@arcgis/core 4.29.0 → 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 (257) 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/{5243f9ff21e768c620c2.js → 23a5d750d93a7829174f.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{47e6119be4a4a5ed640d.js → 2447a4d5886aeb0ff72a.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{7f45a9e9bdbcffc2d6e0.js → 348bcc57b99a975902a8.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{8c9fb2601488998013ba.js → 3523789a2948a4ab8cc8.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{24649b410b757599a549.js → 48db6e0bbb1a9c043193.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{752082be991f1cc8558f.js → 4984e2b79d862114d6a6.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{8d9736fd15cdb54d9855.js → 5227f9eea6988aadad7f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/58723274ef657fe212eb.js +1 -0
  12. package/assets/esri/core/workers/chunks/60ab18c6a04d4b2f1d4c.js +1 -0
  13. package/assets/esri/core/workers/chunks/647515801d94180b8402.js +1 -0
  14. package/assets/esri/core/workers/chunks/6c3ae96ec90e9ed7dd50.js +1 -0
  15. package/assets/esri/core/workers/chunks/7a8bba91769ee18cc39f.js +1 -0
  16. package/assets/esri/core/workers/chunks/7a98d2e026f63a581b1e.js +1 -0
  17. package/assets/esri/core/workers/chunks/8c360923cd1850767d3e.js +1 -0
  18. package/assets/esri/core/workers/chunks/{1a25ba411b89e050fbb7.js → a61f337802ae963d7f65.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{d0c5318d7ef2e923aad0.js → a8ac511280f873960d46.js} +1 -1
  20. package/assets/esri/core/workers/chunks/b125ab84b7761e761734.js +1 -0
  21. package/assets/esri/core/workers/chunks/{b34d6e58b125fe111f91.js → b42a83db83851cb57d44.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{1497dd943df7eede0704.js → b9c55ff1f21db198ce03.js} +1 -1
  23. package/assets/esri/core/workers/chunks/bb3322ddb89c0bd444f0.js +1 -0
  24. package/assets/esri/core/workers/chunks/becfdaeeb07f089d8be7.js +1 -0
  25. package/assets/esri/core/workers/chunks/{b26e39a399963c176d33.js → c527692694688a5b3b07.js} +2 -2
  26. package/assets/esri/core/workers/chunks/{210a93e0b96c5bff44a3.js → c556644bb0cf88770939.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{a5e7b4acae17f88e2208.js → ce93027b6b81428ce9b0.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{b8ece275abac93f3dccf.js → d14f16bfa6c12909929c.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{1594f06a2d7d9439c62e.js → e2147c99cc5839654be1.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{d33ed3a2a0d4b640bd4a.js → e4c7d8c69e4957c9d27c.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{7709248f59520aee6f51.js → eceaa46f622f6fa31128.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{2286db4c83ff1b6fb088.js → ef3e6209e6ac6a56960b.js} +1 -1
  33. package/assets/esri/core/workers/chunks/f59b5ea05caca8a1a398.js +1 -0
  34. package/chunks/Laserlines.glsl.js +3 -3
  35. package/chunks/Precipitation.glsl.js +1 -1
  36. package/chunks/SSAOBlur.glsl.js +2 -2
  37. package/chunks/boundedPlane.js +1 -1
  38. package/chunks/cameraUtilsSpherical.js +1 -1
  39. package/chunks/sphere.js +1 -1
  40. package/chunks/terrainUtilsPlanar.js +1 -1
  41. package/chunks/vec32.js +1 -1
  42. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  43. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  44. package/core/libs/gl-matrix-2/vec3.js +1 -1
  45. package/geometry/support/axisAngleDegrees.js +1 -1
  46. package/geometry/support/coordinateSystem.js +1 -1
  47. package/geometry/support/lineSegment.js +1 -1
  48. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  49. package/geometry/support/meshUtils/georeference.js +1 -1
  50. package/geometry/support/meshUtils/merge.js +1 -1
  51. package/geometry/support/meshUtils/rotate.js +1 -1
  52. package/geometry/support/meshUtils/scale.js +1 -1
  53. package/geometry/support/meshUtils/vertexSpaceConversion.js +5 -0
  54. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  55. package/geometry/support/plane.js +1 -1
  56. package/geometry/support/ray.js +1 -1
  57. package/geometry/support/triangle.js +1 -1
  58. package/geometry/support/vector.js +1 -1
  59. package/interfaces.d.ts +6 -6
  60. package/kernel.js +1 -1
  61. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  62. package/layers/LinkChartLayer.js +1 -1
  63. package/layers/VoxelWasmPerSceneView.js +1 -1
  64. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  65. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  66. package/layers/mixins/FeatureReductionLayer.js +1 -1
  67. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  68. package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
  69. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  70. package/layers/support/layerUtils.js +1 -1
  71. package/layers/video/VideoCameraSensorModel.js +1 -1
  72. package/layers/voxel/VoxelVolume.js +1 -1
  73. package/layers/voxel/voxelPlaneUtils.js +1 -1
  74. package/libs/linkchartlayout/LinkChartLayout.js +1 -1
  75. package/package.json +1 -1
  76. package/support/revision.js +1 -1
  77. package/symbols/cim/cimAnalyzer.js +1 -1
  78. package/views/2d/arcade/callExpressionWithCursor.js +1 -1
  79. package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
  80. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
  81. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  82. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  83. package/views/2d/layers/features/Processor.js +1 -1
  84. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  85. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  86. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  87. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  88. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  89. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  90. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  91. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  92. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  93. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  94. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  95. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  96. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  97. package/views/2d/layers/features/sources/strategies/chunks/DrillDownTileSourceChunk.js +1 -1
  98. package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
  99. package/views/2d/layers/features/sources/strategies/chunks/OverrideChunk.js +1 -1
  100. package/views/2d/layers/features/sources/strategies/chunks/PagedTileSourceChunk.js +1 -1
  101. package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
  102. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  103. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  104. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  105. package/views/2d/layers/features/support/Tile.js +1 -1
  106. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  107. package/views/2d/tiling/TileKey.js +1 -1
  108. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  109. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  110. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  111. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  112. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  113. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  114. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  115. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  116. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  117. package/views/3d/analysis/support/measurementUtils.js +1 -1
  118. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  119. package/views/3d/camera/constraintUtils/common.js +1 -1
  120. package/views/3d/camera/constraintUtils/distance.js +1 -1
  121. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  122. package/views/3d/camera/intersectionUtils.js +1 -1
  123. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  124. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  125. package/views/3d/environment/Fog.js +1 -1
  126. package/views/3d/environment/MarsAtmosphere.js +1 -1
  127. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  128. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  129. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  130. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  131. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  132. package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
  133. package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
  134. package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
  135. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  136. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  137. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  138. package/views/3d/interactive/visualElements/support/Segment.js +1 -1
  139. package/views/3d/layers/I3SMeshView3D.js +1 -1
  140. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  141. package/views/3d/layers/PointCloudWorker.js +1 -1
  142. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  143. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  144. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  145. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  146. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  147. package/views/3d/layers/i3s/LoDUtil.js +1 -1
  148. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  149. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  150. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  151. package/views/3d/layers/support/uvUtils.js +1 -1
  152. package/views/3d/state/Frustum.js +1 -1
  153. package/views/3d/state/NearFarHeuristic.js +1 -1
  154. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  155. package/views/3d/state/controllers/RotateController.js +1 -1
  156. package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
  157. package/views/3d/state/controllers/global/ZoomController.js +1 -1
  158. package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
  159. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  160. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  161. package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
  162. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  163. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  164. package/views/3d/state/utils/navigationUtils.js +1 -1
  165. package/views/3d/state/utils/viewUtils.js +1 -1
  166. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  167. package/views/3d/support/cameraUtils.js +1 -1
  168. package/views/3d/support/cameraUtilsInternal.js +1 -1
  169. package/views/3d/support/intersectionUtils.js +1 -1
  170. package/views/3d/support/mathUtils.js +1 -1
  171. package/views/3d/support/orientedBoundingBox.js +1 -1
  172. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  173. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  174. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  175. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  176. package/views/3d/support/sunUtils.js +1 -1
  177. package/views/3d/support/viewpointUtils.js +1 -1
  178. package/views/3d/terrain/OverlayManager.js +1 -1
  179. package/views/3d/terrain/PatchRenderData.js +1 -1
  180. package/views/3d/terrain/SphericalPatch.js +1 -1
  181. package/views/3d/terrain/TerrainRenderer.js +1 -1
  182. package/views/3d/terrain/Tile.js +1 -1
  183. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  184. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  185. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  186. package/views/3d/webgl-engine/core/util/TwoVectorPosition.js +1 -1
  187. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  188. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  189. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  190. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  191. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  192. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  193. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  194. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  195. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  196. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  197. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  198. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  199. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  200. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  201. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  202. package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
  203. package/views/3d/webgl-engine/lighting/SphericalHarmonics.js +1 -1
  204. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  205. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  206. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  207. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  208. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  209. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  210. package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
  211. package/views/SelectionManager.js +1 -1
  212. package/views/draw/support/createUtils.js +1 -1
  213. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  214. package/views/interactive/GraphicManipulator.js +1 -1
  215. package/views/interactive/SegmentLabels.js +1 -1
  216. package/views/interactive/coordinateHelper.js +1 -1
  217. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  218. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  219. package/views/interactive/sketch/constraints.js +1 -1
  220. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  221. package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
  222. package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
  223. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  224. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  225. package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
  226. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  227. package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
  228. package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
  229. package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
  230. package/views/layers/FeatureLayerView.js +1 -1
  231. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  232. package/views/support/angularMeasurementUtils.js +1 -1
  233. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  234. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  235. package/views/support/geometry3dUtils.js +1 -1
  236. package/widgets/Editor/EditorViewModel.js +1 -1
  237. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  238. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  239. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  240. package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
  241. package/widgets/Features/FeaturesViewModel.js +1 -1
  242. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  243. package/widgets/PanoramicViewer/utils.js +1 -1
  244. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  245. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  246. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  247. package/assets/esri/core/workers/chunks/0e83f3718a0b45652b5e.js +0 -1
  248. package/assets/esri/core/workers/chunks/1fa5c8af69a09a3730b3.js +0 -1
  249. package/assets/esri/core/workers/chunks/4736f79b5c94ce103d43.js +0 -1
  250. package/assets/esri/core/workers/chunks/65f7adaaf1f535310c11.js +0 -1
  251. package/assets/esri/core/workers/chunks/79c041b292648c5eaecc.js +0 -1
  252. package/assets/esri/core/workers/chunks/7c4c2c0beddabac672b6.js +0 -1
  253. package/assets/esri/core/workers/chunks/9307d485a9e5f9fa77d1.js +0 -1
  254. package/assets/esri/core/workers/chunks/9a758de08dfa57735879.js +0 -1
  255. package/assets/esri/core/workers/chunks/a4c3da057ec2a07bbbe8.js +0 -1
  256. package/assets/esri/core/workers/chunks/b252270b100351779f1f.js +0 -1
  257. 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 e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{s as o,f as i,j as a,h as n,g as c,c as l,l as m,p as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as h}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as p}from"../../../../geometry/support/frustum.js";import{create as d,distance2 as g,fromPoints as j,closestLineSegmentPoint as b}from"../../../../geometry/support/lineSegment.js";import{create as S,fromPoints as O,signedDistance as _,getNormal as A}from"../../../../geometry/support/plane.js";import{ShaderOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import x from"../lib/GLMaterial.js";import{Material as y,MaterialParameters as N}from"../lib/Material.js";import{RenderSlot as R}from"../lib/RenderSlot.js";import{isTranslationMatrix as E}from"../lib/Util.js";import{VertexAttribute as M}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as T}from"./DefaultBufferWriter.js";import{PositionColorLayout as v,PositionLayout as w}from"./DefaultLayouts.js";import{NativeLineTechnique as C}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as P}from"../shaders/NativeLineTechniqueConfiguration.js";class V extends y{constructor(e){super(e,new U),this._configuration=new P,this.produces=new Map([[R.OPAQUE_MATERIAL,e=>e===L.Color||e===L.Highlight||e===L.ObjectAndLayerIdColor]])}getConfiguration(e){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration}intersect(t,r,f,h,d,S){if(!f.options.selectionMode||!t.visible)return;if(!E(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const L=t.attributes.get(M.POSITION).data,x=f.camera,y=Z;s(y,f.point);const N=2;o(z[0],y[0]-N,y[1]+N,0),o(z[1],y[0]+N,y[1]+N,0),o(z[2],y[0]+N,y[1]-N,0),o(z[3],y[0]-N,y[1]-N,0);for(let e=0;e<4;e++)if(!x.unprojectFromRenderScreen(z[e],J[e]))return;O(x.eye,J[0],J[1],K),O(x.eye,J[1],J[2],Y),O(x.eye,J[2],J[3],$),O(x.eye,J[3],J[0],ee);let R=Number.MAX_VALUE,T=0;for(let e=0;e<L.length-5;e+=3){if(q[0]=L[e]+r[12],q[1]=L[e+1]+r[13],q[2]=L[e+2]+r[14],B[0]=L[e+3]+r[12],B[1]=L[e+4]+r[13],B[2]=L[e+5]+r[14],_(K,q)<0&&_(K,B)<0||_(Y,q)<0&&_(Y,B)<0||_($,q)<0&&_($,B)<0||_(ee,q)<0&&_(ee,B)<0)continue;if(x.projectToRenderScreen(q,X),x.projectToRenderScreen(B,G),X[2]<0&&G[2]>0){i(D,q,B);const e=x.frustum,t=-_(e[p.NEAR],q)/a(D,A(e[p.NEAR]));n(D,D,t),c(q,q,D),x.projectToRenderScreen(q,X)}else if(X[2]>0&&G[2]<0){i(D,B,q);const e=x.frustum,t=-_(e[p.NEAR],B)/a(D,A(e[p.NEAR]));n(D,D,t),c(B,B,D),x.projectToRenderScreen(B,G)}else if(X[2]<0&&G[2]<0)continue;X[2]=0,G[2]=0;const t=g(j(X,G,H),y);t<R&&(R=t,l(k,q),l(F,B),T=e/3)}const v=f.rayBegin,w=f.rayEnd;if(R<N*N){let e=Number.MAX_VALUE;if(b(j(k,F,H),j(v,w,Q),W)){i(W,W,v);const t=m(W);n(W,W,1/t),e=t/u(v,w)}S(e,W,T,!1)}}intersectDraped(e,r,s,o,i,a){if(!s.options.selectionMode)return;const n=e.attributes.get(M.POSITION).data,c=e.attributes.get(M.SIZE),l=c?c.data[0]:0,m=o[0],u=o[1],f=((l+1)/2+4)*e.screenToWorldRatio;let h=Number.MAX_VALUE,p=0;for(let d=0;d<n.length-5;d+=3){const e=n[d],r=n[d+1],s=m-e,o=u-r,i=n[d+3]-e,a=n[d+4]-r,c=t((i*s+a*o)/(i*i+a*a),0,1),l=i*c-s,f=a*c-o,g=l*l+f*f;g<h&&(h=g,p=d/3)}h<f*f&&i(a.dist,a.normal,p,!1)}createGLMaterial(e){return new I(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?v:w;return new T(e)}}class I extends x{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output===L.Color&&this._updateOccludeeState(e),this.ensureTechnique(C,e)}}class U extends N{constructor(){super(...arguments),this.color=h,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.hasOccludees=!1}}const q=f(),B=f(),D=f(),W=f(),X=r(),G=r(),k=f(),F=f(),H=d(),Q=d(),Z=f(),z=[r(),r(),r(),r()],J=[f(),f(),f(),f()],K=S(),Y=S(),$=S(),ee=S();export{V as NativeLineMaterial,U as Parameters};
5
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{s as o,f as i,k as a,h as n,g as c,c as l,l as m,q as u}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as h}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as p}from"../../../../geometry/support/frustum.js";import{create as d,distance2 as g,fromPoints as j,closestLineSegmentPoint as b}from"../../../../geometry/support/lineSegment.js";import{create as S,fromPoints as O,signedDistance as _,getNormal as A}from"../../../../geometry/support/plane.js";import{ShaderOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import x from"../lib/GLMaterial.js";import{Material as y,MaterialParameters as N}from"../lib/Material.js";import{RenderSlot as R}from"../lib/RenderSlot.js";import{isTranslationMatrix as E}from"../lib/Util.js";import{VertexAttribute as M}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as T}from"./DefaultBufferWriter.js";import{PositionColorLayout as v,PositionLayout as w}from"./DefaultLayouts.js";import{NativeLineTechnique as C}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as P}from"../shaders/NativeLineTechniqueConfiguration.js";class V extends y{constructor(e){super(e,new U),this._configuration=new P,this.produces=new Map([[R.OPAQUE_MATERIAL,e=>e===L.Color||e===L.Highlight||e===L.ObjectAndLayerIdColor]])}getConfiguration(e){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration}intersect(t,r,f,h,d,S){if(!f.options.selectionMode||!t.visible)return;if(!E(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const L=t.attributes.get(M.POSITION).data,x=f.camera,y=Z;s(y,f.point);const N=2;o(z[0],y[0]-N,y[1]+N,0),o(z[1],y[0]+N,y[1]+N,0),o(z[2],y[0]+N,y[1]-N,0),o(z[3],y[0]-N,y[1]-N,0);for(let e=0;e<4;e++)if(!x.unprojectFromRenderScreen(z[e],J[e]))return;O(x.eye,J[0],J[1],K),O(x.eye,J[1],J[2],Y),O(x.eye,J[2],J[3],$),O(x.eye,J[3],J[0],ee);let R=Number.MAX_VALUE,T=0;for(let e=0;e<L.length-5;e+=3){if(q[0]=L[e]+r[12],q[1]=L[e+1]+r[13],q[2]=L[e+2]+r[14],B[0]=L[e+3]+r[12],B[1]=L[e+4]+r[13],B[2]=L[e+5]+r[14],_(K,q)<0&&_(K,B)<0||_(Y,q)<0&&_(Y,B)<0||_($,q)<0&&_($,B)<0||_(ee,q)<0&&_(ee,B)<0)continue;if(x.projectToRenderScreen(q,X),x.projectToRenderScreen(B,k),X[2]<0&&k[2]>0){i(D,q,B);const e=x.frustum,t=-_(e[p.NEAR],q)/a(D,A(e[p.NEAR]));n(D,D,t),c(q,q,D),x.projectToRenderScreen(q,X)}else if(X[2]>0&&k[2]<0){i(D,B,q);const e=x.frustum,t=-_(e[p.NEAR],B)/a(D,A(e[p.NEAR]));n(D,D,t),c(B,B,D),x.projectToRenderScreen(B,k)}else if(X[2]<0&&k[2]<0)continue;X[2]=0,k[2]=0;const t=g(j(X,k,H),y);t<R&&(R=t,l(G,q),l(F,B),T=e/3)}const v=f.rayBegin,w=f.rayEnd;if(R<N*N){let e=Number.MAX_VALUE;if(b(j(G,F,H),j(v,w,Q),W)){i(W,W,v);const t=m(W);n(W,W,1/t),e=t/u(v,w)}S(e,W,T,!1)}}intersectDraped(e,r,s,o,i,a){if(!s.options.selectionMode)return;const n=e.attributes.get(M.POSITION).data,c=e.attributes.get(M.SIZE),l=c?c.data[0]:0,m=o[0],u=o[1],f=((l+1)/2+4)*e.screenToWorldRatio;let h=Number.MAX_VALUE,p=0;for(let d=0;d<n.length-5;d+=3){const e=n[d],r=n[d+1],s=m-e,o=u-r,i=n[d+3]-e,a=n[d+4]-r,c=t((i*s+a*o)/(i*i+a*a),0,1),l=i*c-s,f=a*c-o,g=l*l+f*f;g<h&&(h=g,p=d/3)}h<f*f&&i(a.dist,a.normal,p,!1)}createGLMaterial(e){return new I(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?v:w;return new T(e)}}class I extends x{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output===L.Color&&this._updateOccludeeState(e),this.ensureTechnique(C,e)}}class U extends N{constructor(){super(...arguments),this.color=h,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.hasOccludees=!1}}const q=f(),B=f(),D=f(),W=f(),X=r(),k=r(),G=f(),F=f(),H=d(),Q=d(),Z=f(),z=[r(),r(),r(),r()],J=[f(),f(),f(),f()],K=S(),Y=S(),$=S(),ee=S();export{V as NativeLineMaterial,U as Parameters};
@@ -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 e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{s as i,f as a,j as n,h as o,g as l,c,l as u,p as h,e as p}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as T,distance2 as _,fromPoints as E,closestLineSegmentPoint as A}from"../../../../geometry/support/lineSegment.js";import{create as R,fromPoints as O,signedDistance as I,getNormal as S}from"../../../../geometry/support/plane.js";import{newLayout as g}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as b,isColorAlphaHighlightOIDOrDepth as v,is2DGeometryOutput as P}from"../core/shaderLibrary/ShaderOutput.js";import L from"../lib/GLMaterial.js";import{Material as N,RenderOccludedFlag as C}from"../lib/Material.js";import{RenderSlot as y}from"../lib/RenderSlot.js";import{isTranslationMatrix as j}from"../lib/Util.js";import{VertexAttribute as D}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as U}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as F}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as w}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as B,RibbonLineTechnique as x}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as J,CapType as M}from"../shaders/RibbonLineTechniqueConfiguration.js";var G;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(G||(G={}));class H extends N{constructor(e){super(e,new k),this._configuration=new J,this.produces=new Map([[y.OPAQUE_MATERIAL,e=>e===b.Highlight||e===b.ObjectAndLayerIdColor||(e===b.Color||e===b.Alpha)&&this.parameters.renderOccluded===C.OccludeAndTransparentStencil],[y.OPAQUE_NO_SSAO_DEPTH,e=>e===b.LinearDepth],[y.OCCLUDER_MATERIAL,e=>v(e)&&this.parameters.renderOccluded===C.OccludeAndTransparentStencil],[y.TRANSPARENT_OCCLUDER_MATERIAL,e=>v(e)&&this.parameters.renderOccluded===C.OccludeAndTransparentStencil],[y.TRANSPARENT_MATERIAL,e=>(e===b.Color||e===b.Alpha)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==C.OccludeAndTransparentStencil],[y.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(e===b.Color||e===b.Alpha)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==C.OccludeAndTransparentStencil],[y.DRAPED_MATERIAL,e=>P(e)]]),this._vertexAttributeLocations=B}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===y.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==b.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&Y(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===C.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,r,s,i,a,n){if(!s.options.selectionMode)return;const o=e.attributes.get(D.POSITION).data,l=e.attributes.get(D.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.attributes.get(D.SIZEFEATUREATTRIBUTE).data[0];c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const u=i[0],h=i[1],p=(c/2+4)*e.screenToWorldRatio;let m=Number.MAX_VALUE,f=0;for(let d=0;d<o.length-5;d+=3){const e=o[d],r=o[d+1],s=u-e,i=h-r,a=o[d+3]-e,n=o[d+4]-r,l=t((a*s+n*i)/(a*a+n*n),0,1),c=a*l-s,p=n*l-i,T=c*c+p*p;T<m&&(m=T,f=d/3)}m<p*p&&a(n.dist,n.normal,f,!1)}intersect(r,p,m,f,T,R){if(!m.options.selectionMode||!r.visible)return;if(!j(p))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const g=r.attributes,b=g.get(D.POSITION).data;let v=this.parameters.width;if(this.parameters.vvSize){const e=g.get(D.SIZEFEATUREATTRIBUTE).data[0];v*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else g.has(D.SIZE)&&(v*=g.get(D.SIZE).data[0]);const P=m.camera,L=$;s(L,m.point);const N=v*P.pixelRatio/2+4*P.pixelRatio;i(ce[0],L[0]-N,L[1]+N,0),i(ce[1],L[0]+N,L[1]+N,0),i(ce[2],L[0]+N,L[1]-N,0),i(ce[3],L[0]-N,L[1]-N,0);for(let e=0;e<4;e++)if(!P.unprojectFromRenderScreen(ce[e],ue[e]))return;O(P.eye,ue[0],ue[1],he),O(P.eye,ue[1],ue[2],pe),O(P.eye,ue[2],ue[3],me),O(P.eye,ue[3],ue[0],fe);let C=Number.MAX_VALUE,y=0;const U=W(this.parameters,g)?b.length-2:b.length-5;for(let e=0;e<U;e+=3){q[0]=b[e]+p[12],q[1]=b[e+1]+p[13],q[2]=b[e+2]+p[14];const t=(e+3)%b.length;if(X[0]=b[t]+p[12],X[1]=b[t+1]+p[13],X[2]=b[t+2]+p[14],I(he,q)<0&&I(he,X)<0||I(pe,q)<0&&I(pe,X)<0||I(me,q)<0&&I(me,X)<0||I(fe,q)<0&&I(fe,X)<0)continue;if(P.projectToRenderScreen(q,ee),P.projectToRenderScreen(X,te),ee[2]<0&&te[2]>0){a(Q,q,X);const e=P.frustum,t=-I(e[d.NEAR],q)/n(Q,S(e[d.NEAR]));o(Q,Q,t),l(q,q,Q),P.projectToRenderScreen(q,ee)}else if(ee[2]>0&&te[2]<0){a(Q,X,q);const e=P.frustum,t=-I(e[d.NEAR],X)/n(Q,S(e[d.NEAR]));o(Q,Q,t),l(X,X,Q),P.projectToRenderScreen(X,te)}else if(ee[2]<0&&te[2]<0)continue;ee[2]=0,te[2]=0;const r=_(E(ee,te,ie),L);r<C&&(C=r,c(re,q),c(se,X),y=e/3)}const F=m.rayBegin,w=m.rayEnd;if(C<N*N){let e=Number.MAX_VALUE;if(A(E(re,se,ie),E(F,w,ae),K)){a(K,K,F);const t=u(K);o(K,K,1/t),e=t/h(F,w)}R(e,K,y,!1)}}get _layout(){const e=g().vec3f(D.POSITION).vec3f(D.PREVPOSITION).vec3f(D.NEXTPOSITION).f32(D.SUBDIVISIONFACTOR).vec2f(D.UV0);return this.parameters.vvSize?e.f32(D.SIZEFEATUREATTRIBUTE):e.f32(D.SIZE),this.parameters.vvColor?e.f32(D.COLORFEATUREATTRIBUTE):e.vec4f(D.COLOR),this.parameters.vvOpacity&&e.f32(D.OPACITYFEATUREATTRIBUTE),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(D.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new V(this._layout,this.parameters)}createGLMaterial(e){return new z(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class z extends L{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==b.Color&&this._output!==b.Alpha||this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(x,e)}}class k extends U{constructor(){super(...arguments),this.width=0,this.color=f,this.join="miter",this.cap=M.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class V{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t,this.numJoinSubdivisions=0;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=w+r}}_isClosed(e){return W(this._parameters,e.attributes)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.attributes.get(D.POSITION).indices.length/2+1,s=this._isClosed(e);let i=s?2:2*t;return i+=((s?r:r-1)-(s?0:1))*(2*this.numJoinSubdivisions+4),i+=2,this._parameters.wireframe&&(i=2+4*(i-2)),i}write(e,t,r,s,a){const n=ne,o=oe,l=le,u=r.attributes.get(D.POSITION),m=u.indices,f=u.data.length/3,d=r.attributes.get(D.DISTANCETOSTART)?.data;m&&m.length!==2*(f-1)&&console.warn("RibbonLineMaterial does not support indices");const T=r.attributes.get(D.SIZEFEATUREATTRIBUTE)?.data[0]??r.attributes.get(D.SIZE)?.data[0]??1;let _=[1,1,1,1],E=0;const A=this.vertexBufferLayout.fields.has(D.COLORFEATUREATTRIBUTE);A?E=r.attributes.get(D.COLORFEATUREATTRIBUTE).data[0]:r.attributes.has(D.COLOR)&&(_=r.attributes.get(D.COLOR).data);const R=has("enable-feature:objectAndLayerId-rendering")?r.objectAndLayerIdColor:null,O=this.vertexBufferLayout.fields.has(D.OPACITYFEATUREATTRIBUTE),I=O?r.attributes.get(D.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(s.buffer),g=has("enable-feature:objectAndLayerId-rendering")?new Uint8Array(s.buffer):null,b=this.vertexBufferLayout.stride/4;let v=a*b;const P=v;let L=0;const N=d?(e,t,r)=>L=d[r]:(e,t,r)=>L+=h(e,t),C=has("enable-feature:objectAndLayerId-rendering"),y=(e,t,r,s,i,a,n)=>{if(S[v++]=t[0],S[v++]=t[1],S[v++]=t[2],S[v++]=e[0],S[v++]=e[1],S[v++]=e[2],S[v++]=r[0],S[v++]=r[1],S[v++]=r[2],S[v++]=s,S[v++]=n,S[v++]=i,S[v++]=T,A)S[v++]=E;else{const e=Math.min(4*a,_.length-4);S[v++]=_[e],S[v++]=_[e+1],S[v++]=_[e+2],S[v++]=_[e+3]}O&&(S[v++]=I),C&&(null!=R&&(g[4*v]=R[0],g[4*v+1]=R[1],g[4*v+2]=R[2],g[4*v+3]=R[3]),v++)};v+=b,i(o,u.data[0],u.data[1],u.data[2]),e&&p(o,o,e);const j=this._isClosed(r);if(j){const t=u.data.length-3;i(n,u.data[t],u.data[t+1],u.data[t+2]),e&&p(n,n,e)}else i(l,u.data[3],u.data[4],u.data[5]),e&&p(l,l,e),y(o,o,l,1,G.LEFT_CAP_START,0,0),y(o,o,l,1,G.RIGHT_CAP_START,0,0),c(n,o),c(o,l);const U=j?0:1,F=j?f:f-1;for(let h=U;h<F;h++){const t=(h+1)%f*3;i(l,u.data[t],u.data[t+1],u.data[t+2]),e&&p(l,l,e),N(n,o,h),y(n,o,l,0,G.LEFT_JOIN_END,h,L),y(n,o,l,0,G.RIGHT_JOIN_END,h,L);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);y(n,o,l,t,G.LEFT_JOIN_END,h,L),y(n,o,l,t,G.RIGHT_JOIN_END,h,L)}y(n,o,l,1,G.LEFT_JOIN_START,h,L),y(n,o,l,1,G.RIGHT_JOIN_START,h,L),c(n,o),c(o,l)}j?(i(l,u.data[3],u.data[4],u.data[5]),e&&p(l,l,e),L=N(n,o,F),y(n,o,l,0,G.LEFT_JOIN_END,U,L),y(n,o,l,0,G.RIGHT_JOIN_END,U,L)):(L=N(n,o,F),y(n,o,o,0,G.LEFT_CAP_END,F,L),y(n,o,o,0,G.RIGHT_CAP_END,F,L)),Z(S,P+b,S,P,b);v=Z(S,v-b,S,v,b),this._parameters.wireframe&&this._addWireframeVertices(s,P,v,b)}_addWireframeVertices(e,t,r,s){const i=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=Z(a,e,i,n,s);for(let l=0;l<a.length-1;l+=2*s)o(l),o(l+2*s),o(l+1*s),o(l+2*s),o(l+1*s),o(l+3*s)}}function Z(e,t,r,s,i){for(let a=0;a<i;a++)r[s++]=e[t++];return s}function W(e,t){if(!e.isClosed)return!1;return t.get(D.POSITION).indices.length>2}function Y(e){return e.anchor===F.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const q=m(),X=m(),Q=m(),K=m(),$=m(),ee=r(),te=r(),re=m(),se=m(),ie=T(),ae=T(),ne=m(),oe=m(),le=m(),ce=[r(),r(),r(),r()],ue=[m(),m(),m(),m()],he=R(),pe=R(),me=R(),fe=R();export{k as Parameters,H as RibbonLineMaterial};
5
+ import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{s as i,f as a,k as n,h as o,g as l,c,l as u,q as h,e as p}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as T,distance2 as _,fromPoints as E,closestLineSegmentPoint as A}from"../../../../geometry/support/lineSegment.js";import{create as R,fromPoints as O,signedDistance as I,getNormal as S}from"../../../../geometry/support/plane.js";import{newLayout as g}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as b,isColorAlphaHighlightOIDOrDepth as v,is2DGeometryOutput as P}from"../core/shaderLibrary/ShaderOutput.js";import L from"../lib/GLMaterial.js";import{Material as N,RenderOccludedFlag as C}from"../lib/Material.js";import{RenderSlot as y}from"../lib/RenderSlot.js";import{isTranslationMatrix as j}from"../lib/Util.js";import{VertexAttribute as D}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as U}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as F}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as w}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as B,RibbonLineTechnique as x}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as J,CapType as M}from"../shaders/RibbonLineTechniqueConfiguration.js";var G;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(G||(G={}));class H extends N{constructor(e){super(e,new k),this._configuration=new J,this.produces=new Map([[y.OPAQUE_MATERIAL,e=>e===b.Highlight||e===b.ObjectAndLayerIdColor||(e===b.Color||e===b.Alpha)&&this.parameters.renderOccluded===C.OccludeAndTransparentStencil],[y.OPAQUE_NO_SSAO_DEPTH,e=>e===b.LinearDepth],[y.OCCLUDER_MATERIAL,e=>v(e)&&this.parameters.renderOccluded===C.OccludeAndTransparentStencil],[y.TRANSPARENT_OCCLUDER_MATERIAL,e=>v(e)&&this.parameters.renderOccluded===C.OccludeAndTransparentStencil],[y.TRANSPARENT_MATERIAL,e=>(e===b.Color||e===b.Alpha)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==C.OccludeAndTransparentStencil],[y.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(e===b.Color||e===b.Alpha)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==C.OccludeAndTransparentStencil],[y.DRAPED_MATERIAL,e=>P(e)]]),this._vertexAttributeLocations=B}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===y.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==b.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&Y(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===C.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,r,s,i,a,n){if(!s.options.selectionMode)return;const o=e.attributes.get(D.POSITION).data,l=e.attributes.get(D.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.attributes.get(D.SIZEFEATUREATTRIBUTE).data[0];c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const u=i[0],h=i[1],p=(c/2+4)*e.screenToWorldRatio;let m=Number.MAX_VALUE,f=0;for(let d=0;d<o.length-5;d+=3){const e=o[d],r=o[d+1],s=u-e,i=h-r,a=o[d+3]-e,n=o[d+4]-r,l=t((a*s+n*i)/(a*a+n*n),0,1),c=a*l-s,p=n*l-i,T=c*c+p*p;T<m&&(m=T,f=d/3)}m<p*p&&a(n.dist,n.normal,f,!1)}intersect(r,p,m,f,T,R){if(!m.options.selectionMode||!r.visible)return;if(!j(p))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const g=r.attributes,b=g.get(D.POSITION).data;let v=this.parameters.width;if(this.parameters.vvSize){const e=g.get(D.SIZEFEATUREATTRIBUTE).data[0];v*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else g.has(D.SIZE)&&(v*=g.get(D.SIZE).data[0]);const P=m.camera,L=$;s(L,m.point);const N=v*P.pixelRatio/2+4*P.pixelRatio;i(ce[0],L[0]-N,L[1]+N,0),i(ce[1],L[0]+N,L[1]+N,0),i(ce[2],L[0]+N,L[1]-N,0),i(ce[3],L[0]-N,L[1]-N,0);for(let e=0;e<4;e++)if(!P.unprojectFromRenderScreen(ce[e],ue[e]))return;O(P.eye,ue[0],ue[1],he),O(P.eye,ue[1],ue[2],pe),O(P.eye,ue[2],ue[3],me),O(P.eye,ue[3],ue[0],fe);let C=Number.MAX_VALUE,y=0;const U=W(this.parameters,g)?b.length-2:b.length-5;for(let e=0;e<U;e+=3){q[0]=b[e]+p[12],q[1]=b[e+1]+p[13],q[2]=b[e+2]+p[14];const t=(e+3)%b.length;if(X[0]=b[t]+p[12],X[1]=b[t+1]+p[13],X[2]=b[t+2]+p[14],I(he,q)<0&&I(he,X)<0||I(pe,q)<0&&I(pe,X)<0||I(me,q)<0&&I(me,X)<0||I(fe,q)<0&&I(fe,X)<0)continue;if(P.projectToRenderScreen(q,ee),P.projectToRenderScreen(X,te),ee[2]<0&&te[2]>0){a(Q,q,X);const e=P.frustum,t=-I(e[d.NEAR],q)/n(Q,S(e[d.NEAR]));o(Q,Q,t),l(q,q,Q),P.projectToRenderScreen(q,ee)}else if(ee[2]>0&&te[2]<0){a(Q,X,q);const e=P.frustum,t=-I(e[d.NEAR],X)/n(Q,S(e[d.NEAR]));o(Q,Q,t),l(X,X,Q),P.projectToRenderScreen(X,te)}else if(ee[2]<0&&te[2]<0)continue;ee[2]=0,te[2]=0;const r=_(E(ee,te,ie),L);r<C&&(C=r,c(re,q),c(se,X),y=e/3)}const F=m.rayBegin,w=m.rayEnd;if(C<N*N){let e=Number.MAX_VALUE;if(A(E(re,se,ie),E(F,w,ae),K)){a(K,K,F);const t=u(K);o(K,K,1/t),e=t/h(F,w)}R(e,K,y,!1)}}get _layout(){const e=g().vec3f(D.POSITION).vec3f(D.PREVPOSITION).vec3f(D.NEXTPOSITION).f32(D.SUBDIVISIONFACTOR).vec2f(D.UV0);return this.parameters.vvSize?e.f32(D.SIZEFEATUREATTRIBUTE):e.f32(D.SIZE),this.parameters.vvColor?e.f32(D.COLORFEATUREATTRIBUTE):e.vec4f(D.COLOR),this.parameters.vvOpacity&&e.f32(D.OPACITYFEATUREATTRIBUTE),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(D.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new V(this._layout,this.parameters)}createGLMaterial(e){return new z(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class z extends L{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==b.Color&&this._output!==b.Alpha||this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(x,e)}}class k extends U{constructor(){super(...arguments),this.width=0,this.color=f,this.join="miter",this.cap=M.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class V{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t,this.numJoinSubdivisions=0;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=w+r}}_isClosed(e){return W(this._parameters,e.attributes)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.attributes.get(D.POSITION).indices.length/2+1,s=this._isClosed(e);let i=s?2:2*t;return i+=((s?r:r-1)-(s?0:1))*(2*this.numJoinSubdivisions+4),i+=2,this._parameters.wireframe&&(i=2+4*(i-2)),i}write(e,t,r,s,a){const n=ne,o=oe,l=le,u=r.attributes.get(D.POSITION),m=u.indices,f=u.data.length/3,d=r.attributes.get(D.DISTANCETOSTART)?.data;m&&m.length!==2*(f-1)&&console.warn("RibbonLineMaterial does not support indices");const T=r.attributes.get(D.SIZEFEATUREATTRIBUTE)?.data[0]??r.attributes.get(D.SIZE)?.data[0]??1;let _=[1,1,1,1],E=0;const A=this.vertexBufferLayout.fields.has(D.COLORFEATUREATTRIBUTE);A?E=r.attributes.get(D.COLORFEATUREATTRIBUTE).data[0]:r.attributes.has(D.COLOR)&&(_=r.attributes.get(D.COLOR).data);const R=has("enable-feature:objectAndLayerId-rendering")?r.objectAndLayerIdColor:null,O=this.vertexBufferLayout.fields.has(D.OPACITYFEATUREATTRIBUTE),I=O?r.attributes.get(D.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(s.buffer),g=has("enable-feature:objectAndLayerId-rendering")?new Uint8Array(s.buffer):null,b=this.vertexBufferLayout.stride/4;let v=a*b;const P=v;let L=0;const N=d?(e,t,r)=>L=d[r]:(e,t,r)=>L+=h(e,t),C=has("enable-feature:objectAndLayerId-rendering"),y=(e,t,r,s,i,a,n)=>{if(S[v++]=t[0],S[v++]=t[1],S[v++]=t[2],S[v++]=e[0],S[v++]=e[1],S[v++]=e[2],S[v++]=r[0],S[v++]=r[1],S[v++]=r[2],S[v++]=s,S[v++]=n,S[v++]=i,S[v++]=T,A)S[v++]=E;else{const e=Math.min(4*a,_.length-4);S[v++]=_[e],S[v++]=_[e+1],S[v++]=_[e+2],S[v++]=_[e+3]}O&&(S[v++]=I),C&&(null!=R&&(g[4*v]=R[0],g[4*v+1]=R[1],g[4*v+2]=R[2],g[4*v+3]=R[3]),v++)};v+=b,i(o,u.data[0],u.data[1],u.data[2]),e&&p(o,o,e);const j=this._isClosed(r);if(j){const t=u.data.length-3;i(n,u.data[t],u.data[t+1],u.data[t+2]),e&&p(n,n,e)}else i(l,u.data[3],u.data[4],u.data[5]),e&&p(l,l,e),y(o,o,l,1,G.LEFT_CAP_START,0,0),y(o,o,l,1,G.RIGHT_CAP_START,0,0),c(n,o),c(o,l);const U=j?0:1,F=j?f:f-1;for(let h=U;h<F;h++){const t=(h+1)%f*3;i(l,u.data[t],u.data[t+1],u.data[t+2]),e&&p(l,l,e),N(n,o,h),y(n,o,l,0,G.LEFT_JOIN_END,h,L),y(n,o,l,0,G.RIGHT_JOIN_END,h,L);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);y(n,o,l,t,G.LEFT_JOIN_END,h,L),y(n,o,l,t,G.RIGHT_JOIN_END,h,L)}y(n,o,l,1,G.LEFT_JOIN_START,h,L),y(n,o,l,1,G.RIGHT_JOIN_START,h,L),c(n,o),c(o,l)}j?(i(l,u.data[3],u.data[4],u.data[5]),e&&p(l,l,e),L=N(n,o,F),y(n,o,l,0,G.LEFT_JOIN_END,U,L),y(n,o,l,0,G.RIGHT_JOIN_END,U,L)):(L=N(n,o,F),y(n,o,o,0,G.LEFT_CAP_END,F,L),y(n,o,o,0,G.RIGHT_CAP_END,F,L)),Z(S,P+b,S,P,b);v=Z(S,v-b,S,v,b),this._parameters.wireframe&&this._addWireframeVertices(s,P,v,b)}_addWireframeVertices(e,t,r,s){const i=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=Z(a,e,i,n,s);for(let l=0;l<a.length-1;l+=2*s)o(l),o(l+2*s),o(l+1*s),o(l+2*s),o(l+1*s),o(l+3*s)}}function Z(e,t,r,s,i){for(let a=0;a<i;a++)r[s++]=e[t++];return s}function W(e,t){if(!e.isClosed)return!1;return t.get(D.POSITION).indices.length>2}function Y(e){return e.anchor===F.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const q=m(),X=m(),Q=m(),K=m(),$=m(),ee=r(),te=r(),re=m(),se=m(),ie=T(),ae=T(),ne=m(),oe=m(),le=m(),ce=[r(),r(),r(),r()],ue=[m(),m(),m(),m()],he=R(),pe=R(),me=R(),fe=R();export{k as Parameters,H as RibbonLineMaterial};
@@ -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{i as l}from"../../../../chunks/vec32.js";import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";function u({normalTexture:u,metallicRoughnessTexture:n,metallicFactor:r,roughnessFactor:t,emissiveTexture:o,emissiveFactor:s,occlusionTexture:c}){return null==u&&null==n&&null==o&&(null==s||l(s,e))&&null==c&&(null==t||1===t)&&(null==r||1===r)}function n({normalTexture:u,metallicRoughnessTexture:n,metallicFactor:r,roughnessFactor:t,emissiveTexture:o,emissiveFactor:s,occlusionTexture:c}){return null==u&&null==n&&null==o&&(null==s||l(s,e))&&null==c&&(null==t||1===t)&&(null==r||1===r||0===r)}const r=[1,1,.5],t=[0,.6,.2],o=[0,1,.2];export{r as defaultAdvancedMRRFactors,o as defaultEsriSymbologyMRRFactors,t as defaultSchematicMRRFactors,u as useSchematicPBR,n as useSchematicPBRI3S};
5
+ import{j as l}from"../../../../chunks/vec32.js";import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";function u({normalTexture:u,metallicRoughnessTexture:n,metallicFactor:r,roughnessFactor:t,emissiveTexture:o,emissiveFactor:s,occlusionTexture:c}){return null==u&&null==n&&null==o&&(null==s||l(s,e))&&null==c&&(null==t||1===t)&&(null==r||1===r)}function n({normalTexture:u,metallicRoughnessTexture:n,metallicFactor:r,roughnessFactor:t,emissiveTexture:o,emissiveFactor:s,occlusionTexture:c}){return null==u&&null==n&&null==o&&(null==s||l(s,e))&&null==c&&(null==t||1===t)&&(null==r||1===r||0===r)}const r=[1,1,.5],t=[0,.6,.2],o=[0,1,.2];export{r as defaultAdvancedMRRFactors,o as defaultEsriSymbologyMRRFactors,t as defaultSchematicMRRFactors,u as useSchematicPBR,n as useSchematicPBRI3S};
@@ -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{difference as t,isSome as s}from"../core/arrayUtils.js";import i from"../core/Collection.js";import o from"../core/Evented.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{removeMaybe as r}from"../core/maybe.js";import l from"../core/ReactiveMap.js";import{watch as c,on as a}from"../core/reactiveUtils.js";import{symmetricDifference as h}from"../core/SetUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import p from"../rest/support/Query.js";let f=class extends o.EventedAccessor{constructor(e){super(e),this._selectionMap=new l,this._trashCan=[],this._layerEditHandles=new i,this._vizTaskId=0,this.showHighlight=!0}initialize(){this.addHandles([c((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),a((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})]);const e=new i;this.view.when().then((()=>{this.view.map.allLayers.flatten((e=>"sublayers"in e&&e.sublayers?e.sublayers:null)).forEach((t=>{g(t)&&e.add(t)})),this._set("sources",e)}))}destroy(){this._layerEditHandles.drain(r)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._get("sources")}set sources(e){this._set("sources",e)}async getSelectedFeatures(e,t={},s="layerView"){const{view:i,selections:o}=this,n=(void 0!==e?o.filter((t=>e.includes(t.layer))):o).filter((e=>e.selection.length>0)).map((async e=>{const o=i.map.findLayerByUid(e.layer.uid);if(void 0===o)return null;if("layer"===s)return v(e.layer,e.selection,t);const n=await i.whenLayerView(o);return v(n,e.selection,t)}));return(await Promise.all(n)).filter((e=>null!==e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let i=!1;const o=e.current.concat(e.added);for(const t of o){const e=t.sourceLayer,o=t.getObjectId();if(this.sources.includes(e)&&g(e)&&null!==o){const t=n(s,e,(()=>[]));t.includes(o)||(t.push(o),i=!0)}}for(const t of e.removed){const e=t.sourceLayer,o=t.getObjectId();if(this.sources.includes(e)&&null!==o){const t=s.get(e),n=t?.indexOf(o);void 0!==n&&n>=0&&(t?.splice(n,1),i=!0)}}if(i){const{_selectionMap:e,_trashCan:i}=this,o=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&i.push(s),e.set(n,{selection:r}),o.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(o)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),i=void 0!==s?[...s.selection]:[];for(const o of t)i.includes(o)||i.push(o);this._setSelection(e,i)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const i=[];for(const o of s.selection)t.includes(o)||i.push(o);this._setSelection(e,i)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const i=new Set(s.selection),o=new Set(t),n=h(i,o);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,i]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...i.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:i}=this,o=this._vizTaskId;for(const n of e){const e=s.get(n),r=t.map.findLayerByUid(n.uid);void 0!==r&&t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),void 0!==e&&i&&o===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,"selection"))}))}}_refreshListeners(){this._layerEditHandles.drain(r);for(const e of this.sources)if(g(e)){const t=e.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(t)}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const i=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,i)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const i=this._selectionMap.get(e);if(void 0===i||!_(i,{selection:s})){void 0!==i&&this._trashCan.push(i),this._selectionMap.set(e,{selection:[...s]});const o={layer:e,selection:[...s],...t(void 0!==i?i.selection:[],s)};this._onSelectionChange([o])}}};e([u({readOnly:!0,nonNullable:!0})],f.prototype,"selections",null),e([u({readOnly:!0,nonNullable:!0})],f.prototype,"count",null),e([u({constructOnly:!0,nonNullable:!0})],f.prototype,"view",void 0),e([u({readOnly:!0,nonNullable:!0})],f.prototype,"hasSelection",null),e([u()],f.prototype,"showHighlight",void 0),e([u()],f.prototype,"sources",null),f=e([d("esri.views.SelectionManager")],f);const g=e=>void 0!==e.createQuery&&void 0!==e.on,y=e=>void 0!==e.layer,_=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],i=[...t.selection];if(s.length!==i.length)return!1;s.sort(),i.sort();for(let e=0;e<s.length;e++)if(s[e]!==i[e])return!1}return!0},v=async(e,t,s={})=>{let i;if(y(e)){const o=e;i=void 0===o?null:await o.queryFeatures(new p({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const o=e;i=void 0===o?null:await o.queryFeatures(new p({...s,objectIds:t})).then((e=>({data:e,layer:o})))}return i},m=f;export{m as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import o from"../core/Collection.js";import i from"../core/Evented.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{removeMaybe as r}from"../core/maybe.js";import l from"../core/ReactiveMap.js";import{watch as c,on as a}from"../core/reactiveUtils.js";import{symmetricDifference as h}from"../core/SetUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeGroupLayer as p,isSubtypeSublayer as f}from"../layers/support/layerUtils.js";import g from"../rest/support/Query.js";let _=class extends i.EventedAccessor{constructor(e){super(e),this._selectionMap=new l,this._trashCan=[],this._layerEditHandles=new o,this._vizTaskId=0,this.showHighlight=!0}initialize(){this.addHandles([c((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),a((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})]);const e=new o;this.view.when().then((()=>{this.view.map.allLayers.flatten((e=>"sublayers"in e&&e.sublayers?e.sublayers:null)).forEach((t=>{(y(t)&&!p(t)||f(t))&&e.add(t)})),this._set("sources",e)}))}destroy(){this._layerEditHandles.drain(r)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._get("sources")}set sources(e){this._set("sources",e)}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this,n=(void 0!==e?i.filter((t=>e.includes(t.layer))):i).filter((e=>e.selection.length>0)).map((async e=>{const{layer:i,selection:n}=e,r=f(i)?i.parent:i;if(null==r||!v(r))return null;if("layer"===s)return S(r,n,t);const l=await o.whenLayerView(r);return S(l,n,t)}));return(await Promise.all(n)).filter((e=>null!==e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(y(e)||f(e))&&null!==i){const t=n(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(y(e)||f(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=h(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=f(n)?n.parent:n;null!=r&&v(r)&&t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),void 0!==e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,"selection"))}))}}_refreshListeners(){this._layerEditHandles.drain(r);for(const e of this.sources){const t=f(e)?e.parent:e;if(null!=t&&y(t)){const s=t.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(s)}}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const o=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,o)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!w(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([u({readOnly:!0,nonNullable:!0})],_.prototype,"selections",null),e([u({readOnly:!0,nonNullable:!0})],_.prototype,"count",null),e([u({constructOnly:!0,nonNullable:!0})],_.prototype,"view",void 0),e([u({readOnly:!0,nonNullable:!0})],_.prototype,"hasSelection",null),e([u()],_.prototype,"showHighlight",void 0),e([u()],_.prototype,"sources",null),_=e([d("esri.views.SelectionManager")],_);const y=e=>void 0!==e.createQuery&&void 0!==e.on,m=e=>void 0!==e.layer,v=e=>void 0!==e?.when,w=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},S=async(e,t,s={})=>{let o;if(m(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new g({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new g({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},M=_;export{M 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"../../../geometry.js";import{equals as t,isSome as e}from"../../../core/arrayUtils.js";import{clone as o}from"../../../core/lang.js";import{getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import{k as r}from"../../../chunks/vec32.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../../../geometry/Circle.js";import{simplify as s,distance as i}from"../../../geometry/geometryEngine.js";import{unnormalizeGeometryOnDatelineCrossing as c,isClockwise as y,unnormalizeVerticesOnDatelineCrossing as p}from"../../../geometry/support/coordsUtils.js";import{isValid as u}from"../../../geometry/support/spatialReferenceUtils.js";import{makeSurfacePoint as m}from"./surfaceCoordinateSystems.js";import f from"../../../geometry/Point.js";import x from"../../../geometry/Multipoint.js";import h from"../../../geometry/Polyline.js";import M from"../../../geometry/Polygon.js";function g(t,e){const o=new f({x:t[0],y:t[1],spatialReference:e});return t.length>2&&(o.z=t[2]),o}function d(t,e){return new x({points:t,spatialReference:e})}function R(t,e,o){const n=new h({paths:t,spatialReference:e});return o&&c(n),n}function j(e,n,r,a=!0){const l=o(e);l.forEach((e=>{const o=e[0],n=e[e.length-1];t(o,n)&&1!==e.length||e.push(e[0])}));let i=new M({rings:l,spatialReference:n});return i.rings.forEach((t=>{y(t)||t.reverse()})),r&&c(i),a&&i.isSelfIntersecting&&u(n)&&(i=s(i)),i}function T(t,o,n){const r=o.mapToLocalMultiple(t),a=[],l={x:r[0].x,y:r[0].y},s={x:r[1].x,y:r[1].y},i=Math.round(s.x-l.x),c=Math.round(s.y-l.y),y=Math.max(Math.abs(i),Math.abs(c));if(n){const t={x:l.x+y,y:l.y+y},e={x:l.x-y,y:l.y-y};a.push(m(t.x,e.y),m(e.x,e.y),m(e.x,t.y),m(t.x,t.y))}else{const t={x:i>0?l.x+y:l.x-y,y:c>0?l.y+y:l.y-y};a.push(m(l.x,l.y),m(t.x,l.y),m(t.x,t.y),m(l.x,t.y))}return U(j([a.map((t=>o.localToMap(t))).filter(e)],o.spatialReference,o.doUnnormalization,!0),a,o)}function b(t,o,n){let r=o.mapToLocalMultiple(t);if(1===r.length){const t=48,e=r[0];r=[m(e.x-t,e.y+t),m(e.x+t,e.y-t),m(e.x+t,e.y-t),m(e.x-t,e.y+t)]}const a=[],l={x:r[0].x,y:r[0].y},s={x:r[1].x,y:r[1].y};if(n){const t=Math.round(s.x-l.x),e=Math.round(s.y-l.y);a.push(m(l.x-t,l.y-e),m(s.x,l.y-e),m(s.x,s.y),m(l.x-t,s.y))}else a.push(m(l.x,l.y),m(s.x,l.y),m(s.x,s.y),m(l.x,s.y));return U(j([a.map((t=>o.localToMap(t))).filter(e)],o.spatialReference,o.doUnnormalization,!0),a,o)}function U(t,e,o){const n=P(e[3],e[2],o),r=P(e[1],e[2],o),a=P(e[0],e[1],o),l=P(e[0],e[3],o);return{geometry:t,midpoints:null!=n&&null!=r&&null!=a&&null!=l?{top:n,right:r,bottom:a,left:l}:null}}function P(t,e,o){w[0]=t.x,w[1]=t.y,w[2]=0,I[0]=e.x,I[1]=e.y,I[2]=0,r(w,w,I,.5),z.x=w[0],z.y=I[1],z.z=I[2];const n=o.localToMap(z);return null!=n?g(n,o.spatialReference):null}const z=m(0,0,0),w=a(),I=a();function L(t,e,o,r){const a=e.mapToLocalMultiple(t);let s=null,c=null;if(o)s=a[0],c=a[1];else{const t=a[0],e=a[1],o=Math.round(e.x-t.x),n=Math.round(e.y-t.y),r=Math.max(Math.abs(o),Math.abs(n));s=m(o>0?t.x+r/2:t.x-r/2,n>0?t.y+r/2:t.y-r/2),c=m(Math.abs(o)>Math.abs(n)?s.x-r/2:s.x,Math.abs(o)>Math.abs(n)?s.y:s.y-r/2)}const y=e.localToMap(s),f=e.localToMap(c);if(null==y||null==f)return null;e.doUnnormalization&&p([[y,f]],e.spatialReference);const x=g(y,e.spatialReference),h=g(f,e.spatialReference),M=n(e.spatialReference);let d=0;if(u(e.spatialReference))d=M*i(x,h,null);else{const t=s.x-c.x,e=s.y-c.y;d=M*Math.sqrt(t*t+e*e)*(r||1)}const R=new l({center:x,radius:d,radiusUnit:"meters",spatialReference:e.spatialReference});return{geometry:j(R.rings,R.spatialReference,!1),center:x,edge:h}}function v(t,o,n){const r=o.mapToLocalMultiple(t),a=r[0],l=r[1],s=Math.round(l.x-a.x),i=Math.round(l.y-a.y),c=m(n?a.x:a.x+s/2,n?a.y:a.y+i/2),y=n?s:s/2,p=n?i:i/2,u=60,f=[],x=2*Math.PI/u;function h(t){const e=Math.cos(t),o=Math.sin(t);return m(y*e+c.x,p*o+c.y)}for(let e=0;e<u;e++)f.push(h(e*x));f.push(f[0]);const{spatialReference:M,doUnnormalization:d}=o,R=j([f.map((t=>o.localToMap(t))).filter(e)],M,d,!1),T=o.localToMap(h(Math.PI/2)),b=o.localToMap(h(0)),U=o.localToMap(h(-Math.PI/2)),P=o.localToMap(h(Math.PI));return{geometry:R,midpoints:null!=T&&null!=b&&null!=U&&null!=P?{top:g(T,M),right:g(b,M),bottom:g(U,M),left:g(P,M)}:null}}export{L as createCircle,v as createEllipse,d as createMultipoint,g as createPoint,j as createPolygon,R as createPolyline,b as createRectangle,T as createSquare};
5
+ import"../../../geometry.js";import{equals as t,isSome as e}from"../../../core/arrayUtils.js";import{clone as o}from"../../../core/lang.js";import{getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import{m as r}from"../../../chunks/vec32.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../../../geometry/Circle.js";import{simplify as s,distance as i}from"../../../geometry/geometryEngine.js";import{unnormalizeGeometryOnDatelineCrossing as c,isClockwise as y,unnormalizeVerticesOnDatelineCrossing as p}from"../../../geometry/support/coordsUtils.js";import{isValid as u}from"../../../geometry/support/spatialReferenceUtils.js";import{makeSurfacePoint as m}from"./surfaceCoordinateSystems.js";import f from"../../../geometry/Point.js";import x from"../../../geometry/Multipoint.js";import h from"../../../geometry/Polyline.js";import M from"../../../geometry/Polygon.js";function g(t,e){const o=new f({x:t[0],y:t[1],spatialReference:e});return t.length>2&&(o.z=t[2]),o}function d(t,e){return new x({points:t,spatialReference:e})}function R(t,e,o){const n=new h({paths:t,spatialReference:e});return o&&c(n),n}function j(e,n,r,a=!0){const l=o(e);l.forEach((e=>{const o=e[0],n=e[e.length-1];t(o,n)&&1!==e.length||e.push(e[0])}));let i=new M({rings:l,spatialReference:n});return i.rings.forEach((t=>{y(t)||t.reverse()})),r&&c(i),a&&i.isSelfIntersecting&&u(n)&&(i=s(i)),i}function T(t,o,n){const r=o.mapToLocalMultiple(t),a=[],l={x:r[0].x,y:r[0].y},s={x:r[1].x,y:r[1].y},i=Math.round(s.x-l.x),c=Math.round(s.y-l.y),y=Math.max(Math.abs(i),Math.abs(c));if(n){const t={x:l.x+y,y:l.y+y},e={x:l.x-y,y:l.y-y};a.push(m(t.x,e.y),m(e.x,e.y),m(e.x,t.y),m(t.x,t.y))}else{const t={x:i>0?l.x+y:l.x-y,y:c>0?l.y+y:l.y-y};a.push(m(l.x,l.y),m(t.x,l.y),m(t.x,t.y),m(l.x,t.y))}return U(j([a.map((t=>o.localToMap(t))).filter(e)],o.spatialReference,o.doUnnormalization,!0),a,o)}function b(t,o,n){let r=o.mapToLocalMultiple(t);if(1===r.length){const t=48,e=r[0];r=[m(e.x-t,e.y+t),m(e.x+t,e.y-t),m(e.x+t,e.y-t),m(e.x-t,e.y+t)]}const a=[],l={x:r[0].x,y:r[0].y},s={x:r[1].x,y:r[1].y};if(n){const t=Math.round(s.x-l.x),e=Math.round(s.y-l.y);a.push(m(l.x-t,l.y-e),m(s.x,l.y-e),m(s.x,s.y),m(l.x-t,s.y))}else a.push(m(l.x,l.y),m(s.x,l.y),m(s.x,s.y),m(l.x,s.y));return U(j([a.map((t=>o.localToMap(t))).filter(e)],o.spatialReference,o.doUnnormalization,!0),a,o)}function U(t,e,o){const n=P(e[3],e[2],o),r=P(e[1],e[2],o),a=P(e[0],e[1],o),l=P(e[0],e[3],o);return{geometry:t,midpoints:null!=n&&null!=r&&null!=a&&null!=l?{top:n,right:r,bottom:a,left:l}:null}}function P(t,e,o){w[0]=t.x,w[1]=t.y,w[2]=0,I[0]=e.x,I[1]=e.y,I[2]=0,r(w,w,I,.5),z.x=w[0],z.y=I[1],z.z=I[2];const n=o.localToMap(z);return null!=n?g(n,o.spatialReference):null}const z=m(0,0,0),w=a(),I=a();function L(t,e,o,r){const a=e.mapToLocalMultiple(t);let s=null,c=null;if(o)s=a[0],c=a[1];else{const t=a[0],e=a[1],o=Math.round(e.x-t.x),n=Math.round(e.y-t.y),r=Math.max(Math.abs(o),Math.abs(n));s=m(o>0?t.x+r/2:t.x-r/2,n>0?t.y+r/2:t.y-r/2),c=m(Math.abs(o)>Math.abs(n)?s.x-r/2:s.x,Math.abs(o)>Math.abs(n)?s.y:s.y-r/2)}const y=e.localToMap(s),f=e.localToMap(c);if(null==y||null==f)return null;e.doUnnormalization&&p([[y,f]],e.spatialReference);const x=g(y,e.spatialReference),h=g(f,e.spatialReference),M=n(e.spatialReference);let d=0;if(u(e.spatialReference))d=M*i(x,h,null);else{const t=s.x-c.x,e=s.y-c.y;d=M*Math.sqrt(t*t+e*e)*(r||1)}const R=new l({center:x,radius:d,radiusUnit:"meters",spatialReference:e.spatialReference});return{geometry:j(R.rings,R.spatialReference,!1),center:x,edge:h}}function v(t,o,n){const r=o.mapToLocalMultiple(t),a=r[0],l=r[1],s=Math.round(l.x-a.x),i=Math.round(l.y-a.y),c=m(n?a.x:a.x+s/2,n?a.y:a.y+i/2),y=n?s:s/2,p=n?i:i/2,u=60,f=[],x=2*Math.PI/u;function h(t){const e=Math.cos(t),o=Math.sin(t);return m(y*e+c.x,p*o+c.y)}for(let e=0;e<u;e++)f.push(h(e*x));f.push(f[0]);const{spatialReference:M,doUnnormalization:d}=o,R=j([f.map((t=>o.localToMap(t))).filter(e)],M,d,!1),T=o.localToMap(h(Math.PI/2)),b=o.localToMap(h(0)),U=o.localToMap(h(-Math.PI/2)),P=o.localToMap(h(Math.PI));return{geometry:R,midpoints:null!=T&&null!=b&&null!=U&&null!=P?{top:g(T,M),right:g(b,M),bottom:g(U,M),left:g(P,M)}:null}}export{L as createCircle,v as createEllipse,d as createMultipoint,g as createPoint,j as createPolygon,R as createPolyline,b as createRectangle,T as createSquare};
@@ -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"../../../geometry.js";import{isSome as t}from"../../../core/arrayUtils.js";import{invert as r}from"../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as e,clone as s}from"../../../core/libs/gl-matrix-2/factories/mat2df64.js";import{rotationTo as a,invert as o}from"../../../core/libs/gl-matrix-2/math/quat.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{h as n,j as l,f as h,n as m,b as c,r as f}from"../../../chunks/vec32.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Axis as d}from"../../../geometry/support/Axis.js";import u from"../../../geometry/Point.js";function g(t,r,e=null){return null!=e?[t,r,e]:[t,r]}function w(t,r,e=null){return null!=e?{x:t,y:r,z:e}:{x:t,y:r}}class R{constructor(t){this.spatialReference=t}mapToLocalMultiple(r){return r.map((t=>this.mapToLocal(t))).filter(t)}get doUnnormalization(){return!1}}class W extends R{constructor(t,a,o=null){super(a),this._defaultZ=o,this.transform=e(),this.transformInv=e(),this.transform=s(t),r(this.transformInv,this.transform)}makeMapPoint(t,r){return g(t,r,this._defaultZ)}mapToLocal(t){return w(this.transform[0]*t[0]+this.transform[2]*t[1]+this.transform[4],this.transform[1]*t[0]+this.transform[3]*t[1]+this.transform[5])}localToMap(t){return g(this.transformInv[0]*t.x+this.transformInv[2]*t.y+this.transformInv[4],this.transformInv[1]*t.x+this.transformInv[3]*t.y+this.transformInv[5],this._defaultZ)}}class v extends R{constructor(t,r){super(t.spatialReference),this.view=t,this.defaultZ=null,this.pWS=p(),this.tangentFrameUpWS=p(),this.tangentFrameRightWS=p(),this.tangentFrameForwardWS=p(),this.localFrameRightWS=p(),this.localFrameUpWS=p(),this.worldToLocalTransform=i(),this.localToWorldTransform=i(),this.scale=1,this.scale=t.resolution,this.referenceMapPoint=r,this.defaultZ=r.hasZ?r.z:null;const e=t.state.camera.viewRight;this.view.renderCoordsHelper.toRenderCoords(this.referenceMapPoint,this.pWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,d.X,this.tangentFrameRightWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,d.Y,this.tangentFrameUpWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,d.Z,this.tangentFrameForwardWS);const s=p();n(s,this.tangentFrameForwardWS,l(e,this.tangentFrameForwardWS)),h(this.localFrameRightWS,e,s),m(this.localFrameRightWS,this.localFrameRightWS),c(this.localFrameUpWS,this.tangentFrameForwardWS,this.localFrameRightWS),a(this.worldToLocalTransform,this.localFrameRightWS,this.tangentFrameRightWS),o(this.localToWorldTransform,this.worldToLocalTransform)}get doUnnormalization(){return"global"===this.view.viewingMode}makeMapPoint(t,r){return g(t,r,this.defaultZ)}mapToLocal(t){const r=p();this.view.renderCoordsHelper.toRenderCoords(new u({x:t[0],y:t[1],spatialReference:this.spatialReference}),r),f(r,r,this.worldToLocalTransform);const e=this.view.renderCoordsHelper.fromRenderCoords(r,new u({spatialReference:this.view.spatialReference}));return null!=e?w(e.x/this.scale,e.y/this.scale):null}localToMap(t){const r=p();this.view.renderCoordsHelper.toRenderCoords(new u({x:t.x*this.scale,y:t.y*this.scale,spatialReference:this.spatialReference}),r),f(r,r,this.localToWorldTransform);const e=this.view.renderCoordsHelper.fromRenderCoords(r,new u({spatialReference:this.view.spatialReference}));return null!=e?g(e.x,e.y,this.defaultZ):null}}function F(t,r){if("2d"===t.type)return new W(t.state.transform,t.spatialReference,r.length>2?r[2]:null);if("3d"===t.type){const e=r.length>2?new u({x:r[0],y:r[1],z:r[2],spatialReference:t.spatialReference}):new u({x:r[0],y:r[1],spatialReference:t.spatialReference});return new v(t,e)}return null}export{W as AffineCoordinateSystem,v as SceneViewCoordinateSystem,R as SurfaceCoordinateSystem,F as createViewAlignedCoordinateSystem,g as makeMapPoint,w as makeSurfacePoint};
5
+ import"../../../geometry.js";import{isSome as t}from"../../../core/arrayUtils.js";import{invert as r}from"../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as e,clone as s}from"../../../core/libs/gl-matrix-2/factories/mat2df64.js";import{rotationTo as a,invert as o}from"../../../core/libs/gl-matrix-2/math/quat.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{h as n,k as l,f as h,n as m,b as c,u as f}from"../../../chunks/vec32.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Axis as d}from"../../../geometry/support/Axis.js";import u from"../../../geometry/Point.js";function g(t,r,e=null){return null!=e?[t,r,e]:[t,r]}function w(t,r,e=null){return null!=e?{x:t,y:r,z:e}:{x:t,y:r}}class R{constructor(t){this.spatialReference=t}mapToLocalMultiple(r){return r.map((t=>this.mapToLocal(t))).filter(t)}get doUnnormalization(){return!1}}class W extends R{constructor(t,a,o=null){super(a),this._defaultZ=o,this.transform=e(),this.transformInv=e(),this.transform=s(t),r(this.transformInv,this.transform)}makeMapPoint(t,r){return g(t,r,this._defaultZ)}mapToLocal(t){return w(this.transform[0]*t[0]+this.transform[2]*t[1]+this.transform[4],this.transform[1]*t[0]+this.transform[3]*t[1]+this.transform[5])}localToMap(t){return g(this.transformInv[0]*t.x+this.transformInv[2]*t.y+this.transformInv[4],this.transformInv[1]*t.x+this.transformInv[3]*t.y+this.transformInv[5],this._defaultZ)}}class v extends R{constructor(t,r){super(t.spatialReference),this.view=t,this.defaultZ=null,this.pWS=p(),this.tangentFrameUpWS=p(),this.tangentFrameRightWS=p(),this.tangentFrameForwardWS=p(),this.localFrameRightWS=p(),this.localFrameUpWS=p(),this.worldToLocalTransform=i(),this.localToWorldTransform=i(),this.scale=1,this.scale=t.resolution,this.referenceMapPoint=r,this.defaultZ=r.hasZ?r.z:null;const e=t.state.camera.viewRight;this.view.renderCoordsHelper.toRenderCoords(this.referenceMapPoint,this.pWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,d.X,this.tangentFrameRightWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,d.Y,this.tangentFrameUpWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,d.Z,this.tangentFrameForwardWS);const s=p();n(s,this.tangentFrameForwardWS,l(e,this.tangentFrameForwardWS)),h(this.localFrameRightWS,e,s),m(this.localFrameRightWS,this.localFrameRightWS),c(this.localFrameUpWS,this.tangentFrameForwardWS,this.localFrameRightWS),a(this.worldToLocalTransform,this.localFrameRightWS,this.tangentFrameRightWS),o(this.localToWorldTransform,this.worldToLocalTransform)}get doUnnormalization(){return"global"===this.view.viewingMode}makeMapPoint(t,r){return g(t,r,this.defaultZ)}mapToLocal(t){const r=p();this.view.renderCoordsHelper.toRenderCoords(new u({x:t[0],y:t[1],spatialReference:this.spatialReference}),r),f(r,r,this.worldToLocalTransform);const e=this.view.renderCoordsHelper.fromRenderCoords(r,new u({spatialReference:this.view.spatialReference}));return null!=e?w(e.x/this.scale,e.y/this.scale):null}localToMap(t){const r=p();this.view.renderCoordsHelper.toRenderCoords(new u({x:t.x*this.scale,y:t.y*this.scale,spatialReference:this.spatialReference}),r),f(r,r,this.localToWorldTransform);const e=this.view.renderCoordsHelper.fromRenderCoords(r,new u({spatialReference:this.view.spatialReference}));return null!=e?g(e.x,e.y,this.defaultZ):null}}function F(t,r){if("2d"===t.type)return new W(t.state.transform,t.spatialReference,r.length>2?r[2]:null);if("3d"===t.type){const e=r.length>2?new u({x:r[0],y:r[1],z:r[2],spatialReference:t.spatialReference}):new u({x:r[0],y:r[1],spatialReference:t.spatialReference});return new v(t,e)}return null}export{W as AffineCoordinateSystem,v as SceneViewCoordinateSystem,R as SurfaceCoordinateSystem,F as createViewAlignedCoordinateSystem,g as makeMapPoint,w as makeSurfacePoint};
@@ -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 t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import o from"../../core/Evented.js";import{watch as i,sync as s}from"../../core/reactiveUtils.js";import{screenPointObjectToArray as r,pt2px as l,createScreenPointArray as n}from"../../core/screenUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{squaredDistance as h}from"../../core/libs/gl-matrix-2/math/vec2.js";import{p}from"../../chunks/vec32.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as u,project as y}from"../../geometry/projection.js";import{projectPointToVector as g}from"../../geometry/projection/projectPointToVector.js";import{getGraphicEffectiveElevationMode as b}from"../../support/elevationInfoUtils.js";import{getDefaultSymbol2D as d}from"../../symbols/support/defaults.js";import f from"../../symbols/support/ElevationInfo.js";import{getSymbolInfo as _}from"./support/utils.js";import{intersectsDrapedGeometry as v}from"../support/drapedUtils.js";let S=class extends e{set graphic(t){this._circleCollisionCache=null,this._originalSymbol=t.symbol,this._set("graphic",t),this.attachSymbolChanged()}get elevationInfo(){const{layer:t}=this.graphic,e=t&&"elevationInfo"in t?t.elevationInfo:null,o=b(this.graphic),i=e?e.offset:0;return new f({mode:o,offset:i})}set focusedSymbol(t){t!==this._get("focusedSymbol")&&(this._set("focusedSymbol",t),this._updateGraphicSymbol(),this._circleCollisionCache=null)}grabbableForEvent(){return!0}set grabbing(t){t!==this._get("grabbing")&&(this._set("grabbing",t),this._updateGraphicSymbol())}set hovering(t){t!==this._get("hovering")&&(this._set("hovering",t),this._updateGraphicSymbol())}set selected(t){t!==this._get("selected")&&(this._set("selected",t),this._updateGraphicSymbol(),this.events.emit("select-changed",{action:t?"select":"deselect"}))}get _focused(){return this._get("hovering")||this._get("grabbing")}constructor(t){super(t),this.layer=null,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.dragging=!1,this.cursor=null,this.consumesClicks=!0,this.events=new o.EventEmitter,this._circleCollisionCache=null,this._graphicSymbolChangedHandle=null,this._originalSymbol=null}destroy(){this.detachSymbolChanged(),this._resetGraphicSymbol(),this._set("view",null)}intersectionDistance(t){const e=this.graphic;if(!1===e.visible)return null;const o=e.geometry;if(null==o)return null;const i=this._get("focusedSymbol"),s=null!=i?i:e.symbol;return"2d"===this.view.type?this._intersectDistance2D(this.view,t,o,s):this._intersectDistance3D(this.view,t,e)}attach(){this.attachSymbolChanged(),null!=this.layer&&this.layer.add(this.graphic)}detach(){this.detachSymbolChanged(),this._resetGraphicSymbol(),null!=this.layer&&this.layer.remove(this.graphic)}attachSymbolChanged(){this.detachSymbolChanged(),this._graphicSymbolChangedHandle=i((()=>this.graphic?.symbol),(t=>{null!=t&&t!==this.focusedSymbol&&t!==this._originalSymbol&&(this._originalSymbol=t,this._focused&&null!=this.focusedSymbol&&(this.graphic.symbol=this.focusedSymbol))}),s)}detachSymbolChanged(){null!=this._graphicSymbolChangedHandle&&(this._graphicSymbolChangedHandle.remove(),this._graphicSymbolChangedHandle=null)}onElevationChange(){}onViewChange(){}_updateGraphicSymbol(){this.graphic.symbol=this._focused&&null!=this.focusedSymbol?this.focusedSymbol:this._originalSymbol}_resetGraphicSymbol(){this.graphic.symbol=this._originalSymbol}_intersectDistance2D(t,e,o,i){if(null==(i=i||d(o)))return null;const s=1;let n=this._circleCollisionCache;if("point"===o.type&&"cim"===i.type&&"CIMPointSymbol"===i.data.symbol?.type&&i.data.symbol.symbolLayers){const{offsetX:l,offsetY:n,size:a}=_(i),c=r(e,j),p=a/2,m=t.toScreen(o),u=m.x+l,y=m.y+n;return h(c,[u,y])<p*p?s:null}if("point"!==o.type||"simple-marker"!==i.type)return v(e,o,t)?s:null;if(null==n||!n.originalPoint.equals(o)){const e=o,s=t.spatialReference;if(u(e.spatialReference,s)){const t=y(e,s);n={originalPoint:e.clone(),mapPoint:t,radiusPx:l(i.size)},this._circleCollisionCache=n}}if(null!=n){const o=r(e,j),a=t.toScreen?.(n.mapPoint);if(!a)return null;const c=n.radiusPx,p=a.x+l(i.xoffset),m=a.y-l(i.yoffset);return h(o,[p,m])<c*c?s:null}return null}_intersectDistance3D(t,e,o){const i=t.toMap(e,{include:[o]});return i&&g(i,C,t.renderSpatialReference)?p(C,t.state.camera.eye):null}};t([a({constructOnly:!0,nonNullable:!0})],S.prototype,"graphic",null),t([a()],S.prototype,"elevationInfo",null),t([a({constructOnly:!0,nonNullable:!0})],S.prototype,"view",void 0),t([a({value:null})],S.prototype,"focusedSymbol",null),t([a({constructOnly:!0})],S.prototype,"layer",void 0),t([a()],S.prototype,"interactive",void 0),t([a()],S.prototype,"selectable",void 0),t([a()],S.prototype,"grabbable",void 0),t([a({value:!1})],S.prototype,"grabbing",null),t([a()],S.prototype,"dragging",void 0),t([a()],S.prototype,"hovering",null),t([a({value:!1})],S.prototype,"selected",null),t([a()],S.prototype,"cursor",void 0),S=t([c("esri.views.interactive.GraphicManipulator")],S);const C=m(),j=n();export{S as GraphicManipulator};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import o from"../../core/Evented.js";import{watch as i,sync as s}from"../../core/reactiveUtils.js";import{screenPointObjectToArray as r,pt2px as l,createScreenPointArray as n}from"../../core/screenUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{squaredDistance as h}from"../../core/libs/gl-matrix-2/math/vec2.js";import{q as p}from"../../chunks/vec32.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as u,project as y}from"../../geometry/projection.js";import{projectPointToVector as g}from"../../geometry/projection/projectPointToVector.js";import{getGraphicEffectiveElevationMode as b}from"../../support/elevationInfoUtils.js";import{getDefaultSymbol2D as d}from"../../symbols/support/defaults.js";import f from"../../symbols/support/ElevationInfo.js";import{getSymbolInfo as _}from"./support/utils.js";import{intersectsDrapedGeometry as v}from"../support/drapedUtils.js";let S=class extends e{set graphic(t){this._circleCollisionCache=null,this._originalSymbol=t.symbol,this._set("graphic",t),this.attachSymbolChanged()}get elevationInfo(){const{layer:t}=this.graphic,e=t&&"elevationInfo"in t?t.elevationInfo:null,o=b(this.graphic),i=e?e.offset:0;return new f({mode:o,offset:i})}set focusedSymbol(t){t!==this._get("focusedSymbol")&&(this._set("focusedSymbol",t),this._updateGraphicSymbol(),this._circleCollisionCache=null)}grabbableForEvent(){return!0}set grabbing(t){t!==this._get("grabbing")&&(this._set("grabbing",t),this._updateGraphicSymbol())}set hovering(t){t!==this._get("hovering")&&(this._set("hovering",t),this._updateGraphicSymbol())}set selected(t){t!==this._get("selected")&&(this._set("selected",t),this._updateGraphicSymbol(),this.events.emit("select-changed",{action:t?"select":"deselect"}))}get _focused(){return this._get("hovering")||this._get("grabbing")}constructor(t){super(t),this.layer=null,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.dragging=!1,this.cursor=null,this.consumesClicks=!0,this.events=new o.EventEmitter,this._circleCollisionCache=null,this._graphicSymbolChangedHandle=null,this._originalSymbol=null}destroy(){this.detachSymbolChanged(),this._resetGraphicSymbol(),this._set("view",null)}intersectionDistance(t){const e=this.graphic;if(!1===e.visible)return null;const o=e.geometry;if(null==o)return null;const i=this._get("focusedSymbol"),s=null!=i?i:e.symbol;return"2d"===this.view.type?this._intersectDistance2D(this.view,t,o,s):this._intersectDistance3D(this.view,t,e)}attach(){this.attachSymbolChanged(),null!=this.layer&&this.layer.add(this.graphic)}detach(){this.detachSymbolChanged(),this._resetGraphicSymbol(),null!=this.layer&&this.layer.remove(this.graphic)}attachSymbolChanged(){this.detachSymbolChanged(),this._graphicSymbolChangedHandle=i((()=>this.graphic?.symbol),(t=>{null!=t&&t!==this.focusedSymbol&&t!==this._originalSymbol&&(this._originalSymbol=t,this._focused&&null!=this.focusedSymbol&&(this.graphic.symbol=this.focusedSymbol))}),s)}detachSymbolChanged(){null!=this._graphicSymbolChangedHandle&&(this._graphicSymbolChangedHandle.remove(),this._graphicSymbolChangedHandle=null)}onElevationChange(){}onViewChange(){}_updateGraphicSymbol(){this.graphic.symbol=this._focused&&null!=this.focusedSymbol?this.focusedSymbol:this._originalSymbol}_resetGraphicSymbol(){this.graphic.symbol=this._originalSymbol}_intersectDistance2D(t,e,o,i){if(null==(i=i||d(o)))return null;const s=1;let n=this._circleCollisionCache;if("point"===o.type&&"cim"===i.type&&"CIMPointSymbol"===i.data.symbol?.type&&i.data.symbol.symbolLayers){const{offsetX:l,offsetY:n,size:a}=_(i),c=r(e,j),p=a/2,m=t.toScreen(o),u=m.x+l,y=m.y+n;return h(c,[u,y])<p*p?s:null}if("point"!==o.type||"simple-marker"!==i.type)return v(e,o,t)?s:null;if(null==n||!n.originalPoint.equals(o)){const e=o,s=t.spatialReference;if(u(e.spatialReference,s)){const t=y(e,s);n={originalPoint:e.clone(),mapPoint:t,radiusPx:l(i.size)},this._circleCollisionCache=n}}if(null!=n){const o=r(e,j),a=t.toScreen?.(n.mapPoint);if(!a)return null;const c=n.radiusPx,p=a.x+l(i.xoffset),m=a.y-l(i.yoffset);return h(o,[p,m])<c*c?s:null}return null}_intersectDistance3D(t,e,o){const i=t.toMap(e,{include:[o]});return i&&g(i,C,t.renderSpatialReference)?p(C,t.state.camera.eye):null}};t([a({constructOnly:!0,nonNullable:!0})],S.prototype,"graphic",null),t([a()],S.prototype,"elevationInfo",null),t([a({constructOnly:!0,nonNullable:!0})],S.prototype,"view",void 0),t([a({value:null})],S.prototype,"focusedSymbol",null),t([a({constructOnly:!0})],S.prototype,"layer",void 0),t([a()],S.prototype,"interactive",void 0),t([a()],S.prototype,"selectable",void 0),t([a()],S.prototype,"grabbable",void 0),t([a({value:!1})],S.prototype,"grabbing",null),t([a()],S.prototype,"dragging",void 0),t([a()],S.prototype,"hovering",null),t([a({value:!1})],S.prototype,"selected",null),t([a()],S.prototype,"cursor",void 0),S=t([c("esri.views.interactive.GraphicManipulator")],S);const C=m(),j=n();export{S as GraphicManipulator};
@@ -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 t}from"../../chunks/tslib.es6.js";import e from"../../Color.js";import o from"../../core/Accessor.js";import{createTask as s}from"../../core/asyncUtils.js";import{multiplyOpacity as r,getContrast as i,BrightnessThreshold as n}from"../../core/colorUtils.js";import{makeHandle as l}from"../../core/handleUtils.js";import{deg2rad as a}from"../../core/mathUtils.js";import{throwIfAborted as c}from"../../core/promiseUtils.js";import{formatLength as p}from"../../core/quantityFormatUtils.js";import{watch as h,on as m}from"../../core/reactiveUtils.js";import{createScreenPointArray as d}from"../../core/screenUtils.js";import{getMetersPerUnit as u,getMetersPerVerticalUnitForSR as f}from"../../core/unitUtils.js";import{property as b}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{squaredDistance as x,set as _,normalize as y,scale as v,lerp as j,add as L}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as U}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{F as I}from"../../chunks/vec32.js";import{isClockwise as C}from"../../geometry/support/coordsUtils.js";import{sv3d as w}from"../../geometry/support/vectorStacks.js";import{fetchMessageBundle as k}from"../../intl/messages.js";import{getConvertedElevationFromVector as D,absoluteHeightElevationInfo as S}from"../../support/elevationInfoUtils.js";import{getDefaultUnitForView as O}from"../../support/getDefaultUnitForView.js";import P from"../overlay/TextOverlayItem.js";import{autoDistance2D as V}from"../support/automaticLengthMeasurementUtils.js";const M=3025,A={default:15,far:25};let G=class extends o{constructor(t){super(t),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance="default",this._messagesUnits=null,this._labelInfos=[],this._nextLabelIndex=0}initialize(){const t=s((async t=>{const e=await k("esri/core/t9n/Units");c(t),this._messagesUnits=e}));this.addHandles([h((()=>[null!=this.context&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits]),(()=>this._update())),...["vertex-add","vertex-update","vertex-remove"].map((t=>m((()=>this.context?.editGeometryOperations),t,(()=>this._update())))),l((()=>t.abort())),h((()=>this._colors),(t=>this._updateStyle(t)))])}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop())}get updating(){return null==this._messagesUnits}get test(){return{labelContents:this._labelInfos.slice(0,this._nextLabelIndex).map((t=>t.label.text))}}get _edgeDistancePixels(){return A[this.edgeDistance]}get _colors(){const t=this.context?.view.effectiveTheme.textColor??e.fromArray([255,255,255]);return{textColor:t,backgroundColor:r(i(t,n.Low),.6)}}_update(){if(this.destroyed)return;this._nextLabelIndex=0;const{context:t,stagedVertex:e}=this;if(!t)return this._destroyUnusedLabels();const{editGeometryOperations:o}=t,{components:s,geometry:r,coordinateHelper:i}=o.data;if(!r)return this._destroyUnusedLabels();const n=s.length;for(let l=0;l<n;++l){const s=F(r,o,e,i,l);if(s.length<2||!R(s,t.view,t.elevationInfo,i.spatialReference))continue;const a=1===n&&!C(s);let c=T,p=X;this.toScreenPointArray(t,s[0],c);for(let e=1;e<s.length;++e){const o=s[e-1],r=s[e];this.toScreenPointArray(t,r,p),this._addLabel(t,o,c,r,p,a),[c,p]=[p,c]}}this._destroyUnusedLabels()}_updateStyle({textColor:t,backgroundColor:e}){const o=this._nextLabelIndex,s=this._labelInfos;for(let r=0;r<o;++r){const{label:o}=s[r];o.textColor=t,o.backgroundColor=e}}_addLabel(t,e,o,s,r,i){const{label:n}=this._getOrCreateLabel(t);if(!this.visible||x(o,r)<M)return void(n.visible=!1);const{spatialReference:l}=t.editGeometryOperations.data,a=V(e,s,l),c=this._messagesUnits,h=O(t.view);n.text=null!=c&&null!=a?p(c,a,h):"",n.visible=!0;const m=r[0]-o[0],d=r[1]-o[1];i?_(z,-d,m):_(z,d,-m),y(z,z),v(z,z,this._edgeDistancePixels),j(H,o,r,.5),L(H,H,z),n.position=[H[0],H[1]],Math.abs(z[0])>Math.abs(z[1])?n.anchor=z[0]>0?"left":"right":n.anchor=-z[1]<0?"top":"bottom"}_getOrCreateLabel(t){const e=this._labelInfos.length>this._nextLabelIndex,{textColor:o,backgroundColor:s}=this._colors;if(e){const t=this._labelInfos[this._nextLabelIndex++],{label:e}=t;return e.textColor=o,e.backgroundColor=s,t}const r=new P({anchor:"center",fontSize:8,textColor:o,backgroundColor:s});t.view.overlay?.items.add(r);const i={label:r};return this._labelInfos.push(i),this._nextLabelIndex=this._labelInfos.length,i}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:t}){this.context?.view.overlay?.items.remove(t),t.destroy()}};function F(t,e,o,s,r){const i=[];if(e.data.components[r].iterateVertices((t=>{i.push(s.toXYZ(t.pos,w.get()))})),0===r&&null!=o&&i.push(s.toXYZ(o,w.get())),i.length<2)return i;const n=i[0],l=i[i.length-1];return"polygon"===t.type&&i.length>2&&!I(n,l)&&i.push(n),i}function R(t,e,o,s){if("2d"===e.type)return!0;const r=u(s)??1,i=f(s),n=t=>D(e,t,s,o,S)??0;for(let l=1;l<t.length;++l){const e=t[l-1],o=t[l],s=(o[0]-e[0])*r,a=(o[1]-e[1])*r,c=(n(o)-n(e))*i;if(Math.abs(c)/Math.sqrt(s*s+a*a)>q)return!1}return!0}t([b()],G.prototype,"context",void 0),t([b()],G.prototype,"stagedVertex",void 0),t([b()],G.prototype,"visible",void 0),t([b()],G.prototype,"edgeDistance",void 0),t([b()],G.prototype,"updating",null),t([b()],G.prototype,"_messagesUnits",void 0),t([b()],G.prototype,"_edgeDistancePixels",null),t([b()],G.prototype,"_colors",null),G=t([g("esri.views.interactive")],G);const q=a(5),z=U(),H=U(),T=d(),X=d();export{G as SegmentLabels};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Color.js";import o from"../../core/Accessor.js";import{createTask as s}from"../../core/asyncUtils.js";import{multiplyOpacity as r,getContrast as i,BrightnessThreshold as n}from"../../core/colorUtils.js";import{makeHandle as l}from"../../core/handleUtils.js";import{deg2rad as a}from"../../core/mathUtils.js";import{throwIfAborted as c}from"../../core/promiseUtils.js";import{formatLength as p}from"../../core/quantityFormatUtils.js";import{watch as h,on as m}from"../../core/reactiveUtils.js";import{createScreenPointArray as d}from"../../core/screenUtils.js";import{getMetersPerUnit as u,getMetersPerVerticalUnitForSR as f}from"../../core/unitUtils.js";import{property as b}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{squaredDistance as x,set as _,normalize as y,scale as v,lerp as j,add as L}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as U}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{G as I}from"../../chunks/vec32.js";import{isClockwise as C}from"../../geometry/support/coordsUtils.js";import{sv3d as w}from"../../geometry/support/vectorStacks.js";import{fetchMessageBundle as k}from"../../intl/messages.js";import{getConvertedElevationFromVector as D,absoluteHeightElevationInfo as S}from"../../support/elevationInfoUtils.js";import{getDefaultUnitForView as O}from"../../support/getDefaultUnitForView.js";import P from"../overlay/TextOverlayItem.js";import{autoDistance2D as V}from"../support/automaticLengthMeasurementUtils.js";const G=3025,M={default:15,far:25};let A=class extends o{constructor(t){super(t),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance="default",this._messagesUnits=null,this._labelInfos=[],this._nextLabelIndex=0}initialize(){const t=s((async t=>{const e=await k("esri/core/t9n/Units");c(t),this._messagesUnits=e}));this.addHandles([h((()=>[null!=this.context&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits]),(()=>this._update())),...["vertex-add","vertex-update","vertex-remove"].map((t=>m((()=>this.context?.editGeometryOperations),t,(()=>this._update())))),l((()=>t.abort())),h((()=>this._colors),(t=>this._updateStyle(t)))])}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop())}get updating(){return null==this._messagesUnits}get test(){return{labelContents:this._labelInfos.slice(0,this._nextLabelIndex).map((t=>t.label.text))}}get _edgeDistancePixels(){return M[this.edgeDistance]}get _colors(){const t=this.context?.view.effectiveTheme.textColor??e.fromArray([255,255,255]);return{textColor:t,backgroundColor:r(i(t,n.Low),.6)}}_update(){if(this.destroyed)return;this._nextLabelIndex=0;const{context:t,stagedVertex:e}=this;if(!t)return this._destroyUnusedLabels();const{editGeometryOperations:o}=t,{components:s,geometry:r,coordinateHelper:i}=o.data;if(!r)return this._destroyUnusedLabels();const n=s.length;for(let l=0;l<n;++l){const s=R(r,o,e,i,l);if(s.length<2||!q(s,t.view,t.elevationInfo,i.spatialReference))continue;const a=1===n&&!C(s);let c=T,p=X;this.toScreenPointArray(t,s[0],c);for(let e=1;e<s.length;++e){const o=s[e-1],r=s[e];this.toScreenPointArray(t,r,p),this._addLabel(t,o,c,r,p,a),[c,p]=[p,c]}}this._destroyUnusedLabels()}_updateStyle({textColor:t,backgroundColor:e}){const o=this._nextLabelIndex,s=this._labelInfos;for(let r=0;r<o;++r){const{label:o}=s[r];o.textColor=t,o.backgroundColor=e}}_addLabel(t,e,o,s,r,i){const{label:n}=this._getOrCreateLabel(t);if(!this.visible||x(o,r)<G)return void(n.visible=!1);const{spatialReference:l}=t.editGeometryOperations.data,a=V(e,s,l),c=this._messagesUnits,h=O(t.view);n.text=null!=c&&null!=a?p(c,a,h):"",n.visible=!0;const m=r[0]-o[0],d=r[1]-o[1];i?_(F,-d,m):_(F,d,-m),y(F,F),v(F,F,this._edgeDistancePixels),j(H,o,r,.5),L(H,H,F),n.position=[H[0],H[1]],Math.abs(F[0])>Math.abs(F[1])?n.anchor=F[0]>0?"left":"right":n.anchor=-F[1]<0?"top":"bottom"}_getOrCreateLabel(t){const e=this._labelInfos.length>this._nextLabelIndex,{textColor:o,backgroundColor:s}=this._colors;if(e){const t=this._labelInfos[this._nextLabelIndex++],{label:e}=t;return e.textColor=o,e.backgroundColor=s,t}const r=new P({anchor:"center",fontSize:8,textColor:o,backgroundColor:s});t.view.overlay?.items.add(r);const i={label:r};return this._labelInfos.push(i),this._nextLabelIndex=this._labelInfos.length,i}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:t}){this.context?.view.overlay?.items.remove(t),t.destroy()}};function R(t,e,o,s,r){const i=[];if(e.data.components[r].iterateVertices((t=>{i.push(s.toXYZ(t.pos,w.get()))})),0===r&&null!=o&&i.push(s.toXYZ(o,w.get())),i.length<2)return i;const n=i[0],l=i[i.length-1];return"polygon"===t.type&&i.length>2&&!I(n,l)&&i.push(n),i}function q(t,e,o,s){if("2d"===e.type)return!0;const r=u(s)??1,i=f(s),n=t=>D(e,t,s,o,S)??0;for(let l=1;l<t.length;++l){const e=t[l-1],o=t[l],s=(o[0]-e[0])*r,a=(o[1]-e[1])*r,c=(n(o)-n(e))*i;if(Math.abs(c)/Math.sqrt(s*s+a*a)>z)return!1}return!0}t([b()],A.prototype,"context",void 0),t([b()],A.prototype,"stagedVertex",void 0),t([b()],A.prototype,"visible",void 0),t([b()],A.prototype,"edgeDistance",void 0),t([b()],A.prototype,"updating",null),t([b()],A.prototype,"_messagesUnits",void 0),t([b()],A.prototype,"_edgeDistancePixels",null),t([b()],A.prototype,"_colors",null),A=t([g("esri.views.interactive")],A);const z=a(5),F=U(),H=U(),T=d(),X=d();export{A as SegmentLabels};
@@ -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{lerp as e,distance as r,copy as t,equals as a}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as i,fromValues as o,fromArray as n}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s,k as u,p as c,c as p,F as h}from"../../chunks/vec32.js";import{create as v,fromValues as l,fromArray as y}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{l as d,c as f,e as m}from"../../chunks/vec42.js";import{create as T,fromValues as Z,fromArray as _}from"../../core/libs/gl-matrix-2/factories/vec4f64.js";import g from"../../geometry/Point.js";var x;!function(e){e[e.Z=0]="Z",e[e.M=1]="M"}(x||(x={}));class R{constructor(e){this.spatialReference=e}createVector(){return this._tag(i())}pointToVector(e){return this._tag(o(e.x,e.y))}arrayToVector(e){return this._tag(o(e[0],e[1]))}vectorToArray(e){return[e[0],e[1]]}pointToArray(e){return[e.x,e.y]}vectorToPoint(e,r=new g){return r.x=e[0],r.y=e[1],r.z=void 0,r.m=void 0,r.spatialReference=this.spatialReference,r}arrayToPoint(e,r=new g){return r.x=e[0],r.y=e[1],r.z=void 0,r.m=void 0,r.spatialReference=this.spatialReference,r}vectorToDehydratedPoint(e,r){if(e)return r??={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"},r.x=e[0],r.y=e[1],r.z=void 0,r.m=void 0,r.hasZ=!1,r.hasM=!1,r.spatialReference=this.spatialReference,r}lerp(r,t,a,i){return e(i,r,t,a)}addDelta(e,r,t){e[0]+=r,e[1]+=t}distance(e,t){return r(e,t)}getZ(e,r=void 0){return r}hasZ(){return!1}getM(e,r=void 0){return r}hasM(){return!1}clone(e){return this._tag(n(e))}copy(e,r){return t(r,e)}fromXYZ(e){return this._tag(o(e[0],e[1]))}toXYZ(e,r=v()){return s(r,e[0],e[1],0)}pointToXYZ(e,r=v()){return s(r,e.x,e.y,0)}equals(e,r){return a(e,r)}_tag(e){return e}}class M{constructor(e,r){this._valueType=e,this.spatialReference=r}createVector(){return this._tag(v())}pointToVector(e){return this._tag(l(e.x,e.y,this._valueType===x.Z?e.z:e.m))}arrayToVector(e){return this._tag(l(e[0],e[1],e[2]||0))}vectorToArray(e){return[e[0],e[1],e[2]]}pointToArray(e){return this._valueType===x.Z?[e.x,e.y,e.z]:[e.x,e.y,e.m]}vectorToPoint(e,r=new g){return r.x=e[0],r.y=e[1],r.z=this._valueType===x.Z?e[2]:void 0,r.m=this._valueType===x.M?e[2]:void 0,r.spatialReference=this.spatialReference,r}arrayToPoint(e,r=new g){return r.x=e[0],r.y=e[1],r.z=this._valueType===x.Z?e[2]:void 0,r.m=this._valueType===x.M?e[2]:void 0,r.spatialReference=this.spatialReference,r}vectorToDehydratedPoint(e,r){if(!e)return;r??={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"};const t=this._valueType===x.Z,a=this._valueType===x.M;return r.x=e[0],r.y=e[1],r.z=t?e[2]:void 0,r.m=a?e[2]:void 0,r.hasZ=t,r.hasM=a,r.spatialReference=this.spatialReference,r}lerp(e,r,t,a){return u(a,e,r,t)}addDelta(e,r,t,a){e[0]+=r,e[1]+=t,this._valueType===x.Z&&(e[2]+=a)}distance(e,t){return this._valueType===x.Z?c(e,t):r(w(e),w(t))}getZ(e,r=void 0){return this._valueType===x.Z?e[2]:r}hasZ(){return this._valueType===x.Z}getM(e,r=void 0){return this._valueType===x.M?e[2]:r}hasM(){return this._valueType===x.M}clone(e){return this._tag(y(e))}copy(e,r){return p(r,e)}fromXYZ(e,r=0,t=0){return this._tag(l(e[0],e[1],this._valueType===x.Z?e.length>2?e[2]:r:t))}toXYZ(e,r=v()){return s(r,e[0],e[1],this._valueType===x.Z?e[2]:0)}pointToXYZ(e,r=v()){return s(r,e.x,e.y,this._valueType===x.Z?e.z??0:0)}equals(e,r){return h(e,r)}_tag(e){return e}}class z{constructor(e){this.spatialReference=e}createVector(){return this._tag(T())}pointToVector(e){return this._tag(Z(e.x,e.y,e.z,e.m))}arrayToVector(e){return this._tag(Z(e[0],e[1],e[2]||0,e[3]||0))}vectorToArray(e){return[e[0],e[1],e[2],e[3]]}pointToArray(e){return[e.x,e.y,e.z,e.m]}vectorToPoint(e,r=new g){return r.x=e[0],r.y=e[1],r.z=e[2],r.m=e[3],r.spatialReference=this.spatialReference,r}arrayToPoint(e,r=new g){return r.x=e[0],r.y=e[1],r.z=e[2],r.m=e[3],r.spatialReference=this.spatialReference,r}vectorToDehydratedPoint(e,r){if(e)return r??={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"},r.x=e[0],r.y=e[1],r.z=e[2],r.m=e[3],r.hasZ=!0,r.hasM=!0,r.spatialReference=this.spatialReference,r}lerp(e,r,t,a){return d(a,e,r,t)}addDelta(e,r,t,a){e[0]+=r,e[1]+=t,e[2]+=a}distance(e,r){return c(V(e),V(r))}getZ(e){return e[2]}hasZ(){return!0}getM(e){return e[3]}hasM(){return!0}clone(e){return this._tag(_(e))}copy(e,r){return f(r,e)}fromXYZ(e,r=0,t=0){return this._tag(Z(e[0],e[1],e.length>2?e[2]:r,t))}toXYZ(e,r=v()){return s(r,e[0],e[1],e[2])}pointToXYZ(e,r=v()){return s(r,e.x,e.y,e.z??0)}equals(e,r){return m(e,r)}_tag(e){return e}}function V(e){return e}function w(e){return e}function P(e,r,t){return e&&r?new z(t):r?new M(x.M,t):e?new M(x.Z,t):new R(t)}export{R as CoordinateHelper2D,M as CoordinateHelper3D,z as CoordinateHelper4D,P as createCoordinateHelper};
5
+ import{lerp as e,distance as r,copy as t,equals as a}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as i,fromValues as o,fromArray as n}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s,m as u,q as c,c as h,G as p}from"../../chunks/vec32.js";import{create as v,fromValues as l,fromArray as y}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{l as d,c as f,e as m}from"../../chunks/vec42.js";import{create as T,fromValues as Z,fromArray as _}from"../../core/libs/gl-matrix-2/factories/vec4f64.js";import g from"../../geometry/Point.js";var x;!function(e){e[e.Z=0]="Z",e[e.M=1]="M"}(x||(x={}));class R{constructor(e){this.spatialReference=e}createVector(){return this._tag(i())}pointToVector(e){return this._tag(o(e.x,e.y))}arrayToVector(e){return this._tag(o(e[0],e[1]))}vectorToArray(e){return[e[0],e[1]]}pointToArray(e){return[e.x,e.y]}vectorToPoint(e,r=new g){return r.x=e[0],r.y=e[1],r.z=void 0,r.m=void 0,r.spatialReference=this.spatialReference,r}arrayToPoint(e,r=new g){return r.x=e[0],r.y=e[1],r.z=void 0,r.m=void 0,r.spatialReference=this.spatialReference,r}vectorToDehydratedPoint(e,r){if(e)return r??={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"},r.x=e[0],r.y=e[1],r.z=void 0,r.m=void 0,r.hasZ=!1,r.hasM=!1,r.spatialReference=this.spatialReference,r}lerp(r,t,a,i){return e(i,r,t,a)}addDelta(e,r,t){e[0]+=r,e[1]+=t}distance(e,t){return r(e,t)}getZ(e,r=void 0){return r}hasZ(){return!1}getM(e,r=void 0){return r}hasM(){return!1}clone(e){return this._tag(n(e))}copy(e,r){return t(r,e)}fromXYZ(e){return this._tag(o(e[0],e[1]))}toXYZ(e,r=v()){return s(r,e[0],e[1],0)}pointToXYZ(e,r=v()){return s(r,e.x,e.y,0)}equals(e,r){return a(e,r)}_tag(e){return e}}class M{constructor(e,r){this._valueType=e,this.spatialReference=r}createVector(){return this._tag(v())}pointToVector(e){return this._tag(l(e.x,e.y,this._valueType===x.Z?e.z:e.m))}arrayToVector(e){return this._tag(l(e[0],e[1],e[2]||0))}vectorToArray(e){return[e[0],e[1],e[2]]}pointToArray(e){return this._valueType===x.Z?[e.x,e.y,e.z]:[e.x,e.y,e.m]}vectorToPoint(e,r=new g){return r.x=e[0],r.y=e[1],r.z=this._valueType===x.Z?e[2]:void 0,r.m=this._valueType===x.M?e[2]:void 0,r.spatialReference=this.spatialReference,r}arrayToPoint(e,r=new g){return r.x=e[0],r.y=e[1],r.z=this._valueType===x.Z?e[2]:void 0,r.m=this._valueType===x.M?e[2]:void 0,r.spatialReference=this.spatialReference,r}vectorToDehydratedPoint(e,r){if(!e)return;r??={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"};const t=this._valueType===x.Z,a=this._valueType===x.M;return r.x=e[0],r.y=e[1],r.z=t?e[2]:void 0,r.m=a?e[2]:void 0,r.hasZ=t,r.hasM=a,r.spatialReference=this.spatialReference,r}lerp(e,r,t,a){return u(a,e,r,t)}addDelta(e,r,t,a){e[0]+=r,e[1]+=t,this._valueType===x.Z&&(e[2]+=a)}distance(e,t){return this._valueType===x.Z?c(e,t):r(w(e),w(t))}getZ(e,r=void 0){return this._valueType===x.Z?e[2]:r}hasZ(){return this._valueType===x.Z}getM(e,r=void 0){return this._valueType===x.M?e[2]:r}hasM(){return this._valueType===x.M}clone(e){return this._tag(y(e))}copy(e,r){return h(r,e)}fromXYZ(e,r=0,t=0){return this._tag(l(e[0],e[1],this._valueType===x.Z?e.length>2?e[2]:r:t))}toXYZ(e,r=v()){return s(r,e[0],e[1],this._valueType===x.Z?e[2]:0)}pointToXYZ(e,r=v()){return s(r,e.x,e.y,this._valueType===x.Z?e.z??0:0)}equals(e,r){return p(e,r)}_tag(e){return e}}class z{constructor(e){this.spatialReference=e}createVector(){return this._tag(T())}pointToVector(e){return this._tag(Z(e.x,e.y,e.z,e.m))}arrayToVector(e){return this._tag(Z(e[0],e[1],e[2]||0,e[3]||0))}vectorToArray(e){return[e[0],e[1],e[2],e[3]]}pointToArray(e){return[e.x,e.y,e.z,e.m]}vectorToPoint(e,r=new g){return r.x=e[0],r.y=e[1],r.z=e[2],r.m=e[3],r.spatialReference=this.spatialReference,r}arrayToPoint(e,r=new g){return r.x=e[0],r.y=e[1],r.z=e[2],r.m=e[3],r.spatialReference=this.spatialReference,r}vectorToDehydratedPoint(e,r){if(e)return r??={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"},r.x=e[0],r.y=e[1],r.z=e[2],r.m=e[3],r.hasZ=!0,r.hasM=!0,r.spatialReference=this.spatialReference,r}lerp(e,r,t,a){return d(a,e,r,t)}addDelta(e,r,t,a){e[0]+=r,e[1]+=t,e[2]+=a}distance(e,r){return c(V(e),V(r))}getZ(e){return e[2]}hasZ(){return!0}getM(e){return e[3]}hasM(){return!0}clone(e){return this._tag(_(e))}copy(e,r){return f(r,e)}fromXYZ(e,r=0,t=0){return this._tag(Z(e[0],e[1],e.length>2?e[2]:r,t))}toXYZ(e,r=v()){return s(r,e[0],e[1],e[2])}pointToXYZ(e,r=v()){return s(r,e.x,e.y,e.z??0)}equals(e,r){return m(e,r)}_tag(e){return e}}function V(e){return e}function w(e){return e}function P(e,r,t){return e&&r?new z(t):r?new M(x.M,t):e?new M(x.Z,t):new R(t)}export{R as CoordinateHelper2D,M as CoordinateHelper3D,z as CoordinateHelper4D,P as createCoordinateHelper};
@@ -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 t}from"../../../../core/mathUtils.js";import{subtract as i,normalize as e,dot as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{D as r,s as h,b as o,n as a,h as _,j as c,E as l,g as p,F as g,c as d}from"../../../../chunks/vec32.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as m,fromPositionAndNormal as f,signedDistance as D,copy as E,isPointInside as x,getNormal as b,intersectLine as I}from"../../../../geometry/support/plane.js";import{angle as M,projectPointSignedLength as N}from"../../../../geometry/support/vector.js";import{intersectLineAndRay as V,LineType as X}from"../../../support/geometry2dUtils.js";class Y{get plane(){return this._plane}get requiresSplitEdgeLeft(){return!this._left.isOriginalDirection}get requiresSplitEdgeRight(){return!this._right.isOriginalDirection}get edgeDirection(){return this._edgeDirection}constructor(t,i,e,s=0,n=y.IMMEDIATE){this._helper=t,this._planeType=i,this._edge=e,this.distance=s,this._plane=m(),this._offsetPlane=m(),this._minDistance=-1/0,this._maxDistance=1/0,this._selectedArrow=1,n===y.IMMEDIATE&&this._initialize()}_initialize(){this._initializeNeighbors(),this._initializePlane(),this._initializeDistanceConstraints()}_initializeNeighbors(){const t=this._toXYZ(this._edge.leftVertex.pos),i=this._toXYZ(this._edge.leftVertex.leftEdge?.leftVertex?.pos),e=this._toXYZ(this._edge.rightVertex.pos),s=this._toXYZ(this._edge.rightVertex.rightEdge?.rightVertex?.pos);this._edgeDirection=r(u(),t,e),i?(this._left=this._computeNeighbor(t,i,this._edgeDirection),this._right=this._computeNeighbor(e,s,this._edgeDirection,this._left)):(this._right=this._computeNeighbor(e,s,this._edgeDirection),this._left=this._computeNeighbor(t,i,this._edgeDirection,this._right))}_toXYZ(t){return null!=t?this._helper.toXYZ(t):null}_pointToXYZ(t){return this._toXYZ(this._helper.pointToVector(t))}_computeNeighbor(t,i,e,s){const n=u();if(i){r(n,t,i);const s=!this._passesBisectingAngleThreshold(n,e);return{start:t,end:i,direction:s?this._bisectVectorsPerpendicular(e,n):n,isOriginalDirection:!s}}return this._helper.hasZ()?s&&(o(n,e,s.direction),o(n,n,e),a(n,n),Math.sign(n[1])!==Math.sign(e[0])&&_(n,n,-1)):h(n,-e[1],e[0],0),{start:t,end:i,direction:n,isOriginalDirection:!0}}_passesBisectingAngleThreshold(t,i){const e=Math.abs(M(i,t));return e>=P&&e<=Math.PI-P}_bisectVectorsPerpendicular(t,i){const e=c(t,i)<0?t:l(u(),t),s=Math.abs(c(e,i));if(!(s<T||s>1-T))return this._bisectDirection(e,i);const n=o(u(),e,[0,0,1]);return a(n,n)}_bisectDirection(t,i){const e=p(u(),t,i);return a(e,e)}_initializePlane(){const t=this._computeNormalDirection(this._left),i=this._computeNormalDirection(this._right);c(t,i)<0&&l(i,i),f(this._left.start,this._bisectDirection(t,i),this._plane)}_computeNormalDirection(t){const i=o(u(),t.direction,this._edgeDirection);a(i,i);const e=o(u(),this._edgeDirection,i);return this._planeType===Z.XY&&(e[2]=0),a(e,e)}_initializeDistanceConstraints(){null==this._left.end||this.requiresSplitEdgeLeft||this._updateDistanceConstraint(D(this._plane,this._left.end)),null==this._right.end||this.requiresSplitEdgeRight||this._updateDistanceConstraint(D(this._plane,this._right.end)),this._updateIntersectDistanceConstraint(this._plane)}_updateDistanceConstraint(t){t<=0&&(this._minDistance=Math.max(this._minDistance,t)),t>=0&&(this._maxDistance=Math.min(this._maxDistance,t))}_updateIntersectDistanceConstraint(t){const r=b(t),h=this._edgeDirection,o=p(u(),this._left.start,this._left.direction),a=p(u(),this._right.start,this._right.direction),c=this._pointInBasis2D(n(),r,h,this._left.start),l=this._pointInBasis2D(n(),r,h,o),g=this._pointInBasis2D(n(),r,h,this._right.start),d=this._pointInBasis2D(n(),r,h,a),[m]=V({start:l,end:c,type:X.LINE},{start:d,end:g,type:X.LINE});if(!m)return;const f=i(n(),c,l);e(f,f);const E=i(n(),m,l),x=s(f,E),I=p(u(),o,_(u(),this._left.direction,-x)),M=D(t,I);this._updateDistanceConstraint(M)}_pointInBasis2D(t,i,e,s){return t[0]=N(i,s),t[1]=N(e,s),t}_offset(t,i){Number.isFinite(this._minDistance)&&(i=Math.max(this._minDistance,i)),Number.isFinite(this._maxDistance)&&(i=Math.min(this._maxDistance,i)),E(this._offsetPlane,this._plane),this._offsetPlane[3]-=i;const e=(t,i,e)=>null!=i&&I(this._offsetPlane,t,p(u(),t,i),e),s=u();(t===this._edge.leftVertex?e(this._left.start,this._left.direction,s):e(this._right.start,this._right.direction,s))&&this._helper.copy(this._helper.fromXYZ(s,void 0,this._helper.getM(t.pos)),t.pos)}selectArrowFromStartPoint(t){this._selectedArrow=x(this.plane,this._pointToXYZ(t))?1:-1}get selectedArrow(){return this._selectedArrow}signedDistanceToPoint(t){return D(this.plane,this._pointToXYZ(t))}apply(t){this._offset(t,this.distance)}undo(t){this._offset(t,0)}canAccumulate(t){return t instanceof Y&&this._edge.leftVertex.index===t._edge.leftVertex.index&&this._edge.rightVertex.index===t._edge.rightVertex.index&&this._edge.component===t._edge.component&&this._maybeEqualsVec3(this._left.direction,t._left.direction)&&this._maybeEqualsVec3(this._right.direction,t._right.direction)&&g(b(this._plane),b(t._plane))}accumulate(t,i){const e=this._plane[3]-i._plane[3]+i.distance;this._offset(t,e)}accumulateParams(t){const i=t.distance-t._plane[3];this.distance=i+this._plane[3]}clone(){const t=new Y(this._helper,this._planeType,this._edge,this.distance,y.DEFERRED);return E(t._plane,this._plane),E(t._offsetPlane,this._offsetPlane),t._maxDistance=this._maxDistance,t._minDistance=this._minDistance,t._left=this._cloneNeighbor(this._left),t._right=this._cloneNeighbor(this._right),t._edgeDirection=d(u(),this._edgeDirection),t}_maybeEqualsVec3(t,i){return null==t&&null==i||null!=t&&null!=i&&g(t,i)}_cloneNeighbor({start:t,end:i,direction:e,isOriginalDirection:s}){return{start:d(u(),t),end:null!=i?d(u(),i):null,direction:d(u(),e),isOriginalDirection:s}}}const P=t(15),T=.001;var Z,y;!function(t){t[t.XYZ=0]="XYZ",t[t.XY=1]="XY"}(Z||(Z={})),function(t){t[t.IMMEDIATE=0]="IMMEDIATE",t[t.DEFERRED=1]="DEFERRED"}(y||(y={}));export{Y as OffsetEdgeVertex,Z as PlaneType};
5
+ import{deg2rad as t}from"../../../../core/mathUtils.js";import{subtract as i,normalize as e,dot as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{E as r,s as h,b as o,n as a,h as _,k as c,F as l,g as p,G as g,c as d}from"../../../../chunks/vec32.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as m,fromPositionAndNormal as f,signedDistance as D,copy as E,isPointInside as x,getNormal as b,intersectLine as I}from"../../../../geometry/support/plane.js";import{angle as M,projectPointSignedLength as N}from"../../../../geometry/support/vector.js";import{intersectLineAndRay as V,LineType as X}from"../../../support/geometry2dUtils.js";class Y{get plane(){return this._plane}get requiresSplitEdgeLeft(){return!this._left.isOriginalDirection}get requiresSplitEdgeRight(){return!this._right.isOriginalDirection}get edgeDirection(){return this._edgeDirection}constructor(t,i,e,s=0,n=y.IMMEDIATE){this._helper=t,this._planeType=i,this._edge=e,this.distance=s,this._plane=m(),this._offsetPlane=m(),this._minDistance=-1/0,this._maxDistance=1/0,this._selectedArrow=1,n===y.IMMEDIATE&&this._initialize()}_initialize(){this._initializeNeighbors(),this._initializePlane(),this._initializeDistanceConstraints()}_initializeNeighbors(){const t=this._toXYZ(this._edge.leftVertex.pos),i=this._toXYZ(this._edge.leftVertex.leftEdge?.leftVertex?.pos),e=this._toXYZ(this._edge.rightVertex.pos),s=this._toXYZ(this._edge.rightVertex.rightEdge?.rightVertex?.pos);this._edgeDirection=r(u(),t,e),i?(this._left=this._computeNeighbor(t,i,this._edgeDirection),this._right=this._computeNeighbor(e,s,this._edgeDirection,this._left)):(this._right=this._computeNeighbor(e,s,this._edgeDirection),this._left=this._computeNeighbor(t,i,this._edgeDirection,this._right))}_toXYZ(t){return null!=t?this._helper.toXYZ(t):null}_pointToXYZ(t){return this._toXYZ(this._helper.pointToVector(t))}_computeNeighbor(t,i,e,s){const n=u();if(i){r(n,t,i);const s=!this._passesBisectingAngleThreshold(n,e);return{start:t,end:i,direction:s?this._bisectVectorsPerpendicular(e,n):n,isOriginalDirection:!s}}return this._helper.hasZ()?s&&(o(n,e,s.direction),o(n,n,e),a(n,n),Math.sign(n[1])!==Math.sign(e[0])&&_(n,n,-1)):h(n,-e[1],e[0],0),{start:t,end:i,direction:n,isOriginalDirection:!0}}_passesBisectingAngleThreshold(t,i){const e=Math.abs(M(i,t));return e>=P&&e<=Math.PI-P}_bisectVectorsPerpendicular(t,i){const e=c(t,i)<0?t:l(u(),t),s=Math.abs(c(e,i));if(!(s<T||s>1-T))return this._bisectDirection(e,i);const n=o(u(),e,[0,0,1]);return a(n,n)}_bisectDirection(t,i){const e=p(u(),t,i);return a(e,e)}_initializePlane(){const t=this._computeNormalDirection(this._left),i=this._computeNormalDirection(this._right);c(t,i)<0&&l(i,i),f(this._left.start,this._bisectDirection(t,i),this._plane)}_computeNormalDirection(t){const i=o(u(),t.direction,this._edgeDirection);a(i,i);const e=o(u(),this._edgeDirection,i);return this._planeType===Z.XY&&(e[2]=0),a(e,e)}_initializeDistanceConstraints(){null==this._left.end||this.requiresSplitEdgeLeft||this._updateDistanceConstraint(D(this._plane,this._left.end)),null==this._right.end||this.requiresSplitEdgeRight||this._updateDistanceConstraint(D(this._plane,this._right.end)),this._updateIntersectDistanceConstraint(this._plane)}_updateDistanceConstraint(t){t<=0&&(this._minDistance=Math.max(this._minDistance,t)),t>=0&&(this._maxDistance=Math.min(this._maxDistance,t))}_updateIntersectDistanceConstraint(t){const r=b(t),h=this._edgeDirection,o=p(u(),this._left.start,this._left.direction),a=p(u(),this._right.start,this._right.direction),c=this._pointInBasis2D(n(),r,h,this._left.start),l=this._pointInBasis2D(n(),r,h,o),g=this._pointInBasis2D(n(),r,h,this._right.start),d=this._pointInBasis2D(n(),r,h,a),[m]=V({start:l,end:c,type:X.LINE},{start:d,end:g,type:X.LINE});if(!m)return;const f=i(n(),c,l);e(f,f);const E=i(n(),m,l),x=s(f,E),I=p(u(),o,_(u(),this._left.direction,-x)),M=D(t,I);this._updateDistanceConstraint(M)}_pointInBasis2D(t,i,e,s){return t[0]=N(i,s),t[1]=N(e,s),t}_offset(t,i){Number.isFinite(this._minDistance)&&(i=Math.max(this._minDistance,i)),Number.isFinite(this._maxDistance)&&(i=Math.min(this._maxDistance,i)),E(this._offsetPlane,this._plane),this._offsetPlane[3]-=i;const e=(t,i,e)=>null!=i&&I(this._offsetPlane,t,p(u(),t,i),e),s=u();(t===this._edge.leftVertex?e(this._left.start,this._left.direction,s):e(this._right.start,this._right.direction,s))&&this._helper.copy(this._helper.fromXYZ(s,void 0,this._helper.getM(t.pos)),t.pos)}selectArrowFromStartPoint(t){this._selectedArrow=x(this.plane,this._pointToXYZ(t))?1:-1}get selectedArrow(){return this._selectedArrow}signedDistanceToPoint(t){return D(this.plane,this._pointToXYZ(t))}apply(t){this._offset(t,this.distance)}undo(t){this._offset(t,0)}canAccumulate(t){return t instanceof Y&&this._edge.leftVertex.index===t._edge.leftVertex.index&&this._edge.rightVertex.index===t._edge.rightVertex.index&&this._edge.component===t._edge.component&&this._maybeEqualsVec3(this._left.direction,t._left.direction)&&this._maybeEqualsVec3(this._right.direction,t._right.direction)&&g(b(this._plane),b(t._plane))}accumulate(t,i){const e=this._plane[3]-i._plane[3]+i.distance;this._offset(t,e)}accumulateParams(t){const i=t.distance-t._plane[3];this.distance=i+this._plane[3]}clone(){const t=new Y(this._helper,this._planeType,this._edge,this.distance,y.DEFERRED);return E(t._plane,this._plane),E(t._offsetPlane,this._offsetPlane),t._maxDistance=this._maxDistance,t._minDistance=this._minDistance,t._left=this._cloneNeighbor(this._left),t._right=this._cloneNeighbor(this._right),t._edgeDirection=d(u(),this._edgeDirection),t}_maybeEqualsVec3(t,i){return null==t&&null==i||null!=t&&null!=i&&g(t,i)}_cloneNeighbor({start:t,end:i,direction:e,isOriginalDirection:s}){return{start:d(u(),t),end:null!=i?d(u(),i):null,direction:d(u(),e),isOriginalDirection:s}}}const P=t(15),T=.001;var Z,y;!function(t){t[t.XYZ=0]="XYZ",t[t.XY=1]="XY"}(Z||(Z={})),function(t){t[t.IMMEDIATE=0]="IMMEDIATE",t[t.DEFERRED=1]="DEFERRED"}(y||(y={}));export{Y as OffsetEdgeVertex,Z as PlaneType};
@@ -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{projectAndScale as o,set as i,dot as r,min as t,max as s,subtract as n,add as e,scale as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{g as c,J as f,h as m}from"../../../../chunks/vec32.js";import{fromValues as p,ZEROS as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{u,a as b}from"../../../../chunks/boundedPlane.js";import{sv2d as I}from"../../../../geometry/support/vectorStacks.js";import{MoveVertex as N}from"../operations/MoveVertex.js";import{RotateVertex as j}from"../operations/RotateVertex.js";import{ScaleVertex as l}from"../operations/ScaleVertex.js";import{UpdateVertices as x}from"../operations/UpdateVertices.js";function d(o,i){return T(o,i,!1)}function E(o,i){return T(o,i,!0)}function T(o,i,r){if(o instanceof x){if(o.operation instanceof N)return V(o.operation,i,r),!0;if(o.operation instanceof j)return h(o.operation,i,r),!0;if(o.operation instanceof l)return v(o.operation,i,r),!0}return!1}function V(o,i,r=!1){const t=r?-1:1,s=p(t*o.dx,t*o.dy,t*o.dz);c(i.origin,i.origin,s),u(i)}function h(o,i,r=!1){const t=r?-o.angle:o.angle;f(i.basis1,i.basis1,g,t),f(i.basis2,i.basis2,g,t),u(i)}function v(i,r,t=!1){const s=t?1/i.factor1:i.factor1,n=t?1/i.factor2:i.factor2;m(r.basis1,r.basis1,s),m(r.basis2,r.basis2,n),o(r.origin,r.origin,i.origin,i.axis1,s),o(r.origin,r.origin,i.origin,i.axis2,n),u(r)}function F(o,c,f,m){m||(m=b());const p=i(I.get(),o[1],-o[0]),g=i(I.get(),Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),N=i(I.get(),Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),j=I.get();c.components.forEach((n=>n.vertices.forEach((({pos:n})=>{i(j,r(o,n),r(p,n)),t(g,g,j),s(N,N,j)}))));const l=1e-6,x=i(I.get(),N[0]-g[0]<l?f/2:0,N[1]-g[1]<l?f/2:0);return n(g,g,x),e(N,N,x),a(m.basis1,o,(N[0]-g[0])/2),a(m.basis2,p,(N[1]-g[1])/2),i(m.origin,g[0]*o[0]+g[1]*p[0],g[0]*o[1]+g[1]*p[1]),e(m.origin,m.origin,m.basis1),e(m.origin,m.origin,m.basis2),u(m),m}export{d as apply,E as applyInverse,F as calculateOrientedBounds};
5
+ import{projectAndScale as o,set as i,dot as r,min as t,max as s,subtract as n,add as e,scale as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{g as c,K as f,h as m}from"../../../../chunks/vec32.js";import{fromValues as p,ZEROS as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{u,a as b}from"../../../../chunks/boundedPlane.js";import{sv2d as I}from"../../../../geometry/support/vectorStacks.js";import{MoveVertex as N}from"../operations/MoveVertex.js";import{RotateVertex as j}from"../operations/RotateVertex.js";import{ScaleVertex as l}from"../operations/ScaleVertex.js";import{UpdateVertices as x}from"../operations/UpdateVertices.js";function d(o,i){return T(o,i,!1)}function E(o,i){return T(o,i,!0)}function T(o,i,r){if(o instanceof x){if(o.operation instanceof N)return V(o.operation,i,r),!0;if(o.operation instanceof j)return h(o.operation,i,r),!0;if(o.operation instanceof l)return v(o.operation,i,r),!0}return!1}function V(o,i,r=!1){const t=r?-1:1,s=p(t*o.dx,t*o.dy,t*o.dz);c(i.origin,i.origin,s),u(i)}function h(o,i,r=!1){const t=r?-o.angle:o.angle;f(i.basis1,i.basis1,g,t),f(i.basis2,i.basis2,g,t),u(i)}function v(i,r,t=!1){const s=t?1/i.factor1:i.factor1,n=t?1/i.factor2:i.factor2;m(r.basis1,r.basis1,s),m(r.basis2,r.basis2,n),o(r.origin,r.origin,i.origin,i.axis1,s),o(r.origin,r.origin,i.origin,i.axis2,n),u(r)}function F(o,c,f,m){m||(m=b());const p=i(I.get(),o[1],-o[0]),g=i(I.get(),Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),N=i(I.get(),Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),j=I.get();c.components.forEach((n=>n.vertices.forEach((({pos:n})=>{i(j,r(o,n),r(p,n)),t(g,g,j),s(N,N,j)}))));const l=1e-6,x=i(I.get(),N[0]-g[0]<l?f/2:0,N[1]-g[1]<l?f/2:0);return n(g,g,x),e(N,N,x),a(m.basis1,o,(N[0]-g[0])/2),a(m.basis2,p,(N[1]-g[1])/2),i(m.origin,g[0]*o[0]+g[1]*p[0],g[0]*o[1]+g[1]*p[1]),e(m.origin,m.origin,m.basis1),e(m.origin,m.origin,m.basis2),u(m),m}export{d as apply,E as applyInverse,F as calculateOrientedBounds};
@@ -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{isSome as t,equals as e}from"../../../core/arrayUtils.js";import{asinClamped as s}from"../../../core/mathUtils.js";import{dot as r,subtract as n,exactEquals as i,set as o,squaredDistance as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{q as a,i as h,a as f,y as l,o as d,s as p,c as m,f as g,F as L,j as k,b as _,n as M}from"../../../chunks/vec32.js";import{clone as P,create as x,fromValues as y,UNIT_Z as v}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as T,h as q}from"../../../chunks/vec42.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{toRadians as j}from"../../../geometry/support/geodesicConstants.js";import{directGeodeticSolver as z,inverseGeodeticSolver as A,InverseGeodeticSolverResult as b}from"../../../geometry/support/geodesicUtils.js";import{create as D,intersectLine as E,signedDistance as N,projectPoint as R,fromPositionAndNormal as U,fromPoints as Z,distance as I,getNormal as S}from"../../../geometry/support/plane.js";import{b as C,l as G,p as O,g as F,m as H}from"../../../chunks/sphere.js";import{tangentFrame as V}from"../../3d/support/mathUtils.js";import{fromVec3 as Y,clone as B,fromValues as J,asVec2 as K,create as Q}from"./normalizedPoint.js";import{vectorsHaveCloseZ as W,isClose as X,intersectVerticalPlaneAndVerticalCylinder as $,isPointInsidePlane as tt,projectPointToLineLike as et,projectPointToVerticalCylinder as st,projectPointToVerticalPlane as rt,VerticalPlaneType as nt,intersectLineLikes as it,intersectVerticalPlaneAndLineLike as ot,intersectLineLikeAndVerticalCylinder as ct,intersectLineLikeAndCircle as ut,intersectVerticalPlanes as at,intersectVerticalCylinders as ht,pointsInsidePlane as ft,intersectVerticalPlaneAndPoint as lt}from"../../support/geometry3dUtils.js";import{LineType as dt}from"../../support/geometry2dUtils.js";class pt{intersect(t){return Ot(this,t)}closestPoints(t){return[this.closestTo(t)]}}class mt extends pt{constructor(t){super(),this.point=t}equals(t){return this===t||ge(t)&&h(this.point,t.point)}closestTo(){return B(this.point)}}class gt extends pt{constructor(t,e,s){super(),this.start=t,this.end=e,this.lineLike={start:t,end:e,type:s}}equals(t){return this===t||Le(t)&&this.lineLike.type===t.lineLike.type&&h(this.start,t.start)&&h(this.end,t.end)}closestTo(t){const e=et(t,this.lineLike);return Y(e)}}class Lt extends gt{constructor(t,e){super(t,e,dt.LINE)}}class kt extends gt{constructor(t,e){super(t,e,dt.RAY)}}class _t extends pt{constructor(t){super(),this.constraints=t}equals(t){return this===t||me(t)&&e(this.constraints,t.constraints,((t,e)=>t.equals(e)))}closestTo(t){let e,s=1/0;for(const r of this.constraints){const n=r.closestTo(t),i=f(t,n);i<s&&(s=i,e=n)}return e?B(e):t}closestPoints(t){return this.constraints.flatMap((e=>e===this?[]:e.closestPoints(t)))}}class Mt extends pt{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||Me(t)&&this.center[0]===t.center[0]&&this.center[1]===t.center[1]&&this.radius===t.radius}closestTo(t){const e=st(t,this.center,this.radius);return Y(e)}}class Pt extends pt{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||Pe(t)&&h(this.center,t.center)&&this.radius===t.radius}closestTo(t){const e=st(t,this.center,this.radius);return e[2]=this.center[2],Y(e)}asCircle(){return new xt(B(this.center),this.radius,J(0,0,1))}}class xt extends pt{constructor(t,e,s,r=void 0){super(),this.center=t,this.radius=e,this.normal=s,this.slicePlane=r}equals(t){return this===t||xe(t)&&h(this.center,t.center)&&h(this.normal,t.normal)&&this.radius===t.radius}closestTo(t){const{center:e,radius:s}=this;R(this.getPlane(vt),t,yt);const r=l(yt,yt,e),n=d(r);if(X(n,0))return B(t);const i=s/Math.sqrt(n),o=a(x(),e,r,i),{slicePlane:c}=this;if(c&&!tt(c,o)){const e=Yt(c,this);return e?.closestTo(t)??B(t)}return Y(o)}getPlane(t=D()){return U(this.center,this.normal,t)}}const yt=x(),vt=D();class Tt extends pt{constructor(t){super(),this.z=t}equals(t){return this===t||ke(t)&&this.z===t.z}closestTo(t){return Y(y(t[0],t[1],this.z))}getPlane(t=D()){return p(qt,0,0,this.z),U(qt,v,t)}}const qt=x();class wt extends pt{constructor(t,e,s){super(),this.start=t,this.end=e,this.planeLike={start:K(t),end:K(e),type:s}}equals(t){return this===t||_e(t)&&this.planeLike.type===t.planeLike.type&&h(this.start,t.start)&&h(this.end,t.end)}closestTo(t){return Y(rt(t,this.planeLike))}closestEndTo(t){const{start:e,end:s}=this.planeLike;return Math.sign(r(n(jt,s,e),n(zt,K(t),e)))>0?this.end:this.start}getPlane(t=D()){const e=m(At,this.end);return e[2]+=1,Z(this.start,this.end,e,t)}getSlicePlane(t=D()){const{start:e,end:s,type:r}=this.planeLike;if(r===nt.PLANE)return;const n=p(At,e[0],e[1],0),i=p(bt,s[0],s[1],0),o=g(bt,i,n);return U(n,o,t),t}}const jt=u(),zt=u(),At=x(),bt=x();class Dt extends wt{constructor(t,e){super(t,e,nt.HALF_PLANE)}}class Et extends wt{constructor(t,e){super(t,e,nt.PLANE)}}class Nt extends pt{constructor(t,e){super(),this.sphere=C(t,e)}equals(t){return this===t||ye(t)&&G(this.sphere,t.sphere)}closestTo(t){const e=O(this.sphere,t,x());return Y(e)}get center(){return F(this.sphere)}get radius(){return this.sphere[3]}}class Rt extends pt{constructor(t,e,s){super(),this.start=t,this.end=e,this.getZ=s,this.planeLike={start:K(t),end:K(e),type:nt.PLANE}}equals(t){return this===t||ve(t)&&h(this.start,t.start)&&h(this.end,t.end)&&this.getZ===t.getZ}closestTo(t){return Gt(this,t)}addIfOnTheGround(t,e){for(const s of e){const e=this.getZ(s[0],s[1])??0;X(s[2],e)&&(s[2]=e,t.push(s))}}}class Ut extends pt{constructor(t,e,s,r,n){super(),this._origin=t,this._spatialReference=e,this._distanceMeters=s,this._elevationMeters=r,this._directionDegrees=n}equals(t){return this===t||Te(t)&&i(this._origin,t._origin)&&this._distanceMeters===t._distanceMeters&&this._elevationMeters===t._elevationMeters&&this._directionDegrees===t._directionDegrees}closestTo([t,e,s]){if(o(Zt,t,e),null!=this._directionDegrees&&null!=this._distanceMeters)z(Zt,this._origin,this._directionDegrees,this._distanceMeters,this._spatialReference);else if(null!=this._directionDegrees)St(Zt,this._origin,this._directionDegrees,Zt,this._spatialReference);else if(null!=this._distanceMeters){const{azimuth:t}=A(It,this._origin,Zt,this._spatialReference);z(Zt,this._origin,t??0,this._distanceMeters,this._spatialReference)}return Q(Zt[0],Zt[1],this._elevationMeters??s)}}const Zt=[0,0],It=new b;function St(t,e,s,r,n){let{azimuth:i,distance:o}=A(Ct,e,r,n);i??=0;let c=o*Math.cos((i-s)*j);c=Math.max(0,c),z(t,e,s,c,n)}const Ct=new b;function Gt(t,e){const s=rt(e,t.planeLike);return s[2]=t.getZ(s[0],s[1])??qe,Y(s)}function Ot(t,e){if(me(t)){const s=[];for(const r of t.constraints){const t=r.intersect(e);t&&s.push(t)}return pe(s)}if(me(e))return Ot(e,t);if(ve(t))return he(t,e);if(ve(e))return he(e,t);if(ge(t)){const{point:s}=t;if(ge(e))return h(s,e.point)?t:void 0;const r=e.closestTo(s);return L(r,s)?t:void 0}if(Le(t)){if(ge(e))return Ot(e,t);if(Le(e))return le(it(t.lineLike,e.lineLike));if(ke(e))return Ft(t,e);if(_e(e))return le(ot(e.planeLike,t.lineLike));if(Me(e))return le(ct(t.lineLike,e.center,e.radius));if(xe(e))return le(ut(t.lineLike,e));if(Pe(e))return Ht(t,e);if(ye(e))return Vt(t,e)}else if(ke(t)){if(ge(e)||Le(e))return Ot(e,t);if(ke(e))return Bt(t,e);if(_e(e))return Jt(t,e);if(Me(e))return Kt(t,e);if(xe(e))return Wt(t,e);if(Pe(e))return Qt(t,e);if(ye(e))return Xt(t,e)}else if(_e(t)){if(ge(e)||Le(e)||ke(e))return Ot(e,t);if(_e(e))return fe(at(t.planeLike,e.planeLike));if(Me(e))return fe($(t.planeLike,e.center,e.radius));if(xe(e))return te(t,e);if(Pe(e))return $t(t,e);if(ye(e))return ee(t,e)}else if(Me(t)){if(ge(e)||Le(e)||ke(e)||_e(e))return Ot(e,t);if(Me(e))return fe(ht(K(t.center),t.radius,K(e.center),e.radius));if(xe(e))return se();if(Pe(e))return re(t,e);if(ye(e))return ne()}else if(xe(t)){if(ge(e)||Le(e)||ke(e)||_e(e)||Me(e))return Ot(e,t);if(xe(e))return ie();if(Pe(e))return ie(e.asCircle());if(ye(e))return oe()}else if(Pe(t)){if(ge(e)||Le(e)||ke(e)||_e(e)||Me(e)||xe(e))return Ot(e,t);if(Pe(e))return ce(e,t);if(ye(e))return ue()}else if(ye(t)){if(ge(e)||Le(e)||ke(e)||_e(e)||Me(e)||Pe(e))return Ot(e,t);if(ye(e))return ae()}}const Ft=(()=>{const t=D();return(e,s)=>{const{start:r,end:n}=e;if(W(r,n)&&X(r[2],s.z))return e;const i=x();return E(s.getPlane(t),r,n,i)?new mt(Y(i)):void 0}})();function Ht({lineLike:t},{center:e,radius:s}){const r=e[2];return le(ct(t,e,s).filter((t=>X(t[2],r))))}function Vt({lineLike:t},{sphere:e}){return le(H(e,t.start,t.end))}const Yt=(()=>{const t=w(),e=x(),r=x();return(n,i,o)=>{const{normal:c,center:u,radius:h}=i;V(c,e,r);const f=S(n),l=h*k(f,e),d=h*k(f,r);T(t,u[0],u[1],u[2],1);const p=q(n,t),m=Math.hypot(l,d),g=X(m,0);if(X(I(n,u),0)){if(g)return i;if(X(h,0))return!o||tt(o,u)?new mt(B(u)):void 0;_(e,f,c),M(e,e);const t=new Array,s=P(u);a(s,s,e,h),o&&!tt(o,s)||t.push(s);const r=P(u);return a(r,r,e,-h),o&&!tt(o,r)||t.push(r),le(t)}if(g)return;const L=-p/m;if(Math.abs(L)>1||X(L,1))return;const y=Math.atan(l/d),v=s(L)-y,w=Math.PI-v,j=new Array,z=x();a(z,u,e,h*Math.cos(v)),a(z,z,r,h*Math.sin(v)),j.push(z);const A=x();return a(A,u,e,h*Math.cos(w)),a(A,A,r,h*Math.sin(w)),j.push(A),le(o?ft(o,j):j)}})();function Bt(t,e){return X(t.z,e.z)?t:void 0}function Jt({z:t},{planeLike:e}){const[s,r]=e.start,[n,i]=e.end,o=J(s,r,t),c=J(n,i,t);return e.type===nt.PLANE?new Lt(o,c):new kt(o,c)}function Kt(t,e){const[s,r]=e.center;return new Pt(J(s,r,t.z),e.radius)}function Qt(t,e){return X(e.center[2],t.z)?e:void 0}const Wt=(()=>{const t=D();return(e,s)=>Yt(e.getPlane(t),s,s.slicePlane)})();function Xt(t,{center:e,radius:s}){const r=Math.abs(e[2]-t.z);if(r>s&&!X(r,s))return;const n=J(e[0],e[1],t.z),i=Math.sqrt(s**2-r**2);return X(i,0)?void 0:new Pt(n,i)}const $t=(()=>{const t=D();return(e,{center:s,radius:r})=>{const n=$(e.planeLike,s,r),i=s[2];e.getSlicePlane(t);const o=new Array;for(const[c,u]of n){const e=[c,u,i];tt(t,e)&&o.push(e)}return le(o)}})(),te=(()=>{const t=D(),e=D();return(s,r)=>Yt(s.getPlane(t),r,s.getSlicePlane(e))})(),ee=(()=>{const t=D();return(e,{center:s,radius:r})=>{const n=e.getPlane(t),i=N(n,s),o=Math.abs(i);if(o>r&&!X(o,r))return;const c=P(S(n)),u=a(x(),s,c,i),h=Math.sqrt(r**2-i**2);return X(h,0)?new mt(Y(R(n,s,x()))):new xt(Y(u),h,c,e.getSlicePlane())}})();function se(t,e){}function re(t,e){const s=c(K(t.center),K(e.center));if(X(s,0)&&X(t.radius,e.radius))return e;return de(ht(K(t.center),t.radius,K(e.center),e.radius),e.center[2])}function ne(t,e){}function ie(t,e){}function oe(t,e){}function ce(t,e){if(!W(t.center,e.center))return;const s=c(K(t.center),K(e.center));if(X(s,0)&&X(t.radius,e.radius))return t;return de(ht(K(t.center),t.radius,K(e.center),e.radius),t.center[2])}function ue(t,e){}function ae(t,e){}function he(t,e){const{planeLike:s,getZ:r}=t,n=new Array;if(ge(e))t.addIfOnTheGround(n,lt(s,e.point));else if(Le(e))t.addIfOnTheGround(n,ot(s,e.lineLike));else if(Me(e))for(const[i,o]of $(s,e.center,e.radius)){const t=r(i,o);null!=t&&n.push(y(i,o,t))}else if(_e(e)||ve(e))for(const[i,o]of at(s,e.planeLike)){const t=r(i,o)??qe;n.push(y(i,o,t))}return le(n)}function fe(t){return pe(t.map((([t,e])=>{const s=J(t,e,0),r=J(t,e,1);return new Lt(s,r)})))}function le(t){return pe(t.map((t=>t?new mt(Y(t)):void 0)))}function de(t,e){return le(t.map((([t,s])=>[t,s,e])))}function pe(e){if(0!==e.length)return 1===e.length?e[0]??void 0:new _t(e.filter(t))}function me(t){return t instanceof _t}function ge(t){return t instanceof mt}function Le(t){return t instanceof gt}function ke(t){return t instanceof Tt}function _e(t){return t instanceof wt}function Me(t){return t instanceof Mt}function Pe(t){return t instanceof Pt}function xe(t){return t instanceof xt}function ye(t){return t instanceof Nt}function ve(t){return t instanceof Rt}function Te(t){return t instanceof Ut}const qe=0;export{xt as CircleConstraint,pt as Constraint,Rt as DrapedLineConstraint,Ut as GeodesicConstraint,Pt as HorizontalCircleConstraint,Tt as HorizontalPlaneConstraint,Lt as LineConstraint,gt as LineLikeConstraint,mt as PointConstraint,kt as RayConstraint,_t as SetConstraint,Nt as SphereConstraint,Mt as VerticalCylinderConstraint,Dt as VerticalHalfPlaneConstraint,Et as VerticalPlaneConstraint,wt as VerticalPlaneLikeConstraint,pe as constraintOrSet,ge as isPoint};
5
+ import{isSome as t,equals as e}from"../../../core/arrayUtils.js";import{asinClamped as s}from"../../../core/mathUtils.js";import{dot as r,subtract as n,exactEquals as i,set as o,squaredDistance as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{r as a,j as h,a as f,z as l,p as d,s as p,c as m,f as g,G as L,k,b as _,n as M}from"../../../chunks/vec32.js";import{clone as P,create as x,fromValues as v,UNIT_Z as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as T,h as w}from"../../../chunks/vec42.js";import{create as j}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{toRadians as q}from"../../../geometry/support/geodesicConstants.js";import{directGeodeticSolver as z,inverseGeodeticSolver as A,InverseGeodeticSolverResult as b}from"../../../geometry/support/geodesicUtils.js";import{create as D,intersectLine as E,signedDistance as N,projectPoint as R,fromPositionAndNormal as U,fromPoints as Z,distance as I,getNormal as G}from"../../../geometry/support/plane.js";import{b as S,l as C,p as O,g as F,m as H}from"../../../chunks/sphere.js";import{tangentFrame as V}from"../../3d/support/mathUtils.js";import{fromVec3 as Y,clone as B,fromValues as J,asVec2 as K,create as Q}from"./normalizedPoint.js";import{vectorsHaveCloseZ as W,isClose as X,intersectVerticalPlaneAndVerticalCylinder as $,isPointInsidePlane as tt,projectPointToLineLike as et,projectPointToVerticalCylinder as st,projectPointToVerticalPlane as rt,VerticalPlaneType as nt,intersectLineLikes as it,intersectVerticalPlaneAndLineLike as ot,intersectLineLikeAndVerticalCylinder as ct,intersectLineLikeAndCircle as ut,intersectVerticalPlanes as at,intersectVerticalCylinders as ht,pointsInsidePlane as ft,intersectVerticalPlaneAndPoint as lt}from"../../support/geometry3dUtils.js";import{LineType as dt}from"../../support/geometry2dUtils.js";class pt{intersect(t){return Ot(this,t)}closestPoints(t){return[this.closestTo(t)]}}class mt extends pt{constructor(t){super(),this.point=t}equals(t){return this===t||ge(t)&&h(this.point,t.point)}closestTo(){return B(this.point)}}class gt extends pt{constructor(t,e,s){super(),this.start=t,this.end=e,this.lineLike={start:t,end:e,type:s}}equals(t){return this===t||Le(t)&&this.lineLike.type===t.lineLike.type&&h(this.start,t.start)&&h(this.end,t.end)}closestTo(t){const e=et(t,this.lineLike);return Y(e)}}class Lt extends gt{constructor(t,e){super(t,e,dt.LINE)}}class kt extends gt{constructor(t,e){super(t,e,dt.RAY)}}class _t extends pt{constructor(t){super(),this.constraints=t}equals(t){return this===t||me(t)&&e(this.constraints,t.constraints,((t,e)=>t.equals(e)))}closestTo(t){let e,s=1/0;for(const r of this.constraints){const n=r.closestTo(t),i=f(t,n);i<s&&(s=i,e=n)}return e?B(e):t}closestPoints(t){return this.constraints.flatMap((e=>e===this?[]:e.closestPoints(t)))}}class Mt extends pt{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||Me(t)&&this.center[0]===t.center[0]&&this.center[1]===t.center[1]&&this.radius===t.radius}closestTo(t){const e=st(t,this.center,this.radius);return Y(e)}}class Pt extends pt{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||Pe(t)&&h(this.center,t.center)&&this.radius===t.radius}closestTo(t){const e=st(t,this.center,this.radius);return e[2]=this.center[2],Y(e)}asCircle(){return new xt(B(this.center),this.radius,J(0,0,1))}}class xt extends pt{constructor(t,e,s,r=void 0){super(),this.center=t,this.radius=e,this.normal=s,this.slicePlane=r}equals(t){return this===t||xe(t)&&h(this.center,t.center)&&h(this.normal,t.normal)&&this.radius===t.radius}closestTo(t){const{center:e,radius:s}=this;R(this.getPlane(yt),t,vt);const r=l(vt,vt,e),n=d(r);if(X(n,0))return B(t);const i=s/Math.sqrt(n),o=a(x(),e,r,i),{slicePlane:c}=this;if(c&&!tt(c,o)){const e=Yt(c,this);return e?.closestTo(t)??B(t)}return Y(o)}getPlane(t=D()){return U(this.center,this.normal,t)}}const vt=x(),yt=D();class Tt extends pt{constructor(t){super(),this.z=t}equals(t){return this===t||ke(t)&&this.z===t.z}closestTo(t){return Y(v(t[0],t[1],this.z))}getPlane(t=D()){return p(wt,0,0,this.z),U(wt,y,t)}}const wt=x();class jt extends pt{constructor(t,e,s){super(),this.start=t,this.end=e,this.planeLike={start:K(t),end:K(e),type:s}}equals(t){return this===t||_e(t)&&this.planeLike.type===t.planeLike.type&&h(this.start,t.start)&&h(this.end,t.end)}closestTo(t){return Y(rt(t,this.planeLike))}closestEndTo(t){const{start:e,end:s}=this.planeLike;return Math.sign(r(n(qt,s,e),n(zt,K(t),e)))>0?this.end:this.start}getPlane(t=D()){const e=m(At,this.end);return e[2]+=1,Z(this.start,this.end,e,t)}getSlicePlane(t=D()){const{start:e,end:s,type:r}=this.planeLike;if(r===nt.PLANE)return;const n=p(At,e[0],e[1],0),i=p(bt,s[0],s[1],0),o=g(bt,i,n);return U(n,o,t),t}}const qt=u(),zt=u(),At=x(),bt=x();class Dt extends jt{constructor(t,e){super(t,e,nt.HALF_PLANE)}}class Et extends jt{constructor(t,e){super(t,e,nt.PLANE)}}class Nt extends pt{constructor(t,e){super(),this.sphere=S(t,e)}equals(t){return this===t||ve(t)&&C(this.sphere,t.sphere)}closestTo(t){const e=O(this.sphere,t,x());return Y(e)}get center(){return F(this.sphere)}get radius(){return this.sphere[3]}}class Rt extends pt{constructor(t,e,s){super(),this.start=t,this.end=e,this.getZ=s,this.planeLike={start:K(t),end:K(e),type:nt.PLANE}}equals(t){return this===t||ye(t)&&h(this.start,t.start)&&h(this.end,t.end)&&this.getZ===t.getZ}closestTo(t){return Ct(this,t)}addIfOnTheGround(t,e){for(const s of e){const e=this.getZ(s[0],s[1])??0;X(s[2],e)&&(s[2]=e,t.push(s))}}}class Ut extends pt{constructor(t,e,s,r,n){super(),this._origin=t,this._spatialReference=e,this._distanceMeters=s,this._elevationMeters=r,this._directionDegrees=n}equals(t){return this===t||Te(t)&&i(this._origin,t._origin)&&this._distanceMeters===t._distanceMeters&&this._elevationMeters===t._elevationMeters&&this._directionDegrees===t._directionDegrees}closestTo([t,e,s]){if(o(Zt,t,e),null!=this._directionDegrees&&null!=this._distanceMeters)z(Zt,this._origin,this._directionDegrees,this._distanceMeters,this._spatialReference);else if(null!=this._directionDegrees)Gt(Zt,this._origin,this._directionDegrees,Zt,this._spatialReference);else if(null!=this._distanceMeters){const{azimuth:t}=A(It,this._origin,Zt,this._spatialReference);z(Zt,this._origin,t??0,this._distanceMeters,this._spatialReference)}return Q(Zt[0],Zt[1],this._elevationMeters??s)}}const Zt=[0,0],It=new b;function Gt(t,e,s,r,n){let{azimuth:i,distance:o}=A(St,e,r,n);i??=0;let c=o*Math.cos((i-s)*q);c=Math.max(0,c),z(t,e,s,c,n)}const St=new b;function Ct(t,e){const s=rt(e,t.planeLike);return s[2]=t.getZ(s[0],s[1])??we,Y(s)}function Ot(t,e){if(me(t)){const s=[];for(const r of t.constraints){const t=r.intersect(e);t&&s.push(t)}return pe(s)}if(me(e))return Ot(e,t);if(ye(t))return he(t,e);if(ye(e))return he(e,t);if(ge(t)){const{point:s}=t;if(ge(e))return h(s,e.point)?t:void 0;const r=e.closestTo(s);return L(r,s)?t:void 0}if(Le(t)){if(ge(e))return Ot(e,t);if(Le(e))return le(it(t.lineLike,e.lineLike));if(ke(e))return Ft(t,e);if(_e(e))return le(ot(e.planeLike,t.lineLike));if(Me(e))return le(ct(t.lineLike,e.center,e.radius));if(xe(e))return le(ut(t.lineLike,e));if(Pe(e))return Ht(t,e);if(ve(e))return Vt(t,e)}else if(ke(t)){if(ge(e)||Le(e))return Ot(e,t);if(ke(e))return Bt(t,e);if(_e(e))return Jt(t,e);if(Me(e))return Kt(t,e);if(xe(e))return Wt(t,e);if(Pe(e))return Qt(t,e);if(ve(e))return Xt(t,e)}else if(_e(t)){if(ge(e)||Le(e)||ke(e))return Ot(e,t);if(_e(e))return fe(at(t.planeLike,e.planeLike));if(Me(e))return fe($(t.planeLike,e.center,e.radius));if(xe(e))return te(t,e);if(Pe(e))return $t(t,e);if(ve(e))return ee(t,e)}else if(Me(t)){if(ge(e)||Le(e)||ke(e)||_e(e))return Ot(e,t);if(Me(e))return fe(ht(K(t.center),t.radius,K(e.center),e.radius));if(xe(e))return se();if(Pe(e))return re(t,e);if(ve(e))return ne()}else if(xe(t)){if(ge(e)||Le(e)||ke(e)||_e(e)||Me(e))return Ot(e,t);if(xe(e))return ie();if(Pe(e))return ie(e.asCircle());if(ve(e))return oe()}else if(Pe(t)){if(ge(e)||Le(e)||ke(e)||_e(e)||Me(e)||xe(e))return Ot(e,t);if(Pe(e))return ce(e,t);if(ve(e))return ue()}else if(ve(t)){if(ge(e)||Le(e)||ke(e)||_e(e)||Me(e)||Pe(e))return Ot(e,t);if(ve(e))return ae()}}const Ft=(()=>{const t=D();return(e,s)=>{const{start:r,end:n}=e;if(W(r,n)&&X(r[2],s.z))return e;const i=x();return E(s.getPlane(t),r,n,i)?new mt(Y(i)):void 0}})();function Ht({lineLike:t},{center:e,radius:s}){const r=e[2];return le(ct(t,e,s).filter((t=>X(t[2],r))))}function Vt({lineLike:t},{sphere:e}){return le(H(e,t.start,t.end))}const Yt=(()=>{const t=j(),e=x(),r=x();return(n,i,o)=>{const{normal:c,center:u,radius:h}=i;V(c,e,r);const f=G(n),l=h*k(f,e),d=h*k(f,r);T(t,u[0],u[1],u[2],1);const p=w(n,t),m=Math.hypot(l,d),g=X(m,0);if(X(I(n,u),0)){if(g)return i;if(X(h,0))return!o||tt(o,u)?new mt(B(u)):void 0;_(e,f,c),M(e,e);const t=new Array,s=P(u);a(s,s,e,h),o&&!tt(o,s)||t.push(s);const r=P(u);return a(r,r,e,-h),o&&!tt(o,r)||t.push(r),le(t)}if(g)return;const L=-p/m;if(Math.abs(L)>1||X(L,1))return;const v=Math.atan(l/d),y=s(L)-v,j=Math.PI-y,q=new Array,z=x();a(z,u,e,h*Math.cos(y)),a(z,z,r,h*Math.sin(y)),q.push(z);const A=x();return a(A,u,e,h*Math.cos(j)),a(A,A,r,h*Math.sin(j)),q.push(A),le(o?ft(o,q):q)}})();function Bt(t,e){return X(t.z,e.z)?t:void 0}function Jt({z:t},{planeLike:e}){const[s,r]=e.start,[n,i]=e.end,o=J(s,r,t),c=J(n,i,t);return e.type===nt.PLANE?new Lt(o,c):new kt(o,c)}function Kt(t,e){const[s,r]=e.center;return new Pt(J(s,r,t.z),e.radius)}function Qt(t,e){return X(e.center[2],t.z)?e:void 0}const Wt=(()=>{const t=D();return(e,s)=>Yt(e.getPlane(t),s,s.slicePlane)})();function Xt(t,{center:e,radius:s}){const r=Math.abs(e[2]-t.z);if(r>s&&!X(r,s))return;const n=J(e[0],e[1],t.z),i=Math.sqrt(s**2-r**2);return X(i,0)?void 0:new Pt(n,i)}const $t=(()=>{const t=D();return(e,{center:s,radius:r})=>{const n=$(e.planeLike,s,r),i=s[2];e.getSlicePlane(t);const o=new Array;for(const[c,u]of n){const e=[c,u,i];tt(t,e)&&o.push(e)}return le(o)}})(),te=(()=>{const t=D(),e=D();return(s,r)=>Yt(s.getPlane(t),r,s.getSlicePlane(e))})(),ee=(()=>{const t=D();return(e,{center:s,radius:r})=>{const n=e.getPlane(t),i=N(n,s),o=Math.abs(i);if(o>r&&!X(o,r))return;const c=P(G(n)),u=a(x(),s,c,i),h=Math.sqrt(r**2-i**2);return X(h,0)?new mt(Y(R(n,s,x()))):new xt(Y(u),h,c,e.getSlicePlane())}})();function se(t,e){}function re(t,e){const s=c(K(t.center),K(e.center));if(X(s,0)&&X(t.radius,e.radius))return e;return de(ht(K(t.center),t.radius,K(e.center),e.radius),e.center[2])}function ne(t,e){}function ie(t,e){}function oe(t,e){}function ce(t,e){if(!W(t.center,e.center))return;const s=c(K(t.center),K(e.center));if(X(s,0)&&X(t.radius,e.radius))return t;return de(ht(K(t.center),t.radius,K(e.center),e.radius),t.center[2])}function ue(t,e){}function ae(t,e){}function he(t,e){const{planeLike:s,getZ:r}=t,n=new Array;if(ge(e))t.addIfOnTheGround(n,lt(s,e.point));else if(Le(e))t.addIfOnTheGround(n,ot(s,e.lineLike));else if(Me(e))for(const[i,o]of $(s,e.center,e.radius)){const t=r(i,o);null!=t&&n.push(v(i,o,t))}else if(_e(e)||ye(e))for(const[i,o]of at(s,e.planeLike)){const t=r(i,o)??we;n.push(v(i,o,t))}return le(n)}function fe(t){return pe(t.map((([t,e])=>{const s=J(t,e,0),r=J(t,e,1);return new Lt(s,r)})))}function le(t){return pe(t.map((t=>t?new mt(Y(t)):void 0)))}function de(t,e){return le(t.map((([t,s])=>[t,s,e])))}function pe(e){if(0!==e.length)return 1===e.length?e[0]??void 0:new _t(e.filter(t))}function me(t){return t instanceof _t}function ge(t){return t instanceof mt}function Le(t){return t instanceof gt}function ke(t){return t instanceof Tt}function _e(t){return t instanceof jt}function Me(t){return t instanceof Mt}function Pe(t){return t instanceof Pt}function xe(t){return t instanceof xt}function ve(t){return t instanceof Nt}function ye(t){return t instanceof Rt}function Te(t){return t instanceof Ut}const we=0;export{xt as CircleConstraint,pt as Constraint,Rt as DrapedLineConstraint,Ut as GeodesicConstraint,Pt as HorizontalCircleConstraint,Tt as HorizontalPlaneConstraint,Lt as LineConstraint,gt as LineLikeConstraint,mt as PointConstraint,kt as RayConstraint,_t as SetConstraint,Nt as SphereConstraint,Mt as VerticalCylinderConstraint,Dt as VerticalHalfPlaneConstraint,Et as VerticalPlaneConstraint,jt as VerticalPlaneLikeConstraint,pe as constraintOrSet,ge as isPoint};
@@ -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{cyclical2PI as e}from"../../../core/Cyclical.js";import{createAngle as t,valueInUnit as r}from"../../../core/quantityUtils.js";import{subtract as i,dot as o,squaredLength as n,scaleAndAdd as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as c,s as p,q as h}from"../../../chunks/vec32.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as g}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as l}from"../sketch/constraints.js";import{fromAnyMapPoint as f,asVec2 as m,fromValues as u,fromVec3 as x}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as j}from"./SnappingAlgorithm.js";import{squaredScreenDistance as v}from"./snappingUtils.js";import{RightAngleSnappingCandidate as V,OtherVertexType as _}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as E}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as R,pointFromDistanceAlongAzimuth as y}from"../../support/angularMeasurementUtils.js";import{geodesicDistance as S}from"../../support/geodesicLengthMeasurementUtils.js";class k extends j{snapNewVertex(e,t){const r=t.editGeometryOperations.data.components[0],i=[];if(r.vertices.length<2)return i;const{view:o}=this,n=E(e,t.spatialReference,g,o),s=r.vertices.at(-1);this._checkForSnappingCandidate(i,s.leftEdge,s,s.leftEdge.leftVertex,e,n,t);const a=r.vertices[0];return this._checkForSnappingCandidate(i,a.rightEdge,a,a.rightEdge.rightVertex,e,n,t),i}snapExistingVertex(e,t){const r=[],i=t.vertexHandle;if(i.component.vertices.length<3)return r;const{view:o}=this,n=E(e,t.spatialReference,g,o),s=i.leftEdge,a=i.rightEdge;if(s?.leftVertex.leftEdge){const i=s.leftVertex.leftEdge;this._checkForSnappingCandidate(r,i,i.rightVertex,i.leftVertex,e,n,t)}if(a?.rightVertex.rightEdge){const i=a.rightVertex.rightEdge;this._checkForSnappingCandidate(r,i,i.leftVertex,i.rightVertex,e,n,t)}return r}_checkForSnappingCandidate(e,t,r,i,o,n,s){if(!this.edgeExceedsShortLineThreshold(t,s))return;const a=this.view,c=f(r.pos,a,s),p=f(i.pos,a,s);this._checkForSnappingCandidateNormalized(e,p,c,o,n,s)}_checkForSnappingCandidateNormalized(e,t,r,i,o,n){this._projectionRay(F,t,r,i,n),this._checkForSnappingCandidateAlongProjectedRay(e,t,r,F,i,o,n)}_projectionRay(e,t,r,i,o){this._projectionRayGeodesic(e,t,r,i,o)||this._projectionRayPlanar(e,t,r)}_projectionRayGeodesic(i,o,n,s,{spatialReference:a}){const p=R(o,n,a,a);if(null==p)return!1;const h=R(n,s,a,a);if(null==h)return!1;const g=Math.sign(e.shortestSignedDiff(p,h))*Math.PI*.5,l=t(p+g,"radians","geographic"),f=d(),m=S(n,s,a);return null!=m&&(y(f,n,a,r(m,"meters"),l,"geodesic"),c(i,f,n),!0)}_projectionRayPlanar(e,t,r){const o=i(C,m(r),m(t));p(e,o[1],-o[0],0)}_checkForSnappingCandidateAlongProjectedRay(e,t,r,a,c,p,f){const{spatialReference:j,pointer:R}=f,y=i(C,m(c),m(r)),S=o(a,y)/n(a),k=s(C,m(r),a,S),F=u(k[0],k[1],c[2]);if(v(p,E(F,j,g,this.view))>this.squaredProximityThreshold(R)||this.isVertical(F,r,f)||this.isVertical(r,t,f))return;const w=h(d(),r,a,Math.sign(S));e.push(new V({targetPoint:F,constraint:new l(r,x(w)),previousVertex:t,otherVertex:r,otherVertexType:_.CENTER,isDraped:"on-the-ground"===f.elevationInfo?.mode}))}}const C=a(),F=d();export{k as RightAngleSnapper};
5
+ import{cyclical2PI as e}from"../../../core/Cyclical.js";import{createAngle as t,valueInUnit as r}from"../../../core/quantityUtils.js";import{subtract as i,dot as o,squaredLength as n,scaleAndAdd as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{f as c,s as p,r as h}from"../../../chunks/vec32.js";import{create as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as g}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as l}from"../sketch/constraints.js";import{fromAnyMapPoint as f,asVec2 as m,fromValues as u,fromVec3 as x}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as j}from"./SnappingAlgorithm.js";import{squaredScreenDistance as v}from"./snappingUtils.js";import{RightAngleSnappingCandidate as V,OtherVertexType as _}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as E}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as R,pointFromDistanceAlongAzimuth as y}from"../../support/angularMeasurementUtils.js";import{geodesicDistance as S}from"../../support/geodesicLengthMeasurementUtils.js";class k extends j{snapNewVertex(e,t){const r=t.editGeometryOperations.data.components[0],i=[];if(r.vertices.length<2)return i;const{view:o}=this,n=E(e,t.spatialReference,g,o),s=r.vertices.at(-1);this._checkForSnappingCandidate(i,s.leftEdge,s,s.leftEdge.leftVertex,e,n,t);const a=r.vertices[0];return this._checkForSnappingCandidate(i,a.rightEdge,a,a.rightEdge.rightVertex,e,n,t),i}snapExistingVertex(e,t){const r=[],i=t.vertexHandle;if(i.component.vertices.length<3)return r;const{view:o}=this,n=E(e,t.spatialReference,g,o),s=i.leftEdge,a=i.rightEdge;if(s?.leftVertex.leftEdge){const i=s.leftVertex.leftEdge;this._checkForSnappingCandidate(r,i,i.rightVertex,i.leftVertex,e,n,t)}if(a?.rightVertex.rightEdge){const i=a.rightVertex.rightEdge;this._checkForSnappingCandidate(r,i,i.leftVertex,i.rightVertex,e,n,t)}return r}_checkForSnappingCandidate(e,t,r,i,o,n,s){if(!this.edgeExceedsShortLineThreshold(t,s))return;const a=this.view,c=f(r.pos,a,s),p=f(i.pos,a,s);this._checkForSnappingCandidateNormalized(e,p,c,o,n,s)}_checkForSnappingCandidateNormalized(e,t,r,i,o,n){this._projectionRay(F,t,r,i,n),this._checkForSnappingCandidateAlongProjectedRay(e,t,r,F,i,o,n)}_projectionRay(e,t,r,i,o){this._projectionRayGeodesic(e,t,r,i,o)||this._projectionRayPlanar(e,t,r)}_projectionRayGeodesic(i,o,n,s,{spatialReference:a}){const p=R(o,n,a,a);if(null==p)return!1;const h=R(n,s,a,a);if(null==h)return!1;const g=Math.sign(e.shortestSignedDiff(p,h))*Math.PI*.5,l=t(p+g,"radians","geographic"),f=d(),m=S(n,s,a);return null!=m&&(y(f,n,a,r(m,"meters"),l,"geodesic"),c(i,f,n),!0)}_projectionRayPlanar(e,t,r){const o=i(C,m(r),m(t));p(e,o[1],-o[0],0)}_checkForSnappingCandidateAlongProjectedRay(e,t,r,a,c,p,f){const{spatialReference:j,pointer:R}=f,y=i(C,m(c),m(r)),S=o(a,y)/n(a),k=s(C,m(r),a,S),F=u(k[0],k[1],c[2]);if(v(p,E(F,j,g,this.view))>this.squaredProximityThreshold(R)||this.isVertical(F,r,f)||this.isVertical(r,t,f))return;const w=h(d(),r,a,Math.sign(S));e.push(new V({targetPoint:F,constraint:new l(r,x(w)),previousVertex:t,otherVertex:r,otherVertexType:_.CENTER,isDraped:"on-the-ground"===f.elevationInfo?.mode}))}}const C=a(),F=d();export{k as RightAngleSnapper};
@@ -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{f as e,g as t,i}from"../../../../chunks/vec32.js";import{clone as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{VerticalPlaneConstraint as s}from"../../sketch/constraints.js";import{fromVec3 as n}from"../../sketch/normalizedPoint.js";import{SnappingDomain as a}from"../SnappingDomain.js";import{LineSegmentHintType as f}from"../snappingUtils.js";import{SnappingCandidate as o}from"./SnappingCandidate.js";import{LineSnappingHint as d}from"../hints/LineSnappingHint.js";import{ParallelSnappingHint as h}from"../hints/ParallelSnappingHint.js";class g extends o{constructor({referenceLine:i,lineStart:f,targetPoint:o,isDraped:d}){const h=r(f),{left:g,right:p}=i;e(h,t(h,h,p),g),super(o,new s(f,n(h)),d,a.SELF),this._referenceLines=[{edge:i,fadeLeft:!0,fadeRight:!0}]}get hints(){return[new d(f.TARGET,this.constraint.start,this.targetPoint,this.isDraped,this.domain),new h(this.constraint.start,this.targetPoint,this.isDraped,this.domain),...this._referenceLines.map((e=>new d(f.REFERENCE,e.edge.left,e.edge.right,this.isDraped,this.domain,e.fadeLeft,e.fadeRight)))]}addReferenceLine(e){const t={edge:e,fadeLeft:!0,fadeRight:!0};this._referenceLines.forEach((r=>{i(e.right,r.edge.left)&&(r.fadeLeft=!1,t.fadeRight=!1),i(e.right,r.edge.right)&&(r.fadeRight=!1,t.fadeRight=!1),i(e.left,r.edge.right)&&(r.fadeRight=!1,t.fadeLeft=!1),i(e.left,r.edge.left)&&(r.fadeLeft=!1,t.fadeLeft=!1)})),this._referenceLines.push(t)}}export{g as ParallelLineSnappingCandidate};
5
+ import{f as e,g as t,j as i}from"../../../../chunks/vec32.js";import{clone as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{VerticalPlaneConstraint as s}from"../../sketch/constraints.js";import{fromVec3 as n}from"../../sketch/normalizedPoint.js";import{SnappingDomain as a}from"../SnappingDomain.js";import{LineSegmentHintType as f}from"../snappingUtils.js";import{SnappingCandidate as o}from"./SnappingCandidate.js";import{LineSnappingHint as d}from"../hints/LineSnappingHint.js";import{ParallelSnappingHint as h}from"../hints/ParallelSnappingHint.js";class g extends o{constructor({referenceLine:i,lineStart:f,targetPoint:o,isDraped:d}){const h=r(f),{left:g,right:p}=i;e(h,t(h,h,p),g),super(o,new s(f,n(h)),d,a.SELF),this._referenceLines=[{edge:i,fadeLeft:!0,fadeRight:!0}]}get hints(){return[new d(f.TARGET,this.constraint.start,this.targetPoint,this.isDraped,this.domain),new h(this.constraint.start,this.targetPoint,this.isDraped,this.domain),...this._referenceLines.map((e=>new d(f.REFERENCE,e.edge.left,e.edge.right,this.isDraped,this.domain,e.fadeLeft,e.fadeRight)))]}addReferenceLine(e){const t={edge:e,fadeLeft:!0,fadeRight:!0};this._referenceLines.forEach((r=>{i(e.right,r.edge.left)&&(r.fadeLeft=!1,t.fadeRight=!1),i(e.right,r.edge.right)&&(r.fadeRight=!1,t.fadeRight=!1),i(e.left,r.edge.right)&&(r.fadeRight=!1,t.fadeLeft=!1),i(e.left,r.edge.left)&&(r.fadeLeft=!1,t.fadeLeft=!1)})),this._referenceLines.push(t)}}export{g as ParallelLineSnappingCandidate};
@@ -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{distance as t}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{k as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{VerticalCylinderConstraint as r}from"../../sketch/constraints.js";import{fromVec3 as n,asVec2 as o}from"../../sketch/normalizedPoint.js";import{SnappingDomain as p}from"../SnappingDomain.js";import{LineSegmentHintType as e}from"../snappingUtils.js";import{SnappingCandidate as m}from"./SnappingCandidate.js";import{LineSnappingHint as a}from"../hints/LineSnappingHint.js";import{RightAngleSnappingHint as h}from"../hints/RightAngleSnappingHint.js";class g extends m{constructor({targetPoint:e,point1:m,point2:a,isDraped:h}){super(e,new r(n(i(s(),m,a,.5)),.5*t(o(m),o(a))),h,p.SELF),this._p1=m,this._p2=a}get hints(){return[new a(e.REFERENCE,this.targetPoint,this._p1,this.isDraped,this.domain),new a(e.REFERENCE,this.targetPoint,this._p2,this.isDraped,this.domain),new h(this._p1,this.targetPoint,this._p2,this.isDraped,this.domain)]}}export{g as RightAngleTriangleSnappingCandidate};
5
+ import{distance as t}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{m as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{VerticalCylinderConstraint as r}from"../../sketch/constraints.js";import{fromVec3 as n,asVec2 as o}from"../../sketch/normalizedPoint.js";import{SnappingDomain as p}from"../SnappingDomain.js";import{LineSegmentHintType as e}from"../snappingUtils.js";import{SnappingCandidate as m}from"./SnappingCandidate.js";import{LineSnappingHint as a}from"../hints/LineSnappingHint.js";import{RightAngleSnappingHint as h}from"../hints/RightAngleSnappingHint.js";class g extends m{constructor({targetPoint:e,point1:m,point2:a,isDraped:h}){super(e,new r(n(i(s(),m,a,.5)),.5*t(o(m),o(a))),h,p.SELF),this._p1=m,this._p2=a}get hints(){return[new a(e.REFERENCE,this.targetPoint,this._p1,this.isDraped,this.domain),new a(e.REFERENCE,this.targetPoint,this._p2,this.isDraped,this.domain),new h(this._p1,this.targetPoint,this._p2,this.isDraped,this.domain)]}}export{g as RightAngleTriangleSnappingCandidate};
@@ -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{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{g as s,p as n}from"../../../../../chunks/vec32.js";import{create as i,clone as r}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,fromPoints as c,projectPoint as a}from"../../../../../geometry/support/lineSegment.js";import{g as p,n as m}from"../../../../../chunks/sphere.js";import h from"../../../../3d/webgl-engine/lib/Octree.js";import{extractComponentsEdgeLocationsLayout as u}from"../../../../3d/webgl-engine/lib/edgeRendering/edgeProcessing.js";import{maxCandidateCount as g,boundsFromEdge as l}from"./sceneLayerSnappingUtils.js";let _=class{constructor(){this._idToComponent=new Map,this._components=new h((e=>e.bounds)),this._edges=new h((e=>e.bounds)),this._tmpLineSegment=d(),this._tmpP1=i(),this._tmpP2=i(),this._tmpP3=i(),this.remoteClient=null}async fetchCandidates(e,o){await Promise.resolve(),t(o),await this._ensureEdgeLocations(e,o);const s=[];return this._edges.forEachNeighbor((t=>(this._addCandidates(e,t,s),s.length<g)),e.bounds),{result:{candidates:s}}}async _ensureEdgeLocations(e,t){const o=[];if(this._components.forEachNeighbor((e=>{if(null==e.info){const{id:t,uid:s}=e;o.push({id:t,uid:s})}return!0}),e.bounds),!o.length)return;const s={components:o},n=await this.remoteClient.invoke("fetchAllEdgeLocations",s,t??{});for(const i of n.components)this._setFetchEdgeLocations(i)}async add(e){const t=new b(e.id,e.bounds);return this._idToComponent.set(t.id,t),this._components.add([t]),{result:{}}}async remove(e){const t=this._idToComponent.get(e.id);if(t){const e=[];this._edges.forEachNeighbor((o=>(o.component===t&&e.push(o),!0)),t.bounds),this._edges.remove(e),this._components.remove([t]),this._idToComponent.delete(t.id)}return{result:{}}}_setFetchEdgeLocations(e){const t=this._idToComponent.get(e.id);if(null==t||e.uid!==t.uid)return;const o=u.createView(e.locations),s=new Array(o.count),n=i(),r=i();for(let i=0;i<o.count;i++){o.position0.getVec(i,n),o.position1.getVec(i,r);const d=l(n,r,e.origin),c=new j(t,i,d);s[i]=c}this._edges.add(s);const{objectIds:d,origin:c}=e;t.info={locations:o,objectIds:d,origin:c}}_addCandidates(e,t,o){const{info:n}=t.component,{origin:i,objectIds:r}=n,d=n.locations,c=d.position0.getVec(t.index,this._tmpP1),a=d.position1.getVec(t.index,this._tmpP2);s(c,c,i),s(a,a,i);const p=r[d.componentIndex.get(t.index)];this._addEdgeCandidate(e,p,c,a,o),this._addVertexCandidate(e,p,c,o),this._addVertexCandidate(e,p,a,o)}_addEdgeCandidate(e,t,o,s,i){if(!e.returnEdge)return;const d=p(e.bounds),h=c(o,s,this._tmpLineSegment),u=a(h,d,this._tmpP3);m(e.bounds,u)&&i.push({type:"edge",objectId:t,target:r(u),distance:n(d,u),start:r(o),end:r(s)})}_addVertexCandidate(e,t,o,s){if(!e.returnVertex||!m(e.bounds,o))return;const i=p(e.bounds);s.push({type:"vertex",objectId:t,target:r(o),distance:n(i,o)})}};_=e([o("esri.views.interactive.snapping.featureSources.sceneLayerSource.SceneLayerSnappingSourceWorker")],_);const f=_;class b{constructor(e,t){this.id=e,this.bounds=t,this.info=null,this.uid=++b.uid}}b.uid=0;class j{constructor(e,t,o){this.component=e,this.index=t,this.bounds=o}}export{f as default};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{throwIfAborted as t}from"../../../../../core/promiseUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{g as s,q as n}from"../../../../../chunks/vec32.js";import{create as i,clone as r}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as d,fromPoints as c,projectPoint as a}from"../../../../../geometry/support/lineSegment.js";import{g as p,n as m}from"../../../../../chunks/sphere.js";import h from"../../../../3d/webgl-engine/lib/Octree.js";import{extractComponentsEdgeLocationsLayout as u}from"../../../../3d/webgl-engine/lib/edgeRendering/edgeProcessing.js";import{maxCandidateCount as g,boundsFromEdge as l}from"./sceneLayerSnappingUtils.js";let _=class{constructor(){this._idToComponent=new Map,this._components=new h((e=>e.bounds)),this._edges=new h((e=>e.bounds)),this._tmpLineSegment=d(),this._tmpP1=i(),this._tmpP2=i(),this._tmpP3=i(),this.remoteClient=null}async fetchCandidates(e,o){await Promise.resolve(),t(o),await this._ensureEdgeLocations(e,o);const s=[];return this._edges.forEachNeighbor((t=>(this._addCandidates(e,t,s),s.length<g)),e.bounds),{result:{candidates:s}}}async _ensureEdgeLocations(e,t){const o=[];if(this._components.forEachNeighbor((e=>{if(null==e.info){const{id:t,uid:s}=e;o.push({id:t,uid:s})}return!0}),e.bounds),!o.length)return;const s={components:o},n=await this.remoteClient.invoke("fetchAllEdgeLocations",s,t??{});for(const i of n.components)this._setFetchEdgeLocations(i)}async add(e){const t=new b(e.id,e.bounds);return this._idToComponent.set(t.id,t),this._components.add([t]),{result:{}}}async remove(e){const t=this._idToComponent.get(e.id);if(t){const e=[];this._edges.forEachNeighbor((o=>(o.component===t&&e.push(o),!0)),t.bounds),this._edges.remove(e),this._components.remove([t]),this._idToComponent.delete(t.id)}return{result:{}}}_setFetchEdgeLocations(e){const t=this._idToComponent.get(e.id);if(null==t||e.uid!==t.uid)return;const o=u.createView(e.locations),s=new Array(o.count),n=i(),r=i();for(let i=0;i<o.count;i++){o.position0.getVec(i,n),o.position1.getVec(i,r);const d=l(n,r,e.origin),c=new j(t,i,d);s[i]=c}this._edges.add(s);const{objectIds:d,origin:c}=e;t.info={locations:o,objectIds:d,origin:c}}_addCandidates(e,t,o){const{info:n}=t.component,{origin:i,objectIds:r}=n,d=n.locations,c=d.position0.getVec(t.index,this._tmpP1),a=d.position1.getVec(t.index,this._tmpP2);s(c,c,i),s(a,a,i);const p=r[d.componentIndex.get(t.index)];this._addEdgeCandidate(e,p,c,a,o),this._addVertexCandidate(e,p,c,o),this._addVertexCandidate(e,p,a,o)}_addEdgeCandidate(e,t,o,s,i){if(!e.returnEdge)return;const d=p(e.bounds),h=c(o,s,this._tmpLineSegment),u=a(h,d,this._tmpP3);m(e.bounds,u)&&i.push({type:"edge",objectId:t,target:r(u),distance:n(d,u),start:r(o),end:r(s)})}_addVertexCandidate(e,t,o,s){if(!e.returnVertex||!m(e.bounds,o))return;const i=p(e.bounds);s.push({type:"vertex",objectId:t,target:r(o),distance:n(i,o)})}};_=e([o("esri.views.interactive.snapping.featureSources.sceneLayerSource.SceneLayerSnappingSourceWorker")],_);const f=_;class b{constructor(e,t){this.id=e,this.bounds=t,this.info=null,this.uid=++b.uid}}b.uid=0;class j{constructor(e,t,o){this.component=e,this.index=t,this.bounds=o}}export{f 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{q as s,p as o,g as r}from"../../../../../chunks/vec32.js";import{d as n,g as t}from"../../../../../chunks/sphere.js";const c=1e3;function e(c,e,a){const p=n(),m=t(p);return s(m,m,c,.5),s(m,m,e,.5),p[3]=o(m,c),r(m,m,a),p}export{e as boundsFromEdge,c as maxCandidateCount};
5
+ import{r as s,q as r,g as o}from"../../../../../chunks/vec32.js";import{d as n,g as t}from"../../../../../chunks/sphere.js";const c=1e3;function e(c,e,a){const m=n(),p=t(m);return s(p,p,c,.5),s(p,p,e,.5),m[3]=r(p,c),o(p,p,a),m}export{e as boundsFromEdge,c as maxCandidateCount};
@@ -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{i as n}from"../../../../chunks/vec32.js";import{SnappingDomain as t}from"../SnappingDomain.js";import{SnappingHint as i}from"./SnappingHint.js";class o extends i{constructor(n,i,o=t.ALL){super(i,o),this.intersectionPoint=n}equals(t){return t instanceof o&&n(this.intersectionPoint,t.intersectionPoint)}}export{o as IntersectionSnappingHint};
5
+ import{j as n}from"../../../../chunks/vec32.js";import{SnappingDomain as t}from"../SnappingDomain.js";import{SnappingHint as i}from"./SnappingHint.js";class o extends i{constructor(n,i,o=t.ALL){super(i,o),this.intersectionPoint=n}equals(t){return t instanceof o&&n(this.intersectionPoint,t.intersectionPoint)}}export{o as IntersectionSnappingHint};
@@ -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"../../../../core/has.js";import"../../../../core/Logger.js";import{i as t,p as e}from"../../../../chunks/vec32.js";import{SnappingDomain as i}from"../SnappingDomain.js";import{SnappingHint as s}from"./SnappingHint.js";class n extends s{constructor(t,e,s,n,r=i.ALL,a=!0,h=!0){super(n,r),this.type=t,this.lineStart=e,this.lineEnd=s,this.fadeLeft=a,this.fadeRight=h}equals(e){return e instanceof n&&(this.type===e.type&&t(this.lineStart,e.lineStart)&&t(this.lineEnd,e.lineEnd)&&this.fadeLeft===e.fadeLeft&&this.fadeRight===e.fadeRight)}get length(){return e(this.lineStart,this.lineEnd)}}export{n as LineSnappingHint};
5
+ import"../../../../core/has.js";import"../../../../core/Logger.js";import{j as t,q as e}from"../../../../chunks/vec32.js";import{SnappingDomain as i}from"../SnappingDomain.js";import{SnappingHint as s}from"./SnappingHint.js";class n extends s{constructor(t,e,s,n,r=i.ALL,a=!0,h=!0){super(n,r),this.type=t,this.lineStart=e,this.lineEnd=s,this.fadeLeft=a,this.fadeRight=h}equals(e){return e instanceof n&&(this.type===e.type&&t(this.lineStart,e.lineStart)&&t(this.lineEnd,e.lineEnd)&&this.fadeLeft===e.fadeLeft&&this.fadeRight===e.fadeRight)}get length(){return e(this.lineStart,this.lineEnd)}}export{n as LineSnappingHint};
@@ -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"../../../../core/has.js";import"../../../../core/Logger.js";import{i as t}from"../../../../chunks/vec32.js";import{SnappingDomain as i}from"../SnappingDomain.js";import{SnappingHint as n}from"./SnappingHint.js";class r extends n{constructor(t,n,r,s=i.ALL){super(r,s),this.lineStart=t,this.lineEnd=n}equals(i){return i instanceof r&&(t(this.lineStart,i.lineStart)&&t(this.lineEnd,i.lineEnd))}}export{r as ParallelSnappingHint};
5
+ import"../../../../core/has.js";import"../../../../core/Logger.js";import{j as t}from"../../../../chunks/vec32.js";import{SnappingDomain as n}from"../SnappingDomain.js";import{SnappingHint as i}from"./SnappingHint.js";class r extends i{constructor(t,i,r,s=n.ALL){super(r,s),this.lineStart=t,this.lineEnd=i}equals(n){return n instanceof r&&(t(this.lineStart,n.lineStart)&&t(this.lineEnd,n.lineEnd))}}export{r as ParallelSnappingHint};
@@ -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{i as t}from"../../../../chunks/vec32.js";import{SnappingHint as s}from"./SnappingHint.js";class n extends s{constructor(t,s,n){super(s,n),this.point=t}equals(s){return s instanceof n&&t(this.point,s.point)}}export{n as PointSnappingHint};
5
+ import{j as t}from"../../../../chunks/vec32.js";import{SnappingHint as s}from"./SnappingHint.js";class n extends s{constructor(t,s,n){super(s,n),this.point=t}equals(s){return s instanceof n&&t(this.point,s.point)}}export{n as PointSnappingHint};
@@ -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"../../../../core/has.js";import"../../../../core/Logger.js";import{i as e}from"../../../../chunks/vec32.js";import{SnappingDomain as t}from"../SnappingDomain.js";import{SnappingHint as r}from"./SnappingHint.js";class s extends r{constructor(e,r,s,i,o=t.ALL){super(i,o),this.previousVertex=e,this.centerVertex=r,this.nextVertex=s}equals(t){return t instanceof s&&(e(this.previousVertex,t.previousVertex)&&e(this.centerVertex,t.centerVertex)&&e(this.nextVertex,t.nextVertex))}}export{s as RightAngleSnappingHint};
5
+ import"../../../../core/has.js";import"../../../../core/Logger.js";import{j as e}from"../../../../chunks/vec32.js";import{SnappingDomain as t}from"../SnappingDomain.js";import{SnappingHint as r}from"./SnappingHint.js";class s extends r{constructor(e,r,s,i,o=t.ALL){super(i,o),this.previousVertex=e,this.centerVertex=r,this.nextVertex=s}equals(t){return t instanceof s&&(e(this.previousVertex,t.previousVertex)&&e(this.centerVertex,t.centerVertex)&&e(this.nextVertex,t.nextVertex))}}export{s as RightAngleSnappingHint};