@arcgis/core 6.0.0-next.6 → 6.0.0-next.8

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 (257) hide show
  1. package/arcade/functions/knowledgegraph.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{f09c9d9a554c33a753b4.js → 02253bdffbd580af22d8.js} +1 -1
  4. package/assets/esri/core/workers/chunks/06ab24a083c3229228dd.js +1 -0
  5. package/assets/esri/core/workers/chunks/09a63cc1987f8636c5b0.js +1 -0
  6. package/assets/esri/core/workers/chunks/{8ba32d3a0df4a206ef1c.js → 15cc2c295682f48030f9.js} +1 -1
  7. package/assets/esri/core/workers/chunks/17b76e0d401c7e396d10.js +1 -0
  8. package/assets/esri/core/workers/chunks/{c18189710d6198516175.js → 19b9d393046a780e6c3f.js} +1 -1
  9. package/assets/esri/core/workers/chunks/1b35ec54968fbeec17ce.js +1 -0
  10. package/assets/esri/core/workers/chunks/1c0c5cb13c2590aae906.js +1 -0
  11. package/assets/esri/core/workers/chunks/1e0d2715d603f48a7e0b.js +1 -0
  12. package/assets/esri/core/workers/chunks/{83589144eeeb08f45557.js → 2aeb5cc32284dd3e4d22.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{9a7fc93cc693fd12b5d8.js → 2b6c74646ff475a6e302.js} +1 -1
  14. package/assets/esri/core/workers/chunks/2d9a1f23ec6ce90723ac.js +1 -0
  15. package/assets/esri/core/workers/chunks/340621182db9e8edbec2.js +1 -0
  16. package/assets/esri/core/workers/chunks/{71f739bb3f7350704af6.js → 384ae10053d35940de73.js} +1 -1
  17. package/assets/esri/core/workers/chunks/3b3e519f15ed52c83f0c.js +1 -0
  18. package/assets/esri/core/workers/chunks/{72019baeba520edb6bb0.js → 3b737dae6efed627406e.js} +1 -1
  19. package/assets/esri/core/workers/chunks/3c0ed15b544df6fb0903.js +1 -0
  20. package/assets/esri/core/workers/chunks/3ffda5bf0b91700dc308.js +1 -0
  21. package/assets/esri/core/workers/chunks/{1317ecdfd0cfa683a493.js → 42323093827adffe56d3.js} +1 -1
  22. package/assets/esri/core/workers/chunks/451d7d456df0f4466563.js +1 -0
  23. package/assets/esri/core/workers/chunks/4a6b92ecbb1f1c55cc43.js +1 -0
  24. package/assets/esri/core/workers/chunks/4e544de61f07ca660236.js +1 -0
  25. package/assets/esri/core/workers/chunks/{67ac6b326bf80fc3d33d.js → 53be85d04cd2da4f391d.js} +1 -1
  26. package/assets/esri/core/workers/chunks/54778dec1598818d93cb.js +1 -0
  27. package/assets/esri/core/workers/chunks/{06e7400f5ebe0719b81c.js → 5a5d80c2519aa3ea8878.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{fb4ff0ac2bc445fec413.js → 5b434e8c98e7119d4a3b.js} +1 -1
  29. package/assets/esri/core/workers/chunks/606ea251075fe81a1206.js +1 -0
  30. package/assets/esri/core/workers/chunks/{3ac9dcbb0571a2580236.js → 62c8c9ad09e0166207fd.js} +1 -1
  31. package/assets/esri/core/workers/chunks/6588725275c75fae0d9c.js +1 -0
  32. package/assets/esri/core/workers/chunks/{ac4cc49104d26c384e98.js → 658b2642ab6880770e4e.js} +1 -1
  33. package/assets/esri/core/workers/chunks/68be3fb88ca61f82fb90.js +1 -0
  34. package/assets/esri/core/workers/chunks/6c9266120d46e8c69dbf.js +1 -0
  35. package/assets/esri/core/workers/chunks/6ebe73f69ae822053b70.js +1 -0
  36. package/assets/esri/core/workers/chunks/6ef647b7769d27529f9c.js +1 -0
  37. package/assets/esri/core/workers/chunks/709e019885822b1f6f3e.js +1 -0
  38. package/assets/esri/core/workers/chunks/70cc2d79653d66e85b58.js +1 -0
  39. package/assets/esri/core/workers/chunks/{cbe6c0f32608cb504695.js → 776ae25a34352d3468bc.js} +1 -1
  40. package/assets/esri/core/workers/chunks/8730e7e6e0296f43f10b.js +1 -0
  41. package/assets/esri/core/workers/chunks/8bea0d706ede6f84f8aa.js +1 -0
  42. package/assets/esri/core/workers/chunks/900181f68449d8f82eeb.js +1 -0
  43. package/assets/esri/core/workers/chunks/939942b00ba380e2957e.js +1 -0
  44. package/assets/esri/core/workers/chunks/{1ef39aef6b33c530cbe4.js → 966d0832a3c1f03668a0.js} +1 -1
  45. package/assets/esri/core/workers/chunks/9a28a66807a1e3557018.js +1 -0
  46. package/assets/esri/core/workers/chunks/{2f9033890c465acff698.js → 9bf48a907f91ea004648.js} +1 -1
  47. package/assets/esri/core/workers/chunks/9c7fa9d324fa0bf64d9c.js +1 -0
  48. package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +1 -0
  49. package/assets/esri/core/workers/chunks/{1ba1f705b6ce5c8ea702.js → a655ebdb4bf0660615a2.js} +1 -1
  50. package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +1 -0
  51. package/assets/esri/core/workers/chunks/af349c7bc8ef41a0e1bd.js +1 -0
  52. package/assets/esri/core/workers/chunks/{250d3be6d3849d71fed8.js → c29c474c4b1049352d3e.js} +1 -1
  53. package/assets/esri/core/workers/chunks/c8ba0673d1b87216e619.js +1 -0
  54. package/assets/esri/core/workers/chunks/{4d3f97a48046021713a6.js → ceb112fe7aef354f8051.js} +1 -1
  55. package/assets/esri/core/workers/chunks/d6ad4390df576198e45b.js +1 -0
  56. package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +1 -0
  57. package/assets/esri/core/workers/chunks/ded8b64a46992c3ae693.js +1 -0
  58. package/assets/esri/core/workers/chunks/{0b36abcbf03037b4073d.js → e1af43e2a8f2ef1059e3.js} +1 -1
  59. package/assets/esri/core/workers/chunks/eaf6d587477399a83088.js +1 -0
  60. package/assets/esri/core/workers/chunks/ecaac39dde7ec4213264.js +1 -0
  61. package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +1 -0
  62. package/assets/esri/core/workers/chunks/f31b424a3667686af10c.js +1 -0
  63. package/assets/esri/core/workers/chunks/{711cfb84659cb4437679.js → f528ac5c648ca6a98582.js} +1 -1
  64. package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +1 -0
  65. package/assets/esri/core/workers/chunks/fb444954be74c1962ced.js +1 -0
  66. package/assets/esri/core/workers/chunks/fecaf0bc28aeea4d15db.js +1 -0
  67. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationSettings.scss +1 -1
  68. package/assets/esri/themes/base/widgets/_Features.scss +1 -1
  69. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +5 -9
  70. package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +2 -4
  71. package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -1
  72. package/assets/esri/themes/dark/main.css +1 -1
  73. package/assets/esri/themes/light/main.css +1 -1
  74. package/assets/esri/themes/light/view.css +1 -1
  75. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
  76. package/chunks/GlobalIllumination.glsl.js +4 -2
  77. package/chunks/GlobalIlluminationBlur.glsl.js +3 -5
  78. package/chunks/GlobalIlluminationUpscale.glsl.js +1 -1
  79. package/config.js +1 -1
  80. package/core/colorUtils.js +1 -1
  81. package/core/has.js +1 -1
  82. package/core/workers/workerFactory.js +1 -1
  83. package/form/elements/inputs/DynamicChoiceInput.d.ts +35 -5
  84. package/geometry/projectionUtils.js +1 -1
  85. package/geometry/support/scaleUtils.js +1 -1
  86. package/kernel.js +1 -1
  87. package/layers/ParquetLayer.d.ts +3 -2
  88. package/layers/ParquetLayer.js +1 -1
  89. package/layers/graphics/data/FeatureStore.js +1 -1
  90. package/layers/graphics/data/QueryEngineResult.js +1 -1
  91. package/layers/graphics/data/geometryUtils.js +1 -1
  92. package/layers/graphics/data/projectionSupport.js +1 -1
  93. package/layers/knowledgeGraph/layerUtils.js +1 -1
  94. package/layers/knowledgeGraph/nodeMovementUtils.js +1 -1
  95. package/layers/mixins/ScaleRangeLayer.js +1 -1
  96. package/layers/mixins/SublayersOwner.js +1 -1
  97. package/layers/raster/datasets/TIFFRaster.js +1 -1
  98. package/layers/support/Sublayer.js +1 -1
  99. package/layers/support/SubtypeSublayer.js +1 -1
  100. package/package.json +2 -2
  101. package/popup/FeaturesModel.d.ts +26 -5
  102. package/popup/FeaturesModel.js +1 -1
  103. package/rest/support/printTaskUtils.js +1 -1
  104. package/symbols/cim/CIMSymbolHelper.js +1 -1
  105. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  106. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  107. package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
  108. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  109. package/views/2d/layers/LayerView2D.js +1 -1
  110. package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
  111. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  112. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  113. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  114. package/views/2d/layers/features/sources/strategies/AFeatureTileLoadStrategy.js +1 -1
  115. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  116. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  117. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  118. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  119. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  120. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  121. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  122. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  123. package/views/3d/analysis/Viewshed/types.d.ts +3 -1
  124. package/views/3d/environment/Environment.d.ts +2 -2
  125. package/views/3d/environment/Environment.js +1 -1
  126. package/views/3d/environment/EnvironmentView.js +2 -0
  127. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  128. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  129. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  130. package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
  131. package/views/3d/layers/FlowSubView3D.js +1 -1
  132. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  133. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  134. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  135. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  136. package/views/3d/layers/MediaLayerView3D.js +1 -1
  137. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  138. package/views/3d/layers/RouteLayerView3D.js +1 -1
  139. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  140. package/views/3d/layers/SceneLayerView3D.js +1 -1
  141. package/views/3d/layers/TiledLayerView3D.js +1 -1
  142. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  143. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  144. package/views/3d/layers/graphics/Labeler.js +1 -1
  145. package/views/3d/layers/support/FeatureTile.js +1 -1
  146. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  147. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  148. package/views/3d/layers/support/SampledGeometryMaxDistanceRatio.js +1 -1
  149. package/views/3d/support/elevationUpdateUtils.js +1 -1
  150. package/views/3d/support/popupHitTest.js +1 -1
  151. package/views/3d/terrain/TerrainRenderer.js +1 -1
  152. package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
  153. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
  154. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  155. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js +2 -2
  156. package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
  157. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  158. package/views/SceneView.js +1 -1
  159. package/views/draw/Draw.d.ts +1 -1
  160. package/views/draw/support/InteractiveHandle.js +1 -1
  161. package/views/interactive/options/SnappingOptions.d.ts +1 -0
  162. package/views/interactive/options/TooltipOptions.d.ts +1 -0
  163. package/views/interactive/options/ViewOptions.d.ts +1 -0
  164. package/views/interactive/snapping/FeatureSnappingSourceInfo.js +1 -1
  165. package/views/interactive/support/Units.d.ts +1 -0
  166. package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
  167. package/views/interactive/tooltip/components/ElevationModeSelect.js +1 -1
  168. package/views/layers/LayerView.js +1 -1
  169. package/views/layers/LineOfSightLayerView.d.ts +3 -4
  170. package/views/layers/ViewshedLayerView.d.ts +5 -6
  171. package/views/support/layerViewUtils.js +1 -1
  172. package/views/support/projectionUtils.js +1 -1
  173. package/widgets/BasemapLayerList.js +1 -1
  174. package/widgets/BatchAttributeForm.js +1 -1
  175. package/widgets/DirectionalPad.js +1 -1
  176. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  177. package/widgets/Editor.d.ts +10 -0
  178. package/widgets/Expand.js +1 -1
  179. package/widgets/FeatureForm.d.ts +2 -2
  180. package/widgets/FeatureForm.js +1 -1
  181. package/widgets/FeatureTable/FieldColumn.js +1 -1
  182. package/widgets/FeatureTable.js +1 -1
  183. package/widgets/Features/FeaturesDrillIn.js +1 -1
  184. package/widgets/Features.js +1 -1
  185. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  186. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  187. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  188. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  189. package/widgets/PanoramicVideoViewer.js +1 -1
  190. package/widgets/Print.js +1 -1
  191. package/widgets/ScaleRangeSlider.js +1 -1
  192. package/widgets/Search/SearchResultRenderer.js +1 -1
  193. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  194. package/widgets/Sketch/SketchViewModel.d.ts +1 -1
  195. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  196. package/widgets/Sketch.d.ts +1 -1
  197. package/widgets/Track/TrackViewModel.d.ts +1 -1
  198. package/widgets/UtilityNetworkAssociations.js +1 -1
  199. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  200. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  201. package/widgets/UtilityNetworkTrace/types.d.ts +2 -2
  202. package/widgets/UtilityNetworkTrace.js +1 -1
  203. package/widgets/UtilityNetworkValidateTopology.js +1 -1
  204. package/widgets/ValuePicker.js +1 -1
  205. package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
  206. package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
  207. package/widgets/support/GridControls.js +1 -1
  208. package/widgets/support/PluginSettingsControls.js +1 -1
  209. package/widgets/support/SelectionToolbar.js +1 -1
  210. package/widgets/support/SnappingControls.js +1 -1
  211. package/widgets/support/componentsUtils.js +1 -1
  212. package/assets/esri/core/workers/chunks/00a600c71ceebe7bfeee.js +0 -1
  213. package/assets/esri/core/workers/chunks/00d24415bdeb0adae3df.js +0 -1
  214. package/assets/esri/core/workers/chunks/0193df3f9fb23633da87.js +0 -1
  215. package/assets/esri/core/workers/chunks/02d4f91652a79d2b637e.js +0 -1
  216. package/assets/esri/core/workers/chunks/07aa6d36f1006b6ab7ff.js +0 -1
  217. package/assets/esri/core/workers/chunks/107b025dc5b09465a78f.js +0 -1
  218. package/assets/esri/core/workers/chunks/1f43e06dcfe56229bb0f.js +0 -1
  219. package/assets/esri/core/workers/chunks/25d6c674b1c4829f040f.js +0 -1
  220. package/assets/esri/core/workers/chunks/25e6013e2c095629b236.js +0 -1
  221. package/assets/esri/core/workers/chunks/2a570ce6b99dac6ee996.js +0 -1
  222. package/assets/esri/core/workers/chunks/2c90f7a6432cd716db8b.js +0 -1
  223. package/assets/esri/core/workers/chunks/2e6a2f4d686b71249c0e.js +0 -1
  224. package/assets/esri/core/workers/chunks/303fde8f3459dde16555.js +0 -1
  225. package/assets/esri/core/workers/chunks/350540770781b281c39a.js +0 -1
  226. package/assets/esri/core/workers/chunks/3880d2c7fb14955d7f93.js +0 -1
  227. package/assets/esri/core/workers/chunks/3b017b718ea2d4ed498f.js +0 -1
  228. package/assets/esri/core/workers/chunks/43fc42405167a5537039.js +0 -1
  229. package/assets/esri/core/workers/chunks/4d82db661365daa513a6.js +0 -1
  230. package/assets/esri/core/workers/chunks/56851011276de0b3e318.js +0 -1
  231. package/assets/esri/core/workers/chunks/5f3ab77a79c408423fde.js +0 -1
  232. package/assets/esri/core/workers/chunks/633a9051580c5302d2f7.js +0 -1
  233. package/assets/esri/core/workers/chunks/6469c0d18d3663e7da4b.js +0 -1
  234. package/assets/esri/core/workers/chunks/65654e481cce9ae40e54.js +0 -1
  235. package/assets/esri/core/workers/chunks/669e39c3437d7273f0c7.js +0 -1
  236. package/assets/esri/core/workers/chunks/798a63653f82c0e842c5.js +0 -1
  237. package/assets/esri/core/workers/chunks/84fcbf7a1d04f01685d1.js +0 -1
  238. package/assets/esri/core/workers/chunks/8b54589f173259c1ba55.js +0 -1
  239. package/assets/esri/core/workers/chunks/8e511079918e2fd9261f.js +0 -1
  240. package/assets/esri/core/workers/chunks/95b82cbbe355266c65d7.js +0 -1
  241. package/assets/esri/core/workers/chunks/9673a9efec86040b8c13.js +0 -1
  242. package/assets/esri/core/workers/chunks/a010d2e4e34eb7bc1fec.js +0 -1
  243. package/assets/esri/core/workers/chunks/b05a41a60e30935644be.js +0 -1
  244. package/assets/esri/core/workers/chunks/bff767ec5bb4c0d6b324.js +0 -1
  245. package/assets/esri/core/workers/chunks/c906f984b2b6e7578c06.js +0 -1
  246. package/assets/esri/core/workers/chunks/d21257d2e2a37266c0f7.js +0 -1
  247. package/assets/esri/core/workers/chunks/d270cc9807161033686e.js +0 -1
  248. package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +0 -1
  249. package/assets/esri/core/workers/chunks/e5943f3a4bbc12c06c4d.js +0 -1
  250. package/assets/esri/core/workers/chunks/ec9a2425b4a498054a19.js +0 -1
  251. package/assets/esri/core/workers/chunks/f0a68d2900d24f56afa0.js +0 -1
  252. package/assets/esri/core/workers/chunks/f0aaa646b17ffdbdcefa.js +0 -1
  253. package/assets/esri/core/workers/chunks/f46a0d7cf588ba1b4157.js +0 -1
  254. package/assets/esri/core/workers/chunks/f762f70e7d39634ce797.js +0 -1
  255. package/assets/esri/core/workers/chunks/fccbb902fe08448f91de.js +0 -1
  256. package/assets/esri/core/workers/chunks/fd0254c6fc6c03ec11ba.js +0 -1
  257. package/views/3d/environment/EnvironmentManager.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import{createArcadeGeometryFromOptimizedGeometry as t}from"../../../../../arcade/geometry/adapters/optimized.js";import has from"../../../../../core/has.js";import{estimateNumberArrayMemory as n}from"../../../../../core/memoryEstimations.js";import{DateOnly as r}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as i}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as a}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as o}from"../../../../../geometry/support/aaBoundingBox.js";import{getLabelPoint as s}from"../../../../../geometry/support/labelPoint.js";import{quantizeX as c,quantizeY as l}from"../../../../../geometry/support/quantizationUtils.js";import{zScale as u}from"../../../../../geometry/support/zscale.js";import{getCentroidOptimizedGeometry as d}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as f,generalizeOptimizedGeometry as p,quantizeOptimizedGeometry as m,unquantizeOptimizedGeometryInPlace as h}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as g}from"../../../../../layers/graphics/OptimizedFeature.js";import _ from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as v,unknown as y}from"../../../../../time/constants.js";import{FeatureSetCache as b}from"./FeatureSetCache.js";const x=has(`featurelayer-simplify-thresholds`)??[.5,.5,.5,.5],S=x[0],C=x[1],w=x[2],T=x[3],E=has(`featurelayer-simplify-payload-size-factors`)??[1,2,4],D=E[0],O=E[1],k=E[2],A=has(`featurelayer-simplify-mobile-factor`)??2,j=has(`esri-mobile`),M=4294967295;function N(e,t,n){if(!(e.length>t))for(;e.length<=t;)e.push(n)}class P{constructor(e){this.metadata=e,this.type=`FeatureSetReader`,this._overrides=null,this._postQueryFilteredIds=new Set,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._deleted=new Set,this._caches=new Map,this.arcadeDeclaredClass=`esri.arcade.Feature`,this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}getAreaSimplificationThreshold(e,t){let n=1,r=j?A:1;t>4e6?n=k*r:t>1e6?n=O*r:t>5e5?n=D*r:t>1e5&&(n=r);let i=0;return e>4e3?i=T*n:e>2e3?i=w*n:e>100?i=C:e>15&&(i=S),i}getBounds(e){N(this._boundsBuffer,this.getIndex()*4+4,0);let t=this.getBoundsXMin();if(t===M||!isFinite(t))return!1;if(this.getBoundsXMin()===0){let t=this.readGeometryWorldSpace();if(t?.isPoint&&t.coords[0]===0&&t.coords[1]===0)return o(e,0,0,0,0),!0;if(!t)return this.setBoundsXMin(M),!1;let n=1/0,r=1/0,i=-1/0,a=-1/0;return t.forEachVertex((e,t)=>{n=Math.min(n,e),r=Math.min(r,t),i=Math.max(i,e),a=Math.max(a,t)}),this.setBoundsXMin(n),this.setBoundsYMin(r),this.setBoundsXMax(i),this.setBoundsYMax(a),o(e,n,r,i,a),!0}let n=this.getBoundsXMin(),r=this.getBoundsYMin(),i=this.getBoundsXMax(),a=this.getBoundsYMax();return o(e,n,r,i,a),!0}getBoundsXMin(){return this._boundsBuffer[this.getIndex()*4]}setBoundsXMin(e){this._boundsBuffer[this.getIndex()*4]=e}getBoundsYMin(){return this._boundsBuffer[this.getIndex()*4+1]}setBoundsYMin(e){this._boundsBuffer[this.getIndex()*4+1]=e}getBoundsXMax(){return this._boundsBuffer[this.getIndex()*4+2]}setBoundsXMax(e){this._boundsBuffer[this.getIndex()*4+2]=e}getBoundsYMax(){return this._boundsBuffer[this.getIndex()*4+3]}setBoundsYMax(e){this._boundsBuffer[this.getIndex()*4+3]=e}readAttributeAsTimestamp(e){let t=this.readAttribute(e);return typeof t==`string`?new Date(t).getTime():typeof t==`number`||t==null?t:null}readAttribute(e,t=!1){let n=this._readAttribute(e,t);if(n!==void 0)return n;for(let n of this._joined){n.setIndex(this.getIndex());let r=n._readAttribute(e,t);if(r!==void 0)return r}}readAttributes(){let e=this._readAttributes();for(let t of this._joined){t.setIndex(this.getIndex());let n=t._readAttributes();for(let t of Object.keys(n))e[t]=n[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){let e=this.copy();return e._overrides=null,e}readOptimizedFeatureWorldSpace(){let e=this.readGeometryWorldSpace(),t=this.readAttributes(),n=this.readCentroidWorldSpace();return new g(e,t,n,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){let e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){let e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){let e=this.readGeometryForDisplay();return f(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){let e=this._readX(),t=this.getInTransform();return t==null?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){let e=this._readY(),t=this.getInTransform();return t==null?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){let e=this._readGeometryDeltaDecoded(!0);if(!e){let e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){let t=this.readGeometryForDisplay();if(t&&this.metadata.geometryType===`esriGeometryPolyline`&&(t=p(t,this.metadata.geometryType,e.scale[0])),t&&=m(t,this.metadata.geometryType,e,t.hasZ,t.hasM,!0),!t){let t=this.readCentroidForDisplay();if(!t)return null;let n=c(e,t.coords[0]),r=l(e,t.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(n,r).deltaDecode()}return t}_transformToWorldSpace(e){if(!e)return null;e=e.clone();let t=this.getInTransform();t&&h(e,t);let n=u(this.metadata.spatialReference,this.metadata.outSpatialReference);if(e.hasZ&&n!==1){let{stride:t,coords:r}=e;for(let e=2;e<r.length;e+=t)r[e]*=n}return e}readGeometryWorldSpace(){let e=this._readGeometry();return e||=this._createDeltaQuantizedGeometryFromServerCentroid(),this._transformToWorldSpace(e)}readCentroidForDisplay(){let e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){let e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();return this._transformToWorldSpace(t)}setCache(e){let t=this._caches.get(e);t??(t=new b(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}delete(){this._deleted.add(this.getObjectId())}getByReferenceVertexCount(){return null}get underlyingMemory(){let e=0;e+=n(this._boundsBuffer);for(let t of this._caches.values())e+=t.usedMemory;return e}getDisplayTransform(){return null}_readGeometryDeltaDecoded(e){let t=this._readGeometry(e);if(this.geometryType===`esriGeometryPoint`||!t)return t;let n=this.getInTransform();if(!t||!n)return t;let r=n.scale[2]??1,i=n.translate[2]??0,a=n.scale[3]??1,o=n.translate[3]??0,{hasZ:s,hasM:c,stride:l,size:u,coords:d}=t,f=s&&(r!==1||i!==0),p=c&&(a!==1||o!==0);if(f||p){let e=s?3:2;for(let t=0,n=l*u;t<n;t+=l)f&&(d[t+2]=r*d[t+2]+i),p&&(d[t+e]=a*d[t+e]+o)}return t.deltaDecode()}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some(t=>t.hasField(e))}geometry(){let e=this.readGeometryWorldSpace();if(e==null)return null;let n;switch(this.geometryType){case`esriGeometryPoint`:n=`point`;break;case`esriGeometryMultipoint`:n=`multipoint`;break;case`esriGeometryPolyline`:n=`polyline`;break;case`esriGeometryPolygon`:n=`polygon`;break;default:throw Error(`Unexpected geometry type: ${this.geometryType}`)}return t(n,{lengths:e.lengths,coords:e.coords,hasZ:this.hasZ,hasM:this.hasM},this.metadata.outSpatialReference)}autocastArcadeDate(t,n){return n&&n instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(n):e.dateJSAndZoneToArcadeDate(n,this.contextTimeZone??v):n}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===y}field(t){let n=this.fields.get(t);if(n)switch(n.type){case`date-only`:case`esriFieldTypeDateOnly`:return r.fromReader(this.readAttribute(t,!1));case`time-only`:case`esriFieldTypeTimeOnly`:return i.fromReader(this.readAttribute(t,!1));case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return e.fromReaderAsTimeStampOffset(this.readAttribute(t,!1));case`date`:case`esriFieldTypeDate`:return this.autocastArcadeDate(t,this.readAttribute(t,!0));default:return this.readAttribute(t,!1)}for(let a of this._joined)if(a.setIndex(this.getIndex()),n=a.fields.get(t),n)switch(n.type){case`date-only`:case`esriFieldTypeDateOnly`:return r.fromReader(a._readAttribute(t,!1));case`time-only`:case`esriFieldTypeTimeOnly`:return i.fromReader(a._readAttribute(t,!1));case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return e.fromReaderAsTimeStampOffset(a._readAttribute(t,!1));case`date`:case`esriFieldTypeDate`:return this.autocastArcadeDate(t,a._readAttribute(t,!0));default:return this.readAttribute(t,!1)}throw Error(`Field ${t} does not exist`)}setField(e,t){throw Error(`Unable to update feature attribute values, feature is readonly`)}keys(){return this.fields.fields.map(e=>e.name)}isEmpty(){return this.fields.fields.length<=0&&this.geometry()==null}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());let t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);let n={geometry:t.geometry,attributes:{...t.attributes}};for(let e in n.attributes){let t=n.attributes[e];t instanceof Date&&(n.attributes[e]=t.getTime())}return JSON.stringify(n)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(){return{attributes:this._readAttributes(),geometry:this.geometry()?.castAsJson()??null}}castAsJsonAsync(){return Promise.resolve(this.castAsJson())}applyPostQueryFilter(e){if(this._postQueryFilteredIds.clear(),!e)return;let t=this.getCursor();for(;t.next();)e.check(t,{currentUser:null})||this._postQueryFilteredIds.add(t.getObjectId())}_getExists(){let e=this.getObjectId();return this._deleted.has(e)?!1:this._overrides?!this._overrides.hasOverride(e):!this._postQueryFilteredIds.has(e)}_computeDisplayCentroid(e){if(this.getInTransform()==null)return d(e);let t=a.fromOptimized(e,this.geometryType);t.yFactor*=-1;let n=s(t);return n?isNaN(n[0])||isNaN(n[1])?d(e):(n[1]*=-1,new _([],n)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone,e._postQueryFilteredIds=this._postQueryFilteredIds,e._deleted=this._deleted}_readLegacyGeometryWorldSpace(){let e=this.readGeometryWorldSpace();return f(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){let e=this._readServerCentroid();if(!e)return null;let[t,n]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,n)}_createDeltaQuantizedExtrudedGeometry(e,t){return this.geometryType===`esriGeometryPolyline`?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new _([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new _([2],[e-1,t+1,1,-1])}}export{P as FeatureSetReader};
2
+ import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import{createArcadeGeometryFromOptimizedGeometry as t}from"../../../../../arcade/geometry/adapters/optimized.js";import has from"../../../../../core/has.js";import{estimateNumberArrayMemory as n}from"../../../../../core/memoryEstimations.js";import{DateOnly as r}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as i}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as a}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as o}from"../../../../../geometry/support/aaBoundingBox.js";import{getLabelPoint as s}from"../../../../../geometry/support/labelPoint.js";import{quantizeX as c,quantizeY as l}from"../../../../../geometry/support/quantizationUtils.js";import{zScale as u}from"../../../../../geometry/support/zscale.js";import{getCentroidOptimizedGeometry as d}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as f,generalizeOptimizedGeometry as p,quantizeOptimizedGeometry as m,unquantizeOptimizedGeometryInPlace as h}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as g}from"../../../../../layers/graphics/OptimizedFeature.js";import _ from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as v,unknown as y}from"../../../../../time/constants.js";import{FeatureSetCache as b}from"./FeatureSetCache.js";const x=has(`featurelayer-simplify-thresholds`)??[.5,.5,.5,.5],S=x[0],C=x[1],w=x[2],T=x[3],E=has(`featurelayer-simplify-payload-size-factors`)??[1,2,4],D=E[0],O=E[1],k=E[2],A=has(`featurelayer-simplify-mobile-factor`)??2,j=has(`esri-mobile`),M=4294967295;function N(e,t,n){if(!(e.length>t))for(;e.length<=t;)e.push(n)}class P{constructor(e){this.metadata=e,this.type=`FeatureSetReader`,this._overrides=null,this._postQueryFilteredIds=new Set,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._deleted=new Set,this._caches=new Map,this.arcadeDeclaredClass=`esri.arcade.Feature`,this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}get geometryDensity(){return{sampleCount:0,densePairCount:0}}getAreaSimplificationThreshold(e,t){let n=1,r=j?A:1;t>4e6?n=k*r:t>1e6?n=O*r:t>5e5?n=D*r:t>1e5&&(n=r);let i=0;return e>4e3?i=T*n:e>2e3?i=w*n:e>100?i=C:e>15&&(i=S),i}getBounds(e){N(this._boundsBuffer,this.getIndex()*4+4,0);let t=this.getBoundsXMin();if(t===M||!isFinite(t))return!1;if(this.getBoundsXMin()===0){let t=this.readGeometryWorldSpace();if(t?.isPoint&&t.coords[0]===0&&t.coords[1]===0)return o(e,0,0,0,0),!0;if(!t)return this.setBoundsXMin(M),!1;let n=1/0,r=1/0,i=-1/0,a=-1/0;return t.forEachVertex((e,t)=>{n=Math.min(n,e),r=Math.min(r,t),i=Math.max(i,e),a=Math.max(a,t)}),this.setBoundsXMin(n),this.setBoundsYMin(r),this.setBoundsXMax(i),this.setBoundsYMax(a),o(e,n,r,i,a),!0}let n=this.getBoundsXMin(),r=this.getBoundsYMin(),i=this.getBoundsXMax(),a=this.getBoundsYMax();return o(e,n,r,i,a),!0}getBoundsXMin(){return this._boundsBuffer[this.getIndex()*4]}setBoundsXMin(e){this._boundsBuffer[this.getIndex()*4]=e}getBoundsYMin(){return this._boundsBuffer[this.getIndex()*4+1]}setBoundsYMin(e){this._boundsBuffer[this.getIndex()*4+1]=e}getBoundsXMax(){return this._boundsBuffer[this.getIndex()*4+2]}setBoundsXMax(e){this._boundsBuffer[this.getIndex()*4+2]=e}getBoundsYMax(){return this._boundsBuffer[this.getIndex()*4+3]}setBoundsYMax(e){this._boundsBuffer[this.getIndex()*4+3]=e}readAttributeAsTimestamp(e){let t=this.readAttribute(e);return typeof t==`string`?new Date(t).getTime():typeof t==`number`||t==null?t:null}readAttribute(e,t=!1){let n=this._readAttribute(e,t);if(n!==void 0)return n;for(let n of this._joined){n.setIndex(this.getIndex());let r=n._readAttribute(e,t);if(r!==void 0)return r}}readAttributes(){let e=this._readAttributes();for(let t of this._joined){t.setIndex(this.getIndex());let n=t._readAttributes();for(let t of Object.keys(n))e[t]=n[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){let e=this.copy();return e._overrides=null,e}readOptimizedFeatureWorldSpace(){let e=this.readGeometryWorldSpace(),t=this.readAttributes(),n=this.readCentroidWorldSpace();return new g(e,t,n,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){let e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){let e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){let e=this.readGeometryForDisplay();return f(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){let e=this._readX(),t=this.getInTransform();return t==null?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){let e=this._readY(),t=this.getInTransform();return t==null?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){let e=this._readGeometryDeltaDecoded(!0);if(!e){let e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){let t=this.readGeometryForDisplay();if(t&&this.metadata.geometryType===`esriGeometryPolyline`&&(t=p(t,this.metadata.geometryType,e.scale[0])),t&&=m(t,this.metadata.geometryType,e,t.hasZ,t.hasM,!0),!t){let t=this.readCentroidForDisplay();if(!t)return null;let n=c(e,t.coords[0]),r=l(e,t.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(n,r).deltaDecode()}return t}_transformToWorldSpace(e){if(!e)return null;e=e.clone();let t=this.getInTransform();t&&h(e,t);let n=u(this.metadata.spatialReference,this.metadata.outSpatialReference);if(e.hasZ&&n!==1){let{stride:t,coords:r}=e;for(let e=2;e<r.length;e+=t)r[e]*=n}return e}readGeometryWorldSpace(){let e=this._readGeometry();return e||=this._createDeltaQuantizedGeometryFromServerCentroid(),this._transformToWorldSpace(e)}readCentroidForDisplay(){let e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){let e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();return this._transformToWorldSpace(t)}setCache(e){let t=this._caches.get(e);t??(t=new b(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}delete(){this._deleted.add(this.getObjectId())}getByReferenceVertexCount(){return null}get underlyingMemory(){let e=0;e+=n(this._boundsBuffer);for(let t of this._caches.values())e+=t.usedMemory;return e}getDisplayTransform(){return null}_readGeometryDeltaDecoded(e){let t=this._readGeometry(e);if(this.geometryType===`esriGeometryPoint`||!t)return t;let n=this.getInTransform();if(!t||!n)return t;let r=n.scale[2]??1,i=n.translate[2]??0,a=n.scale[3]??1,o=n.translate[3]??0,{hasZ:s,hasM:c,stride:l,size:u,coords:d}=t,f=s&&(r!==1||i!==0),p=c&&(a!==1||o!==0);if(f||p){let e=s?3:2;for(let t=0,n=l*u;t<n;t+=l)f&&(d[t+2]=r*d[t+2]+i),p&&(d[t+e]=a*d[t+e]+o)}return t.deltaDecode()}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some(t=>t.hasField(e))}geometry(){let e=this.readGeometryWorldSpace();if(e==null)return null;let n;switch(this.geometryType){case`esriGeometryPoint`:n=`point`;break;case`esriGeometryMultipoint`:n=`multipoint`;break;case`esriGeometryPolyline`:n=`polyline`;break;case`esriGeometryPolygon`:n=`polygon`;break;default:throw Error(`Unexpected geometry type: ${this.geometryType}`)}return t(n,{lengths:e.lengths,coords:e.coords,hasZ:this.hasZ,hasM:this.hasM},this.metadata.outSpatialReference)}autocastArcadeDate(t,n){return n&&n instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(n):e.dateJSAndZoneToArcadeDate(n,this.contextTimeZone??v):n}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===y}field(t){let n=this.fields.get(t);if(n)switch(n.type){case`date-only`:case`esriFieldTypeDateOnly`:return r.fromReader(this.readAttribute(t,!1));case`time-only`:case`esriFieldTypeTimeOnly`:return i.fromReader(this.readAttribute(t,!1));case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return e.fromReaderAsTimeStampOffset(this.readAttribute(t,!1));case`date`:case`esriFieldTypeDate`:return this.autocastArcadeDate(t,this.readAttribute(t,!0));default:return this.readAttribute(t,!1)}for(let a of this._joined)if(a.setIndex(this.getIndex()),n=a.fields.get(t),n)switch(n.type){case`date-only`:case`esriFieldTypeDateOnly`:return r.fromReader(a._readAttribute(t,!1));case`time-only`:case`esriFieldTypeTimeOnly`:return i.fromReader(a._readAttribute(t,!1));case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return e.fromReaderAsTimeStampOffset(a._readAttribute(t,!1));case`date`:case`esriFieldTypeDate`:return this.autocastArcadeDate(t,a._readAttribute(t,!0));default:return this.readAttribute(t,!1)}throw Error(`Field ${t} does not exist`)}setField(e,t){throw Error(`Unable to update feature attribute values, feature is readonly`)}keys(){return this.fields.fields.map(e=>e.name)}isEmpty(){return this.fields.fields.length<=0&&this.geometry()==null}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());let t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);let n={geometry:t.geometry,attributes:{...t.attributes}};for(let e in n.attributes){let t=n.attributes[e];t instanceof Date&&(n.attributes[e]=t.getTime())}return JSON.stringify(n)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(){return{attributes:this._readAttributes(),geometry:this.geometry()?.castAsJson()??null}}castAsJsonAsync(){return Promise.resolve(this.castAsJson())}applyPostQueryFilter(e){if(this._postQueryFilteredIds.clear(),!e)return;let t=this.getCursor();for(;t.next();)e.check(t,{currentUser:null})||this._postQueryFilteredIds.add(t.getObjectId())}_getExists(){let e=this.getObjectId();return this._deleted.has(e)?!1:this._overrides?!this._overrides.hasOverride(e):!this._postQueryFilteredIds.has(e)}_computeDisplayCentroid(e){if(this.getInTransform()==null)return d(e);let t=a.fromOptimized(e,this.geometryType);t.yFactor*=-1;let n=s(t);return n?isNaN(n[0])||isNaN(n[1])?d(e):(n[1]*=-1,new _([],n)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone,e._postQueryFilteredIds=this._postQueryFilteredIds,e._deleted=this._deleted}_readLegacyGeometryWorldSpace(){let e=this.readGeometryWorldSpace();return f(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){let e=this._readServerCentroid();if(!e)return null;let[t,n]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,n)}_createDeltaQuantizedExtrudedGeometry(e,t){return this.geometryType===`esriGeometryPolyline`?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new _([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new _([2],[e-1,t+1,1,-1])}}export{P as FeatureSetReader};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{baseObjectMemory as e}from"../../../../../core/memoryEstimations.js";import{normalizeTransform as t,quantizeX as n,quantizeY as r}from"../../../../../geometry/support/quantizationUtils.js";import{convertToGeometry as i}from"../../../../../layers/graphics/featureConversionUtils.js";import{FeatureSetReader as a}from"./FeatureSetReader.js";class o extends a{static from(e,t){if(e instanceof this){let n=new Set(t),r=e._indices.filter(e=>n.has(e)),i=e.copy();return i._indices=r,i._currentIndex=-1,i}return new o(e.copy(),t)}constructor(e,t){super(e.metadata),this._currentIndex=-1,this._displayTransform=null,this._reader=e,this._indices=t}setTransformForDisplay(e){let n=this._reader.getInTransform();if(n==null){this._displayTransform=t(e);return}let r=t(n),i=t(e),[a,o]=r.scale,[s,c]=r.translate,[l,u]=i.scale,[d,f]=i.translate,p=a/l,m=o/u,h=(s-d)/l,g=(c-f)/u;this._displayTransform={originPosition:`lowerLeft`,scale:[1/p,1/m,1,1],translate:[-h/p,-g/m,0,0]}}getInTransform(){return this._reader.getInTransform()}getDisplayTransform(){return this._displayTransform}get fields(){return this._reader.fields}get hasNext(){return this._currentIndex+1<this._indices.length}getSize(){return this._indices.length}getCursor(){return this.copy()}copy(){let e=new o(this._reader.copy(),this._indices);return e._currentIndex=this._currentIndex,e._displayTransform=this._displayTransform,e._processorAttributes=this._processorAttributes,e}get contextTimeZone(){return this._reader.contextTimeZone}set contextTimeZone(e){this._reader.contextTimeZone=e}get usedMemory(){return e+this._reader.usedMemory}setProcessorAttributes(e){this._processorAttributes=Object.assign(this._processorAttributes??{},e)}_nextIndex(){return++this._currentIndex<this._indices.length&&(this._reader.setIndex(this._indices[this._currentIndex]),!0)}next(){for(;this._nextIndex()&&!this._reader._getExists(););return this._currentIndex<this._indices.length}readXForDisplay(){return this._displayTransform?n(this._displayTransform,this._reader.readXForDisplay()):this._reader.readXForDisplay()}readYForDisplay(){return this._displayTransform?r(this._displayTransform,this._reader.readYForDisplay()):this._reader.readYForDisplay()}readGeometryForDisplay(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform):this._reader.readGeometryForDisplay()}readCentroidForDisplay(){let e=this._reader.readCentroidForDisplay()?.clone();if(e){let[t,i]=e.coords;this._displayTransform&&(e.coords[0]=n(this._displayTransform,t),e.coords[1]=r(this._displayTransform,i))}return e}get geometryType(){return this._reader.geometryType}get hasFeatures(){return this._reader.hasFeatures}get exceededTransferLimit(){return this._reader.exceededTransferLimit}get hasZ(){return this._reader.hasZ}get hasM(){return this._reader.hasM}readAttribute(e,t=!1){let n=this._reader.readAttribute(e,t);return n!=null||!this._processorAttributes?n:this._processorAttributes[e]}readAttributes(){return{...this._processorAttributes,...this._reader.readAttributes()}}joinAttributes(e){return this._reader.joinAttributes(e)}getBounds(e){return this._reader.getBounds(e)}getAttributeHash(){return this._reader.getAttributeHash()}getObjectId(){return this._reader.getObjectId()}getDisplayId(){return this._reader.getDisplayId()}setDisplayId(e){return this._reader.setDisplayId(e)}setIndex(e){return this._reader.setIndex(e)}getIndex(){return this._reader.getIndex()}readXWorldSpace(){return this._reader.readXWorldSpace()}readYWorldSpace(){return this._reader.readYWorldSpace()}_readX(){return this._reader.readXForDisplay()}_readY(){return this._reader.readYForDisplay()}_readServerCentroid(){return this._reader._readServerCentroid()}readLegacyFeatureForDisplay(){let e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){let e=this.readGeometryForDisplay();return i(e,this.geometryType,!1,!1)}readGeometryArea(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform)?.area()??0:this._reader.readGeometryArea()}readGeometryWorldSpace(){return this._reader.readGeometryWorldSpace()}_readGeometry(){return this._reader._readGeometry()}_readAttribute(e,t){throw Error(`Error: Should not be called. Underlying _reader should be used instead`)}_readAttributes(){throw Error(`Error: Should not be called. Underlying _reader should be used instead`)}readArcadeFeature(){return this._reader.readArcadeFeature()}geometry(){return this._reader.geometry()}field(e){return this._reader.field(e)}hasField(e){return this._reader.hasField(e)}setField(e,t){return this._reader.setField(e,t)}keys(){return this._reader.keys()}castToText(e=!1){return this._reader.castToText(e)}}export{o as FeatureSetReaderIndirect};
2
+ import{baseObjectMemory as e}from"../../../../../core/memoryEstimations.js";import{normalizeTransform as t,quantizeX as n,quantizeY as r}from"../../../../../geometry/support/quantizationUtils.js";import{convertToGeometry as i}from"../../../../../layers/graphics/featureConversionUtils.js";import{FeatureSetReader as a}from"./FeatureSetReader.js";class o extends a{static from(e,t){if(e instanceof this){let n=new Set(t),r=e._indices.filter(e=>n.has(e)),i=e.copy();return i._indices=r,i._currentIndex=-1,i}return new o(e.copy(),t)}constructor(e,t){super(e.metadata),this._currentIndex=-1,this._displayTransform=null,this._reader=e,this._indices=t}setTransformForDisplay(e){let n=this._reader.getInTransform();if(n==null){this._displayTransform=t(e);return}let r=t(n),i=t(e),[a,o]=r.scale,[s,c]=r.translate,[l,u]=i.scale,[d,f]=i.translate,p=a/l,m=o/u,h=(s-d)/l,g=(c-f)/u;this._displayTransform={originPosition:`lowerLeft`,scale:[1/p,1/m,1,1],translate:[-h/p,-g/m,0,0]}}getInTransform(){return this._reader.getInTransform()}getDisplayTransform(){return this._displayTransform}get fields(){return this._reader.fields}get hasNext(){return this._currentIndex+1<this._indices.length}getSize(){return this._indices.length}getCursor(){return this.copy()}copy(){let e=new o(this._reader.copy(),this._indices);return e._currentIndex=this._currentIndex,e._displayTransform=this._displayTransform,e._processorAttributes=this._processorAttributes,e}get contextTimeZone(){return this._reader.contextTimeZone}set contextTimeZone(e){this._reader.contextTimeZone=e}get usedMemory(){return e+this._reader.usedMemory}setProcessorAttributes(e){this._processorAttributes=Object.assign(this._processorAttributes??{},e)}_nextIndex(){return++this._currentIndex<this._indices.length&&(this._reader.setIndex(this._indices[this._currentIndex]),!0)}next(){for(;this._nextIndex()&&!this._reader._getExists(););return this._currentIndex<this._indices.length}readXForDisplay(){return this._displayTransform?n(this._displayTransform,this._reader.readXForDisplay()):this._reader.readXForDisplay()}readYForDisplay(){return this._displayTransform?r(this._displayTransform,this._reader.readYForDisplay()):this._reader.readYForDisplay()}readGeometryForDisplay(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform):this._reader.readGeometryForDisplay()}readCentroidForDisplay(){let e=this._reader.readCentroidForDisplay()?.clone();if(e){let[t,i]=e.coords;this._displayTransform&&(e.coords[0]=n(this._displayTransform,t),e.coords[1]=r(this._displayTransform,i))}return e}get geometryType(){return this._reader.geometryType}get hasFeatures(){return this._reader.hasFeatures}get exceededTransferLimit(){return this._reader.exceededTransferLimit}get hasZ(){return this._reader.hasZ}get hasM(){return this._reader.hasM}readAttribute(e,t=!1){let n=this._reader.readAttribute(e,t);return n!=null||!this._processorAttributes?n:this._processorAttributes[e]}readAttributes(){return{...this._processorAttributes,...this._reader.readAttributes()}}joinAttributes(e){return this._reader.joinAttributes(e)}getBounds(e){return this._reader.getBounds(e)}getAttributeHash(){return this._reader.getAttributeHash()}getObjectId(){return this._reader.getObjectId()}getDisplayId(){return this._reader.getDisplayId()}setDisplayId(e){return this._reader.setDisplayId(e)}setIndex(e){return this._reader.setIndex(e)}getIndex(){return this._reader.getIndex()}readXWorldSpace(){return this._reader.readXWorldSpace()}readYWorldSpace(){return this._reader.readYWorldSpace()}_readX(){return this._reader.readXForDisplay()}_readY(){return this._reader.readYForDisplay()}_readServerCentroid(){return this._reader._readServerCentroid()}readLegacyFeatureForDisplay(){let e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){let e=this.readGeometryForDisplay();return i(e,this.geometryType,!1,!1)}readGeometryArea(){return this._displayTransform?this._reader.readGeometryForDisplayTransformed(this._displayTransform)?.area()??0:this._reader.readGeometryArea()}readGeometryWorldSpace(){return this._reader.readGeometryWorldSpace()}_readGeometry(){return this._reader._readGeometry()}get geometryDensity(){return this._reader.geometryDensity}_readAttribute(e,t){throw Error(`Error: Should not be called. Underlying _reader should be used instead`)}_readAttributes(){throw Error(`Error: Should not be called. Underlying _reader should be used instead`)}readArcadeFeature(){return this._reader.readArcadeFeature()}geometry(){return this._reader.geometry()}field(e){return this._reader.field(e)}hasField(e){return this._reader.hasField(e)}setField(e,t){return this._reader.setField(e,t)}keys(){return this._reader.keys()}castToText(e=!1){return this._reader.castToText(e)}}export{o as FeatureSetReaderIndirect};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{convertFromFeatures as e,convertFromFeatureSet as t,getQuantizedArea as n}from"../../../../../layers/graphics/featureConversionUtils.js";import{hasGeometry as r}from"../../../../../layers/graphics/OptimizedFeature.js";import i from"../../../../../layers/support/FieldsIndex.js";import{FeatureSetReader as a}from"./FeatureSetReader.js";class o extends a{static fromFeatures(t,n){let{geometryType:r,hasZ:i,hasM:a,featureIdInfo:s}=n,c=e([],t,r,i,a,s);for(let e=0;e<c.length;e++)c[e].displayId=t[e].displayId;return o.fromOptimizedFeatures(c,n)}static fromFeatureSet(e,n){let r=t(e,n.featureIdInfo);return o.fromOptimizedFeatureSet(r,n)}static fromOptimizedFeatureSet(e,t){let n=o.fromOptimizedFeatures(e.features,t);return n._exceededTransferLimit=e.exceededTransferLimit,n._transform=e.transform,n._fieldsIndex=new i(e.fields),n}static fromOptimizedFeatures(e,t,n){let r=new o(e,t);return r._fieldsIndex=t.fieldsIndex,r._transform=n,r}static empty(e){return new o([],e)}constructor(e,t){super(t),this._featureIndex=-1,this._exceededTransferLimit=!1,this._fieldsIndex=null,this._hasZ=!1,this._hasM=!1,this._geometryType=t.geometryType,this._hasZ=t.hasZ,this._hasM=t.hasM,this._features=e}get fields(){return this._fieldsIndex}get geometryType(){return this._geometryType}get hasFeatures(){return!!this._features.length}get hasNext(){return this._featureIndex+1<this._features.length}get exceededTransferLimit(){return this._exceededTransferLimit}get hasZ(){return this._hasZ}get hasM(){return this._hasM}get _current(){return this._features[this._featureIndex]}get usedMemory(){return this._current.usedMemory}getSize(){return this._features.length}getCursor(){return this.copy()}getInTransform(){return this._transform}getAttributeHash(){let e=``;for(let t in this._current.attributes)e+=this._current.attributes[t];return e}getIndex(){return this._featureIndex}setIndex(e){this._featureIndex=e}getObjectId(){return this._current?.objectId}getDisplayId(){return this._current.displayId}setDisplayId(e){this._current.displayId=e}getByReferenceVertexCount(){return this._current.vertexCount}copy(){let e=new o(this._features,this.metadata);return this.copyInto(e),e}next(){for(;++this._featureIndex<this._features.length&&!this._getExists(););return this._featureIndex<this._features.length}readGeometryArea(){return r(this._current)?n(this._current.geometry,2):0}_readX(){return r(this._current)?this._current.geometry.coords[0]:0}_readY(){return r(this._current)?this._current.geometry.coords[1]:0}_readGeometry(){return r(this._current)?this._current.geometry??null:null}_readServerCentroid(){return this._current.centroid}_readAttribute(e,t){if(!this._fieldsIndex){let t=this._current.attributes[e];if(t!==void 0)return t;let n=e.toLowerCase();for(let e in this._current.attributes)if(e.toLowerCase()===n)return this._current.attributes[e];return}let n=this._fieldsIndex.get(e);if(!n)return;let r=this._current.attributes[n.name];return r==null?r:t&&this.fields.isDateField(e)?new Date(r):r}_readAttributes(){return this._current.attributes}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._transform=this._transform,e._fieldsIndex=this._fieldsIndex}}export{o as FeatureSetReaderJSON};
2
+ import has from"../../../../../core/has.js";import{convertFromFeatures as e,convertFromFeatureSet as t,getQuantizedArea as n}from"../../../../../layers/graphics/featureConversionUtils.js";import{hasGeometry as r}from"../../../../../layers/graphics/OptimizedFeature.js";import i from"../../../../../layers/support/FieldsIndex.js";import{FeatureSetReader as a}from"./FeatureSetReader.js";const o=has(`featurelayer-snapping-density-sample-interval`),s=has(`featurelayer-snapping-density-max-vertices-per-feature`),c=has(`featurelayer-snapping-density-max-distance`)**2;class l extends a{static fromFeatures(t,n){let{geometryType:r,hasZ:i,hasM:a,featureIdInfo:o}=n,s=e([],t,r,i,a,o);for(let e=0;e<s.length;e++)s[e].displayId=t[e].displayId;return l.fromOptimizedFeatures(s,n)}static fromFeatureSet(e,n){let r=t(e,n.featureIdInfo);return l.fromOptimizedFeatureSet(r,n)}static fromOptimizedFeatureSet(e,t){let n=l.fromOptimizedFeatures(e.features,t,e.transform);return n._exceededTransferLimit=e.exceededTransferLimit,n._fieldsIndex=new i(e.fields),n}static fromOptimizedFeatures(e,t,n){let r=new l(e,t);return r._fieldsIndex=t.fieldsIndex,r._transform=n,n&&(r.geometryType===`esriGeometryPolyline`||r.geometryType===`esriGeometryPolygon`)&&(r._geometryDensity=u(e)),r}static empty(e){return new l([],e)}constructor(e,t){super(t),this._geometryDensity={sampleCount:0,densePairCount:0},this._featureIndex=-1,this._exceededTransferLimit=!1,this._fieldsIndex=null,this._hasZ=!1,this._hasM=!1,this._geometryType=t.geometryType,this._hasZ=t.hasZ,this._hasM=t.hasM,this._features=e}get fields(){return this._fieldsIndex}get geometryType(){return this._geometryType}get hasFeatures(){return!!this._features.length}get hasNext(){return this._featureIndex+1<this._features.length}get exceededTransferLimit(){return this._exceededTransferLimit}get hasZ(){return this._hasZ}get hasM(){return this._hasM}get geometryDensity(){return this._geometryDensity}get _current(){return this._features[this._featureIndex]}get usedMemory(){return this._current.usedMemory}getSize(){return this._features.length}getCursor(){return this.copy()}getInTransform(){return this._transform}getAttributeHash(){let e=``;for(let t in this._current.attributes)e+=this._current.attributes[t];return e}getIndex(){return this._featureIndex}setIndex(e){this._featureIndex=e}getObjectId(){return this._current?.objectId}getDisplayId(){return this._current.displayId}setDisplayId(e){this._current.displayId=e}getByReferenceVertexCount(){return this._current.vertexCount}copy(){let e=new l(this._features,this.metadata);return this.copyInto(e),e}next(){for(;++this._featureIndex<this._features.length&&!this._getExists(););return this._featureIndex<this._features.length}readGeometryArea(){return r(this._current)?n(this._current.geometry,2):0}_readX(){return r(this._current)?this._current.geometry.coords[0]:0}_readY(){return r(this._current)?this._current.geometry.coords[1]:0}_readGeometry(){return r(this._current)?this._current.geometry??null:null}_readServerCentroid(){return this._current.centroid}_readAttribute(e,t){if(!this._fieldsIndex){let t=this._current.attributes[e];if(t!==void 0)return t;let n=e.toLowerCase();for(let e in this._current.attributes)if(e.toLowerCase()===n)return this._current.attributes[e];return}let n=this._fieldsIndex.get(e);if(!n)return;let r=this._current.attributes[n.name];return r==null?r:t&&this.fields.isDateField(e)?new Date(r):r}_readAttributes(){return this._current.attributes}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._transform=this._transform,e._fieldsIndex=this._fieldsIndex,e._geometryDensity=this._geometryDensity}}function u(e){let t={sampleCount:0,densePairCount:0};for(let n=0;n<e.length;n+=o){let r=e[n].geometry;if(!r)continue;let{coords:i,lengths:a,stride:o}=r,l=Math.min(a[0]??0,s);for(let e=1;e<l;e++){let n=e*o;t.sampleCount++;let r=i[n],a=i[n+1];r*r+a*a<=c&&t.densePairCount++}}return t}export{l as FeatureSetReaderJSON};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{baseObjectMemory as n}from"../../../../../core/memoryEstimations.js";import r from"../../../../../core/pbf.js";import i from"../../../../../layers/graphics/OptimizedGeometry.js";import{FeatureSetCache as a}from"./FeatureSetCache.js";import{FeatureSetReader as o}from"./FeatureSetReader.js";import{parseHeader as s}from"./FeatureSetReaderPBFHeader.js";const c=128e3,l={small:{delta:new Int32Array(128),decoded:new Int32Array(128)},small64:{delta:new Float64Array,decoded:new Float64Array},large:{delta:new Int32Array(c),decoded:new Int32Array(c)},large64:{delta:new Float64Array,decoded:new Float64Array}};function u(e,t){return t?e<=l.small64.delta.length?l.small64:(e<=l.large64.delta.length||(l.large64.delta=new Float64Array(Math.round(e*1.25)),l.large64.decoded=new Float64Array(Math.round(e*1.25))),l.large64):e<=l.small.delta.length?l.small:(e<=l.large.delta.length||(l.large.delta=new Int32Array(Math.round(e*1.25)),l.large.decoded=new Int32Array(Math.round(e*1.25))),l.large)}function d(t){try{let e=new r(new Uint8Array(t),new DataView(t));for(;e.next();)switch(e.tag()){case 2:return f(e.getMessage());default:e.skip()}}catch(t){throw new e(`query:parsing-pbf`,`Error while parsing FeatureSet PBF payload`,{error:t})}return null}function f(e){for(;e.next();)switch(e.tag()){case 1:return e.getMessage();default:e.skip()}return null}function p(e){let t=e.getLength(),n=e.pos()+t;for(;e.pos()<n&&e.next();)switch(e.tag()){case 1:return e.getString();case 2:return e.getFloat();case 3:return e.getDouble();case 4:return e.getSInt32();case 5:return e.getUInt32();case 6:return e.getInt64();case 7:return e.getUInt64();case 8:return e.getSInt64();case 9:return e.getBool();default:return e.skip(),null}return null}function m(e,t,n,r,i){return e?t*i-r*n===0&&t*r+n*i>0:!1}class h extends o{static fromBuffer(e,t,n=!1){let r=t.geometryType,i=d(e),a=s(i,r===`esriGeometryPoint`,t.featureIdInfo);return new h(i,a,t,n)}constructor(e,t,n,r){super(n),this._use64Bit=r,this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0},this._parseCaches=[],this._geometryType=n.geometryType,this._reader=e,this._header=t,this._hasNext=t.hasFeatures,this._isPoints=n.geometryType===`esriGeometryPoint`}get _size(){return this._header.featureCount}get fields(){return this._header.fields}get geometryType(){return this._geometryType}get hasZ(){return this._header.hasZ}get hasM(){return this._header.hasM}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getByReferenceVertexCount(){return this._header.byReferenceVertexCounts.get(this._featureIndex)}getSize(){return this._size}getInTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._featureIndex=e}getAttributeHash(){let e=``;for(let t of this._header.fields.fields)e+=this._readAttributeAtIndex(t.index)+`.`;return e}getObjectId(){if(this._header.idFieldIndices.length===1)return this._readAttributeAtIndex(this._header.idFieldIndices[0]);let e=this._header.idFieldIndices.map(e=>this._readAttributeAtIndex(e));return JSON.stringify(e)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}readGeometryArea(){return this._cache.area||this._readGeometry(!0),this._cache.area}copy(){let e=this._reader.clone(),t=new h(e,this._header,this.metadata,this._use64Bit);return this.copyInto(t),t}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0;++this._featureIndex<this._size&&!this._getExists(););return this._featureIndex<this._size}get usedMemory(){return n+(this._cache.geometry?.usedMemory??0)}get underlyingMemory(){return super.underlyingMemory+this._reader.usedMemory+this._header.usedMemory}_readX(){return this._header.centroid[this._featureIndex*this._header.stride]}_readY(){return this._header.centroid[this._featureIndex*this._header.stride+1]}_readServerCentroid(){let e=new i([],[],this.hasZ,this.hasM),{coords:t,stride:n}=e;for(let e=this._featureIndex*n,r=e+n;e<r;++e)t.push(this._header.centroid[e]);return t[0]===268435455?null:e}_readGeometry(e=!1){if((this.hasZ||this.hasM)&&(e=!1),this._cache.geometry===void 0){let t=null;if(this._isPoints)t=this._readServerCentroid();else{let n=this._header.offsets.geometry[this._featureIndex],r=this._reader;if(n===0)return null;r.move(n);try{t=e?this._parseGeometryForDisplay(r):this._parseGeometry(r)}catch{return null}}return t?.coords.length===0&&(t=null),this._cache.geometry=t,t}return this._cache.geometry}_readAttribute(e,t){let n=this._header.fields.get(e);if(n==null)return;let r=this._readAttributeAtIndex(n.index),i=this._header.fields.isDateField(n.name);return!t||r==null?r:i?new Date(r):r}_readAttributes(){let e={};for(let t of this._header.fields.fields)e[t.name]=this._readAttributeAtIndex(t.index);return e}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._featureOffset=this._featureOffset,e._hasNext=this._hasNext,e._parseCaches=this._parseCaches}_readAttributeAtIndex(e){let t=this._parseCaches[e];if(t||(t=new a(this.getSize()),this._parseCaches[e]=t),t.has(this._featureIndex))return t.get(this._featureIndex);let n=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+e],r=this._reader;r.move(n);let i=p(r);return t.set(this._featureIndex,i),i}_readGeometryDeltaDecoded(e){if(this._cache.unquantGeometry===void 0){let t=this._readGeometry(e);if(!t)return this._cache.unquantGeometry=void 0,null;let n=this.getInTransform();if(!n)return this._cache.unquantGeometry=t,t;let r=n.scale[2]??1,i=n.translate[2]??1,a=n.scale[3]??1,o=n.translate[3]??1,s=t.coords.length,c=u(s,this._use64Bit).decoded,l=t.clone(c);this._cache.unquantGeometry=l;let{lengths:d,coords:f,hasZ:p,hasM:m}=l,h=p&&(r!==1||i!==0),g=m&&(a!==1||o!==0),_=0;for(let e of d){let t=f[_++],n=f[_++];if(h){let e=f[_];f[_++]=r*e+i}if(g){let e=f[_];f[_++]=a*e+o}for(let s=1;s<e;++s){if(t=f[_++]+=t,n=f[_++]+=n,h){let e=f[_];f[_++]=r*e+i}if(g){let e=f[_];f[_++]=a*e+o}}}return l}return this._cache.unquantGeometry}_parseGeometry(e){let t=e.asUnsafe(),n=t.getPackedEnd(),r=[],a=[];for(;t.pos()<n&&t.next();)switch(t.tag()){case 2:{let e=t.getPackedEnd();for(;t.pos()<e;)a.push(t.getUInt32());break}case 3:{let e=t.getPackedEnd();for(;t.pos()<e;)r.push(t.getSInt64());break}default:t.skip()}return new i(a,r,this.hasZ,this.hasM)}_parseGeometryForDisplay(e){let n=e.asUnsafe(),r=n.getLength(),a=n.pos()+r,o=[],s=[],c=0,l=0,d=null,f=0,p=this.geometryType===`esriGeometryPolygon`,h=this.geometryType===`esriGeometryPolyline`,g=p?3:h?2:1,_=p||h;for(;n.pos()<a&&n.next();)switch(n.tag()){case 2:{let e=n.getUInt32(),t=n.pos()+e;for(;n.pos()<t;){let e=n.getUInt32();o.push(e),c+=e}d=u(c*2,this._use64Bit).delta;break}case 3:{n.getUInt32();let e=2+ +!!this.hasZ+ +!!this.hasM;t(d);for(let t of o){if(l+e*t>d.length){for(let e=0;e<t;e++)n.getSInt64(),n.getSInt64(),this.hasZ&&n.getSInt64(),this.hasM&&n.getSInt64();continue}let r=n.getSInt64(),i=n.getSInt64();this.hasZ&&n.getSInt64(),this.hasM&&n.getSInt64(),d[l++]=r,d[l++]=i;let a=1;for(let e=1;e<t;e++){let e=n.getSInt64(),t=n.getSInt64();this.hasZ&&n.getSInt64(),this.hasM&&n.getSInt64();let o=r+e,s=i+t;f+=-.5*(o-r)*(s+i),r=o,i=s,e===0&&t===0||m(_,d[l-2],d[l-1],e,t)?(d[l-2]+=e,d[l-1]+=t):(d[l++]=e,d[l++]=t,a+=1)}a>=g?s.push(a):l-=a*e}break}default:n.skip()}return this._cache.area=f,s.length?new i(s,d):d==null?null:this._createDeltaQuantizedExtrudedGeometry(d[0],d[1])}}export{h as FeatureSetReaderPBF};
2
+ import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{baseObjectMemory as n}from"../../../../../core/memoryEstimations.js";import r from"../../../../../core/pbf.js";import i from"../../../../../layers/graphics/OptimizedGeometry.js";import{FeatureSetCache as a}from"./FeatureSetCache.js";import{FeatureSetReader as o}from"./FeatureSetReader.js";import{parseHeader as s}from"./FeatureSetReaderPBFHeader.js";const c=128e3,l={small:{delta:new Int32Array(128),decoded:new Int32Array(128)},small64:{delta:new Float64Array,decoded:new Float64Array},large:{delta:new Int32Array(c),decoded:new Int32Array(c)},large64:{delta:new Float64Array,decoded:new Float64Array}};function u(e,t){return t?e<=l.small64.delta.length?l.small64:(e<=l.large64.delta.length||(l.large64.delta=new Float64Array(Math.round(e*1.25)),l.large64.decoded=new Float64Array(Math.round(e*1.25))),l.large64):e<=l.small.delta.length?l.small:(e<=l.large.delta.length||(l.large.delta=new Int32Array(Math.round(e*1.25)),l.large.decoded=new Int32Array(Math.round(e*1.25))),l.large)}function d(t){try{let e=new r(new Uint8Array(t),new DataView(t));for(;e.next();)switch(e.tag()){case 2:return f(e.getMessage());default:e.skip()}}catch(t){throw new e(`query:parsing-pbf`,`Error while parsing FeatureSet PBF payload`,{error:t})}return null}function f(e){for(;e.next();)switch(e.tag()){case 1:return e.getMessage();default:e.skip()}return null}function p(e){let t=e.getLength(),n=e.pos()+t;for(;e.pos()<n&&e.next();)switch(e.tag()){case 1:return e.getString();case 2:return e.getFloat();case 3:return e.getDouble();case 4:return e.getSInt32();case 5:return e.getUInt32();case 6:return e.getInt64();case 7:return e.getUInt64();case 8:return e.getSInt64();case 9:return e.getBool();default:return e.skip(),null}return null}function m(e,t,n,r,i){return e?t*i-r*n===0&&t*r+n*i>0:!1}class h extends o{static fromBuffer(e,t,n=!1){let r=t.geometryType,i=d(e),a=r===`esriGeometryPolyline`||r===`esriGeometryPolygon`,o=s(i,r===`esriGeometryPoint`,t.featureIdInfo,a);return new h(i,o,t,n)}constructor(e,t,n,r){super(n),this._use64Bit=r,this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0},this._parseCaches=[],this._geometryType=n.geometryType,this._reader=e,this._header=t,this._hasNext=t.hasFeatures,this._isPoints=n.geometryType===`esriGeometryPoint`}get _size(){return this._header.featureCount}get fields(){return this._header.fields}get geometryType(){return this._geometryType}get hasZ(){return this._header.hasZ}get hasM(){return this._header.hasM}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getByReferenceVertexCount(){return this._header.byReferenceVertexCounts.get(this._featureIndex)}getSize(){return this._size}getInTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._featureIndex=e}getAttributeHash(){let e=``;for(let t of this._header.fields.fields)e+=this._readAttributeAtIndex(t.index)+`.`;return e}getObjectId(){if(this._header.idFieldIndices.length===1)return this._readAttributeAtIndex(this._header.idFieldIndices[0]);let e=this._header.idFieldIndices.map(e=>this._readAttributeAtIndex(e));return JSON.stringify(e)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}readGeometryArea(){return this._cache.area||this._readGeometry(!0),this._cache.area}copy(){let e=this._reader.clone(),t=new h(e,this._header,this.metadata,this._use64Bit);return this.copyInto(t),t}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0;++this._featureIndex<this._size&&!this._getExists(););return this._featureIndex<this._size}get usedMemory(){return n+(this._cache.geometry?.usedMemory??0)}get underlyingMemory(){return super.underlyingMemory+this._reader.usedMemory+this._header.usedMemory}_readX(){return this._header.centroid[this._featureIndex*this._header.stride]}_readY(){return this._header.centroid[this._featureIndex*this._header.stride+1]}_readServerCentroid(){let e=new i([],[],this.hasZ,this.hasM),{coords:t,stride:n}=e;for(let e=this._featureIndex*n,r=e+n;e<r;++e)t.push(this._header.centroid[e]);return t[0]===268435455?null:e}_readGeometry(e=!1){if((this.hasZ||this.hasM)&&(e=!1),this._cache.geometry===void 0){let t=null;if(this._isPoints)t=this._readServerCentroid();else{let n=this._header.offsets.geometry[this._featureIndex],r=this._reader;if(n===0)return null;r.move(n);try{t=e?this._parseGeometryForDisplay(r):this._parseGeometry(r)}catch{return null}}return t?.coords.length===0&&(t=null),this._cache.geometry=t,t}return this._cache.geometry}get geometryDensity(){return this._header.geometryDensity}_readAttribute(e,t){let n=this._header.fields.get(e);if(n==null)return;let r=this._readAttributeAtIndex(n.index),i=this._header.fields.isDateField(n.name);return!t||r==null?r:i?new Date(r):r}_readAttributes(){let e={};for(let t of this._header.fields.fields)e[t.name]=this._readAttributeAtIndex(t.index);return e}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._featureOffset=this._featureOffset,e._hasNext=this._hasNext,e._parseCaches=this._parseCaches}_readAttributeAtIndex(e){let t=this._parseCaches[e];if(t||(t=new a(this.getSize()),this._parseCaches[e]=t),t.has(this._featureIndex))return t.get(this._featureIndex);let n=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+e],r=this._reader;r.move(n);let i=p(r);return t.set(this._featureIndex,i),i}_readGeometryDeltaDecoded(e){if(this._cache.unquantGeometry===void 0){let t=this._readGeometry(e);if(!t)return this._cache.unquantGeometry=void 0,null;let n=this.getInTransform();if(!n)return this._cache.unquantGeometry=t,t;let r=n.scale[2]??1,i=n.translate[2]??1,a=n.scale[3]??1,o=n.translate[3]??1,s=t.coords.length,c=u(s,this._use64Bit).decoded,l=t.clone(c);this._cache.unquantGeometry=l;let{lengths:d,coords:f,hasZ:p,hasM:m}=l,h=p&&(r!==1||i!==0),g=m&&(a!==1||o!==0),_=0;for(let e of d){let t=f[_++],n=f[_++];if(h){let e=f[_];f[_++]=r*e+i}if(g){let e=f[_];f[_++]=a*e+o}for(let s=1;s<e;++s){if(t=f[_++]+=t,n=f[_++]+=n,h){let e=f[_];f[_++]=r*e+i}if(g){let e=f[_];f[_++]=a*e+o}}}return l}return this._cache.unquantGeometry}_parseGeometry(e){let t=e.asUnsafe(),n=t.getPackedEnd(),r=[],a=[];for(;t.pos()<n&&t.next();)switch(t.tag()){case 2:{let e=t.getPackedEnd();for(;t.pos()<e;)a.push(t.getUInt32());break}case 3:{let e=t.getPackedEnd();for(;t.pos()<e;)r.push(t.getSInt64());break}default:t.skip()}return new i(a,r,this.hasZ,this.hasM)}_parseGeometryForDisplay(e){let n=e.asUnsafe(),r=n.getLength(),a=n.pos()+r,o=[],s=[],c=0,l=0,d=null,f=0,p=this.geometryType===`esriGeometryPolygon`,h=this.geometryType===`esriGeometryPolyline`,g=p?3:h?2:1,_=p||h;for(;n.pos()<a&&n.next();)switch(n.tag()){case 2:{let e=n.getUInt32(),t=n.pos()+e;for(;n.pos()<t;){let e=n.getUInt32();o.push(e),c+=e}d=u(c*2,this._use64Bit).delta;break}case 3:{n.getUInt32();let e=2+ +!!this.hasZ+ +!!this.hasM;t(d);for(let t of o){if(l+e*t>d.length){for(let e=0;e<t;e++)n.getSInt64(),n.getSInt64(),this.hasZ&&n.getSInt64(),this.hasM&&n.getSInt64();continue}let r=n.getSInt64(),i=n.getSInt64();this.hasZ&&n.getSInt64(),this.hasM&&n.getSInt64(),d[l++]=r,d[l++]=i;let a=1;for(let e=1;e<t;e++){let e=n.getSInt64(),t=n.getSInt64();this.hasZ&&n.getSInt64(),this.hasM&&n.getSInt64();let o=r+e,s=i+t;f+=-.5*(o-r)*(s+i),r=o,i=s,e===0&&t===0||m(_,d[l-2],d[l-1],e,t)?(d[l-2]+=e,d[l-1]+=t):(d[l++]=e,d[l++]=t,a+=1)}a>=g?s.push(a):l-=a*e}break}default:n.skip()}return this._cache.area=f,s.length?new i(s,d):d==null?null:this._createDeltaQuantizedExtrudedGeometry(d[0],d[1])}}export{h as FeatureSetReaderPBF};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{estimateNumberArrayMemory as e}from"../../../../../core/memoryEstimations.js";import{getFeatureIdInfoFieldNames as t}from"../../../../../layers/graphics/data/FeatureIdInfo.js";import n from"../../../../../layers/support/FieldsIndex.js";import{parseField as r,parseTransform as i}from"../../../../../rest/query/operations/pbfFeatureServiceParser.js";const a=268435455;class o{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.hasZ=!1,this.hasM=!1,this.fieldCount=0,this.featureCount=0,this.idFieldIndices=[],this.transform=null,this.vertexCount=0,this.offsets={attributes:[],geometry:[]},this.centroid=[],this.byReferenceVertexCounts=new Map}get usedMemory(){let t=0;return t+=e(this.idFieldIndices),t+=e(this.offsets.attributes),t+=e(this.offsets.geometry),t+=e(this.centroid),this.displayIds&&(t+=e(this.displayIds)),this.groupIds&&(t+=e(this.groupIds)),t}get stride(){return 2+Number(this.hasZ)+Number(this.hasM)}}function s(e,s,c){let l=e.asUnsafe(),u=l.pos(),d=new o,f=0,p=0,m=null,h=[];for(;l.next();)switch(l.tag()){case 12:m=l.processMessage(i);break;case 9:d.exceededTransferLimit=l.getBool();break;case 10:d.hasZ=l.getBool();break;case 11:d.hasM=l.getBool();break;case 13:{let e=l.processMessage(r);e.index=f++,h.push(e);break}case 15:{let e=l.getPackedEnd(),t=d.offsets.geometry,n=d.centroid;t.push(0);let{stride:r}=d;for(n.push(a),n.push(a);l.pos()<e&&l.next();)switch(l.tag()){case 1:{d.offsets.attributes.push(l.pos());let e=l.getLength();l.skipLen(e);break}case 2:if(s){let e=l.getPackedEnd();for(;l.pos()<e&&l.next();)switch(l.tag()){case 3:{let e=l.getPackedEnd(),t=p*r;for(;l.pos()<e;)d.centroid[t++]=l.getSInt64();break}default:l.skip()}}else{d.offsets.geometry[p]=l.pos();let e=l.getLength();d.vertexCount+=e,l.skipLen(e)}break;case 4:{let e=l.getLength(),t=l.pos()+e;for(;l.pos()<t&&l.next();)switch(l.tag()){case 3:{let e=l.getPackedEnd(),t=p*r;for(;l.pos()<e;)d.centroid[t++]=l.getSInt64();break}default:l.skip()}break}case 12:{let e=l.getUInt64();d.byReferenceVertexCounts.set(p,e);break}default:l.skip()}p++,d.hasFeatures=!0;break}default:l.skip()}d.fields=new n(h),d.featureCount=p,d.fieldCount=f;let g=t(c);return d.idFieldIndices=Array.from(g,e=>d.fields.get(e)?.index),d.transform=m,d.displayIds=new Uint32Array(d.featureCount),d.groupIds=new Uint16Array(d.featureCount),l.move(u),d}export{o as FeatureSetHeader,s as parseHeader};
2
+ import has from"../../../../../core/has.js";import{estimateNumberArrayMemory as e}from"../../../../../core/memoryEstimations.js";import{getFeatureIdInfoFieldNames as t}from"../../../../../layers/graphics/data/FeatureIdInfo.js";import n from"../../../../../layers/support/FieldsIndex.js";import{parseField as r,parseTransform as i}from"../../../../../rest/query/operations/pbfFeatureServiceParser.js";const a=has(`featurelayer-snapping-density-sample-interval`),o=has(`featurelayer-snapping-density-max-vertices-per-feature`),s=has(`featurelayer-snapping-density-max-distance`)**2,c=268435455;class l{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.hasZ=!1,this.hasM=!1,this.fieldCount=0,this.featureCount=0,this.idFieldIndices=[],this.transform=null,this.vertexCount=0,this.geometryDensity={sampleCount:0,densePairCount:0},this.offsets={attributes:[],geometry:[]},this.centroid=[],this.byReferenceVertexCounts=new Map}get usedMemory(){let t=0;return t+=e(this.idFieldIndices),t+=e(this.offsets.attributes),t+=e(this.offsets.geometry),t+=e(this.centroid),this.displayIds&&(t+=e(this.displayIds)),this.groupIds&&(t+=e(this.groupIds)),t}get stride(){return 2+Number(this.hasZ)+Number(this.hasM)}}function u(e,o,s,u=!1){let f=e.asUnsafe(),p=f.pos(),m=new l,h=0,g=0,_=[];for(;f.next();)switch(f.tag()){case 12:m.transform=f.processMessage(i);break;case 9:m.exceededTransferLimit=f.getBool();break;case 10:m.hasZ=f.getBool();break;case 11:m.hasM=f.getBool();break;case 13:{let e=f.processMessage(r);e.index=h++,_.push(e);break}case 15:{let t=f.getPackedEnd(),n=m.offsets.geometry,r=m.centroid;n.push(0);let{stride:i}=m;for(r.push(c),r.push(c);f.pos()<t&&f.next();)switch(f.tag()){case 1:{m.offsets.attributes.push(f.pos());let e=f.getLength();f.skipLen(e);break}case 2:if(o){let e=f.getPackedEnd();for(;f.pos()<e&&f.next();)switch(f.tag()){case 3:{let e=f.getPackedEnd(),t=g*i;for(;f.pos()<e;)m.centroid[t++]=f.getSInt64();break}default:f.skip()}}else{m.offsets.geometry[g]=f.pos();let t=f.getLength(),n=f.pos()+t;m.vertexCount+=t,u&&m.transform!=null&&g%a===0&&d(e,n,m),f.move(n)}break;case 4:{let e=f.getLength(),t=f.pos()+e;for(;f.pos()<t&&f.next();)switch(f.tag()){case 3:{let e=f.getPackedEnd(),t=g*i;for(;f.pos()<e;)m.centroid[t++]=f.getSInt64();break}default:f.skip()}break}case 12:{let e=f.getUInt64();m.byReferenceVertexCounts.set(g,e);break}default:f.skip()}g++,m.hasFeatures=!0;break}default:f.skip()}m.fields=new n(_),m.featureCount=g,m.fieldCount=h;let v=t(s);return m.idFieldIndices=Array.from(v,e=>m.fields.get(e)?.index),m.displayIds=new Uint32Array(m.featureCount),m.groupIds=new Uint16Array(m.featureCount),f.move(p),m}function d(e,t,n){let r=e.asUnsafe(),i=0,a=0,c=0;for(;r.pos()<t&&r.next();)switch(r.tag()){case 2:{let e=r.getPackedEnd();i=r.pos()<e?r.getUInt32():0,r.move(e);break}case 3:c=r.getPackedEnd(),a=r.pos(),r.move(c);break;default:r.skip()}if(i<2||!a)return;let{stride:l,geometryDensity:u}=n,d=Math.min(i,o);r.move(a);for(let e=0;e<d&&r.pos()<c;e++){let t=r.getSInt64(),n=r.getSInt64();for(let e=2;e<l;e++)r.getSInt64();e>0&&(u.sampleCount++,t*t+n*n<=s&&u.densePairCount++)}}export{l as FeatureSetHeader,u as parseHeader};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t,equals as n}from"../../../core/arrayUtils.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Error.js";import"../../../core/has.js";import a from"../../../core/Logger.js";import{abortMaybe as o,destroyMaybe as s}from"../../../core/maybe.js";import{after as c,throwIfAborted as l,isPromiseLike as u}from"../../../core/promiseUtils.js";import{watch as d,syncAndInitial as f}from"../../../core/reactiveUtils.js";import{createScreenPointArray as p,createRenderScreenPointArray as m}from"../../../core/screenUtils.js";import{convertTime as h,offsetDateUTC as g,createZonedDate as _}from"../../../core/timeUtils.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import{projectAsync as C}from"../../../geometry/projectionUtils.js";import{containsExecute as w}from"../../../geometry/operators/containsOperator.js";import{g as T}from"../../../chunks/boundedPlane.js";import{polygonToVolume as E}from"../focusAreaUtils.js";import D from"./AnalysisView3D.js";import{registerAnalysisView as O,hideOtherAnalysisViews as k}from"./ShadowCast/analysisViewRegister.js";import{ShadowCastTooltip as A}from"./ShadowCast/ShadowCastTooltip.js";import{ElevationContext as j}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as M}from"../support/earthUtils.js";import{computeDirectionsOverTime as N}from"../support/sunUtils.js";import{maxColorRampSize as P}from"../webgl-engine/shaders/colorRampParameters.js";import{breadthFirstBinaryPartitioning as F}from"../../../widgets/support/traversalUtils.js";let I=class extends D{constructor(e){super(e),this.type=`shadow-cast-view-3d`,this.analysis=null,this._updatingHandles=new S,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([O(this.view,this),d(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{o(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=r(async e=>{await c(U,e),l(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>V(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),d(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t})=>{t&&k(this.view,this),e?.setParameters({shadowCast:{enabled:t}})},f),d(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:n})=>{R(e,n,t)},f),d(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:n,visible:r})=>{R(e,r,{lightDirections:t,lightDirectionsContext:n})},f),d(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:n})=>{R(e,n,{previewing:t})},{sync:!0,initial:!0,equals:()=>!1}),d(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:n})=>{R(e,t,{analysisVolume:n})},f)]),this.interactive=!0,this._tooltip=new A({getDuration:(e,t)=>this._getDurationAtScreen(e,t),getMode:()=>this.analysis.mode,getShowsSeparateZeroBucketInHourlyMode:()=>this._showsSeparateZeroBucketInHourlyMode,getTotalDuration:()=>this._totalDuration,getTotalDurationMode:()=>this.analysis.totalDurationOptions.mode,getVisualizeSunlight:()=>this.analysis.visualizeSunlight,isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&R(this._renderer,!0,{enabled:!1}),this._tooltip=s(this._tooltip),this._stopPreviewingTask=o(this._stopPreviewingTask),this._updatingHandles=s(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||this._stopPreviewingTask!=null&&!this._stopPreviewingTask.finished||this._tooltip?.updating===!0||this._updatingHandles.updating}get visible(){return super.visible}set visible(e){super.visible=e}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews.some(e=>e.updating),s=!i?.suspended&&!!i?.updating;return a||o||s}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:M(e[0],!1)}get _dateUTCOffset(){let e=this.analysis.date;return e=g(e,-e.getTimezoneOffset(),`minutes`),e=g(e,-this._effectiveUtcOffset,`hours`),e}get _startDateTimeUTC(){return this._getDateTimeUTC(this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return this._getDateTimeUTC(this.analysis.endTimeOfDay)}_getDateTimeUTC(e){let{date:t,timeZone:n}=this.analysis;if(n==null)return g(this._dateUTCOffset,e);let r=_({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()},h(e,`milliseconds`,`minutes`),n);if(r==null)throw RangeError(`Invalid shadow cast date or time zone`);return r}get _referencePosition(){return this.view?.environmentManager?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(W-1)):W}get _interval(){let e=this._totalDurationInterval;switch(this.analysis.mode){case`min-duration`:return this._totalDuration>0?e:0;case`total-duration`:return e;case`discrete`:return this.analysis.discreteOptions.interval||e}}get _intervalContext(){let{mode:e,minDurationOptions:t}=this.analysis;return e===`min-duration`&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){return this._endDateTimeUTC.getTime()-this._startDateTimeUTC.getTime()}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){let{view:t}=this;if(e<=0)return[];let n=t.viewingMode===`global`?G:this._referencePosition;if(n==null)return[];let r=N(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.viewingMode,W),i=r.length;K.length=0;let a=F(0,i,K),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _analysisVolume(){let{geometry:e}=this.analysis;if(e==null)return this._previousVolume=null,null;try{let t=E(e,this.view,q);return t==null?(this._previousVolume=null,null):u(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return a.getLogger(this).error(new i(`shadowcastanalysisview3d:projection-failed`,`Failed to project analysis area geometry to view spatial reference`,{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case`min-duration`:return this._minDurationVisualizationParameters;case`total-duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){let{color:e,minDuration:t}=this.analysis.minDurationOptions,n=this._totalDuration;return{rendersSunlight:this.analysis.visualizeSunlight,visualization:2,thresholdColor:e.toUnitRGBA(),threshold:n>0?t/this._totalDuration:0,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){let{minDurationOptions:e,visualizeSunlight:t}=this.analysis;if(!e.contextEnabled||t)return{};let{color:n,colorStops:r}=e.contextOptions,i=1/this._lightDirectionsContext.length;return{visualization:3,gradientColorRamp:this._getEffectiveShadowCastColorRamp(n,r,i)}}get _durationVisualizationParameters(){let{color:e,colorStops:t,mode:n}=this.analysis.totalDurationOptions,r=this._totalDuration,i=r>0&&n===`hourly`?H/r:0,a=this._getEffectiveShadowCastColorRamp(e,t,1/r);return i===0?{...this._discreteVisualizationParameters,gradientColorRamp:a}:{rendersSunlight:this.analysis.visualizeSunlight,bandedGradientColorRamp:a,visualization:1,bandSize:i}}get _showsSeparateZeroBucketInHourlyMode(){let{colorStops:e}=this.analysis.totalDurationOptions;return e==null||e.length===0||e.reduce((e,t)=>Math.min(e,t.value),1/0)<=0}get _discreteVisualizationParameters(){let{color:e,colorStops:t}=this.analysis.discreteOptions,n=1/this._lightDirections.length;return{rendersSunlight:this.analysis.visualizeSunlight,gradientColorRamp:this._getEffectiveShadowCastColorRamp(e,t,n),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(B)}get _previewDependencies(){let{view:e}=this,n=e.slice.plane,r=this._shadowLayerViews,i=r.map(e=>e.layer).filter(t),a=r.map(e=>e.suspended),o=i.map(e=>e.visible),s=i.map(e=>e.opacity),c=!!e.graphicsView?.suspended,l=i.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),u=r.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:n,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:a,graphicsViewSuspended:c,layerVisibilities:o,layerOpacities:s,filters:u,definitionExpressions:l}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){return this._getDurationAtScreen(e)}async _getDurationAtScreen(e,t){if(!await this._isScreenPointInAnalysisArea(e,t))return-1;let{_renderer:n,_totalDurationSampleCount:r}=this;if(n==null||r===0)return 0;let i=this.view.state.camera.screenToRender(p(e.x,e.y),m()),a=n.readAccumulatedShadow(i);return(this.analysis.visualizeSunlight?1-a:a)*this._totalDuration}async _isScreenPointInAnalysisArea(e,t){let{geometry:n}=this.analysis;if(!n)return!0;let r=await this.view.hitTest(e);l(t);let i=r.results.find(e=>e.mapPoint)?.mapPoint??r?.ground?.mapPoint;if(!i)return!1;let a=await C(i,n.spatialReference,{signal:t});return l(t),a!=null&&w(n,a)}_getEffectiveShadowCastColorRamp(e,t,n){if(t!=null){t.length>P&&a.getLogger(this).warnOnce(`ShadowCastAnalysis supports at most 8 color stops`);let e=t.map(e=>[e.value*n,e.color.toUnitRGBA()]);return e.sort(([e],[t])=>e-t),e}return z(e)}};e([v({readOnly:!0,type:[`shadow-cast-view-3d`]})],I.prototype,`type`,void 0),e([v({constructOnly:!0,nonNullable:!0})],I.prototype,`analysis`,void 0),e([v({readOnly:!0})],I.prototype,`updating`,null),e([v()],I.prototype,`_stopPreviewingTask`,void 0),e([v()],I.prototype,`_updatedRecently`,void 0),e([v()],I.prototype,`_tooltip`,void 0),e([v()],I.prototype,`_sceneUpdating`,null),e([v()],I.prototype,`_effectiveUtcOffset`,null),e([v()],I.prototype,`_utcOffsetAuto`,null),e([v()],I.prototype,`_dateUTCOffset`,null),e([v()],I.prototype,`_startDateTimeUTC`,null),e([v()],I.prototype,`_endDateTimeUTC`,null),e([v()],I.prototype,`_referencePosition`,null),e([v()],I.prototype,`_interval`,null),e([v()],I.prototype,`_intervalContext`,null),e([v()],I.prototype,`_totalDurationSampleCount`,null),e([v()],I.prototype,`_totalDuration`,null),e([v()],I.prototype,`_lightDirections`,null),e([v()],I.prototype,`_lightDirectionsContext`,null),e([v()],I.prototype,`_analysisVolume`,null),e([v()],I.prototype,`_visualizationParameters`,null),e([v()],I.prototype,`_minDurationVisualizationParameters`,null),e([v()],I.prototype,`_minDurationContextVisualizationParameters`,null),e([v()],I.prototype,`_durationVisualizationParameters`,null),e([v()],I.prototype,`_showsSeparateZeroBucketInHourlyMode`,null),e([v()],I.prototype,`_discreteVisualizationParameters`,null),e([v()],I.prototype,`_shadowLayerViews`,null),e([v()],I.prototype,`_previewDependencies`,null),e([v()],I.prototype,`_renderer`,null),I=e([y(`esri.views.3d.analysis.ShadowCastAnalysisView3D`)],I);const L=I;function R(e,t,n){t&&n!=null&&e?.setParameters({shadowCast:n})}function z(e){let t=e.toUnitRGBA();return[[0,x(t[0],t[1],t[2],0)],[1,t]]}function B(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`gaussian-splat-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:return!1;case`group`:return!1;case`graphics-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function V(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let r=T(e.slicePlane,t.slicePlane),i=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=n(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=n(e.layerVisibilities,t.layerVisibilities),s=n(e.layerOpacities,t.layerOpacities),c=n(e.filters,t.filters),l=n(e.definitionExpressions,t.definitionExpressions);return r&&i&&a&&o&&s&&c&&l}const H=h(1,`hours`,`milliseconds`),U=500,W=255,G=b(),K=[],q=new j;export{L as default};
2
+ import{__decorate as e}from"tslib";import{isSome as t,equals as n}from"../../../core/arrayUtils.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Error.js";import"../../../core/has.js";import a from"../../../core/Logger.js";import{abortMaybe as o,destroyMaybe as s}from"../../../core/maybe.js";import{after as c,throwIfAborted as l,isPromiseLike as u}from"../../../core/promiseUtils.js";import{watch as d,syncAndInitial as f}from"../../../core/reactiveUtils.js";import{createScreenPointArray as p,createRenderScreenPointArray as m}from"../../../core/screenUtils.js";import{convertTime as h,offsetDateUTC as g,createZonedDate as _}from"../../../core/timeUtils.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import{projectAsync as C}from"../../../geometry/projectionUtils.js";import{containsExecute as w}from"../../../geometry/operators/containsOperator.js";import{g as T}from"../../../chunks/boundedPlane.js";import{polygonToVolume as E}from"../focusAreaUtils.js";import D from"./AnalysisView3D.js";import{registerAnalysisView as O,hideOtherAnalysisViews as k}from"./ShadowCast/analysisViewRegister.js";import{ShadowCastTooltip as A}from"./ShadowCast/ShadowCastTooltip.js";import{ElevationContext as j}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as M}from"../support/earthUtils.js";import{computeDirectionsOverTime as N}from"../support/sunUtils.js";import{maxColorRampSize as P}from"../webgl-engine/shaders/colorRampParameters.js";import{breadthFirstBinaryPartitioning as F}from"../../../widgets/support/traversalUtils.js";let I=class extends D{constructor(e){super(e),this.type=`shadow-cast-view-3d`,this.analysis=null,this._updatingHandles=new S,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([O(this.view,this),d(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{o(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=r(async e=>{await c(U,e),l(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>V(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),d(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t})=>{t&&k(this.view,this),e?.setParameters({shadowCast:{enabled:t}})},f),d(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:n})=>{R(e,n,t)},f),d(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:n,visible:r})=>{R(e,r,{lightDirections:t,lightDirectionsContext:n})},f),d(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:n})=>{R(e,n,{previewing:t})},{sync:!0,initial:!0,equals:()=>!1}),d(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:n})=>{R(e,t,{analysisVolume:n})},f)]),this.interactive=!0,this._tooltip=new A({getDuration:(e,t)=>this._getDurationAtScreen(e,t),getMode:()=>this.analysis.mode,getShowsSeparateZeroBucketInHourlyMode:()=>this._showsSeparateZeroBucketInHourlyMode,getTotalDuration:()=>this._totalDuration,getTotalDurationMode:()=>this.analysis.totalDurationOptions.mode,getVisualizeSunlight:()=>this.analysis.visualizeSunlight,isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&R(this._renderer,!0,{enabled:!1}),this._tooltip=s(this._tooltip),this._stopPreviewingTask=o(this._stopPreviewingTask),this._updatingHandles=s(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||this._stopPreviewingTask!=null&&!this._stopPreviewingTask.finished||this._tooltip?.updating===!0||this._updatingHandles.updating}get visible(){return super.visible}set visible(e){super.visible=e}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews.some(e=>e.updating),s=!i?.suspended&&!!i?.updating;return a||o||s}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:M(e[0],!1)}get _dateUTCOffset(){let e=this.analysis.date;return e=g(e,-e.getTimezoneOffset(),`minutes`),e=g(e,-this._effectiveUtcOffset,`hours`),e}get _startDateTimeUTC(){return this._getDateTimeUTC(this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return this._getDateTimeUTC(this.analysis.endTimeOfDay)}_getDateTimeUTC(e){let{date:t,timeZone:n}=this.analysis;if(n==null)return g(this._dateUTCOffset,e);let r=_({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()},h(e,`milliseconds`,`minutes`),n);if(r==null)throw RangeError(`Invalid shadow cast date or time zone`);return r}get _referencePosition(){return this.view?.environmentView?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(W-1)):W}get _interval(){let e=this._totalDurationInterval;switch(this.analysis.mode){case`min-duration`:return this._totalDuration>0?e:0;case`total-duration`:return e;case`discrete`:return this.analysis.discreteOptions.interval||e}}get _intervalContext(){let{mode:e,minDurationOptions:t}=this.analysis;return e===`min-duration`&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){return this._endDateTimeUTC.getTime()-this._startDateTimeUTC.getTime()}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){let{view:t}=this;if(e<=0)return[];let n=t.viewingMode===`global`?G:this._referencePosition;if(n==null)return[];let r=N(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.viewingMode,W),i=r.length;K.length=0;let a=F(0,i,K),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _analysisVolume(){let{geometry:e}=this.analysis;if(e==null)return this._previousVolume=null,null;try{let t=E(e,this.view,q);return t==null?(this._previousVolume=null,null):u(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return a.getLogger(this).error(new i(`shadowcastanalysisview3d:projection-failed`,`Failed to project analysis area geometry to view spatial reference`,{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case`min-duration`:return this._minDurationVisualizationParameters;case`total-duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){let{color:e,minDuration:t}=this.analysis.minDurationOptions,n=this._totalDuration;return{rendersSunlight:this.analysis.visualizeSunlight,visualization:2,thresholdColor:e.toUnitRGBA(),threshold:n>0?t/this._totalDuration:0,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){let{minDurationOptions:e,visualizeSunlight:t}=this.analysis;if(!e.contextEnabled||t)return{};let{color:n,colorStops:r}=e.contextOptions,i=1/this._lightDirectionsContext.length;return{visualization:3,gradientColorRamp:this._getEffectiveShadowCastColorRamp(n,r,i)}}get _durationVisualizationParameters(){let{color:e,colorStops:t,mode:n}=this.analysis.totalDurationOptions,r=this._totalDuration,i=r>0&&n===`hourly`?H/r:0,a=this._getEffectiveShadowCastColorRamp(e,t,1/r);return i===0?{...this._discreteVisualizationParameters,gradientColorRamp:a}:{rendersSunlight:this.analysis.visualizeSunlight,bandedGradientColorRamp:a,visualization:1,bandSize:i}}get _showsSeparateZeroBucketInHourlyMode(){let{colorStops:e}=this.analysis.totalDurationOptions;return e==null||e.length===0||e.reduce((e,t)=>Math.min(e,t.value),1/0)<=0}get _discreteVisualizationParameters(){let{color:e,colorStops:t}=this.analysis.discreteOptions,n=1/this._lightDirections.length;return{rendersSunlight:this.analysis.visualizeSunlight,gradientColorRamp:this._getEffectiveShadowCastColorRamp(e,t,n),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(B)}get _previewDependencies(){let{view:e}=this,n=e.slice.plane,r=this._shadowLayerViews,i=r.map(e=>e.layer).filter(t),a=r.map(e=>e.suspended),o=i.map(e=>e.visible),s=i.map(e=>e.opacity),c=!!e.graphicsView?.suspended,l=i.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),u=r.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:n,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:a,graphicsViewSuspended:c,layerVisibilities:o,layerOpacities:s,filters:u,definitionExpressions:l}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){return this._getDurationAtScreen(e)}async _getDurationAtScreen(e,t){if(!await this._isScreenPointInAnalysisArea(e,t))return-1;let{_renderer:n,_totalDurationSampleCount:r}=this;if(n==null||r===0)return 0;let i=this.view.state.camera.screenToRender(p(e.x,e.y),m()),a=n.readAccumulatedShadow(i);return(this.analysis.visualizeSunlight?1-a:a)*this._totalDuration}async _isScreenPointInAnalysisArea(e,t){let{geometry:n}=this.analysis;if(!n)return!0;let r=await this.view.hitTest(e);l(t);let i=r.results.find(e=>e.mapPoint)?.mapPoint??r?.ground?.mapPoint;if(!i)return!1;let a=await C(i,n.spatialReference,{signal:t});return l(t),a!=null&&w(n,a)}_getEffectiveShadowCastColorRamp(e,t,n){if(t!=null){t.length>P&&a.getLogger(this).warnOnce(`ShadowCastAnalysis supports at most 8 color stops`);let e=t.map(e=>[e.value*n,e.color.toUnitRGBA()]);return e.sort(([e],[t])=>e-t),e}return z(e)}};e([v({readOnly:!0,type:[`shadow-cast-view-3d`]})],I.prototype,`type`,void 0),e([v({constructOnly:!0,nonNullable:!0})],I.prototype,`analysis`,void 0),e([v({readOnly:!0})],I.prototype,`updating`,null),e([v()],I.prototype,`_stopPreviewingTask`,void 0),e([v()],I.prototype,`_updatedRecently`,void 0),e([v()],I.prototype,`_tooltip`,void 0),e([v()],I.prototype,`_sceneUpdating`,null),e([v()],I.prototype,`_effectiveUtcOffset`,null),e([v()],I.prototype,`_utcOffsetAuto`,null),e([v()],I.prototype,`_dateUTCOffset`,null),e([v()],I.prototype,`_startDateTimeUTC`,null),e([v()],I.prototype,`_endDateTimeUTC`,null),e([v()],I.prototype,`_referencePosition`,null),e([v()],I.prototype,`_interval`,null),e([v()],I.prototype,`_intervalContext`,null),e([v()],I.prototype,`_totalDurationSampleCount`,null),e([v()],I.prototype,`_totalDuration`,null),e([v()],I.prototype,`_lightDirections`,null),e([v()],I.prototype,`_lightDirectionsContext`,null),e([v()],I.prototype,`_analysisVolume`,null),e([v()],I.prototype,`_visualizationParameters`,null),e([v()],I.prototype,`_minDurationVisualizationParameters`,null),e([v()],I.prototype,`_minDurationContextVisualizationParameters`,null),e([v()],I.prototype,`_durationVisualizationParameters`,null),e([v()],I.prototype,`_showsSeparateZeroBucketInHourlyMode`,null),e([v()],I.prototype,`_discreteVisualizationParameters`,null),e([v()],I.prototype,`_shadowLayerViews`,null),e([v()],I.prototype,`_previewDependencies`,null),e([v()],I.prototype,`_renderer`,null),I=e([y(`esri.views.3d.analysis.ShadowCastAnalysisView3D`)],I);const L=I;function R(e,t,n){t&&n!=null&&e?.setParameters({shadowCast:n})}function z(e){let t=e.toUnitRGBA();return[[0,x(t[0],t[1],t[2],0)],[1,t]]}function B(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`gaussian-splat-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:return!1;case`group`:return!1;case`graphics-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function V(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let r=T(e.slicePlane,t.slicePlane),i=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=n(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=n(e.layerVisibilities,t.layerVisibilities),s=n(e.layerOpacities,t.layerOpacities),c=n(e.filters,t.filters),l=n(e.definitionExpressions,t.definitionExpressions);return r&&i&&a&&o&&s&&c&&l}const H=h(1,`hours`,`milliseconds`),U=500,W=255,G=b(),K=[],q=new j;export{L as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import n from"../../../../core/Accessor.js";import"../../../../core/has.js";import{createAbortError as r,throwIfAborted as i,onAbort as a}from"../../../../core/promiseUtils.js";import{watch as o,sync as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getConvertedElevation as d,absoluteHeightElevationInfo as f}from"../../../../support/elevationInfoUtils.js";import p from"../../../../symbols/support/ElevationInfo.js";import{createDrawTool as m,getFeatureReference as h}from"./placementUtils.js";import{detachToolFromView as g}from"./toolLifecycleUtils.js";import _ from"./ViewshedPlacementOperation.js";import{createViewshedPlacementRootPluginConfiguration as v}from"./ViewshedPlacementRootPlugin.js";import{computeParametersFromTargetPoint as y}from"./viewshedToolUtils.js";import{vectorToRender as b}from"../../interactive/support/viewUtils.js";import{DrawManipulator3D as x}from"../../../draw/DrawManipulator3D.js";import{ViewEventPriorities as S}from"../../../input/InputManager.js";import{sketchKeys as C}from"../../../interactive/keybindings.js";import{bindViewToolOptions as w}from"../../../interactive/options/bindViewToolOptions.js";import T from"../../../interactive/options/InteractiveToolOptions.js";const E=Symbol(`hiddenManipulatorHandle`);let D=class extends n{constructor(e){super(e),this.placementMode=`multiple`,this.observerPlacementElevationInfo=null,this.stagedViewshed=null,this._placeOperation=null,this._drawTool=null,this._renderer=null,this._toolOptions=new T,this._observerScenePoint=u(),this._targetScenePoint=u(),this._mapPointVector=u(),this.creationState=null}initialize(){this.addHandles([w(this._toolOptions,()=>this.view.options),o(()=>[this._drawTool?.tooltipManager,this.creationState],([e,t])=>{e&&(e.enabled=t===`placing-observer`)}),o(()=>[this._drawTool?.activeTooltipInfo,this.creationState],([e,t])=>{e&&(e.elevationModeContext=t===`placing-observer`?this._elevationModeContext:null)}),this.view.on(`key-down`,e=>this._handleKeyDown(e),S.DEFAULT),o(()=>{let{stagedViewshed:e}=this;return{stagedViewshed:e,stagedViewshedInAnalysis:e!=null&&this.analysis.viewsheds.includes(e)}},({stagedViewshed:e,stagedViewshedInAnalysis:t})=>{e!=null&&!t&&this.analysis.viewsheds.add(e)},s)])}destroy(){this._cancelPlacementOperation()}get updating(){return!!this._drawTool?.updating}get active(){return!!this._drawTool?.active}get _elevationModeContext(){let e=this;return{get mode(){return e._observerDrawToolElevationInfo.mode},get disabled(){return!e._drawTool?.interactiveHandleManager?.focusedHandle?.outputMapPosition},onChange:e=>this.setElevationMode(e)}}setElevationMode(e){let t=this._drawTool,n=t?.interactiveHandleManager?.focusedHandle,r=n?.outputMapPosition;if(this.creationState!==`placing-observer`||!t||!n||!r||e===this._observerDrawToolElevationInfo.mode)return;let i=this.observerPlacementElevationInfo?.clone()??new p;i.mode=e;let a=r.clone();t.activeTooltipInfo?.getConstraintFieldByName(n,`elevation`)?.locked||(a.z=d(this.view,r,this._observerDrawToolElevationInfo,i)),t.defaultZ=a.z,this.observerPlacementElevationInfo=i,t.elevationInfo=i,n.inputMapPosition=a.clone(),n.selectedSnappingResult=null,n.outputMapPosition=a}startPlaceOperation(e,t){this._removeStaged(),this.creationState=null,this._rejectPlaceOperation(r()),i(t);let{resolve:n,reject:o,promise:s}=Promise.withResolvers(),c=a(t,()=>this._cancelPlacementOperation());return this._placeOperation=new _({abortHandle:c,reject:o,resolve:n}),this.placementMode=e,this.observerPlacementElevationInfo=t?.elevationInfo,this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),s}cancelPlaceOperation(){(this.creationState!=null||this._placeOperation!=null)&&(this._cancelPlacementOperation(),this.callbacks.cancelTool())}_handleDeleteDuringCreation(){return this.creationState!=null&&(this._destroyDrawTool(),this._removeStaged(),this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),!0)}_handleKeyDown(e){this.creationState!=null&&(C.cancel===e.key?(this._handleCancelDuringCreation(),e.stopPropagation(),e.preventDefault()):C.delete.includes(e.key)&&(this._handleDeleteDuringCreation(),e.stopPropagation(),e.preventDefault()))}_handleCancelDuringCreation(){this._removeStaged()&&this.placementMode===`multiple`?(this.callbacks.setSelectedViewshed(null),this._startObserverPlacement()):(this._destroyDrawTool(),this._abortCreation())}_removeStaged(){let{stagedViewshed:e}=this;return this.stagedViewshed=null,e?(this.analysis.viewsheds.remove(e),!0):!1}_cancelPlacementOperation(){this._destroyDrawTool(),this._removeStaged(),this.creationState=null,this._finishPlaceOperation()}_abortCreation(){this.callbacks.cancelTool(),this.creationState=null,this._finishPlaceOperation()}_handleObserverPlacementComplete(e,n,r){let i=new t({observer:e,elevationInfo:this.observerPlacementElevationInfo,feature:r});this.analysis.viewsheds.add(i),this.stagedViewshed=i,this.creationState=`placing-target`,this._updateStagedViewshed(n),this.callbacks.setSelectedViewshed(null)}_onCancel(e){let t=this._removeStaged();if(this.creationState===`placing-observer`){if(t&&this.placementMode===`multiple`){this.callbacks.setSelectedViewshed(null),this._startObserverPlacement();return}this._destroyDrawTool(e),this._abortCreation()}else t?(this.creationState=`placing-observer`,this.callbacks.setSelectedViewshed(null),this.placementMode===`multiple`?this._startPointPlacement():(this._destroyDrawTool(e),this._abortCreation())):(this._destroyDrawTool(e),this._abortCreation())}_handleTargetPlacementComplete(e){this._updateStagedViewshed(e);let t=this.stagedViewshed;return t?.valid?(this._placeOperation?.markPlacedViewshed(),this.stagedViewshed=null,this.callbacks.setSelectedViewshed(t),!0):!1}_finishPlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.finish())}_rejectPlaceOperation(e){this._clearPlaceOperationAndRun(t=>t?.reject(e))}_clearPlaceOperationAndRun(e){let t=this._placeOperation;this._placeOperation=null,this.observerPlacementElevationInfo=null,e(t)}_startObserverPlacement(){this.creationState=`placing-observer`,this._startPointPlacement()}_startPointPlacement(){this._drawTool&&this._destroyDrawTool(this._drawTool);let{drawTool:e,renderer:t}=m({analysisViewData:this.analysisViewData,snappingManager:this.snappingManager,view:this.view,toolOptions:this._toolOptions,elevationInfo:this._observerDrawToolElevationInfo,onCancel:e=>this._onCancel(e),onComplete:e=>this._onComplete(e),onManipulatorCountChange:e=>this._onManipulatorCountChange(e),isPlacingObserver:()=>this.creationState===`placing-observer`});this._drawTool=e,this._renderer=t;try{this.view.addAndActivateTool(e),e.begin([v({mode:this.placementMode,onObserverComplete:(e,t)=>this._onObserverMapPointComplete(e,t),onTargetComplete:e=>this._onTargetMapPointComplete(e),onObserverPreview:e=>this._onObserverMapPointPreview(e),onTargetPreview:e=>this._onTargetMapPointPreview(e)})])}catch(t){this._destroyDrawTool(e),this._rejectPlaceOperation(t instanceof Error?t:Error(String(t)))}}_onComplete(e){this._removeStaged(),this._finishPlaceOperation(),this._destroyDrawTool(e),this.creationState=null}_onObserverMapPointComplete(e,t){let{intersector:n,snappingManager:r,view:i}=this,a=e.clone(),o=this._toScenePoint(e,this._targetScenePoint,this._observerDrawToolElevationInfo),s=h({intersector:n,snappingManager:r,screenPoint:t,view:i});this._renderer?.updatePlacementLocation(o),this._handleObserverPlacementComplete(a,o,s),this._setDrawToolElevationInfo(f)}_onTargetMapPointComplete(e){let t=this._toScenePoint(e,this._targetScenePoint);return this._renderer?.updatePlacementLocation(t),this._handleTargetPlacementComplete(t)?(this.placementMode===`multiple`&&(this.creationState=`placing-observer`,this._setDrawToolElevationInfo(this._observerDrawToolElevationInfo),this._onObserverMapPointPreview(e)),!0):!1}_onObserverMapPointPreview(e){let t=e.clone(),n=this._toScenePoint(t,this._observerScenePoint,this._observerDrawToolElevationInfo);this._renderer?.updatePlacementLocation(n)}_onTargetMapPointPreview(e){let t=this._toScenePoint(e,this._targetScenePoint);this._renderer?.updatePlacementLocation(t),this._updateStagedViewshed(t)}_setDrawToolElevationInfo(e){let t=this._drawTool;t&&(t.elevationInfo=e)}get _observerDrawToolElevationInfo(){return this.observerPlacementElevationInfo??f}_onManipulatorCountChange(e){e.removeHandles(E);let t=[];e.manipulators.forEach(({manipulator:e})=>{e instanceof x&&t.push(e.disableDisplay())}),e.addHandles(t,E)}_destroyDrawTool(e=this._drawTool){this._drawTool=null,this._renderer=null,e&&g(this.view,e)}_toScenePoint(e,t,n=f){let{x:r,y:i,z:a,spatialReference:o}=e,s=this._mapPointVector;return s[0]=r,s[1]=i,s[2]=a??0,b(s,o,n,this.view,t)}_updateStagedViewshed(e){let t=this.stagedViewshed;if(!t)return;let n=this.callbacks.findViewshedComputedData(t);if(!n)return;let{heading:r,tilt:i,farDistance:a}=y(this.view,n,e);t.farDistance=a,t.tilt=i,t.heading=r}get test(){}};e([c({constructOnly:!0})],D.prototype,`analysis`,void 0),e([c({constructOnly:!0})],D.prototype,`analysisViewData`,void 0),e([c({constructOnly:!0})],D.prototype,`intersector`,void 0),e([c({constructOnly:!0})],D.prototype,`snappingManager`,void 0),e([c({constructOnly:!0})],D.prototype,`view`,void 0),e([c({constructOnly:!0})],D.prototype,`callbacks`,void 0),e([c()],D.prototype,`placementMode`,void 0),e([c()],D.prototype,`observerPlacementElevationInfo`,void 0),e([c()],D.prototype,`stagedViewshed`,void 0),e([c()],D.prototype,`_placeOperation`,void 0),e([c()],D.prototype,`_drawTool`,void 0),e([c()],D.prototype,`_renderer`,void 0),e([c()],D.prototype,`_toolOptions`,void 0),e([c()],D.prototype,`updating`,null),e([c()],D.prototype,`active`,null),e([c()],D.prototype,`creationState`,void 0),e([c()],D.prototype,`_elevationModeContext`,null),D=e([l(`esri.views.3d.analysis.Viewshed.ViewshedPlacementController`)],D);export{D as ViewshedPlacementController};
2
+ import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import n from"../../../../core/Accessor.js";import"../../../../core/has.js";import{createAbortError as r,throwIfAborted as i,onAbort as a}from"../../../../core/promiseUtils.js";import{watch as o,sync as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getConvertedElevation as d,absoluteHeightElevationInfo as f}from"../../../../support/elevationInfoUtils.js";import p from"../../../../symbols/support/ElevationInfo.js";import{createDrawTool as m,getFeatureReference as h}from"./placementUtils.js";import{detachToolFromView as g}from"./toolLifecycleUtils.js";import _ from"./ViewshedPlacementOperation.js";import{createViewshedPlacementRootPluginConfiguration as v}from"./ViewshedPlacementRootPlugin.js";import{computeParametersFromTargetPoint as y}from"./viewshedToolUtils.js";import{vectorToRender as b}from"../../interactive/support/viewUtils.js";import{DrawManipulator3D as x}from"../../../draw/DrawManipulator3D.js";import{ViewEventPriorities as S}from"../../../input/InputManager.js";import{sketchKeys as C}from"../../../interactive/keybindings.js";import{bindViewToolOptions as w}from"../../../interactive/options/bindViewToolOptions.js";import T from"../../../interactive/options/InteractiveToolOptions.js";const E=Symbol(`hiddenManipulatorHandle`);let D=class extends n{constructor(e){super(e),this.placementMode=`multiple`,this.observerPlacementElevationInfo=null,this.stagedViewshed=null,this._placeOperation=null,this._drawTool=null,this._renderer=null,this._toolOptions=new T,this._observerScenePoint=u(),this._targetScenePoint=u(),this._mapPointVector=u(),this.creationState=null}initialize(){this.addHandles([w(this._toolOptions,()=>this.view.options),o(()=>[this._drawTool?.tooltipManager,this.creationState],([e,t])=>{e&&(e.enabled=t===`placing-observer`)}),o(()=>[this._drawTool?.activeTooltipInfo,this.creationState],([e,t])=>{e&&(e.elevationModeContext=t===`placing-observer`?this._elevationModeContext:null)}),this.view.on(`key-down`,e=>this._handleKeyDown(e),S.DEFAULT),o(()=>{let{stagedViewshed:e}=this;return{stagedViewshed:e,stagedViewshedInAnalysis:e!=null&&this.analysis.viewsheds.includes(e)}},({stagedViewshed:e,stagedViewshedInAnalysis:t})=>{e!=null&&!t&&this.analysis.viewsheds.add(e)},s)])}destroy(){this._cancelPlacementOperation()}get updating(){return!!this._drawTool?.updating}get active(){return!!this._drawTool?.active}get _elevationModeContext(){let e=this;return{get mode(){return e._observerDrawToolElevationInfo.mode},get disabled(){return!e._drawTool?.interactiveHandleManager?.focusedHandle?.outputMapPosition},onChange:e=>this.setElevationMode(e)}}setElevationMode(e){let t=this._drawTool,n=t?.interactiveHandleManager?.focusedHandle,r=n?.outputMapPosition;if(this.creationState!==`placing-observer`||!t||!n||!r||e===this._observerDrawToolElevationInfo.mode)return;let i=this.observerPlacementElevationInfo?.clone()??new p;i.mode=e;let a=r.clone();t.activeTooltipInfo?.getConstraintFieldByName(n,`elevation`)?.locked||(a.z=d(this.view,r,this._observerDrawToolElevationInfo,i)),t.defaultZ=a.z,this.observerPlacementElevationInfo=i,t.elevationInfo=i,n.inputMapPosition=a.clone(),n.selectedSnappingResult=null,n.outputMapPosition=a}startPlaceOperation(e,t){this._removeStaged(),this.creationState=null,this._rejectPlaceOperation(r()),i(t);let{resolve:n,reject:o,promise:s}=Promise.withResolvers(),c=a(t,()=>this._cancelPlacementOperation());this._placeOperation=new _({abortHandle:c,reject:o,resolve:n}),this.placementMode=e;let l=t?.elevationInfo;return this.observerPlacementElevationInfo=l?new p({featureExpressionInfo:l.featureExpressionInfo,mode:l.mode,offset:l.offset,unit:l.unit}):null,this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),s}cancelPlaceOperation(){(this.creationState!=null||this._placeOperation!=null)&&(this._cancelPlacementOperation(),this.callbacks.cancelTool())}_handleDeleteDuringCreation(){return this.creationState!=null&&(this._destroyDrawTool(),this._removeStaged(),this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),!0)}_handleKeyDown(e){this.creationState!=null&&(C.cancel===e.key?(this._handleCancelDuringCreation(),e.stopPropagation(),e.preventDefault()):C.delete.includes(e.key)&&(this._handleDeleteDuringCreation(),e.stopPropagation(),e.preventDefault()))}_handleCancelDuringCreation(){this._removeStaged()&&this.placementMode===`multiple`?(this.callbacks.setSelectedViewshed(null),this._startObserverPlacement()):(this._destroyDrawTool(),this._abortCreation())}_removeStaged(){let{stagedViewshed:e}=this;return this.stagedViewshed=null,e?(this.analysis.viewsheds.remove(e),!0):!1}_cancelPlacementOperation(){this._destroyDrawTool(),this._removeStaged(),this.creationState=null,this._finishPlaceOperation()}_abortCreation(){this.callbacks.cancelTool(),this.creationState=null,this._finishPlaceOperation()}_handleObserverPlacementComplete(e,n,r){let i=new t({observer:e,elevationInfo:this.observerPlacementElevationInfo,feature:r});this.analysis.viewsheds.add(i),this.stagedViewshed=i,this.creationState=`placing-target`,this._updateStagedViewshed(n),this.callbacks.setSelectedViewshed(null)}_onCancel(e){let t=this._removeStaged();if(this.creationState===`placing-observer`){if(t&&this.placementMode===`multiple`){this.callbacks.setSelectedViewshed(null),this._startObserverPlacement();return}this._destroyDrawTool(e),this._abortCreation()}else t?(this.creationState=`placing-observer`,this.callbacks.setSelectedViewshed(null),this.placementMode===`multiple`?this._startPointPlacement():(this._destroyDrawTool(e),this._abortCreation())):(this._destroyDrawTool(e),this._abortCreation())}_handleTargetPlacementComplete(e){this._updateStagedViewshed(e);let t=this.stagedViewshed;return t?.valid?(this._placeOperation?.markPlacedViewshed(),this.stagedViewshed=null,this.callbacks.setSelectedViewshed(t),!0):!1}_finishPlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.finish())}_rejectPlaceOperation(e){this._clearPlaceOperationAndRun(t=>t?.reject(e))}_clearPlaceOperationAndRun(e){let t=this._placeOperation;this._placeOperation=null,this.observerPlacementElevationInfo=null,e(t)}_startObserverPlacement(){this.creationState=`placing-observer`,this._startPointPlacement()}_startPointPlacement(){this._drawTool&&this._destroyDrawTool(this._drawTool);let{drawTool:e,renderer:t}=m({analysisViewData:this.analysisViewData,snappingManager:this.snappingManager,view:this.view,toolOptions:this._toolOptions,elevationInfo:this._observerDrawToolElevationInfo,onCancel:e=>this._onCancel(e),onComplete:e=>this._onComplete(e),onManipulatorCountChange:e=>this._onManipulatorCountChange(e),isPlacingObserver:()=>this.creationState===`placing-observer`});this._drawTool=e,this._renderer=t;try{this.view.addAndActivateTool(e),e.begin([v({mode:this.placementMode,onObserverComplete:(e,t)=>this._onObserverMapPointComplete(e,t),onTargetComplete:e=>this._onTargetMapPointComplete(e),onObserverPreview:e=>this._onObserverMapPointPreview(e),onTargetPreview:e=>this._onTargetMapPointPreview(e)})])}catch(t){this._destroyDrawTool(e),this._rejectPlaceOperation(t instanceof Error?t:Error(String(t)))}}_onComplete(e){this._removeStaged(),this._finishPlaceOperation(),this._destroyDrawTool(e),this.creationState=null}_onObserverMapPointComplete(e,t){let{intersector:n,snappingManager:r,view:i}=this,a=e.clone(),o=this._toScenePoint(e,this._targetScenePoint,this._observerDrawToolElevationInfo),s=h({intersector:n,snappingManager:r,screenPoint:t,view:i});this._renderer?.updatePlacementLocation(o),this._handleObserverPlacementComplete(a,o,s),this._setDrawToolElevationInfo(f)}_onTargetMapPointComplete(e){let t=this._toScenePoint(e,this._targetScenePoint);return this._renderer?.updatePlacementLocation(t),this._handleTargetPlacementComplete(t)?(this.placementMode===`multiple`&&(this.creationState=`placing-observer`,this._setDrawToolElevationInfo(this._observerDrawToolElevationInfo),this._onObserverMapPointPreview(e)),!0):!1}_onObserverMapPointPreview(e){let t=e.clone(),n=this._toScenePoint(t,this._observerScenePoint,this._observerDrawToolElevationInfo);this._renderer?.updatePlacementLocation(n)}_onTargetMapPointPreview(e){let t=this._toScenePoint(e,this._targetScenePoint);this._renderer?.updatePlacementLocation(t),this._updateStagedViewshed(t)}_setDrawToolElevationInfo(e){let t=this._drawTool;t&&(t.elevationInfo=e)}get _observerDrawToolElevationInfo(){return this.observerPlacementElevationInfo??f}_onManipulatorCountChange(e){e.removeHandles(E);let t=[];e.manipulators.forEach(({manipulator:e})=>{e instanceof x&&t.push(e.disableDisplay())}),e.addHandles(t,E)}_destroyDrawTool(e=this._drawTool){this._drawTool=null,this._renderer=null,e&&g(this.view,e)}_toScenePoint(e,t,n=f){let{x:r,y:i,z:a,spatialReference:o}=e,s=this._mapPointVector;return s[0]=r,s[1]=i,s[2]=a??0,b(s,o,n,this.view,t)}_updateStagedViewshed(e){let t=this.stagedViewshed;if(!t)return;let n=this.callbacks.findViewshedComputedData(t);if(!n)return;let{heading:r,tilt:i,farDistance:a}=y(this.view,n,e);t.farDistance=a,t.tilt=i,t.heading=r}get test(){}};e([c({constructOnly:!0})],D.prototype,`analysis`,void 0),e([c({constructOnly:!0})],D.prototype,`analysisViewData`,void 0),e([c({constructOnly:!0})],D.prototype,`intersector`,void 0),e([c({constructOnly:!0})],D.prototype,`snappingManager`,void 0),e([c({constructOnly:!0})],D.prototype,`view`,void 0),e([c({constructOnly:!0})],D.prototype,`callbacks`,void 0),e([c()],D.prototype,`placementMode`,void 0),e([c()],D.prototype,`observerPlacementElevationInfo`,void 0),e([c()],D.prototype,`stagedViewshed`,void 0),e([c()],D.prototype,`_placeOperation`,void 0),e([c()],D.prototype,`_drawTool`,void 0),e([c()],D.prototype,`_renderer`,void 0),e([c()],D.prototype,`_toolOptions`,void 0),e([c()],D.prototype,`updating`,null),e([c()],D.prototype,`active`,null),e([c()],D.prototype,`creationState`,void 0),e([c()],D.prototype,`_elevationModeContext`,null),D=e([l(`esri.views.3d.analysis.Viewshed.ViewshedPlacementController`)],D);export{D as ViewshedPlacementController};
@@ -1,5 +1,6 @@
1
1
  import type ElevationInfo from "../../../../symbols/support/ElevationInfo.js";
