@arcgis/core 4.26.0-next.20230111 → 4.26.0-next.20230113

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 (296) hide show
  1. package/arcade/ArcadeDate.js +5 -0
  2. package/arcade/Dictionary.js +1 -1
  3. package/arcade/Feature.js +1 -1
  4. package/arcade/arcadeAsyncRuntime.js +1 -1
  5. package/arcade/arcadeCompiler.js +1 -1
  6. package/arcade/arcadeRuntime.js +1 -1
  7. package/arcade/arcadeTimeUtils.js +5 -0
  8. package/arcade/executionError.js +1 -1
  9. package/arcade/featureset/actions/Adapted.js +1 -1
  10. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  11. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  12. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  13. package/arcade/featureset/support/FeatureSet.js +1 -1
  14. package/arcade/featureset/support/shared.js +1 -1
  15. package/arcade/featureset/support/sqlUtils.js +1 -1
  16. package/arcade/functions/date.js +1 -1
  17. package/arcade/functions/featuresetbase.js +1 -1
  18. package/arcade/functions/featuresetstring.js +1 -1
  19. package/arcade/functions/geomasync.js +1 -1
  20. package/arcade/functions/geometry.js +1 -1
  21. package/arcade/functions/geomsync.js +1 -1
  22. package/arcade/functions/maths.js +1 -1
  23. package/arcade/functions/string.js +1 -1
  24. package/arcade/languageUtils.js +1 -1
  25. package/arcade/treeAnalysis.js +1 -1
  26. package/arcade.js +1 -1
  27. package/assets/esri/core/workers/RemoteClient.js +1 -1
  28. package/assets/esri/core/workers/chunks/{c9477250a5d5ebdef00c.js → 01cd5a9cd4cb1f13691c.js} +1 -1
  29. package/assets/esri/core/workers/chunks/028f9a133104e78e60d2.js +1 -0
  30. package/assets/esri/core/workers/chunks/033e6ae5da6afebd993c.js +1 -0
  31. package/assets/esri/core/workers/chunks/05ab092987251d4a1242.js +1 -0
  32. package/assets/esri/core/workers/chunks/1186a56dacaf269d5271.js +1 -0
  33. package/assets/esri/core/workers/chunks/264e1c00936bcafb9a36.js +1 -0
  34. package/assets/esri/core/workers/chunks/2680392cef77d98ad097.js +1 -0
  35. package/assets/esri/core/workers/chunks/27ba1889fe9f1812389a.js +1165 -0
  36. package/assets/esri/core/workers/chunks/2dfb17fa5b6a5d239942.js +1 -0
  37. package/assets/esri/core/workers/chunks/2e3962506c353b562a88.js +1 -0
  38. package/assets/esri/core/workers/chunks/30ae4c22f6b8aab9f841.js +1 -0
  39. package/assets/esri/core/workers/chunks/329e512f210cb3e904f1.js +1 -0
  40. package/assets/esri/core/workers/chunks/3878efe67f43962b46f8.js +1 -0
  41. package/assets/esri/core/workers/chunks/3b6748f414437cc6cfde.js +1 -0
  42. package/assets/esri/core/workers/chunks/41d25407888326c91566.js +1 -0
  43. package/assets/esri/core/workers/chunks/493e2b00133682748e62.js +1 -0
  44. package/assets/esri/core/workers/chunks/4b2edcb8ef7fae4f7d28.js +1 -0
  45. package/assets/esri/core/workers/chunks/{c11d857dca43de2229fc.js → 4c085cee22ff64ce6d1f.js} +1 -1
  46. package/assets/esri/core/workers/chunks/4d8c53e961275b6a4ee1.js +1 -0
  47. package/assets/esri/core/workers/chunks/5049771eeffe208a9cb8.js +1 -0
  48. package/assets/esri/core/workers/chunks/{58d219ffd9dcc45bb0d1.js → 5191f80f2413ee92c875.js} +1 -1
  49. package/assets/esri/core/workers/chunks/5dfed65b615b33588488.js +1 -0
  50. package/assets/esri/core/workers/chunks/5e9869849d999aac5756.js +1 -0
  51. package/assets/esri/core/workers/chunks/6216cd8134703fd9d9b4.js +1 -0
  52. package/assets/esri/core/workers/chunks/62c8e43741f2d6141f00.js +1 -0
  53. package/assets/esri/core/workers/chunks/64f137358100a1c818f0.js +1 -0
  54. package/assets/esri/core/workers/chunks/6f5f81855985db7c1936.js +1 -0
  55. package/assets/esri/core/workers/chunks/6fba07833345b2d8d373.js +1 -0
  56. package/assets/esri/core/workers/chunks/{80c7726743baf9f54079.js → 7747ee359d357f6e5858.js} +1 -1
  57. package/assets/esri/core/workers/chunks/78fd609f334a29ef39dc.js +1 -0
  58. package/assets/esri/core/workers/chunks/798cd875d64182741364.js +1 -0
  59. package/assets/esri/core/workers/chunks/{9d247a46e0cfdad26273.js → 8176286f8dd055c8ae05.js} +1 -1
  60. package/assets/esri/core/workers/chunks/8530ac02c840c89cc1df.js +1 -0
  61. package/assets/esri/core/workers/chunks/8a69a9b5a04e7321740d.js +1 -0
  62. package/assets/esri/core/workers/chunks/8bd26c71e78698c16778.js +1 -0
  63. package/assets/esri/core/workers/chunks/8c12b82612f050492fef.js +1 -0
  64. package/assets/esri/core/workers/chunks/90653ef5e718bafd6960.js +1 -0
  65. package/assets/esri/core/workers/chunks/{418922fd99e733df023f.js → 9070aa0a94a9204ded1c.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{2ac0d2164a1b49e6f057.js → 94633a9bb5fa4f4ba4de.js} +1 -1
  67. package/assets/esri/core/workers/chunks/969bb94d5bdc9da114e2.js +1 -0
  68. package/assets/esri/core/workers/chunks/9785dba81a6af339e35a.js +1 -0
  69. package/assets/esri/core/workers/chunks/99e16173584702577b80.js +1 -0
  70. package/assets/esri/core/workers/chunks/9aee6f171d4fbac941d9.js +1 -0
  71. package/assets/esri/core/workers/chunks/a194f90ffe13b3d448b0.js +1 -0
  72. package/assets/esri/core/workers/chunks/a53d194e3eede703a6df.js +1 -0
  73. package/assets/esri/core/workers/chunks/a605bf8bc29099ae1b1a.js +1 -0
  74. package/assets/esri/core/workers/chunks/ba7239089a04098e3619.js +1 -0
  75. package/assets/esri/core/workers/chunks/bd2fe663a2b090b134e9.js +1 -0
  76. package/assets/esri/core/workers/chunks/c16003307aad2f84ac51.js +1 -0
  77. package/assets/esri/core/workers/chunks/c6eb6a97ecc6ed9ce713.js +1 -0
  78. package/assets/esri/core/workers/chunks/c81d898f4aef6ecacdb5.js +1 -0
  79. package/assets/esri/core/workers/chunks/cb83480d7074f6185e21.js +1 -0
  80. package/assets/esri/core/workers/chunks/cd0fa942d57a278b0a44.js +1 -0
  81. package/assets/esri/core/workers/chunks/d55332e4d7b8184fd718.js +1 -0
  82. package/assets/esri/core/workers/chunks/d6842acbfa7a39f3ca30.js +1 -0
  83. package/assets/esri/core/workers/chunks/d798bd544433e932f772.js +1 -0
  84. package/assets/esri/core/workers/chunks/e18851e915cb69f53032.js +1 -0
  85. package/assets/esri/core/workers/chunks/{54899827baea77776fc7.js → ea1054116ec842a4f813.js} +1 -1
  86. package/assets/esri/core/workers/chunks/ed1312c2627c0d7e654d.js +1 -0
  87. package/assets/esri/core/workers/chunks/f2750a7b44e8bc8b1e4c.js +1 -0
  88. package/assets/esri/themes/base/widgets/_Editor.scss +1 -11
  89. package/assets/esri/themes/base/widgets/_ItemList.scss +0 -13
  90. package/assets/esri/themes/dark/main.css +1 -1
  91. package/assets/esri/themes/light/main.css +1 -1
  92. package/assets/esri/themes/light/view.css +1 -1
  93. package/assets/esri/widgets/Sketch/t9n/Sketch_ar.json +1 -1
  94. package/assets/esri/widgets/Sketch/t9n/Sketch_bg.json +1 -1
  95. package/assets/esri/widgets/Sketch/t9n/Sketch_bs.json +1 -1
  96. package/assets/esri/widgets/Sketch/t9n/Sketch_ca.json +1 -1
  97. package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
  98. package/assets/esri/widgets/Sketch/t9n/Sketch_da.json +1 -1
  99. package/assets/esri/widgets/Sketch/t9n/Sketch_de.json +1 -1
  100. package/assets/esri/widgets/Sketch/t9n/Sketch_el.json +1 -1
  101. package/assets/esri/widgets/Sketch/t9n/Sketch_es.json +1 -1
  102. package/assets/esri/widgets/Sketch/t9n/Sketch_et.json +1 -1
  103. package/assets/esri/widgets/Sketch/t9n/Sketch_fi.json +1 -1
  104. package/assets/esri/widgets/Sketch/t9n/Sketch_fr.json +1 -1
  105. package/assets/esri/widgets/Sketch/t9n/Sketch_he.json +1 -1
  106. package/assets/esri/widgets/Sketch/t9n/Sketch_hr.json +1 -1
  107. package/assets/esri/widgets/Sketch/t9n/Sketch_hu.json +1 -1
  108. package/assets/esri/widgets/Sketch/t9n/Sketch_id.json +1 -1
  109. package/assets/esri/widgets/Sketch/t9n/Sketch_it.json +1 -1
  110. package/assets/esri/widgets/Sketch/t9n/Sketch_ja.json +1 -1
  111. package/assets/esri/widgets/Sketch/t9n/Sketch_ko.json +1 -1
  112. package/assets/esri/widgets/Sketch/t9n/Sketch_lt.json +1 -1
  113. package/assets/esri/widgets/Sketch/t9n/Sketch_lv.json +1 -1
  114. package/assets/esri/widgets/Sketch/t9n/Sketch_nb.json +1 -1
  115. package/assets/esri/widgets/Sketch/t9n/Sketch_nl.json +1 -1
  116. package/assets/esri/widgets/Sketch/t9n/Sketch_pl.json +1 -1
  117. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-BR.json +1 -1
  118. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-PT.json +1 -1
  119. package/assets/esri/widgets/Sketch/t9n/Sketch_ro.json +1 -1
  120. package/assets/esri/widgets/Sketch/t9n/Sketch_ru.json +1 -1
  121. package/assets/esri/widgets/Sketch/t9n/Sketch_sk.json +1 -1
  122. package/assets/esri/widgets/Sketch/t9n/Sketch_sl.json +1 -1
  123. package/assets/esri/widgets/Sketch/t9n/Sketch_sr.json +1 -1
  124. package/assets/esri/widgets/Sketch/t9n/Sketch_sv.json +1 -1
  125. package/assets/esri/widgets/Sketch/t9n/Sketch_th.json +1 -1
  126. package/assets/esri/widgets/Sketch/t9n/Sketch_tr.json +1 -1
  127. package/assets/esri/widgets/Sketch/t9n/Sketch_uk.json +1 -1
  128. package/assets/esri/widgets/Sketch/t9n/Sketch_vi.json +1 -1
  129. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-CN.json +1 -1
  130. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-HK.json +1 -1
  131. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-TW.json +1 -1
  132. package/chunks/ComponentShader.glsl.js +1 -1
  133. package/chunks/Path.glsl.js +1 -1
  134. package/chunks/Terrain.glsl.js +1 -1
  135. package/chunks/languageUtils.js +1 -1
  136. package/geometry/support/MeshTexture.js +1 -1
  137. package/geometry/support/aaBoundingBox.js +1 -1
  138. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  139. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  140. package/interfaces.d.ts +1400 -1314
  141. package/layers/ImageryTileLayer.js +1 -1
  142. package/layers/VoxelWasmPerSceneView.js +1 -1
  143. package/layers/graphics/data/FeatureStore.js +1 -1
  144. package/layers/graphics/data/QueryEngine.js +1 -1
  145. package/layers/graphics/data/timeSupport.js +1 -1
  146. package/layers/graphics/featureConversionUtils.js +1 -1
  147. package/layers/graphics/sources/WFSSourceWorker.js +1 -1
  148. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  149. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  150. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  151. package/layers/mixins/ArcGISImageService.js +1 -1
  152. package/layers/mixins/ImageryTileMixin.js +1 -1
  153. package/layers/support/layerOriginUtils.js +1 -1
  154. package/layers/support/rasterFormats/JpgPlus.js +1 -1
  155. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  156. package/layers/support/rasterFunctions/ConvolutionFunction.js +1 -1
  157. package/layers/support/rasterFunctions/ConvolutionFunctionArguments.js +1 -1
  158. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  159. package/layers/support/rasterFunctions/ExtractBandFunctionArguments.js +1 -1
  160. package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
  161. package/layers/support/rasterFunctions/NDVIFunctionArguments.js +1 -1
  162. package/layers/support/rasterFunctions/SlopeFunctionArguments.js +1 -1
  163. package/layers/support/rasterFunctions/StatisticsHistogramFunction.js +5 -0
  164. package/layers/support/rasterFunctions/{StatisticsHistogramsFunctionArguments.js → StatisticsHistogramFunctionArguments.js} +1 -1
  165. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  166. package/package.json +1 -1
  167. package/rest/imageService.js +1 -1
  168. package/rest/support/BaseImageMeasureResult.d.ts +4 -0
  169. package/rest/support/ImageAreaParameters.d.ts +4 -0
  170. package/rest/support/{ImageMeasureAreaAndPerimeterParameters.js → ImageAreaParameters.js} +1 -1
  171. package/rest/support/ImageAreaResult.d.ts +4 -0
  172. package/rest/support/{ImageMeasureAreaAndPerimeterResult.js → ImageAreaResult.js} +1 -1
  173. package/rest/support/ImageDistanceParameters.d.ts +4 -0
  174. package/rest/support/{ImageMeasureDistanceAndAngleParameters.js → ImageDistanceParameters.js} +1 -1
  175. package/rest/support/ImageDistanceResult.d.ts +4 -0
  176. package/rest/support/ImageDistanceResult.js +5 -0
  177. package/rest/support/ImageHeightParameters.d.ts +4 -0
  178. package/rest/support/{ImageMeasureHeightParameters.js → ImageHeightParameters.js} +1 -1
  179. package/rest/support/ImageHeightResult.d.ts +4 -0
  180. package/rest/support/{ImageMeasureHeightResult.js → ImageHeightResult.js} +1 -1
  181. package/rest/support/ImagePointParameters.d.ts +4 -0
  182. package/rest/support/{ImageMeasurePointParameters.js → ImagePointParameters.js} +1 -1
  183. package/rest/support/ImagePointResult.d.ts +4 -0
  184. package/rest/support/{ImageMeasurePointResult.js → ImagePointResult.js} +1 -1
  185. package/support/arcadeUtils.js +1 -1
  186. package/support/revision.js +1 -1
  187. package/time/timeReferenceUtils.js +1 -1
  188. package/views/2d/engine/webgl/Overlay.js +1 -1
  189. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  190. package/views/2d/layers/features/FeatureStore2D.js +1 -1
  191. package/views/2d/layers/features/Pipeline.js +1 -1
  192. package/views/2d/layers/features/support/BinStore.js +1 -1
  193. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  194. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  195. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  196. package/views/3d/glTF/internal/Resource.js +1 -1
  197. package/views/3d/glTF/internal/resourceUtils.js +5 -0
  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/Graphics3DFeatureStore.js +1 -1
  201. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  202. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  203. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  204. package/views/3d/layers/graphics/Labeler.js +1 -1
  205. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  206. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  207. package/views/3d/layers/i3s/I3SQueryFeatureStore.js +1 -1
  208. package/views/3d/state/ViewState.js +1 -1
  209. package/views/3d/state/ViewStateManager.js +1 -1
  210. package/views/3d/terrain/Overlay.js +1 -1
  211. package/views/3d/terrain/OverlayManager.js +1 -1
  212. package/views/3d/terrain/TerrainRenderer.js +1 -1
  213. package/views/3d/terrain/TerrainSurface.js +1 -1
  214. package/views/3d/terrain/TileRenderer.js +1 -1
  215. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  216. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +1 -1
  217. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  218. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +1 -1
  219. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +1 -1
  220. package/views/3d/webgl-engine/lib/AnimationTimeStep.js +5 -0
  221. package/views/3d/webgl-engine/lib/AnimationTimer.js +1 -1
  222. package/views/3d/webgl-engine/lib/GLMaterial.js +1 -1
  223. package/views/3d/webgl-engine/lib/Material.js +1 -1
  224. package/views/3d/webgl-engine/lib/RenderFeature.js +5 -0
  225. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  226. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  227. package/views/3d/webgl-engine/lib/basicInterfaces.js +1 -1
  228. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  229. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  230. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  231. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  232. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  233. package/views/draw/support/layerUtils.js +1 -1
  234. package/views/webgl/RenderingContext.js +1 -1
  235. package/views/webgl/Texture.js +1 -1
  236. package/widgets/Editor/EditorViewModel.js +1 -1
  237. package/widgets/Editor.js +1 -1
  238. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  239. package/widgets/FeatureTemplates/ItemList.js +1 -1
  240. package/widgets/FeatureTemplates/TemplateItem.js +1 -1
  241. package/widgets/FeatureTemplates/TemplateItemGroup.js +1 -1
  242. package/widgets/FeatureTemplates.js +1 -1
  243. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  244. package/widgets/support/decorators/accessibleHandler.js +1 -1
  245. package/assets/esri/core/workers/chunks/038dc3f9ef06ef3c960c.js +0 -1
  246. package/assets/esri/core/workers/chunks/078a0b134210167b629d.js +0 -1
  247. package/assets/esri/core/workers/chunks/080a4be417be4943f6a0.js +0 -1
  248. package/assets/esri/core/workers/chunks/0877bab7c03a1de2e713.js +0 -1
  249. package/assets/esri/core/workers/chunks/0c9200ab19fd2f56f87f.js +0 -1
  250. package/assets/esri/core/workers/chunks/1cbffa96ea6683e5f3ec.js +0 -1
  251. package/assets/esri/core/workers/chunks/1f742c3b11c76814fa4d.js +0 -1
  252. package/assets/esri/core/workers/chunks/2eb2d49c549e53934b8b.js +0 -1
  253. package/assets/esri/core/workers/chunks/332494b96a47b378f4e0.js +0 -1
  254. package/assets/esri/core/workers/chunks/3326536d183a858a2a4d.js +0 -1
  255. package/assets/esri/core/workers/chunks/3f4fc8379fc11bc293cc.js +0 -1
  256. package/assets/esri/core/workers/chunks/43fecd621cd043f64828.js +0 -1165
  257. package/assets/esri/core/workers/chunks/47b0b660f5412097fe26.js +0 -1
  258. package/assets/esri/core/workers/chunks/4c0d7a074083aa9614bb.js +0 -1
  259. package/assets/esri/core/workers/chunks/594d7e871b648d5c9662.js +0 -1
  260. package/assets/esri/core/workers/chunks/680b90ac98e8d1ac0e33.js +0 -1
  261. package/assets/esri/core/workers/chunks/6b589f47cb4731df1639.js +0 -1
  262. package/assets/esri/core/workers/chunks/72557c4b1582aa18ad4d.js +0 -1
  263. package/assets/esri/core/workers/chunks/72b490ad371e0c2264f6.js +0 -1
  264. package/assets/esri/core/workers/chunks/75ce17cf13aab0440572.js +0 -1
  265. package/assets/esri/core/workers/chunks/75f4e884a1a0aedc0afd.js +0 -1
  266. package/assets/esri/core/workers/chunks/7b9ab3fb378172831c14.js +0 -1
  267. package/assets/esri/core/workers/chunks/7bef95b168303bdc4bf1.js +0 -1
  268. package/assets/esri/core/workers/chunks/803492088780e18de801.js +0 -1
  269. package/assets/esri/core/workers/chunks/89003e387684af5ebeac.js +0 -1
  270. package/assets/esri/core/workers/chunks/8f93026764a0cce0901b.js +0 -1
  271. package/assets/esri/core/workers/chunks/98350b6b95da62ef5f12.js +0 -1
  272. package/assets/esri/core/workers/chunks/a9cae0d386aa9c00f744.js +0 -1
  273. package/assets/esri/core/workers/chunks/ad65c24558098f21bbf3.js +0 -1
  274. package/assets/esri/core/workers/chunks/aef90ee3f0979a7acb38.js +0 -1
  275. package/assets/esri/core/workers/chunks/b68c7754b0220b194ecf.js +0 -1
  276. package/assets/esri/core/workers/chunks/c012317f045a74fdd79d.js +0 -1
  277. package/assets/esri/core/workers/chunks/cb42675e5b1c41634c63.js +0 -1
  278. package/assets/esri/core/workers/chunks/cb901033dd15b3b72025.js +0 -1
  279. package/assets/esri/core/workers/chunks/d398b6b8a6b0a95247de.js +0 -1
  280. package/assets/esri/core/workers/chunks/d447ebc944a9867f5a99.js +0 -1
  281. package/assets/esri/core/workers/chunks/daaabed988b6ea866350.js +0 -1
  282. package/assets/esri/core/workers/chunks/e048641971aef9dd4da9.js +0 -1
  283. package/assets/esri/core/workers/chunks/e3fd383aee378cbb0dae.js +0 -1
  284. package/assets/esri/core/workers/chunks/e967ffca641947212992.js +0 -1
  285. package/assets/esri/core/workers/chunks/e9c81eee503c1b112bad.js +0 -1
  286. package/assets/esri/core/workers/chunks/ea6cf948fe2de0242308.js +0 -1
  287. package/assets/esri/core/workers/chunks/ed5e71b45dfefcbb2da4.js +0 -1
  288. package/assets/esri/core/workers/chunks/ee50d5d0afe9bdccc84d.js +0 -1
  289. package/assets/esri/core/workers/chunks/ee91401507833875facc.js +0 -1
  290. package/assets/esri/core/workers/chunks/f7d40dd78ef116f5793b.js +0 -1
  291. package/assets/esri/core/workers/chunks/f8ab6e354834b9c0e857.js +0 -1
  292. package/assets/esri/core/workers/chunks/faea681c279486b7a5e7.js +0 -1
  293. package/layers/support/rasterFunctions/StatisticsHistogramsFunction.js +0 -5
  294. package/rest/support/ImageMeasureDistanceAndAngleResult.js +0 -5
  295. package/views/3d/support/animationUtils.js +0 -5
  296. package/views/3d/webgl-engine/lib/RenderStateFeature.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../geometry.js";import e from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import{isNone as t,isSome as s,applySome as r}from"../../../../../core/maybe.js";import{diff as o,hasDiff as a}from"../../../../../core/accessorSupport/diffUtils.js";import{GeohashTree as i}from"../../../../../geohash/GeohashTree.js";import{setGeohashBuf as h,setGeohashXY as n}from"../../../../../geohash/geohashUtils.js";import{fromRect as l}from"../../../../../geometry/support/aaBoundingBox.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{getInfo as g}from"../../../../../geometry/support/spatialReferenceUtils.js";import{getBoundsOptimizedGeometry as c,quantizeX as d,quantizeY as f,convertFromPolygon as p}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeatureWithGeometry as m,OptimizedFeature as _}from"../../../../../layers/graphics/OptimizedFeature.js";import y from"../../../../../layers/graphics/OptimizedGeometry.js";import{checkProjectionSupport as I,project as b}from"../../../../../layers/graphics/data/projectionSupport.js";import{TILE_SIZE as v}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TEXEL_MASK as R}from"../../../engine/webgl/DisplayId.js";import{featureAdapter as M}from"../FeatureStore2D.js";import{Store2D as x}from"../Store2D.js";import{FeatureSetReaderJSON as C}from"./FeatureSetReaderJSON.js";import j from"../../../../../geometry/SpatialReference.js";import L from"../../../../../geometry/Polygon.js";import B from"../../../../../geometry/Extent.js";const F=12,w=64,S=1;class V extends m{constructor(e,t,s,r,o){super(new y([],[t,s]),r,null,e),this.geohashBoundsInfo=o}get count(){return this.attributes.cluster_count}static create(e,t,s,r,o,a,i,h){const n=new V(t,s,r,a,i);return n.displayId=e.createDisplayId(!0),n.referenceId=h,n.tileLevel=o,n}update(e,t,s,r,o,a){return this.geometry.coords[0]=e,this.geometry.coords[1]=t,this.tileLevel=s,this.attributes=r,this.geohashBoundsInfo=o,this.referenceId=null,this.referenceId=a,this}toJSON(){return{attributes:{...this.attributes,aggregateId:this.objectId,referenceId:1===this.attributes.cluster_count?this.referenceId:null},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function T(e){return 57.29577951308232*e}class D extends x{constructor(t,s,r,o){super(t,r),this.type="cluster",this.events=new e,this.objectIdField="aggregateId",this.featureAdapter=M,this._geohashLevel=0,this._tileLevel=0,this._aggregateValueRanges={},this._aggregateValueRangesChanged=!1,this._geohashBuf=[],this._clusters=new Map,this._tiles=new Map,this._serviceInfo=o,this.geometryInfo=t.geometryInfo,this._spatialReference=s,this._projectionSupportCheck=I(s,j.WGS84),this._bitsets.geohash=r.getBitset(r.createBitset()),this._bitsets.inserted=r.getBitset(r.createBitset())}destroy(){this._tree.destroy()}get featureSpatialReference(){return this._spatialReference}get fields(){return this._fields}async updateSchema(e,s){const r=this._schema;try{await super.updateSchema(e,s),await this._projectionSupportCheck}catch(n){}this._fields=this._schema.params.fields;const h=o(r,s);s&&(!t(h)||e.source||e.storage.filters)?((a(h,"params.fields")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new i(this._statisticFields,this._serviceInfo),this._rebuildTree(),has("esri-2d-update-debug")&&console.debug("Aggregate mesh needs update due to tree changing")),has("esri-2d-update-debug")&&console.debug("Applying Update - ClusterStore:",h),e.targets[s.name]=!0,e.mesh=!1,this._aggregateValueRanges={}):r&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet((s=>{if(!e.has(s)){const e=t.lookupByDisplayIdUnsafe(s);this._remove(e)}}))}sweepAggregates(e,t,s){this._clusters.forEach(((r,o)=>{r&&r.tileLevel!==s&&(e.releaseDisplayId(r.displayId),t.unsetAttributeData(r.displayId),this._clusters.delete(o))}))}onTileData(e,s,r,o,a=!0){if(!this._schema||t(s.addOrUpdate))return s;this.events.emit("changed");const i=this._getTransforms(e,this._spatialReference);{const e=s.addOrUpdate.getCursor();for(;e.next();)this._update(e,o)}if(s.status.mesh||!a)return s;const h=new Array,n=this._schema.params.clusterRadius;this._getClustersForTile(h,e,n,r,i),s.addOrUpdate=C.fromOptimizedFeatures(h,this._serviceInfo),s.addOrUpdate.attachStorage(r),s.clear=!0,s.end=!0;{const t=s.addOrUpdate.getCursor();for(;t.next();){const s=t.getDisplayId();this._bitsets.computed.unset(s),this.setComputedAttributes(r,t,s,e.scale)}}return this._aggregateValueRangesChanged&&s.end&&(this.events.emit("valueRangesChanged",{valueRanges:this._aggregateValueRanges}),this._aggregateValueRangesChanged=!1),s}onTileUpdate({added:e,removed:t}){if(e.length){const t=e[0].level;this._tileLevel=t,this._setGeohashLevel(t)}if(!this._schema)return;const s=this._schema.params.clusterRadius;t.forEach((e=>{this._tiles.delete(e.key.id),this._markTileClustersForDeletion(e,s)}))}getAggregate(e){for(const t of this._clusters.values())if((t?.displayId&R)==(e&R))return t.toJSON();return null}getAggregates(){const e=[];for(const t of this._clusters.values())t?.tileLevel===this._tileLevel&&e.push(t.toJSON());return e}getDisplayId(e){const t=this._clusters.get(e);return t?t.displayId:null}getFeatureDisplayIdsForAggregate(e){const t=this._clusters.get(e);return t?this._tree.getRegionDisplayIds(t.geohashBoundsInfo):[]}getDisplayIdForReferenceId(e){for(const t of this._clusters.values())if(t?.referenceId===e)return t.displayId;return null}getAggregateValueRanges(){return this._aggregateValueRanges}forEach(e){this._clusters.forEach((t=>{if(!t)return;const s=t.toJSON(),r=C.fromFeatures([s],{objectIdField:this.objectIdField,globalIdField:null,geometryType:this.geometryInfo.geometryType,fields:this.fields}).getCursor();r.next(),e(r)}))}forEachInBounds(e,t){}forEachBounds(e,s,r){const{hasM:o,hasZ:a}=this.geometryInfo;for(const i of e){const e=c([0,0,0,0],i.readGeometry(),a,o);t(e)||s(l(r,e))}}size(){let e=0;return this.forEach((t=>e++)),e}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),o=this._geohashBuf[2*t],a=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,o,a,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,o=t.isVisible(s);if(o===r.has(s))return;if(!o)return void this._remove(e);const a=e.getXHydrated(),i=e.getYHydrated();if(!this._setGeohash(s,a,i))return;const h=this._geohashBuf[2*s],n=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,a,i,h,n,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const o=T(t/u.radius),a=o-360*Math.floor((o+180)/360),i=T(Math.PI/2-2*Math.atan(Math.exp(-s/u.radius)));h(r,e,i,a,F)}else{const o=b({x:t,y:s},this._spatialReference,j.WGS84);if(!o)return!1;h(r,e,o.y,o.x,F)}return this._bitsets.geohash.set(e),!0}_getClustersForTile(e,o,a,i,h,n=!0){const l=this._schema.params.clusterPixelBuffer,u=2*a,g=Math.ceil(2**o.key.level*v/u)+1,c=Math.ceil(l/u)+0,p=Math.ceil(v/u),{row:m,col:y}=o.key,I=y*v,b=m*v,R=Math.floor(I/u)-c,M=Math.floor(b/u)-c,x=R+p+2*c,C=M+p+2*c,j=o.tileInfoView.getLODInfoAt(o.key.level);for(let v=R;v<=x;v++)for(let a=M;a<=C;a++){let l=v;j.wrap&&(l=v<0?v+g:v%g);const u=j.wrap&&v<0,c=j.wrap&&v%g!==v,p=this._lookupCluster(i,j,o.key.level,l,a,o);if(s(p)){const o=r(h,(e=>u?e.left:c?e.right:e.tile));if(n&&t(o))continue;if(!p.count)continue;if(s(o)&&n){const t=p.geometry.clone();let r=p.attributes;t.coords[0]=d(o,t.coords[0]),t.coords[1]=f(o,t.coords[1]),1===p.count&&s(p.referenceId)&&(r={...p.attributes,referenceId:p.referenceId});const a=new _(t,r);a.displayId=p.displayId,e.push(a)}}}}_getGeohashLevel(e){return Math.min(Math.ceil(e/2+2),F)}_setGeohashLevel(e){const t=this._getGeohashLevel(e),s=(Math.floor(t/S)+1)*S-1;if(this._geohashLevel!==s)return this._geohashLevel=s,this._rebuildTree(),void this._bitsets.geohash.clear()}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=g(t);if(!r)return{tile:s,left:null,right:null};const[o,a]=r.valid;return{tile:s,left:{...s,translate:[a,e.bounds[3]]},right:{...s,translate:[o-a+e.bounds[0],e.bounds[3]]}}}_getClusterId(e,t,s){return(15&e)<<28|(16383&t)<<14|16383&s}_markForDeletion(e,t,s){const r=this._getClusterId(e,t,s);this._clusters.delete(r)}_getClusterBounds(e,t,s){const r=this._schema.params.clusterRadius,o=2*r;let a=s%2?t*o:t*o-r;const i=s*o;let h=a+o;const n=i-o,l=2**e.level*v;e.wrap&&a<0&&(a=0),e.wrap&&h>l&&(h=l);const u=a/v,g=i/v,c=h/v,d=n/v;return[e.getXForColumn(u),e.getYForRow(g),e.getXForColumn(c),e.getYForRow(d)]}_getGeohash(e,t,s){const r={geohashX:0,geohashY:0};return n(r,t,e,s),r}_getGeohashBounds(e,t){const s=this._getGeohashLevel(e.key.level);if(this._spatialReference.isWebMercator){const[e,r,o,a]=t,i={x:e,y:r},h={x:o,y:a};let l=0,g=0,c=0,d=0;{const e=T(i.x/u.radius);l=e-360*Math.floor((e+180)/360),g=T(Math.PI/2-2*Math.atan(Math.exp(-i.y/u.radius)))}{const e=T(h.x/u.radius);c=e-360*Math.floor((e+180)/360),d=T(Math.PI/2-2*Math.atan(Math.exp(-h.y/u.radius)))}const f={geohashX:0,geohashY:0},p={geohashX:0,geohashY:0};n(f,g,l,s),n(p,d,c,s);return{bounds:[e,r,o,a],geohashBounds:{xLL:f.geohashX,yLL:f.geohashY,xTR:p.geohashX,yTR:p.geohashY},level:s}}const r=L.fromExtent(B.fromBounds(t,this._spatialReference)),o=b(r,this._spatialReference,j.WGS84,{densificationStep:e.resolution*w});if(!o)return null;const a=p(new y,o,!1,!1),i=a.coords.filter(((e,t)=>!(t%2))),h=a.coords.filter(((e,t)=>t%2)),l=Math.min(...i),g=Math.min(...h),c=Math.max(...i),d=Math.max(...h),f=this._getGeohash(l,g,s),m=this._getGeohash(c,d,s);return{bounds:t,geohashBounds:{xLL:f.geohashX,yLL:f.geohashY,xTR:m.geohashX,yTR:m.geohashY},level:s}}_lookupCluster(e,r,o,a,i,h){const n=this._getClusterId(o,a,i),l=this._clusters.get(n),u=this._getClusterBounds(r,a,i),g=this._getGeohashBounds(h,u);if(t(g))return null;const c=this._tree.getRegionStatistics(g),{count:d,xTotal:f,yTotal:p,referenceId:m}=c,_=d?f/d:0,y=d?p/d:0;if(0===d)return this._clusters.set(n,null),null;const I={cluster_count:d,...c.attributes},b=s(l)?l.update(_,y,o,I,g,m):V.create(e,n,_,y,o,I,g,m);if(0===d){const[e,t,s,r]=u;b.geometry.coords[0]=(e+s)/2,b.geometry.coords[1]=(t+r)/2}return this._clusters.set(n,b),this._updateAggregateValueRangeForCluster(b,b.tileLevel),b}_updateAggregateValueRangeForCluster(e,t){const s=this._aggregateValueRanges[t]||{minValue:1/0,maxValue:0},r=s.minValue,o=s.maxValue;s.minValue=Math.min(r,e.count),s.maxValue=Math.max(o,e.count),this._aggregateValueRanges[t]=s,r===s.minValue&&o===s.maxValue||(this._aggregateValueRangesChanged=!0)}_markTileClustersForDeletion(e,t){const s=2*t,r=Math.ceil(v/s),{row:o,col:a}=e.key,i=a*v,h=o*v,n=Math.floor(i/s),l=Math.floor(h/s);for(let u=n;u<n+r;u++)for(let t=l;t<l+r;t++)this._markForDeletion(e.key.level,u,t)}}export{V as ClusterInfo,D as ClusterStore};
