@arcgis/core 6.0.0-next.33 → 6.0.0-next.35

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 (317) hide show
  1. package/Basemap.d.ts +2 -2
  2. package/README.md +2 -2
  3. package/analysis/ShadowCastAnalysis.d.ts +11 -5
  4. package/applications/Urban/meshUtils.d.ts +1 -0
  5. package/applications/Urban/meshUtils.js +1 -1
  6. package/arcgisGlobal.d.ts +1 -0
  7. package/assets/esri/core/libs/libtess/libtess-f32.wasm +0 -0
  8. package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
  9. package/assets/esri/core/workers/RemoteClient.js +1 -1
  10. package/assets/esri/core/workers/chunks/01f55004d64309f8538b.js +1 -0
  11. package/assets/esri/core/workers/chunks/0202eb8c2b2865f99981.js +1 -0
  12. package/assets/esri/core/workers/chunks/{67e533748435253aaba6.js → 0284f608d25c654fcc11.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{f3dc0bc0e00635855a7a.js → 03daf6f235c6edef6268.js} +1 -1
  14. package/assets/esri/core/workers/chunks/04a1d08c3b5b1dc7628f.js +1 -0
  15. package/assets/esri/core/workers/chunks/{1eaf8bfdd3765a90ccc2.js → 0523f893870a1546d7d9.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{1ee4df0fd61440cb5f02.js → 06102715e9a8f218e07c.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{6029773458ab98600f67.js → 07e5482e1fc69be5de09.js} +1 -1
  18. package/assets/esri/core/workers/chunks/08140725277de5d2e41a.js +1 -0
  19. package/assets/esri/core/workers/chunks/{72d20d3957d612f86431.js → 0a508e25ec05363e1f04.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{2d9a1f23ec6ce90723ac.js → 0d99bfb75dcb9fa29080.js} +1 -1
  21. package/assets/esri/core/workers/chunks/10ad7b35b6800d40444e.js +1 -0
  22. package/assets/esri/core/workers/chunks/1132e28aaa5825b10b6e.js +1 -0
  23. package/assets/esri/core/workers/chunks/{84038dd85005fea413eb.js → 139e753d95cfc9470e74.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{dd30b02c5978c1c5f511.js → 155861fbd0e5fc2db80c.js} +1 -1
  25. package/assets/esri/core/workers/chunks/15950c2fb173b62ee0ec.js +1 -0
  26. package/assets/esri/core/workers/chunks/165ca7a97b611c8f26c4.js +1 -0
  27. package/assets/esri/core/workers/chunks/{418addce122dbb8897b4.js → 1a614bac5db42c6263f8.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{0cc7fba402a93e6d2455.js → 1ae0c9345626e70affd3.js} +2 -2
  29. package/assets/esri/core/workers/chunks/{58c3ae6030def2ed5f31.js → 1b17f5f720f6cf3f6d73.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{cd355baab983033c3ef0.js → 1ec772eaa63eb6937231.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{f9dc38761b314d33890f.js → 1f51567f47c2e2fc8a23.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{5c04835b0b52461183cd.js → 1fd82fcba2758741996a.js} +1 -1
  33. package/assets/esri/core/workers/chunks/21e1d423ee33f916547e.js +1 -0
  34. package/assets/esri/core/workers/chunks/2211ff0a1f1ae8100231.js +1 -0
  35. package/assets/esri/core/workers/chunks/{096b2bf1c0d69d27f20c.js → 247617c0dbae2386ab3b.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{97ec46605f16333144b7.js → 26ea39dfdf887f357fce.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{85de980c5b296ec69323.js → 279089a6a3f08022c678.js} +1 -1
  38. package/assets/esri/core/workers/chunks/29c610ce1c81ebb84a6b.js +1 -0
  39. package/assets/esri/core/workers/chunks/2b4dd42920d37b1ff0a9.js +2 -0
  40. package/assets/esri/core/workers/chunks/{8da2a10318f49d0dc73a.js → 31ef7b7074b3e3829763.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{b657363113f4a37e634b.js → 3223f9fbc76ba9ef8d13.js} +1 -1
  42. package/assets/esri/core/workers/chunks/322b22a5d54e404bebd5.js +1 -0
  43. package/assets/esri/core/workers/chunks/{122e75b21699a4e83b15.js → 338d800d4efcc91cead1.js} +1 -1
  44. package/assets/esri/core/workers/chunks/3537fe95b83a13b156cc.js +1 -0
  45. package/assets/esri/core/workers/chunks/{360c944c610efa2051fc.js → 379db67f78161ebd5468.js} +2 -2
  46. package/assets/esri/core/workers/chunks/{f09bc86cd52224febfcb.js → 3b380e64566a6cce59e2.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{be55771758e4bcef0976.js → 3e406043a374ee17475b.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{e3b212f8af448ec29eef.js → 3fe4c89acd325d36618d.js} +1 -1
  49. package/assets/esri/core/workers/chunks/449a2dee17b54946f245.js +1 -0
  50. package/assets/esri/core/workers/chunks/46c290108a90518ef695.js +1 -0
  51. package/assets/esri/core/workers/chunks/{a596779eaeec7310671d.js → 478a89317a12e9b4d146.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{fcc3902d6d9eda6f09f5.js → 48b8b57f559a53c6c513.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{55a9eaeb152a3abada67.js → 4e5405134d079bdf9b7a.js} +1 -1
  54. package/assets/esri/core/workers/chunks/4f3e0d583cfa9d1d6727.js +2 -0
  55. package/assets/esri/core/workers/chunks/{d070fcb73ce274ab80e4.js → 5504ec9bd9ee4d10af07.js} +1 -1
  56. package/assets/esri/core/workers/chunks/552c36b40e5a5ec117fb.js +1 -0
  57. package/assets/esri/core/workers/chunks/5622f3faa59434772857.js +1 -0
  58. package/assets/esri/core/workers/chunks/{bd46a04a9ee4ea9e6ef1.js → 5864bce1498a13ee5b7e.js} +2 -2
  59. package/assets/esri/core/workers/chunks/59a1b637d2c107504a04.js +1 -0
  60. package/assets/esri/core/workers/chunks/59a88dd53f8806bbec06.js +1 -0
  61. package/assets/esri/core/workers/chunks/{f4d91d470ca5fea0bd26.js → 5bd1414220e42cb8ebcf.js} +1 -1
  62. package/assets/esri/core/workers/chunks/5c2fe67527c9d7b4dba3.js +1 -0
  63. package/assets/esri/core/workers/chunks/5c3aa8386705c5e40358.js +1 -0
  64. package/assets/esri/core/workers/chunks/5d781c2c6204cffffd0d.js +1 -0
  65. package/assets/esri/core/workers/chunks/{176d75e76318bfc25a53.js → 60c8eedd06080edab3e3.js} +1 -1
  66. package/assets/esri/core/workers/chunks/61d36730564c5ac5edab.js +1 -0
  67. package/assets/esri/core/workers/chunks/6604272ef6fe85279032.js +1 -0
  68. package/assets/esri/core/workers/chunks/{29cc6b1705418b1be5d7.js → 687deb918eb48a963c8f.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{0694c7bcfe71692e2ccf.js → 723df53cfa0189837d01.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{90c1d10eae7ae71889b0.js → 7400b8c454b47ee4fb3c.js} +1 -1
  71. package/assets/esri/core/workers/chunks/796c6195b6bf59dcc9bd.js +1 -0
  72. package/assets/esri/core/workers/chunks/7b45ac83e279fe9516a5.js +1 -0
  73. package/assets/esri/core/workers/chunks/{2de077c7b971f2c215a6.js → 7ddbde8fdd1cf3c53f50.js} +1 -1
  74. package/assets/esri/core/workers/chunks/804606b194dc9e71d088.js +1 -0
  75. package/assets/esri/core/workers/chunks/8102f0bf5707c3be3310.js +1 -0
  76. package/assets/esri/core/workers/chunks/{1a8d8274df292d65f82e.js → 81bcc495e6eaf2cf7474.js} +1 -1
  77. package/assets/esri/core/workers/chunks/90360c0bd053d3e3fd77.js +1 -0
  78. package/assets/esri/core/workers/chunks/{d1d6154b4af1c9cc497b.js → 934e1f2153e6fad6ed23.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{e096c1d9d53af74d3207.js → 990e96139b5a1dccb061.js} +1 -1
  80. package/assets/esri/core/workers/chunks/9c3de54513bf8619271c.js +1 -0
  81. package/assets/esri/core/workers/chunks/{f28b63c1179366dac8a2.js → 9e2c30b67bab5795306e.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{9184c947cdefe06bf551.js → a18c3cbe505a19d29569.js} +1 -1
  83. package/assets/esri/core/workers/chunks/aa6ee2aa4ff6e6d41efb.js +1 -0
  84. package/assets/esri/core/workers/chunks/{3fd5c3cd8457ddc68798.js → aa779896fd9e5c341349.js} +1 -1
  85. package/assets/esri/core/workers/chunks/ac10c7d2c4829a150037.js +1 -0
  86. package/assets/esri/core/workers/chunks/{fe6dcb21570395e46ce8.js → afc8a9847f31bb66b13b.js} +1 -1
  87. package/assets/esri/core/workers/chunks/c5bf19da62a3d31009fe.js +2 -0
  88. package/assets/esri/core/workers/chunks/{2226c20c38e20713bcb5.js.LICENSE.txt → c5bf19da62a3d31009fe.js.LICENSE.txt} +1 -1
  89. package/assets/esri/core/workers/chunks/c7adb7b77721c75891f4.js +1 -0
  90. package/assets/esri/core/workers/chunks/cd55cad81accf51d2989.js +1 -0
  91. package/assets/esri/core/workers/chunks/{bead830a677690eeb6fb.js → ce8ef2eec290e1df6b2a.js} +1 -1
  92. package/assets/esri/core/workers/chunks/d3369ffed19f4c264dcd.js +1 -0
  93. package/assets/esri/core/workers/chunks/d3412518a7b518860fbb.js +1 -0
  94. package/assets/esri/core/workers/chunks/{3048e74e6246324ce6fc.js → d5916500514a41a4758f.js} +1 -1
  95. package/assets/esri/core/workers/chunks/{89dc49e784f7ba3b93ea.js → dac69c0047488fdf986d.js} +1 -1
  96. package/assets/esri/core/workers/chunks/db1f7b2562de495b3401.js +2 -0
  97. package/assets/esri/core/workers/chunks/dcc782e4bf9e8a8202f9.js +1 -0
  98. package/assets/esri/core/workers/chunks/dcdf837a452dc0cac582.js +1 -0
  99. package/assets/esri/core/workers/chunks/e0a37d3bcb9a944e53dd.js +1 -0
  100. package/assets/esri/core/workers/chunks/{19a4fa965b70fc6f78f6.js → e209cb1f3f14bf576ebe.js} +1 -1
  101. package/assets/esri/core/workers/chunks/e67ea2f1714e5abeae44.js +1 -0
  102. package/assets/esri/core/workers/chunks/e8fb2ba7b7a4f0916325.js +1 -0
  103. package/assets/esri/core/workers/chunks/{636e9c4ac1f9ae98f9d1.js → ea81f9d71b0842a4be26.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{164c8eeefa8232b2b191.js → eaa0e906b46ae4c84d72.js} +2 -2
  105. package/assets/esri/core/workers/chunks/efcd38aad9aa667001b2.js +1 -0
  106. package/assets/esri/core/workers/chunks/{3aafdb905c697bc9b1ad.js → f372f4eb5527238c46f5.js} +1 -1
  107. package/assets/esri/core/workers/chunks/f497968055af459c5da4.js +1 -0
  108. package/assets/esri/core/workers/chunks/f7123ba1286f64e13e91.js +1 -0
  109. package/assets/esri/core/workers/chunks/fcb4707c2e95099b9f30.js +1 -0
  110. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  111. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  112. package/chunks/BlurEmission.glsl.js +9 -4
  113. package/chunks/GlobalIllumination.glsl.js +55 -46
  114. package/chunks/GlobalIlluminationBlur.glsl.js +13 -9
  115. package/chunks/RibbonLine.glsl.js +90 -88
  116. package/chunks/Terrain.glsl.js +9 -9
  117. package/chunks/libtess-f32.js +1 -1
  118. package/chunks/libtess-f64.js +1 -1
  119. package/chunks/lyr3DMain.js +1 -1
  120. package/chunks/lyr3DWorker.js +2 -2
  121. package/config.d.ts +3 -3
  122. package/config.js +1 -1
  123. package/core/has.js +1 -1
  124. package/core/mathUtils.js +1 -1
  125. package/core/workers.d.ts +1 -0
  126. package/form/FormTemplate.d.ts +1 -1
  127. package/geometry/libtess.js +1 -1
  128. package/geometry/projection/projectors.js +1 -1
  129. package/geometry/support/MeshLocalVertexSpace.d.ts +3 -3
  130. package/geometry/support/aaBoundingRect.js +1 -1
  131. package/geometry/support/meshUtils/convertMeshVertexSpace.js +1 -1
  132. package/geometry/support/meshUtils/vertexSpaceConversion.js +1 -1
  133. package/identity/Credential.d.ts +1 -1
  134. package/identity/IdentityManager.d.ts +1 -1
  135. package/identity/IdentityManagerBase.js +1 -1
  136. package/identity/OAuthInfo.d.ts +1 -1
  137. package/identity/ServerInfo.d.ts +1 -1
  138. package/kernel.d.ts +3 -3
  139. package/kernel.js +1 -1
  140. package/layers/CSVLayer.js +1 -1
  141. package/layers/GaussianSplatLayer.js +1 -1
  142. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  143. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  144. package/layers/VectorTileLayer.d.ts +2 -2
  145. package/layers/VideoLayer.js +1 -1
  146. package/layers/VoxelWasmPerSceneView.js +1 -1
  147. package/layers/WFSLayer.d.ts +8 -4
  148. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  149. package/layers/graphics/sources/CSVSource.js +1 -1
  150. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  151. package/layers/graphics/sources/MemorySource.js +2 -2
  152. package/layers/graphics/sources/WFSSource.js +1 -1
  153. package/layers/graphics/sources/geojson/geojson.js +1 -1
  154. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  155. package/layers/graphics/sources/support/QueryTask.js +1 -1
  156. package/layers/graphics/sources/support/timeQueryUtils.js +2 -0
  157. package/layers/mixins/APIKeyMixin.d.ts +1 -1
  158. package/layers/mixins/ArcGISMapService.d.ts +17 -0
  159. package/layers/mixins/ArcGISMapService.js +1 -1
  160. package/layers/ogc/types.d.ts +1 -1
  161. package/layers/ogc/wfsUtils.d.ts +7 -2
  162. package/layers/ogc/wfsUtils.js +1 -1
  163. package/layers/ogc/xmlUtils.js +1 -1
  164. package/layers/support/TelemetryData.d.ts +28 -4
  165. package/layers/support/TimeInformation.js +1 -1
  166. package/layers/support/tiles3DUtils.js +1 -1
  167. package/layers/support/timeInfoUtils.js +2 -0
  168. package/layers/video/videoUtils.js +1 -1
  169. package/package.json +4 -4
  170. package/rest/query/executeAttributeBinsQuery.js +1 -1
  171. package/rest/query/executeForExtent.js +1 -1
  172. package/rest/query/executeForTopCount.js +1 -1
  173. package/rest/query/executeForTopExtents.js +1 -1
  174. package/rest/query/executeForTopIds.js +1 -1
  175. package/rest/query/executeTopFeaturesQuery.js +1 -1
  176. package/rest/query/operations/query.js +1 -1
  177. package/rest/query/operations/queryAttributeBins.js +1 -1
  178. package/rest/query/operations/queryTopFeatures.js +1 -1
  179. package/rest/route.d.ts +1 -1
  180. package/rest/support/AreasAndLengthsParameters.d.ts +1 -1
  181. package/rest/support/LengthsParameters.d.ts +1 -1
  182. package/rest/support/timeUtils.js +1 -1
  183. package/symbols/TextSymbol.d.ts +0 -1
  184. package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
  185. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  186. package/views/2d/engine/webgl/GlyphWorker.js +1 -1
  187. package/views/2d/engine/webgl/TextureManager.js +1 -1
  188. package/views/2d/engine/webgl/materialKeyUtils.js +2 -0
  189. package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
  190. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  191. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  192. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +1 -1
  193. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js +1 -1
  194. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
  195. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js +1 -1
  196. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js +1 -1
  197. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  198. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js +1 -1
  199. package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js +1 -1
  200. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  201. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  202. package/views/2d/layers/VideoLayerView2D.js +1 -1
  203. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  204. package/views/3d/FocusAreasView.js +1 -1
  205. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  206. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  207. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  208. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  209. package/views/3d/analysis/ShadowCast/ShadowCastError.d.ts +40 -0
  210. package/views/3d/analysis/ShadowCast/ShadowCastError.js +2 -0
  211. package/views/3d/analysis/ShadowCast/sunlightUtils.js +2 -0
  212. package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +16 -1
  213. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  214. package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
  215. package/views/3d/camera/intersectionUtils.js +1 -1
  216. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  217. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  218. package/views/3d/layers/Lyr3DWorker.js +1 -1
  219. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  220. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  221. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  222. package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
  223. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  224. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  225. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  226. package/views/3d/layers/graphics/MeshFastUpdateProcessor.js +1 -1
  227. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  228. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  229. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  230. package/views/3d/layers/support/FeatureMemory.js +1 -1
  231. package/views/3d/layers/support/FeatureTile.js +1 -1
  232. package/views/3d/navigation/modes/GroundNavigationMode3D.js +1 -1
  233. package/views/3d/state/Constraints.js +1 -1
  234. package/views/3d/state/NearFarHeuristic.js +1 -1
  235. package/views/3d/state/ScreenSizePerspective.js +1 -1
  236. package/views/3d/state/ViewStateManager.js +1 -1
  237. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  238. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  239. package/views/3d/support/RenderCoordsHelper.js +1 -1
  240. package/views/3d/support/orientedBoundingBox.js +1 -1
  241. package/views/3d/support/sphereExtentUtils.js +1 -1
  242. package/views/3d/terrain/TerrainRenderer.js +1 -1
  243. package/views/3d/terrain/TerrainSurface.js +1 -1
  244. package/views/3d/terrain/TileRenderer.js +1 -1
  245. package/views/3d/terrain/tileUtils.js +1 -1
  246. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  247. package/views/3d/webgl-engine/lib/NavigationDepthCache.js +1 -1
  248. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  249. package/views/3d/webgl-engine/lib/RibbonLineVertexInfo.js +1 -1
  250. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  251. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  252. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  253. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  254. package/views/3d/webgl.d.ts +1 -1
  255. package/views/SceneView.js +1 -1
  256. package/views/support/Scheduler.js +1 -1
  257. package/views/webgl/BufferObject.js +1 -1
  258. package/views/webgl/FramebufferObject.js +1 -1
  259. package/widgets/Directions.d.ts +1 -1
  260. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  261. package/widgets/HistogramRangeSlider.d.ts +1 -1
  262. package/assets/esri/core/workers/chunks/0e445ec3523de9f2dfa2.js +0 -1
  263. package/assets/esri/core/workers/chunks/0f6c0d42100c21367e5c.js +0 -1
  264. package/assets/esri/core/workers/chunks/131185d26343a997495e.js +0 -1
  265. package/assets/esri/core/workers/chunks/176d0a06ebff5a29dedf.js +0 -1
  266. package/assets/esri/core/workers/chunks/18776a130d96879a68b1.js +0 -1
  267. package/assets/esri/core/workers/chunks/1a3f71c4d97c36050030.js +0 -1
  268. package/assets/esri/core/workers/chunks/20a698709c3c11ff2c16.js +0 -1
  269. package/assets/esri/core/workers/chunks/2226c20c38e20713bcb5.js +0 -2
  270. package/assets/esri/core/workers/chunks/277263466837e1673f56.js +0 -1
  271. package/assets/esri/core/workers/chunks/2981e904ab62f3ed80d0.js +0 -2
  272. package/assets/esri/core/workers/chunks/32cc59e126df8c96a0cf.js +0 -2
  273. package/assets/esri/core/workers/chunks/379ef56f6b32494832a6.js +0 -1
  274. package/assets/esri/core/workers/chunks/38d852676677e5697864.js +0 -1
  275. package/assets/esri/core/workers/chunks/46453ebfee17b5421d9d.js +0 -1
  276. package/assets/esri/core/workers/chunks/5a9b7eb26f936f03d02e.js +0 -1
  277. package/assets/esri/core/workers/chunks/5bb6c255bdc8aa9ba23e.js +0 -1
  278. package/assets/esri/core/workers/chunks/5f07f52bb8b7721f08d3.js +0 -1
  279. package/assets/esri/core/workers/chunks/654f5441227579d2b6b4.js +0 -1
  280. package/assets/esri/core/workers/chunks/6b5c073dddd89d06ed80.js +0 -1
  281. package/assets/esri/core/workers/chunks/6bb191b19ce43a27f205.js +0 -1
  282. package/assets/esri/core/workers/chunks/6ddc29a144640acb1192.js +0 -1
  283. package/assets/esri/core/workers/chunks/6ebe73f69ae822053b70.js +0 -1
  284. package/assets/esri/core/workers/chunks/6f6d1873753a9c6994aa.js +0 -1
  285. package/assets/esri/core/workers/chunks/7084dd6e10c6c1393e92.js +0 -1
  286. package/assets/esri/core/workers/chunks/7566321c6a2913f2852b.js +0 -1
  287. package/assets/esri/core/workers/chunks/7b5cd150a4d0139850be.js +0 -1
  288. package/assets/esri/core/workers/chunks/7cc9d7a88b64e25fce14.js +0 -1
  289. package/assets/esri/core/workers/chunks/7e211d8a8ad6c6a7cf3e.js +0 -1
  290. package/assets/esri/core/workers/chunks/844eedda8f749972f707.js +0 -2
  291. package/assets/esri/core/workers/chunks/849f446c718e892f39ce.js +0 -1
  292. package/assets/esri/core/workers/chunks/87177e0f82e8a6ae3189.js +0 -1
  293. package/assets/esri/core/workers/chunks/9976eaa81085c0d17e14.js +0 -1
  294. package/assets/esri/core/workers/chunks/a2196a49f89d57a0a1c7.js +0 -1
  295. package/assets/esri/core/workers/chunks/a504a5e06cb89a620799.js +0 -1
  296. package/assets/esri/core/workers/chunks/a65951f1d5702cfd996e.js +0 -1
  297. package/assets/esri/core/workers/chunks/aba259a70bee68d2edb7.js +0 -1
  298. package/assets/esri/core/workers/chunks/b8fd7c3b36981261378b.js +0 -1
  299. package/assets/esri/core/workers/chunks/b9cb92858a576eb6aa06.js +0 -1
  300. package/assets/esri/core/workers/chunks/c33a9635c294c8774977.js +0 -1
  301. package/assets/esri/core/workers/chunks/c570b90995c65bbb2e14.js +0 -1
  302. package/assets/esri/core/workers/chunks/c576bef77e34920af188.js +0 -1
  303. package/assets/esri/core/workers/chunks/cf1ec61eb2ad147bb931.js +0 -1
  304. package/assets/esri/core/workers/chunks/daae21cf77864f3293ef.js +0 -1
  305. package/assets/esri/core/workers/chunks/dc2f93453dfa40f623ab.js +0 -1
  306. package/assets/esri/core/workers/chunks/e81173724e8de8c1e65b.js +0 -1
  307. package/assets/esri/core/workers/chunks/e83f9abee611c5b80009.js +0 -1
  308. package/assets/esri/core/workers/chunks/f39c700f3db7db52b522.js +0 -1
  309. package/assets/esri/core/workers/chunks/f45064066e1ab041a0b2.js +0 -1
  310. package/assets/esri/core/workers/chunks/ffe49d9e7df081bef4a5.js +0 -1
  311. package/views/2d/engine/webgl/hashMosaic.js +0 -2
  312. /package/assets/esri/core/workers/chunks/{0cc7fba402a93e6d2455.js.LICENSE.txt → 1ae0c9345626e70affd3.js.LICENSE.txt} +0 -0
  313. /package/assets/esri/core/workers/chunks/{844eedda8f749972f707.js.LICENSE.txt → 2b4dd42920d37b1ff0a9.js.LICENSE.txt} +0 -0
  314. /package/assets/esri/core/workers/chunks/{32cc59e126df8c96a0cf.js.LICENSE.txt → 4f3e0d583cfa9d1d6727.js.LICENSE.txt} +0 -0
  315. /package/assets/esri/core/workers/chunks/{bd46a04a9ee4ea9e6ef1.js.LICENSE.txt → 5864bce1498a13ee5b7e.js.LICENSE.txt} +0 -0
  316. /package/assets/esri/core/workers/chunks/{2981e904ab62f3ed80d0.js.LICENSE.txt → db1f7b2562de495b3401.js.LICENSE.txt} +0 -0
  317. /package/assets/esri/core/workers/chunks/{164c8eeefa8232b2b191.js.LICENSE.txt → eaa0e906b46ae4c84d72.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as n}from"../../../../core/arrayUtils.js";import r from"../../../../core/Error.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{findInMap as a}from"../../../../core/MapUtils.js";import{abortMaybe as o,removeMaybe as s,destroyMaybe as c}from"../../../../core/maybe.js";import{MinPriority as l}from"../../../../core/MemCache.js";import u from"../../../../core/PooledArray.js";import{throwIfAborted as d,ignoreAbortErrors as f,isAbortError as p}from"../../../../core/promiseUtils.js";import m from"../../../../core/Queue.js";import{when as h,watch as g,on as ee,syncAndInitial as te,whenOnce as _}from"../../../../core/reactiveUtils.js";import{schedule as v}from"../../../../core/scheduling.js";import{property as y,subclass as ne}from"../../../../core/accessorSupport/decorators.js";import{diff as b,isEmpty as re}from"../../../../core/accessorSupport/diffUtils.js";import{runUntracked as x}from"../../../../core/accessorSupport/tracking.js";import{set as S,add as C,scale as w}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as T}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import ie from"../../../../geometry/Extent.js";import ae from"../../../../geometry/Point.js";import{canProjectWithoutEngine as oe}from"../../../../geometry/projectionUtils.js";import{projectBuffer as E}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as D}from"../../../../geometry/projection/projectVectorToVector.js";import{projectXYZToVector as O}from"../../../../geometry/projection/projectXYZToVector.js";import{center as se,fromRect as ce,create as k,equals as le}from"../../../../geometry/support/aaBoundingBox.js";import{create as ue}from"../../../../geometry/support/aaBoundingRect.js";import{equals as de}from"../../../../geometry/support/spatialReferenceUtils.js";import{isPopupProvider as fe}from"../../../../graphic/getPopupProvider.js";import pe from"../../../../layers/Layer.js";import{getObjectId as A,computeAABB as j,hasGeometry as M}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as N}from"../../../../layers/graphics/hydratedFeatures.js";import P from"../../../../renderers/UniqueValueRenderer.js";import{isSupportedRenderer3D as F,validateTo3D as I}from"../../../../renderers/support/rendererConversion.js";import{RenderingInfo as L}from"../../../../renderers/support/RenderingInfo.js";import{isBasemapLayerView as R}from"../../../../support/basemapUtils.js";import{loadArcade as z}from"../../../../support/loadArcade.js";import B from"../../../../symbols/LabelSymbol3D.js";import me from"../../../../symbols/TextSymbol.js";import he from"../../../../symbols/WebStyleSymbol.js";import{getDefaultSymbol3D as ge}from"../../../../symbols/support/defaults3D.js";import{to3D as V}from"../../../../symbols/support/symbolConversion.js";import{aggregateSymbolComplexity as _e,defaultSymbolComplexity as ve}from"./defaultSymbolComplexity.js";import{DisplayFeatureLimit as ye}from"./DisplayFeatureLimit.js";import{ViewElevationProvider as be}from"./ElevationQuery.js";import{extractExpressionInfo as H,createContext as U}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as xe}from"./Graphics3DFeatureStore.js";import{Graphics3DGraphicCreationContext as Se}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as Ce}from"./Graphics3DSymbolCreationContext.js";import{make as we}from"./Graphics3DSymbolFactory.js";import{Graphics3DWebStyleSymbol as Te}from"./Graphics3DWebStyleSymbol.js";import{GraphicsCorePerformanceInfo as Ee}from"./GraphicsCorePerformanceInfo.js";import{GraphicStateTracking as De}from"./GraphicStateTracking.js";import{computeCentroid as Oe}from"./graphicUtils.js";import{placePointOnGeometry as ke}from"./pointUtils.js";import{SpatialIndex2D as Ae}from"./SpatialIndex2D.js";import{AggregateSymbolComplexity as je}from"./SymbolComplexity.js";import{StageLayerElevationProvider as Me}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as Ne}from"../../support/extentUtils.js";import{affectsGeometry as Pe}from"../../webgl-engine/lib/affectsGeometry.js";import{GridLocalOriginFactory as Fe}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{isScreenSizePerspectiveEnabled as W}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{WebGLLayer as Ie}from"../../webgl-engine/lib/WebGLLayer.js";import{HUDMaterial as Le}from"../../webgl-engine/materials/HUDMaterial.js";import{hasPopupTemplate as Re}from"../../../layers/support/popupUtils.js";import{PromiseQueue as G}from"../../../support/PromiseQueue.js";import{PropertiesPool as ze}from"../../../support/PropertiesPool.js";import{ImmediateTask as K,noBudget as Be,TaskPriority as Ve}from"../../../support/Scheduler.js";import{TextureCompressionTracker as He}from"../../../support/TextureCompressionTracker.js";import{Yield as Ue}from"../../../support/Yield.js";import{alphaCutoff as q}from"../../../../webscene/support/AlphaCutoff.js";var J;const Y=T(),We=k();let X=class extends t{static{J=this}static{this.tmpVec=T()}get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new Ae({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 deconflictor(){return this._deconflictor}get labeler(){return this._labeler}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return this.currentRenderer!=null&&this.currentRenderer.type===`dictionary`?0: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.dataUpdating||this._elevationAlignment?.updating||this._scaleVisibility?.updating||this._filterVisibility?.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._frameTaskHandle.updating||this._updateQueue.updating||this.readyToRun)}get dataUpdating(){return!!(this._graphicsWaitingForSymbol.size>0||this._pendingUpdates.size>0||this._spatialIndex?.updating||this._updatingPendingLoadedGraphicsChange||this._dataUpdateQueue.updating||this._loadingSymbols>0||this.compressionTracker.compressing)}get readyToRun(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating||this._dataUpdateQueue.readyToRun||this._updateQueue.readyToRun||this._focusAreasGraphicsQueue.length>0}get suspendedOrOutsideOfView(){return this.owner.suspended||!!this.owner.suspendInfo?.outsideOfView}get updatingRemaining(){return x(()=>this.updating?this._pendingUpdates.size+(this._spatialIndex?.updatingRemaining||0)*.1+(this._elevationAlignment?.updatingRemaining||0)*.1:0)}get displayFeatureLimit(){let e=this.owner&&this.owner.view&&this.owner.view.qualitySettings,t=e?.graphics3D.minTotalNumberOfFeatures??0,n=e?.graphics3D.maxTotalNumberOfFeatures??0,r=e?.graphics3D.maxNumberOfDrawCalls??0,i=e?.graphics3D.maxTotalNumberOfVertices??0,a=this.averageSymbolComplexity,o=Math.max(1,a?.verticesPerFeature??1),s=a&&a.drawCallsPerFeature>0&&r>0?r/a.drawCallsPerFeature:n,c=Math.ceil(i/o),l=Math.max(t,Math.min(n,c,s)),u=this._get(`displayFeatureLimit`);return u&&u.maximumTotalNumberOfVertices===i&&u.averageSymbolComplexity===a&&u.maximumNumberOfFeatures===l?u:new ye(i,l,a)}get averageSymbolComplexity(){return x(()=>{let e=this._averageSymbolComplexities,t=this._get(`averageSymbolComplexity`);return e.numComplexities===0||t!=null&&(e.estimated&&(t.verticesPerFeature>=e.verticesPerFeature||t.verticesPerCoordinate>=e.verticesPerCoordinate||t.drawCallsPerFeature>=e.drawCallsPerFeature)||t.verticesPerFeature===e.verticesPerFeature&&t.verticesPerCoordinate===e.verticesPerCoordinate&&t.drawCallsPerFeature===e.drawCallsPerFeature)?t:e})}get _averageSymbolComplexities(){let e=this._totalSymbolComplexities;return e.numComplexities>0&&(e.verticesPerFeature/=e.numComplexities,e.verticesPerCoordinate/=e.numComplexities,e.drawCallsPerFeature/=e.numComplexities,e.memory.bytesPerFeature/=e.numComplexities,e.memory.bytesPerFeatureLabel/=e.numComplexities,e.memory.resourceBytes/=e.numComplexities,e.memory.draped.bytesPerFeature/=e.numComplexities,e.memory.draped.bytesPerFeatureLabel/=e.numComplexities),e}get _totalSymbolComplexities(){let e=new je;return this._forEachSymbolComplexity(t=>_e(t,e)),e}get usedMemory(){let e=this.labelsEnabled?(this.averageSymbolComplexity?.memory.bytesPerFeatureLabel??0)*this._numberOfGraphics:0,t=0;if(this._forEachSymbolComplexityUsed(e=>t+=e?.memory.resourceBytes??0),this._symbolMaterials==null){this._symbolMaterials=[];for(let e of this._symbols.values())if(e!=null){for(let t of e.symbolLayers)if(t)for(let e of t.materials)e&&this._symbolMaterials.push(e)}}let n=this.owner.view.stage.renderer,r=this.owner.view.overlayManager.renderer,i=this._symbolMaterials.reduce((e,t)=>e+((n.getMaterialRenderer(t)||r.getMaterialRenderer(t))?.usedMemory??0),0);return this._usedMemory+e+t+i}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){let e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(this.averageSymbolComplexity!=null){let 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}_forEachSymbolComplexity(e){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(e):this._forEachSymbolComplexityUsed(e)}get visible(){return this._visible}_getConvertedSymbol(e){let t=e;if(t.type===`web-style`)return t.clone();let n=this._symbolConversionCache.get(t.id);if(n!=null)return n;let r=V(t,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(t),cimFallbackEnabled:!0}),a=r.symbol||null;return a==null&&r.error&&i.getLogger(this).error(r.error.message),this._symbolConversionCache.set(t.id,a),a}_getSymbolComplexitiesUsedOrRenderer(e){let t=this.currentRenderer;if(t==null)return;let n=t.symbols,r=`backgroundFillSymbol`in t?t.backgroundFillSymbol:null;if(!r&&!n.length)return;let i=this._getSymbolComplexityUsedOrRenderer(r);i!=null&&e(i);for(let t of n){let n=this._getSymbolComplexityUsedOrRenderer(t);n!=null&&e(n)}}_getSymbolComplexityUsedOrRenderer(e){if(e==null)return null;let t=this._symbols.get(e.id);if(t!=null)return t.complexity;let n=this._getConvertedSymbol(e);return n==null?null:ve(n)}_forEachSymbolComplexityUsed(e){this._symbols.forEach(t=>{e(t?.complexity)})}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new ze({computedExtent:()=>new ie},this),this.computedExtent=null,this.currentRenderer=null,this.rendererRequiresHydratedGraphic=!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._frameTaskHandle=K,this._dataUpdateQueue=new G,this._updateQueue=new G,this._focusAreasGraphicsQueue=new m,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._elevationAlignment=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._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this.compressionTracker=new He,this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new u,this.preferredUpdatePolicy=1,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.reportGraphicSourceMemory=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this._notifyMemoryChange=e=>{this._usedMemory+=e},this._unusedSymbolsCache=e.owner.view.resourceController.memoryController.newCache(`graphics-3d-unused-symbols`,e=>e.destroy()),this.symbolCreationContext=new Ce(e.owner.view.resourceController.scheduler,(e,t)=>this._updateQueue.push(e,t),e.owner.layerViewUid,this.compressionTracker)}initialize(){this._featureStore=new xe({objectIdField: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)});let e=(e,t,n)=>this.spatialIndex.queryGraphicUIDsInExtent(e,t,n),{componentFactories:t}=this;this._elevationAlignment=t.elevationAlignment?.(this,e),this._scaleVisibility=t.scaleVisibility?.(this,e),this._filterVisibility=t.filterVisibility?.({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(1,4,e(A(t.graphic,this._objectIdField)))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(1,4,e)),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,4,!0))}),this._deconflictor=t.deconflictor?.(this),this._labeler=t.labeler?.(this,this._scaleVisibility),this._objectStates=t.objectStates?.(this),this._initializeAbortController=new AbortController,this.addHandles(h(()=>this.owner.view.state.highlights,()=>{let{highlightOrderMap:e}=this.owner.view.state;this.graphics3DGraphics.forEach(t=>t.updateHighlights(e))})),this._initializePromise=this._initializeAsync()}async _initializeAsync(){let e=this._initializeAbortController?.signal,t=this.owner.view;this._viewElevationProvider=new be(this._viewSpatialReference,t),this._initializeStage(t,this.owner.layerViewUid);let n=t.sharedSymbolResources;this.symbolCreationContext.sharedResources=n,this.currentRenderer!=null&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.renderCoordsHelper=t.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new Fe(t.renderSpatialReference),this.symbolCreationContext.elevationProvider=t.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e),this.symbolCreationContext.focusAreaStyle=t.map?.focusAreas.style??null;let r=H(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await U(r,this._viewSpatialReference,e,i.getLogger(this)),d(e),this.symbolCreationContext.screenSizePerspectiveEnabled=W(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){let{owner:e}=this;this.symbolCreationContext.drapeSourceRenderer=t.overlayManager.registerGeometryDrapeSource(e)}this.addHandles([g(()=>this.suspendedOrOutsideOfView,()=>this._updateQueue.unshift(()=>this._updateLayerVisibility(),null).catch(f)),g(()=>W(this.layer?.screenSizePerspectiveEnabled),e=>{e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._screenSizePerspectiveEnabledChange())}),g(()=>this.owner.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(!!e)),g(()=>this.owner.view.state?.rasterPixelRatio,()=>this._pixelRatioChange()),g(()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._physicalBasedRenderingChange(e)),g(()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,e=>this._skipHighSymbolLoDsChange(e)),g(()=>this.owner.view.focusAreasView?.polygons,()=>this._updateFocusedLabels()),g(()=>this.owner.view.timeZone,()=>{this.currentRenderer?.arcadeRequired&&this.recreateAllGraphics()}),g(()=>this.owner.view.map?.focusAreas.style,e=>{this.symbolCreationContext.focusAreaStyle=e??null,this.recreateAllGraphicsAndSymbols()}),h(()=>t.basemapTerrain?.tilingScheme,e=>{let n=t.groundView?.spatialReference;!e.spatialReference.equals(this.symbolCreationContext.overlaySR)&&n!=null&&(this.symbolCreationContext.overlaySR=n),this.hasHandles(`loaded-graphics`)?this.recreateAllGraphics():this.addHandles([ee(()=>this.owner?.loadedGraphics,`change`,e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()},{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],`loaded-graphics`)},{initial:!0}),g(()=>this.effectiveUpdatePolicy,e=>{this.stageLayer!=null&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===0,e===1&&this.runTask(Be)},te)]),this._frameTaskHandle=t.resourceController.scheduler.registerTask(Ve.GRAPHICS_CORE,this),this.layer&&`featureReduction`in this.layer&&this.addHandles(g(()=>this.layer.featureReduction,()=>this._deconflictor?.featureReductionChange())),this.notifyChange(`averageSymbolComplexity`),this.rendererChange(this.owner.renderer).catch(()=>{}),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController=o(this._initializeAbortController)}_updateFocusedLabels(){this._focusAreasGraphicsQueue.clear(),this.forEachGraphics3DSymbol((e,t)=>{t&&e.needsUpdateFocus&&t.forEach(e=>{this._focusAreasGraphicsQueue.push(e)})})}destroy(){if(this._unusedSymbolsCache.destroy(),this._abortInitialize(),this._rendererChangeAbortController=o(this._rendererChangeAbortController),this._abortElevationInfoChange(),this._frameTaskHandle.remove(),this._frameTaskHandle=K,this._dataUpdateQueue.cancelAll(),this._updateQueue.cancelAll(),this._deconflictor=s(this._deconflictor),this._labeler=s(this._labeler),this._elevationAlignment=c(this._elevationAlignment),this._scaleVisibility=c(this._scaleVisibility),this._filterVisibility=c(this._filterVisibility),this._objectStates=c(this._objectStates),this.clear(),`drapeSourceType`in this.owner){let{owner:e}=this;this.stage.view.overlayManager.unregisterDrapeSource(e)}this._featureStore=c(this._featureStore),this._updatingPendingLoadedGraphicsChange=s(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=c(this._graphicStateTracking),this.stage&&=(this.stageLayer=c(this.stageLayer),null),this._set(`owner`,null);for(let e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new r(`graphic:layer-destroyed`,`Layer has been destroyed`));this._whenGraphics3DGraphicRequests=null,this._propertiesPool=c(this._propertiesPool),this._whenSymbolRemoved.prune(),this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=c(this._spatialIndex),this._symbolMaterials=null}clear(){this._objectStates?.allGraphicsDeleted(),this._graphicStateTracking!=null&&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._symbolMaterials&&=(this._symbolMaterials.length=0,null),this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange(`dataUpdating`),this.notifyChange(`readyToRun`),this.notifyChange(`updatingRemaining`),this._featureStore.events.emit(`changed`),this.owner.notifyContentGeometryUpdate?.()}_initializeStage(e,t){this.stage=e.stage,this.stageLayer=new Ie(this.stage,{visible:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},t);let n=this.stageLayer.events;n.on(`transformationChanged`,e=>this.notifyGraphicGeometryChanged(e.graphicUid)),n.on(`shaderTransformationChanged`,e=>this.notifyGraphicGeometryChanged(e.graphicUid)),n.on(`visibilityChanged`,e=>this.notifyGraphicVisibilityChanged(e.graphicUid)),n.on(`geometriesChanged`,e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)),n.on(`attributesChanged`,e=>Pe(e.attribute)&&this.notifyGraphicGeometryChanged(e.object.graphicUid))}notifyGraphicGeometryChanged(e){if(this.owner.notifyContentGeometryUpdate?.(),this._graphicStateTracking==null||e==null)return;let t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicGeometry(t)}notifyGraphicVisibilityChanged(e){if(this.owner.notifyContentGeometryUpdate?.(),this._graphicStateTracking==null||e==null)return;let t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicVisibility(t)}_updateLayerVisibility(){let e=this.displayFeatureLimit.maximumNumberOfFeatures,t=this._numberOfGraphics>e*Ge,n=!this.suspendedOrOutsideOfView&&!t;n!==this._visible&&(this._visible=n,this._updateStageLayerVisibility())}_updateStageLayerVisibility(){let e=this._visible&&(this.layer.opacity==null||this.layer.opacity>=q);this.stageLayer.visible!==e&&(this.stageLayer.visible=e,e?this.updateGraphicsVisibilities():this._hideAllGraphics(),this.owner.notifyContentGeometryUpdate?.())}getGraphics3DGraphicById(e){return e==null?void 0:this.graphics3DGraphics.get(e)}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,t=this.owner.layer?.objectIdField){return A(e,t)}get graphics3DGraphicsByObjectID(){let e=this.owner.layer?.objectIdField;if(!e)return;let t=new Map;return this.graphics3DGraphics.forEach(n=>{if(!n)return;let r=n.graphic,i=this._getGraphicObjectID(r,e);i!=null&&t.set(i,n)}),t}get labelsEnabled(){return!!this._labeler?.layerLabelsEnabled()}async updateLabelingInfo(e){let t=this._deconflictor?.labelingInfoChange(e),n=this._labeler?.labelingInfoChange(e);await Promise.allSettled([t,n])}updateVisibilityInfo(){this._deconflictor?.labelingInfoChange(),this._labeler?.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return`unknown`;let e=!1,t=!1;for(let[n,r]of this._symbols)if(r!=null)switch(r.getFastUpdateStatus()){case 3:return`unknown`;case 1:this._graphicsBySymbol.has(n)&&(t=!0);break;case 0:this._graphicsBySymbol.has(n)&&(e=!0);break;case 2:this._graphicsBySymbol.has(n)&&(t=e=!0)}return t?e?`mixed`:`fast`:e?`slow`:`mixed`}runTask(e){if(this._dataUpdateQueue.runTask(e),this._updateQueue.runTask(e),this._applyPendingUpdates(e),this._applyFocusAreasUpdates(e),this.notifyChange(`readyToRun`),this.readyToRun||this.notifyChange(`dataUpdating`),this.notifyChange(`updatingRemaining`),!e.hasProgressed)return Ue}setObjectIdVisibility(e,t){t?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);let n=this._findGraphics3DGraphicByObjectId(e);n!=null&&this._updateUserVisibility(n)}_findGraphics3DGraphicByObjectId(e){return a(this.graphics3DGraphics,t=>this._getGraphicObjectID(t.graphic)===e)}_updateUserVisibility(e){if(e==null)return!1;let t=e.graphic,n=this._getGraphicObjectID(t),r=t.visible&&!this.owner.suspended&&this.stageLayer.visible&&(n==null||!this._objectIdInvisibleSet.has(n));return e.setVisibilityFlag(1,1,r)}_whenGraphics3DGraphic(e){let t=this.graphics3DGraphics.get(e.uid);if(t)return Promise.resolve(t);let n=this._whenGraphics3DGraphicRequests[e.uid];if(n)return n.promise;let r=Promise.withResolvers();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,t){let n=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,i=this.owner.view.groundView.spatialReference,a=(e,t,i)=>E(e,r,t,e,n,t,i),o=(e,t,r)=>E(e,i,t,e,n,t,r),s=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:t!=null&&!!t.useViewElevation,minDemResolution:t==null?null:t.minDemResolution,minDemResolutionForPoints:this.owner.view.resolution}:null,c=await e.getProjectedBoundingBox(a,o,s,t?.signal);if(!c)return null;let l=c.boundingBox;if(c.requiresDrapedElevation){let e=this.symbolCreationContext.elevationProvider;if(e){se(l,Y);let t=e.getElevation(Y[0],Y[1],0,n,`ground`)??0;l[2]=Math.min(l[2],t),l[5]=Math.max(l[5],t)}}return{boundingBox:l,screenSpaceObjects:c.screenSpaceObjects}}async whenGraphicBounds(e,t){await _(()=>this.owner?.loadedGraphics);let n=this.owner.layer?.objectIdField,i=this.owner.loadedGraphics.find(t=>t===e||n!=null&&t.attributes!=null&&e.attributes&&t.attributes[n]===e.attributes[n]);if(!i)throw new r(`internal:graphic-not-part-of-view`,`Graphic is not part of this view`);let a=await this._whenGraphics3DGraphic(i);return this._boundsForGraphics3DGraphic(a,t)}computeAttachmentOrigin(e,t){let n=this.graphics3DGraphics.get(e.uid);if(!n)return null;let r=n.computeAttachmentOrigin();if(r.render.num===0&&r.draped.num===0)return null;S(Q,0,0,0);let i=0;if(r.render.num>0){if(!D(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,$,t))return null;C(Q,Q,$),i++}if(r.draped.num>0){let[e,n]=r.draped.origin,a=this.owner.view.groundView.spatialReference,o=this.owner.view.elevationProvider.getElevation(e,n,0,a,`ground`)??0;if(S($,e,n,o),!D($,a,$,t))return null;C(Q,Q,$),i++}return i>1&&w(Q,Q,1/i),new ae({x:Q[0],y:Q[1],z:Q[2],spatialReference:t})}getSymbolLayerSize(e,t){let n=this._symbols.get(e.id);if(n==null)throw new r(`internal:symbol-not-part-of-view`,`Symbol is not part of this view`);let i=e.symbolLayers.indexOf(t);if(i===-1)throw new r(`internal:missing-symbol-layer`,`Symbol layer is not in symbol`);let a=n.getSymbolLayerSize(i);if(a==null)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){let t=e.graphic.uid,n=this.graphics3DGraphics.get(t);if(n!=null||this._graphicsWithoutSymbol.get(t)!=null){switch(e.property){case`visible`:this._graphicUpdateVisibleHandler(n);break;case`geometry`:this._graphicUpdateGeometryHandler(n,e.graphic);break;case`symbol`:this._graphicUpdateSymbolHandler(n,e);break;case`attributes`:this.symbolCreationContext.featureExpressionInfoContext?.arcade?this._graphicUpdateGeometryHandler(n,e.graphic):n?.updateAttributes();break;case`popupTemplate`:break;case`origin-transform`:this._graphicUpdateTransformHandler(n,e)}this.owner.notifyContentGeometryUpdate?.()}}_graphicUpdateGeometryHandler(e,t){this._graphicUpdateGeometryOrTransformHandler(e,t,()=>e!=null&&e.updateGeometry()&&(this._labeler?.updateGraphicGeometry(e)??!0)?(this._labeler?.setDirty(),this._deconflictor?.setDirty(),!0):!1);let n=t.geometry;n!=null&&this._expandComputedExtent(n)}_graphicUpdateTransformHandler(e,t){let n=t.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(e,t.graphic,()=>t.newValue!=null&&e!=null&&n!=null&&e.graphics3DSymbol.updateTransform(e,n.spatialReference,t.newValue,t.action))}_graphicUpdateGeometryOrTransformHandler(e,t,n){if(t.geometry==null)this._recreateGraphic(t);else if(e==null){let e=t.symbol?.id;if(e){let t=this._symbols.get(e);if(t!=null&&t.loadStatus===0)return}this._recreateGraphic(t)}else if(!n()){let n=this._deconflictor?.getState(e);this._recreateGraphic(t);let r=this.graphics3DGraphics.get(t.uid);r&&n!=null&&this._deconflictor?.setState(r,n)}}_graphicUpdateSymbolHandler(e,t){let n=t.graphic,r=e==null?t.oldValue==null?null:this._symbols.get(t.oldValue.id):e.graphics3DSymbol;if(r==null||t.newValue==null){this._recreateGraphic(n);return}let i=r.symbol,a=this._getConvertedSymbol(t.newValue);if(a!=null&&(a.type!==i.type||a.type===`web-style`)||i.type===`web-style`){this._recreateGraphic(n);return}let o=this._graphicsBySymbol.get(i.id);if(o&&o.size!==1){this._recreateGraphic(n);return}let s=b(i,a);if(s==null){this._updateSymbolMapping(i.id,a);return}let c={diff:s,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(c),!re(c.diff)){this._recreateGraphic(n);return}let l=this._getRenderingInfo(n,!1);if(l==null){this._recreateGraphic(n);return}let u=r.extentPadding;for(let e of c.symbolStatePatches)e();if(u!==r.extentPadding&&this._recomputeExtentPadding(),e!=null)for(let t of c.graphics3DGraphicPatches)t(e,l);this._updateSymbolMapping(i.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===1&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){let t=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,t),this._graphicsWaitingForSymbol.size===1&&this.notifyChange(`dataUpdating`),t}_endGraphicUpdate(e,t){e&&(t&&this._graphicStateTracking?.updateGraphicError(e,t),this._graphicsWaitingForSymbol.delete(e.uid),this._graphicsWaitingForSymbol.size===0&&(this._cleanupSymbols(),this.notifyChange(`dataUpdating`)))}_recomputeExtentPadding(){let e=0;this._symbols.forEach(t=>{t!=null&&(e=Math.max(e,t.extentPadding))}),this._set(`extentPadding`,e)}_expandComputedExtent(e){let t=We,n=e.spatialReference;j(e,t);let r=this._viewSpatialReference,i=J.tmpVec;if(de(n,r)||O(t[0],t[1],0,n,i,r)&&(t[0]=i[0],t[1]=i[1],O(t[3],t[4],0,n,i,r),t[3]=i[0],t[4]=i[1]),!isFinite(t[0])||!isFinite(t[3])||!isFinite(t[1])||!isFinite(t[4]))return;let a=this.computedExtent,o=null,s=isFinite(t[2])&&isFinite(t[5]),c=s&&(a?.zmin==null||t[2]<a.zmin),l=s&&(a?.zmax==null||t[5]>a.zmax);a?(t[0]<a.xmin||t[1]<a.ymin||t[3]>a.xmax||t[4]>a.ymax||c||l)&&(o=this._propertiesPool.get(`computedExtent`),o.xmin=Math.min(t[0],a.xmin),o.ymin=Math.min(t[1],a.ymin),o.xmax=Math.max(t[3],a.xmax),o.ymax=Math.max(t[4],a.ymax),o.spatialReference=r):(o=this._propertiesPool.get(`computedExtent`),o.xmin=t[0],o.ymin=t[1],o.xmax=t[3],o.ymax=t[4],o.spatialReference=r),o&&(c&&(o.zmin=t[2]),l&&(o.zmax=t[5]),this._set(`computedExtent`,o))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&=(this._elevationInfoChangeAbortController.abort(),null)}async elevationInfoChange(){this._abortElevationInfoChange();let e=new AbortController;this._elevationInfoChangeAbortController=e;let t=H(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await U(t,this._viewSpatialReference,e.signal,i.getLogger(this)),d(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol((e,t,n)=>{e.globalPropertyChanged(`elevationInfo`,t)?t?.forEach(e=>{let t=e.graphic,n=e.labelLayers;for(let e of n)e.graphics3DSymbolLayer.graphics3DGraphicLayerElevationInfoChanged(t,e)}):this._recreateSymbol(n)}),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?(this.layer.elevationInfo?.mode===`relative-to-scene`||this._numberOfGraphicsProvidingElevation===0)&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=c(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&this.layer.elevationInfo.mode!==`relative-to-scene`)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new Me({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register(2,this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),this._filterVisibility!=null&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&=(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),c(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;let{loadedGraphics:t,view:n}=this.owner,r=n.basemapTerrain?.tilingScheme&&t?.length?t.toArray():null;(e||!r)&&this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=W(this.layer.screenSizePerspectiveEnabled),this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set(`computedExtent`,null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){let t=this._graphicsBySymbol.get(e),n=[];t&&(t.forEach((e,t)=>{this._conditionalRemove(e,t),this._spatialIndex?.remove(e),n.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(t,e),this._updateLayerVisibility(),this._featureStore.events.emit(`changed`),this.owner.notifyContentGeometryUpdate?.()}),this._graphicsBySymbol.set(e,new Map));let r=this._symbols.get(e);c(r),this._symbols.delete(e),this._symbolMaterials=null,c(this._unusedSymbolsCache.pop(e)),this.add(n)}_recreateGraphicsForSymbol(e){let t=this._graphicsBySymbol.get(e);if(t){let e=[];t.forEach(t=>e.push(t.graphic)),this.recreateGraphics(e)}}_conditionalRemove(e,t){this._graphicsDrapedUids.delete(t),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),this._graphicStateTracking!=null&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&e.length!==0&&(this.owner.view.basemapTerrain?.tilingScheme?(this._updatePolicyForGraphics(e)===0?this._addDelayed(e):this._addImmediate(e),this.notifyChange(`dataUpdating`)):i.getLogger(this).error(`#add()`,`Cannot add graphics before terrain surface has been initialized`))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===1&&(this.layer.geometryType===`mesh`||this.layer.geometryType==null)){for(let t of e)if(t.geometry!=null&&t.geometry.type===`mesh`&&!t.geometry.loaded)return 0}return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(let t of e)this._addGraphic(t,this._getRenderingInfo(t),1);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_addDelayed(e){for(let t of e){let e=t.uid,n=this._pendingUpdates.get(e);n?n.add?n.state!==0&&n.abortController?.abort():this._pendingAdds++:(n=new Z,this._pendingAdds++,this._pendingUpdates.set(e,n)),n.add=t}this.notifyChange(`readyToRun`),this.notifyChange(`updatingRemaining`),this.notifyChange(`dataUpdating`)}remove(e){this.effectiveUpdatePolicy===0?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange(`dataUpdating`)}_removeImmediate(e){for(let t of e)this._removeGraphic(t);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_removeDelayed(e){for(let t of e){let e=t.uid,n=this._pendingUpdates.get(e);if(n)n.add&&(n.remove?n.add=null:this._pendingUpdates.delete(e),n.state===1&&n.abortController?.abort(),this._pendingAdds--);else{let n=new Z;n.remove=t,this._pendingUpdates.set(e,n),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}this._pendingUpdates.size===0&&this._finishPendingUpdates(),this.notifyChange(`readyToRun`),this.notifyChange(`updatingRemaining`),this.notifyChange(`dataUpdating`)}_finishPendingUpdates(){this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&i.getLogger(this).warn(`pendingAdds/Removes in inconsistent state!`),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyFocusAreasUpdates(e){for(;this._focusAreasGraphicsQueue.length>0&&!e.done;){e.madeProgress();let t=this._focusAreasGraphicsQueue.pop(),n=ke(t.graphic.geometry);if(n==null)continue;let r=this.stage.view.focusAreasView?.containsGeometry(n)??!0;t.layers.forEach(e=>{(e?.type===`object3d`||e?.type===`buffer`)&&e.stageObject.geometries.some(e=>e.material instanceof Le&&e.material.parameters.focusAreaStyle==null!==r)&&this.recreateGraphics([t.graphic])})}this._focusAreasGraphicsQueue.length===0&&this.notifyChange(`readyToRun`)}_applyPendingUpdates(e){if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,this._pendingUpdates.size===0&&this._spatialIndex?.updating)this._spatialIndex.update(),e.madeProgress();else{if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(let[t,n]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(n.remove&&!n.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(n.remove),n.remove=null,this._pendingUpdates.delete(t),this._pendingRemoves===0))break}}for(let[t,n]of this._pendingUpdates){if(e.done)break;n.add&&n.state===0&&this._processPendingUpdateNew(n);let r=this.effectiveUpdatePolicy;if(n.remove&&(!n.add||n.state===2)&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(n.remove),n.remove=null,r=1),n.add)switch(n.state){case 2:this._addGraphic(n.add,n.renderingInfo,r),n.add=null,this._pendingAdds--,e.madeProgress();break;case 3:n.add=null,this._pendingAdds--}n.remove==null&&n.add==null&&this._pendingUpdates.delete(t)}this._pendingUpdates.size===0&&(this._finishPendingUpdates(),this.notifyChange(`readyToRun`),this.notifyChange(`dataUpdating`))}}_processPendingUpdateNew(e){if(!e.add){e.state=2;return}let t=e.add.geometry;t!=null&&t.type===`mesh`&&!t.loaded?this._processPendingUpdateNewMesh(e,t):this._processPendingUpdateNewRenderingInfo(e)}async _processPendingUpdateNewMesh(e,t){e.state=1,e.abortController=new AbortController;let n=e.abortController.signal;try{await t.load({signal:n})}catch(t){return this._processPendingUpdateNewError(e,t)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,t){e.abortController=null,e.state=p(t)?0:3}async _processPendingUpdateNewRenderingInfo(e){if(this.layer.renderer==null||this.layer.renderer.type!==`dictionary`){e.renderingInfo=this._getRenderingInfo(e.add),e.state=2;return}e.state=1,e.abortController=new AbortController;let t=null;try{t=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(t){e.abortController=null,e.state=p(t)?0:3;return}t?.symbol==null?(this._symbolWarningLogged||(this._symbolWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=t,e.state=2}_addGraphic(e,t,n){if(this._graphicsWithoutSymbol.set(e.uid,e),t?.symbol==null||!M(e))return;let r=this.stage.renderView.olidRenderHelper;if(r&&this.setUidToIdOnAdd){let t=R(this.owner.view,this.owner.layerViewUid);r.setUidToObjectAndLayerId(A(e,this._objectIdField),e.uid,this.layer.id,this.owner.layerViewUid,fe(this.layer)&&!!this.layer.popupEnabled&&!t&&Re(this.layer,this.owner.view.popup?.defaultPopupTemplateEnabled))}let i=t.symbol,a=this.getOrCreateGraphics3DSymbol(i,t.renderer);if(a==null)return;this._expandComputedExtent(e.geometry);let o=this._beginGraphicUpdate(e),s=new Se(e,t,this.layer,this.reportGraphicSourceMemory),c=!1,l=e=>{e===a.symbol.id&&(c=!0)};this._whenSymbolRemoved.push(l);let u=()=>{if(--this._loadingSymbols,!this.destroyed){if(this._whenSymbolRemoved.removeUnordered(l),this._graphicsWaitingForSymbol.get(e.uid)===o&&!c&&!a.destroyed&&(!this.graphicSymbolSupported||!e.symbol||e.symbol.id===a.symbol.id)){let t=this._createGraphics3DGraphic(a,s);this._spatialIndex&&t!=null&&this._spatialIndex.add(t),--a.referenced,this._endGraphicUpdate(e)}else--a.referenced,this._cleanupSymbols();this._featureStore.events.emit(`changed`),this.owner.notifyContentGeometryUpdate?.(),this._labeler?.setDirty()}},d=t=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),c||(p(t)?this.add([e]):a.destroyed||this._endGraphicUpdate(e,t)))};++this._loadingSymbols,n===0?a.load(()=>this._dataUpdateQueue.push(u,null).catch(f),e=>this._dataUpdateQueue.push(()=>d(e),null).catch(f)):a.load(u,d)}_removeGraphic(e){let t=e.uid,n=this.graphics3DGraphics.get(t);if(n){n.graphics3DSymbol.onRemoveGraphic(n);let e=n.isElevationSource;this._conditionalRemove(n,t),this._spatialIndex?.remove(n);let r=n.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(r)?.delete(t),this._graphicsWithoutSymbol.delete(t),this._removeGraphics3DGraphic(t,n,e),n.destroy(),this._featureStore.events.emit(`changed`),this.owner.notifyContentGeometryUpdate?.()}else this._graphicsWithoutSymbol.delete(t),this._graphicsWaitingForSymbol.delete(t),this._graphicsWaitingForSymbol.size===0&&(this._cleanupSymbols(),this.notifyChange(`dataUpdating`))}_hasLabelingContext(e){if(e instanceof B||e instanceof me){let t=this.symbolCreationContext.layer;return t.labelingInfo?t.labelingInfo.some(t=>t.symbol===e):!1}return!1}_hasValidSymbolCreationContext(e){return e instanceof B&&!this._hasLabelingContext(e)?(i.getLogger(this).error(`LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported.`),!1):!0}_getRenderingInfo(e,t=!0){let n=e.geometry;if(n==null)return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!oe(n.spatialReference,this._viewSpatialReference))return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&e.symbol!=null)return t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;let r=this.rendererRequiresHydratedGraphic?N(e,this.layer,null):e,a;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||this.currentRenderer!=null))a=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{let e=r.symbol||ge(r.geometry);a=new L(null,e)}return a?.symbol==null?(t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):a}_getRenderingInfoAsync(e,t){if(e.geometry==null)return this._geometryWarningLogged||(this._geometryWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&e.symbol!=null)return this._symbolWarningLogged||(this._symbolWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;let n=this.rendererRequiresHydratedGraphic?N(e,this.layer,null):e;return this.owner.getRenderingInfoAsync(n,this.currentRenderer,this._arcadeOnDemand,t)}_createGraphics3DSymbol(e,t){if(!this._hasValidSymbolCreationContext(e))return null;let n=this._getConvertedSymbol(e);if(!n)return null;let r;if(t!=null&&`backgroundFillSymbol`in t&&t.backgroundFillSymbol){let e=V(t.backgroundFillSymbol,{ignoreDrivers:!0});e.symbol!=null&&(r=e.symbol.symbolLayers)}let i=we(n,this.symbolCreationContext,r);return i.load(()=>{let e=i.extentPadding;e>this.extentPadding&&this._set(`extentPadding`,e),this.notifyChange(`averageSymbolComplexity`)},()=>{}),i}getOrCreateGraphics3DSymbol(e,t){let n=this._symbols.get(e.id);return n===void 0&&(n=this._unusedSymbolsCache.pop(e.id)??(e instanceof he?new Te(e,e=>this._dataUpdateQueue.push(e,null),e=>this._createGraphics3DSymbol(e,t)):this._createGraphics3DSymbol(e,t)),this._symbols.set(e.id,n),this._symbolMaterials=null),n!=null&&++n.referenced,n}trackGraphicState(e){return this._graphicStateTracking??=new De(this),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,e.notifyMemoryChange=this._notifyMemoryChange,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,t,n=!1){t.notifyMemoryChange=void 0,this._usedMemory-=t.usedMemory,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,n&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,t){let{graphic:n}=t;if(this._graphicsWithoutSymbol.delete(n.uid),!this._symbols.has(e.symbol.id))return this.add([n]),null;if(this.graphics3DGraphics.has(n.uid))return null;let r=e.createGraphics3DGraphic(t);if(r==null)return null;this._addGraphics3DGraphic(r);let i=e.symbol.id;if(this._graphicsBySymbol.has(i)||this._graphicsBySymbol.set(i,new Map),this._graphicsBySymbol.get(i).set(n.uid,r),r.isDraped&&this._graphicsDrapedUids.add(n.uid),r.centroid=null,n.geometry!=null&&n.geometry.type!==`point`&&(r.centroid=Oe(n.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),this._scaleVisibility!=null&&this._scaleVisibility.updateVisibility(r),this._filterVisibility!=null){let{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(1,4,e),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),r.initialize(this.stageLayer),this._graphicStateTracking!=null&&this._graphicStateTracking.addGraphic(r);let a=this._whenGraphics3DGraphicRequests[n.uid];return a&&(delete this._whenGraphics3DGraphicRequests[n.uid],a.resolve(r)),this._symbolMaterials=null,r}async rendererChange(e){if(this._rendererChangeAbortController=o(this._rendererChangeAbortController),e!==this.currentRenderer){if(this._validateRenderer(e),e??this._currentRendererChange(null,!1),!F(e))this._currentRendererChange(e,!1);else if(e?.arcadeRequired){let t=new AbortController;this._rendererChangeAbortController=t;let{arcadeUtils:n}=await this._ensureArcade();d(t);let r=n.hasGeometryOperations(e),i=r||await this._rendererUsesFieldsRequiringArcadeTypeConversion(e);d(t),r&&(await n.enableGeometryOperations(),d(t)),this.effectiveUpdatePolicy===0?await this._updateQueue.push(()=>this._currentRendererChange(e,i),t.signal):this._currentRendererChange(e,i),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===0){let t=new AbortController;this._rendererChangeAbortController=t,await this._updateQueue.push(()=>this._currentRendererChange(e,!1),t.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1)}}async _ensureArcade(){return this._arcadeOnDemand??=await z(),this._arcadeOnDemand}async _rendererUsesFieldsRequiringArcadeTypeConversion(e){let{fieldsIndex:t}=this.layer;return t!=null&&(await e.getRequiredFields(t)).some(e=>{switch(t.get(e)?.type){case`date`:case`date-only`:case`time-only`:case`timestamp-offset`:return!0;default:return!1}})}_currentRendererChange(e,t){this.currentRenderer=e,this.rendererRequiresHydratedGraphic=t,this.symbolCreationContext.arcade=this._arcadeOnDemand;let n=this.symbolCreationContext.renderer;if(e===n)return;if(this._symbolConversionCache.clear(),this._unusedSymbolsCache.clear(),e==null){this.symbolCreationContext.renderer=null,this.recreateAllGraphicsAndSymbols();return}let r=b(n,e);this._updateUnchangedSymbolMappings(r,e,n),this.symbolCreationContext.renderer=e,r!=null&&(r.type===`complete`?this.recreateAllGraphicsAndSymbols():r.type===`partial`&&(this._applyRendererDiff(r,e,n)?this._labeler?.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange(`averageSymbolComplexity`))}_diffHasSymbolChange(e){for(let t in e.diff)switch(t){case`visualVariables`:case`defaultSymbol`:case`uniqueValueInfos`:break;case`uniqueValueGroups`:case`authoringInfo`:case`fieldDelimiter`:delete e.diff[t];break;default:return!0}return!1}_applySymbolSetDiff(e,t,n){e||=[],t||=[];let r=[];for(let i of t){let t=this._graphicsBySymbol.get(i.id);t&&t.forEach((a,o)=>{let s=a.graphic,c=this.layer instanceof pe?this.layer:null,l=this._arcadeOnDemand;if(i===n.defaultSymbol&&n.getSymbol(N(s,c,null),{arcade:l})===n.defaultSymbol)return;e.length||n.defaultSymbol?r.push(s):this._graphicsWithoutSymbol.set(o,s);let u=this.graphics3DGraphics.get(o);this._conditionalRemove(u,o),a.destroy(),t.delete(o),this._removeGraphics3DGraphic(o,u),this._updateLayerVisibility()}),this._whenSymbolRemoved.forAll(e=>e(i.id))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach(e=>r.push(e)),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_applyUniqueValueRendererDiff(e,t,r){let i=e.diff.defaultSymbol,a=e.diff.uniqueValueInfos;if(i||a){let o=a?.changed,s=a?.unchanged;if(o&&s&&o.some(e=>s.some(t=>t.oldValue.symbol?.id===e.oldValue.symbol?.id)))return!1;let c=a?a.added.map(e=>e.symbol).filter(n):[],l=a?a.removed.map(e=>e.symbol).filter(n):[];if(o)for(let e=0;e<o.length;e++)c.push(o[e].newValue.symbol),l.push(o[e].oldValue.symbol);return i?(r.defaultSymbol&&l.push(r.defaultSymbol),t.defaultSymbol&&c.push(t.defaultSymbol)):r.defaultSymbol&&c.length&&l.push(t.defaultSymbol),this._applySymbolSetDiff(c,l,t),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,t,n){if(t?.type!==`unique-value`||n?.type!==`unique-value`||e!=null&&e.type!==`partial`)return[];let r=e=>e==null?null:e.id,i=e&&e.diff,a=i?.defaultSymbol,o=i&&i.uniqueValueInfos,s;if(o)s=o.unchanged.map(e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)}));else{s=[];for(let e of n.uniqueValueInfos??[]){let n=r(e.symbol),i=t.uniqueValueInfos?.find(t=>t.value===e.value);i&&n!==r(i.symbol)&&s.push({oldId:n,newId:r(i.symbol)})}}return!a&&n.defaultSymbol&&s.push({oldId:r(n.defaultSymbol),newId:r(t.defaultSymbol)}),s}_updateSymbolMapping(e,t){let n=t!=null&&t?typeof t==`string`?t:t.id:null;if(e==null||e===n)return;let r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),r!==void 0&&this._graphicsBySymbol.set(n,r);let i=this._symbols.get(e);if(i!==void 0&&(this._symbols.delete(e),this._symbols.set(n,i),this._symbolMaterials=null,i!=null)){let e=typeof t==`string`?null:t;e==null?i.symbol.id=n:i.symbol=e}}_updateUnchangedSymbolMappings(e,t,n){let r=this._calculateUnchangedSymbolMapping(e,t,n);for(let{oldId:e,newId:t}of r)this._updateSymbolMapping(e,t)}_applyRendererDiff(e,t,n){if(this._diffHasSymbolChange(e))return!1;if(t instanceof P&&n instanceof P&&this._applyUniqueValueRendererDiff(e,t,n)&&Object.keys(e.diff).length===0)return!0;for(let n of this._graphicsBySymbol.keys()){let r=this._symbols.get(n);if(r!=null)switch(r.applyRendererDiff(e,t)){case 0:this._recreateSymbol(n);break;case 1:this._recreateGraphicsForSymbol(n)}}return!0}opacityChange(){this._updateStageLayerVisibility(),this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged(`opacity`,t))}_screenSizePerspectiveEnabledChange(){this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged(`screenSizePerspectiveEnabled`,t)),this._labeler?.screenSizePerspectiveEnabledChanged(),this._deconflictor?.screenSizePerspectiveEnabledChanged()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged(`slicePlaneEnabled`,t)),this._deconflictor?.slicePlaneEnabledChange(),this._labeler?.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol((e,t,n)=>{e.globalPropertyChanged(`physicalBasedRenderingEnabled`,t)||this._recreateSymbol(n)})}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol((e,t,n)=>{e.globalPropertyChanged(`skipHighSymbolLods`,t)||this._recreateSymbol(n)})}_pixelRatioChange(){this.forEachGraphics3DSymbol((e,t,n)=>{e.globalPropertyChanged(`pixelRatio`,t)||this._recreateSymbol(n)})}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=v(()=>{this._updatingPendingLoadedGraphicsChange=null})}setClippingExtent(e,t){let n=this.symbolCreationContext.clippingExtent,r=ue();return Ne(e,r,t)?this.symbolCreationContext.clippingExtent=ce(k(),r):this.symbolCreationContext.clippingExtent=null,!le(this.symbolCreationContext.clippingExtent,n)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let t=!1;this.graphics3DGraphics.forEach(n=>{e(n)&&(t=!0)}),t&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}forEachGraphics3DSymbol(e,t){for(let[t,n]of this._symbols){if(n==null)return;e(n,this._graphicsBySymbol.get(t)||Ke,t)}if(!t?.excludeUnused)for(let t of this._unusedSymbolsCache)e(t,void 0,t.symbol.id)}updateGraphicsVisibilities(){this._filterVisibility!=null&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities(e=>{let t=this._updateUserVisibility(e),n=!!this._scaleVisibility?.updateVisibility(e);return t||n})}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,1,!1))}_validateRenderer(e){let t=()=>`'${this.layer.title?`${this.layer.title}, `:``}id:${this.layer.id}'`,n=I(e,{geometryType:this.layer?.geometryType,logWarning:(e,n)=>i.getLogger(this).warn(e,`Symbology conversion for layer ${t()}: ${n}`)});if(n){let e=`Renderer for layer ${t} is not supported in a SceneView`;i.getLogger(this).warn(e,n.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach((t,n)=>{if(t==null||t.referenced>0)return;let r=this._graphicsBySymbol.get(n);r&&r.size!==0||(this._graphicsBySymbol.delete(n),this._symbols.delete(n),this._symbolMaterials=null,this._unusedSymbolsCache.put(n,t,l),e=!0)}),e&&(this._recomputeExtentPadding(),this.notifyChange(`averageSymbolComplexity`))}get test(){}get performanceInfo(){return new Ee(this.graphics3DGraphics.size,this.graphics3DGraphics.values().reduce((e,t)=>e+ +!!t.isVisible(),0),this._graphicsWithoutSymbol.size,this._pendingUpdates.size)}};e([y({readOnly:!0})],X.prototype,`computedExtent`,void 0),e([y()],X.prototype,`currentRenderer`,void 0),e([y()],X.prototype,`rendererRequiresHydratedGraphic`,void 0),e([y()],X.prototype,`_frameTaskHandle`,void 0),e([y()],X.prototype,`_dataUpdateQueue`,void 0),e([y()],X.prototype,`_updateQueue`,void 0),e([y({readOnly:!0})],X.prototype,`_viewSpatialReference`,null),e([y()],X.prototype,`_rendererChangeAbortController`,void 0),e([y()],X.prototype,`_elevationInfoChangeAbortController`,void 0),e([y()],X.prototype,`_initializeAbortController`,void 0),e([y()],X.prototype,`_elevationAlignment`,void 0),e([y()],X.prototype,`_scaleVisibility`,void 0),e([y()],X.prototype,`_filterVisibility`,void 0),e([y()],X.prototype,`_initializePromise`,void 0),e([y()],X.prototype,`_spatialIndex`,void 0),e([y({readOnly:!0})],X.prototype,`extentPadding`,void 0),e([y()],X.prototype,`_updatingPendingLoadedGraphicsChange`,void 0),e([y()],X.prototype,`_featureStore`,void 0),e([y()],X.prototype,`_objectStates`,void 0),e([y()],X.prototype,`_loadingSymbols`,void 0),e([y({constructOnly:!0})],X.prototype,`compressionTracker`,void 0),e([y()],X.prototype,`preferredUpdatePolicy`,void 0),e([y()],X.prototype,`_forcedUpdatePolicy`,void 0),e([y({readOnly:!0})],X.prototype,`effectiveUpdatePolicy`,null),e([y({constructOnly:!0})],X.prototype,`elevationFeatureExpressionEnabled`,void 0),e([y({constructOnly:!0})],X.prototype,`owner`,void 0),e([y({constructOnly:!0})],X.prototype,`layer`,void 0),e([y({constructOnly:!0})],X.prototype,`graphicSymbolSupported`,void 0),e([y({constructOnly:!0})],X.prototype,`getRenderingInfoWithoutRenderer`,void 0),e([y({constructOnly:!0})],X.prototype,`componentFactories`,void 0),e([y({constructOnly:!0})],X.prototype,`setUidToIdOnAdd`,void 0),e([y({constructOnly:!0})],X.prototype,`reportGraphicSourceMemory`,void 0),e([y()],X.prototype,`featureStore`,null),e([y()],X.prototype,`initializePromise`,null),e([y()],X.prototype,`scaleVisibility`,null),e([y()],X.prototype,`elevationAlignment`,null),e([y()],X.prototype,`objectStates`,null),e([y()],X.prototype,`filterVisibility`,null),e([y({readOnly:!0})],X.prototype,`updating`,null),e([y({readOnly:!0})],X.prototype,`dataUpdating`,null),e([y({readOnly:!0})],X.prototype,`readyToRun`,null),e([y({readOnly:!0})],X.prototype,`suspendedOrOutsideOfView`,null),e([y({readOnly:!0})],X.prototype,`updatingRemaining`,null),e([y({readOnly:!0})],X.prototype,`displayFeatureLimit`,null),e([y({readOnly:!0})],X.prototype,`averageSymbolComplexity`,null),e([y({constructOnly:!0})],X.prototype,`hasZ`,void 0),e([y({constructOnly:!0})],X.prototype,`hasM`,void 0),e([y()],X.prototype,`_objectIdField`,null),X=J=e([ne(`esri.views.3d.layers.graphics.Graphics3DCore`)],X);class Z{constructor(){this.add=null,this.renderingInfo=null,this.state=0,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=0,this.abortController=null,this.remove=null}}const Ge=10,Q=T(),$=T(),Ke=new Map;export{X as Graphics3DCore};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as n}from"../../../../core/arrayUtils.js";import r from"../../../../core/Error.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{findInMap as a}from"../../../../core/MapUtils.js";import{abortMaybe as o,removeMaybe as s,destroyMaybe as c}from"../../../../core/maybe.js";import{MinPriority as l}from"../../../../core/MemCache.js";import u from"../../../../core/PooledArray.js";import{throwIfAborted as d,ignoreAbortErrors as f,isAbortError as p}from"../../../../core/promiseUtils.js";import m from"../../../../core/Queue.js";import{when as h,watch as g,on as ee,syncAndInitial as te,whenOnce as _}from"../../../../core/reactiveUtils.js";import{schedule as v}from"../../../../core/scheduling.js";import{property as y,subclass as ne}from"../../../../core/accessorSupport/decorators.js";import{diff as b,isEmpty as re}from"../../../../core/accessorSupport/diffUtils.js";import{runUntracked as x}from"../../../../core/accessorSupport/tracking.js";import{set as S,add as C,scale as w}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as T}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import ie from"../../../../geometry/Extent.js";import ae from"../../../../geometry/Point.js";import{canProjectWithoutEngine as oe}from"../../../../geometry/projectionUtils.js";import{projectBuffer as E}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as D}from"../../../../geometry/projection/projectVectorToVector.js";import{projectXYZToVector as O}from"../../../../geometry/projection/projectXYZToVector.js";import{center as se,fromRect as ce,create as k,equals as le}from"../../../../geometry/support/aaBoundingBox.js";import{create as ue}from"../../../../geometry/support/aaBoundingRect.js";import{equals as de}from"../../../../geometry/support/spatialReferenceUtils.js";import{isPopupProvider as fe}from"../../../../graphic/getPopupProvider.js";import pe from"../../../../layers/Layer.js";import{getObjectId as A,computeAABB as j,hasGeometry as M}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as N}from"../../../../layers/graphics/hydratedFeatures.js";import P from"../../../../renderers/UniqueValueRenderer.js";import{isSupportedRenderer3D as F,validateTo3D as I}from"../../../../renderers/support/rendererConversion.js";import{RenderingInfo as L}from"../../../../renderers/support/RenderingInfo.js";import{isBasemapLayerView as R}from"../../../../support/basemapUtils.js";import{loadArcade as z}from"../../../../support/loadArcade.js";import B from"../../../../symbols/LabelSymbol3D.js";import me from"../../../../symbols/TextSymbol.js";import he from"../../../../symbols/WebStyleSymbol.js";import{getDefaultSymbol3D as ge}from"../../../../symbols/support/defaults3D.js";import{to3D as V}from"../../../../symbols/support/symbolConversion.js";import{aggregateSymbolComplexity as _e,defaultSymbolComplexity as ve}from"./defaultSymbolComplexity.js";import{DisplayFeatureLimit as ye}from"./DisplayFeatureLimit.js";import{ViewElevationProvider as be}from"./ElevationQuery.js";import{extractExpressionInfo as H,createContext as U}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as xe}from"./Graphics3DFeatureStore.js";import{Graphics3DGraphicCreationContext as Se}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as Ce}from"./Graphics3DSymbolCreationContext.js";import{make as we}from"./Graphics3DSymbolFactory.js";import{Graphics3DWebStyleSymbol as Te}from"./Graphics3DWebStyleSymbol.js";import{GraphicsCorePerformanceInfo as Ee}from"./GraphicsCorePerformanceInfo.js";import{GraphicStateTracking as De}from"./GraphicStateTracking.js";import{computeCentroid as Oe}from"./graphicUtils.js";import{placePointOnGeometry as ke}from"./pointUtils.js";import{SpatialIndex2D as Ae}from"./SpatialIndex2D.js";import{AggregateSymbolComplexity as je}from"./SymbolComplexity.js";import{StageLayerElevationProvider as Me}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as Ne}from"../../support/extentUtils.js";import{affectsGeometry as Pe}from"../../webgl-engine/lib/affectsGeometry.js";import{GridLocalOriginFactory as Fe}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{isScreenSizePerspectiveEnabled as W}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{WebGLLayer as Ie}from"../../webgl-engine/lib/WebGLLayer.js";import{HUDMaterial as Le}from"../../webgl-engine/materials/HUDMaterial.js";import{hasPopupTemplate as Re}from"../../../layers/support/popupUtils.js";import{PromiseQueue as G}from"../../../support/PromiseQueue.js";import{PropertiesPool as ze}from"../../../support/PropertiesPool.js";import{ImmediateTask as K,noBudget as Be,TaskPriority as Ve}from"../../../support/Scheduler.js";import{TextureCompressionTracker as He}from"../../../support/TextureCompressionTracker.js";import{Yield as Ue}from"../../../support/Yield.js";import{alphaCutoff as q}from"../../../../webscene/support/AlphaCutoff.js";var J;const Y=T(),We=k();let X=class extends t{static{J=this}static{this.tmpVec=T()}get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new Ae({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 deconflictor(){return this._deconflictor}get labeler(){return this._labeler}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return this.currentRenderer!=null&&this.currentRenderer.type===`dictionary`?0: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.dataUpdating||this._elevationAlignment?.updating||this._scaleVisibility?.updating||this._filterVisibility?.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._frameTaskHandle.updating||this._updateQueue.updating||this.readyToRun)}get dataUpdating(){return!!(this._graphicsWaitingForSymbol.size>0||this._pendingUpdates.size>0||this._spatialIndex?.updating||this._updatingPendingLoadedGraphicsChange||this._dataUpdateQueue.updating||this._loadingSymbols>0||this.compressionTracker.compressing)}get readyToRun(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating||this._dataUpdateQueue.readyToRun||this._updateQueue.readyToRun||this._focusAreasGraphicsQueue.length>0}get suspendedOrOutsideOfView(){return this.owner.suspended||!!this.owner.suspendInfo?.outsideOfView}get updatingRemaining(){return x(()=>this.updating?this._pendingUpdates.size+(this._spatialIndex?.updatingRemaining||0)*.1+(this._elevationAlignment?.updatingRemaining||0)*.1:0)}get displayFeatureLimit(){let e=this.owner&&this.owner.view&&this.owner.view.qualitySettings,t=e?.graphics3D.minTotalNumberOfFeatures??0,n=e?.graphics3D.maxTotalNumberOfFeatures??0,r=e?.graphics3D.maxNumberOfDrawCalls??0,i=e?.graphics3D.maxTotalNumberOfVertices??0,a=this.averageSymbolComplexity,o=Math.max(1,a?.verticesPerFeature??1),s=a&&a.drawCallsPerFeature>0&&r>0?r/a.drawCallsPerFeature:n,c=Math.ceil(i/o),l=Math.max(t,Math.min(n,c,s)),u=this._get(`displayFeatureLimit`);return u&&u.maximumTotalNumberOfVertices===i&&u.averageSymbolComplexity===a&&u.maximumNumberOfFeatures===l?u:new ye(i,l,a)}get averageSymbolComplexity(){return x(()=>{let e=this._averageSymbolComplexities,t=this._get(`averageSymbolComplexity`);return e.numComplexities===0||t!=null&&(e.estimated&&(t.verticesPerFeature>=e.verticesPerFeature||t.verticesPerCoordinate>=e.verticesPerCoordinate||t.drawCallsPerFeature>=e.drawCallsPerFeature)||t.verticesPerFeature===e.verticesPerFeature&&t.verticesPerCoordinate===e.verticesPerCoordinate&&t.drawCallsPerFeature===e.drawCallsPerFeature)?t:e})}get _averageSymbolComplexities(){let e=this._totalSymbolComplexities;return e.numComplexities>0&&(e.verticesPerFeature/=e.numComplexities,e.verticesPerCoordinate/=e.numComplexities,e.drawCallsPerFeature/=e.numComplexities,e.memory.bytesPerFeature/=e.numComplexities,e.memory.bytesPerFeatureLabel/=e.numComplexities,e.memory.resourceBytes/=e.numComplexities,e.memory.draped.bytesPerFeature/=e.numComplexities,e.memory.draped.bytesPerFeatureLabel/=e.numComplexities),e}get _totalSymbolComplexities(){let e=new je;return this._forEachSymbolComplexity(t=>_e(t,e)),e}get usedMemory(){let e=this.labelsEnabled?(this.averageSymbolComplexity?.memory.bytesPerFeatureLabel??0)*this._numberOfGraphics:0,t=0;if(this._forEachSymbolComplexityUsed(e=>t+=e?.memory.resourceBytes??0),this._symbolMaterials==null){this._symbolMaterials=[];for(let e of this._symbols.values())if(e!=null){for(let t of e.symbolLayers)if(t)for(let e of t.materials)e&&this._symbolMaterials.push(e)}}let n=this.owner.view.stage.renderer,r=this.owner.view.overlayManager.renderer,i=this._symbolMaterials.reduce((e,t)=>e+((n.getMaterialRenderer(t)||r.getMaterialRenderer(t))?.usedMemory??0),0);return this._usedMemory+e+t+i}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){let e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(this.averageSymbolComplexity!=null){let 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}_forEachSymbolComplexity(e){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(e):this._forEachSymbolComplexityUsed(e)}get visible(){return this._visible}_getConvertedSymbol(e){let t=e;if(t.type===`web-style`)return t.clone();let n=this._symbolConversionCache.get(t.id);if(n!=null)return n;let r=V(t,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(t),cimFallbackEnabled:!0}),a=r.symbol||null;return a==null&&r.error&&i.getLogger(this).error(r.error.message),this._symbolConversionCache.set(t.id,a),a}_getSymbolComplexitiesUsedOrRenderer(e){let t=this.currentRenderer;if(t==null)return;let n=t.symbols,r=`backgroundFillSymbol`in t?t.backgroundFillSymbol:null;if(!r&&!n.length)return;let i=this._getSymbolComplexityUsedOrRenderer(r);i!=null&&e(i);for(let t of n){let n=this._getSymbolComplexityUsedOrRenderer(t);n!=null&&e(n)}}_getSymbolComplexityUsedOrRenderer(e){if(e==null)return null;let t=this._symbols.get(e.id);if(t!=null)return t.complexity;let n=this._getConvertedSymbol(e);return n==null?null:ve(n)}_forEachSymbolComplexityUsed(e){this._symbols.forEach(t=>{e(t?.complexity)})}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new ze({computedExtent:()=>new ie},this),this.computedExtent=null,this.currentRenderer=null,this.rendererRequiresHydratedGraphic=!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._frameTaskHandle=K,this._dataUpdateQueue=new G,this._updateQueue=new G,this._focusAreasGraphicsQueue=new m,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._elevationAlignment=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._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this.compressionTracker=new He,this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new u,this.preferredUpdatePolicy=1,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.reportGraphicSourceMemory=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this._notifyMemoryChange=e=>{this._usedMemory+=e},this._unusedSymbolsCache=e.owner.view.resourceController.memoryController.newCache(`graphics-3d-unused-symbols`,e=>e.destroy()),this.symbolCreationContext=new Ce(e.owner.view.resourceController.scheduler,(e,t)=>this._updateQueue.push(e,t),e.owner.layerViewUid,this.compressionTracker)}initialize(){this._featureStore=new xe({objectIdField: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)});let e=(e,t,n)=>this.spatialIndex.queryGraphicUIDsInExtent(e,t,n),{componentFactories:t}=this;this._elevationAlignment=t.elevationAlignment?.(this,e),this._scaleVisibility=t.scaleVisibility?.(this,e),this._filterVisibility=t.filterVisibility?.({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(1,4,e(A(t.graphic,this._objectIdField)))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(1,4,e)),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,4,!0))}),this._deconflictor=t.deconflictor?.(this),this._labeler=t.labeler?.(this,this._scaleVisibility),this._objectStates=t.objectStates?.(this),this._initializeAbortController=new AbortController,this.addHandles(h(()=>this.owner.view.state.highlights,()=>{let{highlightOrderMap:e}=this.owner.view.state;this.graphics3DGraphics.forEach(t=>t.updateHighlights(e))})),this._initializePromise=this._initializeAsync()}async _initializeAsync(){let e=this._initializeAbortController?.signal,t=this.owner.view;this._viewElevationProvider=new be(this._viewSpatialReference,t),this._initializeStage(t,this.owner.layerViewUid);let n=t.sharedSymbolResources;this.symbolCreationContext.sharedResources=n,this.currentRenderer!=null&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.renderCoordsHelper=t.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new Fe(t.renderSpatialReference),this.symbolCreationContext.elevationProvider=t.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e),this.symbolCreationContext.focusAreaStyle=t.map?.focusAreas.style??null;let r=H(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await U(r,this._viewSpatialReference,e,i.getLogger(this)),d(e),this.symbolCreationContext.screenSizePerspectiveEnabled=W(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){let{owner:e}=this;this.symbolCreationContext.drapeSourceRenderer=t.overlayManager.registerGeometryDrapeSource(e)}this.addHandles([g(()=>this.suspendedOrOutsideOfView,()=>this._updateQueue.unshift(()=>this._updateLayerVisibility(),null).catch(f)),g(()=>W(this.layer?.screenSizePerspectiveEnabled),e=>{e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._screenSizePerspectiveEnabledChange())}),g(()=>this.owner.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(!!e)),g(()=>this.owner.view.state?.rasterPixelRatio,()=>this._pixelRatioChange()),g(()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._physicalBasedRenderingChange(e)),g(()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,e=>this._skipHighSymbolLoDsChange(e)),g(()=>this.owner.view.focusAreasView?.polygons,()=>this._updateFocusedLabels()),g(()=>this.owner.view.timeZone,()=>{this.currentRenderer?.arcadeRequired&&this.recreateAllGraphics()}),g(()=>this.owner.view.map?.focusAreas.style,e=>{this.symbolCreationContext.focusAreaStyle=e??null,this.recreateAllGraphicsAndSymbols()}),h(()=>t.basemapTerrain?.tilingScheme,e=>{let n=t.groundView?.spatialReference;!e.spatialReference.equals(this.symbolCreationContext.overlaySR)&&n!=null&&(this.symbolCreationContext.overlaySR=n),this.hasHandles(`loaded-graphics`)?this.recreateAllGraphics():this.addHandles([ee(()=>this.owner?.loadedGraphics,`change`,e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()},{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],`loaded-graphics`)},{initial:!0}),g(()=>this.effectiveUpdatePolicy,e=>{this.stageLayer!=null&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===0,e===1&&this.runTask(Be)},te)]),this._frameTaskHandle=t.resourceController.scheduler.registerTask(Ve.GRAPHICS_CORE,this),this.layer&&`featureReduction`in this.layer&&this.addHandles(g(()=>this.layer.featureReduction,()=>this._deconflictor?.featureReductionChange())),this.notifyChange(`averageSymbolComplexity`),this.rendererChange(this.owner.renderer).catch(()=>{}),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController=o(this._initializeAbortController)}_updateFocusedLabels(){this._focusAreasGraphicsQueue.clear(),this.forEachGraphics3DSymbol((e,t)=>{t&&e.needsUpdateFocus&&t.forEach(e=>{this._focusAreasGraphicsQueue.push(e)})})}destroy(){if(this._unusedSymbolsCache.destroy(),this._abortInitialize(),this._rendererChangeAbortController=o(this._rendererChangeAbortController),this._abortElevationInfoChange(),this._frameTaskHandle.remove(),this._frameTaskHandle=K,this._dataUpdateQueue.cancelAll(),this._updateQueue.cancelAll(),this._deconflictor=s(this._deconflictor),this._labeler=s(this._labeler),this._elevationAlignment=c(this._elevationAlignment),this._scaleVisibility=c(this._scaleVisibility),this._filterVisibility=c(this._filterVisibility),this._objectStates=c(this._objectStates),this.clear(),`drapeSourceType`in this.owner){let{owner:e}=this;this.stage.view.overlayManager.unregisterDrapeSource(e)}this._featureStore=c(this._featureStore),this._updatingPendingLoadedGraphicsChange=s(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=c(this._graphicStateTracking),this.stage&&=(this.stageLayer=c(this.stageLayer),null),this._set(`owner`,null);for(let e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new r(`graphic:layer-destroyed`,`Layer has been destroyed`));this._whenGraphics3DGraphicRequests=null,this._propertiesPool=c(this._propertiesPool),this._whenSymbolRemoved.prune(),this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=c(this._spatialIndex),this._symbolMaterials=null}clear(){this._objectStates?.allGraphicsDeleted(),this._graphicStateTracking!=null&&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._symbolMaterials&&=(this._symbolMaterials.length=0,null),this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange(`dataUpdating`),this.notifyChange(`readyToRun`),this.notifyChange(`updatingRemaining`),this._featureStore.events.emit(`changed`),this.owner.notifyContentGeometryUpdate?.()}_initializeStage(e,t){this.stage=e.stage,this.stageLayer=new Ie(this.stage,{visible:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},t);let n=this.stageLayer.events;n.on(`transformationChanged`,e=>this.notifyGraphicGeometryChanged(e.graphicUid)),n.on(`shaderTransformationChanged`,e=>this.notifyGraphicGeometryChanged(e.graphicUid)),n.on(`visibilityChanged`,e=>this.notifyGraphicVisibilityChanged(e.graphicUid)),n.on(`geometriesChanged`,e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)),n.on(`attributesChanged`,e=>Pe(e.attribute)&&this.notifyGraphicGeometryChanged(e.object.graphicUid))}notifyGraphicGeometryChanged(e){if(this.owner.notifyContentGeometryUpdate?.(),this._graphicStateTracking==null||e==null)return;let t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicGeometry(t)}notifyGraphicVisibilityChanged(e){if(this.owner.notifyContentGeometryUpdate?.(),this._graphicStateTracking==null||e==null)return;let t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicVisibility(t)}_updateLayerVisibility(){let e=this.displayFeatureLimit.maximumNumberOfFeatures,t=this._numberOfGraphics>e*Ge,n=!this.suspendedOrOutsideOfView&&!t;n!==this._visible&&(this._visible=n,this._updateStageLayerVisibility())}_updateStageLayerVisibility(){let e=this._visible&&(this.layer.opacity==null||this.layer.opacity>=q);this.stageLayer.visible!==e&&(this.stageLayer.visible=e,e?this.updateGraphicsVisibilities():this._hideAllGraphics(),this.owner.notifyContentGeometryUpdate?.())}getGraphics3DGraphicById(e){return e==null?void 0:this.graphics3DGraphics.get(e)}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,t=this.owner.layer?.objectIdField){return A(e,t)}get graphics3DGraphicsByObjectID(){let e=this.owner.layer?.objectIdField;if(!e)return;let t=new Map;return this.graphics3DGraphics.forEach(n=>{if(!n)return;let r=n.graphic,i=this._getGraphicObjectID(r,e);i!=null&&t.set(i,n)}),t}get labelsEnabled(){return!!this._labeler?.layerLabelsEnabled()}async updateLabelingInfo(e){let t=this._deconflictor?.labelingInfoChange(e),n=this._labeler?.labelingInfoChange(e);await Promise.allSettled([t,n])}updateVisibilityInfo(){this._deconflictor?.labelingInfoChange(),this._labeler?.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return`unknown`;let e=!1,t=!1;for(let[n,r]of this._symbols)if(r!=null)switch(r.getFastUpdateStatus()){case 3:return`unknown`;case 1:this._graphicsBySymbol.has(n)&&(t=!0);break;case 0:this._graphicsBySymbol.has(n)&&(e=!0);break;case 2:this._graphicsBySymbol.has(n)&&(t=e=!0)}return t?e?`mixed`:`fast`:e?`slow`:`mixed`}runTask(e){if(this._dataUpdateQueue.runTask(e),this._updateQueue.runTask(e),this._applyPendingUpdates(e),this._applyFocusAreasUpdates(e),this.notifyChange(`readyToRun`),this.readyToRun||this.notifyChange(`dataUpdating`),this.notifyChange(`updatingRemaining`),!e.hasProgressed)return Ue}setObjectIdVisibility(e,t){t?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);let n=this._findGraphics3DGraphicByObjectId(e);n!=null&&this._updateUserVisibility(n)}_findGraphics3DGraphicByObjectId(e){return a(this.graphics3DGraphics,t=>this._getGraphicObjectID(t.graphic)===e)}_updateUserVisibility(e){if(e==null)return!1;let t=e.graphic,n=this._getGraphicObjectID(t),r=t.visible&&!this.owner.suspended&&this.stageLayer.visible&&(n==null||!this._objectIdInvisibleSet.has(n));return e.setVisibilityFlag(1,1,r)}_whenGraphics3DGraphic(e){let t=this.graphics3DGraphics.get(e.uid);if(t)return Promise.resolve(t);let n=this._whenGraphics3DGraphicRequests[e.uid];if(n)return n.promise;let r=Promise.withResolvers();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,t){let n=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,i=this.owner.view.groundView.spatialReference,a=(e,t,i)=>E(e,r,t,e,n,t,i),o=(e,t,r)=>E(e,i,t,e,n,t,r),s=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:t!=null&&!!t.useViewElevation,minDemResolution:t==null?null:t.minDemResolution,minDemResolutionForPoints:this.owner.view.resolution}:null,c=await e.getProjectedBoundingBox(a,o,s,t?.signal);if(!c)return null;let l=c.boundingBox;if(c.requiresDrapedElevation){let e=this.symbolCreationContext.elevationProvider;if(e){se(l,Y);let t=e.getElevation(Y[0],Y[1],0,n,`ground`)??0;l[2]=Math.min(l[2],t),l[5]=Math.max(l[5],t)}}return{boundingBox:l,screenSpaceObjects:c.screenSpaceObjects}}async whenGraphicBounds(e,t){await _(()=>this.owner?.loadedGraphics);let n=this.owner.layer?.objectIdField,i=this.owner.loadedGraphics.find(t=>t===e||n!=null&&t.attributes!=null&&e.attributes&&t.attributes[n]===e.attributes[n]);if(!i)throw new r(`internal:graphic-not-part-of-view`,`Graphic is not part of this view`);let a=await this._whenGraphics3DGraphic(i);return this._boundsForGraphics3DGraphic(a,t)}computeAttachmentOrigin(e,t){let n=this.graphics3DGraphics.get(e.uid);if(!n)return null;let r=n.computeAttachmentOrigin();if(r.render.num===0&&r.draped.num===0)return null;S(Q,0,0,0);let i=0;if(r.render.num>0){if(!D(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,$,t))return null;C(Q,Q,$),i++}if(r.draped.num>0){let[e,n]=r.draped.origin,a=this.owner.view.groundView.spatialReference,o=this.owner.view.elevationProvider.getElevation(e,n,0,a,`ground`)??0;if(S($,e,n,o),!D($,a,$,t))return null;C(Q,Q,$),i++}return i>1&&w(Q,Q,1/i),new ae({x:Q[0],y:Q[1],z:Q[2],spatialReference:t})}getSymbolLayerSize(e,t){let n=this._symbols.get(e.id);if(n==null)throw new r(`internal:symbol-not-part-of-view`,`Symbol is not part of this view`);let i=e.symbolLayers.indexOf(t);if(i===-1)throw new r(`internal:missing-symbol-layer`,`Symbol layer is not in symbol`);let a=n.getSymbolLayerSize(i);if(a==null)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){let t=e.graphic.uid,n=this.graphics3DGraphics.get(t);if(n!=null||this._graphicsWithoutSymbol.get(t)!=null){switch(e.property){case`visible`:this._graphicUpdateVisibleHandler(n);break;case`geometry`:this._graphicUpdateGeometryHandler(n,e.graphic);break;case`symbol`:this._graphicUpdateSymbolHandler(n,e);break;case`attributes`:this.symbolCreationContext.featureExpressionInfoContext?.arcade?this._graphicUpdateGeometryHandler(n,e.graphic):n?.updateAttributes();break;case`popupTemplate`:break;case`origin-transform`:this._graphicUpdateTransformHandler(n,e)}this.owner.notifyContentGeometryUpdate?.()}}_graphicUpdateGeometryHandler(e,t){this._graphicUpdateGeometryOrTransformHandler(e,t,()=>e!=null&&e.updateGeometry()&&(this._labeler?.updateGraphicGeometry(e)??!0)?(this._labeler?.setDirty(),this._deconflictor?.setDirty(),!0):!1);let n=t.geometry;n!=null&&this._expandComputedExtent(n)}_graphicUpdateTransformHandler(e,t){let n=t.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(e,t.graphic,()=>t.newValue==null||e==null||n?.type!==`mesh`?!1:e.graphics3DSymbol.updateMeshTransform(e,n,t.newValue,()=>this.graphicUpdateHandler({...t,action:1}),t.action))}_graphicUpdateGeometryOrTransformHandler(e,t,n){if(t.geometry==null)this._recreateGraphic(t);else if(e==null){let e=t.symbol?.id;if(e){let t=this._symbols.get(e);if(t!=null&&t.loadStatus===0)return}this._recreateGraphic(t)}else if(!n()){let n=this._deconflictor?.getState(e);this._recreateGraphic(t);let r=this.graphics3DGraphics.get(t.uid);r&&n!=null&&this._deconflictor?.setState(r,n)}}_graphicUpdateSymbolHandler(e,t){let n=t.graphic,r=e==null?t.oldValue==null?null:this._symbols.get(t.oldValue.id):e.graphics3DSymbol;if(r==null||t.newValue==null){this._recreateGraphic(n);return}let i=r.symbol,a=this._getConvertedSymbol(t.newValue);if(a!=null&&(a.type!==i.type||a.type===`web-style`)||i.type===`web-style`){this._recreateGraphic(n);return}let o=this._graphicsBySymbol.get(i.id);if(o&&o.size!==1){this._recreateGraphic(n);return}let s=b(i,a);if(s==null){this._updateSymbolMapping(i.id,a);return}let c={diff:s,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(c),!re(c.diff)){this._recreateGraphic(n);return}let l=this._getRenderingInfo(n,!1);if(l==null){this._recreateGraphic(n);return}let u=r.extentPadding;for(let e of c.symbolStatePatches)e();if(u!==r.extentPadding&&this._recomputeExtentPadding(),e!=null)for(let t of c.graphics3DGraphicPatches)t(e,l);this._updateSymbolMapping(i.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===1&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){let t=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,t),this._graphicsWaitingForSymbol.size===1&&this.notifyChange(`dataUpdating`),t}_endGraphicUpdate(e,t){e&&(t&&this._graphicStateTracking?.updateGraphicError(e,t),this._graphicsWaitingForSymbol.delete(e.uid),this._graphicsWaitingForSymbol.size===0&&(this._cleanupSymbols(),this.notifyChange(`dataUpdating`)))}_recomputeExtentPadding(){let e=0;this._symbols.forEach(t=>{t!=null&&(e=Math.max(e,t.extentPadding))}),this._set(`extentPadding`,e)}_expandComputedExtent(e){let t=We,n=e.spatialReference;j(e,t);let r=this._viewSpatialReference,i=J.tmpVec;if(de(n,r)||O(t[0],t[1],0,n,i,r)&&(t[0]=i[0],t[1]=i[1],O(t[3],t[4],0,n,i,r),t[3]=i[0],t[4]=i[1]),!isFinite(t[0])||!isFinite(t[3])||!isFinite(t[1])||!isFinite(t[4]))return;let a=this.computedExtent,o=null,s=isFinite(t[2])&&isFinite(t[5]),c=s&&(a?.zmin==null||t[2]<a.zmin),l=s&&(a?.zmax==null||t[5]>a.zmax);a?(t[0]<a.xmin||t[1]<a.ymin||t[3]>a.xmax||t[4]>a.ymax||c||l)&&(o=this._propertiesPool.get(`computedExtent`),o.xmin=Math.min(t[0],a.xmin),o.ymin=Math.min(t[1],a.ymin),o.xmax=Math.max(t[3],a.xmax),o.ymax=Math.max(t[4],a.ymax),o.spatialReference=r):(o=this._propertiesPool.get(`computedExtent`),o.xmin=t[0],o.ymin=t[1],o.xmax=t[3],o.ymax=t[4],o.spatialReference=r),o&&(c&&(o.zmin=t[2]),l&&(o.zmax=t[5]),this._set(`computedExtent`,o))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&=(this._elevationInfoChangeAbortController.abort(),null)}async elevationInfoChange(){this._abortElevationInfoChange();let e=new AbortController;this._elevationInfoChangeAbortController=e;let t=H(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await U(t,this._viewSpatialReference,e.signal,i.getLogger(this)),d(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol((e,t,n)=>{e.globalPropertyChanged(`elevationInfo`,t)?t?.forEach(e=>{let t=e.graphic,n=e.labelLayers;for(let e of n)e.graphics3DSymbolLayer.graphics3DGraphicLayerElevationInfoChanged(t,e)}):this._recreateSymbol(n)}),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?(this.layer.elevationInfo?.mode===`relative-to-scene`||this._numberOfGraphicsProvidingElevation===0)&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=c(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&this.layer.elevationInfo.mode!==`relative-to-scene`)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new Me({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register(2,this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),this._filterVisibility!=null&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&=(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),c(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;let{loadedGraphics:t,view:n}=this.owner,r=n.basemapTerrain?.tilingScheme&&t?.length?t.toArray():null;(e||!r)&&this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=W(this.layer.screenSizePerspectiveEnabled),this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set(`computedExtent`,null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){let t=this._graphicsBySymbol.get(e),n=[];t&&(t.forEach((e,t)=>{this._conditionalRemove(e,t),this._spatialIndex?.remove(e),n.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(t,e),this._updateLayerVisibility(),this._featureStore.events.emit(`changed`),this.owner.notifyContentGeometryUpdate?.()}),this._graphicsBySymbol.set(e,new Map));let r=this._symbols.get(e);c(r),this._symbols.delete(e),this._symbolMaterials=null,c(this._unusedSymbolsCache.pop(e)),this.add(n)}_recreateGraphicsForSymbol(e){let t=this._graphicsBySymbol.get(e);if(t){let e=[];t.forEach(t=>e.push(t.graphic)),this.recreateGraphics(e)}}_conditionalRemove(e,t){this._graphicsDrapedUids.delete(t),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),this._graphicStateTracking!=null&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&e.length!==0&&(this.owner.view.basemapTerrain?.tilingScheme?(this._updatePolicyForGraphics(e)===0?this._addDelayed(e):this._addImmediate(e),this.notifyChange(`dataUpdating`)):i.getLogger(this).error(`#add()`,`Cannot add graphics before terrain surface has been initialized`))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===1&&(this.layer.geometryType===`mesh`||this.layer.geometryType==null)){for(let t of e)if(t.geometry!=null&&t.geometry.type===`mesh`&&!t.geometry.loaded)return 0}return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(let t of e)this._addGraphic(t,this._getRenderingInfo(t),1);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_addDelayed(e){for(let t of e){let e=t.uid,n=this._pendingUpdates.get(e);n?n.add?n.state!==0&&n.abortController?.abort():this._pendingAdds++:(n=new Z,this._pendingAdds++,this._pendingUpdates.set(e,n)),n.add=t}this.notifyChange(`readyToRun`),this.notifyChange(`updatingRemaining`),this.notifyChange(`dataUpdating`)}remove(e){this.effectiveUpdatePolicy===0?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange(`dataUpdating`)}_removeImmediate(e){for(let t of e)this._removeGraphic(t);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_removeDelayed(e){for(let t of e){let e=t.uid,n=this._pendingUpdates.get(e);if(n)n.add&&(n.remove?n.add=null:this._pendingUpdates.delete(e),n.state===1&&n.abortController?.abort(),this._pendingAdds--);else{let n=new Z;n.remove=t,this._pendingUpdates.set(e,n),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}this._pendingUpdates.size===0&&this._finishPendingUpdates(),this.notifyChange(`readyToRun`),this.notifyChange(`updatingRemaining`),this.notifyChange(`dataUpdating`)}_finishPendingUpdates(){this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&i.getLogger(this).warn(`pendingAdds/Removes in inconsistent state!`),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyFocusAreasUpdates(e){for(;this._focusAreasGraphicsQueue.length>0&&!e.done;){e.madeProgress();let t=this._focusAreasGraphicsQueue.pop(),n=ke(t.graphic.geometry);if(n==null)continue;let r=this.stage.view.focusAreasView?.containsGeometry(n)??!0;t.layers.forEach(e=>{(e?.type===`object3d`||e?.type===`buffer`)&&e.stageObject.geometries.some(e=>e.material instanceof Le&&e.material.parameters.focusAreaStyle==null!==r)&&this.recreateGraphics([t.graphic])})}this._focusAreasGraphicsQueue.length===0&&this.notifyChange(`readyToRun`)}_applyPendingUpdates(e){if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,this._pendingUpdates.size===0&&this._spatialIndex?.updating)this._spatialIndex.update(),e.madeProgress();else{if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(let[t,n]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(n.remove&&!n.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(n.remove),n.remove=null,this._pendingUpdates.delete(t),this._pendingRemoves===0))break}}for(let[t,n]of this._pendingUpdates){if(e.done)break;n.add&&n.state===0&&this._processPendingUpdateNew(n);let r=this.effectiveUpdatePolicy;if(n.remove&&(!n.add||n.state===2)&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(n.remove),n.remove=null,r=1),n.add)switch(n.state){case 2:this._addGraphic(n.add,n.renderingInfo,r),n.add=null,this._pendingAdds--,e.madeProgress();break;case 3:n.add=null,this._pendingAdds--}n.remove==null&&n.add==null&&this._pendingUpdates.delete(t)}this._pendingUpdates.size===0&&(this._finishPendingUpdates(),this.notifyChange(`readyToRun`),this.notifyChange(`dataUpdating`))}}_processPendingUpdateNew(e){if(!e.add){e.state=2;return}let t=e.add.geometry;t!=null&&t.type===`mesh`&&!t.loaded?this._processPendingUpdateNewMesh(e,t):this._processPendingUpdateNewRenderingInfo(e)}async _processPendingUpdateNewMesh(e,t){e.state=1,e.abortController=new AbortController;let n=e.abortController.signal;try{await t.load({signal:n})}catch(t){return this._processPendingUpdateNewError(e,t)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,t){e.abortController=null,e.state=p(t)?0:3}async _processPendingUpdateNewRenderingInfo(e){if(this.layer.renderer==null||this.layer.renderer.type!==`dictionary`){e.renderingInfo=this._getRenderingInfo(e.add),e.state=2;return}e.state=1,e.abortController=new AbortController;let t=null;try{t=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(t){e.abortController=null,e.state=p(t)?0:3;return}t?.symbol==null?(this._symbolWarningLogged||(this._symbolWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=t,e.state=2}_addGraphic(e,t,n){if(this._graphicsWithoutSymbol.set(e.uid,e),t?.symbol==null||!M(e))return;let r=this.stage.renderView.olidRenderHelper;if(r&&this.setUidToIdOnAdd){let t=R(this.owner.view,this.owner.layerViewUid);r.setUidToObjectAndLayerId(A(e,this._objectIdField),e.uid,this.layer.id,this.owner.layerViewUid,fe(this.layer)&&!!this.layer.popupEnabled&&!t&&Re(this.layer,this.owner.view.popup?.defaultPopupTemplateEnabled))}let i=t.symbol,a=this.getOrCreateGraphics3DSymbol(i,t.renderer);if(a==null)return;this._expandComputedExtent(e.geometry);let o=this._beginGraphicUpdate(e),s=new Se(e,t,this.layer,this.reportGraphicSourceMemory),c=!1,l=e=>{e===a.symbol.id&&(c=!0)};this._whenSymbolRemoved.push(l);let u=()=>{if(--this._loadingSymbols,!this.destroyed){if(this._whenSymbolRemoved.removeUnordered(l),this._graphicsWaitingForSymbol.get(e.uid)===o&&!c&&!a.destroyed&&(!this.graphicSymbolSupported||!e.symbol||e.symbol.id===a.symbol.id)){let t=this._createGraphics3DGraphic(a,s);this._spatialIndex&&t!=null&&this._spatialIndex.add(t),--a.referenced,this._endGraphicUpdate(e)}else--a.referenced,this._cleanupSymbols();this._featureStore.events.emit(`changed`),this.owner.notifyContentGeometryUpdate?.(),this._labeler?.setDirty()}},d=t=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),c||(p(t)?this.add([e]):a.destroyed||this._endGraphicUpdate(e,t)))};++this._loadingSymbols,n===0?a.load(()=>this._dataUpdateQueue.push(u,null).catch(f),e=>this._dataUpdateQueue.push(()=>d(e),null).catch(f)):a.load(u,d)}_removeGraphic(e){let t=e.uid,n=this.graphics3DGraphics.get(t);if(n){n.graphics3DSymbol.onRemoveGraphic(n);let e=n.isElevationSource;this._conditionalRemove(n,t),this._spatialIndex?.remove(n);let r=n.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(r)?.delete(t),this._graphicsWithoutSymbol.delete(t),this._removeGraphics3DGraphic(t,n,e),n.destroy(),this._featureStore.events.emit(`changed`),this.owner.notifyContentGeometryUpdate?.()}else this._graphicsWithoutSymbol.delete(t),this._graphicsWaitingForSymbol.delete(t),this._graphicsWaitingForSymbol.size===0&&(this._cleanupSymbols(),this.notifyChange(`dataUpdating`))}_hasLabelingContext(e){if(e instanceof B||e instanceof me){let t=this.symbolCreationContext.layer;return t.labelingInfo?t.labelingInfo.some(t=>t.symbol===e):!1}return!1}_hasValidSymbolCreationContext(e){return e instanceof B&&!this._hasLabelingContext(e)?(i.getLogger(this).error(`LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported.`),!1):!0}_getRenderingInfo(e,t=!0){let n=e.geometry;if(n==null)return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!oe(n.spatialReference,this._viewSpatialReference))return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&e.symbol!=null)return t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;let r=this.rendererRequiresHydratedGraphic?N(e,this.layer,null):e,a;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||this.currentRenderer!=null))a=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{let e=r.symbol||ge(r.geometry);a=new L(null,e)}return a?.symbol==null?(t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):a}_getRenderingInfoAsync(e,t){if(e.geometry==null)return this._geometryWarningLogged||(this._geometryWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&e.symbol!=null)return this._symbolWarningLogged||(this._symbolWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;let n=this.rendererRequiresHydratedGraphic?N(e,this.layer,null):e;return this.owner.getRenderingInfoAsync(n,this.currentRenderer,this._arcadeOnDemand,t)}_createGraphics3DSymbol(e,t){if(!this._hasValidSymbolCreationContext(e))return null;let n=this._getConvertedSymbol(e);if(!n)return null;let r;if(t!=null&&`backgroundFillSymbol`in t&&t.backgroundFillSymbol){let e=V(t.backgroundFillSymbol,{ignoreDrivers:!0});e.symbol!=null&&(r=e.symbol.symbolLayers)}let i=we(n,this.symbolCreationContext,r);return i.load(()=>{let e=i.extentPadding;e>this.extentPadding&&this._set(`extentPadding`,e),this.notifyChange(`averageSymbolComplexity`)},()=>{}),i}getOrCreateGraphics3DSymbol(e,t){let n=this._symbols.get(e.id);return n===void 0&&(n=this._unusedSymbolsCache.pop(e.id)??(e instanceof he?new Te(e,e=>this._dataUpdateQueue.push(e,null),e=>this._createGraphics3DSymbol(e,t)):this._createGraphics3DSymbol(e,t)),this._symbols.set(e.id,n),this._symbolMaterials=null),n!=null&&++n.referenced,n}trackGraphicState(e){return this._graphicStateTracking??=new De(this),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,e.notifyMemoryChange=this._notifyMemoryChange,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,t,n=!1){t.notifyMemoryChange=void 0,this._usedMemory-=t.usedMemory,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,n&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,t){let{graphic:n}=t;if(this._graphicsWithoutSymbol.delete(n.uid),!this._symbols.has(e.symbol.id))return this.add([n]),null;if(this.graphics3DGraphics.has(n.uid))return null;let r=e.createGraphics3DGraphic(t);if(r==null)return null;this._addGraphics3DGraphic(r);let i=e.symbol.id;if(this._graphicsBySymbol.has(i)||this._graphicsBySymbol.set(i,new Map),this._graphicsBySymbol.get(i).set(n.uid,r),r.isDraped&&this._graphicsDrapedUids.add(n.uid),r.centroid=null,n.geometry!=null&&n.geometry.type!==`point`&&(r.centroid=Oe(n.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),this._scaleVisibility!=null&&this._scaleVisibility.updateVisibility(r),this._filterVisibility!=null){let{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(1,4,e),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),r.initialize(this.stageLayer),this._graphicStateTracking!=null&&this._graphicStateTracking.addGraphic(r);let a=this._whenGraphics3DGraphicRequests[n.uid];return a&&(delete this._whenGraphics3DGraphicRequests[n.uid],a.resolve(r)),this._symbolMaterials=null,r}async rendererChange(e){if(this._rendererChangeAbortController=o(this._rendererChangeAbortController),e!==this.currentRenderer){if(this._validateRenderer(e),e??this._currentRendererChange(null,!1),!F(e))this._currentRendererChange(e,!1);else if(e?.arcadeRequired){let t=new AbortController;this._rendererChangeAbortController=t;let{arcadeUtils:n}=await this._ensureArcade();d(t);let r=n.hasGeometryOperations(e),i=r||await this._rendererUsesFieldsRequiringArcadeTypeConversion(e);d(t),r&&(await n.enableGeometryOperations(),d(t)),this.effectiveUpdatePolicy===0?await this._updateQueue.push(()=>this._currentRendererChange(e,i),t.signal):this._currentRendererChange(e,i),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===0){let t=new AbortController;this._rendererChangeAbortController=t,await this._updateQueue.push(()=>this._currentRendererChange(e,!1),t.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1)}}async _ensureArcade(){return this._arcadeOnDemand??=await z(),this._arcadeOnDemand}async _rendererUsesFieldsRequiringArcadeTypeConversion(e){let{fieldsIndex:t}=this.layer;return t!=null&&(await e.getRequiredFields(t)).some(e=>{switch(t.get(e)?.type){case`date`:case`date-only`:case`time-only`:case`timestamp-offset`:return!0;default:return!1}})}_currentRendererChange(e,t){this.currentRenderer=e,this.rendererRequiresHydratedGraphic=t,this.symbolCreationContext.arcade=this._arcadeOnDemand;let n=this.symbolCreationContext.renderer;if(e===n)return;if(this._symbolConversionCache.clear(),this._unusedSymbolsCache.clear(),e==null){this.symbolCreationContext.renderer=null,this.recreateAllGraphicsAndSymbols();return}let r=b(n,e);this._updateUnchangedSymbolMappings(r,e,n),this.symbolCreationContext.renderer=e,r!=null&&(r.type===`complete`?this.recreateAllGraphicsAndSymbols():r.type===`partial`&&(this._applyRendererDiff(r,e,n)?this._labeler?.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange(`averageSymbolComplexity`))}_diffHasSymbolChange(e){for(let t in e.diff)switch(t){case`visualVariables`:case`defaultSymbol`:case`uniqueValueInfos`:break;case`uniqueValueGroups`:case`authoringInfo`:case`fieldDelimiter`:delete e.diff[t];break;default:return!0}return!1}_applySymbolSetDiff(e,t,n){e||=[],t||=[];let r=[];for(let i of t){let t=this._graphicsBySymbol.get(i.id);t&&t.forEach((a,o)=>{let s=a.graphic,c=this.layer instanceof pe?this.layer:null,l=this._arcadeOnDemand;if(i===n.defaultSymbol&&n.getSymbol(N(s,c,null),{arcade:l})===n.defaultSymbol)return;e.length||n.defaultSymbol?r.push(s):this._graphicsWithoutSymbol.set(o,s);let u=this.graphics3DGraphics.get(o);this._conditionalRemove(u,o),a.destroy(),t.delete(o),this._removeGraphics3DGraphic(o,u),this._updateLayerVisibility()}),this._whenSymbolRemoved.forAll(e=>e(i.id))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach(e=>r.push(e)),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_applyUniqueValueRendererDiff(e,t,r){let i=e.diff.defaultSymbol,a=e.diff.uniqueValueInfos;if(i||a){let o=a?.changed,s=a?.unchanged;if(o&&s&&o.some(e=>s.some(t=>t.oldValue.symbol?.id===e.oldValue.symbol?.id)))return!1;let c=a?a.added.map(e=>e.symbol).filter(n):[],l=a?a.removed.map(e=>e.symbol).filter(n):[];if(o)for(let e=0;e<o.length;e++)c.push(o[e].newValue.symbol),l.push(o[e].oldValue.symbol);return i?(r.defaultSymbol&&l.push(r.defaultSymbol),t.defaultSymbol&&c.push(t.defaultSymbol)):r.defaultSymbol&&c.length&&l.push(t.defaultSymbol),this._applySymbolSetDiff(c,l,t),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,t,n){if(t?.type!==`unique-value`||n?.type!==`unique-value`||e!=null&&e.type!==`partial`)return[];let r=e=>e==null?null:e.id,i=e&&e.diff,a=i?.defaultSymbol,o=i&&i.uniqueValueInfos,s;if(o)s=o.unchanged.map(e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)}));else{s=[];for(let e of n.uniqueValueInfos??[]){let n=r(e.symbol),i=t.uniqueValueInfos?.find(t=>t.value===e.value);i&&n!==r(i.symbol)&&s.push({oldId:n,newId:r(i.symbol)})}}return!a&&n.defaultSymbol&&s.push({oldId:r(n.defaultSymbol),newId:r(t.defaultSymbol)}),s}_updateSymbolMapping(e,t){let n=t!=null&&t?typeof t==`string`?t:t.id:null;if(e==null||e===n)return;let r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),r!==void 0&&this._graphicsBySymbol.set(n,r);let i=this._symbols.get(e);if(i!==void 0&&(this._symbols.delete(e),this._symbols.set(n,i),this._symbolMaterials=null,i!=null)){let e=typeof t==`string`?null:t;e==null?i.symbol.id=n:i.symbol=e}}_updateUnchangedSymbolMappings(e,t,n){let r=this._calculateUnchangedSymbolMapping(e,t,n);for(let{oldId:e,newId:t}of r)this._updateSymbolMapping(e,t)}_applyRendererDiff(e,t,n){if(this._diffHasSymbolChange(e))return!1;if(t instanceof P&&n instanceof P&&this._applyUniqueValueRendererDiff(e,t,n)&&Object.keys(e.diff).length===0)return!0;for(let n of this._graphicsBySymbol.keys()){let r=this._symbols.get(n);if(r!=null)switch(r.applyRendererDiff(e,t)){case 0:this._recreateSymbol(n);break;case 1:this._recreateGraphicsForSymbol(n)}}return!0}opacityChange(){this._updateStageLayerVisibility(),this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged(`opacity`,t))}_screenSizePerspectiveEnabledChange(){this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged(`screenSizePerspectiveEnabled`,t)),this._labeler?.screenSizePerspectiveEnabledChanged(),this._deconflictor?.screenSizePerspectiveEnabledChanged()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged(`slicePlaneEnabled`,t)),this._deconflictor?.slicePlaneEnabledChange(),this._labeler?.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol((e,t,n)=>{e.globalPropertyChanged(`physicalBasedRenderingEnabled`,t)||this._recreateSymbol(n)})}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol((e,t,n)=>{e.globalPropertyChanged(`skipHighSymbolLods`,t)||this._recreateSymbol(n)})}_pixelRatioChange(){this.forEachGraphics3DSymbol((e,t,n)=>{e.globalPropertyChanged(`pixelRatio`,t)||this._recreateSymbol(n)})}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=v(()=>{this._updatingPendingLoadedGraphicsChange=null})}setClippingExtent(e,t){let n=this.symbolCreationContext.clippingExtent,r=ue();return Ne(e,r,t)?this.symbolCreationContext.clippingExtent=ce(k(),r):this.symbolCreationContext.clippingExtent=null,!le(this.symbolCreationContext.clippingExtent,n)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let t=!1;this.graphics3DGraphics.forEach(n=>{e(n)&&(t=!0)}),t&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}forEachGraphics3DSymbol(e,t){for(let[t,n]of this._symbols){if(n==null)return;e(n,this._graphicsBySymbol.get(t)||Ke,t)}if(!t?.excludeUnused)for(let t of this._unusedSymbolsCache)e(t,void 0,t.symbol.id)}updateGraphicsVisibilities(){this._filterVisibility!=null&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities(e=>{let t=this._updateUserVisibility(e),n=!!this._scaleVisibility?.updateVisibility(e);return t||n})}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,1,!1))}_validateRenderer(e){let t=()=>`'${this.layer.title?`${this.layer.title}, `:``}id:${this.layer.id}'`,n=I(e,{geometryType:this.layer?.geometryType,logWarning:(e,n)=>i.getLogger(this).warn(e,`Symbology conversion for layer ${t()}: ${n}`)});if(n){let e=`Renderer for layer ${t} is not supported in a SceneView`;i.getLogger(this).warn(e,n.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach((t,n)=>{if(t==null||t.referenced>0)return;let r=this._graphicsBySymbol.get(n);r&&r.size!==0||(this._graphicsBySymbol.delete(n),this._symbols.delete(n),this._symbolMaterials=null,this._unusedSymbolsCache.put(n,t,l),e=!0)}),e&&(this._recomputeExtentPadding(),this.notifyChange(`averageSymbolComplexity`))}get test(){}get performanceInfo(){return new Ee(this.graphics3DGraphics.size,this.graphics3DGraphics.values().reduce((e,t)=>e+ +!!t.isVisible(),0),this._graphicsWithoutSymbol.size,this._pendingUpdates.size)}};e([y({readOnly:!0})],X.prototype,`computedExtent`,void 0),e([y()],X.prototype,`currentRenderer`,void 0),e([y()],X.prototype,`rendererRequiresHydratedGraphic`,void 0),e([y()],X.prototype,`_frameTaskHandle`,void 0),e([y()],X.prototype,`_dataUpdateQueue`,void 0),e([y()],X.prototype,`_updateQueue`,void 0),e([y({readOnly:!0})],X.prototype,`_viewSpatialReference`,null),e([y()],X.prototype,`_rendererChangeAbortController`,void 0),e([y()],X.prototype,`_elevationInfoChangeAbortController`,void 0),e([y()],X.prototype,`_initializeAbortController`,void 0),e([y()],X.prototype,`_elevationAlignment`,void 0),e([y()],X.prototype,`_scaleVisibility`,void 0),e([y()],X.prototype,`_filterVisibility`,void 0),e([y()],X.prototype,`_initializePromise`,void 0),e([y()],X.prototype,`_spatialIndex`,void 0),e([y({readOnly:!0})],X.prototype,`extentPadding`,void 0),e([y()],X.prototype,`_updatingPendingLoadedGraphicsChange`,void 0),e([y()],X.prototype,`_featureStore`,void 0),e([y()],X.prototype,`_objectStates`,void 0),e([y()],X.prototype,`_loadingSymbols`,void 0),e([y({constructOnly:!0})],X.prototype,`compressionTracker`,void 0),e([y()],X.prototype,`preferredUpdatePolicy`,void 0),e([y()],X.prototype,`_forcedUpdatePolicy`,void 0),e([y({readOnly:!0})],X.prototype,`effectiveUpdatePolicy`,null),e([y({constructOnly:!0})],X.prototype,`elevationFeatureExpressionEnabled`,void 0),e([y({constructOnly:!0})],X.prototype,`owner`,void 0),e([y({constructOnly:!0})],X.prototype,`layer`,void 0),e([y({constructOnly:!0})],X.prototype,`graphicSymbolSupported`,void 0),e([y({constructOnly:!0})],X.prototype,`getRenderingInfoWithoutRenderer`,void 0),e([y({constructOnly:!0})],X.prototype,`componentFactories`,void 0),e([y({constructOnly:!0})],X.prototype,`setUidToIdOnAdd`,void 0),e([y({constructOnly:!0})],X.prototype,`reportGraphicSourceMemory`,void 0),e([y()],X.prototype,`featureStore`,null),e([y()],X.prototype,`initializePromise`,null),e([y()],X.prototype,`scaleVisibility`,null),e([y()],X.prototype,`elevationAlignment`,null),e([y()],X.prototype,`objectStates`,null),e([y()],X.prototype,`filterVisibility`,null),e([y({readOnly:!0})],X.prototype,`updating`,null),e([y({readOnly:!0})],X.prototype,`dataUpdating`,null),e([y({readOnly:!0})],X.prototype,`readyToRun`,null),e([y({readOnly:!0})],X.prototype,`suspendedOrOutsideOfView`,null),e([y({readOnly:!0})],X.prototype,`updatingRemaining`,null),e([y({readOnly:!0})],X.prototype,`displayFeatureLimit`,null),e([y({readOnly:!0})],X.prototype,`averageSymbolComplexity`,null),e([y({constructOnly:!0})],X.prototype,`hasZ`,void 0),e([y({constructOnly:!0})],X.prototype,`hasM`,void 0),e([y()],X.prototype,`_objectIdField`,null),X=J=e([ne(`esri.views.3d.layers.graphics.Graphics3DCore`)],X);class Z{constructor(){this.add=null,this.renderingInfo=null,this.state=0,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=0,this.abortController=null,this.remove=null}}const Ge=10,Q=T(),$=T(),Ke=new Map;export{X as Graphics3DCore};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import{deg2rad as n}from"../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../core/maybe.js";import{isPromiseLike as i}from"../../../../core/promiseUtils.js";import{normalFromMat4 as a,fromMat4 as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as c,multiply as l,invert as u,getTranslation as d}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f,IDENTITY as p,clone as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as g,add as _,scale as v,transformMat4 as y,transformMat3 as b,normalize as x,scaleAndAdd as S,subtract as ee,cross as te,dot as ne}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as re,ZEROS as ie,ONES as ae,create as C}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as oe}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as se}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as w}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as ce}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as le}from"../../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as ue,intersectsClippingArea as de,create as fe}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as T}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as E,getContinuousIndexArray as pe}from"../../../../geometry/support/Indices.js";import me from"../../../../geometry/support/MeshComponent.js";import he from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import ge from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as _e,isAbsoluteVertexSpace as ve}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as D,isPlateCarree as O}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as k}from"../../../../chunks/vec3.js";import{transformNormal as A,transformVectorENUPlateCarree as j,transformVectorWMPlateCarree as M,projectNormalToPCPF as ye,transformTangent as N,projectTangentToPCPF as be}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as xe}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{isDrivenOpacityFallbackAlwaysOpaque as Se}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{getEmissiveMode as Ce}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as we}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as P}from"../../glTF/internal/TextureTransformUtils.js";import{defaultSymbolLayerMemoryComplexity as Te}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as F}from"./ElevationAligners.js";import{needsElevationUpdates3D as I,evaluateElevationInfoAtPoint as L}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as Ee}from"./emissiveUtils.js";import{Graphics3DMeshObject3DGraphicLayer as De}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as Oe}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as ke,nanFallbackColor as Ae}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as je,MeshFastUpdateProcessor as Me}from"./MeshFastUpdateProcessor.js";import{addOlidAttribute as Ne}from"./olidUtils.js";import{SymbolComplexity as Pe}from"./SymbolComplexity.js";import{hasEdges as Fe,createMaterial as Ie}from"../support/edgeUtils.js";import{debugFlags as R}from"../../support/debugFlags.js";import{Attribute as z}from"../../webgl-engine/lib/Attribute.js";import{Geometry as B}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as Le}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as Re}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as ze}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as V}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as Be,advancedMRRFactors as Ve,schematicMRRFactors as He}from"../../webgl-engine/materials/pbrUtils.js";const Ue=[`mesh`];class We extends ke{constructor(e,t,n,r){super(e,t,n,r,Se(t)),this._materialInfoCache=new je,this._fastUpdateProcessor=new Me,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){R.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new V({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new V({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new V({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,Ue,`fill on mesh-3d`))return null;let n=this.createElevationContextForGraphic(t),r=e.renderingInfo;return this._createAs3DShape(t,r,n,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){let n=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:n});let t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(n,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicalBasedRenderingChanged(){let e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateTransform(e,t,n,r){if(!e.fastTransformUpdatesAllowed)return!1;let i=e.fastTransformUpdatesEnabled;switch(r){case 0:if(i)return!0;break;case 1:if(!i)return!0;break;default:if(!i)return this.updateTransform(e,t,n,0)?(e.autoDisableFastTransformUpdates(()=>this.updateTransform(e,t,n,1)),!0):!1}let a=this._context.renderCoordsHelper.spatialReference,o=rt,{origin:s,transform:c}=n;if(!w(t,g(Y,s.x,s.y,s.z??0),o,a))return!1;switch(r){case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:this._fastUpdateProcessor.disable(e,this._materialInfoCache)}e.updateFastLocalOrigin(o,c,this._context.localOriginFactory,!1);let{elevationContext:l}=e;l.centerInElevationSR=this._getCenterInElevationSR(o);let{elevationProvider:u,renderCoordsHelper:d}=this._context;return e.alignedSampledElevation=F(e,l,u.spatialReference,(e,t)=>L(e,u,l,d,t),d,o),e.updateTransform(o,c,this._context.isAsync),e.updateAutoDisableFastTransformUpdates(()=>this.updateTransform(e,t,n,1)),!0}computeComplexity(){if(!this._textures||this._textures.size===0)return super.computeComplexity();let e=0;for(let t of this._textures.values())e+=t.usedMemory;let t={...Te(this.symbol,this.symbolLayer),resourceBytes:e},n=Fe(this.symbolLayer)?2:0;return new Pe({drawCallsPerFeature:n,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){let n=this._requiresSymbolVertexColors(),r=!!e.vertexAttributes.color,i=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:n,hasVertexColors:r,hasVertexTangents:i,unlit:!1,uid:`vc:${r},vt:${i},vct${t},svc:${n}`}}_materialProperties(e,t,n){let r=this._materialPropertiesDefault(e,n);if(!t.material)return r;let{color:i,colorTexture:a,colorTextureTransform:o,normalTexture:s,normalTextureTransform:c,doubleSided:l,alphaCutoff:u,alphaMode:d}=t.material,f=K(i),p=K(a),m=q(o),h=K(s),g=q(c);if(r.color=i,r.colorTexture=a,r.normalTexture=s,r.uid=`${r.uid},cmuid:${f},ctmuid:${p},cttuid:${m},ntmuid:${h},nttuid:${g},ds:${l},ac:${u},am:${d}`,t.material instanceof he){let{metallic:e,roughness:n,metallicRoughnessTexture:i,metallicRoughnessTextureTransform:a,emissiveColor:s,emissiveStrength:l,emissiveTexture:u,emissiveTextureTransform:d,occlusionTexture:f,occlusionTextureTransform:p,unlit:m}=t.material,h=K(i),g=q(a),_=K(s),v=K(u),y=q(d),b=K(f),x=q(p);r.uid=[r.uid,`mrm:${e}`,`mrr:${n}`,`mrt:${h}`,`mrtt:${g}`,`emuid:${_}`,`ems:${l}`,`etmuid:${v}`,`ett:${y}`,`otmuid:${b}`,`ott:${x}`,`unlit:${m}`].join(`,`),r.metallic=e,r.roughness=n,r.metallicRoughnessTexture=i,r.emissiveColor=m?void 0:s,r.emissiveStrength=l,r.emissiveTexture=m?void 0:u,r.occlusionTexture=f,r.unlit=m,r.colorTextureTransform=W(o),r.normalTextureTransform=W(c),r.emissiveTextureTransform=W(d),r.occlusionTextureTransform=W(p),r.metallicRoughnessTextureTransform=W(a)}return r}_getInternalTexture(e,t=!1,n=1){let a=et(e);if(!a)return null;let o=`${e.contentHash}/${n}`,s=this._textures.get(o);if(s){let e=this._context.stage.renderView.textures,t=null,n=e.acquire(s.id);return n!=null&&!i(n)&&(s.events.on(`unloaded`,()=>t=r(t)),t=n),s}let c=null,l=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,u={wrap:Ze(e.wrap),noUnpackFlip:!0,maxAnisotropy:l,mipmap:l>1};return we(a)?(c=a.data,u.preMultiplyAlpha=!1,u.encoding=a.encoding):(c=a,u.preMultiplyAlpha=n!==1,u.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),s=new Le(c,u),this._textures.set(o,s),s.events.on(`loaded`,()=>this.updateComplexity()),s.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(s),s.events.on(`unloaded`,()=>{this._textures.delete(o)}),s}_setInternalMaterialTextureParameters(e,n){if(e.colorTexture!=null){let t=n.textureAlphaMode!==1,r=this._getInternalTexture(e.colorTexture,t,n.textureAlphaMode);r?(n.textureId=r.id,n.textureAlphaPremultiplied=!!r.parameters.preMultiplyAlpha):n.textureId=void 0}if(e.normalTexture&&(n.normalTextureId=this._getInternalTexture(e.normalTexture)?.id),e.emissiveColor){let r=e.emissiveColor?.toUnitRGB();n.emissiveBaseColor=re(t(r[0]),t(r[1]),t(r[2]))}e.emissiveStrength&&(n.emissiveStrengthKHR=e.emissiveStrength),e.emissiveTexture&&(n.emissiveTextureId=this._getInternalTexture(e.emissiveTexture)?.id),e.occlusionTexture&&(n.occlusionTextureId=this._getInternalTexture(e.occlusionTexture,!0)?.id),e.metallicRoughnessTexture&&(n.metallicRoughnessTextureId=this._getInternalTexture(e.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,n){e.color!=null&&$e(e.color,t,n),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=P(e.colorTextureTransform),t.normalTextureTransformMatrix=P(e.normalTextureTransform);let r=e.normalTextureTransform?.scale==null?h:e.normalTextureTransform?.scale;t.scale=[r[0],r[1]],t.occlusionTextureTransformMatrix=P(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=P(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=P(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e,t=this._materialColor){let n=this._drivenProperties.color,r=this._drivenProperties.opacity;if(n)e.externalColor=oe;else{let n=t??null;if(n){let t=n.toUnitRGBA();r&&(t[3]=1),e.externalColor=t}else e.externalColor=Ae}e.colorMixMode=this.symbolLayer.material?.colorMixMode??`multiply`,e.castShadows=!!this.symbolLayer.castShadows,e.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,e.emissiveSource=Ce(this.symbolLayer?.material?.emissive?.source??`emissive`)}_getOrCreateMaterial(e,t){let n=t.material?.color,r=t.material?.colorTexture,i=t.material?.alphaMode,a=i===`blend`,o=i!==`opaque`&&(Qe(e)||n!=null&&n.a<1||r?.transparent||a),s=this._materialProperties(e,t,o),c=this._materialInfoCache.byUid(s.uid);if(c)return this._setInternalMaterialTextureParameters(s,c.material.parameters),c.material;let l={uid:s.uid,material:null,isComponentTransparent:o,alphaMode:t.material?t.material.alphaMode:`opaque`},u=Be({normalTexture:s.normalTexture,metallicRoughnessTexture:s.metallicRoughnessTexture,metallicFactor:s.metallic,roughnessFactor:s.roughness,emissiveTexture:s.unlit?void 0:s.emissiveTexture,emissiveFactor:s.unlit?ie:s.emissiveColor?.toUnitRGB(),occlusionTexture:s.occlusionTexture}),d={usePBR:this._usePBR(),isSchematic:u,hasVertexColors:s.hasVertexColors,hasSymbolColors:s.hasSymbolVertexColors,hasVertexTangents:s.hasVertexTangents,ambient:ie,diffuse:ae,opacity:1,doubleSided:!0,doubleSidedType:`winding-order`,cullFace:0,unlit:s.unlit,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||l.isComponentTransparent};d.mrrFactors=u?He:[s.metallic,s.roughness,Ve[2]],t.material&&(d.doubleSided=t.material.doubleSided,d.cullFace=t.material.doubleSided?0:2,d.textureAlphaCutoff=t.material.alphaCutoff),this._setExternalMaterialParameters(d),this._setMaterialTextureAlphaMode(d,l),this._setInternalMaterialParameters(s,d,l);let f=new ze(d,this._context);return l.material=f,this._materialInfoCache.set(s.uid,l),f}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}_preparePatchColor(e,t){if(!t.material||t.material.type!==`partial`)return;let n=t.material.diff;if(!n.color||n.color.type!==`complete`||n.color.newValue==null||n.color.oldValue==null)return;let r=n.color.newValue;delete n.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{let t=e.material.parameters;this._setExternalMaterialParameters(t,r),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_preparePatchEmissive(e,t){return Ee(e,t,e=>{this._updateMaterialParameters(t=>{t.material.setParameters({emissiveStrengthFromSymbol:e??1})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){e.textureAlphaMode=t.alphaMode===`auto`?this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1?3:1:t.alphaMode===`opaque`?1:t.alphaMode===`mask`?2:0}_createFaceDebugNormals(e,t){let n=t.length,r=e.spatialReference.isGeographic?20015077/180:1,i=.1*Math.max(e.extent.width*r,e.extent.height*r,e.extent.zmax-e.extent.zmin),o=[],c=[],l=t[0].transformation,u=a(s(),l);for(let e=0;e<n;e++){let n=t[e].attributes.get(`position`);if(!n)continue;let r=n.data,a=n.indices;for(let e=0;e<a.length;e+=3)U(r,a,e,Q),Xe(r,a,e,Y,X,Z),_(Y,Y,X),_(Y,Y,Z),v(Y,Y,1/3),y(Y,Y,l),o.push(...Y),b(Q,Q,u),x(Q,Q),S(Y,Y,Q,i),o.push(...Y),c.push(c.length),c.push(c.length)}return o.length?new B(this._debugFaceNormalMaterial,[[`position`,new z(o,c,3,!0)]],null):null}_createPerVertexDebugVectors(e,t,n,r,i){let c=t.length,l=e.spatialReference.isGeographic?20015077/180:1,u=i*.1*Math.max(e.extent.width*l,e.extent.height*l,e.extent.zmax-e.extent.zmin),d=[],f=[],p=t[0].transformation,m=a(s(),p);n===`tangent`&&o(m,p);for(let e=0;e<c;e++){let r=t[e],i=r.attributes.get(`position`),a=r.attributes.get(n);if(!i||!a)continue;let o=i.data,s=i.indices,c=a.data,l=a.indices;for(let e=0;e<s.length;e++){let t=s[e]*3,n=l[e]*a.stride;g(Y,o[t+0],o[t+1],o[t+2]),y(Y,Y,p),d.push(...Y),g(X,c[n+0],c[n+1],c[n+2]),b(X,X,m),x(X,X),S(Y,Y,X,u),d.push(...Y),f.push(f.length),f.push(f.length)}}return d.length?new B(r,[[`position`,new z(d,f,3,!0)]],null):null}_createAs3DShape(e,t,n,r){let i=e.geometry;if(i.type!==`mesh`)return null;let a=this._createGeometryInfo(i,t,r);if(a==null)return null;let{geometries:o,objectTransformation:s}=a;if(R.DRAW_MESH_GEOMETRY_NORMALS){let e=this._createPerVertexDebugVectors(i,o,`normal`,this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(i,o,`tangent`,this._debugTangentNormalMaterial,.5),n=this._createFaceDebugNormals(i,o);e&&o.push(e),t&&o.push(t),n&&o.push(n)}let c=this._context.layerViewUid,l=new Re({geometries:o,layerViewUid:c,graphicUid:r,isElevationSource:!0});l.transformation=s;let u=Ie(this.symbolLayer,{opacity:this._getLayerOpacity()}),d=u?new Oe(o[0].material,u,this._context.slicePlaneEnabled):null,f=new De(this,l,null,F,n,d);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=I(n.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(i),n.centerInElevationSR=this._getCenterInElevationSR(l.transformation);let{elevationProvider:p,renderCoordsHelper:m}=this._context;return f.alignedSampledElevation=F(f,n,p.spatialReference,(e,t)=>L(e,p,n,m,t),m),f}_fastTransformUpdatesAllowed(e){let{vertexSpace:t,spatialReference:n}=e;if(!_e(t))return!1;let{type:r}=t,{view:i}=this._context.graphicsCoreOwner,{viewingMode:a}=i.state,o=i.spatialReference;return a===1&&r===`local`||a===2&&D(o,n)&&r===`georeferenced`&&!n.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){let t=C(),n=g(ot,e[12],e[13],e[14]);return le(n,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return e.reprojection===0&&!!e.objectTransformation}_createPositionBuffer(e,t){let n=e.vertexAttributes.position,r=n,i;if(t.reprojection===0)return{position:r,georeferencedPositionBuffer:i};let a=t.reprojection===1?t.transformBeforeProject:null;a&&(r=k(new Float64Array(r.length),r,a));let{normal:o,tangent:s}=e.vertexAttributes;!this._passthroughReprojectionInfo(t)&&(o||s)&&(i=r);let c=r===n||r===i?new Float64Array(r.length):r;return ce(r,e.spatialReference,0,c,this._context.renderCoordsHelper.spatialReference,0),{position:c,georeferencedPositionBuffer:i}}_createNormalBuffer(e,t,n,r){let i=e.vertexAttributes.normal;if(i==null)return null;let a=i,o=r.reprojection===1?r.transformBeforeProject:null;o&&(a=A(a,new Float32Array(a.length),o));let s=this._context.graphicsCoreOwner.view.viewingMode;if(r.reprojection===0)return a;if(s===`local`){if(!O(this._context.renderCoordsHelper.spatialReference))return a;if(n==null)return null;if(e.spatialReference.isGeographic){let e=a===i?new Float32Array(a.length):a;return j(a,0,n,e)}if(e.spatialReference.isWebMercator){let e=a===i?new Float32Array(a.length):a;return M(a,0,n,e)}return a}if(n==null)return null;let c=a===i?new Float32Array(a.length):a,l=this._context.renderCoordsHelper.spatialReference;return ye(a,n,e.spatialReference,t,l,c)}_createTangentBuffer(e,t,n,r){let i=e.vertexAttributes.tangent;if(i==null)return null;let a=i,o=r.reprojection===1?r.transformBeforeProject:null;o&&(a=N(a,new Float32Array(a.length),o));let s=this._context.graphicsCoreOwner.view.viewingMode;if(r.reprojection===0)return a;if(s===`local`){if(!O(this._context.renderCoordsHelper.spatialReference))return a;if(n==null)return null;if(e.spatialReference.isGeographic){let e=a===i?new Float32Array(a.length):a;return j(a,1,n,e)}if(e.spatialReference.isWebMercator){let e=a===i?new Float32Array(a.length):a;return M(a,1,n,e)}return a}if(n==null)return null;let c=a===i?new Float32Array(a.length):a,l=this._context.renderCoordsHelper.spatialReference;return be(a,n,e.spatialReference,t,l,c)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){let n=e.vertexAttributes&&e.vertexAttributes.position;if(!n)return this.logger.warn(`Mesh geometry must contain position vertex attributes`),null;let r=e.vertexAttributes.normal,i=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(r&&r.length!==n.length)return this.logger.warn(`Mesh normal vertex buffer must contain the same number of elements as the position buffer`),null;if(a&&a.length/4!=n.length/3)return this.logger.warn(`Mesh tangent vertex buffer must contain the same number of elements as the position buffer`),null;if(i&&i.length/2!=n.length/3)return this.logger.warn(`Mesh uv vertex buffer must contain the same number of elements as the position buffer`),null;let o=this._computeReprojectionInfo(e),{position:s,georeferencedPositionBuffer:c}=this._createPositionBuffer(e,o),l=tt(e),u=this._createSymbolColorBuffer(t),d=this._createNormalBuffer(e,s,c,o),p=this._createTangentBuffer(e,s,c,o),m=i,{transformation:h,position:g,normal:_,tangent:v}=this._passthroughReprojectionInfo(o)?{transformation:o.objectTransformation,position:s,normal:d,tangent:p}:this._transformOriginLocal(e,s,d,p);return{positionBuffer:g,normalBuffer:_,tangentBuffer:v,uvBuffer:m,colorBuffer:l,symbolColorBuffer:u,objectTransformation:h,geometryTransformation:o.reprojection===0&&o.geometryTransformation?o.geometryTransformation:f()}}_computeReprojectionInfo(e){let{vertexSpace:t}=e,n=t.type===`georeferenced`?+!D(this._context.renderCoordsHelper.spatialReference,e.spatialReference):0;if(ve(t))return{reprojection:n};let r=t.origin,i=f(),a=e.transform?.localMatrix??p;if(n===0)return w(e.spatialReference,r,i,this._context.renderCoordsHelper.spatialReference),{reprojection:n,objectTransformation:i,geometryTransformation:m(a)};let o=c(f(),r);return l(o,o,a),{reprojection:n,transformBeforeProject:o}}_transformOriginLocal(e,t,n,r){let i=this._context.renderCoordsHelper.spatialReference,a=e.origin;J[0]=a.x,J[1]=a.y,J[2]=a.z??0;let o=f();w(e.spatialReference,J,o,i),u($,o);let{position:s,normal:c,tangent:l}=e.vertexAttributes,d=t===s?new Float64Array(t.length):t;k(d,t,$);let p=n?n===c?new Float32Array(n.length):n:null,m=r?r===l?new Float32Array(r.length):r:null;return n&&p&&A(n,p,$),r&&m&&N(r,m,$),{transformation:o,position:d,normal:p,tangent:m}}_validateFaces(e,t){let n=e.vertexAttributes.position.length/3,r=t.faces;if(r&&r.length>0){let e=-1;for(let t=0;t<r.length;t++){let n=r[t];n>e&&(e=n)}if(n<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(n%3!=0)return this.logger.warn(`Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)`),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent||!e.vertexAttributes?.position)return!1;let t=this._context.elevationProvider.spatialReference,n=xe(e,t??e.spatialReference);return n?(ue(n,it),!de(it,this._context.clippingExtent)):!1}_createGeometryInfo(e,t,n){if(!se(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn(`Geometry spatial reference is not compatible with the view`),null;if(!this._validateVertexSpace(e)||this._isOutsideClippingArea(e))return null;let r=this._createBuffers(e,t);if(r==null)return null;let{positionBuffer:i,uvBuffer:a,colorBuffer:o,symbolColorBuffer:s,normalBuffer:c,tangentBuffer:l,objectTransformation:u,geometryTransformation:f}=r,p=e.components??at,m=[],h=!1,g=d(Y,u),_=this._context.localOriginFactory.getOrigin(g);for(let t of p){if(!this._validateFaces(e,t))return null;let r=Ge(e,t);if(r.length===0)continue;let u=Ke(i,c,t,r);u.didFlipNormals&&(h=!0);let d=[[`position`,new z(i,r,3,!0)],[`normal`,new z(u.normals,u.indices,3,!0)]];o&&d.push([`color`,new z(o,r,4,!0)]);let p=null;s&&(p=E(r.length),d.push([`symbolColor`,new z(s,p,4,!0)])),a&&d.push([`uv0`,new z(a,r,2,!0)]),l&&d.push([`tangent`,new z(l,r,4,!0)]);let g=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:this._context.layerViewUid});g&&(p??=E(r.length),Ne(d,g,p));let v=this._getOrCreateMaterial(e,t),y=new B(v,d,null);y.transformation=f,y.localOrigin=_,m.push(y)}return h&&this.logger.warn(`Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals.`),m.length===0?null:{geometries:m,objectTransformation:u}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){let{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:n}=e;return t===2&&n.type===`local`?(this.logger.warn(`Displaying a mesh with a local vertex space in a view in local viewing mode is not supported.`),!1):!0}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class H{constructor(e,t,n){this.normals=e,this.indices=t,this.didFlipNormals=n}}function Ge(e,t){return t.faces??pe(e.vertexAttributes.position.length/3)}function Ke(e,t,n,r){switch(n.shading||`flat`){default:case`source`:return Je(e,t,n,r);case`flat`:return qe(e,r);case`smooth`:return Ye(e,r)}}function qe(e,t){let n=T(t.length),r=Array(t.length*3);for(let i=0;i<t.length;i+=3){let a=U(e,t,i,Q);for(let e=0;e<3;e++)n[i+e]=a[e],r[i+e]=i/3}return new H(n,r,!1)}function Je(e,t,n,r){if(t==null)return qe(e,r);let i=!1;if(!n.trustSourceNormals)for(let n=0;n<r.length;n+=3){U(e,r,n,Q);for(let e=0;e<3;e++){let a=r[n+e]*3;Y[0]=t[a],Y[1]=t[a+1],Y[2]=t[a+2],ne(Q,Y)<0&&(t[a]=-t[a],t[a+1]=-t[a+1],t[a+2]=-t[a+2],i=!0)}}return new H(t,r,i)}function Ye(e,t){let n={};for(let r=0;r<t.length;r+=3){let i=U(e,t,r,Q);for(let e=0;e<3;e++){let a=t[r+e],o=n[a];o||(o={normal:C(),count:0},n[a]=o),_(o.normal,o.normal,i),o.count++}}let r=T(t.length*3),i=Array(t.length*3);for(let e=0;e<t.length;e++){let a=n[t[e]];a.count!==1&&(x(a.normal,a.normal),a.count=1);for(let t=0;t<3;t++)r[e*3+t]=a.normal[t];i[e]=e}return new H(r,i,!1)}function Xe(e,t,n,r,i,a){let o=t[n]*3,s=t[n+1]*3,c=t[n+2]*3;r[0]=e[o],r[1]=e[o+1],r[2]=e[o+2],i[0]=e[s],i[1]=e[s+1],i[2]=e[s+2],a[0]=e[c],a[1]=e[c+1],a[2]=e[c+2]}function U(e,t,n,r){return Xe(e,t,n,Y,X,Z),ee(X,X,Y),ee(Z,Z,Y),te(Y,X,Z),x(r,Y),r}function W(e){if(!e)return null;let{scale:t,offset:r,rotation:i}=e;return{scale:t,offset:r,rotation:n(i)}}function Ze(e=`repeat`){if(typeof e==`string`){let t=G(e);return{s:t,t}}return{s:G(e.horizontal),t:G(e.vertical)}}function G(e){switch(e){case`clamp`:return 33071;case`mirror`:return 33648;default:return 10497}}function Qe(e){let t=e.vertexAttributes.color;if(t==null)return!1;for(let e=3;e<t.length;e+=4)if(t[e]!==255)return!0;return!1}function $e(e,t,n){t.diffuse=e.toUnitRGB(),t.opacity=n.alphaMode===`opaque`?1:e.a}function et(e){return e.data??e.url}function K(t){return t==null?`-`:t instanceof e?t.toHex():t.contentHash}function q(e){let{offset:t,scale:n,rotation:r}=e??nt;return`${t[0]},${t[1]},${r},${n[0]},${n[1]}`}function tt(e){return e.vertexAttributes.color}const nt=new ge,J=C(),Y=C(),X=C(),Z=C(),Q=C(),$=f(),rt=f(),it=fe(),at=[new me],ot=C();export{We as Graphics3DMeshFillSymbolLayer};