2
2
  import type { AbortOptions } from "../../../../core/promiseUtils.js";
3
+ import type { ElevationInfoProperties } from "../../../../symbols/support/ElevationInfo.js";
3
4
 
4
5
  /**
5
6
  * Options for placing a viewshed interactively.
@@ -9,10 +10,11 @@ import type { AbortOptions } from "../../../../core/promiseUtils.js";
9
10
  export interface ViewshedPlacementOptions extends AbortOptions {
10
11
  /**
11
12
  * Specifies how the placed viewshed observer is positioned on the vertical axis (z).
13
+ * Accepts an [ElevationInfo](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/ElevationInfo/) instance or a plain object with elevation information properties.
12
14
  *
13
15
  * @since 5.2
14
16
  */
15
- elevationInfo?: ElevationInfo | null;
17
+ elevationInfo?: ElevationInfo | ElevationInfoProperties | null;
16
18
  }
17
19
 
18
20
  /**
@@ -36,8 +36,8 @@ export default class Environment extends WebSceneEnvironment {
36
36
  get lighting(): LightingUnion;
37
37
  set lighting(value: ((SunLightingProperties & { type?: "sun" }) | (VirtualLightingProperties & { type: "virtual" })));
38
38
  /**
39
- * Indicates if weather visualization is available. This read-only property is
40
- * `true` only in global scenes at low altitudes. It is `false` in local scenes or at high altitudes.
39
+ * Indicates if weather visualization is available. This read-only property is `true` only in global scenes at low
40
+ * altitudes. It is `false` in local scenes or at high altitudes.
41
41
  *
42
42
  * @since 5.0
43
43
  */
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{destroyHandle as t}from"../../../core/handleUtils.js";import{clone as n}from"../../../core/lang.js";import{property as r,cast as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import{ensureOneOfType as o}from"../../../core/accessorSupport/ensureType.js";import{lightingTypes as s}from"./lightingUtils.js";import c from"./SunLighting.js";import l from"./VirtualLighting.js";import u from"../../../webscene/Environment.js";import d from"../../../webscene/SunLighting.js";import f from"../../../webscene/VirtualLighting.js";var p;let m=class extends u{static{p=this}constructor(e){super(e),this.lighting=this.castLighting(),this._computeWeatherAvailable=void 0,this.cachedCameraTrackingEnabled=null}static fromWebsceneEnvironment(e){let t=e.cloneConstructProperties();return new p({...t,lighting:t.lighting?t.lighting.type===`virtual`?l.fromWebsceneLighting(t.lighting):c.fromWebsceneLighting(t.lighting):void 0})}get weatherAvailable(){return this._computeWeatherAvailable?.()??!1}setComputeWeatherAvailable(e){this._computeWeatherAvailable=e}castLighting(e){return this._convertLightingWithDestroy(e)}applyLighting(e){this.lighting=this._convertLightingWithDestroy(e)}_convertLightingWithDestroy(e){let n=this._convertLighting(e);return n!==e&&this.addHandles(t(n)),n}_convertLighting(e){return e?e instanceof c||e instanceof l?e:e instanceof d?this.lighting&&this.lighting.type!==`virtual`?this.lighting.cloneWithWebsceneLighting(e):new c({...e.cloneConstructProperties(),...this.lighting?.cloneNonPersistentConstructProperties()}):e instanceof f?this.lighting&&this.lighting.type===`virtual`?this.lighting.cloneWithWebsceneLighting(e):new l({...e.cloneConstructProperties(),...this.lighting?.cloneNonPersistentConstructProperties()}):o(s,e):new c}clone(){return new p({lighting:this.lighting.clone(),weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:n(this.background)})}cloneWithWebsceneEnvironment(e){return new p({weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:n(this.background),...e.cloneConstructProperties(),lighting:this._getLighting(e)})}_getLighting(e){switch(e.lighting.type){case`sun`:return this.lighting&&this.lighting.type===`sun`?this.lighting.cloneWithWebsceneLighting(e.lighting):c.fromWebsceneLighting(e.lighting);case`virtual`:return this.lighting&&this.lighting.type===`virtual`?this.lighting.cloneWithWebsceneLighting(e.lighting):l.fromWebsceneLighting(e.lighting);default:return e.lighting,c.fromWebsceneLighting(e.lighting)}}};e([r({types:{defaultKeyValue:`sun`,...s},nonNullable:!0})],m.prototype,`lighting`,void 0),e([r()],m.prototype,`_computeWeatherAvailable`,void 0),e([r({readOnly:!0})],m.prototype,`weatherAvailable`,null),e([i(`lighting`)],m.prototype,`castLighting`,null),m=p=e([a(`esri.views.3d.environment.Environment`)],m);const h=m;export{h as default};
2
+ import{__decorate as e}from"tslib";import{destroyHandle as t}from"../../../core/handleUtils.js";import{clone as n}from"../../../core/lang.js";import{property as r,cast as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import{ensureOneOfType as o}from"../../../core/accessorSupport/ensureType.js";import{lightingTypes as s}from"./lightingUtils.js";import c from"./SunLighting.js";import l from"./VirtualLighting.js";import u from"../../../webscene/Environment.js";import d from"../../../webscene/SunLighting.js";import f from"../../../webscene/VirtualLighting.js";var p;let m=class extends u{static{p=this}constructor(e){super(e),this.lighting=this.castLighting(),this._weatherAvailable=!1,this.cachedCameraTrackingEnabled=null}static fromWebsceneEnvironment(e){let t=e.cloneConstructProperties();return new p({...t,lighting:t.lighting?t.lighting.type===`virtual`?l.fromWebsceneLighting(t.lighting):c.fromWebsceneLighting(t.lighting):void 0})}get weatherAvailable(){return this._weatherAvailable}setWeatherAvailable(e){this._weatherAvailable=e}castLighting(e){return this._convertLightingWithDestroy(e)}applyLighting(e){this.lighting=this._convertLightingWithDestroy(e)}_convertLightingWithDestroy(e){let n=this._convertLighting(e);return n!==e&&this.addHandles(t(n)),n}_convertLighting(e){return e?e instanceof c||e instanceof l?e:e instanceof d?this.lighting&&this.lighting.type!==`virtual`?this.lighting.cloneWithWebsceneLighting(e):new c({...e.cloneConstructProperties(),...this.lighting?.cloneNonPersistentConstructProperties()}):e instanceof f?this.lighting&&this.lighting.type===`virtual`?this.lighting.cloneWithWebsceneLighting(e):new l({...e.cloneConstructProperties(),...this.lighting?.cloneNonPersistentConstructProperties()}):o(s,e):new c}clone(){return new p({lighting:this.lighting.clone(),weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:n(this.background)})}cloneWithWebsceneEnvironment(e){return new p({weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:n(this.background),...e.cloneConstructProperties(),lighting:this._getLighting(e)})}_getLighting(e){switch(e.lighting.type){case`sun`:return this.lighting&&this.lighting.type===`sun`?this.lighting.cloneWithWebsceneLighting(e.lighting):c.fromWebsceneLighting(e.lighting);case`virtual`:return this.lighting&&this.lighting.type===`virtual`?this.lighting.cloneWithWebsceneLighting(e.lighting):l.fromWebsceneLighting(e.lighting);default:return e.lighting,c.fromWebsceneLighting(e.lighting)}}};e([r({types:{defaultKeyValue:`sun`,...s},nonNullable:!0})],m.prototype,`lighting`,void 0),e([r({readOnly:!0})],m.prototype,`weatherAvailable`,null),e([r()],m.prototype,`_weatherAvailable`,void 0),e([i(`lighting`)],m.prototype,`castLighting`,null),m=p=e([a(`esri.views.3d.environment.Environment`)],m);const h=m;export{h as default};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import{watch as n,sync as r,syncAndInitial as i,when as a}from"../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import{length as c,equals as l,copy as u,scale as d,lerp as f}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as p,create as m,fromValues as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isEarth as g,getReferenceEllipsoid as _}from"../../../geometry/ellipsoidUtils.js";import{isLoadedOrLoadFor as v}from"../../../geometry/projectionUtils.js";import y from"../../../geometry/SpatialReference.js";import{projectPointToVector as b}from"../../../geometry/projection/projectPointToVector.js";import{getGCSForPlanet as x}from"../../../geometry/support/planetGCSUtils.js";import{heightLimit as S}from"./weather.js";import{positionToTimezoneInfo as C}from"../support/earthUtils.js";import{ColorAndIntensity as w,computeShadowsEnabled as T,computeColorAndIntensity as E,computeVirtualLightDirection as D}from"../support/sunUtils.js";import{MainLight as O,AmbientLight as k,FillLight as A}from"../webgl-engine/lighting/Lightsources.js";let j=class extends t{constructor(){super(),this._view=null,this._tmpLightParameters=new w,this._defaultLightParameters=new w,this._tmpDate=new Date,this._tmpTz={hours:0,minutes:0,seconds:0},this._viewHandlesKey=`viewHandles`,this._trackingEnabled=!1,this._mainLight=new O,this._ambientLight=new k,this._moonLight=new A,this.shadowsAvailable=!1,this._resetReferencePosition()}destroy(){this.disconnectView()}get updating(){return!this._canProjectCameraPosition}get weatherEnabled(){return this._view?.stage?.renderer?.weatherFader!=null&&this._view.environment.atmosphereEnabled&&this._view.state.viewingMode===1&&g(this._view.spatialReference)}get _weatherAvailable(){let e=this._view;return e!=null&&this.weatherEnabled&&c(e.state.camera.eye)-_(e.spatialReference).radius<=S}get weather(){return this._weatherAvailable?this._view?.environment.weather:null}_modifyShadowsAvailable(){if(this._view==null)return;let e=this.referencePositionGeographic,t=e==null||T(e[2],this._view.state.viewingMode);this.shadowsAvailable=this._view.environment.lighting.directShadowsEnabled&&t}get referencePositionGeographic(){return this._referencePositionGeographic}get _canProjectCameraPosition(){let e=this._view?.stateManager?.camera?.position?.spatialReference??y.WGS84,t=x(e);return v(e,t)}connectView(e){this._view=e,this.addHandles([n(()=>e.environment.lighting,e=>this._updateLightingHandler(e),r),n(()=>e.environment.lighting.type===`virtual`?null:e.environment.lighting.date,e=>this._lightingDateHandler(e),r),n(()=>e.environment.lighting.directShadowsEnabled,()=>this._modifyShadowsAvailable(),r),n(()=>e.spatialReference,()=>this._resetReferencePosition(!0),r),n(()=>[e.environment.weather.type,this.weatherEnabled],()=>this._updateLighting(null,1),r),n(()=>this._weatherAvailable,t=>e.environment.setWeatherAvailable(t),i),n(()=>e.viewingMode,()=>this._resetReferencePosition(!0),i),n(()=>e.environment.lighting.type!==`virtual`&&e.environment.lighting.cameraTrackingEnabled,e=>this._updateCameraTracking(e),i),n(()=>e.state.camera,()=>this._cameraHandler(),i),a(()=>this._canProjectCameraPosition,()=>this._resetReferencePosition(!0),r)],this._viewHandlesKey),this._modifyShadowsAvailable(),this._updateLighting(),this._cameraHandler(),this.notifyChange(`updating`)}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition()}_updateLightingHandler(e){this._updateCameraTracking(e.type!==`virtual`&&e.cameraTrackingEnabled),this._lightingDateHandler(e.type===`virtual`?null:e.date),this._modifyShadowsAvailable()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{if(!this._view)return;let e=this._view.environment.lighting;e?.type!==`virtual`&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){if(!this._view)return;let t=this._view.environment.lighting;if(t?.type===`virtual`)this._updateLighting();else if(e){if(!t.positionTimezoneInfo.autoUpdated&&(this._preupdateTracking(e),this._referencePositionGeographic!=null)){let e=C(this._referencePositionGeographic,this._tmpTz);e!=null&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}this._updateLighting(e)}}_preupdateTracking(e){this._view&&!this._trackingEnabled&&this._view.environment.lighting.type!==`virtual`&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){let t=this._view;if(!t||!t.ready)return;let n=t.stateManager.camera;if(!n)return;let r=n.position,i=r.spatialReference??y.WGS84,a=x(i);if(b(r,P,a,F))this._referencePositionGeographic?l(this._referencePositionGeographic,P)||(u(this._referencePositionGeographic,P),this.notifyChange(`referencePositionGeographic`)):this._referencePositionGeographic=p(P),this._autoUpdateTimezone(this._referencePositionGeographic,e)||this._updateLighting(e);else{if(this._referencePositionGeographic==null)return;this._referencePositionGeographic=null,this._updateLighting()}}_updateLighting(e,t=0){let n=this._view;if(!n)return;let{lighting:r}=n.environment,i=r.type===`virtual`,a=this._referencePositionGeographic,o=a==null?this._defaultLightParameters:this._tmpLightParameters;if(a){e??=i?null:r.date;let t=this.weather?.type??`disabled`;E(e,a,n.state.viewingMode,t,n.state.camera,o)}else i&&D(n.state.camera,n.state.viewingMode,o.direct.directionToLightSource);let s=this._mainLight,c=o.direct;d(s.intensity,c.color,c.intensity*Math.PI),u(s.direction,c.directionToLightSource),s.specularStrength=o.specularStrength,s.environmentStrength=o.environmentStrength;let l=this._ambientLight;d(l.intensity,o.ambient.color,o.ambient.intensity);let p=this._moonLight;f(p.intensity,M,N,o.globalFactor);let m=(1-.5*o.globalFactor)*(1-.4*o.noonFactor*(1-o.globalFactor));d(p.intensity,p.intensity,m),u(p.direction,c.directionToLightSource),n.stage.renderer.updateLighting([s,l,p],o.noonFactor,o.globalFactor,this.weather?t:0),this._modifyShadowsAvailable()}_autoUpdateTimezone(e,t=null){if(!this._view||this._view.environment.lighting.type===`virtual`||!this._view.environment.lighting.cameraTrackingEnabled||e==null)return!1;let n=this._tmpDate;n.setTime((t||this._view.environment.lighting.date).getTime());let r=C(e,this._tmpTz);if(r==null)return!1;let i=this._view.environment.lighting.positionTimezoneInfo;if(!i.autoUpdated)i=r;else if(i.hours===r.hours&&i.minutes===r.minutes&&i.seconds===r.seconds)return!1;let a=n.getUTCHours()-(r.hours-i.hours),o=n.getUTCMinutes()-(r.minutes-i.minutes),s=n.getUTCSeconds()-(r.seconds-i.seconds);return n.setUTCHours(a),n.setUTCMinutes(o),n.setUTCSeconds(s),!t&&this._view.environment.lighting.autoUpdate(n,r)}_resetReferencePosition(e=!1){this._referencePositionGeographic=null,e&&this._cameraHandler()}};e([o()],j.prototype,`_view`,void 0),e([o({type:Boolean,readOnly:!0})],j.prototype,`updating`,null),e([o()],j.prototype,`weatherEnabled`,null),e([o()],j.prototype,`_weatherAvailable`,null),e([o()],j.prototype,`shadowsAvailable`,void 0),e([o()],j.prototype,`referencePositionGeographic`,null),e([o()],j.prototype,`_referencePositionGeographic`,void 0),e([o()],j.prototype,`_canProjectCameraPosition`,null),j=e([s(`esri.views.3d.environment.EnvironmentView`)],j);const M=h(.22,.22,.33),N=h(.22,.22,.22),P=m(),F={zConversionDisabled:!0};export{j as EnvironmentView};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Error.js";import r from"../../../core/Logger.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{throwIfAborted as a,throwIfAbortError as o}from"../../../core/promiseUtils.js";import{syncAndInitial as s,initial as c}from"../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import d from"../../../core/sql/WhereClause.js";import{fallbackObjectIDAttribute as f}from"../../../layers/LayerConstants.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import p from"../../../layers/support/FeatureFilter.js";import{fixFields as m,unpackFieldNames as h,populateMissingFields as g}from"../../../layers/support/fieldUtils.js";import _ from"../../../rest/support/Query.js";import{isNumber as v}from"../../../support/guards.js";import{BuildingSublayerView3DMixin as y}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as b}from"./I3SMeshView3D.js";import{applyFilterMode as x}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as S}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as C}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as w}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as T,I3SQueryFeature as E}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as D}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as O,getIndexCrs as k}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as A}from"./support/DefinitionExpressionSceneLayerView.js";import{TemporalSceneLayerView as j}from"./support/TemporalSceneLayerView.js";import M from"../../layers/BuildingComponentSublayerView.js";import{hasPopupTemplate as N,getRequiredFields as P,getFetchPopupTemplate as F}from"../../layers/support/popupUtils.js";import{isInEffectiveScaleRange as I}from"../../support/layerViewUtils.js";import{TaskPriority as L}from"../../support/Scheduler.js";let R=class extends j(A(b(y(M)))){constructor(e){super(e),this.type=`building-component-sublayer-3d`,this._elevationContext=2,this._supportsLabeling=!1,this.requiredFields=[],this.progressiveLoadFactor=1,this._queryEngine=null,this.layer=e.sublayer}get extractChanges(){return this.layerView.extractChanges}get layerViewUid(){return this.layerView.uid}get layerId(){return this.sublayer.layer.id}get sublayerId(){return this.sublayer.id}get layerPopupEnabledAndHasTemplate(){return this.sublayer.popupEnabled&&N(this.sublayer,this.layerView.view.popup?.defaultPopupTemplateEnabled)}initialize(){this._updatingHandles.add(()=>this.mergedFilter,e=>{e==null||!C.checkSupport(e)?this._i3sFilter=i(this._i3sFilter):this._i3sFilter==null?this._i3sFilter=new C({viewFilter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError),addTimeFilter:(e,t)=>this.addTimeFilter(e,t)}):this._i3sFilter.viewFilter=e},s),this._updatingHandles.add(()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields],()=>this._updateRequiredFields()),this._updatingHandles.add(()=>this.sublayer.renderer,e=>this._rendererChange(e),c);let e=()=>this._filterChange();this._updatingHandles.add(()=>this.parsedDefinitionExpression,e),this._updatingHandles.add(()=>this._i3sFilter?.sortedObjectIds,e),this._updatingHandles.add(()=>this._i3sFilter?.parsedWhereClause,e),this._updatingHandles.add(()=>this.getTimeFilterDependencies(),e),this._updatingHandles.add(()=>this.mergedFilter,e),this._updatingHandles.add(()=>[this._i3sFilter?.parsedGeometry,this.filter?.spatialRelationship],()=>this._geometryFilterChange()),this._updatingHandles.add(()=>this.parsedFilterExpressions,()=>this._updateSymbologyOverride(),c),this.addResolvingPromise(this._updateRequiredFields())}get lodFactor(){return this.view.qualitySettings.sceneService.objectLoDFactor}get parsedFilterExpressions(){return this.sublayer.modelName===`Overview`?[]:this.layerView.filterExpressions.map(([e,t])=>{let n;try{n=d.create(e,{fieldsIndex:this.sublayer.fieldsIndex})}catch(e){return r.getLogger(this).error(`Failed to parse filterExpression: `+e),null}if(!n.isStandardized)return r.getLogger(this).error(`filterExpression is using non standard function`),null;let i=[],a=n.fieldNames;return O(a,this.sublayer.fieldsIndex,{missingFields:i}),i.length>0?(r.getLogger(this).error(`filterExpression references unknown fields: ${i.join(`, `)}`),null):[n,t]}).filter(e=>e!=null)}get filter(){return this._get(`filter`)}set filter(e){this._set(`filter`,C.checkSupport(e)?e:null)}isUpdating(){return super.isUpdating()||(this._i3sFilter?.updating??!1)}_updateSymbologyOverride(){let e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride((t,n)=>{for(let[r,i]of e)try{if(r.testFeature(t))return x(n,i)}catch(e){this.logError(e)}return x(n,null)},this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return m(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce((e,[t])=>e.concat(t.fieldNames),[]))}get availableFields(){let e=this.sublayer,t=e.fieldsIndex,n=this.requiredFields;if(e.outFields||e.layer.outFields){let r=[...e.outFields||[],...e.layer.outFields||[]];n=[...h(t,r),...n]}return n=[...n,e.objectIdField??f],m(t,n)}get _graphicOrigin(){return this.sublayer.graphicOrigin}_createLayerGraphic(e){return new t({attributes:e,layer:this.sublayer.layer,sourceLayer:this.sublayer,origin:this._graphicOrigin})}canResume(){return super.canResume()&&I(this.sublayer.effectiveScaleRange,this.view.scale)&&(!this._controller||this._controller.rootNodeVisible)}async patchFeaturesForPopup(e,t){let n=this._validateFetchPopupFeatures(t);if(n)throw n;if(e.length===0)return[];let i=[],s=[],c=this.sublayer.associatedLayer==null?this.sublayer:await this.sublayer.associatedLayer.load(t),l=h(this.sublayer.fieldsIndex,await P(c,F(this.sublayer,t)));a(t);let u=new Set;for(let t of e)g(t,l,u)?s.push(t):i.push(t);return s.length===0?i:(this.sublayer.associatedLayer!=null&&await this.sublayer.associatedLayer.load().catch(()=>r.getLogger(this).warn(`Failed to load associated feature layer. Displaying popup attributes from cached attributes.`)),this.whenGraphicAttributes(s,Array.from(u)).catch(e=>(o(e),s)).then(e=>i.concat(e)))}async _updateRequiredFields(){let e=m(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields,...this.filterExpressionFields]);this._set(`requiredFields`,e)}_validateFetchPopupFeatures(e){let{sublayer:t}=this,{popupEnabled:r}=t;if(!r)return new n(`buildingscenelayerview3d:fetchPopupFeatures`,`Popups are disabled`,{sublayer:t});if(!F(t,e))return new n(`buildingscenelayerview3d:fetchPopupFeatures`,`Layer does not define a popup template`,{sublayer:t})}getFilters(){let e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this._i3sFilter?.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){let e={outFields:[`*`],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return this.filter==null?new _(e):this.filter.createQuery(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then(e=>{if(!e?.features)return e;let t=this.sublayer,n=t.layer,r=this._graphicOrigin;for(let i of e.features)i.layer=n,i.sourceLayer=t,i.origin=r;return e})}async queryObjectIds(e,t){return(await this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)).filter(v)}_ensureQueryEngine(){return this._queryEngine??=this._createQueryEngine(),this._queryEngine}_createQueryEngine(){let e=S(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new w({layerView:this,priority:L.FEATURE_QUERY_ENGINE,spatialIndex:new D({featureAdapter:new T({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(e,t)=>this._forAllFeatures((t,n,r)=>e(new E(t,n,r)),t,2),getFeatureExtent:e,sourceSpatialReference:k(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(e==null?this.createQuery():_.from(e))}};e([l()],R.prototype,`layerView`,void 0),e([l()],R.prototype,`extractChanges`,null),e([l()],R.prototype,`lodFactor`,null),e([l({readOnly:!0})],R.prototype,`parsedFilterExpressions`,null),e([l({type:p})],R.prototype,`filter`,null),e([l()],R.prototype,`_i3sFilter`,void 0),e([l({type:[String],readOnly:!0})],R.prototype,`filterExpressionFields`,null),e([l({type:[String],readOnly:!0})],R.prototype,`requiredFields`,void 0),e([l({type:[String],readOnly:!0})],R.prototype,`availableFields`,null),e([l()],R.prototype,`_graphicOrigin`,null),R=e([u(`esri.views.3d.layers.BuildingComponentSublayerView3D`)],R);const z=R;export{z as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Error.js";import r from"../../../core/Logger.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{throwIfAborted as a,throwIfAbortError as o}from"../../../core/promiseUtils.js";import{syncAndInitial as s,initial as c}from"../../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import d from"../../../core/sql/WhereClause.js";import{isInEffectiveScaleRange as f}from"../../../geometry/support/scaleUtils.js";import{fallbackObjectIDAttribute as p}from"../../../layers/LayerConstants.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import m from"../../../layers/support/FeatureFilter.js";import{fixFields as h,unpackFieldNames as g,populateMissingFields as _}from"../../../layers/support/fieldUtils.js";import v from"../../../rest/support/Query.js";import{isNumber as y}from"../../../support/guards.js";import{BuildingSublayerView3DMixin as b}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as x}from"./I3SMeshView3D.js";import{applyFilterMode as S}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as C}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as w}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as T}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as E,I3SQueryFeature as D}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as O}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as k,getIndexCrs as A}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as j}from"./support/DefinitionExpressionSceneLayerView.js";import{TemporalSceneLayerView as M}from"./support/TemporalSceneLayerView.js";import N from"../../layers/BuildingComponentSublayerView.js";import{hasPopupTemplate as P,getRequiredFields as F,getFetchPopupTemplate as I}from"../../layers/support/popupUtils.js";import{TaskPriority as L}from"../../support/Scheduler.js";let R=class extends M(j(x(b(N)))){constructor(e){super(e),this.type=`building-component-sublayer-3d`,this._elevationContext=2,this._supportsLabeling=!1,this.requiredFields=[],this.progressiveLoadFactor=1,this._queryEngine=null,this.layer=e.sublayer}get extractChanges(){return this.layerView.extractChanges}get layerViewUid(){return this.layerView.uid}get layerId(){return this.sublayer.layer.id}get sublayerId(){return this.sublayer.id}get layerPopupEnabledAndHasTemplate(){return this.sublayer.popupEnabled&&P(this.sublayer,this.layerView.view.popup?.defaultPopupTemplateEnabled)}initialize(){this._updatingHandles.add(()=>this.mergedFilter,e=>{e==null||!w.checkSupport(e)?this._i3sFilter=i(this._i3sFilter):this._i3sFilter==null?this._i3sFilter=new w({viewFilter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError),addTimeFilter:(e,t)=>this.addTimeFilter(e,t)}):this._i3sFilter.viewFilter=e},s),this._updatingHandles.add(()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields],()=>this._updateRequiredFields()),this._updatingHandles.add(()=>this.sublayer.renderer,e=>this._rendererChange(e),c);let e=()=>this._filterChange();this._updatingHandles.add(()=>this.parsedDefinitionExpression,e),this._updatingHandles.add(()=>this._i3sFilter?.sortedObjectIds,e),this._updatingHandles.add(()=>this._i3sFilter?.parsedWhereClause,e),this._updatingHandles.add(()=>this.getTimeFilterDependencies(),e),this._updatingHandles.add(()=>this.mergedFilter,e),this._updatingHandles.add(()=>[this._i3sFilter?.parsedGeometry,this.filter?.spatialRelationship],()=>this._geometryFilterChange()),this._updatingHandles.add(()=>this.parsedFilterExpressions,()=>this._updateSymbologyOverride(),c),this.addResolvingPromise(this._updateRequiredFields())}get lodFactor(){return this.view.qualitySettings.sceneService.objectLoDFactor}get parsedFilterExpressions(){return this.sublayer.modelName===`Overview`?[]:this.layerView.filterExpressions.map(([e,t])=>{let n;try{n=d.create(e,{fieldsIndex:this.sublayer.fieldsIndex})}catch(e){return r.getLogger(this).error(`Failed to parse filterExpression: `+e),null}if(!n.isStandardized)return r.getLogger(this).error(`filterExpression is using non standard function`),null;let i=[],a=n.fieldNames;return k(a,this.sublayer.fieldsIndex,{missingFields:i}),i.length>0?(r.getLogger(this).error(`filterExpression references unknown fields: ${i.join(`, `)}`),null):[n,t]}).filter(e=>e!=null)}get filter(){return this._get(`filter`)}set filter(e){this._set(`filter`,w.checkSupport(e)?e:null)}isUpdating(){return super.isUpdating()||(this._i3sFilter?.updating??!1)}_updateSymbologyOverride(){let e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride((t,n)=>{for(let[r,i]of e)try{if(r.testFeature(t))return S(n,i)}catch(e){this.logError(e)}return S(n,null)},this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return h(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce((e,[t])=>e.concat(t.fieldNames),[]))}get availableFields(){let e=this.sublayer,t=e.fieldsIndex,n=this.requiredFields;if(e.outFields||e.layer.outFields){let r=[...e.outFields||[],...e.layer.outFields||[]];n=[...g(t,r),...n]}return n=[...n,e.objectIdField??p],h(t,n)}get _graphicOrigin(){return this.sublayer.graphicOrigin}_createLayerGraphic(e){return new t({attributes:e,layer:this.sublayer.layer,sourceLayer:this.sublayer,origin:this._graphicOrigin})}canResume(){return super.canResume()&&f(this.sublayer.effectiveScaleRange,this.view.scale)&&(!this._controller||this._controller.rootNodeVisible)}async patchFeaturesForPopup(e,t){let n=this._validateFetchPopupFeatures(t);if(n)throw n;if(e.length===0)return[];let i=[],s=[],c=this.sublayer.associatedLayer==null?this.sublayer:await this.sublayer.associatedLayer.load(t),l=g(this.sublayer.fieldsIndex,await F(c,I(this.sublayer,t)));a(t);let u=new Set;for(let t of e)_(t,l,u)?s.push(t):i.push(t);return s.length===0?i:(this.sublayer.associatedLayer!=null&&await this.sublayer.associatedLayer.load().catch(()=>r.getLogger(this).warn(`Failed to load associated feature layer. Displaying popup attributes from cached attributes.`)),this.whenGraphicAttributes(s,Array.from(u)).catch(e=>(o(e),s)).then(e=>i.concat(e)))}async _updateRequiredFields(){let e=h(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields,...this.filterExpressionFields]);this._set(`requiredFields`,e)}_validateFetchPopupFeatures(e){let{sublayer:t}=this,{popupEnabled:r}=t;if(!r)return new n(`buildingscenelayerview3d:fetchPopupFeatures`,`Popups are disabled`,{sublayer:t});if(!I(t,e))return new n(`buildingscenelayerview3d:fetchPopupFeatures`,`Layer does not define a popup template`,{sublayer:t})}getFilters(){let e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this._i3sFilter?.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){let e={outFields:[`*`],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return this.filter==null?new v(e):this.filter.createQuery(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then(e=>{if(!e?.features)return e;let t=this.sublayer,n=t.layer,r=this._graphicOrigin;for(let i of e.features)i.layer=n,i.sourceLayer=t,i.origin=r;return e})}async queryObjectIds(e,t){return(await this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)).filter(y)}_ensureQueryEngine(){return this._queryEngine??=this._createQueryEngine(),this._queryEngine}_createQueryEngine(){let e=C(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new T({layerView:this,priority:L.FEATURE_QUERY_ENGINE,spatialIndex:new O({featureAdapter:new E({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(e,t)=>this._forAllFeatures((t,n,r)=>e(new D(t,n,r)),t,2),getFeatureExtent:e,sourceSpatialReference:A(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(e==null?this.createQuery():v.from(e))}};e([l()],R.prototype,`layerView`,void 0),e([l()],R.prototype,`extractChanges`,null),e([l()],R.prototype,`lodFactor`,null),e([l({readOnly:!0})],R.prototype,`parsedFilterExpressions`,null),e([l({type:m})],R.prototype,`filter`,null),e([l()],R.prototype,`_i3sFilter`,void 0),e([l({type:[String],readOnly:!0})],R.prototype,`filterExpressionFields`,null),e([l({type:[String],readOnly:!0})],R.prototype,`requiredFields`,void 0),e([l({type:[String],readOnly:!0})],R.prototype,`availableFields`,null),e([l()],R.prototype,`_graphicOrigin`,null),R=e([u(`esri.views.3d.layers.BuildingComponentSublayerView3D`)],R);const z=R;export{z as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Collection.js";import r from"../../../core/Error.js";import{handlesGroup as i}from"../../../core/handleUtils.js";import a from"../../../core/Logger.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{abortMaybe as s}from"../../../core/maybe.js";import{isAbortError as c,allSettledValues as l,throwIfAborted as u}from"../../../core/promiseUtils.js";import{watch as d,syncAndInitial as f}from"../../../core/reactiveUtils.js";import{property as p,subclass as m}from"../../../core/accessorSupport/decorators.js";import{runUntracked as h}from"../../../core/accessorSupport/tracking.js";import{isBuildingGraphicOrigin as g}from"../../../graphic/isBuildingGraphicOrigin.js";import"../../../layers/buildingSublayers/BuildingGroupSublayer.js";import{I3SExtractChanges as _}from"../../../layers/support/I3SExtractChanges.js";import{isGraphic as v}from"../../../support/graphicInstanceUtils.js";import y from"./BuildingComponentSublayerView3D.js";import{BuildingSublayerView3DMixin as b}from"./BuildingSublayerView3D.js";import{LayerView3D as x}from"./LayerView3D.js";import{parseFilterMode as S}from"./i3s/BuildingFilterUtil.js";import{checkSpatialReference as C}from"./i3s/I3SUtil.js";import{normalizeHighlightTarget as w,emptyHighlightHandle as T}from"./support/highlightUtils.js";import{LayerViewPerformanceInfo as E}from"./support/LayerViewPerformanceInfo.js";import{updatingProgress as D}from"../support/updatingProperties.js";import O from"../../layers/BuildingSceneLayerView.js";import{isInEffectiveScaleRange as k}from"../../support/layerViewUtils.js";const A=b(t);let j=class extends x(O){constructor(e){super(e),this.type=`building-scene-3d`,this.sublayerViews=new n,this._rejectedSublayerViews=new Map,this._abortController=new AbortController,this._loadingComponents=0,this._pendingWhenSublayerViews=new Map,this.ignoresMemoryFactor=!1}get extractChanges(){return this._extractChanges}get filterExpression(){let e=this.layer.activeFilterId,t=e==null?null:this.layer.filters.find(t=>t.id===e),n=t==null?null:t.filterBlocks?.find(e=>e.filterMode.type===`solid`);return n?n.filterExpression:null}get filterExpressions(){let e=this.layer.activeFilterId,t=e==null?null:this.layer.filters.find(t=>t.id===e);return t?.filterBlocks?t.filterBlocks.toArray().map(e=>[e.filterExpression??``,S(e)]):[]}get updatingProgressValue(){return h(()=>{let e=this.sublayerViews,t=this._loadingComponents+(e?e.length:0);return e.reduce((e,t)=>e+t.updatingProgress,0)/t})}get visibleAtCurrentScale(){return k(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){return this._loadingComponents>0||this.sublayerViews&&this.sublayerViews.some(e=>e.updating)}initialize(){C(this.layer.spatialReference,this.view.spatialReference,this.view.viewingMode),this._extractChanges=new _({layer:this.layer,batchingEnabled:!0}),this._initializeSublayerViews(this.layer.sublayers,this)}destroy(){this.sublayerViews&&=(this.sublayerViews.forEach(e=>e.destroy()),null),this._extractChanges.destroy(),this._rejectedSublayerViews=null,this._abortController=s(this._abortController)}_initializeSublayerViews(e,t){let n=this,i=this.view;e.forEach(e=>{if(!e.isEmpty){if(e.type===`building-group`){let n=new A({sublayer:e,view:i,parent:t});this._initializeSublayerViews(e.sublayers,n)}else e.geometryType===`mesh`?(this._loadingComponents++,e.load({signal:this._abortController.signal}).then(()=>{let r=new y({sublayer:e,layerView:n,view:i,parent:t});this.sublayerViews.push(r);let a=this._pendingWhenSublayerViews.get(e);if(a){for(let e of a)e.resolve(r);this._pendingWhenSublayerViews.delete(e)}this.addHandles([d(()=>r.updating,()=>this.notifyChange(`updating`),f),d(()=>r.updatingProgress,()=>this.notifyChange(`updatingProgressValue`),f)])}).catch(t=>{c(t)||a.getLogger(this).error(`Error while creating view for sublayer ${e.id}\nLayer: ${this.layer.url}\n`,t),this._rejectWhenSublayerView(e,t)}).then(()=>{this._loadingComponents--,this.notifyChange(`updating`),this.notifyChange(`updatingProgressValue`)})):this._rejectWhenSublayerView(e,new r(`view:no-layerview-for-sublayer`,`No layerview created for sublayer ${e.id}`))}})}getGraphicFromIntersectorTarget(e,t){for(let n of this.sublayerViews.items)if(n.sublayer.id===e.sublayerId)return n.getGraphicFromIntersectorTarget(e,t);return null}async patchFeaturesForPopup(e,t){if(e.length===0)return[];let n=M(e,e=>g(e.origin)?e.origin.sublayer:e.sourceLayer),r=[];for(let[e,i]of n){let n=this._findComponent(e);n!=null&&r.push(n.patchFeaturesForPopup(i,t))}let i=await l(r);return u(t),i.flat()}whenGraphicBounds(e){let t=this._findComponent(g(e.origin)?e.origin.sublayer:e.sourceLayer);return t==null?Promise.reject():t.whenGraphicBounds(e)}getAABBFromIntersectorTarget(e){for(let t of this.sublayerViews.items)if(t.sublayer.id===e.sublayerId)return t.getAABBFromIntersectorTarget(e);return null}async whenSublayerView(e){let t=this._findComponent(e);if(t!=null)return t;let n=this._rejectedSublayerViews.get(e);if(n!=null)throw n;let r=this._pendingWhenSublayerViews.get(e),i=Promise.withResolvers();return r?r.push(i):this._pendingWhenSublayerViews.set(e,[i]),i.promise}_rejectWhenSublayerView(e,t){if(this.destroyed)return;this._rejectedSublayerViews.set(e,t);let n=this._pendingWhenSublayerViews.get(e);if(n){for(let e of n)e.reject(t);this._pendingWhenSublayerViews.delete(e)}}_findComponent(e){return this.sublayerViews.find(t=>e===t.sublayer)}highlight(e,t){let n=w(e);if(n.length===0)return T;if(v(n[0])){let e=n,r=new Map;for(let t of e)o(r,g(t.origin)?t.origin.sublayer:t.sourceLayer,()=>[]).push(t);let a=[];return this.sublayerViews.forEach(e=>{let n=r.get(e.sublayer);n&&a.push(e.highlight(n,t))}),i(a)}return T}get usedMemory(){return this.sublayerViews.reduce((e,t)=>e+t.usedMemory,0)}get unloadedMemory(){return this.sublayerViews.reduce((e,t)=>e+t.unloadedMemory,0)}get performanceInfo(){return new E(this.usedMemory)}};e([p()],j.prototype,`sublayerViews`,void 0),e([p()],j.prototype,`_rejectedSublayerViews`,void 0),e([p({readOnly:!0})],j.prototype,`filterExpression`,null),e([p({readOnly:!0})],j.prototype,`filterExpressions`,null),e([p(D)],j.prototype,`updatingProgress`,void 0),e([p({readOnly:!0})],j.prototype,`updatingProgressValue`,null),e([p({readOnly:!0})],j.prototype,`visibleAtCurrentScale`,null),j=e([m(`esri.views.3d.layers.BuildingSceneLayerView3D`)],j);function M(e,t){let n=new Map,r=e.length;for(let i=0;i<r;i++){let r=e[i],a=t(r,i,e),o=n.get(a);o?o.push(r):n.set(a,[r])}return n}const N=j;export{N as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Collection.js";import r from"../../../core/Error.js";import{handlesGroup as i}from"../../../core/handleUtils.js";import a from"../../../core/Logger.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{abortMaybe as s}from"../../../core/maybe.js";import{isAbortError as c,allSettledValues as l,throwIfAborted as u}from"../../../core/promiseUtils.js";import{watch as d,syncAndInitial as f}from"../../../core/reactiveUtils.js";import{property as p,subclass as m}from"../../../core/accessorSupport/decorators.js";import{runUntracked as h}from"../../../core/accessorSupport/tracking.js";import{isInEffectiveScaleRange as g}from"../../../geometry/support/scaleUtils.js";import{isBuildingGraphicOrigin as _}from"../../../graphic/isBuildingGraphicOrigin.js";import"../../../layers/buildingSublayers/BuildingGroupSublayer.js";import{I3SExtractChanges as v}from"../../../layers/support/I3SExtractChanges.js";import{isGraphic as y}from"../../../support/graphicInstanceUtils.js";import b from"./BuildingComponentSublayerView3D.js";import{BuildingSublayerView3DMixin as x}from"./BuildingSublayerView3D.js";import{LayerView3D as S}from"./LayerView3D.js";import{parseFilterMode as C}from"./i3s/BuildingFilterUtil.js";import{checkSpatialReference as w}from"./i3s/I3SUtil.js";import{normalizeHighlightTarget as T,emptyHighlightHandle as E}from"./support/highlightUtils.js";import{LayerViewPerformanceInfo as D}from"./support/LayerViewPerformanceInfo.js";import{updatingProgress as O}from"../support/updatingProperties.js";import k from"../../layers/BuildingSceneLayerView.js";const A=x(t);let j=class extends S(k){constructor(e){super(e),this.type=`building-scene-3d`,this.sublayerViews=new n,this._rejectedSublayerViews=new Map,this._abortController=new AbortController,this._loadingComponents=0,this._pendingWhenSublayerViews=new Map,this.ignoresMemoryFactor=!1}get extractChanges(){return this._extractChanges}get filterExpression(){let e=this.layer.activeFilterId,t=e==null?null:this.layer.filters.find(t=>t.id===e),n=t==null?null:t.filterBlocks?.find(e=>e.filterMode.type===`solid`);return n?n.filterExpression:null}get filterExpressions(){let e=this.layer.activeFilterId,t=e==null?null:this.layer.filters.find(t=>t.id===e);return t?.filterBlocks?t.filterBlocks.toArray().map(e=>[e.filterExpression??``,C(e)]):[]}get updatingProgressValue(){return h(()=>{let e=this.sublayerViews,t=this._loadingComponents+(e?e.length:0);return e.reduce((e,t)=>e+t.updatingProgress,0)/t})}get visibleAtCurrentScale(){return g(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){return this._loadingComponents>0||this.sublayerViews&&this.sublayerViews.some(e=>e.updating)}initialize(){w(this.layer.spatialReference,this.view.spatialReference,this.view.viewingMode),this._extractChanges=new v({layer:this.layer,batchingEnabled:!0}),this._initializeSublayerViews(this.layer.sublayers,this)}destroy(){this.sublayerViews&&=(this.sublayerViews.forEach(e=>e.destroy()),null),this._extractChanges.destroy(),this._rejectedSublayerViews=null,this._abortController=s(this._abortController)}_initializeSublayerViews(e,t){let n=this,i=this.view;e.forEach(e=>{if(!e.isEmpty){if(e.type===`building-group`){let n=new A({sublayer:e,view:i,parent:t});this._initializeSublayerViews(e.sublayers,n)}else e.geometryType===`mesh`?(this._loadingComponents++,e.load({signal:this._abortController.signal}).then(()=>{let r=new b({sublayer:e,layerView:n,view:i,parent:t});this.sublayerViews.push(r);let a=this._pendingWhenSublayerViews.get(e);if(a){for(let e of a)e.resolve(r);this._pendingWhenSublayerViews.delete(e)}this.addHandles([d(()=>r.updating,()=>this.notifyChange(`updating`),f),d(()=>r.updatingProgress,()=>this.notifyChange(`updatingProgressValue`),f)])}).catch(t=>{c(t)||a.getLogger(this).error(`Error while creating view for sublayer ${e.id}\nLayer: ${this.layer.url}\n`,t),this._rejectWhenSublayerView(e,t)}).then(()=>{this._loadingComponents--,this.notifyChange(`updating`),this.notifyChange(`updatingProgressValue`)})):this._rejectWhenSublayerView(e,new r(`view:no-layerview-for-sublayer`,`No layerview created for sublayer ${e.id}`))}})}getGraphicFromIntersectorTarget(e,t){for(let n of this.sublayerViews.items)if(n.sublayer.id===e.sublayerId)return n.getGraphicFromIntersectorTarget(e,t);return null}async patchFeaturesForPopup(e,t){if(e.length===0)return[];let n=M(e,e=>_(e.origin)?e.origin.sublayer:e.sourceLayer),r=[];for(let[e,i]of n){let n=this._findComponent(e);n!=null&&r.push(n.patchFeaturesForPopup(i,t))}let i=await l(r);return u(t),i.flat()}whenGraphicBounds(e){let t=this._findComponent(_(e.origin)?e.origin.sublayer:e.sourceLayer);return t==null?Promise.reject():t.whenGraphicBounds(e)}getAABBFromIntersectorTarget(e){for(let t of this.sublayerViews.items)if(t.sublayer.id===e.sublayerId)return t.getAABBFromIntersectorTarget(e);return null}async whenSublayerView(e){let t=this._findComponent(e);if(t!=null)return t;let n=this._rejectedSublayerViews.get(e);if(n!=null)throw n;let r=this._pendingWhenSublayerViews.get(e),i=Promise.withResolvers();return r?r.push(i):this._pendingWhenSublayerViews.set(e,[i]),i.promise}_rejectWhenSublayerView(e,t){if(this.destroyed)return;this._rejectedSublayerViews.set(e,t);let n=this._pendingWhenSublayerViews.get(e);if(n){for(let e of n)e.reject(t);this._pendingWhenSublayerViews.delete(e)}}_findComponent(e){return this.sublayerViews.find(t=>e===t.sublayer)}highlight(e,t){let n=T(e);if(n.length===0)return E;if(y(n[0])){let e=n,r=new Map;for(let t of e)o(r,_(t.origin)?t.origin.sublayer:t.sourceLayer,()=>[]).push(t);let a=[];return this.sublayerViews.forEach(e=>{let n=r.get(e.sublayer);n&&a.push(e.highlight(n,t))}),i(a)}return E}get usedMemory(){return this.sublayerViews.reduce((e,t)=>e+t.usedMemory,0)}get unloadedMemory(){return this.sublayerViews.reduce((e,t)=>e+t.unloadedMemory,0)}get performanceInfo(){return new D(this.usedMemory)}};e([p()],j.prototype,`sublayerViews`,void 0),e([p()],j.prototype,`_rejectedSublayerViews`,void 0),e([p({readOnly:!0})],j.prototype,`filterExpression`,null),e([p({readOnly:!0})],j.prototype,`filterExpressions`,null),e([p(O)],j.prototype,`updatingProgress`,void 0),e([p({readOnly:!0})],j.prototype,`updatingProgressValue`,null),e([p({readOnly:!0})],j.prototype,`visibleAtCurrentScale`,null),j=e([m(`esri.views.3d.layers.BuildingSceneLayerView3D`)],j);function M(e,t){let n=new Map,r=e.length;for(let i=0;i<r;i++){let r=e[i],a=t(r,i,e),o=n.get(a);o?o.push(r):n.set(a,[r])}return n}const N=j;export{N as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{debounce as r,isAbortError as i}from"../../../core/promiseUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{projectAsync as s}from"../../../geometry/projectionUtils.js";import{LayerView3D as c}from"./LayerView3D.js";import{LayerViewPerformanceInfo as l}from"./support/LayerViewPerformanceInfo.js";import u from"../../layers/LayerView.js";import{RefreshableLayerView as d}from"../../layers/RefreshableLayerView.js";import{isInEffectiveScaleRange as f}from"../../support/layerViewUtils.js";const p=c=>{let u=c,d=class extends u{constructor(){super(...arguments),this.fullExtentInLocalViewSpatialReference=null,this.refreshDebounced=r(async e=>{this.destroyed||await this._doRefresh(e).catch(e=>{i(e)||t.getLogger(this).error(e)})},2e3),this.ignoresMemoryFactor=!1,this.unloadedMemory=0}get visibleAtCurrentScale(){let e=this.layer,t=`effectiveScaleRange`in e?e.effectiveScaleRange:null;return f(t,this.view.scale)}isUpdating(){return super.isUpdating()||this.subView?.updating}initialize(){this._initSubView(),this.view.viewingMode===`local`&&this.addResolvingPromise((async()=>this.fullExtentInLocalViewSpatialReference=await s(this.layer.fullExtent,this.view.spatialReference).catch(()=>null))()),this._updatingHandles.add(()=>this.suspended,()=>this._suspendedChangeHandler())}destroy(){this.subView=n(this.subView)}async doRefresh(){return this._doRefresh()}async _doRefresh(e){this.suspended||await this.subView.doRefresh(e)}getFetchOptions(){}_suspendedChangeHandler(){this.suspended?this.subView.clear():this.refreshDebounced()}get test(){}get usedMemory(){return this.subView.usedMemory}get performanceInfo(){return new l(this.usedMemory)}};return e([a()],d.prototype,`suspended`,void 0),e([a()],d.prototype,`fullExtentInLocalViewSpatialReference`,void 0),e([a({readOnly:!0})],d.prototype,`visibleAtCurrentScale`,null),e([a()],d.prototype,`updating`,void 0),e([a()],d.prototype,`subView`,void 0),d=e([o(`esri.views.3d.layers.DynamicLayerView3D`)],d),d};class m extends p(d(c(u))){}export{m as DynamicLayerView3D,p as DynamicLayerView3DMixin};
2
+ import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{debounce as r,isAbortError as i}from"../../../core/promiseUtils.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{projectAsync as s}from"../../../geometry/projectionUtils.js";import{isInEffectiveScaleRange as c}from"../../../geometry/support/scaleUtils.js";import{LayerView3D as l}from"./LayerView3D.js";import{LayerViewPerformanceInfo as u}from"./support/LayerViewPerformanceInfo.js";import d from"../../layers/LayerView.js";import{RefreshableLayerView as f}from"../../layers/RefreshableLayerView.js";const p=l=>{let d=l,f=class extends d{constructor(){super(...arguments),this.fullExtentInLocalViewSpatialReference=null,this.refreshDebounced=r(async e=>{this.destroyed||await this._doRefresh(e).catch(e=>{i(e)||t.getLogger(this).error(e)})},2e3),this.ignoresMemoryFactor=!1,this.unloadedMemory=0}get visibleAtCurrentScale(){let e=this.layer,t=`effectiveScaleRange`in e?e.effectiveScaleRange:null;return c(t,this.view.scale)}isUpdating(){return super.isUpdating()||this.subView?.updating}initialize(){this._initSubView(),this.view.viewingMode===`local`&&this.addResolvingPromise((async()=>this.fullExtentInLocalViewSpatialReference=await s(this.layer.fullExtent,this.view.spatialReference).catch(()=>null))()),this._updatingHandles.add(()=>this.suspended,()=>this._suspendedChangeHandler())}destroy(){this.subView=n(this.subView)}async doRefresh(){return this._doRefresh()}async _doRefresh(e){this.suspended||await this.subView.doRefresh(e)}getFetchOptions(){}_suspendedChangeHandler(){this.suspended?this.subView.clear():this.refreshDebounced()}get test(){}get usedMemory(){return this.subView.usedMemory}get performanceInfo(){return new u(this.usedMemory)}};return e([a()],f.prototype,`suspended`,void 0),e([a()],f.prototype,`fullExtentInLocalViewSpatialReference`,void 0),e([a({readOnly:!0})],f.prototype,`visibleAtCurrentScale`,null),e([a()],f.prototype,`updating`,void 0),e([a()],f.prototype,`subView`,void 0),f=e([o(`esri.views.3d.layers.DynamicLayerView3D`)],f),f};class m extends p(f(l(d))){}export{m as DynamicLayerView3D,p as DynamicLayerView3DMixin};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import i from"../../../core/ReactiveMap.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{projectAsync as s}from"../../../geometry/projectionUtils.js";import{hydrateGraphic as c}from"../../../layers/graphics/hydratedFeatures.js";import{combineTimeExtent as l,hasTimeOptions as u}from"../../../layers/support/timeSupport.js";import d from"../../../rest/support/AttributeBinsQuery.js";import f from"../../../rest/support/Query.js";import{isGraphic as p}from"../../../support/graphicInstanceUtils.js";import{LayerView3D as m}from"./LayerView3D.js";import{attributeLookup as h}from"./support/attributeUtils.js";import{normalizeHighlightTarget as g,emptyHighlightHandle as _,isObjectId as v}from"./support/highlightUtils.js";import{RefreshableLayerView as y}from"../../layers/RefreshableLayerView.js";import{getHighlightName as b}from"../../support/highlightOptionsUtils.js";import{hasLayerBasedScaleVisibility as x,isInEffectiveScaleRange as S}from"../../support/layerViewUtils.js";const C=C=>{let w=y(m(C)),T=class extends w{constructor(){super(...arguments),this.updatePolicy=1,this.slicePlaneEnabled=!1,this._highlightCounter=new i,this.fullExtentInLocalViewSpatialReference=null,this.supportsHeightUnitConversion=!0}initialize(){let e=this.layer;`isTable`in e&&e.isTable?this.addResolvingPromise(Promise.reject(new t(`featurelayerview:table-not-supported`,`table feature layer can't be displayed`,{layer:e}))):(this.addResolvingPromise(this._validateGeometryType()),this.addResolvingPromise((async()=>{if(this.destroyed)return;this.fullExtentInLocalViewSpatialReference=this.view.viewingMode===`local`?await s(this.layer.fullExtent,this.view.spatialReference).catch(()=>null):null,await this._updatingRequiredPromise;let e=await this.createGraphicsPipeline();this.destroyed?e.destroy():(this.graphicsPipeline=e,await e.when())})()),this.notifyChange(`updating`))}destroy(){this.graphicsPipeline=r(this.graphicsPipeline)}get dataUpdating(){return!!this.graphicsPipeline?.dataUpdating}get legendEnabled(){return this.canResume()&&this.graphicsPipeline?.legendEnabled}get visibleAtCurrentScale(){return x()?S(this.layer.effectiveScaleRange,this.view.scale):!this.graphicsPipeline?.scaleVisibilitySuspended}get symbologySnappingSupported(){return this.graphicsPipeline.symbologySnappingSupported}get hasAllFeatures(){return this.graphicsPipeline.hasAllFeatures}get hasAllFeaturesInView(){return this.graphicsPipeline.hasAllFeaturesInView}get hasFullGeometries(){return this.graphicsPipeline.hasFullGeometries}get timeExtent(){return l(u(this.layer)?this.layer:null,this.view?.timeExtent,this._get(`timeExtent`))}get highlightIds(){return Array.from(this._highlightCounter.keys())}get hasHighlight(){return this.highlightIds.length>0}getHit(e,t){let n=this.graphicsPipeline.findGraphic(t=>t.uid===e);if(n==null)return null;let r=c(n,this.layer,this.layer.graphicOrigin);return{type:`graphic`,graphic:r,layer:r.layer}}whenGraphicBounds(e,t){return this.graphicsPipeline?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsPipeline?.computeAttachmentOrigin(e,t)}async elevationAlignPointsInFeatures(e,t){return this.graphicsPipeline.elevationAlignPointsInFeatures(e,t)}async queryForSymbologySnapping(e,t){return this.graphicsPipeline.graphicsQuery.queryForSymbologySnapping(e,t)}queryAggregates(e,t){throw Error(`missing implementation`)}queryFeatures(e,t){return this.graphicsPipeline.graphicsQuery.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryAttributeBins(e,t){return this.graphicsPipeline.graphicsQuery.executeAttributeBinsQuery(this._ensureAttributeBinsQuery(e),t?.signal)}queryExtent(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return e==null?this.createQuery():f.from(e)}_ensureAttributeBinsQuery(e){let t=d.from(e);return t.outSpatialReference||=this.view.spatialReference,t}_addHighlightIds(e){this._highlightCounter.batch(()=>{for(let t of e){let e=this._highlightCounter.get(t)??0;this._highlightCounter.set(t,e+1)}})}_removeHighlightIds(e){this._highlightCounter.batch(()=>{for(let t of e){let e=this._highlightCounter.get(t);e!=null&&(e--,e>0?this._highlightCounter.set(t,e):this._highlightCounter.delete(t))}})}highlight(e,t){let r=b(t),i=this.layer.objectIdField,a=g(e);if(a.length===0)return _;if(p(a[0])){let e=a;if(h(this.layer.fieldsIndex,e[0].attributes,i)!=null){let t=e.map(e=>h(this.layer.fieldsIndex,e.attributes,i)),a=this.graphicsPipeline.highlightByObjectIds(t,r);return this._addHighlightIds(t),n(()=>{this._removeHighlightIds(t),a.remove()})}return this.graphicsPipeline.highlightByGraphics(e,r)}if(v(a[0])){let e=a;this._addHighlightIds(e);let t=this.graphicsPipeline.highlightByObjectIds(e,r);return n(()=>{t.remove(),this._removeHighlightIds(e)})}return _}maskOccludee(e){return this.graphicsPipeline.maskOccludee(e)}getSuspendInfo(){return{...super.getSuspendInfo(),...this.graphicsPipeline.suspendInfo}}isUpdating(){return!this.graphicsPipeline||this.graphicsPipeline.destroyed?!1:!(!this.graphicsPipeline?.updating&&this.view?.groundView?.ready)}async _validateGeometryType(){switch(this.layer.geometryType){case`multipatch`:case`multipoint`:throw new t(`featurelayerview3d:unsupported-geometry-type`,"Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType})}}get performanceInfo(){return this.graphicsPipeline.performanceInfo}};return e([a()],T.prototype,`graphicsPipeline`,void 0),e([a({readOnly:!0})],T.prototype,`dataUpdating`,null),e([a()],T.prototype,`suspended`,void 0),e([a({readOnly:!0})],T.prototype,`legendEnabled`,null),e([a({readOnly:!0})],T.prototype,`visibleAtCurrentScale`,null),e([a()],T.prototype,`updating`,void 0),e([a({readOnly:!0})],T.prototype,`updatePolicy`,void 0),e([a({type:Boolean})],T.prototype,`slicePlaneEnabled`,void 0),e([a({readOnly:!0})],T.prototype,`suspendInfo`,void 0),e([a()],T.prototype,`symbologySnappingSupported`,null),e([a({readOnly:!0})],T.prototype,`hasAllFeatures`,null),e([a({readOnly:!0})],T.prototype,`hasAllFeaturesInView`,null),e([a({readOnly:!0})],T.prototype,`hasFullGeometries`,null),e([a({readOnly:!0})],T.prototype,`timeExtent`,null),e([a()],T.prototype,`highlightIds`,null),e([a()],T.prototype,`hasHighlight`,null),T=e([o(`esri.views.3d.layers.FeatureLikeLayerViewBase3D`)],T),T};export{C as FeatureLikeLayerViewBase3D};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import i from"../../../core/ReactiveMap.js";import{property as a,subclass as o}from"../../../core/accessorSupport/decorators.js";import{projectAsync as s}from"../../../geometry/projectionUtils.js";import{isInEffectiveScaleRange as c}from"../../../geometry/support/scaleUtils.js";import{hydrateGraphic as l}from"../../../layers/graphics/hydratedFeatures.js";import{combineTimeExtent as u,hasTimeOptions as d}from"../../../layers/support/timeSupport.js";import f from"../../../rest/support/AttributeBinsQuery.js";import p from"../../../rest/support/Query.js";import{isGraphic as m}from"../../../support/graphicInstanceUtils.js";import{LayerView3D as h}from"./LayerView3D.js";import{attributeLookup as g}from"./support/attributeUtils.js";import{normalizeHighlightTarget as _,emptyHighlightHandle as v,isObjectId as y}from"./support/highlightUtils.js";import{RefreshableLayerView as b}from"../../layers/RefreshableLayerView.js";import{getHighlightName as x}from"../../support/highlightOptionsUtils.js";import{hasLayerBasedScaleVisibility as S}from"../../support/layerViewUtils.js";const C=C=>{let w=b(h(C)),T=class extends w{constructor(){super(...arguments),this.updatePolicy=1,this.slicePlaneEnabled=!1,this._highlightCounter=new i,this.fullExtentInLocalViewSpatialReference=null,this.supportsHeightUnitConversion=!0}initialize(){let e=this.layer;`isTable`in e&&e.isTable?this.addResolvingPromise(Promise.reject(new t(`featurelayerview:table-not-supported`,`table feature layer can't be displayed`,{layer:e}))):(this.addResolvingPromise(this._validateGeometryType()),this.addResolvingPromise((async()=>{if(this.destroyed)return;this.fullExtentInLocalViewSpatialReference=this.view.viewingMode===`local`?await s(this.layer.fullExtent,this.view.spatialReference).catch(()=>null):null,await this._updatingRequiredPromise;let e=await this.createGraphicsPipeline();this.destroyed?e.destroy():(this.graphicsPipeline=e,await e.when())})()),this.notifyChange(`updating`))}destroy(){this.graphicsPipeline=r(this.graphicsPipeline)}get dataUpdating(){return!!this.graphicsPipeline?.dataUpdating}get legendEnabled(){return this.canResume()&&this.graphicsPipeline?.legendEnabled}get visibleAtCurrentScale(){return S()?c(this.layer.effectiveScaleRange,this.view.scale):!this.graphicsPipeline?.scaleVisibilitySuspended}get symbologySnappingSupported(){return this.graphicsPipeline.symbologySnappingSupported}get hasAllFeatures(){return this.graphicsPipeline.hasAllFeatures}get hasAllFeaturesInView(){return this.graphicsPipeline.hasAllFeaturesInView}get hasFullGeometries(){return this.graphicsPipeline.hasFullGeometries}get timeExtent(){return u(d(this.layer)?this.layer:null,this.view?.timeExtent,this._get(`timeExtent`))}get highlightIds(){return Array.from(this._highlightCounter.keys())}get hasHighlight(){return this.highlightIds.length>0}getHit(e,t){let n=this.graphicsPipeline.findGraphic(t=>t.uid===e);if(n==null)return null;let r=l(n,this.layer,this.layer.graphicOrigin);return{type:`graphic`,graphic:r,layer:r.layer}}whenGraphicBounds(e,t){return this.graphicsPipeline?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsPipeline?.computeAttachmentOrigin(e,t)}async elevationAlignPointsInFeatures(e,t){return this.graphicsPipeline.elevationAlignPointsInFeatures(e,t)}async queryForSymbologySnapping(e,t){return this.graphicsPipeline.graphicsQuery.queryForSymbologySnapping(e,t)}queryAggregates(e,t){throw Error(`missing implementation`)}queryFeatures(e,t){return this.graphicsPipeline.graphicsQuery.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryAttributeBins(e,t){return this.graphicsPipeline.graphicsQuery.executeAttributeBinsQuery(this._ensureAttributeBinsQuery(e),t?.signal)}queryExtent(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return e==null?this.createQuery():p.from(e)}_ensureAttributeBinsQuery(e){let t=f.from(e);return t.outSpatialReference||=this.view.spatialReference,t}_addHighlightIds(e){this._highlightCounter.batch(()=>{for(let t of e){let e=this._highlightCounter.get(t)??0;this._highlightCounter.set(t,e+1)}})}_removeHighlightIds(e){this._highlightCounter.batch(()=>{for(let t of e){let e=this._highlightCounter.get(t);e!=null&&(e--,e>0?this._highlightCounter.set(t,e):this._highlightCounter.delete(t))}})}highlight(e,t){let r=x(t),i=this.layer.objectIdField,a=_(e);if(a.length===0)return v;if(m(a[0])){let e=a;if(g(this.layer.fieldsIndex,e[0].attributes,i)!=null){let t=e.map(e=>g(this.layer.fieldsIndex,e.attributes,i)),a=this.graphicsPipeline.highlightByObjectIds(t,r);return this._addHighlightIds(t),n(()=>{this._removeHighlightIds(t),a.remove()})}return this.graphicsPipeline.highlightByGraphics(e,r)}if(y(a[0])){let e=a;this._addHighlightIds(e);let t=this.graphicsPipeline.highlightByObjectIds(e,r);return n(()=>{t.remove(),this._removeHighlightIds(e)})}return v}maskOccludee(e){return this.graphicsPipeline.maskOccludee(e)}getSuspendInfo(){return{...super.getSuspendInfo(),...this.graphicsPipeline.suspendInfo}}isUpdating(){return!this.graphicsPipeline||this.graphicsPipeline.destroyed?!1:!(!this.graphicsPipeline?.updating&&this.view?.groundView?.ready)}async _validateGeometryType(){switch(this.layer.geometryType){case`multipatch`:case`multipoint`:throw new t(`featurelayerview3d:unsupported-geometry-type`,"Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType})}}get performanceInfo(){return this.graphicsPipeline.performanceInfo}};return e([a()],T.prototype,`graphicsPipeline`,void 0),e([a({readOnly:!0})],T.prototype,`dataUpdating`,null),e([a()],T.prototype,`suspended`,void 0),e([a({readOnly:!0})],T.prototype,`legendEnabled`,null),e([a({readOnly:!0})],T.prototype,`visibleAtCurrentScale`,null),e([a()],T.prototype,`updating`,void 0),e([a({readOnly:!0})],T.prototype,`updatePolicy`,void 0),e([a({type:Boolean})],T.prototype,`slicePlaneEnabled`,void 0),e([a({readOnly:!0})],T.prototype,`suspendInfo`,void 0),e([a()],T.prototype,`symbologySnappingSupported`,null),e([a({readOnly:!0})],T.prototype,`hasAllFeatures`,null),e([a({readOnly:!0})],T.prototype,`hasAllFeaturesInView`,null),e([a({readOnly:!0})],T.prototype,`hasFullGeometries`,null),e([a({readOnly:!0})],T.prototype,`timeExtent`,null),e([a()],T.prototype,`highlightIds`,null),e([a()],T.prototype,`hasHighlight`,null),T=e([o(`esri.views.3d.layers.FeatureLikeLayerViewBase3D`)],T),T};export{C as FeatureLikeLayerViewBase3D};