@arcgis/core 4.31.0-next.20240919 → 4.31.0-next.20240921

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 (283) hide show
  1. package/WebDocument2D.js +1 -1
  2. package/WebLinkChart.js +1 -1
  3. package/WebMap.js +1 -1
  4. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  5. package/arcade/featureset/actions/Adapted.js +1 -1
  6. package/arcade/featureset/support/StatsField.js +1 -1
  7. package/arcade/featureset/support/errorsupport.js +1 -1
  8. package/arcade/featureset/support/sqlUtils.js +1 -1
  9. package/arcade/functions/maths.js +1 -1
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/{d9d8606f0a7c82b42755.js → 093a1ee161cb6a840283.js} +1 -1
  12. package/assets/esri/core/workers/chunks/2020b99675caabf5ac87.js +1 -0
  13. package/assets/esri/core/workers/chunks/24d45530fe47b3114daf.js +1 -0
  14. package/assets/esri/core/workers/chunks/35f92652df2561845d47.js +1 -0
  15. package/assets/esri/core/workers/chunks/42b92b4c2c9fd2b15f60.js +2 -0
  16. package/assets/esri/core/workers/chunks/{ba561e03df67894e437f.js.LICENSE.txt → 42b92b4c2c9fd2b15f60.js.LICENSE.txt} +1 -1
  17. package/assets/esri/core/workers/chunks/65b1d7fa57d4c764efe8.js +1 -0
  18. package/assets/esri/core/workers/chunks/{b99d380cce485e65c990.js → 6cda92678ffeeaea0330.js} +1 -1
  19. package/assets/esri/core/workers/chunks/736e0c5cb9010ca818d8.js +1 -0
  20. package/assets/esri/core/workers/chunks/757b83799555958e059c.js +1 -0
  21. package/assets/esri/core/workers/chunks/76d8192015ce46dbf92a.js +1 -0
  22. package/assets/esri/core/workers/chunks/7b4880b2dc6b01d70ccc.js +1 -0
  23. package/assets/esri/core/workers/chunks/884cd0bd036c65567929.js +1 -0
  24. package/assets/esri/core/workers/chunks/95ea77a7d63c9d7ed78b.js +1 -0
  25. package/assets/esri/core/workers/chunks/{da3a4eb3fbb9dd509b4b.js → 98e872da08203455a5b6.js} +1 -1
  26. package/assets/esri/core/workers/chunks/ad4fa125e09cc0047f5b.js +1 -0
  27. package/assets/esri/core/workers/chunks/bb5a18dd1e6a71905668.js +2 -0
  28. package/assets/esri/core/workers/chunks/bf406a46515d5dfebe06.js +1 -0
  29. package/assets/esri/core/workers/chunks/d9c34e07627d93d4670b.js +1 -0
  30. package/assets/esri/core/workers/chunks/e1e9a7695e48e34a69bd.js +1 -0
  31. package/assets/esri/core/workers/chunks/e4f1464ed269c301b4ee.js +1 -0
  32. package/assets/esri/core/workers/chunks/{072029d05ccb56979523.js → e611141692355a1ba2b2.js} +1 -1
  33. package/assets/esri/core/workers/chunks/f41e8d0d6f5e81289179.js +1 -0
  34. package/assets/esri/core/workers/chunks/f7c96d34c70ed36da7c2.js +1 -0
  35. package/assets/esri/core/workers/chunks/{5ca8e767cc03e1425338.js → f9e90a2fda559ca68848.js} +1 -1
  36. package/assets/esri/themes/base/_functions.scss +6 -2
  37. package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +4 -0
  38. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +6 -0
  39. package/assets/esri/themes/dark/main.css +1 -1
  40. package/assets/esri/themes/light/main.css +1 -1
  41. package/assets/esri/themes/light/view.css +1 -1
  42. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery.json +1 -1
  43. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ar.json +1 -1
  44. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bg.json +1 -1
  45. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_bs.json +1 -1
  46. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ca.json +1 -1
  47. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_cs.json +1 -1
  48. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_da.json +1 -1
  49. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_de.json +1 -1
  50. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_el.json +1 -1
  51. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_en.json +1 -1
  52. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_es.json +1 -1
  53. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_et.json +1 -1
  54. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fi.json +1 -1
  55. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_fr.json +1 -1
  56. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_he.json +1 -1
  57. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hr.json +1 -1
  58. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_hu.json +1 -1
  59. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_id.json +1 -1
  60. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_it.json +1 -1
  61. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ja.json +1 -1
  62. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ko.json +1 -1
  63. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lt.json +1 -1
  64. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_lv.json +1 -1
  65. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nb.json +1 -1
  66. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_nl.json +1 -1
  67. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pl.json +1 -1
  68. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-BR.json +1 -1
  69. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_pt-PT.json +1 -1
  70. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ro.json +1 -1
  71. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_ru.json +1 -1
  72. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sk.json +1 -1
  73. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sl.json +1 -1
  74. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sr.json +1 -1
  75. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_sv.json +1 -1
  76. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_th.json +1 -1
  77. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_tr.json +1 -1
  78. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_uk.json +1 -1
  79. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_vi.json +1 -1
  80. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-CN.json +1 -1
  81. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-HK.json +1 -1
  82. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_zh-TW.json +1 -1
  83. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  84. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  85. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  86. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  87. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  88. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  89. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  90. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  91. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  92. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  93. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  94. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  95. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  96. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  97. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  98. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  99. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  100. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  101. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  102. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  103. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  104. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  105. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  106. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nb.json +1 -1
  107. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  108. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  109. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  110. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  111. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  112. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  113. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  114. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  115. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  116. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  117. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  118. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  119. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  120. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  121. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  122. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  123. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  124. package/chunks/Bufferer-93RDFIRm.js +5 -0
  125. package/chunks/Centroid-DZi-eb9F.js +1 -1
  126. package/chunks/ComponentShader.glsl.js +10 -13
  127. package/chunks/Distance2DCalculator-De7WFGFq.js +5 -0
  128. package/chunks/GeodeticDistanceCalculator-CN7xMqrJ.js +5 -0
  129. package/chunks/LineSeries.js +1 -1
  130. package/chunks/{OITCompositing.glsl.js → OITBlend.glsl.js} +1 -1
  131. package/chunks/OperatorGeneralize.js +1 -1
  132. package/chunks/OperatorGeodesicBuffer.js +1 -1
  133. package/chunks/OperatorGeodeticArea.js +1 -1
  134. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  135. package/chunks/OperatorGeodeticDistance.js +1 -1
  136. package/chunks/OperatorGeodeticLength.js +1 -1
  137. package/chunks/OperatorProximity.js +1 -1
  138. package/chunks/OperatorShapePreservingLength.js +5 -0
  139. package/chunks/Polyline.js +1 -1
  140. package/chunks/Theme.js +1 -1
  141. package/chunks/Tick.js +1 -1
  142. package/chunks/tslib.es6.js +1 -1
  143. package/core/mathUtils.js +1 -1
  144. package/core/sql/AggregateFunctions.js +1 -1
  145. package/core/sql/SqlInterval.js +1 -1
  146. package/core/sql/StandardizedFunctions.js +1 -1
  147. package/core/sql/WhereClause.js +1 -1
  148. package/core/sql/WhereGrammar.js +1 -1
  149. package/core/sql/errorSupport.js +5 -0
  150. package/core/sql/sqlArithmeticUtils.js +1 -1
  151. package/core/sql/sqlCompareUtils.js +1 -1
  152. package/core/sql/sqlDateParsingUtils.js +1 -1
  153. package/geometry/operators/areaOperator.js +5 -0
  154. package/geometry/operators/containsOperator.js +1 -1
  155. package/geometry/operators/crossesOperator.js +1 -1
  156. package/geometry/operators/disjointOperator.js +1 -1
  157. package/geometry/operators/distanceOperator.js +1 -1
  158. package/geometry/operators/equalsOperator.js +1 -1
  159. package/geometry/operators/geodeticDensifyOperator.js +5 -0
  160. package/geometry/operators/graphicBufferOperator.js +5 -0
  161. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  162. package/geometry/operators/gx/operatorBuffer.js +1 -1
  163. package/geometry/operators/gx/operatorClip.js +1 -1
  164. package/geometry/operators/gx/operatorConvexHull.js +1 -1
  165. package/geometry/operators/gx/operatorCut.js +1 -1
  166. package/geometry/operators/gx/operatorDifference.js +1 -1
  167. package/geometry/operators/gx/operatorGeodesicBuffer.js +1 -1
  168. package/geometry/operators/gx/operatorGeodeticArea.js +1 -1
  169. package/geometry/operators/gx/{operatorGeodeticDensifyByLength.js → operatorGeodeticDensify.js} +1 -1
  170. package/geometry/operators/gx/operatorGeodeticDistance.js +1 -1
  171. package/geometry/operators/gx/operatorGeodeticLength.js +1 -1
  172. package/geometry/operators/gx/operatorGraphicBuffer.js +5 -0
  173. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  174. package/geometry/operators/gx/operatorIntersection.js +1 -1
  175. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  176. package/geometry/operators/gx/operatorOffset.js +1 -1
  177. package/geometry/operators/gx/operatorSimplify.js +1 -1
  178. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  179. package/geometry/operators/gx/operatorUnion.js +1 -1
  180. package/geometry/operators/intersectsOperator.js +1 -1
  181. package/geometry/operators/isNearOperator.js +1 -1
  182. package/geometry/operators/lengthOperator.js +5 -0
  183. package/geometry/operators/overlapsOperator.js +1 -1
  184. package/geometry/operators/proximityOperator.d.ts +4 -0
  185. package/geometry/operators/proximityOperator.js +1 -1
  186. package/geometry/operators/relateOperator.js +1 -1
  187. package/geometry/operators/reshapeOperator.js +1 -1
  188. package/geometry/operators/touchesOperator.js +1 -1
  189. package/geometry/operators/withinOperator.js +1 -1
  190. package/interfaces.d.ts +310 -28
  191. package/layers/mixins/ArcGISMapService.js +1 -1
  192. package/layers/support/ControlPointsGeoreference.js +1 -1
  193. package/layers/support/MediaElementBase.js +1 -1
  194. package/layers/support/mediaUtils.js +1 -1
  195. package/linkChart/LinkChartProperties.js +1 -1
  196. package/linkChart/utils.js +1 -1
  197. package/package.json +2 -2
  198. package/portal/schemas/definitions.js +1 -1
  199. package/support/revision.js +1 -1
  200. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  201. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  202. package/views/2d/layers/LayerView2D.js +1 -1
  203. package/views/2d/support/highlightGroupUtils.js +1 -1
  204. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  205. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  206. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  207. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  208. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  209. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  210. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  211. package/views/3d/webgl-engine/effects/transparency/OITBlend.glsl.js +5 -0
  212. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +5 -0
  213. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +5 -0
  214. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  215. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  216. package/views/LinkChartView.js +1 -1
  217. package/views/MapView.js +1 -1
  218. package/views/View.js +1 -1
  219. package/views/View2D.js +1 -1
  220. package/views/draw/DrawGraphicTool.js +1 -1
  221. package/views/draw/support/Box.js +1 -1
  222. package/views/draw/support/Reshape.js +1 -1
  223. package/views/interactive/Tooltip.d.ts +4 -0
  224. package/views/interactive/Tooltip.js +5 -0
  225. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  226. package/webdoc/widgets/TimeSlider.js +1 -1
  227. package/webmap/InitialViewProperties.js +1 -1
  228. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  229. package/widgets/BasemapGallery.js +1 -1
  230. package/widgets/BasemapLayerList/css.js +1 -1
  231. package/widgets/BasemapLayerList.js +1 -1
  232. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  233. package/widgets/BatchAttributeForm/templates/BatchAttributeFormElementTemplate.js +1 -1
  234. package/widgets/BatchAttributeForm/templates/BatchAttributeFormTemplate.js +1 -1
  235. package/widgets/BatchAttributeForm/templates/BatchFieldElementTemplate.js +1 -1
  236. package/widgets/BatchAttributeForm/templates/batchAttributeFormTemplateUtils.js +1 -1
  237. package/widgets/CatalogLayerList.js +1 -1
  238. package/widgets/Feature/FeatureMedia/pieChart.js +1 -1
  239. package/widgets/Feature/FeatureMedia/xyChart.js +1 -1
  240. package/widgets/FeatureForm/FieldInput.js +1 -1
  241. package/widgets/LayerList/LayerListItem.js +1 -1
  242. package/widgets/LayerList/LayerListViewModel.js +1 -1
  243. package/widgets/LayerList.js +1 -1
  244. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  245. package/widgets/OrientedImageryViewer/adapters/OrientedImageryViewerViewModelAdapter2D.js +1 -1
  246. package/widgets/OrientedImageryViewer/adapters/OrientedImageryViewerViewModelAdapter3D.js +1 -1
  247. package/widgets/OrientedImageryViewer/constants.js +1 -1
  248. package/widgets/OrientedImageryViewer/css.js +1 -1
  249. package/widgets/OrientedImageryViewer/utils.js +1 -1
  250. package/widgets/OrientedImageryViewer.js +1 -1
  251. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  252. package/widgets/Sketch/SketchViewModel.js +1 -1
  253. package/widgets/Sketch.js +1 -1
  254. package/widgets/support/SnappingControls.js +1 -1
  255. package/assets/esri/core/workers/chunks/0cfa9665dab31e5235a8.js +0 -1
  256. package/assets/esri/core/workers/chunks/22fb5687932019304225.js +0 -1
  257. package/assets/esri/core/workers/chunks/3b3c8362359a82c66793.js +0 -1
  258. package/assets/esri/core/workers/chunks/3cb1de0b9bf9a25112e0.js +0 -1
  259. package/assets/esri/core/workers/chunks/59833b27d8413b6d9312.js +0 -1
  260. package/assets/esri/core/workers/chunks/5e43cb91bbe20f2d32e3.js +0 -1
  261. package/assets/esri/core/workers/chunks/67df47efb9a9dfeafee2.js +0 -1
  262. package/assets/esri/core/workers/chunks/6be62448e33baabe028c.js +0 -1
  263. package/assets/esri/core/workers/chunks/6d668f7696f280ec9588.js +0 -1
  264. package/assets/esri/core/workers/chunks/74edde71352e1f578a3b.js +0 -1
  265. package/assets/esri/core/workers/chunks/907e74abb4a85a76e3b5.js +0 -1
  266. package/assets/esri/core/workers/chunks/941fe04f47059074c05b.js +0 -2
  267. package/assets/esri/core/workers/chunks/a0005bc65f79e83f26ee.js +0 -1
  268. package/assets/esri/core/workers/chunks/a6560ff77be29344bc50.js +0 -1
  269. package/assets/esri/core/workers/chunks/a6c3c1827d2e8bbfcd9e.js +0 -1
  270. package/assets/esri/core/workers/chunks/ba561e03df67894e437f.js +0 -2
  271. package/assets/esri/core/workers/chunks/df9daac7ea581e9e5ca4.js +0 -1
  272. package/assets/esri/core/workers/chunks/ea51a7c32f716f4f1a34.js +0 -1
  273. package/assets/esri/core/workers/chunks/ef7dcb8758e7f21d30bc.js +0 -1
  274. package/chunks/Distance2DCalculator-BzAEa8Xe.js +0 -5
  275. package/chunks/GeodeticDistanceCalculator-BS_KY66f.js +0 -5
  276. package/chunks/OperatorShapePreservingDensify.js +0 -5
  277. package/geometry/operators/geodeticDensifyByLengthOperator.js +0 -5
  278. package/geometry/operators/gx/operatorShapePreservingDensify.js +0 -5
  279. package/geometry/operators/shapePreservingDensifyOperator.js +0 -5
  280. package/views/3d/webgl-engine/shaders/OITCompositing.glsl.js +0 -5
  281. package/views/3d/webgl-engine/shaders/OITCompositingTechnique.js +0 -5
  282. package/views/interactive/tooltip/Tooltip.js +0 -5
  283. /package/assets/esri/core/workers/chunks/{941fe04f47059074c05b.js.LICENSE.txt → bb5a18dd1e6a71905668.js.LICENSE.txt} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- const c="20240919",f="b50c1623bf138065084c7a89eeb157fff2a73c10";export{c as buildDate,f as commitHash};