2
+ import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import{deg2rad as n}from"../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../core/maybe.js";import{isPromiseLike as i}from"../../../../core/promiseUtils.js";import{normalFromMat4 as a,fromMat4 as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as c,multiply as l,invert as u,getTranslation as d}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f,IDENTITY as p,clone as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as g,add as _,scale as v,transformMat4 as y,transformMat3 as b,normalize as x,scaleAndAdd as ee,subtract as S,cross as te,dot as ne}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as re,ZEROS as ie,ONES as ae,create as C}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as oe}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as se}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as w}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as ce}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as le}from"../../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as ue,intersectsClippingArea as de,create as fe}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as T}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as E,getContinuousIndexArray as pe}from"../../../../geometry/support/Indices.js";import me from"../../../../geometry/support/MeshComponent.js";import he from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import ge from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as _e,isAbsoluteVertexSpace as ve}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as D,isPlateCarree as O}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as k}from"../../../../chunks/vec3.js";import{transformNormal as A,transformVectorENUPlateCarree as j,transformVectorWMPlateCarree as M,projectNormalToPCPF as ye,transformTangent as N,projectTangentToPCPF as be}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as xe}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{projectLocalVertexSpaceToPCPF as Se}from"../../../../geometry/support/meshUtils/vertexSpaceConversion.js";import{isDrivenOpacityFallbackAlwaysOpaque as Ce}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{getEmissiveMode as we}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as Te}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as P}from"../../glTF/internal/TextureTransformUtils.js";import{defaultSymbolLayerMemoryComplexity as Ee}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as F}from"./ElevationAligners.js";import{needsElevationUpdates3D as I,evaluateElevationInfoAtPoint as L}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as De}from"./emissiveUtils.js";import{Graphics3DMeshObject3DGraphicLayer as Oe}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as ke}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as Ae,nanFallbackColor as je}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as Me,MeshFastUpdateProcessor as Ne}from"./MeshFastUpdateProcessor.js";import{addOlidAttribute as Pe}from"./olidUtils.js";import{SymbolComplexity as Fe}from"./SymbolComplexity.js";import{hasEdges as Ie,createMaterial as Le}from"../support/edgeUtils.js";import{debugFlags as Re}from"../../support/debugFlags.js";import{Attribute as R}from"../../webgl-engine/lib/Attribute.js";import{Geometry as z}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as ze}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as Be}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Ve}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as B}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as He,advancedMRRFactors as Ue,schematicMRRFactors as We}from"../../webgl-engine/materials/pbrUtils.js";const Ge=[`mesh`];class Ke extends Ae{constructor(e,t,n,r){super(e,t,n,r,Ce(t)),this._materialInfoCache=new Me,this._fastUpdateProcessor=new Ne,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){Re.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new B({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new B({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new B({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,Ge,`fill on mesh-3d`))return null;let n=this.createElevationContextForGraphic(t),r=e.renderingInfo;return this._createAs3DShape(t,r,n,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){let n=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:n});let t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(n,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicalBasedRenderingChanged(){let e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateMeshTransform(e,t,n,r,i){if(!e.fastTransformUpdatesAllowed)return!1;let a=e.fastTransformUpdatesEnabled;switch(i){case 0:if(a)return!0;break;case 1:if(!a)return!0}let o=this._context.renderCoordsHelper.spatialReference,s=at,{origin:c,transform:l}=n;if(!w(t.spatialReference,g(J,c.x,c.y,c.z??0),s,o))return!1;switch(i){case void 0:a||this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context,!0);break;case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:if(this._fastUpdateProcessor.disable(e,this._materialInfoCache),t.vertexSpace.type===`local`)return!1}e.updateFastLocalOrigin(s,l,this._context.localOriginFactory,!1);let{elevationContext:u}=e;u.centerInElevationSR=this._getCenterInElevationSR(s);let{elevationProvider:d,renderCoordsHelper:f}=this._context;return e.alignedSampledElevation=F(e,u,d.spatialReference,(e,t)=>L(e,d,u,f,t),f,s),e.updateTransform(s,l,this._context.isAsync,r),!0}computeComplexity(){if(!this._textures||this._textures.size===0)return super.computeComplexity();let e=0;for(let t of this._textures.values())e+=t.usedMemory;let t={...Ee(this.symbol,this.symbolLayer),resourceBytes:e},n=Ie(this.symbolLayer)?2:0;return new Fe({drawCallsPerFeature:n,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){let n=this._requiresSymbolVertexColors(),r=!!e.vertexAttributes.color,i=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:n,hasVertexColors:r,hasVertexTangents:i,unlit:!1,uid:`vc:${r},vt:${i},vct${t},svc:${n}`}}_materialProperties(e,t,n){let r=this._materialPropertiesDefault(e,n);if(!t.material)return r;let{color:i,colorTexture:a,colorTextureTransform:o,normalTexture:s,normalTextureTransform:c,doubleSided:l,alphaCutoff:u,alphaMode:d}=t.material,f=G(i),p=G(a),m=K(o),h=G(s),g=K(c);if(r.color=i,r.colorTexture=a,r.normalTexture=s,r.uid=`${r.uid},cmuid:${f},ctmuid:${p},cttuid:${m},ntmuid:${h},nttuid:${g},ds:${l},ac:${u},am:${d}`,t.material instanceof he){let{metallic:e,roughness:n,metallicRoughnessTexture:i,metallicRoughnessTextureTransform:a,emissiveColor:s,emissiveStrength:l,emissiveTexture:u,emissiveTextureTransform:d,occlusionTexture:f,occlusionTextureTransform:p,unlit:m}=t.material,h=G(i),g=K(a),_=G(s),v=G(u),y=K(d),b=G(f),x=K(p);r.uid=[r.uid,`mrm:${e}`,`mrr:${n}`,`mrt:${h}`,`mrtt:${g}`,`emuid:${_}`,`ems:${l}`,`etmuid:${v}`,`ett:${y}`,`otmuid:${b}`,`ott:${x}`,`unlit:${m}`].join(`,`),r.metallic=e,r.roughness=n,r.metallicRoughnessTexture=i,r.emissiveColor=m?void 0:s,r.emissiveStrength=l,r.emissiveTexture=m?void 0:u,r.occlusionTexture=f,r.unlit=m,r.colorTextureTransform=U(o),r.normalTextureTransform=U(c),r.emissiveTextureTransform=U(d),r.occlusionTextureTransform=U(p),r.metallicRoughnessTextureTransform=U(a)}return r}_getInternalTexture(e,t=!1,n=1){let a=nt(e);if(!a)return null;let o=`${e.contentHash}/${n}`,s=this._textures.get(o);if(s){let e=this._context.stage.renderView.textures,t=null,n=e.acquire(s.id);return n!=null&&!i(n)&&(s.events.on(`unloaded`,()=>t=r(t)),t=n),s}let c=null,l=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,u={wrap:$e(e.wrap),noUnpackFlip:!0,maxAnisotropy:l,mipmap:l>1};return Te(a)?(c=a.data,u.preMultiplyAlpha=!1,u.encoding=a.encoding):(c=a,u.preMultiplyAlpha=n!==1,u.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),s=new ze(c,u),this._textures.set(o,s),s.events.on(`loaded`,()=>this.updateComplexity()),s.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(s),s.events.on(`unloaded`,()=>{this._textures.delete(o)}),s}_setInternalMaterialTextureParameters(e,n){if(e.colorTexture!=null){let t=n.textureAlphaMode!==1,r=this._getInternalTexture(e.colorTexture,t,n.textureAlphaMode);r?(n.textureId=r.id,n.textureAlphaPremultiplied=!!r.parameters.preMultiplyAlpha):n.textureId=void 0}if(e.normalTexture&&(n.normalTextureId=this._getInternalTexture(e.normalTexture)?.id),e.emissiveColor){let r=e.emissiveColor?.toUnitRGB();n.emissiveBaseColor=re(t(r[0]),t(r[1]),t(r[2]))}e.emissiveStrength&&(n.emissiveStrengthKHR=e.emissiveStrength),e.emissiveTexture&&(n.emissiveTextureId=this._getInternalTexture(e.emissiveTexture)?.id),e.occlusionTexture&&(n.occlusionTextureId=this._getInternalTexture(e.occlusionTexture,!0)?.id),e.metallicRoughnessTexture&&(n.metallicRoughnessTextureId=this._getInternalTexture(e.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,n){e.color!=null&&tt(e.color,t,n),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=P(e.colorTextureTransform),t.normalTextureTransformMatrix=P(e.normalTextureTransform);let r=e.normalTextureTransform?.scale==null?h:e.normalTextureTransform?.scale;t.scale=[r[0],r[1]],t.occlusionTextureTransformMatrix=P(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=P(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=P(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e,t=this._materialColor){let n=this._drivenProperties.color,r=this._drivenProperties.opacity;if(n)e.externalColor=oe;else{let n=t??null;if(n){let t=n.toUnitRGBA();r&&(t[3]=1),e.externalColor=t}else e.externalColor=je}e.colorMixMode=this.symbolLayer.material?.colorMixMode??`multiply`,e.castShadows=!!this.symbolLayer.castShadows,e.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,e.emissiveSource=we(this.symbolLayer?.material?.emissive?.source??`emissive`)}_getOrCreateMaterial(e,t){let n=t.material?.color,r=t.material?.colorTexture,i=t.material?.alphaMode,a=i===`blend`,o=i!==`opaque`&&(et(e)||n!=null&&n.a<1||r?.transparent||a),s=this._materialProperties(e,t,o),c=this._materialInfoCache.byUid(s.uid);if(c)return this._setInternalMaterialTextureParameters(s,c.material.parameters),c.material;let l={uid:s.uid,material:null,isComponentTransparent:o,alphaMode:t.material?t.material.alphaMode:`opaque`},u=He({normalTexture:s.normalTexture,metallicRoughnessTexture:s.metallicRoughnessTexture,metallicFactor:s.metallic,roughnessFactor:s.roughness,emissiveTexture:s.unlit?void 0:s.emissiveTexture,emissiveFactor:s.unlit?ie:s.emissiveColor?.toUnitRGB(),occlusionTexture:s.occlusionTexture}),d={usePBR:this._usePBR(),isSchematic:u,hasVertexColors:s.hasVertexColors,hasSymbolColors:s.hasSymbolVertexColors,hasVertexTangents:s.hasVertexTangents,ambient:ie,diffuse:ae,opacity:1,doubleSided:!0,doubleSidedType:`winding-order`,cullFace:0,unlit:s.unlit,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||l.isComponentTransparent};d.mrrFactors=u?We:[s.metallic,s.roughness,Ue[2]],t.material&&(d.doubleSided=t.material.doubleSided,d.cullFace=t.material.doubleSided?0:2,d.textureAlphaCutoff=t.material.alphaCutoff),this._setExternalMaterialParameters(d),this._setMaterialTextureAlphaMode(d,l),this._setInternalMaterialParameters(s,d,l);let f=new Ve(d,this._context);return l.material=f,this._materialInfoCache.set(s.uid,l),f}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}_preparePatchColor(e,t){if(!t.material||t.material.type!==`partial`)return;let n=t.material.diff;if(!n.color||n.color.type!==`complete`||n.color.newValue==null||n.color.oldValue==null)return;let r=n.color.newValue;delete n.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{let t=e.material.parameters;this._setExternalMaterialParameters(t,r),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_preparePatchEmissive(e,t){return De(e,t,e=>{this._updateMaterialParameters(t=>{t.material.setParameters({emissiveStrengthFromSymbol:e??1})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){e.textureAlphaMode=t.alphaMode===`auto`?this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1?3:1:t.alphaMode===`opaque`?1:t.alphaMode===`mask`?2:0}_createFaceDebugNormals(e,t){let n=t.length,r=e.spatialReference.isGeographic?20015077/180:1,i=.1*Math.max(e.extent.width*r,e.extent.height*r,e.extent.zmax-e.extent.zmin),o=[],c=[],l=t[0].transformation,u=a(s(),l);for(let e=0;e<n;e++){let n=t[e].attributes.get(`position`);if(!n)continue;let r=n.data,a=n.indices;for(let e=0;e<a.length;e+=3)H(r,a,e,Z),Qe(r,a,e,J,Y,X),_(J,J,Y),_(J,J,X),v(J,J,1/3),y(J,J,l),o.push(...J),b(Z,Z,u),x(Z,Z),ee(J,J,Z,i),o.push(...J),c.push(c.length),c.push(c.length)}return o.length?new z(this._debugFaceNormalMaterial,[[`position`,new R(o,c,3,!0)]],null):null}_createPerVertexDebugVectors(e,t,n,r,i){let c=t.length,l=e.spatialReference.isGeographic?20015077/180:1,u=i*.1*Math.max(e.extent.width*l,e.extent.height*l,e.extent.zmax-e.extent.zmin),d=[],f=[],p=t[0].transformation,m=a(s(),p);n===`tangent`&&o(m,p);for(let e=0;e<c;e++){let r=t[e],i=r.attributes.get(`position`),a=r.attributes.get(n);if(!i||!a)continue;let o=i.data,s=i.indices,c=a.data,l=a.indices;for(let e=0;e<s.length;e++){let t=s[e]*3,n=l[e]*a.stride;g(J,o[t+0],o[t+1],o[t+2]),y(J,J,p),d.push(...J),g(Y,c[n+0],c[n+1],c[n+2]),b(Y,Y,m),x(Y,Y),ee(J,J,Y,u),d.push(...J),f.push(f.length),f.push(f.length)}}return d.length?new z(r,[[`position`,new R(d,f,3,!0)]],null):null}_createAs3DShape(e,t,n,r){let i=e.geometry;if(i.type!==`mesh`)return null;let a=this._createGeometryInfo(i,t,r);if(a==null)return null;let{geometries:o,objectTransformation:s}=a;if(Re.DRAW_MESH_GEOMETRY_NORMALS){let e=this._createPerVertexDebugVectors(i,o,`normal`,this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(i,o,`tangent`,this._debugTangentNormalMaterial,.5),n=this._createFaceDebugNormals(i,o);e&&o.push(e),t&&o.push(t),n&&o.push(n)}let c=this._context.layerViewUid,l=new Be({geometries:o,layerViewUid:c,graphicUid:r,isElevationSource:!0});l.transformation=s;let u=Le(this.symbolLayer,{opacity:this._getLayerOpacity()}),d=u?new ke(o[0].material,u,this._context.slicePlaneEnabled):null,f=new Oe(this,l,null,F,n,d);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=I(n.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(i),n.centerInElevationSR=this._getCenterInElevationSR(l.transformation);let{elevationProvider:p,renderCoordsHelper:m}=this._context;return f.alignedSampledElevation=F(f,n,p.spatialReference,(e,t)=>L(e,p,n,m,t),m),f}_fastTransformUpdatesAllowed(e){let{vertexSpace:t,spatialReference:n}=e;if(!_e(t))return!1;let{type:r}=t,{view:i}=this._context.graphicsCoreOwner,{viewingMode:a}=i.state,o=i.spatialReference;return a===1&&r===`local`||a===2&&D(o,n)&&r===`georeferenced`&&!n.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){let t=C(),n=g(st,e[12],e[13],e[14]);return le(n,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return e.reprojection===0&&!!e.objectTransformation}_createPositionBuffer(e,t,n){let r=n.position,i=r,a;if(t.reprojection===0)return{position:i,georeferencedPositionBuffer:a};let o=t.reprojection===1?t.transformBeforeProject:null;o&&(i=k(new Float64Array(i.length),i,o));let{normal:s,tangent:c}=n;!this._passthroughReprojectionInfo(t)&&(s||c)&&(a=i);let l=i===r||i===a?new Float64Array(i.length):i;return ce(i,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:a}}_createNormalBuffer(e,t,n,r,i){let a=i.normal;if(a==null)return null;let o=a,s=r.reprojection===1?r.transformBeforeProject:null;s&&(o=A(o,new Float32Array(o.length),s));let c=this._context.graphicsCoreOwner.view.viewingMode;if(r.reprojection===0)return o;if(c===`local`){if(!O(this._context.renderCoordsHelper.spatialReference))return o;if(n==null)return null;if(e.spatialReference.isGeographic){let e=o===a?new Float32Array(o.length):o;return j(o,0,n,e)}if(e.spatialReference.isWebMercator){let e=o===a?new Float32Array(o.length):o;return M(o,0,n,e)}return o}if(n==null)return null;let l=o===a?new Float32Array(o.length):o,u=this._context.renderCoordsHelper.spatialReference;return ye(o,n,e.spatialReference,t,u,l)}_createTangentBuffer(e,t,n,r,i){let a=i.tangent;if(a==null)return null;let o=a,s=r.reprojection===1?r.transformBeforeProject:null;s&&(o=N(o,new Float32Array(o.length),s));let c=this._context.graphicsCoreOwner.view.viewingMode;if(r.reprojection===0)return o;if(c===`local`){if(!O(this._context.renderCoordsHelper.spatialReference))return o;if(n==null)return null;if(e.spatialReference.isGeographic){let e=o===a?new Float32Array(o.length):o;return j(o,1,n,e)}if(e.spatialReference.isWebMercator){let e=o===a?new Float32Array(o.length):o;return M(o,1,n,e)}return o}if(n==null)return null;let l=o===a?new Float32Array(o.length):o,u=this._context.renderCoordsHelper.spatialReference;return be(o,n,e.spatialReference,t,u,l)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){let n=e.vertexAttributes&&e.vertexAttributes.position;if(!n)return this.logger.warn(`Mesh geometry must contain position vertex attributes`),null;let r=e.vertexAttributes.normal,i=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(r&&r.length!==n.length)return this.logger.warn(`Mesh normal vertex buffer must contain the same number of elements as the position buffer`),null;if(a&&a.length/4!=n.length/3)return this.logger.warn(`Mesh tangent vertex buffer must contain the same number of elements as the position buffer`),null;if(i&&i.length/2!=n.length/3)return this.logger.warn(`Mesh uv vertex buffer must contain the same number of elements as the position buffer`),null;let o=this._computeReprojectionInfo(e),s=o.reprojection===1&&o.convertLocalVertexSpace,c=s&&e.vertexSpace.type===`local`?Se(e,e.vertexSpace,this._context.renderCoordsHelper.spatialReference):null;if(s&&!c)return this.logger.warn(`Local mesh vertex space could not be converted for rendering`),null;let{position:l,georeferencedPositionBuffer:u}=c?{position:c.position,georeferencedPositionBuffer:null}:this._createPositionBuffer(e,o,e.vertexAttributes),d=rt(e),f=this._createSymbolColorBuffer(t),p=c?c.normal:this._createNormalBuffer(e,l,u,o,e.vertexAttributes),m=c?c.tangent:this._createTangentBuffer(e,l,u,o,e.vertexAttributes),h=i,{geometryTransformation:g}=o,{transformation:_,position:v,normal:y,tangent:b}=this._passthroughReprojectionInfo(o)?{transformation:o.objectTransformation,position:l,normal:p,tangent:m}:this._expressInOriginLocalSpace(e,l,p,m,g);return{positionBuffer:v,normalBuffer:y,tangentBuffer:b,uvBuffer:h,colorBuffer:d,symbolColorBuffer:f,objectTransformation:_,geometryTransformation:g}}_computeReprojectionInfo(e){let{vertexSpace:t}=e,n=t.type===`georeferenced`,r=t.type===`local`&&this._context.graphicsCoreOwner.view.state.viewingMode===1,i=n?+!D(this._context.renderCoordsHelper.spatialReference,e.spatialReference):+!!r;if(ve(t))return{reprojection:i,geometryTransformation:f()};let a=t.origin,o=e.transform?.localMatrix??p;if(i===0){let t=f();return w(e.spatialReference,a,t,this._context.renderCoordsHelper.spatialReference),{reprojection:i,objectTransformation:t,geometryTransformation:m(o)}}if(r)return{reprojection:i,convertLocalVertexSpace:!0,geometryTransformation:m(o)};let s=c(f(),a);return l(s,s,o),{reprojection:i,transformBeforeProject:s,geometryTransformation:f()}}_expressInOriginLocalSpace(e,t,n,r,i){let a=this._context.renderCoordsHelper.spatialReference,o=e.origin;q[0]=o.x,q[1]=o.y,q[2]=o.z??0;let s=f();w(e.spatialReference,q,s,a),l(Q,s,i),u(Q,Q);let{position:c,normal:d,tangent:p}=e.vertexAttributes,m=t===c?new Float64Array(t.length):t;k(m,t,Q);let h=n?n===d?new Float32Array(n.length):n:null,g=r?r===p?new Float32Array(r.length):r:null;return n&&h&&A(n,h,Q),r&&g&&N(r,g,Q),{transformation:s,position:m,normal:h,tangent:g}}_validateFaces(e,t){let n=e.vertexAttributes.position.length/3,r=t.faces;if(r&&r.length>0){let e=-1;for(let t=0;t<r.length;t++){let n=r[t];n>e&&(e=n)}if(n<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(n%3!=0)return this.logger.warn(`Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)`),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent||!e.vertexAttributes?.position)return!1;let t=this._context.elevationProvider.spatialReference,n=xe(e,t??e.spatialReference);return n?(ue(n,$),!de($,this._context.clippingExtent)):!1}_createGeometryInfo(e,t,n){if(!se(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn(`Geometry spatial reference is not compatible with the view`),null;if(!this._validateVertexSpace(e)||this._isOutsideClippingArea(e))return null;let r=this._createBuffers(e,t);if(r==null)return null;let{positionBuffer:i,uvBuffer:a,colorBuffer:o,symbolColorBuffer:s,normalBuffer:c,tangentBuffer:l,objectTransformation:u,geometryTransformation:f}=r,p=e.components??ot,m=[],h=!1,g=d(J,u),_=this._context.localOriginFactory.getOrigin(g);for(let t of p){if(!this._validateFaces(e,t))return null;let r=qe(e,t);if(r.length===0)continue;let u=Je(i,c,t,r);u.didFlipNormals&&(h=!0);let d=[[`position`,new R(i,r,3,!0)],[`normal`,new R(u.normals,u.indices,3,!0)]];o&&d.push([`color`,new R(o,r,4,!0)]);let p=null;s&&(p=E(r.length),d.push([`symbolColor`,new R(s,p,4,!0)])),a&&d.push([`uv0`,new R(a,r,2,!0)]),l&&d.push([`tangent`,new R(l,r,4,!0)]);let g=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:this._context.layerViewUid});g&&(p??=E(r.length),Pe(d,g,p));let v=this._getOrCreateMaterial(e,t),y=new z(v,d,null);y.transformation=f,y.localOrigin=_,m.push(y)}return h&&this.logger.warn(`Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals.`),m.length===0?null:{geometries:m,objectTransformation:u}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){let{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:n}=e;return t===2&&n.type===`local`?(this.logger.warn(`Displaying a mesh with a local vertex space in a view in local viewing mode is not supported.`),!1):!0}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class V{constructor(e,t,n){this.normals=e,this.indices=t,this.didFlipNormals=n}}function qe(e,t){return t.faces??pe(e.vertexAttributes.position.length/3)}function Je(e,t,n,r){switch(n.shading||`flat`){default:case`source`:return Xe(e,t,n,r);case`flat`:return Ye(e,r);case`smooth`:return Ze(e,r)}}function Ye(e,t){let n=T(t.length),r=Array(t.length*3);for(let i=0;i<t.length;i+=3){let a=H(e,t,i,Z);for(let e=0;e<3;e++)n[i+e]=a[e],r[i+e]=i/3}return new V(n,r,!1)}function Xe(e,t,n,r){if(t==null)return Ye(e,r);let i=!1;if(!n.trustSourceNormals)for(let n=0;n<r.length;n+=3){H(e,r,n,Z);for(let e=0;e<3;e++){let a=r[n+e]*3;J[0]=t[a],J[1]=t[a+1],J[2]=t[a+2],ne(Z,J)<0&&(t[a]=-t[a],t[a+1]=-t[a+1],t[a+2]=-t[a+2],i=!0)}}return new V(t,r,i)}function Ze(e,t){let n={};for(let r=0;r<t.length;r+=3){let i=H(e,t,r,Z);for(let e=0;e<3;e++){let a=t[r+e],o=n[a];o||(o={normal:C(),count:0},n[a]=o),_(o.normal,o.normal,i),o.count++}}let r=T(t.length*3),i=Array(t.length*3);for(let e=0;e<t.length;e++){let a=n[t[e]];a.count!==1&&(x(a.normal,a.normal),a.count=1);for(let t=0;t<3;t++)r[e*3+t]=a.normal[t];i[e]=e}return new V(r,i,!1)}function Qe(e,t,n,r,i,a){let o=t[n]*3,s=t[n+1]*3,c=t[n+2]*3;r[0]=e[o],r[1]=e[o+1],r[2]=e[o+2],i[0]=e[s],i[1]=e[s+1],i[2]=e[s+2],a[0]=e[c],a[1]=e[c+1],a[2]=e[c+2]}function H(e,t,n,r){return Qe(e,t,n,J,Y,X),S(Y,Y,J),S(X,X,J),te(J,Y,X),x(r,J),r}function U(e){if(!e)return null;let{scale:t,offset:r,rotation:i}=e;return{scale:t,offset:r,rotation:n(i)}}function $e(e=`repeat`){if(typeof e==`string`){let t=W(e);return{s:t,t}}return{s:W(e.horizontal),t:W(e.vertical)}}function W(e){switch(e){case`clamp`:return 33071;case`mirror`:return 33648;default:return 10497}}function et(e){let t=e.vertexAttributes.color;if(t==null)return!1;for(let e=3;e<t.length;e+=4)if(t[e]!==255)return!0;return!1}function tt(e,t,n){t.diffuse=e.toUnitRGB(),t.opacity=n.alphaMode===`opaque`?1:e.a}function nt(e){return e.data??e.url}function G(t){return t==null?`-`:t instanceof e?t.toHex():t.contentHash}function K(e){let{offset:t,scale:n,rotation:r}=e??it;return`${t[0]},${t[1]},${r},${n[0]},${n[1]}`}function rt(e){return e.vertexAttributes.color}const it=new ge,q=C(),J=C(),Y=C(),X=C(),Z=C(),Q=f(),at=f(),$=fe(),ot=[new me],st=C();export{Ke as Graphics3DMeshFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{getTranslation as e,multiply as t,invert as n,copy as r,fromTranslation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{perObjectElevationAligner as l}from"./ElevationAligners.js";import{evaluateElevationInfoAtPoint as u}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as d}from"./Graphics3DObject3DGraphicLayer.js";import{meshAutoFastUpdateConstants as f}from"./meshAutoFastUpdateConstants.js";class p extends d{constructor(){super(...arguments),this.fastTransformUpdatesAllowed=!1,this._originalGeometries=[],this._fastTransformUpdatesEnabled=!1,this._autoDisableFastUpdatesTimeoutId=0}get fastTransformUpdatesEnabled(){return this._fastTransformUpdatesEnabled}destroy(){super.destroy(),this._cancelAutoDisableFastUpdates()}enableFastTransformUpdates(t,n){if(!this.fastTransformUpdatesAllowed||this._fastTransformUpdatesEnabled)return;this._cancelAutoDisableFastUpdates(),this._fastTransformUpdatesEnabled=!0;let{stageObject:r}=this,i=r.geometries.slice(),a=e(m,r.transformation),o=n.getOrigin(a),s=i.map(e=>{let n=t(e.material),r=e.instantiate({material:n});return r.localOrigin=o,r});r.replaceGeometries(s),this._originalGeometries=i}autoDisableFastTransformUpdates(e){this._cancelAutoDisableFastUpdates(),this._autoDisableFastUpdatesTimeoutId=setTimeout(()=>{this._autoDisableFastUpdatesTimeoutId=0,e()},f.disableDelayMs)}updateAutoDisableFastTransformUpdates(e){this._autoDisableFastUpdatesTimeoutId&&this.autoDisableFastTransformUpdates(e)}_cancelAutoDisableFastUpdates(){clearTimeout(this._autoDisableFastUpdatesTimeoutId),this._autoDisableFastUpdatesTimeoutId=0}disableFastTransformUpdates(e){if(!this._fastTransformUpdatesEnabled)return;this._cancelAutoDisableFastUpdates(),this._fastTransformUpdatesEnabled=!1;let{stageObject:t}=this,n=t.geometries.length>0?t.geometries[0].localOrigin:void 0,r=t.geometries.map(t=>e(t.material)),i=this._originalGeometries.map((e,t)=>{let i=r[t];return i.setParameters({modelTransformation:null}),e.localOrigin!=null&&(e.localOrigin=n),i===e.material?e:e.instantiate({material:i})});t.replaceGeometries(i),this._originalGeometries.length=0}updateFastLocalOrigin(t,n,r,i=!0){if(!this._fastTransformUpdatesEnabled)return;let{stageObject:o}=this;if(o.geometries.length===0)return;let s=o.geometries[0].localOrigin,c=e(m,t);if(s&&!i&&!r.needsOriginUpdate(s,c,o.boundingVolumeWorldSpace.sphere.radius*2))return;let l=r.getOrigin(c);if(l===s)return;let u=n?.localMatrix??a;o.shaderTransformation=null,o.transformation=t,o.geometries.forEach(e=>{e.transformation=u,e.localOrigin=l})}updateTransform(e,r,i){let{stageObject:o}=this,s=r?.localMatrix??a;if(!this._fastTransformUpdatesEnabled){o.shaderTransformation=null,o.transformation=e,o.geometries.forEach(e=>e.transformation=s),this._updateEdgeTransform(i);return}let c=o.transformation,l=o.geometries[0].transformation,u=e,d=s,f=t(h,c,l),p=t(g,u,d);o.shaderTransformation=t(v,p,n(v,l)),this._setFastMaterialTransformation({matA:f,matB:p}),this._updateEdgeTransform(i)}alignWithElevation(e,n,i){if(!this._fastTransformUpdatesEnabled){super.alignWithElevation(e,n,i);return}let a=(t,r)=>u(t,e,this.elevationContext,n,r),{stageObject:o}=this;if(!o.geometries[0].material.parameters.modelTransformation)return;let s=o.transformation,c=o.geometries[0].transformation,d=t(h,s,c),f=o.effectiveTransformation,p=r(_,f);this.alignedSampledElevation=l(this,this.elevationContext,e.spatialReference,a,n,p),o.shaderTransformation=p;let m=o.geometries[0].transformation,v=t(g,p,m);this._setFastMaterialTransformation({matA:d,matB:v}),this._updateEdgeTransform(i)}_setFastMaterialTransformation({matA:e,matB:r}){let{stageObject:a}=this;if(a.geometries.length===0)return;let o=a.geometries[0].localOrigin,c=i(x,s(m,o.vec3,-1)),l=t(y,c,e),u=t(b,c,r),d=n(y,l),f=t(b,u,d);for(let e of a.geometries)e.material.setParameters({modelTransformation:f})}_updateEdgeTransform(e){let{stageObject:t,_stageLayer:n}=this;n.stage.renderer.withEdgeView(n=>{n.fastUpdateObject3DEdgesTransform(t)||this.resetEdgeObject(e)})}}const m=c(),h=o(),g=o(),_=o(),v=o(),y=o(),b=o(),x=o();export{p as Graphics3DMeshObject3DGraphicLayer};
2
+ import{getTranslation as e,multiply as t,invert as n,copy as r,fromTranslation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{perObjectElevationAligner as l}from"./ElevationAligners.js";import{evaluateElevationInfoAtPoint as u}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as d}from"./Graphics3DObject3DGraphicLayer.js";import{meshAutoFastUpdateConstants as f}from"./meshAutoFastUpdateConstants.js";class p extends d{constructor(){super(...arguments),this.fastTransformUpdatesAllowed=!1,this._originalGeometries=[],this._fastTransformUpdatesEnabled=!1,this._autoDisableFastUpdates=!1,this._autoDisableFastUpdatesTimeoutId=0}get fastTransformUpdatesEnabled(){return this._fastTransformUpdatesEnabled}destroy(){super.destroy(),this._cancelAutoDisableFastUpdates()}enableFastTransformUpdates(t,n,r=!1){if(!this.fastTransformUpdatesAllowed||this._fastTransformUpdatesEnabled)return;this._cancelAutoDisableFastUpdates(),this._fastTransformUpdatesEnabled=!0,this._autoDisableFastUpdates=r;let{stageObject:i}=this,a=i.geometries.slice(),o=e(m,i.transformation),s=n.getOrigin(o),c=a.map(e=>{let n=t(e.material),r=e.instantiate({material:n});return r.localOrigin=s,r});i.replaceGeometries(c),this._originalGeometries=a}_scheduleAutoDisableFastTransformUpdates(e){this._autoDisableFastUpdates&&(this._cancelAutoDisableFastUpdates(),this._autoDisableFastUpdatesTimeoutId=setTimeout(()=>{this._autoDisableFastUpdatesTimeoutId=0,e()},f.disableDelayMs))}_cancelAutoDisableFastUpdates(){clearTimeout(this._autoDisableFastUpdatesTimeoutId),this._autoDisableFastUpdatesTimeoutId=0}disableFastTransformUpdates(e){if(!this._fastTransformUpdatesEnabled)return;this._cancelAutoDisableFastUpdates(),this._fastTransformUpdatesEnabled=!1,this._autoDisableFastUpdates=!1;let{stageObject:t}=this,n=t.geometries.length>0?t.geometries[0].localOrigin:void 0,r=t.geometries.map(t=>e(t.material)),i=this._originalGeometries.map((e,t)=>{let i=r[t];return i.setParameters({modelTransformation:null}),e.localOrigin!=null&&(e.localOrigin=n),i===e.material?e:e.instantiate({material:i})});t.replaceGeometries(i),this._originalGeometries.length=0}updateFastLocalOrigin(t,n,r,i=!0){if(!this._fastTransformUpdatesEnabled)return;let{stageObject:o}=this;if(o.geometries.length===0)return;let s=o.geometries[0].localOrigin,c=e(m,t);if(s&&!i&&!r.needsOriginUpdate(s,c,o.boundingVolumeWorldSpace.sphere.radius*2))return;let l=r.getOrigin(c);if(l===s)return;let u=n?.localMatrix??a;o.shaderTransformation=null,o.transformation=t,o.geometries.forEach(e=>{e.transformation=u,e.localOrigin=l})}updateTransform(e,r,i,o){let{stageObject:s}=this,c=r?.localMatrix??a;if(!this._fastTransformUpdatesEnabled){s.shaderTransformation=null,s.transformation=e,s.geometries.forEach(e=>e.transformation=c),this._updateEdgeTransform(i);return}let l=s.transformation,u=s.geometries[0].transformation,d=e,f=c,p=t(h,l,u),m=t(g,d,f);s.shaderTransformation=t(v,m,n(v,u)),this._setFastMaterialTransformation({matA:p,matB:m}),this._updateEdgeTransform(i),this._scheduleAutoDisableFastTransformUpdates(o)}alignWithElevation(e,n,i){if(!this._fastTransformUpdatesEnabled){super.alignWithElevation(e,n,i);return}let a=(t,r)=>u(t,e,this.elevationContext,n,r),{stageObject:o}=this;if(!o.geometries[0].material.parameters.modelTransformation)return;let s=o.transformation,c=o.geometries[0].transformation,d=t(h,s,c),f=o.effectiveTransformation,p=r(_,f);this.alignedSampledElevation=l(this,this.elevationContext,e.spatialReference,a,n,p),o.shaderTransformation=p;let m=o.geometries[0].transformation,v=t(g,p,m);this._setFastMaterialTransformation({matA:d,matB:v}),this._updateEdgeTransform(i)}_setFastMaterialTransformation({matA:e,matB:r}){let{stageObject:a}=this;if(a.geometries.length===0)return;let o=a.geometries[0].localOrigin,c=i(x,s(m,o.vec3,-1)),l=t(y,c,e),u=t(b,c,r),d=n(y,l),f=t(b,u,d);for(let e of a.geometries)e.material.setParameters({modelTransformation:f})}_updateEdgeTransform(e){let{stageObject:t,_stageLayer:n}=this;n.stage.renderer.withEdgeView(n=>{n.fastUpdateObject3DEdgesTransform(t)||this.resetEdgeObject(e)})}}const m=c(),h=o(),g=o(),_=o(),v=o(),y=o(),b=o(),x=o();export{p as Graphics3DMeshObject3DGraphicLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isSome as e}from"../../../../core/arrayUtils.js";import{forEach as t}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{onAbortOrThrow as n,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{aggregateSymbolComplexity as i}from"./defaultSymbolComplexity.js";import{Graphics3DGraphic as a}from"./Graphics3DGraphic.js";import{Graphics3DSymbolLayerCreationContext as o}from"./Graphics3DSymbolCreationContext.js";import{Loadable as s}from"./Loadable.js";import{AggregateSymbolComplexity as c}from"./SymbolComplexity.js";import{getSymbolMemorySize as l}from"./symbolMemory.js";class u extends s{set symbol(e){this._symbol=e,e.symbolLayers.forEach((t,n)=>{let r=this.symbolLayers[n];r!=null&&(r.symbol=e,r.symbolLayer=t)})}get symbol(){return this._symbol}constructor(e,t,n){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=n,this._destroyed=!1,this.symbolLayers=[],this.referenced=0,this._extentPadding=0}async doLoad(e){let i=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(i=this._backgroundLayers.concat(i));let a=i.length;for(;this.symbolLayers.length<i.length;)this.symbolLayers.push(null);this.symbolLayers.length=i.length;let o=[];if(!d){let{make:e}=await import(`./Graphics3DSymbolLayerFactory.js`);d=e}for(let t=0;t<a;t++){let r=i.at(t);if(r.enabled===!1)continue;f.renderPriority=1-(1+t)/a,f.renderPriorityStep=1/a,f.ignoreDrivers=r.ignoreDrivers;let s=d(this.symbol,r,this._context,f),c=n(e,()=>{this.symbolLayers[t]=null,s.destroy()});c&&o.push(c),this.symbolLayers[t]=s}if(await t(this.symbolLayers,async(e,t)=>{if(e!=null)try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch{this.symbolLayers[t]=null}}),o.forEach(e=>e.remove()),r(e),this.symbolLayers.length&&!this.symbolLayers.some(e=>!!e))throw Error()}getSymbolLayerSize(e){let t=this.symbolLayers[e];return t==null?null:t.getCachedSize()}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some(e=>e?.queryForSnapping)}get needsUpdateFocus(){return this.symbolLayers.some(e=>e?.needsUpdateFocus===!0)}createGraphics3DGraphic(e,t){let{graphic:n}=e,r=this.symbolLayers.map(t=>t?.createGraphics3DGraphic(e)??null);return new a(n,t||this,r,e.reportGraphicSourceMemory)}get complexity(){let e=new c;return this.symbolLayers.forEach(t=>i(t?.complexity,e)),e}globalPropertyChanged(e,t){let n=this.symbolLayers.length;for(let r=0;r<n;r++){let n=this.symbolLayers[r];if(n!=null&&!n.globalPropertyChanged(e,t,e=>{let t=e.layers[r];return t?.type===`object3d`||t?.type===`buffer`?t:null}))return!1}return!0}applyRendererDiff(e,t){return this.loadStatus===1?this.symbolLayers.reduce((n,r)=>n!==0&&r!=null?Math.min(n,r.applyRendererDiff(e,t)):n,2):0}prepareSymbolPatch(e){if(this.loadStatus===2||e.diff.type!==`partial`)return;let t=e.diff.diff;if(!t.symbolLayers||t.symbolLayers.type!==`partial`)return;let n=t.symbolLayers.diff;this.symbolLayers.forEach((t,r)=>{if(t==null)return;let i=n[r];if(i){let n={diff:i,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};t.prepareSymbolLayerPatch(n),e.symbolStatePatches.push(...n.symbolLayerStatePatches),n.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push((e,t)=>{let i=e.layers[r];i!=null&&n.graphics3DGraphicPatches.forEach(e=>e(i,t))})}})}updateGeometry(e){return this._updateGeometryOrTransform(e,(t,n)=>t.updateGeometry?t.updateGeometry(e.graphic,n):!1)}updateTransform(e,t,n,r){return this._updateGeometryOrTransform(e,(e,i)=>e.updateTransform?e.updateTransform(i,t,n,r):!1)}_updateGeometryOrTransform(e,t){for(let n=0;n<this.symbolLayers.length;n++){let r=this.symbolLayers[n];if(r==null)continue;let i=e.layers[n];if(!i||!t(r,i))return!1}return!0}onRemoveGraphic(e){for(let t=0;t<this.symbolLayers.length;t++){let n=this.symbolLayers[t];if(n==null)continue;let r=e.layers[t];r!=null&&n.onRemoveGraphic(r)}}getFastUpdateStatus(){let e=!1,t=!1;for(let n of this.symbolLayers)if(n!=null){if(n.loadStatus===0)return 3;n.isFastUpdatesEnabled()?t=!0:e=!0}return t?e?2:1:e?0:4}async queryForSnapping(t,n,i,a){let o=this.symbolLayers.filter(e).filter(e=>e.queryForSnapping!=null).map(e=>e.queryForSnapping(t,n,i,a)),s=await Promise.all(o);return r(a),s.flat()}destroy(){if(!this.destroyed){super.destroy();for(let e of this.symbolLayers)e?.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}get usedMemory(){return l(this)}}let d=null;const f=new o;export{u as Graphics3DSymbol};
2
+ import{isSome as e}from"../../../../core/arrayUtils.js";import{forEach as t}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import{onAbortOrThrow as n,throwIfAborted as r}from"../../../../core/promiseUtils.js";import{aggregateSymbolComplexity as i}from"./defaultSymbolComplexity.js";import{Graphics3DGraphic as a}from"./Graphics3DGraphic.js";import{Graphics3DSymbolLayerCreationContext as o}from"./Graphics3DSymbolCreationContext.js";import{Loadable as s}from"./Loadable.js";import{AggregateSymbolComplexity as c}from"./SymbolComplexity.js";import{getSymbolMemorySize as l}from"./symbolMemory.js";class u extends s{set symbol(e){this._symbol=e,e.symbolLayers.forEach((t,n)=>{let r=this.symbolLayers[n];r!=null&&(r.symbol=e,r.symbolLayer=t)})}get symbol(){return this._symbol}constructor(e,t,n){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=n,this._destroyed=!1,this.symbolLayers=[],this.referenced=0,this._extentPadding=0}async doLoad(e){let i=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(i=this._backgroundLayers.concat(i));let a=i.length;for(;this.symbolLayers.length<i.length;)this.symbolLayers.push(null);this.symbolLayers.length=i.length;let o=[];if(!d){let{make:e}=await import(`./Graphics3DSymbolLayerFactory.js`);d=e}for(let t=0;t<a;t++){let r=i.at(t);if(r.enabled===!1)continue;f.renderPriority=1-(1+t)/a,f.renderPriorityStep=1/a,f.ignoreDrivers=r.ignoreDrivers;let s=d(this.symbol,r,this._context,f),c=n(e,()=>{this.symbolLayers[t]=null,s.destroy()});c&&o.push(c),this.symbolLayers[t]=s}if(await t(this.symbolLayers,async(e,t)=>{if(e!=null)try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch{this.symbolLayers[t]=null}}),o.forEach(e=>e.remove()),r(e),this.symbolLayers.length&&!this.symbolLayers.some(e=>!!e))throw Error()}getSymbolLayerSize(e){let t=this.symbolLayers[e];return t==null?null:t.getCachedSize()}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some(e=>e?.queryForSnapping)}get needsUpdateFocus(){return this.symbolLayers.some(e=>e?.needsUpdateFocus===!0)}createGraphics3DGraphic(e,t){let{graphic:n}=e,r=this.symbolLayers.map(t=>t?.createGraphics3DGraphic(e)??null);return new a(n,t||this,r,e.reportGraphicSourceMemory)}get complexity(){let e=new c;return this.symbolLayers.forEach(t=>i(t?.complexity,e)),e}globalPropertyChanged(e,t){let n=this.symbolLayers.length;for(let r=0;r<n;r++){let n=this.symbolLayers[r];if(n!=null&&!n.globalPropertyChanged(e,t,e=>{let t=e.layers[r];return t?.type===`object3d`||t?.type===`buffer`?t:null}))return!1}return!0}applyRendererDiff(e,t){return this.loadStatus===1?this.symbolLayers.reduce((n,r)=>n!==0&&r!=null?Math.min(n,r.applyRendererDiff(e,t)):n,2):0}prepareSymbolPatch(e){if(this.loadStatus===2||e.diff.type!==`partial`)return;let t=e.diff.diff;if(!t.symbolLayers||t.symbolLayers.type!==`partial`)return;let n=t.symbolLayers.diff;this.symbolLayers.forEach((t,r)=>{if(t==null)return;let i=n[r];if(i){let n={diff:i,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};t.prepareSymbolLayerPatch(n),e.symbolStatePatches.push(...n.symbolLayerStatePatches),n.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push((e,t)=>{let i=e.layers[r];i!=null&&n.graphics3DGraphicPatches.forEach(e=>e(i,t))})}})}updateGeometry(e){return this._updateGeometryOrTransform(e,(t,n)=>t.updateGeometry?t.updateGeometry(e.graphic,n):!1)}updateMeshTransform(e,t,n,r,i){return this._updateGeometryOrTransform(e,(e,a)=>e.updateMeshTransform?e.updateMeshTransform(a,t,n,r,i):!1)}_updateGeometryOrTransform(e,t){for(let n=0;n<this.symbolLayers.length;n++){let r=this.symbolLayers[n];if(r==null)continue;let i=e.layers[n];if(!i||!t(r,i))return!1}return!0}onRemoveGraphic(e){for(let t=0;t<this.symbolLayers.length;t++){let n=this.symbolLayers[t];if(n==null)continue;let r=e.layers[t];r!=null&&n.onRemoveGraphic(r)}}getFastUpdateStatus(){let e=!1,t=!1;for(let n of this.symbolLayers)if(n!=null){if(n.loadStatus===0)return 3;n.isFastUpdatesEnabled()?t=!0:e=!0}return t?e?2:1:e?0:4}async queryForSnapping(t,n,i,a){let o=this.symbolLayers.filter(e).filter(e=>e.queryForSnapping!=null).map(e=>e.queryForSnapping(t,n,i,a)),s=await Promise.all(o);return r(a),s.flat()}destroy(){if(!this.destroyed){super.destroy();for(let e of this.symbolLayers)e?.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}get usedMemory(){return l(this)}}let d=null;const f=new o;export{u as Graphics3DSymbol};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{getMetersPerUnitForSR as e}from"../../../../core/units.js";import{set as t}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as n,create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scale as i}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as o,intersectsClippingArea as s,empty as c,expandWithAABB as l,create as u}from"../../../../geometry/support/aaBoundingBox.js";import{empty as d,expandPointInPlace as f,create as p}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as m}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as h}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as g,needsElevationUpdates2D as _}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as v}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as y}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as b}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as x,createWaterGeometry as S,PolygonCreationDataBase as C}from"./polygonUtils.js";import{loadTessellationUtils as w,preloadedPolygonToRenderInfoElevationAligned as T,preloadedPolygonToRenderInfoDraped as E}from"../../support/renderInfoUtils/polygon.js";import{Object3D as D}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as k,WaterMaterial as A}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as j}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const M=[`polyline`,`polygon`,`extent`];class N extends b{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r)}async doLoad(){await w()}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,M,this.symbolLayer.type))return null;let n=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(n.mode===`on-the-ground`),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,n,t.uid)}ensureMaterial(){if(this._materials[0])return;let e=new k,t=this.symbolLayer.color.toUnitRGBA();t[3]*=this._getLayerOpacity(),e.color=t,e.transparent=t[3]<1||this.needsDrivenTransparentPass,e.waveDirection=this.symbolLayer.waveDirection==null?n(0,0):P(this.symbolLayer.waveDirection);let r=this.symbolLayer.waveStrength+`-`+this.symbolLayer.waterbodySize,i=j[r];e.waveStrength=i.waveStrength,e.waveTextureRepeat=i.textureRepeat,e.waveVelocity=i.waveVelocity,e.flowStrength=i.perturbationStrength,e.hasSlicePlane=this._context.slicePlaneEnabled,e.draped=this.draped,e.useIndexing=!0,this._materials[0]=new A(e,this._context)}layerOpacityChanged(){if(this._materials[0]==null)return;let e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),n=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:n})}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=g(N.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=_(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,n){let r=x(e.geometry);if(r==null)return null;let i=T(r,this._context.elevationProvider,this._context.renderCoordsHelper,t,{owner:this._context.layer});if(i==null)return null;let a=i.vertexCount,o=m(a*2);F(o,i.mapPositions,a,this._context.elevationProvider.spatialReference);let s=new B(i,o,this._context.layerViewUid,e.uid);if(s.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(s),this._create3DShapeGeometries(s),this._logGeometryCreationWarnings(s.renderData,r.rings,`rings`,`WaterSymbol3DLayer`),s.outGeometries.length===0)return null;let c=new D({geometries:s.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:n}),l=new y(this,c,null,h,t);return l.alignedSampledElevation=s.renderData.sampledElevation,l.needsElevationUpdates=_(t.mode),l}_create3DShapeGeometries(e){let{positions:t,mapPositions:n,polygonIndices:r}=e.renderData;if(e.renderData.polygonIndexCount===0)return;let i=e.uvCoords;if(this._context.clippingExtent!=null&&(o(n,z),!s(z,this._context.clippingExtent)))return;let a=S({material:this._materials[0],indices:r,mapPositions:n,attributeData:{position:t,uv0:i}},e.olidColor);e.outGeometries.push(a)}_createAsOverlay(e){let t=x(e.geometry);if(t==null)return null;this._materials[0].renderPriority=this._renderPriority;let n=E(t,{drapedSpatialReference:this._context.overlaySR,owner:this._context.layer});if(n==null)return null;let r=n.vertexCount,i=m(r*2);F(i,n.positions,r,this._context.overlaySR);let a=new V(n,i,this._context.layerViewUid,e.uid);return a.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),a.outBoundingBox=c(),this._createAsOverlayWater(a),this._logGeometryCreationWarnings(a.renderData,t.rings,`rings`,`WaterSymbol3DLayer`),a.outGeometries.length===0?null:new v(this,a.outGeometries,a.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){let t=e.uvCoords,{positions:n,polygonIndices:r}=e.renderData;if(o(n,z),!s(z,this._context.clippingExtent)||(l(e.outBoundingBox,z),e.renderData.polygonIndexCount===0))return;let i=S({material:this._materials[0],indices:r,attributeData:{position:n,uv0:t}},e.olidColor);e.outGeometries.push(new O(i,e))}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function P(e){let t=r(),n=a(e);return t[0]=Math.sin(n),t[1]=Math.cos(n),t}function F(n,r,a,o){let s=e(o);d(L);for(let e=0;e<a;e++)t(R,r[e*3],r[e*3+1]),f(L,R);i(L,L,s);let c=L[0]%N.unitSizeOfTexture,l=L[1]%N.unitSizeOfTexture;I[0]=L[0]-c,I[1]=L[1]-l;for(let e=0;e<a;e++)n[e*2]=(r[e*3]*s-I[0])/N.unitSizeOfTexture,n[e*2+1]=(r[e*3+1]*s-I[1])/N.unitSizeOfTexture}const I=r(),L=p(),R=r(),z=u();class B extends C{constructor(e,t,n,r){super(e,n,r),this.uvCoords=t}}class V extends C{constructor(e,t,n,r){super(e,n,r),this.uvCoords=t}}export{N as Graphics3DWaterSymbolLayer,P as headingVectorFromAngle};
2
+ import{getMetersPerUnitForSR as e}from"../../../../core/units.js";import{fromValues as t,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{scale as i}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as o,intersectsClippingArea as s,empty as c,expandWithAABB as l,create as u,center as d}from"../../../../geometry/support/aaBoundingBox.js";import{empty as f,expandXYInPlace as p,create as m}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec3f as h,BufferViewVec2f as g,BufferViewVec4u8 as _}from"../../../../geometry/support/buffer/BufferView.js";import{perBufferVertexElevationAligner as v}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as y,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DBufferGraphicLayer as x}from"./Graphics3DBufferGraphicLayer.js";import{Graphics3DDrapedBufferGraphicLayer as S}from"./Graphics3DDrapedBufferGraphicLayer.js";import{Graphics3DSymbolLayer as C}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as w,PolygonCreationDataBase as T}from"./polygonUtils.js";import{loadTessellationUtils as E,preloadedPolygonToRenderInfoElevationAligned as D,preloadedPolygonToRenderInfoDraped as O}from"../../support/renderInfoUtils/polygon.js";import{BufferGeometry as k}from"../../webgl-engine/lib/BufferGeometry.js";import{BufferObject3D as A}from"../../webgl-engine/lib/BufferObject3D.js";import{Buffers as j}from"../../webgl-engine/lib/Buffers.js";import{Parameters as M,WaterMaterial as N,getWaterLayout as P}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as F}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const I=[`polyline`,`polygon`,`extent`];class L extends C{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r)}async doLoad(){await E()}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,I,this.symbolLayer.type))return null;let n=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(n.mode===`on-the-ground`),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,n,t.uid)}ensureMaterial(){if(this._materials[0])return;let e=new M,n=this.symbolLayer.color.toUnitRGBA();n[3]*=this._getLayerOpacity(),e.color=n,e.transparent=n[3]<1||this.needsDrivenTransparentPass,e.waveDirection=this.symbolLayer.waveDirection==null?t(0,0):R(this.symbolLayer.waveDirection);let r=this.symbolLayer.waveStrength+`-`+this.symbolLayer.waterbodySize,i=F[r];e.waveStrength=i.waveStrength,e.waveTextureRepeat=i.textureRepeat,e.waveVelocity=i.waveVelocity,e.flowStrength=i.perturbationStrength,e.hasSlicePlane=this._context.slicePlaneEnabled,e.draped=this.draped,e.useIndexing=!0,this._materials[0]=new N(e,this._context)}layerOpacityChanged(){if(this._materials[0]==null)return;let e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),n=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:n})}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=y(L.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=b(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,n){let r=w(e.geometry);if(r==null)return null;let i=D(r,this._context.elevationProvider,this._context.renderCoordsHelper,t,{owner:this._context.layer});if(i==null)return null;let a=new W(i,this._context.layerViewUid,e.uid);if(a.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,r.rings,`rings`,`WaterSymbol3DLayer`),a.outGeometries.length===0)return null;let o=new A({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:n}),s=new x(this,o,null,v,t);return s.alignedSampledElevation=a.renderData.sampledElevation,s.needsElevationUpdates=b(t.mode),s}_create3DShapeGeometries(e){let{mapPositions:t}=e.renderData;if(e.renderData.polygonIndexCount===0||this._context.clippingExtent!=null&&(o(t,V),!s(V,this._context.clippingExtent)))return;let n=z(e.renderData,this._materials[0],this._context.localOriginFactory,this._context.elevationProvider.spatialReference,e.olidColor,e.layerViewUid,e.graphicUid);e.outGeometries.push(n)}_createAsOverlay(e){let t=w(e.geometry);if(t==null)return null;this._materials[0].renderPriority=this._renderPriority;let n=O(t,{drapedSpatialReference:this._context.overlaySR,owner:this._context.layer});if(n==null)return null;let r=new G(n,this._context.layerViewUid,e.uid);return r.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(r),r.outBoundingBox=c(),this._createAsOverlayWater(r),this._logGeometryCreationWarnings(r.renderData,t.rings,`rings`,`WaterSymbol3DLayer`),r.outGeometries.length===0?null:new S(this,r.outGeometries,r.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){let{positions:t}=e.renderData;if(o(t,V),!s(V,this._context.clippingExtent)||(l(e.outBoundingBox,V),e.renderData.polygonIndexCount===0))return;let n=z(e.renderData,this._materials[0],this._context.drapeSourceRenderer.rendererContext.localOriginFactory,this._context.overlaySR,e.olidColor,e.layerViewUid,e.graphicUid);e.outGeometries.push(n)}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function R(e){let t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function z(t,n,r,a,s,c,l){let{positions:u,polygonIndices:m,vertexCount:v}=t,y=`mapPositions`in t?t.mapPositions:null,b=y??u;o(u,V),d(V,U);let x=r.getOrigin(U),S=P().createBuffer(v),C=S.getField(`position`,h),w=S.getField(`uv0`,g),T=S.getField(`olidColor`,_),E=e(a);f(H);for(let e=0;e<v;e++)p(H,b[e*3],b[e*3+1]);i(H,H,E);let[D,O]=H,A=D-D%B,M=O-O%B,N=x.vec3;for(let e=0;e<v;e++){let t=e*3;C.setValues(e,u[t]-N[0],u[t+1]-N[1],u[t+2]-N[2]),w.setValues(e,(b[t]*E-A)/B,(b[t+1]*E-M)/B),T!=null&&s!=null&&T.setVec(e,s)}let F=new k(n,new j(S,void 0,m),x,y);return F.layerViewUid=c,F.graphicUid=l,F}const B=100,V=u(),H=m(),U=r();class W extends T{}class G extends T{}export{L as Graphics3DWaterSymbolLayer,z as createWaterGeometry,R as headingVectorFromAngle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{throwIfAborted as e}from"../../../../core/promiseUtils.js";import{emptySymbolComplexity as t}from"./defaultSymbolComplexity.js";import{Loadable as n}from"./Loadable.js";import{getSymbolMemorySize as r}from"./symbolMemory.js";class i extends n{constructor(e,t,n){super(t),this.symbol=e,this._convert=n,this.symbologySnappingSupported=!1,this.graphics3DSymbol=null,this.referenced=0}getSymbolLayerSize(e){return this.graphics3DSymbol==null?null:this.graphics3DSymbol.getSymbolLayerSize(e)}get symbolLayers(){return this.graphics3DSymbol==null?[]:this.graphics3DSymbol.symbolLayers}get extentPadding(){return this.graphics3DSymbol==null?0:this.graphics3DSymbol.extentPadding}async doLoad(t){let n=await this.symbol.fetchSymbol({signal:t});e(t),n.id=this.symbol.id,this.graphics3DSymbol=this._convert(n),this.graphics3DSymbol!=null&&(await this.graphics3DSymbol.load(),e(t))}createGraphics3DGraphic(e){return this.graphics3DSymbol==null?null:this.graphics3DSymbol.createGraphics3DGraphic(e,this)}get complexity(){return this.graphics3DSymbol==null?t:this.graphics3DSymbol.complexity}globalPropertyChanged(e,t){return this.graphics3DSymbol!=null&&this.graphics3DSymbol.globalPropertyChanged(e,t)}applyRendererDiff(e,t){return this.graphics3DSymbol==null?0:this.graphics3DSymbol.applyRendererDiff(e,t)}prepareSymbolPatch(e){this.graphics3DSymbol!=null&&this.graphics3DSymbol.prepareSymbolPatch(e)}updateGeometry(e){return this.graphics3DSymbol!=null&&this.graphics3DSymbol.updateGeometry(e)}updateTransform(e,t,n,r){return this.graphics3DSymbol?.updateTransform(e,t,n,r)??!1}onRemoveGraphic(){}get needsUpdateFocus(){return!1}getFastUpdateStatus(){return this.graphics3DSymbol?.getFastUpdateStatus()??3}destroy(){this.graphics3DSymbol!=null&&this.graphics3DSymbol.destroy(),this.graphics3DSymbol=void 0,super.destroy()}get destroyed(){return this.graphics3DSymbol===void 0}get usedMemory(){return r(this)}}export{i as Graphics3DWebStyleSymbol};
2
+ import{throwIfAborted as e}from"../../../../core/promiseUtils.js";import{emptySymbolComplexity as t}from"./defaultSymbolComplexity.js";import{Loadable as n}from"./Loadable.js";import{getSymbolMemorySize as r}from"./symbolMemory.js";class i extends n{constructor(e,t,n){super(t),this.symbol=e,this._convert=n,this.symbologySnappingSupported=!1,this.graphics3DSymbol=null,this.referenced=0}getSymbolLayerSize(e){return this.graphics3DSymbol==null?null:this.graphics3DSymbol.getSymbolLayerSize(e)}get symbolLayers(){return this.graphics3DSymbol==null?[]:this.graphics3DSymbol.symbolLayers}get extentPadding(){return this.graphics3DSymbol==null?0:this.graphics3DSymbol.extentPadding}async doLoad(t){let n=await this.symbol.fetchSymbol({signal:t});e(t),n.id=this.symbol.id,this.graphics3DSymbol=this._convert(n),this.graphics3DSymbol!=null&&(await this.graphics3DSymbol.load(),e(t))}createGraphics3DGraphic(e){return this.graphics3DSymbol==null?null:this.graphics3DSymbol.createGraphics3DGraphic(e,this)}get complexity(){return this.graphics3DSymbol==null?t:this.graphics3DSymbol.complexity}globalPropertyChanged(e,t){return this.graphics3DSymbol!=null&&this.graphics3DSymbol.globalPropertyChanged(e,t)}applyRendererDiff(e,t){return this.graphics3DSymbol==null?0:this.graphics3DSymbol.applyRendererDiff(e,t)}prepareSymbolPatch(e){this.graphics3DSymbol!=null&&this.graphics3DSymbol.prepareSymbolPatch(e)}updateGeometry(e){return this.graphics3DSymbol!=null&&this.graphics3DSymbol.updateGeometry(e)}updateMeshTransform(e,t,n,r,i){return this.graphics3DSymbol?.updateMeshTransform(e,t,n,r,i)??!1}onRemoveGraphic(){}get needsUpdateFocus(){return!1}getFastUpdateStatus(){return this.graphics3DSymbol?.getFastUpdateStatus()??3}destroy(){this.graphics3DSymbol!=null&&this.graphics3DSymbol.destroy(),this.graphics3DSymbol=void 0,super.destroy()}get destroyed(){return this.graphics3DSymbol===void 0}get usedMemory(){return r(this)}}export{i as Graphics3DWebStyleSymbol};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{DefaultMaterial as e}from"../../webgl-engine/materials/DefaultMaterial.js";class t{constructor(){this._fastTransformOriginalMaterials=new Map,this._fastTransformClonedMaterials=new Map,this._graphicReferenceCount=0}enable(t,n,r){t.enableFastTransformUpdates(t=>{if(this._graphicReferenceCount<=1){if(this._fastTransformOriginalMaterials.has(t))return t;let e=n.byMaterial(t);return this._fastTransformOriginalMaterials.set(t,e),n.delete(t),t}let i=new e(t.parameters,r);return this._fastTransformClonedMaterials.set(i,t),i},r.localOriginFactory)}disable(e,t){let n=new Set,r=new Set;e.disableFastTransformUpdates(e=>{if(!this._fastTransformClonedMaterials.has(e)){let i=e,a=this._fastTransformOriginalMaterials.get(i);return t.has(a.uid)?(n.add(i),t.byUid(a.uid).material):(r.add(i),a.material)}let i=e,a=this._fastTransformClonedMaterials.get(i);return this._fastTransformClonedMaterials.delete(i),a});for(let e of n)this._fastTransformOriginalMaterials.delete(e);for(let e of r){let n=this._fastTransformOriginalMaterials.get(e);this._fastTransformOriginalMaterials.delete(e),t.set(n.uid,n)}}onAddGraphic(){this._graphicReferenceCount++}onRemoveGraphic(e,t){this._graphicReferenceCount--,this.disable(e,t)}forEachMaterialInfo(e){this._fastTransformOriginalMaterials.forEach(e)}forEachClonedMaterial(e){this._fastTransformClonedMaterials.forEach(e)}destroy(){this._fastTransformClonedMaterials.clear(),this._fastTransformOriginalMaterials.clear()}}class n{constructor(){this._byUid=new Map,this._byMaterial=new Map}get materials(){return Array.from(this._byUid.values(),e=>e.material)}byUid(e){return this._byUid.get(e)}byMaterial(e){return this._byMaterial.get(e)}set(e,t){this._byUid.set(e,t),this._byMaterial.set(t.material,t)}delete(e){let t=this._byMaterial.get(e)?.uid;t&&(this._byUid.delete(t),this._byMaterial.delete(e))}has(e){return this._byUid.has(e)}forEachMaterialInfo(e){this._byUid.forEach(e)}clear(){this._byUid.clear(),this._byMaterial.clear()}}export{n as MaterialInfoCache,t as MeshFastUpdateProcessor};
2
+ import{DefaultMaterial as e}from"../../webgl-engine/materials/DefaultMaterial.js";class t{constructor(){this._fastTransformOriginalMaterials=new Map,this._fastTransformClonedMaterials=new Map,this._graphicReferenceCount=0}enable(t,n,r,i=!1){t.enableFastTransformUpdates(t=>{if(this._graphicReferenceCount<=1){if(this._fastTransformOriginalMaterials.has(t))return t;let e=n.byMaterial(t);return this._fastTransformOriginalMaterials.set(t,e),n.delete(t),t}let i=new e(t.parameters,r);return this._fastTransformClonedMaterials.set(i,t),i},r.localOriginFactory,i)}disable(e,t){let n=new Set,r=new Set;e.disableFastTransformUpdates(e=>{if(!this._fastTransformClonedMaterials.has(e)){let i=e,a=this._fastTransformOriginalMaterials.get(i);return t.has(a.uid)?(n.add(i),t.byUid(a.uid).material):(r.add(i),a.material)}let i=e,a=this._fastTransformClonedMaterials.get(i);return this._fastTransformClonedMaterials.delete(i),a});for(let e of n)this._fastTransformOriginalMaterials.delete(e);for(let e of r){let n=this._fastTransformOriginalMaterials.get(e);this._fastTransformOriginalMaterials.delete(e),t.set(n.uid,n)}}onAddGraphic(){this._graphicReferenceCount++}onRemoveGraphic(e,t){this._graphicReferenceCount--,this.disable(e,t)}forEachMaterialInfo(e){this._fastTransformOriginalMaterials.forEach(e)}forEachClonedMaterial(e){this._fastTransformClonedMaterials.forEach(e)}destroy(){this._fastTransformClonedMaterials.clear(),this._fastTransformOriginalMaterials.clear()}}class n{constructor(){this._byUid=new Map,this._byMaterial=new Map}get materials(){return Array.from(this._byUid.values(),e=>e.material)}byUid(e){return this._byUid.get(e)}byMaterial(e){return this._byMaterial.get(e)}set(e,t){this._byUid.set(e,t),this._byMaterial.set(t.material,t)}delete(e){let t=this._byMaterial.get(e)?.uid;t&&(this._byUid.delete(t),this._byMaterial.delete(e))}has(e){return this._byUid.has(e)}forEachMaterialInfo(e){this._byUid.forEach(e)}clear(){this._byUid.clear(),this._byMaterial.clear()}}export{n as MaterialInfoCache,t as MeshFastUpdateProcessor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../geometry/Extent.js";import t from"../../../../geometry/Polygon.js";import{getContinuousIndexArray as n,getZeroIndexArray as r}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as i}from"./olidUtils.js";import{Attribute as a}from"../../webgl-engine/lib/Attribute.js";import{Geometry as o}from"../../webgl-engine/lib/Geometry.js";function s(e){let t=e.attributeData.position.length/3,s=n(t),c=[[`position`,new a(e.attributeData.position,s,3,!0)]],{boundingRect:l,textureElementIndices:u,boundingRectIndices:d}=e.attributeData,f=l!=null,p=f?d?.length??1:t,m=r(p);e.attributeData.colorFeature==null?e.attributeData.color&&c.push([`color`,new a(e.attributeData.color,m,4,!0)]):c.push([`colorFeatureAttribute`,new a([e.attributeData.colorFeature],m,1,!0)]),e.attributeData.uvMapSpace&&c.push([`uvMapSpace`,new a(e.attributeData.uvMapSpace,s,4,!0)]),f&&(c.push([`boundingRect`,new a(l,d??[0],9,!0)]),u!=null&&c.push([`textureElementIndex`,new a(u,s,1,!0)]));let h=e.attributeData.olidColor;return h!=null&&i(c,h,r(t)),new o(e.material,c,e.mapPositions,void 0,void 0,e.indices)}function c(e,t=null){let s=e.attributeData.position.length/3,c=n(s),l=[[`position`,new a(e.attributeData.position,c,3,!0)],[`uv0`,new a(e.attributeData.uv0,c,2,!0)]];return t!=null&&i(l,t,r(s)),new o(e.material,l,e.mapPositions,void 0,void 0,e.indices)}function l(n){switch(n.type){case`extent`:if(n instanceof e)return t.fromExtent(n);break;case`polygon`:return n}return null}class u{constructor(e,t,n){this.renderData=e,this.layerViewUid=t,this.graphicUid=n,this.outGeometries=[]}}export{u as PolygonCreationDataBase,s as createColorGeometry,c as createWaterGeometry,l as geometryAsPolygon};
2
+ import e from"../../../../geometry/Extent.js";import t from"../../../../geometry/Polygon.js";import{getContinuousIndexArray as n,getZeroIndexArray as r}from"../../../../geometry/support/Indices.js";import{addOlidAttribute as i}from"./olidUtils.js";import{Attribute as a}from"../../webgl-engine/lib/Attribute.js";import{Geometry as o}from"../../webgl-engine/lib/Geometry.js";function s(e){let t=e.attributeData.position.length/3,s=n(t),c=[[`position`,new a(e.attributeData.position,s,3,!0)]],{boundingRect:l,textureElementIndices:u,boundingRectIndices:d}=e.attributeData,f=l!=null,p=f?d?.length??1:t,m=r(p);e.attributeData.colorFeature==null?e.attributeData.color&&c.push([`color`,new a(e.attributeData.color,m,4,!0)]):c.push([`colorFeatureAttribute`,new a([e.attributeData.colorFeature],m,1,!0)]),e.attributeData.uvMapSpace&&c.push([`uvMapSpace`,new a(e.attributeData.uvMapSpace,s,4,!0)]),f&&(c.push([`boundingRect`,new a(l,d??[0],9,!0)]),u!=null&&c.push([`textureElementIndex`,new a(u,s,1,!0)]));let h=e.attributeData.olidColor;return h!=null&&i(c,h,r(t)),new o(e.material,c,e.mapPositions,void 0,void 0,e.indices)}function c(n){switch(n.type){case`extent`:if(n instanceof e)return t.fromExtent(n);break;case`polygon`:return n}return null}class l{constructor(e,t,n){this.renderData=e,this.layerViewUid=t,this.graphicUid=n,this.outGeometries=[]}}export{l as PolygonCreationDataBase,s as createColorGeometry,c as geometryAsPolygon};