@arcgis/core 6.0.0-next.15 → 6.0.0-next.16

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 (337) hide show
  1. package/analysis/LineOfSightAnalysis.d.ts +49 -32
  2. package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
  3. package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
  4. package/analysis/Viewshed.d.ts +23 -3
  5. package/analysis/ViewshedAnalysis.d.ts +33 -13
  6. package/arcade/geometry/operatorsWorkerConnection.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/00d66e3fba5ab4d2aa3c.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
  10. package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +1 -0
  11. package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
  12. package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 1b1d3f6916d2cb751435.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{ed6e9d7f71bfd2691717.js → 1c77de1e79860f8d2228.js} +1 -1
  14. package/assets/esri/core/workers/chunks/1e40a26dcce4d1dadc28.js +1 -0
  15. package/assets/esri/core/workers/chunks/237a1f68a0efbfe5b77c.js +1 -0
  16. package/assets/esri/core/workers/chunks/23c43f09c4a4749516e1.js +1 -0
  17. package/assets/esri/core/workers/chunks/{3418877328f4f0830300.js → 24dac4970526a4e0ae63.js} +1 -1
  18. package/assets/esri/core/workers/chunks/26ceb0ff8d93dbb9b84f.js +1 -0
  19. package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +1 -0
  20. package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{4df6cb1bee5d0720a43e.js → 36cbd614454581aaf334.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{1e0d2715d603f48a7e0b.js → 370aad23df597db80d65.js} +1 -1
  23. package/assets/esri/core/workers/chunks/3baa4a9c52f41bfd6abb.js +1 -0
  24. package/assets/esri/core/workers/chunks/42d44c7d532df5ee70e9.js +1 -0
  25. package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +1 -0
  26. package/assets/esri/core/workers/chunks/{6400446b7615b97c3521.js → 45f826554499c38968c6.js} +1 -1
  27. package/assets/esri/core/workers/chunks/48cc58890fddbcf69cef.js +1 -0
  28. package/assets/esri/core/workers/chunks/494bd434fee9032e1d02.js +1 -0
  29. package/assets/esri/core/workers/chunks/{33e4ff228a8c81b99022.js → 4abd3753cd9b80e4d937.js} +1 -1
  30. package/assets/esri/core/workers/chunks/4bbe1f28f5f16a6bef05.js +1 -0
  31. package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
  32. package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
  33. package/assets/esri/core/workers/chunks/5529831dd891382c79df.js +1 -0
  34. package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +1 -0
  35. package/assets/esri/core/workers/chunks/5acb422fe3cf693d9d4f.js +1 -0
  36. package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
  37. package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +1 -0
  38. package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +1 -0
  39. package/assets/esri/core/workers/chunks/{89e76de5ae3328d821a4.js → 69f6d5997b8ff1326e39.js} +1 -1
  40. package/assets/esri/core/workers/chunks/6a8dd8b18b0b825b0c1b.js +1 -0
  41. package/assets/esri/core/workers/chunks/{a40b6d8b5c73e06e14d4.js → 6c255c029d67423e4dac.js} +1 -1
  42. package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
  43. package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{3ffda5bf0b91700dc308.js → 78643f116677950ea29a.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
  46. package/assets/esri/core/workers/chunks/7b5f3c79e0605c32b267.js +1 -0
  47. package/assets/esri/core/workers/chunks/7bbfe9ff352afc566367.js +1 -0
  48. package/assets/esri/core/workers/chunks/{ac5a6603f7fa78d3e4c8.js → 7e8611cb709f105946f5.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{05cd33d41d91f8d09633.js → 7fb7493f483cd9878bfa.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{601e1d020b8115497944.js → 8a485130781b49dbf608.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{0ccab50877b24f862d6e.js → 8ac2098ecdc40ad41055.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{a655ebdb4bf0660615a2.js → 8b4e9fd88c0c313416d4.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{4e544de61f07ca660236.js → 8c12269d26f5a4c753cb.js} +1 -1
  55. package/assets/esri/core/workers/chunks/91dd65cf877c8f2e01a7.js +1 -0
  56. package/assets/esri/core/workers/chunks/{46b4fb6a7fe4877b0efc.js → 94baa354e50c03b82b25.js} +2 -2
  57. package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
  58. package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
  59. package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +1 -0
  60. package/assets/esri/core/workers/chunks/9b051745d24d1f43480b.js +1 -0
  61. package/assets/esri/core/workers/chunks/9d61740ef8bdcc162be1.js +1 -0
  62. package/assets/esri/core/workers/chunks/{eb04e1717a1002cda3ab.js → 9f06ec95bdf0d0b52b41.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{3b3e519f15ed52c83f0c.js → a49fe94933b65b4b64f8.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{1819c45655c836b9a8d7.js → a4d3944700f1cc240176.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{90bdf86f553e2742d67c.js → a7bd5ba4d7d97411fd33.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
  68. package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
  69. package/assets/esri/core/workers/chunks/{b8337492e2b753aefac4.js → ace41659a5ca0e5abfc3.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{3c0ed15b544df6fb0903.js → b48952e1fb4cb7360dd0.js} +1 -1
  71. package/assets/esri/core/workers/chunks/b5e7475cc5fbf31289d3.js +1 -0
  72. package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{0f617980c7dd9ad0444f.js → bf35927979fc5e7e0478.js} +1 -1
  74. package/assets/esri/core/workers/chunks/c4ddac23bd649d24f3f2.js +1 -0
  75. package/assets/esri/core/workers/chunks/{4e6f40cbdb8c508e6df1.js → c5a9e77977e867a75ff2.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{25f19fc929f25ddd628c.js → c79934cd6883307203f8.js} +1 -1
  77. package/assets/esri/core/workers/chunks/cddc3e285f763ccf33c2.js +1 -0
  78. package/assets/esri/core/workers/chunks/d08ff41e2a9bcd58b64a.js +1 -0
  79. package/assets/esri/core/workers/chunks/d311ff96a5a2791d8cfc.js +1 -0
  80. package/assets/esri/core/workers/chunks/d62afb71f4ece4283994.js +1 -0
  81. package/assets/esri/core/workers/chunks/dc1761cba0454fda3cf9.js +1 -0
  82. package/assets/esri/core/workers/chunks/{4ac1d3e49e242e373a92.js → e0650b1408197d3ac862.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{3ff6d1ed3c0f1285f3e7.js → e0d9dc97985561320bd4.js} +1 -1
  84. package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
  85. package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
  86. package/assets/esri/core/workers/chunks/eca44e53bcee9b08d70a.js +1 -0
  87. package/assets/esri/core/workers/chunks/f00458654c7c34c369ef.js +1 -0
  88. package/assets/esri/core/workers/chunks/f3cd610084e3f4d8656b.js +1 -0
  89. package/assets/esri/core/workers/chunks/f47fe4433b05fca5c3ad.js +1 -0
  90. package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +1 -0
  91. package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +1 -0
  92. package/assets/esri/core/workers/chunks/{ae31fd416bbb41a81392.js → f9c5aa0bbf23e780fecc.js} +1 -1
  93. package/assets/esri/core/workers/chunks/f9ff27cfcf0538ac5e26.js +1 -0
  94. package/assets/esri/core/workers/chunks/{19676b2c5f8b0a5ee680.js → facd1ff23203fed67686.js} +1 -1
  95. package/assets/esri/core/workers/chunks/{40a584cb952e94326e9e.js → fcb86d24fc7e0666b564.js} +1 -1
  96. package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
  97. package/chunks/Envelope.js +1 -1
  98. package/chunks/MultiPathImpl.js +1 -1
  99. package/chunks/OperatorGeodeticArea.js +1 -1
  100. package/chunks/OperatorShapePreservingLength.js +1 -1
  101. package/chunks/OperatorShapePreservingProject.js +1 -1
  102. package/chunks/UnitFactory.js +1 -1
  103. package/chunks/basis_encoder.js +1 -1
  104. package/chunks/basis_transcoder.js +1 -1
  105. package/chunks/index.js +1 -1
  106. package/chunks/lclayout.js +1 -1
  107. package/config.d.ts +2 -0
  108. package/config.js +1 -1
  109. package/core/accessorSupport/DefaultsStore.js +1 -1
  110. package/core/accessorSupport/MultiOriginStore.js +1 -1
  111. package/core/accessorSupport/Store.js +1 -1
  112. package/core/accessorSupport/decorators/reader.js +1 -1
  113. package/core/accessorSupport/decorators/writer.js +1 -1
  114. package/core/workers/WorkerOwner.js +1 -1
  115. package/core/workers/workerFactory.js +1 -1
  116. package/core/workers/workers.js +2 -2
  117. package/core/workers.d.ts +9 -0
  118. package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
  119. package/geometry/Mesh.js +1 -1
  120. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  121. package/geometry/operators/gx/operatorOffset.js +1 -1
  122. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  123. package/geometry/operators/support/jsonConverter.js +1 -1
  124. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  125. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  126. package/geometry/support/meshUtils/merge.js +1 -1
  127. package/geometry/support/meshUtils/rotate.js +1 -1
  128. package/geometry/support/polygonExtentClipping.js +1 -1
  129. package/identity/Credential.js +1 -1
  130. package/kernel.js +1 -1
  131. package/layers/AnnotationFeatureLayer.d.ts +2 -2
  132. package/layers/AnnotationFeatureLayer.js +1 -1
  133. package/layers/CatalogLayer.d.ts +2 -2
  134. package/layers/CatalogLayer.js +1 -1
  135. package/layers/DimensionFeatureLayer.d.ts +2 -2
  136. package/layers/DimensionFeatureLayer.js +1 -1
  137. package/layers/FeatureLayer.d.ts +4 -4
  138. package/layers/FeatureLayer.js +1 -1
  139. package/layers/ImageryTileLayer.js +1 -1
  140. package/layers/LineOfSightLayer.d.ts +10 -8
  141. package/layers/SceneLayer.js +1 -1
  142. package/layers/SubtypeGroupLayer.d.ts +2 -2
  143. package/layers/SubtypeGroupLayer.js +1 -1
  144. package/layers/ViewshedLayer.d.ts +1 -1
  145. package/layers/VoxelLayer.js +1 -1
  146. package/layers/WMSLayer.js +1 -1
  147. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  148. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
  149. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  150. package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
  151. package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
  152. package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
  153. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  154. package/layers/graphics/data/QueryEngineResult.js +1 -1
  155. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  156. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  157. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  158. package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
  159. package/layers/mixins/ReloadableLayer.js +2 -0
  160. package/layers/raster/datasets/BaseRaster.js +1 -1
  161. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  162. package/layers/raster/datasets/ImageAuxRaster.js +2 -2
  163. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  164. package/layers/raster/datasets/InMemoryRaster.js +1 -1
  165. package/layers/raster/datasets/MRFRaster.js +1 -1
  166. package/layers/raster/datasets/TIFFRaster.js +1 -1
  167. package/layers/raster/datasets/WCSRaster.js +1 -1
  168. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  169. package/layers/raster/formats/RasterCodec.js +1 -1
  170. package/layers/raster/formats/TiffDecoder.js +1 -1
  171. package/layers/raster/formats/Zlib.js +1 -1
  172. package/layers/raster/functions/stretchUtils.js +1 -1
  173. package/layers/raster/functions/vectorFieldUtils.js +1 -1
  174. package/layers/support/FieldsIndex.js +1 -1
  175. package/layers/support/RasterWorker.js +1 -1
  176. package/layers/support/featureReductionProperties.js +1 -1
  177. package/layers/support/kmlUtils.js +1 -1
  178. package/layers/video/VideoController.js +10 -10
  179. package/libs/maquette/projection.js +1 -1
  180. package/networks/UtilityNetworkTraceAnalysis.js +1 -1
  181. package/package.json +5 -5
  182. package/popup/FeatureModel.js +1 -1
  183. package/popup/FeaturesModel.js +1 -1
  184. package/portal/Portal.js +1 -1
  185. package/request/process.js +1 -1
  186. package/request/types.d.ts +7 -0
  187. package/rest/knowledgeGraphService.js +1 -1
  188. package/rest/networks/trace.js +1 -1
  189. package/rest/query/executeQuery.js +1 -1
  190. package/smartMapping/raster/renderers/shadedRelief.js +1 -1
  191. package/smartMapping/renderers/univariateColorSize.js +1 -1
  192. package/smartMapping/statistics/support/statsWorker.js +1 -1
  193. package/smartMapping/statistics/support/utils.js +1 -1
  194. package/smartMapping/support/clusterUtils.js +1 -1
  195. package/statistics/utils.js +1 -1
  196. package/symbols/cim/CIMCursor.js +1 -1
  197. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  198. package/symbols/cim/cimAnalyzer.js +1 -1
  199. package/symbols/support/ElevationInfo.d.ts +4 -3
  200. package/undoredo/support/Services.js +1 -1
  201. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +2 -2
  202. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  203. package/views/2d/grid/GridView2D.js +1 -1
  204. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  205. package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
  206. package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
  207. package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
  208. package/views/2d/viewpointUtils.js +1 -1
  209. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  210. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  211. package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
  212. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
  213. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  214. package/views/3d/analysis/Viewshed/types.d.ts +7 -0
  215. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
  216. package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
  217. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  218. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  219. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  220. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  221. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  222. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  223. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  224. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  225. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  226. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  227. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  228. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  229. package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
  230. package/views/3d/layers/i3s/I3SNode.js +1 -1
  231. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  232. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  233. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  234. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  235. package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
  236. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  237. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  238. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  239. package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
  240. package/views/3d/support/elevationUpdateUtils.js +1 -1
  241. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  242. package/views/3d/support/sphereExtentUtils.js +2 -0
  243. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  244. package/views/3d/terrain/OverlayRenderer.js +1 -1
  245. package/views/3d/terrain/PatchRenderData.js +1 -1
  246. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  247. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  248. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  249. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  250. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  251. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  252. package/views/SceneView.js +1 -1
  253. package/views/ToolViewManager.js +1 -1
  254. package/views/draw/DrawOperation.js +1 -1
  255. package/views/draw/support/InteractiveHandle.js +1 -1
  256. package/views/draw/support/Reshape.js +1 -1
  257. package/views/draw/support/createUtils.js +1 -1
  258. package/views/draw/support/editingSessionUtils.js +1 -1
  259. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  260. package/views/interactive/SegmentLabels.js +1 -1
  261. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  262. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  263. package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
  264. package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
  265. package/views/interactive/options/TooltipOptions.d.ts +2 -0
  266. package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
  267. package/views/interactive/sketch/constraintUtils.js +1 -1
  268. package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
  269. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  270. package/views/layers/LayerView.js +1 -1
  271. package/views/layers/LineOfSightLayerView.d.ts +35 -13
  272. package/views/layers/SketchLayerView.d.ts +1 -0
  273. package/views/layers/ViewshedLayerView.d.ts +36 -12
  274. package/views/webgl/Program.js +1 -1
  275. package/views/webgl/Texture.js +1 -1
  276. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  277. package/widgets/Directions.js +1 -1
  278. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  279. package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
  280. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  281. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  282. package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
  283. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  284. package/widgets/Print.js +1 -1
  285. package/widgets/Slice.js +1 -1
  286. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  287. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  288. package/widgets/support/SelectionList.js +1 -1
  289. package/widgets/support/componentsUtils.js +1 -1
  290. package/assets/esri/core/workers/chunks/024b44c0c8876627f904.js +0 -1
  291. package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +0 -1
  292. package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
  293. package/assets/esri/core/workers/chunks/0c8c01097847617261b9.js +0 -1
  294. package/assets/esri/core/workers/chunks/0d931c7579b6409a696d.js +0 -1
  295. package/assets/esri/core/workers/chunks/12c154342fff876f2f1e.js +0 -1
  296. package/assets/esri/core/workers/chunks/1e11d2e97d17685b878a.js +0 -1
  297. package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
  298. package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +0 -1
  299. package/assets/esri/core/workers/chunks/2eae542fe7f0f6576ac1.js +0 -1
  300. package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +0 -1
  301. package/assets/esri/core/workers/chunks/46a7da93a63663878583.js +0 -1
  302. package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +0 -1
  303. package/assets/esri/core/workers/chunks/4c4117e28ea358a32088.js +0 -1
  304. package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +0 -1
  305. package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
  306. package/assets/esri/core/workers/chunks/62ac588f7dd1d24d0c9d.js +0 -1
  307. package/assets/esri/core/workers/chunks/62c8c9ad09e0166207fd.js +0 -1
  308. package/assets/esri/core/workers/chunks/62d6e101e9bd9557a410.js +0 -1
  309. package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
  310. package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +0 -1
  311. package/assets/esri/core/workers/chunks/6f4e6022a52de0c54aab.js +0 -1
  312. package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
  313. package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +0 -1
  314. package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +0 -1
  315. package/assets/esri/core/workers/chunks/8431ca60ad33d594e323.js +0 -1
  316. package/assets/esri/core/workers/chunks/876f7633c15f1e31078d.js +0 -1
  317. package/assets/esri/core/workers/chunks/8ca9648eacb894283513.js +0 -1
  318. package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +0 -1
  319. package/assets/esri/core/workers/chunks/94e427040edb469d58ad.js +0 -1
  320. package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +0 -1
  321. package/assets/esri/core/workers/chunks/9e1a3b6a08c96dcefdde.js +0 -1
  322. package/assets/esri/core/workers/chunks/9e3e442a9874ed23a043.js +0 -1
  323. package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +0 -1
  324. package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
  325. package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +0 -1
  326. package/assets/esri/core/workers/chunks/d8f1cefcad02d7353d4b.js +0 -1
  327. package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
  328. package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +0 -1
  329. package/assets/esri/core/workers/chunks/de02f60258e6985ef676.js +0 -1
  330. package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +0 -1
  331. package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +0 -1
  332. package/assets/esri/core/workers/chunks/ed8786fed345718ed684.js +0 -1
  333. package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +0 -1
  334. package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +0 -1
  335. package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
  336. package/assets/esri/core/workers/chunks/fe9879ecd69ac4329291.js +0 -1
  337. package/layers/mixins/FeatureLayerReload.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Camera.js";import n from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as i}from"../core/domUtils.js";import a from"../core/Error.js";import{on as o}from"../core/events.js";import{destroyHandle as s,makeHandle as c}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{mapCollectionAsync as ee}from"../core/mapCollectionUtils.js";import{destroyMaybe as u,maybeProperty as te}from"../core/maybe.js";import{throwIfDestroyed as ne,throwIfAborted as d,createAbortError as re}from"../core/promiseUtils.js";import ie from"../core/ReactiveSet.js";import{on as f,watch as p,initial as m,sync as h,whenOnce as ae,syncAndInitial as g}from"../core/reactiveUtils.js";import{setFrameDuration as oe,cleanupScheduling as se}from"../core/scheduling.js";import{createScreenPoint as ce,createScreenPointArray as le}from"../core/screenUtils.js";import{cleanupWhereClauseCache as ue}from"../core/sql.js";import{getDefaultVerticalUnitStringForSR as de,getMetersPerUnitForSR as fe}from"../core/units.js";import{property as _,cast as v,subclass as pe}from"../core/accessorSupport/decorators.js";import{ensureType as y,ensureClass as b}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as me}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as he}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as ge}from"../core/accessorSupport/trackingUtils.js";import{create as _e}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as ve}from"../core/libs/rbush/PooledRBush.js";import{initialize as ye}from"../core/workers/workers.js";import x from"../geometry/Extent.js";import be from"../geometry/HeightModelInfo.js";import S from"../geometry/Point.js";import{project as C,canProjectWithoutEngine as xe}from"../geometry/projectionUtils.js";import w from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as Se}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as Ce}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as T}from"../geometry/projection/projectPointToVector.js";import{toExtent as we,create as Te}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as Ee}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as De}from"../geometry/support/scaleUtils.js";import{wgs84 as Oe,webMercator as ke}from"../geometry/support/spatialReferenceUtils.js";import{makeDehydratedPoint as Ae}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as E,isTiledLayer as D,isVoxelLayer as O,isIntegratedMeshLayer as k,isGaussianSplatLayer as je}from"../layers/support/layerUtils.js";import{TilemapCache as Me}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as Ne}from"../portal/portalDefault.js";import{WebSceneTag as Pe}from"../support/tagSymbols.js";import{BreakpointsOwner as Fe}from"./BreakpointsOwner.js";import{DOMContainer as Ie}from"./DOMContainer.js";import{PopupView as Le}from"./PopupView.js";import A from"./View.js";import Re from"./ViewAnimation.js";import{stringFromViewingMode as j,viewingModeFromString as M}from"./ViewingMode.js";import{GroundView3D as ze}from"./3d/GroundView3D.js";import{layerView3DImporter as N}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as Be}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as Ve}from"./3d/camera/intersectionUtils.js";import P from"./3d/constraints/Constraints.js";import F from"./3d/environment/Environment.js";import{EnvironmentView as He}from"./3d/environment/EnvironmentView.js";import Ue from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as We}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Ge}from"./3d/layers/graphics/Labeler.js";import Ke from"./3d/layers/i3s/I3SLodHandling.js";import{Navigation3D as qe}from"./3d/navigation/Navigation3D.js";import{ScreenSizePerspective as Je}from"./3d/state/ScreenSizePerspective.js";import I from"./3d/state/ViewState.js";import{ViewStateManager as Ye,cleanupViewStateManager as Xe}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Ze}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Qe}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as $e}from"./3d/state/utils/navigationUtils.js";import et from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as tt}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as L}from"./3d/support/debugFlags.js";import{getElevationAtPoint as nt}from"./3d/support/ElevationProvider.js";import{GroundAndIMSurface as rt}from"./3d/support/GroundAndIMSurface.js";import{toMap as it,hitTest as at}from"./3d/support/hitTest.js";import{popupHitTest as ot}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as st,getQualityProfileSettings as R}from"./3d/support/QualityProfile.js";import z from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as ct}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as lt}from"./3d/support/ResourceController.js";import ut from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as dt}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as ft}from"./3d/support/ViewSlice.js";import{PointsOfInterest as B}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import V from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as pt,getTiledLayerInfo as mt,checkIfTileInfoSupportedForView as ht}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as gt}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as _t}from"./3d/terrain/TileRenderer.js";import{Stage as vt}from"./3d/webgl-engine/Stage.js";import{olidEnabled as yt}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as bt}from"./3d/webgl-engine/effects/geometry/RenderOccluded.js";import{defaultTolerance as H}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as xt}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as U}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as St}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import W from"./interactive/options/ViewOptions.js";import Ct from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as wt}from"./support/drapedUtils.js";import{occludeesSupported as Tt}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as G,createScreenPointFromSupportedEvent as K}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Et}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Dt,destroyTextureCompressionWorker as Ot}from"./support/TextureCompressionHelper.js";import kt from"./ui/DefaultUI.js";import At from"./ui/3d/DefaultUI3D.js";import jt from"../webscene/Environment.js";import{clearVNodeCache as Mt}from"../widgets/support/vnodeCache.js";var q;const Nt=Symbol(),J=Symbol();function Pt(e){let t=b(W,e);return t!==e&&e.snapping?.enabled==null&&(t.snapping.enabled=!0),t}let Y=class extends Fe(Le(Ie(A))){static{q=this}get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this.options=new W({snapping:{enabled:!0}}),this._userClippingArea=null,this._clippingArea=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=lt(this),this.deconflictor=new We({view:this}),this.attribution3D=new et({view:this}),this.labeler=new Ge({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.navigation=new qe({view:this}),this.basemapTerrain=null,this.elevationProvider=new tt({view:this}),this._canvas=null,this.constraints=new P,this._environment=new F,this.environmentView=new He,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new Ct({importAnalysisViewModule:e=>Be(e),view:this}),this.groundView=null,this.groundAndIMSurface=null,this.map=null,this._featureTileTreeClients=new ie,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new I({view:this}),this.slice=new ft,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type=`3d`,this.ui=new At,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,ye();let t=()=>this._updatingChanged();this.addHandles(s(ee(()=>this.map?.allLayers,async e=>{try{await e.when()}catch{}finally{t()}}))),this.addHandles([f(()=>this.map?.allLayers,`after-changes`,t,{onListenerAdd:t,onListenerRemove:t,sync:!0}),this.allLayerViews.on(`after-changes`,e=>this._updateUpdatingMonitors(e)),p(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new Ue({view:this}),this.stateManager=new Ye({view:this}),this.screenSizePerspective=new Je({view:this})}initialize(){if(has(`enable-feature:esri-compress-textures`)&&has(`wasm-simd`)){let e=Dt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new ze({view:this}),this.groundAndIMSurface=new rt({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>oe(e>0?1e3/Math.ceil(e):0),m),this.addHandles([p(()=>this.spatialReference,()=>this.notifyChange(`clippingArea`),h),p(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),h)])}destroy(){this.destroyed||(Ot(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.layerViewManager.clear(),this._set(`analysisViewManager`,u(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=u(this.sharedSymbolResources),this._set(`labeler`,u(this.labeler)),this._set(`deconflictor`,u(this.deconflictor)),this._resourceController=u(this._resourceController),this._set(`stateManager`,u(this.stateManager)),this._set(`inputManager`,u(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles(`updatingMonitors`),this._set(`environmentView`,u(this.environmentView)),this._set(`environment`,u(this.environment)),this.groundView=u(this.groundView),this.groundAndIMSurface.destroy(),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set(`ui`,null),this._set(`renderCanvas`,null),this._set(`canvas`,null),this._canvas=null,this.screenSizePerspective.destroy(),this.attribution3D.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get groundSpatialReference(){return this.groundView?.spatialReference}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get animation(){return this.state?.animation}get overlayManager(){return this.basemapTerrain?.overlayManager}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=y(S,e))}get clippingArea(){if(this.viewingMode===`global`)return null;let e=this.map,t=this._userClippingArea||te(e,`clippingArea`);return!(this._userClippingArea||te(e,`clippingEnabled`))||t==null?(this._clippingArea=null,null):t instanceof x?this.spatialReference&&(t=X(t,this.spatialReference),t==null)?(l.getLogger(this).error(`#clippingArea`,`setting clippingArea with incompatible SpatialReference`),this._clippingArea):(t=t.clone(),t.intersection(this._groundAndLayersExtent)??(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error(`#clippingArea`,`only clippingArea geometries of type Extent are supported`),this._clippingArea)}set clippingArea(e){this.ready&&this.viewingMode===`global`&&e!=null?l.getLogger(this).error(`#clippingArea=`,`Clipping area is only supported in local viewingMode`):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===1)return null;let e=this.renderSpatialReference,t=this.dataExtent;return t==null||e==null||t.spatialReference.equals(e)?t:X(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent,t=this.spatialReference||w.WGS84,n=X(this.clippingArea,t);n!=null&&(e=e==null?n:e.intersection(n));let r=this._get(`dataExtent`);return e!=null&&e.equals(r)?r:e}get _groundAndLayersExtent(){let e=this.spatialReference||w.WGS84,t,n=n=>{let r=X(n,e);r!=null&&(t==null?t=r.clone():t.union(r))},{groundView:r}=this,i=r?.spatialReference,a=r?.fullGroundExtent;i&&a&&n(new x({xmin:a[0],ymin:a[1],zmin:0,xmax:a[2],ymax:a[3],zmax:0,spatialReference:i}));let o=e=>{e.fullExtent!=null&&(e.type!==`graphics`||!e.internal)&&n(e.fullExtent)};if(this.map?.allLayers.forEach(e=>o(e)),t==null)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);let s=this._get(`_groundAndLayersExtent`);return t.equals(s)?s:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;let{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange(`environment`)}castEnvironment(e){return e?e instanceof F?e:e instanceof jt?this.environment?.cloneWithWebsceneEnvironment(e)??F.fromWebsceneEnvironment(e):y(F,e):new F}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get _layerToLayerviewMapping(){return q._layerToLayerview}static{this._layerToLayerview=A._layerToLayerview.concat([[`view.map.ground.layers`,`view.groundView.layerViews`]])}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&Pe in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){let t=R(e);t&&this._get(`qualityProfile`)!==e&&(this.qualitySettings=new z(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set(`qualityProfile`,e))}get qualityProfile(){return this._get(`qualityProfile`)||st()}_updateSlice(){this.stage!=null&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return this.viewingMode?!!this.stateManager?.preinit(this.spatialReference):!1}get resolution(){let{scale:e,spatialReference:t}=this;return t?he(()=>De(e,t)):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainLevel(){let e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;let n=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return n<=0?null:Math.max(0,Math.min(n,r||1/0))}get heightModelInfo(){let e=this.getDefaultHeightModelInfo();if(!e)return null;let t=de(this.spatialReference);if(t&&e.heightUnit!==t)return new be({heightModel:e.heightModel,heightUnit:t,vertCRS:e.vertCRS,associatedSpatialReference:e.associatedSpatialReference});if(!e.associatedSpatialReference){let t=e.clone();return t.associatedSpatialReference=this.spatialReference,t}return e}get alphaCompositingEnabled(){return this._get(`alphaCompositingEnabled`)}set alphaCompositingEnabled(e){this._stage&&l.getLogger(this).warn(`alphaCompositingEnabled cannot be changed after the view has become ready`),this._set(`alphaCompositingEnabled`,e)}get updating(){if(this.destroying||this.destroyed)return!1;if(!this.initialized)return!0;let e=0,t=this.layerViewManager.updating,n=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(!r.isFulfilled())++n;else if(r.updating){if(t=!0,r.suspended||pt(r))return;++n,e+=r.updatingProgress}});let r=.1;for(let t of this._updatingObjects)t?.updating&&(n+=r,e+=.5*r);for(let t of this._updatingObjectsWithProgress)t?.updating&&(++n,e+=t.updatingProgress);let i=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||n>0||this.updatingHandles.updating||!this.ready||!this.stationary||i||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(n,this._numUpdating),e+=this._numUpdating-n):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=+!t,this._get(`updatingProgress`)!==e){let n=performance.now();if(e<1){let t=Math.min((n-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set(`updatingProgress`,e),this._lastUpdateTime=t&&e<1?n:0}return L.UPDATING&&console.log(`Updating:`,this._updatingObjectsToDebug.filter(e=>e!=null&&e.updating).map(({declaredClass:e})=>e)),t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentView,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager,this.focusAreasView]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get _updatingObjectsToDebug(){return L.UPDATING?this._updatingObjects.concat(this._updatingObjectsWithProgress).concat(this.allLayerViews.toArray()):[]}get viewingMode(){let e=this._predeterminedViewingMode;if(e!=null)return j(e);let t=this.spatialReference;return t?this.defaultsFromMap?.viewingMode!=null&&t.equals(this.defaultsFromMap.spatialReference)?j(this.defaultsFromMap.viewingMode):Et(t,1)?`global`:`local`:`global`}set viewingMode(e){this.ready?l.getLogger(this).error(`#viewingMode`,`viewingMode cannot be set once view is ready`):this._overrideIfSome(`viewingMode`,e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new ut(this)}on(e,t,n,r){return this.viewEvents.on(e,t,n,r)||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error(`#toMap()`,`Scene view cannot be used before it is ready`),null;let n=G(e)?K(this,e):e;return it(this,n,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error(`#toScreen()`,`Scene view cannot be used before it is ready`),null;let t=e;return e.z??(t=Ft,t.x=e.x,t.y=e.y,t.z=nt(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),T(t,Z,this.renderSpatialReference),this.state.camera.projectToScreen(Z,Q),ce(Q[0],Q[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error(`#pixelSizeAt()`,`Scene view cannot be used before it is ready`),null;if(!e)return 0;let n=this.renderSpatialReference;T(e,Z,n);let r=this.state.camera.computeScreenPixelSizeAt(Z);return t&&n!==t?r*fe(n)/fe(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error(`#hitTest()`,`Scene view cannot be used before it is ready`),null;let n=G(e)?K(this,e):e;return at(this,n,t,this._defaultHitTestOptions)}async popupHitTest(e){return ot(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async zoomIn(){if(this.canZoomIn)return this.navigation.zoom(!0)}async zoomOut(){if(this.canZoomOut)return this.navigation.zoom(!1)}async whenAnalysisView(e){if(e.parent==null)throw new a(`view:no-analysisview-for-analysis`,`The analysis does not exist in view.analyses`,{analysis:e});switch(e.parent.type){case`line-of-sight`:case`dimension`:case`viewshed`:return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encode(n,t,this._pixelFormat())}async _takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encodeData(n,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){let t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();let n=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await import(`./support/screenshotUtils.js`);return[r(n[0],this._pixelFormat()),r(n[1],this._pixelFormat())]}async _completeSettings(e){let{toRenderSettings:t,screenshotSuperSampleSettings:n}=await import(`./support/screenshotUtils.js`),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,n(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!yt())throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`);let{encode:t}=await import(`./support/screenshotUtils.js`),n=await this._completeSettings(e);n.olidColor=!0,await this.whenReady();let r=await this.stage.renderView.takeScreenshot(n),i=t(r[0],n,this._pixelFormat()),o=await this._completeSettings(e);return o.format=`png`,[i,t(r[1],o,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){let e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`)}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}getAttributionItems(){return super.getAttributionItems().concat(this.attribution3D.attributionItems)}importLayerView(e){return N.importLayerView(e)}hasLayerViewModule(e){return N.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.scene?.initialViewProperties?.spatialReference}getDefaultTimeZone(){return this.scene?.initialViewProperties?.timeZone??null}getSurface(){return this.surface}get _predeterminedViewingMode(){let e=this._isOverridden(`viewingMode`)?this._get(`viewingMode`):this.scene?.initialViewProperties?.viewingMode;return e==null?null:M(e)}getSpatialReferenceSupport(e,t){let n=this._predeterminedViewingMode,r=r=>this._validateSpatialReferenceForViewingMode(e,t,r)?this._makeSpatialReferenceConstraints(e,t,r,n):null,i=n?r(n):[...r(1)??[],...r(2)??[]];return i?.length?{constraints:i}:null}_validateSpatialReferenceForViewingMode(e,t,n){return Et(e,n)?t==null||E(t)?!0:!(D(t)&&mt(t,e,n)==null||O(t)&&n===1):!1}_makeSpatialReferenceConstraints(e,t,n,r){if(t==null)return[{spatialReference:e,viewingMode:n}];let{isWebMercator:i,isWGS84:a,vcsWkid:o,latestVcsWkid:s}=e,c=()=>o==null?i?w.WGS84:w.WebMercator:new w({...i?Oe:ke,vcsWkid:o,latestVcsWkid:s});return E(t)&&(i||a)?!(a&&r!==2)||ht(t.tileInfo,t.fullExtent,e,1)===null?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:[{spatialReference:c(),viewingMode:n}]:!D(t)&&!O(t)&&(i||a)?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:D(t)&&i&&n!==1?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:2}]:[{spatialReference:e,viewingMode:n}]}_validateSpatialReference(e){let t=this.getSpatialReferenceSupport(e)!=null,n=this._predeterminedViewingMode;return t||(n==null?e.isGeographic&&l.getLogger(this).warnOnce(`Spatial reference is geographic but not supported.`):l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${j(n)} viewing mode.`)),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error(`trackGraphicState`,`GraphicState.graphic must not be null or undefined to start tracking`),null;let t=this.getViewForGraphic(e.graphic),n=null,r=!1,i=t=>{!r&&t!=null&&`processor`in t&&t.processor?.type===`graphics-3d`&&t.processor.graphicsCore&&(n=t.processor.graphicsCore.trackGraphicState(e))};return t==null?this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}maskOccludee(e){if(!e)return l.getLogger(this).error(`maskOccludee`,`GraphicState.graphic must not be null or undefined to mask an occludee`),null;let t=this.getViewForGraphic(e),n=null,r=!1,i=t=>{!r&&t!=null&&Tt(t)&&(n=t.maskOccludee(e))};return t==null?this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>e.type!==`media-3d`).find(t=>t.layer===e.layer):null}graphicChanged(e){this.graphicsView!=null&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await ae(()=>this.graphicsView),this.graphicsView):!e.layer||!this.map?null:!t||!t.waitForLayer||this.map.allLayers.includes(e.layer)?this.whenLayerView(e.layer):new Promise((t,n)=>{let r=this.map.allLayers.on(`change`,i=>{i.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,n))})})}enableFeatureTiles(){let e=Symbol();return this._featureTileTreeClients.add(e),c(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){let n=new AbortController;this._importControllers.set(e,n),this._updatingChanged();try{let r=await It[e]();if(t&&(ne(this),d(n.signal),await t(n.signal)),this.destroyed)throw re();return d(n.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set(`basemapTerrain`,new V({view:this})),this.elevationProvider.register(0,this.basemapTerrain)}_exitBasemapTerrain(){let{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set(`basemapTerrain`,null),t.unregister(e),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set(`pointsOfInterest`,new B({view:this})),this.addHandles([this.updatingHandles.add(()=>L.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import(`./3d/layers/support/FeatureTileTree3DDebugger.js`)).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&L.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=u(this._featureTreeDebugger))},g),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:n,featureTiles:r})=>{if(!r)return;let i=!!e;if(!n&&!i)r.filterExtent=null;else if(!i||!t)r.filterExtent=n;else{let i=e&&t?C(we(e,t),this.spatialReference):null;r.filterExtent=n?n.intersection(i):i}},g),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=u(this._featureTiles)},h)],Nt),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has(`FeatureTileTree3D`))return;let e=(await this.updatingHandles.addPromise(this._importModule(`FeatureTileTree3D`)))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(J),this.removeHandles(Nt),this._featureTiles=u(this.featureTiles),this._set(`pointsOfInterest`,u(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){let e=this.spatialReference,t=this.state.isGlobal,n=Ee(t,e);n!==this.renderSpatialReference&&(this._set(`renderCoordsHelper`,ct.create(this.state.viewingMode,n)),t||this.addHandles(p(()=>this.groundView?.groundExtent,e=>{let t=this.renderCoordsHelper.spatialReference;e!=null&&(e[0]!==0||e[1]!==0||e[2]!==0||e[3]!==0)&&Ce(e,this.groundView.spatialReference,$,t)&&(this.renderCoordsHelper.extent=$)},h),J),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(H/this.renderCoordsHelper.unitInMeters))}else this._set(`renderCoordsHelper`,null)}_exitCoordinateSystem(){this.removeHandles(J),this._set(`renderCoordsHelper`,null)}_updatingChanged(){this.notifyChange(`updating`)}_updateUpdatingMonitors(e=null){(e==null||e.type!==4)&&(this.removeHandles(`updatingMonitors`),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(p(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),h),`updatingMonitors`),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,n){if(!this.overlay||!this.overlay.hasVisibleItems)return n;let r=e.getContext(`2d`,{willReadFrequently:!0});return r.putImageData(n,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,n.width,n.height)}_initStage(){let e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,n)=>this._renderScreenshotOverlay(e,t,n)}},t=new Qe(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set(`sceneIntersectionHelper`,t);let n=i(this.surface);this._stage=new vt({view:this,options:e,container:n}),this.notifyChange(`stage`),this._updateSlice(),this.addHandles([this.on(`pointer-move`,()=>this.stage?.renderer.resetAnimation()),o(this.stage.renderView.canvas,`webglcontextlost`,e=>{this.fatalError=new a(`webgl-context-lost`,e.statusMessage||`WebGL context lost`)})],`stage`),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(H/this.renderCoordsHelper.unitInMeters),this._set(`canvas`,this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set(`sceneIntersectionHelper`,null),this._stage=u(this.stage),this._set(`stage`,null),this.removeHandles(`stage`),this._set(`canvas`,null)}_initSurface(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new dt({view:this,resourceController:this._resourceController})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has(`GraphicsView3D`)||this.graphics.length===0)return;this.removeHandles(`GraphicsView3D`);let e=(await this.updatingHandles.addPromise(this._importModule(`GraphicsView3D`,e=>ae(()=>this.groundView?.ready,e))))?.default;e&&this._set(`graphicsView`,new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport(`GraphicsView3D`),this.removeHandles(`GraphicsView3D`),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set(`graphicsView`,null))}_disposeFocusAreasView(){this._abortImport(`FocusAreasView`),this.removeHandles(`FocusAreasView`),this.focusAreasView=u(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has(`FocusAreasView`)||e===0)return;this.removeHandles(`FocusAreasView`);let t=(await this.updatingHandles.addPromise(this._importModule(`FocusAreasView`)))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){M(this.viewingMode)===1&&(this._clippingArea=null),this._initSurface(),this._set(`ready`,!0),this.addHandles(f(()=>this.graphics,`after-changes`,()=>this._ensureGraphicsView()),`GraphicsView3D`),this._ensureGraphicsView(),this.addHandles(this.updatingHandles.add(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),`FocusAreasView`);let e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?me(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentView.connectView(this),this.inputManager.connect();let n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this))}_teardown(){this.inputManager.disconnect(),this.environmentView.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set(`ready`,!1)}get _defaultToMapOptions(){let e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(U);for(let t of this.allLayerViews)(k(t.layer)&&(!has(`enable-feature:im-as-ground`)||t.layer.isUsedAsGroundLayer)||je(t.layer))&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){let e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(U);for(let t of this.allLayerViews)(has(`enable-feature:im-as-ground`)?k(t.layer)&&t.layer.isUsedAsGroundLayer:k(t.layer))&&t.fullOpacity<1&&e.exclude.add(t.uid);return e}static{this.type=`3d`}static clearStatics(){Mt(),ge(),ue(),St(),Xe(),Ve(),Se(),wt(),Ne(),_t(),xt(),Ze(),$e(),ve(),se(),bt(),gt(),Ke.cleanupI3SLodHandling(),Me.cleanupTilemapCache(),I.cleanupViewstate(),V.cleanupTerrainSurface()}};e([_({nonNullable:!0}),v(Pt)],Y.prototype,`options`,void 0),e([_()],Y.prototype,`_userClippingArea`,void 0),e([_()],Y.prototype,`_resourceController`,void 0),e([_()],Y.prototype,`stage`,null),e([_({readOnly:!0})],Y.prototype,`deconflictor`,void 0),e([_({readOnly:!0})],Y.prototype,`labeler`,void 0),e([_()],Y.prototype,`navigation`,void 0),e([_({type:Re,readOnly:!0})],Y.prototype,`animation`,null),e([_({readOnly:!0})],Y.prototype,`basemapTerrain`,void 0),e([_({readOnly:!0})],Y.prototype,`overlayManager`,null),e([_({readOnly:!0})],Y.prototype,`elevationProvider`,void 0),e([_()],Y.prototype,`camera`,null),e([_({type:t})],Y.prototype,`contentCamera`,null),e([_({readOnly:!0})],Y.prototype,`canvas`,null),e([_({type:S,useTypeForAutocast:!1})],Y.prototype,`center`,null),e([_({type:x})],Y.prototype,`clippingArea`,null),e([_({type:P,nonNullable:!0})],Y.prototype,`constraints`,void 0),e([_({type:x,readOnly:!0})],Y.prototype,`renderDataExtent`,null),e([_({readOnly:!0})],Y.prototype,`tileInfo`,null),e([_({type:x,readOnly:!0})],Y.prototype,`dataExtent`,null),e([_({type:x,readOnly:!0})],Y.prototype,`_groundAndLayersExtent`,null),e([_({type:F})],Y.prototype,`environment`,null),e([v(`environment`)],Y.prototype,`castEnvironment`,null),e([_({readOnly:!0})],Y.prototype,`environmentView`,void 0),e([_({type:x})],Y.prototype,`extent`,null),e([_({type:r})],Y.prototype,`floors`,void 0),e([_()],Y.prototype,`screenCenter`,null),e([_()],Y.prototype,`frustum`,null),e([_({type:Number,readOnly:!0})],Y.prototype,`fullOpacity`,void 0),e([_({readOnly:!0})],Y.prototype,`graphicsView`,void 0),e([_()],Y.prototype,`analysisViewManager`,void 0),e([_()],Y.prototype,`groundView`,void 0),e([_({readOnly:!0})],Y.prototype,`layerviewCollections`,null),e([_({type:Boolean})],Y.prototype,`initialExtentRequired`,null),e([_()],Y.prototype,`defaultsFromMapSettings`,null),e([_()],Y.prototype,`interacting`,null),e([_()],Y.prototype,`stationary`,null),e([_()],Y.prototype,`navigating`,null),e([_()],Y.prototype,`map`,void 0),e([_()],Y.prototype,`padding`,null),e([_({type:B,readOnly:!0})],Y.prototype,`pointsOfInterest`,void 0),e([_()],Y.prototype,`_featureTiles`,void 0),e([_()],Y.prototype,`featureTiles`,null),e([_()],Y.prototype,`_featureTreeDebugger`,void 0),e([_({constructOnly:!0})],Y.prototype,`deactivatedWebGLExtensions`,void 0),e([_({constructOnly:!0})],Y.prototype,`debugWebGLExtensions`,void 0),e([_({constructOnly:!0})],Y.prototype,`renderCanvas`,void 0),e([_({constructOnly:!0})],Y.prototype,`state`,void 0),e([_()],Y.prototype,`screenSizePerspective`,void 0),e([_({readOnly:!0})],Y.prototype,`inputManager`,void 0),e([_({readOnly:!0})],Y.prototype,`stateManager`,void 0),e([_({type:[`low`,`medium`,`high`]})],Y.prototype,`qualityProfile`,null),e([_({type:z,get(){let e=this._get(`qualitySettings`);if(!e){let t=R(this.qualityProfile);e=new z(t)}return e}})],Y.prototype,`qualitySettings`,void 0),e([_()],Y.prototype,`slice`,void 0),e([_({readOnly:!0})],Y.prototype,`typeSpecificPreconditionsReady`,null),e([_({readOnly:!0})],Y.prototype,`renderCoordsHelper`,void 0),e([_({readOnly:!0})],Y.prototype,`sceneIntersectionHelper`,void 0),e([_({type:Number,readOnly:!0})],Y.prototype,`resolution`,null),e([_({type:Number})],Y.prototype,`scale`,null),e([_({readOnly:!0,type:Number})],Y.prototype,`terrainLevel`,null),e([_()],Y.prototype,`heightModelInfo`,null),e([_({type:w})],Y.prototype,`spatialReference`,void 0),e([_({type:Boolean,value:!1})],Y.prototype,`alphaCompositingEnabled`,null),e([_({constructOnly:!0})],Y.prototype,`preserveDrawingBufferEnabled`,void 0),e([_({type:Boolean})],Y.prototype,`supersampleScreenshotsEnabled`,void 0),e([_({readOnly:!0})],Y.prototype,`type`,void 0),e([_(),v(e=>e instanceof kt?e:b(At,e))],Y.prototype,`ui`,void 0),e([_({type:Boolean,readOnly:!0})],Y.prototype,`updating`,null),e([_()],Y.prototype,`_updatingObjects`,null),e([_()],Y.prototype,`_updatingObjectsWithProgress`,null),e([_()],Y.prototype,`_updatingObjectsToDebug`,null),e([_({type:Number,readOnly:!0})],Y.prototype,`updatingProgress`,void 0),e([_({type:[`global`,`local`]})],Y.prototype,`viewingMode`,null),e([_({type:n})],Y.prototype,`viewpoint`,null),e([_({readOnly:!0})],Y.prototype,`visibleArea`,null),e([_({type:Number})],Y.prototype,`zoom`,null),e([_({readOnly:!0})],Y.prototype,`quality`,null),e([_({readOnly:!0})],Y.prototype,`resolutionScale`,null),e([_()],Y.prototype,`focusAreasView`,void 0),e([_()],Y.prototype,`_defaultToMapOptions`,null),e([_()],Y.prototype,`_defaultHitTestOptions`,null),Y=q=e([pe(`esri.views.SceneView`)],Y);function X(e,t){return e!=null&&xe(e.spatialReference,t)?C(e,t):null}const Z=_e(),Q=le(),$=Te(),Ft=Ae(0,0,0,w.WebMercator),It={GraphicsView3D:()=>import(`./3d/layers/GraphicsView3D.js`),FocusAreasView:()=>import(`./3d/FocusAreasView.js`),FeatureTileTree3D:()=>import(`./3d/layers/support/FeatureTileTree3D.js`)},Lt=Y;export{Lt as default};
2
+ import{__decorate as e}from"tslib";import t from"../Camera.js";import n from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as i}from"../core/domUtils.js";import a from"../core/Error.js";import{on as o}from"../core/events.js";import{destroyHandle as s,makeHandle as c}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{mapCollectionAsync as ee}from"../core/mapCollectionUtils.js";import{destroyMaybe as u,maybeProperty as te}from"../core/maybe.js";import{throwIfDestroyed as ne,throwIfAborted as d,createAbortError as re}from"../core/promiseUtils.js";import ie from"../core/ReactiveSet.js";import{on as f,watch as p,initial as m,sync as h,whenOnce as ae,syncAndInitial as g}from"../core/reactiveUtils.js";import{setFrameDuration as oe,cleanupScheduling as se}from"../core/scheduling.js";import{createScreenPoint as ce,createScreenPointArray as le}from"../core/screenUtils.js";import{cleanupWhereClauseCache as ue}from"../core/sql.js";import{getDefaultVerticalUnitStringForSR as de,getMetersPerUnitForSR as fe}from"../core/units.js";import{property as _,cast as v,subclass as pe}from"../core/accessorSupport/decorators.js";import{ensureType as y,ensureClass as b}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as me}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as he}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as ge}from"../core/accessorSupport/trackingUtils.js";import{create as _e}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as ve}from"../core/libs/rbush/PooledRBush.js";import{initialize as ye}from"../core/workers/workers.js";import x from"../geometry/Extent.js";import be from"../geometry/HeightModelInfo.js";import S from"../geometry/Point.js";import{project as C,canProjectWithoutEngine as xe}from"../geometry/projectionUtils.js";import w from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as Se}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as Ce}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as T}from"../geometry/projection/projectPointToVector.js";import{toExtent as we,create as Te}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as Ee}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as De}from"../geometry/support/scaleUtils.js";import{wgs84 as Oe,webMercator as ke}from"../geometry/support/spatialReferenceUtils.js";import{makeDehydratedPoint as Ae}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as E,isTiledLayer as D,isVoxelLayer as O,isIntegratedMeshLayer as k,isGaussianSplatLayer as je}from"../layers/support/layerUtils.js";import{TilemapCache as Me}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as Ne}from"../portal/portalDefault.js";import{WebSceneTag as Pe}from"../support/tagSymbols.js";import{BreakpointsOwner as Fe}from"./BreakpointsOwner.js";import{DOMContainer as Ie}from"./DOMContainer.js";import{PopupView as Le}from"./PopupView.js";import A from"./View.js";import Re from"./ViewAnimation.js";import{stringFromViewingMode as j,viewingModeFromString as M}from"./ViewingMode.js";import{GroundView3D as ze}from"./3d/GroundView3D.js";import{layerView3DImporter as N}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as Be}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as Ve}from"./3d/camera/intersectionUtils.js";import P from"./3d/constraints/Constraints.js";import F from"./3d/environment/Environment.js";import{EnvironmentView as He}from"./3d/environment/EnvironmentView.js";import Ue from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as We}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Ge}from"./3d/layers/graphics/Labeler.js";import Ke from"./3d/layers/i3s/I3SLodHandling.js";import{Navigation3D as qe}from"./3d/navigation/Navigation3D.js";import{ScreenSizePerspective as Je}from"./3d/state/ScreenSizePerspective.js";import I from"./3d/state/ViewState.js";import{ViewStateManager as Ye,cleanupViewStateManager as Xe}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Ze}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Qe}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as $e}from"./3d/state/utils/navigationUtils.js";import et from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as tt}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as L}from"./3d/support/debugFlags.js";import{getElevationAtPoint as nt}from"./3d/support/ElevationProvider.js";import{GroundAndIMSurface as rt}from"./3d/support/GroundAndIMSurface.js";import{toMap as it,hitTest as at}from"./3d/support/hitTest.js";import{popupHitTest as ot}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as st,getQualityProfileSettings as R}from"./3d/support/QualityProfile.js";import z from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as ct}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as lt}from"./3d/support/ResourceController.js";import ut from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as dt}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as ft}from"./3d/support/ViewSlice.js";import{PointsOfInterest as B}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import V from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as pt,getTiledLayerInfo as mt,checkIfTileInfoSupportedForView as ht}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as gt}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as _t}from"./3d/terrain/TileRenderer.js";import{Stage as vt}from"./3d/webgl-engine/Stage.js";import{olidEnabled as yt}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as bt}from"./3d/webgl-engine/effects/geometry/RenderOccluded.js";import{defaultTolerance as H}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as xt}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as U}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as St}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import W from"./interactive/options/ViewOptions.js";import Ct from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as wt}from"./support/drapedUtils.js";import{occludeesSupported as Tt}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as G,createScreenPointFromSupportedEvent as K}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Et}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Dt,destroyTextureCompressionWorker as Ot}from"./support/TextureCompressionHelper.js";import kt from"./ui/DefaultUI.js";import At from"./ui/3d/DefaultUI3D.js";import jt from"../webscene/Environment.js";import{clearVNodeCache as Mt}from"../widgets/support/vnodeCache.js";var q;const Nt=Symbol(),J=Symbol();function Pt(e){let t=b(W,e);return t!==e&&e.snapping?.enabled==null&&(t.snapping.enabled=!0),t}let Y=class extends Fe(Le(Ie(A))){static{q=this}get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this.options=new W({snapping:{enabled:!0}}),this._userClippingArea=null,this._clippingArea=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=lt(this),this.deconflictor=new We({view:this}),this.attribution3D=new et({view:this}),this.labeler=new Ge({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.navigation=new qe({view:this}),this.basemapTerrain=null,this.elevationProvider=new tt({view:this}),this._canvas=null,this.constraints=new P,this._environment=new F,this.environmentView=new He,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new Ct({importAnalysisViewModule:e=>Be(e),view:this}),this.groundView=null,this.groundAndIMSurface=null,this.map=null,this._featureTileTreeClients=new ie,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new I({view:this}),this.slice=new ft,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type=`3d`,this.ui=new At,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,ye();let t=()=>this._updatingChanged();this.addHandles(s(ee(()=>this.map?.allLayers,async e=>{try{await e.when()}catch{}finally{t()}}))),this.addHandles([f(()=>this.map?.allLayers,`after-changes`,t,{onListenerAdd:t,onListenerRemove:t,sync:!0}),this.allLayerViews.on(`after-changes`,e=>this._updateUpdatingMonitors(e)),p(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new Ue({view:this}),this.stateManager=new Ye({view:this}),this.screenSizePerspective=new Je({view:this})}initialize(){if(has(`enable-feature:esri-compress-textures`)&&has(`wasm-simd`)){let e=Dt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new ze({view:this}),this.groundAndIMSurface=new rt({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>oe(e>0?1e3/Math.ceil(e):0),m),this.addHandles([p(()=>this.spatialReference,()=>this.notifyChange(`clippingArea`),h),p(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),h)])}destroy(){this.destroyed||(Ot(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.layerViewManager.clear(),this._set(`analysisViewManager`,u(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=u(this.sharedSymbolResources),this._set(`labeler`,u(this.labeler)),this._set(`deconflictor`,u(this.deconflictor)),this._resourceController=u(this._resourceController),this._set(`stateManager`,u(this.stateManager)),this._set(`inputManager`,u(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles(`updatingMonitors`),this._set(`environmentView`,u(this.environmentView)),this._set(`environment`,u(this.environment)),this.groundView=u(this.groundView),this.groundAndIMSurface.destroy(),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set(`ui`,null),this._set(`renderCanvas`,null),this._set(`canvas`,null),this._canvas=null,this.screenSizePerspective.destroy(),this.attribution3D.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get groundSpatialReference(){return this.groundView?.spatialReference}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get animation(){return this.state?.animation}get overlayManager(){return this.basemapTerrain?.overlayManager}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=y(S,e))}get clippingArea(){if(this.viewingMode===`global`)return null;let e=this.map,t=this._userClippingArea||te(e,`clippingArea`);return!(this._userClippingArea||te(e,`clippingEnabled`))||t==null?(this._clippingArea=null,null):t instanceof x?this.spatialReference&&(t=X(t,this.spatialReference),t==null)?(l.getLogger(this).error(`#clippingArea`,`setting clippingArea with incompatible SpatialReference`),this._clippingArea):(t=t.clone(),t.intersection(this._groundAndLayersExtent)??(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error(`#clippingArea`,`only clippingArea geometries of type Extent are supported`),this._clippingArea)}set clippingArea(e){this.ready&&this.viewingMode===`global`&&e!=null?l.getLogger(this).error(`#clippingArea=`,`Clipping area is only supported in local viewingMode`):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===1)return null;let e=this.renderSpatialReference,t=this.dataExtent;return t==null||e==null||t.spatialReference.equals(e)?t:X(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent,t=this.spatialReference||w.WGS84,n=X(this.clippingArea,t);n!=null&&(e=e==null?n:e.intersection(n));let r=this._get(`dataExtent`);return e!=null&&e.equals(r)?r:e}get _groundAndLayersExtent(){let e=this.spatialReference||w.WGS84,t,n=n=>{let r=X(n,e);r!=null&&(t==null?t=r.clone():t.union(r))},{groundView:r}=this,i=r?.spatialReference,a=r?.fullGroundExtent;i&&a&&n(new x({xmin:a[0],ymin:a[1],zmin:0,xmax:a[2],ymax:a[3],zmax:0,spatialReference:i}));let o=e=>{e.fullExtent==null||e.type===`graphics`&&e.internal||n(e.fullExtent)};if(this.map?.allLayers.forEach(e=>o(e)),t==null)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);let s=this._get(`_groundAndLayersExtent`);return t.equals(s)?s:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;let{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange(`environment`)}castEnvironment(e){return e?e instanceof F?e:e instanceof jt?this.environment?.cloneWithWebsceneEnvironment(e)??F.fromWebsceneEnvironment(e):y(F,e):new F}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get _layerToLayerviewMapping(){return q._layerToLayerview}static{this._layerToLayerview=A._layerToLayerview.concat([[`view.map.ground.layers`,`view.groundView.layerViews`]])}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&Pe in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){let t=R(e);t&&this._get(`qualityProfile`)!==e&&(this.qualitySettings=new z(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set(`qualityProfile`,e))}get qualityProfile(){return this._get(`qualityProfile`)||st()}_updateSlice(){this.stage!=null&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return this.viewingMode?!!this.stateManager?.preinit(this.spatialReference):!1}get resolution(){let{scale:e,spatialReference:t}=this;return t?he(()=>De(e,t)):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainLevel(){let e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;let n=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return n<=0?null:Math.max(0,Math.min(n,r||1/0))}get heightModelInfo(){let e=this.getDefaultHeightModelInfo();if(!e)return null;let t=de(this.spatialReference);if(t&&e.heightUnit!==t)return new be({heightModel:e.heightModel,heightUnit:t,vertCRS:e.vertCRS,associatedSpatialReference:e.associatedSpatialReference});if(!e.associatedSpatialReference){let t=e.clone();return t.associatedSpatialReference=this.spatialReference,t}return e}get alphaCompositingEnabled(){return this._get(`alphaCompositingEnabled`)}set alphaCompositingEnabled(e){this._stage&&l.getLogger(this).warn(`alphaCompositingEnabled cannot be changed after the view has become ready`),this._set(`alphaCompositingEnabled`,e)}get updating(){if(this.destroying||this.destroyed)return!1;if(!this.initialized)return!0;let e=0,t=this.layerViewManager.updating,n=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(!r.isFulfilled())++n;else if(r.updating){if(t=!0,r.suspended||pt(r))return;++n,e+=r.updatingProgress}});let r=.1;for(let t of this._updatingObjects)t?.updating&&(n+=r,e+=.5*r);for(let t of this._updatingObjectsWithProgress)t?.updating&&(++n,e+=t.updatingProgress);let i=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||n>0||this.updatingHandles.updating||!this.ready||!this.stationary||i||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(n,this._numUpdating),e+=this._numUpdating-n):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=+!t,this._get(`updatingProgress`)!==e){let n=performance.now();if(e<1){let t=Math.min((n-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set(`updatingProgress`,e),this._lastUpdateTime=t&&e<1?n:0}return L.UPDATING&&console.log(`Updating:`,this._updatingObjectsToDebug.filter(e=>e!=null&&e.updating).map(({declaredClass:e})=>e)),t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentView,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager,this.focusAreasView]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get _updatingObjectsToDebug(){return L.UPDATING?this._updatingObjects.concat(this._updatingObjectsWithProgress).concat(this.allLayerViews.toArray()):[]}get viewingMode(){let e=this._predeterminedViewingMode;if(e!=null)return j(e);let t=this.spatialReference;return t?this.defaultsFromMap?.viewingMode!=null&&t.equals(this.defaultsFromMap.spatialReference)?j(this.defaultsFromMap.viewingMode):Et(t,1)?`global`:`local`:`global`}set viewingMode(e){this.ready?l.getLogger(this).error(`#viewingMode`,`viewingMode cannot be set once view is ready`):this._overrideIfSome(`viewingMode`,e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new ut(this)}on(e,t,n,r){return this.viewEvents.on(e,t,n,r)||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error(`#toMap()`,`Scene view cannot be used before it is ready`),null;let n=G(e)?K(this,e):e;return it(this,n,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error(`#toScreen()`,`Scene view cannot be used before it is ready`),null;let t=e;return e.z??(t=Ft,t.x=e.x,t.y=e.y,t.z=nt(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),T(t,Z,this.renderSpatialReference),this.state.camera.projectToScreen(Z,Q),ce(Q[0],Q[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error(`#pixelSizeAt()`,`Scene view cannot be used before it is ready`),null;if(!e)return 0;let n=this.renderSpatialReference;T(e,Z,n);let r=this.state.camera.computeScreenPixelSizeAt(Z);return t&&n!==t?r*fe(n)/fe(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error(`#hitTest()`,`Scene view cannot be used before it is ready`),null;let n=G(e)?K(this,e):e;return at(this,n,t,this._defaultHitTestOptions)}async popupHitTest(e){return ot(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async zoomIn(){if(this.canZoomIn)return this.navigation.zoom(!0)}async zoomOut(){if(this.canZoomOut)return this.navigation.zoom(!1)}async whenAnalysisView(e){if(e.parent==null)throw new a(`view:no-analysisview-for-analysis`,`The analysis does not exist in view.analyses`,{analysis:e});switch(e.parent.type){case`line-of-sight`:case`dimension`:case`viewshed`:return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encode(n,t,this._pixelFormat())}async _takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encodeData(n,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){let t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();let n=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await import(`./support/screenshotUtils.js`);return[r(n[0],this._pixelFormat()),r(n[1],this._pixelFormat())]}async _completeSettings(e){let{toRenderSettings:t,screenshotSuperSampleSettings:n}=await import(`./support/screenshotUtils.js`),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,n(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!yt())throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`);let{encode:t}=await import(`./support/screenshotUtils.js`),n=await this._completeSettings(e);n.olidColor=!0,await this.whenReady();let r=await this.stage.renderView.takeScreenshot(n),i=t(r[0],n,this._pixelFormat()),o=await this._completeSettings(e);return o.format=`png`,[i,t(r[1],o,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){let e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`)}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}getAttributionItems(){return super.getAttributionItems().concat(this.attribution3D.attributionItems)}importLayerView(e){return N.importLayerView(e)}hasLayerViewModule(e){return N.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.scene?.initialViewProperties?.spatialReference}getDefaultTimeZone(){return this.scene?.initialViewProperties?.timeZone??null}getSurface(){return this.surface}get _predeterminedViewingMode(){let e=this._isOverridden(`viewingMode`)?this._get(`viewingMode`):this.scene?.initialViewProperties?.viewingMode;return e==null?null:M(e)}getSpatialReferenceSupport(e,t){let n=this._predeterminedViewingMode,r=r=>this._validateSpatialReferenceForViewingMode(e,t,r)?this._makeSpatialReferenceConstraints(e,t,r,n):null,i=n?r(n):[...r(1)??[],...r(2)??[]];return i?.length?{constraints:i}:null}_validateSpatialReferenceForViewingMode(e,t,n){return Et(e,n)?t==null||E(t)?!0:!(D(t)&&mt(t,e,n)==null||O(t)&&n===1):!1}_makeSpatialReferenceConstraints(e,t,n,r){if(t==null)return[{spatialReference:e,viewingMode:n}];let{isWebMercator:i,isWGS84:a,vcsWkid:o,latestVcsWkid:s}=e,c=()=>o==null?i?w.WGS84:w.WebMercator:new w({...i?Oe:ke,vcsWkid:o,latestVcsWkid:s});return E(t)&&(i||a)?!(a&&r!==2)||ht(t.tileInfo,t.fullExtent,e,1)===null?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:[{spatialReference:c(),viewingMode:n}]:!D(t)&&!O(t)&&(i||a)?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:D(t)&&i&&n!==1?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:2}]:[{spatialReference:e,viewingMode:n}]}_validateSpatialReference(e){let t=this.getSpatialReferenceSupport(e)!=null,n=this._predeterminedViewingMode;return t||(n==null?e.isGeographic&&l.getLogger(this).warnOnce(`Spatial reference is geographic but not supported.`):l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${j(n)} viewing mode.`)),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error(`trackGraphicState`,`GraphicState.graphic must not be null or undefined to start tracking`),null;let t=this.getViewForGraphic(e.graphic),n=null,r=!1,i=t=>{!r&&t!=null&&`processor`in t&&t.processor?.type===`graphics-3d`&&t.processor.graphicsCore&&(n=t.processor.graphicsCore.trackGraphicState(e))};return t==null?this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}maskOccludee(e){if(!e)return l.getLogger(this).error(`maskOccludee`,`GraphicState.graphic must not be null or undefined to mask an occludee`),null;let t=this.getViewForGraphic(e),n=null,r=!1,i=t=>{!r&&t!=null&&Tt(t)&&(n=t.maskOccludee(e))};return t==null?this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>e.type!==`media-3d`).find(t=>t.layer===e.layer):null}graphicChanged(e){this.graphicsView!=null&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await ae(()=>this.graphicsView),this.graphicsView):!e.layer||!this.map?null:!t||!t.waitForLayer||this.map.allLayers.includes(e.layer)?this.whenLayerView(e.layer):new Promise((t,n)=>{let r=this.map.allLayers.on(`change`,i=>{i.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,n))})})}enableFeatureTiles(){let e=Symbol();return this._featureTileTreeClients.add(e),c(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){let n=new AbortController;this._importControllers.set(e,n),this._updatingChanged();try{let r=await It[e]();if(t&&(ne(this),d(n.signal),await t(n.signal)),this.destroyed)throw re();return d(n.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set(`basemapTerrain`,new V({view:this})),this.elevationProvider.register(0,this.basemapTerrain)}_exitBasemapTerrain(){let{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set(`basemapTerrain`,null),t.unregister(e),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set(`pointsOfInterest`,new B({view:this})),this.addHandles([this.updatingHandles.add(()=>L.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import(`./3d/layers/support/FeatureTileTree3DDebugger.js`)).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&L.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=u(this._featureTreeDebugger))},g),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:n,featureTiles:r})=>{if(!r)return;let i=!!e;if(!n&&!i)r.filterExtent=null;else if(!i||!t)r.filterExtent=n;else{let i=e&&t?C(we(e,t),this.spatialReference):null;r.filterExtent=n?n.intersection(i):i}},g),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=u(this._featureTiles)},h)],Nt),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has(`FeatureTileTree3D`))return;let e=(await this.updatingHandles.addPromise(this._importModule(`FeatureTileTree3D`)))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(J),this.removeHandles(Nt),this._featureTiles=u(this.featureTiles),this._set(`pointsOfInterest`,u(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){let e=this.spatialReference,t=this.state.isGlobal,n=Ee(t,e);n!==this.renderSpatialReference&&(this._set(`renderCoordsHelper`,ct.create(this.state.viewingMode,n)),t||this.addHandles(p(()=>this.groundView?.groundExtent,e=>{let t=this.renderCoordsHelper.spatialReference;e!=null&&(e[0]!==0||e[1]!==0||e[2]!==0||e[3]!==0)&&Ce(e,this.groundView.spatialReference,$,t)&&(this.renderCoordsHelper.extent=$)},h),J),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(H/this.renderCoordsHelper.unitInMeters))}else this._set(`renderCoordsHelper`,null)}_exitCoordinateSystem(){this.removeHandles(J),this._set(`renderCoordsHelper`,null)}_updatingChanged(){this.notifyChange(`updating`)}_updateUpdatingMonitors(e=null){(e==null||e.type!==4)&&(this.removeHandles(`updatingMonitors`),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(p(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),h),`updatingMonitors`),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,n){if(!this.overlay||!this.overlay.hasVisibleItems)return n;let r=e.getContext(`2d`,{willReadFrequently:!0});return r.putImageData(n,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,n.width,n.height)}_initStage(){let e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,n)=>this._renderScreenshotOverlay(e,t,n)}},t=new Qe(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set(`sceneIntersectionHelper`,t);let n=i(this.surface);this._stage=new vt({view:this,options:e,container:n}),this.notifyChange(`stage`),this._updateSlice(),this.addHandles([this.on(`pointer-move`,()=>this.stage?.renderer.resetAnimation()),o(this.stage.renderView.canvas,`webglcontextlost`,e=>{this.fatalError=new a(`webgl-context-lost`,e.statusMessage||`WebGL context lost`)})],`stage`),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(H/this.renderCoordsHelper.unitInMeters),this._set(`canvas`,this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set(`sceneIntersectionHelper`,null),this._stage=u(this.stage),this._set(`stage`,null),this.removeHandles(`stage`),this._set(`canvas`,null)}_initSurface(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new dt({view:this,resourceController:this._resourceController})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has(`GraphicsView3D`)||this.graphics.length===0)return;this.removeHandles(`GraphicsView3D`);let e=(await this.updatingHandles.addPromise(this._importModule(`GraphicsView3D`,e=>ae(()=>this.groundView?.ready,e))))?.default;e&&this._set(`graphicsView`,new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport(`GraphicsView3D`),this.removeHandles(`GraphicsView3D`),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set(`graphicsView`,null))}_disposeFocusAreasView(){this._abortImport(`FocusAreasView`),this.removeHandles(`FocusAreasView`),this.focusAreasView=u(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has(`FocusAreasView`)||e===0)return;this.removeHandles(`FocusAreasView`);let t=(await this.updatingHandles.addPromise(this._importModule(`FocusAreasView`)))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){M(this.viewingMode)===1&&(this._clippingArea=null),this._initSurface(),this._set(`ready`,!0),this.addHandles(f(()=>this.graphics,`after-changes`,()=>this._ensureGraphicsView()),`GraphicsView3D`),this._ensureGraphicsView(),this.addHandles(this.updatingHandles.add(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),`FocusAreasView`);let e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?me(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentView.connectView(this),this.inputManager.connect();let n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this))}_teardown(){this.inputManager.disconnect(),this.environmentView.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set(`ready`,!1)}get _defaultToMapOptions(){let e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(U);for(let t of this.allLayerViews)(k(t.layer)&&(!has(`enable-feature:im-as-ground`)||t.layer.isUsedAsGroundLayer)||je(t.layer))&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){let e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(U);for(let t of this.allLayerViews)(has(`enable-feature:im-as-ground`)?k(t.layer)&&t.layer.isUsedAsGroundLayer:k(t.layer))&&t.fullOpacity<1&&e.exclude.add(t.uid);return e}static{this.type=`3d`}static clearStatics(){Mt(),ge(),ue(),St(),Xe(),Ve(),Se(),wt(),Ne(),_t(),xt(),Ze(),$e(),ve(),se(),bt(),gt(),Ke.cleanupI3SLodHandling(),Me.cleanupTilemapCache(),I.cleanupViewstate(),V.cleanupTerrainSurface()}};e([_({nonNullable:!0}),v(Pt)],Y.prototype,`options`,void 0),e([_()],Y.prototype,`_userClippingArea`,void 0),e([_()],Y.prototype,`_resourceController`,void 0),e([_()],Y.prototype,`stage`,null),e([_({readOnly:!0})],Y.prototype,`deconflictor`,void 0),e([_({readOnly:!0})],Y.prototype,`labeler`,void 0),e([_()],Y.prototype,`navigation`,void 0),e([_({type:Re,readOnly:!0})],Y.prototype,`animation`,null),e([_({readOnly:!0})],Y.prototype,`basemapTerrain`,void 0),e([_({readOnly:!0})],Y.prototype,`overlayManager`,null),e([_({readOnly:!0})],Y.prototype,`elevationProvider`,void 0),e([_()],Y.prototype,`camera`,null),e([_({type:t})],Y.prototype,`contentCamera`,null),e([_({readOnly:!0})],Y.prototype,`canvas`,null),e([_({type:S,useTypeForAutocast:!1})],Y.prototype,`center`,null),e([_({type:x})],Y.prototype,`clippingArea`,null),e([_({type:P,nonNullable:!0})],Y.prototype,`constraints`,void 0),e([_({type:x,readOnly:!0})],Y.prototype,`renderDataExtent`,null),e([_({readOnly:!0})],Y.prototype,`tileInfo`,null),e([_({type:x,readOnly:!0})],Y.prototype,`dataExtent`,null),e([_({type:x,readOnly:!0})],Y.prototype,`_groundAndLayersExtent`,null),e([_({type:F})],Y.prototype,`environment`,null),e([v(`environment`)],Y.prototype,`castEnvironment`,null),e([_({readOnly:!0})],Y.prototype,`environmentView`,void 0),e([_({type:x})],Y.prototype,`extent`,null),e([_({type:r})],Y.prototype,`floors`,void 0),e([_()],Y.prototype,`screenCenter`,null),e([_()],Y.prototype,`frustum`,null),e([_({type:Number,readOnly:!0})],Y.prototype,`fullOpacity`,void 0),e([_({readOnly:!0})],Y.prototype,`graphicsView`,void 0),e([_()],Y.prototype,`analysisViewManager`,void 0),e([_()],Y.prototype,`groundView`,void 0),e([_({readOnly:!0})],Y.prototype,`layerviewCollections`,null),e([_({type:Boolean})],Y.prototype,`initialExtentRequired`,null),e([_()],Y.prototype,`defaultsFromMapSettings`,null),e([_()],Y.prototype,`interacting`,null),e([_()],Y.prototype,`stationary`,null),e([_()],Y.prototype,`navigating`,null),e([_()],Y.prototype,`map`,void 0),e([_()],Y.prototype,`padding`,null),e([_({type:B,readOnly:!0})],Y.prototype,`pointsOfInterest`,void 0),e([_()],Y.prototype,`_featureTiles`,void 0),e([_()],Y.prototype,`featureTiles`,null),e([_()],Y.prototype,`_featureTreeDebugger`,void 0),e([_({constructOnly:!0})],Y.prototype,`deactivatedWebGLExtensions`,void 0),e([_({constructOnly:!0})],Y.prototype,`debugWebGLExtensions`,void 0),e([_({constructOnly:!0})],Y.prototype,`renderCanvas`,void 0),e([_({constructOnly:!0})],Y.prototype,`state`,void 0),e([_()],Y.prototype,`screenSizePerspective`,void 0),e([_({readOnly:!0})],Y.prototype,`inputManager`,void 0),e([_({readOnly:!0})],Y.prototype,`stateManager`,void 0),e([_({type:[`low`,`medium`,`high`]})],Y.prototype,`qualityProfile`,null),e([_({type:z,get(){let e=this._get(`qualitySettings`);if(!e){let t=R(this.qualityProfile);e=new z(t)}return e}})],Y.prototype,`qualitySettings`,void 0),e([_()],Y.prototype,`slice`,void 0),e([_({readOnly:!0})],Y.prototype,`typeSpecificPreconditionsReady`,null),e([_({readOnly:!0})],Y.prototype,`renderCoordsHelper`,void 0),e([_({readOnly:!0})],Y.prototype,`sceneIntersectionHelper`,void 0),e([_({type:Number,readOnly:!0})],Y.prototype,`resolution`,null),e([_({type:Number})],Y.prototype,`scale`,null),e([_({readOnly:!0,type:Number})],Y.prototype,`terrainLevel`,null),e([_()],Y.prototype,`heightModelInfo`,null),e([_({type:w})],Y.prototype,`spatialReference`,void 0),e([_({type:Boolean,value:!1})],Y.prototype,`alphaCompositingEnabled`,null),e([_({constructOnly:!0})],Y.prototype,`preserveDrawingBufferEnabled`,void 0),e([_({type:Boolean})],Y.prototype,`supersampleScreenshotsEnabled`,void 0),e([_({readOnly:!0})],Y.prototype,`type`,void 0),e([_(),v(e=>e instanceof kt?e:b(At,e))],Y.prototype,`ui`,void 0),e([_({type:Boolean,readOnly:!0})],Y.prototype,`updating`,null),e([_()],Y.prototype,`_updatingObjects`,null),e([_()],Y.prototype,`_updatingObjectsWithProgress`,null),e([_()],Y.prototype,`_updatingObjectsToDebug`,null),e([_({type:Number,readOnly:!0})],Y.prototype,`updatingProgress`,void 0),e([_({type:[`global`,`local`]})],Y.prototype,`viewingMode`,null),e([_({type:n})],Y.prototype,`viewpoint`,null),e([_({readOnly:!0})],Y.prototype,`visibleArea`,null),e([_({type:Number})],Y.prototype,`zoom`,null),e([_({readOnly:!0})],Y.prototype,`quality`,null),e([_({readOnly:!0})],Y.prototype,`resolutionScale`,null),e([_()],Y.prototype,`focusAreasView`,void 0),e([_()],Y.prototype,`_defaultToMapOptions`,null),e([_()],Y.prototype,`_defaultHitTestOptions`,null),Y=q=e([pe(`esri.views.SceneView`)],Y);function X(e,t){return e!=null&&xe(e.spatialReference,t)?C(e,t):null}const Z=_e(),Q=le(),$=Te(),Ft=Ae(0,0,0,w.WebMercator),It={GraphicsView3D:()=>import(`./3d/layers/GraphicsView3D.js`),FocusAreasView:()=>import(`./3d/FocusAreasView.js`),FeatureTileTree3D:()=>import(`./3d/layers/support/FeatureTileTree3D.js`)},Lt=Y;export{Lt as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../core/Accessor.js";import{clock as n}from"../core/clock.js";import r from"../core/Collection.js";import"../core/has.js";import i from"../core/Logger.js";import{removeMaybe as a}from"../core/maybe.js";import{watch as o}from"../core/reactiveUtils.js";import{property as s,subclass as c}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../core/support/UpdatingHandles.js";import{ViewEventPriorities as u}from"./input/InputManager.js";import{eventTypes as d}from"./input/ViewEvents.js";import{getToolCollectionHandles as f,areToolManipulatorsEditable as p,isCancelEvent as m}from"./interactive/interactiveToolUtils.js";import{ToolViewManagerManipulatorState as h}from"./interactive/ToolViewManagerManipulatorState.js";const g=`attached`,_=`tools`,v=1e3;let y=class extends t{constructor(e){super(e),this._updatingHandles=new l,this._clock=n,this._manipulatorState=new h,this.tools=new r,this._interacting=!1,this._interactingTimeout=v,this._interactingTimeoutHandle=null}initialize(){this.addHandles([this.view.on(d,e=>{this._handleInputEvent(e)},u.TOOL),...f(this.tools),this.tools.on(`before-add`,({item:e})=>{this._updateToolEditableFlag(e)}),this.tools.on(`before-remove`,({item:e})=>{this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs)}),this.tools.on(`change`,()=>{this._refreshToolWatchers()})])}destroy(){this.activeTool=null,this.tools.drain(e=>e.destroy()),this._clearInteractingTimeout(),this._interacting=!1,this._updatingHandles.destroy(),this._manipulatorState.destroy()}get _manipulatorStateEventArgs(){return{tools:this.tools,activeTool:this.activeTool,setActiveTool:e=>{this.activeTool=e},view:this.view,multiTouchActive:this.view.inputManager?.multiTouchActive}}set activeTool(e){if(e!=null&&!this.view.ready){i.getLogger(this).error(`Cannot set active tool while view is not ready.`);return}if(e===this.activeTool)return;let t=this.activeTool;this._set(`activeTool`,e),t?.deactivate(),e?.activate(),this._removeIncompleteTools(e);for(let e of this.tools){this._updateToolEditableFlag(e);let t=p(e);(this.activeTool==null||!t)&&this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs,!t)}}get cursor(){let e=this._manipulatorState.cursor;if(e!=null)return e;for(let e of this.tools)if(e.visible&&e.cursor!=null)return e.cursor;return null}get updating(){return this._updatingHandles.updating||this.tools.some(e=>e.updating)}get interacting(){return this._interacting}_clearInteractingTimeout(){this._interactingTimeoutHandle=a(this._interactingTimeoutHandle)}_startInteractingTimeout(){this._clearInteractingTimeout(),this._interactingTimeoutHandle=this._clock.setTimeout(()=>this._interacting=!1,this._interactingTimeout)}attach(){this.view.type===`3d`?this.addHandles([o(()=>{let{state:e}=this.view;return`camera`in e&&e.camera},()=>this._forEachManipulator(e=>e.onViewChange())),this.view.elevationProvider.on(`elevation-change`,e=>this._forEachManipulator(t=>t.onElevationChange(e)))],g):this.addHandles(o(()=>this.view.extent,()=>this._forEachManipulator(e=>e.onViewChange())))}detach(){this.activeTool=null,this.tools.removeAll(),this.removeHandles(g),this._clearInteractingTimeout(),this._interacting=!1}_forEachManipulator(e){for(let t of this.tools)t.manipulators&&t.manipulators.forEach(({manipulator:n})=>e(n,t))}_handleInputEvent(e){let t=!1;m(e)&&this.activeTool&&e.preventDefault();let n={...e,stopPropagation:()=>{t=!0,e.stopPropagation()}};if(this.activeTool!=null)this.activeTool.handleInputEvent&&this.activeTool.handleInputEvent(n);else for(let e of this.tools)!t&&e.visible&&e.handleInputEvent(n);!t&&m(e)&&this.activeTool&&(e.stopPropagation(),this.activeTool.cancel(),this.activeTool=null),this._manipulatorState.handleInputEvent(n,this._manipulatorStateEventArgs),!t&&this.activeTool!=null&&this.activeTool.handleInputEventAfter(n),this._manipulatorState.handleHoverEvent(n,this.tools),e.type===`pointer-move`&&(this._manipulatorState.hasFocusedManipulators||this.activeTool)&&(this._interacting=!0,this._startInteractingTimeout())}_refreshToolWatchers(){this.removeHandles(_);for(let e of this.tools){if(e instanceof t){let t=o(()=>[e.cursor,e.visible,e.editable],()=>{p(e)||this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs)});this.addHandles(t,_)}e.manipulators&&this.addHandles([e.manipulators.on(`after-remove`,t=>{this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs,!0,t.item.manipulator)}),e.manipulators.on(`change`,()=>{this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)})],_)}this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)}_updateToolEditableFlag(e){e.setEditableFlag?.(1,this.activeTool==null||e===this.activeTool)}_removeIncompleteTools(e){this.tools.filter(t=>(e==null||t!==e)&&!t.created&&t.removeIncompleteOnCancel).forEach(e=>{this.tools.remove(e)})}get test(){if(process.env.NODE_ENV!==`test`)return;let e=this;return{setClock:e=>this._clock=e,set interactingTimeoutEnabled(t){e._interactingTimeout=t?v:0},get interactingTimeoutEnabled(){return e._interactingTimeout!==0}}}};e([s({constructOnly:!0,nonNullable:!0})],y.prototype,`view`,void 0),e([s({value:null})],y.prototype,`activeTool`,null),e([s({readOnly:!0,type:r})],y.prototype,`tools`,void 0),e([s()],y.prototype,`cursor`,null),e([s({readOnly:!0})],y.prototype,`updating`,null),e([s()],y.prototype,`_interacting`,void 0),e([s({readOnly:!0})],y.prototype,`interacting`,null),y=e([c(`esri.views.ToolViewManager`)],y);export{y as ToolViewManager,v as interactingTimeout};
2
+ import{__decorate as e}from"tslib";import t from"../core/Accessor.js";import{clock as n}from"../core/clock.js";import r from"../core/Collection.js";import"../core/has.js";import i from"../core/Logger.js";import{removeMaybe as a}from"../core/maybe.js";import{watch as o}from"../core/reactiveUtils.js";import{property as s,subclass as c}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../core/support/UpdatingHandles.js";import{ViewEventPriorities as u}from"./input/InputManager.js";import{eventTypes as d}from"./input/ViewEvents.js";import{getToolCollectionHandles as f,areToolManipulatorsEditable as p,isCancelEvent as m}from"./interactive/interactiveToolUtils.js";import{ToolViewManagerManipulatorState as h}from"./interactive/ToolViewManagerManipulatorState.js";const g=`attached`,_=`tools`,v=1e3;let y=class extends t{constructor(e){super(e),this._updatingHandles=new l,this._clock=n,this._manipulatorState=new h,this.tools=new r,this._interacting=!1,this._interactingTimeout=v,this._interactingTimeoutHandle=null}initialize(){this.addHandles([this.view.on(d,e=>{this._handleInputEvent(e)},u.TOOL),...f(this.tools),this.tools.on(`before-add`,({item:e})=>{this._updateToolEditableFlag(e)}),this.tools.on(`before-remove`,({item:e})=>{this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs)}),this.tools.on(`change`,()=>{this._refreshToolWatchers()})])}destroy(){this.activeTool=null,this.tools.drain(e=>e.destroy()),this._clearInteractingTimeout(),this._interacting=!1,this._updatingHandles.destroy(),this._manipulatorState.destroy()}get _manipulatorStateEventArgs(){return{tools:this.tools,activeTool:this.activeTool,setActiveTool:e=>{this.activeTool=e},view:this.view,multiTouchActive:this.view.inputManager?.multiTouchActive}}set activeTool(e){if(e!=null&&!this.view.ready){i.getLogger(this).error(`Cannot set active tool while view is not ready.`);return}if(e===this.activeTool)return;let t=this.activeTool;this._set(`activeTool`,e),t?.deactivate(),e?.activate(),this._removeIncompleteTools(e);for(let e of this.tools){this._updateToolEditableFlag(e);let t=p(e);this.activeTool!=null&&t||this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs,!t)}}get cursor(){let e=this._manipulatorState.cursor;if(e!=null)return e;for(let e of this.tools)if(e.visible&&e.cursor!=null)return e.cursor;return null}get updating(){return this._updatingHandles.updating||this.tools.some(e=>e.updating)}get interacting(){return this._interacting}_clearInteractingTimeout(){this._interactingTimeoutHandle=a(this._interactingTimeoutHandle)}_startInteractingTimeout(){this._clearInteractingTimeout(),this._interactingTimeoutHandle=this._clock.setTimeout(()=>this._interacting=!1,this._interactingTimeout)}attach(){this.view.type===`3d`?this.addHandles([o(()=>{let{state:e}=this.view;return`camera`in e&&e.camera},()=>this._forEachManipulator(e=>e.onViewChange())),this.view.elevationProvider.on(`elevation-change`,e=>this._forEachManipulator(t=>t.onElevationChange(e)))],g):this.addHandles(o(()=>this.view.extent,()=>this._forEachManipulator(e=>e.onViewChange())))}detach(){this.activeTool=null,this.tools.removeAll(),this.removeHandles(g),this._clearInteractingTimeout(),this._interacting=!1}_forEachManipulator(e){for(let t of this.tools)t.manipulators&&t.manipulators.forEach(({manipulator:n})=>e(n,t))}_handleInputEvent(e){let t=!1;m(e)&&this.activeTool&&e.preventDefault();let n={...e,stopPropagation:()=>{t=!0,e.stopPropagation()}};if(this.activeTool!=null)this.activeTool.handleInputEvent&&this.activeTool.handleInputEvent(n);else for(let e of this.tools)!t&&e.visible&&e.handleInputEvent(n);!t&&m(e)&&this.activeTool&&(e.stopPropagation(),this.activeTool.cancel(),this.activeTool=null),this._manipulatorState.handleInputEvent(n,this._manipulatorStateEventArgs),!t&&this.activeTool!=null&&this.activeTool.handleInputEventAfter(n),this._manipulatorState.handleHoverEvent(n,this.tools),e.type===`pointer-move`&&(this._manipulatorState.hasFocusedManipulators||this.activeTool)&&(this._interacting=!0,this._startInteractingTimeout())}_refreshToolWatchers(){this.removeHandles(_);for(let e of this.tools){if(e instanceof t){let t=o(()=>[e.cursor,e.visible,e.editable],()=>{p(e)||this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs)});this.addHandles(t,_)}e.manipulators&&this.addHandles([e.manipulators.on(`after-remove`,t=>{this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs,!0,t.item.manipulator)}),e.manipulators.on(`change`,()=>{this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)})],_)}this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)}_updateToolEditableFlag(e){e.setEditableFlag?.(1,this.activeTool==null||e===this.activeTool)}_removeIncompleteTools(e){this.tools.filter(t=>(e==null||t!==e)&&!t.created&&t.removeIncompleteOnCancel).forEach(e=>{this.tools.remove(e)})}get test(){if(process.env.NODE_ENV!==`test`)return;let e=this;return{setClock:e=>this._clock=e,set interactingTimeoutEnabled(t){e._interactingTimeout=t?v:0},get interactingTimeoutEnabled(){return e._interactingTimeout!==0}}}};e([s({constructOnly:!0,nonNullable:!0})],y.prototype,`view`,void 0),e([s({value:null})],y.prototype,`activeTool`,null),e([s({readOnly:!0,type:r})],y.prototype,`tools`,void 0),e([s()],y.prototype,`cursor`,null),e([s({readOnly:!0})],y.prototype,`updating`,null),e([s()],y.prototype,`_interacting`,void 0),e([s({readOnly:!0})],y.prototype,`interacting`,null),y=e([c(`esri.views.ToolViewManager`)],y);export{y as ToolViewManager,v as interactingTimeout};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../core/Evented.js";import{clone as n}from"../../core/lang.js";import{equalsMaybe as r,destroyMaybe as i}from"../../core/maybe.js";import{memoize as a}from"../../core/memoize.js";import{ignoreAbortErrors as o}from"../../core/promiseUtils.js";import s from"../../core/ReactiveSet.js";import{watch as c,syncAndInitial as l}from"../../core/reactiveUtils.js";import{createScreenPoint as u}from"../../core/screenUtils.js";import{property as d,subclass as f}from"../../core/accessorSupport/decorators.js";import{diff as p}from"../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import{pointEquals as h,pointNear as g}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as _}from"../../support/elevationInfoUtils.js";import{defaultDrawingMode as v}from"./drawingModes.js";import{LegacyDrawManipulator as y}from"./LegacyDrawManipulator.js";import{createCoordinateHelper as b}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as x,sceneSnappingAtLocation as S}from"../interactive/dragEventPipeline.js";import{EditGeometry as C,Part as w}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as T}from"../interactive/editGeometry/EditGeometryOperations.js";import{isPoint as E}from"../interactive/sketch/constraints.js";import{getPointConstraint as D,getPolylineOrPolygonConstraint as O,pointToConstraintSpace as k,constraintSpaceToPoint as A}from"../interactive/sketch/constraintUtils.js";import j from"../interactive/sketch/SketchLabelOptions.js";import{SnappingContext as M}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as N}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as P}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as F}from"../interactive/snapping/snappingUtils.js";const I=`crosshair`,L=`progress`,R=Symbol(),z=Symbol();let B=class extends t{constructor(e){super(e),this._createOperationCompleted=!1,this._hideDefaultCursor=!1,this._pointerDownStates=new s,this._stagedScreenPoint=null,this._stagedPointerType=null,this._updatingHandles=new m,this._stagedPointerId=null,this.constraintsEnabled=!1,this.constraints=void 0,this._getPointConstraint=a(D),this._getPolylineOrPolygonConstraint=a(O),this.constraintZ=null,this.defaultZ=null,this.isDraped=!0,this.labelOptions=new j,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.firstVertex=null,this.lastVertex=null,this.secondToLastVertex=null,e.elevationInfo??(this.elevationInfo=_(!!e.hasZ))}initializePointer(){let e=this.view.inputManager?.latestPointerInfo;e!=null&&e.type!==`touch`&&this._updatePointer(e.location,e.id,e.type)}initialize(){let{geometryType:e,view:t}=this,n=t.spatialReference,i=`viewingMode`in t.state?t.state.viewingMode:2,a=e===`segment`||e===`multipoint`?`polyline`:e;this.coordinateHelper=b(this.hasZ,this.hasM,n),this._editGeometryOperations=new T(new C(a,this.coordinateHelper),i),this._snappingOperation=new P({view:t}),this.addHandles([c(()=>({stagedPoint:this._snappingOperation.stagedPoint,constraint:this._constraint}),({stagedPoint:e,constraint:t},n)=>{let{snappingOptions:r}=this;if(r&&(r.forceDisabled=t!=null&&E(t)),n!=null&&e===n.stagedPoint&&t!==n.constraint)return this._onKeyboardBasedChange();this._processCursor(e??this._screenToMap(this._stagedScreenPoint))},{equals:(e,t)=>e.stagedPoint===t.stagedPoint&&r(e.constraint,t.constraint)}),c(()=>this.view.viewpoint,(e,t)=>{e&&t&&p(e,t)&&this._onKeyboardBasedChange()})]),this._activePart=new w(n,i),this._editGeometryOperations.data.parts.push(this._activePart);let s=this.segmentLabels;s!=null&&(s.context={view:t,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.addHandles(c(()=>this.labelOptions.enabled,e=>{s.visible=e},l))),this.addHandles(this._editGeometryOperations.on([`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),r=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getFirstVertex()?.pos)??null;h(r,this.firstVertex)||(this.firstVertex=r);let i=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getLastVertex()?.pos)??null;h(i,this.lastVertex)||(this.lastVertex=i);let a=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.segments.at(-1)?.leftVertex?.pos)??null;switch(h(a,this.secondToLastVertex)||(this.secondToLastVertex=a),this._processCursor(this.cursorVertex),e.type){case`vertex-add`:this.emit(e.type,{...e,added:n,vertices:t});break;case`vertex-update`:this.emit(e.type,{...e,updated:n,vertices:t});break;case`vertex-remove`:this.emit(e.type,{...e,removed:n,vertices:t})}}));let u=this._manipulator=new y({consumesClicks:!1,grabbableForEvent:e=>this.drawingMode!==`click`||e.pointerType===`touch`&&this._snappingEnabled&&this._pointerDownStates.size===1});this.manipulators.add(u),u.grabbable=e!==`point`&&e!==`multipoint`,this.addHandles([u.events.on(`immediate-click`,e=>this._onImmediateClick(e)),u.events.on(`immediate-double-click`,e=>this._onImmediateDoubleClick(e)),c(()=>this.drawingMode,()=>{this.removeHandles(R),this.addHandles(this._createManipulatorDragPipeline(u),R)},l),c(()=>({effectiveCursor:this.effectiveCursor}),({effectiveCursor:e})=>{u.cursor=e},l)]),F(this,()=>{let e=this.view.inputManager.latestPointerInfo?.type??`mouse`,t=this._getSnappingContext(e);if(this.snappingManager!=null){let e=this._snappingOperation.snapAgainNearPreviousMapPoint(this.snappingManager,t);this._updatingHandles.consumePromise(o(e))}})}destroy(){i(this.segmentLabels),i(this._snappingOperation),this._editGeometryOperations=i(this._editGeometryOperations),this._updatingHandles.destroy()}get _isDragging(){let{_stagedPointerId:e,_manipulator:t}=this;return e!=null&&this._pointerDownStates.has(e)||t.grabbing||!t.interactive}get _snappingEnabled(){return this.snappingManager!=null&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){let e=this._updateAndGetEffectiveDrawSurface();return this.view.type===`3d`&&this.drawSurface!==e}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activePart.vertices.map(e=>this.coordinateHelper.vectorToArray(e.pos))}get _constraint(){let{constraints:e,constraintsEnabled:t}=this;if(e&&t)switch(this.geometryType){case`point`:case`multipoint`:return this._getPointConstraint(e);case`polygon`:case`polyline`:return this._getPolylineOrPolygonConstraint(this.lastVertex,this.secondToLastVertex,e)}}set drawingMode(e){this._set(`drawingMode`,e??v)}get effectiveCursor(){return this.loading?L:this._hideDefaultCursor?null:this.cursor||I}get interactive(){return this._manipulator.interactive}set interactive(e){this._manipulator.interactive=e}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activePart.vertices.length}get snappingOptions(){return this.snappingManager==null?null:this.snappingManager.options}get cursorVertex(){return this._get(`cursorVertex`)}get visualizationCursorVertex(){return this._stagedPointerType===`mouse`?this.cursorVertex:null}get committableVertex(){let{cursorVertex:e,lastVertex:t,firstVertex:n,geometryType:r}=this;return r===`polygon`&&g(e,n)||g(e,t)?null:e}get updating(){return this.loading||this._updatingHandles.updating||!!this.segmentLabels?.updating}get geometryIncludingUncommittedVertices(){let{committedVertices:e,committableVertex:t,coordinateHelper:n}=this,r=e.slice();return t!=null&&r.push(n.pointToArray(t)),r}cancel(){this.complete({aborted:!0})}commitStagedVertex(){this._snappingOperation.abort();let{committableVertex:e}=this;e!=null&&this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(e),this._activePart)}complete(e){let t=e?.aborted||!1;this._snappingOperation.abort(),this.snappingManager?.doneSnapping();let{geometryType:n,numCommittedVertices:r}=this,i=n===`multipoint`&&r===0||n===`polyline`&&r<2||n===`polygon`&&r<3;(n===`segment`||n===`point`)&&this.commitStagedVertex(),this._createOperationCompleted=!i,(this.isCompleted||t)&&(this._stagedScreenPoint=null,this._stagedPointerId=null,this._stagedPointerType=null,this._processCursor(null),this.emit(`complete`,{vertices:this.committedVertices.map((e,t)=>({componentIndex:0,vertexIndex:t,coordinates:e})),aborted:t,type:`complete`}))}onInputEvent(e){switch(e.type){case`pointer-down`:this._pointerDownStates.add(e.pointerId);break;case`pointer-up`:this._pointerDownStates.delete(e.pointerId)}switch(e.type){case`pointer-move`:return this._onPointerMove(e);case`hold`:return this._onHold(e)}}redo(){this._editGeometryOperations.redo()}undo(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_processCursor(e){let t=n(this.cursorVertex),r=n(e),i=r&&(this._updateAndGetEffectiveDrawSurface()?.constrainZ(r)??r),a=this._snapToClosingVertex(i),o=this._applyConstraints(a);g(t,o)||(this._set(`cursorVertex`,o),this.segmentLabels?.set(`stagedVertex`,o==null?null:this.coordinateHelper.pointToVector(o)),o==null||this._stagedPointerType!==`mouse`?this.emit(`cursor-remove`):this.emit(`cursor-update`,{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activePart.vertices.length,coordinates:this.coordinateHelper.pointToArray(o)}],operation:`apply`,type:`vertex-update`}))}_snapToClosingVertex(e){if(e==null||this._isDragging||this.geometryType!==`polygon`||this.numCommittedVertices<=2)return e;let t=this._mapToScreen(e);if(!t)return e;let n=this._activePart;return this._vertexWithinPointerDistance(n.vertices[0].pos,t)?this.firstVertex:this._vertexWithinPointerDistance(n.vertices.at(-1).pos,t)?this.lastVertex:e}_createManipulatorDragPipeline(e){switch(this.drawingMode){case`click`:return this._createManipulatorDragPipelineClick(e);case`freehand`:return this._createManipulatorDragPipelineFreehand(e);case`hybrid`:return this._createManipulatorDragPipelineHybrid(e)}}_createManipulatorDragPipelineClick(e){return x(e,(e,t,n,r)=>{let i=r===`touch`&&this._snappingEnabled;if(this.isCompleted||!i)return;let{snappingStep:a,cancelSnapping:o}=N({predicate:()=>i,snappingManager:this.snappingManager,snappingContext:new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,feature:this.graphic,pointer:r,visualizer:this.snappingVisualizer,drawConstraints:this.constraints}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});n.next(e=>(i&&this.snappingManager!=null&&this.snappingManager.doneSnapping(),e)).next(o),t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._processCursor(e.mapStart),(this.geometryType===`segment`||i&&!this.numCommittedVertices)&&this.commitStagedVertex()),e)).next(S(this.view,this.elevationInfo)).next(...a).next(e=>(i&&(this._processCursor(e.mapEnd),e.action===`end`&&this.commitStagedVertex()),e)).next(e=>(e.action===`end`&&(this._stagedPointerType!==`mouse`&&this._snappingOperation.abort(),(this.geometryType===`segment`||this.geometryType===`point`)&&this.complete()),e))})}_createManipulatorDragPipelineFreehand(e){return x(e,(e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._snappingOperation.abort(),this.committableVertex??this._processCursor(e.mapStart),this.geometryType===`segment`&&this.commitStagedVertex()),e)).next(e=>{switch(e.action){case`start`:case`update`:this._processCursor(e.mapEnd),(this.geometryType===`polygon`||this.geometryType===`polyline`)&&this.commitStagedVertex();break;case`end`:this.complete()}return e})})}_createManipulatorDragPipelineHybrid(e){return x(e,(e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._snappingOperation.abort(),this.addHandles(this._editGeometryOperations.createUndoGroup(),z),this._processCursor(e.mapStart),this.commitStagedVertex()),e)).next(e=>{switch(e.action){case`start`:case`update`:this._processCursor(e.mapEnd),(this.geometryType===`polygon`||this.geometryType===`polyline`)&&this.commitStagedVertex();break;case`end`:this._stagedPointerType!==`mouse`&&this._snappingOperation.abort(),this.removeHandles(z),(this.geometryType===`segment`||this.geometryType===`point`)&&this.complete()}return e})})}get _drawAtFixedElevation(){let{constraintsEnabled:e,constraintZ:t,geometryType:n,numCommittedVertices:r}=this;return e?t!=null||n===`segment`&&r>0:(n===`segment`||n===`polygon`)&&r>0}_updateAndGetEffectiveDrawSurface(){let{constraintsEnabled:e,coordinateHelper:t,drawSurface:n,elevationDrawSurface:r,snapToSceneEnabled:i}=this;if(r==null)return n;if(!this.hasZ)return r.defaultZ=null,r;let a=this.elevationInfo?.mode,o=this.defaultZ,s=e||a===`absolute-height`;return i!=null&&(s=i),a===`on-the-ground`&&(s=!1),this._drawAtFixedElevation&&(o=(e?this.constraintZ:null)??t.getZ(this._activePart.vertices[0].pos),s=!1),s?n:(r.defaultZ=o,r)}_mapToScreen(e){return this._updateAndGetEffectiveDrawSurface()?.mapToScreen(e)}_onHold(e){this._snappingOperation.abort(),this.drawingMode===`click`&&e.pointerType===`touch`&&this._snappingEnabled&&this._processCursor(e.mapPoint),e.stopPropagation()}_onImmediateClick(e){if(!(e.pointerType===`mouse`&&e.button===2||this._manipulator.dragging))try{let{drawingMode:t,geometryType:n}=this;this._stagedPointerType=e.pointerType,this._stagedScreenPoint=e.screenPoint;let r=this._screenToMap(e.screenPoint);if(r==null||r==null||t===`freehand`&&n!==`point`&&n!==`multipoint`)return;if((!this._snappingEnabled||this.cursorVertex==null)&&this._processCursor(r),this.committableVertex==null){this.complete();return}this.commitStagedVertex(),e.pointerType!==`mouse`&&this._processCursor(null),(t===`freehand`&&this.geometryType!==`multipoint`||n===`point`||n===`segment`&&this.numCommittedVertices===2||n===`segment`&&t===`hybrid`&&this.numCommittedVertices===1)&&this.complete()}finally{e.stopPropagation()}}_onImmediateDoubleClick(e){this._manipulator.dragging||this.geometryType===`point`||(this.complete(),e.stopPropagation())}_onPointerMove(e){let t=u(e.x,e.y);this._updatePointer(t,e.pointerId,e.pointerType)&&e.stopPropagation()}_updatePointer(e,t,n){return this._stagedScreenPoint=e,this._stagedPointerType=n,this._stagedPointerId=t,this._isDragging?(this._snappingOperation.abort(),!1):(this._processCursorMovementRelativeToSurface(e,n),!0)}_onKeyboardBasedChange(){this._stagedPointerType!==`mouse`||!this._stagedScreenPoint||this._stagedPointerId==null||this._isDragging?this._snappingOperation.abort():this._processCursorMovementRelativeToSurface(this._stagedScreenPoint,this._stagedPointerType)}_processCursorMovementRelativeToSurface(e,t){let n=this._snappingOperation,r=this._screenToMap(e),i=this._requiresScenePoint?this.drawSurface?.screenToMap(e):null;if(r==null){this._hideDefaultCursor=!0,this._processCursor(null),n.abort();return}this._hideDefaultCursor=!1;let a=this.snappingManager;if(a==null){this._processCursor(r),n.abort();return}let s=this._getSnappingContext(t);this._updatingHandles.consumePromise(o(n.snap({point:r,scenePoint:i},a,s)))}_applyConstraints(e){let{_constraint:t,constraints:n}=this;if(!e||!n||!t)return e;let{context:r}=n,i=k(e,r),a=i?t.closestTo(i):void 0;if(!a)return e;let o=A(a,e,r),s=this.view.type===`2d`||r.elevationInfo.mode!==`absolute-height`;return o!=null&&s&&this.constraintZ!=null&&this.hasZ&&(o.z=this.constraintZ),o}_screenToMap(e){return e?this._updateAndGetEffectiveDrawSurface()?.screenToMap(e):null}_screenToMapDragEventStep(){let e=null;return t=>{if(t.action===`start`&&(e=this._screenToMap(t.screenStart)),e==null)return null;let n=this._screenToMap(t.screenEnd);return n==null?null:{...t,mapStart:e,mapEnd:n}}}_vertexWithinPointerDistance(e,t){let n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(e));return n!=null&&V(n,t,25)}_getSnappingContext(e){let t=this._drawAtFixedElevation?this.elevationDrawSurface?.defaultZ:null;return new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:e,feature:this.graphic,visualizer:this.snappingVisualizer,selfSnappingZ:t==null?null:{value:t,elevationInfo:this.elevationInfo},drawConstraints:this.constraints})}};e([d()],B.prototype,`_hideDefaultCursor`,void 0),e([d()],B.prototype,`_stagedPointerId`,void 0),e([d()],B.prototype,`_isDragging`,null),e([d()],B.prototype,`_snappingOperation`,void 0),e([d()],B.prototype,`_snappingEnabled`,null),e([d({constructOnly:!0})],B.prototype,`graphic`,void 0),e([d()],B.prototype,`constraintsEnabled`,void 0),e([d()],B.prototype,`constraints`,void 0),e([d()],B.prototype,`_constraint`,null),e([d()],B.prototype,`constraintZ`,void 0),e([d()],B.prototype,`defaultZ`,void 0),e([d()],B.prototype,`isDraped`,void 0),e([d({value:v})],B.prototype,`drawingMode`,null),e([d({constructOnly:!0})],B.prototype,`elevationDrawSurface`,void 0),e([d({constructOnly:!0})],B.prototype,`elevationInfo`,void 0),e([d({constructOnly:!0,type:j})],B.prototype,`labelOptions`,void 0),e([d({constructOnly:!0})],B.prototype,`geometryType`,void 0),e([d({constructOnly:!0})],B.prototype,`hasM`,void 0),e([d({constructOnly:!0})],B.prototype,`hasZ`,void 0),e([d()],B.prototype,`cursor`,void 0),e([d()],B.prototype,`effectiveCursor`,null),e([d()],B.prototype,`loading`,void 0),e([d({constructOnly:!0})],B.prototype,`manipulators`,void 0),e([d({constructOnly:!0})],B.prototype,`drawSurface`,void 0),e([d({constructOnly:!0})],B.prototype,`segmentLabels`,void 0),e([d({constructOnly:!0})],B.prototype,`snappingManager`,void 0),e([d({constructOnly:!0})],B.prototype,`snappingVisualizer`,void 0),e([d()],B.prototype,`snapToSceneEnabled`,void 0),e([d({readOnly:!0})],B.prototype,`cursorVertex`,null),e([d({readOnly:!0})],B.prototype,`visualizationCursorVertex`,null),e([d()],B.prototype,`committableVertex`,null),e([d()],B.prototype,`firstVertex`,void 0),e([d()],B.prototype,`lastVertex`,void 0),e([d()],B.prototype,`secondToLastVertex`,void 0),e([d()],B.prototype,`updating`,null),e([d({constructOnly:!0})],B.prototype,`view`,void 0),B=e([f(`esri.views.draw.DrawOperation`)],B);function V(e,t,n){let r=e.x-t.x,i=e.y-t.y;return r*r+i*i<=n}export{B as DrawOperation,I as defaultCursor,L as defaultLoadingCursor};
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../core/Evented.js";import{clone as n}from"../../core/lang.js";import{equalsMaybe as r,destroyMaybe as i}from"../../core/maybe.js";import{memoize as a}from"../../core/memoize.js";import{ignoreAbortErrors as o}from"../../core/promiseUtils.js";import s from"../../core/ReactiveSet.js";import{watch as c,syncAndInitial as l}from"../../core/reactiveUtils.js";import{createScreenPoint as u}from"../../core/screenUtils.js";import{property as d,subclass as f}from"../../core/accessorSupport/decorators.js";import{diff as p}from"../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import{pointEquals as h,pointNear as g}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as _}from"../../support/elevationInfoUtils.js";import{defaultDrawingMode as v}from"./drawingModes.js";import{LegacyDrawManipulator as y}from"./LegacyDrawManipulator.js";import{createCoordinateHelper as b}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as x,sceneSnappingAtLocation as S}from"../interactive/dragEventPipeline.js";import{EditGeometry as C,Part as w}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as T}from"../interactive/editGeometry/EditGeometryOperations.js";import{isPoint as E}from"../interactive/sketch/constraints.js";import{getPointConstraint as D,getPolylineOrPolygonConstraint as O,pointToConstraintSpace as k,constraintSpaceToPoint as A}from"../interactive/sketch/constraintUtils.js";import j from"../interactive/sketch/SketchLabelOptions.js";import{SnappingContext as M}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as N}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as P}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as F}from"../interactive/snapping/snappingUtils.js";const I=`crosshair`,L=`progress`,R=Symbol(),z=Symbol();let B=class extends t{constructor(e){super(e),this._createOperationCompleted=!1,this._hideDefaultCursor=!1,this._pointerDownStates=new s,this._stagedScreenPoint=null,this._stagedPointerType=null,this._updatingHandles=new m,this._stagedPointerId=null,this.constraintsEnabled=!1,this.constraints=void 0,this._getPointConstraint=a(D),this._getPolylineOrPolygonConstraint=a(O),this.constraintZ=null,this.defaultZ=null,this.isDraped=!0,this.labelOptions=new j,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.firstVertex=null,this.lastVertex=null,this.secondToLastVertex=null,e.elevationInfo??(this.elevationInfo=_(!!e.hasZ))}initializePointer(){let e=this.view.inputManager?.latestPointerInfo;e!=null&&e.type!==`touch`&&this._updatePointer(e.location,e.id,e.type)}initialize(){let{geometryType:e,view:t}=this,n=t.spatialReference,i=`viewingMode`in t.state?t.state.viewingMode:2,a=e===`segment`||e===`multipoint`?`polyline`:e;this.coordinateHelper=b(this.hasZ,this.hasM,n),this._editGeometryOperations=new T(new C(a,this.coordinateHelper),i),this._snappingOperation=new P({view:t}),this.addHandles([c(()=>({stagedPoint:this._snappingOperation.stagedPoint,constraint:this._constraint}),({stagedPoint:e,constraint:t},n)=>{let{snappingOptions:r}=this;if(r&&(r.forceDisabled=t!=null&&E(t)),n!=null&&e===n.stagedPoint&&t!==n.constraint)return this._onKeyboardBasedChange();this._processCursor(e??this._screenToMap(this._stagedScreenPoint))},{equals:(e,t)=>e.stagedPoint===t.stagedPoint&&r(e.constraint,t.constraint)}),c(()=>this.view.viewpoint,(e,t)=>{e&&t&&p(e,t)&&this._onKeyboardBasedChange()})]),this._activePart=new w(n,i),this._editGeometryOperations.data.parts.push(this._activePart);let s=this.segmentLabels;s!=null&&(s.context={view:t,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.addHandles(c(()=>this.labelOptions.enabled,e=>{s.visible=e},l))),this.addHandles(this._editGeometryOperations.on([`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),r=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getFirstVertex()?.pos)??null;h(r,this.firstVertex)||(this.firstVertex=r);let i=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getLastVertex()?.pos)??null;h(i,this.lastVertex)||(this.lastVertex=i);let a=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.segments.at(-1)?.leftVertex?.pos)??null;switch(h(a,this.secondToLastVertex)||(this.secondToLastVertex=a),this._processCursor(this.cursorVertex),e.type){case`vertex-add`:this.emit(e.type,{...e,added:n,vertices:t});break;case`vertex-update`:this.emit(e.type,{...e,updated:n,vertices:t});break;case`vertex-remove`:this.emit(e.type,{...e,removed:n,vertices:t})}}));let u=this._manipulator=new y({consumesClicks:!1,grabbableForEvent:e=>this.drawingMode!==`click`||e.pointerType===`touch`&&this._snappingEnabled&&this._pointerDownStates.size===1});this.manipulators.add(u),u.grabbable=e!==`point`&&e!==`multipoint`,this.addHandles([u.events.on(`immediate-click`,e=>this._onImmediateClick(e)),u.events.on(`immediate-double-click`,e=>this._onImmediateDoubleClick(e)),c(()=>this.drawingMode,()=>{this.removeHandles(R),this.addHandles(this._createManipulatorDragPipeline(u),R)},l),c(()=>({effectiveCursor:this.effectiveCursor}),({effectiveCursor:e})=>{u.cursor=e},l)]),F(this,()=>{let e=this.view.inputManager.latestPointerInfo?.type??`mouse`,t=this._getSnappingContext(e);if(this.snappingManager!=null){let e=this._snappingOperation.snapAgainNearPreviousMapPoint(this.snappingManager,t);this._updatingHandles.consumePromise(o(e))}})}destroy(){i(this.segmentLabels),i(this._snappingOperation),this._editGeometryOperations=i(this._editGeometryOperations),this._updatingHandles.destroy()}get _isDragging(){let{_stagedPointerId:e,_manipulator:t}=this;return e!=null&&this._pointerDownStates.has(e)||t.grabbing||!t.interactive}get _snappingEnabled(){return this.snappingManager!=null&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){let e=this._updateAndGetEffectiveDrawSurface();return this.view.type===`3d`&&this.drawSurface!==e}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activePart.vertices.map(e=>this.coordinateHelper.vectorToArray(e.pos))}get _constraint(){let{constraints:e,constraintsEnabled:t}=this;if(e&&t)switch(this.geometryType){case`point`:case`multipoint`:return this._getPointConstraint(e);case`polygon`:case`polyline`:return this._getPolylineOrPolygonConstraint(this.lastVertex,this.secondToLastVertex,e)}}set drawingMode(e){this._set(`drawingMode`,e??v)}get effectiveCursor(){return this.loading?L:this._hideDefaultCursor?null:this.cursor||I}get interactive(){return this._manipulator.interactive}set interactive(e){this._manipulator.interactive=e}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activePart.vertices.length}get snappingOptions(){return this.snappingManager==null?null:this.snappingManager.options}get cursorVertex(){return this._get(`cursorVertex`)}get visualizationCursorVertex(){return this._stagedPointerType===`mouse`?this.cursorVertex:null}get committableVertex(){let{cursorVertex:e,lastVertex:t,firstVertex:n,geometryType:r}=this;return r===`polygon`&&g(e,n)||g(e,t)?null:e}get updating(){return this.loading||this._updatingHandles.updating||!!this.segmentLabels?.updating}get geometryIncludingUncommittedVertices(){let{committedVertices:e,committableVertex:t,coordinateHelper:n}=this,r=e.slice();return t!=null&&r.push(n.pointToArray(t)),r}cancel(){this.complete({aborted:!0})}commitStagedVertex(){this._snappingOperation.abort();let{committableVertex:e}=this;e!=null&&this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(e),this._activePart)}complete(e){let t=e?.aborted||!1;this._snappingOperation.abort(),this.snappingManager?.doneSnapping();let{geometryType:n,numCommittedVertices:r}=this,i=n===`multipoint`&&r===0||n===`polyline`&&r<2||n===`polygon`&&r<3;(n===`segment`||n===`point`)&&this.commitStagedVertex(),this._createOperationCompleted=!i,(this.isCompleted||t)&&(this._stagedScreenPoint=null,this._stagedPointerId=null,this._stagedPointerType=null,this._processCursor(null),this.emit(`complete`,{vertices:this.committedVertices.map((e,t)=>({componentIndex:0,vertexIndex:t,coordinates:e})),aborted:t,type:`complete`}))}onInputEvent(e){switch(e.type){case`pointer-down`:this._pointerDownStates.add(e.pointerId);break;case`pointer-up`:this._pointerDownStates.delete(e.pointerId)}switch(e.type){case`pointer-move`:return this._onPointerMove(e);case`hold`:return this._onHold(e)}}redo(){this._editGeometryOperations.redo()}undo(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_processCursor(e){let t=n(this.cursorVertex),r=n(e),i=r&&(this._updateAndGetEffectiveDrawSurface()?.constrainZ(r)??r),a=this._snapToClosingVertex(i),o=this._applyConstraints(a);g(t,o)||(this._set(`cursorVertex`,o),this.segmentLabels?.set(`stagedVertex`,o==null?null:this.coordinateHelper.pointToVector(o)),o==null||this._stagedPointerType!==`mouse`?this.emit(`cursor-remove`):this.emit(`cursor-update`,{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activePart.vertices.length,coordinates:this.coordinateHelper.pointToArray(o)}],operation:`apply`,type:`vertex-update`}))}_snapToClosingVertex(e){if(e==null||this._isDragging||this.geometryType!==`polygon`||this.numCommittedVertices<=2)return e;let t=this._mapToScreen(e);if(!t)return e;let n=this._activePart;return this._vertexWithinPointerDistance(n.vertices[0].pos,t)?this.firstVertex:this._vertexWithinPointerDistance(n.vertices.at(-1).pos,t)?this.lastVertex:e}_createManipulatorDragPipeline(e){switch(this.drawingMode){case`click`:return this._createManipulatorDragPipelineClick(e);case`freehand`:return this._createManipulatorDragPipelineFreehand(e);case`hybrid`:return this._createManipulatorDragPipelineHybrid(e)}}_createManipulatorDragPipelineClick(e){return x(e,(e,t,n,r)=>{let i=r===`touch`&&this._snappingEnabled;if(this.isCompleted||!i)return;let{snappingStep:a,cancelSnapping:o}=N({predicate:()=>i,snappingManager:this.snappingManager,snappingContext:new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,feature:this.graphic,pointer:r,visualizer:this.snappingVisualizer,drawConstraints:this.constraints}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});n.next(e=>(i&&this.snappingManager!=null&&this.snappingManager.doneSnapping(),e)).next(o),t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._processCursor(e.mapStart),(this.geometryType===`segment`||i&&!this.numCommittedVertices)&&this.commitStagedVertex()),e)).next(S(this.view,this.elevationInfo)).next(...a).next(e=>(i&&(this._processCursor(e.mapEnd),e.action===`end`&&this.commitStagedVertex()),e)).next(e=>(e.action===`end`&&(this._stagedPointerType!==`mouse`&&this._snappingOperation.abort(),(this.geometryType===`segment`||this.geometryType===`point`)&&this.complete()),e))})}_createManipulatorDragPipelineFreehand(e){return x(e,(e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._snappingOperation.abort(),this.committableVertex??this._processCursor(e.mapStart),this.geometryType===`segment`&&this.commitStagedVertex()),e)).next(e=>{switch(e.action){case`start`:case`update`:this._processCursor(e.mapEnd),(this.geometryType===`polygon`||this.geometryType===`polyline`)&&this.commitStagedVertex();break;case`end`:this.complete()}return e})})}_createManipulatorDragPipelineHybrid(e){return x(e,(e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._snappingOperation.abort(),this.addHandles(this._editGeometryOperations.createUndoGroup(),z),this._processCursor(e.mapStart),this.commitStagedVertex()),e)).next(e=>{switch(e.action){case`start`:case`update`:this._processCursor(e.mapEnd),(this.geometryType===`polygon`||this.geometryType===`polyline`)&&this.commitStagedVertex();break;case`end`:this._stagedPointerType!==`mouse`&&this._snappingOperation.abort(),this.removeHandles(z),(this.geometryType===`segment`||this.geometryType===`point`)&&this.complete()}return e})})}get _drawAtFixedElevation(){let{constraintsEnabled:e,constraintZ:t,geometryType:n,numCommittedVertices:r}=this;return e?t!=null||n===`segment`&&r>0:(n===`segment`||n===`polygon`)&&r>0}_updateAndGetEffectiveDrawSurface(){let{constraintsEnabled:e,coordinateHelper:t,drawSurface:n,elevationDrawSurface:r,snapToSceneEnabled:i}=this;if(r==null)return n;if(!this.hasZ)return r.defaultZ=null,r;let a=this.elevationInfo?.mode,o=this.defaultZ,s=e||a===`absolute-height`;return i!=null&&(s=i),a===`on-the-ground`&&(s=!1),this._drawAtFixedElevation&&(o=(e?this.constraintZ:null)??t.getZ(this._activePart.vertices[0].pos),s=!1),s?n:(r.defaultZ=o,r)}_mapToScreen(e){return this._updateAndGetEffectiveDrawSurface()?.mapToScreen(e)}_onHold(e){this._snappingOperation.abort(),this.drawingMode===`click`&&e.pointerType===`touch`&&this._snappingEnabled&&this._processCursor(e.mapPoint),e.stopPropagation()}_onImmediateClick(e){if(!(e.pointerType===`mouse`&&e.button===2||this._manipulator.dragging))try{let{drawingMode:t,geometryType:n}=this;this._stagedPointerType=e.pointerType,this._stagedScreenPoint=e.screenPoint;let r=this._screenToMap(e.screenPoint);if(r==null||r==null||t===`freehand`&&n!==`point`&&n!==`multipoint`)return;if(this._snappingEnabled&&this.cursorVertex!=null||this._processCursor(r),this.committableVertex==null){this.complete();return}this.commitStagedVertex(),e.pointerType!==`mouse`&&this._processCursor(null),(t===`freehand`&&this.geometryType!==`multipoint`||n===`point`||n===`segment`&&this.numCommittedVertices===2||n===`segment`&&t===`hybrid`&&this.numCommittedVertices===1)&&this.complete()}finally{e.stopPropagation()}}_onImmediateDoubleClick(e){this._manipulator.dragging||this.geometryType===`point`||(this.complete(),e.stopPropagation())}_onPointerMove(e){let t=u(e.x,e.y);this._updatePointer(t,e.pointerId,e.pointerType)&&e.stopPropagation()}_updatePointer(e,t,n){return this._stagedScreenPoint=e,this._stagedPointerType=n,this._stagedPointerId=t,this._isDragging?(this._snappingOperation.abort(),!1):(this._processCursorMovementRelativeToSurface(e,n),!0)}_onKeyboardBasedChange(){this._stagedPointerType!==`mouse`||!this._stagedScreenPoint||this._stagedPointerId==null||this._isDragging?this._snappingOperation.abort():this._processCursorMovementRelativeToSurface(this._stagedScreenPoint,this._stagedPointerType)}_processCursorMovementRelativeToSurface(e,t){let n=this._snappingOperation,r=this._screenToMap(e),i=this._requiresScenePoint?this.drawSurface?.screenToMap(e):null;if(r==null){this._hideDefaultCursor=!0,this._processCursor(null),n.abort();return}this._hideDefaultCursor=!1;let a=this.snappingManager;if(a==null){this._processCursor(r),n.abort();return}let s=this._getSnappingContext(t);this._updatingHandles.consumePromise(o(n.snap({point:r,scenePoint:i},a,s)))}_applyConstraints(e){let{_constraint:t,constraints:n}=this;if(!e||!n||!t)return e;let{context:r}=n,i=k(e,r),a=i?t.closestTo(i):void 0;if(!a)return e;let o=A(a,e,r),s=this.view.type===`2d`||r.elevationInfo.mode!==`absolute-height`;return o!=null&&s&&this.constraintZ!=null&&this.hasZ&&(o.z=this.constraintZ),o}_screenToMap(e){return e?this._updateAndGetEffectiveDrawSurface()?.screenToMap(e):null}_screenToMapDragEventStep(){let e=null;return t=>{if(t.action===`start`&&(e=this._screenToMap(t.screenStart)),e==null)return null;let n=this._screenToMap(t.screenEnd);return n==null?null:{...t,mapStart:e,mapEnd:n}}}_vertexWithinPointerDistance(e,t){let n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(e));return n!=null&&V(n,t,25)}_getSnappingContext(e){let t=this._drawAtFixedElevation?this.elevationDrawSurface?.defaultZ:null;return new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:e,feature:this.graphic,visualizer:this.snappingVisualizer,selfSnappingZ:t==null?null:{value:t,elevationInfo:this.elevationInfo},drawConstraints:this.constraints})}};e([d()],B.prototype,`_hideDefaultCursor`,void 0),e([d()],B.prototype,`_stagedPointerId`,void 0),e([d()],B.prototype,`_isDragging`,null),e([d()],B.prototype,`_snappingOperation`,void 0),e([d()],B.prototype,`_snappingEnabled`,null),e([d({constructOnly:!0})],B.prototype,`graphic`,void 0),e([d()],B.prototype,`constraintsEnabled`,void 0),e([d()],B.prototype,`constraints`,void 0),e([d()],B.prototype,`_constraint`,null),e([d()],B.prototype,`constraintZ`,void 0),e([d()],B.prototype,`defaultZ`,void 0),e([d()],B.prototype,`isDraped`,void 0),e([d({value:v})],B.prototype,`drawingMode`,null),e([d({constructOnly:!0})],B.prototype,`elevationDrawSurface`,void 0),e([d({constructOnly:!0})],B.prototype,`elevationInfo`,void 0),e([d({constructOnly:!0,type:j})],B.prototype,`labelOptions`,void 0),e([d({constructOnly:!0})],B.prototype,`geometryType`,void 0),e([d({constructOnly:!0})],B.prototype,`hasM`,void 0),e([d({constructOnly:!0})],B.prototype,`hasZ`,void 0),e([d()],B.prototype,`cursor`,void 0),e([d()],B.prototype,`effectiveCursor`,null),e([d()],B.prototype,`loading`,void 0),e([d({constructOnly:!0})],B.prototype,`manipulators`,void 0),e([d({constructOnly:!0})],B.prototype,`drawSurface`,void 0),e([d({constructOnly:!0})],B.prototype,`segmentLabels`,void 0),e([d({constructOnly:!0})],B.prototype,`snappingManager`,void 0),e([d({constructOnly:!0})],B.prototype,`snappingVisualizer`,void 0),e([d()],B.prototype,`snapToSceneEnabled`,void 0),e([d({readOnly:!0})],B.prototype,`cursorVertex`,null),e([d({readOnly:!0})],B.prototype,`visualizationCursorVertex`,null),e([d()],B.prototype,`committableVertex`,null),e([d()],B.prototype,`firstVertex`,void 0),e([d()],B.prototype,`lastVertex`,void 0),e([d()],B.prototype,`secondToLastVertex`,void 0),e([d()],B.prototype,`updating`,null),e([d({constructOnly:!0})],B.prototype,`view`,void 0),B=e([f(`esri.views.draw.DrawOperation`)],B);function V(e,t,n){let r=e.x-t.x,i=e.y-t.y;return r*r+i*i<=n}export{B as DrawOperation,I as defaultCursor,L as defaultLoadingCursor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{memoize as i}from"../../../core/memoize.js";import{ignoreAbortErrors as a}from"../../../core/promiseUtils.js";import{valueInUnit as o}from"../../../core/quantity.js";import{createScreenPoint as s}from"../../../core/screenUtils.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{fromArray as u,create as d}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as f}from"../../../core/libs/gl-matrix-2/math/vec2.js";import p from"../../../geometry/Point.js";import{pointEquals as m}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{makeDehydratedPoint as h}from"../../../layers/graphics/dehydratedPoint.js";import{getZFromVertexSnappingCandidates as g}from"./drawUtils.js";import{getPolylineOrPolygonConstraint as _,getPointConstraint as v,pointToConstraintSpace as y,constraintSpaceToPoint as b}from"../../interactive/sketch/constraintUtils.js";import{SnappingContext as x}from"../../interactive/snapping/SnappingContext.js";import{SnappingOperation as S}from"../../interactive/snapping/SnappingOperation.js";let C=class extends t{constructor(e){super(e),this._snappingOperation=null,this.role=`primary`,this.captureMode=`capture-always`,this.defaultCaptureMode=`capture-always`,this.snappingEnabled=!0,this.selfSnappingEnabled=!0,this.editSession=null,this.outputMapPositionOfDragStart=null,this.selectedSnappingResult=null,this.screenPosition=null,this.inputMapPosition=null,this.drawToolDragging=!1,this.manipulatorDragging=!1,this.activePointerId=null,this.activePointerType=null,this._getSnappingContext=i((e,t,n,r,i,a)=>n?new x({elevationInfo:r,pointer:e,vertexHandle:t,editGeometryOperations:n,visualizer:i,suppressSelfSnapping:!a}):null)}destroy(){this._snappingOperation=r(this._snappingOperation)}get grabbable(){return this.captureMode===`grabbable-object`}get following(){let{captureMode:e}=this;return e===`capture-always`||e===`capture-when-engaged`}get outputMapPosition(){return this._get(`outputMapPosition`)}set outputMapPosition(e){let t=this._get(`outputMapPosition`);e&&t&&m(e,t)||this._set(`outputMapPosition`,e)}get dragging(){return this.drawToolDragging||this.manipulatorDragging}get firstPointZ(){let e=this.editSession?.lastPointAddedBySession;if(!e)return null;let t=this.editSession?.getInformationAboutPoint(0,e.partIndex);return t?.point.hasZ?t.point.z:null}async moveTo(e,t){let{snappingManager:n,skipSnapping:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t;this.notePointerActivity(t.pointerId,o);let l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t);e&&(this.screenPosition=e);let d=this.screenPosition;if(!d)return null;let f=this.firstPointZ,g=i?.screenToMap(d,{firstPointZ:f});if(this.inputMapPosition=g,this.selectedSnappingResult=null,!n||!g||!l||r||!this.snappingEnabled)return this.selectedSnappingResult=void 0,this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,g,t);let _=h(g.x,g.y,g.z,g?.spatialReference),v=i?.screenToScene?.(d,{firstPointZ:f}),y=u.snap({point:_,scenePoint:v},n,l),b=()=>{let e=u.stagedPoint;return m(this.selectedSnappingResult,e)||(this.selectedSnappingResult=e==null?null:new p({...e})),this.outputMapPosition=this._finalizeSnappingAndConstraintResult(this.selectedSnappingResult,g,t)};return b(),a(y.then(b))}async moveDeltaRelativeToScreen(e,t,n){let{inputMapPosition:r,screenPosition:i,firstPointZ:a}=this;if(!r)return null;let o=n.surfaceManager?n.surfaceManager.mapToScreen(r,{firstPointZ:a}):i;if(!o)return null;let c=s(o.x+e,o.y+t);return this.moveTo(c,n)}async noteDragStart(e,t){if(this.notePointerDown(t.pointerId,t.pointerType),this.drawToolDragging=!0,t.skipSnapping||!this.snappingEnabled)return null;let{snappingManager:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t,l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t),d=this.firstPointZ,f=i?.screenToMap(e,{firstPointZ:d});if(this.outputMapPositionOfDragStart=null,r&&l&&f){let o=u.snap({point:h(f.x,f.y,f.z,f?.spatialReference),scenePoint:i?.screenToScene?.(e,{firstPointZ:d})},r,l);return a(o.then(()=>{let e=u.stagedPoint?new p({...u.stagedPoint}):null;return this.outputMapPositionOfDragStart=this._finalizeSnappingAndConstraintResult(e,f,t)})).catch(e=>(n.getLogger(this).error(`drawtool:handle:snapping-failed`,e),null))}return this.outputMapPositionOfDragStart=f,null}async noteDragEnd(e,t){return this.moveTo(e,t).finally(()=>{this.drawToolDragging=!1,this.notePointerUp(t.pointerId,t.pointerType)})}notePointerActivity(e=null,t=null){t&&(this.activePointerType=t),e!=null&&this.dragging&&(this.activePointerId=e)}notePointerDown(e=null,t=null){e!=null&&(this.activePointerId=e),t&&(this.activePointerType=t)}notePointerUp(e=null,t=null){(e==null||this.activePointerId==null||this.activePointerId===e)&&(this.activePointerId=null),t&&this.activePointerType===t&&(this.activePointerType=null)}async moveDeltaRelativeToSketchSegment(e,t){let n=this.editSession?.endVertex?.leftSegment?.leftVertex?.pos,{firstPointZ:r}=this,i=this.inputMapPosition?t.surfaceManager?.mapToScreen(this.inputMapPosition,{firstPointZ:r})??this.screenPosition:this.screenPosition;if(!n||!i)return null;let a=t.editGeometryOperations?.data?.coordinateHelper.vectorToPoint(n);if(!a)return null;let o=t.surfaceManager?.mapToScreen(a,{firstPointZ:r});if(!o)return null;let s=[i.x-o.x,i.y-o.y],c=f(d(),u(s)),[l,p]=[c[0]*e,c[1]*e];return this.moveDeltaRelativeToScreen(l,p,t)}refreshConstraint(e){let t=this.outputMapPosition??this.inputMapPosition;return this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,t,e)}_finalizeSnappingAndConstraintResult(e,t,n){let r=e??t;r&&n.view.type===`2d`&&(r.z=g(n.snappingManager)??r.z);let i=(r?n.surfaceManager?.constrainZToEffectiveSurface?.(r):null)??r;return this._ensureZ(this._applyTooltipConstraints(i,n),n)}_applyTooltipConstraints(e,t){let n=e,r=t.tooltipManager?.getConstraints(this);if(!r&&!t.interactiveHandleManager?.customConstraints||!n)return n;let i=t.interactiveHandleManager?.customConstraints,a=t.editGeometryOperations?.data?.coordinateHelper;if(!a)return n;if(i&&this.editSession&&n){let e={handle:this,editSession:this.editSession,toScreen:e=>t.surfaceManager?.mapToScreen(e,{firstPointZ:this.firstPointZ})??null};for(let t of i)n=t(n,e)||n}let s=(this.editSession?.endVertex)?.leftSegment?.leftVertex,c=s?.leftSegment?.leftVertex,l=s&&a.vectorToPoint(s.pos),u=c&&a.vectorToPoint(c.pos);if(!r)return n;let d=(l||u)&&this.role===`primary`?_(l,u,r):v(r);if(!n||!r||!d)return n;let{context:f}=r,m=y(n,f),h=m?d.closestTo(m):void 0;if(!h)return n;let g=b(h,n,f),x=t.surfaceManager?.view?.type===`2d`||f.elevationInfo.mode!==`absolute-height`,S=r.elevation,{hasZ:C,metersPerVerticalUnit:w}=t.surfaceManager??{};return g!=null&&x&&S!=null&&C&&w&&(g.z=o(S,`meters`)/w),g?new p({x:g.x,y:g.y,z:g.z,hasM:g.hasM,hasZ:g.hasZ,m:g.m,spatialReference:g.spatialReference}):null}_ensureZ(e,t){return!e||!t.hasZ||(e.z==null||!e.hasZ)&&(e.z=t.defaultZ??0,e.hasZ=!0),e}_ensureSnappingOperation({view:e}){return this._snappingOperation??=new S({view:e})}};e([c()],C.prototype,`_snappingOperation`,void 0),e([c()],C.prototype,`role`,void 0),e([c()],C.prototype,`name`,void 0),e([c()],C.prototype,`captureMode`,void 0),e([c()],C.prototype,`defaultCaptureMode`,void 0),e([c()],C.prototype,`grabbable`,null),e([c()],C.prototype,`following`,null),e([c()],C.prototype,`snappingEnabled`,void 0),e([c()],C.prototype,`selfSnappingEnabled`,void 0),e([c()],C.prototype,`editSession`,void 0),e([c()],C.prototype,`outputMapPosition`,null),e([c()],C.prototype,`outputMapPositionOfDragStart`,void 0),e([c()],C.prototype,`selectedSnappingResult`,void 0),e([c()],C.prototype,`screenPosition`,void 0),e([c()],C.prototype,`inputMapPosition`,void 0),e([c()],C.prototype,`dragging`,null),e([c()],C.prototype,`drawToolDragging`,void 0),e([c()],C.prototype,`manipulatorDragging`,void 0),e([c()],C.prototype,`activePointerId`,void 0),e([c()],C.prototype,`activePointerType`,void 0),e([c({readOnly:!0})],C.prototype,`firstPointZ`,null),C=e([l(`esri.views.draw.support.InteractiveHandle`)],C);export{C as InteractiveHandle};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{memoize as i}from"../../../core/memoize.js";import{ignoreAbortErrors as a}from"../../../core/promiseUtils.js";import{valueInUnit as o}from"../../../core/quantity.js";import{createScreenPoint as s}from"../../../core/screenUtils.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{fromArray as u,create as d}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as f}from"../../../core/libs/gl-matrix-2/math/vec2.js";import p from"../../../geometry/Point.js";import{pointEquals as m}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{makeDehydratedPoint as h}from"../../../layers/graphics/dehydratedPoint.js";import{getZFromVertexSnappingCandidates as g}from"./drawUtils.js";import{getPolylineOrPolygonConstraint as _,getPointConstraint as v,pointToConstraintSpace as y,constraintSpaceToPoint as b}from"../../interactive/sketch/constraintUtils.js";import{SnappingContext as x}from"../../interactive/snapping/SnappingContext.js";import{SnappingOperation as S}from"../../interactive/snapping/SnappingOperation.js";let C=class extends t{constructor(e){super(e),this._snappingOperation=null,this.role=`primary`,this.captureMode=`capture-always`,this.defaultCaptureMode=`capture-always`,this.snappingEnabled=!0,this.selfSnappingEnabled=!0,this.editSession=null,this.outputMapPositionOfDragStart=null,this.selectedSnappingResult=null,this.screenPosition=null,this.inputMapPosition=null,this.drawToolDragging=!1,this.manipulatorDragging=!1,this.activePointerId=null,this.activePointerType=null,this._getSnappingContext=i((e,t,n,r,i,a)=>n?new x({elevationInfo:r,pointer:e,vertexHandle:t,editGeometryOperations:n,visualizer:i,suppressSelfSnapping:!a}):null)}destroy(){this._snappingOperation=r(this._snappingOperation)}get grabbable(){return this.captureMode===`grabbable-object`}get following(){let{captureMode:e}=this;return e===`capture-always`||e===`capture-when-engaged`}get outputMapPosition(){return this._get(`outputMapPosition`)}set outputMapPosition(e){let t=this._get(`outputMapPosition`);e&&t&&m(e,t)||this._set(`outputMapPosition`,e)}get dragging(){return this.drawToolDragging||this.manipulatorDragging}get firstPointZ(){let e=this.editSession?.lastPointAddedBySession;if(!e)return null;let t=this.editSession?.getInformationAboutPoint(0,e.partIndex);return t?.point.hasZ?t.point.z:null}async moveTo(e,t){let{snappingManager:n,skipSnapping:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t;this.notePointerActivity(t.pointerId,o);let l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t);e&&(this.screenPosition=e);let d=this.screenPosition;if(!d)return null;let f=this.firstPointZ,g=i?.screenToMap(d,{firstPointZ:f});if(this.inputMapPosition=g,this.selectedSnappingResult=null,!n||!g||!l||r||!this.snappingEnabled)return this.selectedSnappingResult=void 0,this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,g,t);let _=h(g.x,g.y,g.z,g?.spatialReference),v=i?.screenToScene?.(d,{firstPointZ:f}),y=u.snap({point:_,scenePoint:v},n,l),b=()=>{let e=u.stagedPoint;return m(this.selectedSnappingResult,e)||(this.selectedSnappingResult=e==null?null:new p({...e})),this.outputMapPosition=this._finalizeSnappingAndConstraintResult(this.selectedSnappingResult,g,t)};return b(),a(y.then(b))}async moveDeltaRelativeToScreen(e,t,n){let{inputMapPosition:r,screenPosition:i,firstPointZ:a}=this;if(!r)return null;let o=n.surfaceManager?n.surfaceManager.mapToScreen(r,{firstPointZ:a}):i;if(!o)return null;let c=s(o.x+e,o.y+t);return this.moveTo(c,n)}async noteDragStart(e,t){if(this.notePointerDown(t.pointerId,t.pointerType),this.drawToolDragging=!0,t.skipSnapping||!this.snappingEnabled)return null;let{snappingManager:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t,l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t),d=this.firstPointZ,f=i?.screenToMap(e,{firstPointZ:d});if(this.outputMapPositionOfDragStart=null,r&&l&&f){let o=u.snap({point:h(f.x,f.y,f.z,f?.spatialReference),scenePoint:i?.screenToScene?.(e,{firstPointZ:d})},r,l);return a(o.then(()=>{let e=u.stagedPoint?new p({...u.stagedPoint}):null;return this.outputMapPositionOfDragStart=this._finalizeSnappingAndConstraintResult(e,f,t)})).catch(e=>(n.getLogger(this).error(`drawtool:handle:snapping-failed`,e),null))}return this.outputMapPositionOfDragStart=f,null}async noteDragEnd(e,t){return this.moveTo(e,t).finally(()=>{this.drawToolDragging=!1,this.notePointerUp(t.pointerId,t.pointerType)})}notePointerActivity(e=null,t=null){t&&(this.activePointerType=t),e!=null&&this.dragging&&(this.activePointerId=e)}notePointerDown(e=null,t=null){e!=null&&(this.activePointerId=e),t&&(this.activePointerType=t)}notePointerUp(e=null,t=null){(e==null||this.activePointerId==null||this.activePointerId===e)&&(this.activePointerId=null),t&&this.activePointerType===t&&(this.activePointerType=null)}async moveDeltaRelativeToSketchSegment(e,t){let n=this.editSession?.endVertex?.leftSegment?.leftVertex?.pos,{firstPointZ:r}=this,i=this.inputMapPosition?t.surfaceManager?.mapToScreen(this.inputMapPosition,{firstPointZ:r})??this.screenPosition:this.screenPosition;if(!n||!i)return null;let a=t.editGeometryOperations?.data?.coordinateHelper.vectorToPoint(n);if(!a)return null;let o=t.surfaceManager?.mapToScreen(a,{firstPointZ:r});if(!o)return null;let s=[i.x-o.x,i.y-o.y],c=f(d(),u(s)),[l,p]=[c[0]*e,c[1]*e];return this.moveDeltaRelativeToScreen(l,p,t)}refreshConstraint(e){let t=this.outputMapPosition??this.inputMapPosition;return this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,t,e)}_finalizeSnappingAndConstraintResult(e,t,n){let r=e??t;r&&n.view.type===`2d`&&(r.z=g(n.snappingManager)??r.z);let i=(r?n.surfaceManager?.constrainZToEffectiveSurface?.(r):null)??r;return this._ensureZ(this._applyTooltipConstraints(i,n),n)}_applyTooltipConstraints(e,t){let n=e,r=t.tooltipManager?.getConstraints(this);if(!r&&!t.interactiveHandleManager?.customConstraints||!n)return n;let i=t.interactiveHandleManager?.customConstraints,a=t.editGeometryOperations?.data?.coordinateHelper;if(!a)return n;if(i&&this.editSession&&n){let e={handle:this,editSession:this.editSession,toScreen:e=>t.surfaceManager?.mapToScreen(e,{firstPointZ:this.firstPointZ})??null};for(let t of i)n=t(n,e)||n}let s=(this.editSession?.endVertex)?.leftSegment?.leftVertex,c=s?.leftSegment?.leftVertex,l=s&&a.vectorToPoint(s.pos),u=c&&a.vectorToPoint(c.pos);if(!r)return n;let d=(l||u)&&this.role===`primary`?_(l,u,r):v(r);if(!n||!r||!d)return n;let{context:f}=r,m=y(n,f),h=m?d.closestTo(m):void 0;if(!h)return n;let g=b(h,n,f),x=t.surfaceManager?.view?.type===`2d`||f.elevationInfo.mode!==`absolute-height`,S=r.elevation,{hasZ:C,metersPerVerticalUnit:w}=t.surfaceManager??{};return g!=null&&x&&S!=null&&C&&w&&(g.z=o(S,`meters`)/w),g?new p({x:g.x,y:g.y,z:g.z,hasM:g.hasM,hasZ:g.hasZ,m:g.m,spatialReference:g.spatialReference}):null}_ensureZ(e,t){return!e||!t.hasZ||e.z!=null&&e.hasZ||(e.z=t.defaultZ??0,e.hasZ=!0),e}_ensureSnappingOperation({view:e}){return this._snappingOperation??=new S({view:e})}};e([c()],C.prototype,`_snappingOperation`,void 0),e([c()],C.prototype,`role`,void 0),e([c()],C.prototype,`name`,void 0),e([c()],C.prototype,`captureMode`,void 0),e([c()],C.prototype,`defaultCaptureMode`,void 0),e([c()],C.prototype,`grabbable`,null),e([c()],C.prototype,`following`,null),e([c()],C.prototype,`snappingEnabled`,void 0),e([c()],C.prototype,`selfSnappingEnabled`,void 0),e([c()],C.prototype,`editSession`,void 0),e([c()],C.prototype,`outputMapPosition`,null),e([c()],C.prototype,`outputMapPositionOfDragStart`,void 0),e([c()],C.prototype,`selectedSnappingResult`,void 0),e([c()],C.prototype,`screenPosition`,void 0),e([c()],C.prototype,`inputMapPosition`,void 0),e([c()],C.prototype,`dragging`,null),e([c()],C.prototype,`drawToolDragging`,void 0),e([c()],C.prototype,`manipulatorDragging`,void 0),e([c()],C.prototype,`activePointerId`,void 0),e([c()],C.prototype,`activePointerType`,void 0),e([c({readOnly:!0})],C.prototype,`firstPointZ`,null),C=e([l(`esri.views.draw.support.InteractiveHandle`)],C);export{C as InteractiveHandle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{createTask as n}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import{EventedAccessor as a}from"../../../core/Evented.js";import o from"../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import{destroyMaybe as c,abortMaybe as l,assertIsSome as u}from"../../../core/maybe.js";import{throwIfAborted as d}from"../../../core/promiseUtils.js";import{pausable as f,when as p,watch as m,initial as h,sync as g}from"../../../core/reactiveUtils.js";import{property as _,subclass as v}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import b from"../../../geometry/Point.js";import x from"../../../geometry/Polyline.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{isPoint as T}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as E}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as D}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as O,getEndpoint as k,isCircularArc as A,isEllipticArc4 as j,isBezierCurve as M,isCoordinate as N,cloneCurve as ee,isEllipticArc7 as P}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as F}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{normalizeEllipticArcAfterEndpointChange as I}from"../../../geometry/support/curves/ellipticArc7Utils.js";import{wrapAtan2 as te}from"../../../geometry/support/curves/mathUtils.js";import ne from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as re}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as ie}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as ae,getZFromVertexSnappingCandidates as oe,cloneMove as se}from"./drawUtils.js";import ce from"./GraphicMover.js";import le from"./HighlightHelper.js";import{addUniqueLayer as ue,isConnectedReshapeSupportedLayer as de}from"./layerUtils.js";import{createTooltipInfos as fe,connectTooltip as pe,updateTranslateTooltipInfo as me,updateTranslateVertexTooltipInfo as he}from"./reshapeTooltipUtils.js";import{defaultSymbols as ge,createMidpointGraphics as _e,createVertexGraphics as L,createCurveControlPointGraphics as ve,createCurveConstructionLineGraphics as ye,attributeKeys as R,getMidpoint as z,controlPointKinds as B,fastCloneGeometry as V,saveUpdatedCurveOrCoordinate as H,toolIdAttribute as be,splitCurve as xe,isSingleSegmentCircle as Se,isSingleSegmentEllipse as Ce}from"./reshapeUtils.js";import{ViewEventPriorities as we}from"../../input/InputManager.js";import{createCoordinateHelper as Te}from"../../interactive/coordinateHelper.js";import{sketchKeys as Ee}from"../../interactive/keybindings.js";import{EditGeometryOperations as De}from"../../interactive/editGeometry/EditGeometryOperations.js";import Oe from"../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as ke}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as Ae,enterInputModeIfAvailable as je}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Me}from"../../support/GeometryWorkerHandle.js";const U=Symbol(),W={mode:`on-the-ground`,offset:0};let G=class extends a{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 y,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=ge,this.tooltip=null,this.activeTooltipInfo=null,this.toolOptions=new Oe,this.type=`reshape`,this.vertexGraphics=new r,this.curveControlPointGraphics=new r,this.constructionLineGraphics=new r,this.midpointGraphics=new r,this.selectedManipulators=new r,this.view=null}initialize(){let e=this.view;this._highlightHelper=new le({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=f(()=>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)},g),this.tooltip=Ae(()=>({view:e,options:this.toolOptions.tooltips})),this.tooltipInfos=fe(this.toolOptions),this.addHandles([p(()=>e?.ready,()=>{let{layer:e,view:t}=this;ue(t,e),this.addHandles(t.on(`key-down`,e=>this._keyDownHandler(e),we.TOOL))},{once:!0,initial:!0}),m(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[m(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],m(()=>this.layer,(e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()}),m(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),m(()=>this.enableMidpoints,()=>this.refresh()),pe(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),m(()=>this.toolOptions.labels.enabled,e=>{this._segmentLabels?this._segmentLabels.visible=e:this._setUpGeometryHelper()}),m(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),h),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=c(this._mover),this._connectedReshapeManager=c(this._connectedReshapeManager),this.tooltip=c(this.tooltip),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this._updatingHandles=c(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??Te(!!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`&&S(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=c(this._segmentLabels),this._logGeometryTypeError()):(this._editGeometryOperations?this._syncEditGeometryOperations(e):this._editGeometryOperations=De.fromGeometry(e,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels()))}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new ne({listMode:`hide`,internal:!0,title:`Reshape snapping layer`}),this.view.map.layers.add(this._snappingGraphicsLayer);let n=this._editGeometryOperations;u(n),this._snappingContext=new ke({editGeometryOperations:n,elevationInfo:W,pointer:t.viewEvent?.pointerType||`mouse`,excludeFeature:this.graphic,feature:this.graphic,visualizer:new re(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this._activeOperationInfo=null,this._mover=c(this._mover),this.removeHandles(U),this._connectedReshapeManager?.finish()}_resetSnappingStateVars(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._snappingGraphicsLayer!=null&&(this.view.map?.layers.remove(this._snappingGraphicsLayer),c(this._snappingGraphicsLayer)),this._snappingTask=l(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(c)}_removeVertexGraphics(e=this.layer){let{vertexGraphics:t}=this;this._relatedGraphicIndex=null,e?.removeMany(t.items),t.drain(c)}_removeCurveGraphics(e=this.layer){let{curveControlPointGraphics:t,constructionLineGraphics:n}=this;e?.removeMany(t.items),e?.removeMany(n.items),t.drain(c),n.drain(c)}_setupGraphics(){let e=this.graphic.geometry;if(e!=null&&(e.type===`polyline`||e.type===`polygon`||e.type===`multipoint`)){let t=K(e);this.enableMidpoints&&e.type!==`multipoint`&&this._setUpMidpointGraphics(t),this.enableVertices&&(this._setUpVertexGraphics(t),this._setupCurveGraphics(t))}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();let t=_e(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=L(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=L(e,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}}_setupCurveGraphics(e){this._removeCurveGraphics();let t=ve(e,this.symbols,this._coordinateHelper),n=ye(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=c(this._segmentLabels)),!this._segmentLabels&&e&&t){let t=this._segmentLabelsImportTask??=n(async e=>{let t=import(`../../2d/interactive/SegmentLabels2D.js`),{SegmentLabels2D:n}=await this._updatingHandles.addPromise(t);return e.aborted?null:n}),r=await this._updatingHandles.addPromise(t.promise);if(!r)return;this._segmentLabels=c(this._segmentLabels),this._segmentLabels=new r({context:{view:this.view,editGeometryOperations:e,elevationInfo:W,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[R.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 ce({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 ie({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}=ae(n,r,this.view);if(!this._effectiveFilterVerticesEnabled){let e=K(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=O(o)[e][n];if(r){let e=k(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(R.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(e)?e:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_handleVertexSnap(e,t,r){let i=e.geometry,a=this.snappingManager?.getVertexCandidates(),o=this.callbacks.onVertexSnap,s=()=>r===`move`?this._emitMoveStopEvent():this._emitReshapeStopEvent(e);!o||!i||!T(i)||!a||a.length===0?(s(),this._afterMoveStop(e,r)):(l(this._snappingTask),this._snappingTask=n(async n=>{try{let r=await o(i,t,a);d(n);let s=w(r);this._coordinateHelper.hasZ()||(s.z=void 0),this._syncGeometryAfterVertexMove(e,s,0,0),e.geometry=s}finally{s(),this._afterMoveStop(e,r)}}))}_updateVertexGraphicLocations(e){let{_coordinateHelper:t}=this;for(let n of this.vertexGraphics){let{pathIndex:r,pointIndex:i}=n.attributes;n.geometry=t.arrayToPoint(k(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 b(z(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 b(z(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(R.controlPointKind)&&s(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(A(a)||j(a)){let n=k(e[r][i-1]),o=A(a)?D(n,a):F(n,a),[s,c]=E(o,.25);t.geometry=new b({x:s,y:c,spatialReference:this._coordinateHelper.spatialReference})}else if(M(a)){let[e,n]=t.getAttribute(R.controlPointKind)===B.bezier.cp1?a.b[1]:a.b[2];t.geometry=new b({x:e,y:n,spatialReference:this._coordinateHelper.spatialReference})}}for(let n of this.constructionLineGraphics){let r=n.getAttribute(R.controlPointKind),[i,a]=Z(n),o=e[i],s=k(o[a-1]),c=k(o[a]),l=e[i][a];n.geometry=r===B.bezier.line1?new x({paths:[[[s[0],s[1]],[...l.b[1]]]],spatialReference:t}):new x({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(R.pointIndex,i+1)};this.vertexGraphics.forEach(r),this.curveControlPointGraphics.forEach(r),this.constructionLineGraphics.forEach(r);for(let e of this.midpointGraphics){if(e.getAttribute(R.pathIndex)!==t)continue;let r=e.getAttribute(R.pointIndexStart);r>=n&&(e.setAttribute(R.pointIndexStart,r+1),e.setAttribute(R.pointIndexEnd,e.getAttribute(R.pointIndexEnd)+1))}}_getVertexFromEditGeometry(e){let[t,n]=Z(e);return u(this._editGeometryOperations),this._editGeometryOperations.data.parts[t].vertices[n]}_onHandleMove(e,t,r,i,a){l(this._snappingTask);let o=this._snappingContext;if(!o)return;let s=e.geometry,c=i.type===`graphic-move-stop`;if(!s||!T(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 b(this._stagedVertex),t,r,c),a(),this._snappingTask=n(async n=>{let l=await i.snap({point:s,context:o,signal:n});if(l.valid){let n=l.apply();n.z=this._coordinateHelper.hasZ()?oe(this.snappingManager)??n.z:void 0,this._stagedVertex=n,this._syncGeometryAfterVertexMove(e,new b(this._stagedVertex),t,r,c),a()}}),this._updatingHandles.consumePromise(this._snappingTask.promise)}else{let n=this._stagedVertex==null?s:new b(this._stagedVertex);this._syncGeometryAfterVertexMove(e,n,t,r,c),a()}}_syncGeometryAfterVertexMove(e,t,n,r,i=!1){let a=V(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=q(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);H(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&&s(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,c]=Z(a);r&&s(r,o,()=>new Set).add(c),X(e,o,c,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(R.relatedGraphicIndices),c=se(a.geometry,n,r,this.view),l=C(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)?Pe(t,n,r,[i[0],i[1]],e.getAttribute(R.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(U),this._updateTooltip()}_handleMidpointClickOrStartMove(e){let{graphic:t}=e,n=this.graphic.geometry;if(n==null||n.type!==`polygon`&&n.type!==`polyline`)return[];let r=V(n),i=[],{[R.pathIndex]:a,[R.pointIndexStart]:o,[R.pointIndexEnd]:s}=t.attributes,c=C(t.geometry),l=s===0?o+1:s;t.attributes={[R.tool]:be,[R.pathIndex]:a,[R.pointIndex]:l,[R.relatedGraphicIndices]:[]};let u=q(r),d=u[a][s];if(N(d)){if(this.enableCurveOnMidpoint&&e.viewEvent.native.shiftKey){let e=k(u[a][l]);u[a].splice(l,1,{c:[e,[c[0],c[1]]]}),t.setAttribute(R.controlPointKind,B.circle.interior),t.setAttribute(R.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(t),this.curveControlPointGraphics.push(t),H(r,u)}else u[a].splice(l,0,c),i.push({coordinates:u[a][l],componentIndex:a,vertexIndex:l})}else{let e=k(u[a][o]),t=xe(e,d,.5,this._coordinateHelper);u[a].splice(s,1,...t),i.push({coordinates:k(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&&je(e,this.tooltip)||Ee.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=V(t),a=q(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]=k(r[i]);if(t===s&&n===c){o.push({coordinates:k(a[e][i]),componentIndex:e,vertexIndex:i}),a[e].splice(Number(i),1);let t=a[e][i];t&&!N(t)&&(a[e][i]=k(t))}}}}if(i.type===`polygon`)a=a.filter(e=>{if(e.length<2)return!1;let[t,n]=k(e[0]),[r,i]=k(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);H(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`),U)}_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,me(n,i,this._tooltipsContext,this._updatingHandles,t)):e&&this.selectedManipulators.length>1&&(n=a.translateVertices,he(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(){o.getLogger(this).error(new i(`reshape:invalid-geometry`,`Reshape operation not supported for the provided graphic. The geometry type is not supported.`))}};e([_()],G.prototype,`_activeOperationInfo`,void 0),e([_()],G.prototype,`_connectedReshapeManager`,void 0),e([_()],G.prototype,`_coordinateHelper`,null),e([_()],G.prototype,`_editGeometryOperations`,void 0),e([_()],G.prototype,`_effectiveFilterVerticesEnabled`,null),e([_()],G.prototype,`_primaryGraphicMoving`,void 0),e([_()],G.prototype,`_segmentLabels`,void 0),e([_()],G.prototype,`test`,null),e([_()],G.prototype,`_segmentLabelsImportTask`,void 0),e([_()],G.prototype,`_updatingHandles`,void 0),e([_()],G.prototype,`_selectedManipulator`,null),e([_()],G.prototype,`_tooltipsContext`,null),e([_()],G.prototype,`callbacks`,void 0),e([_()],G.prototype,`connectedReshapeProviders`,void 0),e([_()],G.prototype,`enableMidpoints`,void 0),e([_()],G.prototype,`enableCurveOnMidpoint`,void 0),e([_()],G.prototype,`enableMovement`,void 0),e([_()],G.prototype,`enableVertices`,void 0),e([_()],G.prototype,`filterVerticesEnabled`,void 0),e([_()],G.prototype,`graphic`,void 0),e([_()],G.prototype,`highlightName`,void 0),e([_()],G.prototype,`highlightsEnabled`,void 0),e([_()],G.prototype,`layer`,void 0),e([_()],G.prototype,`snappingManager`,void 0),e([_({readOnly:!0})],G.prototype,`state`,null),e([_()],G.prototype,`symbols`,void 0),e([_()],G.prototype,`tooltip`,void 0),e([_()],G.prototype,`tooltipInfos`,void 0),e([_()],G.prototype,`activeTooltipInfo`,void 0),e([_()],G.prototype,`updating`,null),e([_()],G.prototype,`toolOptions`,void 0),e([_({readOnly:!0})],G.prototype,`type`,void 0),e([_({readOnly:!0})],G.prototype,`vertexGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`curveControlPointGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`constructionLineGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`midpointGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`selectedManipulators`,void 0),e([_()],G.prototype,`view`,void 0),G=e([v(`esri.views.draw.support.Reshape`)],G);function K(e){let t=q(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(!N(t))continue;let n=e[0];n[0]===t[0]&&n[1]===t[1]&&e.length>2&&e.pop()}return t}function q(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 Ne(e,t,n,r){let i=e[t][n];if(A(i))i.c[1]=r;else if(j(i)){let i=k(e[t][n]);e[t][n]={c:[i,r]}}}function Pe(e,t,n,r,i){switch(i){case B.circle.interior:Ne(e,t,n,r);break;case B.bezier.cp1:e[t][n].b[1]=r;break;case B.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(Se(e,t)){let n=e[t][1];e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0]};return}if(Ce(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=k(i);if(N(i))i.splice(0,i.length,...r);else if(M(i))i.b[0].splice(0,i.b[0].length,...r);else if(A(i)||j(i)){let a=k(e[t][n-1]),o=A(i)?D(a,i):F(a,i);e[t].splice(n,1,{c:[[...r],Y(a,o,r,!0)]})}else if(P(i)){i.a[0].splice(0,i.a[0].length,...r);let a=k(e[t][n-1]);I(a,i)}if(a&&!N(a)&&!M(i)){if(A(a)||j(a)){let i=k(a),s=A(a)?D(o,a):F(o,a);e[t].splice(n+1,1,{c:[i,Y(i,s,r,!1)]})}else if(P(a)){let e=k(i);I(e,a)}}}function Z({attributes:e}){return[e?.[R.pathIndex]||0,e?.[R.pointIndex]||0]}function Q({attributes:e}){return`${e?.[R.pathIndex]}-${e?.[R.pointIndex]}-${e?.[R.controlPointKind]??`vertex`}`}function $(e){return e instanceof t?[e]:[...e]}function Fe(e){let t=e.sourceLayer??e.layer;return de(t)?{graphic:e,layer:t}:null}function Ie(e){return e.toArray().map(({attributes:e})=>({pathIndex:e[R.pathIndex],vertexIndex:e[R.pointIndex]}))}const Le=G;export{Le as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{createTask as n}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import{EventedAccessor as a}from"../../../core/Evented.js";import o from"../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import{destroyMaybe as c,abortMaybe as l,assertIsSome as u}from"../../../core/maybe.js";import{throwIfAborted as d}from"../../../core/promiseUtils.js";import{pausable as f,when as p,watch as m,initial as h,sync as g}from"../../../core/reactiveUtils.js";import{property as _,subclass as v}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import b from"../../../geometry/Point.js";import x from"../../../geometry/Polyline.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{isPoint as T}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as E}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as D}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as O,getEndpoint as k,isCircularArc as A,isEllipticArc4 as j,isBezierCurve as M,isCoordinate as N,cloneCurve as ee,isEllipticArc7 as P}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as F}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{normalizeEllipticArcAfterEndpointChange as I}from"../../../geometry/support/curves/ellipticArc7Utils.js";import{wrapAtan2 as te}from"../../../geometry/support/curves/mathUtils.js";import ne from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as re}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as ie}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as ae,getZFromVertexSnappingCandidates as oe,cloneMove as se}from"./drawUtils.js";import ce from"./GraphicMover.js";import le from"./HighlightHelper.js";import{addUniqueLayer as ue,isConnectedReshapeSupportedLayer as de}from"./layerUtils.js";import{createTooltipInfos as fe,connectTooltip as pe,updateTranslateTooltipInfo as me,updateTranslateVertexTooltipInfo as he}from"./reshapeTooltipUtils.js";import{defaultSymbols as ge,createMidpointGraphics as _e,createVertexGraphics as L,createCurveControlPointGraphics as ve,createCurveConstructionLineGraphics as ye,attributeKeys as R,getMidpoint as z,controlPointKinds as B,fastCloneGeometry as V,saveUpdatedCurveOrCoordinate as H,toolIdAttribute as be,splitCurve as xe,isSingleSegmentCircle as Se,isSingleSegmentEllipse as Ce}from"./reshapeUtils.js";import{ViewEventPriorities as we}from"../../input/InputManager.js";import{createCoordinateHelper as Te}from"../../interactive/coordinateHelper.js";import{sketchKeys as Ee}from"../../interactive/keybindings.js";import{EditGeometryOperations as De}from"../../interactive/editGeometry/EditGeometryOperations.js";import Oe from"../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as ke}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as Ae,enterInputModeIfAvailable as je}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Me}from"../../support/GeometryWorkerHandle.js";const U=Symbol(),W={mode:`on-the-ground`,offset:0};let G=class extends a{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 y,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=ge,this.tooltip=null,this.activeTooltipInfo=null,this.toolOptions=new Oe,this.type=`reshape`,this.vertexGraphics=new r,this.curveControlPointGraphics=new r,this.constructionLineGraphics=new r,this.midpointGraphics=new r,this.selectedManipulators=new r,this.view=null}initialize(){let e=this.view;this._highlightHelper=new le({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=f(()=>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)},g),this.tooltip=Ae(()=>({view:e,options:this.toolOptions.tooltips})),this.tooltipInfos=fe(this.toolOptions),this.addHandles([p(()=>e?.ready,()=>{let{layer:e,view:t}=this;ue(t,e),this.addHandles(t.on(`key-down`,e=>this._keyDownHandler(e),we.TOOL))},{once:!0,initial:!0}),m(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[m(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],m(()=>this.layer,(e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()}),m(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),m(()=>this.enableMidpoints,()=>this.refresh()),pe(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),m(()=>this.toolOptions.labels.enabled,e=>{this._segmentLabels?this._segmentLabels.visible=e:this._setUpGeometryHelper()}),m(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),h),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=c(this._mover),this._connectedReshapeManager=c(this._connectedReshapeManager),this.tooltip=c(this.tooltip),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this._updatingHandles=c(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??Te(!!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`&&S(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=c(this._segmentLabels),this._logGeometryTypeError()):(this._editGeometryOperations?this._syncEditGeometryOperations(e):this._editGeometryOperations=De.fromGeometry(e,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels()))}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new ne({listMode:`hide`,internal:!0,title:`Reshape snapping layer`}),this.view.map.layers.add(this._snappingGraphicsLayer);let n=this._editGeometryOperations;u(n),this._snappingContext=new ke({editGeometryOperations:n,elevationInfo:W,pointer:t.viewEvent?.pointerType||`mouse`,excludeFeature:this.graphic,feature:this.graphic,visualizer:new re(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this._activeOperationInfo=null,this._mover=c(this._mover),this.removeHandles(U),this._connectedReshapeManager?.finish()}_resetSnappingStateVars(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._snappingGraphicsLayer!=null&&(this.view.map?.layers.remove(this._snappingGraphicsLayer),c(this._snappingGraphicsLayer)),this._snappingTask=l(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(c)}_removeVertexGraphics(e=this.layer){let{vertexGraphics:t}=this;this._relatedGraphicIndex=null,e?.removeMany(t.items),t.drain(c)}_removeCurveGraphics(e=this.layer){let{curveControlPointGraphics:t,constructionLineGraphics:n}=this;e?.removeMany(t.items),e?.removeMany(n.items),t.drain(c),n.drain(c)}_setupGraphics(){let e=this.graphic.geometry;if(e!=null&&(e.type===`polyline`||e.type===`polygon`||e.type===`multipoint`)){let t=K(e);this.enableMidpoints&&e.type!==`multipoint`&&this._setUpMidpointGraphics(t),this.enableVertices&&(this._setUpVertexGraphics(t),this._setupCurveGraphics(t))}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();let t=_e(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=L(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=L(e,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}}_setupCurveGraphics(e){this._removeCurveGraphics();let t=ve(e,this.symbols,this._coordinateHelper),n=ye(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=c(this._segmentLabels)),!this._segmentLabels&&e&&t){let t=this._segmentLabelsImportTask??=n(async e=>{let t=import(`../../2d/interactive/SegmentLabels2D.js`),{SegmentLabels2D:n}=await this._updatingHandles.addPromise(t);return e.aborted?null:n}),r=await this._updatingHandles.addPromise(t.promise);if(!r)return;this._segmentLabels=c(this._segmentLabels),this._segmentLabels=new r({context:{view:this.view,editGeometryOperations:e,elevationInfo:W,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[R.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 ce({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 ie({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}=ae(n,r,this.view);if(!this._effectiveFilterVerticesEnabled){let e=K(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=O(o)[e][n];if(r){let e=k(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(R.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(e)?e:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_handleVertexSnap(e,t,r){let i=e.geometry,a=this.snappingManager?.getVertexCandidates(),o=this.callbacks.onVertexSnap,s=()=>r===`move`?this._emitMoveStopEvent():this._emitReshapeStopEvent(e);!o||!i||!T(i)||!a||a.length===0?(s(),this._afterMoveStop(e,r)):(l(this._snappingTask),this._snappingTask=n(async n=>{try{let r=await o(i,t,a);d(n);let s=w(r);this._coordinateHelper.hasZ()||(s.z=void 0),this._syncGeometryAfterVertexMove(e,s,0,0),e.geometry=s}finally{s(),this._afterMoveStop(e,r)}}))}_updateVertexGraphicLocations(e){let{_coordinateHelper:t}=this;for(let n of this.vertexGraphics){let{pathIndex:r,pointIndex:i}=n.attributes;n.geometry=t.arrayToPoint(k(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 b(z(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 b(z(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(R.controlPointKind)&&s(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(A(a)||j(a)){let n=k(e[r][i-1]),o=A(a)?D(n,a):F(n,a),[s,c]=E(o,.25);t.geometry=new b({x:s,y:c,spatialReference:this._coordinateHelper.spatialReference})}else if(M(a)){let[e,n]=t.getAttribute(R.controlPointKind)===B.bezier.cp1?a.b[1]:a.b[2];t.geometry=new b({x:e,y:n,spatialReference:this._coordinateHelper.spatialReference})}}for(let n of this.constructionLineGraphics){let r=n.getAttribute(R.controlPointKind),[i,a]=Z(n),o=e[i],s=k(o[a-1]),c=k(o[a]),l=e[i][a];n.geometry=r===B.bezier.line1?new x({paths:[[[s[0],s[1]],[...l.b[1]]]],spatialReference:t}):new x({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(R.pointIndex,i+1)};this.vertexGraphics.forEach(r),this.curveControlPointGraphics.forEach(r),this.constructionLineGraphics.forEach(r);for(let e of this.midpointGraphics){if(e.getAttribute(R.pathIndex)!==t)continue;let r=e.getAttribute(R.pointIndexStart);r>=n&&(e.setAttribute(R.pointIndexStart,r+1),e.setAttribute(R.pointIndexEnd,e.getAttribute(R.pointIndexEnd)+1))}}_getVertexFromEditGeometry(e){let[t,n]=Z(e);return u(this._editGeometryOperations),this._editGeometryOperations.data.parts[t].vertices[n]}_onHandleMove(e,t,r,i,a){l(this._snappingTask);let o=this._snappingContext;if(!o)return;let s=e.geometry,c=i.type===`graphic-move-stop`;if(!s||!T(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 b(this._stagedVertex),t,r,c),a(),this._snappingTask=n(async n=>{let l=await i.snap({point:s,context:o,signal:n});if(l.valid){let n=l.apply();n.z=this._coordinateHelper.hasZ()?oe(this.snappingManager)??n.z:void 0,this._stagedVertex=n,this._syncGeometryAfterVertexMove(e,new b(this._stagedVertex),t,r,c),a()}}),this._updatingHandles.consumePromise(this._snappingTask.promise)}else{let n=this._stagedVertex==null?s:new b(this._stagedVertex);this._syncGeometryAfterVertexMove(e,n,t,r,c),a()}}_syncGeometryAfterVertexMove(e,t,n,r,i=!1){let a=V(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=q(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);H(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&&s(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,c]=Z(a);r&&s(r,o,()=>new Set).add(c),X(e,o,c,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(R.relatedGraphicIndices),c=se(a.geometry,n,r,this.view),l=C(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)?Pe(t,n,r,[i[0],i[1]],e.getAttribute(R.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(U),this._updateTooltip()}_handleMidpointClickOrStartMove(e){let{graphic:t}=e,n=this.graphic.geometry;if(n==null||n.type!==`polygon`&&n.type!==`polyline`)return[];let r=V(n),i=[],{[R.pathIndex]:a,[R.pointIndexStart]:o,[R.pointIndexEnd]:s}=t.attributes,c=C(t.geometry),l=s===0?o+1:s;t.attributes={[R.tool]:be,[R.pathIndex]:a,[R.pointIndex]:l,[R.relatedGraphicIndices]:[]};let u=q(r),d=u[a][s];if(N(d)){if(this.enableCurveOnMidpoint&&e.viewEvent.native.shiftKey){let e=k(u[a][l]);u[a].splice(l,1,{c:[e,[c[0],c[1]]]}),t.setAttribute(R.controlPointKind,B.circle.interior),t.setAttribute(R.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(t),this.curveControlPointGraphics.push(t),H(r,u)}else u[a].splice(l,0,c),i.push({coordinates:u[a][l],componentIndex:a,vertexIndex:l})}else{let e=k(u[a][o]),t=xe(e,d,.5,this._coordinateHelper);u[a].splice(s,1,...t),i.push({coordinates:k(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&&je(e,this.tooltip)||Ee.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=V(t),a=q(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]=k(r[i]);if(t===s&&n===c){o.push({coordinates:k(a[e][i]),componentIndex:e,vertexIndex:i}),a[e].splice(Number(i),1);let t=a[e][i];t&&!N(t)&&(a[e][i]=k(t))}}}}if(i.type===`polygon`)a=a.filter(e=>{if(e.length<2)return!1;let[t,n]=k(e[0]),[r,i]=k(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);H(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`),U)}_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,me(n,i,this._tooltipsContext,this._updatingHandles,t)):e&&this.selectedManipulators.length>1&&(n=a.translateVertices,he(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(){o.getLogger(this).error(new i(`reshape:invalid-geometry`,`Reshape operation not supported for the provided graphic. The geometry type is not supported.`))}};e([_()],G.prototype,`_activeOperationInfo`,void 0),e([_()],G.prototype,`_connectedReshapeManager`,void 0),e([_()],G.prototype,`_coordinateHelper`,null),e([_()],G.prototype,`_editGeometryOperations`,void 0),e([_()],G.prototype,`_effectiveFilterVerticesEnabled`,null),e([_()],G.prototype,`_primaryGraphicMoving`,void 0),e([_()],G.prototype,`_segmentLabels`,void 0),e([_()],G.prototype,`test`,null),e([_()],G.prototype,`_segmentLabelsImportTask`,void 0),e([_()],G.prototype,`_updatingHandles`,void 0),e([_()],G.prototype,`_selectedManipulator`,null),e([_()],G.prototype,`_tooltipsContext`,null),e([_()],G.prototype,`callbacks`,void 0),e([_()],G.prototype,`connectedReshapeProviders`,void 0),e([_()],G.prototype,`enableMidpoints`,void 0),e([_()],G.prototype,`enableCurveOnMidpoint`,void 0),e([_()],G.prototype,`enableMovement`,void 0),e([_()],G.prototype,`enableVertices`,void 0),e([_()],G.prototype,`filterVerticesEnabled`,void 0),e([_()],G.prototype,`graphic`,void 0),e([_()],G.prototype,`highlightName`,void 0),e([_()],G.prototype,`highlightsEnabled`,void 0),e([_()],G.prototype,`layer`,void 0),e([_()],G.prototype,`snappingManager`,void 0),e([_({readOnly:!0})],G.prototype,`state`,null),e([_()],G.prototype,`symbols`,void 0),e([_()],G.prototype,`tooltip`,void 0),e([_()],G.prototype,`tooltipInfos`,void 0),e([_()],G.prototype,`activeTooltipInfo`,void 0),e([_()],G.prototype,`updating`,null),e([_()],G.prototype,`toolOptions`,void 0),e([_({readOnly:!0})],G.prototype,`type`,void 0),e([_({readOnly:!0})],G.prototype,`vertexGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`curveControlPointGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`constructionLineGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`midpointGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`selectedManipulators`,void 0),e([_()],G.prototype,`view`,void 0),G=e([v(`esri.views.draw.support.Reshape`)],G);function K(e){let t=q(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(!N(t))continue;let n=e[0];n[0]===t[0]&&n[1]===t[1]&&e.length>2&&e.pop()}return t}function q(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 Ne(e,t,n,r){let i=e[t][n];if(A(i))i.c[1]=r;else if(j(i)){let i=k(e[t][n]);e[t][n]={c:[i,r]}}}function Pe(e,t,n,r,i){switch(i){case B.circle.interior:Ne(e,t,n,r);break;case B.bezier.cp1:e[t][n].b[1]=r;break;case B.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(Se(e,t)){let n=e[t][1];e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0]};return}if(Ce(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=k(i);if(N(i))i.splice(0,i.length,...r);else if(M(i))i.b[0].splice(0,i.b[0].length,...r);else if(A(i)||j(i)){let a=k(e[t][n-1]),o=A(i)?D(a,i):F(a,i);e[t].splice(n,1,{c:[[...r],Y(a,o,r,!0)]})}else if(P(i)){i.a[0].splice(0,i.a[0].length,...r);let a=k(e[t][n-1]);I(a,i)}if(a&&!N(a)&&!M(i)){if(A(a)||j(a)){let i=k(a),s=A(a)?D(o,a):F(o,a);e[t].splice(n+1,1,{c:[i,Y(i,s,r,!1)]})}else if(P(a)){let e=k(i);I(e,a)}}}function Z({attributes:e}){return[e?.[R.pathIndex]||0,e?.[R.pointIndex]||0]}function Q({attributes:e}){return`${e?.[R.pathIndex]}-${e?.[R.pointIndex]}-${e?.[R.controlPointKind]??`vertex`}`}function $(e){return e instanceof t?[e]:[...e]}function Fe(e){let t=e.sourceLayer??e.layer;return de(t)?{graphic:e,layer:t}:null}function Ie(e){return e.toArray().map(({attributes:e})=>({pathIndex:e[R.pathIndex],vertexIndex:e[R.pointIndex]}))}const Le=G;export{Le as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isSome as e,equals as t}from"../../../core/arrayUtils.js";import{clone as n}from"../../../core/lang.js";import{getMetersPerUnitForSR as r}from"../../../core/units.js";import{lerp as i}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../geometry/Circle.js";import s from"../../../geometry/Multipoint.js";import c from"../../../geometry/Point.js";import l from"../../../geometry/Polygon.js";import u from"../../../geometry/Polyline.js";import{distanceExecute as d}from"../../../geometry/operators/distanceOperator.js";import{simplifyIsSimple as f,simplifyExecute as p}from"../../../geometry/operators/simplifyOperator.js";import{isClockwise as m}from"../../../geometry/support/coordsUtils.js";import{isValid as h}from"../../../geometry/support/spatialReferenceUtils.js";import{makeSurfacePoint as g}from"./surfaceCoordinateSystems.js";import{unnormalize as _}from"../../support/unnormalizationUtils.js";function v(e,t){let n=new c({x:e[0],y:e[1],spatialReference:t});return e.length>2&&(n.z=e[2]),n}function y(e,t){return new s({points:e,spatialReference:t})}function b(e,t,n){let r=new u({paths:e,spatialReference:t});return n&&_(r,r.spatialReference),r}function x(e,r,i,a=!0){let o=n(e);o.forEach(e=>{let n=e[0],r=e[e.length-1];(!t(n,r)||e.length===1)&&e.push(e[0])});let s=new l({rings:o,spatialReference:r});return s.rings.forEach(e=>{m(e)||e.reverse()}),i&&_(s,s.spatialReference),a&&!f(s)&&h(r)&&(s=p(s)||s),s}function S(t,n,r){let i=n.mapToLocalMultiple(t),a=[],o={x:i[0].x,y:i[0].y},s={x:i[1].x,y:i[1].y},c=Math.round(s.x-o.x),l=Math.round(s.y-o.y),u=Math.max(Math.abs(c),Math.abs(l));if(r){let e={x:o.x+u,y:o.y+u},t={x:o.x-u,y:o.y-u};a.push(g(e.x,t.y),g(t.x,t.y),g(t.x,e.y),g(e.x,e.y))}else{let e={x:c>0?o.x+u:o.x-u,y:l>0?o.y+u:o.y-u};a.push(g(o.x,o.y),g(e.x,o.y),g(e.x,e.y),g(o.x,e.y))}return w(x([a.map(e=>n.localToMap(e)).filter(e)],n.spatialReference,n.doUnnormalization,!0),a,n)}function C(t,n,r){let i=n.mapToLocalMultiple(t);if(i.length===1){let e=i[0];i=[g(e.x-48,e.y+48),g(e.x+48,e.y-48),g(e.x+48,e.y-48),g(e.x-48,e.y+48)]}let a=[],o={x:i[0].x,y:i[0].y},s={x:i[1].x,y:i[1].y};if(r){let e=Math.round(s.x-o.x),t=Math.round(s.y-o.y);a.push(g(o.x-e,o.y-t),g(s.x,o.y-t),g(s.x,s.y),g(o.x-e,s.y))}else a.push(g(o.x,o.y),g(s.x,o.y),g(s.x,s.y),g(o.x,s.y));return w(x([a.map(e=>n.localToMap(e)).filter(e)],n.spatialReference,n.doUnnormalization,!0),a,n)}function w(e,t,n){let r=T(t[3],t[2],n),i=T(t[1],t[2],n),a=T(t[0],t[1],n),o=T(t[0],t[3],n);return{geometry:e,midpoints:r!=null&&i!=null&&a!=null&&o!=null?{top:r,right:i,bottom:a,left:o}:null}}function T(e,t,n){D[0]=e.x,D[1]=e.y,D[2]=0,O[0]=t.x,O[1]=t.y,O[2]=0,i(D,D,O,.5),E.x=D[0],E.y=O[1],E.z=O[2];let r=n.localToMap(E);return r==null?null:v(r,n.spatialReference)}const E=g(0,0,0),D=a(),O=a();function k(e,t,n,i){let a=t.mapToLocalMultiple(e),s=null,c=null;if(n)s=a[0],c=a[1];else{let e=a[0],t=a[1],n=Math.round(t.x-e.x),r=Math.round(t.y-e.y),i=Math.max(Math.abs(n),Math.abs(r));s=g(n>0?e.x+i/2:e.x-i/2,r>0?e.y+i/2:e.y-i/2),c=g(Math.abs(n)>Math.abs(r)?s.x-i/2:s.x,Math.abs(n)>Math.abs(r)?s.y:s.y-i/2)}let l=t.localToMap(s),u=t.localToMap(c);if(l==null||u==null)return null;t.doUnnormalization&&_([[l,u]],t.spatialReference);let f=v(l,t.spatialReference),p=v(u,t.spatialReference),m=r(t.spatialReference),y=0;if(h(t.spatialReference))y=m*d(f,p);else{let e=s.x-c.x,t=s.y-c.y;y=m*Math.sqrt(e*e+t*t)*(i||1)}let b=new o({center:f,radius:y,radiusUnit:`meters`,spatialReference:t.spatialReference});return{geometry:x(b.rings,b.spatialReference,!1),center:f,edge:p}}function A(t,n,r){let i=n.mapToLocalMultiple(t),a=i[0],o=i[1],s=Math.round(o.x-a.x),c=Math.round(o.y-a.y),l=g(r?a.x:a.x+s/2,r?a.y:a.y+c/2),u=r?s:s/2,d=r?c:c/2,f=[],p=2*Math.PI/60;function m(e){let t=Math.cos(e),n=Math.sin(e);return g(u*t+l.x,d*n+l.y)}for(let e=0;e<60;e++)f.push(m(e*p));f.push(f[0]);let{spatialReference:h,doUnnormalization:_}=n,y=x([f.map(e=>n.localToMap(e)).filter(e)],h,_,!1),b=n.localToMap(m(Math.PI/2)),S=n.localToMap(m(0)),C=n.localToMap(m(-Math.PI/2)),w=n.localToMap(m(Math.PI));return{geometry:y,midpoints:b!=null&&S!=null&&C!=null&&w!=null?{top:v(b,h),right:v(S,h),bottom:v(C,h),left:v(w,h)}:null}}export{k as createCircle,A as createEllipse,y as createMultipoint,v as createPoint,x as createPolygon,b as createPolyline,C as createRectangle,S as createSquare};
2
+ import{isSome as e,equals as t}from"../../../core/arrayUtils.js";import{clone as n}from"../../../core/lang.js";import{getMetersPerUnitForSR as r}from"../../../core/units.js";import{lerp as i}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../geometry/Circle.js";import s from"../../../geometry/Multipoint.js";import c from"../../../geometry/Point.js";import l from"../../../geometry/Polygon.js";import u from"../../../geometry/Polyline.js";import{distanceExecute as d}from"../../../geometry/operators/distanceOperator.js";import{simplifyIsSimple as f,simplifyExecute as p}from"../../../geometry/operators/simplifyOperator.js";import{isClockwise as m}from"../../../geometry/support/coordsUtils.js";import{isValid as h}from"../../../geometry/support/spatialReferenceUtils.js";import{makeSurfacePoint as g}from"./surfaceCoordinateSystems.js";import{unnormalize as _}from"../../support/unnormalizationUtils.js";function v(e,t){let n=new c({x:e[0],y:e[1],spatialReference:t});return e.length>2&&(n.z=e[2]),n}function y(e,t){return new s({points:e,spatialReference:t})}function b(e,t,n){let r=new u({paths:e,spatialReference:t});return n&&_(r,r.spatialReference),r}function x(e,r,i,a=!0){let o=n(e);o.forEach(e=>{let n=e[0],r=e[e.length-1];t(n,r)&&e.length!==1||e.push(e[0])});let s=new l({rings:o,spatialReference:r});return s.rings.forEach(e=>{m(e)||e.reverse()}),i&&_(s,s.spatialReference),a&&!f(s)&&h(r)&&(s=p(s)||s),s}function S(t,n,r){let i=n.mapToLocalMultiple(t),a=[],o={x:i[0].x,y:i[0].y},s={x:i[1].x,y:i[1].y},c=Math.round(s.x-o.x),l=Math.round(s.y-o.y),u=Math.max(Math.abs(c),Math.abs(l));if(r){let e={x:o.x+u,y:o.y+u},t={x:o.x-u,y:o.y-u};a.push(g(e.x,t.y),g(t.x,t.y),g(t.x,e.y),g(e.x,e.y))}else{let e={x:c>0?o.x+u:o.x-u,y:l>0?o.y+u:o.y-u};a.push(g(o.x,o.y),g(e.x,o.y),g(e.x,e.y),g(o.x,e.y))}return w(x([a.map(e=>n.localToMap(e)).filter(e)],n.spatialReference,n.doUnnormalization,!0),a,n)}function C(t,n,r){let i=n.mapToLocalMultiple(t);if(i.length===1){let e=i[0];i=[g(e.x-48,e.y+48),g(e.x+48,e.y-48),g(e.x+48,e.y-48),g(e.x-48,e.y+48)]}let a=[],o={x:i[0].x,y:i[0].y},s={x:i[1].x,y:i[1].y};if(r){let e=Math.round(s.x-o.x),t=Math.round(s.y-o.y);a.push(g(o.x-e,o.y-t),g(s.x,o.y-t),g(s.x,s.y),g(o.x-e,s.y))}else a.push(g(o.x,o.y),g(s.x,o.y),g(s.x,s.y),g(o.x,s.y));return w(x([a.map(e=>n.localToMap(e)).filter(e)],n.spatialReference,n.doUnnormalization,!0),a,n)}function w(e,t,n){let r=T(t[3],t[2],n),i=T(t[1],t[2],n),a=T(t[0],t[1],n),o=T(t[0],t[3],n);return{geometry:e,midpoints:r!=null&&i!=null&&a!=null&&o!=null?{top:r,right:i,bottom:a,left:o}:null}}function T(e,t,n){D[0]=e.x,D[1]=e.y,D[2]=0,O[0]=t.x,O[1]=t.y,O[2]=0,i(D,D,O,.5),E.x=D[0],E.y=O[1],E.z=O[2];let r=n.localToMap(E);return r==null?null:v(r,n.spatialReference)}const E=g(0,0,0),D=a(),O=a();function k(e,t,n,i){let a=t.mapToLocalMultiple(e),s=null,c=null;if(n)s=a[0],c=a[1];else{let e=a[0],t=a[1],n=Math.round(t.x-e.x),r=Math.round(t.y-e.y),i=Math.max(Math.abs(n),Math.abs(r));s=g(n>0?e.x+i/2:e.x-i/2,r>0?e.y+i/2:e.y-i/2),c=g(Math.abs(n)>Math.abs(r)?s.x-i/2:s.x,Math.abs(n)>Math.abs(r)?s.y:s.y-i/2)}let l=t.localToMap(s),u=t.localToMap(c);if(l==null||u==null)return null;t.doUnnormalization&&_([[l,u]],t.spatialReference);let f=v(l,t.spatialReference),p=v(u,t.spatialReference),m=r(t.spatialReference),y=0;if(h(t.spatialReference))y=m*d(f,p);else{let e=s.x-c.x,t=s.y-c.y;y=m*Math.sqrt(e*e+t*t)*(i||1)}let b=new o({center:f,radius:y,radiusUnit:`meters`,spatialReference:t.spatialReference});return{geometry:x(b.rings,b.spatialReference,!1),center:f,edge:p}}function A(t,n,r){let i=n.mapToLocalMultiple(t),a=i[0],o=i[1],s=Math.round(o.x-a.x),c=Math.round(o.y-a.y),l=g(r?a.x:a.x+s/2,r?a.y:a.y+c/2),u=r?s:s/2,d=r?c:c/2,f=[],p=2*Math.PI/60;function m(e){let t=Math.cos(e),n=Math.sin(e);return g(u*t+l.x,d*n+l.y)}for(let e=0;e<60;e++)f.push(m(e*p));f.push(f[0]);let{spatialReference:h,doUnnormalization:_}=n,y=x([f.map(e=>n.localToMap(e)).filter(e)],h,_,!1),b=n.localToMap(m(Math.PI/2)),S=n.localToMap(m(0)),C=n.localToMap(m(-Math.PI/2)),w=n.localToMap(m(Math.PI));return{geometry:y,midpoints:b!=null&&S!=null&&C!=null&&w!=null?{top:v(b,h),right:v(S,h),bottom:v(C,h),left:v(w,h)}:null}}export{k as createCircle,A as createEllipse,y as createMultipoint,v as createPoint,x as createPolygon,b as createPolyline,C as createRectangle,S as createSquare};