@arcgis/core 4.29.0-next.20240222 → 4.29.1

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 (279) hide show
  1. package/arcade/treeAnalysis.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{b43fde3e25d0c3b020b5.js → 039a872509872ce67ba4.js} +1 -1
  4. package/assets/esri/core/workers/chunks/0bc21d2a0b65bd4e9d76.js +1 -0
  5. package/assets/esri/core/workers/chunks/{5243f9ff21e768c620c2.js → 23a5d750d93a7829174f.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{47e6119be4a4a5ed640d.js → 2447a4d5886aeb0ff72a.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{7f45a9e9bdbcffc2d6e0.js → 348bcc57b99a975902a8.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{8c9fb2601488998013ba.js → 3523789a2948a4ab8cc8.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{24649b410b757599a549.js → 48db6e0bbb1a9c043193.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{752082be991f1cc8558f.js → 4984e2b79d862114d6a6.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{8d9736fd15cdb54d9855.js → 5227f9eea6988aadad7f.js} +1 -1
  12. package/assets/esri/core/workers/chunks/58723274ef657fe212eb.js +1 -0
  13. package/assets/esri/core/workers/chunks/60ab18c6a04d4b2f1d4c.js +1 -0
  14. package/assets/esri/core/workers/chunks/647515801d94180b8402.js +1 -0
  15. package/assets/esri/core/workers/chunks/6c3ae96ec90e9ed7dd50.js +1 -0
  16. package/assets/esri/core/workers/chunks/7a8bba91769ee18cc39f.js +1 -0
  17. package/assets/esri/core/workers/chunks/7a98d2e026f63a581b1e.js +1 -0
  18. package/assets/esri/core/workers/chunks/8c360923cd1850767d3e.js +1 -0
  19. package/assets/esri/core/workers/chunks/{1a25ba411b89e050fbb7.js → a61f337802ae963d7f65.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{d0c5318d7ef2e923aad0.js → a8ac511280f873960d46.js} +1 -1
  21. package/assets/esri/core/workers/chunks/b125ab84b7761e761734.js +1 -0
  22. package/assets/esri/core/workers/chunks/{b34d6e58b125fe111f91.js → b42a83db83851cb57d44.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{1497dd943df7eede0704.js → b9c55ff1f21db198ce03.js} +1 -1
  24. package/assets/esri/core/workers/chunks/bb3322ddb89c0bd444f0.js +1 -0
  25. package/assets/esri/core/workers/chunks/becfdaeeb07f089d8be7.js +1 -0
  26. package/assets/esri/core/workers/chunks/{b26e39a399963c176d33.js → c527692694688a5b3b07.js} +2 -2
  27. package/assets/esri/core/workers/chunks/{210a93e0b96c5bff44a3.js → c556644bb0cf88770939.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{e7b26c7e9e24dc6255be.js → cacf97b0a7a1057b9f79.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{a5e7b4acae17f88e2208.js → ce93027b6b81428ce9b0.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{b8ece275abac93f3dccf.js → d14f16bfa6c12909929c.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{1594f06a2d7d9439c62e.js → e2147c99cc5839654be1.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{d33ed3a2a0d4b640bd4a.js → e4c7d8c69e4957c9d27c.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{7709248f59520aee6f51.js → eceaa46f622f6fa31128.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{2286db4c83ff1b6fb088.js → ef3e6209e6ac6a56960b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/f59b5ea05caca8a1a398.js +1 -0
  36. package/chunks/Laserlines.glsl.js +3 -3
  37. package/chunks/Precipitation.glsl.js +1 -1
  38. package/chunks/SSAOBlur.glsl.js +2 -2
  39. package/chunks/boundedPlane.js +1 -1
  40. package/chunks/cameraUtilsSpherical.js +1 -1
  41. package/chunks/sphere.js +1 -1
  42. package/chunks/terrainUtilsPlanar.js +1 -1
  43. package/chunks/vec32.js +1 -1
  44. package/config.js +1 -1
  45. package/copyright.txt +56 -28
  46. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  47. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  48. package/core/libs/gl-matrix-2/vec3.js +1 -1
  49. package/geometry/support/axisAngleDegrees.js +1 -1
  50. package/geometry/support/coordinateSystem.js +1 -1
  51. package/geometry/support/lineSegment.js +1 -1
  52. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  53. package/geometry/support/meshUtils/georeference.js +1 -1
  54. package/geometry/support/meshUtils/merge.js +1 -1
  55. package/geometry/support/meshUtils/rotate.js +1 -1
  56. package/geometry/support/meshUtils/scale.js +1 -1
  57. package/geometry/support/meshUtils/vertexSpaceConversion.js +5 -0
  58. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  59. package/geometry/support/plane.js +1 -1
  60. package/geometry/support/ray.js +1 -1
  61. package/geometry/support/triangle.js +1 -1
  62. package/geometry/support/vector.js +1 -1
  63. package/interfaces.d.ts +12 -12
  64. package/kernel.js +1 -1
  65. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  66. package/layers/LinkChartLayer.js +1 -1
  67. package/layers/VoxelWasmPerSceneView.js +1 -1
  68. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  69. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  70. package/layers/mixins/FeatureReductionLayer.js +1 -1
  71. package/layers/orientedImagery/core/CameraOrientation.js +1 -1
  72. package/layers/orientedImagery/core/ElevationSourceDefinitions.js +1 -1
  73. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  74. package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
  75. package/layers/orientedImagery/transformations/imageToWorld.js +5 -0
  76. package/layers/orientedImagery/transformations/updateElevation.js +5 -0
  77. package/layers/orientedImagery/transformations/updateElevationUtils.js +5 -0
  78. package/layers/orientedImagery/transformations/utils.js +1 -1
  79. package/layers/orientedImagery/transformations/worldToImage.js +5 -0
  80. package/layers/support/EditingCapabilities.js +1 -1
  81. package/layers/support/editableLayers.js +1 -1
  82. package/layers/support/layerUtils.js +1 -1
  83. package/layers/video/VideoCameraSensorModel.js +1 -1
  84. package/layers/voxel/VoxelVolume.js +1 -1
  85. package/layers/voxel/voxelPlaneUtils.js +1 -1
  86. package/libs/linkchartlayout/LinkChartLayout.js +1 -1
  87. package/package.json +1 -1
  88. package/smartMapping/renderers/pieChart.js +1 -1
  89. package/support/revision.js +1 -1
  90. package/symbols/cim/cimAnalyzer.js +1 -1
  91. package/views/2d/arcade/callExpressionWithCursor.js +1 -1
  92. package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
  93. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
  94. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  95. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  96. package/views/2d/layers/features/Processor.js +1 -1
  97. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  98. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  99. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  100. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  101. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  102. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  103. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  104. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  105. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  106. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  107. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  108. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  109. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  110. package/views/2d/layers/features/sources/strategies/chunks/DrillDownTileSourceChunk.js +1 -1
  111. package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
  112. package/views/2d/layers/features/sources/strategies/chunks/OverrideChunk.js +1 -1
  113. package/views/2d/layers/features/sources/strategies/chunks/PagedTileSourceChunk.js +1 -1
  114. package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
  115. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  116. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  117. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  118. package/views/2d/layers/features/support/Tile.js +1 -1
  119. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  120. package/views/2d/tiling/TileKey.js +1 -1
  121. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  122. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  123. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  124. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  125. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  126. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  127. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  128. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  129. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  130. package/views/3d/analysis/support/measurementUtils.js +1 -1
  131. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  132. package/views/3d/camera/constraintUtils/common.js +1 -1
  133. package/views/3d/camera/constraintUtils/distance.js +1 -1
  134. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  135. package/views/3d/camera/intersectionUtils.js +1 -1
  136. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  137. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  138. package/views/3d/environment/Fog.js +1 -1
  139. package/views/3d/environment/MarsAtmosphere.js +1 -1
  140. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  141. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  142. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  143. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  144. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  145. package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
  146. package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
  147. package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
  148. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  149. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  150. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  151. package/views/3d/interactive/visualElements/support/Segment.js +1 -1
  152. package/views/3d/layers/I3SMeshView3D.js +1 -1
  153. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  154. package/views/3d/layers/PointCloudWorker.js +1 -1
  155. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  156. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  157. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  158. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  159. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  160. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  161. package/views/3d/layers/i3s/LoDUtil.js +1 -1
  162. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  163. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  164. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  165. package/views/3d/layers/support/uvUtils.js +1 -1
  166. package/views/3d/state/Frustum.js +1 -1
  167. package/views/3d/state/NearFarHeuristic.js +1 -1
  168. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  169. package/views/3d/state/controllers/RotateController.js +1 -1
  170. package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
  171. package/views/3d/state/controllers/global/ZoomController.js +1 -1
  172. package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
  173. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  174. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  175. package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
  176. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  177. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  178. package/views/3d/state/utils/navigationUtils.js +1 -1
  179. package/views/3d/state/utils/viewUtils.js +1 -1
  180. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  181. package/views/3d/support/cameraUtils.js +1 -1
  182. package/views/3d/support/cameraUtilsInternal.js +1 -1
  183. package/views/3d/support/intersectionUtils.js +1 -1
  184. package/views/3d/support/mathUtils.js +1 -1
  185. package/views/3d/support/orientedBoundingBox.js +1 -1
  186. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  187. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  188. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  189. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  190. package/views/3d/support/sunUtils.js +1 -1
  191. package/views/3d/support/viewpointUtils.js +1 -1
  192. package/views/3d/terrain/OverlayManager.js +1 -1
  193. package/views/3d/terrain/PatchRenderData.js +1 -1
  194. package/views/3d/terrain/SphericalPatch.js +1 -1
  195. package/views/3d/terrain/TerrainRenderer.js +1 -1
  196. package/views/3d/terrain/Tile.js +1 -1
  197. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  198. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  199. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  200. package/views/3d/webgl-engine/core/util/TwoVectorPosition.js +1 -1
  201. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  202. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  203. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  204. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  205. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  206. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  207. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  208. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  209. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  210. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  211. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  212. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  213. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  214. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  215. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  216. package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
  217. package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
  218. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  219. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  220. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  221. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  222. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  223. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  224. package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
  225. package/views/SelectionManager.js +1 -1
  226. package/views/draw/support/createUtils.js +1 -1
  227. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  228. package/views/interactive/GraphicManipulator.js +1 -1
  229. package/views/interactive/SegmentLabels.js +1 -1
  230. package/views/interactive/coordinateHelper.js +1 -1
  231. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  232. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  233. package/views/interactive/sketch/constraints.js +1 -1
  234. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  235. package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
  236. package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
  237. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  238. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  239. package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
  240. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  241. package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
  242. package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
  243. package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
  244. package/views/layers/FeatureLayerView.js +1 -1
  245. package/views/layers/support/editableLayerViews.js +5 -0
  246. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  247. package/views/support/angularMeasurementUtils.js +1 -1
  248. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  249. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  250. package/views/support/geometry3dUtils.js +1 -1
  251. package/widgets/Editor/EditorViewModel.js +1 -1
  252. package/widgets/Editor/support/EditorEditingCapabilities.js +1 -1
  253. package/widgets/Editor/support/EditorItem.js +1 -1
  254. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  255. package/widgets/FeatureForm.js +1 -1
  256. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  257. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  258. package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
  259. package/widgets/Features/FeaturesViewModel.js +1 -1
  260. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  261. package/widgets/OrientedImageryViewer.js +1 -1
  262. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  263. package/widgets/PanoramicViewer/utils.js +1 -1
  264. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  265. package/widgets/UtilityNetworkTrace.js +1 -1
  266. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  267. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  268. package/assets/esri/core/workers/chunks/0e83f3718a0b45652b5e.js +0 -1
  269. package/assets/esri/core/workers/chunks/1fa5c8af69a09a3730b3.js +0 -1
  270. package/assets/esri/core/workers/chunks/25f73748df0ee82d06cb.js +0 -1
  271. package/assets/esri/core/workers/chunks/2d7a18f8c540269ecee9.js +0 -1
  272. package/assets/esri/core/workers/chunks/4736f79b5c94ce103d43.js +0 -1
  273. package/assets/esri/core/workers/chunks/65f7adaaf1f535310c11.js +0 -1
  274. package/assets/esri/core/workers/chunks/79c041b292648c5eaecc.js +0 -1
  275. package/assets/esri/core/workers/chunks/7c4c2c0beddabac672b6.js +0 -1
  276. package/assets/esri/core/workers/chunks/9a758de08dfa57735879.js +0 -1
  277. package/assets/esri/core/workers/chunks/a4c3da057ec2a07bbbe8.js +0 -1
  278. package/assets/esri/core/workers/chunks/b252270b100351779f1f.js +0 -1
  279. package/assets/esri/core/workers/chunks/dc57aa9f2fc69e654559.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveLayerCapabilities as r}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as s}from"./featureReductionUtils.js";import{exceedsMinimumSnapshotCoverage as i}from"./featureServiceUtils.js";import{hasFloorFilter as o,addFloorFilter as a}from"./floorFilterUtils.js";import{getEffectiveGeometryType as l}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as n,getLayerDeconflictionEnabled as d,createLabelVVEvaluator as p}from"./labelingUtils.js";import{createFeatureSourceSchema as y}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as m}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class u{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,r=n(t,e)??d(t);return[{vvEvaluators:{0:p(t.renderer)},deconflictionEnabled:r}]}async createServiceOptions(s){const o=this.layer,a=r(o),{capabilities:n,editingInfo:d,objectIdField:p,typeIdField:y,globalIdField:m,datesInUnknownTimezone:c,orderBy:u,subtypeField:f,refreshInterval:h}=o,b=o.fieldsIndex.toJSON(),g=b.fields,S=l(o),I=o.timeInfo?.toJSON(),j=o.spatialReference.toJSON(),F=o.types?.map((e=>e.toJSON())),x=e(this.layer.parsedUrl);this.layer.dynamicDataSource&&(x.query={layer:JSON.stringify({source:this.layer.dynamicDataSource})});let E=this.layer.objectIdField;if(u?.length){const e=!u[0].valueExpression&&u[0].field;e&&(E=e)}const U=!(null!=d?.lastEditDate)&&h>0,v=has("featurelayer-snapshot-enabled")&&"point"===o.geometryType&&n?.query.supportsPagination&&!n?.operations.supportsEditing&&!U,O=v&&i(s,o.fullExtent);return{type:"feature-service",source:x,isSourceHosted:t(x.path),orderByFields:E,metadata:{typeIdField:y??void 0,types:F,timeReferenceUnknownClient:c,subtypeField:f,globalIdField:m,fields:g,fieldsIndex:b,geometryType:S,objectIdField:p,timeInfo:I,spatialReference:j,subtypes:this.layer.subtypes?.map((e=>e.toJSON()))},queryMetadata:{capabilities:n,effectiveCapabilities:a,lastEditDate:d?.lastEditDate?.getTime(),snapshotInfo:{supportsSnapshotMinThreshold:v,supportsSnapshotMaxThreshold:O,snapshotCountThresholds:{min:has("featurelayer-snapshot-point-min-threshold"),max:has("featurelayer-snapshot-point-max-threshold")}}}}}createSourceSchema(e,t,r){const{definitionExpression:s,customParameters:i,gdbVersion:o,historicMoment:a,subtypeCode:l,subtypeField:n,timeExtent:d,apiKey:p}=this.layer;return y(e,{definitionExpression:s,customParameters:i,gdbVersion:o,historicMoment:a,subtypeCode:l,subtypeField:n,timeExtent:d},t,r,p)}createProcessorSchema(e,t,r){const{fields:i,renderer:o,geometryType:a,labelingInfo:l,labelsVisible:n,orderBy:d,objectIdField:p}=this.layer,y={fields:i.map((e=>e.toJSON())),renderer:o?.clone(),featureReduction:s(this.layer,t),geometryType:a,labelingInfo:l,labelsVisible:n,objectIdField:p,orderBy:d??"default"};return m(e,t,y,r)}get hasRequiredSupport(){return c(this.layer.renderer)}hasFilters(e){return o(this.layer,e)}addFilters(e,t){return a(this.layer,e,t)}getUpdateHashProperties(e){const t=this.layer,{definitionExpression:r,renderer:i,gdbVersion:a,apiKey:l,subtypeCode:n}=t,d=this.layer.labelsVisible?this.layer.labelingInfo:null,p=t.historicMoment?.getTime()??void 0,y=JSON.stringify(t.customParameters),m=s(t,e)?.toJSON(),c=JSON.stringify(t.orderBy);return{apiKey:l,customParameters:y,definitionExpression:r,featureReduction:m,floors:o(this.layer,e)?e.floors:null,gdbVersion:a,historicMoment:p,labelingInfo:d,orderBy:c,renderer:i,subtypeCode:n}}}export{u as FeatureLayerAdapter};
5
+ import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveLayerCapabilities as r}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as s}from"./featureReductionUtils.js";import{exceedsMinimumSnapshotCoverage as i}from"./featureServiceUtils.js";import{hasFloorFilter as o,addFloorFilter as a}from"./floorFilterUtils.js";import{getEffectiveGeometryType as l}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as n,getLayerDeconflictionEnabled as d,createLabelVVEvaluator as p}from"./labelingUtils.js";import{createFeatureSourceSchema as m}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as y}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class u{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,r=n(t,e)??d(t);return[{vvEvaluators:{0:p(t.renderer)},deconflictionEnabled:r}]}async createServiceOptions(s){const o=this.layer,a=r(o),{capabilities:n,editingInfo:d,objectIdField:p,typeIdField:m,globalIdField:y,datesInUnknownTimezone:c,orderBy:u,subtypeField:f,refreshInterval:h}=o,b=o.fieldsIndex.toJSON(),g=b.fields,S=l(o),I=o.timeInfo?.toJSON(),j=o.spatialReference.toJSON(),F=o.types?.map((e=>e.toJSON())),x=e(this.layer.parsedUrl);this.layer.dynamicDataSource&&(x.query={layer:JSON.stringify({source:this.layer.dynamicDataSource})});let E=this.layer.objectIdField;if(u?.length){const e=!u[0].valueExpression&&u[0].field;e&&(E=e)}const U=!(null!=d?.lastEditDate)&&h>0,v=has("featurelayer-snapshot-enabled")&&"point"===o.geometryType&&n?.query.supportsPagination&&!n?.operations.supportsEditing&&!U,O=v&&i(s,o.fullExtent);return{type:"feature-service",source:x,isSourceHosted:t(x.path),orderByFields:E,metadata:{typeIdField:m??void 0,types:F,timeReferenceUnknownClient:c,subtypeField:f,globalIdField:y,fields:g,fieldsIndex:b,geometryType:S,objectIdField:p,timeInfo:I,spatialReference:j,subtypes:this.layer.subtypes?.map((e=>e.toJSON())),timeZone:s.timeZone},queryMetadata:{capabilities:n,effectiveCapabilities:a,lastEditDate:d?.lastEditDate?.getTime(),snapshotInfo:{supportsSnapshotMinThreshold:v,supportsSnapshotMaxThreshold:O,snapshotCountThresholds:{min:has("featurelayer-snapshot-point-min-threshold"),max:has("featurelayer-snapshot-point-max-threshold")}}}}}createSourceSchema(e,t,r){const{definitionExpression:s,customParameters:i,gdbVersion:o,historicMoment:a,subtypeCode:l,subtypeField:n,timeExtent:d,apiKey:p}=this.layer;return m(e,{definitionExpression:s,customParameters:i,gdbVersion:o,historicMoment:a,subtypeCode:l,subtypeField:n,timeExtent:d},t,r,p)}createProcessorSchema(e,t,r){const{fields:i,renderer:o,geometryType:a,labelingInfo:l,labelsVisible:n,orderBy:d,objectIdField:p}=this.layer,m={fields:i.map((e=>e.toJSON())),renderer:o?.clone(),featureReduction:s(this.layer,t),geometryType:a,labelingInfo:l,labelsVisible:n,objectIdField:p,orderBy:d??"default"};return y(e,t,m,r)}get hasRequiredSupport(){return c(this.layer.renderer)}hasFilters(e){return o(this.layer,e)}addFilters(e,t){return a(this.layer,e,t)}getUpdateHashProperties(e){const t=this.layer,{definitionExpression:r,renderer:i,gdbVersion:a,apiKey:l,subtypeCode:n}=t,d=this.layer.labelsVisible?this.layer.labelingInfo:null,p=t.historicMoment?.getTime()??void 0,m=JSON.stringify(t.customParameters),y=s(t,e)?.toJSON(),c=JSON.stringify(t.orderBy);return{apiKey:l,customParameters:m,definitionExpression:r,featureReduction:y,floors:o(this.layer,e)?e.floors:null,gdbVersion:a,historicMoment:p,labelingInfo:d,orderBy:c,renderer:i,subtypeCode:n}}}export{u as FeatureLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/Error.js";import{getEffectiveLayerCapabilities as r}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getEffectiveGeometryType as i}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as o,getLayerDeconflictionEnabled as s,createLabelVVEvaluator as l}from"./labelingUtils.js";import{createFeatureSourceSchema as n}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as a}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";function d(r){if(!("openPorts"in r))throw new e("source-not-supported")}class p{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=o(r,e)??s(r);return[{vvEvaluators:{0:l(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(e){const t=this.layer,o=r(t),{capabilities:s,objectIdField:l}=t,n=t.fieldsIndex.toJSON(),a=i(t),c=t.timeInfo?.toJSON(),p=t.spatialReference.toJSON();d(t.source);return{type:"memory",source:await t.source.openPorts(),orderByFields:l,metadata:{fieldsIndex:n,geometryType:a,objectIdField:l,timeInfo:c,spatialReference:p,subtypes:null,subtypeField:null,globalIdField:null,typeIdField:null,types:null,timeReferenceUnknownClient:null},queryMetadata:{capabilities:s,effectiveCapabilities:o,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,r,t){const{definitionExpression:i,timeExtent:o}=this.layer;return n(e,{definitionExpression:i,timeExtent:o,customParameters:null},r,t,null)}createProcessorSchema(e,r,i){const{fields:o,renderer:s,geometryType:l,labelingInfo:n,labelsVisible:c,orderBy:d,objectIdField:p}=this.layer,u={fields:o.map((e=>e.toJSON())),renderer:s?.clone(),featureReduction:t(this.layer,r),geometryType:l,labelingInfo:n,labelsVisible:c,objectIdField:p,orderBy:d??"default"};return a(e,r,u,i)}get hasRequiredSupport(){return c(this.layer.renderer)}getUpdateHashProperties(e){const r=this.layer,{definitionExpression:i,renderer:o}=r,s=this.layer.labelsVisible?this.layer.labelingInfo:null,l=t(r,e)?.toJSON();return{orderBy:JSON.stringify(r.orderBy),definitionExpression:i,renderer:o,labelingInfo:s,featureReduction:l}}}export{p as InMemoryLayerAdapter};
5
+ import e from"../../../../../core/Error.js";import{getEffectiveLayerCapabilities as r}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getEffectiveGeometryType as i}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as o,getLayerDeconflictionEnabled as n,createLabelVVEvaluator as s}from"./labelingUtils.js";import{createFeatureSourceSchema as l}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as a}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";function d(r){if(!("openPorts"in r))throw new e("source-not-supported")}class p{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=o(r,e)??n(r);return[{vvEvaluators:{0:s(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(e){const t=this.layer,o=r(t),{capabilities:n,objectIdField:s}=t,l=t.fieldsIndex.toJSON(),a=i(t),c=t.timeInfo?.toJSON(),p=t.spatialReference.toJSON();d(t.source);return{type:"memory",source:await t.source.openPorts(),orderByFields:s,metadata:{fieldsIndex:l,geometryType:a,objectIdField:s,timeInfo:c,spatialReference:p,subtypes:null,subtypeField:null,globalIdField:null,typeIdField:null,types:null,timeReferenceUnknownClient:null,timeZone:e.timeZone},queryMetadata:{capabilities:n,effectiveCapabilities:o,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,r,t){const{definitionExpression:i,timeExtent:o}=this.layer;return l(e,{definitionExpression:i,timeExtent:o,customParameters:null},r,t,null)}createProcessorSchema(e,r,i){const{fields:o,renderer:n,geometryType:s,labelingInfo:l,labelsVisible:c,orderBy:d,objectIdField:p}=this.layer,u={fields:o.map((e=>e.toJSON())),renderer:n?.clone(),featureReduction:t(this.layer,r),geometryType:s,labelingInfo:l,labelsVisible:c,objectIdField:p,orderBy:d??"default"};return a(e,r,u,i)}get hasRequiredSupport(){return c(this.layer.renderer)}getUpdateHashProperties(e){const r=this.layer,{definitionExpression:i,renderer:o}=r,n=this.layer.labelsVisible?this.layer.labelingInfo:null,s=t(r,e)?.toJSON();return{orderBy:JSON.stringify(r.orderBy),definitionExpression:i,renderer:o,labelingInfo:n,featureReduction:s}}}export{p as InMemoryLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{getEffectiveLayerCapabilities as e}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as r}from"./featureReductionUtils.js";import{getEffectiveGeometryType as t}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as i,getLayerDeconflictionEnabled as l,createLabelVVEvaluator as s}from"./labelingUtils.js";import{createFeatureSourceSchema as o}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as n}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as a}from"../support/rendererUtils.js";class c{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=i(r,e)??l(r);return[{vvEvaluators:{0:s(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(r){const i=this.layer,l=e(i),{capabilities:s,objectIdField:o}=i,n=i.fieldsIndex.toJSON(),a=t(i),c=i.spatialReference.toJSON();return{type:"memory",source:await i.source.openPorts(),orderByFields:o,metadata:{fieldsIndex:n,geometryType:a,objectIdField:o,spatialReference:c,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null},queryMetadata:{capabilities:s,effectiveCapabilities:l,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,r,t){const{definitionExpression:i}=this.layer;return o(e,{definitionExpression:i,customParameters:null},r,t,null)}createProcessorSchema(e,t,i){const{fields:l,renderer:s,geometryType:o,labelingInfo:a,labelsVisible:c,objectIdField:d}=this.layer,p={fields:l.map((e=>e.toJSON())),renderer:s?.clone(),featureReduction:r(this.layer,t),geometryType:o,labelingInfo:a,labelsVisible:c,objectIdField:d,orderBy:"default"};return n(e,t,p,i)}get hasRequiredSupport(){return a(this.layer.renderer)}getUpdateHashProperties(e){const t=this.layer,{definitionExpression:i,renderer:l}=t,s=this.layer.labelsVisible?this.layer.labelingInfo:null,o=r(t,e)?.toJSON();return{definitionExpression:i,renderer:l,labelingInfo:s,featureReduction:o}}}export{c as KnowledgeGraphSublayerAdapter};
5
+ import{getEffectiveLayerCapabilities as e}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as r}from"./featureReductionUtils.js";import{getEffectiveGeometryType as t}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as i,getLayerDeconflictionEnabled as l,createLabelVVEvaluator as o}from"./labelingUtils.js";import{createFeatureSourceSchema as s}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as n}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as a}from"../support/rendererUtils.js";class c{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=i(r,e)??l(r);return[{vvEvaluators:{0:o(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(r){const i=this.layer,l=e(i),{capabilities:o,objectIdField:s}=i,n=i.fieldsIndex.toJSON(),a=t(i),c=i.spatialReference.toJSON();return{type:"memory",source:await i.source.openPorts(),orderByFields:s,metadata:{fieldsIndex:n,geometryType:a,objectIdField:s,spatialReference:c,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null,timeZone:r.timeZone},queryMetadata:{capabilities:o,effectiveCapabilities:l,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,r,t){const{definitionExpression:i}=this.layer;return s(e,{definitionExpression:i,customParameters:null},r,t,null)}createProcessorSchema(e,t,i){const{fields:l,renderer:o,geometryType:s,labelingInfo:a,labelsVisible:c,objectIdField:d}=this.layer,p={fields:l.map((e=>e.toJSON())),renderer:o?.clone(),featureReduction:r(this.layer,t),geometryType:s,labelingInfo:a,labelsVisible:c,objectIdField:d,orderBy:"default"};return n(e,t,p,i)}get hasRequiredSupport(){return a(this.layer.renderer)}getUpdateHashProperties(e){const t=this.layer,{definitionExpression:i,renderer:l}=t,o=this.layer.labelsVisible?this.layer.labelingInfo:null,s=r(t,e)?.toJSON();return{definitionExpression:i,renderer:l,labelingInfo:o,featureReduction:s}}}export{c as KnowledgeGraphSublayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{clone as e}from"../../../../../core/lang.js";import{getEffectiveLayerCapabilities as r}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getEffectiveGeometryType as o}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as i,getLayerDeconflictionEnabled as l,createLabelVVEvaluator as s}from"./labelingUtils.js";import{createFeatureSourceSchema as a}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as n}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class d{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=i(r,e)??l(r);return[{vvEvaluators:{0:s(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(t){const i=this.layer,l=r(i),{capabilities:s,objectIdField:a}=i,n=i.fieldsIndex.toJSON(),c=o(i),d=i.timeInfo?.toJSON(),m=i.spatialReference.toJSON(),u=i.source.getSource(),p=this.layer.objectIdField,y=e(s);return y.query.maxRecordCount=u.maxRecordCount,{type:"ogc",source:u,orderByFields:p,metadata:{fieldsIndex:n,geometryType:c,objectIdField:a,timeInfo:d,spatialReference:m,globalIdField:null,subtypeField:null,subtypes:null,timeReferenceUnknownClient:null,typeIdField:null,types:null},queryMetadata:{capabilities:y,effectiveCapabilities:l,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,r,t){const{customParameters:o,timeExtent:i,apiKey:l}=this.layer;return a(e,{customParameters:o,timeExtent:i},r,t,l)}createProcessorSchema(e,r,o){const{fields:i,renderer:l,geometryType:s,labelingInfo:a,labelsVisible:c,orderBy:d,objectIdField:m}=this.layer,u={fields:i.map((e=>e.toJSON())),renderer:l?.clone(),featureReduction:t(this.layer,r),geometryType:s,labelingInfo:a,labelsVisible:c,objectIdField:m,orderBy:d??"default"};return n(e,r,u,o)}get hasRequiredSupport(){return c(this.layer.renderer)}getUpdateHashProperties(e){const r=this.layer,{renderer:o,apiKey:i}=r,l=this.layer.labelsVisible?this.layer.labelingInfo:null,s=JSON.stringify(r.customParameters),a=t(r,e)?.toJSON();return{apiKey:i,customParameters:s,featureReduction:a,labelingInfo:l,orderBy:JSON.stringify(r.orderBy),renderer:o}}}export{d as OGCFeatureLayerAdapter};
5
+ import{clone as e}from"../../../../../core/lang.js";import{getEffectiveLayerCapabilities as r}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getEffectiveGeometryType as o}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as i,getLayerDeconflictionEnabled as l,createLabelVVEvaluator as s}from"./labelingUtils.js";import{createFeatureSourceSchema as a}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as n}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class d{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=i(r,e)??l(r);return[{vvEvaluators:{0:s(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(t){const i=this.layer,l=r(i),{capabilities:s,objectIdField:a}=i,n=i.fieldsIndex.toJSON(),c=o(i),d=i.timeInfo?.toJSON(),m=i.spatialReference.toJSON(),u=i.source.getSource(),p=this.layer.objectIdField,y=e(s);return y.query.maxRecordCount=u.maxRecordCount,{type:"ogc",source:u,orderByFields:p,metadata:{fieldsIndex:n,geometryType:c,objectIdField:a,timeInfo:d,spatialReference:m,globalIdField:null,subtypeField:null,subtypes:null,timeReferenceUnknownClient:null,typeIdField:null,types:null,timeZone:t.timeZone},queryMetadata:{capabilities:y,effectiveCapabilities:l,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,r,t){const{customParameters:o,timeExtent:i,apiKey:l}=this.layer;return a(e,{customParameters:o,timeExtent:i},r,t,l)}createProcessorSchema(e,r,o){const{fields:i,renderer:l,geometryType:s,labelingInfo:a,labelsVisible:c,orderBy:d,objectIdField:m}=this.layer,u={fields:i.map((e=>e.toJSON())),renderer:l?.clone(),featureReduction:t(this.layer,r),geometryType:s,labelingInfo:a,labelsVisible:c,objectIdField:m,orderBy:d??"default"};return n(e,r,u,o)}get hasRequiredSupport(){return c(this.layer.renderer)}getUpdateHashProperties(e){const r=this.layer,{renderer:o,apiKey:i}=r,l=this.layer.labelsVisible?this.layer.labelingInfo:null,s=JSON.stringify(r.customParameters),a=t(r,e)?.toJSON();return{apiKey:i,customParameters:s,featureReduction:a,labelingInfo:l,orderBy:JSON.stringify(r.orderBy),renderer:o}}}export{d as OGCFeatureLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as r}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveLayerCapabilities as t}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as s}from"./featureReductionUtils.js";import{exceedsMinimumSnapshotCoverage as o}from"./featureServiceUtils.js";import{hasFloorFilter as i,addFloorFilter as l}from"./floorFilterUtils.js";import{getEffectiveGeometryType as a}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as n,getLayerDeconflictionEnabled as p,createLabelVVEvaluator as d}from"./labelingUtils.js";import{createFeatureSourceSchema as c}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as f}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as m}from"../support/rendererUtils.js";class u{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=n(r,e)??p(r);return[{vvEvaluators:{0:d(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(s){const i=this.layer,l=t(i),{capabilities:n,objectIdField:p,globalIdField:d,orderBy:c,refreshInterval:f}=i,m=i.fieldsIndex.toJSON(),u=m.fields,y=a(i),h=i.timeInfo?.toJSON(),b=i.spatialReference.toJSON(),g=e(this.layer.parsedUrl);let S=this.layer.objectIdField;if(c?.length){const e=!c[0].valueExpression&&c[0].field;e&&(S=e)}const I=f>0,j=has("featurelayer-snapshot-enabled")&&"point"===i.geometryType&&n?.query.supportsPagination&&!n?.operations.supportsEditing&&!I,x=j&&o(s,i.fullExtent);return{type:"feature-service",source:g,isSourceHosted:r(g.path),orderByFields:S,metadata:{globalIdField:d,fields:u,fieldsIndex:m,geometryType:y,objectIdField:p,timeInfo:h,spatialReference:b,timeReferenceUnknownClient:!1,subtypeField:null,subtypes:null,typeIdField:null,types:null},queryMetadata:{capabilities:n,effectiveCapabilities:l,lastEditDate:null,snapshotInfo:{supportsSnapshotMinThreshold:j,supportsSnapshotMaxThreshold:x,snapshotCountThresholds:{min:has("featurelayer-snapshot-point-min-threshold"),max:has("featurelayer-snapshot-point-max-threshold")}}}}}createSourceSchema(e,r,t){const{definitionExpression:s,customParameters:o,timeExtent:i}=this.layer;return c(e,{definitionExpression:s,customParameters:o,timeExtent:i},r,t,null)}createProcessorSchema(e,r,t){const{fields:o,renderer:i,geometryType:l,labelingInfo:a,labelsVisible:n,orderBy:p,objectIdField:d}=this.layer,c={fields:o.map((e=>e.toJSON())),renderer:i?.clone(),featureReduction:s(this.layer,r),geometryType:l,labelingInfo:a,labelsVisible:n,objectIdField:d,orderBy:p??"default"};return f(e,r,c,t)}get hasRequiredSupport(){return m(this.layer.renderer)}hasFilters(e){return i(this.layer,e)}addFilters(e,r){return l(this.layer,e,r)}getUpdateHashProperties(e){const r=this.layer,{definitionExpression:t,renderer:o}=r,l=this.layer.labelsVisible?this.layer.labelingInfo:null,a=JSON.stringify(r.customParameters),n=s(r,e)?.toJSON();return{orderBy:JSON.stringify(r.orderBy),definitionExpression:t,renderer:o,labelingInfo:l,featureReduction:n,customParameters:a,floors:i(this.layer,e)?e.floors:null}}}export{u as OrientedImageryLayerAdapter};
5
+ import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as r}from"../../../../../layers/support/arcgisLayerUrl.js";import{getEffectiveLayerCapabilities as t}from"../../../../../layers/support/layerUtils.js";import{getEffectiveFeatureReduction as s}from"./featureReductionUtils.js";import{exceedsMinimumSnapshotCoverage as o}from"./featureServiceUtils.js";import{hasFloorFilter as i,addFloorFilter as l}from"./floorFilterUtils.js";import{getEffectiveGeometryType as a}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as n,getLayerDeconflictionEnabled as p,createLabelVVEvaluator as d}from"./labelingUtils.js";import{createFeatureSourceSchema as m}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as c}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as f}from"../support/rendererUtils.js";class u{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,t=n(r,e)??p(r);return[{vvEvaluators:{0:d(r.renderer)},deconflictionEnabled:t}]}async createServiceOptions(s){const i=this.layer,l=t(i),{capabilities:n,objectIdField:p,globalIdField:d,orderBy:m,refreshInterval:c}=i,f=i.fieldsIndex.toJSON(),u=f.fields,y=a(i),h=i.timeInfo?.toJSON(),b=i.spatialReference.toJSON(),g=e(this.layer.parsedUrl);let S=this.layer.objectIdField;if(m?.length){const e=!m[0].valueExpression&&m[0].field;e&&(S=e)}const I=c>0,j=has("featurelayer-snapshot-enabled")&&"point"===i.geometryType&&n?.query.supportsPagination&&!n?.operations.supportsEditing&&!I,x=j&&o(s,i.fullExtent);return{type:"feature-service",source:g,isSourceHosted:r(g.path),orderByFields:S,metadata:{globalIdField:d,fields:u,fieldsIndex:f,geometryType:y,objectIdField:p,timeInfo:h,spatialReference:b,timeReferenceUnknownClient:!1,subtypeField:null,subtypes:null,typeIdField:null,types:null,timeZone:s.timeZone},queryMetadata:{capabilities:n,effectiveCapabilities:l,lastEditDate:null,snapshotInfo:{supportsSnapshotMinThreshold:j,supportsSnapshotMaxThreshold:x,snapshotCountThresholds:{min:has("featurelayer-snapshot-point-min-threshold"),max:has("featurelayer-snapshot-point-max-threshold")}}}}}createSourceSchema(e,r,t){const{definitionExpression:s,customParameters:o,timeExtent:i}=this.layer;return m(e,{definitionExpression:s,customParameters:o,timeExtent:i},r,t,null)}createProcessorSchema(e,r,t){const{fields:o,renderer:i,geometryType:l,labelingInfo:a,labelsVisible:n,orderBy:p,objectIdField:d}=this.layer,m={fields:o.map((e=>e.toJSON())),renderer:i?.clone(),featureReduction:s(this.layer,r),geometryType:l,labelingInfo:a,labelsVisible:n,objectIdField:d,orderBy:p??"default"};return c(e,r,m,t)}get hasRequiredSupport(){return f(this.layer.renderer)}hasFilters(e){return i(this.layer,e)}addFilters(e,r){return l(this.layer,e,r)}getUpdateHashProperties(e){const r=this.layer,{definitionExpression:t,renderer:o}=r,l=this.layer.labelsVisible?this.layer.labelingInfo:null,a=JSON.stringify(r.customParameters),n=s(r,e)?.toJSON();return{orderBy:JSON.stringify(r.orderBy),definitionExpression:t,renderer:o,labelingInfo:l,featureReduction:n,customParameters:a,floors:i(this.layer,e)?e.floors:null}}}export{u as OrientedImageryLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{getEffectiveFeatureReduction as e}from"./featureReductionUtils.js";import{getEffectiveGeometryType as t}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as r,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as n}from"./labelingUtils.js";import{createSimpleProcessorSchema as o}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as l}from"../support/rendererUtils.js";class s{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,o=r(t,e)??i(t);return[{vvEvaluators:{0:n(t.renderer)},deconflictionEnabled:o}]}async createServiceOptions(e){const r=this.layer,{objectIdField:i}=r,n=t(r),o=r.timeInfo?.toJSON()||null,l=r.spatialReference?r.spatialReference.toJSON():null;return{source:this.layer.parsedUrl,metadata:{fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:n,objectIdField:i,timeInfo:o,timeReferenceUnknownClient:null,spatialReference:l,subtypeField:null,subtypes:null,globalIdField:null,typeIdField:null,types:null}}}createSourceSchema(e,t,r){const{definitionExpression:i,geometryDefinition:n,customParameters:o}=this.layer;return{type:"stream",service:e,tileInfoJSON:t.tileInfoJSON,mutable:{sourceRefreshVersion:r,availableFields:t.availableFields,dataFilter:{geometryDefinition:n?.toJSON(),definitionExpression:i,outSpatialReference:t.outSpatialReference.toJSON(),customParameters:o??null,maxReconnectionAttempts:this.layer.maxReconnectionAttempts,maxReconnectionInterval:this.layer.maxReconnectionInterval,purgeOptions:this.layer.purgeOptions.toJSON()}}}}createProcessorSchema(t,r,i){const{fields:n,renderer:l,geometryType:s,labelingInfo:a,labelsVisible:c,objectIdField:d}=this.layer,m={fields:n.map((e=>e.toJSON())),renderer:l?.clone(),featureReduction:e(this.layer,r),geometryType:s,labelingInfo:a,labelsVisible:c,objectIdField:d,orderBy:"default"};return o(t,r,m,i)}get hasRequiredSupport(){return l(this.layer.renderer)}getUpdateHashProperties(t){const r=this.layer,{definitionExpression:i,renderer:n}=r,o=this.layer.labelsVisible?this.layer.labelingInfo:null,l=JSON.stringify(r.customParameters),s=e(r,t)?.toJSON();return{definitionExpression:i,renderer:n,labelingInfo:o,featureReduction:s,customParameters:l,streamFilter:`${JSON.stringify(r.geometryDefinition)}${r.definitionExpression}`}}}export{s as StreamLayerAdapter};
5
+ import{getEffectiveFeatureReduction as e}from"./featureReductionUtils.js";import{getEffectiveGeometryType as t}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as r,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as n}from"./labelingUtils.js";import{createSimpleProcessorSchema as o}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as l}from"../support/rendererUtils.js";class s{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const t=this.layer,o=r(t,e)??i(t);return[{vvEvaluators:{0:n(t.renderer)},deconflictionEnabled:o}]}async createServiceOptions(e){const r=this.layer,{objectIdField:i}=r,n=t(r),o=r.timeInfo?.toJSON()||null,l=r.spatialReference?r.spatialReference.toJSON():null;return{source:this.layer.parsedUrl,metadata:{fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:n,objectIdField:i,timeInfo:o,timeReferenceUnknownClient:null,spatialReference:l,subtypeField:null,subtypes:null,globalIdField:null,typeIdField:null,types:null,timeZone:e.timeZone}}}createSourceSchema(e,t,r){const{definitionExpression:i,geometryDefinition:n,customParameters:o}=this.layer;return{type:"stream",service:e,tileInfoJSON:t.tileInfoJSON,mutable:{sourceRefreshVersion:r,availableFields:t.availableFields,dataFilter:{geometryDefinition:n?.toJSON(),definitionExpression:i,outSpatialReference:t.outSpatialReference.toJSON(),customParameters:o??null,maxReconnectionAttempts:this.layer.maxReconnectionAttempts,maxReconnectionInterval:this.layer.maxReconnectionInterval,purgeOptions:this.layer.purgeOptions.toJSON()}}}}createProcessorSchema(t,r,i){const{fields:n,renderer:l,geometryType:s,labelingInfo:a,labelsVisible:c,objectIdField:m}=this.layer,d={fields:n.map((e=>e.toJSON())),renderer:l?.clone(),featureReduction:e(this.layer,r),geometryType:s,labelingInfo:a,labelsVisible:c,objectIdField:m,orderBy:"default"};return o(t,r,d,i)}get hasRequiredSupport(){return l(this.layer.renderer)}getUpdateHashProperties(t){const r=this.layer,{definitionExpression:i,renderer:n}=r,o=this.layer.labelsVisible?this.layer.labelingInfo:null,l=JSON.stringify(r.customParameters),s=e(r,t)?.toJSON();return{definitionExpression:i,renderer:n,labelingInfo:o,featureReduction:s,customParameters:l,streamFilter:`${JSON.stringify(r.geometryDefinition)}${r.definitionExpression}`}}}export{s as StreamLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{floatEqualAbsolute as t}from"../../../../../core/mathUtils.js";import{sqlAnd as r}from"../../../../../core/sql.js";import{isHostedAgolService as s}from"../../../../../layers/support/arcgisLayerUrl.js";import i from"../../../../../layers/support/FeatureFilter.js";import{getEffectiveLayerCapabilities as a}from"../../../../../layers/support/layerUtils.js";import{exceedsMinimumSnapshotCoverage as o}from"./featureServiceUtils.js";import{hasFloorFilter as l,addFloorFilter as n}from"./floorFilterUtils.js";import{getEffectiveGeometryType as p}from"./geometryUtils.js";import{getLayerDeconflictionEnabled as y}from"./labelingUtils.js";import{createFeatureSourceSchema as u}from"../schema/SourceSchema.js";import{createSubtypeProcessorSchema as m}from"../schema/processor/SubtypeProcessorSchema.js";class c{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){return[{vvEvaluators:{},deconflictionEnabled:this.layer.sublayers.every((e=>y(e)))}]}async createServiceOptions(t){const r=this.layer,i=a(r),{capabilities:l,datesInUnknownTimezone:n,editingInfo:y,globalIdField:u,objectIdField:m,refreshInterval:c,subtypeField:d}=r,h=r.fieldsIndex.toJSON(),b=p(r),f=r.timeInfo?.toJSON(),g=r.spatialReference.toJSON(),S=e(this.layer.parsedUrl),F=m,I=!(null!=y?.lastEditDate)&&c>0,j=has("featurelayer-snapshot-enabled")&&"point"===r.geometryType&&l?.query.supportsPagination&&!l?.operations.supportsEditing&&!I,x=j&&o(t,r.fullExtent);return{type:"feature-service",source:S,isSourceHosted:s(S.path),orderByFields:F,metadata:{timeReferenceUnknownClient:n,subtypeField:d,globalIdField:u,fieldsIndex:h,geometryType:b,objectIdField:m,timeInfo:f,spatialReference:g,subtypes:this.layer.subtypes?.map((e=>e.toJSON())),typeIdField:null,types:null},queryMetadata:{capabilities:l,effectiveCapabilities:i,lastEditDate:y?.lastEditDate?.getTime(),snapshotInfo:{supportsSnapshotMinThreshold:j,supportsSnapshotMaxThreshold:x,snapshotCountThresholds:{min:has("featurelayer-snapshot-point-min-threshold"),max:has("featurelayer-snapshot-point-max-threshold")}}}}}createSourceSchema(e,t,s){const{definitionExpression:i,customParameters:a,gdbVersion:o,historicMoment:l,subtypeField:n,timeExtent:p,apiKey:y}=this.layer,m=this.layer.sublayers.map((e=>e.subtypeCode)).join(","),c=this.layer.sublayers.length?`${this.layer.subtypeField} IN (${m})`:"1=2",d={definitionExpression:r(i,c),customParameters:a,gdbVersion:o,historicMoment:l,subtypeField:n,timeExtent:p};return u(e,d,t,s,y)}createProcessorSchema(e,t,r){const s={subtypeField:this.layer.subtypeField,sublayers:Array.from(this.layer.sublayers,(e=>({featureReduction:null,geometryType:this.layer.geometryType,labelingInfo:e.labelingInfo,labelsVisible:e.labelsVisible,renderer:e.renderer,subtypeCode:e.subtypeCode,orderBy:null})))};return m(e,t,s,r)}hasFilters(e){return l(this.layer,e)||d(this.layer,e)}addFilters(e,t){e=n(this.layer,e,t);const s=this.layer.sublayers.filter((e=>!h(e,t))).map((e=>e.subtypeCode));if(!s.length)return e;e??=new i;const a=`NOT ${this.layer.subtypeField} IN (${s.join(",")})`;return e.where=r(e.where,a),e}get hasRequiredSupport(){return!0}getUpdateHashProperties(e){const t=this.layer,{definitionExpression:r,gdbVersion:s,apiKey:i}=t,a=t.historicMoment?.getTime()??void 0,o=JSON.stringify(t.customParameters),n=l(this.layer,e)?e.floors:null;return{gdbVersion:s,definitionExpression:r,historicMoment:a,customParameters:o,apiKey:i,sublayerHash:"sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),""),floors:n}}setGraphicOrigin(e){const t=this.layer.fieldsIndex.get(this.layer.subtypeField),r=e.attributes[t.name],s=this.layer.sublayers.find((e=>e.subtypeCode===r));e.layer=e.sourceLayer=s}}function d(e,t){return e.sublayers.some((e=>!h(e,t)))}function h(e,r){return e.visible&&(0===e.minScale||t(r.scale,e.minScale)||r.scale<e.minScale)&&(0===e.maxScale||t(r.scale,e.maxScale)||r.scale>e.maxScale)}export{c as SubtypeGroupLayerAdapter};
5
+ import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{floatEqualAbsolute as t}from"../../../../../core/mathUtils.js";import{sqlAnd as r}from"../../../../../core/sql.js";import{isHostedAgolService as s}from"../../../../../layers/support/arcgisLayerUrl.js";import i from"../../../../../layers/support/FeatureFilter.js";import{getEffectiveLayerCapabilities as a}from"../../../../../layers/support/layerUtils.js";import{exceedsMinimumSnapshotCoverage as o}from"./featureServiceUtils.js";import{hasFloorFilter as l,addFloorFilter as n}from"./floorFilterUtils.js";import{getEffectiveGeometryType as p}from"./geometryUtils.js";import{getLayerDeconflictionEnabled as y}from"./labelingUtils.js";import{createFeatureSourceSchema as u}from"../schema/SourceSchema.js";import{createSubtypeProcessorSchema as m}from"../schema/processor/SubtypeProcessorSchema.js";class c{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){return[{vvEvaluators:{},deconflictionEnabled:this.layer.sublayers.every((e=>y(e)))}]}async createServiceOptions(t){const r=this.layer,i=a(r),{capabilities:l,datesInUnknownTimezone:n,editingInfo:y,globalIdField:u,objectIdField:m,refreshInterval:c,subtypeField:d}=r,h=r.fieldsIndex.toJSON(),b=p(r),f=r.timeInfo?.toJSON(),g=r.spatialReference.toJSON(),S=e(this.layer.parsedUrl),F=m,I=!(null!=y?.lastEditDate)&&c>0,j=has("featurelayer-snapshot-enabled")&&"point"===r.geometryType&&l?.query.supportsPagination&&!l?.operations.supportsEditing&&!I,x=j&&o(t,r.fullExtent);return{type:"feature-service",source:S,isSourceHosted:s(S.path),orderByFields:F,metadata:{timeReferenceUnknownClient:n,subtypeField:d,globalIdField:u,fieldsIndex:h,geometryType:b,objectIdField:m,timeInfo:f,timeZone:t.timeZone,spatialReference:g,subtypes:this.layer.subtypes?.map((e=>e.toJSON())),typeIdField:null,types:null},queryMetadata:{capabilities:l,effectiveCapabilities:i,lastEditDate:y?.lastEditDate?.getTime(),snapshotInfo:{supportsSnapshotMinThreshold:j,supportsSnapshotMaxThreshold:x,snapshotCountThresholds:{min:has("featurelayer-snapshot-point-min-threshold"),max:has("featurelayer-snapshot-point-max-threshold")}}}}}createSourceSchema(e,t,s){const{definitionExpression:i,customParameters:a,gdbVersion:o,historicMoment:l,subtypeField:n,timeExtent:p,apiKey:y}=this.layer,m=this.layer.sublayers.map((e=>e.subtypeCode)).join(","),c=this.layer.sublayers.length?`${this.layer.subtypeField} IN (${m})`:"1=2",d={definitionExpression:r(i,c),customParameters:a,gdbVersion:o,historicMoment:l,subtypeField:n,timeExtent:p};return u(e,d,t,s,y)}createProcessorSchema(e,t,r){const s={subtypeField:this.layer.subtypeField,sublayers:Array.from(this.layer.sublayers,(e=>({featureReduction:null,geometryType:this.layer.geometryType,labelingInfo:e.labelingInfo,labelsVisible:e.labelsVisible,renderer:e.renderer,subtypeCode:e.subtypeCode,orderBy:null})))};return m(e,t,s,r)}hasFilters(e){return l(this.layer,e)||d(this.layer,e)}addFilters(e,t){e=n(this.layer,e,t);const s=this.layer.sublayers.filter((e=>!h(e,t))).map((e=>e.subtypeCode));if(!s.length)return e;e??=new i;const a=`NOT ${this.layer.subtypeField} IN (${s.join(",")})`;return e.where=r(e.where,a),e}get hasRequiredSupport(){return!0}getUpdateHashProperties(e){const t=this.layer,{definitionExpression:r,gdbVersion:s,apiKey:i}=t,a=t.historicMoment?.getTime()??void 0,o=JSON.stringify(t.customParameters),n=l(this.layer,e)?e.floors:null;return{gdbVersion:s,definitionExpression:r,historicMoment:a,customParameters:o,apiKey:i,sublayerHash:"sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),""),floors:n}}setGraphicOrigin(e){const t=this.layer.fieldsIndex.get(this.layer.subtypeField),r=e.attributes[t.name],s=this.layer.sublayers.find((e=>e.subtypeCode===r));e.layer=e.sourceLayer=s}}function d(e,t){return e.sublayers.some((e=>!h(e,t)))}function h(e,r){return e.visible&&(0===e.minScale||t(r.scale,e.minScale)||r.scale<e.minScale)&&(0===e.maxScale||t(r.scale,e.maxScale)||r.scale>e.maxScale)}export{c as SubtypeGroupLayerAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{getGeohashBounds as e}from"../../../../../geohash/geohashUtils.js";import{unquantizeOptimizedGeometry as t,convertToFeature as s}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as r}from"../../../../../layers/graphics/OptimizedFeature.js";import{ComputedAggregateField as a}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as o}from"./AAggregateStrategy.js";import{ASendState as i}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as n}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as d}from"../support/ComputedAttributeStorage.js";import l from"../support/FeatureFilter.js";import{FeatureMetadata as c}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as u}from"../support/FeatureSetReaderJSON.js";import f from"../../../tiling/TileKey.js";class p extends i{constructor(e,t){super(e),this.bins=new Map,this.done=!1,this._store=t}reset(){this.destroy(),this.bins.clear(),this.done=!1,this.handledChunks.clear()}destroy(){for(const e of this.bins.values()){const t=e.cachedFeature?.objectId;null!=t&&this._store.releaseDisplayIdForObjectId(t)}}*featuresWorldSpace(){for(const e of this.bins.values()){const s=e.cachedFeature;if(s){const e=s.clone();t(e.geometry,e.geometry,!1,!1,this.subscription.tile.transform),yield e}}}getGeohashBounds(t,s){const r=this.subscription.tile;return e(r.extent,r.resolution,s,t)}}class h extends o{static async create(e,t,s,r){const o=new d({spatialReference:t}),i=e.fixedBinLevel,n=await Promise.all(e.fields.map((async e=>a.create(o,e)))),c=e.featureFilter?await l.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:t,filterJSON:e.featureFilter}):null;return new h({fields:n,geohashLevel:i,spatialReference:t,featureFilter:c},s,r)}constructor(e,t,s){super(t,s,e.spatialReference,e.fields),this._indexOptions=e,this._metadata=new c({geometryType:"esriGeometryPolygon",objectIdField:"aggregateId",fields:this._indexOptions.fields,globalIdField:null,spatialReference:t.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}createState(e){return new p(e,this._attributeStore)}async*applyOverride(e){for(const t of this._sendStates.values())t.reset()}displayMap(e,t,s){const r=new Map(e.map((e=>[t(e),e]))),a=[];for(const o of this._sendStates.values())for(const e of o.featuresWorldSpace()){const{objectId:t,displayId:o}=e,i=r.get(t);if(null!=i){const e=s(o,i,t);a.push(e),r.delete(t)}}return a}getDisplayFeatures(e){const t=new Set(e),r=new Set,a=[];for(const o of this._sendStates.values())for(const e of o.featuresWorldSpace())t.has(e.displayId)&&!r.has(e.objectId)&&(e.geometry&&a.push({...s(e,this._metadata.geometryType,!1,!1),displayId:e.displayId}),r.add(e.objectId));return{features:[],aggregates:a}}getFeatureObjectIdsForAggregate(e){for(const t of this._sendStates.values())for(const s of t.bins.values())if(s.id===e)return Array.from(s.objectIds);return[]}async*updateChunks(){if(this._source.chunks().length)for(const e of this._sendStates.values())yield*this._update(e,this._source)}forEachAggregateWorldSpace(e){for(const t of this._sendStates.values())for(const s of t.featuresWorldSpace())e(s)}async*_update(e,t){const{handledChunks:s,subscription:a,bins:o}=e,{spatialReference:i,geohashLevel:d}=this._indexOptions,l=a.tile;if(e.done)return;for(const r of t.chunks()){if(s.has(r.chunkId))continue;s.add(r.chunkId);const t=r.queryInfo;if("tileId"in t){const e=new f(t.tileId);if(e.level!==l.level||e.world!==l.key.world)continue}const a=r.getGeohashIndex(this._indexOptions),n=e.getGeohashBounds(i,d);a.putBins(o,n)}const c=[],p=a.tile.transform;for(const n of o.values()){if(n.cachedFeature)n.cachedFeature.attributes=n.getAttributes();else{const e=n.getGeometry(this.spatialReference,p),t=new r(e,n.getAttributes(),null);e||(t.centroid=n.getGeometryCentroid(this.spatialReference,p)),t.objectId=n.id,t.displayId=this._attributeStore.createDisplayIdForObjectId(n.id),n.cachedFeature=t}c.push(n.cachedFeature)}this.events.emit("changed"),e.done=!t.updateTracking.updating;const h=u.fromOptimizedFeatures(c,this._metadata,p),g=h.getCursor(),m=e.subscription.tile.arcadeEvaluationOptions;for(;g.next();)this._attributeStore.setAttributeData(g.getDisplayId(),g,m);const y=new n(e.subscription,h,[],e.done,{});yield y}}export{p as BinningState,h as BinningStrategy};
5
+ import{getGeohashBounds as e}from"../../../../../geohash/geohashUtils.js";import{unquantizeOptimizedGeometry as t,convertToFeature as s}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as r}from"../../../../../layers/graphics/OptimizedFeature.js";import{ComputedAggregateField as a}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as o}from"./AAggregateStrategy.js";import{ASendState as i}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as n}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as l}from"../support/ComputedAttributeStorage.js";import d from"../support/FeatureFilter.js";import{FeatureMetadata as c}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as u}from"../support/FeatureSetReaderJSON.js";import p from"../../../tiling/TileKey.js";class f extends i{constructor(e,t){super(e),this.bins=new Map,this.done=!1,this._store=t}reset(){this.destroy(),this.bins.clear(),this.done=!1,this.handledChunks.clear()}destroy(){const e=this.subscription.tile.key.level;for(const t of this.bins.values()){const s=t.cachedFeature?.objectId;null!=s&&this._store.releaseDisplayIdForObjectId(`${s}.${e}`)}}*featuresWorldSpace(){for(const e of this.bins.values()){const s=e.cachedFeature;if(s){const e=s.clone();t(e.geometry,e.geometry,!1,!1,this.subscription.tile.transform),yield e}}}getGeohashBounds(t,s){const r=this.subscription.tile;return e(r.extent,r.resolution,s,t)}}class h extends o{static async create(e,t,s,r){const o=new l({spatialReference:t}),i=e.fixedBinLevel,n=await Promise.all(e.fields.map((async e=>a.create(o,e)))),c=e.featureFilter?await d.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:t,filterJSON:e.featureFilter}):null;return new h({fields:n,geohashLevel:i,spatialReference:t,featureFilter:c,timeZone:s.metadata.timeZone},e.fields,s,r)}constructor(e,t,s,r){super(s,r,e.spatialReference,e.fields),this._indexOptions=e,this._metadata=new c({geometryType:"esriGeometryPolygon",objectIdField:"aggregateId",fields:t,globalIdField:null,spatialReference:s.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null,timeZone:this._indexOptions.timeZone})}createState(e){return new f(e,this._attributeStore)}async*applyOverride(e){for(const t of this._sendStates.values())t.reset()}displayMap(e,t,s){const r=new Map(e.map((e=>[t(e),e]))),a=[];for(const o of this._sendStates.values())for(const e of o.featuresWorldSpace()){const{objectId:t,displayId:o}=e,i=r.get(t);if(null!=i){const e=s(o,i,t);a.push(e),r.delete(t)}}return a}getDisplayFeatures(e){const t=new Set(e),r=new Set,a=[];for(const o of this._sendStates.values())for(const e of o.featuresWorldSpace())t.has(e.displayId)&&!r.has(e.objectId)&&(e.geometry&&a.push({...s(e,this._metadata.geometryType,!1,!1),displayId:e.displayId}),r.add(e.objectId));return{features:[],aggregates:a}}getFeatureObjectIdsForAggregate(e){for(const t of this._sendStates.values())for(const s of t.bins.values())if(s.id===e)return Array.from(s.objectIds);return[]}async*updateChunks(){if(this._source.chunks().length)for(const e of this._sendStates.values())yield*this._update(e,this._source)}forEachAggregateWorldSpace(e){for(const t of this._sendStates.values())for(const s of t.featuresWorldSpace())e(s)}async*_update(e,t){const{handledChunks:s,subscription:a,bins:o}=e,{spatialReference:i,geohashLevel:l}=this._indexOptions,d=a.tile;if(e.done)return;for(const r of t.chunks()){if(s.has(r.chunkId))continue;s.add(r.chunkId);const t=r.queryInfo;if("tileId"in t){const e=new p(t.tileId);if(e.level!==d.level||e.world!==d.key.world)continue}const a=r.getGeohashIndex(this._indexOptions),n=e.getGeohashBounds(i,l);a.putBins(o,n)}const c=[],f=a.tile.transform,h=a.tile.key.level;for(const n of o.values()){if(n.cachedFeature)n.cachedFeature.attributes=n.getAttributes();else{const e=n.getGeometry(this.spatialReference,f),t=new r(e,n.getAttributes(),null);e||(t.centroid=n.getGeometryCentroid(this.spatialReference,f)),t.objectId=n.id,t.displayId=this._attributeStore.createDisplayIdForObjectId(`${t.objectId}.${h}`),n.cachedFeature=t}c.push(n.cachedFeature)}this.events.emit("changed"),e.done=!t.updateTracking.updating;const m=u.fromOptimizedFeatures(c,this._metadata,f),g=m.getCursor(),y=this._metadata.createArcadeEvalOptions(e.subscription.tile);for(;g.next();)this._attributeStore.setAttributeData(g.getDisplayId(),g,y);const b=new n(e.subscription,m,[],e.done,{});yield b}}export{f as BinningState,h as BinningStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import{tileSize as s}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as i}from"../aggregation/ComputedAggregateField.js";import{GridCell as r}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as n}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as a}from"./AAggregateStrategy.js";import{ASendState as l}from"./AProcessorStrategy.js";import{WithDisplayId as o}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as d}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as c}from"../support/ComputedAttributeStorage.js";import u from"../support/FeatureFilter.js";import{FeatureMetadata as p}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as h}from"../support/FeatureSetReaderJSON.js";import f from"../../../tiling/TileKey.js";const g=128;class _ extends l{constructor(e){super(e),this.didSend=!1,this.done=!1}}class m{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null);i.objectId=e.inner.id,i.displayId=e.displayId,yield i}}clusters(){return this._clusters.values()}updateChunks(e){let t=!1;for(const s of e){const e=s.queryInfo;if("tileId"in e){if(new f(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(s.chunkId)){this._handledChunks.add(s.chunkId),t=!0;s.getGridIndex({...this._indexOptions,scale:this._scale}).putCells(this._cells)}}return t&&this._clusterCells(),t}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map((([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue})));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,i){const r=e.subscription,n=[],a=r.tile.transform;for(const l of this._clusters.values()){const e=l.inner.getCentroid(a),i=new t(e,l.inner.getAttributes(),null);i.objectId=l.inner.id,i.displayId=l.displayId;const o=i.geometry.coords,d=r.tile.lod,c=d.wrap?d.worldSize[0]:null;if(null!=c)if(1===c){const e=i.clone();e.geometry.coords[0]-=s,n.push(e);const t=i.clone();t.geometry.coords[0]+=s,n.push(t)}else o[0]>s+s/2?o[0]-=c*s:o[0]<-s/2&&(o[0]+=c*s);const[u,p]=i.geometry.coords;u<s+g&&u>=-g&&p<s+g&&p>=-g&&n.push(i)}return h.fromOptimizedFeatures(n,i,r.tile.transform)}_clusterCells(){let e=Array.from(this._cells.values());e=e.sort(((e,t)=>t.count-e.count));const t=[];for(const i of this._clusters.values())t.push(i.inner.id);this._clusters.clear();const s=new Set;for(const i of e){if(s.has(i.id))continue;const e=this._store.createDisplayIdForObjectId(i.id),t=new o(i.clone(),e);s.add(i.id),this._clusters.set(i.id,t);const a=this._clusterRadius*(1/n(this._indexOptions.spatialReference,this._scale)),l=1+this._clusterRadius/this._indexOptions.cellSize,d=i.centroidXWorld,c=i.centroidYWorld;for(let n=i.gridY-l;n<=i.gridY+l;n++)for(let e=i.gridX-l;e<=i.gridX+l;e++){if(n===i.gridY&&e===i.gridX)continue;const l=this._cells.get(r.createId(e,n));if(!l||s.has(l.id))continue;const o=Math.abs(l.centroidXWorld-d),u=Math.abs(l.centroidYWorld-c);o<a&&u<a&&(t.inner.merge(l),s.add(l.id))}}for(const i of t)this._store.releaseDisplayIdForObjectId(i)}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,n=e.get(r.name);if(n){const{minValue:e,maxValue:i}=n,r=Math.min(n.minValue,t),a=Math.max(n.maxValue,t);e===r&&i===a||(n.minValue=r,n.maxValue=a,s=!0)}else e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class y extends a{static async create(e,t,s,r,n){const a=new c({spatialReference:s}),l={fields:await Promise.all(t.fields.map((async e=>i.create(a,e)))),spatialReference:s,featureFilter:t.featureFilter?await u.create({geometryType:r.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:r.metadata.timeInfo,fieldsIndex:r.metadata.fieldsIndex,spatialReference:s,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4};return new y(e,t.clusterRadius,l,r,n)}constructor(e,t,s,i,r){super(i,r,s.spatialReference,s.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=new p({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fields:[...this._indexOptions.fields,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],globalIdField:null,spatialReference:i.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new _(e)}async*applyOverride(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map((e=>[t(e),e]))),r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const a of n.clusters()){const e=i.get(a.inner.id);if(null==e){if(1===a.inner.count){const e=i.get(a.inner.firstObjectId);if(null!=e){const t=s(a.displayId,e,a.inner.firstObjectId);r.push(t),i.delete(a.inner.firstObjectId)}}}else{const t=s(a.displayId,e,a.inner.id);r.push(t),i.delete(a.inner.id)}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],n=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of a.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}n.push({...t,displayId:l.displayId})}return{features:r,aggregates:n}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.objectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);if(t.updateChunks(e)||!this._source.updateTracking.updating)for(const r of this._sendStates.values())r.subscription.tile.level===this._requiredLevel&&(r.didSend=!1,r.done=!1);const s=Array.from(this._sendStates.values()).filter((e=>e.done)).map((e=>e.subscription.tile.key)),i=new Set(s);for(const r of this._sendStates.values()){if(this._source.updateTracking.updating){if(s.some((e=>e.containsChild(r.subscription.tile.key))))continue;if(r.subscription.tile.key.getChildKeys().every((e=>i.has(e))))continue}r.didSend||r.subscription.tile.level!==this._requiredLevel||(r.didSend=!0,yield*this._update(r,t,this._source))}await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new m(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!s.updateTracking.updating;const r=i.getCursor(),n=e.subscription.tile.arcadeEvaluationOptions;for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n);const a=new d(e.subscription,i,!0,e.done,{});yield a}}export{_ as ClusterState,y as ClusterStrategy};
5
+ import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import{tileSize as s}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as i}from"../aggregation/ComputedAggregateField.js";import{GridCell as r}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as a}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as n}from"./AAggregateStrategy.js";import{ASendState as l}from"./AProcessorStrategy.js";import{WithDisplayId as o}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as d}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as c}from"../support/ComputedAttributeStorage.js";import u from"../support/FeatureFilter.js";import{FeatureMetadata as h}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as p}from"../support/FeatureSetReaderJSON.js";import f from"../../../tiling/TileKey.js";const g=128;class m extends l{constructor(e){super(e),this.didSend=!1,this.done=!1}}class _{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null);i.objectId=e.inner.id,i.displayId=e.displayId,yield i}}clusters(){return this._clusters.values()}updateChunks(e){let t=!1;for(const s of e){const e=s.queryInfo;if("tileId"in e){if(new f(e.tileId).level!==this._level)continue}if(!this._handledChunks.has(s.normalizedChunkId)){this._handledChunks.add(s.normalizedChunkId),t=!0;s.getGridIndex({...this._indexOptions,scale:this._scale}).putCells(this._cells)}}return t&&this._clusterCells(),t}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map((([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue})));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,i){const r=e.subscription,a=[],n=r.tile.transform;for(const l of this._clusters.values()){const e=l.inner.getCentroid(n),i=new t(e,l.inner.getAttributes(),null);i.objectId=l.inner.id,i.displayId=l.displayId;const o=i.geometry.coords,d=r.tile.lod,c=d.wrap?d.worldSize[0]:null;if(null!=c)if(1===c){const e=i.clone();e.geometry.coords[0]-=s,a.push(e);const t=i.clone();t.geometry.coords[0]+=s,a.push(t)}else o[0]>s+s/2?o[0]-=c*s:o[0]<-s/2&&(o[0]+=c*s);const[u,h]=i.geometry.coords;u<s+g&&u>=-g&&h<s+g&&h>=-g&&a.push(i)}return p.fromOptimizedFeatures(a,i,r.tile.transform)}_clusterCells(){let e=Array.from(this._cells.values());e=e.sort(((e,t)=>t.count-e.count));const t=[];for(const i of this._clusters.values())t.push(i.inner.id);this._clusters.clear();const s=new Set;for(const i of e){if(s.has(i.id))continue;const e=this._store.createDisplayIdForObjectId(i.id),t=new o(i.clone(),e);s.add(i.id),this._clusters.set(i.id,t);const n=this._clusterRadius*(1/a(this._indexOptions.spatialReference,this._scale)),l=1+this._clusterRadius/this._indexOptions.cellSize,d=i.centroidXWorld,c=i.centroidYWorld;for(let a=i.gridY-l;a<=i.gridY+l;a++)for(let e=i.gridX-l;e<=i.gridX+l;e++){if(a===i.gridY&&e===i.gridX)continue;const l=this._cells.get(r.createId(e,a));if(!l||s.has(l.id))continue;const o=Math.abs(l.centroidXWorld-d),u=Math.abs(l.centroidYWorld-c);o<n&&u<n&&(t.inner.merge(l),s.add(l.id))}}for(const i of t)this._store.releaseDisplayIdForObjectId(i)}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,a=e.get(r.name);if(a){const{minValue:e,maxValue:i}=a,r=Math.min(a.minValue,t),n=Math.max(a.maxValue,t);e===r&&i===n||(a.minValue=r,a.maxValue=n,s=!0)}else e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class y extends n{static async create(e,t,s,r,a){const n=new c({spatialReference:s}),l={fields:await Promise.all(t.fields.map((async e=>i.create(n,e)))),spatialReference:s,featureFilter:t.featureFilter?await u.create({geometryType:r.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:r.metadata.timeInfo,fieldsIndex:r.metadata.fieldsIndex,spatialReference:s,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,timeZone:r.metadata.timeZone};return new y(e,t.clusterRadius,l,t.fields,r,a)}constructor(e,t,s,i,r,a){super(r,a,s.spatialReference,s.fields),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=new h({geometryType:"esriGeometryPoint",objectIdField:"aggregateId",fields:[...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],globalIdField:null,spatialReference:r.metadata.spatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,typeIdField:null,types:null,timeZone:r.metadata.timeZone})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}onSubscribe(e){super.onSubscribe(e),this._requiredLevel=e.tile.level,this._requiredScale=e.tile.scale}createState(e){return new m(e)}async*applyOverride(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map((e=>[t(e),e]))),r=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const n of a.clusters()){const e=i.get(n.inner.id);if(null==e){if(1===n.inner.count){const e=i.get(n.inner.firstObjectId);if(null!=e){const t=s(n.displayId,e,n.inner.firstObjectId);r.push(t),i.delete(n.inner.firstObjectId)}}}else{const t=s(n.displayId,e,n.inner.id);r.push(t),i.delete(n.inner.id)}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],a=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of n.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}a.push({...t,displayId:l.displayId})}return{features:r,aggregates:a}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.objectIds);return[]}async*updateChunks(){const e=this._source.chunks();if(!e.length)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);if(t.updateChunks(e)||!this._source.updateTracking.updating)for(const r of this._sendStates.values())r.subscription.tile.level===this._requiredLevel&&(r.didSend=!1,r.done=!1);const s=Array.from(this._sendStates.values()).filter((e=>e.done)).map((e=>e.subscription.tile.key)),i=new Set(s);for(const r of this._sendStates.values()){if(this._source.updateTracking.updating){if(s.some((e=>e.containsChild(r.subscription.tile.key))))continue;if(r.subscription.tile.key.getChildKeys().every((e=>i.has(e))))continue}r.didSend||r.subscription.tile.level!==this._requiredLevel||(r.didSend=!0,yield*this._update(r,t,this._source))}await t.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new _(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){if(e.done)return;const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=!s.updateTracking.updating;const r=i.getCursor(),a=this._metadata.createArcadeEvalOptions(e.subscription.tile);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,a);const n=new d(e.subscription,i,!0,e.done,{});yield n}}export{m as ClusterState,y as ClusterStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{ASendState as t,AProcessorStrategy as e}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as s,FeatureTileAppendMessage as r}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as n}from"../sources/strategies/chunks/OverrideChunk.js";class o extends t{}class a extends e{constructor(t,e){super(t,e),this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set}destroy(){super.destroy();for(const t of this._source.chunks())this._cleanupChunkIds(t)}invalidateAttributeData(){this.handledChunksForAttributeData.clear()}onSubscribe(t){super.onSubscribe(t),this._evalOptions=t.tile.arcadeEvaluationOptions}createState(t){return new o(t)}get aggregateQueryEngine(){return null}displayMap(t,e,s){const r=new Map(t.map((t=>[e(t),t]))),n=[];for(const o of this._source.chunks()){const t=o.reader.getCursor();for(;t.next();){const e=t.getObjectId(),o=t.getDisplayId(),a=r.get(e);if(null!=a){const t=s(o,a,e);n.push(t),r.delete(e)}}}return n}getDisplayFeatures(t){const e=new Set(t),s=new Set,r=[];for(const n of this._source.chunks()){const t=n.reader.getCursor();for(;t.next();){const n=t.getObjectId(),o=t.getDisplayId();e.has(o)&&!s.has(n)&&(r.push({...t.readLegacyFeatureWorldSpace(),displayId:o}),s.add(n))}}return{features:r,aggregates:[]}}async*applyOverride(t){const e=[],r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId();e.push(t);const s=this._attributeStore.createDisplayIdForObjectId(t);r.setDisplayId(s),this._attributeStore.setAttributeData(s,r,this._evalOptions)}const o=this.getDisplayIds(e),a=this.getDisplayIds(t.removed),i=new n;i.applyOverrides(t);for(const n of this._sendStates.values())yield new s(n.subscription,null,o,!1,i.queryInfo);for(const n of this._sendStates.values()){const t=i.getTileReader(n.subscription.tile);yield new s(n.subscription,t,a,!1,i.queryInfo)}for(const s of t.removed)this._attributeStore.releaseDisplayIdForObjectId(s)}async*updateChunks(){if(this._source.chunks().length){await this._updateAttributeData();for(const t of this._sendStates.values())yield*this._update(t)}}removeChunks(t){for(const e of t)this.handledChunks.delete(e.chunkId),this.handledChunksForAttributeData.delete(e.chunkId),this._cleanupChunkIds(e)}_cleanupChunkIds(t){if(this.handledChunksForIdCreation.has(t.chunkId)){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId();this._attributeStore.releaseDisplayIdForObjectId(t)}this.handledChunksForIdCreation.delete(t.chunkId)}}async _updateAttributeData(){for(const t of this._source.chunks()){const{chunkId:e,reader:s}=t;if(!this.handledChunksForIdCreation.has(e)){this.handledChunksForIdCreation.add(e);const t=s.getCursor();for(;t.next();){const e=this._attributeStore.createDisplayIdForObjectId(t.getObjectId());t.setDisplayId(e)}}}for(const t of this._source.chunks())if(!this.handledChunksForAttributeData.has(t.chunkId)){this.handledChunksForAttributeData.add(t.chunkId);const e=t.reader.getCursor();for(;e.next();){const t=e.getDisplayId();this._attributeStore.setAttributeData(t,e,this._evalOptions)}}}*_update(t){const{subscription:e,handledChunks:s}=t;for(const n of this._source.chunks()){const{chunkId:o}=n;if(s.has(o))continue;s.add(o);const a=n.getTileReader(e.tile);a&&(yield new r(t.subscription,a,!1,n.end,n.queryInfo))}}}export{o as DefaultSendState,a as FeatureUpdateStrategy};
5
+ import{ASendState as t,AProcessorStrategy as e}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as s,FeatureTileAppendMessage as r}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as n}from"../sources/strategies/chunks/OverrideChunk.js";class o extends t{}class a extends e{constructor(t,e){super(t,e),this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set}destroy(){super.destroy();for(const t of this._source.chunks())this._cleanupChunkIds(t)}invalidateAttributeData(){this.handledChunksForAttributeData.clear()}onSubscribe(t){super.onSubscribe(t),this._evalOptions=this._source.metadata.createArcadeEvalOptions(t.tile)}createState(t){return new o(t)}get aggregateQueryEngine(){return null}displayMap(t,e,s){const r=new Map(t.map((t=>[e(t),t]))),n=[];for(const o of this._source.chunks()){const t=o.reader.getCursor();for(;t.next();){const e=t.getObjectId(),o=t.getDisplayId(),a=r.get(e);if(null!=a){const t=s(o,a,e);n.push(t),r.delete(e)}}}return n}getDisplayFeatures(t){const e=new Set(t),s=new Set,r=[];for(const n of this._source.chunks()){const t=n.reader.getCursor();for(;t.next();){const n=t.getObjectId(),o=t.getDisplayId();e.has(o)&&!s.has(n)&&(r.push({...t.readLegacyFeatureWorldSpace(),displayId:o}),s.add(n))}}return{features:r,aggregates:[]}}async*applyOverride(t){const e=[],r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId();e.push(t);const s=this._attributeStore.createDisplayIdForObjectId(t);r.setDisplayId(s),this._attributeStore.setAttributeData(s,r,this._evalOptions)}const o=this.getDisplayIds(e),a=this.getDisplayIds(t.removed),i=new n;i.applyOverrides(t);for(const n of this._sendStates.values())yield new s(n.subscription,null,o,!1,i.queryInfo);for(const n of this._sendStates.values()){const t=i.getTileReader(n.subscription.tile);yield new s(n.subscription,t,a,!1,i.queryInfo)}for(const s of t.removed)this._attributeStore.releaseDisplayIdForObjectId(s)}async*updateChunks(){if(this._source.chunks().length){await this._updateAttributeData();for(const t of this._sendStates.values())yield*this._update(t)}}removeChunks(t){for(const e of t)this.handledChunks.delete(e.chunkId),this.handledChunksForAttributeData.delete(e.chunkId),this._cleanupChunkIds(e)}_cleanupChunkIds(t){if(this.handledChunksForIdCreation.has(t.chunkId)){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId();this._attributeStore.releaseDisplayIdForObjectId(t)}this.handledChunksForIdCreation.delete(t.chunkId)}}async _updateAttributeData(){for(const t of this._source.chunks()){const{chunkId:e,reader:s}=t;if(!this.handledChunksForIdCreation.has(e)){this.handledChunksForIdCreation.add(e);const t=s.getCursor();for(;t.next();){const e=this._attributeStore.createDisplayIdForObjectId(t.getObjectId());t.setDisplayId(e)}}}for(const t of this._source.chunks())if(!this.handledChunksForAttributeData.has(t.chunkId)){this.handledChunksForAttributeData.add(t.chunkId);const e=t.reader.getCursor();for(;e.next();){const t=e.getDisplayId();this._attributeStore.setAttributeData(t,e,this._evalOptions)}}}*_update(t){const{subscription:e,handledChunks:s}=t;for(const n of this._source.chunks()){const{chunkId:o}=n;if(s.has(o))continue;s.add(o);const a=n.getTileReader(e.tile);a&&(yield new r(t.subscription,a,!1,n.end,n.queryInfo))}}}export{o as DefaultSendState,a as FeatureUpdateStrategy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,i,r,s,h){super(),this._reader=e,this._queryJSON=t,this._tile=i,this._sourceTile=r,this._sourceTileDepth=s,this._end=h,this.chunkId=`${this._tile.key.id}.${this._sourceTile?.key.id}${this._end?"e":""}`}get queryInfo(){return{type:"drill-down-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,sourceTileDepth:this._sourceTileDepth,sourceTileId:this._sourceTile?.key.id,size:this.size(),end:this.end}}get first(){return 0===this._sourceTileDepth}get reader(){return this._reader}get end(){return this._end}get tile(){return this._tile}get isTiled(){return!0}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}export{t as DrillDownTileSourceChunk};
5
+ import{ASourceChunk as e}from"./ASourceChunk.js";class i extends e{constructor(e,i,t,r,s,h){super(),this._reader=e,this._queryJSON=i,this._tile=t,this._sourceTile=r,this._sourceTileDepth=s,this._end=h,this.chunkId=`${this._tile.key.id}.${this._sourceTile?.key.id}${this._end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._sourceTile?.key.normalizedId}${this._end?"e":""}`}get queryInfo(){return{type:"drill-down-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,sourceTileDepth:this._sourceTileDepth,sourceTileId:this._sourceTile?.key.id,size:this.size(),end:this.end}}get first(){return 0===this._sourceTileDepth}get reader(){return this._reader}get end(){return this._end}get tile(){return this._tile}get isTiled(){return!0}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}export{i as DrillDownTileSourceChunk};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,r,s){super(),this._reader=e,this._queryJSON=t,this._page=r,this._end=s,this.chunkId=`${this._page}${this.end?"e":""}`}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get queryInfo(){return{type:"snapshot",chunkId:this.chunkId,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(e){const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{t as FeatureSnapshotSourceChunk};
5
+ import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,r,s){super(),this._reader=e,this._queryJSON=t,this._page=r,this._end=s,this.chunkId=`${this._page}${this.end?"e":""}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get queryInfo(){return{type:"snapshot",chunkId:this.chunkId,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(e){const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{t as FeatureSnapshotSourceChunk};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as r}from"../../../support/FeatureSetReaderJSON.js";class t extends e{constructor(){super(...arguments),this.chunkId="override",this.removed=new Set,this.overridenIds=new Set,this._features=[]}get reader(){return r.fromOptimizedFeatures(this._features,this._layerSchema??{fields:[]})}get queryInfo(){return{}}get first(){return!1}get end(){return!1}get isTiled(){return!1}applyOverrides(e){super.invalidate(),this._layerSchema||(this._layerSchema=e.reader.fullSchema());const{reader:r,removed:t}=e,s=[],d=new Set,o=r.getCursor(),i=new Set(t);for(this.overridenIds.clear();o.next();){const e=o.readOptimizedFeatureWorldSpace(),r=e.objectId;s.push(e),d.add(r),this.overridenIds.add(r),this.removed.delete(r)}for(const a of this._features){const e=a.objectId;i.has(e)||d.has(e)||(s.push(a),this.overridenIds.add(e))}this._features=s;for(const a of d.values())this.removed.delete(a);for(const a of t)this.removed.add(a),this.overridenIds.add(a)}getTileReader(e){if(!this._features.length)return null;const r=this.queryFeaturesInBounds(e.bounds);return r.setTransformForDisplay(e.transform),r}}export{t as OverrideChunk};
5
+ import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as r}from"../../../support/FeatureSetReaderJSON.js";class t extends e{constructor(){super(...arguments),this.chunkId="override",this.normalizedChunkId="override",this.removed=new Set,this.overridenIds=new Set,this._features=[]}get reader(){return r.fromOptimizedFeatures(this._features,this._layerSchema??{fields:[]})}get queryInfo(){return{}}get first(){return!1}get end(){return!1}get isTiled(){return!1}applyOverrides(e){super.invalidate(),this._layerSchema||(this._layerSchema=e.reader.fullSchema());const{reader:r,removed:t}=e,s=[],d=new Set,o=r.getCursor(),i=new Set(t);for(this.overridenIds.clear();o.next();){const e=o.readOptimizedFeatureWorldSpace(),r=e.objectId;s.push(e),d.add(r),this.overridenIds.add(r),this.removed.delete(r)}for(const a of this._features){const e=a.objectId;i.has(e)||d.has(e)||(s.push(a),this.overridenIds.add(e))}this._features=s;for(const a of d.values())this.removed.delete(a);for(const a of t)this.removed.add(a),this.overridenIds.add(a)}getTileReader(e){if(!this._features.length)return null;const r=this.queryFeaturesInBounds(e.bounds);return r.setTransformForDisplay(e.transform),r}}export{t as OverrideChunk};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,i,r,s){super(),this._reader=e,this._queryJSON=t,this._tile=i,this._page=r,this._end=s,this.chunkId=`${this._tile.key.id}.${this._page}${this.end?"e":""}`}get queryInfo(){return{type:"paged-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get page(){return this._page}get tile(){return this._tile}get isTiled(){return!0}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}export{t as PagedTileSourceChunk};
5
+ import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,i,r,s){super(),this._reader=e,this._queryJSON=t,this._tile=i,this._page=r,this._end=s,this.chunkId=`${this._tile.key.id}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._page}${this.end?"e":""}`}get queryInfo(){return{type:"paged-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get page(){return this._page}get tile(){return this._tile}get isTiled(){return!0}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}export{t as PagedTileSourceChunk};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{ASourceChunk as e}from"./ASourceChunk.js";class r extends e{constructor(e){super(),this._reader=e,this.chunkId="stream-chunk"}get reader(){return this._reader}get first(){return!0}get end(){return!0}get queryInfo(){return{type:"stream",chunkId:this.chunkId,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(e){const r=this.queryFeaturesInBounds(e.bounds);return r.setTransformForDisplay(e.transform),r}}export{r as StreamSourceChunk};
5
+ import{ASourceChunk as e}from"./ASourceChunk.js";class r extends e{constructor(e){super(),this._reader=e,this.chunkId="stream-chunk",this.normalizedChunkId="stream-chunk"}get reader(){return this._reader}get first(){return!0}get end(){return!0}get queryInfo(){return{type:"stream",chunkId:this.chunkId,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(e){const r=this.queryFeaturesInBounds(e.bounds);return r.setTransformForDisplay(e.transform),r}}export{r as StreamSourceChunk};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{diff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{highlightReasons as s}from"../../../engine/highlightReasons.js";import{attributeStoreInitialSize as r,AttributeDataType as n}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as a}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as o}from"../../../engine/webgl/Utils.js";import{nanMagicNumber as l}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as h,DEBUG_ATTR_UPDATES as c}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as d}from"./DisplayIdGenerator.js";import u from"./FeatureFilter.js";import{PixelType as p}from"../../../../webgl/enums.js";function g(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}const _=()=>e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),f=h(c,_()),y={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};class m{constructor(t,e,i){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:s,layout:r,textureOnly:n}=e;this.textureOnly=n||!1,this.pixelType=s,this.layout=r,this._resetRange(),this.size=t,this.isLocal=i,n||(this.data=this._initData(s,t))}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=this.data;for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){this.data[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){this.data[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=a(t);return this.data[i*this.texelSize+e]}setData(t,e,i){const s=a(t),r=1<<e;0!=(this.layout&r)?null!=this.data&&(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):_().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),i=this.data;e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!this.isLocal,r=this.pixelType,n=this.layout,a=this.data;return{start:t,end:e,data:s&&a.slice(t*i,(e+1)*i)||null,pixelType:r,layout:n}}_initData(t,e){const i=ArrayBuffer,s=o(t),r=new s(new i(e*e*4*s.BYTES_PER_ELEMENT));for(let n=0;n<r.length;n+=4)r[n+1]=255;return r}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class b{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=r,this._idsToHighlight=new Map,this._referencesScale=!1,this._referencesGeometry=!1,this._initialized=!1,this.version=0,this._idGenerator=new d,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=p.FLOAT;f(`Creating AttributeStore ${y.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:p.UNSIGNED_BYTE,layout:1},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}get referencesScale(){return this._referencesScale}get referencesGeometry(){return this._referencesGeometry}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}async update(t,e,s,r,n=0){const a=i(this._schema,t);if(this.version=n,a&&(has("esri-2d-update-debug")&&console.debug(`Version[${n}] AttributeStore.update`,{changed:a}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map((t=>t?u.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:r??s.spatialReference,filterJSON:t}):null)))),"subtype"!==t.type)this._attributeComputeInfo={isSubtype:!1,map:new Map},await Promise.all(t.bindings.map((async t=>{const i=await this._bind(e,t);this._referencesGeometry=this._referencesGeometry||(i?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(i?.referencesScale()??!1)})));else{this._attributeComputeInfo={isSubtype:!0,subtypeField:t.subtypeField,map:new Map},this._referencesScale=!1,this._referencesGeometry=!1;for(const i in t.bindings){const s=t.bindings[i];await Promise.all(s.map((async t=>{const s=await this._bind(e,t,parseInt(i,10));this._referencesGeometry=this._referencesGeometry||(s?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(s?.referencesScale()??!1)})))}}}setHighlight(t){const e=this._getBlock(0);e.unsetComponentAllTexels(0,(1<<s.length)-1);for(const{displayId:i,highlightFlags:s}of t){if(null==i)continue;const t=a(i);e.setComponent(0,s,[t])}this._idsToHighlight.clear();for(const{objectId:i,highlightFlags:s}of t)this._idsToHighlight.set(i,s)}setData(t,e,i,s){const r=a(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlags(t){return this._idsToHighlight.get(t)||0}unsetAttributeData(t){const e=a(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e,i){const s=a(t);this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(e));const r=this._attributeComputeInfo,o=1,h=4;let c=null;r&&(c=r.isSubtype?r.map.get(e.readAttribute(r.subtypeField)):r.map,c?.size&&c.forEach(((t,r)=>{const a=r*o%h,c=Math.floor(r*o/h),d=this._getBlock(c+n.VV);let u=t.field?.read(e,i);t.valueRepresentation&&(u=g(u,t.valueRepresentation));(null===u||isNaN(u)||u===1/0||u===-1/0)&&(u=l),d.setData(s,a,u)})))}get epoch(){return this._epoch}async sendUpdates(){const t=this._blocks.map((t=>null!=t?t.toMessage():null)),e=this._getInitArgs();has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.start"),await this._client.update({initArgs:e,blockData:t,version:this.version,sendUpdateEpoch:this._epoch},this._signal),this._epoch+=1,has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.end")}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}async _bind(t,e,i){const s=await t.createComputedField(e),{valueRepresentation:r}=e,n=this._attributeComputeInfo;if(n.isSubtype){const t=n.map.get(i)??new Map;t.set(e.binding,{field:s,valueRepresentation:r}),n.map.set(i,t)}else n.map.set(e.binding,{field:s,valueRepresentation:r});return s}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(n.Animation),this._getBlock(n.GPGPU),{blockSize:this._size,blockDescriptors:this._blocks.map((t=>null!=t?{textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType}:null))})}_getBlock(t){const e=this._blocks[t];if(null!=e)return e;f(`Initializing AttributeBlock at index ${t}`);const i=new m(this._size,this._blockDescriptors[t],this._client.isLocal);return this._blocks[t]=i,this._initialized=!1,i}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const t=this._size<<=1;f("Expanding block size to",t,this._blocks);for(const e of this._blocks)e?.expand(t);return this._initialized=!1,this._size=t,0}return _().error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}isVisible(t){return!!(this._getBlock(0).getData(t,0)&1<<s.length)}getFilterFlags(t){let e=0;for(let s=0;s<this._filters.length;s++){const i=!!(1<<s),r=this._filters[s];e|=(!i||null==r||r.check(t)?1:0)<<s}let i=0;if(this._idsToHighlight.size){const e=t.getObjectId();i=this.getHighlightFlags(e)}return e<<s.length|i}}export{b as AttributeStore,g as getVisualVariableSizeValueRepresentationRatio};
5
+ import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import{diff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{highlightReasons as s}from"../../../engine/highlightReasons.js";import{attributeStoreInitialSize as r,AttributeDataType as n}from"../../../engine/webgl/definitions.js";import{getDisplayIdTexel as a}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as o}from"../../../engine/webgl/Utils.js";import{nanMagicNumber as l}from"../../../engine/webgl/shaderGraph/techniques/shaders/constants.js";import{createDebugLogger as h,DEBUG_ATTR_UPDATES as c}from"../../../engine/webgl/util/debug.js";import{DisplayIdGenerator as d}from"./DisplayIdGenerator.js";import u from"./FeatureFilter.js";import{PixelType as p}from"../../../../webgl/enums.js";function g(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}const _=()=>e.getLogger("esri.views.layers.2d.features.support.AttributeStore"),f=h(c,_()),y={sharedArrayBuffer:has("esri-shared-array-buffer"),atomics:has("esri-atomics")};class m{constructor(t,e,i){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:s,layout:r,textureOnly:n}=e;this.textureOnly=n||!1,this.pixelType=s,this.layout=r,this._resetRange(),this.size=t,this.isLocal=i,n||(this.data=this._initData(s,t))}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=this.data;for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=this.data;for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){this.data[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){this.data[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=a(t);return this.data[i*this.texelSize+e]}setData(t,e,i){const s=a(t),r=1<<e;0!=(this.layout&r)?null!=this.data&&(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):_().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),i=this.data;e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!this.isLocal,r=this.pixelType,n=this.layout,a=this.data;return{start:t,end:e,data:s&&a.slice(t*i,(e+1)*i)||null,pixelType:r,layout:n}}_initData(t,e){const i=ArrayBuffer,s=o(t),r=new s(new i(e*e*4*s.BYTES_PER_ELEMENT));for(let n=0;n<r.length;n+=4)r[n+1]=255;return r}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class b{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=r,this._idsToHighlight=new Map,this._referencesScale=!1,this._referencesGeometry=!1,this._initialized=!1,this.version=0,this._idGenerator=new d,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=p.FLOAT;f(`Creating AttributeStore ${y.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:p.UNSIGNED_BYTE,layout:1},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:p.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}get referencesScale(){return this._referencesScale}get referencesGeometry(){return this._referencesGeometry}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}async update(t,e,s,r,n=0){const a=i(this._schema,t);if(this.version=n,a&&(has("esri-2d-update-debug")&&console.debug(`Version[${n}] AttributeStore.update`,{changed:a}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map((t=>t?u.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:r??s.spatialReference,filterJSON:t}):null)))),"subtype"!==t.type)this._attributeComputeInfo={isSubtype:!1,map:new Map},await Promise.all(t.bindings.map((async t=>{const i=await this._bind(e,t);this._referencesGeometry=this._referencesGeometry||(i?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(i?.referencesScale()??!1)})));else{this._attributeComputeInfo={isSubtype:!0,subtypeField:t.subtypeField,map:new Map},this._referencesScale=!1,this._referencesGeometry=!1;for(const i in t.bindings){const s=t.bindings[i];await Promise.all(s.map((async t=>{const s=await this._bind(e,t,parseInt(i,10));this._referencesGeometry=this._referencesGeometry||(s?.referencesGeometry()??!1),this._referencesScale=this._referencesScale||(s?.referencesScale()??!1)})))}}}setHighlight(t,e){const i=this._getBlock(0);i.unsetComponentAllTexels(0,(1<<s.length)-1);for(const{displayId:s,highlightFlags:r}of t){if(null==s)continue;const t=a(s);i.setComponent(0,r,[t])}this._idsToHighlight.clear();for(const{objectId:s,highlightFlags:r}of t)this._idsToHighlight.set(s,r);for(const{objectId:s,highlightFlags:r}of e)this._idsToHighlight.set(s,r)}setData(t,e,i,s){const r=a(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlags(t){return this._idsToHighlight.get(t)||0}unsetAttributeData(t){const e=a(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e,i){const s=a(t);this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(e));const r=this._attributeComputeInfo,o=1,h=4;let c=null;r&&(c=r.isSubtype?r.map.get(e.readAttribute(r.subtypeField)):r.map,c?.size&&c.forEach(((t,r)=>{const a=r*o%h,c=Math.floor(r*o/h),d=this._getBlock(c+n.VV);let u=t.field?.read(e,i);t.valueRepresentation&&(u=g(u,t.valueRepresentation));(null===u||isNaN(u)||u===1/0||u===-1/0)&&(u=l),d.setData(s,a,u)})))}get epoch(){return this._epoch}async sendUpdates(){const t=this._blocks.map((t=>null!=t?t.toMessage():null)),e=this._getInitArgs();has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.start"),await this._client.update({initArgs:e,blockData:t,version:this.version,sendUpdateEpoch:this._epoch},this._signal),this._epoch+=1,has("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.end")}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}async _bind(t,e,i){const s=await t.createComputedField(e),{valueRepresentation:r}=e,n=this._attributeComputeInfo;if(n.isSubtype){const t=n.map.get(i)??new Map;t.set(e.binding,{field:s,valueRepresentation:r}),n.map.set(i,t)}else n.map.set(e.binding,{field:s,valueRepresentation:r});return s}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(n.Animation),this._getBlock(n.GPGPU),{blockSize:this._size,blockDescriptors:this._blocks.map((t=>null!=t?{textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType}:null))})}_getBlock(t){const e=this._blocks[t];if(null!=e)return e;f(`Initializing AttributeBlock at index ${t}`);const i=new m(this._size,this._blockDescriptors[t],this._client.isLocal);return this._blocks[t]=i,this._initialized=!1,i}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const t=this._size<<=1;f("Expanding block size to",t,this._blocks);for(const e of this._blocks)e?.expand(t);return this._initialized=!1,this._size=t,0}return _().error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}isVisible(t){return!!(this._getBlock(0).getData(t,0)&1<<s.length)}getFilterFlags(t){let e=0;for(let s=0;s<this._filters.length;s++){const i=!!(1<<s),r=this._filters[s];e|=(!i||null==r||r.check(t)?1:0)<<s}let i=0;if(this._idsToHighlight.size){const e=t.getObjectId();i=this.getHighlightFlags(e)}return e<<s.length|i}}export{b as AttributeStore,g as getVisualVariableSizeValueRepresentationRatio};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../geometry/SpatialReference.js";import t from"../../../../../layers/support/FieldsIndex.js";class i{constructor(i){this._options=i,this._fieldsIndex="fieldsIndex"in i?t.fromJSON(i.fieldsIndex):new t(i.fields),i.spatialReference&&(this._spatialReference=e.fromJSON(i.spatialReference)),this._arcadeSchema={fields:this.fieldsIndex.fields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,objectIdField:this.objectIdField,globalIdField:this._options.globalIdField,spatialReference:this._spatialReference,timeInfo:this._options.timeInfo,typeIdField:this._options.typeIdField??void 0,types:this._options.types??void 0,subtypeField:this._options.subtypeField,subtypes:this._options.subtypes??void 0}}get fieldsIndex(){return this._fieldsIndex}get geometryType(){return this._options.geometryType}get timeInfo(){return this._options.timeInfo}get objectIdField(){return this._options.objectIdField}get globalIdField(){return this._options.globalIdField}get arcadeSchema(){return this._arcadeSchema}get spatialReference(){return this._spatialReference}get timeReferenceUnknownClient(){return this._options.timeReferenceUnknownClient}}class s extends i{static create(e){return new s({fields:[],objectIdField:"uid",geometryType:null,spatialReference:e,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:null,typeIdField:null,types:null,timeReferenceUnknownClient:null})}}export{i as FeatureMetadata,s as GraphicsMetadata};
5
+ import e from"../../../../../geometry/SpatialReference.js";import t from"../../../../../layers/support/FieldsIndex.js";class i{constructor(i){this._options=i,this._fieldsIndex="fieldsIndex"in i?t.fromJSON(i.fieldsIndex):new t(i.fields),i.spatialReference&&(this._spatialReference=e.fromJSON(i.spatialReference)),this._arcadeSchema={fields:this.fieldsIndex.fields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,objectIdField:this.objectIdField,globalIdField:this._options.globalIdField,spatialReference:this._spatialReference,timeInfo:this._options.timeInfo,typeIdField:this._options.typeIdField??void 0,types:this._options.types??void 0,subtypeField:this._options.subtypeField,subtypes:this._options.subtypes??void 0}}createArcadeEvalOptions(e){return{$view:{scale:e.scale,timeZone:this._options.timeZone}}}get fieldsIndex(){return this._fieldsIndex}get geometryType(){return this._options.geometryType}get timeInfo(){return this._options.timeInfo}get timeZone(){return this._options.timeZone}get objectIdField(){return this._options.objectIdField}get globalIdField(){return this._options.globalIdField}get arcadeSchema(){return this._arcadeSchema}get spatialReference(){return this._spatialReference}get timeReferenceUnknownClient(){return this._options.timeReferenceUnknownClient}}class s extends i{static create(e){return new s({fields:[],objectIdField:"uid",geometryType:null,spatialReference:e,globalIdField:null,subtypeField:null,subtypes:null,timeInfo:null,typeIdField:null,types:null,timeReferenceUnknownClient:null,timeZone:null})}}export{i as FeatureMetadata,s as GraphicsMetadata};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{ringsCentroid as t,polygonCentroid as e}from"../../../../../geometry/support/centroid.js";import{getJsonType as r}from"../../../../../geometry/support/jsonUtils.js";import{convertFromGeometry as s,quantizeOptimizedGeometry as i}from"../../../../../layers/graphics/featureConversionUtils.js";import o from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as n}from"../../../engine/webgl/definitions.js";import{FeatureSetReader as h}from"./FeatureSetReader.js";class c extends h{static from(t,e,r){return new c(t,e,r)}constructor(t,e,r){super(r),this._items=t,this._tile=e,this._index=-1,this._cachedGeometry=null;const s=e.lod;s.wrap&&(this._wrappingInfo={worldSizeX:s.worldSize[0]})}get _current(){return this._items[this._index]}getItem(){return this._current}getZOrder(){return this._current.zOrder}getMeshWriters(){return this._current.symbolResource?.symbolInfo.meshWriters??[]}field(t){return this.readAttribute(t)}get geometryType(){const t=r(this._current.geometry);return"esriGeometryPoint"===t?"esriGeometryMultipoint":t}getCursor(){return this.copy()}copy(){const t=new c(this._items,this._tile,this.metadata);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._cachedGeometry=this._cachedGeometry,t._index=this._index}get fields(){throw new Error("Fields reading not supported to graphics.")}get hasFeatures(){return!!this._items.length}get hasNext(){return this._index+1<this._items.length}get exceededTransferLimit(){throw new Error("InternalError: exceededTransferLimit not implemented for graphics.")}get hasZ(){return!1}get hasM(){return!1}getInTransform(){return this._tile.transform}getSize(){return this._items.length}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getObjectId(){return this._items[this._index].objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){throw new Error("InternalError: Setting displayId not supported for graphics.")}setIndex(t){this._index=t}getIndex(){return this._index}next(){for(this._cachedGeometry=null;++this._index<this._items.length&&!this._getExists(););return this._index<this._items.length}readGeometryArea(){throw new Error("InternalError: readGeometryArea not supported for graphics.")}_readGeometry(){if(!this._cachedGeometry){const t=s(this._current.projectedGeometry,this.hasZ,this.hasM);if(this._cachedGeometry=i(new o,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform),!this._cachedGeometry)return null;this._wrapGeometry(this._cachedGeometry)}return this._cachedGeometry}_wrapGeometry(t){if(!this._wrappingInfo)return;const{worldSizeX:e}=this._wrappingInfo;if(t.isPoint)return 1===e?(t.coords.push(n,0),t.coords.push(2*-n,0),void t.lengths.push(3)):2===e?(t.coords.push(2*n,0),t.coords.push(4*-n,0),void t.lengths.push(3)):void this._wrapVertex(t.coords,0,2,e);if("esriGeometryMultipoint"!==this.geometryType);else{if(1===e){const e=t.coords.slice();e[0]-=512;const r=t.coords.slice();r[0]+=512,t.coords.push(...e,...r);const s=t.lengths[0];return void t.lengths.push(s,s)}this._wrapVertex(t.coords,0,2,e)}}_wrapVertex(t,e,r,s){const i=e*r,o=t[i];o<-n*(s-2)?t[i]=o+n*s:o>n*(s-1)&&(t[i]=o-n*s)}_readX(){const t=this._readGeometry();return null!=t?t.coords[0]:0}_readY(){const t=this._readGeometry();return null!=t?t.coords[1]:0}_readServerCentroid(){switch(this.geometryType){case"esriGeometryPolygon":{const t=e(this._current.projectedGeometry),r=new o([],t);return i(new o,r,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}case"esriGeometryPolyline":{const e=this._current.projectedGeometry,r=t(e.paths,this.hasZ),s=new o([],r);return i(new o,s,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}}return null}_readAttribute(t,e){const r=this._current.attributes[t];if(void 0!==r)return r;const s=t.toLowerCase();for(const i in this._current.attributes)if(i.toLowerCase()===s)return this._current.attributes[i]}_readAttributes(){return this._current.attributes}}export{c as GraphicsReader};
5
+ import{ringsCentroid as t,polygonCentroid as e}from"../../../../../geometry/support/centroid.js";import{getJsonType as r}from"../../../../../geometry/support/jsonUtils.js";import{convertFromGeometry as s,quantizeOptimizedGeometry as i}from"../../../../../layers/graphics/featureConversionUtils.js";import o from"../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as n}from"../../../engine/webgl/definitions.js";import{FeatureSetReader as h}from"./FeatureSetReader.js";class c extends h{static from(t,e,r){return new c(t,e,r)}constructor(t,e,r){super(r),this._items=t,this._tile=e,this._index=-1,this._cachedGeometry=null;const s=e.lod;s.wrap&&(this._wrappingInfo={worldSizeX:s.worldSize[0]})}get _current(){return this._items[this._index]}getItem(){return this._current}getZOrder(){return this._current.zOrder}getMeshWriters(){return this._current.symbolResource?.symbolInfo.meshWriters??[]}hasField(t){return null!=this._current.attributes[t]}field(t){return this.readAttribute(t)}get geometryType(){const t=r(this._current.geometry);return"esriGeometryPoint"===t?"esriGeometryMultipoint":t}getCursor(){return this.copy()}copy(){const t=new c(this._items,this._tile,this.metadata);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._cachedGeometry=this._cachedGeometry,t._index=this._index}get fields(){throw new Error("Fields reading not supported to graphics.")}get hasFeatures(){return!!this._items.length}get hasNext(){return this._index+1<this._items.length}get exceededTransferLimit(){throw new Error("InternalError: exceededTransferLimit not implemented for graphics.")}get hasZ(){return!1}get hasM(){return!1}getInTransform(){return this._tile.transform}getSize(){return this._items.length}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getObjectId(){return this._items[this._index].objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){throw new Error("InternalError: Setting displayId not supported for graphics.")}setIndex(t){this._index=t}getIndex(){return this._index}next(){for(this._cachedGeometry=null;++this._index<this._items.length&&!this._getExists(););return this._index<this._items.length}readGeometryArea(){throw new Error("InternalError: readGeometryArea not supported for graphics.")}_readGeometry(){if(!this._cachedGeometry){const t=s(this._current.projectedGeometry,this.hasZ,this.hasM);if(this._cachedGeometry=i(new o,t,this.hasZ,this.hasM,this.geometryType,this._tile.transform),!this._cachedGeometry)return null;this._wrapGeometry(this._cachedGeometry)}return this._cachedGeometry}_wrapGeometry(t){if(!this._wrappingInfo)return;const{worldSizeX:e}=this._wrappingInfo;if(t.isPoint)return 1===e?(t.coords.push(n,0),t.coords.push(2*-n,0),void t.lengths.push(3)):2===e?(t.coords.push(2*n,0),t.coords.push(4*-n,0),void t.lengths.push(3)):void this._wrapVertex(t.coords,0,2,e);if("esriGeometryMultipoint"!==this.geometryType);else{if(1===e){const e=t.coords.slice();e[0]-=512;const r=t.coords.slice();r[0]+=512,t.coords.push(...e,...r);const s=t.lengths[0];return void t.lengths.push(s,s)}this._wrapVertex(t.coords,0,2,e)}}_wrapVertex(t,e,r,s){const i=e*r,o=t[i];o<-n*(s-2)?t[i]=o+n*s:o>n*(s-1)&&(t[i]=o-n*s)}_readX(){const t=this._readGeometry();return null!=t?t.coords[0]:0}_readY(){const t=this._readGeometry();return null!=t?t.coords[1]:0}_readServerCentroid(){switch(this.geometryType){case"esriGeometryPolygon":{const t=e(this._current.projectedGeometry),r=new o([],t);return i(new o,r,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}case"esriGeometryPolyline":{const e=this._current.projectedGeometry,r=t(e.paths,this.hasZ),s=new o([],r);return i(new o,s,this.hasZ,this.hasM,this.geometryType,this._tile.transform)}}return null}_readAttribute(t,e){const r=this._current.attributes[t];if(void 0!==r)return r;const s=t.toLowerCase();for(const i in this._current.attributes)if(i.toLowerCase()===s)return this._current.attributes[i]}_readAttributes(){return this._current.attributes}}export{c as GraphicsReader};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/ArrayPool.js";import e from"../../../../../geometry/Extent.js";import{create as i}from"../../../../../geometry/support/aaBoundingRect.js";import s from"../../../../../rest/support/QuantizationParameters.js";import o from"../../../tiling/TileKey.js";class n{constructor(t,e){this.key=new o(0,0,0,0),this.bounds=i(),this.objectIds=new Set,this.key.set(e);const s=t.getLODInfoAt(this.key);this.tileInfoView=t,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.scale=s.scale,this.level=s.level}get lod(){return this.tileInfoView.getLODInfoAt(this.key)}get id(){return this.key.id}get extent(){return e.fromBounds(this.bounds,this.tileInfoView.tileInfo.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}get arcadeEvaluationOptions(){return{$view:{scale:this.scale}}}createChildTiles(){const e=this.key.getChildKeys(),i=t.acquire();for(let t=0;t<e.length;t++)i[t]=new n(this.tileInfoView,e[t]);return i}getQuantizationParameters(){return s.fromJSON({mode:"view",originPosition:"upperLeft",tolerance:this.resolution,extent:{xmin:this.bounds[0],ymin:this.bounds[1],xmax:this.bounds[2],ymax:this.bounds[3],spatialReference:this.tileInfoView.tileInfo.spatialReference}})}}export{n as Tile};
5
+ import t from"../../../../../core/ArrayPool.js";import e from"../../../../../geometry/Extent.js";import{create as i}from"../../../../../geometry/support/aaBoundingRect.js";import s from"../../../../../rest/support/QuantizationParameters.js";import o from"../../../tiling/TileKey.js";class n{constructor(t,e){this.key=new o(0,0,0,0),this.bounds=i(),this.objectIds=new Set,this.key.set(e);const s=t.getLODInfoAt(this.key);this.tileInfoView=t,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.scale=s.scale,this.level=s.level}get lod(){return this.tileInfoView.getLODInfoAt(this.key)}get id(){return this.key.id}get extent(){return e.fromBounds(this.bounds,this.tileInfoView.tileInfo.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}createChildTiles(){const e=this.key.getChildKeys(),i=t.acquire();for(let t=0;t<e.length;t++)i[t]=new n(this.tileInfoView,e[t]);return i}getQuantizationParameters(){return s.fromJSON({mode:"view",originPosition:"upperLeft",tolerance:this.resolution,extent:{xmin:this.bounds[0],ymin:this.bounds[1],xmax:this.bounds[2],ymax:this.bounds[3],spatialReference:this.tileInfoView.tileInfo.spatialReference}})}}export{n as Tile};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{IdentifiableMixin as s}from"../../../../core/Identifiable.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../geometry/support/aaBoundingRect.js";import{isPolyline as l,isPolygon as u,isExtent as p,getJsonType as m}from"../../../../geometry/support/jsonUtils.js";import g from"../../../../layers/support/FieldsIndex.js";import{symbolToCIM as f,CIMSymbolHelper as y}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as _}from"../../../../symbols/cim/OverrideHelper.js";import{errorPolylineSymbol2D as b,errorPolygonSymbol2D as w,errorPointSymbol2D as S}from"../../../../symbols/support/defaults.js";import{filterFlag0 as I}from"../../engine/webgl/definitions.js";import{FeatureTile as v}from"../../engine/webgl/FeatureTile.js";import{MeshData as T}from"../../engine/webgl/mesh/MeshData.js";import{ResourceProxy as R}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{createGraphicSymbolMeshSchemas as M}from"../../engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js";import{createMeshWriter as j}from"../../engine/webgl/shaderGraph/techniques/mesh/createMeshWriter.js";import{castStrictInstanceId as x}from"../../engine/webgl/shaderGraph/techniques/mesh/instanceIdUtils.js";import{createStorageSchema as U}from"../features/schema/processor/StorageSchema.js";import{AttributeStore as C}from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as q}from"../features/support/ComputedAttributeStorage.js";import{GraphicsMetadata as G}from"../features/support/FeatureMetadata.js";import{GraphicsReader as k}from"../features/support/GraphicsReader.js";import P from"./GraphicStore.js";import O from"../support/FeatureCommandQueue.js";import{UpdateTracking2D as F}from"../support/UpdateTracking2D.js";class V{static getOrCreate(e,t,r){let s=t.get(e.id);return s||(s=new V(e,r),t.set(e.id,s)),s}static fromItems(e,t,r){const s=new V(e,r);return s.addedOrModified.push(...t),s}constructor(e,t){this.tile=e,this.metadata=t,this.addedOrModified=[],this.removed=[]}get reader(){return this._reader||(this._reader=k.from(this.addedOrModified,this.tile,this.metadata)),this._reader}}let $=class extends(s(t)){constructor(e){super(e),this._attached=!1,this._tiles=new Map,this._controller=new AbortController,this._hashToSymbolInfo=new Map,this._lastCleanup=performance.now(),this._cleanupRequired=!0,this.lastUpdateId=-1,this.renderer=null,this._updateTracking=new F({debugName:"GraphicsView2D"}),this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this._commandQueue=new O({process:e=>{switch(e.type){case"processed-edit":throw new Error("InternalError: Unsupported command");case"update":return this._update()}}}),this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this.container.destroy(),this.view=null,this.renderer=null,this._set("graphics",null),this._controller.abort(),this._graphicStore.clear(),this._attributeStore=null,this._hashToSymbolInfo.clear(),this._updateTracking.destroy(),this._commandQueue.destroy()}_initAttributeStore(){this._storage=new q({spatialReference:this.view.spatialReference,fields:new g}),this._attributeStore=new C({isLocal:!0,update:async e=>{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateStart`,{message:e});const t=this.container.attributeView.requestUpdate(e);this.container.requestRender(),await t,has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateEnd`,{message:e})}});const e=U(null,[]);this._attributeStore.update(e,this._storage,null),this.container.checkHighlight=()=>this._attributeStore.hasHighlight}initialize(){this._initAttributeStore(),this._metadata=G.create(this.view.spatialReference),this._resourceProxy=new R({fetch:e=>Promise.all(e.map((e=>this.view.stage.textureManager.rasterizeItem(e)))),fetchDictionary:e=>{throw new Error("InternalError: Graphics do not support Dictionary requests")}}),this.addHandles([n((()=>this._effectiveRenderer),(()=>this.requestUpdate())),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",(()=>{this.addHandles([this.graphics.on("change",(()=>this._pushUpdate()))]),this._graphicStore=new P(this.view.spatialReference,this._cimResourceManager,this.view.featuresTilingScheme,this.view.state.scale,this._attributeStore),this._attached=!0,this.requestUpdate(),this._pushUpdate()}))]),this._updateTracking.addUpdateTracking("CommandQueue",this._commandQueue.updateTracking);const e=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:e,removed:[]})}get _effectiveRenderer(){return"function"==typeof this.renderer?this.renderer():this.renderer}get _cimResourceManager(){return this.view.stage.textureManager.resourceManager}get updating(){const e=!this._attached||this._updateTracking.updating;return has("esri-2d-log-updating")&&console.log(`Updating GraphicsView2D: ${e}\n -> attaching ${!this._attached}\n -> updateTracking ${this._updateTracking.updating}`),e}hitTest(e){if(!this.view||this.view.suspended)return[];const{resolution:t,rotation:s}=this.view.state,i=this._graphicStore.hitTest(e.x,e.y,2,t,s),o=new Set(i),a=this.graphics.items.reduce(((e,t)=>(o.has(t.uid)&&e.set(t.uid,t),e)),new Map);return i.map((e=>a.get(e))).filter(r)}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback()),this.notifyChange("updating")}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}viewChange(){this.requestUpdate()}setHighlight(e){const t=[];for(const{objectId:r,highlightFlags:s}of e){const e=this._graphicStore.getItem(r)?.displayId;t.push({objectId:r,highlightFlags:s,displayId:e})}this._attributeStore.setHighlight(t),this._pushUpdate()}graphicUpdateHandler(e){this._pushUpdate()}update(e){this.updateRequested=!1,this._attached&&this._graphicStore.updateLevel(e.state.resolution)}_pushUpdate(){o(this._commandQueue.push({type:"update"}))}async _update(){try{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView._update start`);const e=await this._graphicStore.update(this.graphics,(e=>this._getSymbolForGraphic(e)),(e=>this._ensureSymbolResource(e)));if(!e.hasAnyUpdate())return void await this._attributeStore.sendUpdates();e.removed.length&&(this._cleanupRequired=!0),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView updateMessage`,e);const t=this._createTileMessages(e);await this._fetchResources(t),this._write(t);for(const r of e.added)this._setFilterState(r);for(const r of e.updated)this._setFilterState(r);has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate`,e),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate.await`,e)}catch(e){}this._cleanupSharedResources()}_createTileMessages(e){const t=new Map;for(const r of e.added){const e=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const s of e){V.getOrCreate(s,t,this._metadata).addedOrModified.push(r)}}for(const r of e.updated){const e=this.view.graphicsTileStore.getIntersectingTiles(r.prevBounds),s=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const i of e){V.getOrCreate(i,t,this._metadata).removed.push(r.displayId)}for(const i of s){V.getOrCreate(i,t,this._metadata).addedOrModified.push(r)}}for(const r of e.removed){const e=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const s of e){V.getOrCreate(s,t,this._metadata).removed.push(r.displayId)}}return Array.from(t.values())}async _fetchResources(e){for(const{tile:t,reader:r}of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.id}] GraphicsView fetchResources`,e);const s=r.getCursor();for(;s.next();)for(const e of s.getMeshWriters())e.enqueueRequest(this._resourceProxy,s,t.arcadeEvaluationOptions)}await this._resourceProxy.fetchEnqueuedResources()}_write(e){for(const t of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView write`,t);const e=this._writeMeshes(t);let r=this._tiles.get(t.tile.key);r||(r=this._createFeatureTile(t.tile.key)),has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView onTileData`,t),this.container.onTileData(r,{type:"update",modify:e,remove:t.removed,end:!1,attributeEpoch:this._attributeStore.epoch}),this.container.requestRender()}}_writeMeshes(e){const t=new T(e.tile.id),r=e.reader.getCursor();for(;r.next();){t.entityStart(r.getDisplayId(),r.getZOrder());for(const s of r.getMeshWriters())s.write(t,this._resourceProxy,r,e.tile.arcadeEvaluationOptions,e.tile.level);t.entityEnd()}return{...t.serialize().message,tileId:e.tile.id}}_setFilterState(e){const t=e.displayId,r=this._attributeStore.getHighlightFlags(e.objectId);this._attributeStore.setData(t,0,0,r|(e.visible?I:0))}_getSymbolForGraphic(e){return null!=e.symbol?e.symbol:null!=this._effectiveRenderer?this._effectiveRenderer.getSymbol(e):this._getNullSymbol(e)}async _ensureSymbolResource(e){if(!e.symbol)return;const t=await this._getSymbolInfo(e.symbol);if(!t)return;const r=t.linearCIM.filter((e=>"text"===e.type));if(r.length>0){const s=await this._getTextResources(e,r);e.symbolResource={symbolInfo:t,textInfo:s}}else e.symbolResource={symbolInfo:t}}_getSymbolInfo(e){const t=e.hash();return this._hashToSymbolInfo.has(t)||this._hashToSymbolInfo.set(t,this._createSymbolInfo(t,e).catch((e=>null))),this._hashToSymbolInfo.get(t)}async _createSymbolInfo(e,t){const r=await this._convertToCIMSymbol(t),s=await this._createLinearCIM(r);if("text"===t.type)for(const i of s)"text"===i.type&&(i.lineWidth=t.lineWidth);return{hash:e,cimSymbol:r,linearCIM:s,meshWriters:await this._createMeshWriters(r,s)}}async _convertToCIMSymbol(e){const t=f(e);if("web-style"===t.type){return(await t.fetchCIMSymbol()).data}return t}async _createLinearCIM(e){return await Promise.all(y.fetchResources(e.symbol,this._cimResourceManager,[])),this.view.stage.cimAnalyzer.analyzeSymbolReference(e,!1)}async _createMeshWriters(e,t){a(this._controller.signal);const r=this.container.instanceStore,s=await M(e,t,r);return Promise.all(s.map((e=>j(this._storage,this._resourceProxy,e.meshWriterName,x(e.id),e.options,{tileInfo:this.view.featuresTilingScheme.tileInfo},e.optionalAttributes))))}_onTileUpdate(e){if(e.added&&e.added.length>0)for(const t of e.added)this._updateTracking.addPromise(this._addTile(t));if(e.removed&&e.removed.length>0)for(const t of e.removed)this._removeTile(t.key)}_createFeatureTile(e){const t=this.view.featuresTilingScheme.getTileBounds(c(),e),r=this.view.featuresTilingScheme.getTileResolution(e.level),s=new v(e,r,t[0],t[3]);return this._tiles.set(e,s),this.container.addChild(s),s}async _addTile(e){if(!this._attached)return;const t=this._graphicStore.queryItems(e);if(!t.length)return;const r=this._createFeatureTile(e.key),s=V.fromItems(e,t,this._metadata);await this._fetchResources([s]);const i=this._writeMeshes(s);r.onMessage({type:"append",append:i,clear:!1,end:!0,attributeEpoch:this._attributeStore.epoch})}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_getNullSymbol(e){const t=e.geometry;return l(t)?b:u(t)||p(t)?w:this.defaultPointSymbolEnabled?S:null}async _getTextResources(e,t){const r=new Array,s=new Array;for(let i=0;i<t.length;i++){const o=t[i],{resource:a,overrides:n}=o.textRasterizationParam;if(n?.length>0){const t=_.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:n,symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:a.symbol.height,anchorPointUnits:"Relative",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:a.symbol,textString:a.textString}],scaleSymbolsProportionally:!0,respectFrame:!0}]}},e,this.view.spatialReference,null,m(e.projectedGeometry),null,null);t.then((e=>{const t=e.symbolLayers[0],{textString:r}=t.markerGraphics[0];s.push({type:"cim-rasterization-info",resource:{type:"text",textString:r||"",font:a.font}}),o.text=a.textString=r||""})),r.push(t)}else s.push({type:"cim-rasterization-info",resource:a})}r.length>0&&await Promise.all(r);const o=s.map((e=>this.view.stage.textureManager.rasterizeItem(e))),a=await Promise.all(o);i(a);const n=new Map;for(let i=0;i<t.length;i++){const e=t[i];n.set(e.textRasterizationParam.resource.symbol,{text:e.text,glyphMosaicItems:a[i]})}return n}_cleanupSharedResources(){if(!this._cleanupRequired)return;const e=performance.now();if(e-this._lastCleanup<5e3)return;this._cleanupRequired=!1,this._lastCleanup=e;const t=new Set;for(const s of this._graphicStore.items()){const e=s.symbolResource?.symbolInfo.hash;t.add(e)}const r=new Set(this._hashToSymbolInfo.keys());for(const s of r.values())t.has(s)||this._hashToSymbolInfo.delete(s)}};e([h()],$.prototype,"_effectiveRenderer",null),e([h({constructOnly:!0})],$.prototype,"layerId",void 0),e([h({constructOnly:!0})],$.prototype,"requestUpdateCallback",void 0),e([h()],$.prototype,"container",void 0),e([h({constructOnly:!0})],$.prototype,"graphics",void 0),e([h()],$.prototype,"renderer",void 0),e([h()],$.prototype,"_updateTracking",void 0),e([h()],$.prototype,"updating",null),e([h()],$.prototype,"view",void 0),e([h()],$.prototype,"updateRequested",void 0),e([h()],$.prototype,"defaultPointSymbolEnabled",void 0),$=e([d("esri.views.2d.layers.support.GraphicsView2D")],$);const A=$;export{A as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import has from"../../../../core/has.js";import{IdentifiableMixin as s}from"../../../../core/Identifiable.js";import{assertIsSome as i}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../geometry/support/aaBoundingRect.js";import{isPolyline as l,isPolygon as p,isExtent as u,getJsonType as m}from"../../../../geometry/support/jsonUtils.js";import g from"../../../../layers/support/FieldsIndex.js";import{symbolToCIM as f,CIMSymbolHelper as y}from"../../../../symbols/cim/CIMSymbolHelper.js";import{OverrideHelper as _}from"../../../../symbols/cim/OverrideHelper.js";import{errorPolylineSymbol2D as b,errorPolygonSymbol2D as w,errorPointSymbol2D as S}from"../../../../symbols/support/defaults.js";import{filterFlag0 as I}from"../../engine/webgl/definitions.js";import{FeatureTile as v}from"../../engine/webgl/FeatureTile.js";import{MeshData as T}from"../../engine/webgl/mesh/MeshData.js";import{ResourceProxy as R}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{createGraphicSymbolMeshSchemas as M}from"../../engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js";import{createMeshWriter as j}from"../../engine/webgl/shaderGraph/techniques/mesh/createMeshWriter.js";import{castStrictInstanceId as x}from"../../engine/webgl/shaderGraph/techniques/mesh/instanceIdUtils.js";import{createStorageSchema as U}from"../features/schema/processor/StorageSchema.js";import{AttributeStore as C}from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as q}from"../features/support/ComputedAttributeStorage.js";import{GraphicsMetadata as G}from"../features/support/FeatureMetadata.js";import{GraphicsReader as k}from"../features/support/GraphicsReader.js";import P from"./GraphicStore.js";import O from"../support/FeatureCommandQueue.js";import{UpdateTracking2D as A}from"../support/UpdateTracking2D.js";class F{static getOrCreate(e,t,r){let s=t.get(e.id);return s||(s=new F(e,r),t.set(e.id,s)),s}static fromItems(e,t,r){const s=new F(e,r);return s.addedOrModified.push(...t),s}constructor(e,t){this.tile=e,this.metadata=t,this.addedOrModified=[],this.removed=[]}get reader(){return this._reader||(this._reader=k.from(this.addedOrModified,this.tile,this.metadata)),this._reader}}let V=class extends(s(t)){constructor(e){super(e),this._attached=!1,this._tiles=new Map,this._controller=new AbortController,this._hashToSymbolInfo=new Map,this._lastCleanup=performance.now(),this._cleanupRequired=!0,this.lastUpdateId=-1,this.renderer=null,this._updateTracking=new A({debugName:"GraphicsView2D"}),this.updateRequested=!1,this.defaultPointSymbolEnabled=!0,this._commandQueue=new O({process:e=>{switch(e.type){case"processed-edit":throw new Error("InternalError: Unsupported command");case"update":return this._update()}}}),this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this.container.destroy(),this.view=null,this.renderer=null,this._set("graphics",null),this._controller.abort(),this._graphicStore.clear(),this._attributeStore=null,this._hashToSymbolInfo.clear(),this._updateTracking.destroy(),this._commandQueue.destroy()}_initAttributeStore(){this._storage=new q({spatialReference:this.view.spatialReference,fields:new g}),this._attributeStore=new C({isLocal:!0,update:async e=>{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateStart`,{message:e});const t=this.container.attributeView.requestUpdate(e);this.container.requestRender(),await t,has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView2D.AttributeStoreView.updateEnd`,{message:e})}});const e=U(null,[]);this._attributeStore.update(e,this._storage,null),this.container.checkHighlight=()=>this._attributeStore.hasHighlight}initialize(){this._initAttributeStore(),this._metadata=G.create(this.view.spatialReference),this._resourceProxy=new R({fetch:e=>Promise.all(e.map((e=>this.view.stage.textureManager.rasterizeItem(e)))),fetchDictionary:e=>{throw new Error("InternalError: Graphics do not support Dictionary requests")}}),this.addHandles([n((()=>this._effectiveRenderer),(()=>this.requestUpdate())),this.view.graphicsTileStore.on("update",this._onTileUpdate.bind(this)),this.container.on("attach",(()=>{this.addHandles([this.graphics.on("change",(()=>this._pushUpdate()))]),this._graphicStore=new P(this.view.spatialReference,this._cimResourceManager,this.view.featuresTilingScheme,this.view.state.scale,this._attributeStore),this._attached=!0,this.requestUpdate(),this._pushUpdate()}))]),this._updateTracking.addUpdateTracking("CommandQueue",this._commandQueue.updateTracking);const e=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:e,removed:[]})}get _effectiveRenderer(){return"function"==typeof this.renderer?this.renderer():this.renderer}get _cimResourceManager(){return this.view.stage.textureManager.resourceManager}get updating(){const e=!this._attached||this._updateTracking.updating;return has("esri-2d-log-updating")&&console.log(`Updating GraphicsView2D: ${e}\n -> attaching ${!this._attached}\n -> updateTracking ${this._updateTracking.updating}`),e}hitTest(e){if(!this.view||this.view.suspended)return[];const{resolution:t,rotation:s}=this.view.state,i=this._graphicStore.hitTest(e.x,e.y,2,t,s),o=new Set(i),a=this.graphics.items.reduce(((e,t)=>(o.has(t.uid)&&e.set(t.uid,t),e)),new Map);return i.map((e=>a.get(e))).filter(r)}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback()),this.notifyChange("updating")}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}viewChange(){this.requestUpdate()}setHighlight(e){const t=[];for(const{objectId:r,highlightFlags:s}of e){const e=this._graphicStore.getItem(r)?.displayId;t.push({objectId:r,highlightFlags:s,displayId:e})}this._attributeStore.setHighlight(t,e),this._pushUpdate()}graphicUpdateHandler(e){this._pushUpdate()}update(e){this.updateRequested=!1,this._attached&&this._graphicStore.updateLevel(e.state.resolution)}_pushUpdate(){o(this._commandQueue.push({type:"update"}))}async _update(){try{has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView._update start`);const e=await this._graphicStore.update(this.graphics,(e=>this._getSymbolForGraphic(e)),(e=>this._ensureSymbolResource(e)));if(!e.hasAnyUpdate())return void await this._attributeStore.sendUpdates();e.removed.length&&(this._cleanupRequired=!0),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView updateMessage`,e);const t=this._createTileMessages(e);await this._fetchResources(t),this._write(t);for(const r of e.added)this._setFilterState(r);for(const r of e.updated)this._setFilterState(r);has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate`,e),await this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.debug(`[Id: ${this.layerId}] GraphicsView sendUpdate.await`,e)}catch(e){}this._cleanupSharedResources()}_createTileMessages(e){const t=new Map;for(const r of e.added){const e=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const s of e){F.getOrCreate(s,t,this._metadata).addedOrModified.push(r)}}for(const r of e.updated){const e=this.view.graphicsTileStore.getIntersectingTiles(r.prevBounds),s=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const i of e){F.getOrCreate(i,t,this._metadata).removed.push(r.displayId)}for(const i of s){F.getOrCreate(i,t,this._metadata).addedOrModified.push(r)}}for(const r of e.removed){const e=this.view.graphicsTileStore.getIntersectingTiles(r.bounds);for(const s of e){F.getOrCreate(s,t,this._metadata).removed.push(r.displayId)}}return Array.from(t.values())}async _fetchResources(e){for(const{tile:t,reader:r}of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.id}] GraphicsView fetchResources`,e);const s=r.getCursor();for(;s.next();)for(const e of s.getMeshWriters())e.enqueueRequest(this._resourceProxy,s,this._metadata.createArcadeEvalOptions(t))}await this._resourceProxy.fetchEnqueuedResources()}_write(e){for(const t of e){has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView write`,t);const e=this._writeMeshes(t);let r=this._tiles.get(t.tile.key);r||(r=this._createFeatureTile(t.tile.key)),has("esri-2d-update-debug")&&console.debug(`Id[${this.layerId}] Tile[${t.tile.id}] GraphicsView onTileData`,t),this.container.onTileData(r,{type:"update",modify:e,remove:t.removed,end:!1,attributeEpoch:this._attributeStore.epoch}),this.container.requestRender()}}_writeMeshes(e){const t=new T(e.tile.id),r=e.reader.getCursor();for(;r.next();){t.entityStart(r.getDisplayId(),r.getZOrder());for(const s of r.getMeshWriters())s.write(t,this._resourceProxy,r,this._metadata.createArcadeEvalOptions(e.tile),e.tile.level);t.entityEnd()}return{...t.serialize().message,tileId:e.tile.id}}_setFilterState(e){const t=e.displayId,r=this._attributeStore.getHighlightFlags(e.objectId);this._attributeStore.setData(t,0,0,r|(e.visible?I:0))}_getSymbolForGraphic(e){return null!=e.symbol?e.symbol:null!=this._effectiveRenderer?this._effectiveRenderer.getSymbol(e):this._getNullSymbol(e)}async _ensureSymbolResource(e){if(!e.symbol)return;const t=await this._getSymbolInfo(e.symbol);if(!t)return;const r=t.linearCIM.filter((e=>"text"===e.type));if(r.length>0){const s=await this._getTextResources(e,r);e.symbolResource={symbolInfo:t,textInfo:s}}else e.symbolResource={symbolInfo:t}}_getSymbolInfo(e){const t=e.hash();return this._hashToSymbolInfo.has(t)||this._hashToSymbolInfo.set(t,this._createSymbolInfo(t,e).catch((e=>null))),this._hashToSymbolInfo.get(t)}async _createSymbolInfo(e,t){const r=await this._convertToCIMSymbol(t),s=await this._createLinearCIM(r);if("text"===t.type)for(const i of s)"text"===i.type&&(i.lineWidth=t.lineWidth);return{hash:e,cimSymbol:r,linearCIM:s,meshWriters:await this._createMeshWriters(r,s)}}async _convertToCIMSymbol(e){const t=f(e);if("web-style"===t.type){return(await t.fetchCIMSymbol()).data}return t}async _createLinearCIM(e){return await Promise.all(y.fetchResources(e.symbol,this._cimResourceManager,[])),this.view.stage.cimAnalyzer.analyzeSymbolReference(e,!1)}async _createMeshWriters(e,t){a(this._controller.signal);const r=this.container.instanceStore,s=await M(e,t,r);return Promise.all(s.map((e=>j(this._storage,this._resourceProxy,e.meshWriterName,x(e.id),e.options,{tileInfo:this.view.featuresTilingScheme.tileInfo},e.optionalAttributes))))}_onTileUpdate(e){if(e.added&&e.added.length>0)for(const t of e.added)this._updateTracking.addPromise(this._addTile(t));if(e.removed&&e.removed.length>0)for(const t of e.removed)this._removeTile(t.key)}_createFeatureTile(e){const t=this.view.featuresTilingScheme.getTileBounds(c(),e),r=this.view.featuresTilingScheme.getTileResolution(e.level),s=new v(e,r,t[0],t[3]);return this._tiles.set(e,s),this.container.addChild(s),s}async _addTile(e){if(!this._attached)return;const t=this._graphicStore.queryItems(e);if(!t.length)return;const r=this._createFeatureTile(e.key),s=F.fromItems(e,t,this._metadata);await this._fetchResources([s]);const i=this._writeMeshes(s);r.onMessage({type:"append",append:i,clear:!1,end:!0,attributeEpoch:this._attributeStore.epoch})}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_getNullSymbol(e){const t=e.geometry;return l(t)?b:p(t)||u(t)?w:this.defaultPointSymbolEnabled?S:null}async _getTextResources(e,t){const r=new Array,s=new Array;for(let i=0;i<t.length;i++){const o=t[i],{resource:a,overrides:n}=o.textRasterizationParam;if(n?.length>0){const t=_.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:n,symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:a.symbol.height,anchorPointUnits:"Relative",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:a.symbol,textString:a.textString}],scaleSymbolsProportionally:!0,respectFrame:!0}]}},e,this.view.spatialReference,null,m(e.projectedGeometry),null,null);t.then((e=>{const t=e.symbolLayers[0],{textString:r}=t.markerGraphics[0];s.push({type:"cim-rasterization-info",resource:{type:"text",textString:r||"",font:a.font}}),o.text=a.textString=r||""})),r.push(t)}else s.push({type:"cim-rasterization-info",resource:a})}r.length>0&&await Promise.all(r);const o=s.map((e=>this.view.stage.textureManager.rasterizeItem(e))),a=await Promise.all(o);i(a);const n=new Map;for(let i=0;i<t.length;i++){const e=t[i];n.set(e.textRasterizationParam.resource.symbol,{text:e.text,glyphMosaicItems:a[i]})}return n}_cleanupSharedResources(){if(!this._cleanupRequired)return;const e=performance.now();if(e-this._lastCleanup<5e3)return;this._cleanupRequired=!1,this._lastCleanup=e;const t=new Set;for(const s of this._graphicStore.items()){const e=s.symbolResource?.symbolInfo.hash;t.add(e)}const r=new Set(this._hashToSymbolInfo.keys());for(const s of r.values())t.has(s)||this._hashToSymbolInfo.delete(s)}};e([h()],V.prototype,"_effectiveRenderer",null),e([h({constructOnly:!0})],V.prototype,"layerId",void 0),e([h({constructOnly:!0})],V.prototype,"requestUpdateCallback",void 0),e([h()],V.prototype,"container",void 0),e([h({constructOnly:!0})],V.prototype,"graphics",void 0),e([h()],V.prototype,"renderer",void 0),e([h()],V.prototype,"_updateTracking",void 0),e([h()],V.prototype,"updating",null),e([h()],V.prototype,"view",void 0),e([h()],V.prototype,"updateRequested",void 0),e([h()],V.prototype,"defaultPointSymbolEnabled",void 0),V=e([d("esri.views.2d.layers.support.GraphicsView2D")],V);const $=V;export{$ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/ObjectPool.js";class l{static getId(t,l,e,o){return"object"==typeof t?`${t.level}/${t.row}/${t.col}/${t.world}`:`${t}/${l}/${e}/${o}`}constructor(t,l,e,o){this.set(t,l,e,o)}get key(){return this}get id(){return this.toString()}set id(t){this.set(t)}get hash(){const t=4095&this.row,l=4095&this.col,e=63&this.level;return(3&this.world)<<30|l<<22|t<<8|e}acquire(t,l,e,o){this.set(t,l,e,o)}contains(t){const l=t.level-this.level;return l>=0&&this.row===t.row>>l&&this.col===t.col>>l&&this.world===t.world}containsChild(t){const l=t.level-this.level;return l>0&&this.row===t.row>>l&&this.col===t.col>>l&&this.world===t.world}equals(t){return this.level===t.level&&this.row===t.row&&this.col===t.col&&this.world===t.world}clone(){return new l(this)}release(){this.level=0,this.row=0,this.col=0,this.world=0}set(t,l,e,o){if(null==t)this.level=0,this.row=0,this.col=0,this.world=0;else if("object"==typeof t)this.level=t.level||0,this.row=t.row||0,this.col=t.col||0,this.world=t.world||0;else if("string"==typeof t){const[l,e,o,s]=t.split("/");this.level=parseFloat(l),this.row=parseFloat(e),this.col=parseFloat(o),this.world=parseFloat(s)}else this.level=+t,this.row=+l,this.col=+e,this.world=+o||0;return this}toString(){return`${this.level}/${this.row}/${this.col}/${this.world}`}getParentKey(){return this.level<=0?null:new l(this.level-1,this.row>>1,this.col>>1,this.world)}getNeighborId(t,l){return`${this.level}/${this.row+l}/${this.col+t}/${this.world}`}getChildKeys(){const t=this.level+1,e=this.row<<1,o=this.col<<1,s=this.world;return[new l(t,e,o,s),new l(t,e,o+1,s),new l(t,e+1,o,s),new l(t,e+1,o+1,s)]}compareRowMajor(t){return this.row<t.row?-1:this.row>t.row?1:this.col<t.col?-1:this.col>t.col?1:0}}l.pool=new t(l,null,null,25,50);export{l as default};
5
+ import t from"../../../core/ObjectPool.js";class e{static getId(t,e,l,o){return"object"==typeof t?`${t.level}/${t.row}/${t.col}/${t.world}`:`${t}/${e}/${l}/${o}`}constructor(t,e,l,o){this.set(t,e,l,o)}get key(){return this}get id(){return this.toString()}get normalizedId(){return`${this.level}/${this.row}/${this.col}`}set id(t){this.set(t)}get hash(){const t=4095&this.row,e=4095&this.col,l=63&this.level;return(3&this.world)<<30|e<<22|t<<8|l}acquire(t,e,l,o){this.set(t,e,l,o)}contains(t){const e=t.level-this.level;return e>=0&&this.row===t.row>>e&&this.col===t.col>>e&&this.world===t.world}containsChild(t){const e=t.level-this.level;return e>0&&this.row===t.row>>e&&this.col===t.col>>e&&this.world===t.world}equals(t){return this.level===t.level&&this.row===t.row&&this.col===t.col&&this.world===t.world}clone(){return new e(this)}release(){this.level=0,this.row=0,this.col=0,this.world=0}set(t,e,l,o){if(null==t)this.level=0,this.row=0,this.col=0,this.world=0;else if("object"==typeof t)this.level=t.level||0,this.row=t.row||0,this.col=t.col||0,this.world=t.world||0;else if("string"==typeof t){const[e,l,o,s]=t.split("/");this.level=parseFloat(e),this.row=parseFloat(l),this.col=parseFloat(o),this.world=parseFloat(s)}else this.level=+t,this.row=+e,this.col=+l,this.world=+o||0;return this}toString(){return`${this.level}/${this.row}/${this.col}/${this.world}`}getParentKey(){return this.level<=0?null:new e(this.level-1,this.row>>1,this.col>>1,this.world)}getNeighborId(t,e){return`${this.level}/${this.row+e}/${this.col+t}/${this.world}`}getChildKeys(){const t=this.level+1,l=this.row<<1,o=this.col<<1,s=this.world;return[new e(t,l,o,s),new e(t,l,o+1,s),new e(t,l+1,o,s),new e(t,l+1,o+1,s)]}compareRowMajor(t){return this.row<t.row?-1:this.row>t.row?1:this.col<t.col?-1:this.col>t.col?1:0}}e.pool=new t(e,null,null,25,50);export{e as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
4
  */
5
- import{deg2rad as e}from"../../../../../core/mathUtils.js";import{createLength as t,createArea as s}from"../../../../../core/quantityUtils.js";import{set as i,distance as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as n,c as h,b as a,E as d,f as l,j as g,h as p,g as c,n as m}from"../../../../../chunks/vec32.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as f}from"../../../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as C,canProjectToWGS84ComparableLonLat as S}from"../../../../../geometry/projection.js";import L from"../../../../../geometry/SpatialReference.js";import{getSphericalPCPF as P}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectDirection as j}from"../../../../../geometry/projection/projectDirection.js";import{projectPointToVector as R}from"../../../../../geometry/projection/projectPointToVector.js";import{projectPointToWGS84ComparableLonLat as M}from"../../../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{projectVectorToVector as A}from"../../../../../geometry/projection/projectVectorToVector.js";import{Axis as v}from"../../../../../geometry/support/Axis.js";import{compactIndices as V}from"../../../../../geometry/support/Indices.js";import{segmentIntersects as W}from"../../../../../geometry/support/intersectsBase.js";import{d as I}from"../../../../../chunks/sphere.js";import{areaPoints2d as z}from"../../../../../geometry/support/triangle.js";import{MeasurementMode as w}from"../../interfaces.js";import{segmentLengthGeodesicVector as U,bestFitPlane as G,fitHemisphere as y,triangleAreaGeodesic as T,planePointDistance as x,boundingSphere as b,segmentLengthGeodesic as E,segmentLengthEuclidean as F}from"../../support/measurementUtils.js";import{getElevationAtPoint as N}from"../../../support/ElevationProvider.js";import{midpoint3d as q,makeOrthonormal as D,tangentFrame as k}from"../../../support/mathUtils.js";import{triangulate as B}from"../../../../support/euclideanAreaMeasurementUtils.js";class H{get numVertices(){return this._length}get hasStagedVertex(){return this._hasCursorPoint}constructor(e,t){this.validMeasurement=!1,this.positionsWorldCoords=[],this.positionsRenderCoords=[],this.positionsProjectedWorldCoords=[],this.positionsFittedRenderCoords=[],this.positionsGeographic=[],this.positionsSpherical=[],this.positionsStereographic=[],this.pathSegmentLengths=[],this.geodesicPathSegmentLengths=[],this.perimeterSegmentLengths=[],this.intersectingSegments=new Set,this.geodesicIntersectingSegments=new Set,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.areaCentroidWorldCoords=u(),this.areaCentroidRenderCoords=u(),this.geodesicAreaCentroidRenderCoords=u(),this.area=null,this.geodesicArea=null,this.pathLength=null,this.geodesicPathLength=null,this.perimeterLength=null,this._length=0,this._centroidRenderCoords=u(),this._planeWorldCoords=_(),this._worldUp=u(),this._worldTangent=u(),this._frame=[u(),u(),u()],this._pathVersion=-1,this._hasCursorPoint=!1,this._mode=null,this._tempU=u(),this._tempV=u(),this._tempVec3=u(),this._tempSphere=I(),this._sceneView=e,this.unitNormalizer=t}update(e,t,s,i,o,r){const n=null!=t,h=this._pathVersion===e.version,a=this._hasCursorPoint===n,d=this._mode===o;return!(h&&!r&&a&&d&&e.isValidPolygon)&&(this._pathVersion=e.version,this._hasCursorPoint=n,this._updateCursorSegmentLength(e,t),this._update(e,t,s,i,o),!0)}_update(e,s,i,o,r){const n=this.unitNormalizer,h=this._sceneView.renderSpatialReference,a=this.unitNormalizer.spatialReference;let d=e.numVertices;const l=!(null==s||s.equals(e.lastPoint)||d>2&&s.equals(e.firstPoint));l&&(d+=1);const g=!e.polygonIsClosed&&d>2,p=e.polygonIsClosed||g;this._resize(d);const c=P(i.spatialReference),u=C(i.spatialReference,c)&&S(i.spatialReference),{positionsGeographic:_,positionsWorldCoords:f,positionsRenderCoords:L,positionsSpherical:j}=this,A=(e,t)=>{X(i.elevationProvider,e),R(e,f[t],a),R(e,L[t],h),u&&(M(e,_[t]),R(e,j[t],c),m(j[t],j[t]))};e.forEachVertexPosition(((e,t)=>A(e,t))),l&&A(s,d-1);const v=this._updatePathLengths(p);if(this.pathLength=this._length>1?t(n.normalizeDistance(v),"meters"):null,u){const e=this._updateGeodesicPathLengths(p,a);this.geodesicPathLength=this._length>1?t(e,"meters"):null}else this.geodesicPathLength=null;if(this._updateMode(r),!p)return this.area=null,this.geodesicArea=null,this.perimeterLength=null,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.intersectingSegments.clear(),this.geodesicIntersectingSegments.clear(),void(this.validMeasurement=!1);this._updateAreaAndPerimeterLength(i,n,h,a,o),u&&this._updateGeodesicArea(i),this.validMeasurement=!0}getData(){return{validMeasurement:this.validMeasurement,numVertices:this.numVertices,hasStagedVertex:this.hasStagedVertex,positionsWorldCoords:this.positionsWorldCoords,positionsRenderCoords:this.positionsRenderCoords,positionsProjectedWorldCoords:this.positionsProjectedWorldCoords,positionsFittedRenderCoords:this.positionsFittedRenderCoords,positionsGeographic:this.positionsGeographic,positionsSpherical:this.positionsSpherical,positionsStereographic:this.positionsStereographic,pathSegmentLengths:this.pathSegmentLengths,geodesicPathSegmentLengths:this.geodesicPathSegmentLengths,perimeterSegmentLengths:this.perimeterSegmentLengths,intersectingSegments:this.intersectingSegments,geodesicIntersectingSegments:this.geodesicIntersectingSegments,triangleIndices:this.triangleIndices,geodesicTriangleIndices:this.geodesicTriangleIndices,areaCentroidWorldCoords:this.areaCentroidWorldCoords,areaCentroidRenderCoords:this.areaCentroidRenderCoords,geodesicAreaCentroidRenderCoords:this.geodesicAreaCentroidRenderCoords,fittingMode:this.fittingMode,area:this.area,geodesicArea:this.geodesicArea,pathLength:this.pathLength,geodesicPathLength:this.geodesicPathLength,perimeterLength:this.perimeterLength,unitNormalizer:this.unitNormalizer,actualMeasurementMode:this.actualMeasurementMode}}_resize(e){for(e<this._length&&(this.positionsWorldCoords.length=e,this.positionsRenderCoords.length=e,this.positionsProjectedWorldCoords.length=e,this.positionsFittedRenderCoords.length=e,this.positionsGeographic.length=e,this.positionsSpherical.length=e,this.positionsStereographic.length=e,this.pathSegmentLengths.length=e,this.geodesicPathSegmentLengths.length=e,this.perimeterSegmentLengths.length=e,this._length=e);this._length<e;)this.positionsWorldCoords.push(u()),this.positionsRenderCoords.push(u()),this.positionsProjectedWorldCoords.push(r()),this.positionsFittedRenderCoords.push(u()),this.positionsGeographic.push(u()),this.positionsSpherical.push(u()),this.positionsStereographic.push(r()),this.pathSegmentLengths.push(0),this.geodesicPathSegmentLengths.push(0),this.perimeterSegmentLengths.push(0),++this._length}_updatePathLengths(e){const t=this.positionsWorldCoords,s=this.pathSegmentLengths;let i=0;for(let o=0;o<this._length;++o){const r=s[o]=n(t[o],t[(o+1)%this._length]);(o<this._length-1||e)&&(i+=r)}return i}_updateGeodesicPathLengths(e,t){const s=this.positionsGeographic,i=this.geodesicPathSegmentLengths;let o=0;for(let r=0;r<this._length;++r){const n=i[r]=U(s[r],s[(r+1)%this._length],t??void 0);(r<this._length-1||e)&&(o+=n)}return o}_updateAreaAndPerimeterLength(e,o,r,n,m){const u=e.renderCoordsHelper,_=this.positionsWorldCoords,f=this.positionsRenderCoords,C=this.positionsProjectedWorldCoords,S=this.positionsFittedRenderCoords,L=this._planeWorldCoords,P=this._centroidRenderCoords;q(f,P),u.worldUpAtPosition(P,this._worldUp),u.worldBasisAtPosition(P,v.X,this._worldTangent),j(P,this._worldUp,r,this._worldUp,n),j(P,this._worldTangent,r,this._worldTangent,n),_.length>2&&G(_,L),this.fittingMode=this._selectFittingMode(L,_,this._worldUp,m);let R=0;if("horizontal"===this.fittingMode){let e=-1/0;f.forEach(((t,s)=>{const i=u.getAltitude(f[s]);i>e&&(e=i,R=s)}))}const M=_[R];let V=L,W=this._worldTangent;"horizontal"===this.fittingMode?V=this._worldUp:"vertical"===this.fittingMode&&(V=this._tempVec3,W=this._worldUp,D(L,this._worldUp,V)),h(this._frame[2],V),D(W,V,this._frame[0]),a(this._frame[1],this._frame[0],this._frame[2]),d(this._frame[1],this._frame[1]);const I=this._tempVec3,z=this._tempU,w=this._tempV;for(let t=0;t<this._length;++t){const e=C[t],s=S[t];l(I,_[t],M),i(e,g(this._frame[0],I),g(this._frame[1],I)),p(z,this._frame[0],e[0]),p(w,this._frame[1],e[1]),c(I,z,w),c(I,I,M),A(I,n,s,r)}this.perimeterLength=this._length>0?t(o.normalizeDistance(this._updatePerimeterLengths()),"meters"):null,q(S,this.areaCentroidRenderCoords),A(this.areaCentroidRenderCoords,r,this.areaCentroidWorldCoords,n),this._updateIntersectingSegments(),this.area=0===this.intersectingSegments.size?s(o.normalizeArea(this._computeArea()),"square-meters"):null}_updateGeodesicArea(e){const{renderCoordsHelper:t,spatialReference:o}=e,{positionsSpherical:r,positionsStereographic:n}=this,h=this._tempVec3,a=y(r,h);if(!a)return void(this.geodesicArea=null);const d=this._tempU,l=this._tempV;k(h,d,l);for(let s=0;s<this._length;++s){const e=g(r[s],d),t=g(r[s],l),o=g(r[s],h);i(n[s],e/o,t/o)}p(h,h,f(o).radius),t.toRenderCoords(h,P(o),this.geodesicAreaCentroidRenderCoords),this._updateGeodesicIntersectingSegments(),this.geodesicArea=a&&0===this.geodesicIntersectingSegments.size?s(this._computeGeodesicArea(),"square-meters"):null}_updatePerimeterLengths(){const e=this.positionsProjectedWorldCoords,t=this.perimeterSegmentLengths;let s=0;for(let i=0;i<this._length;++i){s+=t[i]=o(e[i],e[(i+1)%this._length])}return s}_updateIntersectingSegments(){const e=this.positionsProjectedWorldCoords,t=this.intersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],r=e[(s+1)%this._length],n=e[i],h=e[(i+1)%this._length];W(o,r,n,h)&&(t.add(s),t.add(i))}}_computeArea(){const e=this.positionsProjectedWorldCoords,t=this.triangleIndices=V(B(e));let s=0;for(let i=0;i<t.length;i+=3)s+=z(e[t[i]],e[t[i+1]],e[t[i+2]]);return s}_updateGeodesicIntersectingSegments(){const e=this.positionsStereographic,t=this.geodesicIntersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],r=e[(s+1)%this._length],n=e[i],h=e[(i+1)%this._length];W(o,r,n,h)&&(t.add(s),t.add(i))}}_computeGeodesicArea(){const e=this.positionsGeographic,t=this.positionsStereographic,s=this.geodesicTriangleIndices=V(B(t));let i=0;for(let o=0;o<s.length;o+=3)i+=T(e[s[o]],e[s[o+1]],e[s[o+2]],L.WGS84);return i}_selectFittingMode(t,s,i,o){const r=s.map((e=>Math.abs(x(t,e)))).reduce(((e,t)=>Math.max(e,t)),0);b(s,this._tempSphere);const n=r/(2*this._tempSphere[3]),h=n<o.maxRelativeErrorCoplanar,a=n<o.maxRelativeErrorAlmostCoplanar;let d="horizontal";if(h)d="oblique";else if(a){d=Math.abs(g(i,t))>Math.cos(e(o.verticalAngleThreshold))?"horizontal":"vertical"}return d}_updateCursorSegmentLength(e,s){const i=e.lastPoint;e.isValidPolygon||null==i||null==s?(this.geodesicStagedSegmentLength=null,this.stagedSegmentLength=null):(this.geodesicStagedSegmentLength=t(E(i,s),"meters"),this.stagedSegmentLength=t(this.unitNormalizer.normalizeDistance(F(i,s,this.unitNormalizer.spatialReference)),"meters"))}_updateMode(e){if(e===w.Auto){this.actualMeasurementMode="euclidean";let e=0;null!=this.geodesicPathLength&&(e+=this.geodesicPathLength.value),e>Z&&(this.actualMeasurementMode="geodesic")}else this.actualMeasurementMode=e===w.Euclidean?"euclidean":"geodesic";null==this.geodesicPathLength&&(this.actualMeasurementMode="euclidean"),this._mode=e}}function X(e,t){t.hasZ||(t.z=N(e,t,"ground")??0)}const Z=1e5;export{H as MeasurementDataManager};
5
+ import{deg2rad as e}from"../../../../../core/mathUtils.js";import{createLength as t,createArea as s}from"../../../../../core/quantityUtils.js";import{set as i,distance as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{q as n,c as h,b as a,F as d,f as l,k as g,h as p,g as c,n as m}from"../../../../../chunks/vec32.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as f}from"../../../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as C,canProjectToWGS84ComparableLonLat as S}from"../../../../../geometry/projection.js";import L from"../../../../../geometry/SpatialReference.js";import{getSphericalPCPF as P}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectDirection as j}from"../../../../../geometry/projection/projectDirection.js";import{projectPointToVector as R}from"../../../../../geometry/projection/projectPointToVector.js";import{projectPointToWGS84ComparableLonLat as M}from"../../../../../geometry/projection/projectPointToWGS84ComparableLonLat.js";import{projectVectorToVector as A}from"../../../../../geometry/projection/projectVectorToVector.js";import{Axis as v}from"../../../../../geometry/support/Axis.js";import{compactIndices as V}from"../../../../../geometry/support/Indices.js";import{segmentIntersects as W}from"../../../../../geometry/support/intersectsBase.js";import{d as I}from"../../../../../chunks/sphere.js";import{areaPoints2d as z}from"../../../../../geometry/support/triangle.js";import{MeasurementMode as w}from"../../interfaces.js";import{segmentLengthGeodesicVector as U,bestFitPlane as G,fitHemisphere as y,triangleAreaGeodesic as T,planePointDistance as x,boundingSphere as b,segmentLengthGeodesic as F,segmentLengthEuclidean as q}from"../../support/measurementUtils.js";import{getElevationAtPoint as E}from"../../../support/ElevationProvider.js";import{midpoint3d as N,makeOrthonormal as D,tangentFrame as k}from"../../../support/mathUtils.js";import{triangulate as B}from"../../../../support/euclideanAreaMeasurementUtils.js";class H{get numVertices(){return this._length}get hasStagedVertex(){return this._hasCursorPoint}constructor(e,t){this.validMeasurement=!1,this.positionsWorldCoords=[],this.positionsRenderCoords=[],this.positionsProjectedWorldCoords=[],this.positionsFittedRenderCoords=[],this.positionsGeographic=[],this.positionsSpherical=[],this.positionsStereographic=[],this.pathSegmentLengths=[],this.geodesicPathSegmentLengths=[],this.perimeterSegmentLengths=[],this.intersectingSegments=new Set,this.geodesicIntersectingSegments=new Set,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.areaCentroidWorldCoords=u(),this.areaCentroidRenderCoords=u(),this.geodesicAreaCentroidRenderCoords=u(),this.area=null,this.geodesicArea=null,this.pathLength=null,this.geodesicPathLength=null,this.perimeterLength=null,this._length=0,this._centroidRenderCoords=u(),this._planeWorldCoords=_(),this._worldUp=u(),this._worldTangent=u(),this._frame=[u(),u(),u()],this._pathVersion=-1,this._hasCursorPoint=!1,this._mode=null,this._tempU=u(),this._tempV=u(),this._tempVec3=u(),this._tempSphere=I(),this._sceneView=e,this.unitNormalizer=t}update(e,t,s,i,o,r){const n=null!=t,h=this._pathVersion===e.version,a=this._hasCursorPoint===n,d=this._mode===o;return!(h&&!r&&a&&d&&e.isValidPolygon)&&(this._pathVersion=e.version,this._hasCursorPoint=n,this._updateCursorSegmentLength(e,t),this._update(e,t,s,i,o),!0)}_update(e,s,i,o,r){const n=this.unitNormalizer,h=this._sceneView.renderSpatialReference,a=this.unitNormalizer.spatialReference;let d=e.numVertices;const l=!(null==s||s.equals(e.lastPoint)||d>2&&s.equals(e.firstPoint));l&&(d+=1);const g=!e.polygonIsClosed&&d>2,p=e.polygonIsClosed||g;this._resize(d);const c=P(i.spatialReference),u=C(i.spatialReference,c)&&S(i.spatialReference),{positionsGeographic:_,positionsWorldCoords:f,positionsRenderCoords:L,positionsSpherical:j}=this,A=(e,t)=>{X(i.elevationProvider,e),R(e,f[t],a),R(e,L[t],h),u&&(M(e,_[t]),R(e,j[t],c),m(j[t],j[t]))};e.forEachVertexPosition(((e,t)=>A(e,t))),l&&A(s,d-1);const v=this._updatePathLengths(p);if(this.pathLength=this._length>1?t(n.normalizeDistance(v),"meters"):null,u){const e=this._updateGeodesicPathLengths(p,a);this.geodesicPathLength=this._length>1?t(e,"meters"):null}else this.geodesicPathLength=null;if(this._updateMode(r),!p)return this.area=null,this.geodesicArea=null,this.perimeterLength=null,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.intersectingSegments.clear(),this.geodesicIntersectingSegments.clear(),void(this.validMeasurement=!1);this._updateAreaAndPerimeterLength(i,n,h,a,o),u&&this._updateGeodesicArea(i),this.validMeasurement=!0}getData(){return{validMeasurement:this.validMeasurement,numVertices:this.numVertices,hasStagedVertex:this.hasStagedVertex,positionsWorldCoords:this.positionsWorldCoords,positionsRenderCoords:this.positionsRenderCoords,positionsProjectedWorldCoords:this.positionsProjectedWorldCoords,positionsFittedRenderCoords:this.positionsFittedRenderCoords,positionsGeographic:this.positionsGeographic,positionsSpherical:this.positionsSpherical,positionsStereographic:this.positionsStereographic,pathSegmentLengths:this.pathSegmentLengths,geodesicPathSegmentLengths:this.geodesicPathSegmentLengths,perimeterSegmentLengths:this.perimeterSegmentLengths,intersectingSegments:this.intersectingSegments,geodesicIntersectingSegments:this.geodesicIntersectingSegments,triangleIndices:this.triangleIndices,geodesicTriangleIndices:this.geodesicTriangleIndices,areaCentroidWorldCoords:this.areaCentroidWorldCoords,areaCentroidRenderCoords:this.areaCentroidRenderCoords,geodesicAreaCentroidRenderCoords:this.geodesicAreaCentroidRenderCoords,fittingMode:this.fittingMode,area:this.area,geodesicArea:this.geodesicArea,pathLength:this.pathLength,geodesicPathLength:this.geodesicPathLength,perimeterLength:this.perimeterLength,unitNormalizer:this.unitNormalizer,actualMeasurementMode:this.actualMeasurementMode}}_resize(e){for(e<this._length&&(this.positionsWorldCoords.length=e,this.positionsRenderCoords.length=e,this.positionsProjectedWorldCoords.length=e,this.positionsFittedRenderCoords.length=e,this.positionsGeographic.length=e,this.positionsSpherical.length=e,this.positionsStereographic.length=e,this.pathSegmentLengths.length=e,this.geodesicPathSegmentLengths.length=e,this.perimeterSegmentLengths.length=e,this._length=e);this._length<e;)this.positionsWorldCoords.push(u()),this.positionsRenderCoords.push(u()),this.positionsProjectedWorldCoords.push(r()),this.positionsFittedRenderCoords.push(u()),this.positionsGeographic.push(u()),this.positionsSpherical.push(u()),this.positionsStereographic.push(r()),this.pathSegmentLengths.push(0),this.geodesicPathSegmentLengths.push(0),this.perimeterSegmentLengths.push(0),++this._length}_updatePathLengths(e){const t=this.positionsWorldCoords,s=this.pathSegmentLengths;let i=0;for(let o=0;o<this._length;++o){const r=s[o]=n(t[o],t[(o+1)%this._length]);(o<this._length-1||e)&&(i+=r)}return i}_updateGeodesicPathLengths(e,t){const s=this.positionsGeographic,i=this.geodesicPathSegmentLengths;let o=0;for(let r=0;r<this._length;++r){const n=i[r]=U(s[r],s[(r+1)%this._length],t??void 0);(r<this._length-1||e)&&(o+=n)}return o}_updateAreaAndPerimeterLength(e,o,r,n,m){const u=e.renderCoordsHelper,_=this.positionsWorldCoords,f=this.positionsRenderCoords,C=this.positionsProjectedWorldCoords,S=this.positionsFittedRenderCoords,L=this._planeWorldCoords,P=this._centroidRenderCoords;N(f,P),u.worldUpAtPosition(P,this._worldUp),u.worldBasisAtPosition(P,v.X,this._worldTangent),j(P,this._worldUp,r,this._worldUp,n),j(P,this._worldTangent,r,this._worldTangent,n),_.length>2&&G(_,L),this.fittingMode=this._selectFittingMode(L,_,this._worldUp,m);let R=0;if("horizontal"===this.fittingMode){let e=-1/0;f.forEach(((t,s)=>{const i=u.getAltitude(f[s]);i>e&&(e=i,R=s)}))}const M=_[R];let V=L,W=this._worldTangent;"horizontal"===this.fittingMode?V=this._worldUp:"vertical"===this.fittingMode&&(V=this._tempVec3,W=this._worldUp,D(L,this._worldUp,V)),h(this._frame[2],V),D(W,V,this._frame[0]),a(this._frame[1],this._frame[0],this._frame[2]),d(this._frame[1],this._frame[1]);const I=this._tempVec3,z=this._tempU,w=this._tempV;for(let t=0;t<this._length;++t){const e=C[t],s=S[t];l(I,_[t],M),i(e,g(this._frame[0],I),g(this._frame[1],I)),p(z,this._frame[0],e[0]),p(w,this._frame[1],e[1]),c(I,z,w),c(I,I,M),A(I,n,s,r)}this.perimeterLength=this._length>0?t(o.normalizeDistance(this._updatePerimeterLengths()),"meters"):null,N(S,this.areaCentroidRenderCoords),A(this.areaCentroidRenderCoords,r,this.areaCentroidWorldCoords,n),this._updateIntersectingSegments(),this.area=0===this.intersectingSegments.size?s(o.normalizeArea(this._computeArea()),"square-meters"):null}_updateGeodesicArea(e){const{renderCoordsHelper:t,spatialReference:o}=e,{positionsSpherical:r,positionsStereographic:n}=this,h=this._tempVec3,a=y(r,h);if(!a)return void(this.geodesicArea=null);const d=this._tempU,l=this._tempV;k(h,d,l);for(let s=0;s<this._length;++s){const e=g(r[s],d),t=g(r[s],l),o=g(r[s],h);i(n[s],e/o,t/o)}p(h,h,f(o).radius),t.toRenderCoords(h,P(o),this.geodesicAreaCentroidRenderCoords),this._updateGeodesicIntersectingSegments(),this.geodesicArea=a&&0===this.geodesicIntersectingSegments.size?s(this._computeGeodesicArea(),"square-meters"):null}_updatePerimeterLengths(){const e=this.positionsProjectedWorldCoords,t=this.perimeterSegmentLengths;let s=0;for(let i=0;i<this._length;++i){s+=t[i]=o(e[i],e[(i+1)%this._length])}return s}_updateIntersectingSegments(){const e=this.positionsProjectedWorldCoords,t=this.intersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],r=e[(s+1)%this._length],n=e[i],h=e[(i+1)%this._length];W(o,r,n,h)&&(t.add(s),t.add(i))}}_computeArea(){const e=this.positionsProjectedWorldCoords,t=this.triangleIndices=V(B(e));let s=0;for(let i=0;i<t.length;i+=3)s+=z(e[t[i]],e[t[i+1]],e[t[i+2]]);return s}_updateGeodesicIntersectingSegments(){const e=this.positionsStereographic,t=this.geodesicIntersectingSegments;t.clear();for(let s=0;s<this._length;++s)for(let i=s+2;i<this._length;++i){if((i+1)%this._length===s)continue;const o=e[s],r=e[(s+1)%this._length],n=e[i],h=e[(i+1)%this._length];W(o,r,n,h)&&(t.add(s),t.add(i))}}_computeGeodesicArea(){const e=this.positionsGeographic,t=this.positionsStereographic,s=this.geodesicTriangleIndices=V(B(t));let i=0;for(let o=0;o<s.length;o+=3)i+=T(e[s[o]],e[s[o+1]],e[s[o+2]],L.WGS84);return i}_selectFittingMode(t,s,i,o){const r=s.map((e=>Math.abs(x(t,e)))).reduce(((e,t)=>Math.max(e,t)),0);b(s,this._tempSphere);const n=r/(2*this._tempSphere[3]),h=n<o.maxRelativeErrorCoplanar,a=n<o.maxRelativeErrorAlmostCoplanar;let d="horizontal";if(h)d="oblique";else if(a){d=Math.abs(g(i,t))>Math.cos(e(o.verticalAngleThreshold))?"horizontal":"vertical"}return d}_updateCursorSegmentLength(e,s){const i=e.lastPoint;e.isValidPolygon||null==i||null==s?(this.geodesicStagedSegmentLength=null,this.stagedSegmentLength=null):(this.geodesicStagedSegmentLength=t(F(i,s),"meters"),this.stagedSegmentLength=t(this.unitNormalizer.normalizeDistance(q(i,s,this.unitNormalizer.spatialReference)),"meters"))}_updateMode(e){if(e===w.Auto){this.actualMeasurementMode="euclidean";let e=0;null!=this.geodesicPathLength&&(e+=this.geodesicPathLength.value),e>Z&&(this.actualMeasurementMode="geodesic")}else this.actualMeasurementMode=e===w.Euclidean?"euclidean":"geodesic";null==this.geodesicPathLength&&(this.actualMeasurementMode="euclidean"),this._mode=e}}function X(e,t){t.hasZ||(t.z=E(e,t,"ground")??0)}const Z=1e5;export{H as MeasurementDataManager};