@arcgis/core 5.1.0-next.111 → 5.1.0-next.113

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 (323) hide show
  1. package/analysis/ElevationProfile/ElevationProfileGroup.d.ts +3 -0
  2. package/analysis/ElevationProfile/ElevationProfileLineQuery.d.ts +1 -0
  3. package/analysis/ElevationProfileAnalysis.d.ts +5 -0
  4. package/analysis/ShadowCast/DiscreteOptions.d.ts +2 -2
  5. package/analysis/ShadowCast/TotalDurationOptions.d.ts +13 -4
  6. package/analysis/ShadowCastAnalysis.d.ts +8 -5
  7. package/arcade/Dictionary.js +1 -1
  8. package/arcade/Feature.js +1 -1
  9. package/arcade/Pixel.js +1 -1
  10. package/arcade/Voxel.js +1 -1
  11. package/arcade/arcade.js +1 -1
  12. package/arcade/arcadeAsyncRuntime.js +1 -1
  13. package/arcade/arcadeCompiler.js +1 -1
  14. package/arcade/arcadeEnvironment.js +1 -1
  15. package/arcade/arcadeRuntime.js +1 -1
  16. package/arcade/compilerUtils.js +1 -1
  17. package/arcade/containerUtils.js +1 -1
  18. package/arcade/debug.js +1 -1
  19. package/arcade/enum.js +1 -1
  20. package/arcade/executionError.js +1 -1
  21. package/arcade/functions/convertdirection.js +1 -1
  22. package/arcade/functions/date.js +1 -1
  23. package/arcade/functions/feature.js +1 -1
  24. package/arcade/functions/featuresetbase.js +1 -1
  25. package/arcade/functions/featuresetgeom.js +1 -1
  26. package/arcade/functions/featuresetstats.js +1 -1
  27. package/arcade/functions/featuresetstring.js +1 -1
  28. package/arcade/functions/geomasync.js +1 -1
  29. package/arcade/functions/geometry.js +1 -1
  30. package/arcade/functions/geomsync.js +1 -1
  31. package/arcade/functions/knowledgegraph.js +1 -1
  32. package/arcade/functions/maths.js +1 -1
  33. package/arcade/functions/stats.js +1 -1
  34. package/arcade/functions/string.js +1 -1
  35. package/arcade/functions/track.js +1 -1
  36. package/arcade/geometry/constructors.js +1 -1
  37. package/arcade/geometry/functions.js +1 -1
  38. package/arcade/geometry/unitConversion.js +1 -1
  39. package/arcade.js +1 -1
  40. package/assets/components/assets/icon/returnToDefault16.json +1 -0
  41. package/assets/components/assets/icon/returnToDefault24.json +1 -0
  42. package/assets/components/assets/icon/returnToDefault32.json +1 -0
  43. package/assets/components/assets/icon/reviewMap16.json +1 -0
  44. package/assets/components/assets/icon/reviewMap24.json +1 -0
  45. package/assets/components/assets/icon/reviewMap32.json +1 -0
  46. package/assets/esri/core/workers/RemoteClient.js +1 -1
  47. package/assets/esri/core/workers/chunks/{622bdd1b9d5d292ec12b.js → 02c0640005b09007bb70.js} +1 -1
  48. package/assets/esri/core/workers/chunks/0b76534b60014d74ecb9.js +1 -0
  49. package/assets/esri/core/workers/chunks/{34e026549ba2822b8ebd.js → 13d43a0683c42b94feb6.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{4f9ea7544b2d0e88a05c.js → 13f0e08de2dfab07d212.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{35bbd63319d8aa9f31cc.js → 169c9eb6cd000e067c4b.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{d4014213c476bf8099af.js → 18c4207b1cb0777560ba.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{58c15c42e6a618386a2f.js → 1c8c8050d60205cf2156.js} +1 -1
  54. package/assets/esri/core/workers/chunks/1f537c05c2f643acb5e7.js +1 -0
  55. package/assets/esri/core/workers/chunks/241aeff6afd074ce105b.js +1 -0
  56. package/assets/esri/core/workers/chunks/{beff5b4e15edee12bd4c.js → 271e42b7cd3c3441839e.js} +3 -3
  57. package/assets/esri/core/workers/chunks/{ddebc1dc10a2d207389f.js → 282f3d364411efac7b80.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{d6d5ee9d0d998d730f81.js → 2bd334f9ab89334df713.js} +1 -1
  59. package/assets/esri/core/workers/chunks/32f128a1615d71bbe899.js +2 -0
  60. package/assets/esri/core/workers/chunks/{17604cbd4d24158e2c16.js → 3835097520296b0517af.js} +1 -1
  61. package/assets/esri/core/workers/chunks/40df608337d562553ce1.js +2 -0
  62. package/assets/esri/core/workers/chunks/{9f4a9b193485f88d4461.js → 4afe76de6e82e86fe697.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{ac408c62565e2c8b5975.js → 4c5cdd2712c938fafc5d.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{94eab215bab3e4e0e5b5.js → 52a91c314afec70199bc.js} +1 -1
  65. package/assets/esri/core/workers/chunks/5c6742728fa705d2e16e.js +1 -0
  66. package/assets/esri/core/workers/chunks/{ece30bfd5c49b8d99752.js → 5e5c7cc74ff1c9603aff.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{502c3da8c49bf885f51d.js → 63ea9035dcf9ce45560c.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{33ec193e6d7a0cb9d8dd.js → 6b66a6f69aa03338c346.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{56b6b68d9459b1edea43.js → 6c97b5bc408f051606d2.js} +1 -1
  70. package/assets/esri/core/workers/chunks/701125f6cdd91ff3655f.js +2 -0
  71. package/assets/esri/core/workers/chunks/7995e6983456c779adf9.js +1 -0
  72. package/assets/esri/core/workers/chunks/{4e13d639419ac64f7563.js → 7c077e1a63ab97bf3e87.js} +1 -1
  73. package/assets/esri/core/workers/chunks/860465c4f44c373d0a1c.js +1 -0
  74. package/assets/esri/core/workers/chunks/86f2de7dda7992ae706c.js +1 -0
  75. package/assets/esri/core/workers/chunks/{a29cd1f5c7bb4f6a5a4f.js → 8d4881c879c86b353e08.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{6e21675bbd7a44070771.js → 8ff83c59462dea6e3427.js} +1 -1
  77. package/assets/esri/core/workers/chunks/979bab62cad788180770.js +1 -0
  78. package/assets/esri/core/workers/chunks/9890c85a238879490926.js +1 -0
  79. package/assets/esri/core/workers/chunks/9a11ff75009fef45b8c1.js +1 -0
  80. package/assets/esri/core/workers/chunks/a70fa35b2d19460637e9.js +2 -0
  81. package/assets/esri/core/workers/chunks/a95398214e530f896a2d.js +1 -0
  82. package/assets/esri/core/workers/chunks/ae74f722fb385e45fcf1.js +1 -0
  83. package/assets/esri/core/workers/chunks/{fc1fe1f58a65a1694c09.js → b4badbcf1bdb7823d825.js} +1 -1
  84. package/assets/esri/core/workers/chunks/b78fb24b47d9f31f18c6.js +1 -0
  85. package/assets/esri/core/workers/chunks/ba31616de9d73d83d867.js +1 -0
  86. package/assets/esri/core/workers/chunks/c7662455252b48531da1.js +1 -0
  87. package/assets/esri/core/workers/chunks/ca92176d5348e2c533d7.js +1 -0
  88. package/assets/esri/core/workers/chunks/cd5206e19d86c60e3cf0.js +1 -0
  89. package/assets/esri/core/workers/chunks/{bfb417d72d0c90e116fe.js → cedf3e316d6f89cf7005.js} +1 -1
  90. package/assets/esri/core/workers/chunks/d33a08e5f589355c57a3.js +1 -0
  91. package/assets/esri/core/workers/chunks/dd29fd1b3da90d3ca6b1.js +1 -0
  92. package/assets/esri/core/workers/chunks/e0036fa0324a96a88248.js +1 -0
  93. package/assets/esri/core/workers/chunks/e95ce76b5b816256a519.js +1 -0
  94. package/assets/esri/core/workers/chunks/ed939fd5d3827a3f70e0.js +1 -0
  95. package/assets/esri/core/workers/chunks/fbcf09526dc1bbe94b91.js +2 -0
  96. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +22 -6
  97. package/assets/esri/themes/dark/main.css +1 -1
  98. package/assets/esri/themes/light/main.css +1 -1
  99. package/assets/esri/themes/light/view.css +1 -1
  100. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis.json +1 -1
  101. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ar.json +1 -1
  102. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_en.json +1 -1
  103. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
  104. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
  105. package/assets/esri/widgets/Features/t9n/Features_en.json +1 -1
  106. package/chunks/GaussianSplatShadow.glsl.js +11 -9
  107. package/chunks/ShadowCastVisualize.glsl.js +26 -18
  108. package/chunks/aiServices.js +1 -1
  109. package/chunks/arcade.js +1 -1
  110. package/chunks/array.js +1 -1
  111. package/chunks/languageUtils.js +1 -1
  112. package/config.js +1 -1
  113. package/identity/IdentityModal.js +1 -1
  114. package/kernel.js +1 -1
  115. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  116. package/layers/KnowledgeGraphLayer.d.ts +6 -4
  117. package/layers/KnowledgeGraphLayer.js +1 -1
  118. package/layers/LinkChartLayer.js +1 -1
  119. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  120. package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
  121. package/layers/graphics/sources/parquet/PortalParquetLayerFileProvider.js +1 -1
  122. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  123. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  124. package/layers/support/SceneModification.js +1 -1
  125. package/layers/support/SceneModifications.js +1 -1
  126. package/layers/support/featureLayerUtils.js +1 -1
  127. package/layers/support/parquetUtils.js +1 -1
  128. package/linkChart/LinkChartProperties.js +1 -1
  129. package/linkChart/utils.js +1 -1
  130. package/package.json +2 -2
  131. package/renderers/ClassBreaksRenderer.js +1 -1
  132. package/renderers/UniqueValueRenderer.js +1 -1
  133. package/rest/support/TranslateContent.js +1 -1
  134. package/rest/support/TranslateParameters.js +1 -1
  135. package/rest/support/TranslateResult.js +1 -1
  136. package/rest/translate.js +1 -1
  137. package/rest/utils.js +1 -1
  138. package/support/arcadeUtils.js +1 -1
  139. package/support/revision.js +1 -1
  140. package/symbols/cim/types.d.ts +45 -1
  141. package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
  142. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedFillShader.js +1 -1
  143. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedLineShader.js +1 -1
  144. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerShader.js +1 -1
  145. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  146. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  147. package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
  148. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  149. package/views/3d/analysis/Viewshed/ViewshedDrawToolRenderer.js +1 -1
  150. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  151. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  152. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  153. package/views/3d/analysis/Viewshed/viewshedToolManipulatorUtils.js +1 -1
  154. package/views/3d/environment/EnvironmentManager.js +1 -1
  155. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  156. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  157. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  158. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  159. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  160. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  161. package/views/3d/state/utils/navigationUtils.js +1 -1
  162. package/views/3d/support/QualityProfile.js +1 -1
  163. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  164. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +3 -3
  165. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
  166. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  167. package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
  168. package/views/3d/webgl-engine/lib/PathEvaluator.js +2 -0
  169. package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
  170. package/views/3d/webgl-engine/lib/PathFrame2D.js +2 -0
  171. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  172. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  173. package/views/3d/webgl-engine/lib/PathVertexInfo.js +2 -0
  174. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  175. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  176. package/views/3d/webgl-engine/shaders/GaussianSplatShadow.glsl.js +1 -1
  177. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  178. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +1 -1
  179. package/views/DOMContainer.d.ts +2 -0
  180. package/views/LinkChartView.d.ts +47 -0
  181. package/views/MapView.d.ts +1 -85
  182. package/views/VideoView.d.ts +8 -1
  183. package/views/View2D.d.ts +78 -2
  184. package/views/draw/support/Reshape.js +1 -1
  185. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  186. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  187. package/views/types.d.ts +2 -3
  188. package/views/ui/DefaultUI.d.ts +1 -0
  189. package/widgets/Attachments.js +1 -1
  190. package/widgets/BasemapGallery.js +1 -1
  191. package/widgets/BasemapLayerList.js +1 -1
  192. package/widgets/BasemapToggle.js +1 -1
  193. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +17 -3
  194. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  195. package/widgets/BatchAttributeForm/css.js +1 -1
  196. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +25 -1
  197. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  198. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  199. package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.d.ts +46 -1
  200. package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
  201. package/widgets/BatchAttributeForm/inputs/UtilityNetworkAssociationsElementInput.js +1 -1
  202. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  203. package/widgets/BatchAttributeForm/interfaceUtils.js +1 -1
  204. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  205. package/widgets/BatchAttributeForm/types.d.ts +1 -1
  206. package/widgets/BatchAttributeForm.d.ts +2 -1
  207. package/widgets/BatchAttributeForm.js +1 -1
  208. package/widgets/Bookmarks.js +1 -1
  209. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
  210. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  211. package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
  212. package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
  213. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  214. package/widgets/CatalogLayerList.js +1 -1
  215. package/widgets/Compass.js +1 -1
  216. package/widgets/CoordinateConversion.js +1 -1
  217. package/widgets/Daylight.js +1 -1
  218. package/widgets/DirectionalPad.js +1 -1
  219. package/widgets/Directions.js +1 -1
  220. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  221. package/widgets/Editor/UpdateWorkflow.js +1 -1
  222. package/widgets/Editor/components/FeatureList.js +1 -1
  223. package/widgets/Editor/components/FooterActions.js +1 -1
  224. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  225. package/widgets/Editor/components/Prompt.js +1 -1
  226. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  227. package/widgets/ElevationProfile/components/LegendItem.js +1 -1
  228. package/widgets/ElevationProfile.js +1 -1
  229. package/widgets/Expand.js +1 -1
  230. package/widgets/Feature/FeatureMedia.js +1 -1
  231. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  232. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  233. package/widgets/FeatureForm/RelationshipInput.d.ts +3 -3
  234. package/widgets/FeatureForm/RelationshipInput.js +1 -1
  235. package/widgets/FeatureForm/UtilityNetworkAssociationInput.js +1 -1
  236. package/widgets/FeatureForm.js +1 -1
  237. package/widgets/FeatureTable.js +1 -1
  238. package/widgets/Features/FeaturesDrillIn.js +1 -1
  239. package/widgets/Features.js +1 -1
  240. package/widgets/FloorFilter.js +1 -1
  241. package/widgets/FovOverlay.js +1 -1
  242. package/widgets/Fullscreen.js +1 -1
  243. package/widgets/Home.js +1 -1
  244. package/widgets/LayerList/LayerListItem.js +1 -1
  245. package/widgets/LayerList.js +1 -1
  246. package/widgets/Locate.js +1 -1
  247. package/widgets/NavigationToggle.js +1 -1
  248. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  249. package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
  250. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  251. package/widgets/OrientedImageryViewer/components/NavigationActions.js +1 -1
  252. package/widgets/OrientedImageryViewer/components/NavigationUI360.js +1 -1
  253. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  254. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  255. package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
  256. package/widgets/OrientedImageryViewer.js +1 -1
  257. package/widgets/PanoramicVideoViewer.js +1 -1
  258. package/widgets/Print.js +1 -1
  259. package/widgets/Search.js +1 -1
  260. package/widgets/Sketch/SketchViewModel.js +1 -1
  261. package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
  262. package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
  263. package/widgets/Sketch.js +1 -1
  264. package/widgets/Slice.js +1 -1
  265. package/widgets/Slider.js +1 -1
  266. package/widgets/Swipe.js +1 -1
  267. package/widgets/TableList.js +1 -1
  268. package/widgets/TimeSlider.js +1 -1
  269. package/widgets/TimeZoneLabel.js +1 -1
  270. package/widgets/Track.js +1 -1
  271. package/widgets/UtilityNetworkAssociations.js +1 -1
  272. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  273. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  274. package/widgets/UtilityNetworkTrace.js +1 -1
  275. package/widgets/UtilityNetworkValidateTopology.js +1 -1
  276. package/widgets/ValuePicker.js +1 -1
  277. package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
  278. package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
  279. package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
  280. package/widgets/Weather.js +1 -1
  281. package/widgets/Zoom.js +1 -1
  282. package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
  283. package/widgets/support/ColorPicker.js +1 -1
  284. package/widgets/support/ContingentValuesManager.js +1 -1
  285. package/widgets/support/FilterBuilder.js +1 -1
  286. package/widgets/support/GridControls.js +1 -1
  287. package/widgets/support/ItemList.js +1 -1
  288. package/widgets/support/LabeledSwitch.js +1 -1
  289. package/widgets/support/SelectionList.js +1 -1
  290. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.d.ts +66 -6
  291. package/widgets/support/SelectionToolbar/types.d.ts +20 -1
  292. package/assets/esri/core/workers/chunks/1d1929f98d941179be29.js +0 -2
  293. package/assets/esri/core/workers/chunks/286bf3be9f524bde9529.js +0 -1
  294. package/assets/esri/core/workers/chunks/36ecb0082b8804b10fbf.js +0 -1
  295. package/assets/esri/core/workers/chunks/41a95ad470ec42ecd5a2.js +0 -1
  296. package/assets/esri/core/workers/chunks/547dc6ccb989bd962661.js +0 -1
  297. package/assets/esri/core/workers/chunks/549d348ca181d06aefb7.js +0 -2
  298. package/assets/esri/core/workers/chunks/55334ad3618899cdbf78.js +0 -2
  299. package/assets/esri/core/workers/chunks/56d9d3f108ff6e719dd4.js +0 -1
  300. package/assets/esri/core/workers/chunks/5c44638670e40e092ce3.js +0 -1
  301. package/assets/esri/core/workers/chunks/63934843c9f4ef779a07.js +0 -1
  302. package/assets/esri/core/workers/chunks/69c9eb93553b006b640d.js +0 -2
  303. package/assets/esri/core/workers/chunks/8330302096d4312a4393.js +0 -1
  304. package/assets/esri/core/workers/chunks/885eac78a76184efa1e5.js +0 -1
  305. package/assets/esri/core/workers/chunks/8a1751187a20b6578875.js +0 -1
  306. package/assets/esri/core/workers/chunks/95dee5853c6e89f15ea9.js +0 -1
  307. package/assets/esri/core/workers/chunks/9da2f2b67837b491cfa3.js +0 -1
  308. package/assets/esri/core/workers/chunks/a913a1c83a667ed0e711.js +0 -1
  309. package/assets/esri/core/workers/chunks/aca9591d3467a24f8329.js +0 -1
  310. package/assets/esri/core/workers/chunks/b69d1d528e271568cbd8.js +0 -2
  311. package/assets/esri/core/workers/chunks/bc249bb667f0564ad093.js +0 -1
  312. package/assets/esri/core/workers/chunks/c8b96104641cb4afd4df.js +0 -1
  313. package/assets/esri/core/workers/chunks/cdb48d198145493f76f3.js +0 -1
  314. package/assets/esri/core/workers/chunks/d00b9c1fd0865bf8f317.js +0 -1
  315. package/assets/esri/core/workers/chunks/deab352545c34cac148c.js +0 -1
  316. package/assets/esri/core/workers/chunks/e2bb95d601789bbda73b.js +0 -1
  317. package/assets/esri/core/workers/chunks/f1bb426400dac02880f1.js +0 -1
  318. package/assets/esri/core/workers/chunks/f3f984c62311c20a9db8.js +0 -1
  319. /package/assets/esri/core/workers/chunks/{55334ad3618899cdbf78.js.LICENSE.txt → 32f128a1615d71bbe899.js.LICENSE.txt} +0 -0
  320. /package/assets/esri/core/workers/chunks/{69c9eb93553b006b640d.js.LICENSE.txt → 40df608337d562553ce1.js.LICENSE.txt} +0 -0
  321. /package/assets/esri/core/workers/chunks/{549d348ca181d06aefb7.js.LICENSE.txt → 701125f6cdd91ff3655f.js.LICENSE.txt} +0 -0
  322. /package/assets/esri/core/workers/chunks/{b69d1d528e271568cbd8.js.LICENSE.txt → a70fa35b2d19460637e9.js.LICENSE.txt} +0 -0
  323. /package/assets/esri/core/workers/chunks/{1d1929f98d941179be29.js.LICENSE.txt → fbcf09526dc1bbe94b91.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t,__decorate as o}from"tslib";import i from"../../Graphic.js";import{prefersReducedMotion as a}from"../../core/a11yUtils.js";import{isSome as r}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import n from"../../core/Error.js";import{EventedAccessor as p}from"../../core/Evented.js";import{makeHandle as l,drainHandles as h,disposable as d,destroyHandle as c}from"../../core/handleUtils.js";import"../../core/has.js";import u from"../../core/Logger.js";import{destroyMaybe as y,abortMaybe as m}from"../../core/maybe.js";import{createAbortError as g,ignoreAbortErrors as v,whenOrAbort as f}from"../../core/promiseUtils.js";import{watch as _,syncAndInitial as b,on as w,when as T,whenOnce as G}from"../../core/reactiveUtils.js";import{property as O,subclass as S}from"../../core/accessorSupport/decorators.js";import{trackAccess as C}from"../../core/accessorSupport/tracking.js";import{SimpleObservable as A}from"../../core/accessorSupport/tracking/SimpleObservable.js";import{UpdatingHandles as E}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as M}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as k,isLoaded as H,load as P,project as I}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as D}from"../../geometry/support/coordsUtils.js";import{equals as j}from"../../geometry/support/spatialReferenceUtils.js";import U from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as R}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as x}from"../../support/elevationInfoUtils.js";import L from"../../symbols/CIMSymbol.js";import F from"../../symbols/FillSymbol3DLayer.js";import V from"../../symbols/MeshSymbol3D.js";import W from"../../symbols/SimpleFillSymbol.js";import K from"../../symbols/SimpleLineSymbol.js";import Z from"../../symbols/SimpleMarkerSymbol.js";import q from"../../symbols/TextSymbol.js";import{symbolTypes as N}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as z}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as B}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as $}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as Y}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as X}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as J}from"../../views/input/InputManager.js";import{sketchKeys as Q}from"../../views/interactive/keybindings.js";import ee from"../../views/interactive/sketch/SketchLabelOptions.js";import te from"../../views/interactive/sketch/SketchOptions.js";import oe from"../../views/interactive/sketch/SketchTooltipOptions.js";import ie from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as ae}from"../../views/interactive/snapping/SnappingManager.js";import re from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as se}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as ne}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as pe}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as le}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as he}from"../../views/support/screenUtils.js";import de from"./adapters/layer/GraphicsLayerAdapter.js";import ce from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as ue,DrawToolOperationHandle as ye,UpdateOperationHandle as me}from"./support/OperationHandle.js";import{PluginManager as ge}from"./support/PluginManager.js";import{SettingsManager as ve}from"./support/SettingsManager.js";import{getLegacyTool as fe,isCompletelyDegenerate as _e,graphicsHaveTooFewVerticesForBox as be,getModeFromCreateOptions as we,getDrawToolGeometryTypeFromCreateTool as Te}from"./support/sketchUtils.js";const Ge={defaultZ:0},Oe={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move",enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:pe},tool:"transform"},Se=Symbol(),Ce=Symbol();let Ae=class extends p{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new U({listMode:"hide",internal:!0,title:"SVM Internal"}),this._pluginManager=new ge({sketchViewModel:this}),this.settingsManager=new ve({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new E,this._toolTransitionHandles=new E,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new ne,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.activeUpdateOptions=null,this.layer=null,this.pointSymbol=new Z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new W({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new K({color:[130,130,130,1],width:2}),this.meshSymbol=new V({symbolLayers:new s([new F])}),this.updateGraphics=new s,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new Z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new te,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(Ce),!e)return;const t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),_(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},b)].filter(r);this.addHandles(t,Ce)},this._originalPopupEnabled=null,this.defaultCreateOptions=Ge,this.defaultUpdateOptions=Oe,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new re,this.textSymbol=new q({text:"text"})}initialize(){this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([w(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),_(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),b),_(()=>this.view,e=>{this._defaultSnappingManager=y(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new ae({view:e,options:this.snappingOptions})),"2d"===e.type?(import("../../views/2d/interactive/editingTools.js"),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},b),_(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),se(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=y(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this._toolTransitionHandles.destroy(),this._drawToolSimplifyAbortController=m(this._drawToolSimplifyAbortController),this._geometryWorkerHandle.destroy(),this._pluginManager?.destroy(),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new de(e);case"map-notes":return new ce(e);default:return null}}get activeTool(){return this._operationHandle?.tool??null}get geometrySimplificationInProgress(){return!!this._drawToolSimplifyAbortController}get activeCreateToolDrawMode(){const e=this._operationHandle;if("create"===e?.type&&e.activeComponent&&"mode"in e.activeComponent)return e.activeComponent.mode;if("draw-2.0"===e?.activeComponent?.type){const t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(r).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...Ge,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...Oe,...e,reshapeOptions:{...Oe.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...Oe.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get("textSymbol")}set textSymbol(e){this._set("textSymbol",e)}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=y(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new ae({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get toolTransitionInProgress(){return this._toolTransitionHandles.updating||!!this.drawTool?.lifecycleManager.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.activeComponent&&"updating"in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this._drawToolSimplifyAbortController||this.snappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(T(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},b),o),this._set("view",e),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||"2d"!==this.view?.type}get pluginManager(){return this._pluginManager}get drawTool(){return"draw-2.0"!==this.activeComponent?.type?null:this.activeComponent}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome("rootPlugins",e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;const e=this.view?.type??"2d",{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(r)??[]}get firstPluginWithSwappableLeaf(){const e=this.view?.type??"2d",t=this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>null!=t&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1);return t}get multiplePluginsActive(){return!!this.drawTool&&this.drawTool.pluginStack.length>1}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=m(this._moduleLoaderAbortController),this._viewReadyAbortController=m(this._viewReadyAbortController),this._drawToolSimplifyAbortController=m(this._drawToolSimplifyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){return this._toolTransitionHandles.addPromise(this._create(e,t))}async _create(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),g();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");X(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const r=fe(e),s=()=>{if(a===this._operationHandle){const o=this.createGraphic,i=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),a.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:i?"cancel":"complete",tool:r??"point",toolEventInfo:null,type:"create"}),i||this._sketchContinuationFlag)return;const{creationMode:s}=this;if("continuous"===s){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(v(this.create(e,t)))}else"update"===s&&o&&this._updatingHandles.consumePromise(v(this.update([o])))}};a.on("complete",s),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){return this._toolTransitionHandles.addPromise(this._update(e,t))}async _update(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),g();null!=i.activeTool&&(i.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const s=await this._updatingHandles.addPromise(this._setupUpdateOperation(r,t));this.destroyed||null==s||Re(s)||(X(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||j(o.geometry.spatialReference,t.spatialReference)||(k(o.geometry.spatialReference,t.spatialReference)||H()||await P(),o.geometry=I(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return le(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{R(e)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?M(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},J.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(he(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||this.hasGraphic(i)?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a="string"==typeof e?this.pluginManager?.getPluginsEquivalentToCreateTool(e,i.mode):e,r=fe(e);if(a&&!this.isUsingLegacyCreateTools){const e=await this._setupDrawTool(a,i,r??"polyline");if(e)return this._setupDrawToolOperationHandle(e,r??"point")}if(!r)return null;const s=await this._setupDrawGraphicTool(r,o,i);return null==s?null:(o.tools.add(s),o.activeTool=s,this._setupCreateOperationHandle(s,r))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=we(p,e),d=Te(e),c=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=c?.preserveAspectRatio??l??"rectangle"!==e,y={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:s,geometryType:d,mode:h,graphicSymbol:o.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:r,snappingManager:this.snappingManager,snapToScene:!1,view:t,...c};return"2d"===t.type?this._makeDrawGraphicTool2D(y):this._makeDrawGraphicTool3D(y)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return Re(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:ke(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));return Re(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let i=null;const a=e.forceUniformSize,r=e.centered,s=new A,n=[l(()=>s.destroy()),o.on("key-down",t=>{if(t.key===Q.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===Q.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==Q.vertexAdd||t.repeat)t.key===Q.undo?(t.stopPropagation(),p.undo()):t.key===Q.redo?(t.stopPropagation(),p.redo()):t.key!==Q.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===Q.center&&(t.repeat||(e.centered=!r,t.stopPropagation())):(e.forceUniformSize=!a,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},J.WIDGET),o.on("key-up",t=>{t.key===Q.pan?e.enabled=!0:t.key!==Q.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===Q.center&&(e.centered=r,t.stopPropagation()):(e.forceUniformSize=a,t.stopPropagation())},J.WIDGET),e.on("vertex-update",()=>{s.notify()}),e.on("vertex-add",t=>{switch(s.notify(),i=null==i?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:i,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(s.notify(),t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),i="complete",e.aborted?p&&p.cancel():p&&p.complete()}),_(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],p=new ue({activeComponent:e,type:"create",onEnd:()=>{h(n),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>(C(s),e.canUndo),canRedo:()=>(C(s),e.canRedo)});return p}_setupDrawToolOperationHandle(o,i){const a=this.view;if(!a)return this._logMissingView(),null;let s=null;const n=[a.on("key-down",e=>{e.key===Q.pan&&(e.stopPropagation(),e.repeat||(o.editable=!1))},J.WIDGET),a.on("key-up",e=>{e.key===Q.pan&&(o.editable=!0)},J.WIDGET),o.on("before-vertex-add",e=>{const t=o.mostUpstreamPlugin?.configuration;if(t&&"legacyCreateTool"in t&&("point"===t?.legacyCreateTool||"text"===t.legacyCreateTool)){const t=e.detail.originalEvent;return void(t&&"key"in t&&t.key===Q.vertexAdd&&e.preventDefault())}}),o.on("before-complete",e=>{const t=o.getGeometryIfCompleted();(!t||_e(t))&&e.preventDefault()}),o.on(["vertex-add","vertex-remove"],e=>{switch(this.createGraphic&&(this.createGraphic.geometry=o.getGeometryIfCompleted()),s=null==s&&"vertex-remove"!==e.type?"start":"active",e.operation){case"apply":this.emit("create",{graphic:this.createGraphic,state:s,tool:this.activeTool,toolEventInfo:e,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[this.createGraphic].filter(r),tool:i});break;case"redo":this._emitRedoEvent({graphics:[this.createGraphic].filter(r),tool:i})}}),o.on("cursor-update",e=>{this.createGraphic&&(this.createGraphic.geometry=o.unprocessedGeometry),(e.vertices[0]?.vertexIndex>0||e.vertices[0]?.componentIndex>0)&&this.emit("create",{graphic:this.createGraphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:e.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),o.on("complete",async({geometry:i,isSimple:a})=>{const r=this.createGraphic;if(!!i&&"mesh"!==i.type&&"extent"!==i.type&&!a&&r){const a={stack:[],error:void 0,hasError:!1};try{const t=new AbortController;this._drawToolSimplifyAbortController?.abort(),this._drawToolSimplifyAbortController=t;e(a,d(this._createDrawToolCompletionPreviewGraphic(o,i,r)),!1);await this._updatingHandles.addPromise(v(this._finalizeDrawToolCompletion({abortController:t,geometry:i,graphic:r,handle:p})))}catch(s){a.error=s,a.hasError=!0}finally{t(a)}}else r&&(r.geometry=i),p.complete()})],p=new ye({activeComponent:o,type:"create",onEnd:()=>{h(n),a.tools.remove(o)},undo:()=>o.undo(),redo:()=>o.redo(),canUndo:()=>o.canUndo,canRedo:()=>o.canRedo});return n.push(o.on("cancel",()=>{this._drawToolSimplifyAbortController=m(this._drawToolSimplifyAbortController),p.cancel()})),p}_createDrawToolCompletionPreviewGraphic(e,t,o){const a="polygon"===t?.type?this._createAnimatedPolygonPreviewSymbol():o?.symbol,r=t?e.simplifiedGeometryPreview??t:null;if(!r||!a)return l();const s=new i({geometry:r,symbol:a});return this._internalGraphicsLayer.add(s),l(()=>this._internalGraphicsLayer.remove(s))}async _finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:o,handle:i}){const a=this.view?.acquireCursor("progress","high");a&&this.addHandles(a);const r=()=>!!e.signal.aborted&&(o&&this._layerAdapter?.remove(o),this._set("createGraphic",null),!0);try{const a=await this._geometryWorkerHandle.simplify(t,e.signal);if(r())return;o.geometry=a??t,i.complete()}finally{a?.remove(),this._drawToolSimplifyAbortController===e&&(this._drawToolSimplifyAbortController=null)}}_createAnimatedPolygonPreviewSymbol(){const e={type:"CIMAnimatedSymbolProperties",playAnimation:!a(),duration:1,repeatType:"Oscillate",easing:"EaseInOut"};return new L({data:{type:"CIMSymbolReference",symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[180,180,180,36],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]},{type:"CIMHatchFill",enable:!0,separation:6,rotation:-45,offsetX:0,offsetY:0,lineSymbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:.8,color:[100,100,100,110],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]}]}},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:1.8,color:[60,60,60,255],effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[6,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:70,animatedSymbolProperties:e}]}]}}})}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const i={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=i;let a=i.tool??Oe.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(a){case"move":return this._setupMove3DOperation(e,i,o,a);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],i,o);case"transform":return this._setupGraphicTransform3DOperation(e,i,o)}}switch(a){case"move":return this._setupMove2DOperation(e,i,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,a,i,o);case"transform":return be(e)&&(a="reshape"),this._setupTransformOrReshape2DOperation(e,a,i,o)}}async _setupMove3DOperation(e,t,o,i,a=!1){const r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Re(r))return r;const{ManipulatedObject3DGraphic:s,MoveTool3D:n}=r.module,p=new Map,l=()=>{p.forEach(e=>e.destroy()),p.clear()};for(const h of e){const e=new s({view:o,graphic:h}),t=B(e);if(0!==t)return l(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${z(t)}).`),null;p.set(h,e)}const d=new n({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),d.objects.addMany(Array.from(p.values())),a||this.updateGraphics.addMany(e);const c=[],u=new me({activeComponent:d,tool:i,type:"update",onEnd:()=>{h(c),Ue(o,d),l()},undo:()=>{De(this.view,d),He(u,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{Pe(u,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new s({view:o,graphic:e});p.set(e,t),d.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(u.history.undo.forEach(e=>e.updates.splice(t,1)),u.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void u.complete();const o=p.get(e);o&&(d.objects.remove(o),o.destroy(),p.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));a&&!Re(a)&&(u.onEnd(),u.destroy(),this._setUpdateOperationHandle(a,t))}});return c.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(u,e,t),J.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(u,e)},J.WIDGET)),u}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===Y(e[0])){const a=e[0],r=a.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:r,enableZ:s}=t,n=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Re(n))return n;const{TransformTool3D:p,ManipulatedObject3DGraphic:l}=n.module,d=new l({graphic:e,view:o}),c=new p({object:d,view:o,enableRotation:a,enableScaling:r,enableZ:s,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),this.updateGraphics.add(e);const u=[],y=new me({activeComponent:c,tool:i,type:"update",onEnd:()=>{h(u),Ue(o,c),d.destroy()},undo:()=>{De(this.view,c),He(y,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{Pe(y,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),y.onEnd(),y.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Re(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),y.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(y,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(y,e,t),J.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(y,e)},J.WIDGET)),y}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:p}=t,l=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Re(l))return l;const{ManipulatedObject3DGraphic:d,ExtentTransformTool:c}=l.module,u=this.view?.inputManager?.isModifierKeyDown(Q.constraint),y=new d({view:o,graphic:e}),m=new c({object:y,view:o,enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:!!p!=!!u,sketchOptions:this.sketchOptions});o.tools.add(m),i||this.updateGraphics.add(e);const g=[],v=new me({activeComponent:m,tool:a,type:"update",onEnd:()=>{h(g),Ue(o,m),y.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),v.onEnd(),v.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Re(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),v.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));i&&!Re(i)&&(v.onEnd(),v.destroy(),this._setUpdateOperationHandle(i,t))}});return g.push(...this._getHandlesForComponent(v,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(v,e,t),J.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(v,e),J.WIDGET),o.on("key-down",e=>{e.key!==Q.constraint||e.repeat||(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())},J.WIDGET),o.on("key-up",e=>{e.key===Q.constraint&&(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())},J.WIDGET)),v}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,o));if(Re(a))return a;const r=new me({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._clearCursor(),h(p),h(n),a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();He(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();Pe(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:r.complete()}});let s=!1;const n=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,t),J.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==Q.constraint||e.repeat||(s=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},J.WIDGET),o.on("key-up",e=>{e.key===Q.constraint&&s&&(s=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},J.WIDGET)],p=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Re(r))return r;const{ManipulatedObject3DGraphic:s,ReshapeTool3D:n}=r.module,p=new s({view:o,graphic:e}),l=$(p);if(0!==l)return p.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${z(l)}).`),null;const d=t.reshapeOptions,c=new n({view:o,object:p,enableZVertex:t.enableZ&&"move"===d?.vertexOperation,enableZShape:t.enableZ&&"move"===d?.shapeOperation,enableMoveObject:"move"===d?.shapeOperation||"move-xy"===d?.shapeOperation,enableMidpoints:"split"===d?.edgeOperation,enableEdgeOffset:"offset"===d?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),i||this.updateGraphics.add(p.graphic);const u=[],y=new me({activeComponent:c,tool:a,type:"update",onEnd:()=>{h(u),Ue(o,c),p.destroy()},canUndo:()=>!c.destroyed&&c.canUndo,undo:()=>{c.destroyed||(c.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!c.destroyed&&c.canRedo,redo:()=>{c.destroyed||(c.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),y.onEnd(),y.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Re(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),y.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;y.onEnd(),y.destroy();const e=await this._updatingHandles.addPromise(this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0));Re(e)||this._setUpdateOperationHandle(e,t)}});return u.push(...this._getHandlesForComponent(y,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(y,e,t),J.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(y,e)},J.WIDGET)),y}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise("transform"===t?this._getBox(e,o,i):this._getReshape(e,o,i));if(Re(a))return a;const r=new me({activeComponent:a,type:"update",onEnd:()=>{h(n),h(s),r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{He(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{Pe(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),r.onEnd(),r.destroy();const a=await this._updatingHandles.addPromise(this._setupTransformOrReshape2DOperation(t,"transform",o,i));if(Re(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?r.complete():be(o)?r.toggleTool():r.activeComponent.graphics=o,this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&"point"===t.type||"transform"===r.tool&&"extent"===t.type))return;let a=null;const s={...this.defaultUpdateOptions,...o,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...o?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...o?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};"transform"===r.tool?a=await this._updatingHandles.addPromise(this._getReshape([e],s,i)):"reshape"===r.tool&&(a=await this._updatingHandles.addPromise(this._getBox([e],s,i))),Re(a)||(r.activeComponent?.destroy(),r.activeComponent=a,r.activeComponent&&(h(n),n=this._getHandlesForComponent(r,s)))}}),s=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,o),J.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===Q.constraint&&!e.repeat&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},J.WIDGET),i.on("key-up",e=>{if(e.key===Q.constraint&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},J.WIDGET)];let n=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return Re(r)?r:new r.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayCursor("pointer"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:r,preserveAspectRatio:s}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(Re(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(Q.constraint),l=new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:r?.name,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}});return l.addHandles(_(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,o])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=o??t.enableScaling??!0,l.refresh()},b)),l}async _getReshape(e,t,o){const{highlightOptions:i,reshapeOptions:a}=t,r="split"===a?.edgeOperation,s="move"===a?.shapeOperation,n=!!a?.enableCreateCurveFromStraightEdge,p=await this._requireModule(import("../../views/draw/support/Reshape.js"));return Re(p)?p:new p.module.default({enableMidpoints:r,enableMovement:s,enableCurveOnMidpoint:n,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map(e=>D(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map(e=>D(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(je(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(je(t.graphics))),o.on("rotate-start",t=>e.addToHistory(je(t.graphics))),o.on("scale-start",t=>e.addToHistory(je(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(je([t.mover]))),o.on("reshape-start",t=>e.addToHistory(je([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(je([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(je([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&this.hasGraphic(i)?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=he(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void(this.updateOnGraphicClick&&e.complete());if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!i||!this.hasGraphic(e))&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===Q.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===Q.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===Q.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&Q.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&"update"===this._operationHandle.type&&null!=this.activeComponent&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=y(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(Se)}_displayCursor(e){this.removeHandles(Se),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),Se)}_logError(e,t,o){u.getLogger(this).error(new n(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._operationHandle.removeFromSelection(o)}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,t,o){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;const a=this.view,r=await import("../../views/draw/DrawTool.js");await this.pluginManager.loadPlugins();const s=await this.pluginManager.makeRenderer({customSymbol:t.graphicSymbol,useTextSymbol:"text"===o}),n=new r.DrawTool({view:a,elevationInfo:this._layerAdapter?.elevationInfo??x("3d"===a.type),hasZ:!!t.hasZ,sketchOptions:this.sketchOptions,renderer:s,defaultZ:t.defaultZ??0,directionOptions:t.directionOptions,snappingManager:this.snappingManager,enableVertexVisuals:"rectangle"!==o&&"circle"!==o,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});n.addHandles(c(s));const p=new i({...t.graphicProperties,attributes:{...t.graphicProperties?.attributes},symbol:t.graphicSymbol??this._getGraphicSymbolFromTool(o)});return t.graphicSymbol||n.addHandles(_(()=>this._getGraphicSymbolFromTool(o),e=>p.symbol=e)),this._set("createGraphic",p),a.addAndActivateTool(n),n.begin(e),n}get test(){}wait(){return G(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(m(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await f(G(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",Me("view"))}_logMissingLayer(){this._logError(Ee,Me("layer"))}};o([O()],Ae.prototype,"_defaultSnappingManager",void 0),o([O()],Ae.prototype,"_layerAdapter",null),o([O()],Ae.prototype,"_pluginManager",void 0),o([O({readOnly:!0})],Ae.prototype,"settingsManager",void 0),o([O()],Ae.prototype,"_operationHandle",void 0),o([O({readOnly:!0})],Ae.prototype,"_updatingHandles",void 0),o([O({readOnly:!0})],Ae.prototype,"_toolTransitionHandles",void 0),o([O()],Ae.prototype,"_drawToolSimplifyAbortController",void 0),o([O({readOnly:!0})],Ae.prototype,"activeTool",null),o([O()],Ae.prototype,"geometrySimplificationInProgress",null),o([O({readOnly:!0})],Ae.prototype,"activeCreateToolDrawMode",null),o([O()],Ae.prototype,"activeTooltip",null),o([O({types:N})],Ae.prototype,"activeFillSymbol",void 0),o([O()],Ae.prototype,"activeLineSymbol",void 0),o([O()],Ae.prototype,"activeVertexSymbol",void 0),o([O()],Ae.prototype,"allowDeleteKey",void 0),o([O({readOnly:!0})],Ae.prototype,"createGraphic",null),o([O()],Ae.prototype,"defaultCreateOptions",null),o([O()],Ae.prototype,"defaultUpdateOptions",null),o([O()],Ae.prototype,"activeUpdateOptions",void 0),o([O({type:ee,nonNullable:!0})],Ae.prototype,"labelOptions",null),o([O()],Ae.prototype,"layer",void 0),o([O({types:N})],Ae.prototype,"pointSymbol",void 0),o([O({types:N})],Ae.prototype,"polygonSymbol",void 0),o([O({types:N})],Ae.prototype,"polylineSymbol",void 0),o([O()],Ae.prototype,"meshSymbol",void 0),o([O({type:q})],Ae.prototype,"textSymbol",null),o([O({type:re,nonNullable:!0})],Ae.prototype,"snappingOptions",null),o([O()],Ae.prototype,"snappingManager",null),o([O({readOnly:!0})],Ae.prototype,"state",null),o([O()],Ae.prototype,"toolTransitionInProgress",null),o([O({type:oe,nonNullable:!0})],Ae.prototype,"tooltipOptions",null),o([O({readOnly:!0})],Ae.prototype,"updateGraphics",void 0),o([O()],Ae.prototype,"updateOnGraphicClick",void 0),o([O()],Ae.prototype,"updating",null),o([O()],Ae.prototype,"creationMode",void 0),o([O({type:ie,nonNullable:!0})],Ae.prototype,"valueOptions",null),o([O({types:N})],Ae.prototype,"vertexSymbol",void 0),o([O({value:null})],Ae.prototype,"view",null),o([O({constructOnly:!0,type:te})],Ae.prototype,"sketchOptions",void 0),o([O()],Ae.prototype,"useLegacyCreateTools",void 0),o([O()],Ae.prototype,"isUsingLegacyCreateTools",null),o([O()],Ae.prototype,"pluginManager",null),o([O()],Ae.prototype,"drawTool",null),o([O()],Ae.prototype,"rootPlugins",null),o([O()],Ae.prototype,"effectiveAvailablePlugins",null),o([O()],Ae.prototype,"firstPluginWithSwappableLeaf",null),o([O()],Ae.prototype,"multiplePluginsActive",null),Ae=o([S("esri.widgets.Sketch.SketchViewModel")],Ae);const Ee="sketch:missing-property",Me=e=>`Property '${e}' is missing on SketchViewModel.`;function ke(e){return"polygon"===e||"rectangle"===e||"circle"===e}function He(e,t){Ie("undo",e.history.undo,e.history.redo,t)}function Pe(e,t){Ie("redo",e.history.redo,e.history.undo,t)}function Ie(e,t,o,i){const a=t.pop();if(!a)return;const r=a.updates,s=[];i.forEach((t,o)=>{const i=r[o];null!=i&&("geometry"in i&&null!=i.geometry&&(s.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(s.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(s.push(i),i[e](t)))}),o.push({updates:s})}function De(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function je(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function Ue(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function Re(e){return"requireError"in e&&"aborted"===e.requireError}export{Ae as default};
2
+ import{__addDisposableResource as e,__disposeResources as t,__decorate as o}from"tslib";import i from"../../Graphic.js";import{prefersReducedMotion as a}from"../../core/a11yUtils.js";import{isSome as r}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import n from"../../core/Error.js";import{EventedAccessor as p}from"../../core/Evented.js";import{makeHandle as l,drainHandles as h,disposable as d,destroyHandle as c}from"../../core/handleUtils.js";import"../../core/has.js";import u from"../../core/Logger.js";import{destroyMaybe as m,abortMaybe as y}from"../../core/maybe.js";import{createAbortError as g,ignoreAbortErrors as v,whenOrAbort as f}from"../../core/promiseUtils.js";import{watch as _,syncAndInitial as b,on as w,when as T,whenOnce as G}from"../../core/reactiveUtils.js";import{property as O,subclass as S}from"../../core/accessorSupport/decorators.js";import{trackAccess as C}from"../../core/accessorSupport/tracking.js";import{SimpleObservable as A}from"../../core/accessorSupport/tracking/SimpleObservable.js";import{UpdatingHandles as E}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as M}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as k,isLoaded as H,load as P,project as I}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as D}from"../../geometry/support/coordsUtils.js";import{equals as j}from"../../geometry/support/spatialReferenceUtils.js";import U from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as R}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as x}from"../../support/elevationInfoUtils.js";import L from"../../symbols/CIMSymbol.js";import F from"../../symbols/FillSymbol3DLayer.js";import V from"../../symbols/MeshSymbol3D.js";import W from"../../symbols/SimpleFillSymbol.js";import K from"../../symbols/SimpleLineSymbol.js";import Z from"../../symbols/SimpleMarkerSymbol.js";import q from"../../symbols/TextSymbol.js";import{symbolTypes as N}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as z}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as B}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as $}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as Y}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as X}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as J}from"../../views/input/InputManager.js";import{sketchKeys as Q}from"../../views/interactive/keybindings.js";import ee from"../../views/interactive/sketch/SketchLabelOptions.js";import te from"../../views/interactive/sketch/SketchOptions.js";import oe from"../../views/interactive/sketch/SketchTooltipOptions.js";import ie from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as ae}from"../../views/interactive/snapping/SnappingManager.js";import re from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as se}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as ne}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as pe}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as le}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as he}from"../../views/support/screenUtils.js";import de from"./adapters/layer/GraphicsLayerAdapter.js";import ce from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as ue,DrawToolOperationHandle as me,UpdateOperationHandle as ye}from"./support/OperationHandle.js";import{PluginManager as ge}from"./support/PluginManager.js";import{SettingsManager as ve}from"./support/SettingsManager.js";import{getLegacyTool as fe,isCompletelyDegenerate as _e,graphicsHaveTooFewVerticesForBox as be,getModeFromCreateOptions as we,getDrawToolGeometryTypeFromCreateTool as Te}from"./support/sketchUtils.js";const Ge={defaultZ:0},Oe={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move",enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:pe},tool:"transform"},Se=Symbol(),Ce=Symbol();let Ae=class extends p{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new U({listMode:"hide",internal:!0,title:"SVM Internal"}),this._pluginManager=new ge({sketchViewModel:this}),this.settingsManager=new ve({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new E,this._toolTransitionHandles=new E,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new ne,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.activeUpdateOptions=null,this.layer=null,this.pointSymbol=new Z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new W({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new K({color:[130,130,130,1],width:2}),this.meshSymbol=new V({symbolLayers:new s([new F])}),this.updateGraphics=new s,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new Z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new te,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(Ce),!e)return;const t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),_(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},b)].filter(r);this.addHandles(t,Ce)},this._originalPopupEnabled=null,this.defaultCreateOptions=Ge,this.defaultUpdateOptions=Oe,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new re,this.textSymbol=new q({text:"text"})}initialize(){this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([w(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),_(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),b),_(()=>this.view,e=>{this._defaultSnappingManager=m(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new ae({view:e,options:this.snappingOptions})),"2d"===e.type?(import("../../views/2d/interactive/editingTools.js"),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},b),_(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),se(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=m(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this._toolTransitionHandles.destroy(),this._drawToolSimplifyAbortController=y(this._drawToolSimplifyAbortController),this._geometryWorkerHandle.destroy(),this._pluginManager?.destroy(),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new de(e);case"map-notes":return new ce(e);default:return null}}get activeTool(){return this._operationHandle?.tool??null}get geometrySimplificationInProgress(){return!!this._drawToolSimplifyAbortController}get activeCreateToolDrawMode(){const e=this._operationHandle;if("create"===e?.type&&e.activeComponent&&"mode"in e.activeComponent)return e.activeComponent.mode;if("draw-2.0"===e?.activeComponent?.type){const t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(r).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...Ge,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...Oe,...e,reshapeOptions:{...Oe.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...Oe.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get("textSymbol")}set textSymbol(e){this._set("textSymbol",e)}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=m(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new ae({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get toolTransitionInProgress(){return this._toolTransitionHandles.updating||!!this.drawTool?.lifecycleManager.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.activeComponent&&"updating"in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this._drawToolSimplifyAbortController||this.snappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(T(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},b),o),this._set("view",e),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||"2d"!==this.view?.type}get pluginManager(){return this._pluginManager}get drawTool(){return"draw-2.0"!==this.activeComponent?.type?null:this.activeComponent}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome("rootPlugins",e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;const e=this.view?.type??"2d",{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(r)??[]}get firstPluginWithSwappableLeaf(){const e=this.view?.type??"2d",t=this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>null!=t&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1);return t}get multiplePluginsActive(){return!!this.drawTool&&this.drawTool.pluginStack.length>1}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=y(this._moduleLoaderAbortController),this._viewReadyAbortController=y(this._viewReadyAbortController),this._drawToolSimplifyAbortController=y(this._drawToolSimplifyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){return this._toolTransitionHandles.addPromise(this._create(e,t))}async _create(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),g();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");X(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const r=fe(e),s=()=>{if(a===this._operationHandle){const o=this.createGraphic,i=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),a.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:i?"cancel":"complete",tool:r??"point",toolEventInfo:null,type:"create"}),i||this._sketchContinuationFlag)return;const{creationMode:s}=this;if("continuous"===s){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(v(this.create(e,t)))}else"update"===s&&o&&this._updatingHandles.consumePromise(v(this.update([o])))}};a.on("complete",s),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){return this._toolTransitionHandles.addPromise(this._update(e,t))}async _update(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),g();null!=i.activeTool&&(i.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const s=await this._updatingHandles.addPromise(this._setupUpdateOperation(r,t));this.destroyed||null==s||Re(s)||(X(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||j(o.geometry.spatialReference,t.spatialReference)||(k(o.geometry.spatialReference,t.spatialReference)||H()||await P(),o.geometry=I(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._updatingHandles.consumePromise(this._operationHandle?.toggleTool())}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return le(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{R(e)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?M(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},J.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(he(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||this.hasGraphic(i)?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a="string"==typeof e?this.pluginManager?.getPluginsEquivalentToCreateTool(e,i.mode):e,r=fe(e);if(a&&!this.isUsingLegacyCreateTools){const e=await this._setupDrawTool(a,i,r??"polyline");if(e)return this._setupDrawToolOperationHandle(e,r??"point")}if(!r)return null;const s=await this._setupDrawGraphicTool(r,o,i);return null==s?null:(o.tools.add(s),o.activeTool=s,this._setupCreateOperationHandle(s,r))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=we(p,e),d=Te(e),c=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=c?.preserveAspectRatio??l??"rectangle"!==e,m={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:s,geometryType:d,mode:h,graphicSymbol:o.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:r,snappingManager:this.snappingManager,snapToScene:!1,view:t,...c};return"2d"===t.type?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return Re(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:ke(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));return Re(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let i=null;const a=e.forceUniformSize,r=e.centered,s=new A,n=[l(()=>s.destroy()),o.on("key-down",t=>{if(t.key===Q.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===Q.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==Q.vertexAdd||t.repeat)t.key===Q.undo?(t.stopPropagation(),p.undo()):t.key===Q.redo?(t.stopPropagation(),p.redo()):t.key!==Q.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===Q.center&&(t.repeat||(e.centered=!r,t.stopPropagation())):(e.forceUniformSize=!a,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},J.WIDGET),o.on("key-up",t=>{t.key===Q.pan?e.enabled=!0:t.key!==Q.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===Q.center&&(e.centered=r,t.stopPropagation()):(e.forceUniformSize=a,t.stopPropagation())},J.WIDGET),e.on("vertex-update",()=>{s.notify()}),e.on("vertex-add",t=>{switch(s.notify(),i=null==i?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:i,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(s.notify(),t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),i="complete",e.aborted?p&&p.cancel():p&&p.complete()}),_(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],p=new ue({activeComponent:e,type:"create",onEnd:()=>{h(n),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>(C(s),e.canUndo),canRedo:()=>(C(s),e.canRedo)});return p}_setupDrawToolOperationHandle(o,i){const a=this.view;if(!a)return this._logMissingView(),null;let s=null;const n=[a.on("key-down",e=>{e.key===Q.pan&&(e.stopPropagation(),e.repeat||(o.editable=!1))},J.WIDGET),a.on("key-up",e=>{e.key===Q.pan&&(o.editable=!0)},J.WIDGET),o.on("before-vertex-add",e=>{const t=o.mostUpstreamPlugin?.configuration;if(t&&"legacyCreateTool"in t&&("point"===t?.legacyCreateTool||"text"===t.legacyCreateTool)){const t=e.detail.originalEvent;return void(t&&"key"in t&&t.key===Q.vertexAdd&&e.preventDefault())}}),o.on("before-complete",e=>{const t=o.getGeometryIfCompleted();(!t||_e(t))&&e.preventDefault()}),o.on(["vertex-add","vertex-remove"],e=>{switch(this.createGraphic&&(this.createGraphic.geometry=o.getGeometryIfCompleted()),s=null==s&&"vertex-remove"!==e.type?"start":"active",e.operation){case"apply":this.emit("create",{graphic:this.createGraphic,state:s,tool:this.activeTool,toolEventInfo:e,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[this.createGraphic].filter(r),tool:i});break;case"redo":this._emitRedoEvent({graphics:[this.createGraphic].filter(r),tool:i})}}),o.on("cursor-update",e=>{this.createGraphic&&(this.createGraphic.geometry=o.unprocessedGeometry),(e.vertices[0]?.vertexIndex>0||e.vertices[0]?.componentIndex>0)&&this.emit("create",{graphic:this.createGraphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:e.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),o.on("complete",async({geometry:i,isSimple:a})=>{const r=this.createGraphic;if(!!i&&"mesh"!==i.type&&"extent"!==i.type&&!a&&r){const a={stack:[],error:void 0,hasError:!1};try{const t=new AbortController;this._drawToolSimplifyAbortController?.abort(),this._drawToolSimplifyAbortController=t;e(a,d(this._createDrawToolCompletionPreviewGraphic(o,i,r)),!1);await this._updatingHandles.addPromise(v(this._finalizeDrawToolCompletion({abortController:t,geometry:i,graphic:r,handle:p})))}catch(s){a.error=s,a.hasError=!0}finally{t(a)}}else r&&(r.geometry=i),p.complete()})],p=new me({activeComponent:o,type:"create",onEnd:()=>{h(n),a.tools.remove(o)},undo:()=>o.undo(),redo:()=>o.redo(),canUndo:()=>o.canUndo,canRedo:()=>o.canRedo});return n.push(o.on("cancel",()=>{this._drawToolSimplifyAbortController=y(this._drawToolSimplifyAbortController),p.cancel()})),p}_createDrawToolCompletionPreviewGraphic(e,t,o){const a="polygon"===t?.type?this._createAnimatedPolygonPreviewSymbol():o?.symbol,r=t?e.simplifiedGeometryPreview??t:null;if(!r||!a)return l();const s=new i({geometry:r,symbol:a});return this._internalGraphicsLayer.add(s),l(()=>this._internalGraphicsLayer.remove(s))}async _finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:o,handle:i}){const a=this.view?.acquireCursor("progress","high");a&&this.addHandles(a);const r=()=>!!e.signal.aborted&&(o&&this._layerAdapter?.remove(o),this._set("createGraphic",null),!0);try{const a=await this._geometryWorkerHandle.simplify(t,e.signal);if(r())return;o.geometry=a??t,i.complete()}finally{a?.remove(),this._drawToolSimplifyAbortController===e&&(this._drawToolSimplifyAbortController=null)}}_createAnimatedPolygonPreviewSymbol(){const e={type:"CIMAnimatedSymbolProperties",playAnimation:!a(),duration:1,repeatType:"Oscillate",easing:"EaseInOut"};return new L({data:{type:"CIMSymbolReference",symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[180,180,180,36],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]},{type:"CIMHatchFill",enable:!0,separation:6,rotation:-45,offsetX:0,offsetY:0,lineSymbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:.8,color:[100,100,100,110],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]}]}},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:1.8,color:[60,60,60,255],effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[6,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:70,animatedSymbolProperties:e}]}]}}})}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const i={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=i;let a=i.tool??Oe.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(a){case"move":return this._setupMove3DOperation(e,i,o,a);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],i,o);case"transform":return this._setupGraphicTransform3DOperation(e,i,o)}}switch(a){case"move":return this._setupMove2DOperation(e,i,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,a,i,o);case"transform":return be(e)&&(a="reshape"),this._setupTransformOrReshape2DOperation(e,a,i,o)}}async _setupMove3DOperation(e,t,o,i,a=!1){const r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Re(r))return r;const{ManipulatedObject3DGraphic:s,MoveTool3D:n}=r.module,p=new Map,l=()=>{p.forEach(e=>e.destroy()),p.clear()};for(const h of e){const e=new s({view:o,graphic:h}),t=B(e);if(0!==t)return l(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${z(t)}).`),null;p.set(h,e)}const d=new n({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),d.objects.addMany(Array.from(p.values())),a||this.updateGraphics.addMany(e);const c=[],u=new ye({activeComponent:d,tool:i,type:"update",onEnd:()=>{h(c),Ue(o,d),l()},undo:()=>{De(this.view,d),He(u,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{Pe(u,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.push(e);const t=new s({view:o,graphic:e});p.set(e,t),d.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async e=>{const t=this.updateGraphics.indexOf(e);if(u.history.undo.forEach(e=>e.updates.splice(t,1)),u.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void u.complete();const o=p.get(e);o&&(d.objects.remove(o),o.destroy(),p.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));a&&!Re(a)&&(u.onEnd(),u.destroy(),this._setUpdateOperationHandle(a,t))}});return c.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(u,e,t),J.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(u,e)},J.WIDGET)),u}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===Y(e[0])){const a=e[0],r=a.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:r,enableZ:s}=t,n=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Re(n))return n;const{TransformTool3D:p,ManipulatedObject3DGraphic:l}=n.module,d=new l({graphic:e,view:o}),c=new p({object:d,view:o,enableRotation:a,enableScaling:r,enableZ:s,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),this.updateGraphics.add(e);const u=[],m=new ye({activeComponent:c,tool:i,type:"update",onEnd:()=>{h(u),Ue(o,c),d.destroy()},undo:()=>{De(this.view,c),He(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{Pe(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),m.onEnd(),m.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Re(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:async e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),m.complete()},toggleTool:async()=>{}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),J.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},J.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:p}=t,l=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Re(l))return l;const{ManipulatedObject3DGraphic:d,ExtentTransformTool:c}=l.module,u=this.view?.inputManager?.isModifierKeyDown(Q.constraint),m=new d({view:o,graphic:e}),y=new c({object:m,view:o,enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:!!p!=!!u,sketchOptions:this.sketchOptions});o.tools.add(y),i||this.updateGraphics.add(e);const g=[],v=new ye({activeComponent:y,tool:a,type:"update",onEnd:()=>{h(g),Ue(o,y),m.destroy()},canUndo:()=>!y.destroyed&&y.canUndo,undo:()=>{y.destroyed||(y.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!y.destroyed&&y.canRedo,redo:()=>{y.destroyed||(y.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),v.onEnd(),v.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Re(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:async e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),v.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));i&&!Re(i)&&(v.onEnd(),v.destroy(),this._setUpdateOperationHandle(i,t))}});return g.push(...this._getHandlesForComponent(v,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(v,e,t),J.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(v,e),J.WIDGET),o.on("key-down",e=>{e.key!==Q.constraint||e.repeat||(y.preserveAspectRatio=!y.preserveAspectRatio,e.stopPropagation())},J.WIDGET),o.on("key-up",e=>{e.key===Q.constraint&&(y.preserveAspectRatio=!y.preserveAspectRatio,e.stopPropagation())},J.WIDGET)),v}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,o));if(Re(a))return a;const r=new ye({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._clearCursor(),h(p),h(n),a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();He(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();Pe(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:r.complete()}});let s=!1;const n=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,t),J.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==Q.constraint||e.repeat||(s=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},J.WIDGET),o.on("key-up",e=>{e.key===Q.constraint&&s&&(s=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},J.WIDGET)],p=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Re(r))return r;const{ManipulatedObject3DGraphic:s,ReshapeTool3D:n}=r.module,p=new s({view:o,graphic:e}),l=$(p);if(0!==l)return p.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${z(l)}).`),null;const d=t.reshapeOptions,c=new n({view:o,object:p,enableZVertex:t.enableZ&&"move"===d?.vertexOperation,enableZShape:t.enableZ&&"move"===d?.shapeOperation,enableMoveObject:"move"===d?.shapeOperation||"move-xy"===d?.shapeOperation,enableMidpoints:"split"===d?.edgeOperation,enableEdgeOffset:"offset"===d?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),i||this.updateGraphics.add(p.graphic);const u=[],m=new ye({activeComponent:c,tool:a,type:"update",onEnd:()=>{h(u),Ue(o,c),p.destroy()},canUndo:()=>!c.destroyed&&c.canUndo,undo:()=>{c.destroyed||(c.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!c.destroyed&&c.canRedo,redo:()=>{c.destroyed||(c.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),m.onEnd(),m.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Re(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:async e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),m.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;m.onEnd(),m.destroy();const e=await this._updatingHandles.addPromise(this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0));Re(e)||this._setUpdateOperationHandle(e,t)}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),J.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},J.WIDGET)),m}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise("transform"===t?this._getBox(e,o,i):this._getReshape(e,o,i));if(Re(a))return a;const r=new ye({activeComponent:a,type:"update",onEnd:()=>{h(n),h(s),r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{He(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{Pe(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),r.onEnd(),r.destroy();const a=await this._updatingHandles.addPromise(this._setupTransformOrReshape2DOperation(t,"transform",o,i));if(Re(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?r.complete():be(o)?await r.toggleTool():r.activeComponent.graphics=o,this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&"point"===t.type||"transform"===r.tool&&"extent"===t.type))return;let a=null;const s={...this.defaultUpdateOptions,...o,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...o?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...o?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};"transform"===r.tool?a=await this._updatingHandles.addPromise(this._getReshape([e],s,i)):"reshape"===r.tool&&(a=await this._updatingHandles.addPromise(this._getBox([e],s,i))),Re(a)||(r.activeComponent?.destroy(),r.activeComponent=a,r.activeComponent&&(h(n),n=this._getHandlesForComponent(r,s)))}}),s=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,o),J.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===Q.constraint&&!e.repeat&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},J.WIDGET),i.on("key-up",e=>{if(e.key===Q.constraint&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},J.WIDGET)];let n=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return Re(r)?r:new r.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayCursor("pointer"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:r,preserveAspectRatio:s}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(Re(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(Q.constraint),l=new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:r?.name,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}});return l.addHandles(_(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,o])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=o??t.enableScaling??!0,l.refresh()},b)),l}async _getReshape(e,t,o){const{highlightOptions:i,reshapeOptions:a}=t,r="split"===a?.edgeOperation,s="move"===a?.shapeOperation,n=!!a?.enableCreateCurveFromStraightEdge,p=await this._requireModule(import("../../views/draw/support/Reshape.js"));return Re(p)?p:new p.module.default({enableMidpoints:r,enableMovement:s,enableCurveOnMidpoint:n,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map(e=>D(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map(e=>D(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),this._updatingHandles.consumePromise(e.removeFromSelection(o)))}),o.on("graphic-move-start",t=>e.addToHistory(je(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(je(t.graphics))),o.on("rotate-start",t=>e.addToHistory(je(t.graphics))),o.on("scale-start",t=>e.addToHistory(je(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(je([t.mover]))),o.on("reshape-start",t=>e.addToHistory(je([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(je([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(je([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{this._updatingHandles.consumePromise(o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool())})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{this._updatingHandles.consumePromise(o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool())})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{this._updatingHandles.consumePromise(o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool())})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;if(a.native?.shiftKey&&this.hasGraphic(i))return a.stopPropagation(),void this._updatingHandles.consumePromise(e.removeFromSelection(i));t.toggleToolOnClick&&(a.stopPropagation(),this._updatingHandles.consumePromise(e.toggleTool()))}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}_getCommonUpdateOperationClickHandlers(e,t,o){return this._updatingHandles.addPromise(this._handleCommonUpdateOperationClick(e,t,o))}async _handleCommonUpdateOperationClick(e,t,o){const i=he(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void(this.updateOnGraphicClick&&e.complete());const r=t.native.shiftKey?this._toggleSelection([a.graphic],e,o):null;if(r)return t.stopPropagation(),void await r;this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}async _toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;for(const a of e)if(null!=a&&i&&this.hasGraphic(a))return this.updateGraphics.includes(a)?await t.removeFromSelection(a):await t.addToSelection(a)}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===Q.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===Q.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===Q.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&Q.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&"update"===this._operationHandle.type&&null!=this.activeComponent&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=m(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(Se)}_displayCursor(e){this.removeHandles(Se),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),Se)}_logError(e,t,o){u.getLogger(this).error(new n(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._updatingHandles.consumePromise(this._operationHandle.removeFromSelection(o))}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,t,o){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;const a=this.view,r=await import("../../views/draw/DrawTool.js");await this.pluginManager.loadPlugins();const s=await this.pluginManager.makeRenderer({customSymbol:t.graphicSymbol,useTextSymbol:"text"===o}),n=new r.DrawTool({view:a,elevationInfo:this._layerAdapter?.elevationInfo??x("3d"===a.type),hasZ:!!t.hasZ,sketchOptions:this.sketchOptions,renderer:s,defaultZ:t.defaultZ??0,directionOptions:t.directionOptions,snappingManager:this.snappingManager,enableVertexVisuals:"rectangle"!==o&&"circle"!==o,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});n.addHandles(c(s));const p=new i({...t.graphicProperties,attributes:{...t.graphicProperties?.attributes},symbol:t.graphicSymbol??this._getGraphicSymbolFromTool(o)});return t.graphicSymbol||n.addHandles(_(()=>this._getGraphicSymbolFromTool(o),e=>p.symbol=e)),this._set("createGraphic",p),a.addAndActivateTool(n),n.begin(e),n}get test(){}wait(){return G(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(y(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await f(G(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",Me("view"))}_logMissingLayer(){this._logError(Ee,Me("layer"))}};o([O()],Ae.prototype,"_defaultSnappingManager",void 0),o([O()],Ae.prototype,"_layerAdapter",null),o([O()],Ae.prototype,"_pluginManager",void 0),o([O({readOnly:!0})],Ae.prototype,"settingsManager",void 0),o([O()],Ae.prototype,"_operationHandle",void 0),o([O({readOnly:!0})],Ae.prototype,"_updatingHandles",void 0),o([O({readOnly:!0})],Ae.prototype,"_toolTransitionHandles",void 0),o([O()],Ae.prototype,"_drawToolSimplifyAbortController",void 0),o([O({readOnly:!0})],Ae.prototype,"activeTool",null),o([O()],Ae.prototype,"geometrySimplificationInProgress",null),o([O({readOnly:!0})],Ae.prototype,"activeCreateToolDrawMode",null),o([O()],Ae.prototype,"activeTooltip",null),o([O({types:N})],Ae.prototype,"activeFillSymbol",void 0),o([O()],Ae.prototype,"activeLineSymbol",void 0),o([O()],Ae.prototype,"activeVertexSymbol",void 0),o([O()],Ae.prototype,"allowDeleteKey",void 0),o([O({readOnly:!0})],Ae.prototype,"createGraphic",null),o([O()],Ae.prototype,"defaultCreateOptions",null),o([O()],Ae.prototype,"defaultUpdateOptions",null),o([O()],Ae.prototype,"activeUpdateOptions",void 0),o([O({type:ee,nonNullable:!0})],Ae.prototype,"labelOptions",null),o([O()],Ae.prototype,"layer",void 0),o([O({types:N})],Ae.prototype,"pointSymbol",void 0),o([O({types:N})],Ae.prototype,"polygonSymbol",void 0),o([O({types:N})],Ae.prototype,"polylineSymbol",void 0),o([O()],Ae.prototype,"meshSymbol",void 0),o([O({type:q})],Ae.prototype,"textSymbol",null),o([O({type:re,nonNullable:!0})],Ae.prototype,"snappingOptions",null),o([O()],Ae.prototype,"snappingManager",null),o([O({readOnly:!0})],Ae.prototype,"state",null),o([O()],Ae.prototype,"toolTransitionInProgress",null),o([O({type:oe,nonNullable:!0})],Ae.prototype,"tooltipOptions",null),o([O({readOnly:!0})],Ae.prototype,"updateGraphics",void 0),o([O()],Ae.prototype,"updateOnGraphicClick",void 0),o([O()],Ae.prototype,"updating",null),o([O()],Ae.prototype,"creationMode",void 0),o([O({type:ie,nonNullable:!0})],Ae.prototype,"valueOptions",null),o([O({types:N})],Ae.prototype,"vertexSymbol",void 0),o([O({value:null})],Ae.prototype,"view",null),o([O({constructOnly:!0,type:te})],Ae.prototype,"sketchOptions",void 0),o([O()],Ae.prototype,"useLegacyCreateTools",void 0),o([O()],Ae.prototype,"isUsingLegacyCreateTools",null),o([O()],Ae.prototype,"pluginManager",null),o([O()],Ae.prototype,"drawTool",null),o([O()],Ae.prototype,"rootPlugins",null),o([O()],Ae.prototype,"effectiveAvailablePlugins",null),o([O()],Ae.prototype,"firstPluginWithSwappableLeaf",null),o([O()],Ae.prototype,"multiplePluginsActive",null),Ae=o([S("esri.widgets.Sketch.SketchViewModel")],Ae);const Ee="sketch:missing-property",Me=e=>`Property '${e}' is missing on SketchViewModel.`;function ke(e){return"polygon"===e||"rectangle"===e||"circle"===e}function He(e,t){Ie("undo",e.history.undo,e.history.redo,t)}function Pe(e,t){Ie("redo",e.history.redo,e.history.undo,t)}function Ie(e,t,o,i){const a=t.pop();if(!a)return;const r=a.updates,s=[];i.forEach((t,o)=>{const i=r[o];null!=i&&("geometry"in i&&null!=i.geometry&&(s.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(s.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(s.push(i),i[e](t)))}),o.push({updates:s})}function De(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function je(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function Ue(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function Re(e){return"requireError"in e&&"aborted"===e.requireError}export{Ae as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{property as o,subclass as e}from"../../../../core/accessorSupport/decorators.js";import i from"../../../Widget.js";import{WellKnownSizes as n,Icons as r}from"./responsiveToolbarUtils.js";import{ToolbarGroupBase as s}from"./ToolbarGroupBase.js";import{loadCalciteComponents as a}from"../../../support/componentsUtils.js";import{tsx as l,tsxFragment as c,messageBundle as p}from"../../../support/widget.js";let m=class extends(s(i)){constructor(t){super(t),this.allowCollapse=!0,this.messagesCommon=null}loadDependencies(){return a({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu")})}static{this.vnodeSelector="calcite-action-group"}get minimumLength(){const{actionChildren:t,scale:o}=this;return t.length?this.allowCollapse?n.groupSeparator+n.groupPadding[o]+(n.action[o]+n.actionPadding[o])*Math.min(t.length,2):n.groupSeparator+n.groupPadding[o]+(n.action[o]+n.actionPadding[o])*t.length:0}get lengthOptions(){const{actionChildren:t,scale:o,minimumLength:e,allowCollapse:i,priority:r}=this,s=[e];if(t.length<=2||!i||r<1)return s;for(let a=1;a<t.length-1;a++)s.push(e+(n.action[o]+n.actionPadding[o])*a);return s}render(){if(!this.actionChildren.length)return l(c,null,void 0);const{budgetedLength:t,actionChildren:o,activeChildElement:e,layout:i,slot:s,scale:a}=this,p=Math.floor((t-n.groupPadding[a]-n.groupSeparator)/(n.action[a]+n.actionPadding[a])),m=[],d=[];if(p>=o.length)m.push(...o);else{const t=e??m.at(0);if(m.push(...o.slice(0,p-1)),d.push(...o.slice(p-1)),t&&d.includes(t)){const[o]=d.splice(d.indexOf(t),1),e=m.pop();m.push(o),e&&d.unshift(e)}}return l("calcite-action-group",{key:"overflow-button-group",layout:i,onclick:t=>this._handleClick(t.target),slot:s},m.map(t=>this._renderManagedAction(t)),d.length>0?l("calcite-action-menu",{key:"split-button-dropdown",label:this.messagesCommon.more,overlayPositioning:"fixed"},l("calcite-action",{icon:r.overflow,key:"split-button-dropdown-trigger",scale:a,slot:"trigger",text:this.messagesCommon.more}),d.map(t=>this._renderManagedAction(t))):void 0)}_renderManagedAction(t){return l("calcite-action",{...t?.properties,"data-action-key":t?.properties?.key,text:t?.properties?.text??""})}};t([o()],m.prototype,"allowCollapse",void 0),t([o()],m.prototype,"minimumLength",null),t([o(),p("esri/t9n/common")],m.prototype,"messagesCommon",void 0),t([o()],m.prototype,"lengthOptions",null),m=t([e("esri.widgets.Sketch.support.ResponsiveToolbar.OverflowGroup")],m);export{m as default};
2
+ import{__decorate as t}from"tslib";import{property as o,subclass as e}from"../../../../core/accessorSupport/decorators.js";import i from"../../../Widget.js";import{WellKnownSizes as n,Icons as r}from"./responsiveToolbarUtils.js";import{ToolbarGroupBase as s}from"./ToolbarGroupBase.js";import{loadCalciteComponents as a}from"../../../support/componentsUtils.js";import{tsx as l,tsxFragment as c,messageBundle as p}from"../../../support/widget.js";let m=class extends(s(i)){constructor(t){super(t),this.allowCollapse=!0,this.messagesCommon=null}loadDependencies(){return a({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu")})}static{this.vnodeSelector="calcite-action-group"}get minimumLength(){const{actionChildren:t,scale:o}=this;return t.length?this.allowCollapse?n.groupSeparator+n.groupPadding[o]+(n.action[o]+n.actionPadding[o])*Math.min(t.length,2):n.groupSeparator+n.groupPadding[o]+(n.action[o]+n.actionPadding[o])*t.length:0}get lengthOptions(){const{actionChildren:t,scale:o,minimumLength:e,allowCollapse:i,priority:r}=this,s=[e];if(t.length<=2||!i||r<1)return s;for(let a=1;a<t.length-1;a++)s.push(e+(n.action[o]+n.actionPadding[o])*a);return s}render(){if(!this.actionChildren.length)return l(c,null,void 0);const{budgetedLength:t,actionChildren:o,activeChildElement:e,layout:i,slot:s,scale:a}=this,p=Math.floor((t-n.groupPadding[a]-n.groupSeparator)/(n.action[a]+n.actionPadding[a])),m=[],d=[];if(p>=o.length)m.push(...o);else{const t=e??m.at(0);if(m.push(...o.slice(0,p-1)),d.push(...o.slice(p-1)),t&&d.includes(t)){const[o]=d.splice(d.indexOf(t),1),e=m.pop();m.push(o),e&&d.unshift(e)}}return l("calcite-action-group",{key:"overflow-button-group",layout:i,slot:s,onclick:t=>this._handleClick(t.target)},m.map(t=>this._renderManagedAction(t)),d.length>0?l("calcite-action-menu",{key:"split-button-dropdown",label:this.messagesCommon.more,overlayPositioning:"fixed"},l("calcite-action",{icon:r.overflow,key:"split-button-dropdown-trigger",scale:a,slot:"trigger",text:this.messagesCommon.more}),d.map(t=>this._renderManagedAction(t))):void 0)}_renderManagedAction(t){return l("calcite-action",{...t?.properties,"data-action-key":t?.properties?.key,text:t?.properties?.text??""})}};t([o()],m.prototype,"allowCollapse",void 0),t([o()],m.prototype,"minimumLength",null),t([o(),p("esri/t9n/common")],m.prototype,"messagesCommon",void 0),t([o()],m.prototype,"lengthOptions",null),m=t([e("esri.widgets.Sketch.support.ResponsiveToolbar.OverflowGroup")],m);export{m as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{property as o,subclass as e}from"../../../../core/accessorSupport/decorators.js";import i from"../../../Widget.js";import{WellKnownSizes as n,Icons as r}from"./responsiveToolbarUtils.js";import{ToolbarGroupBase as s}from"./ToolbarGroupBase.js";import{loadCalciteComponents as a}from"../../../support/componentsUtils.js";import{tsx as l,tsxFragment as c,messageBundle as p}from"../../../support/widget.js";const d={splitButtonBase:`${"esri-split-button"}--split-part`};let m=class extends(s(i)){constructor(t){super(t),this.allowCollapse=!0,this.messagesCommon=null}loadDependencies(){return a({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu")})}static{this.vnodeSelector="calcite-action-group"}get minimumLength(){const t=this.actionChildren;if(!t.length)return 0;const{scale:o}=this;return 1===t.length?n.action[o]+n.groupSeparator+n.groupPadding[o]:this.allowCollapse?n.action[o]+2*n.actionPadding[o]+n.groupPadding[o]+n.splitButtonPart[this.layout][o]+n.groupSeparator:(n.action[o]+n.actionPadding[o])*t.length+n.groupSeparator+n.groupPadding[o]}get lengthOptions(){const{actionChildren:t,minimumLength:o,scale:e,priority:i,allowCollapse:r}=this;if(t.length<2||i<0||!r)return[o];return[o,n.groupSeparator+n.groupPadding[e]+(n.action[e]+n.actionPadding[e])*t.length]}render(){if(!this.actionChildren.length)return l(c,null,void 0);const{actionChildren:t,minimumLength:o,budgetedLength:e,layout:i,slot:n,allowCollapse:r}=this,s=!r||t.length<2||e>o;return l("calcite-action-group",{key:"split-button-group",layout:i,onclick:t=>this._handleClick(t.target),slot:n},s?this._renderUnSplit():this._renderSplit())}_renderSplit(){const{activeChildElement:t,layout:o,actionChildren:e,scale:i,messagesCommon:n}=this,s=t??e.at(0);if(!s)return;const a=e.filter(t=>t!==s);return[this._renderManagedAction(s),l("calcite-action-menu",{key:"split-button-dropdown",label:n.more,overlayPositioning:"fixed",placement:"horizontal"===o?"bottom-end":"right-end"},l("calcite-action",{class:`${d.splitButtonBase}--${o}--${this.scale}`,compact:"horizontal"===o,icon:r.splitButton[o],key:"split-button-dropdown-trigger",scale:i,slot:"trigger",text:n.more}),a?.map(t=>this._renderManagedAction(t)))]}_renderUnSplit(){return this.actionChildren.map(t=>this._renderManagedAction(t))}_renderManagedAction(t){return l("calcite-action",{...t?.properties,"data-action-key":t?.properties?.key,text:t?.properties?.text??""})}};t([o()],m.prototype,"minimumLength",null),t([o()],m.prototype,"allowCollapse",void 0),t([o()],m.prototype,"lengthOptions",null),t([o(),p("esri/t9n/common")],m.prototype,"messagesCommon",void 0),m=t([e("esri.widgets.Sketch.support.ResponsiveToolbar.SplitButton")],m);export{m as SplitButton};
2
+ import{__decorate as t}from"tslib";import{property as o,subclass as e}from"../../../../core/accessorSupport/decorators.js";import i from"../../../Widget.js";import{WellKnownSizes as n,Icons as r}from"./responsiveToolbarUtils.js";import{ToolbarGroupBase as s}from"./ToolbarGroupBase.js";import{loadCalciteComponents as a}from"../../../support/componentsUtils.js";import{tsx as l,tsxFragment as c,messageBundle as p}from"../../../support/widget.js";const d={splitButtonBase:`${"esri-split-button"}--split-part`};let m=class extends(s(i)){constructor(t){super(t),this.allowCollapse=!0,this.messagesCommon=null}loadDependencies(){return a({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu")})}static{this.vnodeSelector="calcite-action-group"}get minimumLength(){const t=this.actionChildren;if(!t.length)return 0;const{scale:o}=this;return 1===t.length?n.action[o]+n.groupSeparator+n.groupPadding[o]:this.allowCollapse?n.action[o]+2*n.actionPadding[o]+n.groupPadding[o]+n.splitButtonPart[this.layout][o]+n.groupSeparator:(n.action[o]+n.actionPadding[o])*t.length+n.groupSeparator+n.groupPadding[o]}get lengthOptions(){const{actionChildren:t,minimumLength:o,scale:e,priority:i,allowCollapse:r}=this;if(t.length<2||i<0||!r)return[o];return[o,n.groupSeparator+n.groupPadding[e]+(n.action[e]+n.actionPadding[e])*t.length]}render(){if(!this.actionChildren.length)return l(c,null,void 0);const{actionChildren:t,minimumLength:o,budgetedLength:e,layout:i,slot:n,allowCollapse:r}=this,s=!r||t.length<2||e>o;return l("calcite-action-group",{key:"split-button-group",layout:i,slot:n,onclick:t=>this._handleClick(t.target)},s?this._renderUnSplit():this._renderSplit())}_renderSplit(){const{activeChildElement:t,layout:o,actionChildren:e,scale:i,messagesCommon:n}=this,s=t??e.at(0);if(!s)return;const a=e.filter(t=>t!==s);return[this._renderManagedAction(s),l("calcite-action-menu",{key:"split-button-dropdown",label:n.more,overlayPositioning:"fixed",placement:"horizontal"===o?"bottom-end":"right-end"},l("calcite-action",{class:`${d.splitButtonBase}--${o}--${this.scale}`,compact:"horizontal"===o,icon:r.splitButton[o],key:"split-button-dropdown-trigger",scale:i,slot:"trigger",text:n.more}),a?.map(t=>this._renderManagedAction(t)))]}_renderUnSplit(){return this.actionChildren.map(t=>this._renderManagedAction(t))}_renderManagedAction(t){return l("calcite-action",{...t?.properties,"data-action-key":t?.properties?.key,text:t?.properties?.text??""})}};t([o()],m.prototype,"minimumLength",null),t([o()],m.prototype,"allowCollapse",void 0),t([o()],m.prototype,"lengthOptions",null),t([o(),p("esri/t9n/common")],m.prototype,"messagesCommon",void 0),m=t([e("esri.widgets.Sketch.support.ResponsiveToolbar.SplitButton")],m);export{m as SplitButton};
package/widgets/Sketch.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{isSome as o}from"../core/arrayUtils.js";import{deprecateWidget as i}from"../core/deprecate.js";import{handlesGroup as s}from"../core/handleUtils.js";import l from"../core/Logger.js";import{removeMaybe as n,destroyMaybe as r}from"../core/maybe.js";import{ignoreAbortErrors as a}from"../core/promiseUtils.js";import{watch as p,syncAndInitial as c,when as d}from"../core/reactiveUtils.js";import{property as h,subclass as u}from"../core/accessorSupport/decorators.js";import{symbolTypes as g}from"../symbols/support/typeUtils.js";import v from"../views/interactive/sketch/SketchLabelOptions.js";import m from"../views/interactive/sketch/SketchTooltipOptions.js";import f from"../views/interactive/sketch/SketchValueOptions.js";import y from"./Widget.js";import b from"./Sketch/SketchViewModel.js";import _ from"./Sketch/VisibleElements.js";import w from"./Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{connectDelayedLoading as M}from"./support/loaderUtils.js";import S from"./support/PluginSettingsControls.js";import C from"./support/SelectionToolbar.js";import O from"./support/SketchTooltipControls.js";import k from"./support/SnappingControls.js";import{tsx as P,messageBundle as I,vmEvent as L}from"./support/widget.js";import R from"./support/SelectionToolbar/VisibleElements.js";import x from"./support/SketchTooltipControls/VisibleElements.js";const E="esri-sketch",G="settings-menu-action",B={base:E,vertical:`${E}--vertical`,docked:`${E}-bar`,floating:`${E}-pad`,chipHorizontal:`${E}__selection-count-chip--horizontal`,chipVertical:`${E}__selection-count-chip--vertical`,chipVerticalSmall:`${E}__selection-count-chip--vertical--s`,popoverWrapper:`${E}__popover-wrapper`,simplificationProgressLoader:`${E}__simplification-progress-loader`},j={point:"pin",polyline:"line",polygon:"polygon",rectangle:"rectangle",circle:"circle",multipoint:"pins",mesh:"i3d-building",freehandPolygon:"freehand-area",freehandPolyline:"freehand",text:"add-text"};let U=class extends y{constructor(e,t){super(e,t),this._selectionToolbar=null,this._viewModelHandlesGroup=null,this._popoverElement=null,this.availableCreateTools=["point","polyline","polygon","rectangle","circle"],this.customToolOptions=null,this.customActions=null,this.toolbarKind="floating",this.contextualToolLocation="separate",this.groupCollapsePriorities=null,this.groupAllowCollapseOptions=null,this.messages=null,this.messagesCommon=null,this.visibleElements=new _,this._defaultViewModel=null,this._activeCustomToolOptions=null,this._calcitePopoverReferenceElement=null,this._relativeLocation="top",this._popoverOpen=!1,this._showSimplificationProgress=!1,!0!==e?.suppressDeprecationWarning&&(this.announceDeprecation=()=>{i(l.getLogger(this),"Sketch","arcgis-sketch",{version:"5.0"})}),this._activateCreateTool=this._activateCreateTool.bind(this),this.viewModel=e?.viewModel||(this._defaultViewModel=new b({creationMode:e?.creationMode??"continuous",useLegacyCreateTools:e?.useLegacyCreateTools??"3d"===e?.view?.type})),this.viewModel.pluginManager.sketch=this}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...o}=e;return o}initialize(){const{layer:e,view:t}=this,o="2d"===t?.type,i=new C({persistSelection:!1,visibleElements:new R({chip:!1,lassoTool:o,operationTypeControls:!1,pan:!1,pointTool:!1,rectangleTool:o}),view:t,sources:e?[e]:null,scale:this.scale,disabled:"disabled"===this.state||this._hasLongRunningOperation});this.addHandles([p(()=>this.viewModel,e=>{this._viewModelHandlesGroup=n(this._viewModelHandlesGroup),e&&(this._viewModelHandlesGroup=s([e.on("create",()=>this.scheduleRender()),e.on("update",()=>this.scheduleRender()),e.on("delete",e=>this.emit("delete",e)),e.on("undo",()=>this.scheduleRender()),e.on("redo",()=>this.scheduleRender()),p(()=>e.layer,e=>{this._selectionToolbar&&(this._selectionToolbar.sources=e?[e]:null)}),p(()=>e.view,e=>{this._selectionToolbar&&(this._selectionToolbar.view=e)}),p(()=>e.state,()=>{this.notifyChange("state"),this._syncSelectionToolbarDisabledState()}),p(()=>e.geometrySimplificationInProgress,()=>{this._syncSelectionToolbarDisabledState()}),M({getLoading:()=>e.geometrySimplificationInProgress,setEffectiveLoading:e=>{this._showSimplificationProgress=e}})]))},c),d(()=>i.activeOperation,()=>{this.viewModel.cancel(),this._activeCustomToolOptions=null}),i.on("complete",e=>this._onSelectionOperationComplete(e)),p(()=>{const{view:e,visibleElements:{selectionTools:t}}=this;return{lassoTool:"3d"!==e?.type&&!!t?.["lasso-selection"],rectangleTool:"3d"!==e?.type&&!!t?.["rectangle-selection"]}},e=>{Object.assign(i.visibleElements,e)},c)]),this._selectionToolbar=i,this._syncSelectionToolbarDisabledState()}loadDependencies(){return T({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}destroy(){this._selectionToolbar?.destroy(),this._viewModelHandlesGroup=n(this._viewModelHandlesGroup)}get activeTool(){const e=this._selectionToolbar?.activeOperation;if(e)switch(e.toolName){case"lasso":return"lasso-selection";case"rectangle":return"rectangle-selection";case"default":return"custom-selection"}const{availableCreateTools:t}=this,{activeTool:o,activeCreateToolDrawMode:i}=this.viewModel;return"polygon"===o&&"freehand"===i&&t?.includes("freehandPolygon")?"freehandPolygon":"polyline"===o&&"freehand"===i&&t?.includes("freehandPolyline")?"freehandPolyline":this.viewModel.activeTool}get activeTooltip(){return this.viewModel.activeTooltip}get createGraphic(){return this.viewModel.createGraphic}get creationMode(){return this.viewModel.creationMode}set creationMode(e){this.viewModel.creationMode=e}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultUpdateOptions(){return this.viewModel.defaultUpdateOptions}set defaultUpdateOptions(e){this.viewModel.defaultUpdateOptions=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}set layout(e){this._set("layout",e),this._selectionToolbar&&(this._selectionToolbar.layout=e)}get pointSymbol(){return this.viewModel.pointSymbol}set pointSymbol(e){this.viewModel.pointSymbol=e}get polygonSymbol(){return this.viewModel.polygonSymbol}set polygonSymbol(e){this.viewModel.polygonSymbol=e}get polylineSymbol(){return this.viewModel.polylineSymbol}set polylineSymbol(e){this.viewModel.polylineSymbol=e}get textSymbol(){return this.viewModel.textSymbol}set textSymbol(e){this.viewModel.textSymbol=e}set scale(e){this._set("scale",e),this._selectionToolbar&&(this._selectionToolbar.scale=e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get state(){return this._selectionToolbar?.activeOperation?"active":this.viewModel.state}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get updateGraphics(){return this.viewModel.updateGraphics}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set viewModel(e){const t=this._get("viewModel");e!==t&&(t&&t===this._defaultViewModel&&r(t),t?.pluginManager?.sketch===this&&(t.pluginManager.sketch=null),this._set("viewModel",e),e.pluginManager.sketch=this)}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get settingsManager(){return this.viewModel.settingsManager}get _effectiveAvailableCreateTools(){if(this.viewModel.effectiveAvailablePlugins?.length)return this.viewModel.effectiveAvailablePlugins;const{availableCreateTools:e,view:t,visibleElements:o}=this,i=e?.filter(e=>!!o.createTools?.[e]);return"3d"===t?.type?i?.filter(e=>"multipoint"!==e):i}create(e,t,o){const i=o?.createOptions??t;return this._activeCustomToolOptions=o,a(this.viewModel.create(e,i))}update(e,t){return a(this.viewModel.update(e,t))}complete(){this.viewModel.complete()}cancel(){this._selectionToolbar?.cancel(),this.viewModel.cancel(),this._activeCustomToolOptions=null}undo(){this.viewModel.undo(),this.view?.focus()}redo(){this.viewModel.redo(),this.view?.focus()}delete(){this.viewModel.delete()}duplicate(){return this.viewModel.duplicate()}dismissFloatingElements(){this._popoverOpen=!1}render(){const{toolbarKind:e,layout:t,scale:o}=this;return P("div",null,P("div",{classes:{[B.base]:!0,[B.floating]:"floating"===e,[B.docked]:"docked"===e,[B.vertical]:"vertical"===t}},P(w,{barStyle:e,layout:t,scale:o},this._renderSelectionSetItemGroupInline(),this._renderSelectionToolsOrBack(),this._renderCreateToolActionGroup(),this._renderUndoRedoMenuItemGroup(),this._renderSettingsMenuItemGroup(),this._renderSimplificationProgressItemGroupInline()),this._renderSelectionSetToolbar(),this._renderSimplificationProgressToolbar(),this._renderSettingsMenuPopover()))}_renderSimplificationProgressToolbar(){if("separate"!==this.contextualToolLocation)return;const e=this._renderSimplificationProgressItemGroup();return e?P(w,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e):void 0}_renderSimplificationProgressItemGroupInline(){if("separate"!==this.contextualToolLocation)return this._renderSimplificationProgressItemGroup()}_renderSelectionToolsOrBack(){if(!this.viewModel.isUsingLegacyCreateTools&&this.viewModel.firstPluginWithSwappableLeaf)return this._renderBackButton();const e=this.customActions?.filter(e=>"selection-toolbar"===e.position);return P("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("selectionTools")??!0,"group-kind":"split-button",key:"selection-split-button",priority:this.groupCollapsePriorities?.get("selectionTools")??0},this._renderDefaultSelectionButton(),this._selectionToolbar?.render(),e?.map(e=>this._renderToolbarItem(e)))}_renderSettingsMenuPopover(){const{messagesCommon:e,settingsManager:t,snappingOptions:o,view:i,viewModel:s,visibleElements:l}=this;if(!this._calcitePopoverReferenceElement)return;const n={directionModePicker:l.directionModePicker,labelsToggle:l.labelsToggle,tooltipsToggle:l.tooltipsToggle},r="horizontal"===this.layout?"top"===this._relativeLocation?"bottom-end":"top-end":"right-end";return P("calcite-popover",{afterCreate:e=>this._popoverElement=e,closable:!0,heading:e.settings,key:`${this.id}-settings`,label:e.settings,open:this._popoverOpen,overlayPositioning:"fixed",placement:r,referenceElement:this._calcitePopoverReferenceElement,scale:this.scale,topLayerDisabled:this.topLayerDisabled,onCalcitePopoverBeforeClose:e=>this._beforePopoverClose(e.target),onCalcitePopoverBeforeOpen:e=>this._remeasurePopoverSizes(e.currentTarget),onCalcitePopoverClose:e=>this._refocusOnView(e.target)},P("div",{class:B.popoverWrapper},Object.values(n).includes(!0)?P(O,{sketchOptions:s.sketchOptions,view:i,visibleElements:new x(n)}):void 0,l.snappingControls&&i&&o?P(k,{snappingManager:this.viewModel.snappingManager,snappingOptions:o,view:i,visibleElements:l.snappingControlsElements}):void 0,t.hasSettings?P(S,{settingsManager:t}):void 0))}_beforePopoverClose(e){e===this._popoverElement&&(this._popoverOpen=!1)}_renderSelectionSetToolbar(){if("separate"!==this.contextualToolLocation)return;const e=this._renderSelectionSetItemGroup();return e?.length?P(w,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e):void 0}_renderSimplificationProgressItemGroup(){if(!this.visibleElements.geometrySimplificationActivityIndicator||!this._showSimplificationProgress)return;const e=`${this.messages.finalizingDrawingTitle}`;return P("div",{"group-kind":"measured-content-group",key:"simplification-progress-group",slot:"actions-end"},P("calcite-action",{"data-testid":"simplification-progress",key:"simplification-progress",scale:this.scale,text:e,title:e},P("calcite-loader",{class:B.simplificationProgressLoader,inline:!0,label:e,scale:this.scale,type:"indeterminate"})))}_renderSelectionSetItemGroupInline(){return"separate"===this.contextualToolLocation?[]:this._renderSelectionSetItemGroup()}_renderUndoRedoMenuItemGroup(){return P("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("undoRedo")??!0,"group-kind":"split-button",key:"undo-redo-menu",priority:this.groupCollapsePriorities?.get("undoRedo")??10,slot:"actions-end"},this._renderUndoButton(),this._renderRedoButton())}_renderSettingsMenuItemGroup(){const e=[],t=[];this.customActions?.forEach(o=>{"settings-before"===o.position?t.push(o):"settings-after"===o.position&&e.push(o)});const i=[...t.map(e=>this._renderToolbarItem(e)),this._renderSettingsMenuButton(),...e.map(e=>this._renderToolbarItem(e))].filter(o);if(i.length)return P("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("settings")??!1,"group-kind":"overflow-group",key:"settings-menu",priority:this.groupCollapsePriorities?.get("settings")??1e3,slot:"actions-end"},i)}_renderSelectionSetItemGroup(){if(!this.updateGraphics.length)return[];const e="inline-end"===this.contextualToolLocation?"actions-end":void 0,t=this.customActions?.filter(e=>"before-selection-set"===e.position),o=this.customActions?.filter(e=>"after-selection-set"===e.position),i=this.groupCollapsePriorities?.get("selectionSet")??100;return[P("div",{"group-kind":"measured-content",key:"selection-count-chip-group",priority:i,slot:e},this._renderFeatureCountChip()),P("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("selectionSet")??!1,"group-kind":"overflow-group",key:"selection-set-tool-group",priority:i,slot:e},t?.map(e=>this._renderToolbarItem(e)),this._renderDuplicateButton(),this._renderDeleteButton(),o?.map(e=>this._renderToolbarItem(e)))]}_renderDefaultSelectionButton(){if(!this.viewModel.updateOnGraphicClick)return[];const{messages:e,state:t}=this;return this._renderToolbarItem({id:"pointer-select",text:e.selectFeature,icon:"cursor",onclick:this._activateDefaultSelectTool,active:"ready"===t})}_renderBackButton(){const{viewModel:e,isUsingLegacyCreateTools:t}=this;if(!t&&e.multiplePluginsActive&&e.firstPluginWithSwappableLeaf&&e.rootPlugins&&(!(e.rootPlugins.length<2&&e.rootPlugins.includes(e.firstPluginWithSwappableLeaf))||this.visibleElements.singlePluginBackButton))return P("div",{"allow-collapse":!1,"group-kind":"overflow-group",key:"back-button-group"},P("calcite-action",{disabled:"disabled"===this.state||this._hasLongRunningOperation,icon:"chevron-left",iconFlipRtl:!0,onclick:()=>{this.viewModel?.cancel()},scale:this.scale,text:this.messagesCommon.back}))}_renderCreateToolActionGroup(){const e=this.viewModel.firstPluginWithSwappableLeaf?[]:this.customToolOptions?.flatMap(e=>this._renderCustomToolItem(e))??[],t=this._effectiveAvailableCreateTools,o=t?.filter(e=>"string"==typeof e),i=o?.map(e=>this._renderCreateToolItem(e)),s=t?.filter(e=>"string"!=typeof e).map(e=>this._renderCreateToolItem(e));return[i?.length||e?.length||s?.length?P("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("createTools")??!0,"group-kind":"overflow-group",key:"create-tools-group",priority:this.groupCollapsePriorities?.get("createTools")??100},i,e,s):void 0]}_renderCreateToolItem(e){return"string"==typeof e?this._renderBuiltInCreateToolItem(e):this._renderDrawToolPluginItem(e)}_renderDrawToolPluginItem(e){const{icon:t,localizationKey:o,uniqueId:i,hidden:s}=e;if(s)return[];const l=this.messages.digitizers,n=l?.[o]??o,r=!this._activeCustomToolOptions&&this.viewModel.drawTool?.pluginStack.some(e=>!e.configuration?.hidden&&e.configuration?.uniqueId===i);return this._renderToolbarItem({id:`${o}-button`,text:n,icon:t,onclick:()=>this._activatePlugin([e]),active:r})}_renderBuiltInCreateToolItem(e){return this._renderToolbarItem({id:`${e}-button`,text:this.messages.draw[e],icon:j[e],onclick:()=>this._activateCreateTool(e),active:this.activeTool===e&&!this._activeCustomToolOptions})}_renderCustomToolItem(e){const{toolKey:t}=e;return this._renderToolbarItem({id:`custom-${e.toolKey}`,text:e.label,icon:e.icon,onclick:()=>this._activateCreateTool(e.toolName,null,e),active:this._activeCustomToolOptions?.toolKey===t})}_renderUndoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"undo-button",text:this.messages.undo,icon:"undo",disabled:!this.viewModel.canUndo(),onclick:this.undo,flipRTL:!0}):[]}_renderRedoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"redo-button",text:this.messages.redo,icon:"redo",disabled:!this.viewModel.canRedo(),onclick:this.redo,flipRTL:!0}):[]}_renderSettingsMenuButton(){return this.visibleElements.settingsMenu?this._renderToolbarItem({id:G,text:this.messagesCommon.settings,icon:"gear",active:this._popoverOpen,onclick:()=>this._popoverOpen=!this._popoverOpen,afterCreate:e=>this._calcitePopoverReferenceElement=e,afterUpdate:e=>this._calcitePopoverReferenceElement=e,afterRemoved:()=>this._calcitePopoverReferenceElement=null}):[]}_renderFeatureCountChip(){if(!this.visibleElements.selectionCountLabel)return[];const{layout:e,messages:o,scale:i,id:s,updateGraphics:{length:l}}=this,n=t(o.selectedCount,{count:l}),r="l"===i?999:99,a=l>r?t(o.selectedCountTruncated,{truncated:r}):l,p="l"!==i&&"vertical"===e,c=p?`${s}-selection-chip-small`:`${s}-selection-chip`;return[p?P("span",{classes:{[B.chipVertical]:!0,[B.chipVerticalSmall]:"s"===this.scale},id:c,tabIndex:0,title:n},a):P("calcite-chip",{appearance:"outline",class:"horizontal"===e?B.chipHorizontal:B.chipVertical,id:c,kind:"brand",label:n,scale:"l"===i?"m":"s",tabIndex:0,title:"vertical"===e?n:void 0},"vertical"===e?a:n)]}_renderDuplicateButton(){if(!this.visibleElements.duplicateButton)return[];const{messages:e}=this;return this._renderToolbarItem({id:"duplicate",text:this.updateGraphics.length>1?e.duplicateFeatures:e.duplicateFeature,icon:"copy",onclick:this._onDuplicateSelect})}_renderDeleteButton(){if(!this.visibleElements.deleteButton)return[];const{messages:e}=this,t=this.updateGraphics.length>1?e.deleteFeatures:e.deleteFeature;return this._renderToolbarItem({id:"delete",text:t,icon:"trash",onclick:this.delete})}_renderToolbarItem({id:e,text:t,icon:o,disabled:i,onclick:s,active:l,flipRTL:n,afterCreate:r,afterUpdate:a,afterRemoved:p}){const c=`${this.id}-${e}`,d=s?()=>s.call(this):void 0;return[P("calcite-action",{active:l,afterCreate:r,afterRemoved:p,afterUpdate:a,bind:this,"data-testid":e,disabled:i||"disabled"===this.state||this._hasLongRunningOperation,icon:o,iconFlipRtl:n??!1,id:c,key:e,onclick:d,scale:this.scale,text:t,title:t})]}get _hasLongRunningOperation(){return this.viewModel.geometrySimplificationInProgress}_remeasurePopoverSizes(e){try{const t=this._calcitePopoverReferenceElement,o=e.parentElement,i=this?.view?.container?.getBoundingClientRect(),s=o?.style;if(!(o&&i&&s&&this.view?.container?.contains(o)&&t))return;const{bottom:l,top:n}=t.getBoundingClientRect();if("horizontal"===this.layout){const e=l<i.height/2;e!==("top"===this._relativeLocation)&&(this._relativeLocation=e?"top":"bottom"),e?(s?.setProperty("--sketch-view-height-offset",l-i.top+"px"),s?.setProperty("--sketch-view-margin-offset","30px")):(s?.setProperty("--sketch-view-height-offset",i.bottom-n+"px"),s?.setProperty("--sketch-view-margin-offset","15px"))}else"vertical"===this.layout&&(s.setProperty("--sketch-view-height-offset","15px"),s.setProperty("--sketch-view-margin-offset","15px"));const r=e.shadowRoot?.querySelector("div.header")?.getBoundingClientRect().height;s.setProperty("--sketch-popover-header-offset",`${r}px`)}catch(t){l.getLogger(this.declaredClass).warnOnce("Sketch failed to lay out settings menu.",t)}}_activateCreateTool(e,t,o){const i=this._activeCustomToolOptions;if(o||i){if(o?.toolKey===i?.toolKey)return void this.cancel()}else if(this.activeTool===e)return void this.cancel();this._selectionToolbar?.cancel(),this.create(e,t,o)}_activatePlugin(e){this._selectionToolbar?.cancel(),this.viewModel.firstPluginWithSwappableLeaf?(this.viewModel.drawTool?.replaceLeaf(e),this.view?.ready&&this.view.focus()):this._activateCreateTool(e)}_onDuplicateSelect(){const e=this.duplicate(),t=this.viewModel.activeTool;"transform"!==t&&"reshape"!==t||this.update(e,{tool:t})}_onSelectionOperationComplete(e){const{viewModel:{defaultUpdateOptions:t}}=this,{selection:o}=e;if(!e.aborted&&o.length){const e=t.tool,i=o.length>1&&"reshape"===e?"transform":e;this.update(o,{...t,tool:i})}this.notifyChange("state")}_activateDefaultSelectTool(){this.cancel(),this.view?.focus()}_refocusOnView(e){this.activeTool&&e===this._popoverElement&&this.view?.focus()}_syncSelectionToolbarDisabledState(){this._selectionToolbar&&(this._selectionToolbar.disabled="disabled"===this.state||this._hasLongRunningOperation)}};e([h()],U.prototype,"activeTool",null),e([h({readOnly:!0})],U.prototype,"activeTooltip",null),e([h({cast:e=>{if(!e?.length)return null;const t=new Set(["point","polyline","polygon","rectangle","circle","multipoint","freehandPolyline","freehandPolygon","mesh","text"]);return e.filter(e=>t.has(e))}})],U.prototype,"availableCreateTools",void 0),e([h({readOnly:!0})],U.prototype,"createGraphic",null),e([h()],U.prototype,"creationMode",null),e([h()],U.prototype,"customToolOptions",void 0),e([h()],U.prototype,"customActions",void 0),e([h()],U.prototype,"defaultCreateOptions",null),e([h()],U.prototype,"defaultUpdateOptions",null),e([h()],U.prototype,"icon",null),e([h()],U.prototype,"label",null),e([h({type:v})],U.prototype,"labelOptions",null),e([h()],U.prototype,"layer",null),e([h({type:["horizontal","vertical"],value:"horizontal"})],U.prototype,"layout",null),e([h({types:g})],U.prototype,"pointSymbol",null),e([h({types:g})],U.prototype,"polygonSymbol",null),e([h({types:g})],U.prototype,"polylineSymbol",null),e([h()],U.prototype,"textSymbol",null),e([h({value:"m"})],U.prototype,"scale",null),e([h()],U.prototype,"toolbarKind",void 0),e([h()],U.prototype,"contextualToolLocation",void 0),e([h()],U.prototype,"groupCollapsePriorities",void 0),e([h()],U.prototype,"groupAllowCollapseOptions",void 0),e([h(),I("esri/widgets/Sketch/t9n/Sketch")],U.prototype,"messages",void 0),e([h(),I("esri/t9n/common")],U.prototype,"messagesCommon",void 0),e([h()],U.prototype,"snappingOptions",null),e([h()],U.prototype,"state",null),e([h({type:m})],U.prototype,"tooltipOptions",null),e([h({readOnly:!0})],U.prototype,"updateGraphics",null),e([h({type:f,nonNullable:!0})],U.prototype,"valueOptions",null),e([h()],U.prototype,"view",null),e([h({type:b}),L(["create","update","undo","redo"])],U.prototype,"viewModel",null),e([h({type:_,nonNullable:!0})],U.prototype,"visibleElements",void 0),e([h()],U.prototype,"useLegacyCreateTools",null),e([h()],U.prototype,"isUsingLegacyCreateTools",null),e([h()],U.prototype,"settingsManager",null),e([h()],U.prototype,"_effectiveAvailableCreateTools",null),e([h()],U.prototype,"_defaultViewModel",void 0),e([h()],U.prototype,"_activeCustomToolOptions",void 0),e([h()],U.prototype,"_calcitePopoverReferenceElement",void 0),e([h()],U.prototype,"_hasLongRunningOperation",null),e([h()],U.prototype,"_relativeLocation",void 0),e([h()],U.prototype,"_popoverOpen",void 0),e([h()],U.prototype,"_showSimplificationProgress",void 0),U=e([u("esri.widgets.Sketch")],U);const D=U;export{D as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{isSome as o}from"../core/arrayUtils.js";import{deprecateWidget as i}from"../core/deprecate.js";import{handlesGroup as s}from"../core/handleUtils.js";import l from"../core/Logger.js";import{removeMaybe as n,destroyMaybe as r}from"../core/maybe.js";import{ignoreAbortErrors as a}from"../core/promiseUtils.js";import{watch as p,syncAndInitial as c,when as d}from"../core/reactiveUtils.js";import{property as h,subclass as u}from"../core/accessorSupport/decorators.js";import{symbolTypes as g}from"../symbols/support/typeUtils.js";import v from"../views/interactive/sketch/SketchLabelOptions.js";import m from"../views/interactive/sketch/SketchTooltipOptions.js";import f from"../views/interactive/sketch/SketchValueOptions.js";import y from"./Widget.js";import b from"./Sketch/SketchViewModel.js";import _ from"./Sketch/VisibleElements.js";import w from"./Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{connectDelayedLoading as M}from"./support/loaderUtils.js";import S from"./support/PluginSettingsControls.js";import C from"./support/SelectionToolbar.js";import O from"./support/SketchTooltipControls.js";import k from"./support/SnappingControls.js";import{tsx as P,messageBundle as I,vmEvent as L}from"./support/widget.js";import R from"./support/SelectionToolbar/VisibleElements.js";import x from"./support/SketchTooltipControls/VisibleElements.js";const E="esri-sketch",G="settings-menu-action",B={base:E,vertical:`${E}--vertical`,docked:`${E}-bar`,floating:`${E}-pad`,chipHorizontal:`${E}__selection-count-chip--horizontal`,chipVertical:`${E}__selection-count-chip--vertical`,chipVerticalSmall:`${E}__selection-count-chip--vertical--s`,popoverWrapper:`${E}__popover-wrapper`,simplificationProgressLoader:`${E}__simplification-progress-loader`},j={point:"pin",polyline:"line",polygon:"polygon",rectangle:"rectangle",circle:"circle",multipoint:"pins",mesh:"i3d-building",freehandPolygon:"freehand-area",freehandPolyline:"freehand",text:"add-text"};let U=class extends y{constructor(e,t){super(e,t),this._selectionToolbar=null,this._viewModelHandlesGroup=null,this._popoverElement=null,this.availableCreateTools=["point","polyline","polygon","rectangle","circle"],this.customToolOptions=null,this.customActions=null,this.toolbarKind="floating",this.contextualToolLocation="separate",this.groupCollapsePriorities=null,this.groupAllowCollapseOptions=null,this.messages=null,this.messagesCommon=null,this.visibleElements=new _,this._defaultViewModel=null,this._activeCustomToolOptions=null,this._calcitePopoverReferenceElement=null,this._relativeLocation="top",this._popoverOpen=!1,this._showSimplificationProgress=!1,!0!==e?.suppressDeprecationWarning&&(this.announceDeprecation=()=>{i(l.getLogger(this),"Sketch","arcgis-sketch",{version:"5.0"})}),this._activateCreateTool=this._activateCreateTool.bind(this),this.viewModel=e?.viewModel||(this._defaultViewModel=new b({creationMode:e?.creationMode??"continuous",useLegacyCreateTools:e?.useLegacyCreateTools??"3d"===e?.view?.type})),this.viewModel.pluginManager.sketch=this}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...o}=e;return o}initialize(){const{layer:e,view:t}=this,o="2d"===t?.type,i=new C({persistSelection:!1,visibleElements:new R({chip:!1,lassoTool:o,operationTypeControls:!1,pan:!1,pointTool:!1,rectangleTool:o}),view:t,sources:e?[e]:null,scale:this.scale,disabled:"disabled"===this.state||this._hasLongRunningOperation});this.addHandles([p(()=>this.viewModel,e=>{this._viewModelHandlesGroup=n(this._viewModelHandlesGroup),e&&(this._viewModelHandlesGroup=s([e.on("create",()=>this.scheduleRender()),e.on("update",()=>this.scheduleRender()),e.on("delete",e=>this.emit("delete",e)),e.on("undo",()=>this.scheduleRender()),e.on("redo",()=>this.scheduleRender()),p(()=>e.layer,e=>{this._selectionToolbar&&(this._selectionToolbar.sources=e?[e]:null)}),p(()=>e.view,e=>{this._selectionToolbar&&(this._selectionToolbar.view=e)}),p(()=>e.state,()=>{this.notifyChange("state"),this._syncSelectionToolbarDisabledState()}),p(()=>e.geometrySimplificationInProgress,()=>{this._syncSelectionToolbarDisabledState()}),M({getLoading:()=>e.geometrySimplificationInProgress,setEffectiveLoading:e=>{this._showSimplificationProgress=e}})]))},c),d(()=>i.activeOperation,()=>{this.viewModel.cancel(),this._activeCustomToolOptions=null}),i.on("complete",e=>this._onSelectionOperationComplete(e)),p(()=>{const{view:e,visibleElements:{selectionTools:t}}=this;return{lassoTool:"3d"!==e?.type&&!!t?.["lasso-selection"],rectangleTool:"3d"!==e?.type&&!!t?.["rectangle-selection"]}},e=>{Object.assign(i.visibleElements,e)},c)]),this._selectionToolbar=i,this._syncSelectionToolbarDisabledState()}loadDependencies(){return T({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}destroy(){this._selectionToolbar?.destroy(),this._viewModelHandlesGroup=n(this._viewModelHandlesGroup)}get activeTool(){const e=this._selectionToolbar?.activeOperation;if(e)switch(e.toolName){case"lasso":return"lasso-selection";case"rectangle":return"rectangle-selection";case"default":return"custom-selection"}const{availableCreateTools:t}=this,{activeTool:o,activeCreateToolDrawMode:i}=this.viewModel;return"polygon"===o&&"freehand"===i&&t?.includes("freehandPolygon")?"freehandPolygon":"polyline"===o&&"freehand"===i&&t?.includes("freehandPolyline")?"freehandPolyline":this.viewModel.activeTool}get activeTooltip(){return this.viewModel.activeTooltip}get createGraphic(){return this.viewModel.createGraphic}get creationMode(){return this.viewModel.creationMode}set creationMode(e){this.viewModel.creationMode=e}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultUpdateOptions(){return this.viewModel.defaultUpdateOptions}set defaultUpdateOptions(e){this.viewModel.defaultUpdateOptions=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}set layout(e){this._set("layout",e),this._selectionToolbar&&(this._selectionToolbar.layout=e)}get pointSymbol(){return this.viewModel.pointSymbol}set pointSymbol(e){this.viewModel.pointSymbol=e}get polygonSymbol(){return this.viewModel.polygonSymbol}set polygonSymbol(e){this.viewModel.polygonSymbol=e}get polylineSymbol(){return this.viewModel.polylineSymbol}set polylineSymbol(e){this.viewModel.polylineSymbol=e}get textSymbol(){return this.viewModel.textSymbol}set textSymbol(e){this.viewModel.textSymbol=e}set scale(e){this._set("scale",e),this._selectionToolbar&&(this._selectionToolbar.scale=e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get state(){return this._selectionToolbar?.activeOperation?"active":this.viewModel.state}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get updateGraphics(){return this.viewModel.updateGraphics}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set viewModel(e){const t=this._get("viewModel");e!==t&&(t&&t===this._defaultViewModel&&r(t),t?.pluginManager?.sketch===this&&(t.pluginManager.sketch=null),this._set("viewModel",e),e.pluginManager.sketch=this)}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get settingsManager(){return this.viewModel.settingsManager}get _effectiveAvailableCreateTools(){if(this.viewModel.effectiveAvailablePlugins?.length)return this.viewModel.effectiveAvailablePlugins;const{availableCreateTools:e,view:t,visibleElements:o}=this,i=e?.filter(e=>!!o.createTools?.[e]);return"3d"===t?.type?i?.filter(e=>"multipoint"!==e):i}create(e,t,o){const i=o?.createOptions??t;return this._activeCustomToolOptions=o,a(this.viewModel.create(e,i))}update(e,t){return a(this.viewModel.update(e,t))}complete(){this.viewModel.complete()}cancel(){this._selectionToolbar?.cancel(),this.viewModel.cancel(),this._activeCustomToolOptions=null}undo(){this.viewModel.undo(),this.view?.focus()}redo(){this.viewModel.redo(),this.view?.focus()}delete(){this.viewModel.delete()}duplicate(){return this.viewModel.duplicate()}dismissFloatingElements(){this._popoverOpen=!1}render(){const{toolbarKind:e,layout:t,scale:o}=this;return P("div",null,P("div",{classes:{[B.base]:!0,[B.floating]:"floating"===e,[B.docked]:"docked"===e,[B.vertical]:"vertical"===t}},P(w,{barStyle:e,layout:t,scale:o},this._renderSelectionSetItemGroupInline(),this._renderSelectionToolsOrBack(),this._renderCreateToolActionGroup(),this._renderUndoRedoMenuItemGroup(),this._renderSettingsMenuItemGroup(),this._renderSimplificationProgressItemGroupInline()),this._renderSelectionSetToolbar(),this._renderSimplificationProgressToolbar(),this._renderSettingsMenuPopover()))}_renderSimplificationProgressToolbar(){if("separate"!==this.contextualToolLocation)return;const e=this._renderSimplificationProgressItemGroup();return e?P(w,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e):void 0}_renderSimplificationProgressItemGroupInline(){if("separate"!==this.contextualToolLocation)return this._renderSimplificationProgressItemGroup()}_renderSelectionToolsOrBack(){if(!this.viewModel.isUsingLegacyCreateTools&&this.viewModel.firstPluginWithSwappableLeaf)return this._renderBackButton();const e=this.customActions?.filter(e=>"selection-toolbar"===e.position);return P("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("selectionTools")??!0,"group-kind":"split-button",key:"selection-split-button",priority:this.groupCollapsePriorities?.get("selectionTools")??0},this._renderDefaultSelectionButton(),this._selectionToolbar?.render(),e?.map(e=>this._renderToolbarItem(e)))}_renderSettingsMenuPopover(){const{messagesCommon:e,settingsManager:t,snappingOptions:o,view:i,viewModel:s,visibleElements:l}=this;if(!this._calcitePopoverReferenceElement)return;const n={directionModePicker:l.directionModePicker,labelsToggle:l.labelsToggle,tooltipsToggle:l.tooltipsToggle},r="horizontal"===this.layout?"top"===this._relativeLocation?"bottom-end":"top-end":"right-end";return P("calcite-popover",{afterCreate:e=>this._popoverElement=e,closable:!0,heading:e.settings,key:`${this.id}-settings`,label:e.settings,open:this._popoverOpen,overlayPositioning:"fixed",placement:r,referenceElement:this._calcitePopoverReferenceElement,scale:this.scale,topLayerDisabled:this.topLayerDisabled,onCalcitePopoverBeforeClose:e=>this._beforePopoverClose(e.target),onCalcitePopoverBeforeOpen:e=>this._remeasurePopoverSizes(e.currentTarget),onCalcitePopoverClose:e=>this._refocusOnView(e.target)},P("div",{class:B.popoverWrapper},Object.values(n).includes(!0)?P(O,{sketchOptions:s.sketchOptions,view:i,visibleElements:new x(n)}):void 0,l.snappingControls&&i&&o?P(k,{snappingManager:this.viewModel.snappingManager,snappingOptions:o,view:i,visibleElements:l.snappingControlsElements}):void 0,t.hasSettings?P(S,{settingsManager:t}):void 0))}_beforePopoverClose(e){e===this._popoverElement&&(this._popoverOpen=!1)}_renderSelectionSetToolbar(){if("separate"!==this.contextualToolLocation)return;const e=this._renderSelectionSetItemGroup();return e?.length?P(w,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e):void 0}_renderSimplificationProgressItemGroup(){if(!this.visibleElements.geometrySimplificationActivityIndicator||!this._showSimplificationProgress)return;const e=`${this.messages.finalizingDrawingTitle}`;return P("div",{"group-kind":"measured-content-group",key:"simplification-progress-group",slot:"actions-end"},P("calcite-action",{"data-testid":"simplification-progress",key:"simplification-progress",scale:this.scale,text:e,title:e},P("calcite-loader",{class:B.simplificationProgressLoader,inline:!0,label:e,scale:this.scale,type:"indeterminate"})))}_renderSelectionSetItemGroupInline(){return"separate"===this.contextualToolLocation?[]:this._renderSelectionSetItemGroup()}_renderUndoRedoMenuItemGroup(){return P("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("undoRedo")??!0,"group-kind":"split-button",key:"undo-redo-menu",priority:this.groupCollapsePriorities?.get("undoRedo")??10,slot:"actions-end"},this._renderUndoButton(),this._renderRedoButton())}_renderSettingsMenuItemGroup(){const e=[],t=[];this.customActions?.forEach(o=>{"settings-before"===o.position?t.push(o):"settings-after"===o.position&&e.push(o)});const i=[...t.map(e=>this._renderToolbarItem(e)),this._renderSettingsMenuButton(),...e.map(e=>this._renderToolbarItem(e))].filter(o);if(i.length)return P("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("settings")??!1,"group-kind":"overflow-group",key:"settings-menu",priority:this.groupCollapsePriorities?.get("settings")??1e3,slot:"actions-end"},i)}_renderSelectionSetItemGroup(){if(!this.updateGraphics.length)return[];const e="inline-end"===this.contextualToolLocation?"actions-end":void 0,t=this.customActions?.filter(e=>"before-selection-set"===e.position),o=this.customActions?.filter(e=>"after-selection-set"===e.position),i=this.groupCollapsePriorities?.get("selectionSet")??100;return[P("div",{"group-kind":"measured-content",key:"selection-count-chip-group",priority:i,slot:e},this._renderFeatureCountChip()),P("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("selectionSet")??!1,"group-kind":"overflow-group",key:"selection-set-tool-group",priority:i,slot:e},t?.map(e=>this._renderToolbarItem(e)),this._renderDuplicateButton(),this._renderDeleteButton(),o?.map(e=>this._renderToolbarItem(e)))]}_renderDefaultSelectionButton(){if(!this.viewModel.updateOnGraphicClick)return[];const{messages:e,state:t}=this;return this._renderToolbarItem({id:"pointer-select",text:e.selectFeature,icon:"cursor",onclick:this._activateDefaultSelectTool,active:"ready"===t})}_renderBackButton(){const{viewModel:e,isUsingLegacyCreateTools:t}=this;if(!t&&e.multiplePluginsActive&&e.firstPluginWithSwappableLeaf&&e.rootPlugins&&(!(e.rootPlugins.length<2&&e.rootPlugins.includes(e.firstPluginWithSwappableLeaf))||this.visibleElements.singlePluginBackButton))return P("div",{"allow-collapse":!1,"group-kind":"overflow-group",key:"back-button-group"},P("calcite-action",{disabled:"disabled"===this.state||this._hasLongRunningOperation,icon:"chevron-left",iconFlipRtl:!0,scale:this.scale,text:this.messagesCommon.back,onclick:()=>{this.viewModel?.cancel()}}))}_renderCreateToolActionGroup(){const e=this.viewModel.firstPluginWithSwappableLeaf?[]:this.customToolOptions?.flatMap(e=>this._renderCustomToolItem(e))??[],t=this._effectiveAvailableCreateTools,o=t?.filter(e=>"string"==typeof e),i=o?.map(e=>this._renderCreateToolItem(e)),s=t?.filter(e=>"string"!=typeof e).map(e=>this._renderCreateToolItem(e));return[i?.length||e?.length||s?.length?P("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("createTools")??!0,"group-kind":"overflow-group",key:"create-tools-group",priority:this.groupCollapsePriorities?.get("createTools")??100},i,e,s):void 0]}_renderCreateToolItem(e){return"string"==typeof e?this._renderBuiltInCreateToolItem(e):this._renderDrawToolPluginItem(e)}_renderDrawToolPluginItem(e){const{icon:t,localizationKey:o,uniqueId:i,hidden:s}=e;if(s)return[];const l=this.messages.digitizers,n=l?.[o]??o,r=!this._activeCustomToolOptions&&this.viewModel.drawTool?.pluginStack.some(e=>!e.configuration?.hidden&&e.configuration?.uniqueId===i);return this._renderToolbarItem({id:`${o}-button`,text:n,icon:t,onclick:()=>this._activatePlugin([e]),active:r})}_renderBuiltInCreateToolItem(e){return this._renderToolbarItem({id:`${e}-button`,text:this.messages.draw[e],icon:j[e],onclick:()=>this._activateCreateTool(e),active:this.activeTool===e&&!this._activeCustomToolOptions})}_renderCustomToolItem(e){const{toolKey:t}=e;return this._renderToolbarItem({id:`custom-${e.toolKey}`,text:e.label,icon:e.icon,onclick:()=>this._activateCreateTool(e.toolName,null,e),active:this._activeCustomToolOptions?.toolKey===t})}_renderUndoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"undo-button",text:this.messages.undo,icon:"undo",disabled:!this.viewModel.canUndo(),onclick:this.undo,flipRTL:!0}):[]}_renderRedoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"redo-button",text:this.messages.redo,icon:"redo",disabled:!this.viewModel.canRedo(),onclick:this.redo,flipRTL:!0}):[]}_renderSettingsMenuButton(){return this.visibleElements.settingsMenu?this._renderToolbarItem({id:G,text:this.messagesCommon.settings,icon:"gear",active:this._popoverOpen,onclick:()=>this._popoverOpen=!this._popoverOpen,afterCreate:e=>this._calcitePopoverReferenceElement=e,afterUpdate:e=>this._calcitePopoverReferenceElement=e,afterRemoved:()=>this._calcitePopoverReferenceElement=null}):[]}_renderFeatureCountChip(){if(!this.visibleElements.selectionCountLabel)return[];const{layout:e,messages:o,scale:i,id:s,updateGraphics:{length:l}}=this,n=t(o.selectedCount,{count:l}),r="l"===i?999:99,a=l>r?t(o.selectedCountTruncated,{truncated:r}):l,p="l"!==i&&"vertical"===e,c=p?`${s}-selection-chip-small`:`${s}-selection-chip`;return[p?P("span",{classes:{[B.chipVertical]:!0,[B.chipVerticalSmall]:"s"===this.scale},id:c,tabIndex:0,title:n},a):P("calcite-chip",{appearance:"outline",class:"horizontal"===e?B.chipHorizontal:B.chipVertical,id:c,kind:"brand",label:n,scale:"l"===i?"m":"s",tabIndex:0,title:"vertical"===e?n:void 0},"vertical"===e?a:n)]}_renderDuplicateButton(){if(!this.visibleElements.duplicateButton)return[];const{messages:e}=this;return this._renderToolbarItem({id:"duplicate",text:this.updateGraphics.length>1?e.duplicateFeatures:e.duplicateFeature,icon:"copy",onclick:this._onDuplicateSelect})}_renderDeleteButton(){if(!this.visibleElements.deleteButton)return[];const{messages:e}=this,t=this.updateGraphics.length>1?e.deleteFeatures:e.deleteFeature;return this._renderToolbarItem({id:"delete",text:t,icon:"trash",onclick:this.delete})}_renderToolbarItem({id:e,text:t,icon:o,disabled:i,onclick:s,active:l,flipRTL:n,afterCreate:r,afterUpdate:a,afterRemoved:p}){const c=`${this.id}-${e}`,d=s?()=>s.call(this):void 0;return[P("calcite-action",{active:l,afterCreate:r,afterRemoved:p,afterUpdate:a,bind:this,"data-testid":e,disabled:i||"disabled"===this.state||this._hasLongRunningOperation,icon:o,iconFlipRtl:n??!1,id:c,key:e,scale:this.scale,text:t,title:t,onclick:d})]}get _hasLongRunningOperation(){return this.viewModel.geometrySimplificationInProgress}_remeasurePopoverSizes(e){try{const t=this._calcitePopoverReferenceElement,o=e.parentElement,i=this?.view?.container?.getBoundingClientRect(),s=o?.style;if(!(o&&i&&s&&this.view?.container?.contains(o)&&t))return;const{bottom:l,top:n}=t.getBoundingClientRect();if("horizontal"===this.layout){const e=l<i.height/2;e!==("top"===this._relativeLocation)&&(this._relativeLocation=e?"top":"bottom"),e?(s?.setProperty("--sketch-view-height-offset",l-i.top+"px"),s?.setProperty("--sketch-view-margin-offset","30px")):(s?.setProperty("--sketch-view-height-offset",i.bottom-n+"px"),s?.setProperty("--sketch-view-margin-offset","15px"))}else"vertical"===this.layout&&(s.setProperty("--sketch-view-height-offset","15px"),s.setProperty("--sketch-view-margin-offset","15px"));const r=e.shadowRoot?.querySelector("div.header")?.getBoundingClientRect().height;s.setProperty("--sketch-popover-header-offset",`${r}px`)}catch(t){l.getLogger(this.declaredClass).warnOnce("Sketch failed to lay out settings menu.",t)}}_activateCreateTool(e,t,o){const i=this._activeCustomToolOptions;if(o||i){if(o?.toolKey===i?.toolKey)return void this.cancel()}else if(this.activeTool===e)return void this.cancel();this._selectionToolbar?.cancel(),this.create(e,t,o)}_activatePlugin(e){this._selectionToolbar?.cancel(),this.viewModel.firstPluginWithSwappableLeaf?(this.viewModel.drawTool?.replaceLeaf(e),this.view?.ready&&this.view.focus()):this._activateCreateTool(e)}_onDuplicateSelect(){const e=this.duplicate(),t=this.viewModel.activeTool;"transform"!==t&&"reshape"!==t||this.update(e,{tool:t})}_onSelectionOperationComplete(e){const{viewModel:{defaultUpdateOptions:t}}=this,{selection:o}=e;if(!e.aborted&&o.length){const e=t.tool,i=o.length>1&&"reshape"===e?"transform":e;this.update(o,{...t,tool:i})}this.notifyChange("state")}_activateDefaultSelectTool(){this.cancel(),this.view?.focus()}_refocusOnView(e){this.activeTool&&e===this._popoverElement&&this.view?.focus()}_syncSelectionToolbarDisabledState(){this._selectionToolbar&&(this._selectionToolbar.disabled="disabled"===this.state||this._hasLongRunningOperation)}};e([h()],U.prototype,"activeTool",null),e([h({readOnly:!0})],U.prototype,"activeTooltip",null),e([h({cast:e=>{if(!e?.length)return null;const t=new Set(["point","polyline","polygon","rectangle","circle","multipoint","freehandPolyline","freehandPolygon","mesh","text"]);return e.filter(e=>t.has(e))}})],U.prototype,"availableCreateTools",void 0),e([h({readOnly:!0})],U.prototype,"createGraphic",null),e([h()],U.prototype,"creationMode",null),e([h()],U.prototype,"customToolOptions",void 0),e([h()],U.prototype,"customActions",void 0),e([h()],U.prototype,"defaultCreateOptions",null),e([h()],U.prototype,"defaultUpdateOptions",null),e([h()],U.prototype,"icon",null),e([h()],U.prototype,"label",null),e([h({type:v})],U.prototype,"labelOptions",null),e([h()],U.prototype,"layer",null),e([h({type:["horizontal","vertical"],value:"horizontal"})],U.prototype,"layout",null),e([h({types:g})],U.prototype,"pointSymbol",null),e([h({types:g})],U.prototype,"polygonSymbol",null),e([h({types:g})],U.prototype,"polylineSymbol",null),e([h()],U.prototype,"textSymbol",null),e([h({value:"m"})],U.prototype,"scale",null),e([h()],U.prototype,"toolbarKind",void 0),e([h()],U.prototype,"contextualToolLocation",void 0),e([h()],U.prototype,"groupCollapsePriorities",void 0),e([h()],U.prototype,"groupAllowCollapseOptions",void 0),e([h(),I("esri/widgets/Sketch/t9n/Sketch")],U.prototype,"messages",void 0),e([h(),I("esri/t9n/common")],U.prototype,"messagesCommon",void 0),e([h()],U.prototype,"snappingOptions",null),e([h()],U.prototype,"state",null),e([h({type:m})],U.prototype,"tooltipOptions",null),e([h({readOnly:!0})],U.prototype,"updateGraphics",null),e([h({type:f,nonNullable:!0})],U.prototype,"valueOptions",null),e([h()],U.prototype,"view",null),e([h({type:b}),L(["create","update","undo","redo"])],U.prototype,"viewModel",null),e([h({type:_,nonNullable:!0})],U.prototype,"visibleElements",void 0),e([h()],U.prototype,"useLegacyCreateTools",null),e([h()],U.prototype,"isUsingLegacyCreateTools",null),e([h()],U.prototype,"settingsManager",null),e([h()],U.prototype,"_effectiveAvailableCreateTools",null),e([h()],U.prototype,"_defaultViewModel",void 0),e([h()],U.prototype,"_activeCustomToolOptions",void 0),e([h()],U.prototype,"_calcitePopoverReferenceElement",void 0),e([h()],U.prototype,"_hasLongRunningOperation",null),e([h()],U.prototype,"_relativeLocation",void 0),e([h()],U.prototype,"_popoverOpen",void 0),e([h()],U.prototype,"_showSimplificationProgress",void 0),U=e([u("esri.widgets.Sketch")],U);const D=U;export{D as default};
package/widgets/Slice.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../analysis/SliceAnalysis.js";import{deprecateWidget as i}from"../core/deprecate.js";import s from"../core/Logger.js";import{ignoreAbortErrors as l}from"../core/promiseUtils.js";import{property as r,subclass as o}from"../core/accessorSupport/decorators.js";import n from"./Widget.js";import c from"./Slice/SliceViewModel.js";import{loadCalciteComponents as a}from"./support/componentsUtils.js";import{globalCss as d}from"./support/globalCss.js";import{Heading as u}from"./support/Heading.js";import{messageBundle as p,tsx as m}from"./support/widget.js";const y="esri-slice",h={base:y,actions:`${y}__actions`,cancelButton:`${y}__cancel-button`,container:`${y}__container`,error:`${y}__error`,excludeButton:`${y}__exclude-button`,hint:`${y}__hint`,hintText:`${y}__hint-text`,layerItem:`${y}__layer-item`,layerList:`${y}__layer-list`,layerListHeading:`${y}__layer-list-title`,newSliceButton:`${y}__clear-button`};let v=class extends n{constructor(e,t){super(e,t),this.headingLevel=3,this.messages=null,this.viewModel=new c({suppressDeprecationWarning:!0}),this._onNewSliceClick=()=>{l(this.viewModel.start())},i(s.getLogger(this),"Slice","arcgis-slice",{version:"4.33"})}loadDependencies(){return a({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get excludedLayers(){return this.viewModel.excludedLayers}set excludedLayers(e){this.viewModel.excludedLayers=e}get excludeGroundSurface(){return this.viewModel.excludeGroundSurface}set excludeGroundSurface(e){this.viewModel.excludeGroundSurface=e}get icon(){return"slice"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}get hasVoxelLayers(){const e=this.viewModel?.view;return null!=e&&e.allLayerViews.some(e=>"voxel-3d"===e.type)}render(){return m("div",{class:this.classes(h.base,d.widget,d.panel),role:"presentation"},this.visible?m("div",{class:h.container},this.viewModel.supported?[this._renderHint(),this._renderLayerList(),this._renderActions()]:this._renderUnsupported()):null)}_renderUnsupported(){return m("div",{class:h.error,key:"unsupported"},m("p",null,this.messages.unsupported))}_renderHint(){const{hasVoxelLayers:e,messages:t,viewModel:i}=this,{active:s,mode:l,state:r}=i;let o=null;return s&&("exclude"===l?o=t.excludeHint:"ready"===r&&(o=e?t.voxelHint:t.hint)),o?m("div",{class:h.hint,key:"hint"},m("p",{class:h.hintText},o),m("p",{class:h.hintText},t.verticalHint)):null}_renderLayerList(){const{excludedLayers:e,excludeGroundSurface:t,headingLevel:i,messages:s,viewModel:l}=this,{mode:r,state:o}=l,n="slicing"===o||"sliced"===o,c=e?e.toArray().map(e=>this._renderLayerItem({uid:e.uid,title:e.title,onClick:()=>(this.excludedLayers.remove(e),!1)})):[];return t&&c.push(this._renderLayerItem({uid:"ground",title:s.ground,onClick:()=>(this.excludeGroundSurface=!1,!1)})),"exclude"!==r&&n&&0!==c.length?m("div",{class:h.layerList,key:"settings"},m(u,{class:h.layerListHeading,level:i},s.excludedLayers),m("calcite-list",{label:s.excludedLayers,selectionMode:"none"},c)):null}_renderActions(){const{messages:e,viewModel:t}=this,{active:i,state:s}=t,l="disabled"===s,r="slicing"===s||"sliced"===s,o="exclude"===t.mode,n=[];return i&&!r||o||n.push(m("calcite-button",{class:h.newSliceButton,disabled:l,key:"new-slice",onclick:this._onNewSliceClick},e.newSlice)),r&&!o&&n.push(m("calcite-button",{appearance:"outline-fill",class:h.excludeButton,disabled:l,key:"exclude",onclick:()=>t.enterExcludeLayerMode()},e.excludeLayer)),i&&o&&n.push(m("calcite-button",{appearance:"outline-fill",class:h.cancelButton,disabled:l,key:"cancel-exclude",onclick:()=>t.exitExcludeLayerMode()},e.cancel)),0===n.length?null:m("div",{class:h.actions},n)}_renderLayerItem(e){const t=this.messages.includeLayer;return m("calcite-list-item",{class:h.layerItem,"data-testid":`list-item-${e.uid}`,key:e.uid,label:e.title??""},m("calcite-action",{icon:"x",onclick:e.onClick,slot:"actions-end",text:t,title:t}))}};e([r()],v.prototype,"active",null),e([r({type:t,nonNullable:!0})],v.prototype,"analysis",null),e([r()],v.prototype,"excludedLayers",null),e([r()],v.prototype,"excludeGroundSurface",null),e([r()],v.prototype,"headingLevel",void 0),e([r()],v.prototype,"icon",null),e([r()],v.prototype,"label",null),e([r(),p("esri/widgets/Slice/t9n/Slice")],v.prototype,"messages",void 0),e([r()],v.prototype,"view",null),e([r({type:c})],v.prototype,"viewModel",void 0),e([r()],v.prototype,"visible",null),e([r()],v.prototype,"hasVoxelLayers",null),v=e([o("esri.widgets.Slice")],v);const g=v;export{g as default};
2
+ import{__decorate as e}from"tslib";import t from"../analysis/SliceAnalysis.js";import{deprecateWidget as i}from"../core/deprecate.js";import s from"../core/Logger.js";import{ignoreAbortErrors as l}from"../core/promiseUtils.js";import{property as r,subclass as o}from"../core/accessorSupport/decorators.js";import n from"./Widget.js";import c from"./Slice/SliceViewModel.js";import{loadCalciteComponents as a}from"./support/componentsUtils.js";import{globalCss as d}from"./support/globalCss.js";import{Heading as u}from"./support/Heading.js";import{messageBundle as p,tsx as m}from"./support/widget.js";const y="esri-slice",h={base:y,actions:`${y}__actions`,cancelButton:`${y}__cancel-button`,container:`${y}__container`,error:`${y}__error`,excludeButton:`${y}__exclude-button`,hint:`${y}__hint`,hintText:`${y}__hint-text`,layerItem:`${y}__layer-item`,layerList:`${y}__layer-list`,layerListHeading:`${y}__layer-list-title`,newSliceButton:`${y}__clear-button`};let v=class extends n{constructor(e,t){super(e,t),this.headingLevel=3,this.messages=null,this.viewModel=new c({suppressDeprecationWarning:!0}),this._onNewSliceClick=()=>{l(this.viewModel.start())},i(s.getLogger(this),"Slice","arcgis-slice",{version:"4.33"})}loadDependencies(){return a({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get excludedLayers(){return this.viewModel.excludedLayers}set excludedLayers(e){this.viewModel.excludedLayers=e}get excludeGroundSurface(){return this.viewModel.excludeGroundSurface}set excludeGroundSurface(e){this.viewModel.excludeGroundSurface=e}get icon(){return"slice"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}get hasVoxelLayers(){const e=this.viewModel?.view;return null!=e&&e.allLayerViews.some(e=>"voxel-3d"===e.type)}render(){return m("div",{class:this.classes(h.base,d.widget,d.panel),role:"presentation"},this.visible?m("div",{class:h.container},this.viewModel.supported?[this._renderHint(),this._renderLayerList(),this._renderActions()]:this._renderUnsupported()):null)}_renderUnsupported(){return m("div",{class:h.error,key:"unsupported"},m("p",null,this.messages.unsupported))}_renderHint(){const{hasVoxelLayers:e,messages:t,viewModel:i}=this,{active:s,mode:l,state:r}=i;let o=null;return s&&("exclude"===l?o=t.excludeHint:"ready"===r&&(o=e?t.voxelHint:t.hint)),o?m("div",{class:h.hint,key:"hint"},m("p",{class:h.hintText},o),m("p",{class:h.hintText},t.verticalHint)):null}_renderLayerList(){const{excludedLayers:e,excludeGroundSurface:t,headingLevel:i,messages:s,viewModel:l}=this,{mode:r,state:o}=l,n="slicing"===o||"sliced"===o,c=e?e.toArray().map(e=>this._renderLayerItem({uid:e.uid,title:e.title,onClick:()=>(this.excludedLayers.remove(e),!1)})):[];return t&&c.push(this._renderLayerItem({uid:"ground",title:s.ground,onClick:()=>(this.excludeGroundSurface=!1,!1)})),"exclude"!==r&&n&&0!==c.length?m("div",{class:h.layerList,key:"settings"},m(u,{class:h.layerListHeading,level:i},s.excludedLayers),m("calcite-list",{label:s.excludedLayers,selectionMode:"none"},c)):null}_renderActions(){const{messages:e,viewModel:t}=this,{active:i,state:s}=t,l="disabled"===s,r="slicing"===s||"sliced"===s,o="exclude"===t.mode,n=[];return i&&!r||o||n.push(m("calcite-button",{class:h.newSliceButton,disabled:l,key:"new-slice",onclick:this._onNewSliceClick},e.newSlice)),r&&!o&&n.push(m("calcite-button",{appearance:"outline-fill",class:h.excludeButton,disabled:l,key:"exclude",onclick:()=>t.enterExcludeLayerMode()},e.excludeLayer)),i&&o&&n.push(m("calcite-button",{appearance:"outline-fill",class:h.cancelButton,disabled:l,key:"cancel-exclude",onclick:()=>t.exitExcludeLayerMode()},e.cancel)),0===n.length?null:m("div",{class:h.actions},n)}_renderLayerItem(e){const t=this.messages.includeLayer;return m("calcite-list-item",{class:h.layerItem,"data-testid":`list-item-${e.uid}`,key:e.uid,label:e.title??""},m("calcite-action",{icon:"x",slot:"actions-end",text:t,title:t,onclick:e.onClick}))}};e([r()],v.prototype,"active",null),e([r({type:t,nonNullable:!0})],v.prototype,"analysis",null),e([r()],v.prototype,"excludedLayers",null),e([r()],v.prototype,"excludeGroundSurface",null),e([r()],v.prototype,"headingLevel",void 0),e([r()],v.prototype,"icon",null),e([r()],v.prototype,"label",null),e([r(),p("esri/widgets/Slice/t9n/Slice")],v.prototype,"messages",void 0),e([r()],v.prototype,"view",null),e([r({type:c})],v.prototype,"viewModel",void 0),e([r()],v.prototype,"visible",null),e([r()],v.prototype,"hasVoxelLayers",null),v=e([o("esri.widgets.Slice")],v);const g=v;export{g as default};