@arcgis/core 4.33.0-next.20250423 → 4.33.0-next.20250425

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 (294) hide show
  1. package/Graphic.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/analysis/Analysis.d.ts +4 -0
  4. package/analysis/Analysis.js +1 -1
  5. package/analysis/SliceAnalysis.js +1 -1
  6. package/analysis/SlicePlane.js +1 -1
  7. package/analysis/support/AnalysisOriginWebScene.d.ts +4 -0
  8. package/analysis/support/AnalysisOriginWebScene.js +5 -0
  9. package/analysis/support/SliceAnalysisExcludedLayer.js +5 -0
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/{d4d011eea16a89a5aad9.js → 0219c3f9408d3fa3c9a0.js} +1 -1
  12. package/assets/esri/core/workers/chunks/070839cb71c8e764b8d7.js +1 -0
  13. package/assets/esri/core/workers/chunks/19084a293694c5a00cae.js +1 -0
  14. package/assets/esri/core/workers/chunks/{8ba7d44eff348004f084.js → 1a6d2d090b643a87408a.js} +1 -1
  15. package/assets/esri/core/workers/chunks/1b8cc83aa1179245b2dc.js +1 -0
  16. package/assets/esri/core/workers/chunks/{5e5225623977e61fd0ef.js → 213adc87c843d627c5d6.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{fa8a3c75f9b41d31559b.js → 265f69d153b7b6f07e42.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{769b66cca8347f0f84db.js → 279bbd61b32577693a4a.js} +1 -1
  19. package/assets/esri/core/workers/chunks/290b065b377f9d2ee058.js +1 -0
  20. package/assets/esri/core/workers/chunks/29d3245261a7223124ed.js +1 -0
  21. package/assets/esri/core/workers/chunks/2bed8a5ed9ae3760fa2f.js +1 -0
  22. package/assets/esri/core/workers/chunks/2e3019ce49e972a815ca.js +1 -0
  23. package/assets/esri/core/workers/chunks/335b539893569e3d7b82.js +1 -0
  24. package/assets/esri/core/workers/chunks/38f5e6a202ce292edd9f.js +1 -0
  25. package/assets/esri/core/workers/chunks/415903f481392c72870f.js +1 -0
  26. package/assets/esri/core/workers/chunks/4351b3e54b309935faed.js +1 -0
  27. package/assets/esri/core/workers/chunks/4da99f058cca83937e9b.js +1 -0
  28. package/assets/esri/core/workers/chunks/5acdd49c5f1a49fdc6e7.js +1 -0
  29. package/assets/esri/core/workers/chunks/60f7cd05e88701f43d3f.js +1 -0
  30. package/assets/esri/core/workers/chunks/{26e0a0a13060cd3e4291.js → 626ba3a7dee952308566.js} +1 -1
  31. package/assets/esri/core/workers/chunks/7cd32b10ed0e18e44ef2.js +1 -0
  32. package/assets/esri/core/workers/chunks/9661ee8569ee208e6237.js +1 -0
  33. package/assets/esri/core/workers/chunks/968f2f841c011095a6d2.js +1 -0
  34. package/assets/esri/core/workers/chunks/974742af7beb000c4b4a.js +1 -0
  35. package/assets/esri/core/workers/chunks/{e27fa1e84f16b7f19a90.js → 9850ff14bd9c7da81c65.js} +1 -1
  36. package/assets/esri/core/workers/chunks/a0c51c4c30a5f749dfc6.js +1 -0
  37. package/assets/esri/core/workers/chunks/a2676f3f135ad5fdf872.js +1 -0
  38. package/assets/esri/core/workers/chunks/a8430e1e2142f1ce9b92.js +1 -0
  39. package/assets/esri/core/workers/chunks/{fdcbd28f38bc485ac5e3.js → ab6ecd8eeec5ff761b34.js} +1 -1
  40. package/assets/esri/core/workers/chunks/b53300b46646cfad2526.js +319 -0
  41. package/assets/esri/core/workers/chunks/bf543bdec3da0fe278fb.js +1 -0
  42. package/assets/esri/core/workers/chunks/{5bdd5ae2d2f23ef6b331.js → c87e2a63b96e0da77dfe.js} +1 -1
  43. package/assets/esri/core/workers/chunks/cc4dd739c4c7e3ccea3f.js +1 -0
  44. package/assets/esri/core/workers/chunks/d3a74087e076a3ae76ca.js +1 -0
  45. package/assets/esri/core/workers/chunks/{7c42281188b874ffcdad.js → db5913824d5e5a2a8365.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{48a1bb1e171dd06a7c6e.js → dd94585508f49863dc15.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{9408a72968cbd985dd24.js → f2cef954b58c6604642c.js} +34 -34
  48. package/assets/esri/core/workers/chunks/f52e597dca4b32a81881.js +1 -0
  49. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  50. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  51. package/chunks/BloomBlur.glsl.js +7 -7
  52. package/chunks/BloomComposition.glsl.js +24 -25
  53. package/chunks/ShadowCastAccumulate.glsl.js +13 -9
  54. package/chunks/ShadowCastVisualize.glsl.js +24 -9
  55. package/chunks/cameraUtilsSpherical.js +1 -1
  56. package/chunks/lyr3DMain.js +1 -1
  57. package/chunks/lyr3DWorker.js +1 -1
  58. package/chunks/sphere.js +1 -1
  59. package/core/Collection.js +1 -1
  60. package/core/JSONSupport.js +1 -1
  61. package/core/SetUtils.js +1 -1
  62. package/{views/webgl/GLObjectType.js → core/support/jsonUtils.js} +1 -1
  63. package/core/urlUtils.js +1 -1
  64. package/geometry/Mesh.js +1 -1
  65. package/geometry/support/normalizeUtilsSync.js +1 -1
  66. package/geometry/support/sphere.js +1 -1
  67. package/interfaces.d.ts +544 -116
  68. package/layers/DimensionLayer.js +1 -1
  69. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  70. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  71. package/layers/ParquetLayer.js +1 -1
  72. package/layers/RouteLayer.js +1 -1
  73. package/layers/SubtypeGroupLayer.js +1 -1
  74. package/layers/ViewshedLayer.js +1 -1
  75. package/layers/graphics/data/QueryEngine.js +1 -1
  76. package/layers/mixins/ImageryTileMixin.js +1 -1
  77. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  78. package/layers/orientedImagery/transformations/utils.js +1 -1
  79. package/layers/support/FieldsIndex.js +1 -1
  80. package/layers/support/ParquetEncodingLocation.d.ts +4 -0
  81. package/layers/support/ParquetEncodingLocation.js +1 -1
  82. package/layers/support/ParquetEncodingWkb.d.ts +4 -0
  83. package/layers/support/ParquetEncodingWkb.js +1 -1
  84. package/layers/support/RasterStorageInfo.js +1 -1
  85. package/layers/support/VideoElement.js +1 -1
  86. package/layers/support/layerUtils.js +1 -1
  87. package/layers/support/parquetUtils.d.ts +3 -0
  88. package/layers/support/parquetUtils.js +1 -1
  89. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  90. package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
  91. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  92. package/layers/support/rasterDatasets/RawBlockCache.js +1 -1
  93. package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
  94. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  95. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  96. package/layers/support/rasterFormats/{TiffTags.js → tiffTag.js} +1 -1
  97. package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
  98. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  99. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  100. package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
  101. package/layers/support/rasterFunctions/RemapFunction.js +1 -1
  102. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  103. package/layers/support/videoUtils.js +5 -0
  104. package/package.json +2 -2
  105. package/portal/schemas/definitions.js +1 -1
  106. package/portal/schemas/integratedMesh3DTilesLayerItem.js +1 -1
  107. package/renderers/UniqueValueRenderer.js +1 -1
  108. package/renderers/support/colorRampUtils.js +1 -1
  109. package/support/revision.js +1 -1
  110. package/symbols/IconSymbol3DLayer.js +1 -1
  111. package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
  112. package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
  113. package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
  114. package/views/2d/engine/webgl/textureUtils.js +1 -1
  115. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  116. package/views/2d/layers/MediaLayerView2D.js +1 -1
  117. package/views/2d/layers/TileLayerView2D.js +1 -1
  118. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  119. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  120. package/views/2d/layers/support/DebugOverlay.js +1 -1
  121. package/views/2d/layers/support/MediaLayerInteraction.js +1 -1
  122. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  123. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  124. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  125. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  126. package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
  127. package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
  128. package/views/3d/analysis/Viewshed/ViewshedAnalysisVisualization.js +1 -1
  129. package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
  130. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  131. package/views/3d/camera/constraintUtils/distance.js +1 -1
  132. package/views/3d/camera/intersectionUtils.js +1 -1
  133. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  134. package/views/3d/environment/atmosphereUtils.js +1 -1
  135. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  136. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  137. package/views/3d/interactive/visualElements/EngineVisualElement.js +1 -1
  138. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  139. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  140. package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
  141. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  142. package/views/3d/interactive/visualElements/MarkerVisualElement.js +1 -1
  143. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  144. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  145. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  146. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  147. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  148. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  149. package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
  150. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  151. package/views/3d/interactive/visualElements/ViewshedShapeVisualElement.js +1 -1
  152. package/views/3d/interactive/visualElements/VisualElement.js +1 -1
  153. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  154. package/views/3d/layers/I3SMeshView3D.js +1 -1
  155. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  156. package/views/3d/layers/Lyr3DWorker.js +1 -1
  157. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  158. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  159. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  160. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  161. package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
  162. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  163. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  164. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  165. package/views/3d/layers/graphics/pipeline/symbolization/Factory.js +5 -0
  166. package/views/3d/layers/graphics/pipeline/symbolization/SimpleFeatureRenderer.js +5 -0
  167. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  168. package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
  169. package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
  170. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  171. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  172. package/views/3d/state/ConstraintsManager.js +1 -1
  173. package/views/3d/state/NearFarHeuristic.js +1 -1
  174. package/views/3d/state/ViewState.js +1 -1
  175. package/views/3d/state/ViewStateManager.js +1 -1
  176. package/views/3d/state/utils/navigationUtils.js +1 -1
  177. package/views/3d/support/cameraUtilsSpherical.js +1 -1
  178. package/views/3d/support/geometryUtils/sphere.js +1 -1
  179. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  180. package/views/3d/webgl/ManagedDepthTexture.js +1 -1
  181. package/views/3d/webgl/ManagedFBO.js +1 -1
  182. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  183. package/views/3d/webgl-engine/core/FBOCacheFormats.js +5 -0
  184. package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +12 -20
  185. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +1 -1
  186. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendColorsPremultiplied.glsl.js +5 -0
  187. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  188. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  189. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  190. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  191. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  192. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  193. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  194. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  195. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  196. package/views/3d/webgl-engine/lib/DepthRange.js +1 -1
  197. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  198. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  199. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  200. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  201. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  202. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  203. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  204. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  205. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  206. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  207. package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
  208. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
  209. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +5 -0
  210. package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
  211. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
  212. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +1 -1
  213. package/views/PopupView.js +1 -1
  214. package/views/SceneView.js +1 -1
  215. package/views/SelectionManager.js +1 -1
  216. package/views/VideoView.js +1 -1
  217. package/views/analysis/analysisViewUtils.js +1 -1
  218. package/views/input/InputManager.js +1 -1
  219. package/views/input/ViewEvents.js +1 -1
  220. package/views/support/selectionUtils.js +1 -1
  221. package/views/webgl/FBOAttachmentType.js +5 -0
  222. package/views/webgl/FramebufferObject.js +1 -1
  223. package/views/webgl/Renderbuffer.js +1 -1
  224. package/views/webgl/RenderbufferDescriptor.js +1 -1
  225. package/views/webgl/Texture.js +1 -1
  226. package/views/webgl/TextureDescriptor.js +1 -1
  227. package/views/webgl/textureUtils.js +1 -1
  228. package/webscene/InitialViewProperties.js +1 -1
  229. package/webscene/Presentation.js +1 -1
  230. package/webscene/Slide.js +1 -1
  231. package/webscene/SlideLegendInfo.js +1 -1
  232. package/webscene/background/ColorBackground.js +1 -1
  233. package/webscene/spec-certification/api.js +1 -1
  234. package/webscene/spec-certification/compare.js +1 -1
  235. package/webscene/spec-certification/index.js +1 -1
  236. package/webscene/spec-certification/spec.js +1 -1
  237. package/webscene/spec-certification/utils.js +1 -1
  238. package/webscene/support/Description.js +1 -1
  239. package/webscene/support/SlideElements.js +1 -1
  240. package/webscene/support/SlideEnvironment.js +1 -1
  241. package/webscene/support/SlideGround.js +1 -1
  242. package/webscene/support/SlideVisibleLayer.js +1 -1
  243. package/webscene/support/Title.js +1 -1
  244. package/webscene/support/analysisUtils.js +5 -0
  245. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  246. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  247. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  248. package/widgets/Editor/EditorViewModel.js +1 -1
  249. package/widgets/Editor/UpdateWorkflow.js +1 -1
  250. package/widgets/Editor/support/SketchController.js +5 -0
  251. package/widgets/Editor/workflowUtils.js +1 -1
  252. package/widgets/ElevationProfile/ElevationProfileInteraction.js +1 -1
  253. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  254. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  255. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  256. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  257. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  258. package/widgets/FeatureTable.js +1 -1
  259. package/widgets/LayerList/LayerListItem.js +1 -1
  260. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  261. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  262. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  263. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  264. package/widgets/ShadowCast/ThresholdOptions.js +1 -1
  265. package/widgets/Sketch/SketchViewModel.js +1 -1
  266. package/widgets/VideoPlayer.js +1 -1
  267. package/widgets/Widget.js +1 -1
  268. package/widgets/support/AnalysisViewModel.js +1 -1
  269. package/widgets/support/SelectionList.js +1 -1
  270. package/widgets/support/SnappingControls.js +1 -1
  271. package/assets/esri/core/workers/chunks/184d7c8ea818bec5c462.js +0 -1
  272. package/assets/esri/core/workers/chunks/22f604726529ee6f8c25.js +0 -1
  273. package/assets/esri/core/workers/chunks/244d2196bac5ef279436.js +0 -1
  274. package/assets/esri/core/workers/chunks/26fcbe053194bd78fcc3.js +0 -1
  275. package/assets/esri/core/workers/chunks/32f2e0c88046b39916cc.js +0 -1
  276. package/assets/esri/core/workers/chunks/388a763da712ca71ccf4.js +0 -1
  277. package/assets/esri/core/workers/chunks/4f8782b3b6ad414409e8.js +0 -1
  278. package/assets/esri/core/workers/chunks/5ffc3ca6c6a4d32e1282.js +0 -1
  279. package/assets/esri/core/workers/chunks/642a595353a86f3717e3.js +0 -1
  280. package/assets/esri/core/workers/chunks/8dd26b12c625d20196ed.js +0 -319
  281. package/assets/esri/core/workers/chunks/931275cfa2c55eb0f504.js +0 -1
  282. package/assets/esri/core/workers/chunks/93e9dfd1ba8f393c6c47.js +0 -1
  283. package/assets/esri/core/workers/chunks/95379fdd6917c8a84c71.js +0 -1
  284. package/assets/esri/core/workers/chunks/9b21dc4659922cc577cb.js +0 -1
  285. package/assets/esri/core/workers/chunks/a197c86d42cc9ce21924.js +0 -1
  286. package/assets/esri/core/workers/chunks/a276980c06d5d311a37e.js +0 -1
  287. package/assets/esri/core/workers/chunks/b42ecc7c3eb2fd8d1308.js +0 -1
  288. package/assets/esri/core/workers/chunks/ccc50f28f217e50cc2c3.js +0 -1
  289. package/assets/esri/core/workers/chunks/d04efa51da9b4eb3a8a7.js +0 -1
  290. package/assets/esri/core/workers/chunks/d81bebbb6fe000200d35.js +0 -1
  291. package/assets/esri/core/workers/chunks/dd8e72d6784a8ebc115d.js +0 -1
  292. package/assets/esri/core/workers/chunks/e9fba86036b8fe700a41.js +0 -1
  293. package/assets/esri/core/workers/chunks/ed3d1d0465f4a4d8df4a.js +0 -1
  294. package/views/webgl/formats.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as r,g as a,v as o,t as h}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as n}from"./textureUtils.js";import{ViewshedFaceCamera as l}from"./ViewshedFaceCamera.js";import{FramebufferBit as u}from"../../../webgl/enums.js";import{ColorFormat as f,DepthFormat as m}from"../../../webgl/formats.js";class d{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(t){const e=t?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*e}textureResizeModulo(t){return Math.ceil(t/this.textureSizeMultiple)*this.textureSizeMultiple}}const p=["front","left","right","back","top","bottom"];function g(t){return!["top","bottom"].includes(t)}class _{constructor(t){this._fbos=t,this._faces={},this._width=0,this._height=0,this.settings=new d,this._maxTextureSize=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}get depthTexture(){return this._handle?.getTexture()}get ready(){return null!=this.depthTexture&&0!==this._width&&0!==this._height}get nearFar(){const t=this.faces;return 0===t.length?null:t[0].nearFar}get numActiveFaces(){const t=this._faces;let e=0;return Object.keys(t).forEach((i=>{t[i]&&(e+=1)})),e}get faces(){const t=this._faces,e=[];for(const i of p){const s=t[i];s&&e.push(s)}return e}get atlasRegions(){return this.faces.map((t=>[t.x/this._width,(t.x+t.width)/this._width,t.y/this._height,(t.y+t.height)/this._height]))}get viewshedProjectionMatrices(){return this.faces.map((t=>t.projectionMatrix))}get viewshedViewMatrices(){return this.faces.map((t=>t.viewMatrix))}_setupFaceCamera(e,n,u,f){const{effectiveObserverRenderSpace:m,tiltedUpVector:d,targetRenderSpace:p,farDistanceRenderSpace:_,horizontalFieldOfView:x,verticalFieldOfView:b}=n,w=c();r(w,p,m);const M=c(),S=c(),z=(t,e)=>{const r=c(),o=s();return i(o,t,e),h(r,w,o),a(r,m,r),r};let F,T=d;const v=Math.min(90,x),j=Math.min(90,Math.max(0,(x-90)/2));let B=-45,O=45,R=-45,y=45;if(g(e)){const e=e=>t(e,-45,45);R=e(-b/2)-this.settings.toleranceBottomTop,y=e(+b/2)+this.settings.toleranceBottomTop}switch(e){case"front":F=p,B=-v/2,O=v/2;break;case"left":F=z(Math.PI/2,d),B=45-j;break;case"right":F=z(-Math.PI/2,d),O=-45+j;break;case"top":F=a(M,m,d),T=o(S,w);break;case"bottom":F=r(M,m,d),T=w;break;case"back":F=z(Math.PI,d)}const E=new l({center:F,eye:m,up:T,far:_});E.sectionAnglesDeg=[B-this.settings.toleranceSides,O+this.settings.toleranceSides,R,y],E.fovY=Math.PI/2;const k=E.setViewport(u,f);return this._faces[e]=E,k}isActive(t){return this._computeActiveFaces(t).size>0}_computeActiveFaces(t){const e=new Set,{horizontalFieldOfView:i,verticalFieldOfView:s}=t,r=-s/2,a=s/2;return 0===i||0===s||(r<=45&&a>=-45&&e.add("front"),i>90&&(e.add("left"),e.add("right")),i>270&&e.add("back"),a>45-this.settings.toleranceBottomTop&&e.add("top"),r<-45+this.settings.toleranceBottomTop&&e.add("bottom")),e}_computeBaseTextureSize({pixelRatio:t,fullWidth:e,fullHeight:i},s,r,a){const o=s/t,h=this.settings.textureSizeModifier(r);return n(Math.max(e,i)*o*h,this._maxTextureSize/a)}_ensureFBO(t){const e=this._width,i=this._height;this._handle?.fbo?.width===e&&this._handle?.fbo?.height===i||(this._handle?.release(),this._handle=this._fbos.acquire(e,i,"viewshed shadow map",f.RGBA4));const s=t?m.DEPTH24_STENCIL8_TEXTURE:m.DEPTH16_RENDERBUFFER;this._handle.acquireDepth(s)}clearFBO(t){const e=this._fbos.rctx;this._ensureFBO(t),e.bindFramebuffer(this._handle?.fbo),e.setClearColor(1,1,1,1),e.clear(u.COLOR|u.DEPTH)}dispose(){this._handle=this._debugFBO?this._handle:e(this._handle)}start(t,e,i,s,r=!1){this._faces={};const a=this._computeActiveFaces(e),o=a.size;if(0===o)return!1;const h=this._computeBaseTextureSize(t,s,i,o);let c=0,n=0,l=0;return p.filter((t=>a.has(t))).forEach((t=>{const i=x(t,o);i>n&&(l=Math.max(l,c),c=0),n=i;const s=i*h;c+=this._setupFaceCamera(t,e,[c,s],h)})),l=Math.max(l,c),this._width=this.settings.textureResizeModulo(l),this._height=b(o)*h,this.clearFBO(r),!0}finish(){this._handle?.detachDepth()}get test(){}}function x(t,e){if(e<4)return 0;const i="front"===t||"left"===t;return 4===e?i?0:1:i||"right"===t?0:1}function b(t){return t<4?1:2}export{_ as ViewshedShadowMap};
5
+ import has from"../../../../core/has.js";import{clamp as t}from"../../../../core/mathUtils.js";import{releaseMaybe as e}from"../../../../core/maybe.js";import{fromRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as r,g as a,v as o,t as h}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ColorFormat as n,DepthTextureFormat as l,DepthRenderbufferFormat as u}from"../core/FBOCacheFormats.js";import{applyTextureResizeModulo as m}from"./textureUtils.js";import{ViewshedFaceCamera as f}from"./ViewshedFaceCamera.js";import{FramebufferBit as d}from"../../../webgl/enums.js";class p{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(t){const e=t?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*e}textureResizeModulo(t){return Math.ceil(t/this.textureSizeMultiple)*this.textureSizeMultiple}}const g=["front","left","right","back","top","bottom"];function _(t){return!["top","bottom"].includes(t)}class x{constructor(t){this._fbos=t,this._faces={},this._width=0,this._height=0,this.settings=new p,this._maxTextureSize=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}get depthTexture(){return this._handle?.getTexture()}get ready(){return null!=this.depthTexture&&0!==this._width&&0!==this._height}get nearFar(){const t=this.faces;return 0===t.length?null:t[0].nearFar}get numActiveFaces(){const t=this._faces;let e=0;return Object.keys(t).forEach((i=>{t[i]&&(e+=1)})),e}get faces(){const t=this._faces,e=[];for(const i of g){const s=t[i];s&&e.push(s)}return e}get atlasRegions(){return this.faces.map((t=>[t.x/this._width,(t.x+t.width)/this._width,t.y/this._height,(t.y+t.height)/this._height]))}get viewshedProjectionMatrices(){return this.faces.map((t=>t.projectionMatrix))}get viewshedViewMatrices(){return this.faces.map((t=>t.viewMatrix))}_setupFaceCamera(e,n,l,u){const{effectiveObserverRenderSpace:m,tiltedUpVector:d,targetRenderSpace:p,farDistanceRenderSpace:g,horizontalFieldOfView:x,verticalFieldOfView:b}=n,M=c();r(M,p,m);const w=c(),S=c(),z=(t,e)=>{const r=c(),o=s();return i(o,t,e),h(r,M,o),a(r,m,r),r};let F,v=d;const T=Math.min(90,x),O=Math.min(90,Math.max(0,(x-90)/2));let j=-45,B=45,y=-45,k=45;if(_(e)){const e=e=>t(e,-45,45);y=e(-b/2)-this.settings.toleranceBottomTop,k=e(+b/2)+this.settings.toleranceBottomTop}switch(e){case"front":F=p,j=-T/2,B=T/2;break;case"left":F=z(Math.PI/2,d),j=45-O;break;case"right":F=z(-Math.PI/2,d),B=-45+O;break;case"top":F=a(w,m,d),v=o(S,M);break;case"bottom":F=r(w,m,d),v=M;break;case"back":F=z(Math.PI,d)}const R=new f({center:F,eye:m,up:v,far:g});R.sectionAnglesDeg=[j-this.settings.toleranceSides,B+this.settings.toleranceSides,y,k],R.fovY=Math.PI/2;const C=R.setViewport(l,u);return this._faces[e]=R,C}isActive(t){return this._computeActiveFaces(t).size>0}_computeActiveFaces(t){const e=new Set,{horizontalFieldOfView:i,verticalFieldOfView:s}=t,r=-s/2,a=s/2;return 0===i||0===s||(r<=45&&a>=-45&&e.add("front"),i>90&&(e.add("left"),e.add("right")),i>270&&e.add("back"),a>45-this.settings.toleranceBottomTop&&e.add("top"),r<-45+this.settings.toleranceBottomTop&&e.add("bottom")),e}_computeBaseTextureSize({pixelRatio:t,fullWidth:e,fullHeight:i},s,r,a){const o=s/t,h=this.settings.textureSizeModifier(r);return m(Math.max(e,i)*o*h,this._maxTextureSize/a)}_ensureFBO(t){const e=this._width,i=this._height;this._handle?.fbo?.width===e&&this._handle?.fbo?.height===i||(this._handle?.release(),this._handle=this._fbos.acquire(e,i,"viewshed shadow map",n.RGBA4UNORM));const s=t?l.DEPTH24_STENCIL8:u.DEPTH16;this._handle.acquireDepth(s)}clearFBO(t){const e=this._fbos.rctx;this._ensureFBO(t),e.bindFramebuffer(this._handle?.fbo),e.setClearColor(1,1,1,1),e.clear(d.COLOR|d.DEPTH)}dispose(){this._handle=this._debugFBO?this._handle:e(this._handle)}start(t,e,i,s,r=!1){this._faces={};const a=this._computeActiveFaces(e),o=a.size;if(0===o)return!1;const h=this._computeBaseTextureSize(t,s,i,o);let c=0,n=0,l=0;return g.filter((t=>a.has(t))).forEach((t=>{const i=b(t,o);i>n&&(l=Math.max(l,c),c=0),n=i;const s=i*h;c+=this._setupFaceCamera(t,e,[c,s],h)})),l=Math.max(l,c),this._width=this.settings.textureResizeModulo(l),this._height=M(o)*h,this.clearFBO(r),!0}finish(){this._handle?.detachDepth()}get test(){}}function b(t,e){if(e<4)return 0;const i="front"===t||"left"===t;return 4===e?i?0:1:i||"right"===t?0:1}function M(t){return t<4?1:2}export{x as ViewshedShadowMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/PooledArray.js";import{multiply as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as n}from"../../../../chunks/vec32.js";import{l as i}from"../../../../chunks/vec42.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as a}from"../../../../geometry/support/frustum.js";import{a as o,g as h,c as f}from"../../../../chunks/sphere.js";import{maxScale as c}from"../../support/mathUtils.js";import{DepthRange as l}from"./DepthRange.js";import u from"./Octree.js";import{assert as d}from"./Util.js";var _;!function(e){e[e.SHADOW_CASTERS=0]="SHADOW_CASTERS",e[e.FULL_SCENE=1]="FULL_SCENE"}(_||(_={}));const m=1e4,g=100,p=500,b=500,C=.1;function R(e,t,r,n=_.SHADOW_CASTERS){let i=0;if(!t.some((e=>!!e.material&&(i+=e.numGeometries,i>=m))))return y.compute(e,t,n);const s=new l;return r.forAll((t=>s.union(A(e,t)))),s}function A(e,t){if(!t.visible)return;const r=new l,n=t.getSpatialQueryAccelerator();return n?O(r,e,n):w(r,e,t.objects),r}function O(e,t,r){const{eye:n,viewForward:i,frustum:s}=t,a=e=>e.visible,o=r.objectCount;if(o<p)P.set(t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(n,i,u.DepthOrder.FRONT_TO_BACK,P,((r,n)=>{j(e,t,r),P.far=e.near,n.setRange(P)}),s,a),P.set(Math.max(e.far,t.near),t.far),r.forEachInDepthRange(n,i,u.DepthOrder.BACK_TO_FRONT,P,((r,n)=>{j(e,t,r),P.near=e.far,n.setRange(P)}),s,a);else{const n=Math.max(Math.min(o,b),Math.ceil(o*C)),h=r.findClosest(i,u.DepthOrder.FRONT_TO_BACK,s,a,n),f=r.findClosest(i,u.DepthOrder.BACK_TO_FRONT,s,a,n);h&&f&&(S(e,t,h.boundingVolumeWorldSpace.bounds),S(e,t,f.boundingVolumeWorldSpace.bounds))}}function w(e,t,r){W.clear(),r.forAll((e=>{e.visible&&0!==e.geometries.length&&W.add(e)})),W.empty||(W.sort(t),P.set(t.near,Math.min(e.near,t.far)),W.forEachInDepthRange(P,u.DepthOrder.FRONT_TO_BACK,((r,n)=>{n<e.near&&j(e,t,r)})),P.set(Math.max(e.far,t.near),t.far),W.forEachInDepthRange(P,u.DepthOrder.BACK_TO_FRONT,((t,r,n)=>{e.far=Math.max(e.far,n)})))}function j(e,r,n){if(!n.visible)return;if(!a(r.frustum,n.boundingVolumeWorldSpace.bounds))return;const i=n.transformation,s=N;n.geometries.forEach((n=>{t(s,i,n.transformation);const a=c(s);M(e,r,n.boundingInfo,s,a)}))}function M(e,t,r,i,s){if(null==r)return;n(o(I),r.center,i);const{eye:h,viewForward:f}=t,c=f[0]*(I[0]-h[0])+f[1]*(I[1]-h[1])+f[2]*(I[2]-h[2]);if(I[3]=r.radius*s,!(c-I[3]>e.near&&c+I[3]<e.far)&&a(t.frustum,I))if(r.radius>g&&r.getChildren())for(const n of r.getChildren())M(e,t,n,i,s);else K.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,i,r.bbMin,r.bbMax)}function S(e,t,r){const n=t.eye,i=t.viewForward,s=(r[0]-n[0])*i[0]+(r[1]-n[1])*i[1]+(r[2]-n[2])*i[2];e.near=Math.min(e.near,s-r[3]),e.far=Math.max(e.far,s+r[3])}class v{constructor(){this._items=new e({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e){this._items.pushNew().object=e}sort(e){const t=e.eye,r=e.viewForward;this._items.forAll((e=>{const n=e.object.boundingVolumeWorldSpace.bounds,i=(n[0]-t[0])*r[0]+(n[1]-t[1])*r[1]+(n[2]-t[2])*r[2];e.distance=i,e.near=i-n[3],e.far=i+n[3]})),this._items.sort(((e,t)=>e.distance-t.distance))}forEachInDepthRange(e,t,r){if(t===u.DepthOrder.FRONT_TO_BACK)for(let n=0;n<this._items.length;++n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}else for(let n=this._items.length-1;n>=0;--n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}}}class B{constructor(){this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange=new l(0,0)}compute(e,t,r){this._reset();const{viewMatrix:n}=e;t.forAll((e=>{e.forEachGeometry((e=>{if(!e.visible||r===_.SHADOW_CASTERS&&!e.castShadow)return;const t=e.boundingSphere,i=n[2]*t[0]+n[6]*t[1]+n[10]*t[2]+n[14],s=i-t[3],a=i+t[3];this._geometries.push(e),this._near.push(-a),this._far.push(-s)}))}));const i=new l;if(0===this._geometries.length)return i;for(let h=0;h<this._geometries.length;++h)this._near[h]>i.far&&(i.far=this._near[h]),this._near[h]>2&&this._far[h]<i.near&&(i.near=this._far[h]);const s=this._looseRange;s.near=Math.max(.5*i.near,2),s.far=2*i.far;let a=0,o=0;for(let h=0;h<this._geometries.length;++h)this._near[h]<i.near&&(this._near[h]>=s.near?i.near=this._near[h]:this._nearCandidates[a++]=h),this._far[h]>i.far&&(this._far[h]<=s.far?i.far=this._far[h]:this._farCandidates[o++]=h);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return i;this._nearCandidates.sort(((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0)),this._farCandidates.sort(((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0));for(let h=0;h<this._nearCandidates.length;++h){const t=this._nearCandidates[h];if(this._near[t]<i.near){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:s}=r;this._includeNearBoundingInfoRec(e,n,s,i)}}for(let h=0;h<this._farCandidates.length;++h){const t=this._farCandidates[h];if(this._far[t]>i.far){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:s}=r;this._includeFarBoundingInfoRec(e,n,s,i)}}return this._reset(),i}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_isOutsideSidePlanes(e,t){const r=o(e),n=h(e);return t[0][0]*r[0]+t[0][1]*r[1]+t[0][2]*r[2]+t[0][3]>n||t[1][0]*r[0]+t[1][1]*r[1]+t[1][2]*r[2]+t[1][3]>n||t[2][0]*r[0]+t[2][1]*r[1]+t[2][2]*r[2]+t[2][3]>n||t[3][0]*r[0]+t[3][1]*r[1]+t[3][2]*r[2]+t[3][3]>n}_includeNearBoundingInfoRec(e,t,r,i){if(null==t)return;const s=t.center;n(o(I),s,r),I[3]=t.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(I,a))return;const h=I[0],f=I[1],l=I[2],u=I[3],{viewMatrix:d}=e,_=d[2]*h+d[6]*f+d[10]*l+d[14],m=_+u;if(!(-(_-u)<2||-m>=i.near))if(-m>this._looseRange.near)i.near=-m;else{if(u>g){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeNearBoundingInfoRec(e,t,r,i);return}}K.unionDepthRangeWithAABB(i,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}_includeFarBoundingInfoRec(e,t,r,i){if(null==t)return;const s=t.center;n(o(I),s,r),I[3]=t.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(I,a))return;const[h,f,l,u]=I,{viewMatrix:d}=e,_=d[2]*h+d[6]*f+d[10]*l+d[14]-u;if(!(-_<=i.far))if(-_<this._looseRange.far)i.far=-_;else{if(u>g){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeFarBoundingInfoRec(e,t,r,i);return}}K.unionDepthRangeWithAABB(i,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}}class D{constructor(){this._modelViewProj=r(),this._clipPosition=[s(),s(),s(),s(),s(),s(),s(),s()]}unionDepthRangeWithAABB(e,r,n,i,s){const a=this._modelViewProj;t(a,r,n);let o=!1;for(let t=0;t<8;++t){const e=this._clipPosition[t],r=0===t||3===t||4===t||7===t?i[0]:s[0],n=0===t||1===t||4===t||5===t?i[1]:s[1],o=t<4?i[2]:s[2];e[0]=a[0]*r+a[4]*n+a[8]*o+a[12],e[1]=a[1]*r+a[5]*n+a[9]*o+a[13],e[2]=a[2]*r+a[6]*n+a[10]*o+a[14],e[3]=a[3]*r+a[7]*n+a[11]*o+a[15]}for(let t=0;t<12;++t){const r=x(this._clipPosition[E[t][0]],this._clipPosition[E[t][1]],this._clipPosition[E[t][2]]);let n=!0;for(let e=0;e<r.length;++e){if(r[e][3]>=2){n=!1;break}}if(!n){o=!0;for(let t=0;t<r.length;++t){const n=r[t][3];Number.isFinite(n)&&(e.near=Math.min(n,e.near),e.far=Math.max(n,e.far))}}}return o}}function x(e,t,r){let n=[e,t,r];for(let i=0;i<4;++i){const e=n;n=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];T(s,i)?(T(r,i)||n.push(F(r,s,i)),n.push(s)):T(r,i)&&n.push(F(r,s,i))}}return n}function T(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void d(!1)}function F(e,t,r){let n=0;return 0===r?n=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?n=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?n=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(n=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),i(s(),e,t,n)}const E=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],I=f(),N=r(),P=new l,W=new v,y=new B,K=new D;export{B as DepthRangeFromRenderGeometries,_ as DepthRangeMode,R as depthRangeFromScene};
5
+ import e from"../../../../core/PooledArray.js";import{multiply as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as n}from"../../../../chunks/vec32.js";import{l as i}from"../../../../chunks/vec42.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as a}from"../../../../geometry/support/frustum.js";import{a as o,g as h,c as f}from"../../../../chunks/sphere.js";import{maxScale as c}from"../../support/mathUtils.js";import{DepthRange as l}from"./DepthRange.js";import u from"./Octree.js";import{assert as d}from"./Util.js";var _;!function(e){e[e.SHADOW_CASTERS=0]="SHADOW_CASTERS",e[e.FULL_SCENE=1]="FULL_SCENE"}(_||(_={}));const m=1e4,g=100,p=500,b=500,C=.1;function R(e,t,r,n){let i=0;if(!t.some((e=>!!e.material&&(i+=e.numGeometries,i>=m))))return W.compute(e,t,n);const s=new l;return r.forAll((t=>s.union(w(e,t)))),s}function w(e,t){if(!t.visible)return;const r=new l,n=t.getSpatialQueryAccelerator();return n?A(r,e,n):O(r,e,t.objects),r}function A(e,t,r){const{eye:n,viewForward:i,frustum:s}=t,a=e=>e.visible,o=r.objectCount;if(o<p)P.set(t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(n,i,u.DepthOrder.FRONT_TO_BACK,P,((r,n)=>{j(e,t,r),P.far=e.near,n.setRange(P)}),s,a),P.set(Math.max(e.far,t.near),t.far),r.forEachInDepthRange(n,i,u.DepthOrder.BACK_TO_FRONT,P,((r,n)=>{j(e,t,r),P.near=e.far,n.setRange(P)}),s,a);else{const n=Math.max(Math.min(o,b),Math.ceil(o*C)),h=r.findClosest(i,u.DepthOrder.FRONT_TO_BACK,s,a,n),f=r.findClosest(i,u.DepthOrder.BACK_TO_FRONT,s,a,n);h&&f&&(v(e,t,h.boundingVolumeWorldSpace.bounds),v(e,t,f.boundingVolumeWorldSpace.bounds))}}function O(e,t,r){y.clear(),r.forAll((e=>{e.visible&&0!==e.geometries.length&&y.add(e)})),y.empty||(y.sort(t),P.set(t.near,Math.min(e.near,t.far)),y.forEachInDepthRange(P,u.DepthOrder.FRONT_TO_BACK,((r,n)=>{n<e.near&&j(e,t,r)})),P.set(Math.max(e.far,t.near),t.far),y.forEachInDepthRange(P,u.DepthOrder.BACK_TO_FRONT,((t,r,n)=>{e.far=Math.max(e.far,n)})))}function j(e,r,n){if(!n.visible)return;if(!a(r.frustum,n.boundingVolumeWorldSpace.bounds))return;const i=n.transformation,s=N;n.geometries.forEach((n=>{t(s,i,n.transformation);const a=c(s);M(e,r,n.boundingInfo,s,a)}))}function M(e,t,r,i,s){if(null==r)return;n(o(I),r.center,i);const{eye:h,viewForward:f}=t,c=f[0]*(I[0]-h[0])+f[1]*(I[1]-h[1])+f[2]*(I[2]-h[2]);if(I[3]=r.radius*s,!(c-I[3]>e.near&&c+I[3]<e.far)&&a(t.frustum,I))if(r.radius>g&&r.getChildren())for(const n of r.getChildren())M(e,t,n,i,s);else K.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,i,r.bbMin,r.bbMax)}function v(e,t,r){const n=t.eye,i=t.viewForward,s=(r[0]-n[0])*i[0]+(r[1]-n[1])*i[1]+(r[2]-n[2])*i[2];e.near=Math.min(e.near,s-r[3]),e.far=Math.max(e.far,s+r[3])}class B{constructor(){this._items=new e({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e){this._items.pushNew().object=e}sort(e){const t=e.eye,r=e.viewForward;this._items.forAll((e=>{const n=e.object.boundingVolumeWorldSpace.bounds,i=(n[0]-t[0])*r[0]+(n[1]-t[1])*r[1]+(n[2]-t[2])*r[2];e.distance=i,e.near=i-n[3],e.far=i+n[3]})),this._items.sort(((e,t)=>e.distance-t.distance))}forEachInDepthRange(e,t,r){if(t===u.DepthOrder.FRONT_TO_BACK)for(let n=0;n<this._items.length;++n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}else for(let n=this._items.length-1;n>=0;--n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}}}class S{constructor(){this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange=new l(0,0)}compute(e,t,r){this._reset();const{viewMatrix:n}=e;t.forAll((e=>{e.forEachGeometry((e=>{if(!e.visible||r===_.SHADOW_CASTERS&&!e.castShadow)return;const t=e.boundingSphere,i=n[2]*t[0]+n[6]*t[1]+n[10]*t[2]+n[14],s=i-t[3],a=i+t[3];this._geometries.push(e),this._near.push(-a),this._far.push(-s)}))}));const i=new l;if(0===this._geometries.length)return i;for(let h=0;h<this._geometries.length;++h)this._near[h]>i.far&&(i.far=this._near[h]),this._near[h]>2&&this._far[h]<i.near&&(i.near=this._far[h]);const s=this._looseRange;s.near=Math.max(.5*i.near,2),s.far=2*i.far;let a=0,o=0;for(let h=0;h<this._geometries.length;++h)this._near[h]<i.near&&(this._near[h]>=s.near?i.near=this._near[h]:this._nearCandidates[a++]=h),this._far[h]>i.far&&(this._far[h]<=s.far?i.far=this._far[h]:this._farCandidates[o++]=h);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return i;this._nearCandidates.sort(((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0)),this._farCandidates.sort(((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0));for(let h=0;h<this._nearCandidates.length;++h){const t=this._nearCandidates[h];if(this._near[t]<i.near){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:s}=r;this._includeNearBoundingInfoRec(e,n,s,i)}}for(let h=0;h<this._farCandidates.length;++h){const t=this._farCandidates[h];if(this._far[t]>i.far){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:s}=r;this._includeFarBoundingInfoRec(e,n,s,i)}}return this._reset(),i}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_isOutsideSidePlanes(e,t){const r=o(e),n=h(e);return t[0][0]*r[0]+t[0][1]*r[1]+t[0][2]*r[2]+t[0][3]>n||t[1][0]*r[0]+t[1][1]*r[1]+t[1][2]*r[2]+t[1][3]>n||t[2][0]*r[0]+t[2][1]*r[1]+t[2][2]*r[2]+t[2][3]>n||t[3][0]*r[0]+t[3][1]*r[1]+t[3][2]*r[2]+t[3][3]>n}_includeNearBoundingInfoRec(e,t,r,i){if(null==t)return;const s=t.center;n(o(I),s,r),I[3]=t.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(I,a))return;const h=I[0],f=I[1],l=I[2],u=I[3],{viewMatrix:d}=e,_=d[2]*h+d[6]*f+d[10]*l+d[14],m=_+u;if(!(-(_-u)<2||-m>=i.near))if(-m>this._looseRange.near)i.near=-m;else{if(u>g){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeNearBoundingInfoRec(e,t,r,i);return}}K.unionDepthRangeWithAABB(i,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}_includeFarBoundingInfoRec(e,t,r,i){if(null==t)return;const s=t.center;n(o(I),s,r),I[3]=t.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(I,a))return;const[h,f,l,u]=I,{viewMatrix:d}=e,_=d[2]*h+d[6]*f+d[10]*l+d[14]-u;if(!(-_<=i.far))if(-_<this._looseRange.far)i.far=-_;else{if(u>g){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeFarBoundingInfoRec(e,t,r,i);return}}K.unionDepthRangeWithAABB(i,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}}class x{constructor(){this._modelViewProj=r(),this._clipPosition=[s(),s(),s(),s(),s(),s(),s(),s()]}unionDepthRangeWithAABB(e,r,n,i,s){const a=this._modelViewProj;t(a,r,n);let o=!1;for(let t=0;t<8;++t){const e=this._clipPosition[t],r=0===t||3===t||4===t||7===t?i[0]:s[0],n=0===t||1===t||4===t||5===t?i[1]:s[1],o=t<4?i[2]:s[2];e[0]=a[0]*r+a[4]*n+a[8]*o+a[12],e[1]=a[1]*r+a[5]*n+a[9]*o+a[13],e[2]=a[2]*r+a[6]*n+a[10]*o+a[14],e[3]=a[3]*r+a[7]*n+a[11]*o+a[15]}for(let t=0;t<12;++t){const r=D(this._clipPosition[E[t][0]],this._clipPosition[E[t][1]],this._clipPosition[E[t][2]]);let n=!0;for(let e=0;e<r.length;++e){if(r[e][3]>=2){n=!1;break}}if(!n){o=!0;for(let t=0;t<r.length;++t){const n=r[t][3];Number.isFinite(n)&&(e.near=Math.min(n,e.near),e.far=Math.max(n,e.far))}}}return o}}function D(e,t,r){let n=[e,t,r];for(let i=0;i<4;++i){const e=n;n=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];T(s,i)?(T(r,i)||n.push(F(r,s,i)),n.push(s)):T(r,i)&&n.push(F(r,s,i))}}return n}function T(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void d(!1)}function F(e,t,r){let n=0;return 0===r?n=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?n=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?n=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(n=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),i(s(),e,t,n)}const E=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],I=f(),N=r(),P=new l,y=new B,W=new S,K=new x;export{S as DepthRangeFromRenderGeometries,_ as DepthRangeMode,R as depthRangeFromScene};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import{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 p}from"../../../../core/reactiveUtils.js";import{addFrameTask as d}from"../../../../core/scheduling.js";import{Milliseconds as c}from"../../../../core/time.js";import{property as l}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{ViewingMode as _}from"../../../ViewingMode.js";import{ChapmanAtmosphere as g}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as w}from"../../environment/CloudsComposition.js";import{Fog as x}from"../../environment/Fog.js";import{LocalAtmosphere as v}from"../../environment/LocalAtmosphere.js";import j from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as y}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as b}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as R}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{BloomRenderNode as A}from"../effects/bloom/BloomRenderNode.js";import{ObjectAndLayerIDRenderNode as S}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as T}from"../effects/geometry/RenderOccludedRenderNode.js";import{Haze as O}from"../effects/haze/Haze.js";import{Highlight as U}from"../effects/highlight/Highlight.js";import{ShadowHighlight as q}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as D}from"../effects/magnifier/Magnifier.js";import{SMAA as L}from"../effects/smaa/SMAA.js";import{SSAO as M}from"../effects/ssao/SSAO.js";import{Stars as k}from"../effects/stars/Stars.js";import{RenderRequestType as E}from"../lib/basicInterfaces.js";import B from"../lib/CompositingHelper.js";import{GLMaterialRepository as F}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as H}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as W}from"../lib/Renderer.js";import{RenderingContext as G}from"../lib/RenderingContext.js";import{TextureRepository as N}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as z}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as I}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as P}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as K}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{RenderState as Y}from"../../../support/RenderState.js";let Z=class extends t{constructor(e){super(e),this.events=new r,this.waterTextures=new P,this.olidRenderHelper=C()?new H:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.bloom=null,this.test=null;const t=e.stage;try{this._initializeContext(t)}catch(o){return void console.error("Failed to initialize context",o)}const{memoryController:s}=t.view.resourceController;this.stippleTextures=I(this._rctx,s),this.markerTextures=z(this._rctx,s),this._techniques=new R(new b(this._rctx,t.viewingMode,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new N(t),this.addHandles(this._textures.events.on("changed",(e=>this.requestRender(e))));const i=new F(this._textures,this._techniques,(()=>this.requestRender()),(()=>this.requestRender()));this._compositingHelper=new B(this._rctx,this._techniques),this.renderer=new W(t,i,this._techniques,this._rctx,this._compositingHelper,(e=>this.requestRender(e))),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)),p)]);const n={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,n,(e=>this.events.emit("force-camera-for-screenshot",e))),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._componentObjects=o(this._componentObjects),this._screenshotManager=o(this._screenshotManager),o(this.renderer),this._textures=o(this._textures),o(this.waterTextures),o(this.markerTextures),o(this.stippleTextures),this._canvas=null,this._rctx=o(this._rctx)}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new k({view:e}),u(e.spatialReference)||(t===_.Local?(new v({view:e}),this.bloom=new A({view:e})):f(e.spatialReference)?(new j({view:e}),this.bloom=new A({view:e})):(new g({view:e}),new w({view:e}),this.bloom=new A({view:e}),new O({view:e}),new x({view:e}))),new M({view:e,isEnabled:()=>this.renderer.hasSSAO}),new L({view:e,isEnabled:()=>this.renderer.hasSMAA}),new D({view:e}),new U({view:e}),new q({view:e,viewingMode:t}),new T({view:e}),C()&&new S({view:e})}requestRender(e=E.UPDATE){this._needsRender=!0,e===E.UPDATE&&(this._needsUpdate=!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(e).then((e=>e[0]))}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(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 p=(e,t,r)=>s(t,e)*(r[1]-r[0])+r[0];let d=Number.MAX_VALUE;for(let s=0;s<a[2]*a[3];s++){const e=p(4*s,h,i.nearFar);d>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(d=e)}if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&d>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(d=s)}return d===Number.MAX_VALUE?void 0:d}_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=E.BACKGROUND,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?E.UPDATE:E.BACKGROUND,e.commitSyncLayers(),i=this.test?.time??i;(c(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(E.BACKGROUND),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),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(E.BACKGROUND),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(t.mode===Y.IDLE?s:E.UPDATE),i=!1)}};this._frameTask=d(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.");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}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return null==this._componentObjects&&(this._componentObjects=new y(this.renderer.renderPassManager,this._viewingMode)),this._componentObjects}set componentObjectCollection(e){this._componentObjects=e}updateQualitySettings(e){this.test&&null!=this.test.time&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=c(0)),this._rctx.updateOptions({maxPreferredTextureSize:this.stage.view.qualitySettings.maxTextureSize})}};function $(e,t){const r=(e,r)=>t.view.resourceController.memoryController.newCache(e,r),s={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8,maxPreferredTextureSize:t.view.qualitySettings.maxTextureSize,newCache:r};if(J.enabled){let t=ee.get(e);return t?(t.configure(s),t.ref(),t):(t=new G(e,s),ee.set(e,t),t.ref(),t)}return new G(e,s)}e([l({type:Boolean,readOnly:!0})],Z.prototype,"updating",null),e([l({constructOnly:!0})],Z.prototype,"stage",void 0),e([l()],Z.prototype,"_rctx",void 0),e([l()],Z.prototype,"_canvas",void 0),e([l()],Z.prototype,"stippleTextures",void 0),e([l()],Z.prototype,"markerTextures",void 0),e([l()],Z.prototype,"waterTextures",void 0),e([l({readOnly:!0})],Z.prototype,"olidRenderHelper",void 0),e([l()],Z.prototype,"_textures",void 0),e([l({readOnly:!0})],Z.prototype,"renderer",void 0),e([l()],Z.prototype,"_screenshotManager",void 0),e([l()],Z.prototype,"componentObjectCollection",null),e([l()],Z.prototype,"_componentObjects",void 0),e([l()],Z.prototype,"_needsUpdate",void 0),e([l()],Z.prototype,"_needsWaterReflectionUpdate",void 0),Z=e([m("esri.views.3d.webgl-engine.parts.RenderView")],Z);const ee=K();export{Z as RenderView};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.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 p}from"../../../../core/reactiveUtils.js";import{addFrameTask as d}from"../../../../core/scheduling.js";import{Milliseconds as c}from"../../../../core/time.js";import{property as l}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{ViewingMode as _}from"../../../ViewingMode.js";import{ChapmanAtmosphere as g}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as w}from"../../environment/CloudsComposition.js";import{Fog as x}from"../../environment/Fog.js";import{LocalAtmosphere as v}from"../../environment/LocalAtmosphere.js";import j from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as y}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as b}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as R}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{BloomRenderNode as A}from"../effects/bloom/BloomRenderNode.js";import{ObjectAndLayerIDRenderNode as S}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as T}from"../effects/geometry/RenderOccludedRenderNode.js";import{Haze as O}from"../effects/haze/Haze.js";import{Highlight as U}from"../effects/highlight/Highlight.js";import{ShadowHighlight as q}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as D}from"../effects/magnifier/Magnifier.js";import{SMAA as L}from"../effects/smaa/SMAA.js";import{SSAO as M}from"../effects/ssao/SSAO.js";import{Stars as k}from"../effects/stars/Stars.js";import{RenderRequestType as E}from"../lib/basicInterfaces.js";import B from"../lib/CompositingHelper.js";import{GLMaterialRepository as F}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as H}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as W}from"../lib/Renderer.js";import{RenderingContext as G}from"../lib/RenderingContext.js";import{TextureRepository as N}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as z}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as I}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as P}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as K}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{RenderState as Y}from"../../../support/RenderState.js";let Z=class extends t{constructor(e){super(e),this.events=new r,this.waterTextures=new P,this.olidRenderHelper=C()?new H:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this.bloom=null,this.test=null;const t=e.stage;try{this._initializeContext(t)}catch(o){return void console.error("Failed to initialize context",o)}const{memoryController:s}=t.view.resourceController;this.stippleTextures=I(this._rctx,s),this.markerTextures=z(this._rctx,s),this._techniques=new R(new b(this._rctx,t.viewingMode,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new N(t),this.addHandles(this._textures.events.on("changed",(e=>this.requestRender(e))));const i=new F(this._textures,this._techniques,(()=>this.requestRender()),(()=>this.requestRender()));this._compositingHelper=new B(this._rctx,this._techniques),this.renderer=new W(t,i,this._techniques,this._rctx,this._compositingHelper,(e=>this.requestRender(e))),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)),p)]);const n={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,n,(e=>this.events.emit("force-camera-for-screenshot",e))),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._componentObjects=o(this._componentObjects),this._screenshotManager=o(this._screenshotManager),o(this.renderer),this._textures=o(this._textures),o(this.waterTextures),o(this.markerTextures),o(this.stippleTextures),this._canvas=null,this._rctx=o(this._rctx)}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new k({view:e}),u(e.spatialReference)||(t===_.Local?(new v({view:e}),this.bloom=new A({view:e})):f(e.spatialReference)?(new j({view:e}),this.bloom=new A({view:e})):(new g({view:e}),new w({view:e}),this.bloom=new A({view:e}),new O({view:e}),new x({view:e}))),new M({view:e,isEnabled:()=>this.renderer.hasSSAO}),new L({view:e,isEnabled:()=>this.renderer.hasSMAA}),new D({view:e}),new U({view:e}),new q({view:e,viewingMode:t}),new T({view:e}),C()&&new S({view:e})}requestRender(e=E.UPDATE){this._needsRender=!0,e===E.UPDATE&&(this._needsUpdate=!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(e).then((e=>e[0]))}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(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 p=(e,t,r)=>s(t,e)*(r[1]-r[0])+r[0];let d=Number.MAX_VALUE;for(let s=0;s<a[2]*a[3];s++){const e=p(4*s,h,i.nearFar);d>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(d=e)}if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&d>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(d=s)}return d===Number.MAX_VALUE?void 0:d}_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=E.BACKGROUND,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?E.UPDATE:E.BACKGROUND,this._needsRender&&this.renderer.updateSceneDepthRange(t.camera),e.commitSyncLayers(),i=this.test?.time??i;(c(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(E.BACKGROUND),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),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(E.BACKGROUND),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(t.mode===Y.IDLE?s:E.UPDATE),i=!1)}};this._frameTask=d(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.");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}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return null==this._componentObjects&&(this._componentObjects=new y(this.renderer.renderPassManager,this._viewingMode)),this._componentObjects}set componentObjectCollection(e){this._componentObjects=e}updateQualitySettings(e){this.test&&null!=this.test.time&&(this.test.savedFadeDuration=e.fadeDuration,e.fadeDuration=c(0)),this._rctx.updateOptions({maxPreferredTextureSize:this.stage.view.qualitySettings.maxTextureSize})}};function $(e,t){const r=(e,r)=>t.view.resourceController.memoryController.newCache(e,r),s={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8,maxPreferredTextureSize:t.view.qualitySettings.maxTextureSize,newCache:r};if(J.enabled){let t=ee.get(e);return t?(t.configure(s),t.ref(),t):(t=new G(e,s),ee.set(e,t),t.ref(),t)}return new G(e,s)}e([l({type:Boolean,readOnly:!0})],Z.prototype,"updating",null),e([l({constructOnly:!0})],Z.prototype,"stage",void 0),e([l()],Z.prototype,"_rctx",void 0),e([l()],Z.prototype,"_canvas",void 0),e([l()],Z.prototype,"stippleTextures",void 0),e([l()],Z.prototype,"markerTextures",void 0),e([l()],Z.prototype,"waterTextures",void 0),e([l({readOnly:!0})],Z.prototype,"olidRenderHelper",void 0),e([l()],Z.prototype,"_textures",void 0),e([l({readOnly:!0})],Z.prototype,"renderer",void 0),e([l()],Z.prototype,"_screenshotManager",void 0),e([l()],Z.prototype,"componentObjectCollection",null),e([l()],Z.prototype,"_componentObjects",void 0),e([l()],Z.prototype,"_needsUpdate",void 0),e([l()],Z.prototype,"_needsWaterReflectionUpdate",void 0),Z=e([m("esri.views.3d.webgl-engine.parts.RenderView")],Z);const ee=K();export{Z as RenderView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4BindUniform.js";import"../core/shaderModules/Texture2DBindUniform.js";import"./ReadShadowMapConfiguration.js";import"../../../webgl/ShaderBuilder.js";export{S as ShadowCastMaxSamples,b as build}from"../../../../chunks/ShadowCastAccumulate.glsl.js";
5
+ import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4BindUniform.js";import"../core/shaderModules/Texture2DBindUniform.js";import"./ReadShadowMapConfiguration.js";import"./ShadowCastAccumulateTechniqueConfiguration.js";import"../../../webgl/ShaderBuilder.js";export{S as ShadowCastMaxSamples,b as build}from"../../../../chunks/ShadowCastAccumulate.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ReloadableShaderModule as e}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{a as t}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{PrimitiveType as i}from"../../../webgl/enums.js";import{makePipelineState as o,add as s,defaultColorWrite as l}from"../../../webgl/renderState.js";class a extends r{constructor(r,o){super(r,o,new e(t,(()=>import("./ShadowCastAccumulate.glsl.js")))),this.primitiveType=i.TRIANGLE_STRIP}initializePipeline(){return o({blending:s,colorWrite:l,depthTest:null,depthWrite:null})}}export{a as ShadowCastAccumulateTechnique};
5
+ import{ReloadableShaderModule as e}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{a as t}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateIndex as i}from"./ShadowCastAccumulateTechniqueConfiguration.js";import{PrimitiveType as o}from"../../../webgl/enums.js";import{makePipelineState as s,add as a}from"../../../webgl/renderState.js";class n extends r{constructor(r,i){super(r,i,new e(t,(()=>import("./ShadowCastAccumulate.glsl.js")))),this.primitiveType=o.TRIANGLE_STRIP}initializePipeline(e){const r={r:e.index===i.PRIMARY,g:e.index===i.CONTEXT,b:!1,a:!1};return s({blending:a,colorWrite:r,depthTest:null,depthWrite:null})}}export{n as ShadowCastAccumulateTechnique};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{parameter as o,ShaderTechniqueConfiguration as i}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";var r;!function(e){e[e.PRIMARY=0]="PRIMARY",e[e.CONTEXT=1]="CONTEXT",e[e.COUNT=2]="COUNT"}(r||(r={}));class s extends i{constructor(e){super(),this.index=r.PRIMARY,this.index=e}}e([o({count:r.COUNT})],s.prototype,"index",void 0);export{r as ShadowCastAccumulateIndex,s as ShadowCastAccumulateTechniqueConfiguration};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/util/CameraSpace.glsl.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../../chunks/ShadowCastAccumulate.glsl.js";import"./ShadowCastVisualizeTechniqueConfiguration.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{S as ShadowCastVisualizePassParameters,b as build}from"../../../../chunks/ShadowCastVisualize.glsl.js";
5
+ import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/util/BlendColorsPremultiplied.glsl.js";import"../core/shaderLibrary/util/CameraSpace.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../../chunks/ShadowCastAccumulate.glsl.js";import"./ShadowCastVisualizeTechniqueConfiguration.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{S as ShadowCastVisualizePassParameters,b as build}from"../../../../chunks/ShadowCastVisualize.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ReloadableShaderModule as e}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{PrimitiveType as s}from"../../../webgl/enums.js";import{makePipelineState as t,unpremultipliedAlphaToPremultipliedAlpha as o,defaultColorWrite as l}from"../../../webgl/renderState.js";class a extends r{constructor(r,t){super(r,t,new e(i,(()=>import("./ShadowCastVisualize.glsl.js")))),this.primitiveType=s.TRIANGLE_STRIP}initializePipeline(){return t({blending:o,colorWrite:l,depthTest:null,depthWrite:null})}}export{a as ShadowCastVisualizeTechnique};
5
+ import{ReloadableShaderModule as e}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{PrimitiveType as s}from"../../../webgl/enums.js";import{makePipelineState as t,premultipliedAlpha as o,defaultColorWrite as l}from"../../../webgl/renderState.js";class a extends r{constructor(r,t){super(r,t,new e(i,(()=>import("./ShadowCastVisualize.glsl.js")))),this.primitiveType=s.TRIANGLE_STRIP}initializePipeline(){return t({blending:o,colorWrite:l,depthTest:null,depthWrite:null})}}export{a as ShadowCastVisualizeTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../../../chunks/tslib.es6.js";import{parameter as e,ShaderTechniqueConfiguration as i}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";var t;!function(o){o[o.Gradient=0]="Gradient",o[o.Threshold=1]="Threshold",o[o.COUNT=2]="COUNT"}(t||(t={}));class r extends i{constructor(){super(...arguments),this.visualization=t.Gradient,this.bandsEnabled=!1}}o([e({count:t.COUNT})],r.prototype,"visualization",void 0),o([e()],r.prototype,"bandsEnabled",void 0);export{t as ShadowCastVisualization,r as ShadowCastVisualizeTechniqueConfiguration};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{parameter as r,ShaderTechniqueConfiguration as i}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";var n;!function(e){e[e.Gradient=0]="Gradient",e[e.BandedGradient=1]="BandedGradient",e[e.Threshold=2]="Threshold",e[e.ThresholdAndGradient=3]="ThresholdAndGradient",e[e.COUNT=4]="COUNT"}(n||(n={}));class t extends i{constructor(){super(...arguments),this.visualization=n.Gradient}}e([r({count:n.COUNT})],t.prototype,"visualization",void 0);export{n as ShadowCastVisualization,t as ShadowCastVisualizeTechniqueConfiguration};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as p}from"../chunks/tslib.es6.js";import{createTask as e}from"../core/asyncUtils.js";import t from"../core/Error.js";import has from"../core/has.js";import o from"../core/Logger.js";import{throwIfAborted as i,wrapAbortWithTimeout as s,allSettledValues as r,createResolver as a}from"../core/promiseUtils.js";import{watch as u,syncAndInitial as n,whenOnce as c}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{ViewEventPriorities as d}from"./input/InputManager.js";function m(p){return null!=p&&"open"in p&&"declaredClass"in p}function y(p){return null!=p&&"declaredClass"in p&&"dockOptions"in p}const f=a=>{let f=class extends a{constructor(){super(...arguments),this._popupSetupTask=null,this.popup={},this.popupEnabled=!0}initialize(){this.addHandles([u((()=>[this.ui,this.popup]),(([p,e],t)=>{const o="popup",i="manual";if(t){const[p,i]=t;p&&m(i)&&(i.view=null,y(i)&&(p.remove(i,o),i!==e&&e&&i.destroy()))}p&&m(e)&&(e.view=this,y(e)&&p.add(e,{key:o,position:i,internal:!0}))}),n),this.on("click",(p=>{this.popup&&this.popupEnabled&&("mouse"!==p.pointerType||0===p.button)&&(m(this.popup)?this.popup.viewModel.handleViewClick(p):p.async((async()=>{await this.setupPopup(),m(this.popup)&&!this.destroyed&&this.ready&&this.popupEnabled&&this.popup.viewModel.handleViewClick(p)})))}),d.WIDGET)]),c((()=>this.ready&&this.popupEnabled&&!this.updating)).then((()=>{import("../widgets/Popup.js")}))}destroy(){this.destroyed||this.closePopup()}async openPopup(p){if(m(this.popup))return this.popup.open(p);try{if(await this.setupPopup(),!this.popup)return void o.getLogger(this).error(new t("view:null-popup","Popup is null and can't be opened"));this.popup.open(p)}catch{}}closePopup(){this._popupSetupTask?.abort(),m(this.popup)&&this.popup.close()}async fetchPopupFeatures(p,e){return await this.when(),this._popupHitsToFeatures(await this._getPopupHits(p,e),e)}async setupPopup(){if(this._popupSetupTask?.abort(),this.popup&&!m(this.popup))return this._popupSetupTask=e((async p=>{const{default:e}=await import("../widgets/Popup.js");if(i(p),!this.popup||m(this.popup))return;const t=this.popup;delete t.open,delete t.close,this.popup=new e(t)})),this._popupSetupTask.promise}async _popupHitsToFeatures({location:p,hits:e},t){const o=[],i=[];let a=!1;const u=s(t,has("popup-view-fetch-timeout")??P),n=p=>{const e=new w(p);return i.push(e),o.push(e.promise),e},c=p=>{const e=i.at(-1);return e&&e.layerView===p&&!a?e:n(p)};for(const s of e)if("graphic"in s){c(s.layerView).graphics.push(s.graphic),a=!1}else o.push(s.layerView.fetchPopupFeaturesAtLocation(s.mapPoint,u)),a=!0;i.map((p=>p.resolve(u)));const h=r(o).then((p=>p.filter((p=>!!p)).flat()));return{pendingFeatures:o,allGraphicsPromise:h,location:p}}async _getPopupHits(p,e){const{hits:t,location:o}=await this.popupHitTest(p);i(e);const s=[];for(const i of t)if("graphic"in i){if(this._isValidPopupGraphic(i.graphic,e)){const p=this._isValidPopupGraphicsLayerView(i.layerView)?i.layerView:void 0;s.push({graphic:i.graphic,layerView:p})}}else this._isValidPopupLocationLayerView(i.layerView)&&s.push({mapPoint:i.mapPoint,layerView:i.layerView});return{hits:s,location:o}}_isValidPopupGraphic(p,e){return p&&!!p.getEffectivePopupTemplate(e?.defaultPopupTemplateEnabled)}_isValidPopupGraphicsLayerView(p){return!p||(!("layer"in p)||!p.suspended)&&"fetchPopupFeaturesFromGraphics"in p}_isValidPopupLocationLayerView(p){return(!("layer"in p)||!p.suspended)&&"fetchPopupFeaturesAtLocation"in p}};return p([h()],f.prototype,"popup",void 0),p([h()],f.prototype,"popupEnabled",void 0),f=p([l("esri.views.PopupView")],f),f};class w{constructor(p){this.layerView=p,this._resolver=a(),this.graphics=[]}get promise(){return this._resolver.promise}resolve(p){const{layerView:e,graphics:t,_resolver:o}=this;if(!e)return o.resolve(t),o.promise;let i;return e.fetchPopupFeaturesFromGraphics(t,p).catch((p=>(i=p,null))).then((p=>{p?o.resolve(p):o.reject(i)})),o.promise}}const P=5e3;export{f as PopupView};
5
+ import{_ as p}from"../chunks/tslib.es6.js";import{createTask as e}from"../core/asyncUtils.js";import t from"../core/Error.js";import has from"../core/has.js";import o from"../core/Logger.js";import{throwIfAborted as i,wrapAbortWithTimeout as s,allSettledValues as r,createResolver as a}from"../core/promiseUtils.js";import{watch as u,syncAndInitial as n,whenOnce as c}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{ViewEventPriorities as d}from"./input/InputManager.js";function m(p){return null!=p&&"open"in p&&"declaredClass"in p}function f(p){return null!=p&&"declaredClass"in p&&"dockOptions"in p}const w=a=>{let w=class extends a{constructor(){super(...arguments),this._popupSetupTask=null,this.popup={},this.popupEnabled=!0}initialize(){this.addHandles([u((()=>[this.ui,this.popup]),(([p,e],t)=>{const o="popup",i="manual";if(t){const[p,i]=t;p&&m(i)&&(i.view=null,f(i)&&(p.remove(i,o),i!==e&&e&&i.destroy()))}p&&m(e)&&(e.view=this,f(e)&&p.add(e,{key:o,position:i,internal:!0}))}),n),this.on("click",(p=>{this.popup&&this.popupEnabled&&("mouse"!==p.pointerType||0===p.button)&&(m(this.popup)?this.popup.viewModel.handleViewClick(p):p.defer((async()=>{await this.setupPopup(),m(this.popup)&&!this.destroyed&&this.ready&&this.popupEnabled&&this.popup.viewModel.handleViewClick(p)})))}),d.WIDGET)]),c((()=>this.ready&&this.popupEnabled&&!this.updating)).then((()=>{import("../widgets/Popup.js")}))}destroy(){this.destroyed||this.closePopup()}async openPopup(p){if(m(this.popup))return this.popup.open(p);try{if(await this.setupPopup(),!this.popup)return void o.getLogger(this).error(new t("view:null-popup","Popup is null and can't be opened"));this.popup.open(p)}catch{}}closePopup(){this._popupSetupTask?.abort(),m(this.popup)&&this.popup.close()}async fetchPopupFeatures(p,e){return await this.when(),this._popupHitsToFeatures(await this._getPopupHits(p,e),e)}async setupPopup(){if(this._popupSetupTask?.abort(),this.popup&&!m(this.popup))return this._popupSetupTask=e((async p=>{const{default:e}=await import("../widgets/Popup.js");if(i(p),!this.popup||m(this.popup))return;const t=this.popup;delete t.open,delete t.close,this.popup=new e(t)})),this._popupSetupTask.promise}async _popupHitsToFeatures({location:p,hits:e},t){const o=[],i=[];let a=!1;const u=s(t,has("popup-view-fetch-timeout")??P),n=p=>{const e=new y(p);return i.push(e),o.push(e.promise),e},c=p=>{const e=i.at(-1);return e&&e.layerView===p&&!a?e:n(p)};for(const s of e)if("graphic"in s){c(s.layerView).graphics.push(s.graphic),a=!1}else o.push(s.layerView.fetchPopupFeaturesAtLocation(s.mapPoint,u)),a=!0;i.map((p=>p.resolve(u)));const h=r(o).then((p=>p.filter((p=>!!p)).flat()));return{pendingFeatures:o,allGraphicsPromise:h,location:p}}async _getPopupHits(p,e){const{hits:t,location:o}=await this.popupHitTest(p);i(e);const s=[];for(const i of t)if("graphic"in i){if(this._isValidPopupGraphic(i.graphic,e)){const p=this._isValidPopupGraphicsLayerView(i.layerView)?i.layerView:void 0;s.push({graphic:i.graphic,layerView:p})}}else this._isValidPopupLocationLayerView(i.layerView)&&s.push({mapPoint:i.mapPoint,layerView:i.layerView});return{hits:s,location:o}}_isValidPopupGraphic(p,e){return p&&!!p.getEffectivePopupTemplate(e?.defaultPopupTemplateEnabled)}_isValidPopupGraphicsLayerView(p){return!p||(!("layer"in p)||!p.suspended)&&"fetchPopupFeaturesFromGraphics"in p}_isValidPopupLocationLayerView(p){return(!("layer"in p)||!p.suspended)&&"fetchPopupFeaturesAtLocation"in p}};return p([h()],w.prototype,"popup",void 0),p([h()],w.prototype,"popupEnabled",void 0),w=p([l("esri.views.PopupView")],w),w};class y{constructor(p){this.layerView=p,this._resolver=a(),this.graphics=[]}get promise(){return this._resolver.promise}resolve(p){const{layerView:e,graphics:t,_resolver:o}=this;if(!e)return o.resolve(t),o.promise;let i;return e.fetchPopupFeaturesFromGraphics(t,p).catch((p=>(i=p,null))).then((p=>{p?o.resolve(p):o.reject(i)})),o.promise}}const P=5e3;export{w as PopupView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{destroyMaybe as p,maybeProperty as h}from"../core/maybe.js";import{ObservableChangesType as d}from"../core/ObservableChangesType.js";import{throwIfAborted as c}from"../core/promiseUtils.js";import{on as u,watch as g,initial as m,whenOnce as y,syncAndInitial as f,sync as w}from"../core/reactiveUtils.js";import{setFrameDuration as v}from"../core/scheduling.js";import{createScreenPoint as _,createScreenPointArray as b}from"../core/screenUtils.js";import{getMetersPerUnitForSR as M}from"../core/unitUtils.js";import{initialize as S}from"../core/workers/workers.js";import{property as V}from"../core/accessorSupport/decorators/property.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as R}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as C,ensureClass as O}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as T}from"../core/accessorSupport/overrideDefaultsFrom.js";import{create as x}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{owningCollectionProperty as E}from"../core/support/OwningCollection.js";import L from"../geometry/Extent.js";import P from"../geometry/HeightModelInfo.js";import A from"../geometry/Point.js";import{canProjectWithoutEngine as I,project as H}from"../geometry/projection.js";import G from"../geometry/SpatialReference.js";import{projectBoundingRect as D}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as F}from"../geometry/projection/projectPointToVector.js";import{create as U,toExtent as W}from"../geometry/support/aaBoundingRect.js";import{B as q,a as k}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as z}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as B}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as N,isTiledLayer as Q,isVoxelLayer as Y,isIntegratedMeshLayer as Z}from"../layers/support/layerUtils.js";import{AnalysesCollection as $}from"../support/AnalysesCollection.js";import{BreakpointsOwner as J}from"./BreakpointsOwner.js";import{DOMContainer as K}from"./DOMContainer.js";import{FocusAreas as X}from"./FocusAreas.js";import ee from"./GroundView.js";import{PopupView as te}from"./PopupView.js";import ie from"./View.js";import re from"./ViewAnimation.js";import{ViewingMode as se,stringFromViewingMode as ne,viewingModeFromString as ae}from"./ViewingMode.js";import{layerView3DImporter as oe}from"./3d/layerViewModuleImportUtils.js";import le from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as pe}from"./3d/constraints/Constraints.js";import{EnvironmentManager as he}from"./3d/environment/EnvironmentManager.js";import de from"./3d/environment/SceneViewEnvironment.js";import ce from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as ue}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as ge}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as me}from"./3d/layers/support/FeatureTileTree3D.js";import ye from"./3d/state/ViewState.js";import{ViewStateManager as fe}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as we}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as ve}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as _e}from"./3d/support/debugFlags.js";import be from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as Me}from"./3d/support/ElevationProvider.js";import{toMap as Se,hitTest as Ve}from"./3d/support/hitTest.js";import{popupHitTest as je}from"./3d/support/popupHitTest.js";import Re from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Ce}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Oe}from"./3d/support/ResourceController.js";import Te from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as xe}from"./3d/support/SharedSymbolResources.js";import{PointsOfInterest as Ee}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Le from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Pe,getTiledLayerInfo as Ae,checkIfTileInfoSupportedForView as Ie}from"./3d/terrain/terrainUtils.js";import{Stage as He}from"./3d/webgl-engine/Stage.js";import{olidEnabled as Ge}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{defaultTolerance as De}from"./3d/webgl-engine/lib/Intersector.js";import{terrainId as Fe}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{defaultHighlightName as Ue}from"./support/HighlightDefaults.js";import We from"./support/HighlightOptions.js";import{occludeesSupported as qe}from"./support/layerViewUtils.js";import{PropertiesPool as ke}from"./support/PropertiesPool.js";import{isSupportedScreenPointEvent as ze,createScreenPointFromSupportedEvent as Be}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Ne}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Qe,destroyTextureCompressionWorker as Ye}from"./support/TextureCompressionHelper.js";import{check as Ze}from"./support/WebGLRequirements.js";import $e from"./ui/DefaultUI.js";import Je from"./ui/3d/DefaultUI3D.js";import Ke from"../webscene/Environment.js";let Xe=class extends(J(te(K(ie)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new ke({slicePlane:q},this),this._resourceController=Oe(this),this.deconflictor=new ue({view:this}),this.labeler=new ge({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new $,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new pe,this.environment=new de,this.environmentManager=new he,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new le({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ye({view:this}),this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Je,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.focusAreas=new X({view:this}),S();const t=(e=null)=>{null!=e&&e.type===d.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([u((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),g((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new ce({view:this}),this.stateManager=new fe({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=Qe(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new ee({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),m),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),m),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>v(e>0?1e3/Math.ceil(e):0)),m),this.addHandles(g((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),w))}destroy(){this.destroyed||(Ye(this),this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",p(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=p(this.sharedSymbolResources),this._set("labeler",p(this.labeler)),this._set("deconflictor",p(this.deconflictor)),this._resourceController=p(this._resourceController),this._set("stateManager",p(this.stateManager)),this._set("inputManager",p(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this._propertiesPool.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",p(this.environmentManager)),this._set("environment",p(this.environment)),this.groundView=p(this.groundView),this._exitBasemapTerrain(),this.stage?.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||h(e,"clippingArea");return!this._userClippingArea&&!h(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof L?this.spatialReference&&(t=et(t,this.spatialReference),null==t)?(l.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?l.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===se.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:et(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||G.WGS84,i=et(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||G.WGS84;let t;const i=i=>{const r=et(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new L({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}castEnvironment(e){return e?e instanceof de?e:e instanceof Ke?this.environment?.cloneWithWebsceneEnvironment(e)??de.fromWebsceneEnvironment(e):C(de,e):new de}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){be.isValidProfile(e)&&(be.apply(e,this.qualitySettings),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||be.getDefaultProfile()}set slicePlane(e){if(null!=this.stage&&(this.stage.renderer.slicePlane=e),null==e)return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");k(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?B(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?P.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Pe(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._createGraphicsViewController||this.inputManager?.updating||this.map?.allLayers?.some((e=>!e.isFulfilled()))),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return ne(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?ne(this.defaultsFromMap.viewingMode):Ne(t,se.Global)?"global":"local":"global"}set viewingMode(e){this.ready?l.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get highlightOptions(){return this.highlights.find((({name:e})=>e===Ue))??new We}set highlightOptions(e){for(let t=0;t<this.highlights.length;++t){if(this.highlights.at(t).name===Ue)return void this.highlights.items[t].assignFrom(e)}}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Te(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=ze(e)?Be(this,e):e;return Se(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?Me(this.elevationProvider,e):null)??0;return F(e,tt,this.renderSpatialReference,t),this.state.camera.projectToScreen(tt,it),_(it[0],it[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;F(e,tt,i);const r=this.state.camera.computeScreenPixelSizeAt(tt);return t&&i!==t?r*M(i)/M(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,(()=>this.pixelSizeAt(e))):1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=ze(e)?Be(this,e):e;return Ve(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return je(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshotWithOID(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!Ge())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);await this.whenReady();const r=await this.stage.renderView.takeScreenshotWithOID(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return oe.importLayerView(e)}hasLayerViewModule(e){return oe.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=Ze(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw l.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return null!=e?ae(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,se.Local),s=this._validateSpatialReferenceForViewingMode(e,t,se.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,se.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,se.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!Ne(e,i)&&(null==t||(!!N(t)||(!Q(t)||null!=Ae(t,e,i))&&(!Y(t)||i!==se.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(N(t)&&(r||s)){return!s||i===se.Local||null===Ie(t.tileInfo,t.fullExtent,e,se.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:G.WebMercator,viewingMode:i}]:[{spatialReference:r?G.WGS84:G.WebMercator,viewingMode:i}]}return Q(t)||Y(t)||!r&&!s?Q(t)&&r&&i!==se.Global?[{spatialReference:e,viewingMode:i},{spatialReference:G.WGS84,viewingMode:se.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?G.WGS84:G.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${ne(i)} viewing mode.`):e.isGeographic&&l.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}maskOccludee(e){if(!e)return l.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&qe(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter((e=>"media-3d"!==e.type)).find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await y((()=>this.graphicsView)),this.graphicsView):e.layer&&this.map?t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer):null}_initBasemapTerrain(){this._set("basemapTerrain",new Le({view:this})),this._set("elevationProvider",new ve({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Ee({view:this})),this._set("featureTiles",new me({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?H(W(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>_e.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&_e.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||_e.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),f),this.updatingHandles.add((()=>this.clippingArea),e,f),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,f)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.featureTiles&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this._set("featureTiles",p(this.featureTiles)),this._set("pointsOfInterest",p(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=z(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Ce.create(this.state.viewingMode,i)),t||this.addHandles(g((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!D(e,this.basemapTerrain.spatialReference,rt,t)||(this.renderCoordsHelper.extent=rt)}),w),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===d.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(g((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),w),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new we(this.state.viewingMode,(e=>this.stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new He({view:this,options:e,container:i}),this._stage.renderer.slicePlane=this.slicePlane,this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this.stage.renderer.setParameters({highQualityTransparency:e})),m),this.on("pointer-move",(()=>this.stage?.renderer.resetAnimation())),a(this.stage.renderView.canvas,"webglcontextlost",(e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)}))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=p(this.stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new xe({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;c(e),await y((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this,getGraphics:()=>this.graphics}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),null!=this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=ae(this.viewingMode);e===se.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(u((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded();const t=this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties:null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?T(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(Fe);for(const t of this.allLayerViews)Z(t.layer.type)&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(Fe);for(const t of this.allLayerViews)Z(t.layer.type)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}};function et(e,t){return null!=e&&I(e.spatialReference,t)?H(e,t):null}e([V()],Xe.prototype,"_userClippingArea",void 0),e([V()],Xe.prototype,"_resourceController",void 0),e([V()],Xe.prototype,"_stage",void 0),e([V({readOnly:!0})],Xe.prototype,"deconflictor",void 0),e([V({readOnly:!0})],Xe.prototype,"labeler",void 0),e([V(E($,"analyses"))],Xe.prototype,"analyses",void 0),e([V({type:re,readOnly:!0})],Xe.prototype,"animation",null),e([V({readOnly:!0})],Xe.prototype,"basemapTerrain",void 0),e([V({readOnly:!0})],Xe.prototype,"elevationProvider",void 0),e([V()],Xe.prototype,"camera",null),e([V({type:t})],Xe.prototype,"contentCamera",null),e([V({readOnly:!0})],Xe.prototype,"canvas",void 0),e([V({type:A})],Xe.prototype,"center",null),e([V({type:L})],Xe.prototype,"clippingArea",null),e([V({type:pe})],Xe.prototype,"constraints",void 0),e([V({type:L,readOnly:!0})],Xe.prototype,"renderDataExtent",null),e([V({readOnly:!0})],Xe.prototype,"tileInfo",null),e([V({type:L,readOnly:!0})],Xe.prototype,"dataExtent",null),e([V({type:L,readOnly:!0})],Xe.prototype,"_groundAndLayersExtent",null),e([V({type:de})],Xe.prototype,"environment",void 0),e([j("environment")],Xe.prototype,"castEnvironment",null),e([V({readOnly:!0})],Xe.prototype,"environmentManager",void 0),e([V({type:L})],Xe.prototype,"extent",null),e([V({type:r})],Xe.prototype,"floors",void 0),e([V()],Xe.prototype,"screenCenter",null),e([V()],Xe.prototype,"frustum",null),e([V({type:Number,readOnly:!0})],Xe.prototype,"fullOpacity",void 0),e([V({readOnly:!0})],Xe.prototype,"graphicsView",void 0),e([V({readOnly:!0})],Xe.prototype,"analysisViewManager",void 0),e([V()],Xe.prototype,"groundView",void 0),e([V({type:Boolean})],Xe.prototype,"initialExtentRequired",null),e([V()],Xe.prototype,"defaultsFromMapSettings",null),e([V()],Xe.prototype,"interacting",null),e([V()],Xe.prototype,"stationary",null),e([V()],Xe.prototype,"navigating",null),e([V()],Xe.prototype,"map",void 0),e([V()],Xe.prototype,"padding",null),e([V({type:Ee,readOnly:!0})],Xe.prototype,"pointsOfInterest",void 0),e([V({type:me,readOnly:!0})],Xe.prototype,"featureTiles",void 0),e([V()],Xe.prototype,"_featureTreeDebugger",void 0),e([V({type:Boolean})],Xe.prototype,"screenSizePerspectiveEnabled",void 0),e([V({constructOnly:!0})],Xe.prototype,"deactivatedWebGLExtensions",void 0),e([V({constructOnly:!0})],Xe.prototype,"debugWebGLExtensions",void 0),e([V({constructOnly:!0})],Xe.prototype,"renderCanvas",void 0),e([V({constructOnly:!0})],Xe.prototype,"state",void 0),e([V({readOnly:!0})],Xe.prototype,"inputManager",void 0),e([V({readOnly:!0})],Xe.prototype,"stateManager",void 0),e([V({type:["low","medium","high"]})],Xe.prototype,"qualityProfile",null),e([V({type:Re,get(){let e=this._get("qualitySettings");return e||(e=new Re,be.apply(this.qualityProfile,e)),e}})],Xe.prototype,"qualitySettings",void 0),e([V()],Xe.prototype,"slicePlane",null),e([V({readOnly:!0})],Xe.prototype,"typeSpecificPreconditionsReady",null),e([V({readOnly:!0})],Xe.prototype,"renderCoordsHelper",void 0),e([V({readOnly:!0})],Xe.prototype,"sceneIntersectionHelper",void 0),e([V({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],Xe.prototype,"resolution",null),e([V({type:Number})],Xe.prototype,"scale",null),e([V()],Xe.prototype,"heightModelInfo",null),e([V()],Xe.prototype,"spatialReference",void 0),e([V({type:Boolean,constructOnly:!0})],Xe.prototype,"alphaCompositingEnabled",void 0),e([V({constructOnly:!0})],Xe.prototype,"preserveDrawingBufferEnabled",void 0),e([V({type:Boolean})],Xe.prototype,"supersampleScreenshotsEnabled",void 0),e([V({readOnly:!0})],Xe.prototype,"type",void 0),e([V(),j((e=>e instanceof $e?e:O(Je,e)))],Xe.prototype,"ui",void 0),e([V({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],Xe.prototype,"updating",null),e([V()],Xe.prototype,"_updatingObjects",null),e([V()],Xe.prototype,"_updatingObjectsWithProgress",null),e([V({type:Number,readOnly:!0,dependsOn:["updating"]})],Xe.prototype,"updatingProgress",void 0),e([V({type:["global","local"]})],Xe.prototype,"viewingMode",null),e([V({type:i})],Xe.prototype,"viewpoint",null),e([V({readOnly:!0})],Xe.prototype,"visibleArea",null),e([V({type:Number})],Xe.prototype,"zoom",null),e([V({type:We})],Xe.prototype,"highlightOptions",null),e([V({readOnly:!0})],Xe.prototype,"quality",null),e([V({readOnly:!0})],Xe.prototype,"resolutionScale",null),e([V()],Xe.prototype,"_defaultToMapOptions",null),e([V()],Xe.prototype,"_defaultHitTestOptions",null),Xe=e([R("esri.views.SceneView")],Xe);const tt=x(),it=b(),rt=U(),st=Xe;export{st as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{destroyMaybe as p,maybeProperty as h}from"../core/maybe.js";import{ObservableChangesType as d}from"../core/ObservableChangesType.js";import{throwIfAborted as c}from"../core/promiseUtils.js";import{on as u,watch as g,initial as m,whenOnce as y,syncAndInitial as f,sync as w}from"../core/reactiveUtils.js";import{setFrameDuration as v}from"../core/scheduling.js";import{createScreenPoint as _,createScreenPointArray as b}from"../core/screenUtils.js";import{getMetersPerUnitForSR as M}from"../core/unitUtils.js";import{initialize as S}from"../core/workers/workers.js";import{property as V}from"../core/accessorSupport/decorators/property.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as R}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as C,ensureClass as T}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as O}from"../core/accessorSupport/overrideDefaultsFrom.js";import{create as x}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{owningCollectionProperty as E}from"../core/support/OwningCollection.js";import L from"../geometry/Extent.js";import P from"../geometry/HeightModelInfo.js";import A from"../geometry/Point.js";import{canProjectWithoutEngine as I,project as H}from"../geometry/projection.js";import G from"../geometry/SpatialReference.js";import{projectBoundingRect as D}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as F}from"../geometry/projection/projectPointToVector.js";import{create as U,toExtent as W}from"../geometry/support/aaBoundingRect.js";import{B as q,a as k}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as z}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as B}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as N,isTiledLayer as Q,isVoxelLayer as Y,isIntegratedMeshLayer as Z}from"../layers/support/layerUtils.js";import{AnalysesCollection as $}from"../support/AnalysesCollection.js";import{BreakpointsOwner as J}from"./BreakpointsOwner.js";import{DOMContainer as K}from"./DOMContainer.js";import{FocusAreas as X}from"./FocusAreas.js";import ee from"./GroundView.js";import{PopupView as te}from"./PopupView.js";import ie from"./View.js";import re from"./ViewAnimation.js";import{ViewingMode as se,stringFromViewingMode as ne,viewingModeFromString as ae}from"./ViewingMode.js";import{layerView3DImporter as oe}from"./3d/layerViewModuleImportUtils.js";import le from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as pe}from"./3d/constraints/Constraints.js";import{EnvironmentManager as he}from"./3d/environment/EnvironmentManager.js";import de from"./3d/environment/SceneViewEnvironment.js";import ce from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as ue}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as ge}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as me}from"./3d/layers/support/FeatureTileTree3D.js";import ye from"./3d/state/ViewState.js";import{ViewStateManager as fe}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as we}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as ve}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as _e}from"./3d/support/debugFlags.js";import be from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as Me}from"./3d/support/ElevationProvider.js";import{toMap as Se,hitTest as Ve}from"./3d/support/hitTest.js";import{popupHitTest as je}from"./3d/support/popupHitTest.js";import Re from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Ce}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Te}from"./3d/support/ResourceController.js";import Oe from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as xe}from"./3d/support/SharedSymbolResources.js";import{PointsOfInterest as Ee}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Le from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Pe,getTiledLayerInfo as Ae,checkIfTileInfoSupportedForView as Ie}from"./3d/terrain/terrainUtils.js";import{Stage as He}from"./3d/webgl-engine/Stage.js";import{olidEnabled as Ge}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{defaultTolerance as De}from"./3d/webgl-engine/lib/Intersector.js";import{terrainId as Fe}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{defaultHighlightName as Ue}from"./support/HighlightDefaults.js";import We from"./support/HighlightOptions.js";import{occludeesSupported as qe}from"./support/layerViewUtils.js";import{PropertiesPool as ke}from"./support/PropertiesPool.js";import{isSupportedScreenPointEvent as ze,createScreenPointFromSupportedEvent as Be}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Ne}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Qe,destroyTextureCompressionWorker as Ye}from"./support/TextureCompressionHelper.js";import{check as Ze}from"./support/WebGLRequirements.js";import $e from"./ui/DefaultUI.js";import Je from"./ui/3d/DefaultUI3D.js";import Ke from"../webscene/Environment.js";let Xe=class extends(J(te(K(ie)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new ke({slicePlane:q},this),this._resourceController=Te(this),this.deconflictor=new ue({view:this}),this.labeler=new ge({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new $,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new pe,this.environment=new de,this.environmentManager=new he,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new le({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ye({view:this}),this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Je,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.focusAreas=new X({view:this}),S();const t=(e=null)=>{null!=e&&e.type===d.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([u((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),g((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new ce({view:this}),this.stateManager=new fe({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=Qe(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new ee({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),m),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),m),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>v(e>0?1e3/Math.ceil(e):0)),m),this.addHandles(g((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),w))}destroy(){this.destroyed||(Ye(this),this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",p(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=p(this.sharedSymbolResources),this._set("labeler",p(this.labeler)),this._set("deconflictor",p(this.deconflictor)),this._resourceController=p(this._resourceController),this._set("stateManager",p(this.stateManager)),this._set("inputManager",p(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this._propertiesPool.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",p(this.environmentManager)),this._set("environment",p(this.environment)),this.groundView=p(this.groundView),this._exitBasemapTerrain(),this.stage?.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||h(e,"clippingArea");return!this._userClippingArea&&!h(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof L?this.spatialReference&&(t=et(t,this.spatialReference),null==t)?(l.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?l.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===se.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:et(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||G.WGS84,i=et(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||G.WGS84;let t;const i=i=>{const r=et(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new L({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}castEnvironment(e){return e?e instanceof de?e:e instanceof Ke?this.environment?.cloneWithWebsceneEnvironment(e)??de.fromWebsceneEnvironment(e):C(de,e):new de}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){be.isValidProfile(e)&&(be.apply(e,this.qualitySettings),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||be.getDefaultProfile()}set slicePlane(e){if(null!=this.stage&&(this.stage.renderer.slicePlane=e),null==e)return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");k(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?B(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?P.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Pe(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._createGraphicsViewController||this.inputManager?.updating||this.map?.allLayers?.some((e=>!e.isFulfilled()))),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return ne(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?ne(this.defaultsFromMap.viewingMode):Ne(t,se.Global)?"global":"local":"global"}set viewingMode(e){this.ready?l.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get highlightOptions(){return this.highlights.find((({name:e})=>e===Ue))??new We}set highlightOptions(e){for(let t=0;t<this.highlights.length;++t){if(this.highlights.at(t).name===Ue)return void this.highlights.items[t].assignFrom(e)}}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Oe(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=ze(e)?Be(this,e):e;return Se(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?Me(this.elevationProvider,e):null)??0;return F(e,tt,this.renderSpatialReference,t),this.state.camera.projectToScreen(tt,it),_(it[0],it[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;F(e,tt,i);const r=this.state.camera.computeScreenPixelSizeAt(tt);return t&&i!==t?r*M(i)/M(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,(()=>this.pixelSizeAt(e))):1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=ze(e)?Be(this,e):e;return Ve(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return je(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this.stage.renderView.takeScreenshotWithOID(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!Ge())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);await this.whenReady();const r=await this.stage.renderView.takeScreenshotWithOID(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return oe.importLayerView(e)}hasLayerViewModule(e){return oe.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=Ze(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw l.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return null!=e?ae(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,se.Local),s=this._validateSpatialReferenceForViewingMode(e,t,se.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,se.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,se.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!Ne(e,i)&&(null==t||(!!N(t)||(!Q(t)||null!=Ae(t,e,i))&&(!Y(t)||i!==se.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(N(t)&&(r||s)){return!s||i===se.Local||null===Ie(t.tileInfo,t.fullExtent,e,se.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:G.WebMercator,viewingMode:i}]:[{spatialReference:r?G.WGS84:G.WebMercator,viewingMode:i}]}return Q(t)||Y(t)||!r&&!s?Q(t)&&r&&i!==se.Global?[{spatialReference:e,viewingMode:i},{spatialReference:G.WGS84,viewingMode:se.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?G.WGS84:G.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${ne(i)} viewing mode.`):e.isGeographic&&l.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}maskOccludee(e){if(!e)return l.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&qe(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter((e=>"media-3d"!==e.type)).find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await y((()=>this.graphicsView)),this.graphicsView):e.layer&&this.map?t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer):null}_initBasemapTerrain(){this._set("basemapTerrain",new Le({view:this})),this._set("elevationProvider",new ve({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Ee({view:this})),this._set("featureTiles",new me({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?H(W(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>_e.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&_e.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||_e.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),f),this.updatingHandles.add((()=>this.clippingArea),e,f),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,f)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.featureTiles&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this._set("featureTiles",p(this.featureTiles)),this._set("pointsOfInterest",p(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=z(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Ce.create(this.state.viewingMode,i)),t||this.addHandles(g((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!D(e,this.basemapTerrain.spatialReference,rt,t)||(this.renderCoordsHelper.extent=rt)}),w),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===d.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(g((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),w),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new we(this.state.viewingMode,(e=>this.stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new He({view:this,options:e,container:i}),this._stage.renderer.slicePlane=this.slicePlane,this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this.stage.renderer.setParameters({highQualityTransparency:e})),m),this.on("pointer-move",(()=>this.stage?.renderer.resetAnimation())),a(this.stage.renderView.canvas,"webglcontextlost",(e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)}))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=p(this.stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new xe({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;c(e),await y((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this,getGraphics:()=>this.graphics}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),null!=this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=ae(this.viewingMode);e===se.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(u((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded();const t=this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties:null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?O(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,t?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(Fe);for(const t of this.allLayerViews)Z(t.layer.type)&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(Fe);for(const t of this.allLayerViews)Z(t.layer.type)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}};function et(e,t){return null!=e&&I(e.spatialReference,t)?H(e,t):null}e([V()],Xe.prototype,"_userClippingArea",void 0),e([V()],Xe.prototype,"_resourceController",void 0),e([V()],Xe.prototype,"_stage",void 0),e([V({readOnly:!0})],Xe.prototype,"deconflictor",void 0),e([V({readOnly:!0})],Xe.prototype,"labeler",void 0),e([V(E($,"analyses"))],Xe.prototype,"analyses",void 0),e([V({type:re,readOnly:!0})],Xe.prototype,"animation",null),e([V({readOnly:!0})],Xe.prototype,"basemapTerrain",void 0),e([V({readOnly:!0})],Xe.prototype,"elevationProvider",void 0),e([V()],Xe.prototype,"camera",null),e([V({type:t})],Xe.prototype,"contentCamera",null),e([V({readOnly:!0})],Xe.prototype,"canvas",void 0),e([V({type:A})],Xe.prototype,"center",null),e([V({type:L})],Xe.prototype,"clippingArea",null),e([V({type:pe})],Xe.prototype,"constraints",void 0),e([V({type:L,readOnly:!0})],Xe.prototype,"renderDataExtent",null),e([V({readOnly:!0})],Xe.prototype,"tileInfo",null),e([V({type:L,readOnly:!0})],Xe.prototype,"dataExtent",null),e([V({type:L,readOnly:!0})],Xe.prototype,"_groundAndLayersExtent",null),e([V({type:de})],Xe.prototype,"environment",void 0),e([j("environment")],Xe.prototype,"castEnvironment",null),e([V({readOnly:!0})],Xe.prototype,"environmentManager",void 0),e([V({type:L})],Xe.prototype,"extent",null),e([V({type:r})],Xe.prototype,"floors",void 0),e([V()],Xe.prototype,"screenCenter",null),e([V()],Xe.prototype,"frustum",null),e([V({type:Number,readOnly:!0})],Xe.prototype,"fullOpacity",void 0),e([V({readOnly:!0})],Xe.prototype,"graphicsView",void 0),e([V({readOnly:!0})],Xe.prototype,"analysisViewManager",void 0),e([V()],Xe.prototype,"groundView",void 0),e([V({type:Boolean})],Xe.prototype,"initialExtentRequired",null),e([V()],Xe.prototype,"defaultsFromMapSettings",null),e([V()],Xe.prototype,"interacting",null),e([V()],Xe.prototype,"stationary",null),e([V()],Xe.prototype,"navigating",null),e([V()],Xe.prototype,"map",void 0),e([V()],Xe.prototype,"padding",null),e([V({type:Ee,readOnly:!0})],Xe.prototype,"pointsOfInterest",void 0),e([V({type:me,readOnly:!0})],Xe.prototype,"featureTiles",void 0),e([V()],Xe.prototype,"_featureTreeDebugger",void 0),e([V({type:Boolean})],Xe.prototype,"screenSizePerspectiveEnabled",void 0),e([V({constructOnly:!0})],Xe.prototype,"deactivatedWebGLExtensions",void 0),e([V({constructOnly:!0})],Xe.prototype,"debugWebGLExtensions",void 0),e([V({constructOnly:!0})],Xe.prototype,"renderCanvas",void 0),e([V({constructOnly:!0})],Xe.prototype,"state",void 0),e([V({readOnly:!0})],Xe.prototype,"inputManager",void 0),e([V({readOnly:!0})],Xe.prototype,"stateManager",void 0),e([V({type:["low","medium","high"]})],Xe.prototype,"qualityProfile",null),e([V({type:Re,get(){let e=this._get("qualitySettings");return e||(e=new Re,be.apply(this.qualityProfile,e)),e}})],Xe.prototype,"qualitySettings",void 0),e([V()],Xe.prototype,"slicePlane",null),e([V({readOnly:!0})],Xe.prototype,"typeSpecificPreconditionsReady",null),e([V({readOnly:!0})],Xe.prototype,"renderCoordsHelper",void 0),e([V({readOnly:!0})],Xe.prototype,"sceneIntersectionHelper",void 0),e([V({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],Xe.prototype,"resolution",null),e([V({type:Number})],Xe.prototype,"scale",null),e([V()],Xe.prototype,"heightModelInfo",null),e([V()],Xe.prototype,"spatialReference",void 0),e([V({type:Boolean,constructOnly:!0})],Xe.prototype,"alphaCompositingEnabled",void 0),e([V({constructOnly:!0})],Xe.prototype,"preserveDrawingBufferEnabled",void 0),e([V({type:Boolean})],Xe.prototype,"supersampleScreenshotsEnabled",void 0),e([V({readOnly:!0})],Xe.prototype,"type",void 0),e([V(),j((e=>e instanceof $e?e:T(Je,e)))],Xe.prototype,"ui",void 0),e([V({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],Xe.prototype,"updating",null),e([V()],Xe.prototype,"_updatingObjects",null),e([V()],Xe.prototype,"_updatingObjectsWithProgress",null),e([V({type:Number,readOnly:!0,dependsOn:["updating"]})],Xe.prototype,"updatingProgress",void 0),e([V({type:["global","local"]})],Xe.prototype,"viewingMode",null),e([V({type:i})],Xe.prototype,"viewpoint",null),e([V({readOnly:!0})],Xe.prototype,"visibleArea",null),e([V({type:Number})],Xe.prototype,"zoom",null),e([V({type:We})],Xe.prototype,"highlightOptions",null),e([V({readOnly:!0})],Xe.prototype,"quality",null),e([V({readOnly:!0})],Xe.prototype,"resolutionScale",null),e([V()],Xe.prototype,"_defaultToMapOptions",null),e([V()],Xe.prototype,"_defaultHitTestOptions",null),Xe=e([R("esri.views.SceneView")],Xe);const tt=x(),it=b(),rt=U(),st=Xe;export{st as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import n from"../core/Evented.js";import{getOrCreateMapValue as l}from"../core/MapUtils.js";import{removeMaybe as r}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h}from"../core/reactiveUtils.js";import{symmetricDifference as u}from"../core/SetUtils.js";import{property as d}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{isSubtypeGroupLayer as f,isSubtypeSublayer as g}from"../layers/support/layerUtils.js";import m from"../rest/support/Query.js";import{isSelectableLayer as _}from"./support/selectionUtils.js";let y=class extends n.EventedAccessor{constructor(e){super(e),this._selectionMap=new c,this._sources=new i,this._trashCan=[],this._layerEditHandles=new i,this._vizTaskId=0,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([a((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),h((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})]);const e=new i;this.view.when().then((()=>{this.view.map&&(this.view.map.allLayers.flatten((e=>"sublayers"in e&&e.sublayers?e.sublayers:null)).forEach((t=>{(_(t)&&!f(t)||g(t))&&e.add(t)})),this.sources=e)}))}destroy(){this._layerEditHandles.drain(r)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){o(e,this._sources)}async getSelectedFeatures(e,t={},s="layerView"){const{view:i,selections:o}=this,n=(void 0!==e?o.filter((t=>e.includes(t.layer))):o).filter((e=>e.selection.length>0)).map((async e=>{const{layer:o,selection:n}=e,l=g(o)?o.parent:o;if(null==l||!S(l))return null;if("layer"===s)return M(l,n,t);if(v(l))return null;const r=await i.whenLayerView(l).catch((()=>null));return r?M(r,n,t):null}));return(await Promise.all(n)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let i=!1;const o=e.current.concat(e.added);for(const t of o){const e=t.sourceLayer,o=t.getObjectId();if(this.sources.includes(e)&&(_(e)||g(e))&&null!==o){const t=l(s,e,(()=>[]));t.includes(o)||(t.push(o),i=!0)}}for(const t of e.removed){const e=t.sourceLayer,o=t.getObjectId();if(this.sources.includes(e)&&(_(e)||g(e))&&null!==o){const t=s.get(e),n=t?.indexOf(o);void 0!==n&&n>=0&&(t?.splice(n,1),i=!0)}}if(i){const{_selectionMap:e,_trashCan:i}=this,o=[];for(const[n,l]of s){const s=e.get(n);void 0!==s&&i.push(s),e.set(n,{selection:l}),o.push({layer:n,selection:l,...t(void 0!==s?s.selection:[],l)})}this._onSelectionChange(o)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),i=void 0!==s?[...s.selection]:[];for(const o of t)i.includes(o)||i.push(o);this._setSelection(e,i)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const i=[];for(const o of s.selection)t.includes(o)||i.push(o);this._setSelection(e,i)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const i=new Set(s.selection),o=new Set(t),n=u(i,o);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,i]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...i.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:i}=this,o=this._vizTaskId;for(const n of e){const e=s.get(n),l=g(n)?n.parent:n;if(null!=l&&S(l)){if(v(l))continue;t.whenLayerView(l).then((t=>{e?.highlightHandle?.remove(),null!=e&&i&&o===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(r);for(const e of this.sources){const t=g(e)?e.parent:e;if(null!=t&&_(t)){const s=t.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(s)}}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const i=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,i)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const i=this._selectionMap.get(e);if(void 0===i||!j(i,{selection:s})){void 0!==i&&this._trashCan.push(i),this._selectionMap.set(e,{selection:[...s]});const o={layer:e,selection:[...s],...t(void 0!==i?i.selection:[],s)};this._onSelectionChange([o])}}};e([d({readOnly:!0,nonNullable:!0})],y.prototype,"selections",null),e([d({readOnly:!0,nonNullable:!0})],y.prototype,"count",null),e([d({constructOnly:!0,nonNullable:!0})],y.prototype,"view",void 0),e([d({readOnly:!0,nonNullable:!0})],y.prototype,"hasSelection",null),e([d()],y.prototype,"showHighlight",void 0),e([d()],y.prototype,"sources",null),e([d()],y.prototype,"highlightName",void 0),y=e([p("esri.views.SelectionManager")],y);const v=e=>g(e)?!0===e.parent?.isTable:e.isTable,w=e=>void 0!==e.layer,S=e=>void 0!==e?.when,j=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],i=[...t.selection];if(s.length!==i.length)return!1;s.sort(),i.sort();for(let e=0;e<s.length;e++)if(s[e]!==i[e])return!1}return!0},M=async(e,t,s={})=>{let i;if(w(e)){const o=e;i=void 0===o?null:await o.queryFeatures(new m({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const o=e;i=void 0===o?null:await o.queryFeatures(new m({...s,objectIds:t})).then((e=>({data:e,layer:o})))}return i},b=y;export{b as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import o from"../core/Collection.js";import{referenceSetter as i}from"../core/collectionUtils.js";import n from"../core/Evented.js";import{getOrCreateMapValue as r}from"../core/MapUtils.js";import{removeMaybe as l}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h}from"../core/reactiveUtils.js";import{symmetricDifference as u}from"../core/SetUtils.js";import{property as d}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{isSubtypeSublayer as f,isKnowledgeGraphLayer as g,isMapImageLayer as m,isSubtypeGroupLayer as _}from"../layers/support/layerUtils.js";import y from"../rest/support/Query.js";import{isSelectableLayer as v}from"./support/selectionUtils.js";let w=class extends n.EventedAccessor{constructor(e){super(e),this._selectionMap=new c,this._sources=new o,this._trashCan=[],this._layerEditHandles=new o,this._vizTaskId=0,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([a((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),h((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})]),this.view.when().then((()=>this.syncSources()))}destroy(){this._layerEditHandles.drain(l)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){i(e,this._sources)}syncSources(){const e=new Set,{map:t}=this.view;if(!t)return;const s=t=>{g(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):m(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):_(t)?t.sublayers?.forEach(s):v(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this,n=(void 0!==e?i.filter((t=>e.includes(t.layer))):i).filter((e=>e.selection.length>0)).map((async e=>{const{layer:i,selection:n}=e,r=f(i)?i.parent:i;if(null==r||!b(r))return null;if("layer"===s)return E(r,n,t);if(S(r))return null;const l=await o.whenLayerView(r).catch((()=>null));return l?E(l,n,t):null}));return(await Promise.all(n)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(v(e)||f(e))&&null!==i){const t=r(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(v(e)||f(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=u(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=f(n)?n.parent:n;if(null!=r&&b(r)){if(S(r))continue;t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),null!=e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(l);for(const e of this.sources){const t=f(e)?e.parent:e;if(null!=t&&v(t)&&"on"in t&&t.on){const s=t.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(s)}}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const o=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,o)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!M(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([d({readOnly:!0,nonNullable:!0})],w.prototype,"selections",null),e([d({readOnly:!0,nonNullable:!0})],w.prototype,"count",null),e([d({constructOnly:!0,nonNullable:!0})],w.prototype,"view",void 0),e([d({readOnly:!0,nonNullable:!0})],w.prototype,"hasSelection",null),e([d()],w.prototype,"showHighlight",void 0),e([d()],w.prototype,"sources",null),e([d()],w.prototype,"highlightName",void 0),w=e([p("esri.views.SelectionManager")],w);const S=e=>f(e)?!0===e.parent?.isTable:e.isTable,j=e=>void 0!==e.layer,b=e=>void 0!==e?.when,M=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},E=async(e,t,s={})=>{let o;if(j(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new y({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new y({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},C=w;export{C as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import r from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import n from"../core/Promise.js";import{watch as a,whenOnce as m,initial as p,syncAndInitial as l}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import j from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import u from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as w}from"../layers/support/MediaElementView.js";import b from"../layers/support/TileInfo.js";import v from"../layers/support/VideoElement.js";import{DOMContainer as M}from"./DOMContainer.js";import{Viewport2DMixin as _}from"./Viewport2DMixin.js";import x from"./2d/AnimationManager.js";import G from"./2d/MapViewConstraints.js";import"../core/Error.js";import"../core/scheduling.js";import"../core/Logger.js";import"../core/accessorSupport/tracking/Flags.js";import"../core/colorUtils.js";import"../config.js";import"../symbols/cim/defaultCIMValues.js";import"../symbols/cim/enums.js";import"../core/floatRGBA.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"./2d/engine/webgl/definitions.js";import"./2d/engine/webgl/animations/instructions.js";import"../core/mathUtils.js";import"../symbols/Font.js";import"../core/ObjectPool.js";import"../geometry/support/Axis.js";import"../geometry/support/spatialReferenceUtils.js";import"../geometry/support/TileClipper.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"./2d/engine/webgl/alignmentUtils.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import"../layers/effects/EffectView.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/enums.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./webgl/enums.js";import"./2d/engine/webgl/shaders/BackgroundPrograms.js";import"./webgl/checkWebGLError.js";import"./2d/engine/webgl/DefaultVertexAttributeLayouts.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaders/TileInfoPrograms.js";import"./webgl/Texture.js";import"./webgl/GLObjectType.js";import"./2d/engine/vectorTiles/style/StyleDefinition.js";import"./2d/engine/vectorTiles/enums.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"../request.js";import"../core/urlUtils.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueType.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/constants.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../arcade/ArcadeDate.js";import"../intl/locale.js";import"luxon";import"../core/JSONSupport.js";import"../core/sql/UnknownTimeZone.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/renderState.js";import"./3d/webgl-engine/core/shaderModules/glsl.js";import"./webgl/testSVGPremultipliedAlpha.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"../chunks/earcut.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtilsCommon.js";import"../geometry/support/Ellipsoid.js";import"../kernel.js";import"./2d/layers/support/util.js";import S from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/unitUtils.js";import"../geometry/ellipsoidUtils.js";import"../chunks/pe.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import{ViewStateManager as C}from"./2d/ViewStateManager.js";import P from"./2d/engine/webgl/Overlay.js";import E from"./2d/engine/webgl/OverlayContainer.js";import q from"./navigation/Navigation.js";import V from"./ui/DefaultUI.js";import R from"./ui/2d/DefaultUI2D.js";const T=new t("#000");let O;async function W(){const[,{Stage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);O=e}const k=.01;let z=class extends s{};z=e([h("esri.views.VideoView.Base")],z);let A=class extends(_(M(r.EventedMixin(n.EsriPromiseMixin(z))))){constructor(e){super(e),this._isValid=!1,this.stage=null,this.layer=null,this.navigation=new q,this.ready=!1,this.spatialReference=new y({wkid:0}),this.stateManager=new C({constraints:new G({view:this,minScale:1,maxScale:k})}),this.type="2d",this.ui=new R,this.view2dType="video",this.addHandles([a((()=>this.preconditionsReady),(e=>e?this._startup():this._teardown())),a((()=>this.layer),(()=>this.addResolvingPromise(m((()=>this.ready)))),p),a((()=>[this.layer?.effect,this._overlayContainer,this.effect]),(()=>{this._overlayContainer&&(this._overlayContainer.effect=this.effect??this.layer?.effect??null)}),l),a((()=>this.videoSize),(([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}))])}initialize(){this.addResolvingPromise(W().then((()=>(this._isValid=!0,m((()=>this.ready))))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get effect(){return this.layer?.effect}set effect(e){this._override("effect",e)}get preconditionsReady(){return!(!this._isValid||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference),this.stage=new O(this.surface,{renderingOptions:this.renderingOptions,backgroundColor:T}),this._prepareStage(this.stage);const t=new x({view:this});this._set("animationManager",t);const i=new S({view:this,animationManager:t});this._set("mapViewNavigation",i),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.stage.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager.teardown(),this.frameTask.stop(),this.stationaryManager.clear()}_getViewpoint(){return new i({targetGeometry:new j({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([a((()=>this.stationary),(t=>e.stationary=t),l),a((()=>this.state.id),(()=>e.state=this.state),l),a((()=>this.renderingOptions),(t=>e.renderingOptions=t),l)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new w({element:new v({video:this.layer?.videoElement,georeference:new u({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new P(this._videoElementView);this._overlayContainer=new E,this._overlayContainer.addChild(t),this.stage.addChild(this._overlayContainer)}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>k;r/=2)i.push(r);i.push(k);const{lods:s}=b.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}};e([c()],A.prototype,"_overlayContainer",void 0),e([c()],A.prototype,"_isValid",void 0),e([c()],A.prototype,"constraintsInfo",null),e([c()],A.prototype,"effect",null),e([c()],A.prototype,"layer",void 0),e([c({type:q,nonNullable:!0})],A.prototype,"navigation",void 0),e([c({readOnly:!0})],A.prototype,"preconditionsReady",null),e([c({readOnly:!0})],A.prototype,"ready",void 0),e([c({readOnly:!0})],A.prototype,"rendering",null),e([c()],A.prototype,"scale",null),e([c()],A.prototype,"spatialReference",void 0),e([c()],A.prototype,"stateManager",void 0),e([c()],A.prototype,"type",void 0),e([c(),d((e=>e instanceof V?e:g(R,e)))],A.prototype,"ui",void 0),e([c({readOnly:!0})],A.prototype,"videoSize",null),e([c({readOnly:!0})],A.prototype,"view2dType",void 0),A=e([h("esri.views.VideoView")],A);const D=A;export{D as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import r from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import n from"../core/Promise.js";import{watch as a,whenOnce as m,initial as p,syncAndInitial as l}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import j from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import u from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as w}from"../layers/support/MediaElementView.js";import b from"../layers/support/TileInfo.js";import v from"../layers/support/VideoElement.js";import{DOMContainer as M}from"./DOMContainer.js";import{Viewport2DMixin as _}from"./Viewport2DMixin.js";import x from"./2d/AnimationManager.js";import C from"./2d/MapViewConstraints.js";import"../core/Error.js";import"../core/scheduling.js";import"../core/Logger.js";import"../core/accessorSupport/tracking/Flags.js";import"../core/colorUtils.js";import"../config.js";import"../symbols/cim/defaultCIMValues.js";import"../symbols/cim/enums.js";import"../core/floatRGBA.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"./2d/engine/webgl/definitions.js";import"./2d/engine/webgl/animations/instructions.js";import"../core/mathUtils.js";import"../symbols/Font.js";import"../core/ObjectPool.js";import"../geometry/support/Axis.js";import"../geometry/support/spatialReferenceUtils.js";import"../geometry/support/TileClipper.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"./2d/engine/webgl/alignmentUtils.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import"../layers/effects/EffectView.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/enums.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./webgl/enums.js";import"./2d/engine/webgl/shaders/BackgroundPrograms.js";import"./webgl/checkWebGLError.js";import"./2d/engine/webgl/DefaultVertexAttributeLayouts.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaders/TileInfoPrograms.js";import"./webgl/Texture.js";import"./webgl/FBOAttachmentType.js";import"./2d/engine/vectorTiles/style/StyleDefinition.js";import"./2d/engine/vectorTiles/enums.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"../request.js";import"../core/urlUtils.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueType.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/constants.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../arcade/ArcadeDate.js";import"../intl/locale.js";import"luxon";import"../core/sql/UnknownTimeZone.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/renderState.js";import"./3d/webgl-engine/core/shaderModules/glsl.js";import"./webgl/testSVGPremultipliedAlpha.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"../chunks/earcut.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtilsCommon.js";import"../geometry/support/Ellipsoid.js";import"../kernel.js";import"./2d/layers/support/util.js";import G from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/unitUtils.js";import"../geometry/ellipsoidUtils.js";import"../chunks/pe.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import{ViewStateManager as S}from"./2d/ViewStateManager.js";import P from"./2d/engine/webgl/Overlay.js";import E from"./2d/engine/webgl/OverlayContainer.js";import q from"./navigation/Navigation.js";import V from"./ui/DefaultUI.js";import R from"./ui/2d/DefaultUI2D.js";const T=new t("#000");let O;async function W(){const[,{Stage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);O=e}const k=.01;let z=class extends s{};z=e([h("esri.views.VideoView.Base")],z);let A=class extends(_(M(r.EventedMixin(n.EsriPromiseMixin(z))))){constructor(e){super(e),this._isValid=!1,this.stage=null,this.layer=null,this.navigation=new q,this.ready=!1,this.spatialReference=new y({wkid:0}),this.stateManager=new S({constraints:new C({view:this,minScale:1,maxScale:k})}),this.type="2d",this.ui=new R,this.view2dType="video",this.addHandles([a((()=>this.preconditionsReady),(e=>e?this._startup():this._teardown())),a((()=>this.layer),(()=>this.addResolvingPromise(m((()=>this.ready)))),p),a((()=>[this.layer?.effect,this._overlayContainer,this.effect]),(()=>{this._overlayContainer&&(this._overlayContainer.effect=this.effect??this.layer?.effect??null)}),l),a((()=>this.videoSize),(([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}))])}initialize(){this.addResolvingPromise(W().then((()=>(this._isValid=!0,m((()=>this.ready))))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get effect(){return this.layer?.effect}set effect(e){this._override("effect",e)}get preconditionsReady(){return!(!this._isValid||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference),this.stage=new O(this.surface,{renderingOptions:this.renderingOptions,backgroundColor:T}),this._prepareStage(this.stage);const t=new x({view:this});this._set("animationManager",t);const i=new G({view:this,animationManager:t});this._set("mapViewNavigation",i),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.stage.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager.teardown(),this.frameTask.stop(),this.stationaryManager.clear()}_getViewpoint(){return new i({targetGeometry:new j({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([a((()=>this.stationary),(t=>e.stationary=t),l),a((()=>this.state.id),(()=>e.state=this.state),l),a((()=>this.renderingOptions),(t=>e.renderingOptions=t),l)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new w({element:new v({video:this.layer?.videoElement,georeference:new u({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new P(this._videoElementView);this._overlayContainer=new E,this._overlayContainer.addChild(t),this.stage.addChild(this._overlayContainer)}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>k;r/=2)i.push(r);i.push(k);const{lods:s}=b.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}};e([c()],A.prototype,"_overlayContainer",void 0),e([c()],A.prototype,"_isValid",void 0),e([c()],A.prototype,"constraintsInfo",null),e([c()],A.prototype,"effect",null),e([c()],A.prototype,"layer",void 0),e([c({type:q,nonNullable:!0})],A.prototype,"navigation",void 0),e([c({readOnly:!0})],A.prototype,"preconditionsReady",null),e([c({readOnly:!0})],A.prototype,"ready",void 0),e([c({readOnly:!0})],A.prototype,"rendering",null),e([c()],A.prototype,"scale",null),e([c()],A.prototype,"spatialReference",void 0),e([c()],A.prototype,"stateManager",void 0),e([c()],A.prototype,"type",void 0),e([c(),d((e=>e instanceof V?e:g(R,e)))],A.prototype,"ui",void 0),e([c({readOnly:!0})],A.prototype,"videoSize",null),e([c({readOnly:!0})],A.prototype,"view2dType",void 0),A=e([h("esri.views.VideoView")],A);const D=A;export{D as default};