@arcgis/core 4.27.0-next.20230321 → 4.27.0-next.20230323

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 (267) hide show
  1. package/analysis/LineOfSightAnalysisObserver.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/02b6227c156ee0d8eb66.js +1 -0
  4. package/assets/esri/core/workers/chunks/{7e0c65aa61c2ff0c3504.js → 1c98b92933a48cf96c1e.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{a27951dbe83c63f9d01a.js → 26bc91a9d9d7345a3eba.js} +1 -1
  6. package/assets/esri/core/workers/chunks/321f272d4c7ed6b0cb46.js +1 -0
  7. package/assets/esri/core/workers/chunks/{a09cc8e2ff43fe4afa04.js → 375628de4cfc71cb41c1.js} +1 -1
  8. package/assets/esri/core/workers/chunks/47bd558e2ce89f47f908.js +1 -0
  9. package/assets/esri/core/workers/chunks/4cb62855bb1ae608bfde.js +1 -0
  10. package/assets/esri/core/workers/chunks/4f0c2b6b200bf8222fd7.js +1 -0
  11. package/assets/esri/core/workers/chunks/5252f3cc244204edc299.js +1 -0
  12. package/assets/esri/core/workers/chunks/6f952a6464cf9e62dbac.js +1098 -0
  13. package/assets/esri/core/workers/chunks/76d6c1fc25f02bcf258e.js +1 -0
  14. package/assets/esri/core/workers/chunks/{d6ec7682de8fad9718e9.js → 77dccfaf1f9e778973b3.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{c5d872adce711ec61ede.js → 8980c5dc389c27368b73.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{6acaf28cba5d49a98fb6.js → 91b292f310f06a0cbf72.js} +1 -1
  17. package/assets/esri/core/workers/chunks/9bac27976e7a71268b7b.js +1 -0
  18. package/assets/esri/core/workers/chunks/{ff9efa829497557ec26a.js → aa4640a0207e0be224e2.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{81a6f4b43e047c3395c0.js → aebc5091bd4159197ce0.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{c8cd3fde6d8d43ddb954.js → b6cdf4daf07d9e55f61e.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{6b14673a4afd6ef81487.js → c76cabd2d2510a653dff.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{4be7647605300e07e843.js → c90fff7e28ba5b443b11.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{e637e47000f4dc48054d.js → cc7f4fd20443a2acf0f1.js} +1 -1
  24. package/assets/esri/core/workers/chunks/d19e9fab4f4fb765c6a3.js +1 -0
  25. package/assets/esri/core/workers/chunks/d9ef4891c8b0bdd90f5b.js +1 -0
  26. package/assets/esri/core/workers/chunks/{d92d6a43270fb0d366b4.js → de4f5c48efbcee82c3c1.js} +1 -1
  27. package/assets/esri/core/workers/chunks/f6e7948075b3742b4ef9.js +1 -0
  28. package/assets/esri/core/workers/chunks/{32f9b488915a4a8864e5.js → f8b9e0c1671e55b61904.js} +1 -1
  29. package/assets/esri/views/3d/analysis/Slice/images/heading-rotate.ts.svg +7 -28
  30. package/assets/esri/views/3d/analysis/Slice/images/tilt-rotate.ts.svg +11 -0
  31. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList.json +1 -1
  32. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ar.json +1 -1
  33. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_bg.json +1 -1
  34. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_bs.json +1 -1
  35. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ca.json +1 -1
  36. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_cs.json +1 -1
  37. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_da.json +1 -1
  38. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_de.json +1 -1
  39. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_el.json +1 -1
  40. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_en.json +1 -1
  41. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_es.json +1 -1
  42. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_et.json +1 -1
  43. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_fi.json +1 -1
  44. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_fr.json +1 -1
  45. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_he.json +1 -1
  46. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_hr.json +1 -1
  47. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_hu.json +1 -1
  48. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_id.json +1 -1
  49. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_it.json +1 -1
  50. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ja.json +1 -1
  51. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ko.json +1 -1
  52. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_lt.json +1 -1
  53. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_lv.json +1 -1
  54. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_nb.json +1 -1
  55. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_nl.json +1 -1
  56. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pl.json +1 -1
  57. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pt-BR.json +1 -1
  58. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pt-PT.json +1 -1
  59. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ro.json +1 -1
  60. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ru.json +1 -1
  61. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sk.json +1 -1
  62. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sl.json +1 -1
  63. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sr.json +1 -1
  64. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sv.json +1 -1
  65. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_th.json +1 -1
  66. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_tr.json +1 -1
  67. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_uk.json +1 -1
  68. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_vi.json +1 -1
  69. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-CN.json +1 -1
  70. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-HK.json +1 -1
  71. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-TW.json +1 -1
  72. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  73. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  74. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  75. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  76. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  77. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  78. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  79. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  80. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  81. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  82. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  83. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  84. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  85. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  86. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  87. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  88. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  89. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  90. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  91. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  92. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  93. package/assets/esri/widgets/Editor/t9n/Editor_nb.json +1 -1
  94. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  95. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  96. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  97. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  98. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  99. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  100. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  101. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  102. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  103. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  104. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  105. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  106. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  107. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  108. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  109. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  110. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  111. package/assets/esri/widgets/LayerList/t9n/LayerList.json +1 -1
  112. package/assets/esri/widgets/LayerList/t9n/LayerList_ar.json +1 -1
  113. package/assets/esri/widgets/LayerList/t9n/LayerList_bg.json +1 -1
  114. package/assets/esri/widgets/LayerList/t9n/LayerList_bs.json +1 -1
  115. package/assets/esri/widgets/LayerList/t9n/LayerList_ca.json +1 -1
  116. package/assets/esri/widgets/LayerList/t9n/LayerList_cs.json +1 -1
  117. package/assets/esri/widgets/LayerList/t9n/LayerList_da.json +1 -1
  118. package/assets/esri/widgets/LayerList/t9n/LayerList_de.json +1 -1
  119. package/assets/esri/widgets/LayerList/t9n/LayerList_el.json +1 -1
  120. package/assets/esri/widgets/LayerList/t9n/LayerList_en.json +1 -1
  121. package/assets/esri/widgets/LayerList/t9n/LayerList_es.json +1 -1
  122. package/assets/esri/widgets/LayerList/t9n/LayerList_et.json +1 -1
  123. package/assets/esri/widgets/LayerList/t9n/LayerList_fi.json +1 -1
  124. package/assets/esri/widgets/LayerList/t9n/LayerList_fr.json +1 -1
  125. package/assets/esri/widgets/LayerList/t9n/LayerList_he.json +1 -1
  126. package/assets/esri/widgets/LayerList/t9n/LayerList_hr.json +1 -1
  127. package/assets/esri/widgets/LayerList/t9n/LayerList_hu.json +1 -1
  128. package/assets/esri/widgets/LayerList/t9n/LayerList_id.json +1 -1
  129. package/assets/esri/widgets/LayerList/t9n/LayerList_it.json +1 -1
  130. package/assets/esri/widgets/LayerList/t9n/LayerList_ja.json +1 -1
  131. package/assets/esri/widgets/LayerList/t9n/LayerList_ko.json +1 -1
  132. package/assets/esri/widgets/LayerList/t9n/LayerList_lt.json +1 -1
  133. package/assets/esri/widgets/LayerList/t9n/LayerList_lv.json +1 -1
  134. package/assets/esri/widgets/LayerList/t9n/LayerList_nb.json +1 -1
  135. package/assets/esri/widgets/LayerList/t9n/LayerList_nl.json +1 -1
  136. package/assets/esri/widgets/LayerList/t9n/LayerList_pl.json +1 -1
  137. package/assets/esri/widgets/LayerList/t9n/LayerList_pt-BR.json +1 -1
  138. package/assets/esri/widgets/LayerList/t9n/LayerList_pt-PT.json +1 -1
  139. package/assets/esri/widgets/LayerList/t9n/LayerList_ro.json +1 -1
  140. package/assets/esri/widgets/LayerList/t9n/LayerList_ru.json +1 -1
  141. package/assets/esri/widgets/LayerList/t9n/LayerList_sk.json +1 -1
  142. package/assets/esri/widgets/LayerList/t9n/LayerList_sl.json +1 -1
  143. package/assets/esri/widgets/LayerList/t9n/LayerList_sr.json +1 -1
  144. package/assets/esri/widgets/LayerList/t9n/LayerList_sv.json +1 -1
  145. package/assets/esri/widgets/LayerList/t9n/LayerList_th.json +1 -1
  146. package/assets/esri/widgets/LayerList/t9n/LayerList_tr.json +1 -1
  147. package/assets/esri/widgets/LayerList/t9n/LayerList_uk.json +1 -1
  148. package/assets/esri/widgets/LayerList/t9n/LayerList_vi.json +1 -1
  149. package/assets/esri/widgets/LayerList/t9n/LayerList_zh-CN.json +1 -1
  150. package/assets/esri/widgets/LayerList/t9n/LayerList_zh-HK.json +1 -1
  151. package/assets/esri/widgets/LayerList/t9n/LayerList_zh-TW.json +1 -1
  152. package/chunks/ComponentShader.glsl.js +1 -1
  153. package/chunks/DefaultMaterial.glsl.js +4 -4
  154. package/chunks/vec42.js +1 -1
  155. package/core/Loadable.js +1 -1
  156. package/core/accessorSupport/Property.js +1 -1
  157. package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
  158. package/core/analysisThemeUtils.js +1 -1
  159. package/core/maybe.js +1 -1
  160. package/geometry/support/buffer/math/vec4.js +1 -1
  161. package/interfaces.d.ts +1 -1
  162. package/layers/IntegratedMeshLayer.js +1 -1
  163. package/layers/LineOfSightLayer.js +1 -1
  164. package/layers/SceneLayer.js +1 -1
  165. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  166. package/layers/mixins/ImageryTileMixin.js +1 -1
  167. package/layers/mixins/RefreshableLayer.js +1 -1
  168. package/layers/support/SceneFilter.js +1 -1
  169. package/layers/support/SceneModifications.js +1 -1
  170. package/layers/support/rasterFunctions/clipUtils.js +1 -1
  171. package/layers/support/rasterFunctions/stretchUtils.js +1 -1
  172. package/package.json +1 -1
  173. package/portal/PortalItemResource.js +1 -1
  174. package/portal/support/resourceUtils.js +1 -1
  175. package/support/revision.js +1 -1
  176. package/symbols/support/utils.js +1 -1
  177. package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
  178. package/views/2d/viewpointUtils.js +1 -1
  179. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  180. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  181. package/views/3d/analysis/Dimension/settings.js +1 -1
  182. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  183. package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
  184. package/views/3d/analysis/Slice/images/Factory.js +1 -1
  185. package/views/3d/analysis/Slice/images/generateTextures.js +1 -1
  186. package/views/3d/analysis/Slice/images/heading-rotate-svg.js +1 -1
  187. package/views/3d/analysis/Slice/images/tilt-rotate-svg.js +5 -0
  188. package/views/3d/analysis/Slice/settings.js +5 -0
  189. package/views/3d/analysis/Slice/sliceToolConfig.js +1 -1
  190. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  191. package/views/3d/environment/Stars.js +1 -1
  192. package/views/3d/interactive/Manipulator3D.js +1 -1
  193. package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
  194. package/views/3d/interactive/manipulatorUtils.js +1 -1
  195. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  196. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  197. package/views/3d/layers/PointCloudWorker.js +1 -1
  198. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  199. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  200. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  201. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  202. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  203. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  204. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  205. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  206. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  207. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  208. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  209. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  210. package/views/3d/layers/i3s/PointCloudRendererUtil.js +1 -1
  211. package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
  212. package/views/3d/layers/i3s/PointGraphic.js +1 -1
  213. package/views/3d/state/ViewState.js +1 -1
  214. package/views/3d/state/controllers/SurfaceCollisionCorrectionController.js +1 -1
  215. package/views/3d/terrain/GeometryState.js +1 -1
  216. package/views/3d/terrain/PatchGeometry.js +1 -1
  217. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  218. package/views/3d/terrain/TileAgent.js +1 -1
  219. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  220. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  221. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  222. package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +6 -5
  223. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +1 -1
  224. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +11 -11
  225. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeShadingNormal.glsl.js +1 -1
  226. package/views/3d/webgl-engine/lib/AnimationTimeStep.js +1 -1
  227. package/views/3d/webgl-engine/lib/AttributeArray.js +1 -1
  228. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  229. package/views/3d/webgl-engine/lib/Normals.js +5 -0
  230. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  231. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  232. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  233. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  234. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  235. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  236. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  237. package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
  238. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  239. package/views/LayerViewManager.js +1 -1
  240. package/views/SceneView.js +1 -1
  241. package/views/draw/support/Reshape.js +1 -1
  242. package/views/layers/SceneLayerView.js +1 -1
  243. package/views/support/colorUtils.js +1 -1
  244. package/views/webgl/ShaderTranspiler.js +1 -1
  245. package/widgets/BasemapLayerList.js +1 -1
  246. package/widgets/Daylight/DaylightViewModel.js +1 -1
  247. package/widgets/Expand.js +1 -1
  248. package/widgets/FeatureForm/FieldInput.js +1 -1
  249. package/widgets/LayerList.js +1 -1
  250. package/widgets/Search.js +1 -1
  251. package/widgets/Sketch/SketchViewModel.js +1 -1
  252. package/assets/esri/core/workers/chunks/0487ab23a20ec356ab4c.js +0 -1
  253. package/assets/esri/core/workers/chunks/29ee4f14602caf6967e4.js +0 -1
  254. package/assets/esri/core/workers/chunks/2c0775541cfec9d43acb.js +0 -1
  255. package/assets/esri/core/workers/chunks/4879164b48da9ad4547a.js +0 -1
  256. package/assets/esri/core/workers/chunks/69060e5cffc19e76062a.js +0 -1
  257. package/assets/esri/core/workers/chunks/87edeb09a948122fa030.js +0 -1
  258. package/assets/esri/core/workers/chunks/92951b85676df776961f.js +0 -1100
  259. package/assets/esri/core/workers/chunks/a71a5c8a9aa302bf6f01.js +0 -1
  260. package/assets/esri/core/workers/chunks/ad5c61daaed286c74982.js +0 -1
  261. package/assets/esri/core/workers/chunks/bc002e4dff8859571a7a.js +0 -1
  262. package/assets/esri/core/workers/chunks/ef2d3e84cd58df5f80af.js +0 -1
  263. package/assets/esri/core/workers/chunks/fec5e55e0fbf1710e22d.js +0 -1
  264. package/assets/esri/views/3d/analysis/Slice/images/tilt-rotate.svg +0 -80
  265. package/assets/esri/views/3d/analysis/Slice/images/tilt-rotate.ts.png +0 -0
  266. package/views/3d/analysis/Slice/images/tilt-rotate-png.js +0 -5
  267. package/views/3d/webgl-engine/core/shaderLibrary/util/DecodeNormal.glsl.js +0 -8
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{result as t,forEach as i}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import s from"../../../core/Logger.js";import{destroyMaybe as o,abortMaybe as n,isSome as a}from"../../../core/maybe.js";import{eachAlways as d,isAbortError as l,eachAlwaysValues as h,throwIfAborted as u}from"../../../core/promiseUtils.js";import{initial as p,watch as c,sync as _}from"../../../core/reactiveUtils.js";import{pt2px as m}from"../../../core/screenUtils.js";import{estimateSize as g,isArrayBuffer as f}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as y}from"../../../core/unitUtils.js";import{property as b}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as w}from"../../../core/accessorSupport/decorators/subclass.js";import{e as N,c as P}from"../../../chunks/vec3.js";import{b as x}from"../../../chunks/vec3f32.js";import{projectBoundingRect as v}from"../../../geometry/projection.js";import{create as C}from"../../../geometry/support/aaBoundingBox.js";import{containsPoint as S,create as A}from"../../../geometry/support/aaBoundingRect.js";import{create as I,fromNormalAndOffset as k}from"../../../geometry/support/plane.js";import{makeDehydratedPoint as V}from"../../../layers/graphics/dehydratedFeatures.js";import{CodedValue as R}from"../../../layers/support/CodedValue.js";import"../../../core/has.js";import L from"../../../layers/support/CodedValueDomain.js";import"../../../layers/support/Domain.js";import"../../../layers/support/InheritedDomain.js";import"../../../layers/support/RangeDomain.js";import{unpackFieldNames as j}from"../../../layers/support/fieldUtils.js";import{PromiseQueue as Q}from"../../../layers/support/PromiseQueue.js";import{getMetersPerUnit as U}from"../../../symbols/support/unitConversionUtils.js";import{LayerView3D as D}from"./LayerView3D.js";import{PointCloudWorkerHandle as F}from"./PointCloudWorkerHandle.js";import{checkPointCloudLayerValid as z,checkPointCloudLayerCompatibleWithView as M}from"./i3s/I3SUtil.js";import{nodeDiff as W,sortFrontToBack as E,splitWorkEntries as O}from"./i3s/LoDUtil.js";import B from"./i3s/PagedNodeIndex.js";import{getSplatSizeAlgorithm as G,getFixedSizeAlgorithm as H,getRendererInfo as q,getFilterInfo as T,rendererUsesFixedSizes as $,getAttributeInfo as J}from"./i3s/PointCloudRendererUtil.js";import{getAttributeValues as K,readGeometry as X,elevationFromPositions as Y}from"./i3s/PointCloudWorkerUtil.js";import{PointGraphic as Z}from"./i3s/PointGraphic.js";import{PointRenderer as ee,isInstanceOfNode as te,PointRendererNode as ie}from"./i3s/PointRenderer.js";import{PopupSceneLayerView as re}from"./support/PopupSceneLayerView.js";import{projectToBoundingBox as se}from"../support/extentUtils.js";import{ClientType as oe}from"../support/index.js";import{minimumDistancePlane as ne}from"../support/orientedBoundingBox.js";import{updatingProgress as ae}from"../support/updatingProperties.js";import{RenderSlot as de}from"../webgl-engine/lib/RenderSlot.js";import le from"../../layers/LayerView.js";import{isScaleRangeActive as he,extractSafeScaleBounds as ue,scaleBoundsPredicate as pe}from"../../support/layerViewUtils.js";import{TaskPriority as ce}from"../../support/Scheduler.js";const _e=8,me=I();let ge=class extends(re(D(le))){constructor(){super(...arguments),this.type="point-cloud-3d",this.maximumPointCount=4e6,this.slicePlaneEnabled=!1,this._renderer=null,this._rendererAdded=!1,this._renderedNodes=new Set,this._nodeScales=new Map,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new Q,this._indexPagesLoading=new Map,this._loadingNodes=new Map,this._recalcWork=!0,this._layerIsVisible=!1,this._codedDomainPopulationPromise=null,this._codedDomainPopulationAbortController=null,this._totalWork=0,this._index=null,this._loadingInitNodePage=!1,this._nodeIdArray=[],this.ignoresMemoryFactor=!1}get baseUrl(){return this.layer.parsedUrl.path}get pointScale(){const e=G(this.layer&&this.layer.renderer),t=1;return e&&null!=e.scaleFactor?e.scaleFactor:t}get useRealWorldSymbolSizes(){const e=H(this.layer&&this.layer.renderer),t=!1;return e&&null!=e.useRealWorldSymbolSizes?e.useRealWorldSymbolSizes:t}get pointSize(){const e=H(this.layer&&this.layer.renderer),t=0;return e&&null!=e.size?e.size:t}get inverseDensity(){const e=96;return this.layer&&this.layer.renderer?1*e/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=q(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.modulationAttribute.name);const i=T(this.layer);if(i)for(const r of i)r.attributeInfo&&t.add(r.attributeInfo.name);if(this.layer.outFields)for(const r of j(this.layer.fieldsIndex,this.layer.outFields))t.add(r);return Array.from(t)}get _clippingBox(){if(!this.view||!this.view.clippingArea)return null;const e=C(),t=this.view.renderSpatialReference;return se(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;if(e&&"absolute-height"===e.mode){const t=y(this.layer.spatialReference),i=U(e.unit);return(e.offset??0)*i/t}return 0}initialize(){const e=this.view.resourceController,t=Ne(e);this._worker=new F(t),this.addResolvingPromise(this._worker.promise),this._tmpPoint=V(0,0,0,this.layer.spatialReference),z(this.layer),M(this.layer,this.view),this._indexRequester=e.createStreamDataRequester(oe.I3S_INDEX),this._dataRequester=e.createStreamDataRequester(oe.I3S_DATA),this._initRenderer();const i=this._initNodePages(),r=this.view.resourceController.memoryController;this._memCache=r.newCache(this.layer.uid),this.updatingHandles.add((()=>this._clippingBox),(()=>this._setUpdateViewNeeded()),p),this.updatingHandles.add((()=>this._elevationOffset),(()=>this._elevationOffsetChanged()),p),this.updatingHandles.add((()=>this.layer.renderer),(()=>this._rendererChanged()),p),this.updatingHandles.add((()=>this.layer.filters),(()=>this._reload()),p),this.updatingHandles.add((()=>this.layer.outFields),(()=>this._reload()),p),this.updatingHandles.add((()=>this.layer.effectiveScaleRange),(()=>this._setUpdateViewNeeded())),this.updatingHandles.add((()=>this.view.state.contentCamera),(()=>this._setUpdateViewNeeded())),this.handles.add([this.view.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),c((()=>r.memoryFactor),(()=>this._setUpdateViewNeeded()),_)]),this.addResolvingPromise(i),this.when((()=>{this.handles.add([e.scheduler.registerTask(ce.POINT_CLOUD_LAYER,this),e.scheduler.registerIdleStateCallbacks((()=>this._idleBegin()),(()=>this._idleEnd())),this.updatingHandles.add((()=>this.suspended),(e=>{e?this._clearNodeState():this._setUpdateViewNeeded()}),p)])}),(()=>{this.updatingHandles.removeAll(),this.handles.removeAll()}))}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker=o(this._worker),this._destroyRenderer(),this._memCache=o(this._memCache),this._codedDomainPopulationAbortController=n(this._codedDomainPopulationAbortController),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new ee({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerUid=this.layer.uid,this.updatingHandles.add((()=>this._clippingBox),(e=>this._renderer.clippingBox=e),p),this.updatingHandles.add((()=>this.suspended),(e=>this._setPointsVisible(!e)),p),this.updatingHandles.add((()=>this.pointScale),(e=>this._renderer.scaleFactor=e),p),this._renderer.minSizePx=Math.sqrt(2),this.updatingHandles.add((()=>this.useRealWorldSymbolSizes),(e=>this._renderer.useRealWorldSymbolSizes=e),p),this.updatingHandles.add((()=>this.pointSize),(e=>{const t=m(e);this._renderer.size=e,this._renderer.sizePx=t}),p),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._renderer.slicePlaneEnabled=e),p),this.updatingHandles.add((()=>this.inverseDensity),(()=>this._setUpdateViewNeeded()),p),this.updatingHandles.add((()=>this.maximumPointCount),(()=>this._setUpdateViewNeeded()),p),this.updatingHandles.add((()=>this.view.qualitySettings.sceneService.pointCloud.lodFactor),(e=>{this._lodFactor=e,this._setUpdateViewNeeded()}),p)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i){const r=null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t,s=this.view.computeMapPointFromVec3d(i),o=this._createGraphicAttributes(e,r);return new Z({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:r,epoch:this._nodeLoadEpoch},geometry:s,attributes:o,layer:this.layer,sourceLayer:this.layer})}_createGraphicAttributes(e,t){const i={};for(const r of e.attributes)this._encodeGraphicAttribute(r.attributeInfo,r.values,t,i);return i}_encodeGraphicAttribute(e,t,i,r){const s=e.storageInfo?.attributeValues,o=s?.valuesPerElement??1;if(1===o)r[e.name]=t[i];else if("UInt8"===s?.valueType&&o<=4){let s=0;const n=i*o;for(let e=n;e<n+o;e++)s=(s<<8)+t[e];r[e.name]=s}else r[e.name]=void 0}_setPointsVisible(e){e&&!this._rendererAdded?(this.view._stage.addRenderPlugin([de.OPAQUE_MATERIAL],this._renderer),this._rendererAdded=!0):!e&&this._rendererAdded&&(this.view._stage.removeRenderPlugin(this._renderer),this._rendererAdded=!1)}_rendererChanged(){this._renderer.useFixedSizes=$(this.layer.renderer),this._reload()}_reload(){this._clearNodeState(),this._memCache.clear(),this._setUpdateViewNeeded()}_elevationOffsetChanged(){this._clearNodeState(),this._memCache.clear(),this._initNodePages()}_scaleUpdateHandler(e){const t=this.layer.effectiveScaleRange;he(t.minScale,t.maxScale)?v(e.extent,e.spatialReference,be,this.layer.spatialReference)&&(this._nodeScales.forEach(((t,i)=>{if(!this._renderedNodes.has(i))return void this._nodeScales.delete(i);const r=this._index.getNode(i);S(be,r.obb.center)&&this._nodeScales.set(i,e.scale)})),this._setUpdateViewNeeded()):this._nodeScales.clear()}_displayNodes(e){this._workQueue=W([...this._renderedNodes],e,this._index),E(this._workQueue,this.view.state.contentCamera.viewForward,this._index),O(this._workQueue,_e,this._index),this._updateQueues(),this._totalWork=this._computeWork(),this._updateLoading(),this._layerIsVisible=e.length>0||this._loadingInitNodePage,this.notifyChange("suspended")}cancelLoading(){this._cancelNodeLoading(),this._cancelIndexLoading()}_cancelNodeLoading(){const e=new Array;this._loadingNodes.forEach((({abortController:t})=>e.push(t))),this._loadingNodes.clear();for(const t of e)t.abort();this._workQueue=[],this._idleQueue.cancelAll(),this._totalWork=this._computeWork(),this._updateLoading()}_updateQueues(){const e=new Set;this._workQueue.forEach((t=>t.load.forEach((t=>e.add(t)))));const t=new Array,i=new Map;this._loadingNodes.forEach(((r,s)=>{e.has(s)?i.set(s,r):t.push(r)})),this._loadingNodes=i;for(const{abortController:r}of t)r.abort();this._workQueue=this._workQueue.filter((e=>{for(const t of e.load)if(this._loadingNodes.has(t))return this._recalcWork=!0,!1;return!0})),this._totalWork=this._computeWork(),this._updateLoading()}_cancelIndexLoading(){this._indexQueue=[],this._indexPagesLoading.forEach((({abortController:e})=>e.abort())),this._indexPagesLoading.clear(),this._totalWork=this._computeWork(),this._updateLoading()}_clearNodeState(){this._nodeLoadEpoch++,this._renderedNodes.forEach((e=>this._removeFromRenderer(e))),this._cancelNodeLoading()}_idleBegin(){this._setUpdateViewNeeded()}_idleEnd(){this._setUpdateViewNeeded()}get running(){return this.suspended?this._updateViewNeeded:this._updateViewNeeded||this._indexQueue.length>0||this._workQueue.length>0||this._idleQueue.running}runTask(e){if(this.suspended){if(this._updateViewNeeded){this._updateViewNeeded=!1;const e=this._isRootNodeVisible();e!==this._layerIsVisible&&(this._layerIsVisible=e,this.notifyChange("suspended")),this._updateLoading()}}else{for(e.run((()=>this._updateWorkQueues()));this._indexQueue.length>0&&e.run((()=>this._processIndexQueue())););this._processWorkQueue(e),this._idleQueue.runTask(e)}}_processIndexQueue(){const e=this._indexQueue.shift(),t=this._loadNodePage(e);return this._indexPagesLoading.set(e,t),t.promise.then((t=>{this._index.addPage(e,t,this._elevationOffset),this._setUpdateViewNeeded()})).then((()=>{this._indexPagesLoading.delete(e)}),(()=>{this._indexPagesLoading.delete(e)})),!0}_processWorkQueue(e){for(;!e.done;){const t=this._scheduleWorkEntry();if(null==t)return;this._processWorkEntry(t),e.madeProgress()}}_scheduleWorkEntry(){let e=this._workQueue.length;for(;e--;){const e=this._workQueue.shift();if(!e.remove.find((e=>!this._renderedNodes.has(e))))return e;this._workQueue.push(e)}return null}_processWorkEntry(e){if(0!==e.load.length)Promise.all(e.load.map((e=>{const t=new AbortController,i=this._memCache.pop(e.toString());return null!=i?this._loadingNodes.set(e,{abortController:t,promise:Promise.resolve(i)}):this._loadingNodes.has(e)||this._loadingNodes.set(e,{abortController:t,promise:this._loadNode(e,t.signal)}),this._loadingNodes.get(e).promise}))).then((t=>{for(let i=0;i<e.load.length;i++)if(t[i]){const r=this._setupRendererData(e.load[i],t[i]);this._addToRenderer(r)}for(const i of e.remove)this._removeFromRenderer(i)})).catch((()=>{})).then((()=>{for(const t of e.load)this._loadingNodes.delete(t);this._updateLoading(),this._recalcWork&&!this._idleQueue.running&&0===this._indexQueue.length&&0===this._loadingNodes.size&&(this._recalcWork=!1,this._setUpdateViewNeeded())})),this._updateLoading();else for(const t of e.remove)this._removeFromRenderer(t)}async _populateClassCodeCodedDomain(e,i){const r="CLASS_CODE",s=this.layer.fieldsIndex.get(r);if(!s||s.domain)return;if(!e.includes(s.name))return;const o=await t(this.layer.queryCachedStatistics(r,{signal:i}));if(!1===o.ok)return;const n=o.value?.stats?.labels?.labels;n&&Array.isArray(n)&&(s.domain=new L({name:"CLASS_CODE",codedValues:n.map((e=>new R({code:e.value,name:e.label})))}))}async prepareFetchPopupFeatures(e){return this._codedDomainPopulationPromise||(this._codedDomainPopulationAbortController=new AbortController,this._codedDomainPopulationPromise=this._populateClassCodeCodedDomain(e,this._codedDomainPopulationAbortController.signal).then((()=>{this._codedDomainPopulationAbortController=null}))),this._codedDomainPopulationPromise}async whenGraphicAttributes(e,t){const r=this._splitGraphicsPerNode(e),s=this.layer.attributeStorageInfo,o=t.map((e=>J(s,e))).filter(a),n=async(e,t)=>{const r=this._index.getNode(t);await i(o,(async t=>{const i=t.useElevation?await this._loadElevationAttributeFromGeometry(r.resourceId):await this._loadAndParseAttribute(r,t);if(i)for(const r of e)if(this._isValidPointGraphic(r)){const e=r.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(t,i,e,r.attributes)}}))},l=[];return r.forEach(((e,t)=>{l.push(n(e,t))})),await d(l),e}_isValidPointGraphic(e){return e instanceof Z&&e.pointCloudMetadata&&e.pointCloudMetadata.epoch===this._nodeLoadEpoch}_splitGraphicsPerNode(e){const t=new Map;for(const i of e){if(!this._isValidPointGraphic(i))continue;const e=i.pointCloudMetadata,r=t.get(e.nodeId);r?r.push(i):t.set(e.nodeId,[i])}return t}async _loadAndParseAttribute(e,t){const i=await this._loadAttribute(e.resourceId,t,null);return null!=i?K({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=X(t,await this._loadGeometry(e,null));return Y(i,i.length/3)}highlight(e){if(!e)return{remove(){}};const t=r.isCollection(e)?e.toArray():Array.isArray(e)?e:[e];return this._renderer.highlight(t.map((e=>this._graphicToPointDefinition(e))))}_graphicToPointDefinition(e){if(!this._isValidPointGraphic(e))return null;const{nodeId:t,pointIndexInNode:i}=e.pointCloudMetadata;return null!=t&&null!=i?{nodeId:t,pointId:i}:null}_computeWork(){let e=0;for(const t of this._workQueue)e+=t.load.length+t.remove.length;return e+=this._loadingNodes.size,e+=(this._indexQueue.length+this._indexPagesLoading.size)*this._index.pageSize,e+=this._loadingInitNodePage?100:0,e+=this._updateViewNeeded?100:0,e}get updatingProgressValue(){if(this.suspended)return this._updateViewNeeded?0:1;const e=this._computeWork();return 1-Math.min(this._totalWork,e)/this._totalWork}_updateLoading(){this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}canResume(){return super.canResume()&&this._layerIsVisible}isUpdating(){return this.suspended?this._updateViewNeeded:this._computeWork()>0}_initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;return this._index=new B(this.layer.spatialReference,this.view.renderCoordsHelper.spatialReference,t),this._cancelIndexLoading(),this._traverseVisible=this._index.createVisibilityTraverse(),this._loadingInitNodePage=!0,this._layerIsVisible=!0,this.notifyChange("suspended"),this._updateLoading(),this._pageMultiplier=null!=e.nodesPerPage?1:e.nodePerIndexBlock,this._loadNodePage(0).promise.then((e=>{this._index.addPage(0,e,this._elevationOffset),this._loadingInitNodePage=!1,this._setUpdateViewNeeded()}))}_loadNodePage(e){const t=new AbortController,i=`${this.baseUrl}/nodepages/${e*this._pageMultiplier}`;return{promise:this._requestNodePage(i,t.signal).then((t=>t.nodes.map(((t,i)=>({resourceId:null!=t.resourceId?t.resourceId:e*this._index.pageSize+i,obb:t.obb,firstChild:t.firstChild,childCount:t.childCount,vertexCount:t.vertexCount??t.pointCount,lodThreshold:t.lodThreshold??t.effectiveArea}))))),abortController:t}}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;let e=this.inverseDensity/this._lodFactor*this._getLodMemoryFactor();const t=this.maximumPointCount*this._lodFactor*this._getLodMemoryFactor();let i=this._computeNodesForMinimumDensity(e),r=this._computePointCount(i),s=Math.sqrt(r/(.75*t));for(;r>t;)e*=s,i=this._computeNodesForMinimumDensity(e),r=this._computePointCount(i),s=Math.sqrt(2);return this._displayNodes(i),this._updateViewNeeded=!1,this._updateLoading(),!0}_computePointCount(e){let t=0;for(let i=0;i<e.length;i++){const r=this._index.getNode(e[i]);r&&(t+=r.vertexCount)}return t}_getLodMemoryFactor(){return this.view.resourceController.memoryController.memoryFactor}_isRootNodeVisible(){let e=!1;return this._traverseVisible({frustum:this.view.state.contentCamera.frustum,clippingBox:this._clippingBox},{predicate:(t,i,r)=>(e=r,!1),pageMiss:()=>{}}),e}_computeNodesForMinimumDensity(e){const t=this.view.state.contentCamera,i=t.frustum,r=this._clippingBox,s=t.viewForward,o=N(s,t.eye),n=k(s,-o,me),a=t.perScreenPixelRatio/2,d=e*e,l=this._nodeIdArray;l.length=0;const{minScale:h,maxScale:u}=ue(this.layer),p=0===h&&0===u?e=>l.push(e):e=>{const t=this._getScale(e);pe(t,h,u)&&l.push(e)};return this._traverseVisible({frustum:i,clippingBox:r},{predicate:(e,t,i)=>{if(!i)return!1;if(0===t.childCount)return p(e),!1;const r=this._index.getRenderObb(e);return!(this._computeAveragePixelArea(r,t.lodThreshold,t.vertexCount,n,a)<=d)||(p(e),!1)},pageMiss:(e,t)=>{p(e),this._indexQueue.includes(t)||this._indexQueue.push(t)}}),l}_getScale(e){let t=this._nodeScales.get(e);if(null==t){const i=this._index.getNode(e).obb.center;this._tmpPoint.x=i[0],this._tmpPoint.y=i[1],this._tmpPoint.z=i[2],t=this.view.basemapTerrain.getScale(this._tmpPoint),this._nodeScales.set(e,t)}return t}_computeAveragePixelArea(e,t,i,r,s){const o=1e-7,n=Math.max(o,ne(e,r));return t/(n*n)/(4*s*s)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw l(i)||s.getLogger(this.declaredClass).error(i),i}}async _loadAdditionalUserAttributes(e,t,i){const r=this.layer.outFields;if(!r)return[];const s=j(this.layer.fieldsIndex,r),o=new Set(e.map((e=>null!=e?e.name:null))),n=this.layer.attributeStorageInfo,d=[];for(const a of s){if(o.has(a))continue;const e=J(n,a);e&&d.push(t(e))}const l=await h(d);return u(i),l.filter(a)}async _loadNodeAsync(e,t){const i=this._index.getNode(e),r=q(this.layer),s=T(this.layer),o=i.resourceId,n=async e=>{if(null==e)return null;if(e.useElevation)return{attributeInfo:e,buffer:null};const i=await this._loadAttribute(o,e,t);return null!=i?{attributeInfo:e,buffer:i}:null};return this._idleQueue.push((async()=>{const i=this._loadGeometry(o,t),{primaryAttribute:a,modulationAttribute:d}=r,l=n(a),h=n(d),p=s.map((e=>e.attributeInfo)),c=p.map((e=>n(e))),_=this._loadAdditionalUserAttributes([a,d,...p],n,t),[m,g,f,y,b]=await Promise.all([i,l,h,Promise.all(c),_]);u(t);const w={geometryBuffer:m,primaryAttributeData:g,modulationAttributeData:f,filterAttributesData:y,userAttributesData:b,schema:this.layer.store.defaultGeometrySchema,rendererInfo:r,filterInfo:s,obb:this._index.getRenderObb(e),elevationOffset:this._elevationOffset,inSR:this.layer.spatialReference.toJSON(),outSR:this.view.renderCoordsHelper.spatialReference.toJSON()};return this._worker.invoke(w,t)}),t)}async _loadGeometry(e,t){return this._requestData(`${this.baseUrl}/nodes/${e}/geometries/0`,t)}async _loadAttribute(e,t,i){if(null==t||!t.storageInfo)return null;const r=t.storageInfo.key;return this._requestData(`${this.baseUrl}/nodes/${e}/attributes/${r}`,i)}_requestNodePage(e,t){const i={f:"json",token:this.layer.apiKey};return this._indexRequester.request(e,"json",{query:i,signal:t})}_requestData(e,t){return this._dataRequester.request(e,"binary",{query:{token:this.layer.apiKey},signal:t})}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._nodeScales.delete(e),this._memCache.put(t.id.toString(),t,ye(t))}}_addToRenderer(e){this._renderedNodes.has(e.id)||(this._renderedNodes.add(e.id),this._renderer.addNode(e))}_setupRendererData(e,t){const i=this._index.getNode(e),r=Math.sqrt(i.lodThreshold/i.vertexCount),o=this._index.getRenderObb(e);if(te(t))return t.splatSize=r,t.obb=o,P(t.origin,t.obb.center),t;const n=.01*Math.max(o.halfSize[0],o.halfSize[1],o.halfSize[2]);if(t.obb.halfSize[0]>o.halfSize[0]+n||t.obb.halfSize[1]>o.halfSize[1]+n||t.obb.halfSize[2]>o.halfSize[2]+n){if(this._maxLoggedBoxWarnings>0){const i=e=>`[${e.halfSize[0]}, ${e.halfSize[1]}, ${e.halfSize[2]}]`;s.getLogger(this.declaredClass).warn(`Node ${e} reported bounding box too small. got ${i(o)} but points cover ${i(t.obb)}`),0==--this._maxLoggedBoxWarnings&&s.getLogger(this.declaredClass).warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,t.obb)}return new ie(e,r,x(o.center),o,0===i.childCount,t.points,t.rgb,t.attributes,t.pointIdFilterMap)}get usedMemory(){let e=0;return this._renderer.forEachNode((t=>{e+=we,e+=g(t.coordinates);for(const i of t.attributes){const t=i.values;f(t.buffer)&&(e+=g(t))}})),e}get unloadedMemory(){const e=this._renderedNodes.size;if(e<4)return 0;const t=[...this._renderedNodes].reduce(((e,t)=>e+this._index.getNode(t).vertexCount));let i=this._loadingNodes.size;for(let r=0;r<this._workQueue.length;r++)i+=this._workQueue[r].load.length,i-=this._workQueue[r].remove.length;if(i<0)return 0;return i*t/e*((this.usedMemory-e*we)/t)+i*we}get performanceInfo(){return{nodes:this._renderedNodes.size,displayedNumberOfFeatures:[...this._renderedNodes].reduce(((e,t)=>e+this._index.getNode(t).vertexCount),0),maximumNumberOfFeatures:this.maximumPointCount,totalNumberOfFeatures:-1,core:null,"Loading Nodes":this._loadingNodes.size,"Index Queue":this._indexQueue.length,"Work Queue":this._workQueue.length,"Idle Queue":this._idleQueue.length}}get test(){return{index:this._index,visibleNodes:this._renderedNodes}}};e([b()],ge.prototype,"layer",void 0),e([b()],ge.prototype,"baseUrl",null),e([b()],ge.prototype,"pointScale",null),e([b()],ge.prototype,"useRealWorldSymbolSizes",null),e([b()],ge.prototype,"pointSize",null),e([b()],ge.prototype,"inverseDensity",null),e([b()],ge.prototype,"maximumPointCount",void 0),e([b({readOnly:!0})],ge.prototype,"availableFields",null),e([b({readOnly:!0})],ge.prototype,"_clippingBox",null),e([b({readOnly:!0})],ge.prototype,"_elevationOffset",null),e([b({type:Boolean})],ge.prototype,"slicePlaneEnabled",void 0),e([b()],ge.prototype,"updating",void 0),e([b(ae)],ge.prototype,"updatingProgress",void 0),e([b({readOnly:!0})],ge.prototype,"updatingProgressValue",null),ge=e([w("esri.views.3d.layers.PointCloudLayerView3D")],ge);const fe=ge;function ye(e){return 5*e.coordinates.length+128}const be=A(),we=160;function Ne(e){return t=>e.immediate.schedule(t)}export{fe as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{result as t,forEach as i}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import s from"../../../core/Logger.js";import{destroyMaybe as o,abortMaybe as n,isSome as a}from"../../../core/maybe.js";import{eachAlways as d,isAbortError as l,eachAlwaysValues as h,throwIfAborted as u}from"../../../core/promiseUtils.js";import{initial as p,watch as c,sync as _}from"../../../core/reactiveUtils.js";import{pt2px as m}from"../../../core/screenUtils.js";import{estimateSize as g,isArrayBuffer as f}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as y}from"../../../core/unitUtils.js";import{property as b}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as w}from"../../../core/accessorSupport/decorators/subclass.js";import{e as N,c as P}from"../../../chunks/vec3.js";import{b as x}from"../../../chunks/vec3f32.js";import{projectBoundingRect as v}from"../../../geometry/projection.js";import{create as C}from"../../../geometry/support/aaBoundingBox.js";import{containsPoint as S,create as A}from"../../../geometry/support/aaBoundingRect.js";import{create as I,fromNormalAndOffset as k}from"../../../geometry/support/plane.js";import{makeDehydratedPoint as V}from"../../../layers/graphics/dehydratedFeatures.js";import{CodedValue as R}from"../../../layers/support/CodedValue.js";import"../../../core/has.js";import L from"../../../layers/support/CodedValueDomain.js";import"../../../layers/support/Domain.js";import"../../../layers/support/InheritedDomain.js";import"../../../layers/support/RangeDomain.js";import{unpackFieldNames as j}from"../../../layers/support/fieldUtils.js";import{PromiseQueue as Q}from"../../../layers/support/PromiseQueue.js";import{getMetersPerUnit as U}from"../../../symbols/support/unitConversionUtils.js";import{LayerView3D as D}from"./LayerView3D.js";import{PointCloudWorkerHandle as F}from"./PointCloudWorkerHandle.js";import{checkPointCloudLayerValid as z,checkPointCloudLayerCompatibleWithView as W}from"./i3s/I3SUtil.js";import{nodeDiff as M,sortFrontToBack as E,splitWorkEntries as O}from"./i3s/LoDUtil.js";import B from"./i3s/PagedNodeIndex.js";import{getSplatSizeAlgorithm as G,getFixedSizeAlgorithm as H,getRendererInfo as q,getFilterInfo as T,rendererUsesFixedSizes as $,getAttributeInfo as J}from"./i3s/PointCloudRendererUtil.js";import{getAttributeValues as K,readGeometry as X,elevationFromPositions as Y}from"./i3s/PointCloudWorkerUtil.js";import{PointGraphic as Z}from"./i3s/PointGraphic.js";import{PointRenderer as ee,isInstanceOfNode as te,PointRendererNode as ie}from"./i3s/PointRenderer.js";import{PopupSceneLayerView as re}from"./support/PopupSceneLayerView.js";import{projectToBoundingBox as se}from"../support/extentUtils.js";import{ClientType as oe}from"../support/index.js";import{minimumDistancePlane as ne}from"../support/orientedBoundingBox.js";import{updatingProgress as ae}from"../support/updatingProperties.js";import{RenderSlot as de}from"../webgl-engine/lib/RenderSlot.js";import le from"../../layers/LayerView.js";import{isScaleRangeActive as he,extractSafeScaleBounds as ue,scaleBoundsPredicate as pe}from"../../support/layerViewUtils.js";import{TaskPriority as ce}from"../../support/Scheduler.js";const _e=8,me=I();let ge=class extends(re(D(le))){constructor(){super(...arguments),this.type="point-cloud-3d",this.maximumPointCount=4e6,this.slicePlaneEnabled=!1,this._renderer=null,this._rendererAdded=!1,this._renderedNodes=new Set,this._nodeScales=new Map,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new Q,this._indexPagesLoading=new Map,this._loadingNodes=new Map,this._recalcWork=!0,this._layerIsVisible=!1,this._codedDomainPopulationPromise=null,this._codedDomainPopulationAbortController=null,this._totalWork=0,this._index=null,this._loadingInitNodePage=!1,this._nodeIdArray=[],this.ignoresMemoryFactor=!1}get baseUrl(){return this.layer.parsedUrl.path}get pointScale(){const e=G(this.layer&&this.layer.renderer),t=1;return e&&null!=e.scaleFactor?e.scaleFactor:t}get useRealWorldSymbolSizes(){const e=H(this.layer&&this.layer.renderer),t=!1;return e&&null!=e.useRealWorldSymbolSizes?e.useRealWorldSymbolSizes:t}get pointSize(){const e=H(this.layer&&this.layer.renderer),t=0;return e&&null!=e.size?e.size:t}get inverseDensity(){const e=96;return this.layer&&this.layer.renderer?1*e/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=q(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.modulationAttribute.name);const i=T(this.layer);if(i)for(const r of i)r.attributeInfo&&t.add(r.attributeInfo.name);if(this.layer.outFields)for(const r of j(this.layer.fieldsIndex,this.layer.outFields))t.add(r);return Array.from(t)}get _clippingBox(){if(!this.view||!this.view.clippingArea)return null;const e=C(),t=this.view.renderSpatialReference;return se(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;if(e&&"absolute-height"===e.mode){const t=y(this.layer.spatialReference),i=U(e.unit);return(e.offset??0)*i/t}return 0}initialize(){const e=this.view.resourceController,t=Ne(e);this._worker=new F(t),this.addResolvingPromise(this._worker.promise),this._tmpPoint=V(0,0,0,this.layer.spatialReference),z(this.layer),W(this.layer,this.view),this._indexRequester=e.createStreamDataRequester(oe.I3S_INDEX),this._dataRequester=e.createStreamDataRequester(oe.I3S_DATA),this._initRenderer();const i=this._initNodePages(),r=this.view.resourceController.memoryController;this._memCache=r.newCache(this.layer.uid),this.updatingHandles.add((()=>this._clippingBox),(()=>this._setUpdateViewNeeded()),p),this.updatingHandles.add((()=>this._elevationOffset),(()=>this._elevationOffsetChanged()),p),this.updatingHandles.add((()=>this.layer.renderer),(()=>this._rendererChanged()),p),this.updatingHandles.add((()=>this.layer.filters),(()=>this._reload()),p),this.updatingHandles.add((()=>this.layer.outFields),(()=>this._reload()),p),this.updatingHandles.add((()=>this.layer.effectiveScaleRange),(()=>this._setUpdateViewNeeded())),this.updatingHandles.add((()=>this.view.state.contentCamera),(()=>this._setUpdateViewNeeded())),this.handles.add([this.view.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),c((()=>r.memoryFactor),(()=>this._setUpdateViewNeeded()),_)]),this.addResolvingPromise(i),this.when((()=>{this.handles.add([e.scheduler.registerTask(ce.POINT_CLOUD_LAYER,this),e.scheduler.registerIdleStateCallbacks((()=>this._idleBegin()),(()=>this._idleEnd())),this.updatingHandles.add((()=>this.suspended),(e=>{e?this._clearNodeState():this._setUpdateViewNeeded()}),p)])}),(()=>{this.updatingHandles.removeAll(),this.handles.removeAll()}))}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker=o(this._worker),this._destroyRenderer(),this._memCache=o(this._memCache),this._codedDomainPopulationAbortController=n(this._codedDomainPopulationAbortController),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new ee({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerUid=this.layer.uid,this.updatingHandles.add((()=>this._clippingBox),(e=>this._renderer.clippingBox=e),p),this.updatingHandles.add((()=>this.suspended),(e=>this._setPointsVisible(!e)),p),this.updatingHandles.add((()=>this.pointScale),(e=>this._renderer.scaleFactor=e),p),this._renderer.minSizePx=Math.sqrt(2),this.updatingHandles.add((()=>this.useRealWorldSymbolSizes),(e=>this._renderer.useRealWorldSymbolSizes=e),p),this.updatingHandles.add((()=>this.pointSize),(e=>{const t=m(e);this._renderer.size=e,this._renderer.sizePx=t}),p),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._renderer.slicePlaneEnabled=e),p),this.updatingHandles.add((()=>this.inverseDensity),(()=>this._setUpdateViewNeeded()),p),this.updatingHandles.add((()=>this.maximumPointCount),(()=>this._setUpdateViewNeeded()),p),this.updatingHandles.add((()=>this.view.qualitySettings.sceneService.pointCloud.lodFactor),(e=>{this._lodFactor=e,this._setUpdateViewNeeded()}),p)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i){const r=null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t,s=this.view.computeMapPointFromVec3d(i),o=this._createGraphicAttributes(e,r);return new Z({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:r,epoch:this._nodeLoadEpoch},geometry:s,attributes:o,layer:this.layer,sourceLayer:this.layer})}_createGraphicAttributes(e,t){const i={};for(const r of e.attributes)this._encodeGraphicAttribute(r.attributeInfo,r.values,t,i);return i}_encodeGraphicAttribute(e,t,i,r){const s=e.storageInfo?.attributeValues,o=s?.valuesPerElement??1;if(1===o)r[e.name]=t[i];else if("UInt8"===s?.valueType&&o<=4){let s=0;const n=i*o;for(let e=n;e<n+o;e++)s=(s<<8)+t[e];r[e.name]=s}else r[e.name]=void 0}_setPointsVisible(e){e&&!this._rendererAdded?(this.view._stage.addRenderPlugin([de.OPAQUE_MATERIAL],this._renderer),this._rendererAdded=!0):!e&&this._rendererAdded&&(this.view._stage.removeRenderPlugin(this._renderer),this._rendererAdded=!1)}_rendererChanged(){this._renderer.useFixedSizes=$(this.layer.renderer),this._reload()}_reload(){this._clearNodeState(),this._memCache.clear(),this._setUpdateViewNeeded()}_elevationOffsetChanged(){this._clearNodeState(),this._memCache.clear(),this._initNodePages()}_scaleUpdateHandler(e){const t=this.layer.effectiveScaleRange;he(t.minScale,t.maxScale)?v(e.extent,e.spatialReference,be,this.layer.spatialReference)&&(this._nodeScales.forEach(((t,i)=>{if(!this._renderedNodes.has(i))return void this._nodeScales.delete(i);const r=this._index.getNode(i);S(be,r.obb.center)&&this._nodeScales.set(i,e.scale)})),this._setUpdateViewNeeded()):this._nodeScales.clear()}_displayNodes(e){this._workQueue=M([...this._renderedNodes],e,this._index),E(this._workQueue,this.view.state.contentCamera.viewForward,this._index),O(this._workQueue,_e,this._index),this._updateQueues(),this._totalWork=this._computeWork(),this._updateLoading(),this._layerIsVisible=e.length>0||this._loadingInitNodePage,this.notifyChange("suspended")}cancelLoading(){this._cancelNodeLoading(),this._cancelIndexLoading()}_cancelNodeLoading(){const e=new Array;this._loadingNodes.forEach((({abortController:t})=>e.push(t))),this._loadingNodes.clear();for(const t of e)t.abort();this._workQueue=[],this._idleQueue.cancelAll(),this._totalWork=this._computeWork(),this._updateLoading()}_updateQueues(){const e=new Set;this._workQueue.forEach((t=>t.load.forEach((t=>e.add(t)))));const t=new Array,i=new Map;this._loadingNodes.forEach(((r,s)=>{e.has(s)?i.set(s,r):t.push(r)})),this._loadingNodes=i;for(const{abortController:r}of t)r.abort();this._workQueue=this._workQueue.filter((e=>{for(const t of e.load)if(this._loadingNodes.has(t))return this._recalcWork=!0,!1;return!0})),this._totalWork=this._computeWork(),this._updateLoading()}_cancelIndexLoading(){this._indexQueue=[],this._indexPagesLoading.forEach((({abortController:e})=>e.abort())),this._indexPagesLoading.clear(),this._totalWork=this._computeWork(),this._updateLoading()}_clearNodeState(){this._nodeLoadEpoch++,this._renderedNodes.forEach((e=>this._removeFromRenderer(e))),this._cancelNodeLoading()}_idleBegin(){this._setUpdateViewNeeded()}_idleEnd(){this._setUpdateViewNeeded()}get running(){return this.suspended?this._updateViewNeeded:this._updateViewNeeded||this._indexQueue.length>0||this._workQueue.length>0||this._idleQueue.running}runTask(e){if(this.suspended){if(this._updateViewNeeded){this._updateViewNeeded=!1;const e=this._isRootNodeVisible();e!==this._layerIsVisible&&(this._layerIsVisible=e,this.notifyChange("suspended")),this._updateLoading()}}else{for(e.run((()=>this._updateWorkQueues()));this._indexQueue.length>0&&e.run((()=>this._processIndexQueue())););this._processWorkQueue(e),this._idleQueue.runTask(e)}}_processIndexQueue(){const e=this._indexQueue.shift(),t=this._loadNodePage(e);return this._indexPagesLoading.set(e,t),t.promise.then((t=>{this._index.addPage(e,t,this._elevationOffset),this._setUpdateViewNeeded()})).then((()=>{this._indexPagesLoading.delete(e)}),(()=>{this._indexPagesLoading.delete(e)})),!0}_processWorkQueue(e){for(;!e.done;){const t=this._scheduleWorkEntry();if(null==t)return;this._processWorkEntry(t),e.madeProgress()}}_scheduleWorkEntry(){let e=this._workQueue.length;for(;e--;){const e=this._workQueue.shift();if(!e.remove.find((e=>!this._renderedNodes.has(e))))return e;this._workQueue.push(e)}return null}_processWorkEntry(e){if(0!==e.load.length)Promise.all(e.load.map((e=>{const t=new AbortController,i=this._memCache.pop(e.toString());return null!=i?this._loadingNodes.set(e,{abortController:t,promise:Promise.resolve(i)}):this._loadingNodes.has(e)||this._loadingNodes.set(e,{abortController:t,promise:this._loadNode(e,t.signal)}),this._loadingNodes.get(e).promise}))).then((t=>{for(let i=0;i<e.load.length;i++)if(t[i]){const r=this._setupRendererData(e.load[i],t[i]);this._addToRenderer(r)}for(const i of e.remove)this._removeFromRenderer(i)})).catch((()=>{})).then((()=>{for(const t of e.load)this._loadingNodes.delete(t);this._updateLoading(),this._recalcWork&&!this._idleQueue.running&&0===this._indexQueue.length&&0===this._loadingNodes.size&&(this._recalcWork=!1,this._setUpdateViewNeeded())})),this._updateLoading();else for(const t of e.remove)this._removeFromRenderer(t)}async _populateClassCodeCodedDomain(e,i){const r="CLASS_CODE",s=this.layer.fieldsIndex.get(r);if(!s||s.domain)return;if(!e.includes(s.name))return;const o=await t(this.layer.queryCachedStatistics(r,{signal:i}));if(!1===o.ok)return;const n=o.value?.stats?.labels?.labels;n&&Array.isArray(n)&&(s.domain=new L({name:"CLASS_CODE",codedValues:n.map((e=>new R({code:e.value,name:e.label})))}))}async prepareFetchPopupFeatures(e){return this._codedDomainPopulationPromise||(this._codedDomainPopulationAbortController=new AbortController,this._codedDomainPopulationPromise=this._populateClassCodeCodedDomain(e,this._codedDomainPopulationAbortController.signal).then((()=>{this._codedDomainPopulationAbortController=null}))),this._codedDomainPopulationPromise}async whenGraphicAttributes(e,t){const r=this._splitGraphicsPerNode(e),s=this.layer.attributeStorageInfo,o=t.map((e=>J(s,e))).filter(a),n=async(e,t)=>{const r=this._index.getNode(t);await i(o,(async t=>{const i=t.useElevation?await this._loadElevationAttributeFromGeometry(r.resourceId):await this._loadAndParseAttribute(r,t);if(i)for(const r of e)if(this._isValidPointGraphic(r)){const e=r.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(t,i,e,r.attributes)}}))},l=[];return r.forEach(((e,t)=>{l.push(n(e,t))})),await d(l),e}_isValidPointGraphic(e){return e instanceof Z&&e.pointCloudMetadata?.epoch===this._nodeLoadEpoch}_splitGraphicsPerNode(e){const t=new Map;for(const i of e){if(!this._isValidPointGraphic(i))continue;const e=i.pointCloudMetadata,r=t.get(e.nodeId);r?r.push(i):t.set(e.nodeId,[i])}return t}async _loadAndParseAttribute(e,t){const i=await this._loadAttribute(e.resourceId,t,null);return null!=i?K({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=X(t,await this._loadGeometry(e,null));return Y(i,i.length/3)}highlight(e){if(!e)return{remove(){}};const t=r.isCollection(e)?e.toArray():Array.isArray(e)?e:[e];return this._renderer.highlight(t.map((e=>this._graphicToPointDefinition(e))))}_graphicToPointDefinition(e){if(!this._isValidPointGraphic(e))return null;const{nodeId:t,pointIndexInNode:i}=e.pointCloudMetadata;return null!=t&&null!=i?{nodeId:t,pointId:i}:null}_computeWork(){let e=0;for(const t of this._workQueue)e+=t.load.length+t.remove.length;return e+=this._loadingNodes.size,e+=(this._indexQueue.length+this._indexPagesLoading.size)*this._index.pageSize,e+=this._loadingInitNodePage?100:0,e+=this._updateViewNeeded?100:0,e}get updatingProgressValue(){if(this.suspended)return this._updateViewNeeded?0:1;const e=this._computeWork();return 1-Math.min(this._totalWork,e)/this._totalWork}_updateLoading(){this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}canResume(){return super.canResume()&&this._layerIsVisible}isUpdating(){return this.suspended?this._updateViewNeeded:this._computeWork()>0}_initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;return this._index=new B(this.layer.spatialReference,this.view.renderCoordsHelper.spatialReference,t),this._cancelIndexLoading(),this._traverseVisible=this._index.createVisibilityTraverse(),this._loadingInitNodePage=!0,this._layerIsVisible=!0,this.notifyChange("suspended"),this._updateLoading(),this._pageMultiplier=null!=e.nodesPerPage?1:e.nodePerIndexBlock,this._loadNodePage(0).promise.then((e=>{this._index.addPage(0,e,this._elevationOffset),this._loadingInitNodePage=!1,this._setUpdateViewNeeded()}))}_loadNodePage(e){const t=new AbortController,i=`${this.baseUrl}/nodepages/${e*this._pageMultiplier}`;return{promise:this._requestNodePage(i,t.signal).then((t=>t.nodes.map(((t,i)=>({resourceId:null!=t.resourceId?t.resourceId:e*this._index.pageSize+i,obb:t.obb,firstChild:t.firstChild,childCount:t.childCount,vertexCount:t.vertexCount??t.pointCount,lodThreshold:t.lodThreshold??t.effectiveArea}))))),abortController:t}}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;let e=this.inverseDensity/this._lodFactor*this._getLodMemoryFactor();const t=this.maximumPointCount*this._lodFactor*this._getLodMemoryFactor();let i=this._computeNodesForMinimumDensity(e),r=this._computePointCount(i),s=Math.sqrt(r/(.75*t));for(;r>t;)e*=s,i=this._computeNodesForMinimumDensity(e),r=this._computePointCount(i),s=Math.sqrt(2);return this._displayNodes(i),this._updateViewNeeded=!1,this._updateLoading(),!0}_computePointCount(e){let t=0;for(let i=0;i<e.length;i++){const r=this._index.getNode(e[i]);r&&(t+=r.vertexCount)}return t}_getLodMemoryFactor(){return this.view.resourceController.memoryController.memoryFactor}_isRootNodeVisible(){let e=!1;return this._traverseVisible({frustum:this.view.state.contentCamera.frustum,clippingBox:this._clippingBox},{predicate:(t,i,r)=>(e=r,!1),pageMiss:()=>{}}),e}_computeNodesForMinimumDensity(e){const t=this.view.state.contentCamera,i=t.frustum,r=this._clippingBox,s=t.viewForward,o=N(s,t.eye),n=k(s,-o,me),a=t.perScreenPixelRatio/2,d=e*e,l=this._nodeIdArray;l.length=0;const{minScale:h,maxScale:u}=ue(this.layer),p=0===h&&0===u?e=>l.push(e):e=>{const t=this._getScale(e);pe(t,h,u)&&l.push(e)};return this._traverseVisible({frustum:i,clippingBox:r},{predicate:(e,t,i)=>{if(!i)return!1;if(0===t.childCount)return p(e),!1;const r=this._index.getRenderObb(e);return!(this._computeAveragePixelArea(r,t.lodThreshold,t.vertexCount,n,a)<=d)||(p(e),!1)},pageMiss:(e,t)=>{p(e),this._indexQueue.includes(t)||this._indexQueue.push(t)}}),l}_getScale(e){let t=this._nodeScales.get(e);if(null==t){const i=this._index.getNode(e).obb.center;this._tmpPoint.x=i[0],this._tmpPoint.y=i[1],this._tmpPoint.z=i[2],t=this.view.basemapTerrain.getScale(this._tmpPoint),this._nodeScales.set(e,t)}return t}_computeAveragePixelArea(e,t,i,r,s){const o=1e-7,n=Math.max(o,ne(e,r));return t/(n*n)/(4*s*s)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw l(i)||s.getLogger(this.declaredClass).error(i),i}}async _loadAdditionalUserAttributes(e,t,i){const r=this.layer.outFields;if(!r)return[];const s=j(this.layer.fieldsIndex,r),o=new Set(e.map((e=>null!=e?e.name:null))),n=this.layer.attributeStorageInfo,d=[];for(const a of s){if(o.has(a))continue;const e=J(n,a);e&&d.push(t(e))}const l=await h(d);return u(i),l.filter(a)}async _loadNodeAsync(e,t){const i=this._index.getNode(e),r=q(this.layer),s=T(this.layer),o=i.resourceId,n=async e=>{if(!e)return null;if(e.useElevation)return{attributeInfo:e,buffer:null};const i=await this._loadAttribute(o,e,t);return null!=i?{attributeInfo:e,buffer:i}:null};return this._idleQueue.push((async()=>{const i=this._loadGeometry(o,t),{primaryAttribute:a,modulationAttribute:d}=r,l=n(a),h=n(d),p=s.map((e=>e.attributeInfo)),c=p.map((e=>n(e))),_=this._loadAdditionalUserAttributes([a,d,...p],n,t),[m,g,f,y,b]=await Promise.all([i,l,h,Promise.all(c),_]);u(t);const w={geometryBuffer:m,primaryAttributeData:g,modulationAttributeData:f,filterAttributesData:y,userAttributesData:b,schema:this.layer.store.defaultGeometrySchema,rendererInfo:r,filterInfo:s,obb:this._index.getRenderObb(e),elevationOffset:this._elevationOffset,inSR:this.layer.spatialReference.toJSON(),outSR:this.view.renderCoordsHelper.spatialReference.toJSON()};return this._worker.invoke(w,t)}),t)}async _loadGeometry(e,t){return this._requestData(`${this.baseUrl}/nodes/${e}/geometries/0`,t)}async _loadAttribute(e,t,i){if(null==t||!t.storageInfo)return null;const r=t.storageInfo.key;return this._requestData(`${this.baseUrl}/nodes/${e}/attributes/${r}`,i)}_requestNodePage(e,t){const i={f:"json",token:this.layer.apiKey};return this._indexRequester.request(e,"json",{query:i,signal:t})}_requestData(e,t){return this._dataRequester.request(e,"binary",{query:{token:this.layer.apiKey},signal:t})}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._nodeScales.delete(e),this._memCache.put(t.id.toString(),t,ye(t))}}_addToRenderer(e){this._renderedNodes.has(e.id)||(this._renderedNodes.add(e.id),this._renderer.addNode(e))}_setupRendererData(e,t){const i=this._index.getNode(e),r=Math.sqrt(i.lodThreshold/i.vertexCount),o=this._index.getRenderObb(e);if(te(t))return t.splatSize=r,t.obb=o,P(t.origin,t.obb.center),t;const n=.01*Math.max(o.halfSize[0],o.halfSize[1],o.halfSize[2]);if(t.obb.halfSize[0]>o.halfSize[0]+n||t.obb.halfSize[1]>o.halfSize[1]+n||t.obb.halfSize[2]>o.halfSize[2]+n){if(this._maxLoggedBoxWarnings>0){const i=e=>`[${e.halfSize[0]}, ${e.halfSize[1]}, ${e.halfSize[2]}]`;s.getLogger(this.declaredClass).warn(`Node ${e} reported bounding box too small. got ${i(o)} but points cover ${i(t.obb)}`),0==--this._maxLoggedBoxWarnings&&s.getLogger(this.declaredClass).warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,t.obb)}return new ie(e,r,x(o.center),o,0===i.childCount,t.points,t.rgb,t.attributes,t.pointIdFilterMap)}get usedMemory(){let e=0;return this._renderer.forEachNode((t=>{e+=we,e+=g(t.coordinates);for(const i of t.attributes){const t=i.values;f(t.buffer)&&(e+=g(t))}})),e}get unloadedMemory(){const e=this._renderedNodes.size;if(e<4)return 0;const t=[...this._renderedNodes].reduce(((e,t)=>e+this._index.getNode(t).vertexCount));let i=this._loadingNodes.size;for(let r=0;r<this._workQueue.length;r++)i+=this._workQueue[r].load.length,i-=this._workQueue[r].remove.length;if(i<0)return 0;return i*t/e*((this.usedMemory-e*we)/t)+i*we}get performanceInfo(){return{nodes:this._renderedNodes.size,displayedNumberOfFeatures:[...this._renderedNodes].reduce(((e,t)=>e+this._index.getNode(t).vertexCount),0),maximumNumberOfFeatures:this.maximumPointCount,totalNumberOfFeatures:-1,core:null,"Loading Nodes":this._loadingNodes.size,"Index Queue":this._indexQueue.length,"Work Queue":this._workQueue.length,"Idle Queue":this._idleQueue.length}}get test(){return{index:this._index,visibleNodes:this._renderedNodes}}};e([b()],ge.prototype,"layer",void 0),e([b()],ge.prototype,"baseUrl",null),e([b()],ge.prototype,"pointScale",null),e([b()],ge.prototype,"useRealWorldSymbolSizes",null),e([b()],ge.prototype,"pointSize",null),e([b()],ge.prototype,"inverseDensity",null),e([b()],ge.prototype,"maximumPointCount",void 0),e([b({readOnly:!0})],ge.prototype,"availableFields",null),e([b({readOnly:!0})],ge.prototype,"_clippingBox",null),e([b({readOnly:!0})],ge.prototype,"_elevationOffset",null),e([b({type:Boolean})],ge.prototype,"slicePlaneEnabled",void 0),e([b()],ge.prototype,"updating",void 0),e([b(ae)],ge.prototype,"updatingProgress",void 0),e([b({readOnly:!0})],ge.prototype,"updatingProgressValue",null),ge=e([w("esri.views.3d.layers.PointCloudLayerView3D")],ge);const fe=ge;function ye(e){return 5*e.coordinates.length+128}const be=A(),we=160;function Ne(e){return t=>e.immediate.schedule(t)}export{fe 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.27/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../../../core/maybe.js";import{isArrayBuffer as r}from"../../../core/typedArrayUtil.js";import{c as e}from"../../../chunks/quat.js";import{c as a}from"../../../chunks/quatf32.js";import{q as o}from"../../../chunks/vec3.js";import{f as n,c as f}from"../../../chunks/vec3f32.js";import{projectBuffer as i}from"../../../geometry/projection.js";import s from"../../../geometry/SpatialReference.js";import{readGeometry as u,getAttributeValues as l,evaluateRenderer as b,filterInPlace as m}from"./i3s/PointCloudWorkerUtil.js";class c{transform(t){const e=this._transform(t),a=[e.points.buffer,e.rgb.buffer];null!=e.pointIdFilterMap&&a.push(e.pointIdFilterMap.buffer);for(const o of e.attributes)"buffer"in o.values&&r(o.values.buffer)&&o.values.buffer!==e.rgb.buffer&&a.push(o.values.buffer);return Promise.resolve({result:e,transferList:a})}_transform(r){const e=u(r.schema,r.geometryBuffer);let a=e.length/3,o=null;const n=[],f=l(r.primaryAttributeData,e,a);null!=r.primaryAttributeData&&f&&n.push({attributeInfo:r.primaryAttributeData.attributeInfo,values:f});const i=l(r.modulationAttributeData,e,a);null!=r.modulationAttributeData&&i&&n.push({attributeInfo:r.modulationAttributeData.attributeInfo,values:i});let c=b(r.rendererInfo,f,i,a);if(r.filterInfo&&r.filterInfo.length>0&&null!=r.filterAttributesData){const f=r.filterAttributesData.filter(t).map((t=>{const r=l(t,e,a),o={attributeInfo:t.attributeInfo,values:r};return n.push(o),o}));o=new Uint32Array(a),a=m(e,c,o,r.filterInfo,f)}for(const t of r.userAttributesData){const r=l(t,e,a);n.push({attributeInfo:t.attributeInfo,values:r})}3*a<c.length&&(c=new Uint8Array(c.buffer.slice(0,3*a))),this._applyElevationOffsetInPlace(e,a,r.elevationOffset);const p=this._transformCoordinates(e,a,r.obb,s.fromJSON(r.inSR),s.fromJSON(r.outSR));return{obb:r.obb,points:p,rgb:c,attributes:n,pointIdFilterMap:o}}_transformCoordinates(t,r,a,s,u){if(!i(t,s,0,t,u,0,r))throw new Error("Can't reproject");const l=n(a.center[0],a.center[1],a.center[2]),b=f(),m=f();e(p,a.quaternion);const c=new Float32Array(3*r);for(let e=0;e<r;e++)b[0]=t[3*e]-l[0],b[1]=t[3*e+1]-l[1],b[2]=t[3*e+2]-l[2],o(m,b,p),a.halfSize[0]=Math.max(a.halfSize[0],Math.abs(m[0])),a.halfSize[1]=Math.max(a.halfSize[1],Math.abs(m[1])),a.halfSize[2]=Math.max(a.halfSize[2],Math.abs(m[2])),c[3*e]=b[0],c[3*e+1]=b[1],c[3*e+2]=b[2];return c}_applyElevationOffsetInPlace(t,r,e){if(0!==e)for(let a=0;a<r;a++)t[3*a+2]+=e}}const p=a();function h(){return new c}export{h as default};
5
+ import{isSome as t}from"../../../core/maybe.js";import{isArrayBuffer as r}from"../../../core/typedArrayUtil.js";import{c as e}from"../../../chunks/quat.js";import{c as a}from"../../../chunks/quatf32.js";import{q as o}from"../../../chunks/vec3.js";import{f as n,c as f}from"../../../chunks/vec3f32.js";import{projectBuffer as i}from"../../../geometry/projection.js";import s from"../../../geometry/SpatialReference.js";import{readGeometry as u,getAttributeValues as l,evaluateRenderer as b,filterInPlace as m}from"./i3s/PointCloudWorkerUtil.js";class c{transform(t){const e=this._transform(t),a=[e.points.buffer,e.rgb.buffer];null!=e.pointIdFilterMap&&a.push(e.pointIdFilterMap.buffer);for(const o of e.attributes)"buffer"in o.values&&r(o.values.buffer)&&o.values.buffer!==e.rgb.buffer&&a.push(o.values.buffer);return Promise.resolve({result:e,transferList:a})}_transform(r){const e=u(r.schema,r.geometryBuffer);let a=e.length/3,o=null;const n=new Array,f=l(r.primaryAttributeData,e,a);null!=r.primaryAttributeData&&f&&n.push({attributeInfo:r.primaryAttributeData.attributeInfo,values:f});const i=l(r.modulationAttributeData,e,a);null!=r.modulationAttributeData&&i&&n.push({attributeInfo:r.modulationAttributeData.attributeInfo,values:i});let c=b(r.rendererInfo,f,i,a);if(r.filterInfo&&r.filterInfo.length>0&&null!=r.filterAttributesData){const f=r.filterAttributesData.filter(t).map((t=>{const r=l(t,e,a),o={attributeInfo:t.attributeInfo,values:r};return n.push(o),o}));o=new Uint32Array(a),a=m(e,c,o,r.filterInfo,f)}for(const t of r.userAttributesData){const r=l(t,e,a);n.push({attributeInfo:t.attributeInfo,values:r})}3*a<c.length&&(c=new Uint8Array(c.buffer.slice(0,3*a))),this._applyElevationOffsetInPlace(e,a,r.elevationOffset);const p=this._transformCoordinates(e,a,r.obb,s.fromJSON(r.inSR),s.fromJSON(r.outSR));return{obb:r.obb,points:p,rgb:c,attributes:n,pointIdFilterMap:o}}_transformCoordinates(t,r,a,s,u){if(!i(t,s,0,t,u,0,r))throw new Error("Can't reproject");const l=n(a.center[0],a.center[1],a.center[2]),b=f(),m=f();e(p,a.quaternion);const c=new Float32Array(3*r);for(let e=0;e<r;e++)b[0]=t[3*e]-l[0],b[1]=t[3*e+1]-l[1],b[2]=t[3*e+2]-l[2],o(m,b,p),a.halfSize[0]=Math.max(a.halfSize[0],Math.abs(m[0])),a.halfSize[1]=Math.max(a.halfSize[1],Math.abs(m[1])),a.halfSize[2]=Math.max(a.halfSize[2],Math.abs(m[2])),c[3*e]=b[0],c[3*e+1]=b[1],c[3*e+2]=b[2];return c}_applyElevationOffsetInPlace(t,r,e){if(0!==e)for(let a=0;a<r;a++)t[3*a+2]+=e}}const p=a();function h(){return new c}export{h 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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{disposeMaybe as i,abortMaybe as r,destroyMaybe as l}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{SchemaHelper as h}from"../../2d/engine/vectorTiles/SchemaHelper.js";import c from"../../2d/engine/vectorTiles/TileHandler3D.js";import p from"../../2d/engine/vectorTiles/VTLPainter3D.js";import m from"../../2d/engine/vectorTiles/style/StyleRepository.js";import{LayerView3D as d}from"./LayerView3D.js";import{TiledLayerView3D as f}from"./TiledLayerView3D.js";import{vtlAssumes256PixelSizeAsDefault as y,test as u}from"../terrain/terrainUtils.js";import g from"../../layers/LayerView.js";let _=class extends(f(d(g))){constructor(){super(...arguments),this._tileHandlerController=null,this.type="vector-tile-3d"}initialize(){if(null==this.layer.fullExtent)return void this.addResolvingPromise(Promise.reject(new t("vectortilelayerview:full-extent-undefined","This layer view's layer does not define a fullExtent.")));const{basemapTerrain:e,spatialReference:i,state:r,viewingMode:l}=this.view,n="local"===l&&!y(i)||u.force512VTL,a=this.layer.tileInfo.spatialReference.isGeographic,d=n?this.layer.tileInfo:this.layer.tileInfo.getOrCreateCompatible(256,a?1:2),f=this._getTileInfoSupportError(d,this.layer.fullExtent);if(null!=f)return this.addResolvingPromise(Promise.reject(f));const g=o((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const t=e.tilingScheme,i=t.pixelSize;let r;if(this.schemaHelper=new h(i,null!=e.spatialReference&&e.spatialReference.isGeographic),256===i){const e=this.layer.tileInfo.spatialReference.isGeographic;r=this.layer.tileInfo.getOrCreateCompatible(256,e?1:2)}else r=this.view.spatialReference?.isGeographic?this.layer.tileInfo.getOrCreateCompatible(512,.5):this.layer.tileInfo;const l=this._getTileInfoCompatibilityError(r,t);if(l)throw l;this.tileInfo=r}));this._tileHandlerController=new AbortController;const _=this.view.resourceController;this._memCache=_.memoryController.newCache(this.layer.uid,(e=>{e.release()}));const C=new m(this.layer.currentStyleInfo.style);this._tileHandler=new c(this.layer,C,r.contentPixelRatio,this._memCache);const H=this._tileHandlerController.signal,w=v(_),j=this._tileHandler.start({signal:H,schedule:w}),R=this._tileHandler.spriteMosaic;R.then((e=>{!s(H)&&this._tileHandler&&(this.painter=new p(e,this._tileHandler.glyphMosaic))})),j.then((()=>this._tileHandlerController=null)),this.updatingHandles.add((()=>({style:this.layer.currentStyleInfo.style,pixelRatio:this.view.state?.contentPixelRatio})),(({style:e,pixelRatio:t})=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const i=new m(e),r=new c(this.layer,i,t,this._memCache),l=r.start({signal:this._tileHandlerController.signal,schedule:w}),s=r.spriteMosaic;l.then((()=>this._tileHandlerController=null)),this.updatingHandles.addPromise(Promise.all([l,s]).then((([,e])=>{const t=this._tileHandler,i=this.painter;this.painter=new p(e,r.glyphMosaic),this._tileHandler=r,this.emit("data-changed"),t.destroy(),i&&i.dispose()})))}));const T=Promise.all([g,j,R]);this.addResolvingPromise(T)}destroy(){this.painter=i(this.painter),this._tileHandlerController=r(this._tileHandlerController),l(this._tileHandler),this._memCache=l(this._memCache),this._tileHandler=null}get dataLevelRange(){const e=this.tileInfo.lods,t=e[0].scale,i=e[e.length-1].scale,r=this.levelRangeFromScaleRange(t,i);return 1===r.minLevel&&256===this.tileInfo.size[0]&&(r.minLevel=0),r}async fetchTile(e,t,i,r){return this._tileHandler.getVectorTile(e,t,i,r)}};e([n()],_.prototype,"layer",void 0),e([n()],_.prototype,"dataLevelRange",null),e([n()],_.prototype,"updatingProgressValue",void 0),_=e([a("esri.views.3d.layers.VectorTileLayerView3D")],_);const C=_;function v(e){return t=>e.immediate.schedule(t)}export{C as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{disposeMaybe as i,abortMaybe as r,destroyMaybe as l}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{SchemaHelper as h}from"../../2d/engine/vectorTiles/SchemaHelper.js";import c from"../../2d/engine/vectorTiles/TileHandler3D.js";import p from"../../2d/engine/vectorTiles/VTLPainter3D.js";import m from"../../2d/engine/vectorTiles/style/StyleRepository.js";import{LayerView3D as d}from"./LayerView3D.js";import{TiledLayerView3D as f}from"./TiledLayerView3D.js";import{vtlAssumes256PixelSizeAsDefault as y,test as u}from"../terrain/terrainUtils.js";import g from"../../layers/LayerView.js";let _=class extends(f(d(g))){constructor(){super(...arguments),this._tileHandlerController=null,this.type="vector-tile-3d"}initialize(){if(null==this.layer.fullExtent)return void this.addResolvingPromise(Promise.reject(new t("vectortilelayerview:full-extent-undefined","This layer view's layer does not define a fullExtent.")));const{basemapTerrain:e,spatialReference:i,state:r,viewingMode:l}=this.view,n="local"===l&&!y(i)||u.force512VTL,a=this.layer.tileInfo.spatialReference.isGeographic,d=n?this.layer.tileInfo:this.layer.tileInfo.getOrCreateCompatible(256,a?1:2),f=this._getTileInfoSupportError(d,this.layer.fullExtent);if(null!=f)return this.addResolvingPromise(Promise.reject(f));const g=o((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const t=e.tilingScheme,i=t.pixelSize;let r;if(this.schemaHelper=new h(i,null!=e.spatialReference&&e.spatialReference.isGeographic),256===i){const e=this.layer.tileInfo.spatialReference.isGeographic;r=this.layer.tileInfo.getOrCreateCompatible(256,e?1:2)}else r=this.view.spatialReference?.isGeographic?this.layer.tileInfo.getOrCreateCompatible(512,.5):this.layer.tileInfo;const l=this._getTileInfoCompatibilityError(r,t);if(l)throw l;this.tileInfo=r}));this._tileHandlerController=new AbortController;const _=this.view.resourceController;this._memCache=_.memoryController.newCache(this.layer.uid,(e=>{e.release()}));const C=new m(this.layer.currentStyleInfo.style);this._tileHandler=new c(this.layer,C,r.contentPixelRatio,this._memCache);const H=this._tileHandlerController.signal,w=v(_),j=this._tileHandler.start({signal:H,schedule:w}),R=this._tileHandler.spriteMosaic;R.then((e=>{!s(H)&&this._tileHandler&&(this.painter=new p(e,this._tileHandler.glyphMosaic))})),j.then((()=>this._tileHandlerController=null)),this.updatingHandles.add((()=>({style:this.layer.currentStyleInfo.style,pixelRatio:this.view.state?.contentPixelRatio})),(({style:e,pixelRatio:t})=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const i=new m(e),r=new c(this.layer,i,t,this._memCache),l=r.start({signal:this._tileHandlerController.signal,schedule:w}),s=r.spriteMosaic;l.then((()=>this._tileHandlerController=null)),this.updatingHandles.addPromise(Promise.all([l,s]).then((([,e])=>{const t=this._tileHandler,i=this.painter;this.painter=new p(e,r.glyphMosaic),this._tileHandler=r,this.emit("data-changed"),t.destroy(),i&&i.dispose()})))}));const T=Promise.all([g,j,R]);this.addResolvingPromise(T)}destroy(){this.painter=i(this.painter),this._tileHandlerController=r(this._tileHandlerController),this._tileHandler=l(this._tileHandler),this._memCache=l(this._memCache)}get dataLevelRange(){const e=this.tileInfo.lods,t=e[0].scale,i=e[e.length-1].scale,r=this.levelRangeFromScaleRange(t,i);return 1===r.minLevel&&256===this.tileInfo.size[0]&&(r.minLevel=0),r}async fetchTile(e,t,i,r){return this._tileHandler.getVectorTile(e,t,i,r)}};e([n()],_.prototype,"layer",void 0),e([n()],_.prototype,"dataLevelRange",null),e([n()],_.prototype,"updatingProgressValue",void 0),_=e([a("esri.views.3d.layers.VectorTileLayerView3D")],_);const C=_;function v(e){return t=>e.immediate.schedule(t)}export{C as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import"../../../../renderers/ClassBreaksRenderer.js";import"../../../../renderers/DictionaryRenderer.js";import"../../../../renderers/DotDensityRenderer.js";import"../../../../renderers/HeatmapRenderer.js";import"../../../../renderers/PieChartRenderer.js";import"../../../../renderers/Renderer.js";import"../../../../renderers/SimpleRenderer.js";import i from"../../../../renderers/UniqueValueRenderer.js";import"../../../../renderers/support/jsonUtils.js";import"../../../../symbols.js";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import r from"../../../../core/Error.js";import s from"../../../../core/Handles.js";import{makeHandle as a}from"../../../../core/handleUtils.js";import n from"../../../../core/Logger.js";import{someMap as o,findInMap as l}from"../../../../core/MapUtils.js";import{destroyMaybe as h,removeMaybe as d,get as p,disposeMaybe as c,isSome as y}from"../../../../core/maybe.js";import m from"../../../../core/PooledArray.js";import{throwIfAborted as g,eachAlways as u,createDeferred as b,isAbortError as _}from"../../../../core/promiseUtils.js";import{watch as f,when as v,on as C,syncAndInitial as S,whenOnce as w}from"../../../../core/reactiveUtils.js";import{schedule as G}from"../../../../core/scheduling.js";import{property as x}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as P}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as R,isEmpty as D}from"../../../../core/accessorSupport/diffUtils.js";import{s as E,a as I,g as U}from"../../../../chunks/vec3.js";import{c as A}from"../../../../chunks/vec3f64.js";import{projectVectorToVector as O,projectXYZToVector as L,canProjectWithoutEngine as j,projectBuffer as V}from"../../../../geometry/projection.js";import{create as F,center as T,fromRect as k,equals as z}from"../../../../geometry/support/aaBoundingBox.js";import{create as W}from"../../../../geometry/support/aaBoundingRect.js";import{equals as M}from"../../../../geometry/support/spatialReferenceUtils.js";import N from"../../../../layers/Layer.js";import{getObjectId as B,computeAABB as H,hasGeometry as q}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as Y}from"../../../../layers/graphics/hydratedFeatures.js";import{isSupportedRenderer3D as $,validateTo3D as Z}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as J}from"../../../../support/arcadeOnDemand.js";import{getDefaultSymbol3D as Q}from"../../../../symbols/support/defaults3D.js";import{to3D as K}from"../../../../symbols/support/symbolConversion.js";import{ViewElevationProvider as X}from"./ElevationQuery.js";import{VisibilityFlag as ee,VisibilityGroup as ie}from"./enums.js";import{extractExpressionInfo as te,createContext as re}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as se}from"./Graphics3DFeatureStore.js";import ae from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as ne}from"./Graphics3DSymbolCreationContext.js";import{make as oe}from"./Graphics3DSymbolFactory.js";import le from"./Graphics3DWebStyleSymbol.js";import{GraphicStateTracking as he}from"./GraphicStateTracking.js";import{computeCentroid as de}from"./graphicUtils.js";import{ApplyRendererDiffResult as pe}from"./interfaces.js";import{LoadStatus as ce}from"./Loadable.js";import{SpatialIndex2D as ye}from"./SpatialIndex2D.js";import{averageSymbolComplexities as me,defaultSymbolComplexity as ge}from"./symbolComplexity.js";import{StageLayerElevationProvider as ue}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as be}from"../../support/extentUtils.js";import{PropertiesPool as _e}from"../../support/PropertiesPool.js";import{GridLocalOriginFactory as fe}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{UpdatePolicy as ve}from"../../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as Ce}from"../../webgl-engine/lib/WebGLLayer.js";import{ImmediateTask as Se,noBudget as we,TaskPriority as Ge,Task as xe}from"../../../support/Scheduler.js";import Pe from"../../../../geometry/Extent.js";import Re from"../../../../geometry/Point.js";import De from"../../../../symbols/LabelSymbol3D.js";import Ee from"../../../../symbols/TextSymbol.js";import Ie from"../../../../symbols/WebStyleSymbol.js";var Ue;const Ae=A(),Oe=F(),Le="esri.views.3d.layers.graphics.Graphics3DCore",je=n.getLogger(Le);let Ve=Ue=class extends t{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ye({objectIdField:this.owner.layer?.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?ve.ASYNC:this._forcedUpdatePolicy??this.preferredUpdatePolicy}get featureStore(){return this._featureStore}get initializePromise(){return this._initializePromise}get scaleVisibility(){return this._scaleVisibility}get elevationAlignment(){return this._elevationAlignment}get objectStates(){return this._objectStates}get filterVisibility(){return this._filterVisibility}get updating(){return!!(this._graphicsWaitingForSymbol.size>0||this.running||this._elevationAlignment?.updating||null!=this._scaleVisibility&&this._scaleVisibility.updating||null!=this._filterVisibility&&this._filterVisibility.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._updatingPendingLoadedGraphicsChange||this._frameTask.updating||this._loadingSymbols>0)}get running(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating}get suspendedOrOutsideOfView(){return this.owner.suspended||!!this.owner.suspendInfo?.outsideOfView}get updatingRemaining(){return this.updating?this._pendingUpdates.size+.1*(this._spatialIndex?.updatingRemaining||0)+.1*(this._elevationAlignment?.updatingRemaining||0):0}get displayFeatureLimit(){const e=this.owner&&this.owner.view&&this.owner.view.qualitySettings,i=e?e.graphics3D.minTotalNumberOfFeatures:0,t=e?e.graphics3D.maxTotalNumberOfFeatures:0,r=e?e.graphics3D.maxTotalNumberOfPrimitives:0,s=this.averageSymbolComplexity,a=Math.max(1,null!=s?s.primitivesPerFeature:1),n=null!=s&&s.drawCallsPerFeature>0?t/s.drawCallsPerFeature*.3:t,o=Math.ceil(r/a),l=Math.max(i,Math.min(t,o,n)),h=this._get("displayFeatureLimit");return h&&h.minimumTotalNumberOfFeatures===i&&h.maximumTotalNumberOfFeatures===t&&h.maximumTotalNumberOfPrimitives===r&&h.averageSymbolComplexity===s&&h.maximumNumberOfFeatures===l?h:{minimumTotalNumberOfFeatures:i,maximumTotalNumberOfFeatures:t,maximumTotalNumberOfPrimitives:r,averageSymbolComplexity:s,maximumNumberOfFeatures:l}}get averageSymbolComplexity(){const e=me(this._symbolComplexities),i=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=i&&(e.estimated&&(i.primitivesPerFeature>=e.primitivesPerFeature||i.primitivesPerCoordinate>=e.primitivesPerCoordinate||i.drawCallsPerFeature>=e.drawCallsPerFeature)||i.primitivesPerFeature===e.primitivesPerFeature&&i.primitivesPerCoordinate===e.primitivesPerCoordinate&&i.drawCallsPerFeature===e.drawCallsPerFeature)?i:e}get usedMemory(){const e=null!=this.averageSymbolComplexity&&this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel*this._numberOfGraphics:0,i=this._getSymbolComplexitiesUsed().reduce(((e,i)=>e+i.memory.resourceBytes),0);return this._usedMemory+e+i}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){if("web-style"===e.type)return e.clone();const i=this._symbolConversionCache.get(e.id);if(null!=i)return i;const t=K(e,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(e)}),r=t.symbol||null;return null==r&&t.error&&je.error(t.error.message),this._symbolConversionCache.set(e.id,r),r}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const i=e.getSymbols(),t="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!(t||i&&i.length))return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(t);null!=s&&r.push(s);for(const a of i){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const i=this._symbols.get(e.id);if(null!=i)return i.complexity;const t=this._getConvertedSymbol(e);return null!=t?ge(t):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((i=>{null!=i&&e.push(i.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new _e({computedExtent:Pe},this),this.computedExtent=null,this.currentRenderer=null,this.rendererHasGeometryOperations=!1,this._graphicStateTracking=null,this.graphics3DGraphics=new Map,this.stageLayer=null,this.stage=null,this._graphicsDrapedUids=new Set,this._graphicsBySymbol=new Map,this._symbolConversionCache=new Map,this._symbols=new Map,this._graphicsWithoutSymbol=new Map,this._graphicsWaitingForSymbol=new Map,this._graphicsUpdateId=0,this._handles=new s,this._frameTask=Se,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._scaleVisibility=null,this._filterVisibility=null,this._spatialIndex=null,this.extentPadding=0,this._updatingPendingLoadedGraphicsChange=null,this._featureStore=null,this._deconflictor=null,this._labeler=null,this._objectStates=null,this._viewElevationProvider=null,this._stageLayerElevationProvider=null,this._sharedSymbolResourcesOwnerHandle=null,this._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this._pendingUpdatesPool=new m({allocator:e=>e||new Te,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new m,this.preferredUpdatePolicy=ve.SYNC,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this.symbolCreationContext=new ne(e.owner.view.resourceController.scheduler,((e,i)=>this._frameTask.schedule(e,i)))}initialize(){this._featureStore=new se({objectIdField:this.owner.layer&&this.owner.layer.objectIdField,hasZ:!!this.hasZ,hasM:!!this.hasM,viewSpatialReference:this._viewSpatialReference,featureSpatialReference:this.owner.featureSpatialReference,getSpatialIndex:()=>this.spatialIndex,forEach:e=>this.graphics3DGraphics.forEach(e)});const e=(e,i,t)=>this.spatialIndex.queryGraphicUIDsInExtent(e,i,t),{componentFactories:i}=this;if(null!=i.elevationAlignment){const t=i.elevationAlignment(this,e);this._elevationAlignment=t}if(null!=i.scaleVisibility){const t=i.scaleVisibility(this,e);this._scaleVisibility=t}if(null!=i.filterVisibility){const e=i.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(ee.FILTER,e(B(i.graphic,this._objectIdField)),ie.GRAPHIC))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(ee.FILTER,e,ie.GRAPHIC))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(ee.FILTER)))});this._filterVisibility=e}if(null!=i.deconflictor){const e=i.deconflictor(this);this._deconflictor=e}if(null!=i.labeler&&null!=this._scaleVisibility){const e=i.labeler(this,this._scaleVisibility);this._labeler=e}if(null!=i.objectStates){const e=i.objectStates(this);this._objectStates=e}this._initializeAbortController=new AbortController,this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,i=this.owner.view;this._viewElevationProvider=new X(this._viewSpatialReference,i),this._initializeStage(i,this.layer.uid);const t=i.sharedSymbolResources;this.symbolCreationContext.sharedResources=t,this._sharedSymbolResourcesOwnerHandle=t.addGraphicsOwner(this.owner),null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=t.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=i.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new fe(i.renderSpatialReference),this.symbolCreationContext.elevationProvider=i.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=te(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await re(r,this._viewSpatialReference,e,je),g(e),this.symbolCreationContext.screenSizePerspectiveEnabled=i.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this.symbolCreationContext.physicalBasedRenderingEnabled=!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,this.symbolCreationContext.skipHighSymbolLods=!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,"drapeSourceType"in this.owner){const{owner:e}=this;this.symbolCreationContext.drapeSourceRenderer=i.basemapTerrain.overlayManager.registerGeometryDrapeSource(e),this._handles.add(a((()=>i.basemapTerrain.overlayManager.unregisterDrapeSource(e))))}this._handles.add([f((()=>this.suspendedOrOutsideOfView),(()=>this._frameTask.reschedule((()=>this._updateLayerVisibility())))),f((()=>[this.layer?.screenSizePerspectiveEnabled,this.owner.view?.screenSizePerspectiveEnabled]),(()=>{const e=i.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled;e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._labeler?.reset(),this.recreateAllGraphicsAndSymbols())})),f((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),f((()=>this.owner.view.state?.rasterPixelRatio),(()=>this._pixelRatioChange())),f((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),f((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),v((()=>i.basemapTerrain?.tilingScheme),(e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==i.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=i.basemapTerrain.spatialReference),this._handles.has("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this._handles.add([C(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),f((()=>this.effectiveUpdatePolicy),(e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===ve.ASYNC,e===ve.SYNC&&this.runTask(we)}),S)]),this._frameTask=i.resourceController.scheduler.registerTask(Ge.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this._handles.add(f((()=>this.layer.featureReduction),(()=>this._deconflictor.featureReductionChange()))),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch((()=>{})),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController&&(this._initializeAbortController.abort(),this._initializeAbortController=null)}destroy(){this._abortInitialize(),this._abortRendererChange(),this._abortElevationInfoChange(),this._frameTask.remove(),this._frameTask=Se,this.owner.view?.deconflictor?.removeGraphicsOwner(this),this.owner.view?.labeler?.removeGraphicsOwner(this),this._elevationAlignment=h(this._elevationAlignment),this._scaleVisibility=h(this._scaleVisibility),this._filterVisibility=h(this._filterVisibility),this._deconflictor=null,this._labeler=null,this._objectStates=h(this._objectStates),this.clear(),this._featureStore=h(this._featureStore),this._updatingPendingLoadedGraphicsChange=d(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=h(this._graphicStateTracking),this.stage&&(this.stageLayer=h(this.stageLayer),this.stage=null),this._handles=h(this._handles),this._set("owner",null);for(const e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new r("graphic:layer-destroyed","Layer has been destroyed"));this._whenGraphics3DGraphicRequests=null,this._sharedSymbolResourcesOwnerHandle=d(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=h(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=h(this._spatialIndex)}clear(){this._objectStates?.allGraphicsDeleted(),null!=this._graphicStateTracking&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach((e=>e.destroy())),this._spatialIndex?.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(h),this._symbols.clear(),this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingUpdatesPool.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("updating"),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed")}_initializeStage(e,i){this.stage=e._stage,this.stageLayer=new Ce(this.stage,{pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},i);const t=this.stageLayer.events;t.on("objectTransformation",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),t.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.graphicUid))),t.on("objectGeometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),t.on("objectGeometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),t.on("objectGeometryUpdated",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)))}notifyGraphicGeometryChanged(e){if(null==this._graphicStateTracking||null==e)return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicGeometry(i)}notifyGraphicVisibilityChanged(e){if(null==this._graphicStateTracking||null==e)return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicVisibility(i)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,i=this._numberOfGraphics>e*ke,t=!this.suspendedOrOutsideOfView&&!i;t!==this._visible&&(this._visible=t,t?(this.stageLayer.pickable=!0,this.updateAllGraphicsVisibility()):(this.stageLayer.pickable=!1,this._hideAllGraphics()),this._updateStageLayerVisibility())}_updateStageLayerVisibility(){this.stageLayer.visible=this._visible&&(null==this.layer.opacity||this.layer.opacity>0)}getGraphics3DGraphicById(e){return null!=e?this.graphics3DGraphics.get(e):void 0}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,i=this.owner.layer&&this.owner.layer.objectIdField){return B(e,i)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer&&this.owner.layer.objectIdField;if(!e)return;const i=new Map;return this.graphics3DGraphics.forEach((t=>{if(!t)return;const r=t.graphic,s=this._getGraphicObjectID(r,e);null!=s&&i.set(s,t)})),i}get labelsEnabled(){return!(!this._labeler||!this._labeler.layerLabelsEnabled())}async updateLabelingInfo(e){const i=this._deconflictor&&this._deconflictor.labelingInfoChange(e),t=this._labeler&&this._labeler.labelingInfoChange(e);await u([i,t])}updateVisibilityInfo(){this._deconflictor&&this._deconflictor.labelingInfoChange(),this._labeler&&this._labeler.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=0,i=0;return o(this._symbols,((t,r)=>{if(null!=t){const s=t.getFastUpdateStatus();if(s.loading>0)return!0;this._graphicsBySymbol.has(r)&&(i+=s.fast,e+=s.slow)}return!1}))?"unknown":i>=0&&0===e?"fast":e>=0&&0===i?"slow":"mixed"}runTask(e){if(this._frameTask.processQueue(e),this._applyPendingUpdates(e),this.notifyChange("running"),this.running||this.notifyChange("updating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return xe.YIELD}setObjectIdVisibility(e,i){i?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const t=this._findGraphics3DGraphicByObjectId(e);null!=t&&this._updateUserVisibility(t)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(i=>this._getGraphicObjectID(i.graphic)===e))}_updateUserVisibility(e){if(null==e)return!1;const i=e.graphic,t=this._getGraphicObjectID(i),r=i.visible&&!this.owner.suspended&&(null==t||!this._objectIdInvisibleSet.has(t));return e.setVisibilityFlag(ee.USER_SETTING,r,ie.GRAPHIC)}_whenGraphics3DGraphic(e){const i=this.graphics3DGraphics.get(e.uid);if(i)return Promise.resolve(i);const t=this._whenGraphics3DGraphicRequests[e.uid];if(t)return t.promise;const r=b();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,i){const t=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,i,s)=>V(e,r,i,e,t,i,s),n=(e,i,r)=>V(e,s,i,e,t,i,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=i&&!!i.useViewElevation,minDemResolution:null!=i?i.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,p(i,"signal"));if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){T(h,Ae);const i=e.getElevation(Ae[0],Ae[1],0,t,"ground")??0;h[2]=Math.min(h[2],i),h[5]=Math.max(h[5],i)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,i){await w((()=>this.owner?.loadedGraphics));const t=this.owner.layer&&this.owner.layer.objectIdField,s=this.owner.loadedGraphics.find((i=>i===e||null!=t&&null!=i.attributes&&e.attributes&&i.attributes[t]===e.attributes[t]));if(!s)throw new r("internal:graphic-not-part-of-view","Graphic is not part of this view");const a=await this._whenGraphics3DGraphic(s);return this._boundsForGraphics3DGraphic(a,i)}computeAttachmentOrigin(e,i){const t=this.graphics3DGraphics.get(e.uid);if(!t)return null;const r=t.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;E(ze,0,0,0);let s=0;if(r.render.num>0){if(!O(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,We,i))return null;I(ze,ze,We),s++}if(r.draped.num>0){const[e,t]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,t,"ground")??0;if(E(We,e,t,a),!O(We,this._viewElevationProvider.spatialReference,We,i))return null;I(ze,ze,We),s++}return s>1&&U(ze,ze,1/s),new Re({x:ze[0],y:ze[1],z:ze[2],spatialReference:i})}getSymbolLayerSize(e,i){const t=this._symbols.get(e.id);if(null==t)throw new r("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=e.symbolLayers.indexOf(i);if(-1===s)throw new r("internal:missing-symbol-layer","Symbol layer is not in symbol");const a=t.getSymbolLayerSize(s);if(null==a)throw new r("internal:missing-size","Symbol layer has no valid size");return a}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const i=e.graphic.uid,t=this.graphics3DGraphics.get(i);if(null!=t||null!=this._graphicsWithoutSymbol.get(i))switch(e.property){case"visible":this._graphicUpdateVisibleHandler(t);break;case"geometry":this._graphicUpdateGeometryHandler(t,e);break;case"symbol":this._graphicUpdateSymbolHandler(t,e);break;case"attributes":break;case"transform":this._graphicUpdateTransformHandler(t,e)}}_graphicUpdateGeometryHandler(e,i){const t=i.graphic.geometry;if(null==t)return void this._recreateGraphic(i.graphic);if(null==e){const e=i.graphic.symbol&&i.graphic.symbol.id;if(e){const i=this._symbols.get(e);if(null!=i&&i.loadStatus===ce.LOADING)return}return void this._recreateGraphic(i.graphic)}const r=e.graphics3DSymbol;null!=i.newValue&&r.updateGeometry(e,i.newValue)||this._recreateGraphic(e.graphic),this._expandComputedExtent(t)}_graphicUpdateSymbolHandler(e,i){const t=i.graphic,r=null!=e?e.graphics3DSymbol:null!=i.oldValue?this._symbols.get(i.oldValue.id):null;if(null==r||null==i.newValue)return void this._recreateGraphic(t);const s=r.symbol,a=this._getConvertedSymbol(i.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(t);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(t);const o=R(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!D(l.diff))return void this._recreateGraphic(t);const h=this._getRenderingInfo(t);if(null==h)return void this._recreateGraphic(t);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty())}_graphicUpdateTransformHandler(e,i){}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===ve.SYNC&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const i=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,i),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("updating"),i}_endGraphicUpdate(e){e&&(this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach((i=>{null!=i&&(e=Math.max(e,i.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const i=Oe,t=e.spatialReference;H(e,i);const r=this._viewSpatialReference,s=Ue.tmpVec;if(M(t,r)||L(i[0],i[1],0,t,s,r)&&(i[0]=s[0],i[1]=s[1],L(i[3],i[4],0,t,s,r),i[3]=s[0],i[4]=s[1]),!(isFinite(i[0])&&isFinite(i[3])&&isFinite(i[1])&&isFinite(i[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(i[2])&&isFinite(i[5]),l=o&&(!a||null==a.zmin||i[2]<a.zmin),h=o&&(!a||null==a.zmax||i[5]>a.zmax);if(a){(i[0]<a.xmin||i[1]<a.ymin||i[3]>a.xmax||i[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(i[0],a.xmin),n.ymin=Math.min(i[1],a.ymin),n.xmax=Math.max(i[3],a.xmax),n.ymax=Math.max(i[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=i[0],n.ymin=i[1],n.xmax=i[3],n.ymax=i[4],n.spatialReference=r;n&&(l&&(n.zmin=i[2]),h&&(n.zmax=i[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){this._abortElevationInfoChange();const e=new AbortController;this._elevationInfoChangeAbortController=e;const i=te(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await re(i,this._viewSpatialReference,e.signal,je),g(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("elevationInfo",i)?i.forEach((e=>{const i=e.graphic,t=e.labelLayers;for(const r of t){r.graphics3DSymbolLayer.updateGraphicElevationContext(i,r)}})):this._recreateSymbol(t)})),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?(this.layer.elevationInfo&&"relative-to-scene"===this.layer.elevationInfo.mode||0===this._numberOfGraphicsProvidingElevation)&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=c(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new ue({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),null!=this._filterVisibility&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=c(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:i,view:t}=this.owner,r=t.basemapTerrain.tilingScheme&&i&&i.length?i.toArray():null;!e&&r||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=this.owner.view.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){const i=this._graphicsBySymbol.get(e),t=[];i&&(i.forEach(((e,i)=>{const r=e.usedMemory;this._conditionalRemove(e,i),this._spatialIndex?.remove(e),t.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(i,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed")})),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);h(r),this._symbols.delete(e),this.add(t)}_recreateGraphicsForSymbol(e){const i=this._graphicsBySymbol.get(e);if(i){const e=[];i.forEach((i=>e.push(i.graphic))),this.recreateGraphics(e)}}_conditionalRemove(e,i){this._graphicsDrapedUids.delete(i),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain&&this.owner.view.basemapTerrain.tilingScheme?(this._updatePolicyForGraphics(e)===ve.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("updating")):je.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===ve.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const i of e)if(null!=i.geometry&&"mesh"===i.geometry.type&&!i.geometry.loaded)return ve.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const i of e)this._addGraphic(i,this._getRenderingInfo(i,je),ve.SYNC);this._cleanupSymbols(),this._labeler&&(this.owner.view.labeler.setDirty(),this._cleanupSymbols()),this.owner.view.deconflictor.setDirty()}_addDelayed(e){for(const i of e){const e=i.uid;let t=this._pendingUpdates.get(e);t?t.add?t.state!==Fe.NEW&&t.abortController?.abort():this._pendingAdds++:(t=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(e,t)),t.add=i}this.notifyChange("running"),this.notifyChange("updatingRemaining")}remove(e){this.effectiveUpdatePolicy===ve.ASYNC?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("updating")}_removeImmediate(e){for(const i of e)this._removeGraphic(i);this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_removeDelayed(e){for(const i of e){const e=i.uid,t=this._pendingUpdates.get(e);if(t)t.add&&(t.remove?t.add=null:this._pendingUpdates.delete(e),t.state===Fe.LOADING&&t.abortController?.abort(),this._pendingAdds--);else{const t=this._pendingUpdatesPool.pushNew();t.remove=i,this._pendingUpdates.set(e,t),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("updatingRemaining")}_finishPendingUpdates(){this._pendingUpdatesPool.clear(),this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&je.warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyPendingUpdates(e){if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,0===this._pendingUpdates.size&&this._spatialIndex?.updating)return this._spatialIndex.update(),void e.madeProgress();if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(const[i,t]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(t.remove&&!t.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,this._pendingUpdates.delete(i),0===this._pendingRemoves))break}}for(const[i,t]of this._pendingUpdates){if(e.done)break;t.add&&t.state===Fe.NEW&&this._processPendingUpdateNew(t);let r=this.effectiveUpdatePolicy;if(!t.remove||t.add&&t.state!==Fe.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,r=ve.SYNC),t.add)switch(t.state){case Fe.READY:this._addGraphic(t.add,t.renderingInfo,r),t.add=null,this._pendingAdds--,e.madeProgress();break;case Fe.REJECTED:t.add=null,this._pendingAdds--;case Fe.LOADING:}null==t.remove&&null==t.add&&this._pendingUpdates.delete(i)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("running"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=Fe.READY);const i=e.add.geometry;null==i||"mesh"!==i.type||i.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,i)}async _processPendingUpdateNewMesh(e,i){e.state=Fe.LOADING,e.abortController=new AbortController;const t=e.abortController.signal;try{await i.load({signal:t})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,i){e.abortController=null,_(i)?e.state=Fe.NEW:e.state=Fe.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add,je),void(e.state=Fe.READY);e.state=Fe.LOADING,e.abortController=new AbortController;let i=null;try{i=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(t){return e.abortController=null,void(_(t)?e.state=Fe.NEW:e.state=Fe.REJECTED)}null==i||null==i.symbol?(je&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=i,e.state=Fe.READY}_addGraphic(e,i,t){if(this._graphicsWithoutSymbol.set(e.uid,e),null==i||null==i.symbol||!q(e))return;null!=this.stage.renderView.objectAndLayerIdRenderHelper&&this.setUidToIdOnAdd&&this.stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.layer.uid,!!this.layer.popupEnabled);const r=i.symbol,s=this.getOrCreateGraphics3DSymbol(r,i.renderer);if(null==s)return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new ae(e,i,this.layer);let o=!1;const l=e=>{e===s.symbol.id&&(o=!0)};this._whenSymbolRemoved.push(l);const h=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(l);if(this._graphicsWaitingForSymbol.get(e.uid)!==a||o||s.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==s.symbol.id)--s.referenced,this._cleanupSymbols();else{const i=this._createGraphics3DGraphic(s,n);this._spatialIndex&&null!=i&&this._spatialIndex.add(i),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()},d=i=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(_(i)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,t===ve.ASYNC?s.load((()=>this._frameTask.schedule(h)),(e=>this._frameTask.schedule((()=>d(e))))):s.load(h,d)}_removeGraphic(e){const i=e.uid,t=this.graphics3DGraphics.get(i);if(t){t.graphics3DSymbol.onRemoveGraphic(t);const e=t.usedMemory,r=t.isElevationSource;this._conditionalRemove(t,i),this._spatialIndex?.remove(t);const s=t.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(i),this._graphicsWithoutSymbol.delete(i),this._removeGraphics3DGraphic(i,e,r),t.destroy(),this._featureStore.events.emit("changed")}else this._graphicsWithoutSymbol.delete(i),this._graphicsWaitingForSymbol.delete(i),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating"))}_hasLabelingContext(e){if(e instanceof De||e instanceof Ee){const i=this.symbolCreationContext.layer;return!!i.labelingInfo&&i.labelingInfo.some((i=>i.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof De&&!this._hasLabelingContext(e))||(je.error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,i){const t=e.geometry;if(null==t)return i&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!j(t.spatialReference,this._viewSpatialReference))return i&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return i&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?Y(e,this.layer):e;let s;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||null!=this.currentRenderer))s=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{s={symbol:r.symbol||Q(r.geometry)}}return null==s||null==s.symbol?(i&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):s}_getRenderingInfoAsync(e,i){if(null==e.geometry)return je&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return je&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const t=this.rendererHasGeometryOperations?Y(e,this.layer):e;return this.owner.getRenderingInfoAsync(t,this.currentRenderer,this._arcadeOnDemand,i)}_createGraphics3DSymbol(e,i){if(!this._hasValidSymbolCreationContext(e))return null;const t=this._getConvertedSymbol(e);if(!t)return null;let r;if(null!=i&&"backgroundFillSymbol"in i&&i.backgroundFillSymbol){const e=K(i.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&"web-style"!==e.symbol.type&&"cim"!==e.symbol.type&&(r=e.symbol.symbolLayers)}const s=oe(t,this.symbolCreationContext,r);return s.load((()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")}),(()=>{})),s}getOrCreateGraphics3DSymbol(e,i){let t=this._symbols.get(e.id);return void 0===t&&(t=e instanceof Ie?new le(e,(e=>this._frameTask.schedule(e)),(e=>this._createGraphics3DSymbol(e,i))):this._createGraphics3DSymbol(e,i),this._symbols.set(e.id,t)),null!=t&&++t.referenced,t}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new he(this)),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,i,t=!1){this._usedMemory-=i,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,t&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,i){const t=i.graphic;if(this._graphicsWithoutSymbol.delete(t.uid),!this._symbols.has(e.symbol.id))return this.add([t]),null;if(this.graphics3DGraphics.has(t.uid))return null;const r=e.createGraphics3DGraphic(i);if(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(t.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(t.uid),r.centroid=null,null!=t.geometry&&"point"!==t.geometry.type&&(r.centroid=de(t.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(ee.FILTER,e,ie.GRAPHIC),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),this._deconflictor&&this.owner.view.deconflictor.setInitialIconVisibilityFlag(this,r),r.initialize(this.stageLayer,this.owner),null!=this._graphicStateTracking&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[t.uid];return a&&(delete this._whenGraphics3DGraphicRequests[t.uid],a.resolve(r)),r}_abortRendererChange(){this._rendererChangeAbortController&&(this._rendererChangeAbortController.abort(),this._rendererChangeAbortController=null)}async rendererChange(e){if(this._abortRendererChange(),e!==this.currentRenderer)if(this._validateRenderer(e),null==e&&this._currentRendererChange(null,!1),$(e))if(null!=e&&e.arcadeRequired){const i=new AbortController;this._rendererChangeAbortController=i;const{arcadeUtils:t}=await this._ensureArcade();g(i);const r=t.hasGeometryOperations(e);r&&(await t.enableGeometryOperations(),g(i)),this.effectiveUpdatePolicy===ve.ASYNC?await this._frameTask.schedule((()=>this._currentRendererChange(e,r)),i.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===ve.ASYNC){const i=new AbortController;this._rendererChangeAbortController=i,await this._frameTask.schedule((()=>this._currentRendererChange(e,!1)),i.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await J(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,i){this.currentRenderer=e,this.rendererHasGeometryOperations=i,this.symbolCreationContext.arcade=this._arcadeOnDemand;const t=this.symbolCreationContext.renderer;if(e===t)return;if(this._symbolConversionCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=R(t,e);this._updateUnchangedSymbolMappings(r,e,t),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,t)?this._volatileGraphicsUpdated():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const i in e.diff)switch(i){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[i];break;default:return!0}return!1}_applySymbolSetDiff(e,i,t){e=e||[],i=i||[];const r=[];for(const s of i){const i=this._graphicsBySymbol.get(s.id);i&&i.forEach(((a,n)=>{const o=a.graphic,l=this.layer instanceof N?this.layer:null,h=this._arcadeOnDemand;if(s===t.defaultSymbol&&t.getSymbol(Y(o,l),{arcade:h})===t.defaultSymbol)return;const d=a.usedMemory;e.length||t.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),i.delete(n),this._removeGraphics3DGraphic(n,d),this._updateLayerVisibility()})),this._whenSymbolRemoved.forAll((e=>e(s.id)))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach((e=>r.push(e))),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_applyUniqueValueRendererDiff(e,i,t){const r=e.diff.defaultSymbol,s=e.diff.uniqueValueInfos;if(r||s){const a=s?s.added.map((e=>e.symbol)).filter(y):[],n=s?s.removed.map((e=>e.symbol)).filter(y):[];if(s)for(let e=0;e<s.changed.length;e++)a.push(s.changed[e].newValue.symbol),n.push(s.changed[e].oldValue.symbol);return r?(t.defaultSymbol&&n.push(t.defaultSymbol),i.defaultSymbol&&a.push(i.defaultSymbol)):t.defaultSymbol&&a.length&&n.push(i.defaultSymbol),this._applySymbolSetDiff(a,n,i),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,i,t){if("unique-value"!==i?.type||"unique-value"!==t?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s&&s.defaultSymbol,n=s&&s.uniqueValueInfos;let o;if(n)o=n.unchanged.map((e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)})));else{o=[];for(const e of t.uniqueValueInfos??[]){const t=r(e.symbol),s=i.uniqueValueInfos?.find((i=>i.value===e.value));s&&t!==r(s.symbol)&&o.push({oldId:t,newId:r(s.symbol)})}}return!a&&t.defaultSymbol&&o.push({oldId:r(t.defaultSymbol),newId:r(i.defaultSymbol)}),o}_updateSymbolMapping(e,i){const t=null!=i&&i?"string"==typeof i?i:i.id:null;if(null==e||e===t)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(t,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(t,s),null!=s)){const e="string"==typeof i?null:i;null!=e?s.symbol=e:s.symbol.id=t}}_updateUnchangedSymbolMappings(e,i,t){const r=this._calculateUnchangedSymbolMapping(e,i,t);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,t,r){if(this._diffHasSymbolChange(e))return!1;if(t instanceof i&&r instanceof i&&this._applyUniqueValueRendererDiff(e,t,r)&&0===Object.keys(e.diff).length)return!0;for(const[i]of this._graphicsBySymbol){const r=this._symbols.get(i);if(null!=r)switch(r.applyRendererDiff(e,t)){case pe.RecreateSymbol:this._recreateSymbol(i);break;case pe.RecreateGraphics:this._recreateGraphicsForSymbol(i);case pe.FastUpdate:}}return!0}opacityChange(){this.forEachGraphics3DSymbol(((e,i)=>e.globalPropertyChanged("opacity",i))),this._updateStageLayerVisibility()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol(((e,i)=>e.globalPropertyChanged("slicePlaneEnabled",i))),this._deconflictor&&this._deconflictor.slicePlaneEnabledChange(),this._labeler&&this._labeler.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",i)||this._recreateSymbol(t)}))}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("skipHighSymbolLods",i)||this._recreateSymbol(t)}))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("pixelRatio",i)||this._recreateSymbol(t)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=G((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,i){const t=this.symbolCreationContext.clippingExtent,r=W();return be(e,r,i)?this.symbolCreationContext.clippingExtent=k(F(),r):this.symbolCreationContext.clippingExtent=null,!z(this.symbolCreationContext.clippingExtent,t)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let i=!1;this.graphics3DGraphics.forEach((t=>{e(t)&&(i=!0)})),i&&(this.owner.view.labeler?.setDirty(),this.owner.view.deconflictor?.setDirty())}forEachGraphics3DSymbol(e){for(const[i,t]of this._symbols){if(null==t)return;e(t,this._graphicsBySymbol.get(i)||Me,i)}}updateAllGraphicsVisibility(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const i=this._updateUserVisibility(e),t=null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(e);return i||t}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(ee.USER_SETTING,!1,ie.GRAPHIC)))}_validateRenderer(e){const i=Z(e,{geometryType:this.layer?.geometryType});if(i){const e=`Renderer for layer '${this.layer.title?`${this.layer.title}, `:""}, id:${this.layer.id}' is not supported in a SceneView`;je.warn(e,i.message)}}_volatileGraphicsUpdated(){this._labeler?.reset(),this.stageLayer.shaderTransformationChanged(),this.notifyChange("updating")}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach(((i,t)=>{if(null==i||i.referenced>0)return;const r=this._graphicsBySymbol.get(t);r&&0!==r.size||(this._graphicsBySymbol.delete(t),this._symbols.delete(t),h(i),e=!0)})),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){return{snapshotInternals:()=>({graphics:[...this.graphics3DGraphics.keys()].sort(),symbols:[...this._symbols.keys()].sort(),graphicsBySymbol:[...this._graphicsBySymbol.keys()].sort().map((e=>({symbolId:e,graphics:[...this._graphicsBySymbol.get(e).keys()].sort()}))),graphicsWithoutSymbol:[...this._graphicsWithoutSymbol.keys()].sort(),graphicsDrapedUids:[...this._graphicsDrapedUids].sort(),pendingUpdates:this._pendingUpdates}),symbols:this._symbols,filterVisibility:this._filterVisibility,numPending:this._pendingUpdates.size,forceUpdatePolicy:e=>{this._forcedUpdatePolicy=e}}}get performanceInfo(){return{visible:this.graphics3DGraphics.size,missing:this._graphicsWithoutSymbol.size,pending:this._pendingUpdates.size}}};var Fe;Ve.tmpVec=A(),e([x({readOnly:!0})],Ve.prototype,"computedExtent",void 0),e([x()],Ve.prototype,"currentRenderer",void 0),e([x()],Ve.prototype,"rendererHasGeometryOperations",void 0),e([x()],Ve.prototype,"_frameTask",void 0),e([x({readOnly:!0})],Ve.prototype,"_viewSpatialReference",null),e([x()],Ve.prototype,"_rendererChangeAbortController",void 0),e([x()],Ve.prototype,"_elevationInfoChangeAbortController",void 0),e([x()],Ve.prototype,"_initializeAbortController",void 0),e([x()],Ve.prototype,"_elevationAlignment",void 0),e([x()],Ve.prototype,"_scaleVisibility",void 0),e([x()],Ve.prototype,"_filterVisibility",void 0),e([x()],Ve.prototype,"_initializePromise",void 0),e([x()],Ve.prototype,"_spatialIndex",void 0),e([x({readOnly:!0})],Ve.prototype,"extentPadding",void 0),e([x()],Ve.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([x()],Ve.prototype,"_featureStore",void 0),e([x()],Ve.prototype,"_deconflictor",void 0),e([x()],Ve.prototype,"_labeler",void 0),e([x()],Ve.prototype,"_objectStates",void 0),e([x()],Ve.prototype,"_loadingSymbols",void 0),e([x()],Ve.prototype,"preferredUpdatePolicy",void 0),e([x()],Ve.prototype,"_forcedUpdatePolicy",void 0),e([x({readOnly:!0})],Ve.prototype,"effectiveUpdatePolicy",null),e([x({constructOnly:!0})],Ve.prototype,"elevationFeatureExpressionEnabled",void 0),e([x({constructOnly:!0})],Ve.prototype,"owner",void 0),e([x({constructOnly:!0})],Ve.prototype,"layer",void 0),e([x({constructOnly:!0})],Ve.prototype,"graphicSymbolSupported",void 0),e([x({constructOnly:!0})],Ve.prototype,"getRenderingInfoWithoutRenderer",void 0),e([x({constructOnly:!0})],Ve.prototype,"componentFactories",void 0),e([x({constructOnly:!0})],Ve.prototype,"setUidToIdOnAdd",void 0),e([x()],Ve.prototype,"featureStore",null),e([x()],Ve.prototype,"initializePromise",null),e([x()],Ve.prototype,"scaleVisibility",null),e([x()],Ve.prototype,"elevationAlignment",null),e([x()],Ve.prototype,"objectStates",null),e([x()],Ve.prototype,"filterVisibility",null),e([x({readOnly:!0})],Ve.prototype,"updating",null),e([x({readOnly:!0})],Ve.prototype,"running",null),e([x({readOnly:!0})],Ve.prototype,"suspendedOrOutsideOfView",null),e([x({readOnly:!0,dependsOn:[]})],Ve.prototype,"updatingRemaining",null),e([x({readOnly:!0,dependsOn:["owner.view.qualitySettings.graphics3D.maxTotalNumberOfPrimitives","owner.view.qualitySettings.graphics3D.maxTotalNumberOfFeatures","averageSymbolComplexity"]})],Ve.prototype,"displayFeatureLimit",null),e([x({readOnly:!0,dependsOn:[]})],Ve.prototype,"averageSymbolComplexity",null),e([x({constructOnly:!0})],Ve.prototype,"hasZ",void 0),e([x({constructOnly:!0})],Ve.prototype,"hasM",void 0),e([x()],Ve.prototype,"_objectIdField",null),Ve=Ue=e([P(Le)],Ve),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(Fe||(Fe={}));class Te{constructor(){this.add=null,this.renderingInfo=null,this.state=Fe.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=Fe.NEW,this.abortController=null,this.remove=null}}const ke=10,ze=A(),We=A(),Me=new Map;export{Ve as Graphics3DCore};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import"../../../../renderers/ClassBreaksRenderer.js";import"../../../../renderers/DictionaryRenderer.js";import"../../../../renderers/DotDensityRenderer.js";import"../../../../renderers/HeatmapRenderer.js";import"../../../../renderers/PieChartRenderer.js";import"../../../../renderers/Renderer.js";import"../../../../renderers/SimpleRenderer.js";import i from"../../../../renderers/UniqueValueRenderer.js";import"../../../../renderers/support/jsonUtils.js";import"../../../../symbols.js";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import r from"../../../../core/Error.js";import s from"../../../../core/Handles.js";import{makeHandle as a}from"../../../../core/handleUtils.js";import n from"../../../../core/Logger.js";import{someMap as o,findInMap as l}from"../../../../core/MapUtils.js";import{destroyMaybe as h,removeMaybe as d,disposeMaybe as p,isSome as c}from"../../../../core/maybe.js";import y from"../../../../core/PooledArray.js";import{throwIfAborted as m,eachAlways as g,createDeferred as u,isAbortError as b}from"../../../../core/promiseUtils.js";import{watch as _,when as f,on as v,syncAndInitial as C,whenOnce as S}from"../../../../core/reactiveUtils.js";import{schedule as w}from"../../../../core/scheduling.js";import{property as G}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as x}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as P,isEmpty as R}from"../../../../core/accessorSupport/diffUtils.js";import{s as D,a as E,g as I}from"../../../../chunks/vec3.js";import{c as U}from"../../../../chunks/vec3f64.js";import{projectVectorToVector as A,projectXYZToVector as O,canProjectWithoutEngine as L,projectBuffer as j}from"../../../../geometry/projection.js";import{create as V,center as F,fromRect as T,equals as k}from"../../../../geometry/support/aaBoundingBox.js";import{create as z}from"../../../../geometry/support/aaBoundingRect.js";import{equals as W}from"../../../../geometry/support/spatialReferenceUtils.js";import M from"../../../../layers/Layer.js";import{getObjectId as N,computeAABB as B,hasGeometry as H}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as q}from"../../../../layers/graphics/hydratedFeatures.js";import{isSupportedRenderer3D as Y,validateTo3D as $}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as Z}from"../../../../support/arcadeOnDemand.js";import{getDefaultSymbol3D as J}from"../../../../symbols/support/defaults3D.js";import{to3D as Q}from"../../../../symbols/support/symbolConversion.js";import{ViewElevationProvider as K}from"./ElevationQuery.js";import{VisibilityFlag as X,VisibilityGroup as ee}from"./enums.js";import{extractExpressionInfo as ie,createContext as te}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as re}from"./Graphics3DFeatureStore.js";import se from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as ae}from"./Graphics3DSymbolCreationContext.js";import{make as ne}from"./Graphics3DSymbolFactory.js";import oe from"./Graphics3DWebStyleSymbol.js";import{GraphicStateTracking as le}from"./GraphicStateTracking.js";import{computeCentroid as he}from"./graphicUtils.js";import{ApplyRendererDiffResult as de}from"./interfaces.js";import{LoadStatus as pe}from"./Loadable.js";import{SpatialIndex2D as ce}from"./SpatialIndex2D.js";import{averageSymbolComplexities as ye,defaultSymbolComplexity as me}from"./symbolComplexity.js";import{StageLayerElevationProvider as ge}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as ue}from"../../support/extentUtils.js";import{PropertiesPool as be}from"../../support/PropertiesPool.js";import{GridLocalOriginFactory as _e}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{UpdatePolicy as fe}from"../../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as ve}from"../../webgl-engine/lib/WebGLLayer.js";import{ImmediateTask as Ce,noBudget as Se,TaskPriority as we,Task as Ge}from"../../../support/Scheduler.js";import xe from"../../../../geometry/Extent.js";import Pe from"../../../../geometry/Point.js";import Re from"../../../../symbols/LabelSymbol3D.js";import De from"../../../../symbols/TextSymbol.js";import Ee from"../../../../symbols/WebStyleSymbol.js";var Ie;const Ue=U(),Ae=V(),Oe="esri.views.3d.layers.graphics.Graphics3DCore",Le=n.getLogger(Oe);let je=Ie=class extends t{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ce({objectIdField:this.owner.layer?.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?fe.ASYNC:this._forcedUpdatePolicy??this.preferredUpdatePolicy}get featureStore(){return this._featureStore}get initializePromise(){return this._initializePromise}get scaleVisibility(){return this._scaleVisibility}get elevationAlignment(){return this._elevationAlignment}get objectStates(){return this._objectStates}get filterVisibility(){return this._filterVisibility}get updating(){return!!(this._graphicsWaitingForSymbol.size>0||this.running||this._elevationAlignment?.updating||null!=this._scaleVisibility&&this._scaleVisibility.updating||null!=this._filterVisibility&&this._filterVisibility.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._updatingPendingLoadedGraphicsChange||this._frameTask.updating||this._loadingSymbols>0)}get running(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating}get suspendedOrOutsideOfView(){return this.owner.suspended||!!this.owner.suspendInfo?.outsideOfView}get updatingRemaining(){return this.updating?this._pendingUpdates.size+.1*(this._spatialIndex?.updatingRemaining||0)+.1*(this._elevationAlignment?.updatingRemaining||0):0}get displayFeatureLimit(){const e=this.owner&&this.owner.view&&this.owner.view.qualitySettings,i=e?e.graphics3D.minTotalNumberOfFeatures:0,t=e?e.graphics3D.maxTotalNumberOfFeatures:0,r=e?e.graphics3D.maxTotalNumberOfPrimitives:0,s=this.averageSymbolComplexity,a=Math.max(1,null!=s?s.primitivesPerFeature:1),n=null!=s&&s.drawCallsPerFeature>0?t/s.drawCallsPerFeature*.3:t,o=Math.ceil(r/a),l=Math.max(i,Math.min(t,o,n)),h=this._get("displayFeatureLimit");return h&&h.minimumTotalNumberOfFeatures===i&&h.maximumTotalNumberOfFeatures===t&&h.maximumTotalNumberOfPrimitives===r&&h.averageSymbolComplexity===s&&h.maximumNumberOfFeatures===l?h:{minimumTotalNumberOfFeatures:i,maximumTotalNumberOfFeatures:t,maximumTotalNumberOfPrimitives:r,averageSymbolComplexity:s,maximumNumberOfFeatures:l}}get averageSymbolComplexity(){const e=ye(this._symbolComplexities),i=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=i&&(e.estimated&&(i.primitivesPerFeature>=e.primitivesPerFeature||i.primitivesPerCoordinate>=e.primitivesPerCoordinate||i.drawCallsPerFeature>=e.drawCallsPerFeature)||i.primitivesPerFeature===e.primitivesPerFeature&&i.primitivesPerCoordinate===e.primitivesPerCoordinate&&i.drawCallsPerFeature===e.drawCallsPerFeature)?i:e}get usedMemory(){const e=null!=this.averageSymbolComplexity&&this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel*this._numberOfGraphics:0,i=this._getSymbolComplexitiesUsed().reduce(((e,i)=>e+i.memory.resourceBytes),0);return this._usedMemory+e+i}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){if("web-style"===e.type)return e.clone();const i=this._symbolConversionCache.get(e.id);if(null!=i)return i;const t=Q(e,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(e)}),r=t.symbol||null;return null==r&&t.error&&Le.error(t.error.message),this._symbolConversionCache.set(e.id,r),r}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const i=e.getSymbols(),t="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!(t||i&&i.length))return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(t);null!=s&&r.push(s);for(const a of i){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const i=this._symbols.get(e.id);if(null!=i)return i.complexity;const t=this._getConvertedSymbol(e);return null!=t?me(t):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((i=>{null!=i&&e.push(i.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new be({computedExtent:xe},this),this.computedExtent=null,this.currentRenderer=null,this.rendererHasGeometryOperations=!1,this._graphicStateTracking=null,this.graphics3DGraphics=new Map,this.stageLayer=null,this.stage=null,this._graphicsDrapedUids=new Set,this._graphicsBySymbol=new Map,this._symbolConversionCache=new Map,this._symbols=new Map,this._graphicsWithoutSymbol=new Map,this._graphicsWaitingForSymbol=new Map,this._graphicsUpdateId=0,this._handles=new s,this._frameTask=Ce,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._scaleVisibility=null,this._filterVisibility=null,this._spatialIndex=null,this.extentPadding=0,this._updatingPendingLoadedGraphicsChange=null,this._featureStore=null,this._deconflictor=null,this._labeler=null,this._objectStates=null,this._viewElevationProvider=null,this._stageLayerElevationProvider=null,this._sharedSymbolResourcesOwnerHandle=null,this._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this._pendingUpdatesPool=new y({allocator:e=>e||new Fe,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new y,this.preferredUpdatePolicy=fe.SYNC,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this.symbolCreationContext=new ae(e.owner.view.resourceController.scheduler,((e,i)=>this._frameTask.schedule(e,i)))}initialize(){this._featureStore=new re({objectIdField:this.owner.layer&&this.owner.layer.objectIdField,hasZ:!!this.hasZ,hasM:!!this.hasM,viewSpatialReference:this._viewSpatialReference,featureSpatialReference:this.owner.featureSpatialReference,getSpatialIndex:()=>this.spatialIndex,forEach:e=>this.graphics3DGraphics.forEach(e)});const e=(e,i,t)=>this.spatialIndex.queryGraphicUIDsInExtent(e,i,t),{componentFactories:i}=this;if(null!=i.elevationAlignment){const t=i.elevationAlignment(this,e);this._elevationAlignment=t}if(null!=i.scaleVisibility){const t=i.scaleVisibility(this,e);this._scaleVisibility=t}if(null!=i.filterVisibility){const e=i.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(X.FILTER,e(N(i.graphic,this._objectIdField)),ee.GRAPHIC))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(X.FILTER,e,ee.GRAPHIC))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(X.FILTER)))});this._filterVisibility=e}if(null!=i.deconflictor){const e=i.deconflictor(this);this._deconflictor=e}if(null!=i.labeler&&null!=this._scaleVisibility){const e=i.labeler(this,this._scaleVisibility);this._labeler=e}if(null!=i.objectStates){const e=i.objectStates(this);this._objectStates=e}this._initializeAbortController=new AbortController,this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,i=this.owner.view;this._viewElevationProvider=new K(this._viewSpatialReference,i),this._initializeStage(i,this.layer.uid);const t=i.sharedSymbolResources;this.symbolCreationContext.sharedResources=t,this._sharedSymbolResourcesOwnerHandle=t.addGraphicsOwner(this.owner),null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=t.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=i.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new _e(i.renderSpatialReference),this.symbolCreationContext.elevationProvider=i.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=ie(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await te(r,this._viewSpatialReference,e,Le),m(e),this.symbolCreationContext.screenSizePerspectiveEnabled=i.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this.symbolCreationContext.physicalBasedRenderingEnabled=!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,this.symbolCreationContext.skipHighSymbolLods=!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,"drapeSourceType"in this.owner){const{owner:e}=this;this.symbolCreationContext.drapeSourceRenderer=i.basemapTerrain.overlayManager.registerGeometryDrapeSource(e),this._handles.add(a((()=>i.basemapTerrain.overlayManager.unregisterDrapeSource(e))))}this._handles.add([_((()=>this.suspendedOrOutsideOfView),(()=>this._frameTask.reschedule((()=>this._updateLayerVisibility())))),_((()=>[this.layer?.screenSizePerspectiveEnabled,this.owner.view?.screenSizePerspectiveEnabled]),(()=>{const e=i.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled;e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._labeler?.reset(),this.recreateAllGraphicsAndSymbols())})),_((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),_((()=>this.owner.view.state?.rasterPixelRatio),(()=>this._pixelRatioChange())),_((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),_((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),f((()=>i.basemapTerrain?.tilingScheme),(e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==i.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=i.basemapTerrain.spatialReference),this._handles.has("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this._handles.add([v(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),_((()=>this.effectiveUpdatePolicy),(e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===fe.ASYNC,e===fe.SYNC&&this.runTask(Se)}),C)]),this._frameTask=i.resourceController.scheduler.registerTask(we.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this._handles.add(_((()=>this.layer.featureReduction),(()=>this._deconflictor.featureReductionChange()))),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch((()=>{})),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController&&(this._initializeAbortController.abort(),this._initializeAbortController=null)}destroy(){this._abortInitialize(),this._abortRendererChange(),this._abortElevationInfoChange(),this._frameTask.remove(),this._frameTask=Ce,this.owner.view?.deconflictor?.removeGraphicsOwner(this),this.owner.view?.labeler?.removeGraphicsOwner(this),this._elevationAlignment=h(this._elevationAlignment),this._scaleVisibility=h(this._scaleVisibility),this._filterVisibility=h(this._filterVisibility),this._deconflictor=null,this._labeler=null,this._objectStates=h(this._objectStates),this.clear(),this._featureStore=h(this._featureStore),this._updatingPendingLoadedGraphicsChange=d(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=h(this._graphicStateTracking),this.stage&&(this.stageLayer=h(this.stageLayer),this.stage=null),this._handles=h(this._handles),this._set("owner",null);for(const e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new r("graphic:layer-destroyed","Layer has been destroyed"));this._whenGraphics3DGraphicRequests=null,this._sharedSymbolResourcesOwnerHandle=d(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=h(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=h(this._spatialIndex)}clear(){this._objectStates?.allGraphicsDeleted(),null!=this._graphicStateTracking&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach((e=>e.destroy())),this._spatialIndex?.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(h),this._symbols.clear(),this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingUpdatesPool.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("updating"),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed")}_initializeStage(e,i){this.stage=e._stage,this.stageLayer=new ve(this.stage,{pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},i);const t=this.stageLayer.events;t.on("objectTransformation",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),t.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.graphicUid))),t.on("objectGeometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),t.on("objectGeometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),t.on("objectGeometryUpdated",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)))}notifyGraphicGeometryChanged(e){if(null==this._graphicStateTracking||null==e)return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicGeometry(i)}notifyGraphicVisibilityChanged(e){if(null==this._graphicStateTracking||null==e)return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicVisibility(i)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,i=this._numberOfGraphics>e*Te,t=!this.suspendedOrOutsideOfView&&!i;t!==this._visible&&(this._visible=t,t?(this.stageLayer.pickable=!0,this.updateAllGraphicsVisibility()):(this.stageLayer.pickable=!1,this._hideAllGraphics()),this._updateStageLayerVisibility())}_updateStageLayerVisibility(){this.stageLayer.visible=this._visible&&(null==this.layer.opacity||this.layer.opacity>0)}getGraphics3DGraphicById(e){return null!=e?this.graphics3DGraphics.get(e):void 0}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,i=this.owner.layer&&this.owner.layer.objectIdField){return N(e,i)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer&&this.owner.layer.objectIdField;if(!e)return;const i=new Map;return this.graphics3DGraphics.forEach((t=>{if(!t)return;const r=t.graphic,s=this._getGraphicObjectID(r,e);null!=s&&i.set(s,t)})),i}get labelsEnabled(){return!(!this._labeler||!this._labeler.layerLabelsEnabled())}async updateLabelingInfo(e){const i=this._deconflictor&&this._deconflictor.labelingInfoChange(e),t=this._labeler&&this._labeler.labelingInfoChange(e);await g([i,t])}updateVisibilityInfo(){this._deconflictor&&this._deconflictor.labelingInfoChange(),this._labeler&&this._labeler.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=0,i=0;return o(this._symbols,((t,r)=>{if(null!=t){const s=t.getFastUpdateStatus();if(s.loading>0)return!0;this._graphicsBySymbol.has(r)&&(i+=s.fast,e+=s.slow)}return!1}))?"unknown":i>=0&&0===e?"fast":e>=0&&0===i?"slow":"mixed"}runTask(e){if(this._frameTask.processQueue(e),this._applyPendingUpdates(e),this.notifyChange("running"),this.running||this.notifyChange("updating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return Ge.YIELD}setObjectIdVisibility(e,i){i?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const t=this._findGraphics3DGraphicByObjectId(e);null!=t&&this._updateUserVisibility(t)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(i=>this._getGraphicObjectID(i.graphic)===e))}_updateUserVisibility(e){if(null==e)return!1;const i=e.graphic,t=this._getGraphicObjectID(i),r=i.visible&&!this.owner.suspended&&(null==t||!this._objectIdInvisibleSet.has(t));return e.setVisibilityFlag(X.USER_SETTING,r,ee.GRAPHIC)}_whenGraphics3DGraphic(e){const i=this.graphics3DGraphics.get(e.uid);if(i)return Promise.resolve(i);const t=this._whenGraphics3DGraphicRequests[e.uid];if(t)return t.promise;const r=u();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,i){const t=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,i,s)=>j(e,r,i,e,t,i,s),n=(e,i,r)=>j(e,s,i,e,t,i,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=i&&!!i.useViewElevation,minDemResolution:null!=i?i.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,i?.signal);if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){F(h,Ue);const i=e.getElevation(Ue[0],Ue[1],0,t,"ground")??0;h[2]=Math.min(h[2],i),h[5]=Math.max(h[5],i)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,i){await S((()=>this.owner?.loadedGraphics));const t=this.owner.layer&&this.owner.layer.objectIdField,s=this.owner.loadedGraphics.find((i=>i===e||null!=t&&null!=i.attributes&&e.attributes&&i.attributes[t]===e.attributes[t]));if(!s)throw new r("internal:graphic-not-part-of-view","Graphic is not part of this view");const a=await this._whenGraphics3DGraphic(s);return this._boundsForGraphics3DGraphic(a,i)}computeAttachmentOrigin(e,i){const t=this.graphics3DGraphics.get(e.uid);if(!t)return null;const r=t.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;D(ke,0,0,0);let s=0;if(r.render.num>0){if(!A(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,ze,i))return null;E(ke,ke,ze),s++}if(r.draped.num>0){const[e,t]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,t,"ground")??0;if(D(ze,e,t,a),!A(ze,this._viewElevationProvider.spatialReference,ze,i))return null;E(ke,ke,ze),s++}return s>1&&I(ke,ke,1/s),new Pe({x:ke[0],y:ke[1],z:ke[2],spatialReference:i})}getSymbolLayerSize(e,i){const t=this._symbols.get(e.id);if(null==t)throw new r("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=e.symbolLayers.indexOf(i);if(-1===s)throw new r("internal:missing-symbol-layer","Symbol layer is not in symbol");const a=t.getSymbolLayerSize(s);if(null==a)throw new r("internal:missing-size","Symbol layer has no valid size");return a}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const i=e.graphic.uid,t=this.graphics3DGraphics.get(i);if(null!=t||null!=this._graphicsWithoutSymbol.get(i))switch(e.property){case"visible":this._graphicUpdateVisibleHandler(t);break;case"geometry":this._graphicUpdateGeometryHandler(t,e);break;case"symbol":this._graphicUpdateSymbolHandler(t,e);break;case"attributes":break;case"transform":this._graphicUpdateTransformHandler(t,e)}}_graphicUpdateGeometryHandler(e,i){const t=i.graphic.geometry;if(null==t)return void this._recreateGraphic(i.graphic);if(null==e){const e=i.graphic.symbol&&i.graphic.symbol.id;if(e){const i=this._symbols.get(e);if(null!=i&&i.loadStatus===pe.LOADING)return}return void this._recreateGraphic(i.graphic)}const r=e.graphics3DSymbol;null!=i.newValue&&r.updateGeometry(e,i.newValue)||this._recreateGraphic(e.graphic),this._expandComputedExtent(t)}_graphicUpdateSymbolHandler(e,i){const t=i.graphic,r=null!=e?e.graphics3DSymbol:null!=i.oldValue?this._symbols.get(i.oldValue.id):null;if(null==r||null==i.newValue)return void this._recreateGraphic(t);const s=r.symbol,a=this._getConvertedSymbol(i.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(t);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(t);const o=P(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!R(l.diff))return void this._recreateGraphic(t);const h=this._getRenderingInfo(t);if(null==h)return void this._recreateGraphic(t);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty())}_graphicUpdateTransformHandler(e,i){}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===fe.SYNC&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const i=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,i),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("updating"),i}_endGraphicUpdate(e){e&&(this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach((i=>{null!=i&&(e=Math.max(e,i.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const i=Ae,t=e.spatialReference;B(e,i);const r=this._viewSpatialReference,s=Ie.tmpVec;if(W(t,r)||O(i[0],i[1],0,t,s,r)&&(i[0]=s[0],i[1]=s[1],O(i[3],i[4],0,t,s,r),i[3]=s[0],i[4]=s[1]),!(isFinite(i[0])&&isFinite(i[3])&&isFinite(i[1])&&isFinite(i[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(i[2])&&isFinite(i[5]),l=o&&(!a||null==a.zmin||i[2]<a.zmin),h=o&&(!a||null==a.zmax||i[5]>a.zmax);if(a){(i[0]<a.xmin||i[1]<a.ymin||i[3]>a.xmax||i[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(i[0],a.xmin),n.ymin=Math.min(i[1],a.ymin),n.xmax=Math.max(i[3],a.xmax),n.ymax=Math.max(i[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=i[0],n.ymin=i[1],n.xmax=i[3],n.ymax=i[4],n.spatialReference=r;n&&(l&&(n.zmin=i[2]),h&&(n.zmax=i[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){this._abortElevationInfoChange();const e=new AbortController;this._elevationInfoChangeAbortController=e;const i=ie(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await te(i,this._viewSpatialReference,e.signal,Le),m(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("elevationInfo",i)?i.forEach((e=>{const i=e.graphic,t=e.labelLayers;for(const r of t){r.graphics3DSymbolLayer.updateGraphicElevationContext(i,r)}})):this._recreateSymbol(t)})),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?(this.layer.elevationInfo&&"relative-to-scene"===this.layer.elevationInfo.mode||0===this._numberOfGraphicsProvidingElevation)&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=p(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new ge({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),null!=this._filterVisibility&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=p(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:i,view:t}=this.owner,r=t.basemapTerrain.tilingScheme&&i&&i.length?i.toArray():null;!e&&r||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=this.owner.view.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){const i=this._graphicsBySymbol.get(e),t=[];i&&(i.forEach(((e,i)=>{const r=e.usedMemory;this._conditionalRemove(e,i),this._spatialIndex?.remove(e),t.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(i,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed")})),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);h(r),this._symbols.delete(e),this.add(t)}_recreateGraphicsForSymbol(e){const i=this._graphicsBySymbol.get(e);if(i){const e=[];i.forEach((i=>e.push(i.graphic))),this.recreateGraphics(e)}}_conditionalRemove(e,i){this._graphicsDrapedUids.delete(i),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain&&this.owner.view.basemapTerrain.tilingScheme?(this._updatePolicyForGraphics(e)===fe.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("updating")):Le.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===fe.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const i of e)if(null!=i.geometry&&"mesh"===i.geometry.type&&!i.geometry.loaded)return fe.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const i of e)this._addGraphic(i,this._getRenderingInfo(i,Le),fe.SYNC);this._cleanupSymbols(),this._labeler&&(this.owner.view.labeler.setDirty(),this._cleanupSymbols()),this.owner.view.deconflictor.setDirty()}_addDelayed(e){for(const i of e){const e=i.uid;let t=this._pendingUpdates.get(e);t?t.add?t.state!==Ve.NEW&&t.abortController?.abort():this._pendingAdds++:(t=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(e,t)),t.add=i}this.notifyChange("running"),this.notifyChange("updatingRemaining")}remove(e){this.effectiveUpdatePolicy===fe.ASYNC?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("updating")}_removeImmediate(e){for(const i of e)this._removeGraphic(i);this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_removeDelayed(e){for(const i of e){const e=i.uid,t=this._pendingUpdates.get(e);if(t)t.add&&(t.remove?t.add=null:this._pendingUpdates.delete(e),t.state===Ve.LOADING&&t.abortController?.abort(),this._pendingAdds--);else{const t=this._pendingUpdatesPool.pushNew();t.remove=i,this._pendingUpdates.set(e,t),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("updatingRemaining")}_finishPendingUpdates(){this._pendingUpdatesPool.clear(),this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&Le.warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyPendingUpdates(e){if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,0===this._pendingUpdates.size&&this._spatialIndex?.updating)return this._spatialIndex.update(),void e.madeProgress();if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(const[i,t]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(t.remove&&!t.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,this._pendingUpdates.delete(i),0===this._pendingRemoves))break}}for(const[i,t]of this._pendingUpdates){if(e.done)break;t.add&&t.state===Ve.NEW&&this._processPendingUpdateNew(t);let r=this.effectiveUpdatePolicy;if(!t.remove||t.add&&t.state!==Ve.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,r=fe.SYNC),t.add)switch(t.state){case Ve.READY:this._addGraphic(t.add,t.renderingInfo,r),t.add=null,this._pendingAdds--,e.madeProgress();break;case Ve.REJECTED:t.add=null,this._pendingAdds--;case Ve.LOADING:}null==t.remove&&null==t.add&&this._pendingUpdates.delete(i)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("running"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=Ve.READY);const i=e.add.geometry;null==i||"mesh"!==i.type||i.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,i)}async _processPendingUpdateNewMesh(e,i){e.state=Ve.LOADING,e.abortController=new AbortController;const t=e.abortController.signal;try{await i.load({signal:t})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,i){e.abortController=null,b(i)?e.state=Ve.NEW:e.state=Ve.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add,Le),void(e.state=Ve.READY);e.state=Ve.LOADING,e.abortController=new AbortController;let i=null;try{i=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(t){return e.abortController=null,void(b(t)?e.state=Ve.NEW:e.state=Ve.REJECTED)}null==i||null==i.symbol?(Le&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Le.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=i,e.state=Ve.READY}_addGraphic(e,i,t){if(this._graphicsWithoutSymbol.set(e.uid,e),null==i||null==i.symbol||!H(e))return;null!=this.stage.renderView.objectAndLayerIdRenderHelper&&this.setUidToIdOnAdd&&this.stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.layer.uid,!!this.layer.popupEnabled);const r=i.symbol,s=this.getOrCreateGraphics3DSymbol(r,i.renderer);if(null==s)return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new se(e,i,this.layer);let o=!1;const l=e=>{e===s.symbol.id&&(o=!0)};this._whenSymbolRemoved.push(l);const h=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(l);if(this._graphicsWaitingForSymbol.get(e.uid)!==a||o||s.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==s.symbol.id)--s.referenced,this._cleanupSymbols();else{const i=this._createGraphics3DGraphic(s,n);this._spatialIndex&&null!=i&&this._spatialIndex.add(i),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()},d=i=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(b(i)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,t===fe.ASYNC?s.load((()=>this._frameTask.schedule(h)),(e=>this._frameTask.schedule((()=>d(e))))):s.load(h,d)}_removeGraphic(e){const i=e.uid,t=this.graphics3DGraphics.get(i);if(t){t.graphics3DSymbol.onRemoveGraphic(t);const e=t.usedMemory,r=t.isElevationSource;this._conditionalRemove(t,i),this._spatialIndex?.remove(t);const s=t.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(i),this._graphicsWithoutSymbol.delete(i),this._removeGraphics3DGraphic(i,e,r),t.destroy(),this._featureStore.events.emit("changed")}else this._graphicsWithoutSymbol.delete(i),this._graphicsWaitingForSymbol.delete(i),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating"))}_hasLabelingContext(e){if(e instanceof Re||e instanceof De){const i=this.symbolCreationContext.layer;return!!i.labelingInfo&&i.labelingInfo.some((i=>i.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof Re&&!this._hasLabelingContext(e))||(Le.error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,i){const t=e.geometry;if(null==t)return i&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!L(t.spatialReference,this._viewSpatialReference))return i&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return i&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?q(e,this.layer):e;let s;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||null!=this.currentRenderer))s=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{s={symbol:r.symbol||J(r.geometry)}}return null==s||null==s.symbol?(i&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):s}_getRenderingInfoAsync(e,i){if(null==e.geometry)return Le&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,Le.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return Le&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Le.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const t=this.rendererHasGeometryOperations?q(e,this.layer):e;return this.owner.getRenderingInfoAsync(t,this.currentRenderer,this._arcadeOnDemand,i)}_createGraphics3DSymbol(e,i){if(!this._hasValidSymbolCreationContext(e))return null;const t=this._getConvertedSymbol(e);if(!t)return null;let r;if(null!=i&&"backgroundFillSymbol"in i&&i.backgroundFillSymbol){const e=Q(i.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&"web-style"!==e.symbol.type&&"cim"!==e.symbol.type&&(r=e.symbol.symbolLayers)}const s=ne(t,this.symbolCreationContext,r);return s.load((()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")}),(()=>{})),s}getOrCreateGraphics3DSymbol(e,i){let t=this._symbols.get(e.id);return void 0===t&&(t=e instanceof Ee?new oe(e,(e=>this._frameTask.schedule(e)),(e=>this._createGraphics3DSymbol(e,i))):this._createGraphics3DSymbol(e,i),this._symbols.set(e.id,t)),null!=t&&++t.referenced,t}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new le(this)),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,i,t=!1){this._usedMemory-=i,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,t&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,i){const t=i.graphic;if(this._graphicsWithoutSymbol.delete(t.uid),!this._symbols.has(e.symbol.id))return this.add([t]),null;if(this.graphics3DGraphics.has(t.uid))return null;const r=e.createGraphics3DGraphic(i);if(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(t.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(t.uid),r.centroid=null,null!=t.geometry&&"point"!==t.geometry.type&&(r.centroid=he(t.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(X.FILTER,e,ee.GRAPHIC),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),this._deconflictor&&this.owner.view.deconflictor.setInitialIconVisibilityFlag(this,r),r.initialize(this.stageLayer,this.owner),null!=this._graphicStateTracking&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[t.uid];return a&&(delete this._whenGraphics3DGraphicRequests[t.uid],a.resolve(r)),r}_abortRendererChange(){this._rendererChangeAbortController&&(this._rendererChangeAbortController.abort(),this._rendererChangeAbortController=null)}async rendererChange(e){if(this._abortRendererChange(),e!==this.currentRenderer)if(this._validateRenderer(e),null==e&&this._currentRendererChange(null,!1),Y(e))if(null!=e&&e.arcadeRequired){const i=new AbortController;this._rendererChangeAbortController=i;const{arcadeUtils:t}=await this._ensureArcade();m(i);const r=t.hasGeometryOperations(e);r&&(await t.enableGeometryOperations(),m(i)),this.effectiveUpdatePolicy===fe.ASYNC?await this._frameTask.schedule((()=>this._currentRendererChange(e,r)),i.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===fe.ASYNC){const i=new AbortController;this._rendererChangeAbortController=i,await this._frameTask.schedule((()=>this._currentRendererChange(e,!1)),i.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await Z(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,i){this.currentRenderer=e,this.rendererHasGeometryOperations=i,this.symbolCreationContext.arcade=this._arcadeOnDemand;const t=this.symbolCreationContext.renderer;if(e===t)return;if(this._symbolConversionCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=P(t,e);this._updateUnchangedSymbolMappings(r,e,t),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,t)?this._volatileGraphicsUpdated():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const i in e.diff)switch(i){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[i];break;default:return!0}return!1}_applySymbolSetDiff(e,i,t){e=e||[],i=i||[];const r=[];for(const s of i){const i=this._graphicsBySymbol.get(s.id);i&&i.forEach(((a,n)=>{const o=a.graphic,l=this.layer instanceof M?this.layer:null,h=this._arcadeOnDemand;if(s===t.defaultSymbol&&t.getSymbol(q(o,l),{arcade:h})===t.defaultSymbol)return;const d=a.usedMemory;e.length||t.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),i.delete(n),this._removeGraphics3DGraphic(n,d),this._updateLayerVisibility()})),this._whenSymbolRemoved.forAll((e=>e(s.id)))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach((e=>r.push(e))),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_applyUniqueValueRendererDiff(e,i,t){const r=e.diff.defaultSymbol,s=e.diff.uniqueValueInfos;if(r||s){const a=s?s.added.map((e=>e.symbol)).filter(c):[],n=s?s.removed.map((e=>e.symbol)).filter(c):[];if(s)for(let e=0;e<s.changed.length;e++)a.push(s.changed[e].newValue.symbol),n.push(s.changed[e].oldValue.symbol);return r?(t.defaultSymbol&&n.push(t.defaultSymbol),i.defaultSymbol&&a.push(i.defaultSymbol)):t.defaultSymbol&&a.length&&n.push(i.defaultSymbol),this._applySymbolSetDiff(a,n,i),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,i,t){if("unique-value"!==i?.type||"unique-value"!==t?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s&&s.defaultSymbol,n=s&&s.uniqueValueInfos;let o;if(n)o=n.unchanged.map((e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)})));else{o=[];for(const e of t.uniqueValueInfos??[]){const t=r(e.symbol),s=i.uniqueValueInfos?.find((i=>i.value===e.value));s&&t!==r(s.symbol)&&o.push({oldId:t,newId:r(s.symbol)})}}return!a&&t.defaultSymbol&&o.push({oldId:r(t.defaultSymbol),newId:r(i.defaultSymbol)}),o}_updateSymbolMapping(e,i){const t=null!=i&&i?"string"==typeof i?i:i.id:null;if(null==e||e===t)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(t,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(t,s),null!=s)){const e="string"==typeof i?null:i;null!=e?s.symbol=e:s.symbol.id=t}}_updateUnchangedSymbolMappings(e,i,t){const r=this._calculateUnchangedSymbolMapping(e,i,t);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,t,r){if(this._diffHasSymbolChange(e))return!1;if(t instanceof i&&r instanceof i&&this._applyUniqueValueRendererDiff(e,t,r)&&0===Object.keys(e.diff).length)return!0;for(const[i]of this._graphicsBySymbol){const r=this._symbols.get(i);if(null!=r)switch(r.applyRendererDiff(e,t)){case de.RecreateSymbol:this._recreateSymbol(i);break;case de.RecreateGraphics:this._recreateGraphicsForSymbol(i);case de.FastUpdate:}}return!0}opacityChange(){this.forEachGraphics3DSymbol(((e,i)=>e.globalPropertyChanged("opacity",i))),this._updateStageLayerVisibility()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol(((e,i)=>e.globalPropertyChanged("slicePlaneEnabled",i))),this._deconflictor&&this._deconflictor.slicePlaneEnabledChange(),this._labeler&&this._labeler.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",i)||this._recreateSymbol(t)}))}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("skipHighSymbolLods",i)||this._recreateSymbol(t)}))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("pixelRatio",i)||this._recreateSymbol(t)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=w((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,i){const t=this.symbolCreationContext.clippingExtent,r=z();return ue(e,r,i)?this.symbolCreationContext.clippingExtent=T(V(),r):this.symbolCreationContext.clippingExtent=null,!k(this.symbolCreationContext.clippingExtent,t)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let i=!1;this.graphics3DGraphics.forEach((t=>{e(t)&&(i=!0)})),i&&(this.owner.view.labeler?.setDirty(),this.owner.view.deconflictor?.setDirty())}forEachGraphics3DSymbol(e){for(const[i,t]of this._symbols){if(null==t)return;e(t,this._graphicsBySymbol.get(i)||We,i)}}updateAllGraphicsVisibility(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const i=this._updateUserVisibility(e),t=null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(e);return i||t}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(X.USER_SETTING,!1,ee.GRAPHIC)))}_validateRenderer(e){const i=$(e,{geometryType:this.layer?.geometryType});if(i){const e=`Renderer for layer '${this.layer.title?`${this.layer.title}, `:""}, id:${this.layer.id}' is not supported in a SceneView`;Le.warn(e,i.message)}}_volatileGraphicsUpdated(){this._labeler?.reset(),this.stageLayer.shaderTransformationChanged(),this.notifyChange("updating")}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach(((i,t)=>{if(null==i||i.referenced>0)return;const r=this._graphicsBySymbol.get(t);r&&0!==r.size||(this._graphicsBySymbol.delete(t),this._symbols.delete(t),h(i),e=!0)})),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){return{snapshotInternals:()=>({graphics:[...this.graphics3DGraphics.keys()].sort(),symbols:[...this._symbols.keys()].sort(),graphicsBySymbol:[...this._graphicsBySymbol.keys()].sort().map((e=>({symbolId:e,graphics:[...this._graphicsBySymbol.get(e).keys()].sort()}))),graphicsWithoutSymbol:[...this._graphicsWithoutSymbol.keys()].sort(),graphicsDrapedUids:[...this._graphicsDrapedUids].sort(),pendingUpdates:this._pendingUpdates}),symbols:this._symbols,filterVisibility:this._filterVisibility,numPending:this._pendingUpdates.size,forceUpdatePolicy:e=>{this._forcedUpdatePolicy=e}}}get performanceInfo(){return{visible:this.graphics3DGraphics.size,missing:this._graphicsWithoutSymbol.size,pending:this._pendingUpdates.size}}};var Ve;je.tmpVec=U(),e([G({readOnly:!0})],je.prototype,"computedExtent",void 0),e([G()],je.prototype,"currentRenderer",void 0),e([G()],je.prototype,"rendererHasGeometryOperations",void 0),e([G()],je.prototype,"_frameTask",void 0),e([G({readOnly:!0})],je.prototype,"_viewSpatialReference",null),e([G()],je.prototype,"_rendererChangeAbortController",void 0),e([G()],je.prototype,"_elevationInfoChangeAbortController",void 0),e([G()],je.prototype,"_initializeAbortController",void 0),e([G()],je.prototype,"_elevationAlignment",void 0),e([G()],je.prototype,"_scaleVisibility",void 0),e([G()],je.prototype,"_filterVisibility",void 0),e([G()],je.prototype,"_initializePromise",void 0),e([G()],je.prototype,"_spatialIndex",void 0),e([G({readOnly:!0})],je.prototype,"extentPadding",void 0),e([G()],je.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([G()],je.prototype,"_featureStore",void 0),e([G()],je.prototype,"_deconflictor",void 0),e([G()],je.prototype,"_labeler",void 0),e([G()],je.prototype,"_objectStates",void 0),e([G()],je.prototype,"_loadingSymbols",void 0),e([G()],je.prototype,"preferredUpdatePolicy",void 0),e([G()],je.prototype,"_forcedUpdatePolicy",void 0),e([G({readOnly:!0})],je.prototype,"effectiveUpdatePolicy",null),e([G({constructOnly:!0})],je.prototype,"elevationFeatureExpressionEnabled",void 0),e([G({constructOnly:!0})],je.prototype,"owner",void 0),e([G({constructOnly:!0})],je.prototype,"layer",void 0),e([G({constructOnly:!0})],je.prototype,"graphicSymbolSupported",void 0),e([G({constructOnly:!0})],je.prototype,"getRenderingInfoWithoutRenderer",void 0),e([G({constructOnly:!0})],je.prototype,"componentFactories",void 0),e([G({constructOnly:!0})],je.prototype,"setUidToIdOnAdd",void 0),e([G()],je.prototype,"featureStore",null),e([G()],je.prototype,"initializePromise",null),e([G()],je.prototype,"scaleVisibility",null),e([G()],je.prototype,"elevationAlignment",null),e([G()],je.prototype,"objectStates",null),e([G()],je.prototype,"filterVisibility",null),e([G({readOnly:!0})],je.prototype,"updating",null),e([G({readOnly:!0})],je.prototype,"running",null),e([G({readOnly:!0})],je.prototype,"suspendedOrOutsideOfView",null),e([G({readOnly:!0,dependsOn:[]})],je.prototype,"updatingRemaining",null),e([G({readOnly:!0,dependsOn:["owner.view.qualitySettings.graphics3D.maxTotalNumberOfPrimitives","owner.view.qualitySettings.graphics3D.maxTotalNumberOfFeatures","averageSymbolComplexity"]})],je.prototype,"displayFeatureLimit",null),e([G({readOnly:!0,dependsOn:[]})],je.prototype,"averageSymbolComplexity",null),e([G({constructOnly:!0})],je.prototype,"hasZ",void 0),e([G({constructOnly:!0})],je.prototype,"hasM",void 0),e([G()],je.prototype,"_objectIdField",null),je=Ie=e([x(Oe)],je),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(Ve||(Ve={}));class Fe{constructor(){this.add=null,this.renderingInfo=null,this.state=Ve.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=Ve.NEW,this.abortController=null,this.remove=null}}const Te=10,ke=U(),ze=U(),We=new Map;export{je as Graphics3DCore};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import t from"../../../../core/Error.js";import{clone as e}from"../../../../core/lang.js";import{get as s}from"../../../../core/maybe.js";import{getMetersPerVerticalUnitForSR as r}from"../../../../core/unitUtils.js";import{e as n}from"../../../../chunks/earcut.js";import{b as o}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a,u as l}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{c as h,n as m,s as p,b as d,f as g,m as u}from"../../../../chunks/vec3.js";import{d as f,c as y}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection.js";import{create as _,empty as x,expandWithBuffer as j,intersectsClippingArea as P}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as S}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as v,getZeroIndexArray as E}from"../../../../geometry/support/Indices.js";import{t as w,a as L}from"../../../../chunks/vec32.js";import{makeVertexCandidate as C,makeEdgeCandidate as I}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as O}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as M}from"../../../ViewingMode.js";import{needsElevationUpdates3D as A,SampleElevationInfo as z}from"./elevationAlignmentUtils.js";import{ElevationContext as D}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as R}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as G}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as B,computeCentroid as U}from"./graphicUtils.js";import{ApplyRendererDiffResult as k}from"./interfaces.js";import{geometryAsPolygon as T}from"./polygonUtils.js";import{createMaterial as V}from"../support/edgeUtils.js";import N from"../../support/debugFlags.js";import{SamplePosition as H}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as F}from"../../support/renderInfoUtils/polygon.js";import{Attribute as W}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as q}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as Z}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as J}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as K}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{Object3D as Q}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as X}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Y}from"../../webgl-engine/materials/DefaultMaterial.js";const $=["polygon","extent"];class tt extends G{constructor(t,e,s,r){super(t,e,s,r),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const e=B(this._getSymbolSize());if(e)throw new t("graphics3dextrudesymbollayer:invalid-size",e)}const e=s(this.symbolLayer,"material","color"),r=this._getCombinedOpacityAndColor(e),n=f(r),o=r[3],i=o<1||this.needsDrivenTransparentPass,a={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:n,ambient:n,opacity:o,transparent:i,cullFace:i?q.None:q.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};this._material=new Y(a),this._bottomMaterial=new Y({...a,cullFace:q.Back}),this._context.stage.add(this._material),this._context.stage.add(this._bottomMaterial)}destroy(){super.destroy(),this._material&&(this._context.stage.remove(this._material),this._context.stage.remove(this._bottomMaterial))}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,$,this.symbolLayer.type))return null;const s=this._getVertexOpacityAndColor(t.renderingInfo,255),r=this.setGraphicElevationContext(e,new D);return this._createAs3DShape(e,t.renderingInfo,s,r,e.uid)}layerOpacityChanged(t,e){const r=s(this.symbolLayer,"material","color"),n=this._getCombinedOpacity(r),o=n<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:n,transparent:o}),this._bottomMaterial.setParameters({opacity:n,transparent:o});const i=this._getLayerOpacity();t.forEach((t=>{const s=e(t);null!=s&&s.layerOpacityChanged(i,this._context.isAsync)}))}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,A)}slicePlaneEnabledChanged(t,e){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._bottomMaterial.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t.forEach((t=>{const s=e(t);null!=s&&s.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._bottomMaterial.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?O(t.size,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?k.RecreateSymbol:k.RecreateGraphics}async queryForSnapping(t,s,n,o){const i=this._getExtrusionSize(n)*this._context.renderCoordsHelper.unitInMeters/r(s),{objectId:a,target:l}=t,c=e(l);switch(c.z=(c.z??0)+i,t.type){case"edge":{const{start:s,end:r}=t,n=e(s),o=e(r);return n.z=(n.z??0)+i,o.z=(o.z??0)+i,[I(a,c,1/0,n,o)]}case"vertex":return[C(a,c,1/0),I(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,s,r,l){const h=T(t.geometry);if(null==h)return null;if(0===h.rings.length||!h.rings.some((t=>t.length>0)))return this._logGeometryValidationWarnings(h.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=F(h,this._context.elevationProvider,this._context.renderCoordsHelper,r);this._logGeometryCreationWarnings(m,h.rings,"rings","ExtrudeSymbol3DLayer");const p=U(h);if(null==p)return null;const d=new Array,g=new Array,u=_(),f=c(),E=y(),C=this._context.renderCoordsHelper.viewingMode===M.Global;C||this._context.renderCoordsHelper.worldUpAtPosition(null,E),b(h.spatialReference,[p.x,p.y,0],f,this._context.renderCoordsHelper.spatialReference);const I=c();a(I,f);const O=i();o(O,I);const{polygons:z,mapPositions:D,position:G}=m;for(const o of z){const t=o.count;if(this._context.clippingExtent&&(x(u),j(u,o.mapPositions),!P(u,this._context.clippingExtent)))continue;const r=n(o.mapPositions,o.holeIndices,3);if(0===r.length)continue;const i=r.length,a=6*t,c=v(a+i),h=v(i),m=S(3*a),p=S(3*a),f=S(3*a),y=S(a);st(G,D,r,o,m,f,p,y,c,h,this._getExtrusionSize(e),E,C),w(m,m,I),L(p,p,O);const b=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerUid:this._context.layer.uid}),_=new jt(m,f,p,y);d.push(et(this._material,c,c.length-h.length,_,s,b),et(this._bottomMaterial,h,0,_,s,b)),g.push(_.heights)}if(0===d.length)return null;const B=new Q({geometries:d,layerUid:this._context.layer.uid,graphicUid:l,isElevationSource:!0});B.transformation=f;const k=V(this.symbolLayer,{opacity:this._getLayerOpacity()}),N=null!=k?{baseMaterial:this._material,edgeMaterials:[k],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,H=new R(this,B,d,null,null,((t,e,s,r,n)=>gt(t,e,s,r,n,g)),r,N);return H.alignedSampledElevation=m.sampledElevation,H.needsElevationUpdates=A(r.mode),H}}function et(t,e,s,r,n,o){const i=E(e.length),a=[[X.POSITION,new W(r.positions,3,!0)],[X.NORMAL,new W(r.normals,3,!0)],[X.COLOR,new W(n,4,!0)]],l=[[X.POSITION,e],[X.NORMAL,e],[X.COLOR,i]];return new J(t,a,l,r.elevation,Z.Mesh,o,s)}function st(t,e,s,r,n,o,i,a,l,c,h,m,p){const d=s.length/3;let g=0,u=2*r.count;rt(t,e,r.index,r.count,s,0,d,n,o,i,a,l,c,u,h,m,p);let f=2*r.count;u=0,it(n,o,a,i,g,r.pathLengths[0],r.count,f,l,u,h),f+=4*r.pathLengths[0],u+=2*r.pathLengths[0],g+=r.pathLengths[0];for(let y=1;y<r.pathLengths.length;++y)it(n,o,a,i,g,r.pathLengths[y],r.count,f,l,u,h),f+=4*r.pathLengths[y],u+=2*r.pathLengths[y],g+=r.pathLengths[y]}function rt(t,e,s,r,n,o,i,a,l,c,p,d,g,u,f,y,b){h(ft,y);const _=f>0?1:-1;let x=3*s,j=0,P=3*j,S=r,v=3*S;for(let h=0;h<r;++h)b&&(ft[0]=t[x],ft[1]=t[x+1],ft[2]=t[x+2],m(ft,ft)),a[P]=t[x],a[P+1]=t[x+1],a[P+2]=t[x+2],l[P]=e[x],l[P+1]=e[x+1],l[P+2]=e[x+2],c[P]=-_*ft[0],c[P+1]=-_*ft[1],c[P+2]=-_*ft[2],p[j]=0,a[v]=t[x]+f*ft[0],a[v+1]=t[x+1]+f*ft[1],a[v+2]=t[x+2]+f*ft[2],l[v]=e[x],l[v+1]=e[x+1],l[v+2]=e[x+2],c[v]=_*ft[0],c[v+1]=_*ft[1],c[v+2]=_*ft[2],p[S]=f,P+=3,v+=3,x+=3,j+=1,S+=1;x=3*o,P=0,v=3*u;const E=f<0?_t:bt,w=f<0?bt:_t;for(let h=0;h<i;++h)g[P]=n[x+E[0]],g[P+1]=n[x+E[1]],g[P+2]=n[x+E[2]],d[v]=n[x+w[0]]+r,d[v+1]=n[x+w[1]]+r,d[v+2]=n[x+w[2]]+r,P+=3,v+=3,x+=3}function nt(t,e,s,r,n,o,i){r[o]=r[i],i*=3,t[o*=3]=t[i],t[o+1]=t[i+1],t[o+2]=t[i+2],e[o]=e[i],e[o+1]=e[i+1],e[o+2]=e[i+2],s[o]=n[0],s[o+1]=n[1],s[o+2]=n[2]}const ot=y();function it(t,e,s,r,n,o,i,a,l,c,h){let m=n,p=n+1,d=n+i,g=n+i+1,u=a,f=a+1,y=a+2*o,b=a+2*o+1;h<0&&(m=n+i+1,g=n),c*=3;for(let _=0;_<o;++_)_===o-1&&(h>0?(p=n,g=n+i):(p=n,m=n+i)),pt(t,m,p,d,ot),nt(t,e,r,s,ot,u,m),nt(t,e,r,s,ot,f,p),nt(t,e,r,s,ot,y,d),nt(t,e,r,s,ot,b,g),l[c++]=u,l[c++]=y,l[c++]=b,l[c++]=u,l[c++]=b,l[c++]=f,m++,p++,d++,g++,u+=2,f+=2,y+=2,b+=2}const at=y(),lt=y(),ct=y(),ht=y(),mt=y();function pt(t,e,s,r,n){e*=3,s*=3,r*=3,p(at,t[e++],t[e++],t[e++]),p(lt,t[s++],t[s++],t[s++]),p(ct,t[r++],t[r++],t[r++]),d(ht,lt,at),d(mt,ct,at),g(n,mt,ht),m(n,n)}const dt=y();function gt(t,e,s,r,n,o){const i=t.stageObject,a=i.geometries,h=a.length,m="absolute-height"!==e.mode;let d=0;const g=i.transformation,f=l(c(),g);for(let l=0;l<h;l+=2){const t=a[l];if(!K(t))continue;const e=t.getMutableAttribute(X.POSITION).data,c=o[l/2],h=new H(t.mapPositions),y=e.length/3;let b=0,_=!1,x=0;for(let o=0;o<y;o++){dt[0]=e[b],dt[1]=e[b+1],dt[2]=e[b+2],r(h,yt),m&&(x+=yt.sampledElevation),N.TESTS_DISABLE_OPTIMIZATIONS?(p(ut,h.array[h.offset],h.array[h.offset+1],yt.z+c[b/3]),null!=s&&n.toRenderCoords(ut,s,ut),u(ut,ut,f)):(p(ut,e[b],e[b+1],e[b+2]),u(ut,ut,g),n.setAltitude(ut,yt.z+c[b/3]),u(ut,ut,f)),e[b]=ut[0],e[b+1]=ut[1],e[b+2]=ut[2];const t=xt/n.unitInMeters;(Math.abs(dt[0]-e[b])>=t||Math.abs(dt[1]-e[b+1])>=t||Math.abs(dt[2]-e[b+2])>=t)&&(_=!0),h.offset+=3,b+=3}_&&(t.invalidateBoundingInfo(),i.geometryVertexAttrsUpdated(a[l]),a[l+1].invalidateBoundingInfo(),i.geometryVertexAttrsUpdated(a[l+1])),d+=x/y}return d/h}const ut=y(),ft=y(),yt=new z,bt=[0,2,1],_t=[0,1,2],xt=.01;class jt{constructor(t,e,s,r){this.positions=t,this.elevation=e,this.normals=s,this.heights=r}}export{tt as Graphics3DExtrudeSymbolLayer};
5
+ import"../../../../core/has.js";import e from"../../../../core/Error.js";import{clone as t}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as s}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{b as n}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a as o,u as a}from"../../../../chunks/mat4.js";import{c as l}from"../../../../chunks/mat4f64.js";import{c,n as h,s as m,b as p,f as g,m as d}from"../../../../chunks/vec3.js";import{d as u,c as f}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as y}from"../../../../geometry/projection.js";import{create as b,empty as _,expandWithBuffer as x,intersectsClippingArea as j}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as S}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as P,getZeroIndexArray as E}from"../../../../geometry/support/Indices.js";import{t as w}from"../../../../chunks/vec32.js";import{makeVertexCandidate as v,makeEdgeCandidate as C}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as L}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as O}from"../../../ViewingMode.js";import{needsElevationUpdates3D as I,SampleElevationInfo as M}from"./elevationAlignmentUtils.js";import{ElevationContext as A}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as z}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as R,computeCentroid as G}from"./graphicUtils.js";import{ApplyRendererDiffResult as B}from"./interfaces.js";import{geometryAsPolygon as U}from"./polygonUtils.js";import{createMaterial as T}from"../support/edgeUtils.js";import k from"../../support/debugFlags.js";import{SamplePosition as N}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as V}from"../../support/renderInfoUtils/polygon.js";import{NormalType as H}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as F}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as W}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as q}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as Z}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as J}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as K}from"../../webgl-engine/lib/Normals.js";import{Object3D as Q}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as X}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Y}from"../../webgl-engine/materials/DefaultMaterial.js";const $=["polygon","extent"];class ee extends D{constructor(e,t,s,r){super(e,t,s,r),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=R(this._getSymbolSize());if(t)throw new e("graphics3dextrudesymbollayer:invalid-size",t)}const t=this.symbolLayer?.material?.color,s=this._getCombinedOpacityAndColor(t),r=u(s),n=s[3],i=n<1||this.needsDrivenTransparentPass,o={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:r,ambient:r,opacity:n,transparent:i,cullFace:i?W.None:W.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0,normalType:H.CompressedAttribute};this._material=new Y(o),this._bottomMaterial=new Y({...o,cullFace:W.Back}),this._context.stage.add(this._material),this._context.stage.add(this._bottomMaterial)}destroy(){super.destroy(),this._material&&(this._context.stage.remove(this._material),this._context.stage.remove(this._bottomMaterial))}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,$,this.symbolLayer.type))return null;const s=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t,new A);return this._createAs3DShape(t,e.renderingInfo,s,r,t.uid)}layerOpacityChanged(e,t){const s=this.symbolLayer?.material?.color,r=this._getCombinedOpacity(s),n=r<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:r,transparent:n}),this._bottomMaterial.setParameters({opacity:r,transparent:n});const i=this._getLayerOpacity();e.forEach((e=>{const s=t(e);null!=s&&s.layerOpacityChanged(i,this._context.isAsync)}))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(e,t){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._bottomMaterial.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e.forEach((e=>{const s=t(e);null!=s&&s.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._bottomMaterial.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?L(e.size,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?B.RecreateSymbol:B.RecreateGraphics}async queryForSnapping(e,r,n,i){const o=this._getExtrusionSize(n)*this._context.renderCoordsHelper.unitInMeters/s(r),{objectId:a,target:l}=e,c=t(l);switch(c.z=(c.z??0)+o,e.type){case"edge":{const{start:s,end:r}=e,n=t(s),i=t(r);return n.z=(n.z??0)+o,i.z=(i.z??0)+o,[C(a,c,1/0,n,i)]}case"vertex":return[v(a,c,1/0),C(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,s,a,c){const h=U(e.geometry);if(null==h)return null;if(0===h.rings.length||!h.rings.some((e=>e.length>0)))return this._logGeometryValidationWarnings(h.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=V(h,this._context.elevationProvider,this._context.renderCoordsHelper,a);this._logGeometryCreationWarnings(m,h.rings,"rings","ExtrudeSymbol3DLayer");const p=G(h);if(null==p)return null;const g=new Array,d=new Array,u=b(),E=l(),v=f(),C=this._context.renderCoordsHelper.viewingMode===O.Global;C||this._context.renderCoordsHelper.worldUpAtPosition(null,v),y(h.spatialReference,[p.x,p.y,0],E,this._context.renderCoordsHelper.spatialReference);const L=l();o(L,E);const M=i();n(M,L);const{polygons:A,mapPositions:D,position:R}=m;for(const n of A){const e=n.count;if(this._context.clippingExtent&&(_(u),x(u,n.mapPositions),!j(u,this._context.clippingExtent)))continue;const i=r(n.mapPositions,n.holeIndices,3);if(0===i.length)continue;const o=i.length,a=6*e,l=P(a+o),h=P(o),m=S(3*a),p=S(3*a),f=S(3*a),y=S(a);se(R,D,i,n,m,f,p,y,l,h,this._getExtrusionSize(t),v,C),w(m,m,L);const b=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerUid:this._context.layer.uid}),E=new je(m,f,K(p),y);g.push(te(this._material,l,l.length-h.length,E,s,b),te(this._bottomMaterial,h,0,E,s,b)),d.push(E.heights)}if(0===g.length)return null;const B=new Q({geometries:g,layerUid:this._context.layer.uid,graphicUid:c,isElevationSource:!0});B.transformation=E;const k=T(this.symbolLayer,{opacity:this._getLayerOpacity()}),N=null!=k?{baseMaterial:this._material,edgeMaterials:[k],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,H=new z(this,B,g,null,null,((e,t,s,r,n)=>de(e,t,s,r,n,d)),a,N);return H.alignedSampledElevation=m.sampledElevation,H.needsElevationUpdates=I(a.mode),H}}function te(e,t,s,r,n,i){const o=E(t.length),a=[[X.POSITION,new F(r.positions,3,!0)],[X.NORMALCOMPRESSED,new F(r.normals,2,!0)],[X.COLOR,new F(n,4,!0)]],l=[[X.POSITION,t],[X.NORMALCOMPRESSED,t],[X.COLOR,o]];return new Z(e,a,l,r.elevation,q.Mesh,i,s)}function se(e,t,s,r,n,i,o,a,l,c,h,m,p){const g=s.length/3;let d=0,u=2*r.count;re(e,t,r.index,r.count,s,0,g,n,i,o,a,l,c,u,h,m,p);let f=2*r.count;u=0,oe(n,i,a,o,d,r.pathLengths[0],r.count,f,l,u,h),f+=4*r.pathLengths[0],u+=2*r.pathLengths[0],d+=r.pathLengths[0];for(let y=1;y<r.pathLengths.length;++y)oe(n,i,a,o,d,r.pathLengths[y],r.count,f,l,u,h),f+=4*r.pathLengths[y],u+=2*r.pathLengths[y],d+=r.pathLengths[y]}function re(e,t,s,r,n,i,o,a,l,m,p,g,d,u,f,y,b){c(fe,y);const _=f>0?1:-1;let x=3*s,j=0,S=3*j,P=r,E=3*P;for(let c=0;c<r;++c)b&&(fe[0]=e[x],fe[1]=e[x+1],fe[2]=e[x+2],h(fe,fe)),a[S]=e[x],a[S+1]=e[x+1],a[S+2]=e[x+2],l[S]=t[x],l[S+1]=t[x+1],l[S+2]=t[x+2],m[S]=-_*fe[0],m[S+1]=-_*fe[1],m[S+2]=-_*fe[2],p[j]=0,a[E]=e[x]+f*fe[0],a[E+1]=e[x+1]+f*fe[1],a[E+2]=e[x+2]+f*fe[2],l[E]=t[x],l[E+1]=t[x+1],l[E+2]=t[x+2],m[E]=_*fe[0],m[E+1]=_*fe[1],m[E+2]=_*fe[2],p[P]=f,S+=3,E+=3,x+=3,j+=1,P+=1;x=3*i,S=0,E=3*u;const w=f<0?_e:be,v=f<0?be:_e;for(let c=0;c<o;++c)d[S]=n[x+w[0]],d[S+1]=n[x+w[1]],d[S+2]=n[x+w[2]],g[E]=n[x+v[0]]+r,g[E+1]=n[x+v[1]]+r,g[E+2]=n[x+v[2]]+r,S+=3,E+=3,x+=3}function ne(e,t,s,r,n,i,o){r[i]=r[o],o*=3,e[i*=3]=e[o],e[i+1]=e[o+1],e[i+2]=e[o+2],t[i]=t[o],t[i+1]=t[o+1],t[i+2]=t[o+2],s[i]=n[0],s[i+1]=n[1],s[i+2]=n[2]}const ie=f();function oe(e,t,s,r,n,i,o,a,l,c,h){let m=n,p=n+1,g=n+o,d=n+o+1,u=a,f=a+1,y=a+2*i,b=a+2*i+1;h<0&&(m=n+o+1,d=n),c*=3;for(let _=0;_<i;++_)_===i-1&&(h>0?(p=n,d=n+o):(p=n,m=n+o)),pe(e,m,p,g,ie),ne(e,t,r,s,ie,u,m),ne(e,t,r,s,ie,f,p),ne(e,t,r,s,ie,y,g),ne(e,t,r,s,ie,b,d),l[c++]=u,l[c++]=y,l[c++]=b,l[c++]=u,l[c++]=b,l[c++]=f,m++,p++,g++,d++,u+=2,f+=2,y+=2,b+=2}const ae=f(),le=f(),ce=f(),he=f(),me=f();function pe(e,t,s,r,n){t*=3,s*=3,r*=3,m(ae,e[t++],e[t++],e[t++]),m(le,e[s++],e[s++],e[s++]),m(ce,e[r++],e[r++],e[r++]),p(he,le,ae),p(me,ce,ae),g(n,me,he),h(n,n)}const ge=f();function de(e,t,s,r,n,i){const o=e.stageObject,c=o.geometries,h=c.length,p="absolute-height"!==t.mode;let g=0;const u=o.transformation,f=a(l(),u);for(let a=0;a<h;a+=2){const e=c[a];if(!J(e))continue;const t=e.getMutableAttribute(X.POSITION).data,l=i[a/2],h=new N(e.mapPositions),y=t.length/3;let b=0,_=!1,x=0;for(let i=0;i<y;i++){ge[0]=t[b],ge[1]=t[b+1],ge[2]=t[b+2],r(h,ye),p&&(x+=ye.sampledElevation),k.TESTS_DISABLE_OPTIMIZATIONS?(m(ue,h.array[h.offset],h.array[h.offset+1],ye.z+l[b/3]),null!=s&&n.toRenderCoords(ue,s,ue),d(ue,ue,f)):(m(ue,t[b],t[b+1],t[b+2]),d(ue,ue,u),n.setAltitude(ue,ye.z+l[b/3]),d(ue,ue,f)),t[b]=ue[0],t[b+1]=ue[1],t[b+2]=ue[2];const e=xe/n.unitInMeters;(Math.abs(ge[0]-t[b])>=e||Math.abs(ge[1]-t[b+1])>=e||Math.abs(ge[2]-t[b+2])>=e)&&(_=!0),h.offset+=3,b+=3}_&&(e.invalidateBoundingInfo(),o.geometryVertexAttrsUpdated(c[a]),c[a+1].invalidateBoundingInfo(),o.geometryVertexAttrsUpdated(c[a+1])),g+=x/y}return g/h}const ue=f(),fe=f(),ye=new M,be=[0,2,1],_e=[0,1,2],xe=.01;class je{constructor(e,t,s,r){this.positions=e,this.elevation=t,this.normals=s,this.heights=r}}export{ee as Graphics3DExtrudeSymbolLayer};