5
+ const a="20240921",c="7a2168859a2cbc136ee3503e46fa34d4f7e1acca";export{a as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as i,getYDirection as s}from"../../../alignmentUtils.js";import{minMaxZoomPrecisionFactor as n,maxTextLineWidth as a,minTextLineWidth as c,magicLabelLineHeight as l,glyphSize as f}from"../../../definitions.js";import{shapeGlyphs as h}from"../../../mesh/templates/shapingUtils.js";import{packBitset as p,processColorInput as m,getMinMaxZoom as d}from"../fill/meshWriterUtils.js";import{getGeometryEngine as u}from"../mesh/loadGeometryEngine.js";import{MeshWriter as g}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as x,bitsetTextIsMapAligned as y}from"../shaders/constants.js";import{TextMeshTransformProps as _}from"./TextParams.js";import{DataType as P}from"../../../../../../webgl/enums.js";const S=28,b=[4,4],k=[16,4],T={topLeft:k,topRight:k,bottomLeft:k,bottomRight:k},B=[4,2],R=[4,6],w={topLeft:B,topRight:B,bottomLeft:R,bottomRight:R},M={topLeft:B,topRight:R,bottomLeft:B,bottomRight:R},z={topLeft:R,topRight:R,bottomLeft:b,bottomRight:b},L={topLeft:b,topRight:b,bottomLeft:R,bottomRight:R},I={topLeft:R,topRight:b,bottomLeft:R,bottomRight:b},E={topLeft:b,topRight:R,bottomLeft:b,bottomRight:R},G={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:P.UNSIGNED_SHORT,count:2,packPrecisionFactor:n,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||S]},clipAngle:{type:P.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>A(t||0)},referenceSymbol:{type:P.BYTE,count:4,packPrecisionFactor:1,packTessellation:(t,o)=>{if(!t.referenceBounds)return[0,0,0,0];const r=i(o.horizontalAlignment),n=s(o.verticalAlignment),{offsetX:a,offsetY:c,size:l}=t.referenceBounds;return[e(a),-e(c),e(l),r+1<<2|n+1]}}},attributes:{pos:{type:P.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:P.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:P.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>p([[x,t],[y,!!e]])},offset:{type:P.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:r,topRight:i}=t;return[r,i,e,o]}}},textureUV:{type:P.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:r,topRight:i}=t;return[r,i,e,o]}}},color:{type:P.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontSize:{type:P.UNSIGNED_SHORT,count:1,packPrecisionFactor:4,packTessellation:({fontSize:t})=>e(t)},referenceSize:{type:P.UNSIGNED_BYTE,count:1,packPrecisionFactor:4,packTessellation:({fontSize:t},{referenceSize:o})=>e(o??t)},haloColor:{type:P.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>m(t)},haloFontSize:{type:P.UNSIGNED_SHORT,count:1,packPrecisionFactor:4,pack:({haloFontSize:t})=>e(t)}}};class N extends g{constructor(){super(...arguments),this.vertexSpec=G,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,o){super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new _(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(t,e,o){const r=this._getShaping();if(!r)return;const i=e.getDisplayId();if(null!=this.evaluatedMeshParams.placement)return this._writePlacedTextMarkers(t,e,r,o);if(o?.nextPath())return o.nextPoint(),this._writeGlyphs(t,i,o.x,o.y,r,0);if("esriGeometryPolygon"===e.geometryType){const o=e.readCentroidForDisplay();if(!o)return;const[s,n]=o.coords;return this._writeGlyphs(t,i,s,n,r,0)}if("esriGeometryMultipoint"===e.geometryType){const o=e.readGeometryForDisplay();return void o?.forEachVertex(((e,o)=>this._writeGlyphs(t,i,e,o,r,0)))}const s=e.readXForDisplay(),n=e.readYForDisplay();return this._writeGlyphs(t,i,s,n,r,0)}_writePlacedTextMarkers(t,i,s,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const c=-1,l=r.getPlacement(a,c,this.evaluatedMeshParams.placement,e(1),t.id,u());if(!l)return;const f=i.getDisplayId();let h=l.next();for(;null!=h;){const e=h.tx,o=-h.ty,r=-h.getAngle();this._writeGlyphs(t,f,e,o,s,r),h=l.next()}}_getShaping(o){const r=this._textMeshTransformProps,i=this.evaluatedMeshParams;if(!i.glyphs?.glyphs.length)return null;const s=Math.round(e(r.fontSize)),n=e(r.offsetX),p=e(r.offsetY),m=t(e(i.lineWidth),c,a),d=l*t(i.lineHeightRatio,.25,4);return h(i.glyphs,{scale:s/f,angle:r.postAngle,xOffset:n,yOffset:p,horizontalAlignment:i.horizontalAlignment,verticalAlignment:o||i.verticalAlignment,maxLineWidth:m,lineHeight:d,decoration:i.decoration,borderLineSizePx:e(i.boxBorderLineSize),hasBackground:!!i.boxBackgroundColor,useCIMAngleBehavior:i.useCIMAngleBehavior})}_writeGlyphs(t,o,r,i,s,n,a,c){const l=this.evaluatedMeshParams,f=this._textMeshTransformProps,h=f.fontSize,p=e(f.offsetX),u=e(f.offsetY),[g,x]=d(l.scaleInfo,this.getTileInfo());0!==n&&s.setRotation(n);const y=s.bounds,_=r+y.x+p,P=i+y.y-u,S=2*(l.minPixelBuffer?l.minPixelBuffer/h:1),b=Math.max(y.width,y.height)*S;s.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,s.glyphs[0].textureBinding),t.recordBounds(_,P,b,b),this._writeTextBox(t,o,r,i,s.textBox,a,c),t.recordEnd());for(const e of s.glyphs){t.recordStart(this.instanceId,this.attributeLayout,e.textureBinding),t.recordBounds(_,P,b,b);const{texcoords:s,offsets:n}=e;this._writeQuad(t,o,r,i,{texcoords:s,offsets:n,fontSize:h,color:m(l.color),isBackground:!1,referenceBounds:a,minZoom:g,maxZoom:x,...c}),t.recordEnd()}0!==n&&s.setRotation(-n)}_writeTextBox(t,e,o,r,i,s,n){const a=this.evaluatedMeshParams,{fontSize:c}=this._textMeshTransformProps,{boxBackgroundColor:l,boxBorderLineColor:f}=a,h={isBackground:!0,fontSize:c,referenceBounds:s,...n};l&&(this._writeQuad(t,e,o,r,{texcoords:T,offsets:i.main,color:m(l),...h}),f||(this._writeQuad(t,e,o,r,{texcoords:z,offsets:i.top,color:m(l),...h}),this._writeQuad(t,e,o,r,{texcoords:L,offsets:i.bot,color:m(l),...h}),this._writeQuad(t,e,o,r,{texcoords:I,offsets:i.left,color:m(l),...h}),this._writeQuad(t,e,o,r,{texcoords:E,offsets:i.right,color:m(l),...h}))),f&&(this._writeQuad(t,e,o,r,{texcoords:w,offsets:i.top,color:m(f),...h}),this._writeQuad(t,e,o,r,{texcoords:w,offsets:i.bot,color:m(f),...h}),this._writeQuad(t,e,o,r,{texcoords:M,offsets:i.left,color:m(f),...h}),this._writeQuad(t,e,o,r,{texcoords:M,offsets:i.right,color:m(f),...h}))}_writeQuad(t,e,o,r,i){const s=t.vertexCount();this._writeVertex(t,e,o,r,i),t.indexWrite(s+0),t.indexWrite(s+1),t.indexWrite(s+2),t.indexWrite(s+1),t.indexWrite(s+3),t.indexWrite(s+2)}}const A=t=>Math.round(t*(254/360));export{N as TextMeshWriter,G as TextVertexSpec,S as maxLabelZoom};
5
+ import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as i,getYDirection as s}from"../../../alignmentUtils.js";import{minMaxZoomPrecisionFactor as n,maxTextLineWidth as a,minTextLineWidth as c,magicLabelLineHeight as l,glyphSize as h}from"../../../definitions.js";import{shapeGlyphs as f}from"../../../mesh/templates/shapingUtils.js";import{packBitset as p,processColorInput as m,getMinMaxZoom as d}from"../fill/meshWriterUtils.js";import{getGeometryEngine as u}from"../mesh/loadGeometryEngine.js";import{MeshWriter as g}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as x,bitsetTextIsMapAligned as y}from"../shaders/constants.js";import{TextMeshTransformProps as _}from"./TextParams.js";import{DataType as P}from"../../../../../../webgl/enums.js";const S=28,b=[4,4],k=[16,4],T={topLeft:k,topRight:k,bottomLeft:k,bottomRight:k},B=[4,2],R=[4,6],M={topLeft:B,topRight:B,bottomLeft:R,bottomRight:R},w={topLeft:B,topRight:R,bottomLeft:B,bottomRight:R},z={topLeft:R,topRight:R,bottomLeft:b,bottomRight:b},L={topLeft:b,topRight:b,bottomLeft:R,bottomRight:R},I={topLeft:R,topRight:b,bottomLeft:R,bottomRight:b},E={topLeft:b,topRight:R,bottomLeft:b,bottomRight:R},G={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:P.UNSIGNED_SHORT,count:2,packPrecisionFactor:n,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||S]},clipAngle:{type:P.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>A(t||0)},referenceSymbol:{type:P.BYTE,count:4,packPrecisionFactor:1,packTessellation:(t,o)=>{if(!t.referenceBounds)return[0,0,0,0];const r=i(o.horizontalAlignment),n=s(o.verticalAlignment),{offsetX:a,offsetY:c,size:l}=t.referenceBounds;return[e(a),-e(c),Math.round(e(l)),r+1<<2|n+1]}}},attributes:{pos:{type:P.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:P.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:P.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>p([[x,t],[y,!!e]])},offset:{type:P.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:r,topRight:i}=t;return[r,i,e,o]}}},textureUV:{type:P.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:r,topRight:i}=t;return[r,i,e,o]}}},color:{type:P.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontSize:{type:P.UNSIGNED_SHORT,count:1,packPrecisionFactor:4,packTessellation:({fontSize:t})=>Math.round(e(t))},referenceSize:{type:P.UNSIGNED_BYTE,count:1,packPrecisionFactor:4,packTessellation:({fontSize:t},{referenceSize:o})=>Math.round(e(o??t))},haloColor:{type:P.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>m(t)},haloFontSize:{type:P.UNSIGNED_SHORT,count:1,packPrecisionFactor:4,pack:({haloFontSize:t})=>Math.round(e(t))}}};class N extends g{constructor(){super(...arguments),this.vertexSpec=G,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,o){super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new _(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(t,e,o){const r=this._getShaping();if(!r)return;const i=e.getDisplayId();if(null!=this.evaluatedMeshParams.placement)return this._writePlacedTextMarkers(t,e,r,o);if(o?.nextPath())return o.nextPoint(),this._writeGlyphs(t,i,o.x,o.y,r,0);if("esriGeometryPolygon"===e.geometryType){const o=e.readCentroidForDisplay();if(!o)return;const[s,n]=o.coords;return this._writeGlyphs(t,i,s,n,r,0)}if("esriGeometryMultipoint"===e.geometryType){const o=e.readGeometryForDisplay();return void o?.forEachVertex(((e,o)=>this._writeGlyphs(t,i,e,o,r,0)))}const s=e.readXForDisplay(),n=e.readYForDisplay();return this._writeGlyphs(t,i,s,n,r,0)}_writePlacedTextMarkers(t,i,s,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const c=-1,l=r.getPlacement(a,c,this.evaluatedMeshParams.placement,e(1),t.id,u());if(!l)return;const h=i.getDisplayId();let f=l.next();for(;null!=f;){const e=f.tx,o=-f.ty,r=-f.getAngle();this._writeGlyphs(t,h,e,o,s,r),f=l.next()}}_getShaping(o){const r=this._textMeshTransformProps,i=this.evaluatedMeshParams;if(!i.glyphs?.glyphs.length)return null;const s=e(r.fontSize),n=e(r.offsetX),p=e(r.offsetY),m=t(e(i.lineWidth),c,a),d=l*t(i.lineHeightRatio,.25,4);return f(i.glyphs,{scale:s/h,angle:r.postAngle,xOffset:n,yOffset:p,horizontalAlignment:i.horizontalAlignment,verticalAlignment:o||i.verticalAlignment,maxLineWidth:m,lineHeight:d,decoration:i.decoration,borderLineSizePx:e(i.boxBorderLineSize),hasBackground:!!i.boxBackgroundColor,useCIMAngleBehavior:i.useCIMAngleBehavior})}_writeGlyphs(t,o,r,i,s,n,a,c){const l=this.evaluatedMeshParams,h=this._textMeshTransformProps,f=e(h.fontSize),p=e(h.offsetX),u=e(h.offsetY),[g,x]=d(l.scaleInfo,this.getTileInfo());0!==n&&s.setRotation(n);const y=s.bounds,_=r+y.x+p,P=i+y.y-u,S=2*(l.minPixelBuffer?l.minPixelBuffer/f:1),b=Math.max(y.width,y.height)*S;s.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,s.glyphs[0].textureBinding),t.recordBounds(_,P,b,b),this._writeTextBox(t,o,r,i,s.textBox,a,c),t.recordEnd());for(const e of s.glyphs){t.recordStart(this.instanceId,this.attributeLayout,e.textureBinding),t.recordBounds(_,P,b,b);const{texcoords:s,offsets:n}=e;this._writeQuad(t,o,r,i,{texcoords:s,offsets:n,fontSize:f,color:m(l.color),isBackground:!1,referenceBounds:a,minZoom:g,maxZoom:x,...c}),t.recordEnd()}0!==n&&s.setRotation(-n)}_writeTextBox(t,e,o,r,i,s,n){const a=this.evaluatedMeshParams,{fontSize:c}=this._textMeshTransformProps,{boxBackgroundColor:l,boxBorderLineColor:h}=a,f={isBackground:!0,fontSize:c,referenceBounds:s,...n};l&&(this._writeQuad(t,e,o,r,{texcoords:T,offsets:i.main,color:m(l),...f}),h||(this._writeQuad(t,e,o,r,{texcoords:z,offsets:i.top,color:m(l),...f}),this._writeQuad(t,e,o,r,{texcoords:L,offsets:i.bot,color:m(l),...f}),this._writeQuad(t,e,o,r,{texcoords:I,offsets:i.left,color:m(l),...f}),this._writeQuad(t,e,o,r,{texcoords:E,offsets:i.right,color:m(l),...f}))),h&&(this._writeQuad(t,e,o,r,{texcoords:M,offsets:i.top,color:m(h),...f}),this._writeQuad(t,e,o,r,{texcoords:M,offsets:i.bot,color:m(h),...f}),this._writeQuad(t,e,o,r,{texcoords:w,offsets:i.left,color:m(h),...f}),this._writeQuad(t,e,o,r,{texcoords:w,offsets:i.right,color:m(h),...f}))}_writeQuad(t,e,o,r,i){const s=t.vertexCount();this._writeVertex(t,e,o,r,i),t.indexWrite(s+0),t.indexWrite(s+1),t.indexWrite(s+2),t.indexWrite(s+1),t.indexWrite(s+3),t.indexWrite(s+2)}}const A=t=>Math.round(t*(254/360));export{N as TextMeshWriter,G as TextVertexSpec,S as maxLabelZoom};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{isSome as e}from"../../../core/arrayUtils.js";import r from"../../../core/Collection.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView2DMixin as p}from"./LayerView2D.js";import g from"./graphics/GraphicContainer.js";import c from"./graphics/GraphicsView2D.js";import{HighlightCounter as l}from"./support/HighlightCounter.js";import n from"../../layers/LayerView.js";let d=class extends(p(n)){constructor(){super(...arguments),this._highlightCounter=new l}attach(){this.graphicsView=new c({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:this.layer.graphics,container:new g(this.view.featuresTilingScheme),layerId:this.layer.id}),this.container.addChild(this.graphicsView.container),this.addAttachHandles([this.layer.on("graphic-update",this.graphicsView.graphicUpdateHandler),this.watch("layer.visible",(i=>{i&&(this.graphicsView.update({state:this.view.state}),this.graphicsView.pushUpdate())}))]),this._updateHighlight()}detach(){this.container.removeAllChildren(),this.graphicsView=h(this.graphicsView)}async hitTest(i){return this.graphicsView?this.graphicsView.hitTest(i).map((t=>({type:"graphic",graphic:t,mapPoint:i,layer:this.layer}))):null}queryGraphics(){return Promise.resolve(this.graphicsView.graphics)}update(i){this.graphicsView.processUpdate(i)}viewChange(){this.graphicsView.viewChange()}moveEnd(){}isUpdating(){return!this.graphicsView||this.graphicsView.updating}highlight(i,h="default"){let a;"number"==typeof i?a=[i]:i instanceof t?a=[i.uid]:Array.isArray(i)&&i.length>0?a="number"==typeof i[0]?i:i.map((i=>i&&i.uid)):r.isCollection(i)&&i.length>0&&(a=i.map((i=>i&&i.uid)).toArray());const o=a?.filter(e);return o?.length?(this._addHighlight(o,h),s((()=>this._removeHighlight(o,h)))):s()}_addHighlight(i,t){this._highlightCounter.addGroup(i,t),this._updateHighlight()}_removeHighlight(i,t){this._highlightCounter.deleteGroup(i,t),this._updateHighlight()}_updateHighlight(){const i=[];for(const t of this._highlightCounter.ids()){const e=this._highlightCounter.getHighlightGroups(t),r=this._getHighlightBits(e);i.push({objectId:t,highlightFlags:r})}this.graphicsView?.setHighlight(i)}};i([a()],d.prototype,"graphicsView",void 0),d=i([o("esri.views.2d.layers.GraphicsLayerView2D")],d);const u=d;export{u as default};
5
+ import{_ as i}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{isSome as e}from"../../../core/arrayUtils.js";import r from"../../../core/Collection.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView2DMixin as p}from"./LayerView2D.js";import g from"./graphics/GraphicContainer.js";import c from"./graphics/GraphicsView2D.js";import{HighlightCounter as l}from"./support/HighlightCounter.js";import n from"../../layers/LayerView.js";let d=class extends(p(n)){constructor(){super(...arguments),this._highlightCounter=new l}attach(){this.graphicsView=new c({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:this.layer.graphics,container:new g(this.view.featuresTilingScheme),layerId:this.layer.id}),this.container.addChild(this.graphicsView.container),this.addAttachHandles([this.layer.on("graphic-update",this.graphicsView.graphicUpdateHandler),this.watch("layer.visible",(i=>{i&&(this.graphicsView.update({state:this.view.state}),this.graphicsView.pushUpdate())}))]),this._updateHighlights()}detach(){this.container.removeAllChildren(),this.graphicsView=h(this.graphicsView)}async hitTest(i){return this.graphicsView?this.graphicsView.hitTest(i).map((t=>({type:"graphic",graphic:t,mapPoint:i,layer:this.layer}))):null}queryGraphics(){return Promise.resolve(this.graphicsView.graphics)}update(i){this.graphicsView.processUpdate(i)}viewChange(){this.graphicsView.viewChange()}moveEnd(){}isUpdating(){return!this.graphicsView||this.graphicsView.updating}highlight(i,h="default"){let a;"number"==typeof i?a=[i]:i instanceof t?a=[i.uid]:Array.isArray(i)&&i.length>0?a="number"==typeof i[0]?i:i.map((i=>i&&i.uid)):r.isCollection(i)&&i.length>0&&(a=i.map((i=>i&&i.uid)).toArray());const o=a?.filter(e);return o?.length?(this._addHighlight(o,h),s((()=>this._removeHighlight(o,h)))):s()}_addHighlight(i,t){this._highlightCounter.addGroup(i,t),this._updateHighlights()}_removeHighlight(i,t){this._highlightCounter.deleteGroup(i,t),this._updateHighlights()}_updateHighlights(){const i=[];for(const t of this._highlightCounter.ids()){const e=this._highlightCounter.getHighlightGroups(t),r=this._getHighlightBits(e);i.push({objectId:t,highlightFlags:r})}this.graphicsView?.setHighlight(i)}};i([a()],d.prototype,"graphicsView",void 0),d=i([o("esri.views.2d.layers.GraphicsLayerView2D")],d);const u=d;export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Collection.js";import{referenceSetter as i}from"../../../core/collectionUtils.js";import s from"../../../core/Error.js";import{watch as r,syncAndInitial as o,on as a}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{isLinkChartView as n}from"../../../linkChart/utils.js";import{Container as l}from"../engine/Container.js";import{createOrReuseHighlightGradient as c}from"./support/util.js";import{HighlightGroup as d}from"../support/HighlightGroup.js";import{getDefaultHighlightOptions as u,setDefaultHighlightOptions as g}from"../support/highlightGroupUtils.js";import y from"../support/HighlightOptions.js";import m from"../../layers/support/ClipRect.js";import f from"../../layers/support/Geometry.js";import v from"../../layers/support/Path.js";import{isInEffectiveScaleRange as R}from"../../support/layerViewUtils.js";const w=t.ofType({key:"type",base:null,typeMap:{rect:m,path:v,geometry:f}}),S=new(t.ofType(d)),j=m=>{let f=class extends m{constructor(){super(...arguments),this.attached=!1,this.clips=new w,this.highlights=null,this.lastUpdateId=-1,this.moving=!1,this.updateRequested=!1,this._visibleAtCurrentScale=!0}initialize(){const e=this.view?.spatialReferenceLocked??!0,t=this.view?.spatialReference;t&&e&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new s("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",{layer:this.layer}))):(this.container||(this.container=new l),this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.addHandles([r((()=>this.suspended),(e=>{this.container&&(this.container.visible=!e)}),o),r((()=>this.updateSuspended),(e=>{this.view&&!e&&this.updateRequested&&this.view.requestUpdate()}),o),r((()=>this.layer?.opacity??1),(e=>{this.container&&(this.container.opacity=e)}),o),r((()=>this.layer&&"blendMode"in this.layer?this.layer.blendMode:"normal"),(e=>{this.container&&(this.container.blendMode=e)}),o),r((()=>this.layer&&"effect"in this.layer?this.layer.effect:null),(e=>{this.container&&(this.container.effect=e)}),o),r((()=>this._mergedHighlights.items.map((e=>({name:e.name,options:{fillColor:e.options.color,haloColor:e.options.haloColor,fillOpacity:e.options.fillOpacity,haloOpacity:e.options.haloOpacity,haloWidth:e.options.haloWidth,haloBlur:e.options.haloBlur}})))),(()=>{this.container.highlightGradient=c(this.container.highlightGradient,this._mergedHighlights.items)}),o),a((()=>this.clips),"change",(()=>{this.container&&(this.container.clips=this.clips)}),o),r((()=>({scale:this.view?.scale,scaleRange:this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null})),(({scale:e,scaleRange:t})=>{const i=R(t,e);i!==this._visibleAtCurrentScale&&(this._visibleAtCurrentScale=i)}),o)],"constructor"),this.view?.whenLayerView?this.view.whenLayerView(this.layer).then((e=>{e===this&&this.processAttach()}),(()=>{})):this.when().then((()=>{this.processAttach()}),(()=>{})))}destroy(){this.processDetach(),this.updateRequested=!1}get highlightOptions(){return u(this)}set highlightOptions(e){g(this,e)}get _mergedHighlights(){if(!this.view)return S;if(!this.highlights)return this.view.highlights;const e=this.view.highlights.clone();for(const t of this.highlights){const i=e.find((e=>e.name===t.name));i&&(i.options=t.options)}return e}get scheduler(){return this.view.scheduler}get spatialReferenceSupported(){const e=this.view?.spatialReference;return null==e||this.supportsSpatialReference(e)}get updating(){return this.spatialReferenceSupported&&(!this.attached||!this.suspended&&(this.updateRequested||this.isUpdating())||!!this._updatingHandles?.updating)}get visibleAtCurrentScale(){return this._visibleAtCurrentScale}processAttach(){this.isResolved()&&!this.attached&&!this.destroyed&&this.spatialReferenceSupported&&(this.attach(),this.attached=!0,this.requestUpdate())}processDetach(){this.attached&&(this.attached=!1,this.removeHandles("attach"),this.detach(),this.updateRequested=!1)}requestUpdate(){this.destroyed||this.updateRequested||(this.updateRequested=!0,this.updateSuspended||this.view.requestUpdate())}processUpdate(e){!this.isFulfilled()||this.isResolved()?(this._set("updateParameters",e),this.updateRequested&&!this.updateSuspended&&(this.updateRequested=!1,this.update(e))):this.updateRequested=!1}hitTest(e,t){return Promise.resolve(null)}supportsSpatialReference(e){return!0}canResume(){return!!this.spatialReferenceSupported&&((!n(this.view)||"geographic-organic-standard"===this.view.layoutType||"link-chart"===this.layer.type||"knowledge-graph-sublayer"===this.layer.type)&&(!!super.canResume()&&this.visibleAtCurrentScale))}getSuspendInfo(){const e=super.getSuspendInfo(),t=!this.spatialReferenceSupported;return t&&(e.spatialReferenceNotSupported=t),e}addAttachHandles(e){this.addHandles(e,"attach")}_getHighlightBits(e){let t=1,i=0;if(!this.view)return 0;const s=this._mergedHighlights;for(const{name:r}of s)e.has(r)&&(i=t),t<<=1;return i}};return e([h()],f.prototype,"attached",void 0),e([h({type:w,set(e){const t=i(e,this._get("clips"),w);this._set("clips",t)}})],f.prototype,"clips",void 0),e([h()],f.prototype,"container",void 0),e([h({type:y})],f.prototype,"highlightOptions",null),e([h({type:t.ofType(d)})],f.prototype,"highlights",void 0),e([h()],f.prototype,"_mergedHighlights",null),e([h()],f.prototype,"moving",void 0),e([h({readOnly:!0})],f.prototype,"spatialReferenceSupported",null),e([h({readOnly:!0})],f.prototype,"updateParameters",void 0),e([h()],f.prototype,"updateRequested",void 0),e([h()],f.prototype,"updating",null),e([h()],f.prototype,"view",void 0),e([h()],f.prototype,"_visibleAtCurrentScale",void 0),e([h({readOnly:!0})],f.prototype,"visibleAtCurrentScale",null),f=e([p("esri.views.2d.layers.LayerView2D")],f),f};export{j as LayerView2DMixin};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Collection.js";import{referenceSetter as i}from"../../../core/collectionUtils.js";import s from"../../../core/Error.js";import r from"../../../core/Logger.js";import{watch as o,syncAndInitial as h,on as a}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{isLinkChartView as l}from"../../../linkChart/utils.js";import{Container as c}from"../engine/Container.js";import{createOrReuseHighlightGradient as d}from"./support/util.js";import{HighlightGroup as u}from"../support/HighlightGroup.js";import{getDefaultHighlightOptions as g,setDefaultHighlightOptions as m}from"../support/highlightGroupUtils.js";import f from"../support/HighlightOptions.js";import y from"../../layers/support/ClipRect.js";import v from"../../layers/support/Geometry.js";import w from"../../layers/support/Path.js";import{isInEffectiveScaleRange as R}from"../../support/layerViewUtils.js";const S=t.ofType({key:"type",base:null,typeMap:{rect:y,path:w,geometry:v}}),b=new(t.ofType(u)),j=y=>{let v=class extends y{constructor(){super(...arguments),this.attached=!1,this.clips=new S,this.highlights=null,this.lastUpdateId=-1,this.moving=!1,this.updateRequested=!1,this._visibleAtCurrentScale=!0}initialize(){const e=this.view?.spatialReferenceLocked??!0,t=this.view?.spatialReference;t&&e&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new s("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",{layer:this.layer}))):(this.container||(this.container=new c),this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.addHandles([o((()=>this.suspended),(e=>{this.container&&(this.container.visible=!e)}),h),o((()=>this.updateSuspended),(e=>{this.view&&!e&&this.updateRequested&&this.view.requestUpdate()}),h),o((()=>this.layer?.opacity??1),(e=>{this.container&&(this.container.opacity=e)}),h),o((()=>this.layer&&"blendMode"in this.layer?this.layer.blendMode:"normal"),(e=>{this.container&&(this.container.blendMode=e)}),h),o((()=>this.layer&&"effect"in this.layer?this.layer.effect:null),(e=>{this.container&&(this.container.effect=e)}),h),o((()=>this._mergedHighlights.items.map((e=>({name:e.name,options:{fillColor:e.options.color,haloColor:e.options.haloColor,fillOpacity:e.options.fillOpacity,haloOpacity:e.options.haloOpacity,haloWidth:e.options.haloWidth,haloBlur:e.options.haloBlur}})))),(()=>{this.container.highlightGradient=d(this.container.highlightGradient,this._mergedHighlights.items)}),h),o((()=>this._mergedHighlights.items.map((e=>e.name))),(()=>{this._updateHighlights()})),a((()=>this.clips),"change",(()=>{this.container&&(this.container.clips=this.clips)}),h),o((()=>({scale:this.view?.scale,scaleRange:this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null})),(({scale:e,scaleRange:t})=>{const i=R(t,e);i!==this._visibleAtCurrentScale&&(this._visibleAtCurrentScale=i)}),h)],"constructor"),this.view?.whenLayerView?this.view.whenLayerView(this.layer).then((e=>{e===this&&this.processAttach()}),(()=>{})):this.when().then((()=>{this.processAttach()}),(()=>{})))}_updateHighlights(){}destroy(){this.processDetach(),this.updateRequested=!1}get highlightOptions(){return g(this)}set highlightOptions(e){m(this,e)}get _mergedHighlights(){if(!this.view)return b;if(!this.highlights)return this.view.highlights;const e=this.view.highlights.clone();for(const t of this.highlights){const i=e.find((e=>e.name===t.name));i&&(i.options=t.options)}return e}get scheduler(){return this.view.scheduler}get spatialReferenceSupported(){const e=this.view?.spatialReference;return null==e||this.supportsSpatialReference(e)}get updating(){return this.spatialReferenceSupported&&(!this.attached||!this.suspended&&(this.updateRequested||this.isUpdating())||!!this._updatingHandles?.updating)}get visibleAtCurrentScale(){return this._visibleAtCurrentScale}processAttach(){this.isResolved()&&!this.attached&&!this.destroyed&&this.spatialReferenceSupported&&(this.attach(),this.attached=!0,this.requestUpdate())}processDetach(){this.attached&&(this.attached=!1,this.removeHandles("attach"),this.detach(),this.updateRequested=!1)}requestUpdate(){this.destroyed||this.updateRequested||(this.updateRequested=!0,this.updateSuspended||this.view.requestUpdate())}processUpdate(e){!this.isFulfilled()||this.isResolved()?(this._set("updateParameters",e),this.updateRequested&&!this.updateSuspended&&(this.updateRequested=!1,this.update(e))):this.updateRequested=!1}hitTest(e,t){return Promise.resolve(null)}supportsSpatialReference(e){return!0}canResume(){if(!this.spatialReferenceSupported)return!1;switch(this.layer?.type){case"link-chart":case"knowledge-graph-sublayer":break;default:if(l(this.view)&&!this.view.inGeographicLayout)return!1}return!!super.canResume()&&this.visibleAtCurrentScale}getSuspendInfo(){const e=super.getSuspendInfo(),t=!this.spatialReferenceSupported;return t&&(e.spatialReferenceNotSupported=t),e}addAttachHandles(e){this.addHandles(e,"attach")}_getHighlightBits(e){e=new Set(e);let t=1,i=0;if(!this.view)return 0;const s=this._mergedHighlights;for(const{name:r}of s)e.delete(r)&&(i=t),t<<=1;for(const o of e)r.getLogger(this).error("#highlights",`${o} was not found. Features in this group will not be highlighted.`);return i}};return e([n()],v.prototype,"attached",void 0),e([n({type:S,set(e){const t=i(e,this._get("clips"),S);this._set("clips",t)}})],v.prototype,"clips",void 0),e([n()],v.prototype,"container",void 0),e([n({type:f})],v.prototype,"highlightOptions",null),e([n({type:t.ofType(u)})],v.prototype,"highlights",void 0),e([n()],v.prototype,"_mergedHighlights",null),e([n()],v.prototype,"moving",void 0),e([n({readOnly:!0})],v.prototype,"spatialReferenceSupported",null),e([n({readOnly:!0})],v.prototype,"updateParameters",void 0),e([n()],v.prototype,"updateRequested",void 0),e([n()],v.prototype,"updating",null),e([n()],v.prototype,"view",void 0),e([n()],v.prototype,"_visibleAtCurrentScale",void 0),e([n({readOnly:!0})],v.prototype,"visibleAtCurrentScale",null),v=e([p("esri.views.2d.layers.LayerView2D")],v),v};export{j as LayerView2DMixin};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/Collection.js";import{HighlightGroup as i}from"./HighlightGroup.js";import n from"./HighlightOptions.js";const o=t.ofType(i);function e(){return new o([{name:"default",options:new n},{name:"popup",options:new n({color:"teal"})},{name:"temporary",options:new n({color:"yellow"})}])}const h=e().items.map((t=>t.name));function l(t){if(!t.highlights)return null;const i=t.highlights.findIndex((t=>"default"===t.name));return-1===i?null:t.highlights.items[i].options}function s(t,i){if(!t.highlights){if(!i)return;t.highlights=new o([{name:"default",options:new n}])}const e=t.highlights.findIndex((t=>"default"===t.name));i?t.highlights.items[e].options=i:t.highlights.removeAt(e)}export{h as admissibleHighlightGroupNames,e as createInitialHighlightGroups,l as getDefaultHighlightOptions,s as setDefaultHighlightOptions};
5
+ import i from"../../../core/Collection.js";import{HighlightGroup as t}from"./HighlightGroup.js";import n from"./HighlightOptions.js";const o=i.ofType(t);function e(){return new o([{name:"default",options:new n},{name:"temporary",options:new n({color:"yellow"})}])}const h=e().items.map((i=>i.name));function s(i){if(!i.highlights)return null;const t=i.highlights.findIndex((i=>"default"===i.name));return-1===t?null:i.highlights.items[t].options}function l(i,t){if(!i.highlights){if(!t)return;i.highlights=new o([{name:"default",options:new n}])}const e=i.highlights.findIndex((i=>"default"===i.name));t?i.highlights.items[e].options=t:i.highlights.removeAt(e)}export{h as admissibleHighlightGroupNames,e as createInitialHighlightGroups,s as getDefaultHighlightOptions,l as setDefaultHighlightOptions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import i from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{zeroMeters as a,scale as l}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../../../../../core/support/UpdatingHandles.js";import{makeDehydratedPoint as u}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as d}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as f}from"../../SnappingVisualizer3D.js";import{orientation as v}from"../geometryUtils.js";import{SupportedObjectResult as g}from"../isSupportedObjectUtils.js";import{manipulatedObjectGeometry as _}from"../manipulatedObjectUtils.js";import{canMoveZOperations as j}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as M}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as b}from"../tooltipUtils3D.js";import{createVisualElements as y}from"../visualElementUtils.js";import{discRadius as T}from"../manipulations/config.js";import{ManipulationType as w,MoveManipulation as I}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as S}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as O}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as x}from"./isSupportedObject.js";import{OutlineVisualElement as E}from"../../visualElements/OutlineVisualElement.js";import{dragManipulatedObjectMany as U,resetManipulatedObjectMany as P}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as k}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as H}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import X from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as Y}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as R}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as A}from"../../../../interactive/tooltip/Tooltip.js";import{enterInputModeIfAvailable as z}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as D}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as Z}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as C}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as F}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{autoDistanceBetweenPoints2D as V}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as G}from"../../../../support/euclideanLengthMeasurementUtils.js";class L{constructor(t){this.objects=t,this.type="move-start"}}class B{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class N{constructor(t){this.objects=t,this.type="move-stop"}}const q=Symbol("manipulators"),J=Symbol("tooltips");let K=class extends k{constructor(t){super(t),this._infos=new Map,this.events=new i,this.objects=new e,this.enableZ=!0,this.sketchOptions=new X,this.type="move-3d",this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new m,this._moveManipulation=null}initialize(){const{view:t}=this;this.tooltip=A((()=>({view:t,options:this.sketchOptions.tooltips}))),this.addHandles([this.objects.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),this.objects.on("change",(()=>this._connectTooltips()))]);const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=s(this.tooltip),this._moveManipulation=s(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy()}onInputEvent(t){if(!this.destroyed&&!z(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=_(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(x(e)!==g.SUPPORTED)continue;const t=new Q(e);this._infos.set(e,t)}for(const e of o)this._infos.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infos.get(o);this.addHandles(M(t.object),o)}}_refreshManipulators(){if(this.removeHandles(q),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values());this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new O({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator((t=>{this.addHandles([t.events.on("immediate-click",(t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{"start"===t?this._showTooltip(w.XY):this._hideTooltip()}))],q)})),this.addHandles(o.manipulationXY.createDragPipeline(((o,e,i,n)=>this._buildDragEventPipeline(t,w.XY,o,e,i,n))),q)}this._createMoveManipulation(t)}_createMoveManipulation(t){const o=new I({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?I.radiusForSymbol(t[0].object.graphic?.symbol):T});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()})),q)}));const e=t=>o=>{this.addHandles([o.events.on("focus-changed",(({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()})),o.events.on("grab-changed",(()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=a)}))],q)};this._moveManipulation.xyManipulation.forEachManipulator(e(w.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(w.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(w.Z));const i=()=>this._updateMoveManipulation(t);for(const a of t)this.addHandles([a.object.on("committed",i),r((()=>a.object.visible),i)],q);const n=t[t.length-1];this.addHandles(n.object.on("committed",(()=>this._updateMoveManipulationAngle(n))),q);const{object:s}=n,{operations:l}=s;if(l){const e=s.graphic;this.addHandles(o.createDragPipeline(((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s)),s.elevationInfo,l.data.spatialReference,e),q)}this._updateMoveManipulationAngle(n)}_createVisualElements(t){for(const o of t){const e=o.object,i=y({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>n()});null!=i&&(o.geometryRepresentation=i.visualElement,o.geometryRepresentation instanceof E&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",(()=>{o.object.isDraped||this._updateMoveManipulation(t)})),r((()=>o.object.isDraped),(()=>this._updateMoveManipulation(t)))],q),this.addHandles(i,q))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=v(_(t.object)))}_updateMoveManipulation(t){const o=u(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&j(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof E&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let r=null,p=null;const c=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&o===w.XY){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next((t=>p?.(t))).next((()=>(l.length&&this.events.emit("move-stop",new N(l)),this.destroyed||c(),null))),{steps:i=i.next((o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),r=U(l),p=P(l),this._emitRecordUndo(),this.events.emit("move-start",new L(l)),this.destroyed))return null}return 0!==l.length?o:null})).next((t=>r?.(t))).next((t=>(this._updateMoveTooltip(o,t),t))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd),i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new B(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new N(l)),this.destroyed)return null;c()}return null})),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(J),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new D({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new L([o]))},onMove:()=>e.emit("move",new B(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new N([o])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};t=b(this.tooltip,o,(()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i})))}else t=r((()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null),(t=>{this.tooltip.info=t}),p);this.addHandles(t,J)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:e}=this;switch(t){case w.XY:this._latestTooltipInfo=this._translateTooltipInfo??=new Z({sketchOptions:e}),W(this._latestTooltipInfo,o,((t,o)=>V(t,o)));break;case w.XY_AXIS:this._latestTooltipInfo=this._translateXYTooltipInfo??=new C({sketchOptions:e}),W(this._latestTooltipInfo,o,((t,e)=>l(V(t,e),S(o))));break;case w.Z:this._latestTooltipInfo=this._translateZTooltipInfo??=new F({sketchOptions:e}),W(this._latestTooltipInfo,o,G)}this._latestTooltipInfo.sketchOptions=e}_emitRecordUndo(){const t=this.objects.toArray().map((t=>t.createUndoRecord?.())).filter(o);t.length>0&&this.events.emit("record-undo",{updates:t})}_buildSnappingPipelineSteps(t,o,e,i,n){const s=_(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.origin).clone(),l=new Y({elevationInfo:o,pointer:n,editGeometryOperations:H.fromGeometry(a,this.view.state.viewingMode),visualizer:new f,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:c}=R({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return i=i.next(c),{steps:e=e.next((o=>{a.z=d(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}})).next(...p),cancel:i}}};t([c({constructOnly:!0,nonNullable:!0})],K.prototype,"view",void 0),t([c()],K.prototype,"objects",void 0),t([c({constructOnly:!0,nonNullable:!0})],K.prototype,"enableZ",void 0),t([c({constructOnly:!0,type:X})],K.prototype,"sketchOptions",void 0),t([c({constructOnly:!0})],K.prototype,"snappingManager",void 0),t([c()],K.prototype,"type",void 0),t([c()],K.prototype,"updating",null),t([c()],K.prototype,"_latestTooltipInfo",void 0),t([c()],K.prototype,"_shouldShowMovePointTooltip",null),t([c()],K.prototype,"activeTooltipInfo",null),K=t([h("esri.views.3d.interactive.editingTools.move.MoveTool3D")],K);class Q{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}function W(t,o,e){if(null==o||"end"===o.action)return void(t.distance=a);const{mapStart:i,mapEnd:n}=o,s=e(i,n);t.distance=null!=s?s:a}export{B as MoveEvent,L as MoveStartEvent,N as MoveStopEvent,K as MoveTool3D};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import i from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{zeroMeters as a,scale as l}from"../../../../../core/quantityUtils.js";import{watch as r,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../../../../../core/support/UpdatingHandles.js";import{makeDehydratedPoint as u}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as d}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as f}from"../../SnappingVisualizer3D.js";import{orientation as v}from"../geometryUtils.js";import{SupportedObjectResult as g}from"../isSupportedObjectUtils.js";import{manipulatedObjectGeometry as _}from"../manipulatedObjectUtils.js";import{canMoveZOperations as M}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as j}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as b}from"../tooltipUtils3D.js";import{createVisualElements as y}from"../visualElementUtils.js";import{discRadius as T}from"../manipulations/config.js";import{ManipulationType as w,MoveManipulation as I}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as S}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as O}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as x}from"./isSupportedObject.js";import{OutlineVisualElement as E}from"../../visualElements/OutlineVisualElement.js";import{dragManipulatedObjectMany as U,resetManipulatedObjectMany as P}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as k}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as H}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import X from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as Y}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as R}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as A,enterInputModeIfAvailable as z}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as D}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as Z}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as C}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as F}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{autoDistanceBetweenPoints2D as V}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as G}from"../../../../support/euclideanLengthMeasurementUtils.js";class L{constructor(t){this.objects=t,this.type="move-start"}}class B{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class N{constructor(t){this.objects=t,this.type="move-stop"}}const q=Symbol("manipulators"),J=Symbol("tooltips");let K=class extends k{constructor(t){super(t),this._infos=new Map,this.events=new i,this.objects=new e,this.enableZ=!0,this.sketchOptions=new X,this.type="move-3d",this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new m,this._moveManipulation=null}initialize(){const{view:t}=this;this.tooltip=A((()=>({view:t,options:this.sketchOptions.tooltips}))),this.addHandles([this.objects.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),this.objects.on("change",(()=>this._connectTooltips()))]);const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=s(this.tooltip),this._moveManipulation=s(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy()}onInputEvent(t){if(!this.destroyed&&!z(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=_(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(x(e)!==g.SUPPORTED)continue;const t=new Q(e);this._infos.set(e,t)}for(const e of o)this._infos.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infos.get(o);this.addHandles(j(t.object),o)}}_refreshManipulators(){if(this.removeHandles(q),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values());this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new O({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator((t=>{this.addHandles([t.events.on("immediate-click",(t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{"start"===t?this._showTooltip(w.XY):this._hideTooltip()}))],q)})),this.addHandles(o.manipulationXY.createDragPipeline(((o,e,i,n)=>this._buildDragEventPipeline(t,w.XY,o,e,i,n))),q)}this._createMoveManipulation(t)}_createMoveManipulation(t){const o=new I({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?I.radiusForSymbol(t[0].object.graphic?.symbol):T});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()})),q)}));const e=t=>o=>{this.addHandles([o.events.on("focus-changed",(({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()})),o.events.on("grab-changed",(()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=a)}))],q)};this._moveManipulation.xyManipulation.forEachManipulator(e(w.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(w.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(w.Z));const i=()=>this._updateMoveManipulation(t);for(const a of t)this.addHandles([a.object.on("committed",i),r((()=>a.object.visible),i)],q);const n=t[t.length-1];this.addHandles(n.object.on("committed",(()=>this._updateMoveManipulationAngle(n))),q);const{object:s}=n,{operations:l}=s;if(l){const e=s.graphic;this.addHandles(o.createDragPipeline(((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s)),s.elevationInfo,l.data.spatialReference,e),q)}this._updateMoveManipulationAngle(n)}_createVisualElements(t){for(const o of t){const e=o.object,i=y({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>n()});null!=i&&(o.geometryRepresentation=i.visualElement,o.geometryRepresentation instanceof E&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",(()=>{o.object.isDraped||this._updateMoveManipulation(t)})),r((()=>o.object.isDraped),(()=>this._updateMoveManipulation(t)))],q),this.addHandles(i,q))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=v(_(t.object)))}_updateMoveManipulation(t){const o=u(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&M(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof E&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let r=null,p=null;const c=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&o===w.XY){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next((t=>p?.(t))).next((()=>(l.length&&this.events.emit("move-stop",new N(l)),this.destroyed||c(),null))),{steps:i=i.next((o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),r=U(l),p=P(l),this._emitRecordUndo(),this.events.emit("move-start",new L(l)),this.destroyed))return null}return 0!==l.length?o:null})).next((t=>r?.(t))).next((t=>(this._updateMoveTooltip(o,t),t))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd),i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new B(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new N(l)),this.destroyed)return null;c()}return null})),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(J),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new D({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new L([o]))},onMove:()=>e.emit("move",new B(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new N([o])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};t=b(this.tooltip,o,(()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i})))}else t=r((()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null),(t=>{this.tooltip.info=t}),p);this.addHandles(t,J)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:e}=this;switch(t){case w.XY:this._latestTooltipInfo=this._translateTooltipInfo??=new Z({sketchOptions:e}),W(this._latestTooltipInfo,o,((t,o)=>V(t,o)));break;case w.XY_AXIS:this._latestTooltipInfo=this._translateXYTooltipInfo??=new C({sketchOptions:e}),W(this._latestTooltipInfo,o,((t,e)=>l(V(t,e),S(o))));break;case w.Z:this._latestTooltipInfo=this._translateZTooltipInfo??=new F({sketchOptions:e}),W(this._latestTooltipInfo,o,G)}this._latestTooltipInfo.sketchOptions=e}_emitRecordUndo(){const t=this.objects.toArray().map((t=>t.createUndoRecord?.())).filter(o);t.length>0&&this.events.emit("record-undo",{updates:t})}_buildSnappingPipelineSteps(t,o,e,i,n){const s=_(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.origin).clone(),l=new Y({elevationInfo:o,pointer:n,editGeometryOperations:H.fromGeometry(a,this.view.state.viewingMode),visualizer:new f,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:c}=R({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return i=i.next(c),{steps:e=e.next((o=>{a.z=d(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}})).next(...p),cancel:i}}};t([c({constructOnly:!0,nonNullable:!0})],K.prototype,"view",void 0),t([c()],K.prototype,"objects",void 0),t([c({constructOnly:!0,nonNullable:!0})],K.prototype,"enableZ",void 0),t([c({constructOnly:!0,type:X})],K.prototype,"sketchOptions",void 0),t([c({constructOnly:!0})],K.prototype,"snappingManager",void 0),t([c()],K.prototype,"type",void 0),t([c()],K.prototype,"updating",null),t([c()],K.prototype,"_latestTooltipInfo",void 0),t([c()],K.prototype,"_shouldShowMovePointTooltip",null),t([c()],K.prototype,"activeTooltipInfo",null),K=t([h("esri.views.3d.interactive.editingTools.move.MoveTool3D")],K);class Q{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}function W(t,o,e){if(null==o||"end"===o.action)return void(t.distance=a);const{mapStart:i,mapEnd:n}=o,s=e(i,n);t.distance=null!=s?s:a}export{B as MoveEvent,L as MoveStartEvent,N as MoveStopEvent,K as MoveTool3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{unitRGBAFromColor as n}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import a from"../../../../../core/Evented.js";import o from"../../../../../core/Handles.js";import{handlesGroup as s,makeHandle as r,destroyHandle as l}from"../../../../../core/handleUtils.js";import{destroyMaybe as p,removeMaybe as d}from"../../../../../core/maybe.js";import{watch as h,initial as u,on as c,syncAndInitial as m,when as f,sync as g}from"../../../../../core/reactiveUtils.js";import{property as _}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as v}from"../../../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as M}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{m as b,f as x,o as E,a as O,g as y,j}from"../../../../../chunks/vec32.js";import{fromValues as I,create as S}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as H}from"../../../../../core/support/UpdatingHandles.js";import w from"../../../../../geometry/Point.js";import V from"../../../../../geometry/Polyline.js";import T from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as A}from"../../../../../layers/graphics/dehydratedPoint.js";import{isVolumetricSymbol as G}from"../../../../../symbols/support/utils.js";import{Manipulator3D as D}from"../../Manipulator3D.js";import{createManipulatorMaterial as P,createManipulatorOutlineMaterial as L,placeAtObject as C}from"../../manipulatorUtils.js";import{RenderObject as N}from"../../RenderObject.js";import{SegmentLabels3D as U}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as k}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as R,screenToRenderPlaneFromEvent as z,convertToMapCoordinates as F}from"../dragEventPipeline3D.js";import{orientation as Z}from"../geometryUtils.js";import{ManipulatorType as X}from"../ManipulatorType.js";import{canMoveZOperations as Y}from"../manipulatorUtils.js";import{Settings as q}from"../settings.js";import{createVisualElements as B}from"../visualElementUtils.js";import{discRadiusSmall as W}from"../manipulations/config.js";import{ManipulationType as K,MoveManipulation as J}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Q}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as $,createEdgeOffsetIntersectionPlane as ee,createEdgeOffsetOperation as te,edgeOffsetRotationMatrix as ie,screenEdgeLengthSquared as ne,getDistanceInGeometrySR as ae}from"./edgeOffsetUtils.js";import{createTooltipInfos as oe,connectTooltipToManipulatedObject as se,getUpdatedTranslateObjectTooltipInfo as re,getUpdatedEdgeOffsetTooltipInfo as le}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as pe}from"../../visualElements/OutlineVisualElement.js";import{createExtrudedTriangle as de,createSphereGeometry as he}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as ue}from"../../../../input/IViewEvents.js";import{sceneSnappingAtLocation as ce,addMapDelta as me,createManipulatorDragEventPipeline as fe,dragAtLocation as ge,addScreenDelta as _e}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as ve,ManipulatorStateFlags as Me}from"../../../../interactive/interfaces.js";import{tooltipKeys as be}from"../../../../interactive/keybindings.js";import{AccumulationBehavior as xe}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as Ee}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Oe}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as ye}from"../../../../interactive/tooltip/Tooltip.js";import{enterInputModeIfAvailable as je}from"../../../../interactive/tooltip/tooltipCommonUtils.js";const Ie=Symbol();let Se=class extends t{get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=Ce.NONE,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new H,this._recreatingManipulators=!1,this._settings=new q({getTheme:()=>this.view.effectiveTheme}),this.events=new a,this.activeTooltipInfo=null,this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(Ce.RESHAPING),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(Ce.NONE,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(Ce.MOVING),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(Ce.NONE,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=oe(this._sketchOptions,e),this._vertexManipulatorMaterial=P(n(i.color),i.renderOccluded),this._vertexManipulatorOutlineMaterial=L(n(i.outlineColor),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=L(n(i.hoverOutlineColor),i.renderOccluded);const a=t.edge;this._edgeManipulatorMaterial=P(n(a.color),a.renderOccluded),this._edgeManipulatorOutlineMaterial=L(n(a.outlineColor),a.renderOccluded);const o=t.edgeOffset;this._edgeOffsetManipulatorMaterial=P(n(o.color),o.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=P(n(o.hoverColor),o.renderOccluded,!1);const s=t.selected;this._selectedManipulatorMaterial=P(n(s.color),s.renderOccluded),this._selectedManipulatorOutlineMaterial=L(n(s.outlineColor),s.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=L(n(s.hoverOutlineColor),s.renderOccluded),this.tooltip=ye((()=>({view:e,options:this._sketchOptions.tooltips}))),this.addHandles([h((()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}}),(({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:n})=>{e.applyColor(this._vertexManipulatorMaterial),e.applyOutline(this._vertexManipulatorOutlineMaterial),e.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),t.applyColor(this._edgeManipulatorMaterial),t.applyOutline(this._edgeManipulatorOutlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterial),i.applyHover(this._edgeOffsetManipulatorHoverMaterial),n.applyColor(this._selectedManipulatorMaterial),n.applyOutline(this._selectedManipulatorOutlineMaterial),n.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)})),h((()=>this.object.visible),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Ae(t)&&(t.edgeManipulator.available=e)})),h((()=>this._numGrabbing+this._numDragging===0),(e=>this._toggleAutoHideManipulators(e))),h((()=>({labels:this._segmentLabels,enabled:this._sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")}),u),se(this.tooltip,this.object,(()=>this._tooltipsContext)),h((()=>this.tooltip.mode),((e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()})),c((()=>this._operations),"vertex-update",(e=>this._updateManipulatorPositions(e.vertices)),{onListenerAdd:()=>this._recreateManipulators()}),c((()=>this._operations?.data),"change",(e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()}))])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=p(this._segmentLabels),this.tooltip=p(this.tooltip)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===be.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!je(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter((e=>e.manipulator.selected&&"vertex"===e.type));return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=p(this._moveManipulation),this._objectMoveManipulation=p(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const i of this._operations.data.components){const n=e?.byComponentIndex.get(i.index);for(const e of i.vertices){const i=n?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of i.edges)this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}get canRedo(){return null!=this._operations&&this._operations.canRedo}get canUndo(){return null!=this._operations&&this._operations.canUndo}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=p(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._sketchOptions.labels;this._segmentLabels=new U({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const n=[],a=this._manipulatorInfos.some((e=>"vertex"===e.type&&e.manipulator.selected)),o=e===Ne.SELECTED_OR_ALL&&a;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||n.push(s),i++);this._moveVertices(n,t);if(n.length===i){if(this._updateEventState(Ce.MOVING),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._updateEventState(Ce.RESHAPING),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(Ie):this.tool.manipulators.forEach((({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,Ie)})))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce(((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e),0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(Ce.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:n}=e;if(!t&&!i&&!n)return;const a=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&a.push(o);this._moveVertices(a,e,xe.ACCUMULATE_STEPS),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case Ce.NONE:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case Ce.MOVING:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case Ce.RESHAPING:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case Ce.MOVING:switch(this._reshapeEventState){case Ce.NONE:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case Ce.RESHAPING:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case Ce.RESHAPING:switch(this._reshapeEventState){case Ce.NONE:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case Ce.MOVING:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:n}=this;if(n){if(this._objectMoveManipulation=new Q({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline(((t,i,a)=>{i.next((e=>this._trackNumDragging(e))).next((t=>("start"===t.action&&(e=n.createUndoGroup()),t))).next((e=>this._perObjectManipulatorDragAction(Ne.ALL,e))).next((e=>(this._updateTranslateObjectTooltip(K.XY,e),e))).next((t=>{"end"===t.action&&(this._resetTooltip(),e=d(e))})),a.next((()=>this._onDragCancel(!0,(()=>e=d(e)))))}))),this._objectMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1))))}else this._objectMoveManipulation.forEachManipulator((e=>{e.grabbable=!1,e.cursor=null}));this._objectMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(e.events.on("immediate-click",(e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))))}}_createMoveManipulation(e){const{object:t,tool:i,view:n,_operations:a}=this;if(!a)return;this._moveManipulation=new J({tool:i,view:n,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&Y(t.operations,t.elevationInfo),snapToScene:!1,radius:J.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator((e=>this.addHandles([e.events.on("immediate-click",(t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some((e=>e.manipulator.selected))||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()})),this._watchAndUpdateGrabState(e,!1)])));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",(({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()}))])};this._moveManipulation.xyManipulation.forEachManipulator(o(K.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(K.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(o(K.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=a.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline(((n,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:d}=Oe({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new Ee({editGeometryOperations:a,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new k}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next((e=>(this._onDragCancel(),e))).next(d),{steps:s=s.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return e.manipulatorType===X.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e})).next(ce(this.view,e,t.graphic??void 0)).next(...p).next(me()).next((e=>this._perObjectManipulatorDragAction(Ne.SELECTED_OR_ALL,e))).next((e=>(this._updateTranslateTooltip(n,e),e))),cancel:r}}),e,s,t.graphic),h((()=>t.visible),(()=>this._updateMoveManipulationPosition()),u),t.on("committed",(()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()})),h((()=>t.isDraped),(e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?this.addHandles(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):this.removeHandles(t)}),u)])}_createVisualElements(){const{object:e,view:t}=this,i=B({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,X.TRANSLATE_XY)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof pe?i.visualElement:null);const n=this._outlineVisualElement;if(null!=n){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(c((()=>n.events),"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,n=this._operations;if(e.component.vertices.length<=2||!n)return null;const a=n.data.spatialReference,o=this._settings.manipulators.edgeOffset,r=o.size/2,l=r+o.collisionPadding,p=r/l,d=p/2,h=p*Math.sqrt(3)/2,{height:u,offset:c}=o,m=this._edgeOffsetManipulatorMaterial;if(!this._edgeOffsetManipulatorGeometryInside){const e=de(m,h,d,d,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=de(m,-h,d,d,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const f=[new N(this._edgeOffsetManipulatorGeometryInside.instantiate(),Me.Unfocused),new N(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),Me.Focused),new N(this._edgeOffsetManipulatorGeometryOutside.instantiate(),Me.Unfocused),new N(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),Me.Focused)],g=new D({view:i,renderObjects:f,elevationInfo:"on-the-ground"!==t.mode||G(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:I(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:Te(a)}),_=new D({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:Te(a)}),v={manipulator:g,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:_,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(v,o.minSquaredEdgeLength);const M=()=>this._updateEdgeOffsetManipulator(v);M(),v.locationUpdateHandle=s([e.leftVertex,e.rightVertex].map((e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",M)})));const b=e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([v.locationUpdateHandle,this._watchAndUpdateGrabState(g,!0),this._watchAndUpdateGrabState(_,!0),fe(g,this._createEdgeOffsetPipeline(v,t,n)),fe(_,this._createEdgePipeline(v,t,n)),_.events.on("immediate-click",b),g.events.on("immediate-click",b),g.events.on("focus-changed",(()=>this._resetTooltip())),g.events.on("grab-changed",(({screenPoint:e,action:t})=>{v.grabMapPoint="start"===t?$(e,this.view,this.object,v):null}))],g),this._manipulatorInfos.push(v),this.manipulators.addMany([g,_]),this.events.emit("manipulators-changed"),v}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,n=e.edgeManipulator,a=()=>{e.visibilityHandle=d(e.visibilityHandle);const a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=a&&null!=o&&ne(a.manipulator.renderLocation,o.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!n.focused||l)&&(i.grabbable=!l,n.grabbable=!l,e.visibilityHandle=s([i.disableDisplay(),r((()=>{i.grabbable=!0,n.grabbable=this.enableMoveObject}))]))};this._manipulatorHandles.add([i.events.on("focus-changed",a),n.events.on("focus-changed",a),r((()=>{d(e.visibilityHandle),n.metadata.deleting=!0,this.manipulators.remove(n)}))],i),a()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=ee(this.view,e.manipulator.elevationAlignedLocation,te(t,e.handle,e.manipulator.elevationInfo)),n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==n||null==a)return;const o=n.manipulator.renderLocation,s=a.manipulator.renderLocation,r=null!=i?ie(i,o,s):M;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=b(x(De,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(n,a,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(n,a,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=n;a.next((e=>this._trackNumDragging(e))).next(ge(this.view,r)).next(R(this.view,r,t,s,e)).next(_e()).next(me()).next((e=>this._perObjectManipulatorDragAction(Ne.ALL,e))).next((e=>(this._updateTranslateObjectTooltip(K.XY,e),e))).next((e=>{"end"===e.action&&this._resetTooltip()})),o.next((()=>this._onDragCancel(!n.metadata.deleting)))}}}_createEdgeOffsetPipeline(e,t,i){return(n,a,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);a.next((e=>this._trackNumDragging(e))).next(ge(this.view,n.elevationAlignedLocation)).next(r).next(z(this.view)).next(F(this.view,i.data.spatialReference)).next(me()).next(He()).next((e=>this._pendingEdgeOffsetInfo?e:p(e))).next((e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()})),o.next((()=>{this._exitEdgeOffsetInputMode(),n.metadata.deleting||(l(),this._onDragCancel())}))}}_initializeEdgeOffset(e,t,i,n){const{view:a,object:o}=this,r=te(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),p=ee(a,e.manipulator.elevationAlignedLocation,r);let h;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),h=d(h)},c=this.events.on("undo",u);return h=s([this._initializeEdgeOffsetVisualElement(e,o,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,(()=>{n.execute({action:"cancel"})}))]),{initializeStep:e=>null==r||null==p?(u(),null):{...e,operation:r,plane:p},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,a){const o=()=>new V({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:a.data.spatialReference}),r=new pe({view:this.view,isDraped:t.isDraped,geometry:o(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),p=s([h((()=>({color:this._accentColor,draped:t.isDraped})),(({color:e,draped:t})=>{r.color=n(e),r.isDraped=t}),m),t.on("committed",(()=>{r.geometry=o()})),l(r)]);return r.attached=!0,p}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(Ce.RESHAPING),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftEdge?.leftVertex,n=e.handle.leftVertex,a=e.handle.rightVertex.rightEdge?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(n.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,n.pos)<Pe){const e=this._getManipulatorInfoFromHandle(n);null!=e&&l.push(e)}if(s.distance(n.pos,o.pos)<r||a&&s.distance(a.pos,o.pos)<Pe){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!je(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Ae).find((({manipulator:e})=>e.hovering||e.grabbing||e.dragging))}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:n}=i,a=te(t.data.coordinateHelper,e.handle,n);this._selectEdgeOffsetArrow(e,a),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,n,t),this._connectEdgeOffsetTooltip(e,a,t,(()=>{this.removeHandles(a),this._exitEdgeOffsetInputMode()}))],a)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??$(this.view.inputManager?.latestPointerLocation,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,n){const a=()=>this.tooltipInfos.edgeOffset.distance.actual,o=a=>{n(),queueMicrotask((()=>{this.view.focus();const n=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,ae(a,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),n.remove()}))},r=()=>{const e=a();null!=e?o(e):n()};return s([f((()=>this.tooltip&&!this.tooltip.focused),(()=>r()),g),this.tooltip.on("discard",n),this.tooltip.on("commit",(e=>{"commit-and-exit"===e.type&&r()}))])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const n=this.view,a=this._operations,o=this._settings;if(!a)return null;const r=a.data.type,l=a.data.spatialReference;if("edge"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=we(o.manipulators.vertex);this._vertexManipulatorGeometry=he(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=he(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=we(o.manipulators.edge);this._edgeManipulatorGeometry=he(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=he(this._edgeManipulatorOutlineMaterial,t,16,16)}const p="point"===r||"mesh"===r?[]:[new N(this._vertexManipulatorGeometry.instantiate(),Le.Vertex|Me.Unselected),new N(this._vertexManipulatorOutlineGeometry.instantiate(),Le.Vertex|Me.Unfocused|Me.Unselected),new N(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Le.Vertex|Me.Focused|Me.Unselected),new N(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),Me.Selected),new N(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),Me.Selected|Me.Unfocused),new N(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),Me.Selected|Me.Focused)];this.enableMidpoints&&p.push(new N(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),Le.Edge|Me.Focused|Me.Unselected),new N(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Le.Edge|Me.Focused|Me.Unselected),new N(this._edgeManipulatorGeometry.instantiate(),Le.Edge|Me.Unfocused|Me.Unselected),new N(this._edgeManipulatorOutlineGeometry.instantiate(),Le.Edge|Me.Unfocused|Me.Unselected));const h=new D({view:n,renderObjects:p,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:this.object.visible,metadata:{deleting:!1},location:Te(l)});h.selected=i,this._setTypeSpecificManipulatorSettings(h,e,t);const u="edge"===e.type?{manipulator:h,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:h,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(u),this.manipulators.add(h),this._updateManipulatorPosition(u),"edge"===u.type){const e=[];for(const t of[u.handle.leftVertex,u.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(u))))}u.locationUpdateHandle=s(e),this._manipulatorHandles.add(u.locationUpdateHandle,h)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(h,!0),h);const c=fe(h,((e,i,o,s)=>{let r=null;const{snappingStep:p,cancelSnapping:h}=Oe({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new Ee({editGeometryOperations:a,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new k}),updatingHandles:this._updatingHandles,useZ:!1});o=o.next((t=>(this._onDragCancel(!e.metadata.deleting,(()=>r=d(r))),t))).next(h);const{elevationAlignedLocation:c}=e,m=this.object.graphic??void 0;i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&a&&(r=a.createUndoGroup()),"edge"===u.type){const t=this._splitEdgeManipulator(u);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:u,snapOrigin:u.handle.pos}})).next(ge(n,c)).next(R(n,c,t,l,m)).next(ce(n,t,m)).next(...p).next(me()).next((e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=d(r)),this._resetTooltip()}))}));return this._manipulatorHandles.add([c,h.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,u))),h.events.on("select-changed",(()=>{u.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()})),h.events.on("focus-changed",(()=>{this._resetTooltip()}))],h),this.events.emit("manipulators-changed"),u}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._resetTooltip(),this._reshapeEventState){case Ce.NONE:break;case Ce.MOVING:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case Ce.RESHAPING:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(Ce.NONE)}_setTypeSpecificManipulatorSettings(e,t,i){const n=this._settings;switch(t.type){case"vertex":{e.state=Le.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:a}=n.manipulators.vertex;e.radius=t/2+a,e.elevationInfo=i;const o=this._operations?.data.type;e.interactive=null!=o&&"point"!==o&&"mesh"!==o;break}case"edge":{e.state=Le.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:a}=n.manipulators.edge;e.radius=t/2+a,e.elevationInfo="on-the-ground"!==i.mode||G(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",(i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)}))}_onGrabStateChanged(e,t,i,n="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(Ce.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==n||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,Ae(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)})),this._objectMoveManipulation.forEachManipulator((e=>{e.interactive=e.grabbing||!this._numGrabbing})))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){if(e)for(const t of this._manipulatorInfos)if(e===t.handle)return t;return null}_updateManipulatorPositions(e){for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ge),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==n)return;const a=i.manipulator,o=n.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=a.location,n=o.location,s=.5,r=i.x+s*(n.x-i.x),l=i.y+s*(n.y-i.y),p=i.hasZ&&n.hasZ?0:void 0;e.manipulator.location=A(r,l,p,t.data.spatialReference)}else E(De,a.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=De}}_splitEdgeManipulator(e,t=.5){const i=this._operations,n=i.splitEdge(e.handle,t).createdVertex;e.locationUpdateHandle=d(e.locationUpdateHandle);const a=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(n)):(o=e,o.handle=n,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,a)),n.leftEdge&&this._createVertexOrEdgeManipulator(n.leftEdge),n.rightEdge&&this._createVertexOrEdgeManipulator(n.rightEdge),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(Ce.RESHAPING),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.components.indexOf(n.component);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:n.index}],added:r}),s&&this._updateEventState(Ce.NONE),o}_updateMoveManipulationPosition(){const e=O(De,0,0,0);let t=0,i=!1,n=null,a=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,y(e,e,r.manipulator.renderLocation),null==n||r.selectedIndex>n.selectedIndex?(a=n,n=r):(null==a||r.selectedIndex>a.selectedIndex)&&(a=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&Y(this._operations,o.elevationInfo),this._moveManipulation.angle=Z(s),this._moveManipulation.radius=J.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&Y(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=n){const e=n.handle.pos,t=null!=a?a.handle.pos:n.handle.leftEdge?.leftVertex?n.handle.leftEdge.leftVertex.pos:null,o=null==a&&n.handle.rightEdge?.rightVertex?n.handle.rightEdge.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Ve(t,e):o&&(i=Ve(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=W}0!==t&&i?(j(e,e,1/t),Ge.spatialReference=this._operations.data.spatialReference,Ge.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ge),this._moveManipulation.elevationAlignedLocation=Ge):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?C(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(i){for(const n of e){const e=n.handle.component;if("vertex"===n.type&&i.canRemoveVertex(e)){t.push(n.handle),this._removeManipulator(n),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.rightEdge));const a=i.removeVertices([n.handle]),o=a.removedVertices?.[0].createdEdge;o?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.edges[0]))}}if(t.length>0){const e=t.map((e=>{const t=i.data.components.indexOf(e.component);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}})),n=this._updateEventState(Ce.RESHAPING);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map((e=>e.coordinates)),vertices:e}),this.destroyed)return;if(n&&(this._updateEventState(Ce.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}}_moveVertices(e,t,i=("start"===t.action?xe.NEW_STEP:xe.ACCUMULATE_STEPS)){const n=this._operations;if(n){e.length>0&&n.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i);for(const t of e)this._updateManipulatorPosition(t)}}_offsetEdge(e,t,i){if(!this._operations)return;const n=t.clone();n.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],n),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===ue.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===ue.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=re(e,t,this._tooltipsContext))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=le(this.object,e,this._tooltipsContext))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?le(this.object,null,this._tooltipsContext):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return 1===e.length?e[0]:null}get _tooltipsContext(){return{sketchOptions:this._sketchOptions,tooltipInfos:this.tooltipInfos,activeTooltipInfo:this.activeTooltipInfo,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks}}get test(){}};function He(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function we(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Ve(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function Te(e){return new w({x:0,y:0,z:0,spatialReference:e})}function Ae(e){return"edge"===e.type&&"edgeManipulator"in e}e([_()],Se.prototype,"_numGrabbing",void 0),e([_()],Se.prototype,"_numDragging",void 0),e([_()],Se.prototype,"_pendingEdgeOffsetInfo",void 0),e([_()],Se.prototype,"_operations",null),e([_()],Se.prototype,"_segmentLabels",void 0),e([_({constructOnly:!0})],Se.prototype,"tool",void 0),e([_()],Se.prototype,"tooltip",void 0),e([_()],Se.prototype,"activeTooltipInfo",void 0),e([_({readOnly:!0})],Se.prototype,"updating",null),e([_()],Se.prototype,"manipulators",null),e([_()],Se.prototype,"view",null),e([_()],Se.prototype,"object",null),e([_()],Se.prototype,"enableZShape",null),e([_()],Se.prototype,"enableDeleteVertices",null),e([_()],Se.prototype,"enableZVertex",null),e([_()],Se.prototype,"autoHideManipulators",null),e([_()],Se.prototype,"enableMoveObject",null),e([_()],Se.prototype,"enableMidpoints",null),e([_()],Se.prototype,"enableEdgeOffset",null),e([_()],Se.prototype,"_sketchOptions",null),e([_()],Se.prototype,"_accentColor",null),e([_()],Se.prototype,"_tooltipsContext",null),Se=e([v("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],Se);const Ge=A(0,0,void 0,T.WGS84),De=S(),Pe=1e-6;var Le,Ce,Ne;!function(e){e.Vertex=ve.Custom1,e.Edge=ve.Custom2}(Le||(Le={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(Ce||(Ce={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(Ne||(Ne={}));export{Se as ReshapeOperation};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{unitRGBAFromColor as n}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import a from"../../../../../core/Evented.js";import o from"../../../../../core/Handles.js";import{handlesGroup as s,makeHandle as r,destroyHandle as l}from"../../../../../core/handleUtils.js";import{destroyMaybe as p,removeMaybe as d}from"../../../../../core/maybe.js";import{watch as h,initial as u,on as c,syncAndInitial as f,when as m,sync as g}from"../../../../../core/reactiveUtils.js";import{property as _}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as v}from"../../../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as M}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{m as b,f as x,o as E,a as O,g as y,j}from"../../../../../chunks/vec32.js";import{fromValues as I,create as S}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as H}from"../../../../../core/support/UpdatingHandles.js";import w from"../../../../../geometry/Point.js";import V from"../../../../../geometry/Polyline.js";import T from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as A}from"../../../../../layers/graphics/dehydratedPoint.js";import{isVolumetricSymbol as G}from"../../../../../symbols/support/utils.js";import{Manipulator3D as D}from"../../Manipulator3D.js";import{createManipulatorMaterial as P,createManipulatorOutlineMaterial as L,placeAtObject as C}from"../../manipulatorUtils.js";import{RenderObject as N}from"../../RenderObject.js";import{SegmentLabels3D as U}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as k}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as R,screenToRenderPlaneFromEvent as z,convertToMapCoordinates as F}from"../dragEventPipeline3D.js";import{orientation as Z}from"../geometryUtils.js";import{ManipulatorType as X}from"../ManipulatorType.js";import{canMoveZOperations as Y}from"../manipulatorUtils.js";import{Settings as q}from"../settings.js";import{createVisualElements as B}from"../visualElementUtils.js";import{discRadiusSmall as W}from"../manipulations/config.js";import{ManipulationType as K,MoveManipulation as J}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Q}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as $,createEdgeOffsetIntersectionPlane as ee,createEdgeOffsetOperation as te,edgeOffsetRotationMatrix as ie,screenEdgeLengthSquared as ne,getDistanceInGeometrySR as ae}from"./edgeOffsetUtils.js";import{createTooltipInfos as oe,connectTooltipToManipulatedObject as se,getUpdatedTranslateObjectTooltipInfo as re,getUpdatedEdgeOffsetTooltipInfo as le}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as pe}from"../../visualElements/OutlineVisualElement.js";import{createExtrudedTriangle as de,createSphereGeometry as he}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as ue}from"../../../../input/IViewEvents.js";import{sceneSnappingAtLocation as ce,addMapDelta as fe,createManipulatorDragEventPipeline as me,dragAtLocation as ge,addScreenDelta as _e}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as ve,ManipulatorStateFlags as Me}from"../../../../interactive/interfaces.js";import{tooltipKeys as be}from"../../../../interactive/keybindings.js";import{AccumulationBehavior as xe}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as Ee}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Oe}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as ye,enterInputModeIfAvailable as je}from"../../../../interactive/tooltip/tooltipCommonUtils.js";const Ie=Symbol();let Se=class extends t{get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=Ce.NONE,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new H,this._recreatingManipulators=!1,this._settings=new q({getTheme:()=>this.view.effectiveTheme}),this.events=new a,this.activeTooltipInfo=null,this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(Ce.RESHAPING),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(Ce.NONE,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(Ce.MOVING),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(Ce.NONE,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=oe(this._sketchOptions,e),this._vertexManipulatorMaterial=P(n(i.color),i.renderOccluded),this._vertexManipulatorOutlineMaterial=L(n(i.outlineColor),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=L(n(i.hoverOutlineColor),i.renderOccluded);const a=t.edge;this._edgeManipulatorMaterial=P(n(a.color),a.renderOccluded),this._edgeManipulatorOutlineMaterial=L(n(a.outlineColor),a.renderOccluded);const o=t.edgeOffset;this._edgeOffsetManipulatorMaterial=P(n(o.color),o.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=P(n(o.hoverColor),o.renderOccluded,!1);const s=t.selected;this._selectedManipulatorMaterial=P(n(s.color),s.renderOccluded),this._selectedManipulatorOutlineMaterial=L(n(s.outlineColor),s.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=L(n(s.hoverOutlineColor),s.renderOccluded),this.tooltip=ye((()=>({view:e,options:this._sketchOptions.tooltips}))),this.addHandles([h((()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}}),(({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:n})=>{e.applyColor(this._vertexManipulatorMaterial),e.applyOutline(this._vertexManipulatorOutlineMaterial),e.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),t.applyColor(this._edgeManipulatorMaterial),t.applyOutline(this._edgeManipulatorOutlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterial),i.applyHover(this._edgeOffsetManipulatorHoverMaterial),n.applyColor(this._selectedManipulatorMaterial),n.applyOutline(this._selectedManipulatorOutlineMaterial),n.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)})),h((()=>this.object.visible),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Ae(t)&&(t.edgeManipulator.available=e)})),h((()=>this._numGrabbing+this._numDragging===0),(e=>this._toggleAutoHideManipulators(e))),h((()=>({labels:this._segmentLabels,enabled:this._sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")}),u),se(this.tooltip,this.object,(()=>this._tooltipsContext)),h((()=>this.tooltip.mode),((e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()})),c((()=>this._operations),"vertex-update",(e=>this._updateManipulatorPositions(e.vertices)),{onListenerAdd:()=>this._recreateManipulators()}),c((()=>this._operations?.data),"change",(e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()}))])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=p(this._segmentLabels),this.tooltip=p(this.tooltip)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===be.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!je(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter((e=>e.manipulator.selected&&"vertex"===e.type));return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=p(this._moveManipulation),this._objectMoveManipulation=p(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const i of this._operations.data.components){const n=e?.byComponentIndex.get(i.index);for(const e of i.vertices){const i=n?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of i.edges)this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}get canRedo(){return null!=this._operations&&this._operations.canRedo}get canUndo(){return null!=this._operations&&this._operations.canUndo}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=p(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._sketchOptions.labels;this._segmentLabels=new U({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const n=[],a=this._manipulatorInfos.some((e=>"vertex"===e.type&&e.manipulator.selected)),o=e===Ne.SELECTED_OR_ALL&&a;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||n.push(s),i++);this._moveVertices(n,t);if(n.length===i){if(this._updateEventState(Ce.MOVING),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._updateEventState(Ce.RESHAPING),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(Ie):this.tool.manipulators.forEach((({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,Ie)})))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce(((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e),0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(Ce.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:n}=e;if(!t&&!i&&!n)return;const a=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&a.push(o);this._moveVertices(a,e,xe.ACCUMULATE_STEPS),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case Ce.NONE:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case Ce.MOVING:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case Ce.RESHAPING:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case Ce.MOVING:switch(this._reshapeEventState){case Ce.NONE:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case Ce.RESHAPING:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case Ce.RESHAPING:switch(this._reshapeEventState){case Ce.NONE:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case Ce.MOVING:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:n}=this;if(n){if(this._objectMoveManipulation=new Q({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline(((t,i,a)=>{i.next((e=>this._trackNumDragging(e))).next((t=>("start"===t.action&&(e=n.createUndoGroup()),t))).next((e=>this._perObjectManipulatorDragAction(Ne.ALL,e))).next((e=>(this._updateTranslateObjectTooltip(K.XY,e),e))).next((t=>{"end"===t.action&&(this._resetTooltip(),e=d(e))})),a.next((()=>this._onDragCancel(!0,(()=>e=d(e)))))}))),this._objectMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1))))}else this._objectMoveManipulation.forEachManipulator((e=>{e.grabbable=!1,e.cursor=null}));this._objectMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(e.events.on("immediate-click",(e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))))}}_createMoveManipulation(e){const{object:t,tool:i,view:n,_operations:a}=this;if(!a)return;this._moveManipulation=new J({tool:i,view:n,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&Y(t.operations,t.elevationInfo),snapToScene:!1,radius:J.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator((e=>this.addHandles([e.events.on("immediate-click",(t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some((e=>e.manipulator.selected))||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()})),this._watchAndUpdateGrabState(e,!1)])));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",(({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()}))])};this._moveManipulation.xyManipulation.forEachManipulator(o(K.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(K.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(o(K.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=a.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline(((n,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:d}=Oe({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new Ee({editGeometryOperations:a,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new k}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next((e=>(this._onDragCancel(),e))).next(d),{steps:s=s.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return e.manipulatorType===X.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e})).next(ce(this.view,e,t.graphic??void 0)).next(...p).next(fe()).next((e=>this._perObjectManipulatorDragAction(Ne.SELECTED_OR_ALL,e))).next((e=>(this._updateTranslateTooltip(n,e),e))),cancel:r}}),e,s,t.graphic),h((()=>t.visible),(()=>this._updateMoveManipulationPosition()),u),t.on("committed",(()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()})),h((()=>t.isDraped),(e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?this.addHandles(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):this.removeHandles(t)}),u)])}_createVisualElements(){const{object:e,view:t}=this,i=B({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,X.TRANSLATE_XY)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof pe?i.visualElement:null);const n=this._outlineVisualElement;if(null!=n){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(c((()=>n.events),"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,n=this._operations;if(e.component.vertices.length<=2||!n)return null;const a=n.data.spatialReference,o=this._settings.manipulators.edgeOffset,r=o.size/2,l=r+o.collisionPadding,p=r/l,d=p/2,h=p*Math.sqrt(3)/2,{height:u,offset:c}=o,f=this._edgeOffsetManipulatorMaterial;if(!this._edgeOffsetManipulatorGeometryInside){const e=de(f,h,d,d,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=de(f,-h,d,d,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const m=[new N(this._edgeOffsetManipulatorGeometryInside.instantiate(),Me.Unfocused),new N(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),Me.Focused),new N(this._edgeOffsetManipulatorGeometryOutside.instantiate(),Me.Unfocused),new N(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),Me.Focused)],g=new D({view:i,renderObjects:m,elevationInfo:"on-the-ground"!==t.mode||G(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:I(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:Te(a)}),_=new D({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:Te(a)}),v={manipulator:g,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:_,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(v,o.minSquaredEdgeLength);const M=()=>this._updateEdgeOffsetManipulator(v);M(),v.locationUpdateHandle=s([e.leftVertex,e.rightVertex].map((e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",M)})));const b=e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([v.locationUpdateHandle,this._watchAndUpdateGrabState(g,!0),this._watchAndUpdateGrabState(_,!0),me(g,this._createEdgeOffsetPipeline(v,t,n)),me(_,this._createEdgePipeline(v,t,n)),_.events.on("immediate-click",b),g.events.on("immediate-click",b),g.events.on("focus-changed",(()=>this._resetTooltip())),g.events.on("grab-changed",(({screenPoint:e,action:t})=>{v.grabMapPoint="start"===t?$(e,this.view,this.object,v):null}))],g),this._manipulatorInfos.push(v),this.manipulators.addMany([g,_]),this.events.emit("manipulators-changed"),v}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,n=e.edgeManipulator,a=()=>{e.visibilityHandle=d(e.visibilityHandle);const a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=a&&null!=o&&ne(a.manipulator.renderLocation,o.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!n.focused||l)&&(i.grabbable=!l,n.grabbable=!l,e.visibilityHandle=s([i.disableDisplay(),r((()=>{i.grabbable=!0,n.grabbable=this.enableMoveObject}))]))};this._manipulatorHandles.add([i.events.on("focus-changed",a),n.events.on("focus-changed",a),r((()=>{d(e.visibilityHandle),n.metadata.deleting=!0,this.manipulators.remove(n)}))],i),a()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=ee(this.view,e.manipulator.elevationAlignedLocation,te(t,e.handle,e.manipulator.elevationInfo)),n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==n||null==a)return;const o=n.manipulator.renderLocation,s=a.manipulator.renderLocation,r=null!=i?ie(i,o,s):M;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=b(x(De,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(n,a,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(n,a,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=n;a.next((e=>this._trackNumDragging(e))).next(ge(this.view,r)).next(R(this.view,r,t,s,e)).next(_e()).next(fe()).next((e=>this._perObjectManipulatorDragAction(Ne.ALL,e))).next((e=>(this._updateTranslateObjectTooltip(K.XY,e),e))).next((e=>{"end"===e.action&&this._resetTooltip()})),o.next((()=>this._onDragCancel(!n.metadata.deleting)))}}}_createEdgeOffsetPipeline(e,t,i){return(n,a,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);a.next((e=>this._trackNumDragging(e))).next(ge(this.view,n.elevationAlignedLocation)).next(r).next(z(this.view)).next(F(this.view,i.data.spatialReference)).next(fe()).next(He()).next((e=>this._pendingEdgeOffsetInfo?e:p(e))).next((e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()})),o.next((()=>{this._exitEdgeOffsetInputMode(),n.metadata.deleting||(l(),this._onDragCancel())}))}}_initializeEdgeOffset(e,t,i,n){const{view:a,object:o}=this,r=te(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),p=ee(a,e.manipulator.elevationAlignedLocation,r);let h;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),h=d(h)},c=this.events.on("undo",u);return h=s([this._initializeEdgeOffsetVisualElement(e,o,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,(()=>{n.execute({action:"cancel"})}))]),{initializeStep:e=>null==r||null==p?(u(),null):{...e,operation:r,plane:p},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,a){const o=()=>new V({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:a.data.spatialReference}),r=new pe({view:this.view,isDraped:t.isDraped,geometry:o(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),p=s([h((()=>({color:this._accentColor,draped:t.isDraped})),(({color:e,draped:t})=>{r.color=n(e),r.isDraped=t}),f),t.on("committed",(()=>{r.geometry=o()})),l(r)]);return r.attached=!0,p}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(Ce.RESHAPING),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftEdge?.leftVertex,n=e.handle.leftVertex,a=e.handle.rightVertex.rightEdge?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(n.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,n.pos)<Pe){const e=this._getManipulatorInfoFromHandle(n);null!=e&&l.push(e)}if(s.distance(n.pos,o.pos)<r||a&&s.distance(a.pos,o.pos)<Pe){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!je(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Ae).find((({manipulator:e})=>e.hovering||e.grabbing||e.dragging))}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:n}=i,a=te(t.data.coordinateHelper,e.handle,n);this._selectEdgeOffsetArrow(e,a),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,n,t),this._connectEdgeOffsetTooltip(e,a,t,(()=>{this.removeHandles(a),this._exitEdgeOffsetInputMode()}))],a)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??$(this.view.inputManager?.latestPointerLocation,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,n){const a=()=>this.tooltipInfos.edgeOffset.distance.actual,o=a=>{n(),queueMicrotask((()=>{this.view.focus();const n=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,ae(a,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),n.remove()}))},r=()=>{const e=a();null!=e?o(e):n()};return s([m((()=>this.tooltip&&!this.tooltip.focused),(()=>r()),g),this.tooltip.on("discard",n),this.tooltip.on("commit",(e=>{"commit-and-exit"===e.type&&r()}))])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const n=this.view,a=this._operations,o=this._settings;if(!a)return null;const r=a.data.type,l=a.data.spatialReference;if("edge"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=we(o.manipulators.vertex);this._vertexManipulatorGeometry=he(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=he(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=we(o.manipulators.edge);this._edgeManipulatorGeometry=he(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=he(this._edgeManipulatorOutlineMaterial,t,16,16)}const p="point"===r||"mesh"===r?[]:[new N(this._vertexManipulatorGeometry.instantiate(),Le.Vertex|Me.Unselected),new N(this._vertexManipulatorOutlineGeometry.instantiate(),Le.Vertex|Me.Unfocused|Me.Unselected),new N(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Le.Vertex|Me.Focused|Me.Unselected),new N(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),Me.Selected),new N(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),Me.Selected|Me.Unfocused),new N(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),Me.Selected|Me.Focused)];this.enableMidpoints&&p.push(new N(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),Le.Edge|Me.Focused|Me.Unselected),new N(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Le.Edge|Me.Focused|Me.Unselected),new N(this._edgeManipulatorGeometry.instantiate(),Le.Edge|Me.Unfocused|Me.Unselected),new N(this._edgeManipulatorOutlineGeometry.instantiate(),Le.Edge|Me.Unfocused|Me.Unselected));const h=new D({view:n,renderObjects:p,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:this.object.visible,metadata:{deleting:!1},location:Te(l)});h.selected=i,this._setTypeSpecificManipulatorSettings(h,e,t);const u="edge"===e.type?{manipulator:h,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:h,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(u),this.manipulators.add(h),this._updateManipulatorPosition(u),"edge"===u.type){const e=[];for(const t of[u.handle.leftVertex,u.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(u))))}u.locationUpdateHandle=s(e),this._manipulatorHandles.add(u.locationUpdateHandle,h)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(h,!0),h);const c=me(h,((e,i,o,s)=>{let r=null;const{snappingStep:p,cancelSnapping:h}=Oe({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new Ee({editGeometryOperations:a,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new k}),updatingHandles:this._updatingHandles,useZ:!1});o=o.next((t=>(this._onDragCancel(!e.metadata.deleting,(()=>r=d(r))),t))).next(h);const{elevationAlignedLocation:c}=e,f=this.object.graphic??void 0;i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&a&&(r=a.createUndoGroup()),"edge"===u.type){const t=this._splitEdgeManipulator(u);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:u,snapOrigin:u.handle.pos}})).next(ge(n,c)).next(R(n,c,t,l,f)).next(ce(n,t,f)).next(...p).next(fe()).next((e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=d(r)),this._resetTooltip()}))}));return this._manipulatorHandles.add([c,h.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,u))),h.events.on("select-changed",(()=>{u.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()})),h.events.on("focus-changed",(()=>{this._resetTooltip()}))],h),this.events.emit("manipulators-changed"),u}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._resetTooltip(),this._reshapeEventState){case Ce.NONE:break;case Ce.MOVING:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case Ce.RESHAPING:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(Ce.NONE)}_setTypeSpecificManipulatorSettings(e,t,i){const n=this._settings;switch(t.type){case"vertex":{e.state=Le.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:a}=n.manipulators.vertex;e.radius=t/2+a,e.elevationInfo=i;const o=this._operations?.data.type;e.interactive=null!=o&&"point"!==o&&"mesh"!==o;break}case"edge":{e.state=Le.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:a}=n.manipulators.edge;e.radius=t/2+a,e.elevationInfo="on-the-ground"!==i.mode||G(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",(i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)}))}_onGrabStateChanged(e,t,i,n="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(Ce.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==n||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,Ae(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)})),this._objectMoveManipulation.forEachManipulator((e=>{e.interactive=e.grabbing||!this._numGrabbing})))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){if(e)for(const t of this._manipulatorInfos)if(e===t.handle)return t;return null}_updateManipulatorPositions(e){for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ge),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==n)return;const a=i.manipulator,o=n.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=a.location,n=o.location,s=.5,r=i.x+s*(n.x-i.x),l=i.y+s*(n.y-i.y),p=i.hasZ&&n.hasZ?0:void 0;e.manipulator.location=A(r,l,p,t.data.spatialReference)}else E(De,a.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=De}}_splitEdgeManipulator(e,t=.5){const i=this._operations,n=i.splitEdge(e.handle,t).createdVertex;e.locationUpdateHandle=d(e.locationUpdateHandle);const a=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(n)):(o=e,o.handle=n,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,a)),n.leftEdge&&this._createVertexOrEdgeManipulator(n.leftEdge),n.rightEdge&&this._createVertexOrEdgeManipulator(n.rightEdge),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(Ce.RESHAPING),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.components.indexOf(n.component);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:n.index}],added:r}),s&&this._updateEventState(Ce.NONE),o}_updateMoveManipulationPosition(){const e=O(De,0,0,0);let t=0,i=!1,n=null,a=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,y(e,e,r.manipulator.renderLocation),null==n||r.selectedIndex>n.selectedIndex?(a=n,n=r):(null==a||r.selectedIndex>a.selectedIndex)&&(a=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&Y(this._operations,o.elevationInfo),this._moveManipulation.angle=Z(s),this._moveManipulation.radius=J.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&Y(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=n){const e=n.handle.pos,t=null!=a?a.handle.pos:n.handle.leftEdge?.leftVertex?n.handle.leftEdge.leftVertex.pos:null,o=null==a&&n.handle.rightEdge?.rightVertex?n.handle.rightEdge.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Ve(t,e):o&&(i=Ve(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=W}0!==t&&i?(j(e,e,1/t),Ge.spatialReference=this._operations.data.spatialReference,Ge.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ge),this._moveManipulation.elevationAlignedLocation=Ge):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?C(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(i){for(const n of e){const e=n.handle.component;if("vertex"===n.type&&i.canRemoveVertex(e)){t.push(n.handle),this._removeManipulator(n),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.rightEdge));const a=i.removeVertices([n.handle]),o=a.removedVertices?.[0].createdEdge;o?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.edges[0]))}}if(t.length>0){const e=t.map((e=>{const t=i.data.components.indexOf(e.component);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}})),n=this._updateEventState(Ce.RESHAPING);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map((e=>e.coordinates)),vertices:e}),this.destroyed)return;if(n&&(this._updateEventState(Ce.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}}_moveVertices(e,t,i=("start"===t.action?xe.NEW_STEP:xe.ACCUMULATE_STEPS)){const n=this._operations;if(n){e.length>0&&n.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i);for(const t of e)this._updateManipulatorPosition(t)}}_offsetEdge(e,t,i){if(!this._operations)return;const n=t.clone();n.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],n),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===ue.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===ue.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=re(e,t,this._tooltipsContext))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=le(this.object,e,this._tooltipsContext))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?le(this.object,null,this._tooltipsContext):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return 1===e.length?e[0]:null}get _tooltipsContext(){return{sketchOptions:this._sketchOptions,tooltipInfos:this.tooltipInfos,activeTooltipInfo:this.activeTooltipInfo,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks}}get test(){}};function He(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function we(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Ve(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function Te(e){return new w({x:0,y:0,z:0,spatialReference:e})}function Ae(e){return"edge"===e.type&&"edgeManipulator"in e}e([_()],Se.prototype,"_numGrabbing",void 0),e([_()],Se.prototype,"_numDragging",void 0),e([_()],Se.prototype,"_pendingEdgeOffsetInfo",void 0),e([_()],Se.prototype,"_operations",null),e([_()],Se.prototype,"_segmentLabels",void 0),e([_({constructOnly:!0})],Se.prototype,"tool",void 0),e([_()],Se.prototype,"tooltip",void 0),e([_()],Se.prototype,"activeTooltipInfo",void 0),e([_({readOnly:!0})],Se.prototype,"updating",null),e([_()],Se.prototype,"manipulators",null),e([_()],Se.prototype,"view",null),e([_()],Se.prototype,"object",null),e([_()],Se.prototype,"enableZShape",null),e([_()],Se.prototype,"enableDeleteVertices",null),e([_()],Se.prototype,"enableZVertex",null),e([_()],Se.prototype,"autoHideManipulators",null),e([_()],Se.prototype,"enableMoveObject",null),e([_()],Se.prototype,"enableMidpoints",null),e([_()],Se.prototype,"enableEdgeOffset",null),e([_()],Se.prototype,"_sketchOptions",null),e([_()],Se.prototype,"_accentColor",null),e([_()],Se.prototype,"_tooltipsContext",null),Se=e([v("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],Se);const Ge=A(0,0,void 0,T.WGS84),De=S(),Pe=1e-6;var Le,Ce,Ne;!function(e){e.Vertex=ve.Custom1,e.Edge=ve.Custom2}(Le||(Le={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(Ce||(Ce={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(Ne||(Ne={}));export{Se as ReshapeOperation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{watch as o,initial as a}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{containsXY as r}from"../../../../../geometry/support/aaBoundingRect.js";import{sm4d as l}from"../../../../../geometry/support/vectorStacks.js";import{calculateBoundedPlaneTranslateRotate as p,resizeNormal as h,resizeOutlineOnly as c}from"../../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as d}from"../../Manipulator3D.js";import{manipulatedObjectGeometry as u}from"../manipulatedObjectUtils.js";import{ManipulatorType as m}from"../ManipulatorType.js";import{canMoveZOperations as b}from"../manipulatorUtils.js";import{createVisualElements as v}from"../visualElementUtils.js";import{ExtentMove as _}from"./extentTransform/ExtentMove.js";import{ExtentRotate as f}from"./extentTransform/ExtentRotate.js";import{ExtentScale as g}from"./extentTransform/ExtentScale.js";import{TransformBounds as j}from"./extentTransform/extentUtils.js";import{PreserveAspectRatio as y}from"./extentTransform/PreserveAspectRatio.js";import{SnapRotation as M}from"./extentTransform/SnapRotation.js";import{OutlineVisualElement as R}from"../../visualElements/OutlineVisualElement.js";import{InteractiveToolBase as x}from"../../../../interactive/InteractiveToolBase.js";import E from"../../../../interactive/sketch/SketchOptions.js";import{makeTooltip as A}from"../../../../interactive/tooltip/Tooltip.js";let T=class extends x{get updating(){return!!this.object.updating}constructor(t){super(t),this.events=new e,this.enableZ=!0,this.enableScaling=!0,this.enableRotation=!0,this.sketchOptions=new E,this._preserveAspectRatio=new y,this._snapRotation=new M,this.grabbing=!1,this.inputState=null,this._attachmentOrigin=null,this.type="transform-3d",this._outlineVisualElement=null}initialize(){const{view:t,object:e}=this,s=this._bounds=new j(this,(()=>this._updateManipulators()));this._extentMove=new _(this,s),this._extentScale=new g(this,s,(()=>this._preserveAspectRatio.createDragEventPipelineStep())),this._extentRotate=new f(this,s,(()=>this._snapRotation.createDragEventPipelineStep())),this.addHandles([o((()=>this.enableZ),(()=>this._updateManipulatorAvailability(this._extentMove.moveZManipulator,m.TRANSLATE_Z))),o((()=>this.enableScaling),(()=>this._extentScale.forEachManipulator((t=>this._updateManipulatorAvailability(t,m.SCALE))))),o((()=>this.enableRotation),(()=>this._updateManipulatorAvailability(this._extentRotate.rotateManipulator,m.ROTATE)))]),this._updateManipulators(),this._updateAllManipulatorAvailability();const n=v({view:t,object:e,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>i()});if(null!=n){const{visualElement:t}=n;t instanceof R&&(this._outlineVisualElement=t,this.addHandles(t.events.on("attachment-origin-changed",(()=>this._bounds.updateDisplayBounds())))),this.addHandles(n)}this.addHandles([e.on("committed",(()=>this._onGeometryChanged())),o((()=>this.object.visible),(()=>this._updateAllManipulatorAvailability())),o((()=>this.object.isDraped),(()=>this._graphicDrapedChanged()),a),o((()=>t.pointsOfInterest?.centerOnSurfaceFrequent.location),(()=>s.updateDisplayBounds()))]);const r=t=>{this.addHandles(t.events.on("grab-changed",(()=>{this.grabbing=t.grabbing,this._updateAllManipulatorAvailability()})))};this._forEachManipulator(r);const l=(t,i)=>{this.addHandles(t.events.on("immediate-click",(t=>{i===m.TRANSLATE_XY&&this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()})))};this._forEachManipulator(l),this._initializeTooltip(),this.finishToolCreation()}destroy(){this._extentMove.destroy(),this._extentScale.destroy(),this._extentRotate.destroy(),this.tooltip.destroy(),this._set("view",null),this._set("object",null)}_initializeTooltip(){const{view:t}=this;this.tooltip=A((()=>({view:t,options:this.sketchOptions.tooltips})));const e=()=>{this.tooltip.info=this._getUpdatedTooltipInfo()};this.addHandles([o((()=>this.sketchOptions.tooltips.effectiveEnabled),e),o((()=>this.preserveAspectRatio),e)]),this._forEachManipulator((t=>{this.addHandles([t.events.on(["focus-changed","grab-changed"],e),t.events.on("drag",(t=>{"cancel"===t.action?this.tooltip.clear():e()}))])}))}_getUpdatedTooltipInfo(){return this.sketchOptions.tooltips.effectiveEnabled?this._extentMove.getUpdatedTooltipInfo()??this._extentScale.getUpdatedTooltipInfo()??this._extentRotate.getUpdatedTooltipInfo():null}_onGeometryChanged(){this._bounds.updateDisplayBounds()}_graphicDrapedChanged(){this.removeHandles(S),this._bounds.updateDisplayBounds(),this.object.isDraped&&this.addHandles(this.view.elevationProvider.on("elevation-change",(t=>{null!=this._attachmentOrigin&&r(t.extent,this._attachmentOrigin.x,this._attachmentOrigin.y)&&this._bounds.updateDisplayBounds()})),S)}_updateManipulators(){if(!this.visible)return;const t=this._bounds.displayBounds,e=p(t,l.get());this._extentMove.updateManipulators(e,t),this._extentScale.updateManipulators(e,t),this._extentRotate.updateManipulators(e,t)}_updateAllManipulatorAvailability(){this._forEachManipulator(((t,e)=>this._updateManipulatorAvailability(t,e)))}_updateManipulatorAvailability(t,e){const i=this.grabbing&&!t.grabbing;if(t.interactive=!i,t instanceof d){const o=this.object.visible,a=this.enableZ&&b(this.object.operations,this.object.elevationInfo);switch(e){case m.ROTATE:t.available=o&&this.enableRotation;break;case m.SCALE:t.available=o&&(this.enableScaling||this.enableRotation||a),t.interactive=!i&&this.enableScaling,t.state=this.enableScaling?h:c;break;case m.TRANSLATE_Z:t.available=o&&a;break;default:t.available=o}}}_forEachManipulator(t){this._extentMove.forEachManipulator(t),this._extentScale.forEachManipulator(t),this._extentRotate.forEachManipulator(t)}get preserveAspectRatio(){return this._preserveAspectRatio.enabled}set preserveAspectRatio(t){this._preserveAspectRatio.enabled=t,this._set("preserveAspectRatio",t)}get snapRotation(){return this._snapRotation.enabled}set snapRotation(t){this._snapRotation.enabled=t,this._set("snapRotation",t)}get attachmentOrigin(){const t=this.object.isDraped?null:this._outlineVisualElement?.attachmentOrigin;return this._attachmentOrigin=t??this.object.origin??u(this.object)?.extent?.center,this._attachmentOrigin}reset(){}cancel(){if(this.canUndo){const t=this.object.operations?.undo();t&&this._bounds.updateMapBoundsFromOperationInverse(t)}this.inputState=null}get canUndo(){return!!this.object.operations?.canUndo}undo(){if(null!=this.inputState)this.view.activeTool=null;else if(this.canUndo){const t=this.object.operations?.undo();t&&this._bounds.updateMapBoundsFromOperationInverse(t)}}get canRedo(){return!!this.object.operations?.canRedo}redo(){if(this.canRedo){const t=this.object.operations?.redo();t&&this._bounds.updateMapBoundsFromOperation(t)}}get test(){}};t([s()],T.prototype,"updating",null),t([s({constructOnly:!0,nonNullable:!0})],T.prototype,"view",void 0),t([s({constructOnly:!0,nonNullable:!0})],T.prototype,"object",void 0),t([s()],T.prototype,"enableZ",void 0),t([s()],T.prototype,"enableScaling",void 0),t([s()],T.prototype,"enableRotation",void 0),t([s({constructOnly:!0,type:E})],T.prototype,"sketchOptions",void 0),t([s()],T.prototype,"preserveAspectRatio",null),t([s()],T.prototype,"snapRotation",null),t([s()],T.prototype,"grabbing",void 0),t([s()],T.prototype,"inputState",void 0),t([s({readOnly:!0})],T.prototype,"type",void 0),t([s()],T.prototype,"tooltip",void 0),T=t([n("esri.views.3d.interactive.editingTools.transform.ExtentTransformTool")],T);const S="draped-elevation-changes";export{T as ExtentTransformTool};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{watch as o,initial as a}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{containsXY as r}from"../../../../../geometry/support/aaBoundingRect.js";import{sm4d as l}from"../../../../../geometry/support/vectorStacks.js";import{calculateBoundedPlaneTranslateRotate as p,resizeNormal as h,resizeOutlineOnly as c}from"../../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as d}from"../../Manipulator3D.js";import{manipulatedObjectGeometry as u}from"../manipulatedObjectUtils.js";import{ManipulatorType as m}from"../ManipulatorType.js";import{canMoveZOperations as b}from"../manipulatorUtils.js";import{createVisualElements as v}from"../visualElementUtils.js";import{ExtentMove as _}from"./extentTransform/ExtentMove.js";import{ExtentRotate as f}from"./extentTransform/ExtentRotate.js";import{ExtentScale as g}from"./extentTransform/ExtentScale.js";import{TransformBounds as j}from"./extentTransform/extentUtils.js";import{PreserveAspectRatio as y}from"./extentTransform/PreserveAspectRatio.js";import{SnapRotation as M}from"./extentTransform/SnapRotation.js";import{OutlineVisualElement as R}from"../../visualElements/OutlineVisualElement.js";import{InteractiveToolBase as x}from"../../../../interactive/InteractiveToolBase.js";import E from"../../../../interactive/sketch/SketchOptions.js";import{makeTooltip as A}from"../../../../interactive/tooltip/tooltipCommonUtils.js";let S=class extends x{get updating(){return!!this.object.updating}constructor(t){super(t),this.events=new e,this.enableZ=!0,this.enableScaling=!0,this.enableRotation=!0,this.sketchOptions=new E,this._preserveAspectRatio=new y,this._snapRotation=new M,this.grabbing=!1,this.inputState=null,this._attachmentOrigin=null,this.type="transform-3d",this._outlineVisualElement=null}initialize(){const{view:t,object:e}=this,s=this._bounds=new j(this,(()=>this._updateManipulators()));this._extentMove=new _(this,s),this._extentScale=new g(this,s,(()=>this._preserveAspectRatio.createDragEventPipelineStep())),this._extentRotate=new f(this,s,(()=>this._snapRotation.createDragEventPipelineStep())),this.addHandles([o((()=>this.enableZ),(()=>this._updateManipulatorAvailability(this._extentMove.moveZManipulator,m.TRANSLATE_Z))),o((()=>this.enableScaling),(()=>this._extentScale.forEachManipulator((t=>this._updateManipulatorAvailability(t,m.SCALE))))),o((()=>this.enableRotation),(()=>this._updateManipulatorAvailability(this._extentRotate.rotateManipulator,m.ROTATE)))]),this._updateManipulators(),this._updateAllManipulatorAvailability();const n=v({view:t,object:e,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>i()});if(null!=n){const{visualElement:t}=n;t instanceof R&&(this._outlineVisualElement=t,this.addHandles(t.events.on("attachment-origin-changed",(()=>this._bounds.updateDisplayBounds())))),this.addHandles(n)}this.addHandles([e.on("committed",(()=>this._onGeometryChanged())),o((()=>this.object.visible),(()=>this._updateAllManipulatorAvailability())),o((()=>this.object.isDraped),(()=>this._graphicDrapedChanged()),a),o((()=>t.pointsOfInterest?.centerOnSurfaceFrequent.location),(()=>s.updateDisplayBounds()))]);const r=t=>{this.addHandles(t.events.on("grab-changed",(()=>{this.grabbing=t.grabbing,this._updateAllManipulatorAvailability()})))};this._forEachManipulator(r);const l=(t,i)=>{this.addHandles(t.events.on("immediate-click",(t=>{i===m.TRANSLATE_XY&&this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()})))};this._forEachManipulator(l),this._initializeTooltip(),this.finishToolCreation()}destroy(){this._extentMove.destroy(),this._extentScale.destroy(),this._extentRotate.destroy(),this.tooltip.destroy(),this._set("view",null),this._set("object",null)}_initializeTooltip(){const{view:t}=this;this.tooltip=A((()=>({view:t,options:this.sketchOptions.tooltips})));const e=()=>{this.tooltip.info=this._getUpdatedTooltipInfo()};this.addHandles([o((()=>this.sketchOptions.tooltips.effectiveEnabled),e),o((()=>this.preserveAspectRatio),e)]),this._forEachManipulator((t=>{this.addHandles([t.events.on(["focus-changed","grab-changed"],e),t.events.on("drag",(t=>{"cancel"===t.action?this.tooltip.clear():e()}))])}))}_getUpdatedTooltipInfo(){return this.sketchOptions.tooltips.effectiveEnabled?this._extentMove.getUpdatedTooltipInfo()??this._extentScale.getUpdatedTooltipInfo()??this._extentRotate.getUpdatedTooltipInfo():null}_onGeometryChanged(){this._bounds.updateDisplayBounds()}_graphicDrapedChanged(){this.removeHandles(T),this._bounds.updateDisplayBounds(),this.object.isDraped&&this.addHandles(this.view.elevationProvider.on("elevation-change",(t=>{null!=this._attachmentOrigin&&r(t.extent,this._attachmentOrigin.x,this._attachmentOrigin.y)&&this._bounds.updateDisplayBounds()})),T)}_updateManipulators(){if(!this.visible)return;const t=this._bounds.displayBounds,e=p(t,l.get());this._extentMove.updateManipulators(e,t),this._extentScale.updateManipulators(e,t),this._extentRotate.updateManipulators(e,t)}_updateAllManipulatorAvailability(){this._forEachManipulator(((t,e)=>this._updateManipulatorAvailability(t,e)))}_updateManipulatorAvailability(t,e){const i=this.grabbing&&!t.grabbing;if(t.interactive=!i,t instanceof d){const o=this.object.visible,a=this.enableZ&&b(this.object.operations,this.object.elevationInfo);switch(e){case m.ROTATE:t.available=o&&this.enableRotation;break;case m.SCALE:t.available=o&&(this.enableScaling||this.enableRotation||a),t.interactive=!i&&this.enableScaling,t.state=this.enableScaling?h:c;break;case m.TRANSLATE_Z:t.available=o&&a;break;default:t.available=o}}}_forEachManipulator(t){this._extentMove.forEachManipulator(t),this._extentScale.forEachManipulator(t),this._extentRotate.forEachManipulator(t)}get preserveAspectRatio(){return this._preserveAspectRatio.enabled}set preserveAspectRatio(t){this._preserveAspectRatio.enabled=t,this._set("preserveAspectRatio",t)}get snapRotation(){return this._snapRotation.enabled}set snapRotation(t){this._snapRotation.enabled=t,this._set("snapRotation",t)}get attachmentOrigin(){const t=this.object.isDraped?null:this._outlineVisualElement?.attachmentOrigin;return this._attachmentOrigin=t??this.object.origin??u(this.object)?.extent?.center,this._attachmentOrigin}reset(){}cancel(){if(this.canUndo){const t=this.object.operations?.undo();t&&this._bounds.updateMapBoundsFromOperationInverse(t)}this.inputState=null}get canUndo(){return!!this.object.operations?.canUndo}undo(){if(null!=this.inputState)this.view.activeTool=null;else if(this.canUndo){const t=this.object.operations?.undo();t&&this._bounds.updateMapBoundsFromOperationInverse(t)}}get canRedo(){return!!this.object.operations?.canRedo}redo(){if(this.canRedo){const t=this.object.operations?.redo();t&&this._bounds.updateMapBoundsFromOperation(t)}}get test(){}};t([s()],S.prototype,"updating",null),t([s({constructOnly:!0,nonNullable:!0})],S.prototype,"view",void 0),t([s({constructOnly:!0,nonNullable:!0})],S.prototype,"object",void 0),t([s()],S.prototype,"enableZ",void 0),t([s()],S.prototype,"enableScaling",void 0),t([s()],S.prototype,"enableRotation",void 0),t([s({constructOnly:!0,type:E})],S.prototype,"sketchOptions",void 0),t([s()],S.prototype,"preserveAspectRatio",null),t([s()],S.prototype,"snapRotation",null),t([s()],S.prototype,"grabbing",void 0),t([s()],S.prototype,"inputState",void 0),t([s({readOnly:!0})],S.prototype,"type",void 0),t([s()],S.prototype,"tooltip",void 0),S=t([n("esri.views.3d.interactive.editingTools.transform.ExtentTransformTool")],S);const T="draped-elevation-changes";export{S as ExtentTransformTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as a}from"../../../../../core/colorUtils.js";import{cyclicalPI as o}from"../../../../../core/Cyclical.js";import i from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as s,rad2deg as n}from"../../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{createAngle as l,createScalar as c,createLength as p}from"../../../../../core/quantityUtils.js";import{when as h,initial as u,watch as d}from"../../../../../core/reactiveUtils.js";import{addFrameTask as m}from"../../../../../core/scheduling.js";import{createScreenPointArray as g}from"../../../../../core/screenUtils.js";import{property as f}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as _}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as v,fromScaling as b,multiply as D,scale as S,rotate as M}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as y}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as T,f as j,m as w,s as R,b as k,g as I}from"../../../../../chunks/vec32.js";import{clone as E,fromValues as O}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as A,create as F,getNormal as C}from"../../../../../geometry/support/plane.js";import{wrap as P,distance2 as U}from"../../../../../geometry/support/ray.js";import{sv3d as x,sm4d as L}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as z}from"../../Manipulator3D.js";import{calculateInputRotationTransform as N}from"../../manipulatorUtils.js";import{RenderObject as H}from"../../RenderObject.js";import{screenToRenderPlane as G}from"../dragEventPipeline3D.js";import{ManipulatorType as V}from"../ManipulatorType.js";import{ringIndicatorDelayMs as q,rotateIndicatorDirectionBuffer as B,scaleIndicatorDirectionBuffer as J,rotateIndicatorArrowPlacementPercentage as K,ringThickness as Q,dragThresholdPx as W,ringRadius as X,innerIndicatorRadius as Y,outerIndicatorRadius as Z,ringHeight as $,rotateIndicatorArrowTipRadius as tt,rotateIndicatorArrowTipLength as et,scaleIndicatorOffset1 as at,scaleIndicatorOffset2 as ot,indicatorThickness as it,geometrySegments as st,rotateIndicatorArcLength as nt,ringResetAnimationSpeedFactor as rt,scaleIndicatorArcLength as lt}from"../manipulations/config.js";import{CullFaceOptions as ct}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as pt,transformInPlace as ht,createPathExtrusionGeometry as ut}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as dt}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as mt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as gt}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as ft,ManipulatorStateFlags as _t}from"../../../../interactive/interfaces.js";import{makeTooltip as vt}from"../../../../interactive/tooltip/Tooltip.js";import{TransformAbsoluteTooltipInfo as bt}from"../../../../interactive/tooltip/infos/TransformAbsoluteTooltipInfo.js";import{TransformRotateTooltipInfo as Dt}from"../../../../interactive/tooltip/infos/TransformRotateTooltipInfo.js";import{TransformScaleTooltipInfo as St}from"../../../../interactive/tooltip/infos/TransformScaleTooltipInfo.js";var Mt;!function(t){t.ScaleIn=ft.Custom2,t.ScaleOut=ft.Custom3,t.RotateLeft=ft.Custom4,t.RotateRight=ft.Custom5,t.Unlocked=ft.Custom7,t.DelayedFocused=ft.Custom8,t.TouchInput=ft.Custom12}(Mt||(Mt={}));let yt=class extends e{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}get updating(){return!!this._activeAnimation}get tooltipEffectiveEnabled(){return this.sketchOptions.tooltips.effectiveEnabled&&this.tooltipEnabled}constructor(t){super(t),this.mode=null,this.tooltipEnabled=!0,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=q,this._absoluteTooltipInfo=null,this._scaleTooltipInfo=null,this._rotateTooltipInfo=null,this.events=new i,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this.adapter.scale:1}initialize(){this.tooltip=vt((()=>({view:this.tool.view,options:this.sketchOptions.tooltips}))),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([h((()=>!this.tooltipEffectiveEnabled),(()=>this.tooltip.clear()),u),d((()=>{const{adapter:t}=this,{info:e}=this.tooltip;return e===this._absoluteTooltipInfo&&this.getFocused()?[e,t.size,t.orientationClockwise]:[null]}),(([t])=>{t&&this._updateFocusTooltip()})),d((()=>{const{adapter:t}=this;return[t.angle,t.scale]}),(()=>this._updateManipulatorTransform()))])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this.tooltip=r(this.tooltip)}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=m({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=r(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,V.SCALE_ROTATE)}_createManipulator(){const t=this._createRingManipulator();this._ringManipulator=t,this.tool.manipulators.add(t);const e=this.tool.object,a=gt(t,((t,a,i)=>{this._scaleRotateDragData=null;const r=this.adapter.startInteraction(),l={mode:"none",origin:E(t.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=x.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(t.renderLocation,c),a.next(G(this.tool.view,A(t.renderLocation,c,F()))).next((t=>{const a=C(t.plane),i=N(t.renderStart,t.renderEnd,l.origin,a),c=o.shortestSignedDiff(l.angle,i);l.angleDir=s(l.angleDir+c,-B,B),l.angle=i;const p=Tt(l,t),h=p-this.adapter.scale;if(l.scaleDir=s(l.scaleDir+h,-J,J),this._onScaleChanged(),"none"===l.mode){const a=this.mode||jt(t,t.plane,l.origin,this.tool.view.state.camera);if(null!=a){switch(a){case"rotate":this.tool.events.emit("rotate-start",{object:e,angle:0}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]});break;case"scale":this.tool.events.emit("scale-start",{object:e,xScale:1,yScale:1}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]})}l.mode=a}}switch(l.mode){case"rotate":r.state.angle=l.initialAngle+i;break;case"scale":r.state.scale=p,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),t.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.events.emit("rotate",{object:e,angle:n(l.angle)});break;case"scale":this.tool.events.emit("scale",{object:e,xScale:p,yScale:p})}break;case"end":switch(l.mode){case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:n(l.angle)});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:p,yScale:p})}}return"end"===t.action&&(this.startAnimation(kt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),r.done()),t})).next(this._updateTooltipPipelineStep(l)),i.next((()=>{if(r.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:0});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:1,yScale:1})}this.startAnimation(kt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()}))}));this.addHandles([a,t.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(It(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),t.events.on("immediate-click",(t=>{t.stopPropagation()})),d((()=>this.tool.object.visible),(t=>this._ringManipulator.available=t),u)])}_updateTooltipPipelineStep(t){return e=>{const{sketchOptions:a}=this,{visualVariables:o}=a.tooltips;if(!this.tooltipEffectiveEnabled)return e;if("end"===e.action)return this._updateFocusTooltip(),e;const{tooltip:i}=this;switch(t.mode){case"scale":{i.info=this._scaleTooltipInfo??=new St({sketchOptions:a});const{size:t,scale:e}=this.adapter,s=o?.size,n=i.info;n.sketchOptions=a,n.scale=c(e),n.size=null!=t?p(t,"meters"):void 0,n.sizePrecision=Et(s?.valueType),n.sizeUnit=s?.unit;break}case"rotate":{i.info=this._rotateTooltipInfo??=new Dt({sketchOptions:a});const{orientationClockwise:t,relativeAngleClockwise:e}=this.adapter,s=o?.rotation,n=Et(s?.valueType),r=i.info;r.sketchOptions=a,r.rotation=null!=e?l(e,"radians","geographic"):void 0,r.rotationPrecision=n,r.rotationType=s?.rotationType??"geographic",r.orientation=null!=t?l(t,"radians","geographic"):void 0,r.orientationPrecision=n;break}}return e}}_updateFocusTooltip(){const{sketchOptions:t,tooltip:e}=this,{visualVariables:a}=t.tooltips;if(!this.tooltipEffectiveEnabled)return;if(this.getFocused()){const o=a?.rotation,i=a?.size,s=this.mode,{size:n,orientationClockwise:r}=this.adapter,c=null!=r&&(null==s||"rotate"===s),h=null!=n&&(null==s||"scale"===s);e.info=this._absoluteTooltipInfo??=new bt({sketchOptions:t});const u=e.info;u.sketchOptions=t,u.orientation=c?l(r,"radians","geographic"):void 0,u.orientationPrecision=Et(o?.valueType),u.rotationType=o?.rotationType??"geographic",u.size=h?p(n,"meters"):void 0,u.sizeUnit=i?.unit,u.sizePrecision=Et(i?.valueType)}else e.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(Mt.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){if(this._ringManipulator.updateStateEnabled(Mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(Mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(Mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(Mt.RotateLeft|Mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(Mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(Mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut|Mt.RotateLeft|Mt.RotateRight,!1)}_updateManipulatorTransform(){const t=v(L.get(),this.adapter.angle,O(0,0,1));if(null==t)return;const e=this.getScale(),a=b(L.get(),T(x.get(),e,e,e));this._ringManipulator.modelTransform=D(L.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const o=[],i=Math.ceil(st*(e-t)/(2*Math.PI));for(let s=0;s<i+1;s++){const n=t+s*(e-t)/i;o.push(O(a*Math.cos(n),a*Math.sin(n),0))}return o},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,$/2],[-t/2,$/2]],o=this._createMaterial(1),i=(t,e,i=o)=>ut(i,a(e),t,[],[],!1),s=e(X),n=i(s,Q),r={left:new Array,right:new Array},l=[];for(let w=0;w<2;w++){const e=w*Math.PI-Math.PI/4,a=Math.PI/2-nt,s=e+a,n=e+Math.PI/2-a,c=t(s,n,Y),p=i(c,it);l.push(c),l.push(t(s,n,Z-Q/2)),r.left.push(p),r.right.push(p.instantiate());for(let t=0;t<2;t++){const e=0===t,a=y();if(e){S(a,a,[1,-1,1]),M(a,a,-s,[0,0,1]);const t=Math.round(K*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{M(a,a,n,[0,0,1]);const t=Math.round((1-K)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const i=pt(o,et,0,tt,$);ht(i,a),(e?r.left:r.right).push(i)}}const c=[];for(let S=0;S<2;S++){const e=S*Math.PI-Math.PI/4,a=Math.PI/2-lt,o=e+a,s=e+Math.PI/2-a,n=t(o,s,Z);c.push(i(n,it))}const p=this._createMaterial(.66),h=this._createMaterial(.5),u=this._createMaterial(.33),d=e(X+at),m=e(X+ot),g=i(d,it,p),f=i(m,it,u),_=e(X-at),v=e(X-ot),b=i(_,it,p),D=i(v,it,u);let T=[new H(n,Mt.DelayedFocused),new H(n.instantiate({material:h}),_t.None)];this.mode&&"scale"!==this.mode||(T=T.concat([...c.map((t=>new H(t,Mt.DelayedFocused|Mt.Unlocked))),new H(g,Mt.DelayedFocused|Mt.ScaleIn),new H(f,Mt.DelayedFocused|Mt.ScaleIn),new H(b,Mt.DelayedFocused|Mt.ScaleOut),new H(D,Mt.DelayedFocused|Mt.ScaleOut)])),this.mode&&"rotate"!==this.mode||(T=T.concat([...r.right.map((t=>new H(t.instantiate(),Mt.DelayedFocused|Mt.Unlocked))),...r.left.map((t=>new H(t,Mt.DelayedFocused|Mt.RotateLeft))),...r.right.map((t=>new H(t,Mt.DelayedFocused|Mt.RotateRight)))]));const j=[s,...l];return new z({view:this.tool.view,renderObjects:T,autoScaleRenderObjects:!1,worldOriented:!0,radius:Q,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:"ribbon",paths:j,direction:O(0,0,1)}})}_createMaterial(t){const e=new mt({cullFace:ct.Back,renderOccluded:dt.Transparent,isDecoration:!0});return this.addHandles(d((()=>a(this.tool.view.effectiveTheme.accentColor,t)),(t=>e.setParameters({color:t})),u)),e}get test(){}};function Tt(t,e){const a=j(x.get(),e.renderStart,t.origin),o=j(x.get(),e.renderEnd,t.origin),i=w(a),s=w(o);return 0===i?0:s/i}function jt(t,e,a,o){const{renderStart:i,renderEnd:s}=t,n=wt(i,o,x.get()),r=wt(s,o,x.get());if(R(n,r)<W*W)return null;const l=j(x.get(),i,a),c=k(x.get(),l,C(e)),p=i,h=I(x.get(),p,c),u=wt(a,o,x.get()),d=n,m=wt(h,o,x.get()),g=j(x.get(),m,d),f=j(x.get(),n,u),_=P(d,g),v=P(u,f);return U(_,r)<U(v,r)?"rotate":"scale"}function wt(t,e,a){return e.projectToScreen(t,Ot),T(a,Ot[0],Ot[1],0)}var Rt;function kt(t,e){let a=null,o=1;const i=()=>o;return{start:()=>{o=t.getScale(),a=t.getScale,t.getScale=i,e()},update:t=>(o+=((o+1)/2-o)*Math.min(t*rt,1),e(),Math.abs(o-1)<.01?Rt.STOP:Rt.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function It(t,e,a){let o=0,i=null;const s=()=>!1;return{start:()=>{i=t.getFocused,t.getFocused=s,o=0,e()},update:t=>(o+=t,!i?.()||o>=a.delayMs?Rt.STOP:Rt.CONTINUE),destroy:()=>{i&&(t.getFocused=i),e()}}}function Et(t){switch(t){case"integer":case"long":return 0;default:return null}}t([f({constructOnly:!0})],yt.prototype,"tool",void 0),t([f({constructOnly:!0})],yt.prototype,"adapter",void 0),t([f({constructOnly:!0})],yt.prototype,"sketchOptions",void 0),t([f()],yt.prototype,"mode",void 0),t([f()],yt.prototype,"tooltipEnabled",void 0),t([f()],yt.prototype,"_activeAnimation",void 0),t([f()],yt.prototype,"updating",null),t([f()],yt.prototype,"tooltipEffectiveEnabled",null),yt=t([_("esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform")],yt),function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(Rt||(Rt={}));const Ot=g();export{yt as ScaleRotateTransform};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as a}from"../../../../../core/colorUtils.js";import{cyclicalPI as o}from"../../../../../core/Cyclical.js";import i from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as s,rad2deg as n}from"../../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{createAngle as l,createScalar as c,createLength as p}from"../../../../../core/quantityUtils.js";import{when as h,initial as u,watch as d}from"../../../../../core/reactiveUtils.js";import{addFrameTask as m}from"../../../../../core/scheduling.js";import{createScreenPointArray as g}from"../../../../../core/screenUtils.js";import{property as f}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as _}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as v,fromScaling as b,multiply as D,scale as S,rotate as M}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as y}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as T,f as j,m as w,s as R,b as k,g as I}from"../../../../../chunks/vec32.js";import{clone as E,fromValues as O}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as A,create as C,getNormal as F}from"../../../../../geometry/support/plane.js";import{wrap as P,distance2 as U}from"../../../../../geometry/support/ray.js";import{sv3d as x,sm4d as L}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as z}from"../../Manipulator3D.js";import{calculateInputRotationTransform as N}from"../../manipulatorUtils.js";import{RenderObject as H}from"../../RenderObject.js";import{screenToRenderPlane as G}from"../dragEventPipeline3D.js";import{ManipulatorType as V}from"../ManipulatorType.js";import{ringIndicatorDelayMs as q,rotateIndicatorDirectionBuffer as B,scaleIndicatorDirectionBuffer as J,rotateIndicatorArrowPlacementPercentage as K,ringThickness as Q,dragThresholdPx as W,ringRadius as X,innerIndicatorRadius as Y,outerIndicatorRadius as Z,ringHeight as $,rotateIndicatorArrowTipRadius as tt,rotateIndicatorArrowTipLength as et,scaleIndicatorOffset1 as at,scaleIndicatorOffset2 as ot,indicatorThickness as it,geometrySegments as st,rotateIndicatorArcLength as nt,ringResetAnimationSpeedFactor as rt,scaleIndicatorArcLength as lt}from"../manipulations/config.js";import{CullFaceOptions as ct}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as pt,transformInPlace as ht,createPathExtrusionGeometry as ut}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as dt}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as mt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as gt}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as ft,ManipulatorStateFlags as _t}from"../../../../interactive/interfaces.js";import{makeTooltip as vt}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{TransformAbsoluteTooltipInfo as bt}from"../../../../interactive/tooltip/infos/TransformAbsoluteTooltipInfo.js";import{TransformRotateTooltipInfo as Dt}from"../../../../interactive/tooltip/infos/TransformRotateTooltipInfo.js";import{TransformScaleTooltipInfo as St}from"../../../../interactive/tooltip/infos/TransformScaleTooltipInfo.js";var Mt;!function(t){t.ScaleIn=ft.Custom2,t.ScaleOut=ft.Custom3,t.RotateLeft=ft.Custom4,t.RotateRight=ft.Custom5,t.Unlocked=ft.Custom7,t.DelayedFocused=ft.Custom8,t.TouchInput=ft.Custom12}(Mt||(Mt={}));let yt=class extends e{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}get updating(){return!!this._activeAnimation}get tooltipEffectiveEnabled(){return this.sketchOptions.tooltips.effectiveEnabled&&this.tooltipEnabled}constructor(t){super(t),this.mode=null,this.tooltipEnabled=!0,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=q,this._absoluteTooltipInfo=null,this._scaleTooltipInfo=null,this._rotateTooltipInfo=null,this.events=new i,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this.adapter.scale:1}initialize(){this.tooltip=vt((()=>({view:this.tool.view,options:this.sketchOptions.tooltips}))),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([h((()=>!this.tooltipEffectiveEnabled),(()=>this.tooltip.clear()),u),d((()=>{const{adapter:t}=this,{info:e}=this.tooltip;return e===this._absoluteTooltipInfo&&this.getFocused()?[e,t.size,t.orientationClockwise]:[null]}),(([t])=>{t&&this._updateFocusTooltip()})),d((()=>{const{adapter:t}=this;return[t.angle,t.scale]}),(()=>this._updateManipulatorTransform()))])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this.tooltip=r(this.tooltip)}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=m({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=r(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,V.SCALE_ROTATE)}_createManipulator(){const t=this._createRingManipulator();this._ringManipulator=t,this.tool.manipulators.add(t);const e=this.tool.object,a=gt(t,((t,a,i)=>{this._scaleRotateDragData=null;const r=this.adapter.startInteraction(),l={mode:"none",origin:E(t.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=x.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(t.renderLocation,c),a.next(G(this.tool.view,A(t.renderLocation,c,C()))).next((t=>{const a=F(t.plane),i=N(t.renderStart,t.renderEnd,l.origin,a),c=o.shortestSignedDiff(l.angle,i);l.angleDir=s(l.angleDir+c,-B,B),l.angle=i;const p=Tt(l,t),h=p-this.adapter.scale;if(l.scaleDir=s(l.scaleDir+h,-J,J),this._onScaleChanged(),"none"===l.mode){const a=this.mode||jt(t,t.plane,l.origin,this.tool.view.state.camera);if(null!=a){switch(a){case"rotate":this.tool.events.emit("rotate-start",{object:e,angle:0}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]});break;case"scale":this.tool.events.emit("scale-start",{object:e,xScale:1,yScale:1}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]})}l.mode=a}}switch(l.mode){case"rotate":r.state.angle=l.initialAngle+i;break;case"scale":r.state.scale=p,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),t.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.events.emit("rotate",{object:e,angle:n(l.angle)});break;case"scale":this.tool.events.emit("scale",{object:e,xScale:p,yScale:p})}break;case"end":switch(l.mode){case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:n(l.angle)});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:p,yScale:p})}}return"end"===t.action&&(this.startAnimation(kt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),r.done()),t})).next(this._updateTooltipPipelineStep(l)),i.next((()=>{if(r.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:0});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:1,yScale:1})}this.startAnimation(kt(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()}))}));this.addHandles([a,t.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(It(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),t.events.on("immediate-click",(t=>{t.stopPropagation()})),d((()=>this.tool.object.visible),(t=>this._ringManipulator.available=t),u)])}_updateTooltipPipelineStep(t){return e=>{const{sketchOptions:a}=this,{visualVariables:o}=a.tooltips;if(!this.tooltipEffectiveEnabled)return e;if("end"===e.action)return this._updateFocusTooltip(),e;const{tooltip:i}=this;switch(t.mode){case"scale":{i.info=this._scaleTooltipInfo??=new St({sketchOptions:a});const{size:t,scale:e}=this.adapter,s=o?.size,n=i.info;n.sketchOptions=a,n.scale=c(e),n.size=null!=t?p(t,"meters"):void 0,n.sizePrecision=Et(s?.valueType),n.sizeUnit=s?.unit;break}case"rotate":{i.info=this._rotateTooltipInfo??=new Dt({sketchOptions:a});const{orientationClockwise:t,relativeAngleClockwise:e}=this.adapter,s=o?.rotation,n=Et(s?.valueType),r=i.info;r.sketchOptions=a,r.rotation=null!=e?l(e,"radians","geographic"):void 0,r.rotationPrecision=n,r.rotationType=s?.rotationType??"geographic",r.orientation=null!=t?l(t,"radians","geographic"):void 0,r.orientationPrecision=n;break}}return e}}_updateFocusTooltip(){const{sketchOptions:t,tooltip:e}=this,{visualVariables:a}=t.tooltips;if(!this.tooltipEffectiveEnabled)return;if(this.getFocused()){const o=a?.rotation,i=a?.size,s=this.mode,{size:n,orientationClockwise:r}=this.adapter,c=null!=r&&(null==s||"rotate"===s),h=null!=n&&(null==s||"scale"===s);e.info=this._absoluteTooltipInfo??=new bt({sketchOptions:t});const u=e.info;u.sketchOptions=t,u.orientation=c?l(r,"radians","geographic"):void 0,u.orientationPrecision=Et(o?.valueType),u.rotationType=o?.rotationType??"geographic",u.size=h?p(n,"meters"):void 0,u.sizeUnit=i?.unit,u.sizePrecision=Et(i?.valueType)}else e.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(Mt.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){if(this._ringManipulator.updateStateEnabled(Mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(Mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(Mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(Mt.RotateLeft|Mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(Mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(Mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut|Mt.RotateLeft|Mt.RotateRight,!1)}_updateManipulatorTransform(){const t=v(L.get(),this.adapter.angle,O(0,0,1));if(null==t)return;const e=this.getScale(),a=b(L.get(),T(x.get(),e,e,e));this._ringManipulator.modelTransform=D(L.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const o=[],i=Math.ceil(st*(e-t)/(2*Math.PI));for(let s=0;s<i+1;s++){const n=t+s*(e-t)/i;o.push(O(a*Math.cos(n),a*Math.sin(n),0))}return o},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,$/2],[-t/2,$/2]],o=this._createMaterial(1),i=(t,e,i=o)=>ut(i,a(e),t,[],[],!1),s=e(X),n=i(s,Q),r={left:new Array,right:new Array},l=[];for(let w=0;w<2;w++){const e=w*Math.PI-Math.PI/4,a=Math.PI/2-nt,s=e+a,n=e+Math.PI/2-a,c=t(s,n,Y),p=i(c,it);l.push(c),l.push(t(s,n,Z-Q/2)),r.left.push(p),r.right.push(p.instantiate());for(let t=0;t<2;t++){const e=0===t,a=y();if(e){S(a,a,[1,-1,1]),M(a,a,-s,[0,0,1]);const t=Math.round(K*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{M(a,a,n,[0,0,1]);const t=Math.round((1-K)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const i=pt(o,et,0,tt,$);ht(i,a),(e?r.left:r.right).push(i)}}const c=[];for(let S=0;S<2;S++){const e=S*Math.PI-Math.PI/4,a=Math.PI/2-lt,o=e+a,s=e+Math.PI/2-a,n=t(o,s,Z);c.push(i(n,it))}const p=this._createMaterial(.66),h=this._createMaterial(.5),u=this._createMaterial(.33),d=e(X+at),m=e(X+ot),g=i(d,it,p),f=i(m,it,u),_=e(X-at),v=e(X-ot),b=i(_,it,p),D=i(v,it,u);let T=[new H(n,Mt.DelayedFocused),new H(n.instantiate({material:h}),_t.None)];this.mode&&"scale"!==this.mode||(T=T.concat([...c.map((t=>new H(t,Mt.DelayedFocused|Mt.Unlocked))),new H(g,Mt.DelayedFocused|Mt.ScaleIn),new H(f,Mt.DelayedFocused|Mt.ScaleIn),new H(b,Mt.DelayedFocused|Mt.ScaleOut),new H(D,Mt.DelayedFocused|Mt.ScaleOut)])),this.mode&&"rotate"!==this.mode||(T=T.concat([...r.right.map((t=>new H(t.instantiate(),Mt.DelayedFocused|Mt.Unlocked))),...r.left.map((t=>new H(t,Mt.DelayedFocused|Mt.RotateLeft))),...r.right.map((t=>new H(t,Mt.DelayedFocused|Mt.RotateRight)))]));const j=[s,...l];return new z({view:this.tool.view,renderObjects:T,autoScaleRenderObjects:!1,worldOriented:!0,radius:Q,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:"ribbon",paths:j,direction:O(0,0,1)}})}_createMaterial(t){const e=new mt({cullFace:ct.Back,renderOccluded:dt.Transparent,isDecoration:!0});return this.addHandles(d((()=>a(this.tool.view.effectiveTheme.accentColor,t)),(t=>e.setParameters({color:t})),u)),e}get test(){}};function Tt(t,e){const a=j(x.get(),e.renderStart,t.origin),o=j(x.get(),e.renderEnd,t.origin),i=w(a),s=w(o);return 0===i?0:s/i}function jt(t,e,a,o){const{renderStart:i,renderEnd:s}=t,n=wt(i,o,x.get()),r=wt(s,o,x.get());if(R(n,r)<W*W)return null;const l=j(x.get(),i,a),c=k(x.get(),l,F(e)),p=i,h=I(x.get(),p,c),u=wt(a,o,x.get()),d=n,m=wt(h,o,x.get()),g=j(x.get(),m,d),f=j(x.get(),n,u),_=P(d,g),v=P(u,f);return U(_,r)<U(v,r)?"rotate":"scale"}function wt(t,e,a){return e.projectToScreen(t,Ot),T(a,Ot[0],Ot[1],0)}var Rt;function kt(t,e){let a=null,o=1;const i=()=>o;return{start:()=>{o=t.getScale(),a=t.getScale,t.getScale=i,e()},update:t=>(o+=((o+1)/2-o)*Math.min(t*rt,1),e(),Math.abs(o-1)<.01?Rt.STOP:Rt.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function It(t,e,a){let o=0,i=null;const s=()=>!1;return{start:()=>{i=t.getFocused,t.getFocused=s,o=0,e()},update:t=>(o+=t,!i?.()||o>=a.delayMs?Rt.STOP:Rt.CONTINUE),destroy:()=>{i&&(t.getFocused=i),e()}}}function Et(t){switch(t){case"integer":case"long":return 0;default:return null}}t([f({constructOnly:!0})],yt.prototype,"tool",void 0),t([f({constructOnly:!0})],yt.prototype,"adapter",void 0),t([f({constructOnly:!0})],yt.prototype,"sketchOptions",void 0),t([f()],yt.prototype,"mode",void 0),t([f()],yt.prototype,"tooltipEnabled",void 0),t([f()],yt.prototype,"_activeAnimation",void 0),t([f()],yt.prototype,"updating",null),t([f()],yt.prototype,"tooltipEffectiveEnabled",null),yt=t([_("esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform")],yt),function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(Rt||(Rt={}));const Ot=g();export{yt as ScaleRotateTransform};