@arcgis/core 6.0.0-next.54 → 6.0.0-next.56

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 (467) hide show
  1. package/WebScene.js +2 -2
  2. package/applications/Components/OrientedImageryViewer/shared/constants.js +1 -1
  3. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  4. package/arcade/arcadeAsyncRuntime.js +1 -1
  5. package/arcade/arcadeCompiler.js +1 -1
  6. package/arcade/arcadeRuntime.js +1 -1
  7. package/arcade/featureset/support/sqlUtils.js +1 -1
  8. package/arcade/validation/arcadeValidator.js +1 -1
  9. package/arcgisGlobal.d.ts +1 -0
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/0329fa3aa3403f1c243b.js +1 -0
  12. package/assets/esri/core/workers/chunks/033b9fcd9833db3b6e7d.js +1 -0
  13. package/assets/esri/core/workers/chunks/{6602310c3fcd91fb6a2f.js → 07c8ac092e4b9e8d5b3c.js} +1 -1
  14. package/assets/esri/core/workers/chunks/0978e12dd6a1cbc50b80.js +1 -0
  15. package/assets/esri/core/workers/chunks/0a97b1974367382cfdf5.js +1 -0
  16. package/assets/esri/core/workers/chunks/{db0a7671ab5cbe8afd72.js → 123661019bb69c53f2d3.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{e956845255bce0910944.js → 1507297550c3cd1268e2.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{1b41ba050cde068d2860.js → 193a73a2c7f4f8482c21.js} +1 -1
  19. package/assets/esri/core/workers/chunks/1c0f5c42331fb6fc26cb.js +1 -0
  20. package/assets/esri/core/workers/chunks/20acb6f3ed5140b6c6c6.js +1 -0
  21. package/assets/esri/core/workers/chunks/2cd2fcf4a37d180d5d5c.js +1 -0
  22. package/assets/esri/core/workers/chunks/2f9adf0b809ce8797ebf.js +1 -0
  23. package/assets/esri/core/workers/chunks/{afb4dfb89fbc8a342cc5.js → 3354f1fa90f8ce4c8fde.js} +1 -1
  24. package/assets/esri/core/workers/chunks/3982409149571a827390.js +1 -0
  25. package/assets/esri/core/workers/chunks/{9b458b0d1627f22fdd93.js → 3b11e4d2e69b7aea1d65.js} +1 -1
  26. package/assets/esri/core/workers/chunks/3d851710f7fcc27c5b60.js +2 -0
  27. package/assets/esri/core/workers/chunks/3e8d70039800f2395d66.js +1 -0
  28. package/assets/esri/core/workers/chunks/41694ee8990e799da225.js +1 -0
  29. package/assets/esri/core/workers/chunks/4d8539674fc2e4fea03c.js +1 -0
  30. package/assets/esri/core/workers/chunks/{12add2003631fa314f25.js → 5060be52a380fc4920f8.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{2aa6be0b047a1b25a520.js → 53bbb9aa6e4e4a0a8121.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{c6d82397044e403a1f61.js → 5954f02c3901b28d8e73.js} +1 -1
  33. package/assets/esri/core/workers/chunks/5ba6007c3c49a8153256.js +1 -0
  34. package/assets/esri/core/workers/chunks/5bdd95eeb8f34dbf26f2.js +2 -0
  35. package/assets/esri/core/workers/chunks/{4707aedcc1b3bdf5e987.js → 5c34d49a6c9cc34b7626.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{ced5dfb2bf46fc5eac8c.js → 5e47026c681238038955.js} +2 -2
  37. package/assets/esri/core/workers/chunks/{2baf35b1b19482d603b5.js → 5f7505ada0991cfbdd84.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{976303f47c342b9d1cc0.js → 62ddd3a82864e26f009a.js} +1 -1
  39. package/assets/esri/core/workers/chunks/69a09c6acb5ae03c67f6.js +1 -0
  40. package/assets/esri/core/workers/chunks/{542a9c414c99d84d52ab.js → 6a202ef9ba9b89e09153.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{0826feebdca8a31eb630.js → 6ba6fece5c11fe2a6ace.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{5eb69e2895e5aec81051.js → 6fd10891506925560443.js} +1 -1
  43. package/assets/esri/core/workers/chunks/7b156905d168bf973518.js +1 -0
  44. package/assets/esri/core/workers/chunks/7b6fd287e7043ad50f4e.js +1 -0
  45. package/assets/esri/core/workers/chunks/7baa49055bc31618b56e.js +1 -0
  46. package/assets/esri/core/workers/chunks/8570e3df90fb76a8741a.js +1 -0
  47. package/assets/esri/core/workers/chunks/{c3c0f24a9e0047232ae1.js → 8679dfc0c53355b6feb0.js} +1 -1
  48. package/assets/esri/core/workers/chunks/8a636dc51372e14c98f5.js +1 -0
  49. package/assets/esri/core/workers/chunks/{d14732a57c8e63948c60.js → 9117c9b720c9ba6e7a6e.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{f7e33d37dd11fb08f3f8.js → 97107e64407fa6825620.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{5118c7269b706089c88e.js → a05a2c2aaf0c288f9681.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{944f17e9c9f681b971fb.js → a12e2a345005189c64be.js} +1 -1
  53. package/assets/esri/core/workers/chunks/a22458e5272332d86cb9.js +1 -0
  54. package/assets/esri/core/workers/chunks/{15b3386ad92a0b4149b8.js → a24dc5350af001db417a.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{10967a36c77c5188690d.js → a66d6298236d59a615db.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{3ea480cebf8ee56228a5.js → a7dfca326883384d2751.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{723d8316f5d4b6ce2942.js → a9539393e2f1812a973a.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{ac8d38016e4bee37a77c.js → ab784764ddf9d7f693a1.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{255f5b45c4d32f97f86c.js → ac0861014b3d2f1a1de2.js} +1 -1
  60. package/assets/esri/core/workers/chunks/ace210d313ce53f3ae10.js +1 -0
  61. package/assets/esri/core/workers/chunks/ae48ee283cfa5b3c14b0.js +1 -0
  62. package/assets/esri/core/workers/chunks/b38b6fe08a367e9de4f5.js +1 -0
  63. package/assets/esri/core/workers/chunks/{4e651869e9a196494694.js → b6e628b5d2643af4c19b.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{b37ab6b1cb4cfc85cd9d.js → b7828d7e2c5b75644057.js} +1 -1
  65. package/assets/esri/core/workers/chunks/bbd8fcb0bbba7bde3d9b.js +1 -0
  66. package/assets/esri/core/workers/chunks/{ec465abb0344ad719e9d.js → bd8e329ec74d921d311a.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{56e6e70aa40e51827290.js → c3f94024c6c9eed9f273.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{6d17b45022dfd2548098.js → c5ddf8b347c31fe772a3.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{ee9af58ae202b803bba7.js → c7a0c4ca37ebd1d98cf1.js} +1 -1
  70. package/assets/esri/core/workers/chunks/d0659f1b0495734be4b3.js +1 -0
  71. package/assets/esri/core/workers/chunks/d7763c42754152510e13.js +2 -0
  72. package/assets/esri/core/workers/chunks/{b9a2b05ede02c305e865.js → d8ffb1502def5c85740b.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{7dfe1e78d2e66de6be22.js → d9ef244019954d5a8a27.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{95403bb27a4ea0a4b7b1.js → ddbfa664e69612295785.js} +1 -1
  75. package/assets/esri/core/workers/chunks/dfa1b0308e5e82d1ddfe.js +1120 -0
  76. package/assets/esri/core/workers/chunks/e566102c7ed7a8ebf89e.js +1 -0
  77. package/assets/esri/core/workers/chunks/e74586b074d0fa6abb4b.js +1 -0
  78. package/assets/esri/core/workers/chunks/e7dff025780726d5feae.js +1 -0
  79. package/assets/esri/core/workers/chunks/e96fa029acba59c04e4e.js +2 -0
  80. package/assets/esri/core/workers/chunks/{55d28d3f5b8ced061e39.js → eaf73ce60f39a48ddd2a.js} +1 -1
  81. package/assets/esri/core/workers/chunks/ed2f2a5da830d058e339.js +1 -0
  82. package/assets/esri/core/workers/chunks/{e592f2483db71230e8e5.js → efd6ea0966f60ab19520.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{944cb751c85d3a127f49.js → f52d081bbde5c95265cf.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{1de9be7b65109c207bd5.js → fbd5f3b81cd9f061824d.js} +1 -1
  85. package/assets/esri/core/workers/chunks/fdfbd201be372d3796bf.js +2 -0
  86. package/assets/esri/core/workers/chunks/ff0a0819bba5e8264c47.js +1 -0
  87. package/assets/esri/layers/raster/formats/blosc-wasm.wasm +0 -0
  88. package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
  89. package/basemapGallery/support/basemapCompatibilityUtils.js +1 -1
  90. package/chunks/BlendLayers.glsl.js +1 -1
  91. package/chunks/ColorMaterial.glsl.js +14 -14
  92. package/chunks/Component.glsl.js +37 -37
  93. package/chunks/CypherParser.js +1 -1
  94. package/chunks/DefaultMaterial.glsl.js +15 -15
  95. package/chunks/GeodeticDistanceCalculator-zRp89-dW.js +1 -1
  96. package/chunks/HUDMaterial.glsl.js +3 -3
  97. package/chunks/MultiPathImpl.js +1 -1
  98. package/chunks/OperatorGeodesicBuffer.js +1 -1
  99. package/chunks/Path.glsl.js +15 -15
  100. package/chunks/Pattern.glsl.js +20 -20
  101. package/chunks/RasterColorizer.glsl.js +1 -1
  102. package/chunks/ShadowHighlight.glsl.js +1 -1
  103. package/chunks/Terrain.glsl.js +24 -24
  104. package/chunks/UnitFactory.js +1 -1
  105. package/chunks/Water.glsl.js +29 -20
  106. package/chunks/blosc-wasm.js +2 -0
  107. package/chunks/cameraUtilsSpherical.js +1 -1
  108. package/chunks/parquet.js +1 -1
  109. package/chunks/pdf.js +57 -0
  110. package/chunks/text.js +1 -1
  111. package/config.js +1 -1
  112. package/core/accessorSupport/write.js +1 -1
  113. package/core/scheduling.js +1 -1
  114. package/core/sql/SqlInterval.js +1 -1
  115. package/core/urlUtils.js +1 -1
  116. package/geometry/geometryEngine.js +1 -1
  117. package/geometry/operators/gx/operatorOffset.js +1 -1
  118. package/geometry/support/Ellipsoid.js +1 -1
  119. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  120. package/geometry/support/geodesicConstants.js +1 -1
  121. package/geometry/support/meshUtils/primitives.js +1 -1
  122. package/kernel.js +1 -1
  123. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  124. package/layers/VoxelWasmPerSceneView.js +1 -1
  125. package/layers/effects/parser.js +1 -1
  126. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  127. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -56
  128. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  129. package/layers/geospatialPDF/parserUtils.js +2 -0
  130. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  131. package/layers/graphics/data/QueryEngineResult.js +1 -1
  132. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  133. package/layers/parquet.js +1 -1
  134. package/layers/raster/datasets/ZarrRaster.js +1 -1
  135. package/layers/raster/datasets/wcsCoverageParser.js +1 -1
  136. package/layers/raster/formats/RasterCodec.js +1 -1
  137. package/layers/raster/formats/blosc.js +2 -0
  138. package/layers/support/BuildingFilter.js +1 -1
  139. package/layers/support/ControlPoint.js +1 -1
  140. package/layers/support/ControlPointsGeoreference.js +1 -1
  141. package/layers/support/IntegratedMeshSemantics.js +1 -1
  142. package/layers/support/commonProperties.js +1 -1
  143. package/layers/support/fieldUtils.d.ts +23 -87
  144. package/layers/support/fieldUtils.js +1 -1
  145. package/layers/support/geospatialPDFUtils.d.ts +63 -0
  146. package/layers/support/geospatialPDFUtils.js +2 -0
  147. package/layers/support/layersMapping.js +1 -1
  148. package/layers/video/VideoController.js +1 -1
  149. package/legend/ActiveLayerInfo.js +1 -1
  150. package/libs/ajv/ajv.bundle-wrapper.js +1 -1
  151. package/package.json +6 -6
  152. package/renderers/types.d.ts +1 -1
  153. package/rest/knowledgeGraphService.js +1 -1
  154. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  155. package/smartMapping/statistics/support/attributeDensity.js +1 -1
  156. package/smartMapping/support/adapters/support/utils.js +1 -1
  157. package/support/tests/serviceMockDependencies.js +1 -1
  158. package/symbols/CIMSymbol.d.ts +9 -9
  159. package/symbols/PathSymbol3DLayer.d.ts +1 -1
  160. package/symbols/WaterSymbol3DLayer.d.ts +13 -1
  161. package/symbols/WaterSymbol3DLayer.js +1 -1
  162. package/symbols/cim/CIMEffects.js +1 -1
  163. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  164. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  165. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  166. package/symbols/cim/rasterizingUtils.js +1 -1
  167. package/views/2d/PaddedViewState.js +1 -1
  168. package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
  169. package/views/2d/engine/vectorTiles/constants.js +1 -1
  170. package/views/2d/engine/vectorTiles/style/geoJSONVectorTileUtils.js +1 -1
  171. package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
  172. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  173. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  174. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
  175. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  176. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  177. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  178. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  179. package/views/2d/layers/ParquetLayerView2D.js +1 -1
  180. package/views/2d/layers/features/Processor.js +1 -1
  181. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  182. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  183. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  184. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  185. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  186. package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
  187. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  188. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  189. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  190. package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
  191. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  192. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  193. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  194. package/views/3d/analysis/Viewshed/ViewshedObserverManipulatedObject3D.js +1 -1
  195. package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
  196. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  197. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  198. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  199. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementVisualization.js +1 -1
  200. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  201. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  202. package/views/3d/camera/constraintUtils.js +1 -1
  203. package/views/3d/camera/intersectionUtils.js +1 -1
  204. package/views/3d/environment/EnvironmentView.js +1 -1
  205. package/views/3d/focusAreaUtils.js +1 -1
  206. package/views/3d/input/handlers/ground/GroundNavigation.js +1 -1
  207. package/views/3d/interactive/Manipulator3D.js +1 -1
  208. package/views/3d/interactive/Manipulator3DBase.js +1 -1
  209. package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
  210. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  211. package/views/3d/interactive/editingTools/manipulations/config.js +1 -1
  212. package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
  213. package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
  214. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  215. package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
  216. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  217. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  218. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  219. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  220. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  221. package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
  222. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  223. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  224. package/views/3d/layers/DrapedSubView3D.js +1 -1
  225. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  226. package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
  227. package/views/3d/layers/FlowSubView3D.js +1 -1
  228. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  229. package/views/3d/layers/I3SMeshView3D.js +1 -1
  230. package/views/3d/layers/RouteLayerView3D.js +1 -1
  231. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  232. package/views/3d/layers/TiledLayerView3D.js +1 -1
  233. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  234. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  235. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  236. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  237. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  238. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  239. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  240. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  241. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  242. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  243. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  244. package/views/3d/layers/graphics/Graphics3DSymbolFactory.js +1 -1
  245. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  246. package/views/3d/layers/graphics/LabelInfo.js +1 -1
  247. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  248. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  249. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  250. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  251. package/views/3d/layers/i3s/I3SNode.js +1 -1
  252. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  253. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  254. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  255. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  256. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  257. package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
  258. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  259. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  260. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  261. package/views/3d/layers/support/Tiles3DBVH.js +1 -1
  262. package/views/3d/layers/support/Tiles3DLayerViewRegistration.js +1 -1
  263. package/views/3d/layers/support/createTileBVHForLayer.js +1 -1
  264. package/views/3d/layers/support/selectTiles3DSpatialReference.js +1 -1
  265. package/views/3d/layers/support/uvUtils.js +1 -1
  266. package/views/3d/state/Constraints.js +1 -1
  267. package/views/3d/state/ConstraintsManager.js +1 -1
  268. package/views/3d/state/NearFarHeuristic.js +1 -1
  269. package/views/3d/state/ViewState.js +1 -1
  270. package/views/3d/state/ViewStateManager.js +1 -1
  271. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  272. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  273. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  274. package/views/3d/state/controllers/RotateController.js +1 -1
  275. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  276. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  277. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  278. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  279. package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
  280. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  281. package/views/3d/state/utils/navigationUtils.js +1 -1
  282. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  283. package/views/3d/support/QualityProfile.js +1 -1
  284. package/views/3d/support/QualitySettings.js +1 -1
  285. package/views/3d/support/RenderCoordsHelper.js +1 -1
  286. package/views/3d/support/SweptSphereVolume.js +1 -1
  287. package/views/3d/support/cameraUtils.js +1 -1
  288. package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
  289. package/views/3d/support/engineContent/line.js +1 -1
  290. package/views/3d/support/engineContent/marker.js +1 -1
  291. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  292. package/views/3d/support/hitTest.js +1 -1
  293. package/views/3d/support/orientedBoundingBox.js +1 -1
  294. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  295. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  296. package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
  297. package/views/3d/support/sunUtils.js +1 -1
  298. package/views/3d/terrain/BlendLayersTechniqueConfiguration.js +1 -1
  299. package/views/3d/terrain/ExtentHelper.js +1 -1
  300. package/views/3d/terrain/OverlayManager.js +1 -1
  301. package/views/3d/terrain/OverlayRenderer.js +1 -1
  302. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  303. package/views/3d/terrain/RasterColorizerTechniqueConfiguration.js +1 -1
  304. package/views/3d/terrain/TerrainRenderer.js +1 -1
  305. package/views/3d/terrain/TerrainSurface.js +1 -1
  306. package/views/3d/terrain/Tile.js +1 -1
  307. package/views/3d/terrain/TilingSchemeLogic.js +1 -1
  308. package/views/3d/terrain/terrainUtils.js +1 -1
  309. package/views/3d/webgl/RenderCamera.js +1 -1
  310. package/views/3d/webgl-engine/Stage.js +1 -1
  311. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  312. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  313. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  314. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
  315. package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
  316. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  317. package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
  318. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  319. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
  320. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  321. package/views/3d/webgl-engine/core/shaderLibrary/clampShadowPosition.glsl.js +2 -0
  322. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +14 -14
  323. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
  324. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
  325. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +2 -3
  326. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  327. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
  328. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  329. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  330. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
  331. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +1 -1
  332. package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
  333. package/views/3d/webgl-engine/lib/BufferObject3D.js +1 -1
  334. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  335. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  336. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  337. package/views/3d/webgl-engine/lib/Program.js +1 -1
  338. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  339. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  340. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  341. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  342. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  343. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  344. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  345. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  346. package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
  347. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  348. package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
  349. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  350. package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
  351. package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
  352. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  353. package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
  354. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  355. package/views/3d/webgl-engine/parts/Model.js +1 -1
  356. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  357. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  358. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  359. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  360. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  361. package/views/Attribution.js +5 -5
  362. package/views/DOMContainer.d.ts +2 -1
  363. package/views/MapView.d.ts +1 -0
  364. package/views/SceneView.js +1 -1
  365. package/views/View2D.js +1 -1
  366. package/views/ViewingMode.js +1 -1
  367. package/views/analysis/ElevationProfile/elevationProfileChartBoundsUtils.js +1 -1
  368. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  369. package/views/draw/DrawAction.js +1 -1
  370. package/views/draw/DrawGraphicTool.js +1 -1
  371. package/views/draw/DrawOperation.js +1 -1
  372. package/views/draw/DrawTool.js +1 -1
  373. package/views/draw/SegmentDrawAction.js +1 -1
  374. package/views/draw/support/Reshape.js +1 -1
  375. package/views/draw/support/helpMessageUtils.js +1 -1
  376. package/views/draw/support/managers/EditSessionManager.js +1 -1
  377. package/views/draw/support/surfaceCoordinateSystems.js +1 -1
  378. package/views/interactive/dragEventPipeline.js +1 -1
  379. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  380. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  381. package/views/interactive/editGeometry/operations/AddOrUpdatePart.js +1 -1
  382. package/views/layers/support/editableLayerViews.js +1 -1
  383. package/views/overlay/TextOverlayItem.js +1 -1
  384. package/views/support/DefaultsFromMap.js +1 -1
  385. package/views/support/Scheduler.js +1 -1
  386. package/views/support/spatialReferenceSupport.js +1 -1
  387. package/views/webgl/Program.js +3 -3
  388. package/views/webgl/ShaderBuilder.js +23 -23
  389. package/views/webgl/ShaderTranspiler.js +2 -2
  390. package/webscene/Slide.js +1 -1
  391. package/webscene/VirtualLighting.d.ts +2 -4
  392. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  393. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  394. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +17 -1
  395. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  396. package/widgets/BatchAttributeForm/inputs/support/inputUtils.d.ts +7 -0
  397. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  398. package/widgets/BatchAttributeForm.js +1 -1
  399. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  400. package/widgets/Editor/workflowUtils.js +1 -1
  401. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  402. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  403. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  404. package/widgets/FeatureForm.js +1 -1
  405. package/widgets/Legend/styles/card/ColorRamp.js +1 -1
  406. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  407. package/widgets/Measurement.js +1 -1
  408. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  409. package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
  410. package/widgets/Search/support/layerSearchUtils.js +1 -1
  411. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  412. package/widgets/Sketch/SketchViewModel.js +1 -1
  413. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  414. package/widgets/UtilityNetworkAssociations.js +1 -1
  415. package/widgets/Weather/WeatherViewModel.js +1 -1
  416. package/widgets/Weather/css.js +1 -1
  417. package/widgets/Weather.js +1 -1
  418. package/widgets/support/ContingentValuesManager.js +1 -1
  419. package/widgets/support/forms/types.d.ts +23 -1
  420. package/assets/esri/core/workers/chunks/021bd07b9a3e70598840.js +0 -1
  421. package/assets/esri/core/workers/chunks/032733b863426c5bde00.js +0 -1121
  422. package/assets/esri/core/workers/chunks/144f18a3dd2c8cf07cf7.js +0 -1
  423. package/assets/esri/core/workers/chunks/170e68624b71ac96de4a.js +0 -1
  424. package/assets/esri/core/workers/chunks/23fc1c1ed483ed3b2298.js +0 -1
  425. package/assets/esri/core/workers/chunks/2634927d26cb1139c6d0.js +0 -1
  426. package/assets/esri/core/workers/chunks/2d1b8154ee40afc9d40b.js +0 -1
  427. package/assets/esri/core/workers/chunks/2d3e977f3b75474d7ebc.js +0 -1
  428. package/assets/esri/core/workers/chunks/4a41bf3d1e2e9bb79771.js +0 -2
  429. package/assets/esri/core/workers/chunks/5f324d88785ffcb73ae0.js +0 -1
  430. package/assets/esri/core/workers/chunks/70695e0fb53018d48e7b.js +0 -2
  431. package/assets/esri/core/workers/chunks/723c9ad4c25be2b82476.js +0 -1
  432. package/assets/esri/core/workers/chunks/766a1357be2ed7f4e125.js +0 -1
  433. package/assets/esri/core/workers/chunks/817bf487df056da1e6ec.js +0 -1
  434. package/assets/esri/core/workers/chunks/89e55895683369b5277a.js +0 -1
  435. package/assets/esri/core/workers/chunks/8a820e303941b351de81.js +0 -1
  436. package/assets/esri/core/workers/chunks/8c94e987754b3919181e.js +0 -1
  437. package/assets/esri/core/workers/chunks/90d567e920b6982b402d.js +0 -1
  438. package/assets/esri/core/workers/chunks/919115788da38049aea7.js +0 -2
  439. package/assets/esri/core/workers/chunks/97cdcedfe853280f6258.js +0 -1
  440. package/assets/esri/core/workers/chunks/9ebc6026934400fc1e1f.js +0 -1
  441. package/assets/esri/core/workers/chunks/b33e7e74cf8fa3926617.js +0 -1
  442. package/assets/esri/core/workers/chunks/b4a325dcf50e276751d7.js +0 -1
  443. package/assets/esri/core/workers/chunks/bb2af16e55cb39163827.js +0 -1
  444. package/assets/esri/core/workers/chunks/be5857b0d1b00faf430b.js +0 -1
  445. package/assets/esri/core/workers/chunks/cd9100a7c8309dfa7569.js +0 -1
  446. package/assets/esri/core/workers/chunks/d5bb9f9b7b341c671525.js +0 -1
  447. package/assets/esri/core/workers/chunks/d96e63d66f7b1f4ea54a.js +0 -2
  448. package/assets/esri/core/workers/chunks/e3bcd2e356f75afc316a.js +0 -1
  449. package/assets/esri/core/workers/chunks/e507dfc4788295d9c244.js +0 -1
  450. package/assets/esri/core/workers/chunks/e58f51618251f74aaafd.js +0 -1
  451. package/assets/esri/core/workers/chunks/e80526571f1a34de3278.js +0 -1
  452. package/assets/esri/core/workers/chunks/e83806797979138fd22a.js +0 -1
  453. package/assets/esri/core/workers/chunks/ea71850ba87ae6038000.js +0 -1
  454. package/assets/esri/core/workers/chunks/f537a5e808dc546813c7.js +0 -1
  455. package/assets/esri/core/workers/chunks/fe811d651d201f698b8f.js +0 -2
  456. package/chunks/NativeLine.glsl.js +0 -8
  457. package/layers/geospatialPDF/geospatialPDFParserUtils.js +0 -2
  458. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +0 -2
  459. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +0 -2
  460. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +0 -2
  461. package/views/3d/webgl-engine/shaders/NativeLineTechniqueConfiguration.js +0 -2
  462. /package/assets/esri/core/workers/chunks/{919115788da38049aea7.js.LICENSE.txt → 3d851710f7fcc27c5b60.js.LICENSE.txt} +0 -0
  463. /package/assets/esri/core/workers/chunks/{fe811d651d201f698b8f.js.LICENSE.txt → 5bdd95eeb8f34dbf26f2.js.LICENSE.txt} +0 -0
  464. /package/assets/esri/core/workers/chunks/{ced5dfb2bf46fc5eac8c.js.LICENSE.txt → 5e47026c681238038955.js.LICENSE.txt} +0 -0
  465. /package/assets/esri/core/workers/chunks/{4a41bf3d1e2e9bb79771.js.LICENSE.txt → d7763c42754152510e13.js.LICENSE.txt} +0 -0
  466. /package/assets/esri/core/workers/chunks/{d96e63d66f7b1f4ea54a.js.LICENSE.txt → e96fa029acba59c04e4e.js.LICENSE.txt} +0 -0
  467. /package/assets/esri/core/workers/chunks/{70695e0fb53018d48e7b.js.LICENSE.txt → fdfbd201be372d3796bf.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t,__decorate as n}from"tslib";import{property as r}from"../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{diff as a}from"../../core/accessorSupport/diffUtils.js";import{createTask as o}from"../../core/asyncUtils.js";import{makeHandle as s,disposable as c}from"../../core/handleUtils.js";import l from"../../core/Logger.js";import{getOrCreateMapValue as u}from"../../core/MapUtils.js";import{destroyMaybe as d,abortMaybe as f}from"../../core/maybe.js";import{ignoreAbortErrors as ee}from"../../core/promiseUtils.js";import{when as p,initial as m,watch as h,syncAndInitial as g,on as _,sync as v}from"../../core/reactiveUtils.js";import{createScreenPoint as y,screenPointEqual as b}from"../../core/screenUtils.js";import{UpdatingHandles as x}from"../../core/support/UpdatingHandles.js";import{simplifyIsSimple as S,simplifyExecute as te}from"../../geometry/operators/simplifyOperator.js";import C from"../../geometry/Polygon.js";import{isCurvedGeometry as w}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as T}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{isPolygon as E}from"../../geometry/support/typeUtils.js";import{getEffectiveElevationInfo as D}from"../../support/elevationInfoUtils.js";import{getMaxDeviationInPixels as O,getMinSegmentsPerCurve as k}from"../2d/layers/graphics/densificationConstants.js";import{ViewEventPriorities as A}from"../input/InputManager.js";import{createCoordinateHelper as j}from"../interactive/coordinateHelper.js";import{InteractiveToolBase as M}from"../interactive/InteractiveToolBase.js";import{KeyBindings as N,mediaKeys as P,sketchKeys as F,advancedSketchKeys as I,tooltipKeys as L}from"../interactive/keybindings.js";import{isInputModeAvailable as R}from"../interactive/tooltip/tooltipCommonUtils.js";import{createSnappingVisualizer as z}from"./support/createSnappingVisualizer.js";import{multipointFromGeometry as B,markHandled as V,getPointerType as H,getPointerId as U}from"./support/drawToolUtils.js";import{viewEventToCommand as W}from"./support/input/drawToolInput.js";import{EditSessionManager as G}from"./support/managers/EditSessionManager.js";import{GlobalStateManager as K}from"./support/managers/GlobalStateManager.js";import{InteractiveHandleManager as q}from"./support/managers/InteractiveHandleManager.js";import{MeasurementManager as J}from"./support/managers/MeasurementManager.js";import{PluginLifecycleManager as Y}from"./support/managers/PluginLifecycleManager.js";import{SurfaceManager as X}from"./support/managers/SurfaceManager.js";import{TooltipManager as Z}from"./support/managers/TooltipManager.js";import{PluginContext as ne}from"./support/PluginContext.js";const Q=Symbol();let $=class extends M{constructor(e){super(e),this._shapeVisualId=Symbol(),this._vertexVisualId=Symbol(),this._pluginContexts=new Map,this._queuedFeedbackEvents=[],this._flushingQueuedFeedbackEvents=!1,this._commandsSuspended=!1,this._snappingVisualizer=null,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._updatingHandles=new x,this._keybindings=this._makeKeyBindings(),this._pendingBeginRequest=null,this.type=`draw-2.0`,this.automaticManipulatorSelection=!0,this.snappingManager=null,this.toolOptions=null,this.disableTouchDrag=!1,this.elevationInfo=null,this.hasZ=!1,this.defaultZ=0,this.lastScreenPosition=null,this.measurementManager=new J,this.globalStateManager=new K({getPluginStack:()=>this.pluginStack}),this.editSessionManager=new G({getContext:()=>this._editSessionManagerContext}),this.lifecycleManager=new Y({getContext:this._getContextForPlugin.bind(this),editSessionManager:this.editSessionManager,afterAttach:this._afterAttach.bind(this),afterDetach:this._afterDetach.bind(this),beforeResume:this._beforeResume.bind(this)}),this.surfaceManager=null,this.interactiveHandleManager=null,this.renderer=null,this.readPluginSetting=null,this.enableVertexVisuals=!0}initialize(){let{view:e}=this;this.interactiveHandleManager=new q({view:e,renderer:this.renderer}),this._override(`manipulators`,this.interactiveHandleManager.manipulators),this.tooltipManager=new Z({getDependencies:()=>this._tooltipDependencies,getLastScreenPosition:()=>this.lastScreenPosition}),this.addHandles(p(()=>this.renderer,t=>{t.addOrUpdateVisual(this._shapeVisualId,{role:`outputGeometry`}),t.addOrUpdateVisual(this._vertexVisualId,{role:`vertex`}),this._updatingHandles.addPromise(z(e,t).then(e=>this._snappingVisualizer=e))},m)),this.addHandles([h(()=>[this.view,this.coordinateHelper.spatialReference,this.defaultZ,this.hasZ,this.elevationInfo],([e,t,n,r,i])=>{this.surfaceManager?.destroy(),this.surfaceManager=new X({spatialReference:t,excludedGraphicsLayer:null,defaultZ:n,hasZ:r,view:e,elevationInfo:i,getContext:()=>({drawAtFixedElevation:this.globalStateManager.drawAtFixedElevation,elevationConstraint:this.tooltipManager?.elevationConstraint,constraintsEnabled:this.tooltipManager?.constraintsEnabled??!1})})},g),p(()=>this.toolOptions?.tooltips.effectiveEnabled,()=>this.measurementManager.preloadMeasurementUtils(),{once:!0,initial:!0}),h(()=>[this.editGeometryOperations,this.toolOptions?.labels.enabled,this.globalStateManager.segmentLabelsDisabled],()=>{this._updatingHandles.addPromise(this._setupSegmentLabels())},m),_(()=>this.editSessionManager,`cancelPlugin`,({plugin:e})=>{this._suspendPlugin(e)},v),_(()=>this.editSessionManager,`restartPlugin`,({restartInfo:e})=>{this._resumePlugin(e)},v),h(()=>this.lifecycleManager.updating,e=>{e||this._emitQueuedFeedbackEvents()},v),_(()=>this.editGeometryOperations,[`vertex-add`,`vertex-update`,`vertex-remove`],e=>{let t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),n=t.map(e=>e.coordinates);switch(e.type){case`vertex-add`:this._emitWhenReady(e.type,{...e,added:n,vertices:t});break;case`vertex-update`:this._emitWhenReady(e.type,{...e,updated:n,vertices:t});break;case`vertex-remove`:this._emitWhenReady(e.type,{...e,removed:n,vertices:t})}})])}destroy(){this.active&&this.onDeactivate(),this.editSessionManager.destroy(),this.lifecycleManager.destroy(),this.measurementManager.destroy(),this.globalStateManager.destroy();for(let e of this._pluginContexts.values())e.destroy();this._pluginContexts.clear(),this.surfaceManager=d(this.surfaceManager),this.interactiveHandleManager=d(this.interactiveHandleManager),this._segmentLabelsImportTask=f(this._segmentLabelsImportTask),this._segmentLabels=d(this._segmentLabels),this.tooltipManager=d(this.tooltipManager)}get _zOfLastUserInput(){let e=(this.mostDownstreamPlugin&&this.editSessionManager.getSession(this.mostDownstreamPlugin))?.firstPointAddedBySession?.point;return e?.hasZ?e.z:null}get _tooltipDependencies(){let{defaultZ:e,editGeometryOperations:t,toolOptions:n,directionOptions:r,elevationInfo:i,view:a}=this;return!t||!n||!a?null:{defaultZ:e,directionOptions:r,elevationInfo:i,editGeometryOperations:t,toolOptions:n,view:a,getActiveHandle:()=>this.interactiveHandleManager?.focusedHandle,getAllHandles:()=>this.interactiveHandleManager?.allhandles,getHelpMessageKey:()=>this.helpMessageKey,notifyTooltipsChanged:()=>{let{interactiveHandleManager:e,movementCommandContext:t}=this;e&&t&&e.reapplyPositions(t)}}}get _editSessionManagerContext(){let{coordinateHelper:e,view:t}=this;return t?{coordinateHelper:e,viewingMode:t.type===`3d`&&t.viewingMode===`global`?1:2}:null}get _densificationParameters(){let{view:e,coordinateHelper:t}=this,n=t.spatialReference,r=e?.spatialReference,i=e.resolution;if(!n||!r||!i||!Number.isFinite(i))return null;let a=r.metersPerUnit/n.metersPerUnit;return{maxDeviation:2**Math.round(Math.log2(i))*O()*a,minSegmentsPerCurve:k()}}get test(){return{densificationParameters:this._densificationParameters,segmentLabels:this._segmentLabels}}get updating(){return this._updatingHandles.updating||this.snappingManager?.updating||this.lifecycleManager.updating||!!this._segmentLabels?.updating}get coordinateHelper(){return j(this.hasZ,!1,this.view.spatialReference)}get editGeometry(){return this.editGeometryOperations?.data}get editGeometryOperations(){return this.editSessionManager.editGeometryOperations}get unprocessedGeometry(){return this.editSessionManager.outputGeometry}get simplifiedGeometryPreview(){let e=this.editSessionManager.outputGeometry;if(e&&E(e))try{let t=this._densificationParameters,n=w(e)&&t?new C({...T(e,t)}):e;if(!S(n))return te(n)}catch{return e}return e}get _suppressCoincidentPointOverlaysIn3D(){return this.view.type===`3d`&&this.unprocessedGeometry?.type===`point`&&!!this.interactiveHandleManager?.allhandles?.find(e=>e.role===`primary`)?.outputMapPosition}get _shapeVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.simplifiedGeometryPreview}get _vertexVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.unprocessedGeometry}get canUndo(){return this.editSessionManager.canUndo}get canRedo(){return this.editSessionManager.canRedo}get pluginStack(){return this.lifecycleManager.pluginStack}get mostDownstreamPlugin(){return this.pluginStack.at(-1)}get mostUpstreamPlugin(){return this.pluginStack.at(0)}get positionOfLastUserInput(){let e=this.lastScreenPosition;return e?this.surfaceManager?.screenToMap(e,{firstPointZ:this._zOfLastUserInput})??this.view.toMap(e):this.view.center}get movementCommandContext(){let{editGeometryOperations:e,tooltipManager:t,surfaceManager:n,snappingManager:r,interactiveHandleManager:i,_snappingVisualizer:a,defaultZ:o,hasZ:s,globalStateManager:{drawAtFixedElevation:c},view:l}=this;return{tooltipManager:t,editGeometryOperations:e,surfaceManager:n,interactiveHandleManager:i,snappingManager:r,snappingVisualizer:a,pointerType:`mouse`,hasZ:s,defaultZ:o,view:l,drawAtFixedElevation:c}}get tooltip(){return this.tooltipManager?.tooltip}get activeTooltipInfo(){return this.tooltipManager?.tooltipInfo}get helpMessageKey(){return this.pluginStack.items.findLast(e=>e.helpMessageKey)?.helpMessageKey??`noTool`}begin(e){this.active?(this.lifecycleManager.begin(e),this._pendingBeginRequest=null):this._pendingBeginRequest=e}complete(e){let t=this.lifecycleManager;if(e&&t.complete(e),t.pluginStack.length===0){let e=this.unprocessedGeometry,t=!e||e.type===`mesh`||S(e);this.emit(`complete`,{geometry:e,isSimple:t,aborted:!1,type:`complete`,vertices:[]}),this.view?.activeTool===this&&(this.view.activeTool=null)}}cancelFirstUserLeafPlugin(){let e=this.pluginStack.toArray().findLast(e=>e.configuration?.hidden!==!0);e&&this.lifecycleManager.cancel(e)}getVertexSnappingCandidates(){return this.interactiveHandleManager?.capturingHandle?.role===`secondary`?[]:this.snappingManager?.getVertexCandidates()??[]}replaceLeaf(e){let t=this.lifecycleManager;t.updating?l.getLogger(this).info(`Ignoring command; arrived while updating:`,`replaceLeaf`):t.replaceLeaf(e)}finishPart(){let e=this.mostUpstreamPlugin?.configuration;if(this.editGeometryOperations&&e&&e.kind?.includes(`multipart`)){let e=this.pluginStack.at(1);e&&this.complete(e)}}undo(){this._handleCommand({action:`undo`})}redo(){this._handleCommand({action:`redo`})}executeCommand(e){return this._handleCommand(e)}suspendCommands(){return this._commandsSuspended=!0,s(()=>{this._commandsSuspended=!1;let e=this.view?.inputManager.latestPointerInfo;if(e){let{x:t,y:n}=e.location;this._handleCommand({action:`manipulator-move-to`,x:t,y:n})}})}addPromise(e){return this._updatingHandles.addPromise(e)}readPluginSettingValue(e,t){return this.readPluginSetting?.(e,t)}getGeometryIfCompleted(){let e=this.lifecycleManager.gatherCompletablePlugins();return this.editSessionManager?.generatePreviewGeometryForPlugins(e)}onActivate(){super.onActivate();let{view:e}=this;this.lastScreenPosition=e?.inputManager.latestPointerInfo?.location,this.renderer?.activate(),this._pendingBeginRequest&&=(this.begin(this._pendingBeginRequest),null),this.enableVertexVisuals&&this.addHandles(h(()=>this._vertexVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._vertexVisualId,{geometry:e?B(e):null})},m)),this.addHandles([h(()=>this._shapeVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._shapeVisualId,{geometry:e})},m),p(()=>this.interactiveHandleManager?.capturingHandle?.screenPosition,e=>this.lastScreenPosition=e,{initial:!0,equals:b}),h(()=>this.interactiveHandleManager?.capturingHandle?.outputMapPosition,(e,t)=>{let n=this.interactiveHandleManager?.capturingHandle?.editSession?.endVertex;e&&t&&n&&this._emitWhenReady(`cursor-update`,{updated:n.pos,type:`vertex-update`,operation:`apply`,vertices:[{componentIndex:n.part.index,vertexIndex:n.index,coordinates:n.pos}]})},v),this._keybindings.register(e,A.TOOL),h(()=>e.viewpoint,(e,t)=>{e&&t&&a(e,t)&&this._handleCommand({action:`viewpoint-moved`})})],Q)}onDeactivate(){super.onDeactivate(),this.removeHandles(Q),this.renderer?.deactivate(),this.snappingManager?.doneSnapping(),this.lifecycleManager.cancelAll(),this._pendingBeginRequest=null}onInputEvent(e){if(this.disableTouchDrag&&(e.type===`drag`||e.type===`pointer-drag`)&&e.pointerType===`touch`)return;e.type===`pointer-down`?this.interactiveHandleManager?.notePointerDown(e.pointerId,e.pointerType):(e.type===`pointer-up`||e.type===`pointer-leave`)&&this.interactiveHandleManager?.notePointerUp(e.pointerId,e.pointerType);let t=W(e);t&&this._handleCommand(t)}forceAddVertex(){this._commitNext()}_emitWhenReady(e,t){if(this.destroyed)return;let n=()=>{this.emit(e,t)};this.lifecycleManager.updating||this._flushingQueuedFeedbackEvents?this._queuedFeedbackEvents.push(n):n()}_emitQueuedFeedbackEvents(){if(!(this.destroyed||this._flushingQueuedFeedbackEvents||this.lifecycleManager.updating||this._queuedFeedbackEvents.length===0)){this._flushingQueuedFeedbackEvents=!0;try{for(;!this.destroyed&&!this.lifecycleManager.updating&&this._queuedFeedbackEvents.length>0;)this._queuedFeedbackEvents.shift()?.()}finally{this._flushingQueuedFeedbackEvents=!1}}}async _handleCommand(e){if(!this._commandsSuspended){if(this.lifecycleManager.updating)l.getLogger(this).info(`Ignoring command; arrived while updating:`,e.action);else switch(e.action){case`view-drag`:return await this._handleViewDragCommand(e);case`vertex-add`:return this._guardCommand(e,()=>{V(e),this._commitNext()});case`vertex-add-and-finish-part`:return this._handleVertexAddAndFinishPartCommand(e);case`cancel`:return this._guardCommand(e,()=>this.cancel());case`complete`:return this._guardCommand(e,()=>{this.mostUpstreamPlugin&&(V(e),this.complete(this.mostUpstreamPlugin))});case`finish-part`:return this._guardCommand(e,()=>this.finishPart());case`undo`:return this._guardCommand(e,()=>this.editSessionManager.undo());case`redo`:return this._guardCommand(e,()=>this.editSessionManager.redo());case`next-manipulator`:return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator(`forward`));case`previous-manipulator`:return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator(`backward`));case`toggle-manipulator-follow`:this.interactiveHandleManager?.toggleFollow()&&V(e);break;case`viewpoint-moved`:return await this._handleViewpointMovedCommand(e);case`manipulator-move-to`:return await this._handleManipulatorMoveToCommand(e);case`manipulator-drag-to`:return await this._handleManipulatorDragToCommand(e);case`vertex-add-at-point`:return await this._handleVertexAddAtPointCommand(e);case`show-tooltip`:return this._guardCommand(e,async()=>{let t=this.tooltipManager?.tooltip;t&&R(t.info)&&(await t.enterInputMode(),V(e))});case`constraint-center`:this.globalStateManager.setCentered(e.enabled);break;case`constraint-aspect`:this.globalStateManager.setPreserveAspectRatio(e.enabled)}}}async _handleViewDragCommand(e){if(!this.editable)return;let t=e.originalEvent,n=this.interactiveHandleManager?.capturingHandle;(t&&`pointerType`in t&&t.pointerType===`touch`&&(n?.captureMode===`capture-always`||n?.captureMode===`capture-when-engaged`)||this.interactiveHandleManager?.capturingHandle?.captureMode===`capture-when-engaged`||this._before(e))&&V(e)}_handleVertexAddAndFinishPartCommand(e){this._before(e)||(V(e),this._commitNext(),this.finishPart())}async _handleViewpointMovedCommand(e){if(!this.editable)return;let t=H(e.originalEvent),n=U(e.originalEvent);await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(null,{...this.movementCommandContext,pointerType:t,pointerId:n})),this.interactiveHandleManager?.updateAllScreenPositions(this.movementCommandContext.surfaceManager)}async _handleManipulatorMoveToCommand(e){if(!this.editable)return;let t=H(e.originalEvent),n=U(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(n,t))return;let r=this._updateLastScreenPosition(e);this.interactiveHandleManager?.capturingHandle&&V(e),await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(r,{...this.movementCommandContext,pointerType:t,pointerId:n}))}async _handleManipulatorDragToCommand(e){if(!this.editable)return;let t=H(e.originalEvent),n=U(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(n,t))return;let r=this._updateLastScreenPosition(e),i=this.interactiveHandleManager?.findHandleByManipulator(r,t);t===`touch`&&i&&e.state===`start`&&this.interactiveHandleManager?.releaseHandle();let a=this.interactiveHandleManager?.findHandleDragging(),o=this.interactiveHandleManager?.capturingHandle,s=a??o??i;s&&!i&&V(e),s?.captureMode===`capture-when-engaged`||s?.captureMode===`capture-always`&&t===`touch`?e.state===`end`?await this._updatingHandles.addPromise(s.noteDragEnd(r,{...this.movementCommandContext,pointerType:t,pointerId:n}).then(()=>{s&&H(e.originalEvent)===`touch`&&s.captureMode!==`grabbable-object`&&s.defaultCaptureMode!==`capture-when-engaged`&&s.role===`primary`&&(this.interactiveHandleManager?.handleCount===1?this._handleCommand({action:`vertex-add`}):this.interactiveHandleManager?.releaseHandle())})):e.state===`start`?await this._updatingHandles.addPromise(s.noteDragStart(r,{...this.movementCommandContext,pointerType:t,pointerId:n}).then(()=>{s&&H(e.originalEvent)===`touch`&&s.captureMode!==`grabbable-object`&&s.defaultCaptureMode!==`capture-when-engaged`&&!s.editSession?.lastPointAddedBySession&&this._handleCommand({action:`vertex-add`})})):await this._updatingHandles.addPromise(s?.moveTo(r,{...this.movementCommandContext,pointerType:t,pointerId:n})):s?.captureMode===`grabbable-object`&&(this.interactiveHandleManager?.releaseHandle(o),await this._updatingHandles.addPromise(s.moveTo(r,{...this.movementCommandContext,pointerType:t,pointerId:n})))}async _handleVertexAddAtPointCommand(e){let t=this._updateLastScreenPosition(e),n=H(e.originalEvent),r=U(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(r,n))return;let i=this.interactiveHandleManager?.capturingHandle??this.interactiveHandleManager?.findHandleByManipulator(t,n);this.editable&&i&&(this._before(e)||(V(e),await this._updatingHandles.addPromise(i.moveTo(t,{...this.movementCommandContext,skipSnapping:!0,pointerType:n,pointerId:r}).finally(()=>this._commitNext()))))}_makeKeyBindings(){let e=new N,t=(t,n)=>{e.addToggle(t,e=>this._handleCommand({action:n,originalEvent:e,enabled:e.type===`key-down`}))},n=(t,n)=>{e.add(t,e=>this._handleCommand({action:n,originalEvent:e}))};return t(P.preserveAspectRatio,`constraint-aspect`),t(F.center,`constraint-center`),n(I.toggleFollowManipulator,`toggle-manipulator-follow`),n(F.undo,`undo`),n(F.redo,`redo`),n(F.complete,`complete`),n(F.vertexAdd,`vertex-add`),n({key:L.enterInputMode,continuePropagation:!0,repeats:!0},`show-tooltip`),e}_afterAttach(){}_afterDetach(e){this.interactiveHandleManager?.unregisterCustomConstraint(e),this.interactiveHandleManager?.unregisterHandle(e),this.tooltipManager?.unregisterPluginFields(e),this.globalStateManager.clearPluginOverrides(e);let t=this._pluginContexts.get(e);t&&(t.destroy(),this._pluginContexts.delete(e))}_beforeResume(e,t){this.interactiveHandleManager?.replaceEditSessions(e,t)}_commitNext(){let n={stack:[],error:void 0,hasError:!1};try{let t=this.mostDownstreamPlugin;if(!t)return;this.tooltipManager?.storeConstraintSnapshot();let r=this.tooltipManager?.getFieldsToUnlockOnVertexPlacement()??[],i=!1,a=this.editGeometryOperations;e(n,a?c(a.on(`vertex-add`,()=>i=!0)):null,!1),t.completeStep?t.completeStep():this.complete(t),i&&this.tooltipManager?.unlockOnVertexPlacement(r)}catch(e){n.error=e,n.hasError=!0}finally{t(n)}}_suspendPlugin(e){this.lifecycleManager.suspend(e),this.measurementManager.suspendPlugin(e)}_resumePlugin(e){this.lifecycleManager.resume(e)}_updateLastScreenPosition(e){let t=y(e.x,e.y);return this.lastScreenPosition=t,t}_getContextForPlugin(e,t){let n=u(this._pluginContexts,e,()=>new ne({drawTool:this,plugin:e,session:t}));return n.session=t,n}_before(e){if(!this.hasEventListener(`before-${e.action}`))return!1;let t=new CustomEvent(`before-${e.action}`,{detail:e,cancelable:!0});return this.emit(`before-${e.action}`,t),t.defaultPrevented}_guardCommand(e,t,n){return this._before(e)?n?.():t()}async _setupSegmentLabels(){let e=this.editGeometryOperations,t=this.toolOptions?.labels,n=!!t?.enabled,r=this.globalStateManager.segmentLabelsDisabled;if(!e||!t||!n){this._segmentLabels=d(this._segmentLabels);return}if(r){this._segmentLabels&&(this._segmentLabels.visible=!1);return}if(this._segmentLabels?.context?.editGeometryOperations===e&&this._segmentLabels.context.labelOptions===t){this._segmentLabels.visible=!0;return}let i=await this._createSegmentLabels(e,t);i&&(this._segmentLabels=d(this._segmentLabels),this._segmentLabels=i)}async _createSegmentLabels(e,t){this._segmentLabelsImportTask?.abort();let n=this._segmentLabelsImportTask=o(async n=>{if(this.view.type===`3d`){let r=import(`../3d/interactive/SegmentLabels3D.js`),{SegmentLabels3D:i}=await this._updatingHandles.addPromise(r);return this._isSegmentLabelsSetupStale(n,e,t)?null:new i({context:{view:this.view,editGeometryOperations:e,elevationInfo:D(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})}let r=import(`../2d/interactive/SegmentLabels2D.js`),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(r);return this._isSegmentLabelsSetupStale(n,e,t)?null:new i({context:{view:this.view,editGeometryOperations:e,elevationInfo:D(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})});return ee(n.promise)}_isSegmentLabelsSetupStale(e,t,n){return e.aborted||this.editGeometryOperations!==t||this.toolOptions?.labels!==n||!n.enabled||this.globalStateManager.segmentLabelsDisabled}};n([r()],$.prototype,`_commandsSuspended`,void 0),n([r()],$.prototype,`_zOfLastUserInput`,null),n([r()],$.prototype,`_snappingVisualizer`,void 0),n([r()],$.prototype,`_segmentLabels`,void 0),n([r()],$.prototype,`_segmentLabelsImportTask`,void 0),n([r()],$.prototype,`_tooltipDependencies`,null),n([r()],$.prototype,`_editSessionManagerContext`,null),n([r()],$.prototype,`_densificationParameters`,null),n([r({constructOnly:!0,nonNullable:!0})],$.prototype,`view`,void 0),n([r()],$.prototype,`automaticManipulatorSelection`,void 0),n([r()],$.prototype,`updating`,null),n([r()],$.prototype,`coordinateHelper`,null),n([r()],$.prototype,`editGeometry`,null),n([r()],$.prototype,`editGeometryOperations`,null),n([r()],$.prototype,`unprocessedGeometry`,null),n([r()],$.prototype,`simplifiedGeometryPreview`,null),n([r()],$.prototype,`_suppressCoincidentPointOverlaysIn3D`,null),n([r()],$.prototype,`_shapeVisualGeometry`,null),n([r()],$.prototype,`_vertexVisualGeometry`,null),n([r()],$.prototype,`snappingManager`,void 0),n([r()],$.prototype,`toolOptions`,void 0),n([r()],$.prototype,`disableTouchDrag`,void 0),n([r()],$.prototype,`elevationInfo`,void 0),n([r()],$.prototype,`hasZ`,void 0),n([r()],$.prototype,`defaultZ`,void 0),n([r()],$.prototype,`directionOptions`,void 0),n([r()],$.prototype,`canUndo`,null),n([r()],$.prototype,`canRedo`,null),n([r()],$.prototype,`pluginStack`,null),n([r()],$.prototype,`mostDownstreamPlugin`,null),n([r()],$.prototype,`mostUpstreamPlugin`,null),n([r()],$.prototype,`lastScreenPosition`,void 0),n([r()],$.prototype,`positionOfLastUserInput`,null),n([r()],$.prototype,`tooltipManager`,void 0),n([r()],$.prototype,`measurementManager`,void 0),n([r()],$.prototype,`globalStateManager`,void 0),n([r()],$.prototype,`editSessionManager`,void 0),n([r()],$.prototype,`lifecycleManager`,void 0),n([r()],$.prototype,`surfaceManager`,void 0),n([r()],$.prototype,`interactiveHandleManager`,void 0),n([r()],$.prototype,`renderer`,void 0),n([r()],$.prototype,`readPluginSetting`,void 0),n([r()],$.prototype,`movementCommandContext`,null),n([r()],$.prototype,`tooltip`,null),n([r()],$.prototype,`activeTooltipInfo`,null),n([r()],$.prototype,`helpMessageKey`,null),n([r({constructOnly:!0})],$.prototype,`enableVertexVisuals`,void 0),$=n([i(`esri.views.draw.DrawTool`)],$);export{$ as DrawTool};
2
+ import{__addDisposableResource as e,__disposeResources as t,__decorate as n}from"tslib";import{property as r}from"../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{diff as a}from"../../core/accessorSupport/diffUtils.js";import{createTask as o}from"../../core/asyncUtils.js";import{makeHandle as s,disposable as c}from"../../core/handleUtils.js";import l from"../../core/Logger.js";import{getOrCreateMapValue as u}from"../../core/MapUtils.js";import{destroyMaybe as d,abortMaybe as f}from"../../core/maybe.js";import{ignoreAbortErrors as ee}from"../../core/promiseUtils.js";import{when as p,initial as m,watch as h,syncAndInitial as g,on as _,sync as v}from"../../core/reactiveUtils.js";import{createScreenPoint as y,screenPointEqual as b}from"../../core/screenUtils.js";import{UpdatingHandles as x}from"../../core/support/UpdatingHandles.js";import{simplifyIsSimple as S,simplifyExecute as te}from"../../geometry/operators/simplifyOperator.js";import C from"../../geometry/Polygon.js";import{isCurvedGeometry as w}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as T}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{isPolygon as E}from"../../geometry/support/typeUtils.js";import{getEffectiveElevationInfo as D}from"../../support/elevationInfoUtils.js";import{getMaxDeviationInPixels as O,getMinSegmentsPerCurve as k}from"../2d/layers/graphics/densificationConstants.js";import{ViewEventPriorities as A}from"../input/InputManager.js";import{createCoordinateHelper as j}from"../interactive/coordinateHelper.js";import{InteractiveToolBase as M}from"../interactive/InteractiveToolBase.js";import{KeyBindings as N,mediaKeys as P,sketchKeys as F,advancedSketchKeys as I,tooltipKeys as L}from"../interactive/keybindings.js";import{isInputModeAvailable as R}from"../interactive/tooltip/tooltipCommonUtils.js";import{createSnappingVisualizer as z}from"./support/createSnappingVisualizer.js";import{multipointFromGeometry as B,markHandled as V,getPointerType as H,getPointerId as U}from"./support/drawToolUtils.js";import{viewEventToCommand as W}from"./support/input/drawToolInput.js";import{EditSessionManager as G}from"./support/managers/EditSessionManager.js";import{GlobalStateManager as K}from"./support/managers/GlobalStateManager.js";import{InteractiveHandleManager as q}from"./support/managers/InteractiveHandleManager.js";import{MeasurementManager as J}from"./support/managers/MeasurementManager.js";import{PluginLifecycleManager as Y}from"./support/managers/PluginLifecycleManager.js";import{SurfaceManager as X}from"./support/managers/SurfaceManager.js";import{TooltipManager as Z}from"./support/managers/TooltipManager.js";import{PluginContext as ne}from"./support/PluginContext.js";const Q=Symbol();let $=class extends M{constructor(e){super(e),this._shapeVisualId=Symbol(),this._vertexVisualId=Symbol(),this._pluginContexts=new Map,this._queuedFeedbackEvents=[],this._flushingQueuedFeedbackEvents=!1,this._commandsSuspended=!1,this._snappingVisualizer=null,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._updatingHandles=new x,this._keybindings=this._makeKeyBindings(),this._pendingBeginRequest=null,this.type=`draw-2.0`,this.automaticManipulatorSelection=!0,this.snappingManager=null,this.toolOptions=null,this.disableTouchDrag=!1,this.elevationInfo=null,this.hasZ=!1,this.defaultZ=0,this.lastScreenPosition=null,this.measurementManager=new J,this.globalStateManager=new K({getPluginStack:()=>this.pluginStack}),this.editSessionManager=new G({getContext:()=>this._editSessionManagerContext}),this.lifecycleManager=new Y({getContext:this._getContextForPlugin.bind(this),editSessionManager:this.editSessionManager,afterAttach:this._afterAttach.bind(this),afterDetach:this._afterDetach.bind(this),beforeResume:this._beforeResume.bind(this)}),this.surfaceManager=null,this.interactiveHandleManager=null,this.renderer=null,this.readPluginSetting=null,this.enableVertexVisuals=!0}initialize(){let{view:e}=this;this.interactiveHandleManager=new q({view:e,renderer:this.renderer}),this._override(`manipulators`,this.interactiveHandleManager.manipulators),this.tooltipManager=new Z({getDependencies:()=>this._tooltipDependencies,getLastScreenPosition:()=>this.lastScreenPosition}),this.addHandles(p(()=>this.renderer,t=>{t.addOrUpdateVisual(this._shapeVisualId,{role:`outputGeometry`}),t.addOrUpdateVisual(this._vertexVisualId,{role:`vertex`}),this._updatingHandles.addPromise(z(e,t).then(e=>this._snappingVisualizer=e))},m)),this.addHandles([h(()=>[this.view,this.coordinateHelper.spatialReference,this.defaultZ,this.hasZ,this.elevationInfo],([e,t,n,r,i])=>{this.surfaceManager?.destroy(),this.surfaceManager=new X({spatialReference:t,excludedGraphicsLayer:null,defaultZ:n,hasZ:r,view:e,elevationInfo:i,getContext:()=>({drawAtFixedElevation:this.globalStateManager.drawAtFixedElevation,elevationConstraint:this.tooltipManager?.elevationConstraint,constraintsEnabled:this.tooltipManager?.constraintsEnabled??!1})})},g),p(()=>this.toolOptions?.tooltips.effectiveEnabled,()=>this.measurementManager.preloadMeasurementUtils(),{once:!0,initial:!0}),h(()=>[this.editGeometryOperations,this.toolOptions?.labels.enabled,this.globalStateManager.segmentLabelsDisabled],()=>{this._updatingHandles.addPromise(this._setupSegmentLabels())},m),_(()=>this.editSessionManager,`cancelPlugin`,({plugin:e})=>{this._suspendPlugin(e)},v),_(()=>this.editSessionManager,`restartPlugin`,({restartInfo:e})=>{this._resumePlugin(e)},v),h(()=>this.lifecycleManager.updating,e=>{e||this._emitQueuedFeedbackEvents()},v),_(()=>this.editGeometryOperations,[`vertex-add`,`vertex-update`,`vertex-remove`],e=>{let t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),n=t.map(e=>e.coordinates);switch(e.type){case`vertex-add`:this._emitWhenReady(e.type,{...e,added:n,vertices:t});break;case`vertex-update`:this._emitWhenReady(e.type,{...e,updated:n,vertices:t});break;case`vertex-remove`:this._emitWhenReady(e.type,{...e,removed:n,vertices:t})}})])}destroy(){this.active&&this.onDeactivate(),this.editSessionManager.destroy(),this.lifecycleManager.destroy(),this.measurementManager.destroy(),this.globalStateManager.destroy();for(let e of this._pluginContexts.values())e.destroy();this._pluginContexts.clear(),this.surfaceManager=d(this.surfaceManager),this.interactiveHandleManager=d(this.interactiveHandleManager),this._segmentLabelsImportTask=f(this._segmentLabelsImportTask),this._segmentLabels=d(this._segmentLabels),this.tooltipManager=d(this.tooltipManager)}get _zOfLastUserInput(){let e=(this.mostDownstreamPlugin&&this.editSessionManager.getSession(this.mostDownstreamPlugin))?.firstPointAddedBySession?.point;return e?.hasZ?e.z:null}get _tooltipDependencies(){let{defaultZ:e,editGeometryOperations:t,toolOptions:n,directionOptions:r,elevationInfo:i,view:a}=this;return!t||!n||!a?null:{defaultZ:e,directionOptions:r,elevationInfo:i,editGeometryOperations:t,toolOptions:n,view:a,getActiveHandle:()=>this.interactiveHandleManager?.focusedHandle,getAllHandles:()=>this.interactiveHandleManager?.allhandles,getHelpMessageKey:()=>this.helpMessageKey,notifyTooltipsChanged:()=>{let{interactiveHandleManager:e,movementCommandContext:t}=this;e&&t&&e.reapplyPositions(t)}}}get _editSessionManagerContext(){let{coordinateHelper:e,view:t}=this;return t?{coordinateHelper:e,isGlobal:t.state.isGlobal}:null}get _densificationParameters(){let{view:e,coordinateHelper:t}=this,n=t.spatialReference,r=e?.spatialReference,i=e.resolution;if(!n||!r||!i||!Number.isFinite(i))return null;let a=r.metersPerUnit/n.metersPerUnit;return{maxDeviation:2**Math.round(Math.log2(i))*O()*a,minSegmentsPerCurve:k()}}get test(){return{densificationParameters:this._densificationParameters,segmentLabels:this._segmentLabels}}get updating(){return this._updatingHandles.updating||this.snappingManager?.updating||this.lifecycleManager.updating||!!this._segmentLabels?.updating}get coordinateHelper(){return j(this.hasZ,!1,this.view.spatialReference)}get editGeometry(){return this.editGeometryOperations?.data}get editGeometryOperations(){return this.editSessionManager.editGeometryOperations}get unprocessedGeometry(){return this.editSessionManager.outputGeometry}get simplifiedGeometryPreview(){let e=this.editSessionManager.outputGeometry;if(e&&E(e))try{let t=this._densificationParameters,n=w(e)&&t?new C({...T(e,t)}):e;if(!S(n))return te(n)}catch{return e}return e}get _suppressCoincidentPointOverlaysIn3D(){return this.view.type===`3d`&&this.unprocessedGeometry?.type===`point`&&!!this.interactiveHandleManager?.allhandles?.find(e=>e.role===`primary`)?.outputMapPosition}get _shapeVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.simplifiedGeometryPreview}get _vertexVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.unprocessedGeometry}get canUndo(){return this.editSessionManager.canUndo}get canRedo(){return this.editSessionManager.canRedo}get pluginStack(){return this.lifecycleManager.pluginStack}get mostDownstreamPlugin(){return this.pluginStack.at(-1)}get mostUpstreamPlugin(){return this.pluginStack.at(0)}get positionOfLastUserInput(){let e=this.lastScreenPosition;return e?this.surfaceManager?.screenToMap(e,{firstPointZ:this._zOfLastUserInput})??this.view.toMap(e):this.view.center}get movementCommandContext(){let{editGeometryOperations:e,tooltipManager:t,surfaceManager:n,snappingManager:r,interactiveHandleManager:i,_snappingVisualizer:a,defaultZ:o,hasZ:s,globalStateManager:{drawAtFixedElevation:c},view:l}=this;return{tooltipManager:t,editGeometryOperations:e,surfaceManager:n,interactiveHandleManager:i,snappingManager:r,snappingVisualizer:a,pointerType:`mouse`,hasZ:s,defaultZ:o,view:l,drawAtFixedElevation:c}}get tooltip(){return this.tooltipManager?.tooltip}get activeTooltipInfo(){return this.tooltipManager?.tooltipInfo}get helpMessageKey(){return this.pluginStack.items.findLast(e=>e.helpMessageKey)?.helpMessageKey??`noTool`}begin(e){this.active?(this.lifecycleManager.begin(e),this._pendingBeginRequest=null):this._pendingBeginRequest=e}complete(e){let t=this.lifecycleManager;if(e&&t.complete(e),t.pluginStack.length===0){let e=this.unprocessedGeometry,t=!e||e.type===`mesh`||S(e);this.emit(`complete`,{geometry:e,isSimple:t,aborted:!1,type:`complete`,vertices:[]}),this.view?.activeTool===this&&(this.view.activeTool=null)}}cancelFirstUserLeafPlugin(){let e=this.pluginStack.toArray().findLast(e=>e.configuration?.hidden!==!0);e&&this.lifecycleManager.cancel(e)}getVertexSnappingCandidates(){return this.interactiveHandleManager?.capturingHandle?.role===`secondary`?[]:this.snappingManager?.getVertexCandidates()??[]}replaceLeaf(e){let t=this.lifecycleManager;t.updating?l.getLogger(this).info(`Ignoring command; arrived while updating:`,`replaceLeaf`):t.replaceLeaf(e)}finishPart(){let e=this.mostUpstreamPlugin?.configuration;if(this.editGeometryOperations&&e&&e.kind?.includes(`multipart`)){let e=this.pluginStack.at(1);e&&this.complete(e)}}undo(){this._handleCommand({action:`undo`})}redo(){this._handleCommand({action:`redo`})}executeCommand(e){return this._handleCommand(e)}suspendCommands(){return this._commandsSuspended=!0,s(()=>{this._commandsSuspended=!1;let e=this.view?.inputManager.latestPointerInfo;if(e){let{x:t,y:n}=e.location;this._handleCommand({action:`manipulator-move-to`,x:t,y:n})}})}addPromise(e){return this._updatingHandles.addPromise(e)}readPluginSettingValue(e,t){return this.readPluginSetting?.(e,t)}getGeometryIfCompleted(){let e=this.lifecycleManager.gatherCompletablePlugins();return this.editSessionManager?.generatePreviewGeometryForPlugins(e)}onActivate(){super.onActivate();let{view:e}=this;this.lastScreenPosition=e?.inputManager.latestPointerInfo?.location,this.renderer?.activate(),this._pendingBeginRequest&&=(this.begin(this._pendingBeginRequest),null),this.enableVertexVisuals&&this.addHandles(h(()=>this._vertexVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._vertexVisualId,{geometry:e?B(e):null})},m)),this.addHandles([h(()=>this._shapeVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._shapeVisualId,{geometry:e})},m),p(()=>this.interactiveHandleManager?.capturingHandle?.screenPosition,e=>this.lastScreenPosition=e,{initial:!0,equals:b}),h(()=>this.interactiveHandleManager?.capturingHandle?.outputMapPosition,(e,t)=>{let n=this.interactiveHandleManager?.capturingHandle?.editSession?.endVertex;e&&t&&n&&this._emitWhenReady(`cursor-update`,{updated:n.pos,type:`vertex-update`,operation:`apply`,vertices:[{componentIndex:n.part.index,vertexIndex:n.index,coordinates:n.pos}]})},v),this._keybindings.register(e,A.TOOL),h(()=>e.viewpoint,(e,t)=>{e&&t&&a(e,t)&&this._handleCommand({action:`viewpoint-moved`})})],Q)}onDeactivate(){super.onDeactivate(),this.removeHandles(Q),this.renderer?.deactivate(),this.snappingManager?.doneSnapping(),this.lifecycleManager.cancelAll(),this._pendingBeginRequest=null}onInputEvent(e){if(this.disableTouchDrag&&(e.type===`drag`||e.type===`pointer-drag`)&&e.pointerType===`touch`)return;e.type===`pointer-down`?this.interactiveHandleManager?.notePointerDown(e.pointerId,e.pointerType):(e.type===`pointer-up`||e.type===`pointer-leave`)&&this.interactiveHandleManager?.notePointerUp(e.pointerId,e.pointerType);let t=W(e);t&&this._handleCommand(t)}forceAddVertex(){this._commitNext()}_emitWhenReady(e,t){if(this.destroyed)return;let n=()=>{this.emit(e,t)};this.lifecycleManager.updating||this._flushingQueuedFeedbackEvents?this._queuedFeedbackEvents.push(n):n()}_emitQueuedFeedbackEvents(){if(!(this.destroyed||this._flushingQueuedFeedbackEvents||this.lifecycleManager.updating||this._queuedFeedbackEvents.length===0)){this._flushingQueuedFeedbackEvents=!0;try{for(;!this.destroyed&&!this.lifecycleManager.updating&&this._queuedFeedbackEvents.length>0;)this._queuedFeedbackEvents.shift()?.()}finally{this._flushingQueuedFeedbackEvents=!1}}}async _handleCommand(e){if(!this._commandsSuspended){if(this.lifecycleManager.updating)l.getLogger(this).info(`Ignoring command; arrived while updating:`,e.action);else switch(e.action){case`view-drag`:return await this._handleViewDragCommand(e);case`vertex-add`:return this._guardCommand(e,()=>{V(e),this._commitNext()});case`vertex-add-and-finish-part`:return this._handleVertexAddAndFinishPartCommand(e);case`cancel`:return this._guardCommand(e,()=>this.cancel());case`complete`:return this._guardCommand(e,()=>{this.mostUpstreamPlugin&&(V(e),this.complete(this.mostUpstreamPlugin))});case`finish-part`:return this._guardCommand(e,()=>this.finishPart());case`undo`:return this._guardCommand(e,()=>this.editSessionManager.undo());case`redo`:return this._guardCommand(e,()=>this.editSessionManager.redo());case`next-manipulator`:return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator(`forward`));case`previous-manipulator`:return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator(`backward`));case`toggle-manipulator-follow`:this.interactiveHandleManager?.toggleFollow()&&V(e);break;case`viewpoint-moved`:return await this._handleViewpointMovedCommand(e);case`manipulator-move-to`:return await this._handleManipulatorMoveToCommand(e);case`manipulator-drag-to`:return await this._handleManipulatorDragToCommand(e);case`vertex-add-at-point`:return await this._handleVertexAddAtPointCommand(e);case`show-tooltip`:return this._guardCommand(e,async()=>{let t=this.tooltipManager?.tooltip;t&&R(t.info)&&(await t.enterInputMode(),V(e))});case`constraint-center`:this.globalStateManager.setCentered(e.enabled);break;case`constraint-aspect`:this.globalStateManager.setPreserveAspectRatio(e.enabled)}}}async _handleViewDragCommand(e){if(!this.editable)return;let t=e.originalEvent,n=this.interactiveHandleManager?.capturingHandle;(t&&`pointerType`in t&&t.pointerType===`touch`&&(n?.captureMode===`capture-always`||n?.captureMode===`capture-when-engaged`)||this.interactiveHandleManager?.capturingHandle?.captureMode===`capture-when-engaged`||this._before(e))&&V(e)}_handleVertexAddAndFinishPartCommand(e){this._before(e)||(V(e),this._commitNext(),this.finishPart())}async _handleViewpointMovedCommand(e){if(!this.editable)return;let t=H(e.originalEvent),n=U(e.originalEvent);await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(null,{...this.movementCommandContext,pointerType:t,pointerId:n})),this.interactiveHandleManager?.updateAllScreenPositions(this.movementCommandContext.surfaceManager)}async _handleManipulatorMoveToCommand(e){if(!this.editable)return;let t=H(e.originalEvent),n=U(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(n,t))return;let r=this._updateLastScreenPosition(e);this.interactiveHandleManager?.capturingHandle&&V(e),await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(r,{...this.movementCommandContext,pointerType:t,pointerId:n}))}async _handleManipulatorDragToCommand(e){if(!this.editable)return;let t=H(e.originalEvent),n=U(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(n,t))return;let r=this._updateLastScreenPosition(e),i=this.interactiveHandleManager?.findHandleByManipulator(r,t);t===`touch`&&i&&e.state===`start`&&this.interactiveHandleManager?.releaseHandle();let a=this.interactiveHandleManager?.findHandleDragging(),o=this.interactiveHandleManager?.capturingHandle,s=a??o??i;s&&!i&&V(e),s?.captureMode===`capture-when-engaged`||s?.captureMode===`capture-always`&&t===`touch`?e.state===`end`?await this._updatingHandles.addPromise(s.noteDragEnd(r,{...this.movementCommandContext,pointerType:t,pointerId:n}).then(()=>{s&&H(e.originalEvent)===`touch`&&s.captureMode!==`grabbable-object`&&s.defaultCaptureMode!==`capture-when-engaged`&&s.role===`primary`&&(this.interactiveHandleManager?.handleCount===1?this._handleCommand({action:`vertex-add`}):this.interactiveHandleManager?.releaseHandle())})):e.state===`start`?await this._updatingHandles.addPromise(s.noteDragStart(r,{...this.movementCommandContext,pointerType:t,pointerId:n}).then(()=>{s&&H(e.originalEvent)===`touch`&&s.captureMode!==`grabbable-object`&&s.defaultCaptureMode!==`capture-when-engaged`&&!s.editSession?.lastPointAddedBySession&&this._handleCommand({action:`vertex-add`})})):await this._updatingHandles.addPromise(s?.moveTo(r,{...this.movementCommandContext,pointerType:t,pointerId:n})):s?.captureMode===`grabbable-object`&&(this.interactiveHandleManager?.releaseHandle(o),await this._updatingHandles.addPromise(s.moveTo(r,{...this.movementCommandContext,pointerType:t,pointerId:n})))}async _handleVertexAddAtPointCommand(e){let t=this._updateLastScreenPosition(e),n=H(e.originalEvent),r=U(e.originalEvent);if(!this.interactiveHandleManager?.shouldCaptureInput(r,n))return;let i=this.interactiveHandleManager?.capturingHandle??this.interactiveHandleManager?.findHandleByManipulator(t,n);this.editable&&i&&(this._before(e)||(V(e),await this._updatingHandles.addPromise(i.moveTo(t,{...this.movementCommandContext,skipSnapping:!0,pointerType:n,pointerId:r}).finally(()=>this._commitNext()))))}_makeKeyBindings(){let e=new N,t=(t,n)=>{e.addToggle(t,e=>this._handleCommand({action:n,originalEvent:e,enabled:e.type===`key-down`}))},n=(t,n)=>{e.add(t,e=>this._handleCommand({action:n,originalEvent:e}))};return t(P.preserveAspectRatio,`constraint-aspect`),t(F.center,`constraint-center`),n(I.toggleFollowManipulator,`toggle-manipulator-follow`),n(F.undo,`undo`),n(F.redo,`redo`),n(F.complete,`complete`),n(F.vertexAdd,`vertex-add`),n({key:L.enterInputMode,continuePropagation:!0,repeats:!0},`show-tooltip`),e}_afterAttach(){}_afterDetach(e){this.interactiveHandleManager?.unregisterCustomConstraint(e),this.interactiveHandleManager?.unregisterHandle(e),this.tooltipManager?.unregisterPluginFields(e),this.globalStateManager.clearPluginOverrides(e);let t=this._pluginContexts.get(e);t&&(t.destroy(),this._pluginContexts.delete(e))}_beforeResume(e,t){this.interactiveHandleManager?.replaceEditSessions(e,t)}_commitNext(){let n={stack:[],error:void 0,hasError:!1};try{let t=this.mostDownstreamPlugin;if(!t)return;this.tooltipManager?.storeConstraintSnapshot();let r=this.tooltipManager?.getFieldsToUnlockOnVertexPlacement()??[],i=!1,a=this.editGeometryOperations;e(n,a?c(a.on(`vertex-add`,()=>i=!0)):null,!1),t.completeStep?t.completeStep():this.complete(t),i&&this.tooltipManager?.unlockOnVertexPlacement(r)}catch(e){n.error=e,n.hasError=!0}finally{t(n)}}_suspendPlugin(e){this.lifecycleManager.suspend(e),this.measurementManager.suspendPlugin(e)}_resumePlugin(e){this.lifecycleManager.resume(e)}_updateLastScreenPosition(e){let t=y(e.x,e.y);return this.lastScreenPosition=t,t}_getContextForPlugin(e,t){let n=u(this._pluginContexts,e,()=>new ne({drawTool:this,plugin:e,session:t}));return n.session=t,n}_before(e){if(!this.hasEventListener(`before-${e.action}`))return!1;let t=new CustomEvent(`before-${e.action}`,{detail:e,cancelable:!0});return this.emit(`before-${e.action}`,t),t.defaultPrevented}_guardCommand(e,t,n){return this._before(e)?n?.():t()}async _setupSegmentLabels(){let e=this.editGeometryOperations,t=this.toolOptions?.labels,n=!!t?.enabled,r=this.globalStateManager.segmentLabelsDisabled;if(!e||!t||!n){this._segmentLabels=d(this._segmentLabels);return}if(r){this._segmentLabels&&(this._segmentLabels.visible=!1);return}if(this._segmentLabels?.context?.editGeometryOperations===e&&this._segmentLabels.context.labelOptions===t){this._segmentLabels.visible=!0;return}let i=await this._createSegmentLabels(e,t);i&&(this._segmentLabels=d(this._segmentLabels),this._segmentLabels=i)}async _createSegmentLabels(e,t){this._segmentLabelsImportTask?.abort();let n=this._segmentLabelsImportTask=o(async n=>{if(this.view.type===`3d`){let r=import(`../3d/interactive/SegmentLabels3D.js`),{SegmentLabels3D:i}=await this._updatingHandles.addPromise(r);return this._isSegmentLabelsSetupStale(n,e,t)?null:new i({context:{view:this.view,editGeometryOperations:e,elevationInfo:D(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})}let r=import(`../2d/interactive/SegmentLabels2D.js`),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(r);return this._isSegmentLabelsSetupStale(n,e,t)?null:new i({context:{view:this.view,editGeometryOperations:e,elevationInfo:D(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})});return ee(n.promise)}_isSegmentLabelsSetupStale(e,t,n){return e.aborted||this.editGeometryOperations!==t||this.toolOptions?.labels!==n||!n.enabled||this.globalStateManager.segmentLabelsDisabled}};n([r()],$.prototype,`_commandsSuspended`,void 0),n([r()],$.prototype,`_zOfLastUserInput`,null),n([r()],$.prototype,`_snappingVisualizer`,void 0),n([r()],$.prototype,`_segmentLabels`,void 0),n([r()],$.prototype,`_segmentLabelsImportTask`,void 0),n([r()],$.prototype,`_tooltipDependencies`,null),n([r()],$.prototype,`_editSessionManagerContext`,null),n([r()],$.prototype,`_densificationParameters`,null),n([r({constructOnly:!0,nonNullable:!0})],$.prototype,`view`,void 0),n([r()],$.prototype,`automaticManipulatorSelection`,void 0),n([r()],$.prototype,`updating`,null),n([r()],$.prototype,`coordinateHelper`,null),n([r()],$.prototype,`editGeometry`,null),n([r()],$.prototype,`editGeometryOperations`,null),n([r()],$.prototype,`unprocessedGeometry`,null),n([r()],$.prototype,`simplifiedGeometryPreview`,null),n([r()],$.prototype,`_suppressCoincidentPointOverlaysIn3D`,null),n([r()],$.prototype,`_shapeVisualGeometry`,null),n([r()],$.prototype,`_vertexVisualGeometry`,null),n([r()],$.prototype,`snappingManager`,void 0),n([r()],$.prototype,`toolOptions`,void 0),n([r()],$.prototype,`disableTouchDrag`,void 0),n([r()],$.prototype,`elevationInfo`,void 0),n([r()],$.prototype,`hasZ`,void 0),n([r()],$.prototype,`defaultZ`,void 0),n([r()],$.prototype,`directionOptions`,void 0),n([r()],$.prototype,`canUndo`,null),n([r()],$.prototype,`canRedo`,null),n([r()],$.prototype,`pluginStack`,null),n([r()],$.prototype,`mostDownstreamPlugin`,null),n([r()],$.prototype,`mostUpstreamPlugin`,null),n([r()],$.prototype,`lastScreenPosition`,void 0),n([r()],$.prototype,`positionOfLastUserInput`,null),n([r()],$.prototype,`tooltipManager`,void 0),n([r()],$.prototype,`measurementManager`,void 0),n([r()],$.prototype,`globalStateManager`,void 0),n([r()],$.prototype,`editSessionManager`,void 0),n([r()],$.prototype,`lifecycleManager`,void 0),n([r()],$.prototype,`surfaceManager`,void 0),n([r()],$.prototype,`interactiveHandleManager`,void 0),n([r()],$.prototype,`renderer`,void 0),n([r()],$.prototype,`readPluginSetting`,void 0),n([r()],$.prototype,`movementCommandContext`,null),n([r()],$.prototype,`tooltip`,null),n([r()],$.prototype,`activeTooltipInfo`,null),n([r()],$.prototype,`helpMessageKey`,null),n([r({constructOnly:!0})],$.prototype,`enableVertexVisuals`,void 0),$=n([i(`esri.views.draw.DrawTool`)],$);export{$ as DrawTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/Point.js";import{ViewEventPriorities as i}from"../input/InputManager.js";import{EditGeometry as a,Part as o}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as s}from"../interactive/editGeometry/EditGeometryOperations.js";import{sketchKeys as c}from"../interactive/keybindings.js";import{createScreenPointFromEvent as l}from"../support/screenUtils.js";import u from"./CursorUpdateEvent.js";import d from"./DrawAction.js";import f from"./DrawCompleteEvent.js";import{createViewAlignedCoordinateSystem as p}from"./support/surfaceCoordinateSystems.js";import m from"./VertexAddEvent.js";const h=[`freehand`,`click`];let g=class extends d{constructor(e){super(e),this._isDragging=!1,this._panEnabled=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.viewAlignedCoordinateSystem=null,this.mode=`freehand`}initialize(){this.view.type===`2d`?this._addViewHandles():this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit(`destroy`)}complete(){this._completeDrawing()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this.mode===`click`?this.addHandles(this._getClickModeViewHandles()):this.addHandles(this._getDragModeViewHandles())}_getDragModeViewHandles(){return[this.view.on(`immediate-click`,e=>{e.stopPropagation(),e.mapPoint&&!this._panEnabled&&this.getCoordsFromScreenPoint(l(e))!=null&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))},i.TOOL),this.view.on(`pointer-down`,e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._panEnabled||(this._resetGeometry(),this._addVertexOnPointerUp=!0,this._cursorScreenPoint=l(e),this._activePointerId=e.pointerId,this._vertexAddHandler(e),this._isDragging=!1,e.pointerType===`touch`&&this._updateCursor()))},i.TOOL),this.view.on(`pointer-move`,e=>{this._abortSnapping(),this._activePointerId==null&&e.pointerType!==`touch`&&(this._cursorScreenPoint=l(e),this._updateCursor())},i.TOOL),this.view.on(`pointer-drag`,e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0,this._cursorScreenPoint=l(e),this._updateCursor())},i.TOOL),this.view.on(`pointer-up`,e=>{this._shouldHandlePointerEvent(e)&&this._addVertexOnPointerUp&&(this._abortSnapping(),this._activePointerId=null,this._isDragging&&this._vertexAddHandler(e),this._committedVertices.length===2&&this._drawCompleteHandler(e),this._isDragging=!1)},i.TOOL),this.view.on(`key-down`,e=>{e.key===c.complete&&this._cursorScreenPoint?(this._abortSnapping(),this._vertexAddHandler(e),this._drawCompleteHandler(e)):e.key===c.pan&&(this._panEnabled=!0)},i.TOOL),this.view.on(`key-up`,e=>{e.key===c.pan&&(this._panEnabled=!1)},i.TOOL),this.view.on(`drag`,e=>{this._activePointerId!=null&&e.stopPropagation()},i.TOOL),this.view.on(`drag`,[`Shift`],e=>{e.stopPropagation()},i.TOOL)]}_getClickModeViewHandles(){return[this.view.on(`pointer-down`,e=>{this._abortSnapping(),this._cursorScreenPoint=l(e),this._activePointerId=e.pointerId,this._isDragging=!1,e.pointerType===`touch`&&this._updateCursor()},i.TOOL),this.view.on(`pointer-move`,e=>{this._abortSnapping(),this._cursorScreenPoint=l(e),this._activePointerId==null&&e.pointerType!==`touch`&&this._updateCursor()},i.TOOL),this.view.on(`pointer-drag`,e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0)},i.TOOL),this.view.on(`pointer-up`,e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=null,e.stopPropagation(),this._isDragging||this._vertexAddHandler(e),this.vertices.length===2&&!this._isDragging&&this._drawCompleteHandler(e),this._isDragging=!1)},i.TOOL),this.view.on(`key-down`,e=>{e.key===c.vertexAdd&&this._cursorScreenPoint&&(this._vertexAddHandler(e),this.vertices.length===2&&this._drawCompleteHandler(e)),e.key===c.complete&&this._cursorScreenPoint&&this.vertices.length===2&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))},i.TOOL)]}async _addDrawTool(){let{LegacyDrawTool:e}=await import(`./LegacyDrawTool.js`),t=new e({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:`segment`,mode:this.mode});this.destroyed?t.destroy():(this._drawTool=t,this.view.addAndActivateTool(t),this.addHandles([t.on(`vertex-add`,e=>{e.vertices.length===1&&this.emit(`vertex-add`,new m(this.view,e.vertices[0].vertexIndex,t.getVertexCoords()))}),t.on(`cursor-update`,e=>{e.vertices.length===1&&this.emit(`cursor-update`,new u(this.view,e.vertices[0].vertexIndex,t.getVertexCoords()))}),t.on(`complete`,e=>{this.emit(`draw-complete`,new f(t.getVertexCoords())),this._removeDrawTool()}),this.view.on(`key-down`,e=>{e.key===c.vertexAdd&&!e.repeat&&this.mode===`click`?t.drawOperation.numCommittedVertices>0?t.completeCreateOperation():t.drawOperation.commitStagedVertex():e.key===c.complete&&!e.repeat&&t.completeCreateOperation()},i.TOOL)]))}_removeDrawTool(){this._drawTool&&=(this.view.tools.remove(this._drawTool),null)}_addVertex(e){let t=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(t))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertexToFirstPart(t),this._committedVertices.length===1&&(this.viewAlignedCoordinateSystem=p(this.view,this._committedVertices[0]));let n=this._committedVertices.length-1,r=new m(this.view,n,this.vertices);this.emit(`vertex-add`,r)}_updateCursor(){if(this._popCursorVertex(),!this._cursorScreenPoint)return;let e=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);e!=null&&this._pushCursorVertex(e.vertex,()=>this.emit(`cursor-update`,new u(this.view,this._activeComponent.vertices.length,this.vertices,this._stagedVertex==null?null:new r(this._stagedVertex))))}_completeDrawing(){if(this._drawTool){this._drawTool.completeCreateOperation(),this.removeAllHandles();return}if(this._activePointerId=null,this._popCursorVertex(),this._cursorScreenPoint=null,this._isDragging=!1,this._abortSnapping(),this._snappingManager!=null&&this._snappingManager.doneSnapping(),this.vertices.length<1)return;let e=new f(this.vertices);this.emit(`draw-complete`,e),e.defaultPrevented||this.removeAllHandles()}_resetGeometry(){this._editGeometryOperations.destroy(),this._editGeometryOperations=new s(new a(`polygon`,this._coordinateHelper),2),this._activeComponent=new o(this._coordinateHelper.spatialReference,2),this._editGeometryOperations.data.parts.push(this._activeComponent)}};e([t({type:h})],g.prototype,`mode`,void 0),g=e([n(`esri.views.draw.SegmentDrawAction`)],g);const _=g;export{_ as default};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/Point.js";import{ViewEventPriorities as i}from"../input/InputManager.js";import{EditGeometry as a,Part as o}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as s}from"../interactive/editGeometry/EditGeometryOperations.js";import{sketchKeys as c}from"../interactive/keybindings.js";import{createScreenPointFromEvent as l}from"../support/screenUtils.js";import u from"./CursorUpdateEvent.js";import d from"./DrawAction.js";import f from"./DrawCompleteEvent.js";import{createViewAlignedCoordinateSystem as p}from"./support/surfaceCoordinateSystems.js";import m from"./VertexAddEvent.js";const h=[`freehand`,`click`];let g=class extends d{constructor(e){super(e),this._isDragging=!1,this._panEnabled=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.viewAlignedCoordinateSystem=null,this.mode=`freehand`}initialize(){this.view.type===`2d`?this._addViewHandles():this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit(`destroy`)}complete(){this._completeDrawing()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this.mode===`click`?this.addHandles(this._getClickModeViewHandles()):this.addHandles(this._getDragModeViewHandles())}_getDragModeViewHandles(){return[this.view.on(`immediate-click`,e=>{e.stopPropagation(),e.mapPoint&&!this._panEnabled&&this.getCoordsFromScreenPoint(l(e))!=null&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))},i.TOOL),this.view.on(`pointer-down`,e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._panEnabled||(this._resetGeometry(),this._addVertexOnPointerUp=!0,this._cursorScreenPoint=l(e),this._activePointerId=e.pointerId,this._vertexAddHandler(e),this._isDragging=!1,e.pointerType===`touch`&&this._updateCursor()))},i.TOOL),this.view.on(`pointer-move`,e=>{this._abortSnapping(),this._activePointerId==null&&e.pointerType!==`touch`&&(this._cursorScreenPoint=l(e),this._updateCursor())},i.TOOL),this.view.on(`pointer-drag`,e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0,this._cursorScreenPoint=l(e),this._updateCursor())},i.TOOL),this.view.on(`pointer-up`,e=>{this._shouldHandlePointerEvent(e)&&this._addVertexOnPointerUp&&(this._abortSnapping(),this._activePointerId=null,this._isDragging&&this._vertexAddHandler(e),this._committedVertices.length===2&&this._drawCompleteHandler(e),this._isDragging=!1)},i.TOOL),this.view.on(`key-down`,e=>{e.key===c.complete&&this._cursorScreenPoint?(this._abortSnapping(),this._vertexAddHandler(e),this._drawCompleteHandler(e)):e.key===c.pan&&(this._panEnabled=!0)},i.TOOL),this.view.on(`key-up`,e=>{e.key===c.pan&&(this._panEnabled=!1)},i.TOOL),this.view.on(`drag`,e=>{this._activePointerId!=null&&e.stopPropagation()},i.TOOL),this.view.on(`drag`,[`Shift`],e=>{e.stopPropagation()},i.TOOL)]}_getClickModeViewHandles(){return[this.view.on(`pointer-down`,e=>{this._abortSnapping(),this._cursorScreenPoint=l(e),this._activePointerId=e.pointerId,this._isDragging=!1,e.pointerType===`touch`&&this._updateCursor()},i.TOOL),this.view.on(`pointer-move`,e=>{this._abortSnapping(),this._cursorScreenPoint=l(e),this._activePointerId==null&&e.pointerType!==`touch`&&this._updateCursor()},i.TOOL),this.view.on(`pointer-drag`,e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0)},i.TOOL),this.view.on(`pointer-up`,e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=null,e.stopPropagation(),this._isDragging||this._vertexAddHandler(e),this.vertices.length===2&&!this._isDragging&&this._drawCompleteHandler(e),this._isDragging=!1)},i.TOOL),this.view.on(`key-down`,e=>{e.key===c.vertexAdd&&this._cursorScreenPoint&&(this._vertexAddHandler(e),this.vertices.length===2&&this._drawCompleteHandler(e)),e.key===c.complete&&this._cursorScreenPoint&&this.vertices.length===2&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))},i.TOOL)]}async _addDrawTool(){let{LegacyDrawTool:e}=await import(`./LegacyDrawTool.js`),t=new e({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:`segment`,mode:this.mode});this.destroyed?t.destroy():(this._drawTool=t,this.view.addAndActivateTool(t),this.addHandles([t.on(`vertex-add`,e=>{e.vertices.length===1&&this.emit(`vertex-add`,new m(this.view,e.vertices[0].vertexIndex,t.getVertexCoords()))}),t.on(`cursor-update`,e=>{e.vertices.length===1&&this.emit(`cursor-update`,new u(this.view,e.vertices[0].vertexIndex,t.getVertexCoords()))}),t.on(`complete`,e=>{this.emit(`draw-complete`,new f(t.getVertexCoords())),this._removeDrawTool()}),this.view.on(`key-down`,e=>{e.key===c.vertexAdd&&!e.repeat&&this.mode===`click`?t.drawOperation.numCommittedVertices>0?t.completeCreateOperation():t.drawOperation.commitStagedVertex():e.key===c.complete&&!e.repeat&&t.completeCreateOperation()},i.TOOL)]))}_removeDrawTool(){this._drawTool&&=(this.view.tools.remove(this._drawTool),null)}_addVertex(e){let t=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(t))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertexToFirstPart(t),this._committedVertices.length===1&&(this.viewAlignedCoordinateSystem=p(this.view,this._committedVertices[0]));let n=this._committedVertices.length-1,r=new m(this.view,n,this.vertices);this.emit(`vertex-add`,r)}_updateCursor(){if(this._popCursorVertex(),!this._cursorScreenPoint)return;let e=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);e!=null&&this._pushCursorVertex(e.vertex,()=>this.emit(`cursor-update`,new u(this.view,this._activeComponent.vertices.length,this.vertices,this._stagedVertex==null?null:new r(this._stagedVertex))))}_completeDrawing(){if(this._drawTool){this._drawTool.completeCreateOperation(),this.removeAllHandles();return}if(this._activePointerId=null,this._popCursorVertex(),this._cursorScreenPoint=null,this._isDragging=!1,this._abortSnapping(),this._snappingManager!=null&&this._snappingManager.doneSnapping(),this.vertices.length<1)return;let e=new f(this.vertices);this.emit(`draw-complete`,e),e.defaultPrevented||this.removeAllHandles()}_resetGeometry(){this._editGeometryOperations.destroy(),this._editGeometryOperations=new s(new a(`polygon`,this._coordinateHelper),this.view.state.isGlobal),this._activeComponent=new o(this._coordinateHelper.spatialReference,this.view.state.isGlobal),this._editGeometryOperations.data.parts.push(this._activeComponent)}};e([t({type:h})],g.prototype,`mode`,void 0),g=e([n(`esri.views.draw.SegmentDrawAction`)],g);const _=g;export{_ as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Collection.js";import a from"../../../core/Error.js";import{EventedAccessor as o}from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{getOrCreateMapValue as c}from"../../../core/MapUtils.js";import{destroyMaybe as l,abortMaybe as u,assertIsSome as d}from"../../../core/maybe.js";import{throwIfAborted as f}from"../../../core/promiseUtils.js";import{pausable as p,when as m,watch as h,initial as g,sync as _}from"../../../core/reactiveUtils.js";import{UpdatingHandles as v}from"../../../core/support/UpdatingHandles.js";import y from"../../../geometry/Point.js";import b from"../../../geometry/Polyline.js";import{closeRingsAndFixWinding as x,geometryToCoordinates as S}from"../../../geometry/support/coordsUtils.js";import{interpolateCircle as C}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as w}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as T,getEndpoint as E,isCircularArc as D,isEllipticArc4 as O,isBezierCurve as k,isCoordinate as A,cloneCurve as ee,isEllipticArc7 as j}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as M}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{normalizeEllipticArcAfterEndpointChange as N}from"../../../geometry/support/curves/ellipticArc7Utils.js";import{wrapAtan2 as te}from"../../../geometry/support/curves/mathUtils.js";import{fromJSON as ne}from"../../../geometry/support/jsonUtils.js";import{isPoint as P}from"../../../geometry/support/typeUtils.js";import re from"../../../Graphic.js";import ie from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as ae}from"../../2d/interactive/SnappingVisualizer2D.js";import{ViewEventPriorities as oe}from"../../input/InputManager.js";import{createCoordinateHelper as se}from"../../interactive/coordinateHelper.js";import{EditGeometryOperations as ce}from"../../interactive/editGeometry/EditGeometryOperations.js";import{sketchKeys as le}from"../../interactive/keybindings.js";import ue from"../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as de}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as fe,enterInputModeIfAvailable as pe}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as me}from"../../support/GeometryWorkerHandle.js";import{ConnectedReshapeManager as he}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as ge,getZFromVertexSnappingCandidates as _e,cloneMove as ve}from"./drawUtils.js";import F from"./GraphicMover.js";import ye from"./HighlightHelper.js";import{addUniqueLayer as be,isConnectedReshapeSupportedLayer as xe}from"./layerUtils.js";import{createTooltipInfos as Se,connectTooltip as Ce,updateTranslateTooltipInfo as we,updateTranslateVertexTooltipInfo as Te}from"./reshapeTooltipUtils.js";import{defaultSymbols as Ee,createMidpointGraphics as De,createVertexGraphics as I,createCurveControlPointGraphics as Oe,createCurveConstructionLineGraphics as ke,attributeKeys as L,getMidpoint as R,controlPointKinds as z,fastCloneGeometry as B,saveUpdatedCurveOrCoordinate as V,toolIdAttribute as Ae,splitCurve as je,isSingleSegmentCircle as Me,isSingleSegmentEllipse as Ne}from"./reshapeUtils.js";const H=Symbol(),U={mode:`on-the-ground`,offset:0};let W=class extends o{constructor(e){super(e),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new v,this._measurementWorker=new me({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=Ee,this.tooltip=null,this.activeTooltipInfo=null,this.toolOptions=new ue,this.type=`reshape`,this.vertexGraphics=new i,this.curveControlPointGraphics=new i,this.constructionLineGraphics=new i,this.midpointGraphics=new i,this.selectedManipulators=new i,this.view=null}initialize(){let e=this.view;this._highlightHelper=new ye({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=p(()=>this.graphic?.geometry,e=>{if(!e||this._primaryGraphicMoving===!0)return;let t=new Set(this.selectedManipulators.map(Q));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(e=>t.has(Q(e))).forEach(e=>this._addToSelection(e)),this.curveControlPointGraphics.filter(e=>t.has(Q(e))).forEach(e=>this._addToSelection(e));let{enableMovement:n,_mover:r,graphic:i,midpointGraphics:a,vertexGraphics:o,curveControlPointGraphics:s}=this,c=o.concat(a,s).toArray();n&&c.push(i),r?.set(`graphics`,c)},_),this.tooltip=fe(()=>({view:e,options:this.toolOptions.tooltips})),this.tooltipInfos=Se(this.toolOptions),this.addHandles([m(()=>e?.ready,()=>{let{layer:e,view:t}=this;be(t,e),this.addHandles(t.on(`key-down`,e=>this._keyDownHandler(e),oe.TOOL))},{once:!0,initial:!0}),h(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[h(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],h(()=>this.layer,(e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()}),h(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),h(()=>this.enableMidpoints,()=>this.refresh()),Ce(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),h(()=>this.toolOptions.labels.enabled,e=>{this._segmentLabels?this._segmentLabels.visible=e:this._setUpGeometryHelper()}),h(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),g),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=l(this._mover),this._connectedReshapeManager=l(this._connectedReshapeManager),this.tooltip=l(this.tooltip),this._segmentLabelsImportTask=u(this._segmentLabelsImportTask),this._segmentLabels=l(this._segmentLabels),this._updatingHandles=l(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??se(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return this.view?.type===`2d`&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return this.selectedManipulators.length===1?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){let{toolOptions:e,activeTooltipInfo:t,graphic:n}=this;return{toolOptions:e,activeTooltipInfo:t,graphic:n,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(e,t,n,r,i)=>{this._setUpGeometryHelper();let a=e===this.graphic;if(a?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(e),this._syncGeometryAfterVertexMove(e,t,r,i,!0),a){let{view:e}=this,r=e.toScreen(n),i=e.toScreen(t),a=(i?.x??0)-(r?.x??0),o=(i?.y??0)-(r?.y??0);this._emitMoveEvent(a,o),this._emitMoveStopEvent(a,o)}else this._emitReshapeEvent(e),this._emitReshapeStopEvent(e)}}}get state(){let e=this.view.ready,t=!!(this.graphic&&this.layer);return e&&t?`active`:e?`ready`:`disabled`}get updating(){return!!this._updatingHandles?.updating||!!this._connectedReshapeManager?.updating||!!this._segmentLabels?.updating||!!this.snappingManager?.updating}isUIGraphic(e){return e===this.graphic||this._isMidpoint(e)||this._isCurveControlPoint(e)||this._isVertex(e)||this._isConstructionLine(e)}refresh(e){if(this._reset(),this._setup(),e){for(let t of this.vertexGraphics)e.has(Q(t))&&this._addToSelection(t);for(let t of this.curveControlPointGraphics)e.has(Q(t))&&this._addToSelection(t)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){let{selectedManipulators:e}=this;e.length&&this._removeVertices(e)}_setup(){let{graphic:e,layer:t}=this;if(!t||e?.geometry==null)return;let n=e.geometry;n.type===`mesh`||n.type===`extent`?this._logGeometryTypeError():(n.type===`polygon`&&x(n),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper())}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){let e=this.graphic.geometry;e==null||e.type===`mesh`||e.type===`extent`?(this._segmentLabels=l(this._segmentLabels),this._logGeometryTypeError()):(this._editGeometryOperations?this._syncEditGeometryOperations(e):this._editGeometryOperations=ce.fromGeometry(e,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels()))}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new ie({listMode:`hide`,internal:!0,title:`Reshape snapping layer`}),this.view.map.layers.add(this._snappingGraphicsLayer);let n=this._editGeometryOperations;d(n),this._snappingContext=new de({editGeometryOperations:n,elevationInfo:U,pointer:t.viewEvent?.pointerType||`mouse`,excludeFeature:this.graphic,feature:this.graphic,visualizer:new ae(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=u(this._segmentLabelsImportTask),this._segmentLabels=l(this._segmentLabels),this._activeOperationInfo=null,this._mover=l(this._mover),this.removeHandles(H),this._connectedReshapeManager?.finish()}_resetSnappingStateVars(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._snappingGraphicsLayer!=null&&(this.view.map?.layers.remove(this._snappingGraphicsLayer),l(this._snappingGraphicsLayer)),this._snappingTask=u(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._removeCurveGraphics(e),this._updateTooltip()}_removeMidpointGraphics(e=this.layer){let{midpointGraphics:t}=this;e?.removeMany(t.items),t.drain(l)}_removeVertexGraphics(e=this.layer){let{vertexGraphics:t}=this;this._relatedGraphicIndex=null,e?.removeMany(t.items),t.drain(l)}_removeCurveGraphics(e=this.layer){let{curveControlPointGraphics:t,constructionLineGraphics:n}=this;e?.removeMany(t.items),e?.removeMany(n.items),t.drain(l),n.drain(l)}_setupGraphics(){let e=this.graphic.geometry;if(e!=null&&(e.type===`polyline`||e.type===`polygon`||e.type===`multipoint`)){let t=G(e);this.enableMidpoints&&e.type!==`multipoint`&&this._setUpMidpointGraphics(t),this.enableVertices&&(this._setUpVertexGraphics(t),this._setupCurveGraphics(t))}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();let t=De(e,this.symbols,this._coordinateHelper,this.graphic.geometry?.type===`polygon`,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){let t=I(e,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=t.graphicIndex,this.vertexGraphics.addMany(t.graphics),this.layer.addMany(t.graphics)}else{let t=I(e,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}}_setupCurveGraphics(e){this._removeCurveGraphics();let t=Oe(e,this.symbols,this._coordinateHelper),n=ke(e,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(t),this.constructionLineGraphics.addMany(n),this.layer.addMany(n),this.layer.addMany(t)}async _setupSegmentLabels(){let e=this._editGeometryOperations,t=this.toolOptions.labels.enabled;if(e&&this._segmentLabels?.context?.editGeometryOperations===e&&t||(this._segmentLabels=l(this._segmentLabels)),!this._segmentLabels&&e&&t){let t=this._segmentLabelsImportTask??=r(async e=>{let t=import(`../../2d/interactive/SegmentLabels2D.js`),{SegmentLabels2D:n}=await this._updatingHandles.addPromise(t);return e.aborted?null:n}),n=await this._updatingHandles.addPromise(t.promise);if(!n)return;this._segmentLabels=l(this._segmentLabels),this._segmentLabels=new n({context:{view:this.view,editGeometryOperations:e,elevationInfo:U,labelOptions:this.toolOptions.labels},visible:!0})}}_updateSymbolsForTheme(){let e=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set(`color`,e),hover:this.symbols.vertices.hover?.clone().set(`color`,e)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set(`color`,e),hover:this.symbols.controlPoints.hover?.clone().set(`color`,e)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set(`color`,e)};for(let e of this.vertexGraphics)e.symbol=this._isSelected(e)?this.symbols.vertices.selected:this._hoverGraphic===e?this.symbols.vertices.hover:this.symbols.vertices.default;for(let e of this.curveControlPointGraphics)e.symbol=this._isSelected(e)?this.symbols.controlPoints.selected:this._hoverGraphic===e?this.symbols.controlPoints.hover:this.symbols.controlPoints.default;for(let e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){let e=this.vertexGraphics.items;if(!e)return;let t=e.map(({geometry:e})=>({x:e.x,y:e.y}));for(let n=0;n<t.length;n++){let r=[];for(let e=0;e<t.length;e++){if(n===e)continue;let i=t[n],a=t[e];i.x===a.x&&i.y===a.y&&r.push(e)}e[n].attributes[L.relatedGraphicIndices]=r}}_setupMover(){let{enableMovement:e,graphic:t,midpointGraphics:n,vertexGraphics:r,view:i}=this,a=r.concat(n,this.curveControlPointGraphics).toArray();e&&t.geometry?.type!==`multipoint`&&a.push(t),this._mover=new F({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:a,view:i,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_setupConnectedReshapeManager(){let{connectedReshapeProviders:e}=this;e!=null&&e.length!==0&&(this._connectedReshapeManager??=new he({providerFactories:e,view:this.view}))}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();let t=e.graphic,n=this._isCurveControlPoint(t);if(t===this.graphic)this.clearSelection(),this.emit(`graphic-click`,e),this.callbacks.onGraphicClick?.(e);else if(this._isMidpoint(t)){if(e.viewEvent.button===2)return;let n=this.graphic.clone(),r=this._handleMidpointClickOrStartMove(e);this.refresh(),r.length&&this._emitVertexAddEvent([t],n,r)}else if(this._isVertex(t)||n){if(e.viewEvent.stopPropagation(),e.viewEvent.button===2){n||this._removeVertices(t);return}e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){let{graphic:t,dx:n,dy:r}=e,i=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:i?`move`:`reshape`,totalDx:n,totalDy:r}}_onGraphicMoveStartCallback(e){let{dx:t,dy:n,graphic:r}=e,i=this._connectedReshapeManager,a=i?Fe(this.graphic):null;if(r===this.graphic){let{geometry:o}=r;this._primaryGraphicMoving=!0,this._setUpOperation(e),this._emitMoveStartEvent(t,n),a&&i?.startFeatureMove([a]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),o!=null&&o.type===`point`&&this._onHandleMove(r,t,n,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,n)});return}let{selectedManipulators:o}=this;if(!o.includes(r)){if(this._clearSelection(),this._isMidpoint(r)){let t=this.graphic.clone(),n=this._handleMidpointClickOrStartMove(e);n.length&&(this._emitVertexAddEvent([r],t,n),this._refreshGraphicIndicesAttributes(n[0]))}this._addToSelection(r)}if(this._setUpOperation(e),a){let e=o.filter(e=>this._isVertex(e));i?.startVertexMove(a,Ie(e))}this._emitReshapeStartEvent(r),this._onHandleMove(r,t,n,e,()=>{this._updateTooltip(r,e.viewEvent),this._emitReshapeEvent(r)})}_onGraphicMoveCallback(e){let t=this._activeOperationInfo;if(!t)return;let{dx:n,dy:r,graphic:i}=e;t.totalDx+=n,t.totalDy+=r;let{operationType:a}=t,{geometry:o}=i;if(o!=null){if(a===`move`){if(o.type===`point`)this._onHandleMove(i,n,r,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(n,r)});else if(o.type===`polyline`||o.type===`polygon`){let{dxMap:t,dyMap:i}=ge(n,r,this.view);if(!this._effectiveFilterVerticesEnabled){let e=G(o);this._updateVertexGraphicLocations(e)}else if(this.selectedManipulators.length>0){let e=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(let t of e){if(t.geometry?.type===`point`){let{pathIndex:e,pointIndex:n}=t.attributes,r=T(o)[e][n];if(r){let e=E(r);t.geometry=this._coordinateHelper.arrayToPoint(e)}}this._addToSelection(t.clone())}}this._connectedReshapeManager?.translate(t,i,0),this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(n,r)}this._syncEditGeometryOperations(o)}else this._onHandleMove(i,n,r,e,()=>{this._updateTooltip(i,e.viewEvent),this._emitReshapeEvent(i)})}}_onGraphicMoveStopCallback(e){let t=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!t)return;let{dx:n,dy:r,graphic:i,x:a,y:o}=e,{operationType:s}=t;t.totalDx+=n,t.totalDy+=r,this._onHandleMove(i,n,r,e,()=>this._handleVertexSnap(i,{x:a,y:o},s))}_afterMoveStop(e,t){if(this._effectiveFilterVerticesEnabled&&t===`move`){let e=new Set;for(let t of this.selectedManipulators)e.add(Q(t));this.refresh(e),this._updateTooltip()}else this._isMidpoint(e)||e.getAttribute(L.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(e)?e:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_handleVertexSnap(e,t,n){let i=e.geometry,a=this.snappingManager?.getVertexCandidates(),o=this.callbacks.onVertexSnap,s=()=>n===`move`?this._emitMoveStopEvent():this._emitReshapeStopEvent(e);!o||!i||!P(i)||!a||a.length===0?(s(),this._afterMoveStop(e,n)):(u(this._snappingTask),this._snappingTask=r(async r=>{try{let n=await o(i,t,a);f(r);let s=ne(n);this._coordinateHelper.hasZ()||(s.z=void 0),this._syncGeometryAfterVertexMove(e,s,0,0),e.geometry=s}finally{s(),this._afterMoveStop(e,n)}}))}_updateVertexGraphicLocations(e){let{_coordinateHelper:t}=this;for(let n of this.vertexGraphics){let{pathIndex:r,pointIndex:i}=n.attributes;n.geometry=t.arrayToPoint(E(e[r][i]))}this._updateMidpointGraphicLocations(e),this._updateCurveGraphicLocations(e)}_updateMidpointGraphicLocations(e,t){let{_coordinateHelper:n}=this;if(t)for(let r of this.midpointGraphics){let{pathIndex:i,pointIndexStart:a,pointIndexEnd:o}=r.attributes;if(!t.has(i))continue;let s=t.get(i);if(!s.has(a)&&!s.has(o))continue;let c=e[i];r.geometry=new y(R(c[a],c[o],n))}else for(let t of this.midpointGraphics){let{pathIndex:r,pointIndexStart:i,pointIndexEnd:a}=t.attributes,o=e[r];t.geometry=new y(R(o[i],o[a],n))}}_updateCurveGraphicLocations(e){let{spatialReference:t}=this._coordinateHelper,n=new Map;for(let e of this.selectedManipulators){let[t,r]=Z(e);t!=null&&r!=null&&e.getAttribute(L.controlPointKind)&&c(n,t,()=>new Set)?.add(r)}for(let t of this.curveControlPointGraphics){let[r,i]=Z(t);if(n.get(r)?.has(i))continue;let a=e[r][i];if(D(a)||O(a)){let n=E(e[r][i-1]),o=D(a)?w(n,a):M(n,a),[s,c]=C(o,.25);t.geometry=new y({x:s,y:c,spatialReference:this._coordinateHelper.spatialReference})}else if(k(a)){let[e,n]=t.getAttribute(L.controlPointKind)===z.bezier.cp1?a.b[1]:a.b[2];t.geometry=new y({x:e,y:n,spatialReference:this._coordinateHelper.spatialReference})}}for(let n of this.constructionLineGraphics){let r=n.getAttribute(L.controlPointKind),[i,a]=Z(n),o=e[i],s=E(o[a-1]),c=E(o[a]),l=e[i][a];n.geometry=r===z.bezier.line1?new b({paths:[[[s[0],s[1]],[...l.b[1]]]],spatialReference:t}):new b({paths:[[[c[0],c[1]],[...l.b[2]]]],spatialReference:t})}}_refreshGraphicIndicesAttributes(e){let{componentIndex:t,vertexIndex:n}=e,r=e=>{let[r,i]=Z(e);r===t&&i>=n&&e.setAttribute(L.pointIndex,i+1)};this.vertexGraphics.forEach(r),this.curveControlPointGraphics.forEach(r),this.constructionLineGraphics.forEach(r);for(let e of this.midpointGraphics){if(e.getAttribute(L.pathIndex)!==t)continue;let r=e.getAttribute(L.pointIndexStart);r>=n&&(e.setAttribute(L.pointIndexStart,r+1),e.setAttribute(L.pointIndexEnd,e.getAttribute(L.pointIndexEnd)+1))}}_getVertexFromEditGeometry(e){let[t,n]=Z(e);return d(this._editGeometryOperations),this._editGeometryOperations.data.parts[t].vertices[n]}_onHandleMove(e,t,n,i,a){u(this._snappingTask);let o=this._snappingContext;if(!o)return;let s=e.geometry,c=i.type===`graphic-move-stop`;if(!s||!P(s))a();else if(this.snappingManager!=null&&this.selectedManipulators.length<2&&!c){let i=this.snappingManager;this._stagedVertex=i.update({point:s,context:o}),this._syncGeometryAfterVertexMove(e,new y(this._stagedVertex),t,n,c),a(),this._snappingTask=r(async r=>{let l=await i.snap({point:s,context:o,signal:r});if(l.valid){let r=l.apply();r.z=this._coordinateHelper.hasZ()?_e(this.snappingManager)??r.z:void 0,this._stagedVertex=r,this._syncGeometryAfterVertexMove(e,new y(this._stagedVertex),t,n,c),a()}}),this._updatingHandles.consumePromise(this._snappingTask.promise)}else{let r=this._stagedVertex==null?s:new y(this._stagedVertex);this._syncGeometryAfterVertexMove(e,r,t,n,c),a()}}_syncGeometryAfterVertexMove(e,t,n,r,i=!1){let a=B(this._editGeometryOperations?.data.geometry);if(!a)return;let{_coordinateHelper:o}=this,s=o.pointToVector(t),c=this._getVertexFromEditGeometry(e),l=null;if(c){let e=o.getZ(s);l=[c.pos[0],c.pos[1]];let t=s[0]-c.pos[0],n=s[1]-c.pos[1],r=e==null?0:e-c.pos[2];(a.type===`point`||a.type===`mesh`)&&this._editGeometryOperations?.moveVertices([c],t,n,r),this._connectedReshapeManager?.translate(t,n,r)}if(a.type===`point`)e.geometry=t;else if(a.type===`mesh`)e.geometry=a.centerAt(t);else{if(e!==this.graphic){l&&!this._isVertex(e)&&(l=null);let[i,s]=Z(e),c=K(a),u=o.pointToArray(t);if(this._updateGeometryFromGraphic(e,c,i,s,u,a.type===`polygon`),this._isVertex(e)||this._isCurveControlPoint(e)){let t=new Map;t.set(i,new Set([s])),c=this._moveRelatedCoordinates(c,e,u,t,l),c=this._moveSelectedHandleCoordinates(c,e,n,r,a.type===`polygon`),this._updateMidpointGraphicLocations(c,t),this._updateCurveGraphicLocations(c)}else this._isMidpoint(e)&&this._updateCurveGraphicLocations(c);V(a,c)}this._updateGraphicGeometry(a),this._syncEditGeometryOperations(a),i&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_syncEditGeometryOperations(e){this._editGeometryOperations?.trySetGeometry(e)||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(e,t,n,r,i){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&i){let a=this._relatedGraphicIndex.search({minX:i[0],maxX:i[0],minY:i[1],maxY:i[1]});for(let o of a)o.coordinate[0]===i[0]&&o.coordinate[1]===i[1]&&o.graphic&&(r&&c(r,o.pathIndex,()=>new Set).add(o.pointIndex),X(e,o.pathIndex,o.pointIndex,n),this._relatedGraphicIndex.remove(o),o.coordinate[0]=t.geometry.x,o.coordinate[1]=t.geometry.y,o.graphic.geometry=t.geometry,this._relatedGraphicIndex.insert(o));return e}let{relatedGraphicIndices:a}=t.attributes;if(!a?.length)return e;for(let i of a){let a=this.vertexGraphics.at(i),[o,s]=Z(a);r&&c(r,o,()=>new Set).add(s),X(e,o,s,n),a.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,n,r,i){for(let a of this.selectedManipulators)if(a!==t){let[t,o]=Z(a),s=a.getAttribute(L.relatedGraphicIndices),c=ve(a.geometry,n,r,this.view),l=S(c);if(a.geometry=c,this._updateGeometryFromGraphic(a,e,t,o,l,i),s?.length)for(let t of s){let n=this.vertexGraphics.at(t),[r,i]=Z(n);X(e,r,i,l),n.geometry=c}}return e}_updateGeometryFromGraphic(e,t,n,r,i,a){let o=t[n].length-1;this._isCurveControlPoint(e)?q(t,n,r,[i[0],i[1]],e.getAttribute(L.controlPointKind)):(X(t,n,r,i),a&&(r===0?X(t,n,o,i):r===o&&(t[n][0]=i)))}_onGraphicPointerOverCallback(e){let t=e.graphic;this._hoverGraphic=t;let n=this._isVertex(t);n&&!this._isSelected(t)?t.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.hover),this._updateTooltip(n?t:null),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){let t=e.graphic;this._hoverGraphic=null,this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.default),this.removeHandles(H),this._updateTooltip()}_handleMidpointClickOrStartMove(e){let{graphic:t}=e,n=this.graphic.geometry;if(n==null||n.type!==`polygon`&&n.type!==`polyline`)return[];let r=B(n),i=[],{[L.pathIndex]:a,[L.pointIndexStart]:o,[L.pointIndexEnd]:s}=t.attributes,c=S(t.geometry),l=s===0?o+1:s;t.attributes={[L.tool]:Ae,[L.pathIndex]:a,[L.pointIndex]:l,[L.relatedGraphicIndices]:[]};let u=K(r),d=u[a][s];if(A(d)){if(this.enableCurveOnMidpoint&&e.viewEvent.native.shiftKey){let e=E(u[a][l]);u[a].splice(l,1,{c:[e,[c[0],c[1]]]}),t.setAttribute(L.controlPointKind,z.circle.interior),t.setAttribute(L.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(t),this.curveControlPointGraphics.push(t),V(r,u)}else u[a].splice(l,0,c),i.push({coordinates:u[a][l],componentIndex:a,vertexIndex:l})}else{let e=E(u[a][o]),t=je(e,d,.5,this._coordinateHelper);u[a].splice(s,1,...t),i.push({coordinates:E(u[a][l]),componentIndex:a,vertexIndex:l})}return this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),i}_addToSelection(e){let t=$(e);for(let e of t)e.symbol=this._isCurveControlPoint(e)?this.symbols.controlPoints.selected:this.symbols.vertices.selected,this.selectedManipulators.add(e),this._updateTooltip(e);this._emitSelectEvent(t)}_removeFromSelection(e,t){if(this._isVertex(e)){let{vertices:n}=this.symbols;e.symbol=t?n.hover:n.default}else if(this._isCurveControlPoint(e)){let{controlPoints:n}=this.symbols;e.symbol=t?n.hover:n.default}this.selectedManipulators.remove(e),this._emitDeselectEvent([e]),this._updateTooltip()}_clearSelection(){let e=this.selectedManipulators.toArray(),{controlPoints:t,vertices:n}=this.symbols;if(e.length>0){for(let r of e)this._isVertex(r)?r.symbol=n.default:this._isCurveControlPoint(r)&&(r.symbol=t.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(e),this._updateTooltip()}}_keyDownHandler(e){this._activeOperationInfo==null&&pe(e,this.tooltip)||le.delete.includes(e.key)&&!e.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),e.stopPropagation())}_removeVertices(e){let t=this.graphic.geometry,n=this.vertexGraphics.length;if(t==null||t.type!==`polygon`&&t.type!==`polyline`&&t.type!==`multipoint`||t.type===`polygon`&&n<4||t.type===`multipoint`&&n<2||t.type===`polyline`&&n<3)return;let r=this.graphic.clone(),i=B(t),a=K(i),o=[],s=$(e);for(let e of s){if(this._isCurveControlPoint(e))continue;let{x:t,y:n}=e.geometry;for(let e=0;e<a.length;e++){let r=a[e];for(let i=0;i<r.length;i++){let[s,c]=E(r[i]);if(t===s&&n===c){o.push({coordinates:E(a[e][i]),componentIndex:e,vertexIndex:i}),a[e].splice(Number(i),1);let t=a[e][i];t&&!A(t)&&(a[e][i]=E(t))}}}}if(i.type===`polygon`)a=a.filter(e=>{if(e.length<2)return!1;let[t,n]=E(e[0]),[r,i]=E(e[e.length-1]);return e.length===2&&t===r&&n===i?!1:((t!==r||n!==i)&&e.push(e[0]),!0)});else if(i.type===`polyline`)for(let e of a)e.length===1&&a.splice(a.indexOf(e),1);V(i,a),this._updateGraphicGeometry(i),this.refresh(),this._emitVertexRemoveEvent(s,r,o)}_isVertex(e){return this.vertexGraphics.includes(e)}_isCurveControlPoint(e){return this.curveControlPointGraphics.includes(e)}_isConstructionLine(e){return this.constructionLineGraphics.includes(e)}_isSelected(e){return(this._isVertex(e)||this.curveControlPointGraphics.includes(e))&&this.selectedManipulators.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){let t=this._isMidpoint(e)?`copy`:`move`;this.addHandles(this.view.acquireCursor(t,`high`),H)}_updateTooltip(e,t){let n=null,{graphic:r,view:i,tooltipInfos:a}=this,o=r?.geometry;o?.type===`point`?n=a.movePoint:this._selectedManipulator?n=a.selectedVertex:e===this.graphic?(n=a.translateGraphic,we(n,i,this._tooltipsContext,this._updatingHandles,t)):e&&this.selectedManipulators.length>1&&(n=a.translateVertices,Te(n,i,o,this._tooltipsContext,this._updatingHandles,t)),this.activeTooltipInfo=n}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){let n={type:`move-start`,mover:this.graphic,dx:e,dy:t};this.emit(`move-start`,n),this.callbacks.onMoveStart?.(n)}_emitMoveEvent(e,t){let n={type:`move`,mover:this.graphic,dx:e,dy:t};this.emit(`move`,n),this.callbacks.onMove?.(n)}_emitMoveStopEvent(e,t){if(e==null||t==null){let n=this._activeOperationInfo;if(!n)return;e=n.totalDx,t=n.totalDy}let n={type:`move-stop`,mover:this.graphic,dx:e,dy:t};this.emit(`move-stop`,n),this.callbacks.onMoveStop?.(n)}_emitReshapeStartEvent(e){let t={type:`reshape-start`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape-start`,t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){let t={type:`reshape`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape`,t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){let t={type:`reshape-stop`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape-stop`,t),this.callbacks.onReshapeStop?.(t)}_emitSelectEvent(e){let t={type:`vertex-select`,added:e};this.emit(`select`,t),this.callbacks.onVertexSelect?.(t)}_emitDeselectEvent(e){let t={type:`vertex-deselect`,removed:e};this.emit(`deselect`,t),this.callbacks.onVertexDeselect?.(t)}_emitVertexAddEvent(e,t,n){let r={type:`vertex-add`,added:e,graphic:this.graphic,oldGraphic:t,vertices:n};this.emit(`vertex-add`,r),this.callbacks.onVertexAdd?.(r)}_emitVertexRemoveEvent(e,t,n){let r={type:`vertex-remove`,removed:e,graphic:this.graphic,oldGraphic:t,vertices:n};this.emit(`vertex-remove`,r),this.callbacks.onVertexRemove?.(r)}_logGeometryTypeError(){s.getLogger(this).error(new a(`reshape:invalid-geometry`,`Reshape operation not supported for the provided graphic. The geometry type is not supported.`))}};e([t()],W.prototype,`_activeOperationInfo`,void 0),e([t()],W.prototype,`_connectedReshapeManager`,void 0),e([t()],W.prototype,`_coordinateHelper`,null),e([t()],W.prototype,`_editGeometryOperations`,void 0),e([t()],W.prototype,`_effectiveFilterVerticesEnabled`,null),e([t()],W.prototype,`_primaryGraphicMoving`,void 0),e([t()],W.prototype,`_segmentLabels`,void 0),e([t()],W.prototype,`test`,null),e([t()],W.prototype,`_segmentLabelsImportTask`,void 0),e([t()],W.prototype,`_updatingHandles`,void 0),e([t()],W.prototype,`_selectedManipulator`,null),e([t()],W.prototype,`_tooltipsContext`,null),e([t()],W.prototype,`callbacks`,void 0),e([t()],W.prototype,`connectedReshapeProviders`,void 0),e([t()],W.prototype,`enableMidpoints`,void 0),e([t()],W.prototype,`enableCurveOnMidpoint`,void 0),e([t()],W.prototype,`enableMovement`,void 0),e([t()],W.prototype,`enableVertices`,void 0),e([t()],W.prototype,`filterVerticesEnabled`,void 0),e([t()],W.prototype,`graphic`,void 0),e([t()],W.prototype,`highlightName`,void 0),e([t()],W.prototype,`highlightsEnabled`,void 0),e([t()],W.prototype,`layer`,void 0),e([t()],W.prototype,`snappingManager`,void 0),e([t({readOnly:!0})],W.prototype,`state`,null),e([t()],W.prototype,`symbols`,void 0),e([t()],W.prototype,`tooltip`,void 0),e([t()],W.prototype,`tooltipInfos`,void 0),e([t()],W.prototype,`activeTooltipInfo`,void 0),e([t()],W.prototype,`updating`,null),e([t()],W.prototype,`toolOptions`,void 0),e([t({readOnly:!0})],W.prototype,`type`,void 0),e([t({readOnly:!0})],W.prototype,`vertexGraphics`,void 0),e([t({readOnly:!0})],W.prototype,`curveControlPointGraphics`,void 0),e([t({readOnly:!0})],W.prototype,`constructionLineGraphics`,void 0),e([t({readOnly:!0})],W.prototype,`midpointGraphics`,void 0),e([t({readOnly:!0})],W.prototype,`selectedManipulators`,void 0),e([t()],W.prototype,`view`,void 0),W=e([n(`esri.views.draw.support.Reshape`)],W);function G(e){let t=K(e);t=t.map(e=>e.slice());for(let e of t)for(let t=0;t<e.length;t++)e[t]=ee(e[t]);if(e.type===`polygon`)for(let e of t){let t=e[e.length-1];if(!A(t))continue;let n=e[0];n[0]===t[0]&&n[1]===t[1]&&e.length>2&&e.pop()}return t}function K(e){return e.type===`polygon`?e.curveRings?.slice()??e.rings.slice():e.type===`polyline`?e.curvePaths?.slice()??e.paths.slice():e.points.map(e=>[e])}function Pe(e,t,n,r){let i=e[t][n];if(D(i))i.c[1]=r;else if(O(i)){let i=E(e[t][n]);e[t][n]={c:[i,r]}}}function q(e,t,n,r,i){switch(i){case z.circle.interior:Pe(e,t,n,r);break;case z.bezier.cp1:e[t][n].b[1]=r;break;case z.bezier.cp2:e[t][n].b[2]=r}}function J(e,t){return e<t*1e-8}function Y(e,{cx:t,cy:n,isInvalid:r,thetaStart:i,thetaEnd:a},o,s){let[c,l]=e,[u,d]=o,f=u-c,p=d-l;t-=c,n-=l;let m=s?i>a:i<a,[h,g]=r?[t,n]:m?[-n,t]:[n,-t],[_,v]=[f,p],[y,b]=[h,g],x=_*b-v*y,S=(f**2+p**2)/2;if(J(Math.abs(x),S))return[(c+u)/2,(l+d)/2];let[C,w]=[b/x*S,-y/x*S],T=C**2+w**2,[E,D]=[f/2-C,p/2-w];if(J(E**2+D**2,T)){let[e,t]=m?[-w,C]:[w,-C];return[e+C+c,t+w+l]}let O=Math.sqrt((C**2+w**2)/(E**2+D**2))*Math.sign(f*h+p*g);return[E*O+C+c,D*O+w+l]}function X(e,t,n,r){let i=e[t][n],a=e[t].at(n+1);if(Me(e,t)){let n=e[t][1];e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0]};return}if(Ne(e,t)){let n=e[t][1],[i,a]=n.a[1],[o,s]=r,c=Math.hypot(o-i,s-a),[l,u]=[o-i,s-a],d=te(u,l);e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0,d,c,n.a[6]]};return}let o=E(i);if(A(i))i.splice(0,i.length,...r);else if(k(i))i.b[0].splice(0,i.b[0].length,...r);else if(D(i)||O(i)){let a=E(e[t][n-1]),o=D(i)?w(a,i):M(a,i);e[t].splice(n,1,{c:[[...r],Y(a,o,r,!0)]})}else if(j(i)){i.a[0].splice(0,i.a[0].length,...r);let a=E(e[t][n-1]);N(a,i)}if(a&&!A(a)&&!k(i)){if(D(a)||O(a)){let i=E(a),s=D(a)?w(o,a):M(o,a);e[t].splice(n+1,1,{c:[i,Y(i,s,r,!1)]})}else if(j(a)){let e=E(i);N(e,a)}}}function Z({attributes:e}){return[e?.[L.pathIndex]||0,e?.[L.pointIndex]||0]}function Q({attributes:e}){return`${e?.[L.pathIndex]}-${e?.[L.pointIndex]}-${e?.[L.controlPointKind]??`vertex`}`}function $(e){return e instanceof re?[e]:[...e]}function Fe(e){let t=e.sourceLayer??e.layer;return xe(t)?{graphic:e,layer:t}:null}function Ie(e){return e.toArray().map(({attributes:e})=>({pathIndex:e[L.pathIndex],vertexIndex:e[L.pointIndex]}))}const Le=W;export{Le as default};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Collection.js";import a from"../../../core/Error.js";import{EventedAccessor as o}from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{getOrCreateMapValue as c}from"../../../core/MapUtils.js";import{destroyMaybe as l,abortMaybe as u,assertIsSome as d}from"../../../core/maybe.js";import{throwIfAborted as f}from"../../../core/promiseUtils.js";import{pausable as p,when as m,watch as h,initial as g,sync as _}from"../../../core/reactiveUtils.js";import{UpdatingHandles as v}from"../../../core/support/UpdatingHandles.js";import y from"../../../geometry/Point.js";import b from"../../../geometry/Polyline.js";import{closeRingsAndFixWinding as x,geometryToCoordinates as S}from"../../../geometry/support/coordsUtils.js";import{interpolateCircle as C}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as w}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as T,getEndpoint as E,isCircularArc as D,isEllipticArc4 as O,isBezierCurve as k,isCoordinate as A,cloneCurve as ee,isEllipticArc7 as j}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as M}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{normalizeEllipticArcAfterEndpointChange as N}from"../../../geometry/support/curves/ellipticArc7Utils.js";import{wrapAtan2 as te}from"../../../geometry/support/curves/mathUtils.js";import{fromJSON as ne}from"../../../geometry/support/jsonUtils.js";import{isPoint as P}from"../../../geometry/support/typeUtils.js";import re from"../../../Graphic.js";import ie from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as ae}from"../../2d/interactive/SnappingVisualizer2D.js";import{ViewEventPriorities as oe}from"../../input/InputManager.js";import{createCoordinateHelper as se}from"../../interactive/coordinateHelper.js";import{EditGeometryOperations as ce}from"../../interactive/editGeometry/EditGeometryOperations.js";import{sketchKeys as le}from"../../interactive/keybindings.js";import ue from"../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as de}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as fe,enterInputModeIfAvailable as pe}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as me}from"../../support/GeometryWorkerHandle.js";import{ConnectedReshapeManager as he}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as ge,getZFromVertexSnappingCandidates as _e,cloneMove as ve}from"./drawUtils.js";import F from"./GraphicMover.js";import ye from"./HighlightHelper.js";import{addUniqueLayer as be,isConnectedReshapeSupportedLayer as xe}from"./layerUtils.js";import{createTooltipInfos as Se,connectTooltip as Ce,updateTranslateTooltipInfo as we,updateTranslateVertexTooltipInfo as Te}from"./reshapeTooltipUtils.js";import{defaultSymbols as Ee,createMidpointGraphics as De,createVertexGraphics as I,createCurveControlPointGraphics as Oe,createCurveConstructionLineGraphics as ke,attributeKeys as L,getMidpoint as R,controlPointKinds as z,fastCloneGeometry as B,saveUpdatedCurveOrCoordinate as V,toolIdAttribute as Ae,splitCurve as je,isSingleSegmentCircle as Me,isSingleSegmentEllipse as Ne}from"./reshapeUtils.js";const H=Symbol(),U={mode:`on-the-ground`,offset:0};let W=class extends o{constructor(e){super(e),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new v,this._measurementWorker=new me({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=Ee,this.tooltip=null,this.activeTooltipInfo=null,this.toolOptions=new ue,this.type=`reshape`,this.vertexGraphics=new i,this.curveControlPointGraphics=new i,this.constructionLineGraphics=new i,this.midpointGraphics=new i,this.selectedManipulators=new i,this.view=null}initialize(){let e=this.view;this._highlightHelper=new ye({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=p(()=>this.graphic?.geometry,e=>{if(!e||this._primaryGraphicMoving===!0)return;let t=new Set(this.selectedManipulators.map(Q));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(e=>t.has(Q(e))).forEach(e=>this._addToSelection(e)),this.curveControlPointGraphics.filter(e=>t.has(Q(e))).forEach(e=>this._addToSelection(e));let{enableMovement:n,_mover:r,graphic:i,midpointGraphics:a,vertexGraphics:o,curveControlPointGraphics:s}=this,c=o.concat(a,s).toArray();n&&c.push(i),r?.set(`graphics`,c)},_),this.tooltip=fe(()=>({view:e,options:this.toolOptions.tooltips})),this.tooltipInfos=Se(this.toolOptions),this.addHandles([m(()=>e?.ready,()=>{let{layer:e,view:t}=this;be(t,e),this.addHandles(t.on(`key-down`,e=>this._keyDownHandler(e),oe.TOOL))},{once:!0,initial:!0}),h(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[h(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],h(()=>this.layer,(e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()}),h(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),h(()=>this.enableMidpoints,()=>this.refresh()),Ce(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),h(()=>this.toolOptions.labels.enabled,e=>{this._segmentLabels?this._segmentLabels.visible=e:this._setUpGeometryHelper()}),h(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),g),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=l(this._mover),this._connectedReshapeManager=l(this._connectedReshapeManager),this.tooltip=l(this.tooltip),this._segmentLabelsImportTask=u(this._segmentLabelsImportTask),this._segmentLabels=l(this._segmentLabels),this._updatingHandles=l(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??se(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return this.view?.type===`2d`&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return this.selectedManipulators.length===1?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){let{toolOptions:e,activeTooltipInfo:t,graphic:n}=this;return{toolOptions:e,activeTooltipInfo:t,graphic:n,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(e,t,n,r,i)=>{this._setUpGeometryHelper();let a=e===this.graphic;if(a?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(e),this._syncGeometryAfterVertexMove(e,t,r,i,!0),a){let{view:e}=this,r=e.toScreen(n),i=e.toScreen(t),a=(i?.x??0)-(r?.x??0),o=(i?.y??0)-(r?.y??0);this._emitMoveEvent(a,o),this._emitMoveStopEvent(a,o)}else this._emitReshapeEvent(e),this._emitReshapeStopEvent(e)}}}get state(){let e=this.view.ready,t=!!(this.graphic&&this.layer);return e&&t?`active`:e?`ready`:`disabled`}get updating(){return!!this._updatingHandles?.updating||!!this._connectedReshapeManager?.updating||!!this._segmentLabels?.updating||!!this.snappingManager?.updating}isUIGraphic(e){return e===this.graphic||this._isMidpoint(e)||this._isCurveControlPoint(e)||this._isVertex(e)||this._isConstructionLine(e)}refresh(e){if(this._reset(),this._setup(),e){for(let t of this.vertexGraphics)e.has(Q(t))&&this._addToSelection(t);for(let t of this.curveControlPointGraphics)e.has(Q(t))&&this._addToSelection(t)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){let{selectedManipulators:e}=this;e.length&&this._removeVertices(e)}_setup(){let{graphic:e,layer:t}=this;if(!t||e?.geometry==null)return;let n=e.geometry;n.type===`mesh`||n.type===`extent`?this._logGeometryTypeError():(n.type===`polygon`&&x(n),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper())}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){let e=this.graphic.geometry;e==null||e.type===`mesh`||e.type===`extent`?(this._segmentLabels=l(this._segmentLabels),this._logGeometryTypeError()):(this._editGeometryOperations?this._syncEditGeometryOperations(e):this._editGeometryOperations=ce.fromGeometry(e,this.view.state.isGlobal,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels()))}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new ie({listMode:`hide`,internal:!0,title:`Reshape snapping layer`}),this.view.map.layers.add(this._snappingGraphicsLayer);let n=this._editGeometryOperations;d(n),this._snappingContext=new de({editGeometryOperations:n,elevationInfo:U,pointer:t.viewEvent?.pointerType||`mouse`,excludeFeature:this.graphic,feature:this.graphic,visualizer:new ae(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=u(this._segmentLabelsImportTask),this._segmentLabels=l(this._segmentLabels),this._activeOperationInfo=null,this._mover=l(this._mover),this.removeHandles(H),this._connectedReshapeManager?.finish()}_resetSnappingStateVars(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._snappingGraphicsLayer!=null&&(this.view.map?.layers.remove(this._snappingGraphicsLayer),l(this._snappingGraphicsLayer)),this._snappingTask=u(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._removeCurveGraphics(e),this._updateTooltip()}_removeMidpointGraphics(e=this.layer){let{midpointGraphics:t}=this;e?.removeMany(t.items),t.drain(l)}_removeVertexGraphics(e=this.layer){let{vertexGraphics:t}=this;this._relatedGraphicIndex=null,e?.removeMany(t.items),t.drain(l)}_removeCurveGraphics(e=this.layer){let{curveControlPointGraphics:t,constructionLineGraphics:n}=this;e?.removeMany(t.items),e?.removeMany(n.items),t.drain(l),n.drain(l)}_setupGraphics(){let e=this.graphic.geometry;if(e!=null&&(e.type===`polyline`||e.type===`polygon`||e.type===`multipoint`)){let t=G(e);this.enableMidpoints&&e.type!==`multipoint`&&this._setUpMidpointGraphics(t),this.enableVertices&&(this._setUpVertexGraphics(t),this._setupCurveGraphics(t))}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();let t=De(e,this.symbols,this._coordinateHelper,this.graphic.geometry?.type===`polygon`,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){let t=I(e,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=t.graphicIndex,this.vertexGraphics.addMany(t.graphics),this.layer.addMany(t.graphics)}else{let t=I(e,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}}_setupCurveGraphics(e){this._removeCurveGraphics();let t=Oe(e,this.symbols,this._coordinateHelper),n=ke(e,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(t),this.constructionLineGraphics.addMany(n),this.layer.addMany(n),this.layer.addMany(t)}async _setupSegmentLabels(){let e=this._editGeometryOperations,t=this.toolOptions.labels.enabled;if(e&&this._segmentLabels?.context?.editGeometryOperations===e&&t||(this._segmentLabels=l(this._segmentLabels)),!this._segmentLabels&&e&&t){let t=this._segmentLabelsImportTask??=r(async e=>{let t=import(`../../2d/interactive/SegmentLabels2D.js`),{SegmentLabels2D:n}=await this._updatingHandles.addPromise(t);return e.aborted?null:n}),n=await this._updatingHandles.addPromise(t.promise);if(!n)return;this._segmentLabels=l(this._segmentLabels),this._segmentLabels=new n({context:{view:this.view,editGeometryOperations:e,elevationInfo:U,labelOptions:this.toolOptions.labels},visible:!0})}}_updateSymbolsForTheme(){let e=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set(`color`,e),hover:this.symbols.vertices.hover?.clone().set(`color`,e)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set(`color`,e),hover:this.symbols.controlPoints.hover?.clone().set(`color`,e)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set(`color`,e)};for(let e of this.vertexGraphics)e.symbol=this._isSelected(e)?this.symbols.vertices.selected:this._hoverGraphic===e?this.symbols.vertices.hover:this.symbols.vertices.default;for(let e of this.curveControlPointGraphics)e.symbol=this._isSelected(e)?this.symbols.controlPoints.selected:this._hoverGraphic===e?this.symbols.controlPoints.hover:this.symbols.controlPoints.default;for(let e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){let e=this.vertexGraphics.items;if(!e)return;let t=e.map(({geometry:e})=>({x:e.x,y:e.y}));for(let n=0;n<t.length;n++){let r=[];for(let e=0;e<t.length;e++){if(n===e)continue;let i=t[n],a=t[e];i.x===a.x&&i.y===a.y&&r.push(e)}e[n].attributes[L.relatedGraphicIndices]=r}}_setupMover(){let{enableMovement:e,graphic:t,midpointGraphics:n,vertexGraphics:r,view:i}=this,a=r.concat(n,this.curveControlPointGraphics).toArray();e&&t.geometry?.type!==`multipoint`&&a.push(t),this._mover=new F({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:a,view:i,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_setupConnectedReshapeManager(){let{connectedReshapeProviders:e}=this;e!=null&&e.length!==0&&(this._connectedReshapeManager??=new he({providerFactories:e,view:this.view}))}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();let t=e.graphic,n=this._isCurveControlPoint(t);if(t===this.graphic)this.clearSelection(),this.emit(`graphic-click`,e),this.callbacks.onGraphicClick?.(e);else if(this._isMidpoint(t)){if(e.viewEvent.button===2)return;let n=this.graphic.clone(),r=this._handleMidpointClickOrStartMove(e);this.refresh(),r.length&&this._emitVertexAddEvent([t],n,r)}else if(this._isVertex(t)||n){if(e.viewEvent.stopPropagation(),e.viewEvent.button===2){n||this._removeVertices(t);return}e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){let{graphic:t,dx:n,dy:r}=e,i=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:i?`move`:`reshape`,totalDx:n,totalDy:r}}_onGraphicMoveStartCallback(e){let{dx:t,dy:n,graphic:r}=e,i=this._connectedReshapeManager,a=i?Fe(this.graphic):null;if(r===this.graphic){let{geometry:o}=r;this._primaryGraphicMoving=!0,this._setUpOperation(e),this._emitMoveStartEvent(t,n),a&&i?.startFeatureMove([a]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),o!=null&&o.type===`point`&&this._onHandleMove(r,t,n,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,n)});return}let{selectedManipulators:o}=this;if(!o.includes(r)){if(this._clearSelection(),this._isMidpoint(r)){let t=this.graphic.clone(),n=this._handleMidpointClickOrStartMove(e);n.length&&(this._emitVertexAddEvent([r],t,n),this._refreshGraphicIndicesAttributes(n[0]))}this._addToSelection(r)}if(this._setUpOperation(e),a){let e=o.filter(e=>this._isVertex(e));i?.startVertexMove(a,Ie(e))}this._emitReshapeStartEvent(r),this._onHandleMove(r,t,n,e,()=>{this._updateTooltip(r,e.viewEvent),this._emitReshapeEvent(r)})}_onGraphicMoveCallback(e){let t=this._activeOperationInfo;if(!t)return;let{dx:n,dy:r,graphic:i}=e;t.totalDx+=n,t.totalDy+=r;let{operationType:a}=t,{geometry:o}=i;if(o!=null){if(a===`move`){if(o.type===`point`)this._onHandleMove(i,n,r,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(n,r)});else if(o.type===`polyline`||o.type===`polygon`){let{dxMap:t,dyMap:i}=ge(n,r,this.view);if(!this._effectiveFilterVerticesEnabled){let e=G(o);this._updateVertexGraphicLocations(e)}else if(this.selectedManipulators.length>0){let e=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(let t of e){if(t.geometry?.type===`point`){let{pathIndex:e,pointIndex:n}=t.attributes,r=T(o)[e][n];if(r){let e=E(r);t.geometry=this._coordinateHelper.arrayToPoint(e)}}this._addToSelection(t.clone())}}this._connectedReshapeManager?.translate(t,i,0),this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(n,r)}this._syncEditGeometryOperations(o)}else this._onHandleMove(i,n,r,e,()=>{this._updateTooltip(i,e.viewEvent),this._emitReshapeEvent(i)})}}_onGraphicMoveStopCallback(e){let t=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!t)return;let{dx:n,dy:r,graphic:i,x:a,y:o}=e,{operationType:s}=t;t.totalDx+=n,t.totalDy+=r,this._onHandleMove(i,n,r,e,()=>this._handleVertexSnap(i,{x:a,y:o},s))}_afterMoveStop(e,t){if(this._effectiveFilterVerticesEnabled&&t===`move`){let e=new Set;for(let t of this.selectedManipulators)e.add(Q(t));this.refresh(e),this._updateTooltip()}else this._isMidpoint(e)||e.getAttribute(L.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(e)?e:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_handleVertexSnap(e,t,n){let i=e.geometry,a=this.snappingManager?.getVertexCandidates(),o=this.callbacks.onVertexSnap,s=()=>n===`move`?this._emitMoveStopEvent():this._emitReshapeStopEvent(e);!o||!i||!P(i)||!a||a.length===0?(s(),this._afterMoveStop(e,n)):(u(this._snappingTask),this._snappingTask=r(async r=>{try{let n=await o(i,t,a);f(r);let s=ne(n);this._coordinateHelper.hasZ()||(s.z=void 0),this._syncGeometryAfterVertexMove(e,s,0,0),e.geometry=s}finally{s(),this._afterMoveStop(e,n)}}))}_updateVertexGraphicLocations(e){let{_coordinateHelper:t}=this;for(let n of this.vertexGraphics){let{pathIndex:r,pointIndex:i}=n.attributes;n.geometry=t.arrayToPoint(E(e[r][i]))}this._updateMidpointGraphicLocations(e),this._updateCurveGraphicLocations(e)}_updateMidpointGraphicLocations(e,t){let{_coordinateHelper:n}=this;if(t)for(let r of this.midpointGraphics){let{pathIndex:i,pointIndexStart:a,pointIndexEnd:o}=r.attributes;if(!t.has(i))continue;let s=t.get(i);if(!s.has(a)&&!s.has(o))continue;let c=e[i];r.geometry=new y(R(c[a],c[o],n))}else for(let t of this.midpointGraphics){let{pathIndex:r,pointIndexStart:i,pointIndexEnd:a}=t.attributes,o=e[r];t.geometry=new y(R(o[i],o[a],n))}}_updateCurveGraphicLocations(e){let{spatialReference:t}=this._coordinateHelper,n=new Map;for(let e of this.selectedManipulators){let[t,r]=Z(e);t!=null&&r!=null&&e.getAttribute(L.controlPointKind)&&c(n,t,()=>new Set)?.add(r)}for(let t of this.curveControlPointGraphics){let[r,i]=Z(t);if(n.get(r)?.has(i))continue;let a=e[r][i];if(D(a)||O(a)){let n=E(e[r][i-1]),o=D(a)?w(n,a):M(n,a),[s,c]=C(o,.25);t.geometry=new y({x:s,y:c,spatialReference:this._coordinateHelper.spatialReference})}else if(k(a)){let[e,n]=t.getAttribute(L.controlPointKind)===z.bezier.cp1?a.b[1]:a.b[2];t.geometry=new y({x:e,y:n,spatialReference:this._coordinateHelper.spatialReference})}}for(let n of this.constructionLineGraphics){let r=n.getAttribute(L.controlPointKind),[i,a]=Z(n),o=e[i],s=E(o[a-1]),c=E(o[a]),l=e[i][a];n.geometry=r===z.bezier.line1?new b({paths:[[[s[0],s[1]],[...l.b[1]]]],spatialReference:t}):new b({paths:[[[c[0],c[1]],[...l.b[2]]]],spatialReference:t})}}_refreshGraphicIndicesAttributes(e){let{componentIndex:t,vertexIndex:n}=e,r=e=>{let[r,i]=Z(e);r===t&&i>=n&&e.setAttribute(L.pointIndex,i+1)};this.vertexGraphics.forEach(r),this.curveControlPointGraphics.forEach(r),this.constructionLineGraphics.forEach(r);for(let e of this.midpointGraphics){if(e.getAttribute(L.pathIndex)!==t)continue;let r=e.getAttribute(L.pointIndexStart);r>=n&&(e.setAttribute(L.pointIndexStart,r+1),e.setAttribute(L.pointIndexEnd,e.getAttribute(L.pointIndexEnd)+1))}}_getVertexFromEditGeometry(e){let[t,n]=Z(e);return d(this._editGeometryOperations),this._editGeometryOperations.data.parts[t].vertices[n]}_onHandleMove(e,t,n,i,a){u(this._snappingTask);let o=this._snappingContext;if(!o)return;let s=e.geometry,c=i.type===`graphic-move-stop`;if(!s||!P(s))a();else if(this.snappingManager!=null&&this.selectedManipulators.length<2&&!c){let i=this.snappingManager;this._stagedVertex=i.update({point:s,context:o}),this._syncGeometryAfterVertexMove(e,new y(this._stagedVertex),t,n,c),a(),this._snappingTask=r(async r=>{let l=await i.snap({point:s,context:o,signal:r});if(l.valid){let r=l.apply();r.z=this._coordinateHelper.hasZ()?_e(this.snappingManager)??r.z:void 0,this._stagedVertex=r,this._syncGeometryAfterVertexMove(e,new y(this._stagedVertex),t,n,c),a()}}),this._updatingHandles.consumePromise(this._snappingTask.promise)}else{let r=this._stagedVertex==null?s:new y(this._stagedVertex);this._syncGeometryAfterVertexMove(e,r,t,n,c),a()}}_syncGeometryAfterVertexMove(e,t,n,r,i=!1){let a=B(this._editGeometryOperations?.data.geometry);if(!a)return;let{_coordinateHelper:o}=this,s=o.pointToVector(t),c=this._getVertexFromEditGeometry(e),l=null;if(c){let e=o.getZ(s);l=[c.pos[0],c.pos[1]];let t=s[0]-c.pos[0],n=s[1]-c.pos[1],r=e==null?0:e-c.pos[2];(a.type===`point`||a.type===`mesh`)&&this._editGeometryOperations?.moveVertices([c],t,n,r),this._connectedReshapeManager?.translate(t,n,r)}if(a.type===`point`)e.geometry=t;else if(a.type===`mesh`)e.geometry=a.centerAt(t);else{if(e!==this.graphic){l&&!this._isVertex(e)&&(l=null);let[i,s]=Z(e),c=K(a),u=o.pointToArray(t);if(this._updateGeometryFromGraphic(e,c,i,s,u,a.type===`polygon`),this._isVertex(e)||this._isCurveControlPoint(e)){let t=new Map;t.set(i,new Set([s])),c=this._moveRelatedCoordinates(c,e,u,t,l),c=this._moveSelectedHandleCoordinates(c,e,n,r,a.type===`polygon`),this._updateMidpointGraphicLocations(c,t),this._updateCurveGraphicLocations(c)}else this._isMidpoint(e)&&this._updateCurveGraphicLocations(c);V(a,c)}this._updateGraphicGeometry(a),this._syncEditGeometryOperations(a),i&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_syncEditGeometryOperations(e){this._editGeometryOperations?.trySetGeometry(e)||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(e,t,n,r,i){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&i){let a=this._relatedGraphicIndex.search({minX:i[0],maxX:i[0],minY:i[1],maxY:i[1]});for(let o of a)o.coordinate[0]===i[0]&&o.coordinate[1]===i[1]&&o.graphic&&(r&&c(r,o.pathIndex,()=>new Set).add(o.pointIndex),X(e,o.pathIndex,o.pointIndex,n),this._relatedGraphicIndex.remove(o),o.coordinate[0]=t.geometry.x,o.coordinate[1]=t.geometry.y,o.graphic.geometry=t.geometry,this._relatedGraphicIndex.insert(o));return e}let{relatedGraphicIndices:a}=t.attributes;if(!a?.length)return e;for(let i of a){let a=this.vertexGraphics.at(i),[o,s]=Z(a);r&&c(r,o,()=>new Set).add(s),X(e,o,s,n),a.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,n,r,i){for(let a of this.selectedManipulators)if(a!==t){let[t,o]=Z(a),s=a.getAttribute(L.relatedGraphicIndices),c=ve(a.geometry,n,r,this.view),l=S(c);if(a.geometry=c,this._updateGeometryFromGraphic(a,e,t,o,l,i),s?.length)for(let t of s){let n=this.vertexGraphics.at(t),[r,i]=Z(n);X(e,r,i,l),n.geometry=c}}return e}_updateGeometryFromGraphic(e,t,n,r,i,a){let o=t[n].length-1;this._isCurveControlPoint(e)?q(t,n,r,[i[0],i[1]],e.getAttribute(L.controlPointKind)):(X(t,n,r,i),a&&(r===0?X(t,n,o,i):r===o&&(t[n][0]=i)))}_onGraphicPointerOverCallback(e){let t=e.graphic;this._hoverGraphic=t;let n=this._isVertex(t);n&&!this._isSelected(t)?t.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.hover),this._updateTooltip(n?t:null),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){let t=e.graphic;this._hoverGraphic=null,this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.default),this.removeHandles(H),this._updateTooltip()}_handleMidpointClickOrStartMove(e){let{graphic:t}=e,n=this.graphic.geometry;if(n==null||n.type!==`polygon`&&n.type!==`polyline`)return[];let r=B(n),i=[],{[L.pathIndex]:a,[L.pointIndexStart]:o,[L.pointIndexEnd]:s}=t.attributes,c=S(t.geometry),l=s===0?o+1:s;t.attributes={[L.tool]:Ae,[L.pathIndex]:a,[L.pointIndex]:l,[L.relatedGraphicIndices]:[]};let u=K(r),d=u[a][s];if(A(d)){if(this.enableCurveOnMidpoint&&e.viewEvent.native.shiftKey){let e=E(u[a][l]);u[a].splice(l,1,{c:[e,[c[0],c[1]]]}),t.setAttribute(L.controlPointKind,z.circle.interior),t.setAttribute(L.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(t),this.curveControlPointGraphics.push(t),V(r,u)}else u[a].splice(l,0,c),i.push({coordinates:u[a][l],componentIndex:a,vertexIndex:l})}else{let e=E(u[a][o]),t=je(e,d,.5,this._coordinateHelper);u[a].splice(s,1,...t),i.push({coordinates:E(u[a][l]),componentIndex:a,vertexIndex:l})}return this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),i}_addToSelection(e){let t=$(e);for(let e of t)e.symbol=this._isCurveControlPoint(e)?this.symbols.controlPoints.selected:this.symbols.vertices.selected,this.selectedManipulators.add(e),this._updateTooltip(e);this._emitSelectEvent(t)}_removeFromSelection(e,t){if(this._isVertex(e)){let{vertices:n}=this.symbols;e.symbol=t?n.hover:n.default}else if(this._isCurveControlPoint(e)){let{controlPoints:n}=this.symbols;e.symbol=t?n.hover:n.default}this.selectedManipulators.remove(e),this._emitDeselectEvent([e]),this._updateTooltip()}_clearSelection(){let e=this.selectedManipulators.toArray(),{controlPoints:t,vertices:n}=this.symbols;if(e.length>0){for(let r of e)this._isVertex(r)?r.symbol=n.default:this._isCurveControlPoint(r)&&(r.symbol=t.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(e),this._updateTooltip()}}_keyDownHandler(e){this._activeOperationInfo==null&&pe(e,this.tooltip)||le.delete.includes(e.key)&&!e.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),e.stopPropagation())}_removeVertices(e){let t=this.graphic.geometry,n=this.vertexGraphics.length;if(t==null||t.type!==`polygon`&&t.type!==`polyline`&&t.type!==`multipoint`||t.type===`polygon`&&n<4||t.type===`multipoint`&&n<2||t.type===`polyline`&&n<3)return;let r=this.graphic.clone(),i=B(t),a=K(i),o=[],s=$(e);for(let e of s){if(this._isCurveControlPoint(e))continue;let{x:t,y:n}=e.geometry;for(let e=0;e<a.length;e++){let r=a[e];for(let i=0;i<r.length;i++){let[s,c]=E(r[i]);if(t===s&&n===c){o.push({coordinates:E(a[e][i]),componentIndex:e,vertexIndex:i}),a[e].splice(Number(i),1);let t=a[e][i];t&&!A(t)&&(a[e][i]=E(t))}}}}if(i.type===`polygon`)a=a.filter(e=>{if(e.length<2)return!1;let[t,n]=E(e[0]),[r,i]=E(e[e.length-1]);return e.length===2&&t===r&&n===i?!1:((t!==r||n!==i)&&e.push(e[0]),!0)});else if(i.type===`polyline`)for(let e of a)e.length===1&&a.splice(a.indexOf(e),1);V(i,a),this._updateGraphicGeometry(i),this.refresh(),this._emitVertexRemoveEvent(s,r,o)}_isVertex(e){return this.vertexGraphics.includes(e)}_isCurveControlPoint(e){return this.curveControlPointGraphics.includes(e)}_isConstructionLine(e){return this.constructionLineGraphics.includes(e)}_isSelected(e){return(this._isVertex(e)||this.curveControlPointGraphics.includes(e))&&this.selectedManipulators.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){let t=this._isMidpoint(e)?`copy`:`move`;this.addHandles(this.view.acquireCursor(t,`high`),H)}_updateTooltip(e,t){let n=null,{graphic:r,view:i,tooltipInfos:a}=this,o=r?.geometry;o?.type===`point`?n=a.movePoint:this._selectedManipulator?n=a.selectedVertex:e===this.graphic?(n=a.translateGraphic,we(n,i,this._tooltipsContext,this._updatingHandles,t)):e&&this.selectedManipulators.length>1&&(n=a.translateVertices,Te(n,i,o,this._tooltipsContext,this._updatingHandles,t)),this.activeTooltipInfo=n}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){let n={type:`move-start`,mover:this.graphic,dx:e,dy:t};this.emit(`move-start`,n),this.callbacks.onMoveStart?.(n)}_emitMoveEvent(e,t){let n={type:`move`,mover:this.graphic,dx:e,dy:t};this.emit(`move`,n),this.callbacks.onMove?.(n)}_emitMoveStopEvent(e,t){if(e==null||t==null){let n=this._activeOperationInfo;if(!n)return;e=n.totalDx,t=n.totalDy}let n={type:`move-stop`,mover:this.graphic,dx:e,dy:t};this.emit(`move-stop`,n),this.callbacks.onMoveStop?.(n)}_emitReshapeStartEvent(e){let t={type:`reshape-start`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape-start`,t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){let t={type:`reshape`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape`,t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){let t={type:`reshape-stop`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape-stop`,t),this.callbacks.onReshapeStop?.(t)}_emitSelectEvent(e){let t={type:`vertex-select`,added:e};this.emit(`select`,t),this.callbacks.onVertexSelect?.(t)}_emitDeselectEvent(e){let t={type:`vertex-deselect`,removed:e};this.emit(`deselect`,t),this.callbacks.onVertexDeselect?.(t)}_emitVertexAddEvent(e,t,n){let r={type:`vertex-add`,added:e,graphic:this.graphic,oldGraphic:t,vertices:n};this.emit(`vertex-add`,r),this.callbacks.onVertexAdd?.(r)}_emitVertexRemoveEvent(e,t,n){let r={type:`vertex-remove`,removed:e,graphic:this.graphic,oldGraphic:t,vertices:n};this.emit(`vertex-remove`,r),this.callbacks.onVertexRemove?.(r)}_logGeometryTypeError(){s.getLogger(this).error(new a(`reshape:invalid-geometry`,`Reshape operation not supported for the provided graphic. The geometry type is not supported.`))}};e([t()],W.prototype,`_activeOperationInfo`,void 0),e([t()],W.prototype,`_connectedReshapeManager`,void 0),e([t()],W.prototype,`_coordinateHelper`,null),e([t()],W.prototype,`_editGeometryOperations`,void 0),e([t()],W.prototype,`_effectiveFilterVerticesEnabled`,null),e([t()],W.prototype,`_primaryGraphicMoving`,void 0),e([t()],W.prototype,`_segmentLabels`,void 0),e([t()],W.prototype,`test`,null),e([t()],W.prototype,`_segmentLabelsImportTask`,void 0),e([t()],W.prototype,`_updatingHandles`,void 0),e([t()],W.prototype,`_selectedManipulator`,null),e([t()],W.prototype,`_tooltipsContext`,null),e([t()],W.prototype,`callbacks`,void 0),e([t()],W.prototype,`connectedReshapeProviders`,void 0),e([t()],W.prototype,`enableMidpoints`,void 0),e([t()],W.prototype,`enableCurveOnMidpoint`,void 0),e([t()],W.prototype,`enableMovement`,void 0),e([t()],W.prototype,`enableVertices`,void 0),e([t()],W.prototype,`filterVerticesEnabled`,void 0),e([t()],W.prototype,`graphic`,void 0),e([t()],W.prototype,`highlightName`,void 0),e([t()],W.prototype,`highlightsEnabled`,void 0),e([t()],W.prototype,`layer`,void 0),e([t()],W.prototype,`snappingManager`,void 0),e([t({readOnly:!0})],W.prototype,`state`,null),e([t()],W.prototype,`symbols`,void 0),e([t()],W.prototype,`tooltip`,void 0),e([t()],W.prototype,`tooltipInfos`,void 0),e([t()],W.prototype,`activeTooltipInfo`,void 0),e([t()],W.prototype,`updating`,null),e([t()],W.prototype,`toolOptions`,void 0),e([t({readOnly:!0})],W.prototype,`type`,void 0),e([t({readOnly:!0})],W.prototype,`vertexGraphics`,void 0),e([t({readOnly:!0})],W.prototype,`curveControlPointGraphics`,void 0),e([t({readOnly:!0})],W.prototype,`constructionLineGraphics`,void 0),e([t({readOnly:!0})],W.prototype,`midpointGraphics`,void 0),e([t({readOnly:!0})],W.prototype,`selectedManipulators`,void 0),e([t()],W.prototype,`view`,void 0),W=e([n(`esri.views.draw.support.Reshape`)],W);function G(e){let t=K(e);t=t.map(e=>e.slice());for(let e of t)for(let t=0;t<e.length;t++)e[t]=ee(e[t]);if(e.type===`polygon`)for(let e of t){let t=e[e.length-1];if(!A(t))continue;let n=e[0];n[0]===t[0]&&n[1]===t[1]&&e.length>2&&e.pop()}return t}function K(e){return e.type===`polygon`?e.curveRings?.slice()??e.rings.slice():e.type===`polyline`?e.curvePaths?.slice()??e.paths.slice():e.points.map(e=>[e])}function Pe(e,t,n,r){let i=e[t][n];if(D(i))i.c[1]=r;else if(O(i)){let i=E(e[t][n]);e[t][n]={c:[i,r]}}}function q(e,t,n,r,i){switch(i){case z.circle.interior:Pe(e,t,n,r);break;case z.bezier.cp1:e[t][n].b[1]=r;break;case z.bezier.cp2:e[t][n].b[2]=r}}function J(e,t){return e<t*1e-8}function Y(e,{cx:t,cy:n,isInvalid:r,thetaStart:i,thetaEnd:a},o,s){let[c,l]=e,[u,d]=o,f=u-c,p=d-l;t-=c,n-=l;let m=s?i>a:i<a,[h,g]=r?[t,n]:m?[-n,t]:[n,-t],[_,v]=[f,p],[y,b]=[h,g],x=_*b-v*y,S=(f**2+p**2)/2;if(J(Math.abs(x),S))return[(c+u)/2,(l+d)/2];let[C,w]=[b/x*S,-y/x*S],T=C**2+w**2,[E,D]=[f/2-C,p/2-w];if(J(E**2+D**2,T)){let[e,t]=m?[-w,C]:[w,-C];return[e+C+c,t+w+l]}let O=Math.sqrt((C**2+w**2)/(E**2+D**2))*Math.sign(f*h+p*g);return[E*O+C+c,D*O+w+l]}function X(e,t,n,r){let i=e[t][n],a=e[t].at(n+1);if(Me(e,t)){let n=e[t][1];e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0]};return}if(Ne(e,t)){let n=e[t][1],[i,a]=n.a[1],[o,s]=r,c=Math.hypot(o-i,s-a),[l,u]=[o-i,s-a],d=te(u,l);e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0,d,c,n.a[6]]};return}let o=E(i);if(A(i))i.splice(0,i.length,...r);else if(k(i))i.b[0].splice(0,i.b[0].length,...r);else if(D(i)||O(i)){let a=E(e[t][n-1]),o=D(i)?w(a,i):M(a,i);e[t].splice(n,1,{c:[[...r],Y(a,o,r,!0)]})}else if(j(i)){i.a[0].splice(0,i.a[0].length,...r);let a=E(e[t][n-1]);N(a,i)}if(a&&!A(a)&&!k(i)){if(D(a)||O(a)){let i=E(a),s=D(a)?w(o,a):M(o,a);e[t].splice(n+1,1,{c:[i,Y(i,s,r,!1)]})}else if(j(a)){let e=E(i);N(e,a)}}}function Z({attributes:e}){return[e?.[L.pathIndex]||0,e?.[L.pointIndex]||0]}function Q({attributes:e}){return`${e?.[L.pathIndex]}-${e?.[L.pointIndex]}-${e?.[L.controlPointKind]??`vertex`}`}function $(e){return e instanceof re?[e]:[...e]}function Fe(e){let t=e.sourceLayer??e.layer;return xe(t)?{graphic:e,layer:t}:null}function Ie(e){return e.toArray().map(({attributes:e})=>({pathIndex:e[L.pathIndex],vertexIndex:e[L.pointIndex]}))}const Le=W;export{Le as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- function e(e,a,o){if(e==null)return`noTool`;switch(e){case`point`:return t();case`multipoint`:return`multipoint`;case`polyline`:return n(a,o);case`polygon`:return r(a,o);case`rectangle`:case`circle`:return i(a,o);default:return}}function t(e){return`point`}function n(e,t){let n=e!=null&&e.type===`polyline`&&e.paths.length?e.paths[0].length:0;return t===`freehand`?n<2?`freehandStart`:`freehandEnd`:n<2?`polylineZeroVertices`:`polylineOneVertex`}function r(e,t){let n=e!=null&&e.type===`polygon`&&e.rings.length?e.rings[0].length:0;if(n<3)switch(t){case`freehand`:return`freehandStart`;case`hybrid`:return`polygonZeroVerticesHybrid`;default:return`polygonZeroVertices`}else if(n<4)switch(t){case`freehand`:return`freehandEnd`;default:return`polygonOneVertex`}return`polygonTwoVertices`}function i(e,t){if((e!=null&&e.type===`polygon`&&e.rings.length?e.rings[0].length:0)<3)switch(t){case`freehand`:return`freehandStart`;case`click`:return`shapeStartClick`;default:return`shapeStartHybrid`}switch(t){case`freehand`:return`freehandEnd`;case`click`:return`shapeEndClick`;default:return`shapeEndHybrid`}}export{e as getDrawHelpMessage};
2
+ function e(e,a,o){if(e==null)return`noTool`;switch(e){case`point`:return t();case`multipoint`:return`multipoint`;case`polyline`:return n(a,o);case`polygon`:return r(a,o);case`rectangle`:case`circle`:return i(a,o);default:return}}function t(e){return`point`}function n(e,t){let n=e!=null&&e.type===`polyline`&&e.paths.length?e.paths[0].length:0;return t===`freehand`?n<2?`freehandStart`:`freehandEnd`:n<2?`polylineZeroVertices`:`polylineOneVertex`}function r(e,t){let n=e!=null&&e.type===`polygon`&&e.rings.length?e.rings[0].length:0;if(n<3)switch(t){case`freehand`:return`freehandStart`;case`hybrid`:return`polygonZeroVerticesHybrid`;default:return`polygonZeroVertices`}else if(n<4)return t===`freehand`?`freehandEnd`:`polygonOneVertex`;return`polygonTwoVertices`}function i(e,t){if((e!=null&&e.type===`polygon`&&e.rings.length?e.rings[0].length:0)<3)switch(t){case`freehand`:return`freehandStart`;case`click`:return`shapeStartClick`;default:return`shapeStartHybrid`}switch(t){case`freehand`:return`freehandEnd`;case`click`:return`shapeEndClick`;default:return`shapeEndHybrid`}}export{e as getDrawHelpMessage};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import r from"../../../../core/Collection.js";import i from"../../../../core/Error.js";import{EventedAccessor as a}from"../../../../core/Evented.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{EditGeometry as s}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as c}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{EditSession as l,captureGeometryChangeEvents as u}from"../EditSession.js";let d=class extends a{constructor(e){super(e),this._sessionStack=new r,this._pluginSessionLookup=new WeakMap,this._sharedEditGeometry=null}destroy(){this._sharedEditGeometry=o(this._sharedEditGeometry),this._sessionStack.drain(e=>e.destroy())}get _lastOperableSessionIndex(){let e=this._sessionStack.items.findLastIndex(e=>e.editGeometryOperations===this._sharedEditGeometry);return e>=0?e:null}get editGeometryOperations(){return this._sharedEditGeometry}get outputGeometry(){return this._sharedEditGeometry?.data.geometry}get canUndo(){let e=this._sharedEditGeometry?.canUndo??!1;return this._sessionStack.some(t=>(t.stepUndoStack.length>0||t.operations.size>0&&e)&&!t.automaticRestart)}get canRedo(){return this._sharedEditGeometry?.canRedo||this._sessionStack.some(e=>e.stepRedoStack.length>0)}get test(){return{sessionStack:this._sessionStack}}startSession(e,t,n,r){let i=t?this._sharedEditGeometry??=this._setupEditGeometryOperations(n,this):this._setupEditGeometryOperations(n,e),a=new l({editGeometryOperations:i,plugin:e});return a.restoreState(r),a.addHandles([a.on(`completed`,()=>{this.completeSession(a)}),a.on(`before-apply-operation`,e=>{let t=e.session;if(e.blockApply=!0,t.editGeometryOperations!==this._sharedEditGeometry){e.blockApply=!1;return}let n=this._lastOperableSessionIndex;this._sessionStack.indexOf(t)===n&&(e.blockApply=!1)})]),this._sessionStack.push(a),this._pluginSessionLookup.set(e,a),a}cancelSession(e){let t=this._pluginSessionLookup.get(e);if(!t)return;let n=this._sessionStack.indexOf(t);if(!(n<0))for(let e=this._sessionStack.length-1;e>=n;e--){let t=this._sessionStack.at(e);this._discardSessionOperations(t),this._cleanUpSession(t),this._sessionStack.remove(t)}}completeSession(e){let t=this._sessionStack;for(;t.length>0;){let n=t.pop();if(t.at(-1)?.mergeSession(n),this._cleanUpSession(n),n===e)break}}getSession(e){return this._pluginSessionLookup.get(e)??null}undo(){let e=this._undoAndGetRestartInfo([]);e.length>0&&this._restartSession(e.toReversed())}redo(){let e=this._sharedEditGeometry;if(!e||!this.canRedo||this._sessionStack.length===0)return;let t=e.nextOperation,n=[],r=[],i=null,a=!1;for(let e=0;e<this._sessionStack.length;e++){let n=this._sessionStack.at(e);if(t&&n.undoneOperations.has(t)){i=e,a=!0;break}n.stepRedoStack.length>0&&i===null&&(i=e)}if(i===null)return;for(let e=this._sessionStack.length-1;e>i;e--){let t=this._sessionStack.at(e);if(t.automaticRestart){this._discardSessionOperations(t);let e=this._requestCancelSession(t,`undo`,!1);e&&n.push(e)}else r.push(t)}let o=this._sessionStack.at(i);if(a)this._redoOperation(o,e),r.push(o);else{let e=this._requestCancelSession(o,`redo`,!0);e&&n.push(e)}n.length>0&&this._restartSession(n.toReversed());for(let{plugin:e}of r)e?.afterUndoRedo?.(`redo`)}generatePreviewGeometryForPlugins(e){let t=this.editGeometryOperations,n=t?.data.type;if(!n||n===`mesh`)return null;let r=e.map(e=>this._pluginSessionLookup.get(e)).filter(e=>e?.editGeometryOperations===t),i=r.findLast(e=>e?.endVertex)?.endVertex,a=r.find(e=>e?.startingVertex)?.startingVertex;return!a||!i?null:this.editGeometryOperations?.data.getPartialGeometry(a,i,n)}_discardSessionOperations(e){let t=e.editGeometryOperations;if(!t)return;let n=t.lastOperation;try{for(t.disableDefaultRedoBehavior=!0;n&&e.operations.has(n);)this._undoOperation(e,t),n=t.lastOperation}finally{t.disableDefaultRedoBehavior=!1}}_undoAndGetRestartInfo(e){let t=this._sharedEditGeometry;if(!t||!this.canUndo||this._sessionStack.length===0)return e;let n=t.lastOperation,r=!1;for(let i=this._sessionStack.length-1;i>=0;i--){let a=this._sessionStack.at(i),o=n&&a.operations.has(n);if(a.automaticRestart){this._discardSessionOperations(a);let t=this._requestCancelSession(a,`undo`,!1);t&&e.push(t)}else if(a.stepUndoStack.length>0){let t=this._requestCancelSession(a,`undo`,!0);t&&e.push(t),r=!a.stepUndoStack.length;break}else if(o){this._undoOperation(a,t),a.plugin?.afterUndoRedo?.(`undo`);break}if(o){r=!0;break}}return r&&this._undoAndGetRestartInfo(e),e}_setupEditGeometryOperations(e,t){let{coordinateHelper:n,viewingMode:r}=this.getContext?.()??{};if(!n||!r)throw new i(`esri-drawtool:edit-session-missing-context`,`Failed to initialize edit session`);let a=new c(new s(e,n),r,!0);return t.addHandles([a.data.on(`change`,()=>{this.notifyChange(`outputGeometry`)}),a.on(`can-redo-change`,()=>{this.notifyChange(`canRedo`)}),a.on(`can-undo-change`,()=>{this.notifyChange(`canUndo`)}),a.on(`redo-reset`,()=>{this._sessionStack.forEach(e=>e.undoneOperations.clear()),this.notifyChange(`canRedo`)})]),a}_requestCancelSession(e,t,n){try{let r=e.plugin;if(!r)return null;let i=r.configuration,a=r?.suspend?.(),o=null,{stepUndoStack:s,stepRedoStack:c,automaticRestart:l}=e;t===`undo`&&!e.automaticRestart&&n?(o=s.pop(),o&&c.push(o)):t===`redo`&&n&&(o=c.pop(),o&&s.push(o));let u={undoSteps:[...s],redoSteps:[...c],automaticRestart:l,isConnected:e.editGeometryOperations===this._sharedEditGeometry,geometryType:e.editGeometryOperations.data.geometry?.type};return this.emit(`cancelPlugin`,{plugin:r}),i?{pluginConfiguration:i,pluginState:a,sessionState:u,currentInternalStep:s.at(-1),pluginInstance:r}:null}finally{this._cleanUpSession(e)}}_restartSession(e){this.emit(`restartPlugin`,{restartInfo:e}),this.notifyChange(`outputGeometry`)}_cleanUpSession(e){e.plugin=null,e.destroy()}_undoOperation(e,t){let n=null,r=u(t,()=>{n=t.undo()});return e&&(e.syncVertices(r),n&&(e.operations.delete(n),e.undoneOperations.add(n))),n}_redoOperation(e,t){let n=null,r=u(t,()=>{n=t.redo()});return e?.syncVertices(r),e&&n&&(e.operations.add(n),e.undoneOperations.delete(n)),n}};e([t()],d.prototype,`_sharedEditGeometry`,void 0),e([t()],d.prototype,`_lastOperableSessionIndex`,null),e([t()],d.prototype,`editGeometryOperations`,null),e([t()],d.prototype,`outputGeometry`,null),e([t()],d.prototype,`getContext`,void 0),e([t()],d.prototype,`canUndo`,null),e([t()],d.prototype,`canRedo`,null),e([t()],d.prototype,`test`,null),d=e([n(`esri.views.draw.support.managers.EditSessionManager`)],d);export{d as EditSessionManager};
2
+ import{__decorate as e}from"tslib";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import r from"../../../../core/Collection.js";import i from"../../../../core/Error.js";import{EventedAccessor as a}from"../../../../core/Evented.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{EditGeometry as s}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as c}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{EditSession as l,captureGeometryChangeEvents as u}from"../EditSession.js";let d=class extends a{constructor(e){super(e),this._sessionStack=new r,this._pluginSessionLookup=new WeakMap,this._sharedEditGeometry=null}destroy(){this._sharedEditGeometry=o(this._sharedEditGeometry),this._sessionStack.drain(e=>e.destroy())}get _lastOperableSessionIndex(){let e=this._sessionStack.items.findLastIndex(e=>e.editGeometryOperations===this._sharedEditGeometry);return e>=0?e:null}get editGeometryOperations(){return this._sharedEditGeometry}get outputGeometry(){return this._sharedEditGeometry?.data.geometry}get canUndo(){let e=this._sharedEditGeometry?.canUndo??!1;return this._sessionStack.some(t=>(t.stepUndoStack.length>0||t.operations.size>0&&e)&&!t.automaticRestart)}get canRedo(){return this._sharedEditGeometry?.canRedo||this._sessionStack.some(e=>e.stepRedoStack.length>0)}get test(){return{sessionStack:this._sessionStack}}startSession(e,t,n,r){let i=t?this._sharedEditGeometry??=this._setupEditGeometryOperations(n,this):this._setupEditGeometryOperations(n,e),a=new l({editGeometryOperations:i,plugin:e});return a.restoreState(r),a.addHandles([a.on(`completed`,()=>{this.completeSession(a)}),a.on(`before-apply-operation`,e=>{let t=e.session;if(e.blockApply=!0,t.editGeometryOperations!==this._sharedEditGeometry){e.blockApply=!1;return}let n=this._lastOperableSessionIndex;this._sessionStack.indexOf(t)===n&&(e.blockApply=!1)})]),this._sessionStack.push(a),this._pluginSessionLookup.set(e,a),a}cancelSession(e){let t=this._pluginSessionLookup.get(e);if(!t)return;let n=this._sessionStack.indexOf(t);if(!(n<0))for(let e=this._sessionStack.length-1;e>=n;e--){let t=this._sessionStack.at(e);this._discardSessionOperations(t),this._cleanUpSession(t),this._sessionStack.remove(t)}}completeSession(e){let t=this._sessionStack;for(;t.length>0;){let n=t.pop();if(t.at(-1)?.mergeSession(n),this._cleanUpSession(n),n===e)break}}getSession(e){return this._pluginSessionLookup.get(e)??null}undo(){let e=this._undoAndGetRestartInfo([]);e.length>0&&this._restartSession(e.toReversed())}redo(){let e=this._sharedEditGeometry;if(!e||!this.canRedo||this._sessionStack.length===0)return;let t=e.nextOperation,n=[],r=[],i=null,a=!1;for(let e=0;e<this._sessionStack.length;e++){let n=this._sessionStack.at(e);if(t&&n.undoneOperations.has(t)){i=e,a=!0;break}n.stepRedoStack.length>0&&i===null&&(i=e)}if(i===null)return;for(let e=this._sessionStack.length-1;e>i;e--){let t=this._sessionStack.at(e);if(t.automaticRestart){this._discardSessionOperations(t);let e=this._requestCancelSession(t,`undo`,!1);e&&n.push(e)}else r.push(t)}let o=this._sessionStack.at(i);if(a)this._redoOperation(o,e),r.push(o);else{let e=this._requestCancelSession(o,`redo`,!0);e&&n.push(e)}n.length>0&&this._restartSession(n.toReversed());for(let{plugin:e}of r)e?.afterUndoRedo?.(`redo`)}generatePreviewGeometryForPlugins(e){let t=this.editGeometryOperations,n=t?.data.type;if(!n||n===`mesh`)return null;let r=e.map(e=>this._pluginSessionLookup.get(e)).filter(e=>e?.editGeometryOperations===t),i=r.findLast(e=>e?.endVertex)?.endVertex,a=r.find(e=>e?.startingVertex)?.startingVertex;return!a||!i?null:this.editGeometryOperations?.data.getPartialGeometry(a,i,n)}_discardSessionOperations(e){let t=e.editGeometryOperations;if(!t)return;let n=t.lastOperation;try{for(t.disableDefaultRedoBehavior=!0;n&&e.operations.has(n);)this._undoOperation(e,t),n=t.lastOperation}finally{t.disableDefaultRedoBehavior=!1}}_undoAndGetRestartInfo(e){let t=this._sharedEditGeometry;if(!t||!this.canUndo||this._sessionStack.length===0)return e;let n=t.lastOperation,r=!1;for(let i=this._sessionStack.length-1;i>=0;i--){let a=this._sessionStack.at(i),o=n&&a.operations.has(n);if(a.automaticRestart){this._discardSessionOperations(a);let t=this._requestCancelSession(a,`undo`,!1);t&&e.push(t)}else if(a.stepUndoStack.length>0){let t=this._requestCancelSession(a,`undo`,!0);t&&e.push(t),r=!a.stepUndoStack.length;break}else if(o){this._undoOperation(a,t),a.plugin?.afterUndoRedo?.(`undo`);break}if(o){r=!0;break}}return r&&this._undoAndGetRestartInfo(e),e}_setupEditGeometryOperations(e,t){let{coordinateHelper:n,isGlobal:r}=this.getContext?.()??{};if(!n||r==null)throw new i(`esri-drawtool:edit-session-missing-context`,`Failed to initialize edit session`);let a=new c(new s(e,n),r,!0);return t.addHandles([a.data.on(`change`,()=>{this.notifyChange(`outputGeometry`)}),a.on(`can-redo-change`,()=>{this.notifyChange(`canRedo`)}),a.on(`can-undo-change`,()=>{this.notifyChange(`canUndo`)}),a.on(`redo-reset`,()=>{this._sessionStack.forEach(e=>e.undoneOperations.clear()),this.notifyChange(`canRedo`)})]),a}_requestCancelSession(e,t,n){try{let r=e.plugin;if(!r)return null;let i=r.configuration,a=r?.suspend?.(),o=null,{stepUndoStack:s,stepRedoStack:c,automaticRestart:l}=e;t===`undo`&&!e.automaticRestart&&n?(o=s.pop(),o&&c.push(o)):t===`redo`&&n&&(o=c.pop(),o&&s.push(o));let u={undoSteps:[...s],redoSteps:[...c],automaticRestart:l,isConnected:e.editGeometryOperations===this._sharedEditGeometry,geometryType:e.editGeometryOperations.data.geometry?.type};return this.emit(`cancelPlugin`,{plugin:r}),i?{pluginConfiguration:i,pluginState:a,sessionState:u,currentInternalStep:s.at(-1),pluginInstance:r}:null}finally{this._cleanUpSession(e)}}_restartSession(e){this.emit(`restartPlugin`,{restartInfo:e}),this.notifyChange(`outputGeometry`)}_cleanUpSession(e){e.plugin=null,e.destroy()}_undoOperation(e,t){let n=null,r=u(t,()=>{n=t.undo()});return e&&(e.syncVertices(r),n&&(e.operations.delete(n),e.undoneOperations.add(n))),n}_redoOperation(e,t){let n=null,r=u(t,()=>{n=t.redo()});return e?.syncVertices(r),e&&n&&(e.operations.add(n),e.undoneOperations.delete(n)),n}};e([t()],d.prototype,`_sharedEditGeometry`,void 0),e([t()],d.prototype,`_lastOperableSessionIndex`,null),e([t()],d.prototype,`editGeometryOperations`,null),e([t()],d.prototype,`outputGeometry`,null),e([t()],d.prototype,`getContext`,void 0),e([t()],d.prototype,`canUndo`,null),e([t()],d.prototype,`canRedo`,null),e([t()],d.prototype,`test`,null),d=e([n(`esri.views.draw.support.managers.EditSessionManager`)],d);export{d as EditSessionManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isSome as e}from"../../../core/arrayUtils.js";import{invert as t}from"../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as n,clone as r}from"../../../core/libs/gl-matrix-2/factories/mat2df64.js";import{rotationTo as i,invert as a}from"../../../core/libs/gl-matrix-2/math/quat.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{scale as s,dot as c,subtract as l,normalize as u,cross as d,transformQuat as f}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import m from"../../../geometry/Point.js";function h(e,t,n=null){return n==null?[e,t]:[e,t,n]}function g(e,t,n=null){return n==null?{x:e,y:t}:{x:e,y:t,z:n}}class _{constructor(e){this.spatialReference=e}mapToLocalMultiple(t){return t.map(e=>this.mapToLocal(e)).filter(e)}get doUnnormalization(){return!1}}class v extends _{constructor(e,i,a=null){super(i),this._defaultZ=a,this.transform=n(),this.transformInv=n(),this.transform=r(e),t(this.transformInv,this.transform)}makeMapPoint(e,t){return h(e,t,this._defaultZ)}mapToLocal(e){return g(this.transform[0]*e[0]+this.transform[2]*e[1]+this.transform[4],this.transform[1]*e[0]+this.transform[3]*e[1]+this.transform[5])}localToMap(e){return h(this.transformInv[0]*e.x+this.transformInv[2]*e.y+this.transformInv[4],this.transformInv[1]*e.x+this.transformInv[3]*e.y+this.transformInv[5],this._defaultZ)}}class y extends _{constructor(e,t){super(e.spatialReference),this.view=e,this.defaultZ=null,this.pWS=p(),this.tangentFrameUpWS=p(),this.tangentFrameRightWS=p(),this.tangentFrameForwardWS=p(),this.localFrameRightWS=p(),this.localFrameUpWS=p(),this.worldToLocalTransform=o(),this.localToWorldTransform=o(),this.scale=1,this.scale=e.resolution,this.referenceMapPoint=t,this.defaultZ=t.hasZ?t.z:null;let n=e.state.camera.viewRight;this.view.renderCoordsHelper.toRenderCoords(this.referenceMapPoint,this.pWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,0,this.tangentFrameRightWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,1,this.tangentFrameUpWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,2,this.tangentFrameForwardWS);let r=p();s(r,this.tangentFrameForwardWS,c(n,this.tangentFrameForwardWS)),l(this.localFrameRightWS,n,r),u(this.localFrameRightWS,this.localFrameRightWS),d(this.localFrameUpWS,this.tangentFrameForwardWS,this.localFrameRightWS),i(this.worldToLocalTransform,this.localFrameRightWS,this.tangentFrameRightWS),a(this.localToWorldTransform,this.worldToLocalTransform)}get doUnnormalization(){return this.view.viewingMode===`global`}makeMapPoint(e,t){return h(e,t,this.defaultZ)}mapToLocal(e){let t=p();this.view.renderCoordsHelper.toRenderCoords(new m({x:e[0],y:e[1],spatialReference:this.spatialReference}),t),f(t,t,this.worldToLocalTransform);let n=this.view.renderCoordsHelper.fromRenderCoords(t,new m({spatialReference:this.view.spatialReference}));return n==null?null:g(n.x/this.scale,n.y/this.scale)}localToMap(e){let t=p();this.view.renderCoordsHelper.toRenderCoords(new m({x:e.x*this.scale,y:e.y*this.scale,spatialReference:this.spatialReference}),t),f(t,t,this.localToWorldTransform);let n=this.view.renderCoordsHelper.fromRenderCoords(t,new m({spatialReference:this.view.spatialReference}));return n==null?null:h(n.x,n.y,this.defaultZ)}}function b(e,t){if(e.type===`2d`)return new v(e.state.transform,e.spatialReference,t.length>2?t[2]:null);if(e.type===`3d`){let n=t.length>2?new m({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference}):new m({x:t[0],y:t[1],spatialReference:e.spatialReference});return new y(e,n)}return null}export{v as AffineCoordinateSystem,y as SceneViewCoordinateSystem,_ as SurfaceCoordinateSystem,b as createViewAlignedCoordinateSystem,h as makeMapPoint,g as makeSurfacePoint};
2
+ import{isSome as e}from"../../../core/arrayUtils.js";import{invert as t}from"../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as n,clone as r}from"../../../core/libs/gl-matrix-2/factories/mat2df64.js";import{rotationTo as i,invert as a}from"../../../core/libs/gl-matrix-2/math/quat.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{scale as s,dot as c,subtract as l,normalize as u,cross as d,transformQuat as f}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import m from"../../../geometry/Point.js";function h(e,t,n=null){return n==null?[e,t]:[e,t,n]}function g(e,t,n=null){return n==null?{x:e,y:t}:{x:e,y:t,z:n}}class _{constructor(e){this.spatialReference=e}mapToLocalMultiple(t){return t.map(e=>this.mapToLocal(e)).filter(e)}get doUnnormalization(){return!1}}class v extends _{constructor(e,i,a=null){super(i),this._defaultZ=a,this.transform=n(),this.transformInv=n(),this.transform=r(e),t(this.transformInv,this.transform)}makeMapPoint(e,t){return h(e,t,this._defaultZ)}mapToLocal(e){return g(this.transform[0]*e[0]+this.transform[2]*e[1]+this.transform[4],this.transform[1]*e[0]+this.transform[3]*e[1]+this.transform[5])}localToMap(e){return h(this.transformInv[0]*e.x+this.transformInv[2]*e.y+this.transformInv[4],this.transformInv[1]*e.x+this.transformInv[3]*e.y+this.transformInv[5],this._defaultZ)}}class y extends _{constructor(e,t){super(e.spatialReference),this.view=e,this.defaultZ=null,this.pWS=p(),this.tangentFrameUpWS=p(),this.tangentFrameRightWS=p(),this.tangentFrameForwardWS=p(),this.localFrameRightWS=p(),this.localFrameUpWS=p(),this.worldToLocalTransform=o(),this.localToWorldTransform=o(),this.scale=1,this.scale=e.resolution,this.referenceMapPoint=t,this.defaultZ=t.hasZ?t.z:null;let n=e.state.camera.viewRight;this.view.renderCoordsHelper.toRenderCoords(this.referenceMapPoint,this.pWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,0,this.tangentFrameRightWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,1,this.tangentFrameUpWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,2,this.tangentFrameForwardWS);let r=p();s(r,this.tangentFrameForwardWS,c(n,this.tangentFrameForwardWS)),l(this.localFrameRightWS,n,r),u(this.localFrameRightWS,this.localFrameRightWS),d(this.localFrameUpWS,this.tangentFrameForwardWS,this.localFrameRightWS),i(this.worldToLocalTransform,this.localFrameRightWS,this.tangentFrameRightWS),a(this.localToWorldTransform,this.worldToLocalTransform)}get doUnnormalization(){return this.view.state.isGlobal}makeMapPoint(e,t){return h(e,t,this.defaultZ)}mapToLocal(e){let t=p();this.view.renderCoordsHelper.toRenderCoords(new m({x:e[0],y:e[1],spatialReference:this.spatialReference}),t),f(t,t,this.worldToLocalTransform);let n=this.view.renderCoordsHelper.fromRenderCoords(t,new m({spatialReference:this.view.spatialReference}));return n==null?null:g(n.x/this.scale,n.y/this.scale)}localToMap(e){let t=p();this.view.renderCoordsHelper.toRenderCoords(new m({x:e.x*this.scale,y:e.y*this.scale,spatialReference:this.spatialReference}),t),f(t,t,this.localToWorldTransform);let n=this.view.renderCoordsHelper.fromRenderCoords(t,new m({spatialReference:this.view.spatialReference}));return n==null?null:h(n.x,n.y,this.defaultZ)}}function b(e,t){if(e.type===`2d`)return new v(e.state.transform,e.spatialReference,t.length>2?t[2]:null);if(e.type===`3d`){let n=t.length>2?new m({x:t[0],y:t[1],z:t[2],spatialReference:e.spatialReference}):new m({x:t[0],y:t[1],spatialReference:e.spatialReference});return new y(e,n)}return null}export{v as AffineCoordinateSystem,y as SceneViewCoordinateSystem,_ as SurfaceCoordinateSystem,b as createViewAlignedCoordinateSystem,h as makeMapPoint,g as makeSurfacePoint};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isSome as e}from"../../core/arrayUtils.js";import"../../core/has.js";import{clone as t}from"../../core/lang.js";import{clamp as n}from"../../core/mathUtils.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{project as i}from"../../geometry/projectionUtils.js";import{isMeshWithRelativeVertexSpace as a}from"../../geometry/support/meshVertexSpaceUtils.js";import{clonePoint as o}from"../../layers/graphics/hydratedFeatures.js";import{hydratedSpatialReference as s}from"../../layers/graphics/hydratedSpatialReference.js";import{getZForElevationMode as c}from"../../support/elevationInfoUtils.js";import{EditGeometryOperations as l}from"./editGeometry/EditGeometryOperations.js";function u(e,t){let n=null,r=null;return i=>{if(i.action===`cancel`){r!=null&&(r.execute({action:`cancel`}),n=null,r=null);return}let a={action:i.action,screenStart:i.start,screenEnd:i.screenPoint};i.action===`start`&&n==null&&(n=new D,r=new D,t(e,n,r,i.pointerType,a)),n?.execute(a),i.action===`end`&&n!=null&&(n=null,r=null)}}function d(e,t){return e.events.on(`drag`,u(e,t))}function f(e,t){let n=[e.x,e.y,e.z??0],r=t,i=[Math.cos(r),Math.sin(r)],a=Math.sqrt(i[0]*i[0]+i[1]*i[1]);if(a===0)return null;i[0]/=a,i[1]/=a;let o=e=>{let t=(e.x-n[0])*i[0]+(e.y-n[1])*i[1];e.x=n[0]+t*i[0],e.y=n[1]+t*i[1]};return e=>(o(e.mapStart),o(e.mapEnd),{...e,axis:i})}function p(e){let t=null,n=C();return r=>{if(r.action===`start`&&(t=h(e,r.mapStart.spatialReference)),t==null)return null;let i=n(r);if(!i)return null;let{translationX:a,translationY:o,translationZ:s}=i;return t.move(a,o,s,r.action),i}}function m(e,t){return e==null?null:e.spatialReference.equals(t)?e.clone():i(e,t)}function h(e,t){let n=e.operations;if(!n)return null;let r=n.data.geometry,o=s(t);if(r.spatialReference.equals(o))return g(e,n,()=>{});if(r.type!==`mesh`){let t=m(r,o);if(t==null)return null;let a=r.spatialReference,s=l.fromGeometry(t,n.viewingMode);return g(e,s,()=>{let e=s.data.geometry,t=i(e,a);n.trySetGeometry(t)})}if(a(r)){let t=m(r.origin,o);if(!t)return null;let a=r.spatialReference,s=l.fromGeometry(t,n.viewingMode);return g(e,n,()=>{let e=i(s.data.geometry,a),t=e.x-r.origin.x,o=e.y-r.origin.y,c=(e.z??0)-(r.origin.z??0);n.move(t,o,c)})}return null}function g(e,t,n){let r=0,i=0,a=0;return{move:(o,s,c,l)=>{l===`start`&&(r=0,i=0,a=0);let u=o-r,d=s-i,f=c-a;t.move(u,d,f),r+=u,i+=d,a+=f,n(),l===`end`&&e.endInteraction?.()}}}function _(e,t=null,n){let r=null,a=t!=null&&!e.spatialReference?.equals(t)?e=>e==null?e:i(e,t):e=>e,o={exclude:[],...n};return t=>{if(t.action===`start`&&(r=a(e.toMap(t.screenStart,o))),r==null)return null;let n=a(e.toMap(t.screenEnd,o));return n==null?null:{...t,mapStart:r,mapEnd:n}}}function v(t){let n=t.map(e=>p(e)).filter(e),r=C();return e=>{let t=r(e);return n.forEach(t=>t(e)),t}}function y(e,n){let r=new Map;for(let i of n)r.set(i,t(e[i]));return t=>(r.forEach((t,n)=>{e[n]=t}),t)}function b(e){let t=e.operations?.createResetState();return e=>(t?.remove(),e)}function x(e){let t=e.map(e=>b(e)).filter(e=>e!=null);return e=>(t.forEach(t=>t(e)),e)}function S(){let e=0,t=0,n=0;return r=>{r.action===`start`&&(e=r.mapStart.x,t=r.mapStart.y,n=r.mapStart.z??0);let i=r.mapEnd.x-e,a=r.mapEnd.y-t,o=(r.mapEnd.z??0)-n;return e=r.mapEnd.x,t=r.mapEnd.y,n=r.mapEnd.z,{...r,mapDeltaX:i,mapDeltaY:a,mapDeltaZ:o,mapDeltaSpatialReference:r.mapStart.spatialReference}}}function C(){let e=0,t=0,n=0;return r=>{r.action===`start`&&(e=r.mapStart.x,t=r.mapStart.y,n=r.mapStart.z??0);let i=r.mapEnd.x-e,a=r.mapEnd.y-t,o=(r.mapEnd.z??0)-n;return{...r,translationX:i,translationY:a,translationZ:o}}}function w(){let e=0,t=0;return n=>{n.action===`start`&&(e=n.screenStart.x,t=n.screenStart.y);let r=n.screenEnd.x-e,i=n.screenEnd.y-t;return e=n.screenEnd.x,t=n.screenEnd.y,{...n,screenDeltaX:r,screenDeltaY:i}}}function T(e,t){let i=null,a=0,o=0;return s=>{if(s.action===`start`&&(i=e.toScreen?.(t),i!=null&&(i.x<0||i.x>e.width||i.y<0||i.y>e.height?i=null:(a=s.screenStart.x-i.x,o=s.screenStart.y-i.y))),i==null)return null;let c=n(s.screenEnd.x-a,0,e.width),l=n(s.screenEnd.y-o,0,e.height),u=r(c,l);return s.screenStart=i,s.screenEnd=u,s}}const E=()=>{};class D{constructor(){this.execute=E}next(e,t=new D){return e!=null&&(this.execute=n=>{let r=e(n);r!=null&&t.execute(r)}),t}}function O(e,t,n=[]){if(e.type===`2d`)return e=>e;let r=null;return i=>{i.action===`start`&&(r=e.toMap(i.screenStart,{exclude:n}),r!=null&&(r.z=c(r,e,t)));let a=e.toMap(i.screenEnd,{exclude:n});a!=null&&(a.z=c(a,e,t));let o=r!=null&&a!=null?{sceneStart:r,sceneEnd:a}:null;return{...i,scenePoints:o}}}function k(e,t,n){let r=t.elevationProvider.getElevation(e.x,e.y,e.z??0,e.spatialReference,`scene`)??0,i=o(e);return i.z=r,i.hasZ=!0,i.z=c(i,t,n),i}function A(e,t){if(e.type===`2d`)return e=>e;let n=null;return r=>{r.action===`start`&&(n=k(r.mapStart,e,t));let i=k(r.mapEnd,e,t),a=n!=null&&i!=null?{sceneStart:n,sceneEnd:i}:null;return{...r,scenePoints:a}}}export{D as EventPipeline,S as addMapDelta,C as addMapTranslation,w as addScreenDelta,f as constrainToMapAxis,u as createDragEventPipelineCallback,d as createManipulatorDragEventPipeline,T as dragAtLocation,p as dragManipulatedObject,v as dragManipulatedObjectMany,b as resetManipulatedObject,x as resetManipulatedObjectMany,y as resetProperties,O as sceneSnappingAtLocation,A as sceneSnappingAtProjectedLocation,_ as screenToMap};
2
+ import{isSome as e}from"../../core/arrayUtils.js";import"../../core/has.js";import{clone as t}from"../../core/lang.js";import{clamp as n}from"../../core/mathUtils.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{project as i}from"../../geometry/projectionUtils.js";import{isMeshWithRelativeVertexSpace as a}from"../../geometry/support/meshVertexSpaceUtils.js";import{clonePoint as o}from"../../layers/graphics/hydratedFeatures.js";import{hydratedSpatialReference as s}from"../../layers/graphics/hydratedSpatialReference.js";import{getZForElevationMode as c}from"../../support/elevationInfoUtils.js";import{EditGeometryOperations as l}from"./editGeometry/EditGeometryOperations.js";function u(e,t){let n=null,r=null;return i=>{if(i.action===`cancel`){r!=null&&(r.execute({action:`cancel`}),n=null,r=null);return}let a={action:i.action,screenStart:i.start,screenEnd:i.screenPoint};i.action===`start`&&n==null&&(n=new D,r=new D,t(e,n,r,i.pointerType,a)),n?.execute(a),i.action===`end`&&n!=null&&(n=null,r=null)}}function d(e,t){return e.events.on(`drag`,u(e,t))}function f(e,t){let n=[e.x,e.y,e.z??0],r=t,i=[Math.cos(r),Math.sin(r)],a=Math.sqrt(i[0]*i[0]+i[1]*i[1]);if(a===0)return null;i[0]/=a,i[1]/=a;let o=e=>{let t=(e.x-n[0])*i[0]+(e.y-n[1])*i[1];e.x=n[0]+t*i[0],e.y=n[1]+t*i[1]};return e=>(o(e.mapStart),o(e.mapEnd),{...e,axis:i})}function p(e){let t=null,n=C();return r=>{if(r.action===`start`&&(t=h(e,r.mapStart.spatialReference)),t==null)return null;let i=n(r);if(!i)return null;let{translationX:a,translationY:o,translationZ:s}=i;return t.move(a,o,s,r.action),i}}function m(e,t){return e==null?null:e.spatialReference.equals(t)?e.clone():i(e,t)}function h(e,t){let n=e.operations;if(!n)return null;let r=n.data.geometry,o=s(t);if(r.spatialReference.equals(o))return g(e,n,()=>{});if(r.type!==`mesh`){let t=m(r,o);if(t==null)return null;let a=r.spatialReference,s=l.fromGeometry(t,n.isGlobal);return g(e,s,()=>{let e=s.data.geometry,t=i(e,a);n.trySetGeometry(t)})}if(a(r)){let t=m(r.origin,o);if(!t)return null;let a=r.spatialReference,s=l.fromGeometry(t,n.isGlobal);return g(e,n,()=>{let e=i(s.data.geometry,a),t=e.x-r.origin.x,o=e.y-r.origin.y,c=(e.z??0)-(r.origin.z??0);n.move(t,o,c)})}return null}function g(e,t,n){let r=0,i=0,a=0;return{move:(o,s,c,l)=>{l===`start`&&(r=0,i=0,a=0);let u=o-r,d=s-i,f=c-a;t.move(u,d,f),r+=u,i+=d,a+=f,n(),l===`end`&&e.endInteraction?.()}}}function _(e,t=null,n){let r=null,a=t!=null&&!e.spatialReference?.equals(t)?e=>e==null?e:i(e,t):e=>e,o={exclude:[],...n};return t=>{if(t.action===`start`&&(r=a(e.toMap(t.screenStart,o))),r==null)return null;let n=a(e.toMap(t.screenEnd,o));return n==null?null:{...t,mapStart:r,mapEnd:n}}}function v(t){let n=t.map(e=>p(e)).filter(e),r=C();return e=>{let t=r(e);return n.forEach(t=>t(e)),t}}function y(e,n){let r=new Map;for(let i of n)r.set(i,t(e[i]));return t=>(r.forEach((t,n)=>{e[n]=t}),t)}function b(e){let t=e.operations?.createResetState();return e=>(t?.remove(),e)}function x(e){let t=e.map(e=>b(e)).filter(e=>e!=null);return e=>(t.forEach(t=>t(e)),e)}function S(){let e=0,t=0,n=0;return r=>{r.action===`start`&&(e=r.mapStart.x,t=r.mapStart.y,n=r.mapStart.z??0);let i=r.mapEnd.x-e,a=r.mapEnd.y-t,o=(r.mapEnd.z??0)-n;return e=r.mapEnd.x,t=r.mapEnd.y,n=r.mapEnd.z,{...r,mapDeltaX:i,mapDeltaY:a,mapDeltaZ:o,mapDeltaSpatialReference:r.mapStart.spatialReference}}}function C(){let e=0,t=0,n=0;return r=>{r.action===`start`&&(e=r.mapStart.x,t=r.mapStart.y,n=r.mapStart.z??0);let i=r.mapEnd.x-e,a=r.mapEnd.y-t,o=(r.mapEnd.z??0)-n;return{...r,translationX:i,translationY:a,translationZ:o}}}function w(){let e=0,t=0;return n=>{n.action===`start`&&(e=n.screenStart.x,t=n.screenStart.y);let r=n.screenEnd.x-e,i=n.screenEnd.y-t;return e=n.screenEnd.x,t=n.screenEnd.y,{...n,screenDeltaX:r,screenDeltaY:i}}}function T(e,t){let i=null,a=0,o=0;return s=>{if(s.action===`start`&&(i=e.toScreen?.(t),i!=null&&(i.x<0||i.x>e.width||i.y<0||i.y>e.height?i=null:(a=s.screenStart.x-i.x,o=s.screenStart.y-i.y))),i==null)return null;let c=n(s.screenEnd.x-a,0,e.width),l=n(s.screenEnd.y-o,0,e.height),u=r(c,l);return s.screenStart=i,s.screenEnd=u,s}}const E=()=>{};class D{constructor(){this.execute=E}next(e,t=new D){return e!=null&&(this.execute=n=>{let r=e(n);r!=null&&t.execute(r)}),t}}function O(e,t,n=[]){if(e.type===`2d`)return e=>e;let r=null;return i=>{i.action===`start`&&(r=e.toMap(i.screenStart,{exclude:n}),r!=null&&(r.z=c(r,e,t)));let a=e.toMap(i.screenEnd,{exclude:n});a!=null&&(a.z=c(a,e,t));let o=r!=null&&a!=null?{sceneStart:r,sceneEnd:a}:null;return{...i,scenePoints:o}}}function k(e,t,n){let r=t.elevationProvider.getElevation(e.x,e.y,e.z??0,e.spatialReference,`scene`)??0,i=o(e);return i.z=r,i.hasZ=!0,i.z=c(i,t,n),i}function A(e,t){if(e.type===`2d`)return e=>e;let n=null;return r=>{r.action===`start`&&(n=k(r.mapStart,e,t));let i=k(r.mapEnd,e,t),a=n!=null&&i!=null?{sceneStart:n,sceneEnd:i}:null;return{...r,scenePoints:a}}}export{D as EventPipeline,S as addMapDelta,C as addMapTranslation,w as addScreenDelta,f as constrainToMapAxis,u as createDragEventPipelineCallback,d as createManipulatorDragEventPipeline,T as dragAtLocation,p as dragManipulatedObject,v as dragManipulatedObjectMany,b as resetManipulatedObject,x as resetManipulatedObjectMany,y as resetProperties,O as sceneSnappingAtLocation,A as sceneSnappingAtProjectedLocation,_ as screenToMap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{numbersEquals as e,pushIfSome as t}from"../../../core/arrayUtils.js";import{Evented as n}from"../../../core/Evented.js";import r from"../../../geometry/Multipoint.js";import i from"../../../geometry/Polygon.js";import a from"../../../geometry/Polyline.js";import{getEndpoint as o,isCoordinate as s,isBezierCurve as c,isCircularArc as l,isEllipticArc4 as u}from"../../../geometry/support/curves/curveUtils.js";import{unnormalize as d}from"../../support/unnormalizationUtils.js";import{createCoordinateHelper as f}from"../coordinateHelper.js";class p{constructor(e){this.part=e,this.leftSegment=null,this.rightSegment=null,this.type=`vertex`,this.index=null}get pos(){return this._pos}set pos(e){this._pos=e,this.part.unnormalizeVertexPositions()}}class m{constructor(e,t,n){this.part=e,this.leftVertex=t,this.rightVertex=n,this.type=`line`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return[...this.rightVertex.pos]}}class h{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`bezier`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return{b:[[...this.rightVertex.pos],[...this.curveDefinition.controlPoint1],[...this.curveDefinition.controlPoint2]]}}}class g{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`circular-arc`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{interiorPoint:t}=this.curveDefinition;return{c:[[...e],[...t]]}}}class _{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-4`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r}=this.curveDefinition;return{a:[[...e],[...t],n,r]}}}class v{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-7`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r,rotation:i,semiMajorAxisLength:a,minorMajorAxisRatio:o}=this.curveDefinition;return{a:[[...e],t,n,r,i,a,o]}}}class y{constructor(e,t,n=!1){this._spatialReference=e,this._viewingMode=t,this.autoClose=n,this.vertices=[],this.segments=[],this.index=null}unnormalizeVertexPositions(){this.vertices.length<=1||this._viewingMode===1&&d(this.vertices,this._spatialReference)}updateVertexIndex(e,t){let{vertices:n}=this;if(n.length===0)return;let r=n[0],i=null,a=e,o=t;do i=a,i.index=o++,a=i.rightSegment?i.rightSegment.rightVertex:null;while(a!=null&&a!==r);i.leftSegment&&i!==n[n.length-1]&&this.swapVertices(n.indexOf(i),n.length-1)}getFirstVertex(){return this.vertices.at(0)}getLastVertex(){return this.vertices.at(-1)}isClosed(){return this.getFirstVertex()?.leftSegment!=null}swapVertices(e,t){let{vertices:n}=this,r=n[e];n[e]=n[t],n[t]=r}*iterateVertices(){let e=this.getFirstVertex(),t=e;if(t)do yield t,t=t.rightSegment?.rightVertex;while(t!==e&&t!=null)}}class b extends n{constructor(e,t){super(),this.type=e,this.coordinateHelper=t,this._geometry=null,this._dirty=!0,this.parts=[]}get geometry(){if(this._dirty){switch(this.type){case`point`:this._geometry=this._toPoint();break;case`multipoint`:this._geometry=this._toMultipoint();break;case`polyline`:this._geometry=this._toPolyline();break;case`polygon`:this._geometry=this._toPolygon();break;case`mesh`:break;default:this.type}this._dirty=!1}return this._geometry}get spatialReference(){return this.coordinateHelper.spatialReference}get allVerticesUnordered(){return Array.from(this.iterateVerticesUnordered())}*iterateVerticesUnordered(){for(let e of this.parts)for(let t of e.vertices)yield t}get allVertices(){return Array.from(this.iterateVertices())}*iterateVertices(){for(let e of this.parts)yield*e.iterateVertices()}notifyChanges(e){this._dirty=!0,this.emit(`change`,e)}getPartialGeometry(e,t,n){let{parts:r,hasCurves:i}=w(this,{startingVertex:e,endingVertexInclusive:t,geometryType:n});return C(r,i,n,this.coordinateHelper)}_toPoint(){let{parts:e,coordinateHelper:t}=this;return e.at(0)?.vertices.length?t.vectorToPoint(e[0].vertices[0].pos):null}_toMultipoint(){let e=[],{coordinateHelper:t,parts:n,spatialReference:i}=this;for(let r of n){let n=r.getFirstVertex();n&&e.push(t.arrayToVector(n.pos))}return new r({hasM:t.hasM(),hasZ:t.hasZ(),spatialReference:i,points:e})}_toPolyline(){let e=[],t=!1;for(let n of this.parts){if(n.vertices.length<1)continue;let r=n.vertices[0],i=[];i.push(r.pos);let a=r.rightSegment;for(;a;)t||=a.type!==`line`,i.push(a.toCurveOrCoordinate()),a=a.rightVertex.rightSegment;e.push(i)}return new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}_toPolygon(){let t=[],n=!1;for(let r of this.parts){if(r.vertices.length<1)continue;let i=r.vertices[0],a=[];a.push(i.pos);let c=i.rightSegment;for(;c&&(n||=c.type!==`line`,a.push(c.toCurveOrCoordinate()),c=c.rightVertex.rightSegment,c?.leftVertex!==i););if(r.autoClose&&a.length>1){let t=a.at(-1),n=o(a[0]),r=o(t);a.length===2&&s(t)||e(n,r)||a.push(n)}t.push(a)}return new i({rings:n?void 0:t,curveRings:n?t:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}static fromGeometry(e,t,n){let r=e.spatialReference,i=f(e.hasZ,e.hasM,r),a=new b(e.type,i);switch(e.type){case`polygon`:T(a,e,t,n?.allowCurves??!1);break;case`polyline`:E(a,e,t,n?.allowCurves??!1);break;case`point`:D(a,e,t);break;case`multipoint`:O(a,e,t);break;case`mesh`:D(a,e.origin,t),a._geometry=e,a._dirty=!1}return a}}function x(e,t,n,r){let i=new p(e);e.vertices.push(i);let a=o(r);return i.pos=t.arrayToVector(a),i.index=e.vertices.length-1,n&&e.segments.push(S(e,n,i,r)),i}function S(e,t,n,r){if(s(r))return new m(e,t,n);if(c(r)){let[,i,a]=r.b;return new h(e,t,n,{controlPoint1:[...i],controlPoint2:[...a]})}if(l(r)){let[,i]=r.c;return new g(e,t,n,{interiorPoint:[...i]})}if(u(r)){let[,i,a,o]=r.a;return new _(e,t,n,{centerPoint:[...i],sweep:a,orientation:o})}let[,i,a,o,d,f,p]=r.a;return new v(e,t,n,{centerPoint:[...i],sweep:a,orientation:o,rotation:d,semiMajorAxisLength:f,minorMajorAxisRatio:p})}function C(e,t,n,s){let{spatialReference:c}=s;if(n===`point`){let t=e.at(0)?.at(0);return t?s.arrayToPoint(o(t)):null}return n===`polygon`?new i({rings:t?void 0:e,curveRings:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()}):n===`multipoint`?new r({spatialReference:c,points:e.flatMap(e=>e.map(e=>o(e))),hasM:s.hasM(),hasZ:s.hasZ()}):new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()})}function w(n,r){let i=(r?.geometryType??n.type)===`polygon`,a=[],c=!1,l=!1,u=!1;for(let d of n.parts){let n=null;if(u)break;if(d.vertices.length<1)continue;if(r?.startingVertex){if(d!==r.startingVertex.part&&!l)continue;l=!0}let f=d===r?.startingVertex?.part?r.startingVertex:d.vertices.at(0),p=[];if(t(p,f?.pos),f===r?.endingVertexInclusive){u=!0,n=f,a.push(p);break}let m=f?.rightSegment;for(;m;){if(c||=m.type!==`line`,p.push(m.toCurveOrCoordinate()),n=m.rightVertex,m.rightVertex===r?.endingVertexInclusive){u=!0;break}if(m=m.rightVertex.rightSegment,m?.leftVertex===f)break}let h=p.at(-1),g=d.getFirstVertex(),_=d.getLastVertex();i&&d.autoClose&&h&&n===_&&f===g&&(p.length>2||p.length===2&&!s(h))&&f?.pos&&!e(o(h),f.pos)&&p.push([...f.pos]),a.push(p)}return{parts:a,hasCurves:c}}function T(t,n,r,i){let a=n.spatialReference,s=t.coordinateHelper,{rings:c,curveRings:l}=n,u=l&&i?l:c;for(let n=0;n<u.length;++n){let i=u[n],c=new y(a,r);if(c.index=n,t.parts.push(c),i.length<1)continue;let l=null,d=null;for(let e=0;e<i.length-1;++e)d=x(c,s,d,i[e]),l??=d;i.length>1&&e(o(i[i.length-1]),l?.pos)?d&&l&&c.segments.push(S(c,d,l,i[i.length-1])):d=x(c,s,d,i[i.length-1])}}function E(e,t,n,r){let i=t.spatialReference,a=e.coordinateHelper,{curvePaths:o,paths:s}=t,c=o&&r?o:s;for(let t=0;t<c.length;++t){let r=c[t],o=new y(i,n);if(o.index=t,e.parts.push(o),r.length<1)continue;let s=null;for(let e=0;e<r.length;++e)s=x(o,a,s,r[e])}}function D(e,t,n){let r=t.spatialReference,i=e.coordinateHelper,a=new y(r,n);a.index=0;let o=new p(a);o.index=0,o.pos=i.pointToVector(t),a.vertices.push(o),e.parts.push(a)}function O(e,t,n){let r=t.spatialReference,{coordinateHelper:i,parts:a}=e,o=t.points.map(e=>i.arrayToVector(e));for(let e=0;e<o.length;e++){let t=new y(r,n);t.index=e,a.push(t);let i=new p(t);i.pos=o[e],i.index=0,t.vertices.push(i)}}function k(e){return e.type===`mesh`}function A(e,t){if(e.type!==t.type||e.parts.length!==t.parts.length)return!1;for(let n=0;n<e.parts.length;n++){let r=e.parts[n],i=t.parts[n];if(r.vertices.length!==i.vertices.length)return!1}let n=e.allVertices,r=t.allVertices;for(let e=0;e<n.length;e++)if(n[e].leftSegment?.type!==r[e].leftSegment?.type)return!1;return!0}export{h as BezierSegment,g as CircularArcSegment,b as EditGeometry,_ as EllipticArc4Segment,v as EllipticArc7Segment,m as LineSegment,y as Part,p as Vertex,x as addVertexAndConnectingSegment,S as createConnectingSegment,A as haveCompatibleTopologies,k as isMeshEditGeometry,C as partialCoordsToGeometry,w as toPartialCoords};
2
+ import{numbersEquals as e,pushIfSome as t}from"../../../core/arrayUtils.js";import{Evented as n}from"../../../core/Evented.js";import r from"../../../geometry/Multipoint.js";import i from"../../../geometry/Polygon.js";import a from"../../../geometry/Polyline.js";import{getEndpoint as o,isCoordinate as s,isBezierCurve as c,isCircularArc as l,isEllipticArc4 as u}from"../../../geometry/support/curves/curveUtils.js";import{unnormalize as d}from"../../support/unnormalizationUtils.js";import{createCoordinateHelper as f}from"../coordinateHelper.js";class p{constructor(e){this.part=e,this.leftSegment=null,this.rightSegment=null,this.type=`vertex`,this.index=null}get pos(){return this._pos}set pos(e){this._pos=e,this.part.unnormalizeVertexPositions()}}class m{constructor(e,t,n){this.part=e,this.leftVertex=t,this.rightVertex=n,this.type=`line`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return[...this.rightVertex.pos]}}class h{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`bezier`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return{b:[[...this.rightVertex.pos],[...this.curveDefinition.controlPoint1],[...this.curveDefinition.controlPoint2]]}}}class g{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`circular-arc`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{interiorPoint:t}=this.curveDefinition;return{c:[[...e],[...t]]}}}class _{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-4`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r}=this.curveDefinition;return{a:[[...e],[...t],n,r]}}}class v{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-7`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r,rotation:i,semiMajorAxisLength:a,minorMajorAxisRatio:o}=this.curveDefinition;return{a:[[...e],t,n,r,i,a,o]}}}class y{constructor(e,t,n=!1){this._spatialReference=e,this._isGlobal=t,this.autoClose=n,this.vertices=[],this.segments=[],this.index=null}unnormalizeVertexPositions(){this.vertices.length<=1||this._isGlobal&&d(this.vertices,this._spatialReference)}updateVertexIndex(e,t){let{vertices:n}=this;if(n.length===0)return;let r=n[0],i=null,a=e,o=t;do i=a,i.index=o++,a=i.rightSegment?i.rightSegment.rightVertex:null;while(a!=null&&a!==r);i.leftSegment&&i!==n[n.length-1]&&this.swapVertices(n.indexOf(i),n.length-1)}getFirstVertex(){return this.vertices.at(0)}getLastVertex(){return this.vertices.at(-1)}isClosed(){return this.getFirstVertex()?.leftSegment!=null}swapVertices(e,t){let{vertices:n}=this,r=n[e];n[e]=n[t],n[t]=r}*iterateVertices(){let e=this.getFirstVertex(),t=e;if(t)do yield t,t=t.rightSegment?.rightVertex;while(t!==e&&t!=null)}}class b extends n{constructor(e,t){super(),this.type=e,this.coordinateHelper=t,this._geometry=null,this._dirty=!0,this.parts=[]}get geometry(){if(this._dirty){switch(this.type){case`point`:this._geometry=this._toPoint();break;case`multipoint`:this._geometry=this._toMultipoint();break;case`polyline`:this._geometry=this._toPolyline();break;case`polygon`:this._geometry=this._toPolygon();break;case`mesh`:break;default:this.type}this._dirty=!1}return this._geometry}get spatialReference(){return this.coordinateHelper.spatialReference}get allVerticesUnordered(){return Array.from(this.iterateVerticesUnordered())}*iterateVerticesUnordered(){for(let e of this.parts)for(let t of e.vertices)yield t}get allVertices(){return Array.from(this.iterateVertices())}*iterateVertices(){for(let e of this.parts)yield*e.iterateVertices()}notifyChanges(e){this._dirty=!0,this.emit(`change`,e)}getPartialGeometry(e,t,n){let{parts:r,hasCurves:i}=w(this,{startingVertex:e,endingVertexInclusive:t,geometryType:n});return C(r,i,n,this.coordinateHelper)}_toPoint(){let{parts:e,coordinateHelper:t}=this;return e.at(0)?.vertices.length?t.vectorToPoint(e[0].vertices[0].pos):null}_toMultipoint(){let e=[],{coordinateHelper:t,parts:n,spatialReference:i}=this;for(let r of n){let n=r.getFirstVertex();n&&e.push(t.arrayToVector(n.pos))}return new r({hasM:t.hasM(),hasZ:t.hasZ(),spatialReference:i,points:e})}_toPolyline(){let e=[],t=!1;for(let n of this.parts){if(n.vertices.length<1)continue;let r=n.vertices[0],i=[];i.push(r.pos);let a=r.rightSegment;for(;a;)t||=a.type!==`line`,i.push(a.toCurveOrCoordinate()),a=a.rightVertex.rightSegment;e.push(i)}return new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}_toPolygon(){let t=[],n=!1;for(let r of this.parts){if(r.vertices.length<1)continue;let i=r.vertices[0],a=[];a.push(i.pos);let c=i.rightSegment;for(;c&&(n||=c.type!==`line`,a.push(c.toCurveOrCoordinate()),c=c.rightVertex.rightSegment,c?.leftVertex!==i););if(r.autoClose&&a.length>1){let t=a.at(-1),n=o(a[0]),r=o(t);a.length===2&&s(t)||e(n,r)||a.push(n)}t.push(a)}return new i({rings:n?void 0:t,curveRings:n?t:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}static fromGeometry(e,t,n){let r=e.spatialReference,i=f(e.hasZ,e.hasM,r),a=new b(e.type,i);switch(e.type){case`polygon`:T(a,e,t,n?.allowCurves??!1);break;case`polyline`:E(a,e,t,n?.allowCurves??!1);break;case`point`:D(a,e,t);break;case`multipoint`:O(a,e,t);break;case`mesh`:D(a,e.origin,t),a._geometry=e,a._dirty=!1}return a}}function x(e,t,n,r){let i=new p(e);e.vertices.push(i);let a=o(r);return i.pos=t.arrayToVector(a),i.index=e.vertices.length-1,n&&e.segments.push(S(e,n,i,r)),i}function S(e,t,n,r){if(s(r))return new m(e,t,n);if(c(r)){let[,i,a]=r.b;return new h(e,t,n,{controlPoint1:[...i],controlPoint2:[...a]})}if(l(r)){let[,i]=r.c;return new g(e,t,n,{interiorPoint:[...i]})}if(u(r)){let[,i,a,o]=r.a;return new _(e,t,n,{centerPoint:[...i],sweep:a,orientation:o})}let[,i,a,o,d,f,p]=r.a;return new v(e,t,n,{centerPoint:[...i],sweep:a,orientation:o,rotation:d,semiMajorAxisLength:f,minorMajorAxisRatio:p})}function C(e,t,n,s){let{spatialReference:c}=s;if(n===`point`){let t=e.at(0)?.at(0);return t?s.arrayToPoint(o(t)):null}return n===`polygon`?new i({rings:t?void 0:e,curveRings:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()}):n===`multipoint`?new r({spatialReference:c,points:e.flatMap(e=>e.map(e=>o(e))),hasM:s.hasM(),hasZ:s.hasZ()}):new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()})}function w(n,r){let i=(r?.geometryType??n.type)===`polygon`,a=[],c=!1,l=!1,u=!1;for(let d of n.parts){let n=null;if(u)break;if(d.vertices.length<1)continue;if(r?.startingVertex){if(d!==r.startingVertex.part&&!l)continue;l=!0}let f=d===r?.startingVertex?.part?r.startingVertex:d.vertices.at(0),p=[];if(t(p,f?.pos),f===r?.endingVertexInclusive){u=!0,n=f,a.push(p);break}let m=f?.rightSegment;for(;m;){if(c||=m.type!==`line`,p.push(m.toCurveOrCoordinate()),n=m.rightVertex,m.rightVertex===r?.endingVertexInclusive){u=!0;break}if(m=m.rightVertex.rightSegment,m?.leftVertex===f)break}let h=p.at(-1),g=d.getFirstVertex(),_=d.getLastVertex();i&&d.autoClose&&h&&n===_&&f===g&&(p.length>2||p.length===2&&!s(h))&&f?.pos&&!e(o(h),f.pos)&&p.push([...f.pos]),a.push(p)}return{parts:a,hasCurves:c}}function T(t,n,r,i){let a=n.spatialReference,s=t.coordinateHelper,{rings:c,curveRings:l}=n,u=l&&i?l:c;for(let n=0;n<u.length;++n){let i=u[n],c=new y(a,r);if(c.index=n,t.parts.push(c),i.length<1)continue;let l=null,d=null;for(let e=0;e<i.length-1;++e)d=x(c,s,d,i[e]),l??=d;i.length>1&&e(o(i[i.length-1]),l?.pos)?d&&l&&c.segments.push(S(c,d,l,i[i.length-1])):d=x(c,s,d,i[i.length-1])}}function E(e,t,n,r){let i=t.spatialReference,a=e.coordinateHelper,{curvePaths:o,paths:s}=t,c=o&&r?o:s;for(let t=0;t<c.length;++t){let r=c[t],o=new y(i,n);if(o.index=t,e.parts.push(o),r.length<1)continue;let s=null;for(let e=0;e<r.length;++e)s=x(o,a,s,r[e])}}function D(e,t,n){let r=t.spatialReference,i=e.coordinateHelper,a=new y(r,n);a.index=0;let o=new p(a);o.index=0,o.pos=i.pointToVector(t),a.vertices.push(o),e.parts.push(a)}function O(e,t,n){let r=t.spatialReference,{coordinateHelper:i,parts:a}=e,o=t.points.map(e=>i.arrayToVector(e));for(let e=0;e<o.length;e++){let t=new y(r,n);t.index=e,a.push(t);let i=new p(t);i.pos=o[e],i.index=0,t.vertices.push(i)}}function k(e){return e.type===`mesh`}function A(e,t){if(e.type!==t.type||e.parts.length!==t.parts.length)return!1;for(let n=0;n<e.parts.length;n++){let r=e.parts[n],i=t.parts[n];if(r.vertices.length!==i.vertices.length)return!1}let n=e.allVertices,r=t.allVertices;for(let e=0;e<n.length;e++)if(n[e].leftSegment?.type!==r[e].leftSegment?.type)return!1;return!0}export{h as BezierSegment,g as CircularArcSegment,b as EditGeometry,_ as EllipticArc4Segment,v as EllipticArc7Segment,m as LineSegment,y as Part,p as Vertex,x as addVertexAndConnectingSegment,S as createConnectingSegment,A as haveCompatibleTopologies,k as isMeshEditGeometry,C as partialCoordsToGeometry,w as toPartialCoords};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{Evented as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import{clone as n}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isMeshEditGeometry as r,Part as i,EditGeometry as a,haveCompatibleTopologies as o}from"./EditGeometry.js";import{AppendVertex as s}from"./operations/AppendVertex.js";import{UpdateVertices as c}from"./operations/UpdateVertices.js";import{RemoveVertices as l}from"./operations/RemoveVertices.js";import{SplitSegment as u}from"./operations/SplitSegment.js";import{SetVertexPosition as d}from"./operations/SetVertexPosition.js";import{ClosePart as f}from"./operations/ClosePart.js";import{AddOrUpdatePart as p}from"./operations/AddOrUpdatePart.js";import{MoveMesh as m}from"./operations/MoveMesh.js";import{MoveVertex as h}from"./operations/MoveVertex.js";import{OffsetEdgeVertex as g}from"./operations/OffsetEdgeVertex.js";import{RotateVertex as _}from"./operations/RotateVertex.js";import{ScaleVertex as v}from"./operations/ScaleVertex.js";import{SetAllVertexPositions as y}from"./operations/SetAllVertexPositions.js";import{UndoGroup as b}from"./operations/UndoGroup.js";class x extends e{constructor(e,t,n=!1){super(),this.data=e,this.viewingMode=t,this.allowCurves=n,this._undoStack=[],this._redoStack=[],this.disableDefaultRedoBehavior=!1,this._listener=this.data.on(`change`,e=>{e.addedVertices&&this.emit(`vertex-add`,{type:`vertex-add`,vertices:e.addedVertices,operation:e.operation}),e.removedVertices&&this.emit(`vertex-remove`,{type:`vertex-remove`,vertices:e.removedVertices,operation:e.operation}),e.updatedVertices&&this.emit(`vertex-update`,{type:`vertex-update`,vertices:e.updatedVertices,operation:e.operation})})}destroy(){super.destroy(),this._listener.remove()}splitSegment(e,t){return this._apply(new u(this.data,e,t))}updateVertices(e,t,n=1){return this._apply(new c(this.data,e,t),n)}move(e,t,n,i=1){return r(this.data)?this._apply(new m(this.data,e,t,n),i):this.moveVertices(this.data.allVerticesUnordered,e,t,n,i)}moveVertices(e,t,n,i,a=1){return r(this.data)?this._apply(new m(this.data,t,n,i),a):this.updateVertices(e,new h(this.data.coordinateHelper,t,n,i),a)}scale(e,t,n,r,i=1,a=0){return this.scaleVertices(this.data.allVerticesUnordered,e,t,n,r,i,a)}scaleVertices(e,t,n,r,i,a=1,o=0){return this.updateVertices(e,new v(t,n,r,i,o),a)}rotate(e,t,n=1,r=0){return this.rotateVertices(this.data.allVerticesUnordered,e,t,n,r)}rotateVertices(e,t,n,r=1,i=0){return this.updateVertices(e,new _(t,n,i),r)}removeVertices(e){return this._apply(new l(this.data,e,this._minNumVerticesPerType))}appendVertex(e,t,n){return t??=new i(this.data.spatialReference,this.viewingMode,n),this._apply(new s(this.data,t,e))}appendVertexToFirstPart(e){let t=this.data.parts.at(0);return t?this._apply(new s(this.data,t,e)):null}addOrUpdatePart(e,t){return this._apply(new p(this.data,e,t,this.viewingMode))}setVertexPosition(e,t){return this._apply(new d(this.data,e,t))}offsetEdge(e,t,n,r=1){return this.updateVertices([t.leftVertex,t.rightVertex],new g(this.data.coordinateHelper,e,t,n),r)}trySetGeometry(e,t=1){let{data:n}=this,{coordinateHelper:i}=n;if(n.type!==e.type||!n.spatialReference.equals(e.spatialReference)||i.hasZ()!==e.hasZ||i.hasM()!==e.hasM||r(n))return;let s=a.fromGeometry(e,this.viewingMode,{allowCurves:this.allowCurves});if(o(n,s))return this.overwriteGeometryDataInPlace(s,t)}overwriteGeometryDataInPlace(e,t=1){return this._apply(new y(this.data,e),t)}createResetState(){if(r(this.data))return this._createResetStateMesh();let e=this.data.geometry.clone();return t(()=>this.trySetGeometry(e))}closePart(e){return this.data.parts.includes(e)?this._apply(new f(this.data,e)):null}canRemoveVertex(e){return e.vertices.length>this._minNumVerticesPerType}createUndoGroup(){let e=new b;return this._apply(e),t(()=>e.close())}groupOperations(e){let t=[],{_undoStack:n}=this;for(;n.length>0;){let r=n.at(-1);if(!r||!e(r))break;n.pop(),t.push(r)}if(t.length>0){let e=new b(t.reverse());return this.recordUndo(e,!0),{group:e,operations:t}}return null}recordUndo(e,t){let n=this.canUndo;this._undoStack.push(e),t&&this.resetRedoStack(),this.emit(`can-redo-change`,{type:`can-redo-change`,canRedo:this.canRedo}),n!==this.canUndo&&this.emit(`can-undo-change`,{type:`can-undo-change`,canUndo:this.canUndo})}recordRedo(e){if(this.disableDefaultRedoBehavior)return;let t=this.canRedo;this._redoStack.push(e),t||this.emit(`can-redo-change`,{type:`can-redo-change`,canRedo:!0})}undo(){if(this._undoStack.length>0){let e=this.canUndo,t=this._undoStack.pop();return t.undo(),this.recordRedo(t),e!==this.canUndo&&this.emit(`can-undo-change`,{type:`can-undo-change`,canUndo:this.canUndo}),t}return null}redo(){if(this._redoStack.length>0){let e=this._redoStack.pop();return e.apply(),this.recordUndo(e,!1),e}return null}resetRedoStack(){this.disableDefaultRedoBehavior||(this._redoStack=[],this.emit(`redo-reset`,{type:`redo-reset`}))}undoHas(e){return this._undoStack.includes(e)}get canUndo(){return this._undoStack.length>0}get canRedo(){return this._redoStack.length>0}get lastOperation(){return this._undoStack.length>0?this._undoStack[this._undoStack.length-1]:null}get nextOperation(){return this._redoStack.length>0?this._redoStack[this._redoStack.length-1]:null}get test(){return{undoLength:this._undoStack.length,redoLength:this._redoStack.length}}get _minNumVerticesPerType(){switch(this.data.type){case`point`:return 1;case`polyline`:return 2;case`polygon`:return 3;default:return 0}}_apply(e,t=1){return t!==0&&this.lastOperation?.accumulate(e)||(e.apply(),this.recordUndo(e,!0)),e}_createResetStateMesh(){if(!r(this.data))return t();let e=this.data.geometry,{vertexSpace:i}=e;if(i.origin){let r=n(i.origin);return t(()=>{e.vertexSpace.origin=r})}let a=e.vertexAttributes.clonePositional();return t(()=>{e.vertexAttributes=a,e.vertexAttributesChanged()})}static fromGeometry(e,t,n){return new x(a.fromGeometry(e,t,n),t,n?.allowCurves)}}export{x as EditGeometryOperations};
2
+ import{Evented as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import{clone as n}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isMeshEditGeometry as r,Part as i,EditGeometry as a,haveCompatibleTopologies as o}from"./EditGeometry.js";import{AppendVertex as s}from"./operations/AppendVertex.js";import{UpdateVertices as c}from"./operations/UpdateVertices.js";import{RemoveVertices as l}from"./operations/RemoveVertices.js";import{SplitSegment as u}from"./operations/SplitSegment.js";import{SetVertexPosition as d}from"./operations/SetVertexPosition.js";import{ClosePart as f}from"./operations/ClosePart.js";import{AddOrUpdatePart as p}from"./operations/AddOrUpdatePart.js";import{MoveMesh as m}from"./operations/MoveMesh.js";import{MoveVertex as h}from"./operations/MoveVertex.js";import{OffsetEdgeVertex as g}from"./operations/OffsetEdgeVertex.js";import{RotateVertex as _}from"./operations/RotateVertex.js";import{ScaleVertex as v}from"./operations/ScaleVertex.js";import{SetAllVertexPositions as y}from"./operations/SetAllVertexPositions.js";import{UndoGroup as b}from"./operations/UndoGroup.js";class x extends e{constructor(e,t,n=!1){super(),this.data=e,this.isGlobal=t,this.allowCurves=n,this._undoStack=[],this._redoStack=[],this.disableDefaultRedoBehavior=!1,this._listener=this.data.on(`change`,e=>{e.addedVertices&&this.emit(`vertex-add`,{type:`vertex-add`,vertices:e.addedVertices,operation:e.operation}),e.removedVertices&&this.emit(`vertex-remove`,{type:`vertex-remove`,vertices:e.removedVertices,operation:e.operation}),e.updatedVertices&&this.emit(`vertex-update`,{type:`vertex-update`,vertices:e.updatedVertices,operation:e.operation})})}destroy(){super.destroy(),this._listener.remove()}splitSegment(e,t){return this._apply(new u(this.data,e,t))}updateVertices(e,t,n=1){return this._apply(new c(this.data,e,t),n)}move(e,t,n,i=1){return r(this.data)?this._apply(new m(this.data,e,t,n),i):this.moveVertices(this.data.allVerticesUnordered,e,t,n,i)}moveVertices(e,t,n,i,a=1){return r(this.data)?this._apply(new m(this.data,t,n,i),a):this.updateVertices(e,new h(this.data.coordinateHelper,t,n,i),a)}scale(e,t,n,r,i=1,a=0){return this.scaleVertices(this.data.allVerticesUnordered,e,t,n,r,i,a)}scaleVertices(e,t,n,r,i,a=1,o=0){return this.updateVertices(e,new v(t,n,r,i,o),a)}rotate(e,t,n=1,r=0){return this.rotateVertices(this.data.allVerticesUnordered,e,t,n,r)}rotateVertices(e,t,n,r=1,i=0){return this.updateVertices(e,new _(t,n,i),r)}removeVertices(e){return this._apply(new l(this.data,e,this._minNumVerticesPerType))}appendVertex(e,t,n){return t??=new i(this.data.spatialReference,this.isGlobal,n),this._apply(new s(this.data,t,e))}appendVertexToFirstPart(e){let t=this.data.parts.at(0);return t?this._apply(new s(this.data,t,e)):null}addOrUpdatePart(e,t){return this._apply(new p(this.data,e,t,this.isGlobal))}setVertexPosition(e,t){return this._apply(new d(this.data,e,t))}offsetEdge(e,t,n,r=1){return this.updateVertices([t.leftVertex,t.rightVertex],new g(this.data.coordinateHelper,e,t,n),r)}trySetGeometry(e,t=1){let{data:n}=this,{coordinateHelper:i}=n;if(n.type!==e.type||!n.spatialReference.equals(e.spatialReference)||i.hasZ()!==e.hasZ||i.hasM()!==e.hasM||r(n))return;let s=a.fromGeometry(e,this.isGlobal,{allowCurves:this.allowCurves});if(o(n,s))return this.overwriteGeometryDataInPlace(s,t)}overwriteGeometryDataInPlace(e,t=1){return this._apply(new y(this.data,e),t)}createResetState(){if(r(this.data))return this._createResetStateMesh();let e=this.data.geometry.clone();return t(()=>this.trySetGeometry(e))}closePart(e){return this.data.parts.includes(e)?this._apply(new f(this.data,e)):null}canRemoveVertex(e){return e.vertices.length>this._minNumVerticesPerType}createUndoGroup(){let e=new b;return this._apply(e),t(()=>e.close())}groupOperations(e){let t=[],{_undoStack:n}=this;for(;n.length>0;){let r=n.at(-1);if(!r||!e(r))break;n.pop(),t.push(r)}if(t.length>0){let e=new b(t.reverse());return this.recordUndo(e,!0),{group:e,operations:t}}return null}recordUndo(e,t){let n=this.canUndo;this._undoStack.push(e),t&&this.resetRedoStack(),this.emit(`can-redo-change`,{type:`can-redo-change`,canRedo:this.canRedo}),n!==this.canUndo&&this.emit(`can-undo-change`,{type:`can-undo-change`,canUndo:this.canUndo})}recordRedo(e){if(this.disableDefaultRedoBehavior)return;let t=this.canRedo;this._redoStack.push(e),t||this.emit(`can-redo-change`,{type:`can-redo-change`,canRedo:!0})}undo(){if(this._undoStack.length>0){let e=this.canUndo,t=this._undoStack.pop();return t.undo(),this.recordRedo(t),e!==this.canUndo&&this.emit(`can-undo-change`,{type:`can-undo-change`,canUndo:this.canUndo}),t}return null}redo(){if(this._redoStack.length>0){let e=this._redoStack.pop();return e.apply(),this.recordUndo(e,!1),e}return null}resetRedoStack(){this.disableDefaultRedoBehavior||(this._redoStack=[],this.emit(`redo-reset`,{type:`redo-reset`}))}undoHas(e){return this._undoStack.includes(e)}get canUndo(){return this._undoStack.length>0}get canRedo(){return this._redoStack.length>0}get lastOperation(){return this._undoStack.length>0?this._undoStack[this._undoStack.length-1]:null}get nextOperation(){return this._redoStack.length>0?this._redoStack[this._redoStack.length-1]:null}get test(){return{undoLength:this._undoStack.length,redoLength:this._redoStack.length}}get _minNumVerticesPerType(){switch(this.data.type){case`point`:return 1;case`polyline`:return 2;case`polygon`:return 3;default:return 0}}_apply(e,t=1){return t!==0&&this.lastOperation?.accumulate(e)||(e.apply(),this.recordUndo(e,!0)),e}_createResetStateMesh(){if(!r(this.data))return t();let e=this.data.geometry,{vertexSpace:i}=e;if(i.origin){let r=n(i.origin);return t(()=>{e.vertexSpace.origin=r})}let a=e.vertexAttributes.clonePositional();return t(()=>{e.vertexAttributes=a,e.vertexAttributesChanged()})}static fromGeometry(e,t,n){return new x(a.fromGeometry(e,t,n),t,n?.allowCurves)}}export{x as EditGeometryOperations};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{toPartialCoords as e,Part as t,addVertexAndConnectingSegment as n}from"../EditGeometry.js";class r{constructor(e,t,n,r){this._editGeometry=e,this._positions=t,this._part=n,this._viewingMode=r,this._addedPart=null,this._originalPositions=null,this._hasApplied=!1}get part(){return this._addedPart}apply(){let r=this._editGeometry,i=r.parts,a=this._part;if(!this._hasApplied&&a&&i.includes(a)){let t=a.getFirstVertex(),n=a.getLastVertex();this._originalPositions=e(r,{startingVertex:t,endingVertexInclusive:n}).parts[0]}let o=this._addedPart??this._part??(this._addedPart=new t(r.spatialReference,this._viewingMode,r.type===`polygon`));i.includes(o)||(i.push(o),o.index=i.length-1);let s=o.vertices.slice(),c=[];o.segments.length=0,o.vertices.length=0;let l=null;for(let e of this._positions)l=n(o,r.coordinateHelper,l,e),c.push(l);this._hasApplied=!0,r.notifyChanges({operation:this._hasApplied?`redo`:`apply`,addedVertices:c,removedVertices:s,addedParts:this._addedPart?[this._addedPart]:void 0})}undo(){if(!this._hasApplied)return;let{_editGeometry:e,_addedPart:t}=this;if(t){let n=e.parts.indexOf(t);if(n!==-1){e.parts.splice(n,1),e.notifyChanges({operation:`undo`,removedVertices:t.vertices.slice(),removedParts:[t]});return}}let r=this._part;if(!r||!e.parts.includes(r)||!this._originalPositions)return;let i=Array.from(r.iterateVertices()),a=[];r.vertices.length=0,r.segments.length=0;let o=null;for(let t of this._positions)o=n(r,e.coordinateHelper,o,t),a.push(o);e.notifyChanges({operation:`undo`,addedVertices:a,removedVertices:i})}accumulate(e){return e instanceof r&&e._part!=null&&(e._part===this._addedPart||e._part===this._part)&&(this._positions=e._positions,this.apply(),!0)}}export{r as AddOrUpdatePart};
2
+ import{toPartialCoords as e,Part as t,addVertexAndConnectingSegment as n}from"../EditGeometry.js";class r{constructor(e,t,n,r){this._editGeometry=e,this._positions=t,this._part=n,this._isGlobal=r,this._addedPart=null,this._originalPositions=null,this._hasApplied=!1}get part(){return this._addedPart}apply(){let r=this._editGeometry,i=r.parts,a=this._part;if(!this._hasApplied&&a&&i.includes(a)){let t=a.getFirstVertex(),n=a.getLastVertex();this._originalPositions=e(r,{startingVertex:t,endingVertexInclusive:n}).parts[0]}let o=this._addedPart??this._part??(this._addedPart=new t(r.spatialReference,this._isGlobal,r.type===`polygon`));i.includes(o)||(i.push(o),o.index=i.length-1);let s=o.vertices.slice(),c=[];o.segments.length=0,o.vertices.length=0;let l=null;for(let e of this._positions)l=n(o,r.coordinateHelper,l,e),c.push(l);this._hasApplied=!0,r.notifyChanges({operation:this._hasApplied?`redo`:`apply`,addedVertices:c,removedVertices:s,addedParts:this._addedPart?[this._addedPart]:void 0})}undo(){if(!this._hasApplied)return;let{_editGeometry:e,_addedPart:t}=this;if(t){let n=e.parts.indexOf(t);if(n!==-1){e.parts.splice(n,1),e.notifyChanges({operation:`undo`,removedVertices:t.vertices.slice(),removedParts:[t]});return}}let r=this._part;if(!r||!e.parts.includes(r)||!this._originalPositions)return;let i=Array.from(r.iterateVertices()),a=[];r.vertices.length=0,r.segments.length=0;let o=null;for(let t of this._positions)o=n(r,e.coordinateHelper,o,t),a.push(o);e.notifyChanges({operation:`undo`,addedVertices:a,removedVertices:i})}accumulate(e){return e instanceof r&&e._part!=null&&(e._part===this._addedPart||e._part===this._part)&&(this._positions=e._positions,this.apply(),!0)}}export{r as AddOrUpdatePart};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../core/Logger.js";import{equals as t,isGeographic as n,isWebMercator as r,isWGS84 as i}from"../../../geometry/support/spatialReferenceUtils.js";import{getGlbFormatId as a}from"../../../layers/support/infoFor3D.js";const o=`esri.views.layers.support.editableLayerViews`;function s(s,c){let{associatedLayer:l}=s,u=l?.infoFor3D;if(!u)return!1;let d=a(u);if(!(d!=null&&u.queryFormats.includes(d)))return e.getLogger(o).warnOnce(`SceneLayer (${s.title??`Untitled layer`}, ${s.id}) does not support geometry edits because it does not support GLB queries.`),!1;let f=s.spatialReference,p=l.spatialReference;if(!t(f,p))return e.getLogger(o).warnOnce(`SceneLayer (${s.title??`Untitled layer`}, ${s.id}) does not support geometry edits because its spatial reference (wkid:${f.wkid}) is different from its associated FeatureLayer's spatial reference (wkid:${p.wkid}).`),!1;let m=l.sourceJSON?.sourceSpatialReference;if(!(m==null||t(m,p)))return e.getLogger(o).warnOnce(`SceneLayer (${s.title??`Untitled layer`}, ${s.id}) does not support geometry edits because the spatial reference of its associated FeatureLayer's service (wkid:${p.wkid}) is different from its source spatial reference (wkid:${m.wkid}).`),!1;let{view:h}=c;if(c.destroyed||h==null)return!1;let g=h.spatialReference,{viewingMode:_}=h.state,v=n(f),y=_===1;return v&&!y?(e.getLogger(o).warnOnce(`SceneLayer (${s.title??`Untitled layer`}, ${s.id}) does not support geometry edits in local viewing mode because its spatial reference (wkid:${f.wkid}) is geographic. Please consider changing the viewing mode to global.`),!1):!v&&y?(e.getLogger(o).warnOnce(`SceneLayer (${s.title??`Untitled layer`}, ${s.id}) does not support geometry edits in global viewing mode because its spatial reference (wkid:${f.wkid}) is projected. Please consider changing the viewing mode to local.`),!1):t(f,g)||y&&r(g)&&i(f)?!0:(e.getLogger(o).warnOnce(`SceneLayer (${s.title??`Untitled layer`}, ${s.id}) does not support geometry edits because its spatial reference (wkid:${f.wkid}) does not match the view spatial reference (wkid:${g.wkid}).`),!1)}export{s as isGeometryEditableSceneLayer};
2
+ import e from"../../../core/Logger.js";import{equals as t,isGeographic as n,isWebMercator as r,isWGS84 as i}from"../../../geometry/support/spatialReferenceUtils.js";import{getGlbFormatId as a}from"../../../layers/support/infoFor3D.js";const o=`esri.views.layers.support.editableLayerViews`;function s(s,c){let{associatedLayer:l}=s,u=l?.infoFor3D;if(!u)return!1;let d=a(u);if(!(d!=null&&u.queryFormats.includes(d)))return e.getLogger(o).warnOnce(`SceneLayer (${s.title??`Untitled layer`}, ${s.id}) does not support geometry edits because it does not support GLB queries.`),!1;let f=s.spatialReference,p=l.spatialReference;if(!t(f,p))return e.getLogger(o).warnOnce(`SceneLayer (${s.title??`Untitled layer`}, ${s.id}) does not support geometry edits because its spatial reference (wkid:${f.wkid}) is different from its associated FeatureLayer's spatial reference (wkid:${p.wkid}).`),!1;let m=l.sourceJSON?.sourceSpatialReference;if(!(m==null||t(m,p)))return e.getLogger(o).warnOnce(`SceneLayer (${s.title??`Untitled layer`}, ${s.id}) does not support geometry edits because the spatial reference of its associated FeatureLayer's service (wkid:${p.wkid}) is different from its source spatial reference (wkid:${m.wkid}).`),!1;let{view:h}=c;if(c.destroyed||h==null)return!1;let g=h.spatialReference,{isGlobal:_}=h.state,v=n(f);return v&&!_?(e.getLogger(o).warnOnce(`SceneLayer (${s.title??`Untitled layer`}, ${s.id}) does not support geometry edits in local viewing mode because its spatial reference (wkid:${f.wkid}) is geographic. Please consider changing the viewing mode to global.`),!1):!v&&_?(e.getLogger(o).warnOnce(`SceneLayer (${s.title??`Untitled layer`}, ${s.id}) does not support geometry edits in global viewing mode because its spatial reference (wkid:${f.wkid}) is projected. Please consider changing the viewing mode to local.`),!1):t(f,g)||_&&r(g)&&i(f)?!0:(e.getLogger(o).warnOnce(`SceneLayer (${s.title??`Untitled layer`}, ${s.id}) does not support geometry edits because its spatial reference (wkid:${f.wkid}) does not match the view spatial reference (wkid:${g.wkid}).`),!1)}export{s as isGeometryEditableSceneLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../chunks/projector.js";import{h as t}from"../../chunks/h.js";import n from"../../Color.js";import r from"../../core/Accessor.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";const o={bottom:`esri-text-overlay-item-anchor-bottom`,"bottom-right":`esri-text-overlay-item-anchor-bottom-right`,"bottom-left":`esri-text-overlay-item-anchor-bottom-left`,top:`esri-text-overlay-item-anchor-top`,"top-right":`esri-text-overlay-item-anchor-top-right`,"top-left":`esri-text-overlay-item-anchor-top-left`,center:`esri-text-overlay-item-anchor-center`,right:`esri-text-overlay-item-anchor-right`,left:`esri-text-overlay-item-anchor-left`};let s=class extends r{get position(){return[this.x,this.y]}set position(e){this._set(`x`,e[0]),this._set(`y`,e[1])}set visible(e){this._visible=e}get visible(){return this._visible&&!!this.text}get _textShadowColor(){let{textColor:e,backgroundColor:t}=this,n=t.clone();return n.a*=e.a,n}get _textShadow(){let e=this._textShadowColor.toCss(!0);return`0 0 ${this._textShadowSize}px ${e}`}get padding(){return .5*this.fontSize}get borderRadius(){return this.padding}set borderRadius(e){this._overrideIfSome(`borderRadius`,e)}constructor(e){super(e),this.x=0,this.y=0,this.text=`-`,this.fontSize=14,this.anchor=`center`,this._visible=!0,this.isDecoration=!0,this.backgroundColor=new n([0,0,0,.6]),this.textColor=new n([255,255,255]),this._textShadowSize=1}render(){return t(`div`,{classes:this._cssClasses(),styles:{left:Math.floor(this.x)+`px`,top:Math.floor(this.y)+`px`,visibility:this.visible?`visible`:`hidden`,fontSize:this.fontSize+`px`,lineHeight:this.fontSize+`px`,backgroundColor:this.backgroundColor.toCss(!0),color:this.textColor.toCss(!0),padding:this.padding+`px`,borderRadius:this.borderRadius+`px`,textShadow:this._textShadow}},[this.text])}renderCanvas(e){if(!this.visible)return;let t=e.font.replace(/^(.*?)px/,``);e.font=`${this.fontSize}px ${t}`;let{padding:n,borderRadius:r}=this,i=e.measureText(this.text).width,a=this.text===``?0:this.fontSize,o=c[this.anchor];e.textAlign=`center`,e.textBaseline=`middle`;let s=i+2*n,l=a+2*n,u=this.x+o.x*s,d=this.y+o.y*l;this._roundedRect(e,u,d,s,l,r),e.fillStyle=this.backgroundColor.toCss(!0),e.fill();let f=this.x+(o.x+.5)*s,p=this.y+(o.y+.5)*l;this._renderTextShadow(e,this.text,f,p),e.fillStyle=this.textColor.toCss(!0),e.fillText(this.text,f,p)}_renderTextShadow(e,t,n,r){e.lineJoin=`miter`,e.fillStyle=`rgba(${this._textShadowColor.r}, ${this._textShadowColor.g}, ${this._textShadowColor.b}, ${1/l.length})`;let i=this._textShadowSize;for(let[a,o]of l)e.fillText(t,n+i*a,r+i*o)}_roundedRect(e,t,n,r,i,a){a=Math.min(a,i/2,r/2),e.beginPath(),e.moveTo(t,n+a),e.arcTo(t,n,t+a,n,a),e.lineTo(t+r-a,n),e.arcTo(t+r,n,t+r,n+a,a),e.lineTo(t+r,n+i-a),e.arcTo(t+r,n+i,t+r-a,n+i,a),e.lineTo(t+a,n+i),e.arcTo(t,n+i,t,n+i-a,a),e.closePath()}_cssClasses(){let e={"esri-text-overlay-item":!0},t;for(t in o)e[o[t]]=this.anchor===t;return e}};e([i()],s.prototype,`x`,void 0),e([i()],s.prototype,`y`,void 0),e([i()],s.prototype,`position`,null),e([i()],s.prototype,`text`,void 0),e([i()],s.prototype,`fontSize`,void 0),e([i()],s.prototype,`anchor`,void 0),e([i()],s.prototype,`_visible`,void 0),e([i()],s.prototype,`visible`,null),e([i()],s.prototype,`isDecoration`,void 0),e([i()],s.prototype,`backgroundColor`,void 0),e([i()],s.prototype,`textColor`,void 0),e([i()],s.prototype,`_textShadowSize`,void 0),e([i()],s.prototype,`_textShadowColor`,null),e([i()],s.prototype,`_textShadow`,null),e([i()],s.prototype,`padding`,null),e([i()],s.prototype,`borderRadius`,null),s=e([a(`esri.views.overlay.TextOverlayItem`)],s);const c={bottom:{x:-.5,y:-1,textAlign:`center`,textBaseline:`bottom`},"bottom-left":{x:0,y:-1,textAlign:`left`,textBaseline:`bottom`},"bottom-right":{x:-1,y:-1,textAlign:`right`,textBaseline:`bottom`},center:{x:-.5,y:-.5,textAlign:`center`,textBaseline:`middle`},left:{x:0,y:-.5,textAlign:`left`,textBaseline:`middle`},right:{x:-1,y:-.5,textAlign:`right`,textBaseline:`middle`},top:{x:-.5,y:0,textAlign:`center`,textBaseline:`top`},"top-left":{x:0,y:0,textAlign:`left`,textBaseline:`top`},"top-right":{x:-1,y:0,textAlign:`right`,textBaseline:`top`}},l=[];for(let e=0;e<360;e+=360/16)l.push([Math.cos(Math.PI*e/180),Math.sin(Math.PI*e/180)]);export{s as default};
2
+ import{__decorate as e}from"tslib";import"../../chunks/projector.js";import{h as t}from"../../chunks/h.js";import n from"../../Color.js";import r from"../../core/Accessor.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";const o={bottom:`esri-text-overlay-item-anchor-bottom`,"bottom-right":`esri-text-overlay-item-anchor-bottom-right`,"bottom-left":`esri-text-overlay-item-anchor-bottom-left`,top:`esri-text-overlay-item-anchor-top`,"top-right":`esri-text-overlay-item-anchor-top-right`,"top-left":`esri-text-overlay-item-anchor-top-left`,center:`esri-text-overlay-item-anchor-center`,right:`esri-text-overlay-item-anchor-right`,left:`esri-text-overlay-item-anchor-left`};let s=class extends r{get position(){return[this.x,this.y]}set position(e){this._set(`x`,e[0]),this._set(`y`,e[1])}set visible(e){this._visible=e}get visible(){return this._visible&&!!this.text}get _textShadowColor(){let{textColor:e,backgroundColor:t}=this,n=t.clone();return n.a*=e.a,n}get _textShadow(){let e=this._textShadowColor.toCss(!0);return`0 0 ${this._textShadowSize}px ${e}`}get padding(){return .5*this.fontSize}get borderRadius(){return this.padding}set borderRadius(e){this._overrideIfSome(`borderRadius`,e)}constructor(e){super(e),this.x=0,this.y=0,this.text=`-`,this.fontSize=14,this.anchor=`center`,this._visible=!0,this.isDecoration=!0,this.backgroundColor=new n([0,0,0,.6]),this.textColor=new n([255,255,255]),this._textShadowSize=1}render(){return t(`div`,{classes:this._cssClasses(),styles:{left:Math.floor(this.x)+`px`,top:Math.floor(this.y)+`px`,visibility:this.visible?`visible`:`hidden`,fontSize:this.fontSize+`px`,lineHeight:this.fontSize+`px`,backgroundColor:this.backgroundColor.toCss(!0),color:this.textColor.toCss(!0),padding:this.padding+`px`,borderRadius:this.borderRadius+`px`,textShadow:this._textShadow}},[this.text])}renderCanvas(e){if(!this.visible)return;let t=e.font.replace(/^(.*?)px/,``);e.font=`${this.fontSize}px ${t}`;let{padding:n,borderRadius:r}=this,i=e.measureText(this.text).width,a=this.text===``?0:this.fontSize,o=c[this.anchor];e.textAlign=`center`,e.textBaseline=`middle`;let s=i+2*n,l=a+2*n,u=this.x+o.x*s,d=this.y+o.y*l;this._roundedRect(e,u,d,s,l,r),e.fillStyle=this.backgroundColor.toCss(!0),e.fill();let f=this.x+(o.x+.5)*s,p=this.y+(o.y+.5)*l;this._renderTextShadow(e,this.text,f,p),e.fillStyle=this.textColor.toCss(!0),e.fillText(this.text,f,p)}_renderTextShadow(e,t,n,r){e.lineJoin=`miter`,e.fillStyle=`rgba(${this._textShadowColor.r}, ${this._textShadowColor.g}, ${this._textShadowColor.b}, ${1/l.length})`;let i=this._textShadowSize;for(let[a,o]of l)e.fillText(t,n+i*a,r+i*o)}_roundedRect(e,t,n,r,i,a){a=Math.min(a,i/2,r/2),e.beginPath(),e.moveTo(t,n+a),e.arcTo(t,n,t+a,n,a),e.lineTo(t+r-a,n),e.arcTo(t+r,n,t+r,n+a,a),e.lineTo(t+r,n+i-a),e.arcTo(t+r,n+i,t+r-a,n+i,a),e.lineTo(t+a,n+i),e.arcTo(t,n+i,t,n+i-a,a),e.closePath()}_cssClasses(){let e={"esri-text-overlay-item":!0},t;for(t in o)e[o[t]]=this.anchor===t;return e}};e([i()],s.prototype,`x`,void 0),e([i()],s.prototype,`y`,void 0),e([i()],s.prototype,`position`,null),e([i()],s.prototype,`text`,void 0),e([i()],s.prototype,`fontSize`,void 0),e([i()],s.prototype,`anchor`,void 0),e([i()],s.prototype,`_visible`,void 0),e([i()],s.prototype,`visible`,null),e([i()],s.prototype,`isDecoration`,void 0),e([i()],s.prototype,`backgroundColor`,void 0),e([i()],s.prototype,`textColor`,void 0),e([i()],s.prototype,`_textShadowSize`,void 0),e([i()],s.prototype,`_textShadowColor`,null),e([i()],s.prototype,`_textShadow`,null),e([i()],s.prototype,`padding`,null),e([i()],s.prototype,`borderRadius`,null),s=e([a(`esri.views.overlay.TextOverlayItem`)],s);const c={bottom:{x:-.5,y:-1,textAlign:`center`,textBaseline:`bottom`},"bottom-left":{x:0,y:-1,textAlign:`left`,textBaseline:`bottom`},"bottom-right":{x:-1,y:-1,textAlign:`right`,textBaseline:`bottom`},center:{x:-.5,y:-.5,textAlign:`center`,textBaseline:`middle`},left:{x:0,y:-.5,textAlign:`left`,textBaseline:`middle`},right:{x:-1,y:-.5,textAlign:`right`,textBaseline:`middle`},top:{x:-.5,y:0,textAlign:`center`,textBaseline:`top`},"top-left":{x:0,y:0,textAlign:`left`,textBaseline:`top`},"top-right":{x:-1,y:0,textAlign:`right`,textBaseline:`top`}},l=[];for(let e=0;e<360;e+=22.5)l.push([Math.cos(Math.PI*e/180),Math.sin(Math.PI*e/180)]);export{s as default};