5
+ import"../../../../../geometry.js";import e from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import{isNone as t,isSome as s,applySome as r}from"../../../../../core/maybe.js";import{diff as o,hasDiff as a}from"../../../../../core/accessorSupport/diffUtils.js";import{GeohashTree as i}from"../../../../../geohash/GeohashTree.js";import{setGeohashBuf as h,setGeohashXY as n}from"../../../../../geohash/geohashUtils.js";import{create as l}from"../../../../../geometry/support/aaBoundingBox.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{getInfo as g}from"../../../../../geometry/support/spatialReferenceUtils.js";import{getBoundsOptimizedGeometry as c,quantizeX as d,quantizeY as f,convertFromPolygon as p}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeatureWithGeometry as m,OptimizedFeature as _}from"../../../../../layers/graphics/OptimizedFeature.js";import y from"../../../../../layers/graphics/OptimizedGeometry.js";import{checkProjectionSupport as I,project as b}from"../../../../../layers/graphics/data/projectionSupport.js";import{TILE_SIZE as v}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TEXEL_MASK as R}from"../../../engine/webgl/DisplayId.js";import{featureAdapter as M}from"../FeatureStore2D.js";import{Store2D as x}from"../Store2D.js";import{FeatureSetReaderJSON as C}from"./FeatureSetReaderJSON.js";import j from"../../../../../geometry/SpatialReference.js";import L from"../../../../../geometry/Polygon.js";import B from"../../../../../geometry/Extent.js";const F=12,w=64,S=1,V=l();class T extends m{constructor(e,t,s,r,o){super(new y([],[t,s]),r,null,e),this.geohashBoundsInfo=o}get count(){return this.attributes.cluster_count}static create(e,t,s,r,o,a,i,h){const n=new T(t,s,r,a,i);return n.displayId=e.createDisplayId(!0),n.referenceId=h,n.tileLevel=o,n}update(e,t,s,r,o,a){return this.geometry.coords[0]=e,this.geometry.coords[1]=t,this.tileLevel=s,this.attributes=r,this.geohashBoundsInfo=o,this.referenceId=null,this.referenceId=a,this}toJSON(){return{attributes:{...this.attributes,aggregateId:this.objectId,referenceId:1===this.attributes.cluster_count?this.referenceId:null},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function D(e){return 57.29577951308232*e}class G extends x{constructor(t,s,r,o){super(t,r),this.type="cluster",this.events=new e,this.objectIdField="aggregateId",this.featureAdapter=M,this._geohashLevel=0,this._tileLevel=0,this._aggregateValueRanges={},this._aggregateValueRangesChanged=!1,this._geohashBuf=[],this._clusters=new Map,this._tiles=new Map,this._serviceInfo=o,this.geometryInfo=t.geometryInfo,this._spatialReference=s,this._projectionSupportCheck=I(s,j.WGS84),this._bitsets.geohash=r.getBitset(r.createBitset()),this._bitsets.inserted=r.getBitset(r.createBitset())}destroy(){this._tree.destroy()}get featureSpatialReference(){return this._spatialReference}get fields(){return this._fields}async updateSchema(e,s){const r=this._schema;try{await super.updateSchema(e,s),await this._projectionSupportCheck}catch(n){}this._fields=this._schema.params.fields;const h=o(r,s);s&&(!t(h)||e.source||e.storage.filters)?((a(h,"params.fields")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new i(this._statisticFields,this._serviceInfo),this._rebuildTree(),has("esri-2d-update-debug")&&console.debug("Aggregate mesh needs update due to tree changing")),has("esri-2d-update-debug")&&console.debug("Applying Update - ClusterStore:",h),e.targets[s.name]=!0,e.mesh=!1,this._aggregateValueRanges={}):r&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet((s=>{if(!e.has(s)){const e=t.lookupByDisplayIdUnsafe(s);this._remove(e)}}))}sweepAggregates(e,t,s){this._clusters.forEach(((r,o)=>{r&&r.tileLevel!==s&&(e.releaseDisplayId(r.displayId),t.unsetAttributeData(r.displayId),this._clusters.delete(o))}))}onTileData(e,s,r,o,a=!0){if(!this._schema||t(s.addOrUpdate))return s;this.events.emit("changed");const i=this._getTransforms(e,this._spatialReference);{const e=s.addOrUpdate.getCursor();for(;e.next();)this._update(e,o)}if(s.status.mesh||!a)return s;const h=new Array,n=this._schema.params.clusterRadius;this._getClustersForTile(h,e,n,r,i),s.addOrUpdate=C.fromOptimizedFeatures(h,this._serviceInfo),s.addOrUpdate.attachStorage(r),s.clear=!0,s.end=!0;{const t=s.addOrUpdate.getCursor();for(;t.next();){const s=t.getDisplayId();this._bitsets.computed.unset(s),this.setComputedAttributes(r,t,s,e.scale)}}return this._aggregateValueRangesChanged&&s.end&&(this.events.emit("valueRangesChanged",{valueRanges:this._aggregateValueRanges}),this._aggregateValueRangesChanged=!1),s}onTileUpdate({added:e,removed:t}){if(e.length){const t=e[0].level;this._tileLevel=t,this._setGeohashLevel(t)}if(!this._schema)return;const s=this._schema.params.clusterRadius;t.forEach((e=>{this._tiles.delete(e.key.id),this._markTileClustersForDeletion(e,s)}))}getAggregate(e){for(const t of this._clusters.values())if((t?.displayId&R)==(e&R))return t.toJSON();return null}getAggregates(){const e=[];for(const t of this._clusters.values())t?.tileLevel===this._tileLevel&&e.push(t.toJSON());return e}getDisplayId(e){const t=this._clusters.get(e);return t?t.displayId:null}getFeatureDisplayIdsForAggregate(e){const t=this._clusters.get(e);return t?this._tree.getRegionDisplayIds(t.geohashBoundsInfo):[]}getDisplayIdForReferenceId(e){for(const t of this._clusters.values())if(t?.referenceId===e)return t.displayId;return null}getAggregateValueRanges(){return this._aggregateValueRanges}forEach(e){this._clusters.forEach((t=>{if(!t)return;const s=t.toJSON(),r=C.fromFeatures([s],{objectIdField:this.objectIdField,globalIdField:null,geometryType:this.geometryInfo.geometryType,fields:this.fields}).getCursor();r.next(),e(r)}))}forEachInBounds(e,t){}forEachBounds(e,s){const{hasM:r,hasZ:o}=this.geometryInfo;for(const a of e){const e=c(V,a.readGeometry(),o,r);t(e)||s(e)}}size(){let e=0;return this.forEach((t=>e++)),e}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),o=this._geohashBuf[2*t],a=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,o,a,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,o=t.isVisible(s);if(o===r.has(s))return;if(!o)return void this._remove(e);const a=e.getXHydrated(),i=e.getYHydrated();if(!this._setGeohash(s,a,i))return;const h=this._geohashBuf[2*s],n=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,a,i,h,n,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const o=D(t/u.radius),a=o-360*Math.floor((o+180)/360),i=D(Math.PI/2-2*Math.atan(Math.exp(-s/u.radius)));h(r,e,i,a,F)}else{const o=b({x:t,y:s},this._spatialReference,j.WGS84);if(!o)return!1;h(r,e,o.y,o.x,F)}return this._bitsets.geohash.set(e),!0}_getClustersForTile(e,o,a,i,h,n=!0){const l=this._schema.params.clusterPixelBuffer,u=2*a,g=Math.ceil(2**o.key.level*v/u)+1,c=Math.ceil(l/u)+0,p=Math.ceil(v/u),{row:m,col:y}=o.key,I=y*v,b=m*v,R=Math.floor(I/u)-c,M=Math.floor(b/u)-c,x=R+p+2*c,C=M+p+2*c,j=o.tileInfoView.getLODInfoAt(o.key.level);for(let v=R;v<=x;v++)for(let a=M;a<=C;a++){let l=v;j.wrap&&(l=v<0?v+g:v%g);const u=j.wrap&&v<0,c=j.wrap&&v%g!==v,p=this._lookupCluster(i,j,o.key.level,l,a,o);if(s(p)){const o=r(h,(e=>u?e.left:c?e.right:e.tile));if(n&&t(o))continue;if(!p.count)continue;if(s(o)&&n){const t=p.geometry.clone();let r=p.attributes;t.coords[0]=d(o,t.coords[0]),t.coords[1]=f(o,t.coords[1]),1===p.count&&s(p.referenceId)&&(r={...p.attributes,referenceId:p.referenceId});const a=new _(t,r);a.displayId=p.displayId,e.push(a)}}}}_getGeohashLevel(e){return Math.min(Math.ceil(e/2+2),F)}_setGeohashLevel(e){const t=this._getGeohashLevel(e),s=(Math.floor(t/S)+1)*S-1;if(this._geohashLevel!==s)return this._geohashLevel=s,this._rebuildTree(),void this._bitsets.geohash.clear()}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=g(t);if(!r)return{tile:s,left:null,right:null};const[o,a]=r.valid;return{tile:s,left:{...s,translate:[a,e.bounds[3]]},right:{...s,translate:[o-a+e.bounds[0],e.bounds[3]]}}}_getClusterId(e,t,s){return(15&e)<<28|(16383&t)<<14|16383&s}_markForDeletion(e,t,s){const r=this._getClusterId(e,t,s);this._clusters.delete(r)}_getClusterBounds(e,t,s){const r=this._schema.params.clusterRadius,o=2*r;let a=s%2?t*o:t*o-r;const i=s*o;let h=a+o;const n=i-o,l=2**e.level*v;e.wrap&&a<0&&(a=0),e.wrap&&h>l&&(h=l);const u=a/v,g=i/v,c=h/v,d=n/v;return[e.getXForColumn(u),e.getYForRow(g),e.getXForColumn(c),e.getYForRow(d)]}_getGeohash(e,t,s){const r={geohashX:0,geohashY:0};return n(r,t,e,s),r}_getGeohashBounds(e,t){const s=this._getGeohashLevel(e.key.level);if(this._spatialReference.isWebMercator){const[e,r,o,a]=t,i={x:e,y:r},h={x:o,y:a};let l=0,g=0,c=0,d=0;{const e=D(i.x/u.radius);l=e-360*Math.floor((e+180)/360),g=D(Math.PI/2-2*Math.atan(Math.exp(-i.y/u.radius)))}{const e=D(h.x/u.radius);c=e-360*Math.floor((e+180)/360),d=D(Math.PI/2-2*Math.atan(Math.exp(-h.y/u.radius)))}const f={geohashX:0,geohashY:0},p={geohashX:0,geohashY:0};n(f,g,l,s),n(p,d,c,s);return{bounds:[e,r,o,a],geohashBounds:{xLL:f.geohashX,yLL:f.geohashY,xTR:p.geohashX,yTR:p.geohashY},level:s}}const r=L.fromExtent(B.fromBounds(t,this._spatialReference)),o=b(r,this._spatialReference,j.WGS84,{densificationStep:e.resolution*w});if(!o)return null;const a=p(new y,o,!1,!1),i=a.coords.filter(((e,t)=>!(t%2))),h=a.coords.filter(((e,t)=>t%2)),l=Math.min(...i),g=Math.min(...h),c=Math.max(...i),d=Math.max(...h),f=this._getGeohash(l,g,s),m=this._getGeohash(c,d,s);return{bounds:t,geohashBounds:{xLL:f.geohashX,yLL:f.geohashY,xTR:m.geohashX,yTR:m.geohashY},level:s}}_lookupCluster(e,r,o,a,i,h){const n=this._getClusterId(o,a,i),l=this._clusters.get(n),u=this._getClusterBounds(r,a,i),g=this._getGeohashBounds(h,u);if(t(g))return null;const c=this._tree.getRegionStatistics(g),{count:d,xTotal:f,yTotal:p,referenceId:m}=c,_=d?f/d:0,y=d?p/d:0;if(0===d)return this._clusters.set(n,null),null;const I={cluster_count:d,...c.attributes},b=s(l)?l.update(_,y,o,I,g,m):T.create(e,n,_,y,o,I,g,m);if(0===d){const[e,t,s,r]=u;b.geometry.coords[0]=(e+s)/2,b.geometry.coords[1]=(t+r)/2}return this._clusters.set(n,b),this._updateAggregateValueRangeForCluster(b,b.tileLevel),b}_updateAggregateValueRangeForCluster(e,t){const s=this._aggregateValueRanges[t]||{minValue:1/0,maxValue:0},r=s.minValue,o=s.maxValue;s.minValue=Math.min(r,e.count),s.maxValue=Math.max(o,e.count),this._aggregateValueRanges[t]=s,r===s.minValue&&o===s.maxValue||(this._aggregateValueRangesChanged=!0)}_markTileClustersForDeletion(e,t){const s=2*t,r=Math.ceil(v/s),{row:o,col:a}=e.key,i=a*v,h=o*v,n=Math.floor(i/s),l=Math.floor(h/s);for(let u=n;u<n+r;u++)for(let t=l;t<l+r;t++)this._markForDeletion(e.key.level,u,t)}}export{T as ClusterInfo,G as ClusterStore};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../geometry.js";import has from"../../../../../core/has.js";import{isSome as e,isNone as t,unwrapOrThrow as r,unwrapOr as s}from"../../../../../core/maybe.js";import{getCentroidOptimizedGeometry as i}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as o}from"../../../../../layers/graphics/featureConversionUtils.js";import n from"../../../../../layers/graphics/OptimizedGeometry.js";import{StaticBitSet as a}from"./StaticBitSet.js";import{fromJSON as d}from"../../../../../geometry/support/jsonUtils.js";let h=0;const u=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],l=u[0],c=u[1],m=u[2],g=u[3],y=has("featurelayer-simplify-payload-size-factors")??[1,2,4],_=y[0],f=y[1],p=y[2],x=has("featurelayer-simplify-mobile-factor")??2,I=has("esri-mobile");class b{constructor(e,t){this.type="FeatureSetReader",this.arcadeDeclaredClass="esri.arcade.Feature",this.seen=!1,this.instance=0,this._tx=0,this._ty=0,this._sx=1,this._sy=1,this._deleted=null,this._joined=[],this._objectIdToIndex=null,this._level=0,this.instance=e,this._layerSchema=t}static createInstance(){return h++,h=h>65535?0:h,h}get isEmpty(){return e(this._deleted)&&this._deleted.countSet()===this.getSize()}set level(e){this._level=e}getAreaSimplificationThreshold(e,t){let r=1;const s=I?x:1;t>4e6?r=p*s:t>1e6?r=f*s:t>5e5?r=_*s:t>1e5&&(r=s);let i=0;e>4e3?i=g*r:e>2e3?i=m*r:e>100?i=c:e>15&&(i=l);let o=8;return this._level<4?o=1:this._level<5?o=2:this._level<6&&(o=4),i*o}createQuantizedExtrudedQuad(e,t){return new n([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}setArcadeSpatialReference(e){this._arcadeSpatialReference=e}attachStorage(e){this._storage=e}getQuantizationTransform(){throw new Error("Unable to find transform for featureSet")}getStorage(){return this._storage}getComputedNumeric(e){return this.getComputedNumericAtIndex(0)}setComputedNumeric(e,t){return this.setComputedNumericAtIndex(t,0)}getComputedString(e){return this.getComputedStringAtIndex(0)}setComputedString(e,t){return this.setComputedStringAtIndex(0,t)}getComputedNumericAtIndex(e){return this._storage.getComputedNumericAtIndex(this.getDisplayId(),e)}setComputedNumericAtIndex(e,t){this._storage.setComputedNumericAtIndex(this.getDisplayId(),e,t)}getComputedStringAtIndex(e){return this._storage.getComputedStringAtIndex(this.getDisplayId(),e)}setComputedStringAtIndex(e,t){return this._storage.setComputedStringAtIndex(this.getDisplayId(),e,t)}transform(e,t,r,s){const i=this.copy();return i._tx+=e,i._ty+=t,i._sx*=r,i._sy*=s,i}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}readArcadeFeature(){return this}geometry(){const e=this.readHydratedGeometry(),t=o(e,this.geometryType,this.hasZ,this.hasM),r=d(t);return r&&(r.spatialReference=this._arcadeSpatialReference),r}field(e){if(this.hasField(e))return this.readAttribute(e,!0);for(const t of this._joined)if(t.setIndex(this.getIndex()),t.hasField(e)){return t._readAttribute(e,!0)}throw new Error(`Field ${e} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.getFieldNames()}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeature());const t=this.readLegacyFeature();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes?t.attributes:{}}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this._layerSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry().toJSON()}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}removeIds(e){if(t(this._objectIdToIndex)){const e=new Map,t=this.getCursor();for(;t.next();){const s=r(t.getObjectId());e.set(s,t.getIndex())}this._objectIdToIndex=e}const s=this._objectIdToIndex;for(const t of e)s.has(t)&&this.removeAtIndex(s.get(t))}removeAtIndex(e){t(this._deleted)&&(this._deleted=a.create(this.getSize())),this._deleted.set(e)}readGeometryForDisplay(){return this.readUnquantizedGeometry(!0)}readLegacyGeometryForDisplay(){return this.readLegacyGeometry(!0)}*features(){const e=this.getCursor();for(;e.next();)yield e.readOptimizedFeature()}_getExists(){return t(this._deleted)||!this._deleted.has(this.getIndex())}_computeCentroid(){if("esriGeometryPolygon"!==this.geometryType)return null;const e=this.readUnquantizedGeometry();if(!e||e.hasIndeterminateRingOrder)return null;const t=s(this.getQuantizationTransform(),null);return i(new n,e,this.hasM,this.hasZ,t)}copyInto(e){e.seen=this.seen,e._storage=this._storage,e._arcadeSpatialReference=this._arcadeSpatialReference,e._joined=this._joined,e._tx=this._tx,e._ty=this._ty,e._sx=this._sx,e._sy=this._sy,e._deleted=this._deleted,e._objectIdToIndex=this._objectIdToIndex}}export{b as FeatureSetReader};
5
+ import"../../../../../geometry.js";import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import{DateTimeReferenceFieldIndex as t}from"../../../../../arcade/arcadeTimeUtils.js";import has from"../../../../../core/has.js";import{isSome as r,isNone as s,unwrapOrThrow as i,unwrapOr as a}from"../../../../../core/maybe.js";import{getCentroidOptimizedGeometry as n}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as o}from"../../../../../layers/graphics/featureConversionUtils.js";import d from"../../../../../layers/graphics/OptimizedGeometry.js";import{StaticBitSet as h}from"./StaticBitSet.js";import{fromJSON as u}from"../../../../../geometry/support/jsonUtils.js";let c=0;const l=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],m=l[0],f=l[1],g=l[2],_=l[3],y=has("featurelayer-simplify-payload-size-factors")??[1,2,4],p=y[0],x=y[1],I=y[2],A=has("featurelayer-simplify-mobile-factor")??2,S=has("esri-mobile");class b{constructor(e,t){this.type="FeatureSetReader",this.arcadeDeclaredClass="esri.arcade.Feature",this.seen=!1,this.instance=0,this._tx=0,this._ty=0,this._sx=1,this._sy=1,this._deleted=null,this._joined=[],this._objectIdToIndex=null,this._level=0,this._datetimeMetadata=null,this.instance=e,this._layerSchema=t}static createInstance(){return c++,c=c>65535?0:c,c}get isEmpty(){return r(this._deleted)&&this._deleted.countSet()===this.getSize()}set level(e){this._level=e}getAreaSimplificationThreshold(e,t){let r=1;const s=S?A:1;t>4e6?r=I*s:t>1e6?r=x*s:t>5e5?r=p*s:t>1e5&&(r=s);let i=0;e>4e3?i=_*r:e>2e3?i=g*r:e>100?i=f:e>15&&(i=m);let a=8;return this._level<4?a=1:this._level<5?a=2:this._level<6&&(a=4),i*a}createQuantizedExtrudedQuad(e,t){return new d([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}setArcadeSpatialReference(e){this._arcadeSpatialReference=e}attachStorage(e){this._storage=e}getQuantizationTransform(){throw new Error("Unable to find transform for featureSet")}getStorage(){return this._storage}getComputedNumeric(e){return this.getComputedNumericAtIndex(0)}setComputedNumeric(e,t){return this.setComputedNumericAtIndex(t,0)}getComputedString(e){return this.getComputedStringAtIndex(0)}setComputedString(e,t){return this.setComputedStringAtIndex(0,t)}getComputedNumericAtIndex(e){return this._storage.getComputedNumericAtIndex(this.getDisplayId(),e)}setComputedNumericAtIndex(e,t){this._storage.setComputedNumericAtIndex(this.getDisplayId(),e,t)}getComputedStringAtIndex(e){return this._storage.getComputedStringAtIndex(this.getDisplayId(),e)}setComputedStringAtIndex(e,t){return this._storage.setComputedStringAtIndex(this.getDisplayId(),e,t)}transform(e,t,r,s){const i=this.copy();return i._tx+=e,i._ty+=t,i._sx*=r,i._sy*=s,i}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}readArcadeFeature(){return this}geometry(){const e=this.readHydratedGeometry(),t=o(e,this.geometryType,this.hasZ,this.hasM),r=u(t);return r&&(r.spatialReference=this._arcadeSpatialReference),r}get dateTimeReferenceFieldIndex(){return this._datetimeMetadata||(this._datetimeMetadata=t.create(this._layerSchema.fields,this._layerSchema)),this._datetimeMetadata}autocastArcadeDate(t,r){return r&&r instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(r):e.dateJSToArcadeDate(r):r}isUnknownDateTimeField(e){return"unknown"===this.dateTimeReferenceFieldIndex?.fieldTimeZone(e)}fieldSourceTimeZone(e){return this.dateTimeReferenceFieldIndex?.fieldTimeZone(e)??""}get layerPreferredTimeZone(){return this.dateTimeReferenceFieldIndex?.layerPreferredTimeZone??""}field(e){if(this.hasField(e))return this.autocastArcadeDate(e,this.readAttribute(e,!0));for(const t of this._joined)if(t.setIndex(this.getIndex()),t.hasField(e)){const r=t._readAttribute(e,!0);return this.autocastArcadeDate(e,r)}throw new Error(`Field ${e} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.getFieldNames()}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeature());const t=this.readLegacyFeature();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes?t.attributes:{}}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this._layerSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry().toJSON()}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}removeIds(e){if(s(this._objectIdToIndex)){const e=new Map,t=this.getCursor();for(;t.next();){const r=i(t.getObjectId());e.set(r,t.getIndex())}this._objectIdToIndex=e}const t=this._objectIdToIndex;for(const r of e)t.has(r)&&this.removeAtIndex(t.get(r))}removeAtIndex(e){s(this._deleted)&&(this._deleted=h.create(this.getSize())),this._deleted.set(e)}readGeometryForDisplay(){return this.readUnquantizedGeometry(!0)}readLegacyGeometryForDisplay(){return this.readLegacyGeometry(!0)}*features(){const e=this.getCursor();for(;e.next();)yield e.readOptimizedFeature()}_getExists(){return s(this._deleted)||!this._deleted.has(this.getIndex())}_computeCentroid(){if("esriGeometryPolygon"!==this.geometryType)return null;const e=this.readUnquantizedGeometry();if(!e||e.hasIndeterminateRingOrder)return null;const t=a(this.getQuantizationTransform(),null);return n(new d,e,this.hasM,this.hasZ,t)}copyInto(e){e.seen=this.seen,e._storage=this._storage,e._arcadeSpatialReference=this._arcadeSpatialReference,e._joined=this._joined,e._tx=this._tx,e._ty=this._ty,e._sx=this._sx,e._sy=this._sy,e._deleted=this._deleted,e._objectIdToIndex=this._objectIdToIndex}}export{b as FeatureSetReader};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{lerp as s}from"../../../core/mathUtils.js";import{isSome as r,isNone as i,destroyMaybe as a}from"../../../core/maybe.js";import{when as o,syncAndInitial as n,watch as h,initial as p,sync as m}from"../../../core/reactiveUtils.js";import{Milliseconds as d}from"../../../core/time.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{l as c,c as u,h as g}from"../../../chunks/vec3.js";import{f as w}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as f}from"../../../geometry/ellipsoidUtils.js";import{isMoon as y,isEarth as v}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as P}from"../../ViewingMode.js";import{AtmosphereType as b}from"./AtmosphereType.js";import{ChapmanAtmosphere as R}from"./ChapmanAtmosphere.js";import{CloudsComposition as x}from"./CloudsComposition.js";import{FadeInStages as z,FadeInOutStages as A}from"./CloudsCompositionParameters.js";import{isReadyCloudsData as W,CloudsRenderingStages as N}from"./CloudsData.js";import{CloudsGenerator as j}from"./CloudsGenerator.js";import{cloudPresets as C}from"./CloudsPresets.js";import{Fog as E,FogParameters as T}from"./Fog.js";import{PanoramicAtmosphere as O}from"./PanoramicAtmosphere.js";import{Precipitation as S}from"./Precipitation.js";import F from"./SimpleAtmosphere.js";import{SimpleHaze as q,HazeParameters as H}from"./SimpleHaze.js";import{Stars as I}from"./Stars.js";import{weatherHeightLimit as M}from"./weather.js";import{updateWeatherFading as L,weatherfadingNeedsRender as U}from"./weatherUtils.js";import{ShaderOutput as V}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as k}from"../webgl-engine/lib/RenderSlot.js";import{RenderStateFeature as G}from"../webgl-engine/lib/RenderStateFeature.js";import{Update as B}from"../webgl-engine/lib/Update.js";var D;const Q=[k.POSTPROCESSING_ENVIRONMENT_OPAQUE,k.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let J=D=class extends t{constructor(e){super(e),this._context=null,this._atmosphere=null,this._hqAtmosphere=null,this._oldWeatherParameters=new K,this._newWeatherParameters=new K,this._fadedWeatherParameters=new K,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(Q,this)}destroy(){this.removeHandles(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return r(this._hqAtmosphere)&&this.view._stage.renderer.isFeatureEnabled(G.RealisticAtmosphere)?this._hqAtmosphere:this._atmosphere}get _atmosphereType(){return r(this.atmosphere)?this.atmosphere.type:b.None}get canRender(){return!!this.view.basemapTerrain?.renderer.canRender||"global"!==this.view.viewingMode}get needsLinearDepth(){return this._atmosphereType===b.Realistic}updateAnimation(e){return!!r(this._precipitation)&&this._precipitation.update(e)}get updating(){return r(this._stars)&&this._stars.updating||r(this._clouds)&&this._clouds.running}get weatherVisible(){return c(this.view.state.camera.eye)-f(this.view.spatialReference).radius<=M}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return!t||i(this._context)?(a(s),null):r(s)?s:new I({view:e,requestRender:()=>this._setNeedsRender()})}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||i(this._context))return a(e),null;const t=this.view,s=this._context;return r(e)&&e.context===s?e:(a(e),new S({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||i(this._context))return a(e),null;if(r(e))return e;const t=this.view,s=this._context;return a(e),new j({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||i(this._context))return a(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,o=f(this.view.spatialReference).radius;return r(e)&&e.viewingMode===t&&e.planetRadius===o?e:(a(e),new x({rctx:s,viewingMode:t,planetRadius:o,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||i(this._context))return a(e),null;if(r(e))return e;const t=this.view,s=this._context;return new E({context:s,view:t})}get _simpleHaze(){const e=this._get("_simpleHaze");if(!this.weatherEnabled||i(this._context))return a(e),null;if(r(e))return e;const t=this.view,s=this._context;return new q({context:s,view:t})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([o((()=>this.view?.basemapTerrain),(()=>this._updateBasemapTerrain()),n),h((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled,quality:this.view.environment.atmosphere.quality})),(e=>this._updateAtmosphere(e)),n),h((()=>this._stars),t),h((()=>this._precipitation),t),h((()=>this._clouds),(()=>this._updateWeather()),p),h((()=>this._fog),(()=>this._updateFogHaze()),p),h((()=>this._simpleHaze),(()=>this._updateFogHaze()),p),h((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),m),h((()=>this._atmosphereType),(()=>this._updateBasemapTerrain()),n),h((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),n)])}uninitializeRenderContext(){this._context=null,this._atmosphere=a(this._atmosphere),this._hqAtmosphere=a(this._hqAtmosphere),this._set("_stars",a(this._stars)),this._set("_precipitation",a(this._precipitation)),this._set("_clouds",a(this._clouds)),this._set("_cloudsComposition",a(this._cloudsComposition)),this._set("_fog",a(this._fog)),this._set("_simpleHaze",a(this._simpleHaze))}prepareRender(e){e.bindParameters.cloudsFade.data=W(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&(L(e.bindParameters.cloudsFade,e.bindParameters.camera,this.view.state.mode,D.test.time||e.time,this.view.qualitySettings.weatherFadeDuration),this._updateWeatherFading(e.bindParameters),e.bindParameters.cloudsFade.renderingStage===N.FINISHED&&r(this._clouds)&&0===this._clouds.coverage&&!1===this._clouds.running&&this._clouds.destroyFrameBufferCube())}render(e){if(e.output===V.Color)switch(e.bindParameters.slot){case k.POSTPROCESSING_ENVIRONMENT_OPAQUE:r(this._stars)&&this._stars.render(e),r(this.atmosphere)&&(this.atmosphere.render(e),r(this._cloudsComposition)&&r(e.bindParameters.cloudsFade.data)&&(this.weatherVisible&&r(this._clouds)&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),U(e.bindParameters.cloudsFade)&&r(this._context)&&this._context.requestRender());break;case k.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(r(this.atmosphere)&&(this.atmosphere.renderHaze(e,this._weatherParameters.haze.amount),this._weatherParameters.haze.amount>0&&this._atmosphereType!==b.Realistic&&r(this._simpleHaze)&&this._simpleHaze.render(e,this._weatherParameters.haze),this._weatherParameters.fog.amount>0&&r(this._fog)&&this._fog.render(e,this._weatherParameters.fog),r(this._precipitation))){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,i){if(r(this._context)){const r=this._context.renderContext;r.bindParameters.oldLighting.copyFrom(r.bindParameters.lighting),r.bindParameters.newLighting.noonFactor=t,r.bindParameters.newLighting.globalFactor=s,r.bindParameters.newLighting.set(e);i===B.Faded||r.bindParameters.weatherFading?r.bindParameters.fadeLighting(0):r.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return i(e)?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e){if(!e.weatherFading)return;const t=e.cloudsFade;return t.fadeIn.stage===z.FADE_IN?(e.fadeLighting(t.fadeIn.factor),void this._fadeWeather(t.fadeIn.factor)):t.fadeInOut.stage===A.FADE_IN?(e.fadeLighting(t.fadeInOut.factor),void this._fadeWeather(t.fadeInOut.factor)):t.crossFade.enabled?(e.fadeLighting(t.crossFade.factor),void this._fadeWeather(t.crossFade.factor)):(e.fadeLighting(0),void this._fadeWeather(0))}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;i(e)||i(this._clouds)||(this._clouds.applyPreset(C[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){r(this._context)&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(i(this._fog)||i(this._simpleHaze)||i(e)||i(this._context))return;const t=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=s(3e-5,.005,e.weatherAdjustment**3),u(this._newWeatherParameters.fog.color,Y),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=this._atmosphereType===b.Realistic?1:0,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),u(this._newWeatherParameters.fog.color,X),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),u(this._newWeatherParameters.fog.color,Y),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=this._atmosphereType===b.Realistic?1:0,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.haze.strength=4e-6,this._newWeatherParameters.haze.amount=1,this._setNeedsRender()}t.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(r(this._atmosphere)?this._atmosphere.type===t:t===b.None)return;this._atmosphere=a(this._atmosphere),this._hqAtmosphere=a(this._hqAtmosphere);const s=this._getAtmosphereClass(t);s&&r(this._context)&&(this._atmosphere=new s(this.view),this._atmosphere.initializeRenderContext(this._context),t===b.Simple&&(this._hqAtmosphere=new R(this.view),this._hqAtmosphere.initializeRenderContext(this._context))),this._setNeedsRender(),this._updateBasemapTerrain()}_getAtmosphereClass(e){switch(e){case b.None:return null;case b.Realistic:return R;case b.Panoramic:return O;case b.Simple:return F}}_selectAtmosphereType(e){const{enabled:t,quality:s,viewingMode:i}=e;return!t||y(this.view.spatialReference)?b.None:i===P.Local?b.Panoramic:r(this._context)&&"high"===s&&R.isSupported(this._context)&&v(this.view.spatialReference)?b.Realistic:b.Simple}_updateBasemapTerrain(){this.view.basemapTerrain&&(this.view.basemapTerrain.velvetOverground=this._atmosphereType===b.Simple)}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled,quality:this.view.environment.atmosphere.quality}),stubGetAtmosphereClass:e=>{Z=D.prototype._getAtmosphereClass,D.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{D.prototype._getAtmosphereClass=Z}}}};J.test={time:d(0)},e([l({constructOnly:!0})],J.prototype,"view",void 0),e([l({readOnly:!0})],J.prototype,"atmosphere",null),e([l({readOnly:!0})],J.prototype,"_atmosphereType",null),e([l({type:Boolean,readOnly:!0})],J.prototype,"updating",null),e([l({readOnly:!0})],J.prototype,"weatherVisible",null),e([l()],J.prototype,"_context",void 0),e([l()],J.prototype,"_atmosphere",void 0),e([l()],J.prototype,"_hqAtmosphere",void 0),e([l({readOnly:!0})],J.prototype,"_stars",null),e([l({readOnly:!0})],J.prototype,"_precipitation",null),e([l({readOnly:!0})],J.prototype,"_clouds",null),e([l({readOnly:!0})],J.prototype,"_cloudsComposition",null),e([l({readOnly:!0})],J.prototype,"_fog",null),e([l({readOnly:!0})],J.prototype,"_simpleHaze",null),e([l({readOnly:!0})],J.prototype,"weatherEnabled",null),e([l({readOnly:!0})],J.prototype,"_precipitationEnabled",null),e([l({readOnly:!0})],J.prototype,"_weatherUpdateParameters",null),J=D=e([_("esri.views.3d.environment.EnvironmentRenderer")],J);class K{constructor(){this.fog=new T,this.haze=new H}copyFrom(e){this.fog.amount=e.fog.amount,this.haze.amount=e.haze.amount,this.fog.strength=e.fog.strength,this.haze.strength=e.haze.strength,u(this.fog.color,e.fog.color)}lerp(e,t,r){this.fog.amount=s(e.fog.amount,t.fog.amount,r),this.haze.amount=s(e.haze.amount,t.haze.amount,r),this.fog.strength=s(e.fog.strength,t.fog.strength,r),this.haze.strength=s(e.haze.strength,t.haze.strength,r),g(this.fog.color,e.fog.color,t.fog.color,r)}}const X=w(.5,.5,.5),Y=w(1.5,1.5,1.5);let Z;export{J as EnvironmentRenderer,K as WeatherParameters};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{lerp as s}from"../../../core/mathUtils.js";import{isSome as r,isNone as i,destroyMaybe as a}from"../../../core/maybe.js";import{when as o,syncAndInitial as n,watch as h,initial as p,sync as m}from"../../../core/reactiveUtils.js";import{Milliseconds as d}from"../../../core/time.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{l as c,c as u,h as g}from"../../../chunks/vec3.js";import{f as w}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as f}from"../../../geometry/ellipsoidUtils.js";import{isMoon as y,isEarth as v}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as P}from"../../ViewingMode.js";import{AtmosphereType as b}from"./AtmosphereType.js";import{ChapmanAtmosphere as R}from"./ChapmanAtmosphere.js";import{CloudsComposition as x}from"./CloudsComposition.js";import{FadeInStages as z,FadeInOutStages as A}from"./CloudsCompositionParameters.js";import{isReadyCloudsData as W,CloudsRenderingStages as j}from"./CloudsData.js";import{CloudsGenerator as N}from"./CloudsGenerator.js";import{cloudPresets as C}from"./CloudsPresets.js";import{Fog as E,FogParameters as T}from"./Fog.js";import{PanoramicAtmosphere as O}from"./PanoramicAtmosphere.js";import{Precipitation as F}from"./Precipitation.js";import S from"./SimpleAtmosphere.js";import{SimpleHaze as q,HazeParameters as H}from"./SimpleHaze.js";import{Stars as I}from"./Stars.js";import{weatherHeightLimit as M}from"./weather.js";import{updateWeatherFading as L,weatherfadingNeedsRender as U}from"./weatherUtils.js";import{ShaderOutput as V}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderFeature as k}from"../webgl-engine/lib/RenderFeature.js";import{RenderSlot as G}from"../webgl-engine/lib/RenderSlot.js";import{Update as B}from"../webgl-engine/lib/Update.js";var D;const Q=[G.POSTPROCESSING_ENVIRONMENT_OPAQUE,G.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let J=D=class extends t{constructor(e){super(e),this._context=null,this._atmosphere=null,this._hqAtmosphere=null,this._oldWeatherParameters=new K,this._newWeatherParameters=new K,this._fadedWeatherParameters=new K,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(Q,this)}destroy(){this.removeHandles(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return r(this._hqAtmosphere)&&this.view._stage.renderer.isFeatureEnabled(k.RealisticAtmosphere)?this._hqAtmosphere:this._atmosphere}get _atmosphereType(){return r(this.atmosphere)?this.atmosphere.type:b.None}get canRender(){return!!this.view.basemapTerrain?.renderer.canRender||"global"!==this.view.viewingMode}get needsLinearDepth(){return this._atmosphereType===b.Realistic}updateAnimation(e){return!!r(this._precipitation)&&this._precipitation.update(e)}get updating(){return r(this._stars)&&this._stars.updating||r(this._clouds)&&this._clouds.running}get weatherVisible(){return c(this.view.state.camera.eye)-f(this.view.spatialReference).radius<=M}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return!t||i(this._context)?(a(s),null):r(s)?s:new I({view:e,requestRender:()=>this._setNeedsRender()})}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||i(this._context))return a(e),null;const t=this.view,s=this._context;return r(e)&&e.context===s?e:(a(e),new F({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||i(this._context))return a(e),null;if(r(e))return e;const t=this.view,s=this._context;return a(e),new N({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||i(this._context))return a(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,o=f(this.view.spatialReference).radius;return r(e)&&e.viewingMode===t&&e.planetRadius===o?e:(a(e),new x({rctx:s,viewingMode:t,planetRadius:o,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||i(this._context))return a(e),null;if(r(e))return e;const t=this.view,s=this._context;return new E({context:s,view:t})}get _simpleHaze(){const e=this._get("_simpleHaze");if(!this.weatherEnabled||i(this._context))return a(e),null;if(r(e))return e;const t=this.view,s=this._context;return new q({context:s,view:t})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([o((()=>this.view?.basemapTerrain),(()=>this._updateBasemapTerrain()),n),h((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled,quality:this.view.environment.atmosphere.quality})),(e=>this._updateAtmosphere(e)),n),h((()=>this._stars),t),h((()=>this._precipitation),t),h((()=>this._clouds),(()=>this._updateWeather()),p),h((()=>this._fog),(()=>this._updateFogHaze()),p),h((()=>this._simpleHaze),(()=>this._updateFogHaze()),p),h((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),m),h((()=>this._atmosphereType),(()=>this._updateBasemapTerrain()),n),h((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),n)])}uninitializeRenderContext(){this._context=null,this._atmosphere=a(this._atmosphere),this._hqAtmosphere=a(this._hqAtmosphere),this._set("_stars",a(this._stars)),this._set("_precipitation",a(this._precipitation)),this._set("_clouds",a(this._clouds)),this._set("_cloudsComposition",a(this._cloudsComposition)),this._set("_fog",a(this._fog)),this._set("_simpleHaze",a(this._simpleHaze))}prepareRender(e){e.bindParameters.cloudsFade.data=W(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&(L(e.bindParameters.cloudsFade,e.bindParameters.camera,this.view.state.mode,D.test.time||e.time,this.view.qualitySettings.weatherFadeDuration),this._updateWeatherFading(e.bindParameters),e.bindParameters.cloudsFade.renderingStage===j.FINISHED&&r(this._clouds)&&0===this._clouds.coverage&&!1===this._clouds.running&&this._clouds.destroyFrameBufferCube())}render(e){if(e.output===V.Color)switch(e.bindParameters.slot){case G.POSTPROCESSING_ENVIRONMENT_OPAQUE:r(this._stars)&&this._stars.render(e),r(this.atmosphere)&&(this.atmosphere.render(e),r(this._cloudsComposition)&&r(e.bindParameters.cloudsFade.data)&&(this.weatherVisible&&r(this._clouds)&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),U(e.bindParameters.cloudsFade)&&r(this._context)&&this._context.requestRender());break;case G.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(r(this.atmosphere)&&(this.atmosphere.renderHaze(e,this._weatherParameters.haze.amount),this._weatherParameters.haze.amount>0&&this._atmosphereType!==b.Realistic&&r(this._simpleHaze)&&this._simpleHaze.render(e,this._weatherParameters.haze),this._weatherParameters.fog.amount>0&&r(this._fog)&&this._fog.render(e,this._weatherParameters.fog),r(this._precipitation))){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,i){if(r(this._context)){const r=this._context.renderContext;r.bindParameters.oldLighting.copyFrom(r.bindParameters.lighting),r.bindParameters.newLighting.noonFactor=t,r.bindParameters.newLighting.globalFactor=s,r.bindParameters.newLighting.set(e);i===B.Faded||r.bindParameters.weatherFading?r.bindParameters.fadeLighting(0):r.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return i(e)?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e){if(!e.weatherFading)return;const t=e.cloudsFade;return t.fadeIn.stage===z.FADE_IN?(e.fadeLighting(t.fadeIn.factor),void this._fadeWeather(t.fadeIn.factor)):t.fadeInOut.stage===A.FADE_IN?(e.fadeLighting(t.fadeInOut.factor),void this._fadeWeather(t.fadeInOut.factor)):t.crossFade.enabled?(e.fadeLighting(t.crossFade.factor),void this._fadeWeather(t.crossFade.factor)):(e.fadeLighting(0),void this._fadeWeather(0))}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;i(e)||i(this._clouds)||(this._clouds.applyPreset(C[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){r(this._context)&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(i(this._fog)||i(this._simpleHaze)||i(e)||i(this._context))return;const t=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=s(3e-5,.005,e.weatherAdjustment**3),u(this._newWeatherParameters.fog.color,Y),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=this._atmosphereType===b.Realistic?1:0,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),u(this._newWeatherParameters.fog.color,X),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),u(this._newWeatherParameters.fog.color,Y),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=this._atmosphereType===b.Realistic?1:0,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.haze.strength=4e-6,this._newWeatherParameters.haze.amount=1,this._setNeedsRender()}t.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(r(this._atmosphere)?this._atmosphere.type===t:t===b.None)return;this._atmosphere=a(this._atmosphere),this._hqAtmosphere=a(this._hqAtmosphere);const s=this._getAtmosphereClass(t);s&&r(this._context)&&(this._atmosphere=new s(this.view),this._atmosphere.initializeRenderContext(this._context),t===b.Simple&&(this._hqAtmosphere=new R(this.view),this._hqAtmosphere.initializeRenderContext(this._context))),this._setNeedsRender(),this._updateBasemapTerrain()}_getAtmosphereClass(e){switch(e){case b.Realistic:return R;case b.Panoramic:return O;case b.Simple:return S;default:case b.None:return null}}_selectAtmosphereType(e){const{enabled:t,quality:s,viewingMode:i}=e;return!t||y(this.view.spatialReference)?b.None:i===P.Local?b.Panoramic:r(this._context)&&"high"===s&&R.isSupported(this._context)&&v(this.view.spatialReference)?b.Realistic:b.Simple}_updateBasemapTerrain(){this.view.basemapTerrain&&(this.view.basemapTerrain.velvetOverground=this._atmosphereType===b.Simple)}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled,quality:this.view.environment.atmosphere.quality}),stubGetAtmosphereClass:e=>{Z=D.prototype._getAtmosphereClass,D.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{D.prototype._getAtmosphereClass=Z}}}};J.test={time:d(0)},e([l({constructOnly:!0})],J.prototype,"view",void 0),e([l({readOnly:!0})],J.prototype,"atmosphere",null),e([l({readOnly:!0})],J.prototype,"_atmosphereType",null),e([l({type:Boolean,readOnly:!0})],J.prototype,"updating",null),e([l({readOnly:!0})],J.prototype,"weatherVisible",null),e([l()],J.prototype,"_context",void 0),e([l()],J.prototype,"_atmosphere",void 0),e([l()],J.prototype,"_hqAtmosphere",void 0),e([l({readOnly:!0})],J.prototype,"_stars",null),e([l({readOnly:!0})],J.prototype,"_precipitation",null),e([l({readOnly:!0})],J.prototype,"_clouds",null),e([l({readOnly:!0})],J.prototype,"_cloudsComposition",null),e([l({readOnly:!0})],J.prototype,"_fog",null),e([l({readOnly:!0})],J.prototype,"_simpleHaze",null),e([l({readOnly:!0})],J.prototype,"weatherEnabled",null),e([l({readOnly:!0})],J.prototype,"_precipitationEnabled",null),e([l({readOnly:!0})],J.prototype,"_weatherUpdateParameters",null),J=D=e([_("esri.views.3d.environment.EnvironmentRenderer")],J);class K{constructor(){this.fog=new T,this.haze=new H}copyFrom(e){this.fog.amount=e.fog.amount,this.haze.amount=e.haze.amount,this.fog.strength=e.fog.strength,this.haze.strength=e.haze.strength,u(this.fog.color,e.fog.color)}lerp(e,t,r){this.fog.amount=s(e.fog.amount,t.fog.amount,r),this.haze.amount=s(e.haze.amount,t.haze.amount,r),this.fog.strength=s(e.fog.strength,t.fog.strength,r),this.haze.strength=s(e.haze.strength,t.haze.strength,r),g(this.fog.color,e.fog.color,t.fog.color,r)}}const X=w(.5,.5,.5),Y=w(1.5,1.5,1.5);let Z;export{J as EnvironmentRenderer,K as WeatherParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{getOrCreateMapValue as e}from"../../../../core/MapUtils.js";import{eachAlwaysValues as t}from"../../../../core/promiseUtils.js";import{isDataProtocol as r,dataComponents as s,dataToArrayBuffer as n,makeAbsolute as o}from"../../../../core/urlUtils.js";import{Version as a}from"../../../../core/Version.js";import{A as i,m as u,w as c,e as f,k as d}from"../../../../chunks/mat4.js";import{c as p,b as m}from"../../../../chunks/mat4f64.js";import{g as l}from"../../../../chunks/quat.js";import{a as h}from"../../../../chunks/quatf64.js";import{BufferViewUint32 as y,BufferViewUint16 as b,BufferViewUint8 as T,BufferViewVec3f as _,BufferViewVec4f as x,BufferViewVec2f as w,BufferViewVec4u8 as O,BufferViewVec4u16 as N,BufferViewVec3u8 as g,BufferViewVec3u16 as C,BufferViewVec2u32 as S,BufferViewVec2u16 as U,BufferViewVec2i16 as I,BufferViewVec2u8 as L,BufferViewVec2i8 as A}from"../../../../geometry/support/buffer/BufferView.js";import{m as E}from"../../../../chunks/scalar.js";import{BinaryStreamReader as R}from"./BinaryStreamReader.js";import{AttributeType as B}from"./enums.js";import{material as v,textureSampler as D}from"./fillDefaults.js";import{splitURI as G}from"./pathUtils.js";import{DataType as j}from"../../../webgl/enums.js";const M={MAGIC:1179937895,CHUNK_TYPE_JSON:1313821514,CHUNK_TYPE_BIN:5130562,MIN_HEADER_LENGTH:20};class F{constructor(e,t,r,s,n){this._context=e,this._errorContext=t,this.uri=r,this.json=s,this._glbBuffer=n,this._bufferLoaders=new Map,this._textureLoaders=new Map,this._textureCache=new Map,this._materialCache=new Map,this._nodeParentMap=new Map,this._nodeTransformCache=new Map,this._baseUri=G(this.uri).dirPart,this._checkVersionSupported(),this._checkRequiredExtensionsSupported(),t.errorUnsupportedIf(null==s.scenes,"Scenes must be defined."),t.errorUnsupportedIf(null==s.meshes,"Meshes must be defined"),t.errorUnsupportedIf(null==s.nodes,"Nodes must be defined."),this._computeNodeParents()}static async load(e,t,o,a){if(r(o)){const r=s(o);if(r&&"model/gltf-binary"!==r.mediaType)try{const s=JSON.parse(r.isBase64?atob(r.data):r.data);return new F(e,t,o,s)}catch{}const a=n(o);if(F._isGLBData(a))return this._fromGLBData(e,t,o,a)}if(o.endsWith(".gltf")){const r=await e.loadJSON(o,a);return new F(e,t,o,r)}const i=await e.loadBinary(o,a);if(F._isGLBData(i))return this._fromGLBData(e,t,o,i);const u=await e.loadJSON(o,a);return new F(e,t,o,u)}static _isGLBData(e){if(null==e)return!1;const t=new R(e);return t.remainingBytes()>=4&&t.readUint32()===M.MAGIC}static async _fromGLBData(e,t,r,s){const n=await F._parseGLBData(t,s);return new F(e,t,r,n.json,n.binaryData)}static async _parseGLBData(e,t){const r=new R(t);e.assert(r.remainingBytes()>=12,"GLB binary data is insufficiently large.");const s=r.readUint32(),n=r.readUint32(),o=r.readUint32();e.assert(s===M.MAGIC,"Magic first 4 bytes do not fit to expected GLB value."),e.assert(t.byteLength>=o,"GLB binary data is smaller than header specifies."),e.errorUnsupportedIf(2!==n,"An unsupported GLB container version was detected. Only version 2 is supported.");let a,i,u=0;for(;r.remainingBytes()>=8;){const t=r.readUint32(),s=r.readUint32();0===u?(e.assert(s===M.CHUNK_TYPE_JSON,"First GLB chunk must be JSON."),e.assert(t>=0,"No JSON data found."),a=await K(r.readUint8Array(t))):1===u?(e.errorUnsupportedIf(s!==M.CHUNK_TYPE_BIN,"Second GLB chunk expected to be BIN."),i=r.readUint8Array(t)):e.warnUnsupported("More than 2 GLB chunks detected. Skipping."),u+=1}return a||e.error("No GLB JSON chunk detected."),{json:a,binaryData:i}}async getBuffer(e,t){const r=this.json.buffers[e],s=this._errorContext;if(null==r.uri)return s.assert(null!=this._glbBuffer,"GLB buffer not present"),this._glbBuffer;const n=await this._getBufferLoader(e,t);return s.assert(n.byteLength===r.byteLength,"Buffer byte lengths should match."),n}async _getBufferLoader(e,t){const r=this._bufferLoaders.get(e);if(r)return r;const s=this.json.buffers[e].uri,n=this._context.loadBinary(this._resolveUri(s),t).then((e=>new Uint8Array(e)));return this._bufferLoaders.set(e,n),n}async getAccessor(e,t){const r=this._errorContext;r.errorUnsupportedIf(!this.json.accessors,"Accessors missing.");const s=this.json.accessors[e];r.errorUnsupportedIf(null==s?.bufferView,"Some accessor does not specify a bufferView."),r.errorUnsupportedIf(s.type in[B.MAT2,B.MAT3,B.MAT4],`AttributeType ${s.type} is not supported`);const n=this.json.bufferViews[s.bufferView],o=await this.getBuffer(n.buffer,t),a=H[s.type],i=Y[s.componentType],u=a*i,c=n.byteStride||u;return{raw:o.buffer,byteStride:c,byteOffset:o.byteOffset+(n.byteOffset||0)+(s.byteOffset||0),entryCount:s.count,isDenselyPacked:c===u,componentCount:a,componentByteSize:i,componentType:s.componentType,min:s.min,max:s.max,normalized:!!s.normalized}}async getIndexData(e,t){if(null==e.indices)return;const r=await this.getAccessor(e.indices,t);if(r.isDenselyPacked)switch(r.componentType){case j.UNSIGNED_BYTE:return new Uint8Array(r.raw,r.byteOffset,r.entryCount);case j.UNSIGNED_SHORT:return new Uint16Array(r.raw,r.byteOffset,r.entryCount);case j.UNSIGNED_INT:return new Uint32Array(r.raw,r.byteOffset,r.entryCount)}else switch(r.componentType){case j.UNSIGNED_BYTE:return E(this._wrapAccessor(T,r));case j.UNSIGNED_SHORT:return E(this._wrapAccessor(b,r));case j.UNSIGNED_INT:return E(this._wrapAccessor(y,r))}}async getPositionData(e,t){const r=this._errorContext;r.errorUnsupportedIf(null==e.attributes.POSITION,"No POSITION vertex data found.");const s=await this.getAccessor(e.attributes.POSITION,t);return r.errorUnsupportedIf(s.componentType!==j.FLOAT,"Expected type FLOAT for POSITION vertex attribute, but found "+j[s.componentType]),r.errorUnsupportedIf(3!==s.componentCount,"POSITION vertex attribute must have 3 components, but found "+s.componentCount.toFixed()),this._wrapAccessor(_,s)}async getNormalData(e,t){const r=this._errorContext;r.assert(null!=e.attributes.NORMAL,"No NORMAL vertex data found.");const s=await this.getAccessor(e.attributes.NORMAL,t);return r.errorUnsupportedIf(s.componentType!==j.FLOAT,"Expected type FLOAT for NORMAL vertex attribute, but found "+j[s.componentType]),r.errorUnsupportedIf(3!==s.componentCount,"NORMAL vertex attribute must have 3 components, but found "+s.componentCount.toFixed()),this._wrapAccessor(_,s)}async getTangentData(e,t){const r=this._errorContext;r.assert(null!=e.attributes.TANGENT,"No TANGENT vertex data found.");const s=await this.getAccessor(e.attributes.TANGENT,t);return r.errorUnsupportedIf(s.componentType!==j.FLOAT,"Expected type FLOAT for TANGENT vertex attribute, but found "+j[s.componentType]),r.errorUnsupportedIf(4!==s.componentCount,"TANGENT vertex attribute must have 4 components, but found "+s.componentCount.toFixed()),new x(s.raw,s.byteOffset,s.byteStride,s.byteOffset+s.byteStride*s.entryCount)}async getTextureCoordinates(e,t){const r=this._errorContext;r.assert(null!=e.attributes.TEXCOORD_0,"No TEXCOORD_0 vertex data found.");const s=await this.getAccessor(e.attributes.TEXCOORD_0,t);return r.errorUnsupportedIf(2!==s.componentCount,"TEXCOORD_0 vertex attribute must have 2 components, but found "+s.componentCount.toFixed()),s.componentType===j.FLOAT?this._wrapAccessor(w,s):(r.errorUnsupportedIf(!s.normalized,"Integer component types are only supported for a normalized accessor for TEXCOORD_0."),J(s))}async getVertexColors(e,t){const r=this._errorContext;r.assert(null!=e.attributes.COLOR_0,"No COLOR_0 vertex data found.");const s=await this.getAccessor(e.attributes.COLOR_0,t);if(r.errorUnsupportedIf(4!==s.componentCount&&3!==s.componentCount,"COLOR_0 attribute must have 3 or 4 components, but found "+s.componentCount.toFixed()),4===s.componentCount){if(s.componentType===j.FLOAT)return this._wrapAccessor(x,s);if(s.componentType===j.UNSIGNED_BYTE)return this._wrapAccessor(O,s);if(s.componentType===j.UNSIGNED_SHORT)return this._wrapAccessor(N,s)}else if(3===s.componentCount){if(s.componentType===j.FLOAT)return this._wrapAccessor(_,s);if(s.componentType===j.UNSIGNED_BYTE)return this._wrapAccessor(g,s);if(s.componentType===j.UNSIGNED_SHORT)return this._wrapAccessor(C,s)}r.errorUnsupported("Unsupported component type for COLOR_0 attribute: "+j[s.componentType])}hasPositions(e){return void 0!==e.attributes.POSITION}hasNormals(e){return void 0!==e.attributes.NORMAL}hasVertexColors(e){return void 0!==e.attributes.COLOR_0}hasTextureCoordinates(e){return void 0!==e.attributes.TEXCOORD_0}hasTangents(e){return void 0!==e.attributes.TANGENT}async getMaterial(e,t,r){let s=e.material?this._materialCache.get(e.material):void 0;if(!s){const n=null!=e.material?v(this.json.materials[e.material]):v(),o=n.pbrMetallicRoughness,a=this.hasVertexColors(e),i=this.getTexture(o.baseColorTexture,t),u=this.getTexture(n.normalTexture,t),c=r?this.getTexture(n.occlusionTexture,t):void 0,f=r?this.getTexture(n.emissiveTexture,t):void 0,d=r?this.getTexture(o.metallicRoughnessTexture,t):void 0,p=null!=e.material?e.material:-1;s={alphaMode:n.alphaMode,alphaCutoff:n.alphaCutoff,color:o.baseColorFactor,doubleSided:!!n.doubleSided,colorTexture:await i,normalTexture:await u,name:n.name,id:p,occlusionTexture:await c,emissiveTexture:await f,emissiveFactor:n.emissiveFactor,metallicFactor:o.metallicFactor,roughnessFactor:o.roughnessFactor,metallicRoughnessTexture:await d,hasVertexColors:a,ESRI_externalColorMixMode:n.extras.ESRI_externalColorMixMode,colorTextureTransform:o?.baseColorTexture?.extensions?.KHR_texture_transform,normalTextureTransform:n.normalTexture?.extensions?.KHR_texture_transform,occlusionTextureTransform:n.occlusionTexture?.extensions?.KHR_texture_transform,emissiveTextureTransform:n.emissiveTexture?.extensions?.KHR_texture_transform,metallicRoughnessTextureTransform:o?.metallicRoughnessTexture?.extensions?.KHR_texture_transform}}return s}async getTexture(t,r){if(!t)return;this._errorContext.errorUnsupportedIf(0!==(t.texCoord||0),"Only TEXCOORD with index 0 is supported.");const s=t.index,n=this._errorContext,o=this.json.textures[s],a=D(null!=o.sampler?this.json.samplers[o.sampler]:{});n.errorUnsupportedIf(null==o.source,"Source is expected to be defined for a texture.");const i=this.json.images[o.source],u=await this._loadTextureImageData(s,o,r);return e(this._textureCache,s,(()=>{const e=e=>33071===e||33648===e||10497===e,t=e=>(n.error(`Unexpected TextureSampler WrapMode: ${e}. Using default REPEAT(10497).`),10497);return{data:u,wrapS:e(a.wrapS)?a.wrapS:t(a.wrapS),wrapT:e(a.wrapT)?a.wrapT:t(a.wrapT),minFilter:a.minFilter,name:i.name,id:s}}))}getNodeTransform(e){if(void 0===e)return P;let t=this._nodeTransformCache.get(e);if(!t){const r=this.getNodeTransform(this._getNodeParent(e)),s=this.json.nodes[e];s.matrix?t=u(p(),r,s.matrix):s.translation||s.rotation||s.scale?(t=m(r),s.translation&&c(t,t,s.translation),s.rotation&&(k[3]=l(k,s.rotation),f(t,t,k[3],k)),s.scale&&d(t,t,s.scale)):t=m(r),this._nodeTransformCache.set(e,t)}return t}_wrapAccessor(e,t){return new e(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*(t.entryCount-1)+t.componentByteSize*t.componentCount)}_resolveUri(e){return o(e,this._baseUri)}_getNodeParent(e){return this._nodeParentMap.get(e)}_checkVersionSupported(){const e=a.parse(this.json.asset.version,"glTF");V.validate(e)}_checkRequiredExtensionsSupported(){const e=this.json,t=this._errorContext;e.extensionsRequired&&0!==e.extensionsRequired.length&&t.errorUnsupported("gltf loader was not able to load unsupported feature. Required extensions: "+e.extensionsRequired.join(", "))}_computeNodeParents(){this.json.nodes.forEach(((e,t)=>{e.children&&e.children.forEach((e=>{this._nodeParentMap.set(e,t)}))}))}async _loadTextureImageData(e,t,r){const s=this._textureLoaders.get(e);if(s)return s;const n=this._createTextureLoader(t,r);return this._textureLoaders.set(e,n),n}async _createTextureLoader(e,t){const r=this.json.images[e.source];if(r.uri)return this._context.loadImage(this._resolveUri(r.uri),t);const s=this._errorContext;s.errorUnsupportedIf(null==r.bufferView,"Image bufferView must be defined."),s.errorUnsupportedIf(null==r.mimeType,"Image mimeType must be defined.");const n=this.json.bufferViews[r.bufferView],o=await this.getBuffer(n.buffer,t);return s.errorUnsupportedIf(null!=n.byteStride,"byteStride not supported for image buffer"),q(new Uint8Array(o.buffer,o.byteOffset+(n.byteOffset||0),n.byteLength),r.mimeType)}async getLoadedBuffersSize(){if(this._glbBuffer)return this._glbBuffer.byteLength;const e=await t(Array.from(this._bufferLoaders.values())),r=await t(Array.from(this._textureLoaders.values()));return e.reduce(((e,t)=>e+(t?.byteLength??0)),0)+r.reduce(((e,t)=>e+(t?t.width*t.height*4:0)),0)}}const P=i(p(),Math.PI/2),V=new a(2,0,"glTF"),k=h(),H={SCALAR:1,VEC2:2,VEC3:3,VEC4:4},Y={[j.BYTE]:1,[j.UNSIGNED_BYTE]:1,[j.SHORT]:2,[j.UNSIGNED_SHORT]:2,[j.FLOAT]:4,[j.UNSIGNED_INT]:4};function J(e){switch(e.componentType){case j.BYTE:return new A(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case j.UNSIGNED_BYTE:return new L(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case j.SHORT:return new I(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case j.UNSIGNED_SHORT:return new U(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case j.UNSIGNED_INT:return new S(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case j.FLOAT:return new w(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount)}}async function K(e){return new Promise(((t,r)=>{const s=new Blob([e]),n=new FileReader;n.onload=()=>{const e=n.result;t(JSON.parse(e))},n.onerror=e=>{r(e)},n.readAsText(s)}))}async function q(e,t){return new Promise(((r,s)=>{const n=new Blob([e],{type:t}),o=URL.createObjectURL(n),a=new Image,i=()=>{URL.revokeObjectURL(o),"decode"in a?a.decode().then((()=>r(a)),(()=>r(a))).then(c):(r(a),c())},u=e=>{URL.revokeObjectURL(o),s(e),c()},c=()=>{a.removeEventListener("load",i),a.removeEventListener("error",u)};a.addEventListener("load",i),a.addEventListener("error",u),a.src=o}))}export{F as GLTFResource,P as TRANSFORM_GLTF_TO_ENGINE};
5
+ import{getOrCreateMapValue as e}from"../../../../core/MapUtils.js";import{eachAlwaysValues as t}from"../../../../core/promiseUtils.js";import{isDataProtocol as r,dataComponents as s,dataToArrayBuffer as o,makeAbsolute as n}from"../../../../core/urlUtils.js";import{Version as a}from"../../../../core/Version.js";import{A as i,m as u,w as c,e as f,k as p}from"../../../../chunks/mat4.js";import{c as d,b as m}from"../../../../chunks/mat4f64.js";import{g as h}from"../../../../chunks/quat.js";import{a as l}from"../../../../chunks/quatf64.js";import{BufferViewUint32 as y,BufferViewUint16 as T,BufferViewUint8 as _,BufferViewVec3f as b,BufferViewVec4f as x,BufferViewVec2f as w,BufferViewVec4u8 as O,BufferViewVec4u16 as N,BufferViewVec3u8 as g,BufferViewVec3u16 as C,BufferViewVec2u32 as S,BufferViewVec2u16 as I,BufferViewVec2i16 as U,BufferViewVec2u8 as A,BufferViewVec2i8 as L}from"../../../../geometry/support/buffer/BufferView.js";import{m as E}from"../../../../chunks/scalar.js";import{BinaryStreamReader as R}from"./BinaryStreamReader.js";import{AttributeType as B}from"./enums.js";import{material as v,textureSampler as D}from"./fillDefaults.js";import{splitURI as G}from"./pathUtils.js";import{jsonFromBinaryData as M,EncodedMeshTexture as j,imageFromBinaryData as F,isEncodedMeshTexture as P}from"./resourceUtils.js";import{DataType as H}from"../../../webgl/enums.js";const V={MAGIC:1179937895,CHUNK_TYPE_JSON:1313821514,CHUNK_TYPE_BIN:5130562,MIN_HEADER_LENGTH:20};class k{constructor(e,t,r,s,o){this._context=e,this._errorContext=t,this.uri=r,this.json=s,this._glbBuffer=o,this._bufferLoaders=new Map,this._textureLoaders=new Map,this._textureCache=new Map,this._materialCache=new Map,this._nodeParentMap=new Map,this._nodeTransformCache=new Map,this._supportedExtensions=["KHR_texture_basisu"],this._baseUri=G(this.uri).dirPart,this._checkVersionSupported(),this._checkRequiredExtensionsSupported(),t.errorUnsupportedIf(null==s.scenes,"Scenes must be defined."),t.errorUnsupportedIf(null==s.meshes,"Meshes must be defined"),t.errorUnsupportedIf(null==s.nodes,"Nodes must be defined."),this._computeNodeParents()}static async load(e,t,n,a){if(r(n)){const r=s(n);if(r&&"model/gltf-binary"!==r.mediaType)try{const s=JSON.parse(r.isBase64?atob(r.data):r.data);return new k(e,t,n,s)}catch{}const a=o(n);if(k._isGLBData(a))return this._fromGLBData(e,t,n,a)}if(n.endsWith(".gltf")){const r=await e.loadJSON(n,a);return new k(e,t,n,r)}const i=await e.loadBinary(n,a);if(k._isGLBData(i))return this._fromGLBData(e,t,n,i);const u=await e.loadJSON(n,a);return new k(e,t,n,u)}static _isGLBData(e){if(null==e)return!1;const t=new R(e);return t.remainingBytes()>=4&&t.readUint32()===V.MAGIC}static async _fromGLBData(e,t,r,s){const o=await k._parseGLBData(t,s);return new k(e,t,r,o.json,o.binaryData)}static async _parseGLBData(e,t){const r=new R(t);e.assert(r.remainingBytes()>=12,"GLB binary data is insufficiently large.");const s=r.readUint32(),o=r.readUint32(),n=r.readUint32();e.assert(s===V.MAGIC,"Magic first 4 bytes do not fit to expected GLB value."),e.assert(t.byteLength>=n,"GLB binary data is smaller than header specifies."),e.errorUnsupportedIf(2!==o,"An unsupported GLB container version was detected. Only version 2 is supported.");let a,i,u=0;for(;r.remainingBytes()>=8;){const t=r.readUint32(),s=r.readUint32();0===u?(e.assert(s===V.CHUNK_TYPE_JSON,"First GLB chunk must be JSON."),e.assert(t>=0,"No JSON data found."),a=await M(r.readUint8Array(t))):1===u?(e.errorUnsupportedIf(s!==V.CHUNK_TYPE_BIN,"Second GLB chunk expected to be BIN."),i=r.readUint8Array(t)):e.warnUnsupported("More than 2 GLB chunks detected. Skipping."),u+=1}return a||e.error("No GLB JSON chunk detected."),{json:a,binaryData:i}}async getBuffer(e,t){const r=this.json.buffers[e],s=this._errorContext;if(null==r.uri)return s.assert(null!=this._glbBuffer,"GLB buffer not present"),this._glbBuffer;const o=await this._getBufferLoader(e,t);return s.assert(o.byteLength===r.byteLength,"Buffer byte lengths should match."),o}async _getBufferLoader(e,t){const r=this._bufferLoaders.get(e);if(r)return r;const s=this.json.buffers[e].uri,o=this._context.loadBinary(this._resolveUri(s),t).then((e=>new Uint8Array(e)));return this._bufferLoaders.set(e,o),o}async getAccessor(e,t){const r=this._errorContext;r.errorUnsupportedIf(!this.json.accessors,"Accessors missing.");const s=this.json.accessors[e];r.errorUnsupportedIf(null==s?.bufferView,"Some accessor does not specify a bufferView."),r.errorUnsupportedIf(s.type in[B.MAT2,B.MAT3,B.MAT4],`AttributeType ${s.type} is not supported`);const o=this.json.bufferViews[s.bufferView],n=await this.getBuffer(o.buffer,t),a=J[s.type],i=z[s.componentType],u=a*i,c=o.byteStride||u;return{raw:n.buffer,byteStride:c,byteOffset:n.byteOffset+(o.byteOffset||0)+(s.byteOffset||0),entryCount:s.count,isDenselyPacked:c===u,componentCount:a,componentByteSize:i,componentType:s.componentType,min:s.min,max:s.max,normalized:!!s.normalized}}async getIndexData(e,t){if(null==e.indices)return;const r=await this.getAccessor(e.indices,t);if(r.isDenselyPacked)switch(r.componentType){case H.UNSIGNED_BYTE:return new Uint8Array(r.raw,r.byteOffset,r.entryCount);case H.UNSIGNED_SHORT:return new Uint16Array(r.raw,r.byteOffset,r.entryCount);case H.UNSIGNED_INT:return new Uint32Array(r.raw,r.byteOffset,r.entryCount)}else switch(r.componentType){case H.UNSIGNED_BYTE:return E(this._wrapAccessor(_,r));case H.UNSIGNED_SHORT:return E(this._wrapAccessor(T,r));case H.UNSIGNED_INT:return E(this._wrapAccessor(y,r))}}async getPositionData(e,t){const r=this._errorContext;r.errorUnsupportedIf(null==e.attributes.POSITION,"No POSITION vertex data found.");const s=await this.getAccessor(e.attributes.POSITION,t);return r.errorUnsupportedIf(s.componentType!==H.FLOAT,"Expected type FLOAT for POSITION vertex attribute, but found "+H[s.componentType]),r.errorUnsupportedIf(3!==s.componentCount,"POSITION vertex attribute must have 3 components, but found "+s.componentCount.toFixed()),this._wrapAccessor(b,s)}async getNormalData(e,t){const r=this._errorContext;r.assert(null!=e.attributes.NORMAL,"No NORMAL vertex data found.");const s=await this.getAccessor(e.attributes.NORMAL,t);return r.errorUnsupportedIf(s.componentType!==H.FLOAT,"Expected type FLOAT for NORMAL vertex attribute, but found "+H[s.componentType]),r.errorUnsupportedIf(3!==s.componentCount,"NORMAL vertex attribute must have 3 components, but found "+s.componentCount.toFixed()),this._wrapAccessor(b,s)}async getTangentData(e,t){const r=this._errorContext;r.assert(null!=e.attributes.TANGENT,"No TANGENT vertex data found.");const s=await this.getAccessor(e.attributes.TANGENT,t);return r.errorUnsupportedIf(s.componentType!==H.FLOAT,"Expected type FLOAT for TANGENT vertex attribute, but found "+H[s.componentType]),r.errorUnsupportedIf(4!==s.componentCount,"TANGENT vertex attribute must have 4 components, but found "+s.componentCount.toFixed()),new x(s.raw,s.byteOffset,s.byteStride,s.byteOffset+s.byteStride*s.entryCount)}async getTextureCoordinates(e,t){const r=this._errorContext;r.assert(null!=e.attributes.TEXCOORD_0,"No TEXCOORD_0 vertex data found.");const s=await this.getAccessor(e.attributes.TEXCOORD_0,t);return r.errorUnsupportedIf(2!==s.componentCount,"TEXCOORD_0 vertex attribute must have 2 components, but found "+s.componentCount.toFixed()),s.componentType===H.FLOAT?this._wrapAccessor(w,s):(r.errorUnsupportedIf(!s.normalized,"Integer component types are only supported for a normalized accessor for TEXCOORD_0."),X(s))}async getVertexColors(e,t){const r=this._errorContext;r.assert(null!=e.attributes.COLOR_0,"No COLOR_0 vertex data found.");const s=await this.getAccessor(e.attributes.COLOR_0,t);if(r.errorUnsupportedIf(4!==s.componentCount&&3!==s.componentCount,"COLOR_0 attribute must have 3 or 4 components, but found "+s.componentCount.toFixed()),4===s.componentCount){if(s.componentType===H.FLOAT)return this._wrapAccessor(x,s);if(s.componentType===H.UNSIGNED_BYTE)return this._wrapAccessor(O,s);if(s.componentType===H.UNSIGNED_SHORT)return this._wrapAccessor(N,s)}else if(3===s.componentCount){if(s.componentType===H.FLOAT)return this._wrapAccessor(b,s);if(s.componentType===H.UNSIGNED_BYTE)return this._wrapAccessor(g,s);if(s.componentType===H.UNSIGNED_SHORT)return this._wrapAccessor(C,s)}r.errorUnsupported("Unsupported component type for COLOR_0 attribute: "+H[s.componentType])}hasPositions(e){return void 0!==e.attributes.POSITION}hasNormals(e){return void 0!==e.attributes.NORMAL}hasVertexColors(e){return void 0!==e.attributes.COLOR_0}hasTextureCoordinates(e){return void 0!==e.attributes.TEXCOORD_0}hasTangents(e){return void 0!==e.attributes.TANGENT}async getMaterial(e,t,r){let s=e.material?this._materialCache.get(e.material):void 0;if(!s){const o=null!=e.material?v(this.json.materials[e.material]):v(),n=o.pbrMetallicRoughness,a=this.hasVertexColors(e),i=this.getTexture(n.baseColorTexture,t),u=this.getTexture(o.normalTexture,t),c=r?this.getTexture(o.occlusionTexture,t):void 0,f=r?this.getTexture(o.emissiveTexture,t):void 0,p=r?this.getTexture(n.metallicRoughnessTexture,t):void 0,d=null!=e.material?e.material:-1;s={alphaMode:o.alphaMode,alphaCutoff:o.alphaCutoff,color:n.baseColorFactor,doubleSided:!!o.doubleSided,colorTexture:await i,normalTexture:await u,name:o.name,id:d,occlusionTexture:await c,emissiveTexture:await f,emissiveFactor:o.emissiveFactor,metallicFactor:n.metallicFactor,roughnessFactor:n.roughnessFactor,metallicRoughnessTexture:await p,hasVertexColors:a,ESRI_externalColorMixMode:o.extras.ESRI_externalColorMixMode,colorTextureTransform:n?.baseColorTexture?.extensions?.KHR_texture_transform,normalTextureTransform:o.normalTexture?.extensions?.KHR_texture_transform,occlusionTextureTransform:o.occlusionTexture?.extensions?.KHR_texture_transform,emissiveTextureTransform:o.emissiveTexture?.extensions?.KHR_texture_transform,metallicRoughnessTextureTransform:n?.metallicRoughnessTexture?.extensions?.KHR_texture_transform}}return s}async getTexture(t,r){if(!t)return;this._errorContext.errorUnsupportedIf(0!==(t.texCoord||0),"Only TEXCOORD with index 0 is supported.");const s=t.index,o=this._errorContext,n=this.json.textures[s],a=D(null!=n.sampler?this.json.samplers[n.sampler]:{}),i=this._getTextureSourceId(n),u=this.json.images[i],c=await this._loadTextureImageData(s,n,r);return e(this._textureCache,s,(()=>{const e=e=>33071===e||33648===e||10497===e,t=e=>(o.error(`Unexpected TextureSampler WrapMode: ${e}. Using default REPEAT(10497).`),10497);return{data:c,wrapS:e(a.wrapS)?a.wrapS:t(a.wrapS),wrapT:e(a.wrapT)?a.wrapT:t(a.wrapT),minFilter:a.minFilter,name:u.name,id:s}}))}getNodeTransform(e){if(void 0===e)return K;let t=this._nodeTransformCache.get(e);if(!t){const r=this.getNodeTransform(this._getNodeParent(e)),s=this.json.nodes[e];s.matrix?t=u(d(),r,s.matrix):s.translation||s.rotation||s.scale?(t=m(r),s.translation&&c(t,t,s.translation),s.rotation&&(q[3]=h(q,s.rotation),f(t,t,q[3],q)),s.scale&&p(t,t,s.scale)):t=m(r),this._nodeTransformCache.set(e,t)}return t}_wrapAccessor(e,t){return new e(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*(t.entryCount-1)+t.componentByteSize*t.componentCount)}_resolveUri(e){return n(e,this._baseUri)}_getNodeParent(e){return this._nodeParentMap.get(e)}_checkVersionSupported(){const e=a.parse(this.json.asset.version,"glTF");Y.validate(e)}_checkRequiredExtensionsSupported(){const e=this.json,t=this._errorContext;if(e.extensionsRequired){e.extensionsRequired.every((e=>this._supportedExtensions.includes(e)))||t.errorUnsupported("gltf loader was not able to load unsupported feature. Required extensions: "+e.extensionsRequired.join(", "))}}_computeNodeParents(){this.json.nodes.forEach(((e,t)=>{e.children&&e.children.forEach((e=>{this._nodeParentMap.set(e,t)}))}))}async _loadTextureImageData(e,t,r){const s=this._textureLoaders.get(e);if(s)return s;const o=this._createTextureLoader(t,r);return this._textureLoaders.set(e,o),o}_getTextureSourceId(e){const t=null!==e.source;return void 0!==e.extensions&&null!==e.extensions.KHR_texture_basisu?e.extensions.KHR_texture_basisu.source:t?e.source:this._errorContext.errorUnsupported("Source is expected to be defined for a texture. It can also be omitted in favour of an KHR_texture_basisu extension tag.")}async _createTextureLoader(e,t){const r=this._getTextureSourceId(e),s=this.json.images[r];if(s.uri){if(s.uri.endsWith(".ktx2")){const e=await this._context.loadBinary(this._resolveUri(s.uri),t);return new j(new Uint8Array(e))}return this._context.loadImage(this._resolveUri(s.uri),t)}const o=this._errorContext;o.errorUnsupportedIf(null==s.bufferView,"Image bufferView must be defined."),o.errorUnsupportedIf(null==s.mimeType,"Image mimeType must be defined.");const n=this.json.bufferViews[s.bufferView],a=await this.getBuffer(n.buffer,t);o.errorUnsupportedIf(null!=n.byteStride,"byteStride not supported for image buffer");const i=a.byteOffset+(n.byteOffset||0);return F(new Uint8Array(a.buffer,i,n.byteLength),s.mimeType)}async getLoadedBuffersSize(){if(this._glbBuffer)return this._glbBuffer.byteLength;const e=await t(Array.from(this._bufferLoaders.values())),r=await t(Array.from(this._textureLoaders.values()));return e.reduce(((e,t)=>e+(t?.byteLength??0)),0)+r.reduce(((e,t)=>e+(t?P(t)?t.data.byteLength:t.width*t.height*4:0)),0)}}const K=i(d(),Math.PI/2),Y=new a(2,0,"glTF"),q=l(),J={SCALAR:1,VEC2:2,VEC3:3,VEC4:4},z={[H.BYTE]:1,[H.UNSIGNED_BYTE]:1,[H.SHORT]:2,[H.UNSIGNED_SHORT]:2,[H.FLOAT]:4,[H.UNSIGNED_INT]:4};function X(e){switch(e.componentType){case H.BYTE:return new L(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case H.UNSIGNED_BYTE:return new A(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case H.SHORT:return new U(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case H.UNSIGNED_SHORT:return new I(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case H.UNSIGNED_INT:return new S(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case H.FLOAT:return new w(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount)}}export{k as GLTFResource,K as TRANSFORM_GLTF_TO_ENGINE};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
+ */
5
+ import{TextureEncodingMimeType as e}from"../../webgl-engine/lib/basicInterfaces.js";class n{constructor(n){this.data=n,this.type="encoded-mesh-texture",this.encoding=e.KTX2_ENCODING}}function t(e){return"encoded-mesh-texture"===e?.type}async function r(e){return new Promise(((n,t)=>{const r=new Blob([e]),o=new FileReader;o.onload=()=>{const e=o.result;n(JSON.parse(e))},o.onerror=e=>{t(e)},o.readAsText(r)}))}async function o(t,r){return r===e.KTX2_ENCODING?new n(t):new Promise(((e,n)=>{const o=new Blob([t],{type:r}),s=URL.createObjectURL(o),c=new Image,d=()=>{URL.revokeObjectURL(s),"decode"in c?c.decode().then((()=>e(c)),(()=>e(c))).then(a):(e(c),a())},i=e=>{URL.revokeObjectURL(s),n(e),a()},a=()=>{c.removeEventListener("load",d),c.removeEventListener("error",i)};c.addEventListener("load",d),c.addEventListener("error",i),c.src=s}))}export{n as EncodedMeshTexture,o as imageFromBinaryData,t as isEncodedMeshTexture,r as jsonFromBinaryData};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{isNone as i,isSome as r,disposeMaybe as l,abortMaybe as s,destroyMaybe as o}from"../../../core/maybe.js";import{isAborted as a}from"../../../core/promiseUtils.js";import{whenOnce as n}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{SchemaHelper as p}from"../../2d/engine/vectorTiles/SchemaHelper.js";import m from"../../2d/engine/vectorTiles/TileHandler3D.js";import d from"../../2d/engine/vectorTiles/VTLPainter3D.js";import f from"../../2d/engine/vectorTiles/style/StyleRepository.js";import{LayerView3D as y}from"./LayerView3D.js";import{TiledLayerView3D as g}from"./TiledLayerView3D.js";import{vtlAssumes256PixelSizeAsDefault as u,test as _}from"../terrain/terrainUtils.js";import C from"../../layers/LayerView.js";let v=class extends(g(y(C))){constructor(){super(...arguments),this._tileHandlerController=null,this.type="vector-tile-3d"}initialize(){if(i(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:l,state:s,viewingMode:o}=this.view,{pixelRatio:h}=s,c="local"===o&&!u(l)||_.force512VTL,y=this.layer.tileInfo.spatialReference.isGeographic,g=c?this.layer.tileInfo:this.layer.tileInfo.getOrCreateCompatible(256,y?1:2),C=this._getTileInfoSupportError(g,this.layer.fullExtent);if(r(C))return this.addResolvingPromise(Promise.reject(C));const v=n((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const t=e.tilingScheme,i=t.pixelSize;let l;if(this.schemaHelper=new p(i,r(e.spatialReference)&&e.spatialReference.isGeographic),256===i){const e=this.layer.tileInfo.spatialReference.isGeographic;l=this.layer.tileInfo.getOrCreateCompatible(256,e?1:2)}else l=this.view.spatialReference?.isGeographic?this.layer.tileInfo.getOrCreateCompatible(512,.5):this.layer.tileInfo;const s=this._getTileInfoCompatibilityError(l,t);if(s)throw s;this.tileInfo=l}));this._tileHandlerController=new AbortController;const w=this.view.resourceController;this._memCache=w.memoryController.newCache(this.layer.uid,(e=>{e.release()}));const H=new f(this.layer.currentStyleInfo.style),j=e.mapTileRequester;this._tileHandler=new m(this.layer,H,h,this._memCache,j);const R=this._tileHandlerController.signal,T=e=>w.immediate.schedule(e),I=this._tileHandler.start({signal:R,schedule:T}),b=this._tileHandler.spriteMosaic;b.then((e=>{!a(R)&&this._tileHandler&&(this.painter=new d(e,this._tileHandler.glyphMosaic))})),I.then((()=>this._tileHandlerController=null)),this.updatingHandles.add((()=>({style:this.layer.currentStyleInfo.style,newPixelRatio:this.view.state?.pixelRatio})),(({style:e})=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const t=new f(e),i=new m(this.layer,t,h,this._memCache,j),r=i.start({signal:this._tileHandlerController.signal,schedule:T}),l=i.spriteMosaic;r.then((()=>this._tileHandlerController=null)),this.updatingHandles.addPromise(Promise.all([r,l]).then((([,e])=>{const t=this._tileHandler,r=this.painter;this.painter=new d(e,i.glyphMosaic),this._tileHandler=i,this.emit("data-changed"),t.destroy(),r&&r.dispose()})))}));const S=Promise.all([v,I,b]);this.addResolvingPromise(S)}destroy(){this.painter=l(this.painter),this._tileHandlerController=s(this._tileHandlerController),o(this._tileHandler),this._memCache=o(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([h()],v.prototype,"layer",void 0),e([h()],v.prototype,"dataLevelRange",null),e([h()],v.prototype,"updatingProgressValue",void 0),v=e([c("esri.views.3d.layers.VectorTileLayerView3D")],v);const w=v;export{w as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{isNone as i,isSome as r,disposeMaybe as l,abortMaybe as s,destroyMaybe as o}from"../../../core/maybe.js";import{isAborted as a}from"../../../core/promiseUtils.js";import{whenOnce as n}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{SchemaHelper as p}from"../../2d/engine/vectorTiles/SchemaHelper.js";import m from"../../2d/engine/vectorTiles/TileHandler3D.js";import d from"../../2d/engine/vectorTiles/VTLPainter3D.js";import f from"../../2d/engine/vectorTiles/style/StyleRepository.js";import{LayerView3D as y}from"./LayerView3D.js";import{TiledLayerView3D as g}from"./TiledLayerView3D.js";import{vtlAssumes256PixelSizeAsDefault as u,test as _}from"../terrain/terrainUtils.js";import C from"../../layers/LayerView.js";let v=class extends(g(y(C))){constructor(){super(...arguments),this._tileHandlerController=null,this.type="vector-tile-3d"}initialize(){if(i(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:l,state:s,viewingMode:o}=this.view,h="local"===o&&!u(l)||_.force512VTL,c=this.layer.tileInfo.spatialReference.isGeographic,y=h?this.layer.tileInfo:this.layer.tileInfo.getOrCreateCompatible(256,c?1:2),g=this._getTileInfoSupportError(y,this.layer.fullExtent);if(r(g))return this.addResolvingPromise(Promise.reject(g));const C=n((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const t=e.tilingScheme,i=t.pixelSize;let l;if(this.schemaHelper=new p(i,r(e.spatialReference)&&e.spatialReference.isGeographic),256===i){const e=this.layer.tileInfo.spatialReference.isGeographic;l=this.layer.tileInfo.getOrCreateCompatible(256,e?1:2)}else l=this.view.spatialReference?.isGeographic?this.layer.tileInfo.getOrCreateCompatible(512,.5):this.layer.tileInfo;const s=this._getTileInfoCompatibilityError(l,t);if(s)throw s;this.tileInfo=l}));this._tileHandlerController=new AbortController;const v=this.view.resourceController;this._memCache=v.memoryController.newCache(this.layer.uid,(e=>{e.release()}));const H=new f(this.layer.currentStyleInfo.style),w=e.mapTileRequester;this._tileHandler=new m(this.layer,H,s.contentPixelRatio,this._memCache,w);const j=this._tileHandlerController.signal,R=e=>v.immediate.schedule(e),T=this._tileHandler.start({signal:j,schedule:R}),I=this._tileHandler.spriteMosaic;I.then((e=>{!a(j)&&this._tileHandler&&(this.painter=new d(e,this._tileHandler.glyphMosaic))})),T.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 f(e),r=new m(this.layer,i,t,this._memCache,w),l=r.start({signal:this._tileHandlerController.signal,schedule:R}),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 d(e,r.glyphMosaic),this._tileHandler=r,this.emit("data-changed"),t.destroy(),i&&i.dispose()})))}));const b=Promise.all([C,T,I]);this.addResolvingPromise(b)}destroy(){this.painter=l(this.painter),this._tileHandlerController=s(this._tileHandlerController),o(this._tileHandler),this._memCache=o(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([h()],v.prototype,"layer",void 0),e([h()],v.prototype,"dataLevelRange",null),e([h()],v.prototype,"updatingProgressValue",void 0),v=e([c("esri.views.3d.layers.VectorTileLayerView3D")],v);const H=v;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.26/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{isSome as h,unwrapOr as d,isNone as p,destroyMaybe as c,removeMaybe as y,get as m,disposeMaybe as g,unwrap as u}from"../../../../core/maybe.js";import b from"../../../../core/PooledArray.js";import{throwIfAborted as _,eachAlways as f,createDeferred as v,isAbortError as C}from"../../../../core/promiseUtils.js";import{watch as S,when as w,on as G,syncAndInitial as x,whenOnce as R}from"../../../../core/reactiveUtils.js";import{schedule as P}from"../../../../core/scheduling.js";import{property as D}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as I}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as E,isEmpty as U}from"../../../../core/accessorSupport/diffUtils.js";import{s as A,a as O,g as L}from"../../../../chunks/vec3.js";import{c as j}from"../../../../chunks/vec3f64.js";import{projectVectorToVector as V,projectXYZToVector as F,canProjectWithoutEngine as T,projectBuffer as k}from"../../../../geometry/projection.js";import{create as z,center as W,fromRect as M,equals as N}from"../../../../geometry/support/aaBoundingBox.js";import{create as B}from"../../../../geometry/support/aaBoundingRect.js";import{equals as H}from"../../../../geometry/support/spatialReferenceUtils.js";import q from"../../../../layers/Layer.js";import{getObjectId as Y,computeAABB as $,hasGeometry as Z}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as J}from"../../../../layers/graphics/hydratedFeatures.js";import{isSupportedRenderer3D as Q,validateTo3D as K}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as X}from"../../../../support/arcadeOnDemand.js";import{getDefaultSymbol3D as ee}from"../../../../symbols/support/defaults3D.js";import{to3D as ie}from"../../../../symbols/support/symbolConversion.js";import{ViewElevationProvider as te}from"./ElevationQuery.js";import{VisibilityFlag as re,VisibilityGroup as se}from"./enums.js";import{extractExpressionInfo as ae,createContext as ne}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as oe}from"./Graphics3DFeatureStore.js";import le from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as he}from"./Graphics3DSymbolCreationContext.js";import{make as de}from"./Graphics3DSymbolFactory.js";import pe from"./Graphics3DWebStyleSymbol.js";import{GraphicStateTracking as ce}from"./GraphicStateTracking.js";import{computeCentroid as ye}from"./graphicUtils.js";import{ApplyRendererDiffResult as me}from"./interfaces.js";import{LoadStatus as ge}from"./Loadable.js";import{SpatialIndex2D as ue}from"./SpatialIndex2D.js";import{averageSymbolComplexities as be,defaultSymbolComplexity as _e}from"./symbolComplexity.js";import{StageLayerElevationProvider as fe}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as ve}from"../../support/extentUtils.js";import{PropertiesPool as Ce}from"../../support/PropertiesPool.js";import{UpdatePolicy as Se}from"../../webgl-engine/lib/basicInterfaces.js";import{GridLocalOriginFactory as we}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{WebGLLayer as Ge}from"../../webgl-engine/lib/WebGLLayer.js";import{ImmediateTask as xe,noBudget as Re,TaskPriority as Pe,Task as De}from"../../../support/Scheduler.js";import Ie from"../../../../geometry/Extent.js";import Ee from"../../../../geometry/Point.js";import Ue from"../../../../symbols/LabelSymbol3D.js";import Ae from"../../../../symbols/TextSymbol.js";import Oe from"../../../../symbols/WebStyleSymbol.js";var Le;const je=j(),Ve=z(),Fe="esri.views.3d.layers.graphics.Graphics3DCore",Te=n.getLogger(Fe);let ke=Le=class extends t{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ue({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 h(this.currentRenderer)&&"dictionary"===this.currentRenderer.type?Se.ASYNC:d(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||h(this._scaleVisibility)&&this._scaleVisibility.updating||h(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,h(s)?s.primitivesPerFeature:1),n=h(s)&&s.drawCallsPerFeature>0?t/s.drawCallsPerFeature*.3:t,o=Math.ceil(r/a),l=Math.max(i,Math.min(t,o,n)),d=this._get("displayFeatureLimit");return d&&d.minimumTotalNumberOfFeatures===i&&d.maximumTotalNumberOfFeatures===t&&d.maximumTotalNumberOfPrimitives===r&&d.averageSymbolComplexity===s&&d.maximumNumberOfFeatures===l?d:{minimumTotalNumberOfFeatures:i,maximumTotalNumberOfFeatures:t,maximumTotalNumberOfPrimitives:r,averageSymbolComplexity:s,maximumNumberOfFeatures:l}}get averageSymbolComplexity(){const e=be(this._symbolComplexities),i=this._get("averageSymbolComplexity");return 0===e.numComplexities||h(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=h(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(h(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(h(i))return i;const t=ie(e,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(e)}),r=t.symbol||null;return p(r)&&t.error&&Te.error(t.error.message),this._symbolConversionCache.set(e.id,r),r}_getSymbolComplexitiesUsedOrRenderer(e){if(p(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);h(s)&&r.push(s);for(const a of i){const e=this._getSymbolComplexityUsedOrRenderer(a);h(e)&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(p(e))return null;const i=this._symbols.get(e.id);if(h(i))return i.complexity;const t=this._getConvertedSymbol(e);return h(t)?_e(t):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((i=>{h(i)&&e.push(i.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new Ce({computedExtent:Ie},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=xe,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 b({allocator:e=>e||new We,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new b,this.preferredUpdatePolicy=Se.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 he(e.owner.view.resourceController.scheduler,((e,i)=>this._frameTask.schedule(e,i)))}initialize(){this._featureStore=new oe({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(h(i.elevationAlignment)){const t=i.elevationAlignment(this,e);this._elevationAlignment=t}if(h(i.scaleVisibility)){const t=i.scaleVisibility(this,e);this._scaleVisibility=t}if(h(i.filterVisibility)){const e=i.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(re.FILTER,e(Y(i.graphic,this._objectIdField)),se.GRAPHIC))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(re.FILTER,e,se.GRAPHIC))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(re.FILTER)))});this._filterVisibility=e}if(h(i.deconflictor)){const e=i.deconflictor(this);this._deconflictor=e}if(h(i.labeler)&&h(this._scaleVisibility)){const e=i.labeler(this,this._scaleVisibility);this._labeler=e}if(h(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 te(this._viewSpatialReference,i),this._initializeStage(i,this.layer.uid);const t=i.sharedSymbolResources;this.symbolCreationContext.sharedResources=t,this._sharedSymbolResourcesOwnerHandle=t.addGraphicsOwner(this.owner),h(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 we(i.renderSpatialReference),this.symbolCreationContext.elevationProvider=i.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=ae(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await ne(r,this._viewSpatialReference,e,Te),_(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([S((()=>this.suspendedOrOutsideOfView),(()=>this._frameTask.reschedule((()=>this._updateLayerVisibility())))),S((()=>[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())})),S((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),S((()=>this.owner.view.state?.idlePixelRatio),(()=>this._pixelRatioChange())),S((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),S((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),w((()=>i.basemapTerrain?.tilingScheme),(e=>{if(!e.spatialReference.equals(this.symbolCreationContext.overlaySR)&&h(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([G(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),S((()=>this.effectiveUpdatePolicy),(e=>{h(this.stageLayer)&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===Se.ASYNC,e===Se.SYNC&&this.runTask(Re)}),x)]),this._frameTask=i.resourceController.scheduler.registerTask(Pe.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this._handles.add(S((()=>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=xe,this.owner.view.deconflictor.removeGraphicsOwner(this),this.owner.view.labeler.removeGraphicsOwner(this),this._elevationAlignment=c(this._elevationAlignment),this._scaleVisibility=c(this._scaleVisibility),this._filterVisibility=c(this._filterVisibility),this._deconflictor=null,this._labeler=null,this._objectStates=c(this._objectStates),this.clear(),this._featureStore=c(this._featureStore),this._updatingPendingLoadedGraphicsChange=y(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=c(this._graphicStateTracking),this.stage&&(this.stage.remove(this.stageLayer),this.stageLayer=null,this.stage=null),this._handles=c(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=y(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=c(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=c(this._spatialIndex)}clear(){this._objectStates?.allGraphicsDeleted(),h(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(c),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 Ge({pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},i),this.stage.add(this.stageLayer);const t=this.stageLayer.events;t.on("objectTransformation",(e=>this.notifyGraphicGeometryChanged(e.metadata.graphicUid))),t.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.metadata.graphicUid))),t.on("objectGeometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.metadata.graphicUid))),t.on("objectGeometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.metadata.graphicUid))),t.on("objectGeometryUpdated",(e=>this.notifyGraphicGeometryChanged(e.object.metadata.graphicUid)))}notifyGraphicGeometryChanged(e){if(p(this._graphicStateTracking)||p(e))return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicGeometry(i)}notifyGraphicVisibilityChanged(e){if(p(this._graphicStateTracking)||p(e))return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicVisibility(i)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,i=this._numberOfGraphics>e*Me,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 Y(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);h(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 f([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(h(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 De.YIELD}setObjectIdVisibility(e,i){i?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const t=this._findGraphics3DGraphicByObjectId(e);h(t)&&this._updateUserVisibility(t)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(i=>this._getGraphicObjectID(i.graphic)===e))}_updateUserVisibility(e){if(p(e))return!1;const i=e.graphic,t=this._getGraphicObjectID(i),r=i.visible&&!this.owner.suspended&&(p(t)||!this._objectIdInvisibleSet.has(t));return e.setVisibilityFlag(re.USER_SETTING,r,se.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=v();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)=>k(e,r,i,e,t,i,s),n=(e,i,r)=>k(e,s,i,e,t,i,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:!!h(i)&&!!i.useViewElevation,minDemResolution:h(i)?i.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,m(i,"signal"));if(!l)return null;const p=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){W(p,je);const i=d(e.getElevation(je[0],je[1],0,t,"ground"),0);p[2]=Math.min(p[2],i),p[5]=Math.max(p[5],i)}}return{boundingBox:p,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,i){await R((()=>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;A(Ne,0,0,0);let s=0;if(r.render.num>0){if(!V(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,Be,i))return null;O(Ne,Ne,Be),s++}if(r.draped.num>0){const[e,t]=r.draped.origin,a=d(this._viewElevationProvider.getElevation(e,t,"ground"),0);if(A(Be,e,t,a),!V(Be,this._viewElevationProvider.spatialReference,Be,i))return null;O(Ne,Ne,Be),s++}return s>1&&L(Ne,Ne,1/s),new Ee({x:Ne[0],y:Ne[1],z:Ne[2],spatialReference:i})}getSymbolLayerSize(e,i){const t=this._symbols.get(e.id);if(p(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(p(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(!p(t)||!p(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(p(t))return void this._recreateGraphic(i.graphic);if(p(e)){const e=i.graphic.symbol&&i.graphic.symbol.id;if(e){const i=this._symbols.get(e);if(h(i)&&i.loadStatus===ge.LOADING)return}return void this._recreateGraphic(i.graphic)}const r=e.graphics3DSymbol;!p(i.newValue)&&r.updateGeometry(e,i.newValue)||this._recreateGraphic(e.graphic),this._expandComputedExtent(t)}_graphicUpdateSymbolHandler(e,i){const t=i.graphic,r=h(e)?e.graphics3DSymbol:h(i.oldValue)?this._symbols.get(i.oldValue.id):null;if(p(r)||p(i.newValue))return void this._recreateGraphic(t);const s=r.symbol,a=this._getConvertedSymbol(i.newValue);if(h(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=E(s,a);if(p(o))return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!U(l.diff))return void this._recreateGraphic(t);const d=this._getRenderingInfo(t);if(p(d))return void this._recreateGraphic(t);const c=r.extentPadding;for(const h of l.symbolStatePatches)h();if(c!==r.extentPadding&&this._recomputeExtentPadding(),h(e))for(const h of l.graphics3DGraphicPatches)h(e,d);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===Se.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=>{h(i)&&(e=Math.max(e,i.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const i=Ve,t=e.spatialReference;$(e,i);const r=this._viewSpatialReference,s=Le.tmpVec;if(H(t,r)||F(i[0],i[1],0,t,s,r)&&(i[0]=s[0],i[1]=s[1],F(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=ae(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await ne(i,this._viewSpatialReference,e.signal,Te),_(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=g(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new fe({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),h(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=g(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);c(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),h(this._graphicStateTracking)&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain&&this.owner.view.basemapTerrain.tilingScheme?(this._updatePolicyForGraphics(e)===Se.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("updating")):Te.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===Se.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const i of e)if(h(i.geometry)&&"mesh"===i.geometry.type&&!i.geometry.loaded)return Se.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const i of e)this._addGraphic(i,this._getRenderingInfo(i,Te),Se.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!==ze.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===Se.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===ze.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)&&Te.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===ze.NEW&&this._processPendingUpdateNew(t);let r=this.effectiveUpdatePolicy;if(!t.remove||t.add&&t.state!==ze.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,r=Se.SYNC),t.add)switch(t.state){case ze.READY:this._addGraphic(t.add,t.renderingInfo,r),t.add=null,this._pendingAdds--,e.madeProgress();break;case ze.REJECTED:t.add=null,this._pendingAdds--;case ze.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=ze.READY);const i=e.add.geometry;h(i)&&"mesh"===i.type&&!i.loaded?this._processPendingUpdateNewMesh(e,i):this._processPendingUpdateNewRenderingInfo(e)}async _processPendingUpdateNewMesh(e,i){e.state=ze.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,C(i)?e.state=ze.NEW:e.state=ze.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(p(this.layer.renderer)||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add,Te),void(e.state=ze.READY);e.state=ze.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(C(t)?e.state=ze.NEW:e.state=ze.REJECTED)}p(i)||p(i.symbol)?(Te&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Te.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=i,e.state=ze.READY}_addGraphic(e,i,t){if(this._graphicsWithoutSymbol.set(e.uid,e),p(i)||p(i.symbol)||!Z(e))return;h(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(p(s))return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new le(e,i,this.layer);let o=!1;const l=e=>{e===s.symbol.id&&(o=!0)};this._whenSymbolRemoved.push(l);const d=()=>{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&&h(i)&&this._spatialIndex.add(i),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()},c=i=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(C(i)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,t===Se.ASYNC?s.load((()=>this._frameTask.schedule(d)),(e=>this._frameTask.schedule((()=>c(e))))):s.load(d,c)}_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 Ue||e instanceof Ae){const i=this.symbolCreationContext.layer;return!!i.labelingInfo&&i.labelingInfo.some((i=>i.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof Ue&&!this._hasLabelingContext(e))||(Te.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(p(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(!T(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&&h(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?J(e,this.layer):e;let s;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||h(this.currentRenderer)))s=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{s={symbol:r.symbol||ee(r.geometry)}}return p(s)||p(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){const t=e.geometry;if(p(t))return Te&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,Te.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&h(e.symbol))return Te&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Te.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?J(e,this.layer):e;return this.owner.getRenderingInfoAsync(r,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(h(i)&&"backgroundFillSymbol"in i&&i.backgroundFillSymbol){const e=ie(i.backgroundFillSymbol,{ignoreDrivers:!0});h(e.symbol)&&"web-style"!==e.symbol.type&&"cim"!==e.symbol.type&&(r=e.symbol.symbolLayers)}const s=de(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 Oe?new pe(e,(e=>this._frameTask.schedule(e)),(e=>this._createGraphics3DSymbol(e,i))):this._createGraphics3DSymbol(e,i),this._symbols.set(e.id,t)),h(t)&&++t.referenced,t}trackGraphicState(e){return p(this._graphicStateTracking)&&(this._graphicStateTracking=new ce(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(p(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,h(t.geometry)&&"point"!==t.geometry.type&&(r.centroid=ye(t.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),h(this._scaleVisibility)&&this._scaleVisibility.updateVisibility(r),h(this._filterVisibility)){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(re.FILTER,e,se.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.stage,this.stageLayer,this.owner),h(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),p(e)&&this._currentRendererChange(null,!1),Q(e))if(h(e)&&e.arcadeRequired){const i=new AbortController;this._rendererChangeAbortController=i;const{arcadeUtils:t}=await this._ensureArcade();_(i);const r=t.hasGeometryOperations(e);r&&(await t.enableGeometryOperations(),_(i)),this.effectiveUpdatePolicy===Se.ASYNC?await this._frameTask.schedule((()=>this._currentRendererChange(e,r)),i.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===Se.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 p(this._arcadeOnDemand)?(this._arcadeOnDemand=await X(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,i){this.currentRenderer=e,this.rendererHasGeometryOperations=i,this.symbolCreationContext.arcade=u(this._arcadeOnDemand);const t=this.symbolCreationContext.renderer;if(e===t)return;if(this._symbolConversionCache.clear(),p(e))return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=E(t,e);this._updateUnchangedSymbolMappings(r,e,t),this.symbolCreationContext.renderer=e,p(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 q?this.layer:null,h=u(this._arcadeOnDemand);if(s===t.defaultSymbol&&t.getSymbol(J(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(h):[],n=s?s.removed.map((e=>e.symbol)).filter(h):[];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||h(e)&&"partial"!==e.type)return[];const r=e=>h(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=h(i)&&i?"string"==typeof i?i:i.id:null;if(p(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),h(s))){const e="string"==typeof i?null:i;h(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(h(r))switch(r.applyRendererDiff(e,t)){case me.Recreate_Symbol:this._recreateSymbol(i);break;case me.Recreate_Graphics:this._recreateGraphicsForSymbol(i);case me.Fast_Update:}}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)=>this._recreateSymbol(t)))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("pixelRatio",i)||this._recreateSymbol(t)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=P((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,i){const t=this.symbolCreationContext.clippingExtent,r=B();return ve(e,r,i)?this.symbolCreationContext.clippingExtent=M(z(),r):this.symbolCreationContext.clippingExtent=null,!N(this.symbolCreationContext.clippingExtent,t)}modifyGraphics3DGraphicVisibilities(e){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(p(t))return;e(t,this._graphicsBySymbol.get(i)||He,i)}}updateAllGraphicsVisibility(){h(this._filterVisibility)&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const i=this._updateUserVisibility(e),t=h(this._scaleVisibility)&&this._scaleVisibility.updateVisibility(e);return i||t}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(re.USER_SETTING,!1,se.GRAPHIC)))}_validateRenderer(e){const i=K(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`;Te.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(p(i)||i.referenced>0)return;const r=this._graphicsBySymbol.get(t);r&&0!==r.size||(this._graphicsBySymbol.delete(t),this._symbols.delete(t),c(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 ze;ke.tmpVec=j(),e([D({readOnly:!0})],ke.prototype,"computedExtent",void 0),e([D()],ke.prototype,"currentRenderer",void 0),e([D()],ke.prototype,"rendererHasGeometryOperations",void 0),e([D()],ke.prototype,"_frameTask",void 0),e([D({readOnly:!0})],ke.prototype,"_viewSpatialReference",null),e([D()],ke.prototype,"_rendererChangeAbortController",void 0),e([D()],ke.prototype,"_elevationInfoChangeAbortController",void 0),e([D()],ke.prototype,"_initializeAbortController",void 0),e([D()],ke.prototype,"_elevationAlignment",void 0),e([D()],ke.prototype,"_scaleVisibility",void 0),e([D()],ke.prototype,"_filterVisibility",void 0),e([D()],ke.prototype,"_initializePromise",void 0),e([D()],ke.prototype,"_spatialIndex",void 0),e([D({readOnly:!0})],ke.prototype,"extentPadding",void 0),e([D()],ke.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([D()],ke.prototype,"_featureStore",void 0),e([D()],ke.prototype,"_deconflictor",void 0),e([D()],ke.prototype,"_labeler",void 0),e([D()],ke.prototype,"_objectStates",void 0),e([D()],ke.prototype,"_loadingSymbols",void 0),e([D()],ke.prototype,"preferredUpdatePolicy",void 0),e([D()],ke.prototype,"_forcedUpdatePolicy",void 0),e([D({readOnly:!0})],ke.prototype,"effectiveUpdatePolicy",null),e([D({constructOnly:!0})],ke.prototype,"elevationFeatureExpressionEnabled",void 0),e([D({constructOnly:!0})],ke.prototype,"owner",void 0),e([D({constructOnly:!0})],ke.prototype,"layer",void 0),e([D({constructOnly:!0})],ke.prototype,"graphicSymbolSupported",void 0),e([D({constructOnly:!0})],ke.prototype,"getRenderingInfoWithoutRenderer",void 0),e([D({constructOnly:!0})],ke.prototype,"componentFactories",void 0),e([D({constructOnly:!0})],ke.prototype,"setUidToIdOnAdd",void 0),e([D()],ke.prototype,"featureStore",null),e([D()],ke.prototype,"initializePromise",null),e([D()],ke.prototype,"scaleVisibility",null),e([D()],ke.prototype,"elevationAlignment",null),e([D()],ke.prototype,"objectStates",null),e([D()],ke.prototype,"filterVisibility",null),e([D({readOnly:!0})],ke.prototype,"updating",null),e([D({readOnly:!0})],ke.prototype,"running",null),e([D({readOnly:!0})],ke.prototype,"suspendedOrOutsideOfView",null),e([D({readOnly:!0,dependsOn:[]})],ke.prototype,"updatingRemaining",null),e([D({readOnly:!0,dependsOn:["owner.view.qualitySettings.graphics3D.maxTotalNumberOfPrimitives","owner.view.qualitySettings.graphics3D.maxTotalNumberOfFeatures","averageSymbolComplexity"]})],ke.prototype,"displayFeatureLimit",null),e([D({readOnly:!0,dependsOn:[]})],ke.prototype,"averageSymbolComplexity",null),e([D({constructOnly:!0})],ke.prototype,"hasZ",void 0),e([D({constructOnly:!0})],ke.prototype,"hasM",void 0),e([D()],ke.prototype,"_objectIdField",null),ke=Le=e([I(Fe)],ke),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(ze||(ze={}));class We{constructor(){this.add=null,this.renderingInfo=null,this.state=ze.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=ze.NEW,this.abortController=null,this.remove=null}}const Me=10,Ne=j(),Be=j(),He=new Map;export{ke 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{isSome as h,unwrapOr as d,isNone as p,destroyMaybe as c,removeMaybe as y,get as m,disposeMaybe as g,unwrap as u}from"../../../../core/maybe.js";import b from"../../../../core/PooledArray.js";import{throwIfAborted as _,eachAlways as f,createDeferred as v,isAbortError as C}from"../../../../core/promiseUtils.js";import{watch as S,when as w,on as G,syncAndInitial as x,whenOnce as R}from"../../../../core/reactiveUtils.js";import{schedule as P}from"../../../../core/scheduling.js";import{property as D}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as I}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as E,isEmpty as U}from"../../../../core/accessorSupport/diffUtils.js";import{s as A,a as O,g as L}from"../../../../chunks/vec3.js";import{c as j}from"../../../../chunks/vec3f64.js";import{projectVectorToVector as V,projectXYZToVector as F,canProjectWithoutEngine as T,projectBuffer as k}from"../../../../geometry/projection.js";import{create as z,center as W,fromRect as M,equals as N}from"../../../../geometry/support/aaBoundingBox.js";import{create as B}from"../../../../geometry/support/aaBoundingRect.js";import{equals as H}from"../../../../geometry/support/spatialReferenceUtils.js";import q from"../../../../layers/Layer.js";import{getObjectId as Y,computeAABB as $,hasGeometry as Z}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as J}from"../../../../layers/graphics/hydratedFeatures.js";import{isSupportedRenderer3D as Q,validateTo3D as K}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as X}from"../../../../support/arcadeOnDemand.js";import{getDefaultSymbol3D as ee}from"../../../../symbols/support/defaults3D.js";import{to3D as ie}from"../../../../symbols/support/symbolConversion.js";import{ViewElevationProvider as te}from"./ElevationQuery.js";import{VisibilityFlag as re,VisibilityGroup as se}from"./enums.js";import{extractExpressionInfo as ae,createContext as ne}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as oe}from"./Graphics3DFeatureStore.js";import le from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as he}from"./Graphics3DSymbolCreationContext.js";import{make as de}from"./Graphics3DSymbolFactory.js";import pe from"./Graphics3DWebStyleSymbol.js";import{GraphicStateTracking as ce}from"./GraphicStateTracking.js";import{computeCentroid as ye}from"./graphicUtils.js";import{ApplyRendererDiffResult as me}from"./interfaces.js";import{LoadStatus as ge}from"./Loadable.js";import{SpatialIndex2D as ue}from"./SpatialIndex2D.js";import{averageSymbolComplexities as be,defaultSymbolComplexity as _e}from"./symbolComplexity.js";import{StageLayerElevationProvider as fe}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as ve}from"../../support/extentUtils.js";import{PropertiesPool as Ce}from"../../support/PropertiesPool.js";import{UpdatePolicy as Se}from"../../webgl-engine/lib/basicInterfaces.js";import{GridLocalOriginFactory as we}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{WebGLLayer as Ge}from"../../webgl-engine/lib/WebGLLayer.js";import{ImmediateTask as xe,noBudget as Re,TaskPriority as Pe,Task as De}from"../../../support/Scheduler.js";import Ie from"../../../../geometry/Extent.js";import Ee from"../../../../geometry/Point.js";import Ue from"../../../../symbols/LabelSymbol3D.js";import Ae from"../../../../symbols/TextSymbol.js";import Oe from"../../../../symbols/WebStyleSymbol.js";var Le;const je=j(),Ve=z(),Fe="esri.views.3d.layers.graphics.Graphics3DCore",Te=n.getLogger(Fe);let ke=Le=class extends t{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ue({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 h(this.currentRenderer)&&"dictionary"===this.currentRenderer.type?Se.ASYNC:d(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||h(this._scaleVisibility)&&this._scaleVisibility.updating||h(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,h(s)?s.primitivesPerFeature:1),n=h(s)&&s.drawCallsPerFeature>0?t/s.drawCallsPerFeature*.3:t,o=Math.ceil(r/a),l=Math.max(i,Math.min(t,o,n)),d=this._get("displayFeatureLimit");return d&&d.minimumTotalNumberOfFeatures===i&&d.maximumTotalNumberOfFeatures===t&&d.maximumTotalNumberOfPrimitives===r&&d.averageSymbolComplexity===s&&d.maximumNumberOfFeatures===l?d:{minimumTotalNumberOfFeatures:i,maximumTotalNumberOfFeatures:t,maximumTotalNumberOfPrimitives:r,averageSymbolComplexity:s,maximumNumberOfFeatures:l}}get averageSymbolComplexity(){const e=be(this._symbolComplexities),i=this._get("averageSymbolComplexity");return 0===e.numComplexities||h(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=h(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(h(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(h(i))return i;const t=ie(e,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(e)}),r=t.symbol||null;return p(r)&&t.error&&Te.error(t.error.message),this._symbolConversionCache.set(e.id,r),r}_getSymbolComplexitiesUsedOrRenderer(e){if(p(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);h(s)&&r.push(s);for(const a of i){const e=this._getSymbolComplexityUsedOrRenderer(a);h(e)&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(p(e))return null;const i=this._symbols.get(e.id);if(h(i))return i.complexity;const t=this._getConvertedSymbol(e);return h(t)?_e(t):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((i=>{h(i)&&e.push(i.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new Ce({computedExtent:Ie},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=xe,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 b({allocator:e=>e||new We,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new b,this.preferredUpdatePolicy=Se.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 he(e.owner.view.resourceController.scheduler,((e,i)=>this._frameTask.schedule(e,i)))}initialize(){this._featureStore=new oe({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(h(i.elevationAlignment)){const t=i.elevationAlignment(this,e);this._elevationAlignment=t}if(h(i.scaleVisibility)){const t=i.scaleVisibility(this,e);this._scaleVisibility=t}if(h(i.filterVisibility)){const e=i.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(re.FILTER,e(Y(i.graphic,this._objectIdField)),se.GRAPHIC))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(re.FILTER,e,se.GRAPHIC))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(re.FILTER)))});this._filterVisibility=e}if(h(i.deconflictor)){const e=i.deconflictor(this);this._deconflictor=e}if(h(i.labeler)&&h(this._scaleVisibility)){const e=i.labeler(this,this._scaleVisibility);this._labeler=e}if(h(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 te(this._viewSpatialReference,i),this._initializeStage(i,this.layer.uid);const t=i.sharedSymbolResources;this.symbolCreationContext.sharedResources=t,this._sharedSymbolResourcesOwnerHandle=t.addGraphicsOwner(this.owner),h(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 we(i.renderSpatialReference),this.symbolCreationContext.elevationProvider=i.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=ae(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await ne(r,this._viewSpatialReference,e,Te),_(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([S((()=>this.suspendedOrOutsideOfView),(()=>this._frameTask.reschedule((()=>this._updateLayerVisibility())))),S((()=>[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())})),S((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),S((()=>this.owner.view.state?.rasterPixelRatio),(()=>this._pixelRatioChange())),S((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),S((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),w((()=>i.basemapTerrain?.tilingScheme),(e=>{if(!e.spatialReference.equals(this.symbolCreationContext.overlaySR)&&h(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([G(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),S((()=>this.effectiveUpdatePolicy),(e=>{h(this.stageLayer)&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===Se.ASYNC,e===Se.SYNC&&this.runTask(Re)}),x)]),this._frameTask=i.resourceController.scheduler.registerTask(Pe.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this._handles.add(S((()=>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=xe,this.owner.view.deconflictor.removeGraphicsOwner(this),this.owner.view.labeler.removeGraphicsOwner(this),this._elevationAlignment=c(this._elevationAlignment),this._scaleVisibility=c(this._scaleVisibility),this._filterVisibility=c(this._filterVisibility),this._deconflictor=null,this._labeler=null,this._objectStates=c(this._objectStates),this.clear(),this._featureStore=c(this._featureStore),this._updatingPendingLoadedGraphicsChange=y(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=c(this._graphicStateTracking),this.stage&&(this.stage.remove(this.stageLayer),this.stageLayer=null,this.stage=null),this._handles=c(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=y(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=c(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=c(this._spatialIndex)}clear(){this._objectStates?.allGraphicsDeleted(),h(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(c),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 Ge({pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},i),this.stage.add(this.stageLayer);const t=this.stageLayer.events;t.on("objectTransformation",(e=>this.notifyGraphicGeometryChanged(e.metadata.graphicUid))),t.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.metadata.graphicUid))),t.on("objectGeometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.metadata.graphicUid))),t.on("objectGeometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.metadata.graphicUid))),t.on("objectGeometryUpdated",(e=>this.notifyGraphicGeometryChanged(e.object.metadata.graphicUid)))}notifyGraphicGeometryChanged(e){if(p(this._graphicStateTracking)||p(e))return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicGeometry(i)}notifyGraphicVisibilityChanged(e){if(p(this._graphicStateTracking)||p(e))return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicVisibility(i)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,i=this._numberOfGraphics>e*Me,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 Y(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);h(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 f([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(h(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 De.YIELD}setObjectIdVisibility(e,i){i?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const t=this._findGraphics3DGraphicByObjectId(e);h(t)&&this._updateUserVisibility(t)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(i=>this._getGraphicObjectID(i.graphic)===e))}_updateUserVisibility(e){if(p(e))return!1;const i=e.graphic,t=this._getGraphicObjectID(i),r=i.visible&&!this.owner.suspended&&(p(t)||!this._objectIdInvisibleSet.has(t));return e.setVisibilityFlag(re.USER_SETTING,r,se.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=v();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)=>k(e,r,i,e,t,i,s),n=(e,i,r)=>k(e,s,i,e,t,i,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:!!h(i)&&!!i.useViewElevation,minDemResolution:h(i)?i.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,m(i,"signal"));if(!l)return null;const p=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){W(p,je);const i=d(e.getElevation(je[0],je[1],0,t,"ground"),0);p[2]=Math.min(p[2],i),p[5]=Math.max(p[5],i)}}return{boundingBox:p,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,i){await R((()=>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;A(Ne,0,0,0);let s=0;if(r.render.num>0){if(!V(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,Be,i))return null;O(Ne,Ne,Be),s++}if(r.draped.num>0){const[e,t]=r.draped.origin,a=d(this._viewElevationProvider.getElevation(e,t,"ground"),0);if(A(Be,e,t,a),!V(Be,this._viewElevationProvider.spatialReference,Be,i))return null;O(Ne,Ne,Be),s++}return s>1&&L(Ne,Ne,1/s),new Ee({x:Ne[0],y:Ne[1],z:Ne[2],spatialReference:i})}getSymbolLayerSize(e,i){const t=this._symbols.get(e.id);if(p(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(p(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(!p(t)||!p(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(p(t))return void this._recreateGraphic(i.graphic);if(p(e)){const e=i.graphic.symbol&&i.graphic.symbol.id;if(e){const i=this._symbols.get(e);if(h(i)&&i.loadStatus===ge.LOADING)return}return void this._recreateGraphic(i.graphic)}const r=e.graphics3DSymbol;!p(i.newValue)&&r.updateGeometry(e,i.newValue)||this._recreateGraphic(e.graphic),this._expandComputedExtent(t)}_graphicUpdateSymbolHandler(e,i){const t=i.graphic,r=h(e)?e.graphics3DSymbol:h(i.oldValue)?this._symbols.get(i.oldValue.id):null;if(p(r)||p(i.newValue))return void this._recreateGraphic(t);const s=r.symbol,a=this._getConvertedSymbol(i.newValue);if(h(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=E(s,a);if(p(o))return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!U(l.diff))return void this._recreateGraphic(t);const d=this._getRenderingInfo(t);if(p(d))return void this._recreateGraphic(t);const c=r.extentPadding;for(const h of l.symbolStatePatches)h();if(c!==r.extentPadding&&this._recomputeExtentPadding(),h(e))for(const h of l.graphics3DGraphicPatches)h(e,d);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===Se.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=>{h(i)&&(e=Math.max(e,i.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const i=Ve,t=e.spatialReference;$(e,i);const r=this._viewSpatialReference,s=Le.tmpVec;if(H(t,r)||F(i[0],i[1],0,t,s,r)&&(i[0]=s[0],i[1]=s[1],F(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=ae(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await ne(i,this._viewSpatialReference,e.signal,Te),_(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=g(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new fe({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),h(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=g(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);c(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),h(this._graphicStateTracking)&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain&&this.owner.view.basemapTerrain.tilingScheme?(this._updatePolicyForGraphics(e)===Se.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("updating")):Te.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===Se.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const i of e)if(h(i.geometry)&&"mesh"===i.geometry.type&&!i.geometry.loaded)return Se.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const i of e)this._addGraphic(i,this._getRenderingInfo(i,Te),Se.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!==ze.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===Se.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===ze.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)&&Te.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===ze.NEW&&this._processPendingUpdateNew(t);let r=this.effectiveUpdatePolicy;if(!t.remove||t.add&&t.state!==ze.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,r=Se.SYNC),t.add)switch(t.state){case ze.READY:this._addGraphic(t.add,t.renderingInfo,r),t.add=null,this._pendingAdds--,e.madeProgress();break;case ze.REJECTED:t.add=null,this._pendingAdds--;case ze.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=ze.READY);const i=e.add.geometry;h(i)&&"mesh"===i.type&&!i.loaded?this._processPendingUpdateNewMesh(e,i):this._processPendingUpdateNewRenderingInfo(e)}async _processPendingUpdateNewMesh(e,i){e.state=ze.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,C(i)?e.state=ze.NEW:e.state=ze.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(p(this.layer.renderer)||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add,Te),void(e.state=ze.READY);e.state=ze.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(C(t)?e.state=ze.NEW:e.state=ze.REJECTED)}p(i)||p(i.symbol)?(Te&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Te.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=i,e.state=ze.READY}_addGraphic(e,i,t){if(this._graphicsWithoutSymbol.set(e.uid,e),p(i)||p(i.symbol)||!Z(e))return;h(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(p(s))return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new le(e,i,this.layer);let o=!1;const l=e=>{e===s.symbol.id&&(o=!0)};this._whenSymbolRemoved.push(l);const d=()=>{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&&h(i)&&this._spatialIndex.add(i),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()},c=i=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(C(i)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,t===Se.ASYNC?s.load((()=>this._frameTask.schedule(d)),(e=>this._frameTask.schedule((()=>c(e))))):s.load(d,c)}_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 Ue||e instanceof Ae){const i=this.symbolCreationContext.layer;return!!i.labelingInfo&&i.labelingInfo.some((i=>i.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof Ue&&!this._hasLabelingContext(e))||(Te.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(p(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(!T(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&&h(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?J(e,this.layer):e;let s;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||h(this.currentRenderer)))s=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{s={symbol:r.symbol||ee(r.geometry)}}return p(s)||p(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){const t=e.geometry;if(p(t))return Te&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,Te.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&h(e.symbol))return Te&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Te.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?J(e,this.layer):e;return this.owner.getRenderingInfoAsync(r,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(h(i)&&"backgroundFillSymbol"in i&&i.backgroundFillSymbol){const e=ie(i.backgroundFillSymbol,{ignoreDrivers:!0});h(e.symbol)&&"web-style"!==e.symbol.type&&"cim"!==e.symbol.type&&(r=e.symbol.symbolLayers)}const s=de(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 Oe?new pe(e,(e=>this._frameTask.schedule(e)),(e=>this._createGraphics3DSymbol(e,i))):this._createGraphics3DSymbol(e,i),this._symbols.set(e.id,t)),h(t)&&++t.referenced,t}trackGraphicState(e){return p(this._graphicStateTracking)&&(this._graphicStateTracking=new ce(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(p(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,h(t.geometry)&&"point"!==t.geometry.type&&(r.centroid=ye(t.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),h(this._scaleVisibility)&&this._scaleVisibility.updateVisibility(r),h(this._filterVisibility)){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(re.FILTER,e,se.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.stage,this.stageLayer,this.owner),h(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),p(e)&&this._currentRendererChange(null,!1),Q(e))if(h(e)&&e.arcadeRequired){const i=new AbortController;this._rendererChangeAbortController=i;const{arcadeUtils:t}=await this._ensureArcade();_(i);const r=t.hasGeometryOperations(e);r&&(await t.enableGeometryOperations(),_(i)),this.effectiveUpdatePolicy===Se.ASYNC?await this._frameTask.schedule((()=>this._currentRendererChange(e,r)),i.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===Se.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 p(this._arcadeOnDemand)?(this._arcadeOnDemand=await X(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,i){this.currentRenderer=e,this.rendererHasGeometryOperations=i,this.symbolCreationContext.arcade=u(this._arcadeOnDemand);const t=this.symbolCreationContext.renderer;if(e===t)return;if(this._symbolConversionCache.clear(),p(e))return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=E(t,e);this._updateUnchangedSymbolMappings(r,e,t),this.symbolCreationContext.renderer=e,p(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 q?this.layer:null,h=u(this._arcadeOnDemand);if(s===t.defaultSymbol&&t.getSymbol(J(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(h):[],n=s?s.removed.map((e=>e.symbol)).filter(h):[];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||h(e)&&"partial"!==e.type)return[];const r=e=>h(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=h(i)&&i?"string"==typeof i?i:i.id:null;if(p(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),h(s))){const e="string"==typeof i?null:i;h(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(h(r))switch(r.applyRendererDiff(e,t)){case me.Recreate_Symbol:this._recreateSymbol(i);break;case me.Recreate_Graphics:this._recreateGraphicsForSymbol(i);case me.Fast_Update:}}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)=>this._recreateSymbol(t)))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("pixelRatio",i)||this._recreateSymbol(t)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=P((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,i){const t=this.symbolCreationContext.clippingExtent,r=B();return ve(e,r,i)?this.symbolCreationContext.clippingExtent=M(z(),r):this.symbolCreationContext.clippingExtent=null,!N(this.symbolCreationContext.clippingExtent,t)}modifyGraphics3DGraphicVisibilities(e){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(p(t))return;e(t,this._graphicsBySymbol.get(i)||He,i)}}updateAllGraphicsVisibility(){h(this._filterVisibility)&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const i=this._updateUserVisibility(e),t=h(this._scaleVisibility)&&this._scaleVisibility.updateVisibility(e);return i||t}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(re.USER_SETTING,!1,se.GRAPHIC)))}_validateRenderer(e){const i=K(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`;Te.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(p(i)||i.referenced>0)return;const r=this._graphicsBySymbol.get(t);r&&0!==r.size||(this._graphicsBySymbol.delete(t),this._symbols.delete(t),c(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 ze;ke.tmpVec=j(),e([D({readOnly:!0})],ke.prototype,"computedExtent",void 0),e([D()],ke.prototype,"currentRenderer",void 0),e([D()],ke.prototype,"rendererHasGeometryOperations",void 0),e([D()],ke.prototype,"_frameTask",void 0),e([D({readOnly:!0})],ke.prototype,"_viewSpatialReference",null),e([D()],ke.prototype,"_rendererChangeAbortController",void 0),e([D()],ke.prototype,"_elevationInfoChangeAbortController",void 0),e([D()],ke.prototype,"_initializeAbortController",void 0),e([D()],ke.prototype,"_elevationAlignment",void 0),e([D()],ke.prototype,"_scaleVisibility",void 0),e([D()],ke.prototype,"_filterVisibility",void 0),e([D()],ke.prototype,"_initializePromise",void 0),e([D()],ke.prototype,"_spatialIndex",void 0),e([D({readOnly:!0})],ke.prototype,"extentPadding",void 0),e([D()],ke.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([D()],ke.prototype,"_featureStore",void 0),e([D()],ke.prototype,"_deconflictor",void 0),e([D()],ke.prototype,"_labeler",void 0),e([D()],ke.prototype,"_objectStates",void 0),e([D()],ke.prototype,"_loadingSymbols",void 0),e([D()],ke.prototype,"preferredUpdatePolicy",void 0),e([D()],ke.prototype,"_forcedUpdatePolicy",void 0),e([D({readOnly:!0})],ke.prototype,"effectiveUpdatePolicy",null),e([D({constructOnly:!0})],ke.prototype,"elevationFeatureExpressionEnabled",void 0),e([D({constructOnly:!0})],ke.prototype,"owner",void 0),e([D({constructOnly:!0})],ke.prototype,"layer",void 0),e([D({constructOnly:!0})],ke.prototype,"graphicSymbolSupported",void 0),e([D({constructOnly:!0})],ke.prototype,"getRenderingInfoWithoutRenderer",void 0),e([D({constructOnly:!0})],ke.prototype,"componentFactories",void 0),e([D({constructOnly:!0})],ke.prototype,"setUidToIdOnAdd",void 0),e([D()],ke.prototype,"featureStore",null),e([D()],ke.prototype,"initializePromise",null),e([D()],ke.prototype,"scaleVisibility",null),e([D()],ke.prototype,"elevationAlignment",null),e([D()],ke.prototype,"objectStates",null),e([D()],ke.prototype,"filterVisibility",null),e([D({readOnly:!0})],ke.prototype,"updating",null),e([D({readOnly:!0})],ke.prototype,"running",null),e([D({readOnly:!0})],ke.prototype,"suspendedOrOutsideOfView",null),e([D({readOnly:!0,dependsOn:[]})],ke.prototype,"updatingRemaining",null),e([D({readOnly:!0,dependsOn:["owner.view.qualitySettings.graphics3D.maxTotalNumberOfPrimitives","owner.view.qualitySettings.graphics3D.maxTotalNumberOfFeatures","averageSymbolComplexity"]})],ke.prototype,"displayFeatureLimit",null),e([D({readOnly:!0,dependsOn:[]})],ke.prototype,"averageSymbolComplexity",null),e([D({constructOnly:!0})],ke.prototype,"hasZ",void 0),e([D({constructOnly:!0})],ke.prototype,"hasM",void 0),e([D()],ke.prototype,"_objectIdField",null),ke=Le=e([I(Fe)],ke),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(ze||(ze={}));class We{constructor(){this.add=null,this.renderingInfo=null,this.state=ze.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=ze.NEW,this.abortController=null,this.remove=null}}const Me=10,Ne=j(),Be=j(),He=new Map;export{ke as Graphics3DCore};