@arcgis/core 5.0.0-next.4 → 5.0.0-next.5

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 (363) hide show
  1. package/Map.js +1 -1
  2. package/analysis/ElevationProfileAnalysis.js +1 -1
  3. package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
  4. package/applications/KnowledgeStudio/generalSdkInternalAccess.d.ts +4 -0
  5. package/applications/KnowledgeStudio/generalSdkInternalAccess.js +5 -0
  6. package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +1 -0
  7. package/applications/KnowledgeStudio/generalSharedKgUtils.js +1 -1
  8. package/applications/KnowledgeStudio/layerInternalAccessUtils.d.ts +2 -0
  9. package/applications/KnowledgeStudio/layerInternalAccessUtils.js +1 -1
  10. package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
  11. package/assets/components/assets/sort-handle/t9n/messages.uk.json +1 -1
  12. package/assets/esri/core/workers/RemoteClient.js +1 -1
  13. package/assets/esri/core/workers/chunks/0366b78b0ccf4ed5f6ac.js +1 -0
  14. package/assets/esri/core/workers/chunks/037b2548bf85e2d7c6ac.js +1 -0
  15. package/assets/esri/core/workers/chunks/{c0feec6e2f0e45900ae0.js → 0686243904381ef863dc.js} +1 -1
  16. package/assets/esri/core/workers/chunks/06ba43843e9c4988049b.js +1 -0
  17. package/assets/esri/core/workers/chunks/0f100e163e1847e04155.js +1 -0
  18. package/assets/esri/core/workers/chunks/{388482cea4b9fdeaf06e.js → 0f30a9514571c7be9978.js} +1 -1
  19. package/assets/esri/core/workers/chunks/0f8847f9ae3068833fa4.js +1 -0
  20. package/assets/esri/core/workers/chunks/{14ace5dc4b8984212a57.js → 17d5f8dba6ebb1184506.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{b2add7338258ca7c24dd.js → 1da74aa308ded5748ef5.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{651b9144abb1895cc510.js → 1e848d9da1c61a27cf18.js} +1 -1
  23. package/assets/esri/core/workers/chunks/1eedac33c9fcd7681427.js +1 -0
  24. package/assets/esri/core/workers/chunks/239377336a2009caea01.js +1 -0
  25. package/assets/esri/core/workers/chunks/285762ff92d5388b6024.js +1 -0
  26. package/assets/esri/core/workers/chunks/{40b81d1c2d53cf598b8e.js → 2f03d33f4ca8a48461fc.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{4f01be74dd26e639330f.js → 2f24017e72d41c259faa.js} +1 -1
  28. package/assets/esri/core/workers/chunks/3271614322ba4b44fb5a.js +1 -0
  29. package/assets/esri/core/workers/chunks/36b1f47d70b57d79df7b.js +1 -0
  30. package/assets/esri/core/workers/chunks/{3d65b8a2fbe1df050a25.js → 377a66034e7c1bad5599.js} +1 -1
  31. package/assets/esri/core/workers/chunks/37f2ef14399546e697e6.js +1 -0
  32. package/assets/esri/core/workers/chunks/{0f9bb3187306f89e3d63.js → 398f356b11fd33bd3831.js} +1 -1
  33. package/assets/esri/core/workers/chunks/3a457e718a901a45902e.js.LICENSE.txt +1 -1
  34. package/assets/esri/core/workers/chunks/4442817beb7a76c95770.js +1 -0
  35. package/assets/esri/core/workers/chunks/4c5a7249a311070d8f43.js +1 -0
  36. package/assets/esri/core/workers/chunks/551c6c89b51b99f4864b.js +1 -0
  37. package/assets/esri/core/workers/chunks/{9a723d739ac44b45432c.js → 557960763695abee4a83.js} +1 -1
  38. package/assets/esri/core/workers/chunks/655360995c1cbc78a5a3.js +1 -0
  39. package/assets/esri/core/workers/chunks/67d9cfe02613cb73ee37.js.LICENSE.txt +1 -1
  40. package/assets/esri/core/workers/chunks/6a69dafeb7c9ca8a3d84.js +1 -0
  41. package/assets/esri/core/workers/chunks/6c3b99209d542efa64d4.js +1 -0
  42. package/assets/esri/core/workers/chunks/{8215015f11221a354273.js → 6d049182bec34a22abcd.js} +1 -1
  43. package/assets/esri/core/workers/chunks/71762199aef5d3107da2.js +1 -0
  44. package/assets/esri/core/workers/chunks/72c851c400752094b162.js +1 -0
  45. package/assets/esri/core/workers/chunks/7558919912f7fdc4837b.js +1 -0
  46. package/assets/esri/core/workers/chunks/7596d005a4dc3964b140.js +1 -0
  47. package/assets/esri/core/workers/chunks/762fe93015b705546188.js +1 -0
  48. package/assets/esri/core/workers/chunks/79dbfa2b9b332ca0002f.js +1 -0
  49. package/assets/esri/core/workers/chunks/7a23ab84e1144f081c92.js +1 -0
  50. package/assets/esri/core/workers/chunks/{2a5f331c0f18d8574b4e.js → 811d4c46c75cf6a63e78.js} +1 -1
  51. package/assets/esri/core/workers/chunks/829bc5dbda2f51561446.js +1 -0
  52. package/assets/esri/core/workers/chunks/8372f142c4d7a65c7954.js +1 -0
  53. package/assets/esri/core/workers/chunks/8605ec4678eb4511c715.js +1 -0
  54. package/assets/esri/core/workers/chunks/883ffaa69b3e6eb158bf.js +1 -0
  55. package/assets/esri/core/workers/chunks/{3d22fe2f2c40abbc246e.js → 88d942cd25bef74fd50a.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{0086a09441627842d34a.js → 8f3503b2fb6cd38757b9.js} +1 -1
  57. package/assets/esri/core/workers/chunks/9786f91455350eaae493.js +1 -0
  58. package/assets/esri/core/workers/chunks/98311fec6c16a1b23586.js +1 -0
  59. package/assets/esri/core/workers/chunks/9c5cbf8810f37b1a4718.js +1 -0
  60. package/assets/esri/core/workers/chunks/a091623bbfb3d771c8d8.js +1 -0
  61. package/assets/esri/core/workers/chunks/a137c27ce078bea44f89.js +1 -0
  62. package/assets/esri/core/workers/chunks/a29d7205394cb8b2a847.js +1 -0
  63. package/assets/esri/core/workers/chunks/a2a284d4dd5caaecbc2e.js +1 -0
  64. package/assets/esri/core/workers/chunks/{135e270b4f03c4270870.js → a4db5c9a90107e097df8.js} +1 -1
  65. package/assets/esri/core/workers/chunks/a61cb4f1ca282bf8b75d.js +1 -0
  66. package/assets/esri/core/workers/chunks/a6ac1ff89c40f3a4797a.js +1 -0
  67. package/assets/esri/core/workers/chunks/{dc31865edea480f0ebba.js → a8c4fd779e454e4075c4.js} +1 -1
  68. package/assets/esri/core/workers/chunks/a8f998b8ec8c56150479.js.LICENSE.txt +1 -1
  69. package/assets/esri/core/workers/chunks/aa6eb55e4fb57c4e8eeb.js +1 -0
  70. package/assets/esri/core/workers/chunks/aa78b69219d9a0ef1c54.js.LICENSE.txt +1 -1
  71. package/assets/esri/core/workers/chunks/af3fc2562bb6d217adf6.js +1 -0
  72. package/assets/esri/core/workers/chunks/{46ef545d2b3b3f4e6d32.js → b017bac40dc8328013e3.js} +2 -2
  73. package/assets/esri/core/workers/chunks/{46ef545d2b3b3f4e6d32.js.LICENSE.txt → b017bac40dc8328013e3.js.LICENSE.txt} +1 -1
  74. package/assets/esri/core/workers/chunks/b59f9c3f7a149214256f.js +1 -0
  75. package/assets/esri/core/workers/chunks/b96eb0ea506379182d62.js +2 -0
  76. package/assets/esri/core/workers/chunks/{24921d31efa8d222ad2d.js.LICENSE.txt → b96eb0ea506379182d62.js.LICENSE.txt} +1 -1
  77. package/assets/esri/core/workers/chunks/{b5863afafd3a7d2d5c05.js → bb5484b5eeacc9ad2ceb.js} +3 -3
  78. package/assets/esri/core/workers/chunks/bb56717c4e36f28d4c08.js +1 -0
  79. package/assets/esri/core/workers/chunks/bb7976e2f883b544add6.js +1 -0
  80. package/assets/esri/core/workers/chunks/c0b7e86860838638537f.js +1 -0
  81. package/assets/esri/core/workers/chunks/c134ebbaeac514cbd657.js +1 -0
  82. package/assets/esri/core/workers/chunks/c2b47a7dc961863d283f.js +1 -0
  83. package/assets/esri/core/workers/chunks/{0eaa4dccba0d844b9da3.js → c3ddcf9148dd2640c402.js} +1 -1
  84. package/assets/esri/core/workers/chunks/c476643002387f60ea42.js +1 -0
  85. package/assets/esri/core/workers/chunks/ce16489cf7eb0d78c741.js.LICENSE.txt +1 -1
  86. package/assets/esri/core/workers/chunks/d048e4926e78458afa3e.js +1 -0
  87. package/assets/esri/core/workers/chunks/d39a10155317e6f7a21c.js +1 -0
  88. package/assets/esri/core/workers/chunks/d6e0528eacee7ea4c1ce.js.LICENSE.txt +1 -1
  89. package/assets/esri/core/workers/chunks/d886fb97bdb348a16f25.js +1 -0
  90. package/assets/esri/core/workers/chunks/{00aa85ae6419aad183ea.js → dc4982b0ac007bd70213.js} +1 -1
  91. package/assets/esri/core/workers/chunks/e1258b6a404e58878c7a.js +1 -0
  92. package/assets/esri/core/workers/chunks/e31192ae920e3e19b6aa.js +1 -0
  93. package/assets/esri/core/workers/chunks/e6a86cad44056735ed26.js +1 -0
  94. package/assets/esri/core/workers/chunks/e82f5437bd66779c6740.js +1 -0
  95. package/assets/esri/core/workers/chunks/{039ec0fbe3b4b398b8c6.js → f26dc1d83beed63b6045.js} +1 -1
  96. package/assets/esri/core/workers/chunks/{fa5c87889c2f0bef896b.js → f35aaa04cca676c2d3f8.js} +1 -1
  97. package/assets/esri/core/workers/chunks/f5b7e7f2860a825ed373.js +1 -0
  98. package/assets/esri/core/workers/chunks/f651c05604eab83aef5f.js.LICENSE.txt +1 -1
  99. package/assets/esri/core/workers/chunks/{18da83afbc324fef9fd8.js → f779034623980bf9a37c.js} +2 -2
  100. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  101. package/assets/esri/themes/base/widgets/_Directions.scss +17 -18
  102. package/assets/esri/themes/dark/main.css +1 -1
  103. package/assets/esri/themes/light/main.css +1 -1
  104. package/assets/esri/themes/light/view.css +1 -1
  105. package/chunks/ComponentShader.glsl.js +72 -39
  106. package/chunks/OITBlend.glsl.js +3 -3
  107. package/chunks/bundle.js +1 -1
  108. package/config.js +1 -1
  109. package/core/QueueProcessor.js +1 -1
  110. package/core/has.js +1 -1
  111. package/core/sanitizerUtils.js +1 -1
  112. package/core/workers/Connection.js +1 -1
  113. package/core/workers/WorkerHandle.js +1 -1
  114. package/core/workers/utils.js +1 -1
  115. package/geohash/GeohashCell.js +1 -1
  116. package/geohash/geohashUtils.js +1 -1
  117. package/geometry/GeometryCursor.js +1 -1
  118. package/geometry/geometryCursorCollectUtils.js +1 -1
  119. package/geometry/libtess.js +1 -1
  120. package/geometry/support/jsonUtils.js +1 -1
  121. package/geometry/support/normalizeUtilsSync.js +1 -1
  122. package/geometry/support/triangulationUtils.js +1 -1
  123. package/interfaces.d.ts +426 -347
  124. package/intl/date.js +1 -1
  125. package/intl.d.ts +2 -0
  126. package/intl.js +1 -1
  127. package/kernel.js +1 -1
  128. package/layers/FeatureLayer.js +1 -1
  129. package/layers/graphics/OptimizedFeature.js +1 -1
  130. package/layers/graphics/OptimizedGeometry.js +1 -1
  131. package/layers/graphics/centroid.js +1 -1
  132. package/layers/graphics/contains.js +1 -1
  133. package/layers/graphics/data/AttributesBuilder.js +1 -1
  134. package/layers/graphics/data/FeatureStore.js +1 -1
  135. package/layers/graphics/data/QueryEngine.js +1 -1
  136. package/layers/graphics/data/QueryEngineResult.js +1 -1
  137. package/layers/graphics/data/geometryUtils.js +1 -1
  138. package/layers/graphics/data/spatialQuerySupport.js +1 -1
  139. package/layers/graphics/featureConversionUtils.js +1 -1
  140. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  141. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  142. package/layers/graphics/sources/geojson/geojson.js +1 -1
  143. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  144. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  145. package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
  146. package/layers/knowledgeGraph/layerUtils.js +1 -1
  147. package/layers/mixins/ArcGISImageService.js +1 -1
  148. package/layers/mixins/ImageryTileMixin.js +1 -1
  149. package/layers/support/PixelBlock.js +1 -1
  150. package/layers/support/RasterInfo.js +1 -1
  151. package/layers/support/RasterJobHandler.js +1 -1
  152. package/layers/support/RasterSensorInfo.js +1 -1
  153. package/layers/support/RasterStorageInfo.js +1 -1
  154. package/layers/support/RasterWorker.js +1 -1
  155. package/layers/support/TitleCreator.js +1 -1
  156. package/layers/support/arcgisLayerUrl.js +1 -1
  157. package/layers/support/capabilities.js +1 -1
  158. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  159. package/layers/support/rasterDatasets/pixelReader.js +1 -1
  160. package/layers/support/rasterFieldUtils.js +1 -1
  161. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  162. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  163. package/package.json +5 -5
  164. package/request.js +1 -1
  165. package/rest/print.js +1 -1
  166. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  167. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  168. package/rest/query/operations/query.js +1 -1
  169. package/rest/query/operations/queryZScale.js +1 -1
  170. package/rest/versionManagement/getVersionInfos.js +1 -1
  171. package/smartMapping/statistics/histogram.js +1 -1
  172. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  173. package/smartMapping/support/utils.js +1 -1
  174. package/support/elevationInfoUtils.js +1 -1
  175. package/support/requestImageUtils.js +1 -1
  176. package/support/revision.js +1 -1
  177. package/views/2d/GoToManager.js +1 -1
  178. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  179. package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
  180. package/views/2d/engine/webgl/Mesh2D.js +1 -1
  181. package/views/2d/engine/webgl/brushes/WGLBrushVTLSymbol.js +1 -1
  182. package/views/2d/engine/webgl/mesh/templates/templateUtils.js +1 -1
  183. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  184. package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
  185. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  186. package/views/2d/layers/features/aggregation/GridCell.js +1 -1
  187. package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
  188. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  189. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  190. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  191. package/views/2d/layers/features/schema/SourceSchema.js +1 -1
  192. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  193. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  194. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  195. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  196. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  197. package/views/2d/layers/features/support/FeatureFilterEvaluator.js +1 -1
  198. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  199. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  200. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  201. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  202. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  203. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  204. package/views/3d/FocusAreasView.js +1 -1
  205. package/views/3d/GroundView3D.js +1 -1
  206. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  207. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  208. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  209. package/views/3d/glTF/DefaultLoadingContext.js +1 -1
  210. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  211. package/views/3d/layers/FlowSubView3D.js +1 -1
  212. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  213. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  214. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  215. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  216. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  217. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  218. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  219. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  220. package/views/3d/layers/graphics/pipeline/featureSet/PBFPointFeatureSetView.js +1 -1
  221. package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
  222. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  223. package/views/3d/layers/i3s/I3SQueryFeatureAdapter.js +1 -1
  224. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  225. package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
  226. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  227. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  228. package/views/3d/state/ViewStateManager.js +1 -1
  229. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  230. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  231. package/views/3d/state/controllers/RotateController.js +1 -1
  232. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  233. package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
  234. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  235. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  236. package/views/3d/state/utils/navigationUtils.js +1 -1
  237. package/views/3d/support/DisplayQualityProfile.js +1 -1
  238. package/views/3d/support/QualitySettings.js +1 -1
  239. package/views/3d/support/StreamDataLoader.js +1 -1
  240. package/views/3d/support/engineContent/line.js +1 -1
  241. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  242. package/views/3d/support/flow/FlowWorker.js +1 -1
  243. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  244. package/views/3d/support/flow/constants.js +1 -1
  245. package/views/3d/support/hitTest.js +1 -1
  246. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  247. package/views/3d/terrain/Tile.js +1 -1
  248. package/views/3d/terrain/TileOverlayData.js +1 -1
  249. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  250. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  251. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  252. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  253. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  254. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +7 -7
  255. package/views/3d/webgl-engine/core/shaderModules/BooleanDrawUniform.js +5 -0
  256. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueConstructionContext.js +1 -1
  257. package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
  258. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  259. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  260. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  261. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +4 -4
  262. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  263. package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +1 -1
  264. package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
  265. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  266. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
  267. package/views/draw/support/Reshape.js +1 -1
  268. package/views/draw/support/reshapeUtils.js +1 -1
  269. package/views/interactive/dragEventPipeline.js +1 -1
  270. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  271. package/views/webgl/ShaderBuilder.js +1 -1
  272. package/views/webgl/Texture.js +1 -1
  273. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  274. package/widgets/BatchAttributeForm.js +1 -1
  275. package/widgets/Directions/css.js +1 -1
  276. package/widgets/Directions.js +1 -1
  277. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  278. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  279. package/widgets/Editor/EditorViewModel.js +1 -1
  280. package/widgets/Editor/Edits.js +1 -1
  281. package/widgets/Editor/MergeFeaturesWorkflow.d.ts +4 -0
  282. package/widgets/Editor/MergeFeaturesWorkflow.js +5 -0
  283. package/widgets/Editor/MergeFeaturesWorkflowData.d.ts +4 -0
  284. package/widgets/Editor/MergeFeaturesWorkflowData.js +5 -0
  285. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  286. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  287. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  288. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  289. package/widgets/Editor/components/UploadDetails.js +1 -1
  290. package/widgets/Editor/support/EditorItem.js +1 -1
  291. package/widgets/Editor/support/mergeFeaturesUtils.js +5 -0
  292. package/widgets/Editor/workflowUtils.js +1 -1
  293. package/widgets/Editor.js +1 -1
  294. package/widgets/Feature/FeatureExpression.js +1 -1
  295. package/widgets/Feature/FeatureFields/FeatureFieldsViewModel.js +1 -1
  296. package/widgets/Feature/FeatureFields.js +1 -1
  297. package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
  298. package/widgets/Feature/FeatureMedia.js +1 -1
  299. package/widgets/Feature/FeatureViewModel.js +1 -1
  300. package/widgets/Feature/support/featureUtils.js +1 -1
  301. package/widgets/Feature.js +1 -1
  302. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  303. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  304. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  305. package/widgets/Print.js +1 -1
  306. package/widgets/support/ColorPicker.js +1 -1
  307. package/widgets/support/SelectionList/LayerItem.js +1 -1
  308. package/widgets/support/jsxWidgetSupport.js +1 -1
  309. package/assets/esri/core/workers/chunks/065f2bbcaeef1f13fd48.js +0 -1
  310. package/assets/esri/core/workers/chunks/0731e588afd1f561ec3b.js +0 -1
  311. package/assets/esri/core/workers/chunks/188272af9a6470ccfe31.js +0 -1
  312. package/assets/esri/core/workers/chunks/1a9f544f20f643161a36.js +0 -1
  313. package/assets/esri/core/workers/chunks/1cfcadaa98ac528fea37.js +0 -1
  314. package/assets/esri/core/workers/chunks/1db0bf570a04687b3130.js +0 -1
  315. package/assets/esri/core/workers/chunks/24921d31efa8d222ad2d.js +0 -2
  316. package/assets/esri/core/workers/chunks/2a900a632a1231deb713.js +0 -1
  317. package/assets/esri/core/workers/chunks/31c6e951b99315e8e68a.js +0 -1
  318. package/assets/esri/core/workers/chunks/35491fbdd287470d40a4.js +0 -1
  319. package/assets/esri/core/workers/chunks/36247c6f6fc2891df2cf.js +0 -1
  320. package/assets/esri/core/workers/chunks/3d53307efbc3f07d7bf2.js +0 -1
  321. package/assets/esri/core/workers/chunks/42a72e1d963e4636323b.js +0 -1
  322. package/assets/esri/core/workers/chunks/456161a323be7d640c61.js +0 -1
  323. package/assets/esri/core/workers/chunks/500d09d2191127371081.js +0 -1
  324. package/assets/esri/core/workers/chunks/5707713c2f27588b9194.js +0 -1
  325. package/assets/esri/core/workers/chunks/5713f96bade5ebb54c81.js +0 -1
  326. package/assets/esri/core/workers/chunks/5718cf135e105e1e026b.js +0 -1
  327. package/assets/esri/core/workers/chunks/5c585b338a9e9aa0e205.js +0 -1
  328. package/assets/esri/core/workers/chunks/5d1d909354c90cb8eb60.js +0 -1
  329. package/assets/esri/core/workers/chunks/5ea03f53d4d64d9e7cae.js +0 -1
  330. package/assets/esri/core/workers/chunks/63019a7eb5222dc5e420.js +0 -1
  331. package/assets/esri/core/workers/chunks/64629ddcf008349eaf41.js +0 -1
  332. package/assets/esri/core/workers/chunks/64ee8d2acae2d6fce608.js +0 -1
  333. package/assets/esri/core/workers/chunks/6fcacfcb3d83515c37c9.js +0 -1
  334. package/assets/esri/core/workers/chunks/72ecf49d03bb24bf0998.js +0 -1
  335. package/assets/esri/core/workers/chunks/7421f9575487cdc9e28e.js +0 -1
  336. package/assets/esri/core/workers/chunks/77a11d7d53325d108ed8.js +0 -1
  337. package/assets/esri/core/workers/chunks/7a05b1f6163112bc9db2.js +0 -1
  338. package/assets/esri/core/workers/chunks/7d9882ddfa6495f72baa.js +0 -1
  339. package/assets/esri/core/workers/chunks/7fffad8ff6878fa1fd56.js +0 -1
  340. package/assets/esri/core/workers/chunks/81bbe5251ed13c0d91cc.js +0 -1
  341. package/assets/esri/core/workers/chunks/8b16aa50d879b92a5375.js +0 -1
  342. package/assets/esri/core/workers/chunks/8bc64fc7c4b9eb8fca4d.js +0 -1
  343. package/assets/esri/core/workers/chunks/8bfa19c24be0e3f3fd74.js +0 -1
  344. package/assets/esri/core/workers/chunks/8eefa133c36a004c054c.js +0 -1
  345. package/assets/esri/core/workers/chunks/9834bc11586a2d8d6f35.js +0 -1
  346. package/assets/esri/core/workers/chunks/9c6fc4fe2c46f40d63d9.js +0 -1
  347. package/assets/esri/core/workers/chunks/a5f25104938ab33e7a85.js +0 -1
  348. package/assets/esri/core/workers/chunks/a7bd294996e6c8b8354a.js +0 -1
  349. package/assets/esri/core/workers/chunks/abf4f018c692c18c3320.js +0 -1
  350. package/assets/esri/core/workers/chunks/b1f667006cba60ef4aa7.js +0 -1
  351. package/assets/esri/core/workers/chunks/b2d9f4e057af26a538fb.js +0 -1
  352. package/assets/esri/core/workers/chunks/b62807c6fcfb70a87cd4.js +0 -1
  353. package/assets/esri/core/workers/chunks/b8339c1d60847a9eed3e.js +0 -1
  354. package/assets/esri/core/workers/chunks/c362fbbafec91c44eeb2.js +0 -1
  355. package/assets/esri/core/workers/chunks/c941d15190fc08523d0d.js +0 -1
  356. package/assets/esri/core/workers/chunks/cc70a4a915b0b2ccb2a0.js +0 -1
  357. package/assets/esri/core/workers/chunks/d121045cddbe55c2ecb2.js +0 -1
  358. package/assets/esri/core/workers/chunks/d2120a623b1bd91b9ed9.js +0 -1
  359. package/assets/esri/core/workers/chunks/d78c2833cdc4730a88a3.js +0 -1
  360. package/assets/esri/core/workers/chunks/df438b62702007267798.js +0 -1
  361. package/assets/esri/core/workers/chunks/f4eb090bcc3eca64306a.js +0 -1
  362. package/assets/esri/core/workers/chunks/f7846523adacbfe5047e.js +0 -1
  363. package/assets/esri/core/workers/chunks/f839b86bee15deaf84e4.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as P,invert as C,multiply as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as E}from"../../../../chunks/vec42.js";import{ZEROS as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as D}from"../../../../geometry/support/Indices.js";import{RenderCategory as I,InternalRenderCategory as R}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as v}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as q}from"../core/renderPasses/RenderPassManager.js";import{isColorEmission as N,isColorOrColorEmission as G}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as L}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as V}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as k}from"../effects/highlight/Highlight.js";import{OITBlend as z}from"../effects/transparency/OITBlend.js";import{AnimationTimer as Q}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Y}from"./BoundingInfo.js";import{DepthRange as Z}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as K}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as X}from"./MainFramebuffer.js";import{RenderContext as $,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as re}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ae}from"./ShadowMap.js";import ne from"./SliceHelper.js";import{MergedRenderer as he}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as oe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as de,PerformanceCategory as le}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as ue,ColorAttachment2 as pe}from"../../../webgl/enums.js";let me=class extends te{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new q,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ne,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Z.Infinite),this._state=c(2),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(re(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new X(this.fboCache),this._performanceInfo=new de(this._rctx),this._shadowMap=new ae(this.fboCache,e.viewingMode),this._shadowAccumulator=new se(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(4,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new $(this._rctx,this._shadowMap,r),this._nodes=new V(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_(()=>e.view.state.camera,()=>n(),u),_(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),_(()=>e.view.environment.background?.color,e=>{const t=e?i(e):y;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),_(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=L,u),_(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),_(()=>this._bindParameters.clouds.data?.state,()=>n(),m),_(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Y.prune(),he.prune(),D()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=re(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(i=>i.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(5))}get _hasHighlights(){return this._plugins.produces(9,2,4,18,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(9,13,14)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(4))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(0)}get hasEmitters(){return this._plugins.hasEmitters&&this.stage.view.qualitySettings.physicallyBasedRenderingEnabled}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:xe(this.stage.view.resourceController)});return this.addHandles(_(()=>r.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&P(this._bindParameters.ssr.reprojectionMatrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...Ce),has.water=this._plugins.produces(3,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new Q(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new oe(this._pluginInput.get(I.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=K,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),g=s(((u.position.z??0)-d)/(l-d),0,1),f=a(a(1,m,c),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const C=Math.max(1-r,Math.abs(r-i)),w=Math.min(C*P/p,n);w>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*w,this._requestRender())}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),l=this._nodes.produces(I.FINAL),_=this.hasEmitters,u=_?1:0;this._renderContext.time=t,this._renderContext.output=u,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const p=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=p?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(R.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const m=this._framebuffer,c=m.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,_);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const g=this._highQualityTransparency&&this._hasTransparentTerrain,f=this._plugins.produces(0,...be);this._precompilePrepasses(),this.performanceInfo.advance(le.PREPARE);const b=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,b),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(b,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(g,f,u),this._renderContext.output=u,m.bind(),this._bindParameters.mainDepth=m.depth.attachment,this._renderOpaque(g),this._renderTransparent(f,g,u),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(R.CUTFILL_DEPTH,this._renderCutFillDepth()),m.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),m.update(e=>this._renderNodes(R.VIEWSHED,e)),m.update(e=>this._renderNodes(R.LASERLINES,e)),m.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.CUTFILL_DEPTH),m.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,b);const P=2===r?this._renderObjectAndLayerIdColor():null;m.update(e=>this._renderNodes(I.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const C=s&&!l&&!(d&&!i),w=this._pluginInput.get(I.COMPOSITE),T=C?M:this.fboCache.acquire(w.fbo.width,w.fbo.height,R.ANTIALIASING),S=this._nodes.produces(R.ANTIALIASING)?this._renderNodes(R.ANTIALIASING,T):this.blitFBO(w,T,!1);let E;this._pluginInput.set(R.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(1,S,u),E=this._renderNodes(R.HIGHLIGHTS,S)):(E=this._renderNodes(R.HIGHLIGHTS,S),this._renderHUD(1,E,u));const x=this._renderNodes(R.MAGNIFIER,E);return s&&d&&!i&&!l&&this.blitFBO(x),l?(x.attachDepth(m.depth),this.blitFBO(this._renderNodes(I.FINAL,x)),x.detachDepth()):this._pluginInput.set(I.FINAL,x),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),m.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new oe(this._pluginInput.get(I.FINAL),P)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(R.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=2,this._plugins.precompile(6),this._plugins.precompile(7),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(6),this._plugins.precompile(7),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(R.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(12),this._plugins.precompile(15),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(R.VIEWSHED,R.CUTFILL_DEPTH,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING,R.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(i.highlights.forEach((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(9)}),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(I.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(le.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(le.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(y),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,_e.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._renderContext.output,i=this._framebufferSize,s=this.fboCache.acquire(i.width,i.height,"edges"),a=()=>t.render(this._bindParameters,e),n=this._bindParameters.geometryDepth;this.renderToTargets(a,s,n??this._framebuffer.depth,y),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),N(r)?1:0),s.release(),this.performanceInfo.advance(1===e?le.OPAQUE_EDGES:le.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(le.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(6,this._shadowMap),s.copySnapshot(1),this._renderShadowCascades(5,this._shadowMap)):this._renderShadowCascades(4),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(5,this._shadowMap),s.moveSnapshot(0),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(R.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(2)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(R.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(2),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(le.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(2),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(le.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=2;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(2),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Z.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Z.Infinite);const t=e.clone();t.near=v,t.far=1e10;const r=J(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED,R.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(3),this._needsDepth&&this._precompileAllGeometry(2),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(5),this._precompileShadowCascades(6),this._precompileShadowCascades(5)):this._precompileShadowCascades(4)),this._shadowAccumulator.active&&this._precompileAllGeometry(4)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(y,!0,!0),this._renderGeometryWithNormals(3);const i=this._nodes.optional("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(le.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(R.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(le.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(6),this._plugins.precompile(7),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Pe);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Pe),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(13)}precompileViewshedShadowMap(){this._precompileAllGeometry(7)}precompileCutFill(){const e=8,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,6),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(7),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=8,this._plugins.render(0,1),this._plugins.render(6),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...ce),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ge)}_precompileOpaqueGeometry(){this._plugins.precompile(...fe),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...fe)}_renderTransparentGeometry(){this._plugins.render(...be)}get _hasTransparentTerrain(){return this._plugins.produces(0,6)}get _hasTransparentIntegratedMesh(){return this._plugins.produces(this._renderContext.output,7)}_renderTransparentTerrain(){const e=()=>this._plugins.render(6);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}_renderTransparentIntegratedMesh(){const e=()=>this._plugins.render(7);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent integrated mesh");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,12)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(12),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(le.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(15),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(15)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=9,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...Ce),this._bindParameters.oitPass=2,this._plugins.precompile(...Ce),this._bindParameters.oitPass=0):this._plugins.precompile(...Ce),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(1,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture(),0),i.release()}else if(this._renderContext.output=r,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?le.HUD_OCCLUDED:le.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(5,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>B?3:1);a.acquireDepth(13),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=9,t.bindFramebuffer(a.fbo),k(t,e,i,r,()=>this._renderHighlightGeometries()),this.performanceInfo.advance(le.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...we),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(le.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...be),this._bindParameters.oitPass=2,this._plugins.precompile(...be),this._bindParameters.oitPass=0):this._plugins.precompile(...be)}_renderOIT(e,t,r=2){const i=1===e,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=1;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,8),_=1===t;_&&l.acquireColor(ue,8,"oit emissive"),l.acquireColor(_?pe:ue,7),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,x),n(),l.detachDepth(),h.oitPass=2;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(ue,8,"oit emissive front"),a?u.acquireDepth(12):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(y,!!a),n(),u.detachDepth(),h.oitPass=0,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new z(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_,!i),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(0,...fe);if(t){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(R.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const r=this._framebuffer;this._renderTerrainDepth(e),r.update(e=>this._renderNodes(I.OPAQUE,e,t)),this.fboCache.debugCallback?.(I.OPAQUE,r.color.fbo),r.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderEdges(1)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(20,le.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry()),i.update(t=>this._renderNodes(I.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(I.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(15),this._renderEdges(0);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(le.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(0,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),N(r)?1:0),s.release(),t&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry(),this.performanceInfo.advance(le.TRANSPARENT)),this._renderEdges(0)));const a=this._hasTransparentIntegratedMesh?this._renderTransparentIntegratedMesh():null;a&&(i.bind(),this._compositingHelper.composite(this._bindParameters,a.getTexture(),N(r)?1:0),a.release()),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(le.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(8),this.performanceInfo.advance(le.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}blitFBO(e,t=M,r=!0){return this._blit??=new j(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=T:(C(Se,this._bindParameters.camera.viewMatrix),C(Te,this._bindParameters.camera.projectionMatrix),w(Ee,Se,Te),w(Ee,this._renderContext.lastFrameCamera.viewMatrix,Ee),w(Ee,this._renderContext.lastFrameCamera.projectionMatrix,Ee),this._reprojectionMatrix=Ee);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=T,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};e([f({readOnly:!0})],me.prototype,"fullResolutionAtmosphere",null),e([f()],me.prototype,"_edgeView",void 0),e([f()],me.prototype,"updating",null),me=e([b("esri.views.3d.webgl-engine.lib.Renderer")],me);const ce=[0,1,2,4],ge=[3,5],fe=[0,1,2,3],be=[4,5],Pe=[2,4,8],Ce=[16,13,14],we=[4,5,2,3,6,0,1],Te=S(),Se=S(),Ee=S();function xe(e){return t=>e.immediate.schedule(t)}export{me as Renderer};
5
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as m}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{Milliseconds as f}from"../../../../core/time.js";import{property as g}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as P,invert as C,multiply as w}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as T,create as S}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as E}from"../../../../chunks/vec42.js";import{ZEROS as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as A,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as D}from"../../../../geometry/support/Indices.js";import{RenderCategory as I,InternalRenderCategory as R}from"../../webgl.js";import{innerAtmosphereFadeStart as O}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as v}from"../../state/NearFarHeuristic.js";import{debugFlags as F}from"../../support/debugFlags.js";import{FBOCache as H,defaultWebGLFBO as M}from"../core/FBOCache.js";import{RenderPassManager as q}from"../core/renderPasses/RenderPassManager.js";import{isColorEmission as N,isColorOrColorEmission as G}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as L}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as V}from"../effects/RenderNodes.js";import{RenderPluginManager as U}from"../effects/RenderPluginManager.js";import{Blit as j}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as B,renderHighlightBuffer as k}from"../effects/highlight/Highlight.js";import{OITBlend as z}from"../effects/transparency/OITBlend.js";import{AnimationTimer as Q}from"./AnimationTimer.js";import{AnimationTimeStep as W}from"./AnimationTimeStep.js";import{BoundingInfo as Y}from"./BoundingInfo.js";import{DepthRange as Z}from"./DepthRange.js";import{depthRangeFromScene as J}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as K}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as X}from"./MainFramebuffer.js";import{RenderContext as $,defaultRenderOccludedMask as ee}from"./RenderContext.js";import{RendererBase as te}from"./RendererBase.js";import{setupFeatureDefaults as re}from"./RenderFeature.js";import{RenderPluginInput as ie}from"./RenderPluginInput.js";import{ShadowAccumulator as se}from"./ShadowAccumulator.js";import{ShadowMap as ae}from"./ShadowMap.js";import ne from"./SliceHelper.js";import{MergedRenderer as he}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as oe}from"../parts/renderUtils.js";import{RendererPerformanceInfo as de,PerformanceCategory as le}from"../statistics/RendererPerformanceInfo.js";import{PixelType as _e,ColorAttachment1 as ue,ColorAttachment2 as pe}from"../../../webgl/enums.js";let me=class extends te{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new q,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ne,this._blit=null,this._oitblend=null,this.sceneDepthRange=c(Z.Infinite),this._state=c(2),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new W,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._lastFrameTime=f(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ie,this._releaseNormals=e=>{e.some(({name:e})=>"normals"===e)&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this._fboCache=new H(s),this._renderStateFeatures=c(re(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new X(this.fboCache),this._performanceInfo=new de(this._rctx),this._shadowMap=new ae(this.fboCache,e.viewingMode),this._shadowAccumulator=new se(this.fboCache,r,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(4,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},n),this._renderContext=new $(this._rctx,this._shadowMap,r),this._nodes=new V(this._renderContext),this._plugins=new U({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_(()=>e.view.state.camera,()=>n(),u),_(()=>F.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},n()},p),_(()=>e.view.environment.background?.color,e=>{const t=e?i(e):y;E(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()},u),_(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=L,u),_(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},m),_(()=>this._bindParameters.clouds.data?.state,()=>n(),m),_(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,n()},p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._blit=null,this._oitblend=null,this._compositingHelper=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,Y.prune(),he.prune(),D()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=re(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate(i=>i.set(t,e,r)),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(5))}get _hasHighlights(){return this._plugins.produces(9,2,4,18,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(9,13,14)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(4))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(0)}get hasEmitters(){return this._plugins.hasEmitters&&this.stage.view.qualitySettings.physicallyBasedRenderingEnabled}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:xe(this.stage.view.resourceController)});return this.addHandles(_(()=>r.updating,()=>this._requestRender(),m)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(r)),this._edgeViewCallbacks.length=0,r})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&P(this._bindParameters.ssr.reprojectionMatrix,T)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment){void 0!==e.environment.weather&&(this._bindParameters.weather=e.environment.weather);const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(0,...Ce),has.water=this._plugins.produces(3,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new Q(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new oe(this._pluginInput.get(I.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=K,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,m=2===e?r:i,c=s((u.tilt-h)/(o-h),0,1),f=s(((u.position.z??0)-d)/(l-d),0,1),g=a(a(1,m,c),1,f),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===g||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=g,void(this._lastFrameTime=t);const P=t-this._lastFrameTime;this._lastFrameTime=t;const C=Math.max(1-r,Math.abs(r-i)),w=Math.min(C*P/p,n);w>=Math.abs(g-b)?this._bindParameters.hudOccludedFragmentOpacity=g:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(g-b)*w,this._requestRender())}_render(e,t,r,i){const s=0===r;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=s,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h;const d=this._nodes.produces("magnifier-color"),l=this._nodes.produces(I.FINAL),_=this.hasEmitters,u=_?1:0;this._renderContext.time=t,this._renderContext.output=u,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const p=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=p?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(R.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(R.CUTFILL_DEPTH),this._renderOverlay(),a.setGLViewport(this._rctx);const m=this._framebuffer,c=m.initialize(a.fullWidth,a.fullHeight,this._backgroundColor,_);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(a,n),this._updateHUDOccludedFragmentOpacity(h,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const f=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(0,...be);this._precompilePrepasses(),this.performanceInfo.advance(le.PREPARE);const b=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,b),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(b,a,n,!s),this._ensureBindParametersSSR(t),this._precompileShaders(f,g,u),this._renderContext.output=u,m.bind(),this._bindParameters.mainDepth=m.depth.attachment,this._renderOpaque(f),this._renderTransparent(g,f,u),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(R.FOCUSAREA,this._renderFocusAreaGeometry()),this._pluginInput.set(R.CUTFILL_DEPTH,this._renderCutFillDepth()),m.update(e=>this._renderNodes(R.TRANSPARENT_ENVIRONMENT,e)),m.update(e=>this._renderNodes(R.VIEWSHED,e)),m.update(e=>this._renderNodes(R.LASERLINES,e)),m.update(e=>this._renderNodes(R.FOCUSAREA_COLOR,e)),this._pluginInput.release(R.FOCUSAREA),this._pluginInput.release(R.CUTFILL_DEPTH),m.update(e=>this._renderNodes(R.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(a,this._bindParameters.lighting.mainLight.direction,b);const P=2===r?this._renderObjectAndLayerIdColor():null;m.update(e=>this._renderNodes(I.COMPOSITE,e)),this._shadowMap.disposeOffscreenBuffers();const C=s&&!l&&!(d&&!i),w=this._pluginInput.get(I.COMPOSITE),T=C?M:this.fboCache.acquire(w.fbo.width,w.fbo.height,R.ANTIALIASING),S=this._nodes.produces(R.ANTIALIASING)?this._renderNodes(R.ANTIALIASING,T):this.blitFBO(w,T,!1);let E;this._pluginInput.set(R.ANTIALIASING,S),this._hasHUDHighlights?(this._renderHUD(1,S,u),E=this._renderNodes(R.HIGHLIGHTS,S)):(E=this._renderNodes(R.HIGHLIGHTS,S),this._renderHUD(1,E,u));const x=this._renderNodes(R.MAGNIFIER,E);return s&&d&&!i&&!l&&this.blitFBO(x),l?(x.attachDepth(m.depth),this.blitFBO(this._renderNodes(I.FINAL,x)),x.detachDepth()):this._pluginInput.set(I.FINAL,x),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),m.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),s||(this._releaseFBOs(),this._disposeOffscreenBuffers()),new oe(this._pluginInput.get(I.FINAL),P)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(R.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=2,this._plugins.precompile(6),this._plugins.precompile(7),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(6),this._plugins.precompile(7),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(R.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(12),this._plugins.precompile(15),this._precompileHUD(0),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(R.VIEWSHED,R.CUTFILL_DEPTH,R.CUTFILL_COLOR,R.LASERLINES,R.FOCUSAREA_COLOR,R.OCCLUDED,R.ANTIALIASING,R.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(1),this._hasHighlights&&(i.highlights.forEach((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(9)}),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(I.COMPOSITE,R.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(8),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(R.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(le.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(le.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=0===e;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(y),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,_e.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,6408,_e.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._renderContext.output,i=this._framebufferSize,s=this.fboCache.acquire(i.width,i.height,"edges"),a=()=>t.render(this._bindParameters,e),n=this._bindParameters.geometryDepth;this.renderToTargets(a,s,n??this._framebuffer.depth,y),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,s.getTexture(),N(r)?1:0),s.release(),this.performanceInfo.advance(1===e?le.OPAQUE_EDGES:le.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(le.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(6,this._shadowMap),s.copySnapshot(1),this._renderShadowCascades(5,this._shadowMap)):this._renderShadowCascades(4),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(5,this._shadowMap),s.moveSnapshot(0),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(le.SHADOW_MAP)}_renderCutFillDepth(){return this._nodes.produce(R.CUTFILL_DEPTH,this._pluginInput)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(2)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(R.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(2),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(le.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"geometry depth",13);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1280),this.renderAllGeometry(2),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(le.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=2;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",13);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(1280),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(2),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return Z.Zero;const t=J(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=Z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<O)return void(this.sceneDepthRange.value=Z.Infinite);const t=e.clone();t.near=v,t.far=1e10;const r=J(t,this._plugins.plugins,this.stage.layers,1);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(r)||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED,R.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(3),this._needsDepth&&this._precompileAllGeometry(2),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(5),this._precompileShadowCascades(6),this._precompileShadowCascades(5)):this._precompileShadowCascades(4)),this._shadowAccumulator.active&&this._precompileAllGeometry(4)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(y,!0,!0),this._renderGeometryWithNormals(3);const i=this._nodes.optional("normals",I.FINAL,I.COMPOSITE,I.OPAQUE,I.TRANSPARENT,R.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(le.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(R.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(le.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(6),this._plugins.precompile(7),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Pe);this._renderContext.renderOccludedMask=ee}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...Pe),this._renderContext.renderOccludedMask=ee}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(13)}precompileViewshedShadowMap(){this._precompileAllGeometry(7)}precompileCutFill(){const e=8,t=this._renderContext.output;this._renderContext.output=e,this._plugins.precompile(0,1,6),this._renderContext.output=t}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(7),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._renderContext.output=8,this._plugins.render(0,1),this._plugins.render(6),this._ensureBindParametersCamera(t,r),t.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...ce),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...fe)}_precompileOpaqueGeometry(){this._plugins.precompile(...ge),this._nodes.precompile("opaque-color")}_renderOpaqueGeometry(){this._plugins.render(...ge)}_renderTransparentGeometry(){this._plugins.render(...be)}get _hasTransparentTerrain(){return this._plugins.produces(0,6)}get _hasTransparentIntegratedMesh(){return this._plugins.produces(this._renderContext.output,7)}_renderTransparentTerrain(){const e=()=>this._plugins.render(6);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}_renderTransparentIntegratedMesh(){const e=()=>this._plugins.render(7);if(!G(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent integrated mesh");return this.renderToTargets(e,r,this._framebuffer.depth,y),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,12)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",4),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(12),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(le.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(15),t=this._framebufferSize,r=this.fboCache.acquireDepth(12,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(15)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=9,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...Ce),this._bindParameters.oitPass=2,this._plugins.precompile(...Ce),this._bindParameters.oitPass=0):this._plugins.precompile(...Ce),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(1,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture(),0),i.release()}else if(this._renderContext.output=r,0===e){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(12,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(12),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(0===e?le.HUD_OCCLUDED:le.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ce)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(5,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>B?3:1);a.acquireDepth(13),this._framebuffer.color.fbo&&a.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,a.fbo,1024),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=9,t.bindFramebuffer(a.fbo),k(t,e,i,r,()=>this._renderHighlightGeometries()),a.detachDepth(),this.performanceInfo.advance(le.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...we),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(le.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&G(this._renderContext.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...be),this._bindParameters.oitPass=2,this._plugins.precompile(...be),this._bindParameters.oitPass=0):this._plugins.precompile(...be)}_renderOIT(e,t,r=2){const i=1===e,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=1;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,8),_=1===t;_&&l.acquireColor(ue,8,"oit emissive"),l.acquireColor(_?pe:ue,7),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,x),n(),l.detachDepth(),h.oitPass=2;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(ue,8,"oit emissive front"),a?u.acquireDepth(12):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(y,!!a),n(),u.detachDepth(),h.oitPass=0,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):this._framebuffer.bind(),this._oitblend??=new z(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_,!i),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(0,...ge);if(t){this._plugins.render(0,1);const e=this._framebuffer;e.update(e=>this._renderNodes(R.CUTFILL_COLOR,e)),e.update(e=>this._renderNodes(R.OPAQUE_TERRAIN,e)),e.bind(),this._plugins.render(2,3)}const r=this._framebuffer;this._renderTerrainDepth(e),r.update(e=>this._renderNodes(I.OPAQUE,e,t)),this.fboCache.debugCallback?.(I.OPAQUE,r.color.fbo),r.update(e=>this._renderNodes(R.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(R.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderEdges(1)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(20,le.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry()),i.update(t=>this._renderNodes(I.TRANSPARENT,t,e)),this.fboCache.debugCallback?.(I.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(15),this._renderEdges(0);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(le.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(0):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(0,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),N(r)?1:0),s.release(),t&&(this._renderEdges(1),e&&(this._oitEnabled?this._renderOIT(0,r):this._renderTransparentGeometry(),this.performanceInfo.advance(le.TRANSPARENT)),this._renderEdges(0)));const a=this._hasTransparentIntegratedMesh?this._renderTransparentIntegratedMesh():null;a&&(i.bind(),this._compositingHelper.composite(this._bindParameters,a.getTexture(),N(r)?1:0),a.release()),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(le.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(8),this.performanceInfo.advance(le.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}blitFBO(e,t=M,r=!0){return this._blit??=new j(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=T:(C(Se,this._bindParameters.camera.viewMatrix),C(Te,this._bindParameters.camera.projectionMatrix),w(Ee,Se,Te),w(Ee,this._renderContext.lastFrameCamera.viewMatrix,Ee),w(Ee,this._renderContext.lastFrameCamera.projectionMatrix,Ee),this._reprojectionMatrix=Ee);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=T,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};e([g({readOnly:!0})],me.prototype,"fullResolutionAtmosphere",null),e([g()],me.prototype,"_edgeView",void 0),e([g()],me.prototype,"updating",null),me=e([b("esri.views.3d.webgl-engine.lib.Renderer")],me);const ce=[0,1,2,4],fe=[3,5],ge=[0,1,2,3],be=[4,5],Pe=[2,4,8],Ce=[16,13,14],we=[4,5,2,3,6,0,1],Te=S(),Se=S(),Ee=S();function xe(e){return t=>e.immediate.schedule(t)}export{me as Renderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{toConst as r}from"../../../../core/compilerUtils.js";import{unpackFloatRGBA as s}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{removeMaybe as n,destroyMaybe as o}from"../../../../core/maybe.js";import{watch as a,initial as h,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{Milliseconds as d}from"../../../../core/time.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{isMoon as u,isMars as f}from"../../../../geometry/support/spatialReferenceUtils.js";import{ChapmanAtmosphere as _}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as g}from"../../environment/CloudsComposition.js";import{Fog as w}from"../../environment/Fog.js";import{LocalAtmosphere as x}from"../../environment/LocalAtmosphere.js";import{MarsAtmosphere as v}from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as y}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as j}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as R}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{ObjectAndLayerIDRenderNode as b}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as T}from"../effects/geometry/RenderOccludedRenderNode.js";import{GlowRenderNode as A}from"../effects/glow/GlowRenderNode.js";import{Haze as O}from"../effects/haze/Haze.js";import{Highlight as S}from"../effects/highlight/Highlight.js";import{ShadowHighlight as q}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as U}from"../effects/magnifier/Magnifier.js";import{SMAA as M}from"../effects/smaa/SMAA.js";import{SSAO as k}from"../effects/ssao/SSAO.js";import{Stars as L}from"../effects/stars/Stars.js";import D from"../lib/CompositingHelper.js";import{GLMaterialRepository as H}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as F}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as W}from"../lib/Renderer.js";import{RenderingContext as B}from"../lib/RenderingContext.js";import{RenderingContextOptions as E}from"../lib/RenderingContextOptions.js";import{TextureRepository as G}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as N}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as z}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as P}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as I}from"./contextCache.js";import{removeLoadedShaderModules as V}from"./renderUtils.js";import{ScreenshotManager as X,ScreenshotContext as Q}from"./ScreenshotManager.js";import{contextCache as J}from"./testUtils.js";import{noBudget as K}from"../../../support/Scheduler.js";import{checkWebGLError as Y}from"../../../webgl/checkWebGLError.js";let Z=class extends t{constructor(e){super(e),this._waterTextures=new P,this.olidRenderHelper=C()?new F:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.glow=null,this.fog=null,this.test=null;const t=e.stage;try{this._initializeContext(t)}catch(n){return void console.error("Failed to initialize context",n)}const{memoryController:r}=t.view.resourceController;this._stippleTextures=z(this._rctx,r),this.notifyChange("stippleTextures"),this._markerTextures=N(this._rctx,r),this.notifyChange("markerTextures"),this._techniques=new R(new j(this._rctx,t.viewingMode,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new G(t),this.addHandles(this._textures.events.on("changed",e=>this.requestRender(e)));const s=new H(this._textures,this._techniques,()=>this.requestRender(),()=>this.requestRender());this._compositingHelper=new D(this._rctx,this._techniques),this._renderer=new W(t,s,this._techniques,this._rctx,this._compositingHelper,e=>this.requestRender(e)),this.notifyChange("renderer"),this.addHandles([a(()=>t.view.ready,e=>{e&&this._createRenderNodes()},h),a(()=>this.waterTextures?.updating,()=>this.requestRender(),h),a(()=>t.view.qualityProfile,e=>this.renderer?.updateRenderFeatures(e),l)]);const i={renderScene:(e,t,r,s)=>this.renderer.render(e,t,r,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,s)=>t.options.screenshot.renderOverlay(e,r,s)};this._screenshotManager=new X(this._rctx,i,e=>t.view.overlayManager.updateOverlays(K,e.camera,0)),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=n(this._frameTask),this._techniques=o(this._techniques),this._componentObjectCollection=o(this._componentObjectCollection),this._set("componentObjectCollection",null),this._screenshotManager=o(this._screenshotManager),o(this.renderer),this._textures=o(this._textures),o(this.waterTextures),o(this.markerTextures),o(this.stippleTextures),this._waterTextures=null,this._markerTextures=null,this._stippleTextures=null,this._canvas=null,this._rctx=o(this._rctx),this._compositingHelper=null,this._renderer=null,this._set("renderer",null),this.test?.destroy()}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new L({view:e}),u(e.spatialReference)||(2===t?(new x({view:e}),this.glow=new A({view:e})):f(e.spatialReference)?(new v({view:e}),this.glow=new A({view:e})):(new _({view:e}),new g({view:e}),this.glow=new A({view:e}),new O({view:e}),this.fog=new w({view:e}))),new k({view:e,isEnabled:()=>this.renderer.hasSSAO}),new M({view:e,isEnabled:()=>this.renderer.hasSMAA}),new U({view:e}),new S({view:e}),new q({view:e,viewingMode:t}),new T({view:e}),C()&&new b({view:e})}requestRender(e=1){switch(e){case 2:this.stage.view.state.fading=!0;case 1:this._needsUpdate=!0;case 0:this._needsRender=!0}}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textures.updating||this.waterTextures.updating}get textures(){return this._textures}get techniques(){return this._techniques}get compositingHelper(){return this._compositingHelper}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(r(e))}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,n,o=n){const a=i.constrainWindowSize(t,r,n*i.pixelRatio,o*i.pixelRatio),h=this._ensureLinearDepthArrayBuffer(a);this.renderer.readMainDepth(a,h);const l=(e,t,r)=>s(t,e)*(r[1]-r[0])+r[0];let p=Number.MAX_VALUE;for(let s=0;s<a[2]*a[3];s++){const e=l(4*s,h,i.nearFar);p>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(p=e)}if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&p>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(p=s)}return p===Number.MAX_VALUE?void 0:p}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){V(),await this._techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,s=0,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?1:0,this._needsRender&&this.renderer.updateSceneDepthRange(t.camera),e.commitSyncLayers(),i=this.test?.time??i;(d(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(0),this._lastAnimationUpdate=i)},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,e=this.test?.time??e,this.renderer.render(t,e,0),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(0),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this._textures.update();const r=new Q(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{i&&(this.renderer.finish(2===t.mode?s:1),i=!1)}};this._frameTask=p(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const s={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",s);if(null==n)return void i.getLogger(this).error("A WebGL2 context could not be created.");Y(n,!0),this._rctx=$(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&i.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}get stippleTextures(){return this._stippleTextures}get markerTextures(){return this._markerTextures}get waterTextures(){return this._waterTextures}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get renderer(){return this._renderer}get componentObjectCollection(){return null==this._componentObjectCollection&&(this._componentObjectCollection=new y(this.renderer.renderPassManager,this._viewingMode)),this._componentObjectCollection}set componentObjectCollection(e){this._componentObjectCollection=e}updateQualitySettings(e){null!=this.test?.time&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=d(0)),this._rctx.updateOptions({maxPreferredTexturePixels:this.stage.view.qualitySettings.maxTexturePixels})}};function $(e,t){const r=new E(t);if(J.enabled){let t=ee.get(e);return t&&1===t.refCount?(t.configure(r),t.ref(),t):(t=new B(e,r),ee.set(e,t),t.ref(),t)}return new B(e,r)}e([c({type:Boolean,readOnly:!0})],Z.prototype,"updating",null),e([c({constructOnly:!0})],Z.prototype,"stage",void 0),e([c({readOnly:!0})],Z.prototype,"stippleTextures",null),e([c({readOnly:!0})],Z.prototype,"markerTextures",null),e([c({readOnly:!0})],Z.prototype,"waterTextures",null),e([c({readOnly:!0})],Z.prototype,"olidRenderHelper",void 0),e([c()],Z.prototype,"_textures",void 0),e([c({readOnly:!0})],Z.prototype,"renderer",null),e([c()],Z.prototype,"_screenshotManager",void 0),e([c()],Z.prototype,"componentObjectCollection",null),e([c()],Z.prototype,"_componentObjectCollection",void 0),e([c()],Z.prototype,"_needsUpdate",void 0),e([c()],Z.prototype,"_needsWaterReflectionUpdate",void 0),Z=e([m("esri.views.3d.webgl-engine.parts.RenderView")],Z);const ee=I();export{Z as RenderView};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{toConst as r}from"../../../../core/compilerUtils.js";import{unpackFloatRGBA as s}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{removeMaybe as n,destroyMaybe as o}from"../../../../core/maybe.js";import{watch as a,initial as h,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{Milliseconds as d}from"../../../../core/time.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{isMoon as u,isMars as f}from"../../../../geometry/support/spatialReferenceUtils.js";import{ChapmanAtmosphere as _}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as g}from"../../environment/CloudsComposition.js";import{Fog as w}from"../../environment/Fog.js";import{LocalAtmosphere as x}from"../../environment/LocalAtmosphere.js";import{MarsAtmosphere as v}from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as y}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as j}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as R}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{ObjectAndLayerIDRenderNode as b}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as T}from"../effects/geometry/RenderOccludedRenderNode.js";import{GlowRenderNode as A}from"../effects/glow/GlowRenderNode.js";import{Haze as O}from"../effects/haze/Haze.js";import{Highlight as S}from"../effects/highlight/Highlight.js";import{ShadowHighlight as q}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as M}from"../effects/magnifier/Magnifier.js";import{SMAA as U}from"../effects/smaa/SMAA.js";import{SSAO as k}from"../effects/ssao/SSAO.js";import{Stars as L}from"../effects/stars/Stars.js";import D from"../lib/CompositingHelper.js";import{GLMaterialRepository as H}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as F}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as W}from"../lib/Renderer.js";import{RenderingContext as B}from"../lib/RenderingContext.js";import{RenderingContextOptions as E}from"../lib/RenderingContextOptions.js";import{TextureRepository as G}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as N}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as z}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as P}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as I}from"./contextCache.js";import{removeLoadedShaderModules as V}from"./renderUtils.js";import{ScreenshotManager as X,ScreenshotContext as Q}from"./ScreenshotManager.js";import{contextCache as J}from"./testUtils.js";import{noBudget as K}from"../../../support/Scheduler.js";import{checkWebGLError as Y}from"../../../webgl/checkWebGLError.js";let Z=class extends t{constructor(e){super(e),this._waterTextures=new P,this.olidRenderHelper=C()?new F:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.glow=null,this.fog=null,this.test=null;const t=e.stage;try{this._initializeContext(t)}catch(n){return void console.error("Failed to initialize context",n)}const{memoryController:r}=t.view.resourceController;this._stippleTextures=z(this._rctx,r),this.notifyChange("stippleTextures"),this._markerTextures=N(this._rctx,r),this.notifyChange("markerTextures"),this._techniques=new R(new j(this._rctx,t.viewingMode,2===t.viewingMode?0:t.view.spatialReference.isWebMercator?1:2,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new G(t),this.addHandles(this._textures.events.on("changed",e=>this.requestRender(e)));const s=new H(this._textures,this._techniques,()=>this.requestRender(),()=>this.requestRender());this._compositingHelper=new D(this._rctx,this._techniques),this._renderer=new W(t,s,this._techniques,this._rctx,this._compositingHelper,e=>this.requestRender(e)),this.notifyChange("renderer"),this.addHandles([a(()=>t.view.ready,e=>{e&&this._createRenderNodes()},h),a(()=>this.waterTextures?.updating,()=>this.requestRender(),h),a(()=>t.view.qualityProfile,e=>this.renderer?.updateRenderFeatures(e),l)]);const i={renderScene:(e,t,r,s)=>this.renderer.render(e,t,r,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,s)=>t.options.screenshot.renderOverlay(e,r,s)};this._screenshotManager=new X(this._rctx,i,e=>t.view.overlayManager.updateOverlays(K,e.camera,0)),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=n(this._frameTask),this._techniques=o(this._techniques),this._componentObjectCollection=o(this._componentObjectCollection),this._set("componentObjectCollection",null),this._screenshotManager=o(this._screenshotManager),o(this.renderer),this._textures=o(this._textures),o(this.waterTextures),o(this.markerTextures),o(this.stippleTextures),this._waterTextures=null,this._markerTextures=null,this._stippleTextures=null,this._canvas=null,this._rctx=o(this._rctx),this._compositingHelper=null,this._renderer=null,this._set("renderer",null),this.test?.destroy()}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new L({view:e}),u(e.spatialReference)||(2===t?(new x({view:e}),this.glow=new A({view:e})):f(e.spatialReference)?(new v({view:e}),this.glow=new A({view:e})):(new _({view:e}),new g({view:e}),this.glow=new A({view:e}),new O({view:e}),this.fog=new w({view:e}))),new k({view:e,isEnabled:()=>this.renderer.hasSSAO}),new U({view:e,isEnabled:()=>this.renderer.hasSMAA}),new M({view:e}),new S({view:e}),new q({view:e,viewingMode:t}),new T({view:e}),C()&&new b({view:e})}requestRender(e=1){switch(e){case 2:this.stage.view.state.fading=!0;case 1:this._needsUpdate=!0;case 0:this._needsRender=!0}}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textures.updating||this.waterTextures.updating}get textures(){return this._textures}get techniques(){return this._techniques}get compositingHelper(){return this._compositingHelper}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(r(e))}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,n,o=n){const a=i.constrainWindowSize(t,r,n*i.pixelRatio,o*i.pixelRatio),h=this._ensureLinearDepthArrayBuffer(a);this.renderer.readMainDepth(a,h);const l=(e,t,r)=>s(t,e)*(r[1]-r[0])+r[0];let p=Number.MAX_VALUE;for(let s=0;s<a[2]*a[3];s++){const e=l(4*s,h,i.nearFar);p>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(p=e)}if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&p>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(p=s)}return p===Number.MAX_VALUE?void 0:p}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){V(),await this._techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,s=0,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?1:0,this._needsRender&&this.renderer.updateSceneDepthRange(t.camera),e.commitSyncLayers(),i=this.test?.time??i;(d(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(0),this._lastAnimationUpdate=i)},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,e=this.test?.time??e,this.renderer.render(t,e,0),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(0),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this._textures.update();const r=new Q(t,this.renderer.fboCache);e=this.test?.time??e,this._screenshotManager.update(r,e)},finish:()=>{i&&(this.renderer.finish(2===t.mode?s:1),i=!1)}};this._frameTask=p(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const s={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",s);if(null==n)return void i.getLogger(this).error("A WebGL2 context could not be created.");Y(n,!0),this._rctx=$(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&i.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}get stippleTextures(){return this._stippleTextures}get markerTextures(){return this._markerTextures}get waterTextures(){return this._waterTextures}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get renderer(){return this._renderer}get componentObjectCollection(){return null==this._componentObjectCollection&&(this._componentObjectCollection=new y(this.renderer.renderPassManager,this._viewingMode)),this._componentObjectCollection}set componentObjectCollection(e){this._componentObjectCollection=e}updateQualitySettings(e){null!=this.test?.time&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=d(0)),this._rctx.updateOptions({maxPreferredTexturePixels:this.stage.view.qualitySettings.maxTexturePixels})}};function $(e,t){const r=new E(t);if(J.enabled){let t=ee.get(e);return t&&1===t.refCount?(t.configure(r),t.ref(),t):(t=new B(e,r),ee.set(e,t),t.ref(),t)}return new B(e,r)}e([c({type:Boolean,readOnly:!0})],Z.prototype,"updating",null),e([c({constructOnly:!0})],Z.prototype,"stage",void 0),e([c({readOnly:!0})],Z.prototype,"stippleTextures",null),e([c({readOnly:!0})],Z.prototype,"markerTextures",null),e([c({readOnly:!0})],Z.prototype,"waterTextures",null),e([c({readOnly:!0})],Z.prototype,"olidRenderHelper",void 0),e([c()],Z.prototype,"_textures",void 0),e([c({readOnly:!0})],Z.prototype,"renderer",null),e([c()],Z.prototype,"_screenshotManager",void 0),e([c()],Z.prototype,"componentObjectCollection",null),e([c()],Z.prototype,"_componentObjectCollection",void 0),e([c()],Z.prototype,"_needsUpdate",void 0),e([c()],Z.prototype,"_needsWaterReflectionUpdate",void 0),Z=e([m("esri.views.3d.webgl-engine.parts.RenderView")],Z);const ee=I();export{Z as RenderView};
@@ -2,10 +2,10 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{s as e}from"../../../../chunks/vec42.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Float4PassUniform as a}from"../core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as i}from"../core/shaderModules/FloatPassUniform.js";import{glsl as o}from"../core/shaderModules/glsl.js";function m(t,m){if(!m.hasAnimation)return;const{attributes:r,varyings:d,vertex:l,fragment:T}=t;r.add("timeStamps","vec4"),d.add("vTimeStamp","float"),d.add("vFirstTime","float"),d.add("vLastTime","float"),d.add("vTransitionType","int"),l.main.add(o`vTimeStamp = timeStamps.x;
5
+ import{s as e}from"../../../../chunks/vec42.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Float4PassUniform as a}from"../core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as i}from"../core/shaderModules/FloatPassUniform.js";import{glsl as o}from"../core/shaderModules/glsl.js";function m(t,m){if(!m.hasAnimation)return;const{attributes:r,varyings:d,vertex:l,fragment:T}=t;r.add("timeStamps","vec4"),d.add("vTimeStamp","float"),d.add("vFirstTime","float"),d.add("vLastTime","float"),d.add("vTransitionType","float"),l.main.add(o`vTimeStamp = timeStamps.x;
6
6
  vFirstTime = timeStamps.y;
7
7
  vLastTime = timeStamps.z;
8
- vTransitionType = int(timeStamps.w);`);const{animation:v}=m;3===v&&T.constants.add("decayRate","float",2.3),T.code.add(o`
8
+ vTransitionType = timeStamps.w;`);const{animation:v}=m;3===v&&T.constants.add("decayRate","float",2.3),T.code.add(o`
9
9
  float getTrailOpacity(float x) {
10
10
  ${s(v)}
11
11
  }`),T.uniforms.add(new i("timeElapsed",e=>e.timeElapsed),new i("trailLength",e=>e.trailLength),new i("speed",e=>e.animationSpeed),new a("timingOptions",t=>e(n,t.startTime,t.endTime,t.fadeInTime,t.fadeOutTime))),T.code.add(o`float fadeIn(float x) {
@@ -17,7 +17,7 @@ return isinf(timingOptions[3]) ? 1.0 : smoothstep(timingOptions[3], 0.0, x);
17
17
  float startTime = timingOptions[0];
18
18
  float endTime = timingOptions[1];
19
19
  float totalTime = vLastTime - vFirstTime;
20
- float actualEndTime = vTransitionType == 2 ? min(endTime, startTime + vLastTime / speed) : endTime;
20
+ float actualEndTime = int(vTransitionType) == 2 ? min(endTime, startTime + vLastTime / speed) : endTime;
21
21
  vec4 animatedColor = color;
22
22
  float relativeStartTime = mod(startTime, totalTime);
23
23
  float vHeadRelativeToFirst = mod((timeElapsed - relativeStartTime) * speed - vFirstTime, totalTime);
@@ -34,7 +34,7 @@ animatedColor *= step(vAbsoluteTime, actualEndTime);
34
34
  animatedColor.a *= isinf(actualEndTime) ? 1.0 : fadeOut(timeElapsed - actualEndTime);
35
35
  animatedColor.a *= inPreviousCycle ? fadeOut(vHeadRelativeToFirst / speed) : 1.0;
36
36
  animatedColor.a *= getTrailOpacity(vRelativeToHead / trailLength);
37
- animatedColor.a *= vTransitionType == 0 ? fadeIn(vAbsoluteTime - startTime) : 1.0;
37
+ animatedColor.a *= int(vTransitionType) == 0 ? fadeIn(vAbsoluteTime - startTime) : 1.0;
38
38
  animatedColor.a *= fadeIn(vTimeStamp - vFirstTime);
39
39
  return animatedColor;
40
40
  }`)}function s(e){switch(e){case 2:return"return x >= 0.0 && x <= 1.0 ? 1.0 : 0.0;";case 3:return"float cutOff = exp(-decayRate);\n return (exp(-decayRate * x) - cutOff) / (1.0 - cutOff);";default:return"return 1.0;"}}const n=t();export{m as AnimatedLine};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{min as o}from"../../../core/arrayUtils.js";import{createTask as i}from"../../../core/asyncUtils.js";import{dedupeResult as s}from"../../../core/dedupeResult.js";import{makeHandle as r}from"../../../core/handleUtils.js";import{equalsShallow as a}from"../../../core/lang.js";import{LRUCache as n}from"../../../core/LRUCache.js";import{mapCollection as l}from"../../../core/mapCollectionUtils.js";import{destroyMaybe as p,abortMaybe as u,equalsMaybe as c}from"../../../core/maybe.js";import{throwIfAborted as m,throwIfAbortError as h}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as d,on as f}from"../../../core/reactiveUtils.js";import{throttle as v}from"../../../core/throttle.js";import{adaptiveVerticalLengthUnit as y,adaptiveLengthUnit as g}from"../../../core/unitUtils.js";import{property as C}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as P}from"../../../core/accessorSupport/decorators/subclass.js";import{ElevationQueryTileCache as j}from"../../../layers/support/ElevationQueryTileCache.js";import{absoluteHeightElevationInfo as T}from"../../../support/elevationInfoUtils.js";import{getDefaultUnitForView as U}from"../../../support/getDefaultUnitForView.js";import b from"../../../symbols/support/ElevationInfo.js";import{getConfig as w}from"./constants.js";import R from"./ElevationProfileError.js";import{InvalidGeometryError as S,UnknownError as I}from"./elevationProfileErrors.js";import{createProfileQueue as E,generateProfiles as D}from"./elevationProfileGenerationUtils.js";import{mergeStatistics as q,getBoundsInMeters as x}from"./elevationProfileStatisticsUtils.js";let O=class extends e{constructor(t){super(t),this.error=null,this._getStableEffectiveUnits=s(()=>{const t=x(this._activeComputations.map(t=>t.result.rawResult)),e=this.analysis.displayUnits,o=U(this.view);return{distance:g(t.maxDistance,"meters",e.distance??o),elevation:y(t.maxElevation,"meters",e.elevation??o)}},a),this._updateTask=null,this._queue=null,this._currentTileCache=null,this._parametersPerComputation=new Map,this._getStableUpdateParameters=s(()=>({stationary:this.view.stationary??!0,activeComputations:this._activeComputations,generationParameters:this._generationParameters}),a),this._getStableGenerationParameters=s(()=>{const{view:t,analysis:e}=this;return t?.ready&&this._queue?{view:t,geometry:e.geometry,geometryIsValid:e.valid,elevationInfo:this.elevationInfo,queue:this._queue,cache:this._tileCache,options:this._options,slicePlane:"3d"===t.type?t.slice.plane:null}:null},a),this._getStableElevationInfo=s(()=>this.analysis.elevationInfo??V,c),this._getStableOptions=s(()=>{const{densificationMaxSamples:t,defaultDemResolution:e,maxTotalSamples:o}=w();let i=this._minDemResolution??e;return i=parseFloat(i.toFixed(2)),{samplingDistance:i,densificationMaxSamples:Math.round(t/this._activeComputations.length),maxTotalSamples:o}},a),this._updateThrottled=v(t=>this._update(t),w().updateThrottleMillis)}initialize(){this._computationsCollection=l(()=>this.analysis.profiles,t=>this.computationFactory.create({controller:this,profile:t,onInvalidate:t=>this._invalidateComputation(t)}),{recycleItems:!0}),this.addHandles([this._computationsCollection.on("change",()=>{this._parametersPerComputation.clear(),this._updateThrottled(this._updateParameters)}),_(()=>this._updateParameters,t=>this._updateThrottled(t),d),this._updateThrottled]);const t="3d"===this.view.type?this.view.resourceController:void 0;this._queue=E(t?.scheduler),t?.addUpdatingObject(this)}destroy(){this._abortUpdate(),this._parametersPerComputation.clear(),this._computationsCollection?.destroy(),this._queue=p(this._queue),this._currentTileCache=p(this._currentTileCache)}get effectiveDisplayUnits(){return this._getStableEffectiveUnits()}get progress(){let t=0,e=0;for(const i of this._activeComputations)t++,e+=i.progress;const o=t>0?e/t:0;return o>.999999?1:o}get updating(){const{progress:t}=this;return t>0&&t<1||!!this._queue?.updating||this._updateThrottled.hasPendingUpdates()||null!=this._updateTask&&!this._updateTask.finished}get results(){return this._computations.map(t=>t.result)}get statistics(){return q(this._activeComputations.map(t=>t.result.statistics))}get hoveredPoints(){return this._computations.map(t=>t.hoveredPoint)}onElevationChange(t){const{view:e}=this;return"3d"===e?.type?f(()=>e.elevationProvider,"elevation-change",t,{onListenerAdd:t,onListenerRemove:t}):r()}get _tileCache(){this._currentTileCache=p(this._currentTileCache);const t=this.view;if("3d"===t?.type){const e=t.basemapTerrain?.elevationQueryCache;if(null!=e)return e}return null==this._currentTileCache&&(this._currentTileCache=new j(new n(20971520))),this._currentTileCache}get _computations(){return this._computationsCollection?.toArray()??[]}get _activeComputations(){return this._computations.filter(t=>t.profile.enabled&&t.available)}get _minDemResolution(){const t=this._minDemResolutions;return t.length>0?o(t):null}get _minDemResolutions(){const t=[];for(const{minDemResolution:e}of this._activeComputations)null!=e&&t.push(e);return t}get _updateParameters(){return this._getStableUpdateParameters()}get _generationParameters(){return this._getStableGenerationParameters()}get elevationInfo(){return this._getStableElevationInfo()}get _options(){return this._getStableOptions()}_update({stationary:t,activeComputations:e,generationParameters:o}){this._abortUpdate(),t&&(null!=o?this._updateTask=i(async t=>{this.error=null;const i=e.filter(t=>!this._isComputationValid(t,o));try{if(!o.geometryIsValid)throw new S;const e=D({...o,providers:i},{signal:t});for await(const s of e){m(t),this._clearInvalidResults(o);for(let t=0;t<i.length;t++)i[t].setResult(s[t]);for(const t of i)this._parametersPerComputation.set(t,o)}}catch(s){h(s),this._abortUpdate(),this.error=s instanceof R?s:new I,i.forEach(t=>{t.clearResult()})}}):this._clearResults())}_abortUpdate(){this._updateTask=u(this._updateTask)}_isComputationValid(t,e){return this._parametersPerComputation.has(t)&&this._parametersPerComputation.get(t)===e}_invalidateComputation(t){this._parametersPerComputation.delete(t),this._updateThrottled(this._updateParameters)}_clearInvalidResults(t){for(const e of this._computations)this._isComputationValid(e,t)||(e.clearResult(),this._parametersPerComputation.delete(e))}_clearResults(){for(const t of this._computations)t.clearResult(),this._parametersPerComputation.delete(t)}};t([C({constructOnly:!0})],O.prototype,"analysis",void 0),t([C({constructOnly:!0})],O.prototype,"analysisViewData",void 0),t([C({constructOnly:!0})],O.prototype,"computationFactory",void 0),t([C({constructOnly:!0})],O.prototype,"view",void 0),t([C()],O.prototype,"error",void 0),t([C({readOnly:!0})],O.prototype,"effectiveDisplayUnits",null),t([C()],O.prototype,"progress",null),t([C()],O.prototype,"updating",null),t([C()],O.prototype,"results",null),t([C()],O.prototype,"statistics",null),t([C()],O.prototype,"hoveredPoints",null),t([C()],O.prototype,"_queue",void 0),t([C()],O.prototype,"_tileCache",null),t([C()],O.prototype,"_computationsCollection",void 0),t([C()],O.prototype,"_computations",null),t([C()],O.prototype,"_activeComputations",null),t([C({readOnly:!0})],O.prototype,"_minDemResolution",null),t([C()],O.prototype,"_minDemResolutions",null),t([C()],O.prototype,"_updateParameters",null),t([C()],O.prototype,"_generationParameters",null),t([C()],O.prototype,"elevationInfo",null),t([C()],O.prototype,"_options",null),O=t([P("esri.views.analysis.ElevationProfile.ElevationProfileController")],O);const V=new b({...T});export{O as ElevationProfileController};
5
+ import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{min as o}from"../../../core/arrayUtils.js";import{createTask as i}from"../../../core/asyncUtils.js";import{dedupeResult as s}from"../../../core/dedupeResult.js";import{makeHandle as r}from"../../../core/handleUtils.js";import{equalsShallow as a}from"../../../core/lang.js";import{LRUCache as n}from"../../../core/LRUCache.js";import{mapCollection as l}from"../../../core/mapCollectionUtils.js";import{destroyMaybe as p,abortMaybe as u,equalsMaybe as c}from"../../../core/maybe.js";import{throwIfAborted as m,throwIfAbortError as h}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as d,on as f}from"../../../core/reactiveUtils.js";import{throttle as v}from"../../../core/throttle.js";import{adaptiveVerticalLengthUnit as y,adaptiveLengthUnit as g}from"../../../core/unitUtils.js";import{property as C}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as P}from"../../../core/accessorSupport/decorators/subclass.js";import{ElevationQueryTileCache as j}from"../../../layers/support/ElevationQueryTileCache.js";import{absoluteHeightElevationInfo as T}from"../../../support/elevationInfoUtils.js";import{getDefaultUnitForView as U}from"../../../support/getDefaultUnitForView.js";import b from"../../../symbols/support/ElevationInfo.js";import{getConfig as w}from"./constants.js";import R from"./ElevationProfileError.js";import{InvalidGeometryError as S,UnknownError as I}from"./elevationProfileErrors.js";import{createProfileQueue as E,sanitizeProgress as D,generateProfiles as q}from"./elevationProfileGenerationUtils.js";import{mergeStatistics as x,getBoundsInMeters as O}from"./elevationProfileStatisticsUtils.js";let k=class extends e{constructor(t){super(t),this.error=null,this._getStableEffectiveUnits=s(()=>{const t=O(this._activeComputations.map(t=>t.result.rawResult)),e=this.analysis.displayUnits,o=U(this.view);return{distance:g(t.maxDistance,"meters",e.distance??o),elevation:y(t.maxElevation,"meters",e.elevation??o)}},a),this._updateTask=null,this._queue=null,this._currentTileCache=null,this._parametersPerComputation=new Map,this._getStableUpdateParameters=s(()=>({stationary:this.view.stationary??!0,activeComputations:this._activeComputations,generationParameters:this._generationParameters}),a),this._getStableGenerationParameters=s(()=>{const{view:t,analysis:e}=this;return t?.ready&&this._queue?{view:t,geometry:e.geometry,geometryIsValid:e.valid,elevationInfo:this.elevationInfo,queue:this._queue,cache:this._tileCache,options:this._options,slicePlane:"3d"===t.type?t.slice.plane:null}:null},a),this._getStableElevationInfo=s(()=>this.analysis.elevationInfo??V,c),this._getStableOptions=s(()=>{const{densificationMaxSamples:t,defaultDemResolution:e,maxTotalSamples:o}=w();let i=this._minDemResolution??e;return i=parseFloat(i.toFixed(2)),{samplingDistance:i,densificationMaxSamples:Math.round(t/this._activeComputations.length),maxTotalSamples:o}},a),this._updateThrottled=v(t=>this._update(t),w().updateThrottleMillis)}initialize(){this._computationsCollection=l(()=>this.analysis.profiles,t=>this.computationFactory.create({controller:this,profile:t,onInvalidate:t=>this._invalidateComputation(t)}),{recycleItems:!0}),this.addHandles([this._computationsCollection.on("change",()=>{this._parametersPerComputation.clear(),this._updateThrottled(this._updateParameters)}),_(()=>this._updateParameters,t=>this._updateThrottled(t),d),this._updateThrottled]);const t="3d"===this.view.type?this.view.resourceController:void 0;this._queue=E(t?.scheduler),t?.addUpdatingObject(this)}destroy(){this._abortUpdate(),this._parametersPerComputation.clear(),this._computationsCollection?.destroy(),this._queue=p(this._queue),this._currentTileCache=p(this._currentTileCache)}get effectiveDisplayUnits(){return this._getStableEffectiveUnits()}get progress(){let t=0,e=0;for(const o of this._activeComputations)t++,e+=o.progress;return D(t>0?e/t:0)}get updating(){const{progress:t}=this,e=!!this._queue?.updating,o=this._updateThrottled.hasPendingUpdates(),i=null!=this._updateTask&&!this._updateTask.finished;return e||o||i||t>0&&t<1}get results(){return this._computations.map(t=>t.result)}get statistics(){return x(this._activeComputations.map(t=>t.result.statistics))}get hoveredPoints(){return this._computations.map(t=>t.hoveredPoint)}onElevationChange(t){const{view:e}=this;return"3d"===e?.type?f(()=>e.elevationProvider,"elevation-change",t,{onListenerAdd:t,onListenerRemove:t}):r()}get _tileCache(){this._currentTileCache=p(this._currentTileCache);const t=this.view;if("3d"===t?.type){const e=t.basemapTerrain?.elevationQueryCache;if(null!=e)return e}return null==this._currentTileCache&&(this._currentTileCache=new j(new n(20971520))),this._currentTileCache}get _computations(){return this._computationsCollection?.toArray()??[]}get _activeComputations(){return this._computations.filter(t=>t.profile.enabled&&t.available)}get _minDemResolution(){const t=this._minDemResolutions;return t.length>0?o(t):null}get _minDemResolutions(){const t=[];for(const{minDemResolution:e}of this._activeComputations)null!=e&&t.push(e);return t}get _updateParameters(){return this._getStableUpdateParameters()}get _generationParameters(){return this._getStableGenerationParameters()}get elevationInfo(){return this._getStableElevationInfo()}get _options(){return this._getStableOptions()}_update({stationary:t,activeComputations:e,generationParameters:o}){this._abortUpdate(),t&&(null!=o?this._updateTask=i(async t=>{this.error=null;const i=e.filter(t=>!this._isComputationValid(t,o));try{if(!o.geometryIsValid)throw new S;const e=q({...o,providers:i},{signal:t});let s=!1;for await(const r of e){m(t),s||(this._clearInvalidResults(o),s=!0);for(let t=0;t<i.length;t++)i[t].setResult(r[t])}for(const t of i)this._parametersPerComputation.set(t,o)}catch(s){h(s),this._abortUpdate(),this.error=s instanceof R?s:new I,i.forEach(t=>{t.clearResult()})}}):this._clearResults())}_abortUpdate(){this._updateTask=u(this._updateTask)}_isComputationValid(t,e){return this._parametersPerComputation.has(t)&&this._parametersPerComputation.get(t)===e}_invalidateComputation(t){this._parametersPerComputation.delete(t),this._updateThrottled(this._updateParameters)}_clearInvalidResults(t){for(const e of this._computations)this._isComputationValid(e,t)||(e.clearResult(),this._parametersPerComputation.delete(e))}_clearResults(){for(const t of this._computations)t.clearResult(),this._parametersPerComputation.delete(t)}};t([C({constructOnly:!0})],k.prototype,"analysis",void 0),t([C({constructOnly:!0})],k.prototype,"analysisViewData",void 0),t([C({constructOnly:!0})],k.prototype,"computationFactory",void 0),t([C({constructOnly:!0})],k.prototype,"view",void 0),t([C()],k.prototype,"error",void 0),t([C({readOnly:!0})],k.prototype,"effectiveDisplayUnits",null),t([C()],k.prototype,"progress",null),t([C()],k.prototype,"updating",null),t([C()],k.prototype,"results",null),t([C()],k.prototype,"statistics",null),t([C()],k.prototype,"hoveredPoints",null),t([C()],k.prototype,"_updateTask",void 0),t([C()],k.prototype,"_queue",void 0),t([C()],k.prototype,"_tileCache",null),t([C()],k.prototype,"_computationsCollection",void 0),t([C()],k.prototype,"_computations",null),t([C()],k.prototype,"_activeComputations",null),t([C({readOnly:!0})],k.prototype,"_minDemResolution",null),t([C()],k.prototype,"_minDemResolutions",null),t([C()],k.prototype,"_updateParameters",null),t([C()],k.prototype,"_generationParameters",null),t([C()],k.prototype,"elevationInfo",null),t([C()],k.prototype,"_options",null),k=t([P("esri.views.analysis.ElevationProfile.ElevationProfileController")],k);const V=new b({...T});export{k as ElevationProfileController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{dedupeResult as t}from"../../../core/dedupeResult.js";import{equalsShallow as o}from"../../../core/lang.js";import{equalsMaybe as r}from"../../../core/maybe.js";import{watch as i}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{GeometryDescriptor as a}from"../../../layers/support/GeometryDescriptor.js";import{getVisibleLayerIds as l}from"./elevationProfileLayerUtils.js";import{ElevationProfileLineComputation as c}from"./ElevationProfileLineComputation.js";let p=class extends c{constructor(){super(...arguments),this.type="input",this.numSamplesForPreview=50,this.numSamplesPerChunk=500,this._getStableElevationDependencies=t(()=>{const{view:e}=this.controller;if(!e)return null;const t=this._getStableElevationInfo();return{view:e,stationary:!this._requiresElevationAlignment||e.stationary,elevationInfo:t,visibleLayerIds:this._getStableLayerIds(),spatialReference:this._getStableSpatialReference()}},o),this._getStableElevationInfo=t(()=>this.controller.elevationInfo,r),this._getStableSpatialReference=t(()=>this.controller.view?.spatialReference,r),this._getStableLayerIds=t(()=>{const{view:e}=this.controller;return"3d"!==e.type?[]:l(e)},o)}initialize(){const e=()=>this.onInvalidate(this);this.addHandles([i(()=>this._queryElevationDependencies,e),this.controller.onElevationChange(e)])}async queryElevation(e,{noDataValue:t,signal:o}){const r=this._queryElevationDependencies;if(null==r)throw new Error(`${this.declaredClass}: no dependencies`);const{view:i,spatialReference:n}=r;if(this._requiresElevationAlignment&&"3d"===i.type&&n){const r=await a.fromGeometry(e).project(n,o);if(!r)return{geometry:e,noDataValue:t};const s=i.elevationProvider;return r.coordinates.forEach(e=>{e.z=s.getElevation(e.x,e.y,0,n,"ground")??0}),{geometry:r.export(),noDataValue:t}}return{geometry:e,noDataValue:t}}get _requiresElevationAlignment(){return"on-the-ground"===this.controller.elevationInfo?.mode&&"3d"===this.controller.view.type}get _queryElevationDependencies(){return this._getStableElevationDependencies()}};e([n()],p.prototype,"_queryElevationDependencies",null),p=e([s("esri.views.analysis.ElevationProfile.ElevationProfileLineInputComputation")],p);export{p as ElevationProfileLineInputComputation};
5
+ import{__decorate as e}from"tslib";import{dedupeResult as t}from"../../../core/dedupeResult.js";import{equalsShallow as o}from"../../../core/lang.js";import{equalsMaybe as r}from"../../../core/maybe.js";import{watch as i,sync as n}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{GeometryDescriptor as l}from"../../../layers/support/GeometryDescriptor.js";import{getVisibleLayerIds as c}from"./elevationProfileLayerUtils.js";import{ElevationProfileLineComputation as p}from"./ElevationProfileLineComputation.js";let u=class extends p{constructor(){super(...arguments),this.type="input",this.numSamplesForPreview=50,this.numSamplesPerChunk=500,this._getStableElevationDependencies=t(()=>{const{view:e}=this.controller;if(!e)return null;const t=this._getStableElevationInfo();return{view:e,stationary:!this._requiresElevationAlignment||e.stationary,elevationInfo:t,visibleLayerIds:this._getStableLayerIds(),spatialReference:this._getStableSpatialReference()}},o),this._getStableElevationInfo=t(()=>this.controller.elevationInfo,r),this._getStableSpatialReference=t(()=>this.controller.view?.spatialReference,r),this._getStableLayerIds=t(()=>{const{view:e}=this.controller;return"3d"!==e.type?[]:c(e)},o)}initialize(){const e=()=>this.onInvalidate(this);this.addHandles([i(()=>this._queryElevationDependencies,e,n),this.controller.onElevationChange(e)])}async queryElevation(e,{noDataValue:t,signal:o}){const r=this._queryElevationDependencies;if(null==r)throw new Error(`${this.declaredClass}: no dependencies`);const{view:i,spatialReference:n}=r;if(this._requiresElevationAlignment&&"3d"===i.type&&n){const r=await l.fromGeometry(e).project(n,o);if(!r)return{geometry:e,noDataValue:t};const s=i.elevationProvider;return r.coordinates.forEach(e=>{e.z=s.getElevation(e.x,e.y,0,n,"ground")??0}),{geometry:r.export(),noDataValue:t}}return{geometry:e,noDataValue:t}}get _requiresElevationAlignment(){return"on-the-ground"===this.controller.elevationInfo?.mode&&"3d"===this.controller.view.type}get _queryElevationDependencies(){return this._getStableElevationDependencies()}};e([s()],u.prototype,"_queryElevationDependencies",null),u=e([a("esri.views.analysis.ElevationProfile.ElevationProfileLineInputComputation")],u);export{u as ElevationProfileLineInputComputation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{Clonable as e}from"../../../core/Clonable.js";import{memoize as o}from"../../../core/memoize.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../../../geometry/Point.js";import{binaryFindClosest as i}from"./elevationProfileGenerationUtils.js";import{convertSamples as n,convertStatistics as a}from"./elevationProfileUnitUtils.js";let p=class extends e{constructor(t){super(t),this._getSamplesMemoized=o((t,e)=>n(t,e)),this._getStatisticsMemoized=o((t,e)=>a(t,e)),this.rawResult=null}get available(){const{computation:t}=this;return t.profile.enabled&&t.available}get profile(){return this.computation.profile}get progress(){return null!=this.rawResult&&this.computation.profile.enabled?this.rawResult.progress:0}get samples(){return this._getSamplesMemoized(this.rawResult,this.computation.controller.effectiveDisplayUnits)}get statistics(){return this._getStatisticsMemoized(this.rawResult,this.computation.controller.effectiveDisplayUnits)}get hoveredPoint(){if(!this.computation.profile.enabled)return null;const t=this.computation.controller.analysisViewData.hoveredPosition;if(null==t)return null;const{rawResult:e,samples:o}=this;if(null==o||null==e)return null;const r=o.length;if(0===r)return null;const s=o[r-1].distance,n=i(o,t*s,t=>t.distance);if(null==n)return null;const{x:a,y:p,z:u}=n;return null==u?null:new l({x:a,y:p,z:u,spatialReference:e.spatialReference})}};t([r()],p.prototype,"available",null),t([r({readOnly:!0})],p.prototype,"profile",null),t([r({readOnly:!0})],p.prototype,"progress",null),t([r()],p.prototype,"samples",null),t([r()],p.prototype,"statistics",null),t([r({constructOnly:!0})],p.prototype,"computation",void 0),t([r()],p.prototype,"rawResult",void 0),t([r()],p.prototype,"hoveredPoint",null),p=t([s("esri.views.analysis.ElevationProfile.ElevationProfileResult")],p);export{p as default};
5
+ import{__decorate as t}from"tslib";import{Clonable as e}from"../../../core/Clonable.js";import{memoize as o}from"../../../core/memoize.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../../../geometry/Point.js";import{sanitizeProgress as i,binaryFindClosest as n}from"./elevationProfileGenerationUtils.js";import{convertSamples as a,convertStatistics as p}from"./elevationProfileUnitUtils.js";let u=class extends e{constructor(t){super(t),this._getSamplesMemoized=o((t,e)=>a(t,e)),this._getStatisticsMemoized=o((t,e)=>p(t,e)),this.rawResult=null}get available(){const{computation:t}=this;return t.profile.enabled&&t.available}get profile(){return this.computation.profile}get progress(){return i(null!=this.rawResult&&this.computation.profile.enabled?this.rawResult.progress:0)}get samples(){return this._getSamplesMemoized(this.rawResult,this.computation.controller.effectiveDisplayUnits)}get statistics(){return this._getStatisticsMemoized(this.rawResult,this.computation.controller.effectiveDisplayUnits)}get hoveredPoint(){if(!this.computation.profile.enabled)return null;const t=this.computation.controller.analysisViewData.hoveredPosition;if(null==t)return null;const{rawResult:e,samples:o}=this;if(null==o||null==e)return null;const r=o.length;if(0===r)return null;const s=o[r-1].distance,i=n(o,t*s,t=>t.distance);if(null==i)return null;const{x:a,y:p,z:u}=i;return null==u?null:new l({x:a,y:p,z:u,spatialReference:e.spatialReference})}};t([r()],u.prototype,"available",null),t([r({readOnly:!0})],u.prototype,"profile",null),t([r({readOnly:!0})],u.prototype,"progress",null),t([r()],u.prototype,"samples",null),t([r()],u.prototype,"statistics",null),t([r({constructOnly:!0})],u.prototype,"computation",void 0),t([r()],u.prototype,"rawResult",void 0),t([r()],u.prototype,"hoveredPoint",null),u=t([s("esri.views.analysis.ElevationProfile.ElevationProfileResult")],u);export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import s from"../../../core/Accessor.js";import{createTask as i}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{makeHandle as a}from"../../../core/handleUtils.js";import{ignoreAbortErrors as r,isAborted as o,throwIfAborted as n}from"../../../core/promiseUtils.js";import{watch as c,syncAndInitial as h}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../../core/support/UpdatingHandles.js";import m from"../../../layers/GraphicsLayer.js";import{getGraphicEffectiveElevationInfo as y}from"../../../support/elevationInfoUtils.js";import u from"../../../symbols/CIMSymbol.js";import g from"../../../symbols/SimpleLineSymbol.js";import _ from"../../../symbols/support/ElevationInfo.js";import{ExclusiveOperationManager as f}from"../ExclusiveOperationManager.js";import{isPolyline as k,isValidInputGraphic as v}from"./elevationProfileGeometryUtils.js";import{ViewEventPriorities as w}from"../../input/InputManager.js";import{isCancelEvent as G}from"../../interactive/interactiveToolUtils.js";import b from"../../../widgets/Sketch/SketchViewModel.js";let S=class extends s{constructor(e){super(e),this._updatingHandles=new d,this._operationManager=new f}initialize(){const{view:e}=this;this._graphicsLayer=new m({listMode:"hide",internal:!0}),this._sketchViewModel=new b({layer:this._graphicsLayer,view:e,defaultCreateOptions:{mode:"click",hasZ:!0},updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:"none"},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"reshape"},polylineSymbol:this._lineSymbol,activeLineSymbol:this._lineSymbol}),this.addHandles([c(()=>({map:e.map,internalGraphicsLayer:this._graphicsLayer,state:this.state,sketchGraphicVisible:this._analysis.viewOptions.geometryVisualizationVisible}),({map:e,internalGraphicsLayer:t,state:s,sketchGraphicVisible:i})=>{j(e,t);const a=this.sketchGraphic;switch(a&&(a.visible=!0),s){case"idle":case"reshaping-disabled":a&&!i&&(a.visible=!1),this._operationManager.stop(),this._ensureUpdatedSketchGraphic();break;case"reshaping":r(this._startReshape());break;case"awaiting-sketch":this.analysisViewData.interactive=!0}},h),c(()=>this._analysis.elevationInfo,e=>{this._graphicsLayer.elevationInfo=e},h)])}destroy(){this._operationManager.destroy(),this._sketchViewModel.destroy();const e=this._graphicsLayer;this.view.map?.remove(e),e.destroy()}get sketchGraphic(){return this._get("sketchGraphic")}set sketchGraphic(e){e!==this._get("sketchGraphic")&&(this._set("sketchGraphic",e),L(this._graphicsLayer,e),this._updateAnalysisFromSketchGraphic())}get state(){const{visible:e,interactive:t}=this.analysisViewData;if(!e)return"idle";switch(this._operationManager.currentOperationType){case"place":return this._sketchViewModel.createGraphic===this.sketchGraphic?"sketching":"awaiting-sketch";case"pick-feature":return"picking";default:return this._analysis.geometry?t?"reshaping":"reshaping-disabled":"idle"}}get updating(){return this._sketchViewModel.updating||this._updatingHandles.updating}get _analysis(){return this.analysisViewData.analysis}get _lineSymbol(){return M(this.view.type)}place(e){return this._operationManager.start("place",async t=>{const s=this._analysis.clone();this._ensureUpdatedSketchGraphic();const i=this._sketchViewModel.on("create",e=>{switch(e.state){case"start":this.sketchGraphic=e.graphic,this._analysis.elevationInfo=this._graphicsLayer.elevationInfo;break;case"active":this._updateAnalysisFromSketchGraphic();break;case"complete":this._updateAnalysisFromSketchGraphic(),t.stop();break;case"cancel":t.stop()}});t.handles.push(i,a(()=>(i.remove(),this._sketchViewModel.cancel(),this._updateAnalysisFromSketchGraphic(),this._analysis.valid?o(e)||s.equals(this._analysis)?t.reject():void t.resolve({}):(this._clear(),t.reject()))),this._stashSketchGraphic()),this._graphicsLayer.elevationInfo=V,await this._updatingHandles.addPromise(r(this._sketchViewModel.create("polyline")))},e)}_stashSketchGraphic(){const e=this.sketchGraphic;if(!e)return a();const t=this._analysis.elevationInfo,s=new m({listMode:"hide",internal:!0,elevationInfo:t});return this.view.map.add(s),s.graphics.add(e),a(()=>{this.sketchGraphic===e&&(this._graphicsLayer.elevationInfo=t,this._graphicsLayer.add(e)),s.removeFromParent(),s.destroy()})}async pickFeature(e){return this._operationManager.start("pick-feature",async e=>{const{view:t}=this;t.closePopup();let s=null;const r=a=>{a.defer(async()=>{s?.abort(),s=i(async s=>{const{results:i}=await t.hitTest(a);n(s);const r=i.filter(e=>"graphic"===e.type).map(e=>e.graphic).find(v);r?(a.preventDefault(),a.stopPropagation(),this.sketchGraphic=null,this._analysis.geometry=r.geometry,this._analysis.elevationInfo=new _({...y(r)}),e.resolve({feature:r}),e.stop()):e.reject()}),await s.promise})},o=t=>{G(t)&&(e.reject(),e.stop())};e.handles.push(t.on("immediate-click",r,w.TOOL),t.on("key-down",o,w.TOOL),t.acquireCursor("crosshair","high"),a(()=>{s?.abort(),e.reject()})),t.focus()},e)}_startReshape(){return this._operationManager.start("reshape",async e=>{const t=()=>{const e=this._ensureUpdatedSketchGraphic();return e?(L(this._graphicsLayer,e),this._updatingHandles.addPromise(this._sketchViewModel.update(e,{tool:"reshape"}))):Promise.resolve()};if(!this._ensureUpdatedSketchGraphic())return;const s=this._sketchViewModel.on("update",s=>{this._updateAnalysisFromSketchGraphic(),"complete"===s.state&&("reshaping"===this.state?r(t()):e.resolve())});e.handles.push(s,a(()=>{s.remove(),this._sketchViewModel.cancel(),e.resolve()})),await t()})}_ensureUpdatedSketchGraphic(){const{geometry:e}=this._analysis;if(!e)return this.sketchGraphic=null,null;const s=this.sketchGraphic??=new t({symbol:this._lineSymbol,geometry:e});return s.geometry=e,s}_clear(){this.sketchGraphic=null,this._analysis.clear()}_updateAnalysisFromSketchGraphic(){let e=this.sketchGraphic?.geometry;k(e)||(e=null);const t=this._analysis;t.geometry!==e&&(t.geometry=e)}};function M(e){if("2d"===e){const e={type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5};return new u({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{...e,effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],color:[0,0,0,255]},{...e,color:[255,255,255,255]}]}}})}return new g({color:[0,0,0,0]})}function j(e,t){t&&(t.removeFromParent(),e?.add(t))}function L({graphics:e},t){t?(e.includes(t)||e.add(t),1!==e.length&&e.removeMany(e.filter(e=>e!==t))):e.removeAll()}e([l({constructOnly:!0})],S.prototype,"analysisViewData",void 0),e([l({constructOnly:!0})],S.prototype,"view",void 0),e([l()],S.prototype,"sketchGraphic",null),e([l({nonNullable:!0})],S.prototype,"state",null),e([l()],S.prototype,"updating",null),e([l()],S.prototype,"_analysis",null),e([l()],S.prototype,"_lineSymbol",null),S=e([p("esri.views.analysis.ElevationProfile.ElevationProfileTool")],S);const V=new _({mode:"on-the-ground",offset:0});export{S as ElevationProfileTool};
5
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import s from"../../../core/Accessor.js";import{createTask as i}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{makeHandle as a}from"../../../core/handleUtils.js";import{ignoreAbortErrors as r,isAborted as o,throwIfAborted as n}from"../../../core/promiseUtils.js";import{watch as l,syncAndInitial as c}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../../core/support/UpdatingHandles.js";import m from"../../../layers/GraphicsLayer.js";import{getGraphicEffectiveElevationInfo as y}from"../../../support/elevationInfoUtils.js";import u from"../../../symbols/CIMSymbol.js";import g from"../../../symbols/SimpleLineSymbol.js";import _ from"../../../symbols/support/ElevationInfo.js";import{ExclusiveOperationManager as f}from"../ExclusiveOperationManager.js";import{isPolyline as k,isValidInputGraphic as v}from"./elevationProfileGeometryUtils.js";import{ViewEventPriorities as w}from"../../input/InputManager.js";import{isCancelEvent as b}from"../../interactive/interactiveToolUtils.js";import G from"../../../widgets/Sketch/SketchViewModel.js";let S=class extends s{constructor(e){super(e),this._updatingHandles=new d,this._operationManager=new f}initialize(){const{view:e}=this;this._graphicsLayer=new m({listMode:"hide",internal:!0}),this._sketchViewModel=new G({layer:this._graphicsLayer,view:e,defaultCreateOptions:{mode:"click",hasZ:!0},updateOnGraphicClick:!1,defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{shapeOperation:"none"},toggleToolOnClick:!1,tool:"reshape"},polylineSymbol:this._lineSymbol,activeLineSymbol:this._lineSymbol}),this.addHandles([l(()=>({map:e.map,internalGraphicsLayer:this._graphicsLayer,state:this.state,geometryVisualizationVisible:this._analysis.viewOptions.geometryVisualizationVisible,visible:this.analysisViewData.visible}),({map:e,internalGraphicsLayer:t,state:s,geometryVisualizationVisible:i,visible:a})=>{j(e,t);const o=this.sketchGraphic;switch(o&&(o.visible=a),s){case"idle":case"reshaping-disabled":o&&!i&&(o.visible=!1),this._operationManager.stop(),this._ensureUpdatedSketchGraphic();break;case"reshaping":r(this._startReshape());break;case"awaiting-sketch":this.analysisViewData.interactive=!0}},c),l(()=>this._analysis.elevationInfo,e=>{this._graphicsLayer.elevationInfo=e},c)])}destroy(){this._operationManager.destroy(),this._sketchViewModel.destroy();const e=this._graphicsLayer;this.view.map?.remove(e),e.destroy()}get sketchGraphic(){return this._get("sketchGraphic")}set sketchGraphic(e){e!==this._get("sketchGraphic")&&(this._set("sketchGraphic",e),L(this._graphicsLayer,e),this._updateAnalysisFromSketchGraphic())}get state(){const{visible:e,interactive:t}=this.analysisViewData;if(!e)return"idle";switch(this._operationManager.currentOperationType){case"place":return this._sketchViewModel.createGraphic===this.sketchGraphic?"sketching":"awaiting-sketch";case"pick-feature":return"picking";default:return this._analysis.geometry?t?"reshaping":"reshaping-disabled":"idle"}}get updating(){return this._sketchViewModel.updating||this._updatingHandles.updating}get _analysis(){return this.analysisViewData.analysis}get _lineSymbol(){return M(this.view.type)}place(e){return this._operationManager.start("place",async t=>{const s=this._analysis.clone();this._ensureUpdatedSketchGraphic();const i=this._stashSketchGraphic(),n=this._sketchViewModel.on("create",e=>{switch(e.state){case"start":this.sketchGraphic=e.graphic,this._analysis.elevationInfo=this._graphicsLayer.elevationInfo,i.remove();break;case"active":this._updateAnalysisFromSketchGraphic();break;case"complete":this._updateAnalysisFromSketchGraphic(),t.stop();break;case"cancel":t.stop()}});t.handles.push(n,a(()=>(n.remove(),this._sketchViewModel.cancel(),this._updateAnalysisFromSketchGraphic(),this._analysis.valid?o(e)||s.equals(this._analysis)?t.reject():void t.resolve({}):(this._clear(),t.reject()))),i),this._graphicsLayer.elevationInfo=V,await this._updatingHandles.addPromise(r(this._sketchViewModel.create("polyline")))},e)}_stashSketchGraphic(){const e=this.sketchGraphic;if(!e)return a();const t=this._analysis.elevationInfo,s=new m({listMode:"hide",internal:!0,elevationInfo:t});return this.view.map.add(s),s.graphics.add(e),a(()=>{this.sketchGraphic===e&&(this._graphicsLayer.elevationInfo=t,this._graphicsLayer.add(e)),s.removeFromParent(),s.destroy()})}async pickFeature(e){return this._operationManager.start("pick-feature",async e=>{const{view:t}=this;t.closePopup();let s=null;const r=a=>{a.defer(async()=>{s?.abort(),s=i(async s=>{const{results:i}=await t.hitTest(a);n(s);const r=i.filter(e=>"graphic"===e.type).map(e=>e.graphic).find(v);r?(a.preventDefault(),a.stopPropagation(),this.sketchGraphic=null,this._analysis.geometry=r.geometry,this._analysis.elevationInfo=new _({...y(r)}),e.resolve({feature:r}),e.stop()):e.reject()}),await s.promise})},o=t=>{b(t)&&(e.reject(),e.stop())};e.handles.push(t.on("immediate-click",r,w.TOOL),t.on("key-down",o,w.TOOL),t.acquireCursor("crosshair","high"),a(()=>{s?.abort(),e.reject()})),t.focus()},e)}_startReshape(){return this._operationManager.start("reshape",async e=>{const t=()=>{const e=this._ensureUpdatedSketchGraphic();return e?(L(this._graphicsLayer,e),this._updatingHandles.addPromise(this._sketchViewModel.update(e,{tool:"reshape"}))):Promise.resolve()};if(!this._ensureUpdatedSketchGraphic())return;const s=this._sketchViewModel.on("update",s=>{this._updateAnalysisFromSketchGraphic(),"complete"===s.state&&("reshaping"===this.state?r(t()):e.resolve())});e.handles.push(s,a(()=>{s.remove(),this._sketchViewModel.cancel(),e.resolve()})),await t()})}_ensureUpdatedSketchGraphic(){const{geometry:e}=this._analysis;if(!e)return this.sketchGraphic=null,null;const s=this.sketchGraphic??=new t({symbol:this._lineSymbol,geometry:e});return s.geometry=e,s}_clear(){this.sketchGraphic=null,this._analysis.clear()}_updateAnalysisFromSketchGraphic(){let e=this.sketchGraphic?.geometry;k(e)||(e=null);const t=this._analysis;t.geometry!==e&&(t.geometry=e)}};function M(e){if("2d"===e){const e={type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5};return new u({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{...e,effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],color:[0,0,0,255]},{...e,color:[255,255,255,255]}]}}})}return new g({color:[0,0,0,0]})}function j(e,t){t&&(t.removeFromParent(),e?.add(t))}function L({graphics:e},t){t?(e.includes(t)||e.add(t),1!==e.length&&e.removeMany(e.filter(e=>e!==t))):e.removeAll()}e([h({constructOnly:!0})],S.prototype,"analysisViewData",void 0),e([h({constructOnly:!0})],S.prototype,"view",void 0),e([h()],S.prototype,"sketchGraphic",null),e([h({nonNullable:!0})],S.prototype,"state",null),e([h()],S.prototype,"updating",null),e([h()],S.prototype,"_analysis",null),e([h()],S.prototype,"_lineSymbol",null),S=e([p("esri.views.analysis.ElevationProfile.ElevationProfileTool")],S);const V=new _({mode:"on-the-ground",offset:0});export{S as ElevationProfileTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{splitIntoChunks as e}from"../../../core/arrayUtils.js";import{lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as r,throwIfNotAbortError as n,after as o,isAbortError as s}from"../../../core/promiseUtils.js";import i from"../../../geometry/Multipoint.js";import{unnormalizedCoordinate as l}from"../../../geometry/support/coordsUtils.js";import{getInfo as a}from"../../../geometry/support/spatialReferenceUtils.js";import{getConfig as c,errorResult as u}from"./constants.js";import{InvalidGeometryError as p,TooComplexError as f,ElevationQueryError as m}from"./elevationProfileErrors.js";import{isValidInputPath as d,countPoints as h,densifyPath as y}from"./elevationProfileGeometryUtils.js";import{getStatistics as w}from"./elevationProfileStatisticsUtils.js";import{breadthFirstBinaryPartitioning as g}from"./elevationProfileTraversalUtils.js";import{ScheduledQueueProcessor as v}from"../../support/ScheduledQueueProcessor.js";import{TaskPriority as P}from"../../support/Scheduler.js";async function*j(e,t){const{view:n,geometry:s,elevationInfo:i,providers:l,options:a}=e,u=n.spatialReference;if(!u||null==s||!d(s))throw new p;const m=l.length;if(0===m)return null;const w=Math.round(a.maxTotalSamples/m);if(h(s)>w)throw new f;const g=await y(s,i,n,u,a,w,t);r(t);let v=0;const P=new Array(m),j=new Array(m);for(let r=0;r<m;r++){const n=M(g);P[r]=n,v+=n.samples.length;const o={...e,provider:l[r],result:n,densificationResult:g};j[r]=R(o,t)[Symbol.iterator]()}if(v>a.maxTotalSamples)throw new f;const Z=await Promise.all(j.map(e=>{const t=e.next();return!0===t.done?Promise.resolve(null):t.value}));r(t);for(let r=0;r<m;r++)P[r]=Z[r];yield P,await o(e.delayAfterPreview??c().delayAfterPreviewMillis,null,t.signal),r(t);const S=[];try{let e;do{e=!1;for(let t=0;t<m;t++){const r=j[t].next();!1===r.done&&(S.push({resultPromise:r.value,index:t}),e=!0)}}while(e)}finally{j.forEach(e=>e.return?.())}for(const{resultPromise:o,index:c}of S)P[c]=await o,r(t),yield P;for(const r of P)null!=r&&(r.progress=1);yield P}function*R(t,r){const{densificationResult:n}=t,o={...t,abortOptions:r,densificationResult:n},s=g(0,o.result.samples.length),i=s.slice(0,o.provider.numSamplesForPreview);yield Z(o,i,!0);const l=e(s,o.provider.numSamplesPerChunk);for(const e of l)yield Z(o,e,!1)}async function Z({densificationResult:e,result:t,provider:r,queue:n,abortOptions:o,cache:l},a,p){const{densifiedPath:f,pathLength:m}=e,d=t.spatialReference,{samples:h}=t,y=[];for(let s=0;s<a.length;s++){const e=h[a[s]];y[s]=[...e.coordinate]}try{return await n.push({geometry:new i({spatialReference:d,points:y,hasZ:f.hasZ}),provider:r,indices:a,preview:p,result:t,parameters:{...c().defaultQueryOptions(),minDemResolution:p?Math.round(m/r.numSamplesForPreview):Math.round(m/h.length),cache:l}},o),{...t}}catch(w){return s(w)?null:u}}function S(e){return new v({priority:P.ELEVATION_PROFILE,concurrency:1,scheduler:e,process:async e=>{r(e.parameters);try{await U(e)}catch(t){n(t)}}})}async function U({geometry:e,provider:t,indices:r,preview:n,result:o,parameters:s}){if(0===r.length)return;const i=(await b(t,e,s)).geometry,{hasZ:l,points:a}=i,c=s.noDataValue,{samples:u}=o;for(let p=0;p<r.length;p++){const e=u[r[p]];if(e.isHole)continue;const t=l?a[p][2]:null;null===t||t===c?e.sampledZ=null:(o.hasZ=!0,e.sampledZ=t),e.sampled=!0}x(u),o.progress=n?0:o.progress+r.length/u.length,o.statistics=w(o.samples,o.spatialReference)}function x(e){const t=e.length-1;let r=0;for(let n=1;n<=t;n++){(e[n].sampled||n===t)&&(E(e,r,n),r=n)}}function E(e,r,n){if(n-r===1)return;const o=e[r],s=o.sampledZ,i=e[n],l=i.sampledZ;if(null==s||null==l){for(let t=r+1;t<n;t++)e[t].sampledZ=null;return}const a=o.distance,c=i.distance-a;for(let u=r+1;u<n;u++){const r=e[u],n=(r.distance-a)/c;r.sampledZ=t(s,l,n)}}function M({densifiedPath:e,distances:t}){const r=e.spatialReference,n=a(r),o=e.paths,s=o.length,i=[];let c=null,u=0;for(let a=0;a<s;a++){const e=o[a],r=e.length,s=t[a];for(let t=0;t<r;t++){const r=e[t],o=s[t];n&&(r[0]=l(r[0],n.valid[0],n.valid[1])),c&&0===t&&A(i,c,r,u,o),i.push(O(r,o)),c=r,u=o}}return{progress:0,samples:i,hasZ:!1,statistics:null,spatialReference:r}}function A(e,t,r,n,o){e.push(T(t,n)),e.push(T(r,o))}function O(e,t){return{coordinate:e,distance:t,sampledZ:null,sampled:!1,isHole:!1}}function T(e,t){return{coordinate:e,distance:t,sampledZ:null,sampled:!0,isHole:!0}}async function b(e,t,r){try{return await e.queryElevation(t,r)}catch(n){throw new m}}function F(e,t,r){if(!e||0===e.length)return;const n=e.length-1,o=e[0];if(t<=r(o))return o;const s=e[n];if(t>=r(s))return s;let i=0,l=0,a=n;for(;i<a;){l=i+Math.floor((a-i)/2);const o=e[l],s=r(o);if(s===t)return o;if(t<s){if(l>0){const n=e[l-1],i=r(n);if(t>i)return t-i>=s-t?o:n}a=l}else{if(l<n){const n=e[l+1],i=r(n);if(t<i)return t-s>=i-t?n:o}i=l+1}}return e[l]}export{F as binaryFindClosest,S as createProfileQueue,R as generateProfile,j as generateProfiles,x as interpolateElevations};
5
+ import{splitIntoChunks as e}from"../../../core/arrayUtils.js";import{lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as r,throwIfNotAbortError as n,after as o,isAbortError as s}from"../../../core/promiseUtils.js";import i from"../../../geometry/Multipoint.js";import{unnormalizedCoordinate as l}from"../../../geometry/support/coordsUtils.js";import{getInfo as a}from"../../../geometry/support/spatialReferenceUtils.js";import{getConfig as c,errorResult as u}from"./constants.js";import{InvalidGeometryError as p,TooComplexError as f,ElevationQueryError as m}from"./elevationProfileErrors.js";import{isValidInputPath as d,countPoints as h,densifyPath as y}from"./elevationProfileGeometryUtils.js";import{getStatistics as w}from"./elevationProfileStatisticsUtils.js";import{breadthFirstBinaryPartitioning as g}from"./elevationProfileTraversalUtils.js";import{ScheduledQueueProcessor as v}from"../../support/ScheduledQueueProcessor.js";import{TaskPriority as P}from"../../support/Scheduler.js";async function*j(e,t){const{view:n,geometry:s,elevationInfo:i,providers:l,options:a}=e,u=n.spatialReference;if(!u||null==s||!d(s))throw new p;const m=l.length;if(0===m)return null;const w=Math.round(a.maxTotalSamples/m);if(h(s)>w)throw new f;const g=await y(s,i,n,u,a,w,t);r(t);let v=0;const P=new Array(m),j=new Array(m);for(let r=0;r<m;r++){const n=M(g);P[r]=n,v+=n.samples.length;const o={...e,provider:l[r],result:n,densificationResult:g};j[r]=R(o,t)[Symbol.iterator]()}if(v>a.maxTotalSamples)throw new f;const Z=await Promise.all(j.map(e=>{const t=e.next();return!0===t.done?Promise.resolve(null):t.value}));r(t);for(let r=0;r<m;r++)P[r]=Z[r];yield P,await o(e.delayAfterPreview??c().delayAfterPreviewMillis,null,t.signal),r(t);const S=[];try{let e;do{e=!1;for(let t=0;t<m;t++){const r=j[t].next();!1===r.done&&(S.push({resultPromise:r.value,index:t}),e=!0)}}while(e)}finally{j.forEach(e=>e.return?.())}for(const{resultPromise:o,index:c}of S)P[c]=await o,r(t),yield P;for(const r of P)null!=r&&(r.progress=1);yield P}function*R(t,r){const{densificationResult:n}=t,o={...t,abortOptions:r,densificationResult:n},s=g(0,o.result.samples.length),i=s.slice(0,o.provider.numSamplesForPreview);yield Z(o,i,!0);const l=e(s,o.provider.numSamplesPerChunk);for(const e of l)yield Z(o,e,!1)}async function Z({densificationResult:e,result:t,provider:r,queue:n,abortOptions:o,cache:l},a,p){const{densifiedPath:f,pathLength:m}=e,d=t.spatialReference,{samples:h}=t,y=[];for(let s=0;s<a.length;s++){const e=h[a[s]];y[s]=[...e.coordinate]}try{return await n.push({geometry:new i({spatialReference:d,points:y,hasZ:f.hasZ}),provider:r,indices:a,preview:p,result:t,parameters:{...c().defaultQueryOptions(),minDemResolution:p?Math.round(m/r.numSamplesForPreview):Math.round(m/h.length),cache:l}},o),{...t}}catch(w){return s(w)?null:u}}function S(e){return new v({priority:P.ELEVATION_PROFILE,concurrency:1,scheduler:e,process:async e=>{r(e.parameters);try{await U(e)}catch(t){n(t)}}})}async function U({geometry:e,provider:t,indices:r,preview:n,result:o,parameters:s}){if(0===r.length)return;const i=(await b(t,e,s)).geometry,{hasZ:l,points:a}=i,c=s.noDataValue,{samples:u}=o;for(let p=0;p<r.length;p++){const e=u[r[p]];if(e.isHole)continue;const t=l?a[p][2]:null;null===t||t===c?e.sampledZ=null:(o.hasZ=!0,e.sampledZ=t),e.sampled=!0}x(u),o.progress=n?0:o.progress+r.length/u.length,o.statistics=w(o.samples,o.spatialReference)}function x(e){const t=e.length-1;let r=0;for(let n=1;n<=t;n++){(e[n].sampled||n===t)&&(E(e,r,n),r=n)}}function E(e,r,n){if(n-r===1)return;const o=e[r],s=o.sampledZ,i=e[n],l=i.sampledZ;if(null==s||null==l){for(let t=r+1;t<n;t++)e[t].sampledZ=null;return}const a=o.distance,c=i.distance-a;for(let u=r+1;u<n;u++){const r=e[u],n=(r.distance-a)/c;r.sampledZ=t(s,l,n)}}function M({densifiedPath:e,distances:t}){const r=e.spatialReference,n=a(r),o=e.paths,s=o.length,i=[];let c=null,u=0;for(let a=0;a<s;a++){const e=o[a],r=e.length,s=t[a];for(let t=0;t<r;t++){const r=e[t],o=s[t];n&&(r[0]=l(r[0],n.valid[0],n.valid[1])),c&&0===t&&A(i,c,r,u,o),i.push(O(r,o)),c=r,u=o}}return{progress:0,samples:i,hasZ:!1,statistics:null,spatialReference:r}}function A(e,t,r,n,o){e.push(T(t,n)),e.push(T(r,o))}function O(e,t){return{coordinate:e,distance:t,sampledZ:null,sampled:!1,isHole:!1}}function T(e,t){return{coordinate:e,distance:t,sampledZ:null,sampled:!0,isHole:!0}}async function b(e,t,r){try{return await e.queryElevation(t,r)}catch(n){throw new m}}function F(e,t,r){if(!e||0===e.length)return;const n=e.length-1,o=e[0];if(t<=r(o))return o;const s=e[n];if(t>=r(s))return s;let i=0,l=0,a=n;for(;i<a;){l=i+Math.floor((a-i)/2);const o=e[l],s=r(o);if(s===t)return o;if(t<s){if(l>0){const n=e[l-1],i=r(n);if(t>i)return t-i>=s-t?o:n}a=l}else{if(l<n){const n=e[l+1],i=r(n);if(t<i)return t-s>=i-t?n:o}i=l+1}}return e[l]}function H(e){return e>.999999?1:e}export{F as binaryFindClosest,S as createProfileQueue,R as generateProfile,j as generateProfiles,x as interpolateElevations,H as sanitizeProgress};