@arcgis/core 4.24.0-next.20220427 → 4.24.0-next.20220430

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 (276) hide show
  1. package/WebMap.js +1 -1
  2. package/analysis/LineOfSightAnalysis.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{3a43a2918b44781aaf85.js → 055a0ebf22a82f859474.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{3273b6be43eeb49ee842.js → 0b12ff7b2ed2838afbb8.js} +1 -1
  6. package/assets/esri/core/workers/chunks/0e25548573baf855e394.js +1 -0
  7. package/assets/esri/core/workers/chunks/0edd4c3ca6e7d749d0e5.js +1 -0
  8. package/assets/esri/core/workers/chunks/133f971e72a1a6277ac4.js +1 -0
  9. package/assets/esri/core/workers/chunks/{c388ac33496f004d56f3.js → 135a90ae61f3b3cae91b.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{54f9b1ab9d472bf4baca.js → 1facbda248863cf72cbd.js} +1 -1
  11. package/assets/esri/core/workers/chunks/1fb2d7abe6c8efa84695.js +1 -0
  12. package/assets/esri/core/workers/chunks/2133499e642193f6738f.js +1 -0
  13. package/assets/esri/core/workers/chunks/{dee63bfc108b4e5893a3.js → 2cf3934b3ecabdf207c8.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{3c572629f46e5093223c.js → 30333a95dc0a44e23fb5.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{7afe89eafab00afb31f2.js → 30837d93116f0337972f.js} +1 -1
  16. package/assets/esri/core/workers/chunks/31df729c17470245288c.js +2 -0
  17. package/assets/esri/core/workers/chunks/{c0bf663240df7be68131.js.LICENSE.txt → 31df729c17470245288c.js.LICENSE.txt} +1 -1
  18. package/assets/esri/core/workers/chunks/4130ea1f5a9f197168d7.js +1 -0
  19. package/assets/esri/core/workers/chunks/{417ee7a88575cb8f9aaf.js → 492b65fe99641f5740f0.js} +1 -1
  20. package/assets/esri/core/workers/chunks/4cdd29e1f3a1c7a39af7.js +1 -0
  21. package/assets/esri/core/workers/chunks/{9a0073d43b7dbaeba736.js → 541e644fc77dbe527124.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{5a61a12b2492c6eae592.js → 59e341b2db44351bf557.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{73630d52768e3d932f30.js → 5a10b58533b4116115ac.js} +1 -1
  24. package/assets/esri/core/workers/chunks/5fd787f63362defc984f.js +1 -0
  25. package/assets/esri/core/workers/chunks/682a8f15f352de76df69.js +1 -0
  26. package/assets/esri/core/workers/chunks/6a06635089761ee3e6d4.js +972 -0
  27. package/assets/esri/core/workers/chunks/{ab0c0c29d54f2ed954d6.js → 86b31ae136f931d7884a.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{dc193247a1980360ec4f.js → 8e98ff9404a802352037.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{863cfe35ee640bac103f.js → 94e51fe1c539df6257c2.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{cbe7e6283a427a618d4b.js → 9519a02b9b8db88a3150.js} +1 -1
  31. package/assets/esri/core/workers/chunks/9f3a094aa4b47e4eb046.js +1 -0
  32. package/assets/esri/core/workers/chunks/{50d256bc3b213c8a1b09.js → a0ebf25c9c9a7f839b93.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{d8a992dee594a6a64fde.js → a25f0a195f9217665530.js} +1 -1
  34. package/assets/esri/core/workers/chunks/a59ee7d2b98c85f27dd2.js +1 -0
  35. package/assets/esri/core/workers/chunks/{92ef9b0c61640e0ecbb4.js → a5dbab94697757c87c49.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{147d3ee9aa81d7b2b7fa.js → a6406a248b7b2ed65f35.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{ebdf61eb364ac0856f40.js → acbd0f4d72d1f5d8e4e8.js} +1 -1
  38. package/assets/esri/core/workers/chunks/acc97a210f36bff2d1b0.js +1 -0
  39. package/assets/esri/core/workers/chunks/ad68fe924456d6d7d4f0.js +1 -0
  40. package/assets/esri/core/workers/chunks/b06c949fc7d08e376a5f.js +1 -0
  41. package/assets/esri/core/workers/chunks/b4405e9fe6c0cf7250d3.js +1 -0
  42. package/assets/esri/core/workers/chunks/b97a34d2e7cceef1ac41.js +1 -0
  43. package/assets/esri/core/workers/chunks/bc08fe3b03767bd694c5.js +1 -0
  44. package/assets/esri/core/workers/chunks/c9b09099488d0e719dfb.js +1 -0
  45. package/assets/esri/core/workers/chunks/{4a05d0dfa73ff570e1fa.js → d15e6662d90718411d62.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{b74b9dceabbf7b1aec39.js → d16aac3461af9cee0c29.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{bb678bc2e2fc48112e07.js → d60dd3e1028f714f2258.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{31c1ae0532dd991da63d.js → d6c150c243ca1f6108f9.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{cab6decfcb3f596a3837.js → d8c59b1d73650c060dfb.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{d24339b37cc9316e6d99.js → dcb6e1b33402d7fa455b.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{a8da24116180d708cf81.js → df653bca2b14dffc82d1.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{a3db91d04fe1fca0fe4f.js → e06461703e6f1acfcfdc.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{423e199c2f695e913c0e.js → e3e1d87b8532bf84a18d.js} +1 -1
  54. package/assets/esri/core/workers/chunks/e7744b7e0c16bba93151.js +1 -0
  55. package/assets/esri/core/workers/chunks/ea50effc5c39870dc871.js +1 -0
  56. package/assets/esri/core/workers/chunks/fc4fd9db056579e09bfe.js +1 -0
  57. package/assets/esri/core/workers/chunks/fc9b5f40c5179a8c90de.js +1 -0
  58. package/assets/esri/core/workers/chunks/fd35b69872ac9393924f.js +1 -0
  59. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ar.json +1 -1
  60. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_bg.json +1 -1
  61. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_bs.json +1 -1
  62. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ca.json +1 -1
  63. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_cs.json +1 -1
  64. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_da.json +1 -1
  65. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_de.json +1 -1
  66. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_el.json +1 -1
  67. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_es.json +1 -1
  68. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_et.json +1 -1
  69. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_fi.json +1 -1
  70. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_fr.json +1 -1
  71. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_he.json +1 -1
  72. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_hr.json +1 -1
  73. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_hu.json +1 -1
  74. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_id.json +1 -1
  75. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_it.json +1 -1
  76. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ja.json +1 -1
  77. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ko.json +1 -1
  78. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_lt.json +1 -1
  79. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_lv.json +1 -1
  80. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_nb.json +1 -1
  81. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_nl.json +1 -1
  82. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pl.json +1 -1
  83. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pt-BR.json +1 -1
  84. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pt-PT.json +1 -1
  85. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ro.json +1 -1
  86. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ru.json +1 -1
  87. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sk.json +1 -1
  88. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sl.json +1 -1
  89. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sr.json +1 -1
  90. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sv.json +1 -1
  91. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_th.json +1 -1
  92. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_tr.json +1 -1
  93. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_uk.json +1 -1
  94. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_vi.json +1 -1
  95. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-CN.json +1 -1
  96. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-HK.json +1 -1
  97. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-TW.json +1 -1
  98. package/assets/esri/widgets/Weather/t9n/Weather_ar.json +1 -1
  99. package/assets/esri/widgets/Weather/t9n/Weather_bg.json +1 -1
  100. package/assets/esri/widgets/Weather/t9n/Weather_bs.json +1 -1
  101. package/assets/esri/widgets/Weather/t9n/Weather_ca.json +1 -1
  102. package/assets/esri/widgets/Weather/t9n/Weather_cs.json +1 -1
  103. package/assets/esri/widgets/Weather/t9n/Weather_da.json +1 -1
  104. package/assets/esri/widgets/Weather/t9n/Weather_de.json +1 -1
  105. package/assets/esri/widgets/Weather/t9n/Weather_el.json +1 -1
  106. package/assets/esri/widgets/Weather/t9n/Weather_es.json +1 -1
  107. package/assets/esri/widgets/Weather/t9n/Weather_et.json +1 -1
  108. package/assets/esri/widgets/Weather/t9n/Weather_fi.json +1 -1
  109. package/assets/esri/widgets/Weather/t9n/Weather_fr.json +1 -1
  110. package/assets/esri/widgets/Weather/t9n/Weather_he.json +1 -1
  111. package/assets/esri/widgets/Weather/t9n/Weather_hr.json +1 -1
  112. package/assets/esri/widgets/Weather/t9n/Weather_hu.json +1 -1
  113. package/assets/esri/widgets/Weather/t9n/Weather_id.json +1 -1
  114. package/assets/esri/widgets/Weather/t9n/Weather_it.json +1 -1
  115. package/assets/esri/widgets/Weather/t9n/Weather_ja.json +1 -1
  116. package/assets/esri/widgets/Weather/t9n/Weather_ko.json +1 -1
  117. package/assets/esri/widgets/Weather/t9n/Weather_lt.json +1 -1
  118. package/assets/esri/widgets/Weather/t9n/Weather_lv.json +1 -1
  119. package/assets/esri/widgets/Weather/t9n/Weather_nb.json +1 -1
  120. package/assets/esri/widgets/Weather/t9n/Weather_nl.json +1 -1
  121. package/assets/esri/widgets/Weather/t9n/Weather_pl.json +1 -1
  122. package/assets/esri/widgets/Weather/t9n/Weather_pt-BR.json +1 -1
  123. package/assets/esri/widgets/Weather/t9n/Weather_pt-PT.json +1 -1
  124. package/assets/esri/widgets/Weather/t9n/Weather_ro.json +1 -1
  125. package/assets/esri/widgets/Weather/t9n/Weather_ru.json +1 -1
  126. package/assets/esri/widgets/Weather/t9n/Weather_sk.json +1 -1
  127. package/assets/esri/widgets/Weather/t9n/Weather_sl.json +1 -1
  128. package/assets/esri/widgets/Weather/t9n/Weather_sr.json +1 -1
  129. package/assets/esri/widgets/Weather/t9n/Weather_sv.json +1 -1
  130. package/assets/esri/widgets/Weather/t9n/Weather_th.json +1 -1
  131. package/assets/esri/widgets/Weather/t9n/Weather_tr.json +1 -1
  132. package/assets/esri/widgets/Weather/t9n/Weather_uk.json +1 -1
  133. package/assets/esri/widgets/Weather/t9n/Weather_vi.json +1 -1
  134. package/assets/esri/widgets/Weather/t9n/Weather_zh-CN.json +1 -1
  135. package/assets/esri/widgets/Weather/t9n/Weather_zh-HK.json +1 -1
  136. package/assets/esri/widgets/Weather/t9n/Weather_zh-TW.json +1 -1
  137. package/chunks/ColorMaterial.glsl.js +4 -4
  138. package/chunks/LineMarker.glsl.js +12 -12
  139. package/chunks/Pattern.glsl.js +17 -17
  140. package/chunks/RibbonLine.glsl.js +34 -34
  141. package/chunks/ShadedColorMaterial.glsl.js +11 -11
  142. package/chunks/index.js +1 -1
  143. package/chunks/sphere.js +1 -1
  144. package/config.js +1 -1
  145. package/core/workers/RemoteClient.js +1 -1
  146. package/core/workers/WorkerHandle.js +1 -1
  147. package/geometry/support/sphere.js +1 -1
  148. package/interfaces.d.ts +74 -20
  149. package/layers/mixins/PortalLayer.js +1 -1
  150. package/layers/support/LercDecoder.js +1 -1
  151. package/package.json +2 -2
  152. package/request.js +1 -1
  153. package/support/elevationInfoUtils.js +1 -1
  154. package/support/revision.js +1 -1
  155. package/symbols/support/previewSymbol2D.js +1 -1
  156. package/views/2d/engine/brushes.js +1 -1
  157. package/views/2d/engine/vectorTiles/TileParser.js +1 -1
  158. package/views/2d/engine/webgl/GraphicDisplayList.js +1 -1
  159. package/views/2d/engine/webgl/Painter.js +1 -1
  160. package/views/2d/engine/webgl/WGLRendererInfo.js +1 -1
  161. package/views/2d/engine/webgl/brushes/WGLBrushDotDensity.js +5 -0
  162. package/views/2d/engine/webgl/brushes/WGLBrushHeatmap.js +5 -0
  163. package/views/2d/engine/webgl/brushes/WGLGeometryBrush.js +1 -1
  164. package/views/2d/engine/webgl/brushes/WGLGeometryBrushFill.js +1 -1
  165. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js +1 -1
  166. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
  167. package/views/2d/engine/webgl/brushes/WGLGeometryBrushMarker.js +1 -1
  168. package/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js +1 -1
  169. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  170. package/views/2d/engine/webgl/techniques/Technique.js +5 -0
  171. package/views/2d/engine/webgl/techniques/dotDensity/TechniqueDotDensity.js +5 -0
  172. package/views/2d/engine/webgl/techniques/heatmap/TechniqueHeatmap.js +5 -0
  173. package/views/2d/engine/webgl/techniques/utils.js +5 -0
  174. package/views/2d/layers/features/schemaUtils.js +1 -1
  175. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  176. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  177. package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
  178. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  179. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  180. package/views/3d/camera/constraintUtils/distance.js +1 -1
  181. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  182. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  183. package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
  184. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  185. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  186. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  187. package/views/3d/layers/I3SMeshView3D.js +1 -1
  188. package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
  189. package/views/3d/layers/I3SPointsWorkerHandle.js +1 -1
  190. package/views/3d/layers/PointCloudWorkerHandle.js +1 -1
  191. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  192. package/views/3d/layers/i3s/I3SElevationProvider.js +1 -1
  193. package/views/3d/layers/i3s/I3SNode.js +1 -1
  194. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  195. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  196. package/views/3d/state/utils/navigationUtils.js +1 -1
  197. package/views/3d/support/PBFDecoder.js +1 -1
  198. package/views/3d/support/geometryUtils/sphere.js +1 -1
  199. package/views/3d/terrain/OverlayManager.js +1 -1
  200. package/views/3d/terrain/OverlayRenderer.js +1 -1
  201. package/views/3d/terrain/PatchRenderData.js +1 -1
  202. package/views/3d/terrain/TerrainSurface.js +1 -1
  203. package/views/3d/terrain/Tile.js +1 -1
  204. package/views/3d/terrain/tileUtils.js +1 -1
  205. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  206. package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRangeRunLengthEncoded.js +1 -1
  207. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
  208. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  209. package/views/3d/webgl-engine/lib/edgeRendering/EdgeProcessingWorker.js +1 -1
  210. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  211. package/views/3d/webgl-engine/lib/edgeRendering/EdgeWorkerHandle.js +1 -1
  212. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  213. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  214. package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +1 -1
  215. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  216. package/views/interactive/snapping/LineSnapper.js +1 -1
  217. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  218. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  219. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  220. package/views/interactive/snapping/SnappingManager.js +1 -1
  221. package/views/interactive/snapping/candidates/EdgeSnappingCandidate.js +1 -1
  222. package/views/interactive/snapping/candidates/FeatureSnappingCandidate.js +1 -1
  223. package/views/interactive/snapping/candidates/IntersectionSnappingCandidate.js +1 -1
  224. package/views/interactive/snapping/candidates/LineSnappingCandidate.js +1 -1
  225. package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
  226. package/views/interactive/snapping/candidates/RightAngleSnappingCandidate.js +1 -1
  227. package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
  228. package/views/interactive/snapping/candidates/SnappingCandidate.js +1 -1
  229. package/views/interactive/snapping/candidates/VertexSnappingCandidate.js +1 -1
  230. package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
  231. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  232. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  233. package/views/interactive/snapping/featureSources/SceneLayerSnappingSource.js +5 -0
  234. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  235. package/views/interactive/snapping/featureSources/queryEngineUtils.js +1 -1
  236. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +5 -0
  237. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorkerHandle.js +5 -0
  238. package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
  239. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  240. package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
  241. package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
  242. package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
  243. package/views/interactive/snapping/hints/SnappingHint.js +1 -1
  244. package/views/interactive/snapping/snappingUtils.js +1 -1
  245. package/views/support/colorUtils.js +1 -1
  246. package/webmap/Bookmark.js +1 -1
  247. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  248. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  249. package/widgets/FeatureTable/Grid/Grid.js +2 -2
  250. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  251. package/widgets/Sketch/SketchViewModel.js +1 -1
  252. package/widgets/Slice/SliceViewModel.js +1 -1
  253. package/widgets/support/AnalysisViewModel.js +1 -1
  254. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  255. package/assets/esri/core/workers/chunks/2266d6388444ac5d50b3.js +0 -1
  256. package/assets/esri/core/workers/chunks/3f6b17c9d2629ed396da.js +0 -1
  257. package/assets/esri/core/workers/chunks/404f1d7bce014c7e6965.js +0 -1
  258. package/assets/esri/core/workers/chunks/4e4994665549435f51ee.js +0 -1
  259. package/assets/esri/core/workers/chunks/503226c5c612feab4115.js +0 -1
  260. package/assets/esri/core/workers/chunks/528033aa0d663b4d41bf.js +0 -1
  261. package/assets/esri/core/workers/chunks/54af957c5330933805a3.js +0 -1
  262. package/assets/esri/core/workers/chunks/6ef8de3aa9a8d9c22161.js +0 -1
  263. package/assets/esri/core/workers/chunks/72d8b2ad36f0d0a40a0d.js +0 -1
  264. package/assets/esri/core/workers/chunks/756befc4aa3354e1db1d.js +0 -972
  265. package/assets/esri/core/workers/chunks/8a4e2831e8fdde530b21.js +0 -1
  266. package/assets/esri/core/workers/chunks/9b9821772b6cbe189fe0.js +0 -1
  267. package/assets/esri/core/workers/chunks/9c4d41f20c1a94147344.js +0 -1
  268. package/assets/esri/core/workers/chunks/9cfd66ee9e6328b3693a.js +0 -1
  269. package/assets/esri/core/workers/chunks/b548bf032c8af34fe155.js +0 -1
  270. package/assets/esri/core/workers/chunks/bbcae04235830debd814.js +0 -1
  271. package/assets/esri/core/workers/chunks/bc6f5927f07c5993b998.js +0 -1
  272. package/assets/esri/core/workers/chunks/c0bf663240df7be68131.js +0 -2
  273. package/assets/esri/core/workers/chunks/cd9668acbe3babd2b188.js +0 -1
  274. package/assets/esri/core/workers/chunks/d53c7a9ede56be749f2b.js +0 -1
  275. package/assets/esri/core/workers/chunks/e07930ab66f89d215666.js +0 -1
  276. package/assets/esri/core/workers/chunks/f72de828ede4d0c5e9d7.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{ByteSizeUnit as s}from"../../../core/byteSizeEstimations.js";import r from"../../../core/Collection.js";import o from"../../../core/has.js";import a from"../../../core/Logger.js";import{someMap as n}from"../../../core/MapUtils.js";import{unwrapOr as l,destroyMaybe as d,isSome as h,isNone as c,applySome as u,unwrap as m}from"../../../core/maybe.js";import _ from"../../../core/PooledArray.js";import{throwIfAborted as g,createResolver as p}from"../../../core/promiseUtils.js";import{initial as f,watch as b}from"../../../core/reactiveUtils.js";import{schedule as y}from"../../../core/scheduling.js";import{isArrayBuffer as I}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as v}from"../../../core/unitUtils.js";import{property as M}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as C}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as O}from"../../../chunks/mat3f32.js";import{m as S,B as j}from"../../../chunks/mat4.js";import{b as E,c as w}from"../../../chunks/mat4f64.js";import{m as N,c as D}from"../../../chunks/vec3.js";import{c as R}from"../../../chunks/vec3f64.js";import{s as T}from"../../../chunks/vec4.js";import{f as F}from"../../../chunks/vec4f64.js";import{projectBuffer as P,getProjectorName as A,localLinearScaleFactors as V,projectVectorToVector as U,projectBoundingSphere as H}from"../../../geometry/projection.js";import{create as G,empty as L,expandWithBuffer as B,toRect as k}from"../../../geometry/support/aaBoundingBox.js";import{create as q,intersects as z}from"../../../geometry/support/aaBoundingRect.js";import K from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as W}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as $}from"../../../layers/support/layerUtils.js";import X from"../../../layers/support/SceneModification.js";import{getColor as Y,getOpacity as Q}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as J}from"../../../support/arcadeOnDemand.js";import Z from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as ee}from"../../../symbols/support/unitConversionUtils.js";import te from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as ie,toWasmModification as se}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as re,ForAllFeaturesReturnType as oe}from"./II3SMeshView3D.js";import{initialize as ae,setModificationsSync as ne,filterObbsForModificationsSync as le,interpretObbModificationResults as de}from"./SceneLayerWorker.js";import{overrideColor as he}from"./graphics/graphicUtils.js";import{TextureUsage as ce,TextureEncoding as ue}from"./i3s/enums.js";import me from"./i3s/Highlights.js";import{I3SAttributeOverrides as _e}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as ge,NodeCrossfadeMetaData as pe}from"./i3s/I3SCrossfadeHelper.js";import fe from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as be}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as ye}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Ie,selectEncoding as ve,defaultMaterial as Me,createTexture as Ce,configureMaterial as xe}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as Oe,NodeState as Se}from"./i3s/I3SNode.js";import{computeGlobalTransformation as je,getLocalOrigin as Ee}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as we,checkSceneLayerValid as Ne,checkSceneLayerCompatibleWithView as De,getCacheKeySuffix as Re,whenGraphicAttributes as Te,computeVisibilityObb as Fe,filterInPlace as Pe,getCachedAttributeValue as Ae,intersectBoundingRectWithMbs as Ve,MbsIntersectResult as Ue,addWraparound as He,getSymbolInfo as Ge,transparentEdgeMaterial as Le,getClipRect as Be}from"./i3s/I3SUtil.js";import{IDBCache as ke}from"./i3s/IDBCache.js";import{IDBMockCache as qe}from"./i3s/IDBMockCache.js";import{attributeLookup as ze}from"./support/attributeUtils.js";import{ColorMixModeEnum as Ke}from"./support/symbolColorUtils.js";import We from"../support/debugFlags.js";import{toBoundingRect as $e}from"../support/extentUtils.js";import{create as Xe,clone as Ye}from"../support/orientedBoundingBox.js";import{updatingProgress as Qe}from"../support/updatingProperties.js";import{glLayout as Je}from"../support/buffer/glUtil.js";import{State as Ze}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as et}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as tt}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as it}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as st}from"../webgl-engine/lib/edgeRendering/interfaces.js";const rt=a.getLogger("esri.views.3d.layers.SceneLayerView3D"),ot=[1,1,1,1];class at extends pe{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var nt;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(nt||(nt={}));const lt=19,dt=100*s.MEGABYTES,ht=t=>{let s=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._idbCache=o("enable-feature:idb-mock-cache")?new qe:new ke("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new ge(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return we(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?ce.AllTexturesPBR:ce.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?ce.GeometryTexturesPBR:ce.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=v(this.i3slayer.spatialReference),i=ee(e.unit);return l(e.offset,0)*i/t}return 0}get supportedTextureEncodings(){return Ie(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var e;const t=null==(e=this.view)?void 0:e.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,i=0==(this.supportedTextureEncodings&ue.DDS_S3TC);return t&&i}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new _e(this.i3slayer,e.memoryController),this._worker=new ie((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),Ne(this.i3slayer),De(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new K({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new me({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,re.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>h(this._controller.index)&&h(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,h(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new ye({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new fe({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),f),this.updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add((()=>this.filter),(()=>this._filterChange()),f),this.updatingHandles.add((()=>this.view.qualitySettings.physicallyBasedRenderingEnabled),(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),s),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),s),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),f),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),f),this.handles.add([b((()=>We.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&We.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||We.I3S_TREE_SHOW_TILES||(this._treeDebugger=d(this._treeDebugger))}),f),b((()=>We.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),f)]),this._cacheKeySuffix=Re(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>rt.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=d(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=d(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=d(this._labeler),this._treeDebugger=d(this._treeDebugger),this._controller=d(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(h(e)){const t=e.estimatedTexMemRequired;this.gpuMemoryEstimate-=t,this.texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this.gpuMemoryEstimate+=t,this.geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this.gpuMemoryEstimate-=t,this.geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=h(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=h(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=h(t)?t.node.memory:0)),e}getUnloadedMemory(){return(h(this._controller)?this._controller.unloadedMemoryEstimate:0)+(h(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!($(this.i3slayer)&&this._supportsLabeling))return void(h(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(h(this._labeler))return;const e=new te({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>h(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=ae().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=se(this._layerClippingArea,this._modifications,t);ne({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new _:null;this._nodeId2Meta.forEach(((e,t)=>{c(e)?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):h(s)&&s.push(e.node)})),h(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),h(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==Oe.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),h(t)?(this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t)):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(h(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!We.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);h(i)&&h(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);h(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,h(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){h(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>h(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!o("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&ue.Basis)&&u(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&it()}_getVertexBufferLayout(e,t){const i={hasTexture:bt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Je(et(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=ze(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return n(this._nodeId2Meta,(e=>{if(c(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(c(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=ze(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._nodeId2Meta.get(t.node.index);if(c(i))return Promise.reject();const s=i.objectHandle,r=be(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(P(r,o,0,r,a,0,8)){const e=L();return B(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Te(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(h)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return c(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${lt}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return h(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){h(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(c(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){var r;const o=null!=(r=null==e?void 0:e.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(c(t))return!0;const s=ve(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(c(r)||null==r.data||s&&r.encoding!==s.encoding)})))?r:[];return 0===o.length?Promise.resolve(!1):i(o,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&h(s.textureData)&&(s.byteSize=vt(s.transformedGeometry,s.textureData),s.textureData.every(It)&&Mt(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>rt.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),g(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return yt(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(c(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,u=je(e.mbs,this.elevationOffset,l,d);e.geometryObb=Xe([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),N(e.geometryObb.center,e.geometryObb.center,u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a));const m={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:u,geometryObb:e.geometryObb,byteSize:vt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&Mt(e,m)){const t=h(m.textureData)?m.textureData.map((e=>It(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{...m,textureData:t}).catch((t=>rt.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,m,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return Fe(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let c=0;c<s.length;++c)r[c]=this._getVertexBufferLayout(s[c],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=Ee(o,a,n),u=je(o,a,n,d),m=A(n,l),_=A(l,d);if(c(m)||c(_))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:u,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:m,vertexToRenderProjector:_};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){var e,t;return!(null!=(e=this.view)&&null!=(t=e._stage)&&t.renderView.shadowsEnabled)}get nodeCrossfadingEnabled(){return this.supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this.supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(e.geometryObb=Ye(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);h(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,Ze.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),h(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){var s;if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(c(t))return void this._addNodeMeta(e.index,null);const r=this._addTasks.get(e.index),{geometryData:a,transformedGeometry:n,globalTrafo:l}=t;await this.attributeOverrides.apply(a.featureIds,r.attributeInfo,i);const d=h(t.textureData)?t.textureData.filter((e=>h(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!o("disable-feature:i3s-basis")&&d.some((e=>h(e)&&(e.encoding===ue.Basis||e.encoding===ue.KTX2)))&&await it(),e.memory=0;const{componentOffsets:u,geometries:_,featureIds:g}=a,p=this._collection,f=_[0],{layout:b,indices:y,interleavedVertexData:I,positionData:v,hasColors:M}=n,C=this._materialParameters(f,b),N=u||new Uint32Array([0,y?y.length:I.byteLength/b[0].stride]),D={vertices:{data:I,count:I.byteLength/b[0].stride,layoutParameters:C.geometryParams},positionData:{positions:v.data,indices:v.indices},indices:y,componentOffsets:N},T=f.transformation?E(f.transformation):w();S(T,l,T);const P=j(R(),T),A=x(O(),T),H=this.view.renderSpatialReference,G=this.view.basemapTerrain.spatialReference,L=R(),B=[1,1,1];V(P,H,B,G)||rt.errorOnce("Unsupported coordinate system for IM overlay"),U(P,H,L,G);const k=p.createObject({toMapSpace:F(L[0],L[1],B[0],B[1]),geometry:D,obb:m(e.geometryObb),transform:{position:P,rotationScale:A}}),q=C.geometryParams.textureCoordinates===tt.Atlas,{textures:z,texturePromise:K}=this._initMaterialAndTextures(k,C.material,d,q);e.memory+=this._memEstimateGeometryAdded(k),e.memory+=z.reduce(((e,t)=>e+(h(t)?this._memEstimateTextureAdded(t):0)),0);const W=!!C.material.hasParametersFromSource,$="blend"!==C.material.alphaMode&&C.material.metallicRoughness.baseColorFactor[3]>=1,X=new at(e,g,k,this._getInvalidRendererVersion(),r.attributeInfo,{hasParametersFromSource:W,isOpaque:$},z);r.meta=X,!this._hasTextures&&null!=(s=t.requiredTextures)&&s.some((({usage:e})=>0!=(e&ce.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||M,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const Y=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(X),K]).then((([t,s])=>(h(t)&&t.updateObjectVisibility(X.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(h(this._labeler)&&this._addMetaToLabeler(this._labeler,X),this._addNodeMeta(e.index,X),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);p.setObjectVisibility(k,Ze.Visible),h(t)&&t.updateObjectVisibility(X.objectHandle,!0),X.attributeInfo=i.attributeInfo;const s=X.cachedRendererVersion!==this._rendererVersion,r=Y!==this.slicePlaneEnabled;this._setObjectSymbolColors(X);const o=this._applyFiltersToNode(X);(s||h(t)&&(r||o))&&this._addOrUpdateEdgeRendering(X),this._visibleGeometryChanged(X),this._highlights.objectCreated(X),this._updateMaterial(X),this._setNewNodeOpacity(X),h(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw h(r.meta)&&(this._cacheGPUData(r.meta),r.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){rt.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);h(t)&&this._deleteComponentObject(t)}else this._controller.updateLoadStatus(e,!0);h(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Ot(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_safeReschedule(e,t){return g(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=h(e.params.material)?e.params.material:Me(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=bt(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Ce(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=xe(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR(),isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?tt.Atlas:tt.Default:tt.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...p(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{h(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=q();this._renderClippingArea=$e(this.view.clippingArea,i,e)?i:null;const s=q();this._layerClippingArea=$e(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{h(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e))}))}getFilters(){const e=[],t=this._renderClippingArea;return h(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(h(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=h(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Pe(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Ae(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return H(e.node.mbs,this._controller.crsIndex,ft,this.view.renderSpatialReference),Ve(t,ft)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,ct),k(ct,ut),z(i,ut)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Ue.INSIDE)return;if(r===Ue.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(mt,i,t.objectHandle);Pe(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(c(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={hasSlicePlane:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Ot(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(h(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);c(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,Ze.Hidden),h(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s),h(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),h(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(h(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===Se.Hole))}_invalidateAllSymbols(){this._rendererVersion=He(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return He(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=He(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await J()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:rt.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&rt.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(e,i)=>{const s=5*e;T(i.externalColor,t[s+0]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255),i.externalColorMixMode=t[s+4]&(1<<nt.CastShadows)-1,i.castShadows=0!=(t[s+4]&1<<nt.CastShadows),i.pickable=0!=(t[s+4]&1<<nt.Pickable)}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof Z))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Ge(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=h(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?h(this._rendererFields)&&this._rendererFields.length>0?W(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=h(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&h(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&h(this._symbologyFields))for(const h of this._symbologyFields){const e=r[h];e&&(n.push(h),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:gt,castShadows:!0,pickable:!0,colorMixMode:Ke.Multiply,edgeMaterial:null},u=this.fullOpacity,m=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let _=null,g=st.OPAQUE,p=Le,f=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a)for(let e=0;e<n.length;e++)i[n[e]]=Ae(l[e],b);const r=this._getSymbolInfo(s,t);let u=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=Y(this._colorVariable,t,{color:pt,arcade:this._arcade});e&&(u=gt,u[0]=e.r/255,u[1]=e.g/255,u[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=Q(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;u=c(u)||c(y)?he(u,y,e.color,e.alpha,ot,gt):he(u,y,null,null,ot,gt)}if(c(u)&&(u=gt,u[0]=1,u[1]=1,u[2]=1,u[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:Ke.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,h(this._symbologyOverride)&&(d.color=u,this._symbologyOverride(t,d),u=d.color),h(d.edgeMaterial)){const t=u[3]<=0?st.INVISIBLE:u[3]>=1&&(e.material.isOpaque||d.colorMixMode===Ke.Replace)?st.OPAQUE:st.TRANSPARENT;d.edgeMaterial===_&&t===g||(p={...d.edgeMaterial,opacity:m,objectTransparency:t},_=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=p}else e.cachedEdgeMaterials[b]=Le;e.cachedSymbology[f+0]=Math.round(255*u[0]),e.cachedSymbology[f+1]=Math.round(255*u[1]),e.cachedSymbology[f+2]=Math.round(255*u[2]),e.cachedSymbology[f+3]=Math.round(255*u[3]),e.cachedSymbology[f+4]=d.colorMixMode|+d.castShadows<<nt.CastShadows|+d.pickable<<nt.Pickable,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||Ot(t,this.fullOpacity),c(e.filteredIds)){return{hasEdges:t.some((e=>e!==Le)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?Le:(s=s||t!==Le,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Ot(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR(),this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),h(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.hasSlicePlane=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{c(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){h(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=re.VISIBLE_ONLY){n(this._nodeId2Meta,(s=>{if(c(s))return!1;if(h(t)){switch(t(s)){case oe.EXIT:return!0;case oe.SKIP:return!1}}let r=oe.CONTINUE;switch(i){case re.ALL:r=this._forAllFeaturesOfNode(s,e);break;case re.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case re.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===oe.EXIT}))}_forAllFeaturesOfNode(e,t){let i=oe.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===oe.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=oe.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===oe.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(c(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===Ue.OUTSIDE)return oe.CONTINUE;if(i===Ue.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=oe.CONTINUE,r=e.featureIds,o=e.objectHandle,a=Be(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===oe.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=h(t.attributeInfo)&&t.attributeInfo.attributeData;if(h(s))for(const r of Object.keys(s))i[r]=Ae(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof r&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>ze(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return xt}_visibleGeometryChanged(e){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=y((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return h(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),oe.CONTINUE)),null,re.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return h(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);h(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(c(this._edgeView)||!e.cachedEdgeMaterials)return;Ot(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&h(this._layerClippingArea)||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=Ct(e);if(h(s)){const t={context:i,buffer:s.buffer};le(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=de(i);e.imModificationImpact=s,s!==Oe.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||h(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}};return e([M()],s.prototype,"_hasLoadedPBRTextures",void 0),e([M()],s.prototype,"_asyncModuleLoading",void 0),e([M()],s.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([M()],s.prototype,"view",void 0),e([M()],s.prototype,"i3slayer",void 0),e([M()],s.prototype,"_controller",void 0),e([M()],s.prototype,"_labeler",void 0),e([M()],s.prototype,"updating",void 0),e([M()],s.prototype,"suspended",void 0),e([M()],s.prototype,"holeFilling",void 0),e([M(Qe)],s.prototype,"updatingProgress",void 0),e([M({readOnly:!0,aliasOf:"_controller.updatingProgress"})],s.prototype,"updatingProgressValue",void 0),e([M({readOnly:!0})],s.prototype,"hasTexturesOrVertexColors",null),e([M({readOnly:!0})],s.prototype,"rendererTextureUsage",null),e([M()],s.prototype,"filter",void 0),e([M({readOnly:!0})],s.prototype,"elevationOffset",null),e([M({type:Boolean})],s.prototype,"slicePlaneEnabled",void 0),e([M()],s.prototype,"supportedTextureEncodings",null),e([M()],s.prototype,"uncompressedTextureDownsamplingEnabled",null),e([M({type:[X]})],s.prototype,"_modifications",void 0),s=e([C("esri.views.3d.layers.I3SMeshView3D")],s),s},ct=G(),ut=q(),mt=q(),_t=Xe(),gt=[0,0,0,0],pt=new t([0,0,0,0]),ft=[0,0,0,0];function bt(e){if(c(e))return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function yt(e){return"geometryData"in e}function It(e){return h(e)&&I(e.data)}function vt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(h(t))for(const s of t)h(s)&&I(s.data)&&(i+=s.data.byteLength);return i}function Mt(e,t){return t.byteSize>dt?(rt.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function Ct(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;c(s)&&(s=_t,D(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const xt={remove(){},pause(){},resume(){}};function Ot(e,t){e.forEach((e=>e.opacity=t))}export{ht as I3SMeshView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{removeUnordered as s}from"../../../core/arrayUtils.js";import{ByteSizeUnit as r}from"../../../core/byteSizeEstimations.js";import o from"../../../core/Collection.js";import a from"../../../core/has.js";import n from"../../../core/Logger.js";import{someMap as l}from"../../../core/MapUtils.js";import{unwrapOr as d,destroyMaybe as h,isSome as c,isNone as u,applySome as _,unwrap as m}from"../../../core/maybe.js";import g from"../../../core/PooledArray.js";import{throwIfAborted as p,createResolver as f}from"../../../core/promiseUtils.js";import{initial as b,watch as y}from"../../../core/reactiveUtils.js";import{schedule as I}from"../../../core/scheduling.js";import{isArrayBuffer as v}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as M}from"../../../core/unitUtils.js";import{property as C}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as x}from"../../../core/accessorSupport/decorators/subclass.js";import{f as O}from"../../../chunks/mat3.js";import{c as S}from"../../../chunks/mat3f32.js";import{m as E,B as j}from"../../../chunks/mat4.js";import{b as w,c as D}from"../../../chunks/mat4f64.js";import{m as T,c as N}from"../../../chunks/vec3.js";import{c as R}from"../../../chunks/vec3f64.js";import{s as F}from"../../../chunks/vec4.js";import{f as A}from"../../../chunks/vec4f64.js";import{projectBuffer as P,getProjectorName as V,localLinearScaleFactors as U,projectVectorToVector as H,projectBoundingSphere as G}from"../../../geometry/projection.js";import{create as L,empty as B,expandWithBuffer as k,toRect as q}from"../../../geometry/support/aaBoundingBox.js";import{create as z,intersects as K}from"../../../geometry/support/aaBoundingRect.js";import W from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as $}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as X}from"../../../layers/support/layerUtils.js";import Y from"../../../layers/support/SceneModification.js";import{getColor as Q,getOpacity as J}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as Z}from"../../../support/arcadeOnDemand.js";import ee from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as te}from"../../../symbols/support/unitConversionUtils.js";import ie from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as se,toWasmModification as re}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as oe,ForAllFeaturesReturnType as ae}from"./II3SMeshView3D.js";import{initialize as ne,setModificationsSync as le,filterObbsForModificationsSync as de,interpretObbModificationResults as he}from"./SceneLayerWorker.js";import{overrideColor as ce}from"./graphics/graphicUtils.js";import{TextureUsage as ue,TextureEncoding as _e}from"./i3s/enums.js";import me from"./i3s/Highlights.js";import{I3SAttributeOverrides as ge}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as pe,NodeCrossfadeMetaData as fe}from"./i3s/I3SCrossfadeHelper.js";import be from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as ye}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Ie}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as ve,selectEncoding as Me,defaultMaterial as Ce,createTexture as xe,configureMaterial as Oe}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as Se,NodeState as Ee}from"./i3s/I3SNode.js";import{computeGlobalTransformation as je,getLocalOrigin as we}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as De,checkSceneLayerValid as Te,checkSceneLayerCompatibleWithView as Ne,getCacheKeySuffix as Re,whenGraphicAttributes as Fe,computeVisibilityObb as Ae,filterInPlace as Pe,getCachedAttributeValue as Ve,intersectBoundingRectWithMbs as Ue,MbsIntersectResult as He,addWraparound as Ge,getSymbolInfo as Le,transparentEdgeMaterial as Be,getClipRect as ke}from"./i3s/I3SUtil.js";import{IDBCache as qe}from"./i3s/IDBCache.js";import{IDBMockCache as ze}from"./i3s/IDBMockCache.js";import{attributeLookup as Ke}from"./support/attributeUtils.js";import{ColorMixModeEnum as We}from"./support/symbolColorUtils.js";import $e from"../support/debugFlags.js";import{toBoundingRect as Xe}from"../support/extentUtils.js";import{create as Ye,clone as Qe}from"../support/orientedBoundingBox.js";import{updatingProgress as Je}from"../support/updatingProperties.js";import{glLayout as Ze}from"../support/buffer/glUtil.js";import{State as et}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as tt}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as it}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as st}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as rt}from"../webgl-engine/lib/edgeRendering/interfaces.js";const ot=n.getLogger("esri.views.3d.layers.SceneLayerView3D"),at=[1,1,1,1];class nt extends fe{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var lt;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(lt||(lt={}));const dt=19,ht=100*r.MEGABYTES,ct=t=>{let r=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._idbCache=a("enable-feature:idb-mock-cache")?new ze:new qe("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new pe(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return De(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?ue.AllTexturesPBR:ue.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?ue.GeometryTexturesPBR:ue.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=M(this.i3slayer.spatialReference),i=te(e.unit);return d(e.offset,0)*i/t}return 0}get supportedTextureEncodings(){return ve(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var e;const t=null==(e=this.view)?void 0:e.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,i=0==(this.supportedTextureEncodings&_e.DDS_S3TC);return t&&i}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new ge(this.i3slayer,e.memoryController),this._worker=new se((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),Te(this.i3slayer),Ne(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new W({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new me({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,oe.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>c(this._controller.index)&&c(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,c(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new Ie({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new be({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),b),this.updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add((()=>this.filter),(()=>this._filterChange()),b),this.updatingHandles.add((()=>this.view.qualitySettings.physicallyBasedRenderingEnabled),(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),s),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),s),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),b),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),b),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),b),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),b),this.handles.add([y((()=>$e.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&$e.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||$e.I3S_TREE_SHOW_TILES||(this._treeDebugger=h(this._treeDebugger))}),b),y((()=>$e.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),b)]),this._cacheKeySuffix=Re(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>ot.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=h(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=h(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=h(this._labeler),this._treeDebugger=h(this._treeDebugger),this._controller=h(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(c(e)){const t=e.estimatedTexMemRequired;this.gpuMemoryEstimate-=t,this.texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this.gpuMemoryEstimate+=t,this.geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this.gpuMemoryEstimate-=t,this.geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=c(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=c(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=c(t)?t.node.memory:0)),e}getUnloadedMemory(){return(c(this._controller)?this._controller.unloadedMemoryEstimate:0)+(c(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(X(this.i3slayer)&&this._supportsLabeling))return void(c(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(c(this._labeler))return;const e=new ie({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>c(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=ne().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=re(this._layerClippingArea,this._modifications,t);le({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new g:null;this._nodeId2Meta.forEach(((e,t)=>{u(e)?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):c(s)&&s.push(e.node)})),c(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),c(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==Se.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),c(t)?(this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t)):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(c(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!$e.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(c(t)&&c(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(c(t)&&c(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);c(i)&&c(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);c(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,c(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){c(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>c(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!a("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&_e.Basis)&&_(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&st()}_getVertexBufferLayout(e,t){const i={hasTexture:It(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Ze(tt(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=Ke(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return l(this._nodeId2Meta,(e=>{if(u(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(u(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=Ke(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._nodeId2Meta.get(t.node.index);if(u(i))return Promise.reject();const s=i.objectHandle,r=ye(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(P(r,o,0,r,a,0,8)){const e=B();return k(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Fe(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(c)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return u(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${dt}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return c(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){c(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(u(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){var r;const o=null!=(r=null==e?void 0:e.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(u(t))return!0;const s=Me(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(u(r)||null==r.data||s&&r.encoding!==s.encoding)})))?r:[];return 0===o.length?Promise.resolve(!1):i(o,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&c(s.textureData)&&(s.byteSize=Ct(s.transformedGeometry,s.textureData),s.textureData.every(Mt)&&xt(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>ot.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),p(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return vt(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(u(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,h=je(e.mbs,this.elevationOffset,l,d);e.geometryObb=Ye([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),T(e.geometryObb.center,e.geometryObb.center,h),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a));const _={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:h,geometryObb:e.geometryObb,byteSize:Ct(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&xt(e,_)){const t=c(_.textureData)?_.textureData.map((e=>Mt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{..._,textureData:t}).catch((t=>ot.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return Ae(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let u=0;u<s.length;++u)r[u]=this._getVertexBufferLayout(s[u],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=we(o,a,n),c=je(o,a,n,d),_=V(n,l),m=V(l,d);if(u(_)||u(m))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:c,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){var e,t;return!(null!=(e=this.view)&&null!=(t=e._stage)&&t.renderView.shadowsEnabled)}get nodeCrossfadingEnabled(){return this.supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this.supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(e.geometryObb=Qe(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);c(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,et.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),c(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){var s;if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(u(t))return void this._addNodeMeta(e.index,null);const r=this._addTasks.get(e.index),{geometryData:o,transformedGeometry:n,globalTrafo:l}=t;await this.attributeOverrides.apply(o.featureIds,r.attributeInfo,i);const d=c(t.textureData)?t.textureData.filter((e=>c(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!a("disable-feature:i3s-basis")&&d.some((e=>c(e)&&(e.encoding===_e.Basis||e.encoding===_e.KTX2)))&&await st(),e.memory=0;const{componentOffsets:h,geometries:_,featureIds:g}=o,p=this._collection,f=_[0],{layout:b,indices:y,interleavedVertexData:I,positionData:v,hasColors:M}=n,C=this._materialParameters(f,b),x=h||new Uint32Array([0,y?y.length:I.byteLength/b[0].stride]),T={vertices:{data:I,count:I.byteLength/b[0].stride,layoutParameters:C.geometryParams},positionData:{positions:v.data,indices:v.indices},indices:y,componentOffsets:x},N=f.transformation?w(f.transformation):D();E(N,l,N);const F=j(R(),N),P=O(S(),N),V=this.view.renderSpatialReference,G=this.view.basemapTerrain.spatialReference,L=R(),B=[1,1,1];U(F,V,B,G)||ot.errorOnce("Unsupported coordinate system for IM overlay"),H(F,V,L,G);const k=p.createObject({toMapSpace:A(L[0],L[1],B[0],B[1]),geometry:T,obb:m(e.geometryObb),transform:{position:F,rotationScale:P}}),q=C.geometryParams.textureCoordinates===it.Atlas,{textures:z,texturePromise:K}=this._initMaterialAndTextures(k,C.material,d,q);e.memory+=this._memEstimateGeometryAdded(k),e.memory+=z.reduce(((e,t)=>e+(c(t)?this._memEstimateTextureAdded(t):0)),0);const W=!!C.material.hasParametersFromSource,$="blend"!==C.material.alphaMode&&C.material.metallicRoughness.baseColorFactor[3]>=1,X=new nt(e,g,k,this._getInvalidRendererVersion(),r.attributeInfo,{hasParametersFromSource:W,isOpaque:$},z);r.meta=X,!this._hasTextures&&null!=(s=t.requiredTextures)&&s.some((({usage:e})=>0!=(e&ue.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||M,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const Y=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(X),K]).then((([t,s])=>(c(t)&&t.updateObjectVisibility(X.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(c(this._labeler)&&this._addMetaToLabeler(this._labeler,X),this._addNodeMeta(e.index,X),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);p.setObjectVisibility(k,et.Visible),c(t)&&t.updateObjectVisibility(X.objectHandle,!0),X.attributeInfo=i.attributeInfo;const s=X.cachedRendererVersion!==this._rendererVersion,r=Y!==this.slicePlaneEnabled;this._setObjectSymbolColors(X);const o=this._applyFiltersToNode(X);(s||c(t)&&(r||o))&&this._addOrUpdateEdgeRendering(X),this._visibleGeometryChanged(X,ut.ADD),this._highlights.objectCreated(X),this._updateMaterial(X),this._setNewNodeOpacity(X),c(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw c(r.meta)&&(this._cacheGPUData(r.meta),r.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){ot.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);c(t)&&this._deleteComponentObject(t)}else this._controller.updateLoadStatus(e,!0);c(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Et(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_safeReschedule(e,t){return p(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=c(e.params.material)?e.params.material:Ce(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=It(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>xe(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Oe(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR(),isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?it.Atlas:it.Default:it.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...f(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{c(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=z();this._renderClippingArea=Xe(this.view.clippingArea,i,e)?i:null;const s=z();this._layerClippingArea=Xe(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{c(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,ut.UPDATE))}))}getFilters(){const e=[],t=this._renderClippingArea;return c(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(c(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=c(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Pe(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Ve(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return G(e.node.mbs,this._controller.crsIndex,yt,this.view.renderSpatialReference),Ue(t,yt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,_t),q(_t,mt),K(i,mt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===He.INSIDE)return;if(r===He.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(gt,i,t.objectHandle);Pe(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(u(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={hasSlicePlane:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Et(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(c(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);u(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,et.Hidden),c(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s,ut.REMOVE),c(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),c(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(c(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);c(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===Ee.Hole))}_invalidateAllSymbols(){this._rendererVersion=Ge(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return Ge(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Ge(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await Z()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:ot.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&ot.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(e,i)=>{const s=5*e;F(i.externalColor,t[s+0]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255),i.externalColorMixMode=t[s+4]&(1<<lt.CastShadows)-1,i.castShadows=0!=(t[s+4]&1<<lt.CastShadows),i.pickable=0!=(t[s+4]&1<<lt.Pickable)}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof ee))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Le(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=c(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?c(this._rendererFields)&&this._rendererFields.length>0?$(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=c(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&c(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&c(this._symbologyFields))for(const c of this._symbologyFields){const e=r[c];e&&(n.push(c),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:ft,castShadows:!0,pickable:!0,colorMixMode:We.Multiply,edgeMaterial:null},h=this.fullOpacity,_=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let m=null,g=rt.OPAQUE,p=Be,f=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a)for(let e=0;e<n.length;e++)i[n[e]]=Ve(l[e],b);const r=this._getSymbolInfo(s,t);let h=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=Q(this._colorVariable,t,{color:bt,arcade:this._arcade});e&&(h=ft,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=J(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;h=u(h)||u(y)?ce(h,y,e.color,e.alpha,at,ft):ce(h,y,null,null,at,ft)}if(u(h)&&(h=ft,h[0]=1,h[1]=1,h[2]=1,h[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:We.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,c(this._symbologyOverride)&&(d.color=h,this._symbologyOverride(t,d),h=d.color),c(d.edgeMaterial)){const t=h[3]<=0?rt.INVISIBLE:h[3]>=1&&(e.material.isOpaque||d.colorMixMode===We.Replace)?rt.OPAQUE:rt.TRANSPARENT;d.edgeMaterial===m&&t===g||(p={...d.edgeMaterial,opacity:_,objectTransparency:t},m=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=p}else e.cachedEdgeMaterials[b]=Be;e.cachedSymbology[f+0]=Math.round(255*h[0]),e.cachedSymbology[f+1]=Math.round(255*h[1]),e.cachedSymbology[f+2]=Math.round(255*h[2]),e.cachedSymbology[f+3]=Math.round(255*h[3]),e.cachedSymbology[f+4]=d.colorMixMode|+d.castShadows<<lt.CastShadows|+d.pickable<<lt.Pickable,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||Et(t,this.fullOpacity),u(e.filteredIds)){return{hasEdges:t.some((e=>e!==Be)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?Be:(s=s||t!==Be,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{u(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Et(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR(),this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,ut.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),c(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{u(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.hasSlicePlane=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{u(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){c(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=oe.VISIBLE_ONLY){l(this._nodeId2Meta,(s=>{if(u(s))return!1;if(c(t)){switch(t(s)){case ae.EXIT:return!0;case ae.SKIP:return!1}}let r=ae.CONTINUE;switch(i){case oe.ALL:r=this._forAllFeaturesOfNode(s,e);break;case oe.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case oe.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===ae.EXIT}))}_forAllFeaturesOfNode(e,t){let i=ae.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===ae.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=ae.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===ae.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(u(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===He.OUTSIDE)return ae.CONTINUE;if(i===He.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=ae.CONTINUE,r=e.featureIds,o=e.objectHandle,a=ke(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===ae.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=c(t.attributeInfo)&&t.attributeInfo.attributeData;if(c(s))for(const r of Object.keys(s))i[r]=Ve(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof o&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>Ke(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return St}_visibleGeometryChanged(e,t){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=I((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))),this._updateSnappingSources(e,t))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return c(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),ae.CONTINUE)),null,oe.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return c(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);c(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);c(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(u(this._edgeView)||!e.cachedEdgeMaterials)return;Et(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&c(this._layerClippingArea)||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=Ot(e);if(c(s)){const t={context:i,buffer:s.buffer};de(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=he(i);e.imModificationImpact=s,s!==Se.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||c(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(u(s))throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return{locations:o,type:"components",objectIds:s.featureIds,origin:r}},remove:()=>{s(this._snappingSourcesTrackers,t)}};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach(((t,i)=>{u(t)||e.add(i,t.node.renderMbs)})),t}_updateSnappingSources(e,t){const{index:i,renderMbs:s}=e.node;for(const r of this._snappingSourcesTrackers)t!==ut.REMOVE&&t!==ut.UPDATE||r.events.remove(i),t!==ut.ADD&&t!==ut.UPDATE||r.events.add(i,s)}};return e([C()],r.prototype,"_hasLoadedPBRTextures",void 0),e([C()],r.prototype,"_asyncModuleLoading",void 0),e([C()],r.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([C()],r.prototype,"view",void 0),e([C()],r.prototype,"i3slayer",void 0),e([C()],r.prototype,"_controller",void 0),e([C()],r.prototype,"_labeler",void 0),e([C()],r.prototype,"updating",void 0),e([C()],r.prototype,"suspended",void 0),e([C()],r.prototype,"holeFilling",void 0),e([C(Je)],r.prototype,"updatingProgress",void 0),e([C({readOnly:!0,aliasOf:"_controller.updatingProgress"})],r.prototype,"updatingProgressValue",void 0),e([C({readOnly:!0})],r.prototype,"hasTexturesOrVertexColors",null),e([C({readOnly:!0})],r.prototype,"rendererTextureUsage",null),e([C()],r.prototype,"filter",void 0),e([C({readOnly:!0})],r.prototype,"elevationOffset",null),e([C({type:Boolean})],r.prototype,"slicePlaneEnabled",void 0),e([C()],r.prototype,"supportedTextureEncodings",null),e([C()],r.prototype,"uncompressedTextureDownsamplingEnabled",null),e([C({type:[Y]})],r.prototype,"_modifications",void 0),r=e([x("esri.views.3d.layers.I3SMeshView3D")],r),r};var ut;!function(e){e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE"}(ut||(ut={}));const _t=L(),mt=z(),gt=z(),pt=Ye(),ft=[0,0,0,0],bt=new t([0,0,0,0]),yt=[0,0,0,0];function It(e){if(u(e))return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function vt(e){return"geometryData"in e}function Mt(e){return c(e)&&v(e.data)}function Ct(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(c(t))for(const s of t)c(s)&&v(s.data)&&(i+=s.data.byteLength);return i}function xt(e,t){return t.byteSize>ht?(ot.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function Ot(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;u(s)&&(s=pt,N(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const St={remove(){},pause(){},resume(){}};function Et(e,t){e.forEach((e=>e.opacity=t))}export{ct as I3SMeshView3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import s from"../../../core/Logger.js";import{isSome as e}from"../../../core/maybe.js";import t from"../../../core/PooledArray.js";import{WorkerHandle as o}from"../../../core/workers/WorkerHandle.js";import{canProjectWithoutEngine as r,projectVectorToVector as p}from"../../../geometry/projection.js";import{ModificationType as h}from"../../../libs/i3s/enums.js";const i=s.getLogger("esri.views.3d.layers.I3SMeshWorkerHandle");class u extends o{constructor(s){super("SceneLayerWorker","process",s,{hasInitialize:!0})}getTransferList(s){return[s.geometryBuffer]}setModifications(s,e,t,o){const r={context:s,modifications:c(e,t,o),isGeodetic:o.isGeographic};this.broadcast(r,"setModifications")}setLegacySchema(s,e){const t=JSON.stringify(e);this.broadcast({context:s,jsonSchema:t},"setLegacySchema")}destroyContext(s){return this.broadcast(s,"destroyContext")}}const n=new t({deallocator:null}),a=[0,0,0];function c(s,t,o){n.clear();let u=1/0,c=1/0,f=-1/0,l=-1/0,m=!1;for(const e of t){const s="clip"===e.type?h.Inside:"mask"===e.type?h.Outside:h.Replace,t=e.geometry;let d=s=>s;if(t.spatialReference){if(!r(t.spatialReference,o)){i.warn("Can't project modification polygon into layer spatial reference, ignoring modification");continue}d=s=>(p(s,t.spatialReference,a,o),a)}else t.hasZ||(a[2]=0,d=s=>(a[0]=s[0],a[1]=s[1],a));m=m||s===h.Outside,n.push(s),n.push(t.rings.length);for(const e of t.rings){n.push(e.length);for(const s of e){const e=d(s);n.push(e[0]),n.push(e[1]),n.push(e[2]),u=Math.min(u,e[0]),c=Math.min(c,e[1]),f=Math.max(f,e[0]),l=Math.max(l,e[1])}}}if(e(s))if(m){const e=1e-4;n.push(h.Inside),n.push(2),n.push(4),n.push(u-e),n.push(c-e),n.push(0),n.push(f+e),n.push(c-e),n.push(0),n.push(f+e),n.push(l+e),n.push(0),n.push(u-e),n.push(l+e),n.push(0),n.push(4),n.push(s[0]),n.push(s[1]),n.push(0),n.push(s[2]),n.push(s[1]),n.push(0),n.push(s[2]),n.push(s[3]),n.push(0),n.push(s[0]),n.push(s[3]),n.push(0)}else n.push(h.Outside),n.push(1),n.push(4),n.push(s[0]),n.push(s[1]),n.push(0),n.push(s[2]),n.push(s[1]),n.push(0),n.push(s[2]),n.push(s[3]),n.push(0),n.push(s[0]),n.push(s[3]),n.push(0);n.push(h.Finished);const d=new Float64Array(n.length);for(let e=0;e<n.length;++e)d[e]=n.getItemAt(e);return d}export{u as I3SMeshWorkerHandle,c as toWasmModification};
5
+ import s from"../../../core/Logger.js";import{isSome as e}from"../../../core/maybe.js";import t from"../../../core/PooledArray.js";import{WorkerHandle as o}from"../../../core/workers/WorkerHandle.js";import{canProjectWithoutEngine as p,projectVectorToVector as r}from"../../../geometry/projection.js";import{ModificationType as h}from"../../../libs/i3s/enums.js";const i=s.getLogger("esri.views.3d.layers.I3SMeshWorkerHandle");class u extends o{constructor(s){super("SceneLayerWorker","process",{process:s=>[s.geometryBuffer]},s,{hasInitialize:!0})}setModifications(s,e,t,o){const p={context:s,modifications:c(e,t,o),isGeodetic:o.isGeographic};this.broadcast(p,"setModifications")}setLegacySchema(s,e){const t=JSON.stringify(e);this.broadcast({context:s,jsonSchema:t},"setLegacySchema")}destroyContext(s){return this.broadcast(s,"destroyContext")}}const n=new t({deallocator:null}),a=[0,0,0];function c(s,t,o){n.clear();let u=1/0,c=1/0,f=-1/0,l=-1/0,m=!1;for(const e of t){const s="clip"===e.type?h.Inside:"mask"===e.type?h.Outside:h.Replace,t=e.geometry;let d=s=>s;if(t.spatialReference){if(!p(t.spatialReference,o)){i.warn("Can't project modification polygon into layer spatial reference, ignoring modification");continue}d=s=>(r(s,t.spatialReference,a,o),a)}else t.hasZ||(a[2]=0,d=s=>(a[0]=s[0],a[1]=s[1],a));m=m||s===h.Outside,n.push(s),n.push(t.rings.length);for(const e of t.rings){n.push(e.length);for(const s of e){const e=d(s);n.push(e[0]),n.push(e[1]),n.push(e[2]),u=Math.min(u,e[0]),c=Math.min(c,e[1]),f=Math.max(f,e[0]),l=Math.max(l,e[1])}}}if(e(s))if(m){const e=1e-4;n.push(h.Inside),n.push(2),n.push(4),n.push(u-e),n.push(c-e),n.push(0),n.push(f+e),n.push(c-e),n.push(0),n.push(f+e),n.push(l+e),n.push(0),n.push(u-e),n.push(l+e),n.push(0),n.push(4),n.push(s[0]),n.push(s[1]),n.push(0),n.push(s[2]),n.push(s[1]),n.push(0),n.push(s[2]),n.push(s[3]),n.push(0),n.push(s[0]),n.push(s[3]),n.push(0)}else n.push(h.Outside),n.push(1),n.push(4),n.push(s[0]),n.push(s[1]),n.push(0),n.push(s[2]),n.push(s[1]),n.push(0),n.push(s[2]),n.push(s[3]),n.push(0),n.push(s[0]),n.push(s[3]),n.push(0);n.push(h.Finished);const d=new Float64Array(n.length);for(let e=0;e<n.length;++e)d[e]=n.getItemAt(e);return d}export{u as I3SMeshWorkerHandle,c as toWasmModification};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{WorkerHandle as r}from"../../../core/workers/WorkerHandle.js";class e extends r{constructor(r){super("SceneLayerWorker","dracoDecompressPointCloudData",r,{hasInitialize:!0})}getTransferList(r){return[r.geometryBuffer]}}export{e as I3SPointsWorkerHandle};
5
+ import{WorkerHandle as e}from"../../../core/workers/WorkerHandle.js";class r extends e{constructor(e){super("SceneLayerWorker","dracoDecompressPointCloudData",{dracoDecompressPointCloudData:e=>[e.geometryBuffer]},e,{hasInitialize:!0})}}export{r as I3SPointsWorkerHandle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../core/maybe.js";import{WorkerHandle as r}from"../../../core/workers/WorkerHandle.js";class e extends r{constructor(t){super("PointCloudWorker","transform",t)}getTransferList(r){const e=[r.geometryBuffer];if(t(r.primaryAttributeData)&&r.primaryAttributeData.buffer&&e.push(r.primaryAttributeData.buffer),t(r.modulationAttributeData)&&r.modulationAttributeData.buffer&&e.push(r.modulationAttributeData.buffer),t(r.filterAttributesData))for(const u of r.filterAttributesData)t(u)&&u.buffer&&e.push(u.buffer);for(const t of r.userAttributesData)t.buffer&&e.push(t.buffer);return e}}export{e as PointCloudWorkerHandle};
5
+ import{isSome as t}from"../../../core/maybe.js";import{WorkerHandle as r}from"../../../core/workers/WorkerHandle.js";class e extends r{constructor(t){super("PointCloudWorker","transform",{transform:t=>this._getTransferList(t)},t)}_getTransferList(r){const e=[r.geometryBuffer];if(t(r.primaryAttributeData)&&r.primaryAttributeData.buffer&&e.push(r.primaryAttributeData.buffer),t(r.modulationAttributeData)&&r.modulationAttributeData.buffer&&e.push(r.modulationAttributeData.buffer),t(r.filterAttributesData))for(const a of r.filterAttributesData)t(a)&&a.buffer&&e.push(a.buffer);for(const t of r.userAttributesData)t.buffer&&e.push(t.buffer);return e}}export{e as PointCloudWorkerHandle};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as s}from"../../../../core/mathUtils.js";import{isNone as e,isSome as r}from"../../../../core/maybe.js";import a from"../../../../core/PooledArray.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as n}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{a as l}from"../../../../chunks/vec2f64.js";import{m as p,g as u,s as d,c as f}from"../../../../chunks/vec3.js";import{Z as m,c as g}from"../../../../chunks/vec3f64.js";import{s as b,t as v,b as y}from"../../../../chunks/vec4.js";import{c as _}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as G}from"../../../../geometry/projectionEllipsoid.js";import{create as S,empty as B,offset as w,width as D,height as N,expand as j,intersects as V}from"../../../../geometry/support/aaBoundingRect.js";import{c as I,a as P,e as C}from"../../../../chunks/boundedPlane.js";import{create as A}from"../../../../geometry/support/ray.js";import{d as x,g as O,e as M,c as T}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as z,prepare as E,drawPoly as F}from"./deconflictorDebug.js";import{VisibilityGroup as X,VisibilityFlag as R}from"./enums.js";import L from"../../support/debugFlags.js";import{Camera as Y}from"../../webgl-engine/lib/Camera.js";import{applyPrecomputedScaleFactor as k}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as W}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as U}from"../../webgl-engine/materials/HUDMaterial.js";const H=g(),Z=_(),q=_(),J=g(),K=h(),Q=T(),$=A(),ii=g(),ti=S();class si{constructor(){this.aabr=S(),this.distance=0,this.culled=!1,this.visible=!1}}class ei{constructor(i,t,s={}){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.info=s}}class ri{constructor(){this.active=new Map,this.visible=new Map}clear(){this.active.clear(),this.visible.clear()}}class ai{}class oi{constructor(){this.sortArray=new a({allocator:i=>i||new ai})}}var ci;!function(i){i[i.Idle=0]="Idle",i[i.Process=1]="Process",i[i.Sort=2]="Sort",i[i.Deconflict=3]="Deconflict",i[i.NumStates=4]="NumStates"}(ci||(ci={}));class ni{constructor(){this.camera=new Y,this.slicePlane=I(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),P(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let hi=class extends t{constructor(){super(...arguments),this._dirty=!1,this._runningViewState=new ni,this._state=ci.Idle,this.graphics=new ri,this.iterators=new oi,this.accBinsNumX=15,this.accBinsNumY=20,this.accBinsSizeX=0,this.accBinsSizeY=0,this.accBins=null,this.accNumTests=0}get dirty(){return this._dirty}get state(){return this._state}destroy(){this.graphics.clear(),this.iterators=null}setDirty(){!this._dirty&&this.graphics.active.size>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==ci.Idle||this._dirty}get updatingProgress(){if(!this.updating)return 1;const i=this._state/ci.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case ci.Idle:this._startUpdate(),i.madeProgress();case ci.Process:if(this._state=ci.Process,!this._processActiveGraphics(i))return;case ci.Sort:if(this._state=ci.Sort,!this._sortVisibleGraphics(i))return;case ci.Deconflict:if(this._state=ci.Deconflict,!this._deconflictVisibleGraphics(i))return;default:z(this,this.graphics.visible),this._state=ci.Idle,this.notifyChange("updating")}}modifyGraphics(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i))),this.setDirty()}layerSupportsDeconfliction(i){if(e(i)||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?t.geometryRecords.length:0))return!1;return t.geometryRecords[0].material instanceof U}_startUpdate(){E(this.view),this._dirty=!1,this._runningViewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._runningViewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.info[this.visibilityGroup]=new si,this.graphics.active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._removeFromVisibleGraphics(i),li(i,this.visibilityGroup),delete i.info[this.visibilityGroup],this.graphics.active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}_addToVisibleGraphics(i){this.graphics.visible.set(i.graphics3DGraphic.graphic.uid,i)}_removeFromVisibleGraphics(i){this.graphics.visible.delete(i.graphics3DGraphic.graphic.uid)}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),s=n(K,this._runningViewState.camera.projectionMatrix),e="global"===this.view.viewingMode&&1===this.view.map.ground.opacity&&this._runningViewState.camera.relativeElevation>0?Q:null;let a=0;for(r(e)&&(p(e,m,this._runningViewState.camera.viewMatrix),e[3]=G(this.view.spatialReference).radius,a=x(e,m));!i.done;){i.madeProgress();const r=t.next();if(!0===r.done)return this._resetActiveGraphicsIterator(),!0;const o=r.value,c=o&&o.info[this.visibilityGroup];c&&(this._collectGraphics3DGraphics(o,s,e,a),c.culled?this._removeFromVisibleGraphics(o):this._addToVisibleGraphics(o))}return!1}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const s=t.next();if(i.madeProgress(),!0===s.done)return this._resetSortGraphicsIterator(),!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),s=this.visibilityGroup===X.LABEL;for(;!i.done;){i.madeProgress();const e=t.next();if(!0===e.done)return this._resetVisibleGraphicsIterator(),!0;const r=e.value,a=r.info[this.visibilityGroup];if(!a||a.culled)continue;const o=r.graphics3DGraphic,c=(!s||o.isVisible())&&!this._isConflicted(r);c&&this._addToBins(r),a.visible=c,this._setGraphicVisibility(r,c),F(a,c)}return!1}_resetIterators(){this.iterators.active=null,this.iterators.visible=null,this.iterators.sort=null}_ensureActiveGraphicsIterator(){return this.iterators.active||(this.iterators.active=pi(this.graphics.active)),this.iterators.active}_resetActiveGraphicsIterator(){this.iterators.active=null}_ensureVisibleGraphicsIterator(){return this.iterators.visible||(this.iterators.visible=pi(this.graphics.visible)),this.iterators.visible}_resetVisibleGraphicsIterator(){this.iterators.visible=null}_ensureSortGraphicsIterator(){return this.iterators.sort||(this.iterators.sort=ui(this.graphics.visible,this.iterators.sortArray,this.visibilityGroup)),this.iterators.sort}_resetSortGraphicsIterator(){this.iterators.sort=null}_collectGraphics3DGraphics(i,t,s,a){const o=i.graphics3DGraphic;if(o.destroyed)return;const c=i.info[this.visibilityGroup];if(!o.isVisible(X.GRAPHIC,R.DECONFLICTION))return void(c.culled=!0);const n=this.getGraphicsLayers(o);B(c.aabr);let h=null;for(const l of n){if(!this.layerSupportsDeconfliction(l))continue;const o=l.stageObject.geometryRecords[0].material;if(e(h)){if(h=this._getProjectionInfo(l,t,mi),h.isOutsideScreen||this._isCulledBySlice(i,H)||r(s)&&this._isCulledByHorizon(h,s,a))return void(c.culled=!0);!L.TESTS_DISABLE_OPTIMIZATIONS&&c.visible&&(h.distance*=.7)}this._expandBoundingRect(c,l,o,h)}e(h)?c.culled=!0:(c.distance=h.distance,c.culled=!1)}_getProjectionInfo(i,t,s){const e=this._runningViewState.camera,r=i.stageObject,a=r.geometryRecords[0],o=a.material,c=O(r.boundingVolumeWorldSpace.bounds);p(H,c,e.viewMatrix);const n=a.geometry.vertexAttributes,h=n.get(W.NORMAL).data,l=n.get(W.AUXPOS1).data;return o.applyShaderOffsetsView(H,h,r.transformation,l,e,s.scaleInfo,H),b(Z,H[0],H[1],H[2],1),v(q,Z,e.projectionMatrix),u(s.positionNDC,q,1/q[3]),o.applyShaderOffsetsNDC(s.positionNDC,l,e,s.positionNDC,J),s.distanceWithoutPolygonOffset=e.depthNDCToWorld(J[2]),s.distance=J[2]===s.positionNDC[2]?s.distanceWithoutPolygonOffset:e.depthNDCToWorld(s.positionNDC[2]),b(q,s.positionNDC[0],s.positionNDC[1],s.positionNDC[2],1),v(Z,q,t),y(Z,Z,1/Z[3]),d(s.positionView,H[0],H[1],H[2]),s}_isCulledByHorizon(i,t,s){return f($.direction,i.positionView),d($.origin,0,0,0),!!M(t,$,ii)&&i.distanceWithoutPolygonOffset>s}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._runningViewState.slicePlaneEnabled&&C(this._runningViewState.slicePlane,t)}_expandBoundingRect(i,t,e,{positionNDC:r,scaleInfo:a}){const o=this._runningViewState.camera,c=t.getScreenSize(di);k(c,a.factor,c),c[0]*=o.pixelRatio,c[1]*=o.pixelRatio;const n=w(e.calculateRelativeScreenBounds(c,a.factorAlignment.scale,ti),s(0,o.fullWidth,.5+.5*r[0]),s(0,o.fullHeight,.5+.5*r[1])),h=this.iconMarginFactor;if(0!==h){const i=h*Math.min(D(n),N(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}j(i.aabr,n,i.aabr)}_isConflicted(i){const t=i.graphics3DGraphic.graphic.uid,s=i.info[this.visibilityGroup];for(let e=Math.floor(s.aabr[0]/this.accBinsSizeX);e<=Math.floor(s.aabr[2]/this.accBinsSizeX);e++)if(!(e<0||e>=this.accBinsNumX))for(let i=Math.floor(s.aabr[1]/this.accBinsSizeY);i<=Math.floor(s.aabr[3]/this.accBinsSizeY);i++){if(i<0||i>=this.accBinsNumY)continue;const r=this.accBins[e][i];for(let i=0;i<r.length;i++){const e=r.data[i],a=e.info[this.visibilityGroup];if(a&&a.visible&&(e.graphics3DGraphic.graphic.uid!==t&&(this.accNumTests++,V(a.aabr,s.aabr))))return!0}}return!1}_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 a)}}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,this.accNumTests=0}_addToBins(i){const t=i.info[this.visibilityGroup],s=Math.floor(t.aabr[0]/this.accBinsSizeX),e=Math.floor(t.aabr[2]/this.accBinsSizeX),r=Math.floor(t.aabr[1]/this.accBinsSizeY),a=Math.floor(t.aabr[3]/this.accBinsSizeY);for(let o=s;o<=e;o++)if(!(o<0||o>=this.accBinsNumX))for(let t=r;t<=a;t++)t<0||t>=this.accBinsNumY||this.accBins[o][t].push(i)}_setGraphicVisibility(i,t){const s=i.graphics3DGraphic;s.destroyed||(s.setVisibilityFlag(R.DECONFLICTION,t,this.visibilityGroup),this.visibilityGroup===X.LABEL&&this.view.labeler.setLabelGraphicVisibility(s,t))}};function li(i,t){const s=i.graphics3DGraphic;s.destroyed||s.clearVisibilityFlag(R.DECONFLICTION,t)}function*pi(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*ui(i,t,s){t.clear(),i.forEach(((i,e)=>{const r=t.pushNew();r.id=e,r.prio=i.info?-i.info[s].distance:Number.MAX_VALUE})),yield;const e=t.iterableSort(((i,t)=>t.prio-i.prio));for(let r=e.next();!r.done;r=e.next())yield;t.forAll((t=>{const s=i.get(t.id);s&&(i.delete(t.id),i.set(t.id,s))})),t.clear()}i([o({constructOnly:!0})],hi.prototype,"view",void 0),i([o({type:Boolean,readOnly:!0})],hi.prototype,"updating",null),hi=i([c("esri.views.3d.layers.graphics.Deconflictor")],hi);const di=l();class fi{constructor(){this.positionView=g(),this.positionNDC=g(),this.distance=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo={factor:{scale:0,factor:0,minPixelSize:0,paddingPixels:0},factorAlignment:{scale:0,factor:0,minPixelSize:0,paddingPixels:0}}}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1}}const mi=new fi;export{hi as Deconflictor,ei as DeconflictorGraphic,ni as DeconflictorViewState,ci as State};
5
+ import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as s}from"../../../../core/mathUtils.js";import{isNone as e,isSome as r}from"../../../../core/maybe.js";import a from"../../../../core/PooledArray.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as n}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{a as l}from"../../../../chunks/vec2f64.js";import{m as p,g as u,s as d,c as f}from"../../../../chunks/vec3.js";import{Z as m,c as g}from"../../../../chunks/vec3f64.js";import{s as b,t as v,b as y}from"../../../../chunks/vec4.js";import{c as _}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as G}from"../../../../geometry/projectionEllipsoid.js";import{create as S,empty as B,offset as w,width as D,height as N,expand as j,intersects as V}from"../../../../geometry/support/aaBoundingRect.js";import{c as I,a as P,e as C}from"../../../../chunks/boundedPlane.js";import{create as A}from"../../../../geometry/support/ray.js";import{e as x,g as O,h as M,c as T}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as z,prepare as E,drawPoly as F}from"./deconflictorDebug.js";import{VisibilityGroup as X,VisibilityFlag as R}from"./enums.js";import L from"../../support/debugFlags.js";import{Camera as Y}from"../../webgl-engine/lib/Camera.js";import{applyPrecomputedScaleFactor as k}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as W}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as U}from"../../webgl-engine/materials/HUDMaterial.js";const H=g(),Z=_(),q=_(),J=g(),K=h(),Q=T(),$=A(),ii=g(),ti=S();class si{constructor(){this.aabr=S(),this.distance=0,this.culled=!1,this.visible=!1}}class ei{constructor(i,t,s={}){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.info=s}}class ri{constructor(){this.active=new Map,this.visible=new Map}clear(){this.active.clear(),this.visible.clear()}}class ai{}class oi{constructor(){this.sortArray=new a({allocator:i=>i||new ai})}}var ci;!function(i){i[i.Idle=0]="Idle",i[i.Process=1]="Process",i[i.Sort=2]="Sort",i[i.Deconflict=3]="Deconflict",i[i.NumStates=4]="NumStates"}(ci||(ci={}));class ni{constructor(){this.camera=new Y,this.slicePlane=I(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),P(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let hi=class extends t{constructor(){super(...arguments),this._dirty=!1,this._runningViewState=new ni,this._state=ci.Idle,this.graphics=new ri,this.iterators=new oi,this.accBinsNumX=15,this.accBinsNumY=20,this.accBinsSizeX=0,this.accBinsSizeY=0,this.accBins=null,this.accNumTests=0}get dirty(){return this._dirty}get state(){return this._state}destroy(){this.graphics.clear(),this.iterators=null}setDirty(){!this._dirty&&this.graphics.active.size>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==ci.Idle||this._dirty}get updatingProgress(){if(!this.updating)return 1;const i=this._state/ci.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case ci.Idle:this._startUpdate(),i.madeProgress();case ci.Process:if(this._state=ci.Process,!this._processActiveGraphics(i))return;case ci.Sort:if(this._state=ci.Sort,!this._sortVisibleGraphics(i))return;case ci.Deconflict:if(this._state=ci.Deconflict,!this._deconflictVisibleGraphics(i))return;default:z(this,this.graphics.visible),this._state=ci.Idle,this.notifyChange("updating")}}modifyGraphics(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i))),this.setDirty()}layerSupportsDeconfliction(i){if(e(i)||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?t.geometryRecords.length:0))return!1;return t.geometryRecords[0].material instanceof U}_startUpdate(){E(this.view),this._dirty=!1,this._runningViewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._runningViewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.info[this.visibilityGroup]=new si,this.graphics.active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._removeFromVisibleGraphics(i),li(i,this.visibilityGroup),delete i.info[this.visibilityGroup],this.graphics.active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}_addToVisibleGraphics(i){this.graphics.visible.set(i.graphics3DGraphic.graphic.uid,i)}_removeFromVisibleGraphics(i){this.graphics.visible.delete(i.graphics3DGraphic.graphic.uid)}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),s=n(K,this._runningViewState.camera.projectionMatrix),e="global"===this.view.viewingMode&&1===this.view.map.ground.opacity&&this._runningViewState.camera.relativeElevation>0?Q:null;let a=0;for(r(e)&&(p(e,m,this._runningViewState.camera.viewMatrix),e[3]=G(this.view.spatialReference).radius,a=x(e,m));!i.done;){i.madeProgress();const r=t.next();if(!0===r.done)return this._resetActiveGraphicsIterator(),!0;const o=r.value,c=o&&o.info[this.visibilityGroup];c&&(this._collectGraphics3DGraphics(o,s,e,a),c.culled?this._removeFromVisibleGraphics(o):this._addToVisibleGraphics(o))}return!1}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const s=t.next();if(i.madeProgress(),!0===s.done)return this._resetSortGraphicsIterator(),!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),s=this.visibilityGroup===X.LABEL;for(;!i.done;){i.madeProgress();const e=t.next();if(!0===e.done)return this._resetVisibleGraphicsIterator(),!0;const r=e.value,a=r.info[this.visibilityGroup];if(!a||a.culled)continue;const o=r.graphics3DGraphic,c=(!s||o.isVisible())&&!this._isConflicted(r);c&&this._addToBins(r),a.visible=c,this._setGraphicVisibility(r,c),F(a,c)}return!1}_resetIterators(){this.iterators.active=null,this.iterators.visible=null,this.iterators.sort=null}_ensureActiveGraphicsIterator(){return this.iterators.active||(this.iterators.active=pi(this.graphics.active)),this.iterators.active}_resetActiveGraphicsIterator(){this.iterators.active=null}_ensureVisibleGraphicsIterator(){return this.iterators.visible||(this.iterators.visible=pi(this.graphics.visible)),this.iterators.visible}_resetVisibleGraphicsIterator(){this.iterators.visible=null}_ensureSortGraphicsIterator(){return this.iterators.sort||(this.iterators.sort=ui(this.graphics.visible,this.iterators.sortArray,this.visibilityGroup)),this.iterators.sort}_resetSortGraphicsIterator(){this.iterators.sort=null}_collectGraphics3DGraphics(i,t,s,a){const o=i.graphics3DGraphic;if(o.destroyed)return;const c=i.info[this.visibilityGroup];if(!o.isVisible(X.GRAPHIC,R.DECONFLICTION))return void(c.culled=!0);const n=this.getGraphicsLayers(o);B(c.aabr);let h=null;for(const l of n){if(!this.layerSupportsDeconfliction(l))continue;const o=l.stageObject.geometryRecords[0].material;if(e(h)){if(h=this._getProjectionInfo(l,t,mi),h.isOutsideScreen||this._isCulledBySlice(i,H)||r(s)&&this._isCulledByHorizon(h,s,a))return void(c.culled=!0);!L.TESTS_DISABLE_OPTIMIZATIONS&&c.visible&&(h.distance*=.7)}this._expandBoundingRect(c,l,o,h)}e(h)?c.culled=!0:(c.distance=h.distance,c.culled=!1)}_getProjectionInfo(i,t,s){const e=this._runningViewState.camera,r=i.stageObject,a=r.geometryRecords[0],o=a.material,c=O(r.boundingVolumeWorldSpace.bounds);p(H,c,e.viewMatrix);const n=a.geometry.vertexAttributes,h=n.get(W.NORMAL).data,l=n.get(W.AUXPOS1).data;return o.applyShaderOffsetsView(H,h,r.transformation,l,e,s.scaleInfo,H),b(Z,H[0],H[1],H[2],1),v(q,Z,e.projectionMatrix),u(s.positionNDC,q,1/q[3]),o.applyShaderOffsetsNDC(s.positionNDC,l,e,s.positionNDC,J),s.distanceWithoutPolygonOffset=e.depthNDCToWorld(J[2]),s.distance=J[2]===s.positionNDC[2]?s.distanceWithoutPolygonOffset:e.depthNDCToWorld(s.positionNDC[2]),b(q,s.positionNDC[0],s.positionNDC[1],s.positionNDC[2],1),v(Z,q,t),y(Z,Z,1/Z[3]),d(s.positionView,H[0],H[1],H[2]),s}_isCulledByHorizon(i,t,s){return f($.direction,i.positionView),d($.origin,0,0,0),!!M(t,$,ii)&&i.distanceWithoutPolygonOffset>s}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._runningViewState.slicePlaneEnabled&&C(this._runningViewState.slicePlane,t)}_expandBoundingRect(i,t,e,{positionNDC:r,scaleInfo:a}){const o=this._runningViewState.camera,c=t.getScreenSize(di);k(c,a.factor,c),c[0]*=o.pixelRatio,c[1]*=o.pixelRatio;const n=w(e.calculateRelativeScreenBounds(c,a.factorAlignment.scale,ti),s(0,o.fullWidth,.5+.5*r[0]),s(0,o.fullHeight,.5+.5*r[1])),h=this.iconMarginFactor;if(0!==h){const i=h*Math.min(D(n),N(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}j(i.aabr,n,i.aabr)}_isConflicted(i){const t=i.graphics3DGraphic.graphic.uid,s=i.info[this.visibilityGroup];for(let e=Math.floor(s.aabr[0]/this.accBinsSizeX);e<=Math.floor(s.aabr[2]/this.accBinsSizeX);e++)if(!(e<0||e>=this.accBinsNumX))for(let i=Math.floor(s.aabr[1]/this.accBinsSizeY);i<=Math.floor(s.aabr[3]/this.accBinsSizeY);i++){if(i<0||i>=this.accBinsNumY)continue;const r=this.accBins[e][i];for(let i=0;i<r.length;i++){const e=r.data[i],a=e.info[this.visibilityGroup];if(a&&a.visible&&(e.graphics3DGraphic.graphic.uid!==t&&(this.accNumTests++,V(a.aabr,s.aabr))))return!0}}return!1}_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 a)}}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,this.accNumTests=0}_addToBins(i){const t=i.info[this.visibilityGroup],s=Math.floor(t.aabr[0]/this.accBinsSizeX),e=Math.floor(t.aabr[2]/this.accBinsSizeX),r=Math.floor(t.aabr[1]/this.accBinsSizeY),a=Math.floor(t.aabr[3]/this.accBinsSizeY);for(let o=s;o<=e;o++)if(!(o<0||o>=this.accBinsNumX))for(let t=r;t<=a;t++)t<0||t>=this.accBinsNumY||this.accBins[o][t].push(i)}_setGraphicVisibility(i,t){const s=i.graphics3DGraphic;s.destroyed||(s.setVisibilityFlag(R.DECONFLICTION,t,this.visibilityGroup),this.visibilityGroup===X.LABEL&&this.view.labeler.setLabelGraphicVisibility(s,t))}};function li(i,t){const s=i.graphics3DGraphic;s.destroyed||s.clearVisibilityFlag(R.DECONFLICTION,t)}function*pi(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*ui(i,t,s){t.clear(),i.forEach(((i,e)=>{const r=t.pushNew();r.id=e,r.prio=i.info?-i.info[s].distance:Number.MAX_VALUE})),yield;const e=t.iterableSort(((i,t)=>t.prio-i.prio));for(let r=e.next();!r.done;r=e.next())yield;t.forAll((t=>{const s=i.get(t.id);s&&(i.delete(t.id),i.set(t.id,s))})),t.clear()}i([o({constructOnly:!0})],hi.prototype,"view",void 0),i([o({type:Boolean,readOnly:!0})],hi.prototype,"updating",null),hi=i([c("esri.views.3d.layers.graphics.Deconflictor")],hi);const di=l();class fi{constructor(){this.positionView=g(),this.positionNDC=g(),this.distance=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo={factor:{scale:0,factor:0,minPixelSize:0,paddingPixels:0},factorAlignment:{scale:0,factor:0,minPixelSize:0,paddingPixels:0}}}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1}}const mi=new fi;export{hi as Deconflictor,ei as DeconflictorGraphic,ni as DeconflictorViewState,ci as State};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import s from"../../../../core/Logger.js";import{isNone as i,isSome as o}from"../../../../core/maybe.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{k as c}from"../../../../chunks/mat4.js";import{c as l}from"../../../../chunks/mat4f64.js";import{m as p,c as d}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{empty as m,expand as f}from"../../../../geometry/support/aaBoundingRect.js";import{newIntersector as u}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as v}from"../../webgl-engine/lib/IntersectorInterfaces.js";const y=m(),x=l(),E=h(),g=h(),j=h(),b=s.getLogger("esri.views.3d.layers.i3s.I3SElevationProvider");let R=class extends(r.EventedMixin(t)){constructor(e){super(e),this.tmpEvent={spatialReference:null,extent:y,context:"scene"}}initialize(){this.view=this.layerView.view,this.renderCoordsHelper=this.view.renderCoordsHelper,this.intersector=u(this.view.state.viewingMode),this.intersector.options.store=v.MIN;const e=this.layerView.i3slayer.fullExtent;i(e)?b.error("I3SElevationProvider expected fullExtent on I3SLayer."):(this.zmin=e.zmin,this.zmax=e.zmax),this.tmpEvent.context=this.intersectionHandler.isGround?"ground":"scene"}getElevation(e,t,r,s){if(E[0]=e,E[1]=t,E[2]=r,!this.renderCoordsHelper.toRenderCoords(E,s,E))return b.error("could not project point to compute elevation"),null;const i=this.layerView.elevationOffset,o=this.zmin+i,n=this.zmax+i;return this.renderCoordsHelper.setAltitude(g,n,E),this.renderCoordsHelper.setAltitude(j,o,E),this.intersector.reset(g,j,null),this.intersectionHandler.intersect(this.intersector,null,g,j),this.intersector.results.min.getIntersectionPoint(E)?this.renderCoordsHelper.getAltitude(E):null}layerChanged(){this.spatialReference&&(this.tmpEvent.extent=this._computeLayerExtent(),this.tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this.tmpEvent))}objectChanged(e){this.spatialReference&&(this.tmpEvent.extent=this._computeObjectExtent(e),this.tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this.tmpEvent))}_computeObjectExtent(e){return m(y),this._expandExtent(e,y),y}_computeLayerExtent(){m(y);for(const e of this.layerView.getVisibleNodes())this._expandExtent(e,y);return y}_expandExtent(e,t){const r=e.visibilityObb||e.serviceObbInRenderSR;if(o(r)){c(x,r.quaternion),x[12]=r.center[0],x[13]=r.center[1],x[14]=r.center[2];for(let e=0;e<8;++e)E[0]=1&e?r.halfSize[0]:-r.halfSize[0],E[1]=2&e?r.halfSize[1]:-r.halfSize[1],E[2]=4&e?r.halfSize[2]:-r.halfSize[2],p(E,E,x),this.renderCoordsHelper.fromRenderCoords(E,E,this.spatialReference),f(t,E,t)}else{const r=e.renderMbs[3],s=d(g,e.renderMbs);s[0]-=r,s[1]-=r,s[2]-=r;const i=d(j,e.renderMbs);i[0]+=r,i[1]+=r,i[2]+=r;for(let e=0;e<8;++e)E[0]=1&e?s[0]:i[0],E[1]=2&e?s[1]:i[1],E[2]=4&e?s[2]:i[2],this.renderCoordsHelper.fromRenderCoords(E,E,this.spatialReference),f(t,E,t)}}};e([n({constructOnly:!0})],R.prototype,"layerView",void 0),e([n({constructOnly:!0})],R.prototype,"intersectionHandler",void 0),e([n()],R.prototype,"view",void 0),e([n({readOnly:!0,aliasOf:"view.elevationProvider.spatialReference"})],R.prototype,"spatialReference",void 0),R=e([a("esri.views.3d.layers.i3s.I3SElevationProvider")],R);const w=R;export{w as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import s from"../../../../core/Logger.js";import{isNone as i,isSome as o}from"../../../../core/maybe.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{k as c}from"../../../../chunks/mat4.js";import{c as l}from"../../../../chunks/mat4f64.js";import{m as p,c as h}from"../../../../chunks/vec3.js";import{c as d}from"../../../../chunks/vec3f64.js";import{empty as m,expand as f}from"../../../../geometry/support/aaBoundingRect.js";import{d as u,g as v}from"../../../../chunks/sphere.js";import{newIntersector as y}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as x}from"../../webgl-engine/lib/IntersectorInterfaces.js";const E=m(),g=l(),j=d(),b=d(),R=d(),w=s.getLogger("esri.views.3d.layers.i3s.I3SElevationProvider");let S=class extends(r.EventedMixin(t)){constructor(e){super(e),this.tmpEvent={spatialReference:null,extent:E,context:"scene"}}initialize(){this.view=this.layerView.view,this.renderCoordsHelper=this.view.renderCoordsHelper,this.intersector=y(this.view.state.viewingMode),this.intersector.options.store=x.MIN;const e=this.layerView.i3slayer.fullExtent;i(e)?w.error("I3SElevationProvider expected fullExtent on I3SLayer."):(this.zmin=e.zmin,this.zmax=e.zmax),this.tmpEvent.context=this.intersectionHandler.isGround?"ground":"scene"}getElevation(e,t,r,s){if(j[0]=e,j[1]=t,j[2]=r,!this.renderCoordsHelper.toRenderCoords(j,s,j))return w.error("could not project point to compute elevation"),null;const i=this.layerView.elevationOffset,o=this.zmin+i,n=this.zmax+i;return this.renderCoordsHelper.setAltitude(b,n,j),this.renderCoordsHelper.setAltitude(R,o,j),this.intersector.reset(b,R,null),this.intersectionHandler.intersect(this.intersector,null,b,R),this.intersector.results.min.getIntersectionPoint(j)?this.renderCoordsHelper.getAltitude(j):null}layerChanged(){this.spatialReference&&(this.tmpEvent.extent=this._computeLayerExtent(),this.tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this.tmpEvent))}objectChanged(e){this.spatialReference&&(this.tmpEvent.extent=this._computeObjectExtent(e),this.tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this.tmpEvent))}_computeObjectExtent(e){return m(E),this._expandExtent(e,E),E}_computeLayerExtent(){m(E);for(const e of this.layerView.getVisibleNodes())this._expandExtent(e,E);return E}_expandExtent(e,t){const r=e.visibilityObb||e.serviceObbInRenderSR;if(o(r)){c(g,r.quaternion),g[12]=r.center[0],g[13]=r.center[1],g[14]=r.center[2];for(let e=0;e<8;++e)j[0]=1&e?r.halfSize[0]:-r.halfSize[0],j[1]=2&e?r.halfSize[1]:-r.halfSize[1],j[2]=4&e?r.halfSize[2]:-r.halfSize[2],p(j,j,g),this.renderCoordsHelper.fromRenderCoords(j,j,this.spatialReference),f(t,j,t)}else{const r=u(e.renderMbs),s=h(b,v(e.renderMbs));s[0]-=r,s[1]-=r,s[2]-=r;const i=h(R,v(e.renderMbs));i[0]+=r,i[1]+=r,i[2]+=r;for(let e=0;e<8;++e)j[0]=1&e?s[0]:i[0],j[1]=2&e?s[1]:i[1],j[2]=4&e?s[2]:i[2],this.renderCoordsHelper.fromRenderCoords(j,j,this.spatialReference),f(t,j,t)}}};e([n({constructOnly:!0})],S.prototype,"layerView",void 0),e([n({constructOnly:!0})],S.prototype,"intersectionHandler",void 0),e([n()],S.prototype,"view",void 0),e([n({readOnly:!0,aliasOf:"view.elevationProvider.spatialReference"})],S.prototype,"spatialReference",void 0),S=e([a("esri.views.3d.layers.i3s.I3SElevationProvider")],S);const z=S;export{z 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{b as e}from"../../../../chunks/vec4f64.js";class t{constructor(t,i){this.id=t,this.mbs=i,this.renderMbs=e([0,0,0,-1]),this.imModificationImpact=n.NotChecked}}var i,n,o,s,a;!function(e){e[e.Unmodified=0]="Unmodified",e[e.Culled=1]="Culled",e[e.NotChecked=2]="NotChecked"}(i||(i={})),function(e){e[e.Unmodified=0]="Unmodified",e[e.PotentiallyModified=1]="PotentiallyModified",e[e.Culled=2]="Culled",e[e.Unknown=3]="Unknown",e[e.NotChecked=4]="NotChecked"}(n||(n={}));class c extends t{constructor(e,t,i,n,s,a,c,d,h,r){super(e,i),this.index=t,this.childCount=n,this.level=s,this.resources=a,this.version=c,this.lodMetric=d,this.maxError=h,this.numFeatures=r,this.failed=!1,this.hasModifications=!1,this.cacheState=o.Unknown,this.vertexCount=0,this.memory=0,this.childrenLoaded=0}}!function(e){e[e.Unknown=0]="Unknown",e[e.Uncached=1]="Uncached",e[e.Cached=2]="Cached"}(o||(o={})),function(e){e[e.None=0]="None",e[e.MaxScreenThreshold=1]="MaxScreenThreshold",e[e.ScreenSpaceRelative=2]="ScreenSpaceRelative",e[e.RemovedFeatureDiameter=3]="RemovedFeatureDiameter",e[e.DistanceRangeFromDefaultCamera=4]="DistanceRangeFromDefaultCamera"}(s||(s={})),function(e){e[e.Hole=0]="Hole",e[e.Leaf=1]="Leaf"}(a||(a={}));class d{constructor(e,t,i,n){this.nodeHasLOD=e,this.isChosen=t,this.lodLevel=i,this.version=n}}export{o as CacheState,s as LodMetric,c as Node,t as NodeBase,i as NodeFilterImpact,n as NodeIMModificationImpact,a as NodeState,d as NodeTraversalState};
5
+ import{f as e}from"../../../../chunks/sphere.js";class t{constructor(t,i){this.id=t,this.mbs=i,this.renderMbs=e(0,0,0,-1),this.imModificationImpact=n.NotChecked}}var i,n,o,s,a;!function(e){e[e.Unmodified=0]="Unmodified",e[e.Culled=1]="Culled",e[e.NotChecked=2]="NotChecked"}(i||(i={})),function(e){e[e.Unmodified=0]="Unmodified",e[e.PotentiallyModified=1]="PotentiallyModified",e[e.Culled=2]="Culled",e[e.Unknown=3]="Unknown",e[e.NotChecked=4]="NotChecked"}(n||(n={}));class c extends t{constructor(e,t,i,n,s,a,c,d,h,r){super(e,i),this.index=t,this.childCount=n,this.level=s,this.resources=a,this.version=c,this.lodMetric=d,this.maxError=h,this.numFeatures=r,this.failed=!1,this.hasModifications=!1,this.cacheState=o.Unknown,this.vertexCount=0,this.memory=0,this.childrenLoaded=0}}!function(e){e[e.Unknown=0]="Unknown",e[e.Uncached=1]="Uncached",e[e.Cached=2]="Cached"}(o||(o={})),function(e){e[e.None=0]="None",e[e.MaxScreenThreshold=1]="MaxScreenThreshold",e[e.ScreenSpaceRelative=2]="ScreenSpaceRelative",e[e.RemovedFeatureDiameter=3]="RemovedFeatureDiameter",e[e.DistanceRangeFromDefaultCamera=4]="DistanceRangeFromDefaultCamera"}(s||(s={})),function(e){e[e.Hole=0]="Hole",e[e.Leaf=1]="Leaf"}(a||(a={}));class d{constructor(e,t,i,n){this.nodeHasLOD=e,this.isChosen=t,this.lodLevel=i,this.version=n}}export{o as CacheState,s as LodMetric,c as Node,t as NodeBase,i as NodeFilterImpact,n as NodeIMModificationImpact,a as NodeState,d as NodeTraversalState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{estimateAttributesObjectSize as t,estimateFixedArraySize as r,estimateNumberByteSize as i}from"../../../../core/byteSizeEstimations.js";import a from"../../../../core/Error.js";import{HandleOwner as o}from"../../../../core/HandleOwner.js";import{makeHandle as s}from"../../../../core/handleUtils.js";import n from"../../../../core/Logger.js";import{isSome as l,disposeMaybe as d,unwrap as u,isNone as p,applySome as m,mapSome as h}from"../../../../core/maybe.js";import{initial as c,sync as y,watch as f}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as g}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as R}from"../../../../chunks/vec3.js";import{c as v}from"../../../../chunks/vec3f64.js";import{projectPointToVector as b}from"../../../../geometry/projection.js";import{getResolutionForScale as F}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as w}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as S}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as P}from"../../../../layers/graphics/OptimizedFeature.js";import j from"../../../../layers/graphics/OptimizedGeometry.js";import T from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as x}from"../../../../layers/support/fieldUtils.js";import{generateGradient as G}from"../../../../renderers/support/heatmapUtils.js";import{DrapeSourceType as M}from"../interfaces.js";import{DRAPED_Z as N}from"../../terrain/OverlayRenderer.js";import{UpdatePolicy as O,PrimitiveType as E}from"../../webgl-engine/lib/basicInterfaces.js";import{DrapedHeatmapRenderer as I}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{ModelDirty as C}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as W}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as D}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as L}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";const U=n.getLogger("esri.views.3d.layers.support.HeatmapFeatureProcessor"),V=50;let A=class extends o{constructor(e){super(e),this.type="heatmap",this.filterVisibility={filterChanged(){},dirty:!1},this.preferredUpdatePolicy=O.ASYNC,this.dataExtent=null,this.drapeSourceType=M.Features,this._renderGeometries=new Map,this._material=new L({}),this._materialWithField=new L({isAttributeDriven:!0}),this._fieldTotal=0,this._drapeSourceRenderer=null}initialize(){this._featureStore=new T({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM});const{colorBufferFloat:e,textureFloat:t}=this._renderView.capabilities,{floatBufferBlendWorking:r}=this._renderView.renderingContext.driverTest;if(null==t||!t.textureFloat)throw new a("heatmap:missing-texture-float","HeatmapRenderer requires WebGL2 or the WebGL1 extension OES_texture_float.");if(null==e||!e.textureFloat)throw new a("heatmap:missing-color-buffer-float","HeatmapRenderer requires the WebGL2 extension EXT_color_buffer_float or the WebGL1 extension WEBGL_color_buffer_float.");if(null==e||!e.floatBlend)throw new a("heatmap:missing-float-blend","HeatmapRenderer requires the WebGL extension EXT_float_blend.");if(!r)throw new a("heatmap:missing-float-blend","HeatmapRenderer requires the WebGL extension EXT_float_blend. This device claims support for it, but does not actually support it.");this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerDrapeSource(this,I),this.updatingHandles.addOnCollectionChange((()=>this._loadedPointGraphics),(e=>this._onLoadedFeaturesChange(e)),c),this.updatingHandles.addWhen((()=>this._materialParameters),(e=>this._forEachMaterial((t=>t.setParameters(e)))),c),this.updatingHandles.add((()=>this._heatmapRendererField),(()=>{this._recreate()}),y),this.updatingHandles.add((()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric})),(({fieldName:e,numeric:t})=>{if(l(e)&&t){let t=0;this._featureStore.forEach((r=>{var i;t+=null!=(i=r.attributes[e])?i:0})),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures}),c),this.handles.add([f((()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField})),(({fieldName:e,field:t})=>{var r;e&&!t&&U.warn(`Heatmap renderer field '${e}' for layer '${null!=(r=this.layer.title)?r:this.layer.id}' not found`)})),f((()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric})),(({field:e,numeric:t})=>{var r;l(e)&&!t&&U.warn(`Heatmap renderer field '${e.name}' for layer '${null!=(r=this.layer.title)?r:this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)})),s((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))])}destroy(){this._renderGeometries.clear(),this._material=d(this._material),this._materialWithField=d(this._materialWithField),this._featureStore.clear(),this._featureStore=null}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this.updatingHandles.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get displayFeatureLimit(){var e,t,r,i,a,o,s;const n=null!=(e=null==(t=this.owner)||null==(r=t.view)||null==(i=r.resourceController)||null==(a=i.memoryController)?void 0:a.memoryFactor)?e:1,l=null==(o=this.owner)||null==(s=o.view)?void 0:s.qualitySettings,d=l?Math.ceil(l.heatmap.maxTotalNumberOfFeatures*n):0;return{minimumTotalNumberOfFeatures:0,maximumTotalNumberOfFeatures:d,maximumTotalNumberOfPrimitives:d*2,maximumNumberOfFeatures:d}}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){return!1}get usedMemory(){var e,t,r,i,a;const o=this.usedMemoryPerFeature*this._featureStore.numFeatures,{R32F:s}=null==(e=this._renderView)||null==(t=e.capabilities)?void 0:t.colorBufferFloat,n=null!=s?1:4,d=4,u=null!=(r=Math.ceil((null==(i=this._overlayRenderer)||null==(a=i.overlays[0])?void 0:a.resolution)*this._densityMapPixelRatio))?r:0;return u*u*n*d+o+(l(this._heatmapRenderer)?3*Math.min(this._heatmapRenderer.blurRadius,V):0)*n*d}get usedMemoryPerFeature(){if(0===this._featureStore.numFeatures)return 0;let e=0;this._featureStore.forEach((r=>e+=t(r.attributes))),e/=this._featureStore.numFeatures;const a=i(),o=6;return o*r([0,0,0],a)+o*r([0,0],a)+(this._heatmapRendererFieldIsNumeric?o*a:0)+e}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return{core:{visible:this._featureStore.numFeatures,missing:0,pending:0},elevationUpdating:!1,visibilityFrustum:!0,visibilityScale:!0}}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return u(this._overlayRenderer.spatialReference)}get _materialParameters(){return{...this._blurRadiusParameters,...this._densityParameters,colorRampData:this._colorRampData,pixelRatio:this._densityMapPixelRatio}}get _densityParameters(){const e=this._heatmapRenderer;if(p(e))return null;return{minDensity:e.minPixelIntensity,maxDensity:e.maxPixelIntensity,fieldTotal:this._fieldTotal}}get _blurRadiusParameters(){return m(this._heatmapRenderer,(({referenceScale:e,blurRadius:t})=>({searchRadius:this._clampSearchRadius(t),resolutionForScale:0===e?0:F(e,this.view.spatialReference)})))}get _colorRampData(){return m(this._heatmapRenderer,(e=>G(e.colorStops)))}get _densityMapPixelRatio(){var e,t,r,i,a,o,s,n;const l=null!=(e=null==(t=this.owner)||null==(r=t.view)||null==(i=r.resourceController)||null==(a=i.memoryController)?void 0:a.memoryFactor)?e:1;return(null!=(o=null==(s=this.owner)||null==(n=s.view)?void 0:n.qualitySettings.heatmap.pixelRatio)?o:1)*Math.sqrt(l)}get _renderView(){return this.view._stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===(null==e?void 0:e.type)?e:null}get _heatmapRendererFieldName(){return m(this._heatmapRenderer,(e=>e.field))}get _heatmapRendererField(){return m(this._heatmapRendererFieldName,(e=>this.layer.fieldsIndex.get(e)))}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return!p(e)&&x(e)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return B}maskOccludee(){return B}setObjectIdVisibility(){}async setup(){}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:t}=this.layer;this._featureStore.removeManyById(e.removed.map((e=>w(e,t)))),this._featureStore.addMany(e.added.map((e=>new P(S(new j,e.geometry),e.attributes,m(e.centroid,(e=>S(new j,e))),w(e,t)))));const r=e.added,i=e.removed;this._fieldTotal+=this._computeFieldTotalChange(r,i);const a=h(i,(({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t})),o=r.map((e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t}));a.length>0&&this._drapeSourceRenderer.removeGeometries(a,C.Geometry.REMOVE),o.length>0&&this._drapeSourceRenderer.addGeometries(o,C.Geometry.ADD),(o.length>0||a.length>0)&&this._renderView.requestRender()}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=l(t)?this._materialWithField:this._material,i=v();b(e.geometry,i,this._overlaySpatialReference),i[2]=N;const a=[[D.POSITION,{data:i,size:i.length}]],o=this._heatmapRendererFieldIsNumeric;var s;l(t)&&a.push([D.FEATUREATTRIBUTE,{data:[o&&null!=(s=e.attributes[t])?s:0],size:1}]);const n=new W(new H(a,null,E.Point),r,{layerUid:this.layer.uid,graphicUid:e.uid});return R(n.boundingSphere,i),n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(p(this._heatmapRendererFieldName)||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>{var i;return e+(null!=(i=t.attributes[r])?i:0)};return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>V&&U.warnOnce(`SceneView supports a maximum blurRadius of ${V} for HeatmapRenderer.`),Math.min(e,V)}};e([_()],A.prototype,"type",void 0),e([_({constructOnly:!0})],A.prototype,"owner",void 0),e([_()],A.prototype,"layer",null),e([_()],A.prototype,"featureStore",null),e([_()],A.prototype,"updating",null),e([_()],A.prototype,"updatingRemaining",null),e([_()],A.prototype,"suspendInfo",null),e([_()],A.prototype,"legendEnabled",null),e([_()],A.prototype,"filterVisibility",void 0),e([_()],A.prototype,"displayFeatureLimit",null),e([_()],A.prototype,"preferredUpdatePolicy",void 0),e([_()],A.prototype,"hasZ",null),e([_()],A.prototype,"hasM",null),e([_()],A.prototype,"dataExtent",void 0),e([_()],A.prototype,"view",null),e([_()],A.prototype,"fullOpacity",null),e([_()],A.prototype,"updatePolicy",null),e([_()],A.prototype,"drapeSourceType",void 0),e([_()],A.prototype,"_featureStore",void 0),e([_()],A.prototype,"_overlayRenderer",null),e([_()],A.prototype,"_overlaySpatialReference",null),e([_()],A.prototype,"_materialParameters",null),e([_()],A.prototype,"_densityParameters",null),e([_()],A.prototype,"_blurRadiusParameters",null),e([_()],A.prototype,"_colorRampData",null),e([_()],A.prototype,"_densityMapPixelRatio",null),e([_()],A.prototype,"_renderGeometries",void 0),e([_()],A.prototype,"_material",void 0),e([_()],A.prototype,"_materialWithField",void 0),e([_()],A.prototype,"_renderView",null),e([_()],A.prototype,"_featuresArePoints",null),e([_()],A.prototype,"_loadedPointGraphics",null),e([_()],A.prototype,"_heatmapRenderer",null),e([_()],A.prototype,"_heatmapRendererFieldName",null),e([_()],A.prototype,"_heatmapRendererField",null),e([_()],A.prototype,"_heatmapRendererFieldIsNumeric",null),e([_()],A.prototype,"_fieldTotal",void 0),e([_()],A.prototype,"_drapeSourceRenderer",void 0),A=e([g("esri.views.3d.layers.support.HeatmapFeatureProcessor")],A);const B=s();export{A as HeatmapFeatureProcessor,V as MAX_RADIUS};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{estimateAttributesObjectSize as r,estimateFixedArraySize as t,estimateNumberByteSize as i}from"../../../../core/byteSizeEstimations.js";import a from"../../../../core/Error.js";import{HandleOwner as o}from"../../../../core/HandleOwner.js";import{makeHandle as s}from"../../../../core/handleUtils.js";import n from"../../../../core/Logger.js";import{isSome as l,disposeMaybe as d,unwrap as u,isNone as p,applySome as m,mapSome as h}from"../../../../core/maybe.js";import{initial as c,sync as y,watch as _}from"../../../../core/reactiveUtils.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as g}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as R}from"../../../../chunks/vec3.js";import{c as v}from"../../../../chunks/vec3f64.js";import{projectPointToVector as b}from"../../../../geometry/projection.js";import{getResolutionForScale as F}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as w}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as P}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as S}from"../../../../layers/graphics/OptimizedFeature.js";import j from"../../../../layers/graphics/OptimizedGeometry.js";import x from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as T}from"../../../../layers/support/fieldUtils.js";import{generateGradient as G}from"../../../../renderers/support/heatmapUtils.js";import{DrapeSourceType as M}from"../interfaces.js";import{DRAPED_Z as N}from"../../terrain/OverlayRenderer.js";import{UpdatePolicy as O,PrimitiveType as E}from"../../webgl-engine/lib/basicInterfaces.js";import{DrapedHeatmapRenderer as I}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{ModelDirty as C}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as W}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as L}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as U}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";const V=n.getLogger("esri.views.3d.layers.support.HeatmapFeatureProcessor"),A=50;let D=class extends o{constructor(e){super(e),this.type="heatmap",this.filterVisibility={filterChanged(){},dirty:!1},this.preferredUpdatePolicy=O.ASYNC,this.dataExtent=null,this.drapeSourceType=M.Features,this._renderGeometries=new Map,this._material=new U({}),this._materialWithField=new U({isAttributeDriven:!0}),this._fieldTotal=0,this._drapeSourceRenderer=null}initialize(){this._featureStore=new x({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM});const{colorBufferFloat:e,textureFloat:r}=this._renderView.capabilities,{floatBufferBlendWorking:t}=this._renderView.renderingContext.driverTest;if(null==r||!r.textureFloat)throw new a("heatmap:missing-texture-float","HeatmapRenderer requires WebGL2 or the WebGL1 extension OES_texture_float.");if(null==e||!e.textureFloat)throw new a("heatmap:missing-color-buffer-float","HeatmapRenderer requires the WebGL2 extension EXT_color_buffer_float or the WebGL1 extension WEBGL_color_buffer_float.");if(null==e||!e.floatBlend)throw new a("heatmap:missing-float-blend","HeatmapRenderer requires the WebGL extension EXT_float_blend.");if(!t)throw new a("heatmap:missing-float-blend","HeatmapRenderer requires the WebGL extension EXT_float_blend. This device claims support for it, but does not actually support it.");this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerDrapeSource(this,I,this._rendererParameters),this.updatingHandles.addOnCollectionChange((()=>this._loadedPointGraphics),(e=>this._onLoadedFeaturesChange(e)),c),this.updatingHandles.addWhen((()=>this._materialParameters),(e=>this._forEachMaterial((r=>r.setParameters(e)))),c),this.updatingHandles.add((()=>this._rendererParameters),(e=>this._drapeSourceRenderer.set(e))),this.updatingHandles.add((()=>this._heatmapRendererField),(()=>{this._recreate()}),y),this.updatingHandles.add((()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric})),(({fieldName:e,numeric:r})=>{if(l(e)&&r){let r=0;this._featureStore.forEach((t=>{var i;r+=null!=(i=t.attributes[e])?i:0})),this._fieldTotal=r}else this._fieldTotal=this._featureStore.numFeatures}),c),this.handles.add([_((()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField})),(({fieldName:e,field:r})=>{var t;e&&!r&&V.warn(`Heatmap renderer field '${e}' for layer '${null!=(t=this.layer.title)?t:this.layer.id}' not found`)})),_((()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric})),(({field:e,numeric:r})=>{var t;l(e)&&!r&&V.warn(`Heatmap renderer field '${e.name}' for layer '${null!=(t=this.layer.title)?t:this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)})),s((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))])}destroy(){this._renderGeometries.clear(),this._material=d(this._material),this._materialWithField=d(this._materialWithField),this._featureStore.clear(),this._featureStore=null}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this.updatingHandles.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get displayFeatureLimit(){var e,r,t,i,a,o,s;const n=null!=(e=null==(r=this.owner)||null==(t=r.view)||null==(i=t.resourceController)||null==(a=i.memoryController)?void 0:a.memoryFactor)?e:1,l=null==(o=this.owner)||null==(s=o.view)?void 0:s.qualitySettings,d=l?Math.ceil(l.heatmap.maxTotalNumberOfFeatures*n):0;return{minimumTotalNumberOfFeatures:0,maximumTotalNumberOfFeatures:d,maximumTotalNumberOfPrimitives:d*2,maximumNumberOfFeatures:d}}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){return!1}get usedMemory(){var e,r,t,i,a;const o=this.usedMemoryPerFeature*this._featureStore.numFeatures,{R32F:s}=null==(e=this._renderView)||null==(r=e.capabilities)?void 0:r.colorBufferFloat,n=null!=s?1:4,d=4,u=null!=(t=Math.ceil((null==(i=this._overlayRenderer)||null==(a=i.overlays[0])?void 0:a.resolution)*this._densityMapPixelRatio))?t:0;return u*u*n*d+o+(l(this._heatmapRenderer)?3*Math.min(this._heatmapRenderer.blurRadius,A):0)*n*d}get usedMemoryPerFeature(){if(0===this._featureStore.numFeatures)return 0;let e=0;this._featureStore.forEach((t=>e+=r(t.attributes))),e/=this._featureStore.numFeatures;const a=i(),o=6;return o*t([0,0,0],a)+o*t([0,0],a)+(this._heatmapRendererFieldIsNumeric?o*a:0)+e}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return{core:{visible:this._featureStore.numFeatures,missing:0,pending:0},elevationUpdating:!1,visibilityFrustum:!0,visibilityScale:!0}}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return u(this._overlayRenderer.spatialReference)}get _rendererParameters(){return{...this._blurRadiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._blurRadiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(p(e))return null;return{minDensity:e.minPixelIntensity,maxDensity:e.maxPixelIntensity,fieldTotal:this._fieldTotal}}get _blurRadiusParameter(){return m(this._heatmapRenderer,(({blurRadius:e})=>({searchRadius:this._clampSearchRadius(e)})))}get _resolutionForScaleParameter(){return m(this._heatmapRenderer,(({referenceScale:e})=>({resolutionForScale:0===e?0:F(e,this.view.spatialReference)})))}get _colorRampParameter(){return m(this._heatmapRenderer,(e=>({colorRampData:G(e.colorStops)})))}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){var e,r,t,i,a,o,s,n;const l=null!=(e=null==(r=this.owner)||null==(t=r.view)||null==(i=t.resourceController)||null==(a=i.memoryController)?void 0:a.memoryFactor)?e:1;return(null!=(o=null==(s=this.owner)||null==(n=s.view)?void 0:n.qualitySettings.heatmap.pixelRatio)?o:1)*Math.sqrt(l)}get _renderView(){return this.view._stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===(null==e?void 0:e.type)?e:null}get _heatmapRendererFieldName(){return m(this._heatmapRenderer,(e=>e.field))}get _heatmapRendererField(){return m(this._heatmapRendererFieldName,(e=>this.layer.fieldsIndex.get(e)))}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return!p(e)&&T(e)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return B}maskOccludee(){return B}setObjectIdVisibility(){}async setup(){}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:r}=this.layer;this._featureStore.removeManyById(e.removed.map((e=>w(e,r)))),this._featureStore.addMany(e.added.map((e=>new S(P(new j,e.geometry),e.attributes,m(e.centroid,(e=>P(new j,e))),w(e,r)))));const t=e.added,i=e.removed;this._fieldTotal+=this._computeFieldTotalChange(t,i);const a=h(i,(({uid:e})=>{const r=this._renderGeometries.get(e);return this._renderGeometries.delete(e),r})),o=t.map((e=>{const r=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,r),r}));a.length>0&&this._drapeSourceRenderer.removeGeometries(a,C.Geometry.REMOVE),o.length>0&&this._drapeSourceRenderer.addGeometries(o,C.Geometry.ADD),(o.length>0||a.length>0)&&this._renderView.requestRender()}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const r=this._heatmapRendererFieldName,t=l(r)?this._materialWithField:this._material,i=v();b(e.geometry,i,this._overlaySpatialReference),i[2]=N;const a=[[L.POSITION,{data:i,size:i.length}]],o=this._heatmapRendererFieldIsNumeric;var s;l(r)&&a.push([L.FEATUREATTRIBUTE,{data:[o&&null!=(s=e.attributes[r])?s:0],size:1}]);const n=new W(new H(a,null,E.Point),t,{layerUid:this.layer.uid,graphicUid:e.uid});return R(n.boundingSphere,i),n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,r){if(p(this._heatmapRendererFieldName)||!this._heatmapRendererFieldIsNumeric)return e.length-r.length;const t=this._heatmapRendererFieldName,i=(e,r)=>{var i;return e+(null!=(i=r.attributes[t])?i:0)};return e.reduce(i,0)-r.reduce(i,0)}_clampSearchRadius(e){return e>A&&V.warnOnce(`SceneView supports a maximum blurRadius of ${A} for HeatmapRenderer.`),Math.min(e,A)}};e([f()],D.prototype,"type",void 0),e([f({constructOnly:!0})],D.prototype,"owner",void 0),e([f()],D.prototype,"layer",null),e([f()],D.prototype,"featureStore",null),e([f()],D.prototype,"updating",null),e([f()],D.prototype,"updatingRemaining",null),e([f()],D.prototype,"suspendInfo",null),e([f()],D.prototype,"legendEnabled",null),e([f()],D.prototype,"filterVisibility",void 0),e([f()],D.prototype,"displayFeatureLimit",null),e([f()],D.prototype,"preferredUpdatePolicy",void 0),e([f()],D.prototype,"hasZ",null),e([f()],D.prototype,"hasM",null),e([f()],D.prototype,"dataExtent",void 0),e([f()],D.prototype,"view",null),e([f()],D.prototype,"fullOpacity",null),e([f()],D.prototype,"updatePolicy",null),e([f()],D.prototype,"drapeSourceType",void 0),e([f()],D.prototype,"_featureStore",void 0),e([f()],D.prototype,"_overlayRenderer",null),e([f()],D.prototype,"_overlaySpatialReference",null),e([f()],D.prototype,"_rendererParameters",null),e([f()],D.prototype,"_materialParameters",null),e([f()],D.prototype,"_densityParameters",null),e([f()],D.prototype,"_blurRadiusParameter",null),e([f()],D.prototype,"_resolutionForScaleParameter",null),e([f()],D.prototype,"_colorRampParameter",null),e([f()],D.prototype,"_pixelRatioParameter",null),e([f()],D.prototype,"_densityMapPixelRatio",null),e([f()],D.prototype,"_renderGeometries",void 0),e([f()],D.prototype,"_material",void 0),e([f()],D.prototype,"_materialWithField",void 0),e([f()],D.prototype,"_renderView",null),e([f()],D.prototype,"_featuresArePoints",null),e([f()],D.prototype,"_loadedPointGraphics",null),e([f()],D.prototype,"_heatmapRenderer",null),e([f()],D.prototype,"_heatmapRendererFieldName",null),e([f()],D.prototype,"_heatmapRendererField",null),e([f()],D.prototype,"_heatmapRendererFieldIsNumeric",null),e([f()],D.prototype,"_fieldTotal",void 0),e([f()],D.prototype,"_drapeSourceRenderer",void 0),D=e([g("esri.views.3d.layers.support.HeatmapFeatureProcessor")],D);const B=s();export{D as HeatmapFeatureProcessor,A as MAX_RADIUS};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{isSome as o}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as c,e as m,i as l}from"../../../../chunks/mat4.js";import{c as p}from"../../../../chunks/mat4f64.js";import{b as h,m as d,a as u,g as f,c as v,o as C,l as g,s as y,n as w,f as O,e as b,i as S,r as _}from"../../../../chunks/vec3.js";import{c as j}from"../../../../chunks/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/projectionEllipsoid.js";import{wrap as M}from"../../../../geometry/support/ray.js";import{h as L,j as T}from"../../../../chunks/sphere.js";import{sv3d as A}from"../../../../geometry/support/vectorStacks.js";import{applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintTypes as E,InteractionType as D,TiltMode as I}from"../../camera/constraintUtils/common.js";import{TiltDefault as R}from"../Constraints.js";import{InteractiveController as k}from"./InteractiveController.js";import{panMotionToRotationMatrix as U,onSurfaceTiltToEyeTiltGlobal as H,offSurfaceTiltToEyeTiltGlobal as N}from"../utils/navigationUtils.js";import{viewAngle as F}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as P}from"../../support/cameraUtils.js";import{createDirectionUp as G}from"../../support/cameraUtilsInternal.js";import{Camera as V}from"../../webgl-engine/lib/Camera.js";import{extractTransformation as B,isZeroTransformation as K,extractTransformationKeyboard as X}from"../../../navigation/gamepadAndKeyboardUtils.js";let Z=class extends k{constructor(t){super(t),this.transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this.keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this.tmpCamera=new V,this.constraintOptions={selection:E.ALL,interactionType:D.NONE,interactionStartCamera:new V,interactionFactor:0,interactionDirection:null,tiltMode:I.LOOK_AROUND}}handleEventGamepad(t){const e=B(t,this.view.navigation.gamepad,this.transformation);("end"===t.action||K(e))&&this.finishController()}activateDirection(t){this.keysButtonState[t]=1,X(this.keysButtonState,this.transformation)}deactivateDirection(t){this.keysButtonState[t]=0;const e=X(this.keysButtonState,this.transformation);K(e)&&this.finishController()}onControllerStart(t){this.filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this.headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this.filteredSurfaceElevation+=i*(e-this.filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this.constraintOptions.interactionStartCamera.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,et),this._applyDisabledMovementTypes(et),this._applyPan(et.pan),this._applyRotate(et.rotate),this._applyZoom(et.zoom),this._applyAscend(et.ascend),this.constraintOptions.interactionType=D.NONE,this.constraintOptions.selection=E.COLLISION,z(this.view,this.currentCamera,this.constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this.transformation.heading&&(this.headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h(it,e.center,e.eye),d(it,it,t.matrix),e.center=u(it,it,e.eye),e.up=d(it,e.up,t.matrix),this.constraintOptions.interactionType=D.LOOK_AROUND,this.constraintOptions.selection=E.ALL_EXCEPT_COLLISION,z(this.view,e,this.constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=d(it,e.eye,t.matrix),e.center=d(it,e.center,t.matrix);this.view.state.isGlobal&&(e.up=d(it,e.up,t.matrix)),this.constraintOptions.interactionType=D.PAN,this.constraintOptions.selection=E.ALL,z(this.view,e,this.constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=u(it,this.currentCamera.eye,f(A.get(),e,t)),v(at,e),C(at,at),this.constraintOptions.interactionDirection=at,this.constraintOptions.interactionType=D.ZOOM,this.constraintOptions.selection=E.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this.constraintOptions),this.constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,A.get());this.constraintOptions.interactionDirection=v(at,e);if(this.view.state.isGlobal){const e=g(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=f(it,this.currentCamera.eye,i),this.currentCamera.center=f(it,this.currentCamera.center,i)}else{const i=f(A.get(),e,t);this.currentCamera.eye=u(it,this.currentCamera.eye,i),this.currentCamera.center=u(it,this.currentCamera.center,i)}this._updateCameraCenter(),this.constraintOptions.interactionType=D.ASCEND,this.constraintOptions.selection=E.COLLISION,z(this.view,this.currentCamera,this.constraintOptions)&&this._updateCameraCenter(),this.constraintOptions.selection=E.ALL_EXCEPT_COLLISION,z(this.view,this.currentCamera,this.constraintOptions),this.constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){ot(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,it)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,n=this.transformation,l=this.view.navigation.gamepad,p=y(A.get(),s[0],s[1],0);w(p,p);const h=n.translation[0]*t.pan;if(0!==h){const t=f(A.get(),o,h);c(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(l.mode){case"pan":{const e=-n.translation[1]*t.pan;if(0!==e){const t=f(A.get(),p,e);c(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=n.zoom*t.zoom;break}case"zoom":r.zoom=(-n.translation[1]+n.zoom)*t.zoom;break;default:e(l.mode)}const d=n.translation[2]*t.ascend;r.ascend=d;const u=-n.heading*t.rotate;0!==u&&(m(r.rotate.matrix,r.rotate.matrix,u,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,A.get())),r.rotate.enabled=!0);const v=n.tilt*t.rotate,C=F(this.view.renderCoordsHelper,a.center,a.eye),g=i(C+v,R.min,R.max)-C;g&&(m(r.rotate.matrix,r.rotate.matrix,g,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this.transformation,s=this.view.navigation.gamepad,n=O(A.get(),r,a);w(n,n),C(n,n),U(this.startCamera,e,o,t,this.view.camera.heading,this.headingStart,this.view.camera.tilt,i,s),this.tmpCamera.copyFrom(this.currentCamera),this._applyPan(et.pan,this.tmpCamera);const c=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,l=o.translation[2]*t.ascend;i.ascend=l;const p=-o.heading*t.rotate;0!==p&&(m(i.rotate.matrix,i.rotate.matrix,p,this.tmpCamera.eye),i.rotate.enabled=!0);const h=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(h,e.ray,c);0!==d&&(m(i.rotate.matrix,i.rotate.matrix,d,this.tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,r){const o=x(this.view.spatialReference),s=H(R.min,e.origin,r,o);let n=0,c=0;const m=A.get();if(this.view.renderCoordsHelper.intersectManifold(e,r,m)){const t=F(this.view.renderCoordsHelper,m,e.origin);n=H(t,e.origin,r,o),c=H(R.max,e.origin,r,o)}else{L(T(r+o.radius),e,m);const t=a(-b(e.direction,w(m,m)));n=N(t,e.origin,r,o),c=N(R.max,e.origin,r,o)}return i(n+t,s,c)-n}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=P(this.view,e,0,J,rt),o=i.intersectManifoldClosestSilhouette(M(e,r),t,A.get()),s=S(e,o),n=i.intersectManifoldClosestSilhouette(M(e,_(A.get(),e,a.center)),t,A.get()),c=S(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this.filteredSurfaceElevation,A.get());if(o){const e=h(A.get(),t,s),i=g(e);f(e,e,1/i);const r=w(A.get(),t),o=a(b(r,e));return i*Math.sin(Math.min(Q,o))}{const i=v(A.get(),t);return e.setAltitude(i,this.filteredSurfaceElevation),S(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:Y}_computeVelocities(t){const e=this.filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=A.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),m=r.width/2,l=W*r.width,p=W*r.width,h=c*Math.tan(.5*r.fovX)/m,d=h/a,u=h/this._computeHeadingRotateRadius(s),f=n-e;return{pan:(o?d:h)*l*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(l*t/m)*f-f),zoom:2**(l*t/m)*c-c,rotate:i(u*p,$,tt)*t}}_applyDisabledMovementTypes(t){!o(this.disableMovements)||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&l(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&l(t.rotate.matrix))}static activatesFor(t,e){const i=B(e,t.navigation.gamepad,q);return!("end"===e.action||K(i))}};t([s({constructOnly:!0})],Z.prototype,"view",void 0),t([s({constructOnly:!0})],Z.prototype,"gamepadDevice",void 0),t([s({constructOnly:!0})],Z.prototype,"disableMovements",void 0),Z=t([n("esri.views.3d.state.controllers.GamepadKeyboardController")],Z);const q={translation:[0,0,0],heading:0,tilt:0,zoom:0},J=80,Q=r(J),W=.75,Y=5,$=r(30),tt=r(80),et={zoom:0,ascend:0,pan:{enabled:!1,matrix:p()},rotate:{enabled:!1,matrix:p()}},it=j(),at=j(),rt=G();function ot(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,l(t.pan.matrix),t.rotate.enabled=!1,l(t.rotate.matrix)}export{Z as GamepadKeyboardController};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as i,acosClamped as a,deg2rad as r}from"../../../../core/mathUtils.js";import{isSome as o}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{j as c,e as m,i as l}from"../../../../chunks/mat4.js";import{c as p}from"../../../../chunks/mat4f64.js";import{b as h,m as d,a as u,g as f,c as v,o as C,l as g,s as y,n as w,f as O,e as b,i as S,r as _}from"../../../../chunks/vec3.js";import{c as j}from"../../../../chunks/vec3f64.js";import{getReferenceEllipsoid as x}from"../../../../geometry/projectionEllipsoid.js";import{wrap as M}from"../../../../geometry/support/ray.js";import{j as L,k as T,t as A}from"../../../../chunks/sphere.js";import{sv3d as z}from"../../../../geometry/support/vectorStacks.js";import{applyAll as E}from"../../camera/constraintUtils.js";import{ConstraintTypes as D,InteractionType as I,TiltMode as k}from"../../camera/constraintUtils/common.js";import{TiltDefault as R}from"../Constraints.js";import{InteractiveController as U}from"./InteractiveController.js";import{panMotionToRotationMatrix as H,onSurfaceTiltToEyeTiltGlobal as N,offSurfaceTiltToEyeTiltGlobal as F}from"../utils/navigationUtils.js";import{viewAngle as P}from"../utils/viewUtils.js";import{headingTiltToDirectionUp as G}from"../../support/cameraUtils.js";import{createDirectionUp as V}from"../../support/cameraUtilsInternal.js";import{Camera as B}from"../../webgl-engine/lib/Camera.js";import{extractTransformation as K,isZeroTransformation as X,extractTransformationKeyboard as Z}from"../../../navigation/gamepadAndKeyboardUtils.js";let q=class extends U{constructor(t){super(t),this.transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this.keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this.tmpCamera=new B,this.constraintOptions={selection:D.ALL,interactionType:I.NONE,interactionStartCamera:new B,interactionFactor:0,interactionDirection:null,tiltMode:k.LOOK_AROUND}}handleEventGamepad(t){const e=K(t,this.view.navigation.gamepad,this.transformation);("end"===t.action||X(e))&&this.finishController()}activateDirection(t){this.keysButtonState[t]=1,Z(this.keysButtonState,this.transformation)}deactivateDirection(t){this.keysButtonState[t]=0;const e=Z(this.keysButtonState,this.transformation);X(e)&&this.finishController()}onControllerStart(t){this.filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this.headingStart=this.view.camera.heading,super.onControllerStart(t)}_updateFilteredSurfaceElevation(t){const e=this.view.pointsOfInterest.cameraOnSurface.location.z,i=1;this.filteredSurfaceElevation+=i*(e-this.filteredSurfaceElevation)*t}stepController(t,e){this._updateStartHeading(),this._updateFilteredSurfaceElevation(t),this.currentCamera.copyViewFrom(e),this._updateCameraCenter(),this.constraintOptions.interactionStartCamera.copyFrom(this.currentCamera),this._calculateControlTransformation(t,this.currentCamera,it),this._applyDisabledMovementTypes(it),this._applyPan(it.pan),this._applyRotate(it.rotate),this._applyZoom(it.zoom),this._applyAscend(it.ascend),this.constraintOptions.interactionType=I.NONE,this.constraintOptions.selection=D.COLLISION,E(this.view,this.currentCamera,this.constraintOptions),super.stepController(t,e)}_updateStartHeading(){0!==this.transformation.heading&&(this.headingStart=this.view.camera.heading)}_applyRotate(t){if(!t.enabled)return;const e=this.currentCamera;h(at,e.center,e.eye),d(at,at,t.matrix),e.center=u(at,at,e.eye),e.up=d(at,e.up,t.matrix),this.constraintOptions.interactionType=I.LOOK_AROUND,this.constraintOptions.selection=D.ALL_EXCEPT_COLLISION,E(this.view,e,this.constraintOptions)}_applyPan(t,e=this.currentCamera){if(!t.enabled)return;e.eye=d(at,e.eye,t.matrix),e.center=d(at,e.center,t.matrix);this.view.state.isGlobal&&(e.up=d(at,e.up,t.matrix)),this.constraintOptions.interactionType=I.PAN,this.constraintOptions.selection=D.ALL,E(this.view,e,this.constraintOptions)}_applyZoom(t){if(!t)return;const e=this.currentCamera.viewForward;this.currentCamera.eye=u(at,this.currentCamera.eye,f(z.get(),e,t)),v(rt,e),C(rt,rt),this.constraintOptions.interactionDirection=rt,this.constraintOptions.interactionType=I.ZOOM,this.constraintOptions.selection=D.ALL_EXCEPT_COLLISION,E(this.view,this.currentCamera,this.constraintOptions),this.constraintOptions.interactionDirection=null}_applyAscend(t){if(!t)return;const e=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,z.get());this.constraintOptions.interactionDirection=v(rt,e);if(this.view.state.isGlobal){const e=g(this.currentCamera.eye),i=(e+t)/e;this.currentCamera.eye=f(at,this.currentCamera.eye,i),this.currentCamera.center=f(at,this.currentCamera.center,i)}else{const i=f(z.get(),e,t);this.currentCamera.eye=u(at,this.currentCamera.eye,i),this.currentCamera.center=u(at,this.currentCamera.center,i)}this._updateCameraCenter(),this.constraintOptions.interactionType=I.ASCEND,this.constraintOptions.selection=D.COLLISION,E(this.view,this.currentCamera,this.constraintOptions)&&this._updateCameraCenter(),this.constraintOptions.selection=D.ALL_EXCEPT_COLLISION,E(this.view,this.currentCamera,this.constraintOptions),this.constraintOptions.interactionDirection=null}_calculateControlTransformation(t,e,i){st(i);const a=this._computeVelocities(t);this.view.state.isLocal?this._calculateControlTransformationLocal(a,e,i):this._calculateControlTransformationGlobal(a,e,i)}_updateCameraCenter(){const t=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,e=this.view.renderCoordsHelper,i=this.currentCamera.ray;this.currentCamera.center=e.intersectManifoldClosestSilhouette(i,t,at)}_calculateControlTransformationLocal(t,a,r){const{viewRight:o,viewForward:s}=a,n=this.transformation,l=this.view.navigation.gamepad,p=y(z.get(),s[0],s[1],0);w(p,p);const h=n.translation[0]*t.pan;if(0!==h){const t=f(z.get(),o,h);c(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}switch(l.mode){case"pan":{const e=-n.translation[1]*t.pan;if(0!==e){const t=f(z.get(),p,e);c(r.pan.matrix,r.pan.matrix,t),r.pan.enabled=!0}r.zoom=n.zoom*t.zoom;break}case"zoom":r.zoom=(-n.translation[1]+n.zoom)*t.zoom;break;default:e(l.mode)}const d=n.translation[2]*t.ascend;r.ascend=d;const u=-n.heading*t.rotate;0!==u&&(m(r.rotate.matrix,r.rotate.matrix,u,this.view.renderCoordsHelper.worldUpAtPosition(a.eye,z.get())),r.rotate.enabled=!0);const v=n.tilt*t.rotate,C=P(this.view.renderCoordsHelper,a.center,a.eye),g=i(C+v,R.min,R.max)-C;g&&(m(r.rotate.matrix,r.rotate.matrix,g,o),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(t,e,i){const{eye:a,viewRight:r}=e,o=this.transformation,s=this.view.navigation.gamepad,n=O(z.get(),r,a);w(n,n),C(n,n),H(this.startCamera,e,o,t,this.view.camera.heading,this.headingStart,this.view.camera.tilt,i,s),this.tmpCamera.copyFrom(this.currentCamera),this._applyPan(it.pan,this.tmpCamera);const c=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,l=o.translation[2]*t.ascend;i.ascend=l;const p=-o.heading*t.rotate;0!==p&&(m(i.rotate.matrix,i.rotate.matrix,p,this.tmpCamera.eye),i.rotate.enabled=!0);const h=o.tilt*t.rotate,d=this._clampTiltDeltaGlobalToValidRange(h,e.ray,c);0!==d&&(m(i.rotate.matrix,i.rotate.matrix,d,this.tmpCamera.viewRight),i.rotate.enabled=!0),i.zoom+=o.zoom*t.zoom}_clampTiltDeltaGlobalToValidRange(t,e,r){const o=x(this.view.spatialReference),s=N(R.min,e.origin,r,o);let n=0,c=0;const m=z.get();if(this.view.renderCoordsHelper.intersectManifold(e,r,m)){const t=P(this.view.renderCoordsHelper,m,e.origin);n=N(t,e.origin,r,o),c=N(R.max,e.origin,r,o)}else{L(T(A,r+o.radius),e,m);const t=a(-b(e.direction,w(m,m)));n=F(t,e.origin,r,o),c=F(R.max,e.origin,r,o)}return i(n+t,s,c)-n}_getPointAbsoluteSurfaceElevation(t,e,i){const{renderCoordsHelper:a}=this.view,r=a.getAltitude(t),o=e+Math.abs(r-e);return a.setAltitude(i,o,t),o}_clampedDistanceToSurface(t,e){const{renderCoordsHelper:i}=this.view,{camera:a}=this.view.state,{direction:r}=G(this.view,e,0,Q,ot),o=i.intersectManifoldClosestSilhouette(M(e,r),t,z.get()),s=S(e,o),n=i.intersectManifoldClosestSilhouette(M(e,_(z.get(),e,a.center)),t,z.get()),c=S(e,n);return Math.min(s,c)}_computeHeadingRotateRadius(t){const{renderCoordsHelper:e,state:i}=this.view,{camera:r,isGlobal:o}=i,s=e.intersectManifoldClosestSilhouette(r.ray,this.filteredSurfaceElevation,z.get());if(o){const e=h(z.get(),t,s),i=g(e);f(e,e,1/i);const r=w(z.get(),t),o=a(b(r,e));return i*Math.sin(Math.min(W,o))}{const i=v(z.get(),t);return e.setAltitude(i,this.filteredSurfaceElevation),S(s,i)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:$}_computeVelocities(t){const e=this.filteredSurfaceElevation,a=e+x(this.view.spatialReference).radius,{camera:r,isGlobal:o}=this.view.state,s=z.get(),n=this._getPointAbsoluteSurfaceElevation(r.eye,e,s),c=this._clampedDistanceToSurface(e,s),m=r.width/2,l=Y*r.width,p=Y*r.width,h=c*Math.tan(.5*r.fovX)/m,d=h/a,u=h/this._computeHeadingRotateRadius(s),f=n-e;return{pan:(o?d:h)*l*t,ascend:Math.max(this._minimumAscendVelocity()*t,2**(l*t/m)*f-f),zoom:2**(l*t/m)*c-c,rotate:i(u*p,tt,et)*t}}_applyDisabledMovementTypes(t){!o(this.disableMovements)||void 0!==this.disableMovements.mode&&this.view.state.viewingMode!==this.disableMovements.mode||(t.zoom=this.disableMovements.zoom?0:t.zoom,t.ascend=this.disableMovements.ascend?0:t.ascend,t.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&l(t.pan.matrix),t.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&l(t.rotate.matrix))}static activatesFor(t,e){const i=K(e,t.navigation.gamepad,J);return!("end"===e.action||X(i))}};t([s({constructOnly:!0})],q.prototype,"view",void 0),t([s({constructOnly:!0})],q.prototype,"gamepadDevice",void 0),t([s({constructOnly:!0})],q.prototype,"disableMovements",void 0),q=t([n("esri.views.3d.state.controllers.GamepadKeyboardController")],q);const J={translation:[0,0,0],heading:0,tilt:0,zoom:0},Q=80,W=r(Q),Y=.75,$=5,tt=r(30),et=r(80),it={zoom:0,ascend:0,pan:{enabled:!1,matrix:p()},rotate:{enabled:!1,matrix:p()}},at=j(),rt=j(),ot=V();function st(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,l(t.pan.matrix),t.rotate.enabled=!1,l(t.rotate.matrix)}export{q as GamepadKeyboardController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o}from"../../../../core/mathUtils.js";import{isNone as r}from"../../../../core/maybe.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{d as i,m as s,e as c}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{b as u}from"../../../../chunks/vec2.js";import{a as l}from"../../../../chunks/vec2f64.js";import{c as p,e as f,g as h,b as M,n as y,f as g,m as d,a as b,l as j,h as v,s as z,d as x}from"../../../../chunks/vec3.js";import{c as P}from"../../../../chunks/vec3f64.js";import{create as k,axis as I,fromPoints as w,wrapAxisAngle as E}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as S,vectorCoordinates as A}from"../../../../geometry/support/coordinateSystem.js";import{create as H,intersectRay as G,fromNormalAndOffset as U}from"../../../../geometry/support/plane.js";import{h as V,e as q,c as C}from"../../../../chunks/sphere.js";import{angle as F}from"../../../../geometry/support/vector.js";import{sv3d as R,sm4d as T}from"../../../../geometry/support/vectorStacks.js";import{fromScreen as W,fromScreenAtEye as B}from"../../support/geometryUtils/ray.js";import{intersectScreen as D}from"../../support/geometryUtils/sphere.js";import{Camera as J}from"../../webgl-engine/lib/Camera.js";var K;!function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"}(K||(K={}));const L=30,N=[1,3e8],O=70;function Q(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function X(t,e,n){const o=R.get(),r=R.get(),a=R.get();p(r,t),p(a,e);const i=f(r,n),s=f(a,n);h(o,n,i),M(r,r,o),y(r,r),h(o,n,s),M(a,a,o),y(a,a);const c=f(r,a);g(o,n,r);const m=f(a,o);return Math.atan2(m,c)}function Y(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function Z(t,e,n){const o=i(T.get(),n[3],I(n));M(Ot,t.eye,e),d(Ot,Ot,o),t.eye=b(Ot,Ot,e),M(Ot,t.center,e),d(Ot,Ot,o),t.center=b(Ot,Ot,e),t.up=d(Ot,t.up,o)}function $(t,e,n,o){return G(t,W(e,n,$t),o)}function _(t,e,n,o){return G(t,B(e,n,$t),o)}function tt(t,e,n,o){const r=R.get();let a=1-n;M(r,e,t.eye);const i=j(r);let s=i*(1-a);a>=0&&s<o&&(s=o,a=-(s-i)/i),Math.abs(i-s)<1e-6||(h(r,r,a),t.eye=b(Ot,t.eye,r),t.center=v(Ot,t.center,e,a))}function et(t,e,n){e.getScreenCenter(nt),D(t,e,nt,Ot)&&(e.center=Ot);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=h(R.get(),e.viewForward,r);e.eye=M(Ot,e.center,a)}const nt=a();function ot(t,e,n){rt(e,n),y(n,n),h(n,n,t)}function rt(t,e){z(e,0,0,0);for(const n of t)b(e,e,n);h(e,e,1/t.length)}function at(t,e,n,o){return Math.sin(t/j(e))*(n+o.radius)}function it(t,e,n,o){return at(Math.PI/2,e,n,o)+(t-Math.PI/2)}var st;!function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(st||(st={}));const ct={Elevation:3e4,Angle:e(6)},mt={Pole:.95,Angle:e(18),Tilt:45},ut=e(80);function lt(t,e,n,o,r,a){const i=P(),s=C();let c=!0,m=!0;return t.intersectScreen(n,i,a)?s[3]=j(i):(m=!1,e.aboveGround&&r!==K.Ellipsoid?s[3]=Math.max(j(e.center),.9*o.radius):s[3]=j(e.eye)-e.relativeElevation,r===K.Silhouette?Mt(s,e,n,i):c=D(s,e,n,i)),{sphere:s,scenePickPoint:c?i:null,hasGeometryIntersection:m}}function pt(t,e,n,o){if(j(t.eye)-o.radius>ct.Elevation)return st.Horizontal;if(!n)return st.Vertical;B(t,e,_t);return-Math.sign(t.relativeElevation)*(.5*Math.PI+F(t.eye,_t.direction))<ct.Angle?st.Vertical:st.Horizontal}function ft(t,e,n){M(ht,n,e),t.eye=M(Ot,t.eye,ht),t.center=M(Ot,t.center,ht)}const ht=P();function Mt(t,e,n,o){const a=B(e,n,$t);return!r(a)&&(V(t,a,yt),q(t,a,o)?!(x(yt,a.origin)<x(o,a.origin))||(p(o,yt),!1):(M(gt,e.eye,e.center),y(gt,gt),U(gt,-f(y(gt,gt),yt),dt),G(dt,a,o),!1))}const yt=P(),gt=P(),dt=H();function bt(r,a,i,s,c,m){let u;if(g(Yt,r,a),M(Qt,r,a),j(r)<=c||!s.aboveGround){g(i,Qt,s.eye);const l=f(r,a)/(j(r)*j(a)),p=Math.cos(n(t.normalize(e(m)),0,ut));u=-o(l)-Math.max(0,j(a)-c)/(p*c)}else M(jt,s.eye,s.center),g(i,Qt,jt),u=-j(Qt)/c;return y(i,i),h(i,i,j(Yt)),u}const jt=P();function vt(r,a,i,s){let c,m;const u=Math.cos(n(t.normalize(e(s)),0,ut));return c=a>i?-(a-i)/(u*i):a<-i?Math.PI-(a+i)/(u*i):o(a/i),m=r>i?-(r-i)/(u*i):r<-i?Math.PI-(r+i)/(u*i):o(r/i),(m-c)*i}function zt(t,e,n,o,r,a,i,s,c,m){const l=vt(t[2],e[2],i[3],c),p=m?vt(t[0],e[0],i[3],180):e[0]-t[0],h=Math.sin(s)*p-Math.cos(s)*l,M=Math.cos(s)*p+Math.sin(s)*l;y(Ot,r);const g=m?h/Math.sqrt(Math.abs(i[3]**2-f(n,Ot)**2)):h/i[3],d=M/Math.sqrt(Math.abs(i[3]**2-f(n,o)**2));u(a,g,d)}function xt(t,e,n,o,r,a,i,s,c,m){g(Yt,t,e),S(a.up,a.eye,Ct,Ft,Rt),S([0,0,1],a.eye,Ut,Vt,qt),p(n,Vt),p(o,Ut),y(n,n),h(n,n,j(Yt)),A(t,y(Ft,Ft),y(Rt,Rt),y(Ct,Ct),Tt),A(e,Ft,Rt,Ct,Wt),zt(Tt,Wt,t,Ut,Vt,r,i,s,c,m)}function Pt(t,e,n,o,r,a,c){i(Jt,r,o),i(Kt,c,a),s(Lt,Jt,Kt),M(e,t,n),d(e,e,Lt),b(e,e,n)}function kt(t,e,n,o,r,a){i(Jt,o,n),i(Kt,a,r),s(Lt,Jt,Kt),M(Ot,t.eye,e),d(Ot,Ot,Lt),t.eye=b(Ot,Ot,e),M(Ot,t.center,e),d(Ot,Ot,Lt),t.center=b(Ot,Ot,e),M(Ot,t.up,e),d(Ot,Ot,Lt),t.up=b(Ot,Ot,e)}function It(t,e,n,o,r,a,i=mt.Pole,s=mt.Angle){const c=Math.abs(o)>Math.PI-s||Math.abs(o)<s,m=Math.abs(t[2])<n*i||Math.abs(e)>n;return!!(c&&m&&a.aboveGround&&r<mt.Tilt)}function wt(t,e,n,o,r,a){if(a)w(n,o,Dt),Z(e,t,Dt);else{const a=bt(n,o,Zt,e,t[3],r);Z(e,t,E(Zt,a))}}function Et(t,e,n,o,r,a,i){const s=i?20:1,c=1e-12;let m,u;p(Nt,o),Xt.copyFrom(e);for(let l=0;l<s&&x(n,Nt)>c&&(m=x(n,Nt),xt(n,Nt,Vt,Ut,Bt,Xt,t,r,a,i),kt(Xt,t,Ut,Bt[1],Vt,Bt[0]),Pt(Nt,Nt,t,Ut,Bt[1],Vt,Bt[0]),u=x(n,Nt),u<m||0===l);l++)e.copyFrom(Xt)}function St(n,o,r,a,i,s,c){It(r,f(o.up,r),n[3],-t.normalize(e(i)),s,o,mt.Pole,mt.Angle)?Et(n,o,r,a,-t.normalize(e(i)),s,c):wt(n,o,r,a,s,c)}function At(t,e,n,o,r,a){const{eye:i}=t;S([0,0,1],i,Ut,Vt,qt);const s=e.translation[0]*n.pan,m="zoom"===r.mode?0:e.translation[1]*n.pan,u=Math.max(Math.sqrt(Math.abs(1-f(t.center,Ut)**2/j(t.center)**2)),.5),l=(Math.sin(a)*m+Math.cos(a)*s)/u,p=-Math.cos(a)*m+Math.sin(a)*s;switch(c(o.pan.matrix,o.pan.matrix,l,Ut),o.pan.enabled=!0,r.mode){case"pan":c(o.pan.matrix,o.pan.matrix,p,Vt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Ht(t,e,n,o,r){const{eye:a,viewRight:i}=t,s=g(R.get(),i,a),m=e.translation[0]*n.pan;switch(0!==m&&(c(o.pan.matrix,o.pan.matrix,-m,s),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(o.pan.matrix,o.pan.matrix,t,i),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Gt(n,o,r,a,i,s,c,m,u){It(n.center,f(n.up,n.center),j(n.center),-t.normalize(e(s)),c,o)?At(o,r,a,m,u,-t.normalize(e(i))):Ht(o,r,a,m,u)}const Ut=P(),Vt=P(),qt=P(),Ct=P(),Ft=P(),Rt=P(),Tt=P(),Wt=P(),Bt=l(),Dt=k(),Jt=m(),Kt=m(),Lt=m(),Nt=P(),Ot=P(),Qt=P(),Xt=new J,Yt=P(),Zt=P(),$t={origin:P(),direction:P()},_t={origin:P(),direction:P()};export{N as DISTANCE_CLAMP_VALUES,st as NavigationMode,L as PIVOT_DISTANCE_MODIFIER,mt as PreservingHeadingThreshold,O as SCREEN_PIXEL_AREA,K as SpherePickPointFallback,ut as TiltThresholdPanningSpeed,ct as VerticalPanTresholds,ft as applyPanPlanar,wt as applyPanSphericalDirectRotation,Et as applyPanSphericalPreserveHeading,Z as applyRotation,kt as applyRotationWithTwoAxes,et as applyZoomOnSphere,tt as applyZoomToPoint,rt as centroid,ot as centroidOnSphere,pt as decideNavigationMode,$ as intersectPlaneFromScreenPoint,_ as intersectPlaneFromScreenPointAtEye,vt as lengthFromPoints,Q as normalizeCoordinate,Y as normalizeRotationDelta,it as offSurfaceTiltToEyeTiltGlobal,at as onSurfaceTiltToEyeTiltGlobal,Gt as panMotionToRotationMatrix,St as panToPosition,lt as pickPointAndInitSphere,It as preserveHeadingThreshold,Pt as rotatePointAroundTwoAxes,bt as rotationAngleAndAxisDirectRotation,xt as rotationAnglesAndAxesHeadingPreserving,zt as rotationAnglesHeadingPreserving,X as rotationFromPointsAroundAxis,Mt as sphereOrPlanePointFromScreenPoint};
5
+ import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as o}from"../../../../core/mathUtils.js";import{isNone as r}from"../../../../core/maybe.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{d as i,m as s,e as c}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{b as u}from"../../../../chunks/vec2.js";import{a as l}from"../../../../chunks/vec2f64.js";import{c as p,e as f,g as h,b as M,n as y,f as g,m as d,a as b,l as j,h as v,s as z,d as x}from"../../../../chunks/vec3.js";import{c as P}from"../../../../chunks/vec3f64.js";import{create as k,axis as I,fromPoints as w,wrapAxisAngle as E}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as S,vectorCoordinates as A}from"../../../../geometry/support/coordinateSystem.js";import{create as H,intersectRay as G,fromNormalAndOffset as U}from"../../../../geometry/support/plane.js";import{j as V,h as q,c as C}from"../../../../chunks/sphere.js";import{angle as F}from"../../../../geometry/support/vector.js";import{sv3d as R,sm4d as T}from"../../../../geometry/support/vectorStacks.js";import{fromScreen as W,fromScreenAtEye as B}from"../../support/geometryUtils/ray.js";import{intersectScreen as D}from"../../support/geometryUtils/sphere.js";import{Camera as J}from"../../webgl-engine/lib/Camera.js";var K;!function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"}(K||(K={}));const L=30,N=[1,3e8],O=70;function Q(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function X(t,e,n){const o=R.get(),r=R.get(),a=R.get();p(r,t),p(a,e);const i=f(r,n),s=f(a,n);h(o,n,i),M(r,r,o),y(r,r),h(o,n,s),M(a,a,o),y(a,a);const c=f(r,a);g(o,n,r);const m=f(a,o);return Math.atan2(m,c)}function Y(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function Z(t,e,n){const o=i(T.get(),n[3],I(n));M(Ot,t.eye,e),d(Ot,Ot,o),t.eye=b(Ot,Ot,e),M(Ot,t.center,e),d(Ot,Ot,o),t.center=b(Ot,Ot,e),t.up=d(Ot,t.up,o)}function $(t,e,n,o){return G(t,W(e,n,$t),o)}function _(t,e,n,o){return G(t,B(e,n,$t),o)}function tt(t,e,n,o){const r=R.get();let a=1-n;M(r,e,t.eye);const i=j(r);let s=i*(1-a);a>=0&&s<o&&(s=o,a=-(s-i)/i),Math.abs(i-s)<1e-6||(h(r,r,a),t.eye=b(Ot,t.eye,r),t.center=v(Ot,t.center,e,a))}function et(t,e,n){e.getScreenCenter(nt),D(t,e,nt,Ot)&&(e.center=Ot);const o=e.distance,r=o*n;if(Math.abs(o-r)<1e-6)return;const a=h(R.get(),e.viewForward,r);e.eye=M(Ot,e.center,a)}const nt=a();function ot(t,e,n){rt(e,n),y(n,n),h(n,n,t)}function rt(t,e){z(e,0,0,0);for(const n of t)b(e,e,n);h(e,e,1/t.length)}function at(t,e,n,o){return Math.sin(t/j(e))*(n+o.radius)}function it(t,e,n,o){return at(Math.PI/2,e,n,o)+(t-Math.PI/2)}var st;!function(t){t[t.Vertical=0]="Vertical",t[t.Horizontal=1]="Horizontal"}(st||(st={}));const ct={Elevation:3e4,Angle:e(6)},mt={Pole:.95,Angle:e(18),Tilt:45},ut=e(80);function lt(t,e,n,o,r,a){const i=P(),s=C();let c=!0,m=!0;return t.intersectScreen(n,i,a)?s[3]=j(i):(m=!1,e.aboveGround&&r!==K.Ellipsoid?s[3]=Math.max(j(e.center),.9*o.radius):s[3]=j(e.eye)-e.relativeElevation,r===K.Silhouette?Mt(s,e,n,i):c=D(s,e,n,i)),{sphere:s,scenePickPoint:c?i:null,hasGeometryIntersection:m}}function pt(t,e,n,o){if(j(t.eye)-o.radius>ct.Elevation)return st.Horizontal;if(!n)return st.Vertical;B(t,e,_t);return-Math.sign(t.relativeElevation)*(.5*Math.PI+F(t.eye,_t.direction))<ct.Angle?st.Vertical:st.Horizontal}function ft(t,e,n){M(ht,n,e),t.eye=M(Ot,t.eye,ht),t.center=M(Ot,t.center,ht)}const ht=P();function Mt(t,e,n,o){const a=B(e,n,$t);return!r(a)&&(V(t,a,yt),q(t,a,o)?!(x(yt,a.origin)<x(o,a.origin))||(p(o,yt),!1):(M(gt,e.eye,e.center),y(gt,gt),U(gt,-f(y(gt,gt),yt),dt),G(dt,a,o),!1))}const yt=P(),gt=P(),dt=H();function bt(r,a,i,s,c,m){let u;if(g(Yt,r,a),M(Qt,r,a),j(r)<=c||!s.aboveGround){g(i,Qt,s.eye);const l=f(r,a)/(j(r)*j(a)),p=Math.cos(n(t.normalize(e(m)),0,ut));u=-o(l)-Math.max(0,j(a)-c)/(p*c)}else M(jt,s.eye,s.center),g(i,Qt,jt),u=-j(Qt)/c;return y(i,i),h(i,i,j(Yt)),u}const jt=P();function vt(r,a,i,s){let c,m;const u=Math.cos(n(t.normalize(e(s)),0,ut));return c=a>i?-(a-i)/(u*i):a<-i?Math.PI-(a+i)/(u*i):o(a/i),m=r>i?-(r-i)/(u*i):r<-i?Math.PI-(r+i)/(u*i):o(r/i),(m-c)*i}function zt(t,e,n,o,r,a,i,s,c,m){const l=vt(t[2],e[2],i[3],c),p=m?vt(t[0],e[0],i[3],180):e[0]-t[0],h=Math.sin(s)*p-Math.cos(s)*l,M=Math.cos(s)*p+Math.sin(s)*l;y(Ot,r);const g=m?h/Math.sqrt(Math.abs(i[3]**2-f(n,Ot)**2)):h/i[3],d=M/Math.sqrt(Math.abs(i[3]**2-f(n,o)**2));u(a,g,d)}function xt(t,e,n,o,r,a,i,s,c,m){g(Yt,t,e),S(a.up,a.eye,Ct,Ft,Rt),S([0,0,1],a.eye,Ut,Vt,qt),p(n,Vt),p(o,Ut),y(n,n),h(n,n,j(Yt)),A(t,y(Ft,Ft),y(Rt,Rt),y(Ct,Ct),Tt),A(e,Ft,Rt,Ct,Wt),zt(Tt,Wt,t,Ut,Vt,r,i,s,c,m)}function Pt(t,e,n,o,r,a,c){i(Jt,r,o),i(Kt,c,a),s(Lt,Jt,Kt),M(e,t,n),d(e,e,Lt),b(e,e,n)}function kt(t,e,n,o,r,a){i(Jt,o,n),i(Kt,a,r),s(Lt,Jt,Kt),M(Ot,t.eye,e),d(Ot,Ot,Lt),t.eye=b(Ot,Ot,e),M(Ot,t.center,e),d(Ot,Ot,Lt),t.center=b(Ot,Ot,e),M(Ot,t.up,e),d(Ot,Ot,Lt),t.up=b(Ot,Ot,e)}function It(t,e,n,o,r,a,i=mt.Pole,s=mt.Angle){const c=Math.abs(o)>Math.PI-s||Math.abs(o)<s,m=Math.abs(t[2])<n*i||Math.abs(e)>n;return!!(c&&m&&a.aboveGround&&r<mt.Tilt)}function wt(t,e,n,o,r,a){if(a)w(n,o,Dt),Z(e,t,Dt);else{const a=bt(n,o,Zt,e,t[3],r);Z(e,t,E(Zt,a))}}function Et(t,e,n,o,r,a,i){const s=i?20:1,c=1e-12;let m,u;p(Nt,o),Xt.copyFrom(e);for(let l=0;l<s&&x(n,Nt)>c&&(m=x(n,Nt),xt(n,Nt,Vt,Ut,Bt,Xt,t,r,a,i),kt(Xt,t,Ut,Bt[1],Vt,Bt[0]),Pt(Nt,Nt,t,Ut,Bt[1],Vt,Bt[0]),u=x(n,Nt),u<m||0===l);l++)e.copyFrom(Xt)}function St(n,o,r,a,i,s,c){It(r,f(o.up,r),n[3],-t.normalize(e(i)),s,o,mt.Pole,mt.Angle)?Et(n,o,r,a,-t.normalize(e(i)),s,c):wt(n,o,r,a,s,c)}function At(t,e,n,o,r,a){const{eye:i}=t;S([0,0,1],i,Ut,Vt,qt);const s=e.translation[0]*n.pan,m="zoom"===r.mode?0:e.translation[1]*n.pan,u=Math.max(Math.sqrt(Math.abs(1-f(t.center,Ut)**2/j(t.center)**2)),.5),l=(Math.sin(a)*m+Math.cos(a)*s)/u,p=-Math.cos(a)*m+Math.sin(a)*s;switch(c(o.pan.matrix,o.pan.matrix,l,Ut),o.pan.enabled=!0,r.mode){case"pan":c(o.pan.matrix,o.pan.matrix,p,Vt),o.pan.enabled=!0;break;case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Ht(t,e,n,o,r){const{eye:a,viewRight:i}=t,s=g(R.get(),i,a),m=e.translation[0]*n.pan;switch(0!==m&&(c(o.pan.matrix,o.pan.matrix,-m,s),o.pan.enabled=!0),r.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(o.pan.matrix,o.pan.matrix,t,i),o.pan.enabled=!0);break}case"zoom":o.zoom=-e.translation[1]*n.zoom}}function Gt(n,o,r,a,i,s,c,m,u){It(n.center,f(n.up,n.center),j(n.center),-t.normalize(e(s)),c,o)?At(o,r,a,m,u,-t.normalize(e(i))):Ht(o,r,a,m,u)}const Ut=P(),Vt=P(),qt=P(),Ct=P(),Ft=P(),Rt=P(),Tt=P(),Wt=P(),Bt=l(),Dt=k(),Jt=m(),Kt=m(),Lt=m(),Nt=P(),Ot=P(),Qt=P(),Xt=new J,Yt=P(),Zt=P(),$t={origin:P(),direction:P()},_t={origin:P(),direction:P()};export{N as DISTANCE_CLAMP_VALUES,st as NavigationMode,L as PIVOT_DISTANCE_MODIFIER,mt as PreservingHeadingThreshold,O as SCREEN_PIXEL_AREA,K as SpherePickPointFallback,ut as TiltThresholdPanningSpeed,ct as VerticalPanTresholds,ft as applyPanPlanar,wt as applyPanSphericalDirectRotation,Et as applyPanSphericalPreserveHeading,Z as applyRotation,kt as applyRotationWithTwoAxes,et as applyZoomOnSphere,tt as applyZoomToPoint,rt as centroid,ot as centroidOnSphere,pt as decideNavigationMode,$ as intersectPlaneFromScreenPoint,_ as intersectPlaneFromScreenPointAtEye,vt as lengthFromPoints,Q as normalizeCoordinate,Y as normalizeRotationDelta,it as offSurfaceTiltToEyeTiltGlobal,at as onSurfaceTiltToEyeTiltGlobal,Gt as panMotionToRotationMatrix,St as panToPosition,lt as pickPointAndInitSphere,It as preserveHeadingThreshold,Pt as rotatePointAroundTwoAxes,bt as rotationAngleAndAxisDirectRotation,xt as rotationAnglesAndAxesHeadingPreserving,zt as rotationAnglesHeadingPreserving,X as rotationFromPointsAroundAxis,Mt as sphereOrPlanePointFromScreenPoint};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Graphic.js";import{isSome as r}from"../../../core/maybe.js";import{WorkerHandle as o}from"../../../core/workers/WorkerHandle.js";import t from"../../../geometry/SpatialReference.js";import s from"../../../layers/support/Field.js";class i{constructor(e){this._schedule=e,this._handle=new n(e)}destroy(){this._handle.destroy()}invoke(o,i){return o.buffer&&0!==o.buffer.byteLength?(o.options.sourceSpatialReference&&o.options.sourceSpatialReference instanceof t&&(o.options={...o.options,sourceSpatialReference:o.options.sourceSpatialReference.toJSON()}),this._handle.invoke(o,i).then((o=>this._schedule((()=>{if(o.spatialReference=t.fromJSON(o.spatialReference),o.fields)for(let e=0;e<o.fields.length;e++)o.fields[e]=s.fromJSON(o.fields[e]);const i=o.spatialReference;for(const t of o.features)t.uid=e.generateUID(),r(t.geometry)&&(t.geometry.spatialReference=i);return o}))))):Promise.resolve(null)}}class n extends o{constructor(e){super("PBFDecoderWorker","_parseFeatureQuery",e)}getTransferList(e){return[e.buffer]}}export{i as PBFDecoder};
5
+ import e from"../../../Graphic.js";import{isSome as r}from"../../../core/maybe.js";import{WorkerHandle as o}from"../../../core/workers/WorkerHandle.js";import t from"../../../geometry/SpatialReference.js";import s from"../../../layers/support/Field.js";class i{constructor(e){this._schedule=e,this._handle=new n(e)}destroy(){this._handle.destroy()}invoke(o,i){return o.buffer&&0!==o.buffer.byteLength?(o.options.sourceSpatialReference&&o.options.sourceSpatialReference instanceof t&&(o.options={...o.options,sourceSpatialReference:o.options.sourceSpatialReference.toJSON()}),this._handle.invoke(o,i).then((o=>this._schedule((()=>{if(o.spatialReference=t.fromJSON(o.spatialReference),o.fields)for(let e=0;e<o.fields.length;e++)o.fields[e]=s.fromJSON(o.fields[e]);const i=o.spatialReference;for(const t of o.features)t.uid=e.generateUID(),r(t.geometry)&&(t.geometry.spatialReference=i);return o}))))):Promise.resolve(null)}}class n extends o{constructor(e){super("PBFDecoderWorker","_parseFeatureQuery",{_parseFeatureQuery:e=>[e.buffer]},e)}}export{i as PBFDecoder};