@arcgis/core 5.1.0-next.74 → 5.1.0-next.75

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 (253) hide show
  1. package/arcade/ArcadePortal.js +1 -1
  2. package/arcade/functions/aiServices.js +1 -1
  3. package/arcade/functions/featuresetbase.js +1 -1
  4. package/arcade/functions/geomasync.js +1 -1
  5. package/arcade/functions/knowledgegraph.js +1 -1
  6. package/arcade/functions/string.js +1 -1
  7. package/arcade/languageUtils.js +1 -1
  8. package/arcade/portalUtils.js +1 -1
  9. package/assets/esri/core/workers/RemoteClient.js +1 -1
  10. package/assets/esri/core/workers/chunks/07aca5ecad659d55e795.js +2 -0
  11. package/assets/esri/core/workers/chunks/09630888267cde87654f.js +1 -0
  12. package/assets/esri/core/workers/chunks/0fa207c68dfd7ddee160.js +1 -0
  13. package/assets/esri/core/workers/chunks/146424b5717d0a645ee1.js +1 -0
  14. package/assets/esri/core/workers/chunks/{d00dafad202450e6ee2e.js → 14eb2cc8e2ad6d8d03fd.js} +1 -1
  15. package/assets/esri/core/workers/chunks/1765dfeac20e34ce25b7.js +1 -0
  16. package/assets/esri/core/workers/chunks/176dd195f77b98cb0b0f.js +1 -0
  17. package/assets/esri/core/workers/chunks/1906416c84bab369bbd6.js +1 -0
  18. package/assets/esri/core/workers/chunks/{b98c24229463029504e8.js → 1f6b7626f333809837ef.js} +1 -1
  19. package/assets/esri/core/workers/chunks/1ff3c15a51c4dc991806.js +1 -0
  20. package/assets/esri/core/workers/chunks/2a2e97918524e0f436d7.js +1 -0
  21. package/assets/esri/core/workers/chunks/2b0b398180ed98c2c84c.js +1 -0
  22. package/assets/esri/core/workers/chunks/{bab23b905678e42815e5.js → 312036c89a6a09bb06c2.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{37091cf498a16ccad7ff.js → 330b47ac0759c3c35cc5.js} +1 -1
  24. package/assets/esri/core/workers/chunks/34b6b5dd415c68f0b0d1.js +1 -0
  25. package/assets/esri/core/workers/chunks/{a270960d80d8344dd75f.js → 34ea3ed78041437a8fc8.js} +1 -1
  26. package/assets/esri/core/workers/chunks/384c235d36f32769e32b.js +1 -0
  27. package/assets/esri/core/workers/chunks/3a183259805638c25363.js +1 -0
  28. package/assets/esri/core/workers/chunks/{deaca3cd202851ecf9c2.js → 3cce9dad8ee0e4971d50.js} +1 -1
  29. package/assets/esri/core/workers/chunks/3efbb684c0409955186d.js +1 -0
  30. package/assets/esri/core/workers/chunks/40d251b6b42a41d68bd2.js +1 -0
  31. package/assets/esri/core/workers/chunks/42336e0d1ef88737b078.js +1 -0
  32. package/assets/esri/core/workers/chunks/47b3a5213539548ff3a6.js +1 -0
  33. package/assets/esri/core/workers/chunks/4a23b27bfbcfa08fd9a7.js +1 -0
  34. package/assets/esri/core/workers/chunks/52b3a11c962810bc6dbe.js +1 -0
  35. package/assets/esri/core/workers/chunks/53750e85f3128993a43a.js +1 -0
  36. package/assets/esri/core/workers/chunks/{4bbe684050b3b04681d0.js → 537fe2522dff1e6ce03b.js} +1 -1
  37. package/assets/esri/core/workers/chunks/55fd201ca5e10c6e4761.js +1 -0
  38. package/assets/esri/core/workers/chunks/56941e8bbd2d49bf2656.js +1 -0
  39. package/assets/esri/core/workers/chunks/5d8e944b192aad4cf986.js +1 -0
  40. package/assets/esri/core/workers/chunks/{5476c2f7b83f4ccd0335.js → 5e1b847b116d21908a54.js} +1 -1
  41. package/assets/esri/core/workers/chunks/5ed8d8b5336c81fbcda3.js +1 -0
  42. package/assets/esri/core/workers/chunks/60915a3708a34da1977e.js +1 -0
  43. package/assets/esri/core/workers/chunks/61c523dd9d8027922465.js +1 -0
  44. package/assets/esri/core/workers/chunks/65c61171e6c6be5c5c2f.js +1 -0
  45. package/assets/esri/core/workers/chunks/6a3d207308b29651f397.js +1 -0
  46. package/assets/esri/core/workers/chunks/6c35583707f5c339ee99.js +1 -0
  47. package/assets/esri/core/workers/chunks/702e8468836863abd81b.js +1 -0
  48. package/assets/esri/core/workers/chunks/7540f7df86620f067b5a.js +1 -0
  49. package/assets/esri/core/workers/chunks/76e34f81bb4a7b0e694c.js +1 -0
  50. package/assets/esri/core/workers/chunks/7b6c8be59ed87e386aa4.js +1 -0
  51. package/assets/esri/core/workers/chunks/7c820c5f6f05480d5050.js +1 -0
  52. package/assets/esri/core/workers/chunks/80f4f686ce403cb2693f.js +1 -0
  53. package/assets/esri/core/workers/chunks/852f4cd514008fee5a55.js +1 -0
  54. package/assets/esri/core/workers/chunks/8a3bff0f58483c1665f9.js +1 -0
  55. package/assets/esri/core/workers/chunks/8b046e28f879079caada.js +1 -0
  56. package/assets/esri/core/workers/chunks/8d738e9acc2f222235ea.js +1 -0
  57. package/assets/esri/core/workers/chunks/9103eb0b9078019d3a26.js +1 -0
  58. package/assets/esri/core/workers/chunks/915e2711d3a2cfa402b2.js +1 -0
  59. package/assets/esri/core/workers/chunks/91f9e0e3662d4bf9f163.js +1 -0
  60. package/assets/esri/core/workers/chunks/99c161fecae710b53b40.js +1 -0
  61. package/assets/esri/core/workers/chunks/99d298d0039c536fcf3e.js +1 -0
  62. package/assets/esri/core/workers/chunks/9a5ef33d99a8f89956ff.js +1 -0
  63. package/assets/esri/core/workers/chunks/9d10db72e342fe63c981.js +1 -0
  64. package/assets/esri/core/workers/chunks/{a36761e3122f70fbb3c9.js → 9d6491f996eeb0c646ed.js} +1 -1
  65. package/assets/esri/core/workers/chunks/a015c2f54eb91e43a1f4.js +1 -0
  66. package/assets/esri/core/workers/chunks/a242ec19a7508de436da.js +1 -0
  67. package/assets/esri/core/workers/chunks/a320998f18922a35899f.js +1 -0
  68. package/assets/esri/core/workers/chunks/a7f9f478bd1493fc3c76.js +1 -0
  69. package/assets/esri/core/workers/chunks/aac6a57edd7494125204.js +1 -0
  70. package/assets/esri/core/workers/chunks/b73c146d3e550eaf07eb.js +1 -0
  71. package/assets/esri/core/workers/chunks/b7af0e6b9aadbcaf6a0b.js +1 -0
  72. package/assets/esri/core/workers/chunks/b803e7b0d489bb628d72.js +1 -0
  73. package/assets/esri/core/workers/chunks/baeb96aef03d4c566af7.js +1 -0
  74. package/assets/esri/core/workers/chunks/bc75ab48f4c7609ef09d.js +1 -0
  75. package/assets/esri/core/workers/chunks/bc78937986854e500b8e.js +1 -0
  76. package/assets/esri/core/workers/chunks/bd10d21545bca9a49de0.js +1 -0
  77. package/assets/esri/core/workers/chunks/{b905e637a67fbb7af4ae.js → bf8f603848bad4a7deb4.js} +1 -1
  78. package/assets/esri/core/workers/chunks/bfe575da727ce7c8d331.js +2 -0
  79. package/assets/esri/core/workers/chunks/c31ee5617c61a933cb0e.js +1 -0
  80. package/assets/esri/core/workers/chunks/cb45e5d4a4ef82cda583.js +1 -0
  81. package/assets/esri/core/workers/chunks/ce7ef7c4ca14d66d96f6.js +1 -0
  82. package/assets/esri/core/workers/chunks/{5b324e572737a308500d.js → cf14b3a44705dacefac4.js} +1 -1
  83. package/assets/esri/core/workers/chunks/d3b086eb9aa8c7d09048.js +1 -0
  84. package/assets/esri/core/workers/chunks/d55cef8199b8246fea3f.js +1 -0
  85. package/assets/esri/core/workers/chunks/d8decaee2c780e1b5e35.js +1 -0
  86. package/assets/esri/core/workers/chunks/{41809c16544ec25120fa.js → d95ffd990b3a7df69e1e.js} +1 -1
  87. package/assets/esri/core/workers/chunks/dc54d4a9fe1691862356.js +1 -0
  88. package/assets/esri/core/workers/chunks/dda2cb5c073d1e65f14f.js +1 -0
  89. package/assets/esri/core/workers/chunks/e18badd11f360cc2912b.js +1 -0
  90. package/assets/esri/core/workers/chunks/{ad064583f8a836005098.js → e262c4864dc06c43b380.js} +1 -1
  91. package/assets/esri/core/workers/chunks/e610d24539a675fb054b.js +1 -0
  92. package/assets/esri/core/workers/chunks/e9c5c295b6bf10e942a4.js +1 -0
  93. package/assets/esri/core/workers/chunks/ea59b81299acaf0d85ee.js +1 -0
  94. package/assets/esri/core/workers/chunks/{873c1b705ac3d4e6c384.js → ea97619a4470f1540b99.js} +1 -1
  95. package/assets/esri/core/workers/chunks/eaab5ac049622986e3bc.js +1 -0
  96. package/assets/esri/core/workers/chunks/edee616b6f1b5be8fd39.js +1 -0
  97. package/assets/esri/core/workers/chunks/ef0085aa743b33cb549f.js +1 -0
  98. package/assets/esri/core/workers/chunks/f0250cecb243b32cdba7.js +1 -0
  99. package/assets/esri/core/workers/chunks/f518835b2dc89a48cfb1.js +1 -0
  100. package/assets/esri/core/workers/chunks/f6c8e93ca2987e83f925.js +1 -0
  101. package/assets/esri/themes/base/widgets/_Sketch.scss +32 -0
  102. package/assets/esri/themes/dark/main.css +1 -1
  103. package/assets/esri/themes/light/main.css +1 -1
  104. package/assets/esri/themes/light/view.css +1 -1
  105. package/assets/esri/widgets/Sketch/t9n/Sketch.json +1 -1
  106. package/assets/esri/widgets/Sketch/t9n/Sketch_en.json +1 -1
  107. package/chunks/MultiPathImpl.js +1 -1
  108. package/chunks/Point2D.js +1 -1
  109. package/chunks/SpatialReference.js +1 -1
  110. package/chunks/aiServices.js +1 -1
  111. package/chunks/languageUtils.js +1 -1
  112. package/config.js +1 -1
  113. package/core/workers/registry.js +1 -1
  114. package/form/elements/AttachmentElement.d.ts +15 -16
  115. package/form/elements/GroupElement.d.ts +3 -2
  116. package/form/elements/inputs/attachments/AttachmentInput.d.ts +7 -9
  117. package/form/elements/inputs/attachments/AudioInput.d.ts +6 -8
  118. package/form/elements/inputs/attachments/DocumentInput.d.ts +5 -7
  119. package/form/elements/inputs/attachments/ImageInput.d.ts +6 -8
  120. package/form/elements/inputs/attachments/Input.d.ts +2 -6
  121. package/form/elements/inputs/attachments/SignatureInput.d.ts +5 -7
  122. package/form/elements/inputs/attachments/VideoInput.d.ts +6 -8
  123. package/form/elements/inputs/attachments/types.d.ts +3 -3
  124. package/geometry/FlatGeometry.js +1 -1
  125. package/geometry/operators/projectOperator.js +1 -1
  126. package/graphic/ImageryGraphicOrigin.js +1 -1
  127. package/graphic/ImageryTileGraphicOrigin.js +1 -1
  128. package/graphic/WCSGraphicOrigin.js +1 -1
  129. package/kernel.js +1 -1
  130. package/layers/mixins/ArcGISImageService.js +1 -1
  131. package/package.json +4 -4
  132. package/popup/Features.js +1 -1
  133. package/support/revision.js +1 -1
  134. package/symbols/cim/CIMSymbolHelper.js +1 -1
  135. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  136. package/symbols/support/previewCIMSymbol.js +1 -1
  137. package/views/2d/analysis/AreaMeasurement/AreaMeasurementController.js +1 -1
  138. package/views/2d/engine/webgl/TextureManager.js +1 -1
  139. package/views/2d/layers/MediaLayerView2D.js +1 -1
  140. package/views/2d/layers/TileLayerView2D.js +1 -1
  141. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  142. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  143. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  144. package/views/3d/analysis/Dimension/DimensionController.js +1 -1
  145. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  146. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  147. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  148. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  149. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
  150. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  151. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  152. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  153. package/views/VideoView.js +1 -1
  154. package/views/draw/DrawGraphicTool.js +1 -1
  155. package/views/draw/DrawTool.js +1 -1
  156. package/views/draw/support/Box.js +1 -1
  157. package/views/draw/support/Reshape.js +1 -1
  158. package/views/draw/support/managers/MeasurementManager.js +1 -1
  159. package/views/interactive/SegmentLabels.js +1 -1
  160. package/views/interactive/snapping/SelfSnappingEngine.js +1 -1
  161. package/views/support/GeometryWorker.js +2 -0
  162. package/views/support/GeometryWorkerHandle.js +2 -0
  163. package/widgets/FeatureTable/FeatureTableViewModel.d.ts +1 -3
  164. package/widgets/FeatureTable/Grid/GridViewModel.d.ts +2 -11
  165. package/widgets/FeatureTable/support/types.d.ts +2 -1
  166. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.d.ts +28 -0
  167. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
  168. package/widgets/OrientedImageryViewer.d.ts +27 -0
  169. package/widgets/Sketch/SketchViewModel.d.ts +10 -2
  170. package/widgets/Sketch/SketchViewModel.js +1 -1
  171. package/widgets/Sketch/support/ResponsiveToolbar/MeasuredContentGroup.js +1 -1
  172. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  173. package/widgets/Sketch.js +1 -1
  174. package/assets/esri/core/workers/chunks/00bae4b7e179336e0362.js +0 -1
  175. package/assets/esri/core/workers/chunks/041c372e98a6fba90b36.js +0 -1
  176. package/assets/esri/core/workers/chunks/0783890816bac45277b9.js +0 -1
  177. package/assets/esri/core/workers/chunks/07aac6245a0d1adbb2d4.js +0 -1
  178. package/assets/esri/core/workers/chunks/1286f41f245ef22b3a26.js +0 -1
  179. package/assets/esri/core/workers/chunks/12e575a6d2b008b8fc2b.js +0 -1
  180. package/assets/esri/core/workers/chunks/161d60fdac2013c15543.js +0 -1
  181. package/assets/esri/core/workers/chunks/168de44a789d1cecc1f8.js +0 -1
  182. package/assets/esri/core/workers/chunks/1d9d7915cf7449e5d468.js +0 -1
  183. package/assets/esri/core/workers/chunks/1db1656a033f3992f0d6.js +0 -1
  184. package/assets/esri/core/workers/chunks/235cb82952a18ff8d206.js +0 -1
  185. package/assets/esri/core/workers/chunks/27b80c386cebadcaca3c.js +0 -1
  186. package/assets/esri/core/workers/chunks/29d3890a5a43d934067a.js +0 -1
  187. package/assets/esri/core/workers/chunks/2f17438d215bea3ce70f.js +0 -1
  188. package/assets/esri/core/workers/chunks/356cb86606b8c674f947.js +0 -1
  189. package/assets/esri/core/workers/chunks/398e0dd2bc7e1ab84831.js +0 -1
  190. package/assets/esri/core/workers/chunks/3b1052aa30af3f6186cc.js +0 -1
  191. package/assets/esri/core/workers/chunks/3e87e3ad857d72f6ecbb.js +0 -1
  192. package/assets/esri/core/workers/chunks/42e483fde18f12da32a6.js +0 -1
  193. package/assets/esri/core/workers/chunks/43ab44d37bc0ea97ef98.js +0 -1
  194. package/assets/esri/core/workers/chunks/488ed9584b527ec47be3.js +0 -1
  195. package/assets/esri/core/workers/chunks/4ad32580e0c0699fde1f.js +0 -1
  196. package/assets/esri/core/workers/chunks/4c13869d260a902d3014.js +0 -1
  197. package/assets/esri/core/workers/chunks/54ed37ec9682ea739deb.js +0 -1
  198. package/assets/esri/core/workers/chunks/5511e640e171c294f52a.js +0 -2
  199. package/assets/esri/core/workers/chunks/55369c5bd65bcaf78da1.js +0 -1
  200. package/assets/esri/core/workers/chunks/56fd3da911c2c4511e5d.js +0 -1
  201. package/assets/esri/core/workers/chunks/59592bb25f226865e88a.js +0 -1
  202. package/assets/esri/core/workers/chunks/5d55b4449bcb24cd72b6.js +0 -1
  203. package/assets/esri/core/workers/chunks/5d8fe41a3c06ddb4094b.js +0 -1
  204. package/assets/esri/core/workers/chunks/608d707fd9d9f9088473.js +0 -1
  205. package/assets/esri/core/workers/chunks/6a21c9a4aeebe806ea39.js +0 -1
  206. package/assets/esri/core/workers/chunks/6c7ff968bd4fc816442d.js +0 -1
  207. package/assets/esri/core/workers/chunks/6d11ec355e5474b2968b.js +0 -1
  208. package/assets/esri/core/workers/chunks/6d25230dd85a4ba54c4f.js +0 -1
  209. package/assets/esri/core/workers/chunks/7027d93dc5a4595d70c6.js +0 -1
  210. package/assets/esri/core/workers/chunks/70b35b2446558d5280e3.js +0 -1
  211. package/assets/esri/core/workers/chunks/7349cb45a93e6916f115.js +0 -1
  212. package/assets/esri/core/workers/chunks/76edaeaf8fe344bb77a8.js +0 -1
  213. package/assets/esri/core/workers/chunks/76fe5b821d6b54db5721.js +0 -1
  214. package/assets/esri/core/workers/chunks/7951d93f5f15aa76f49c.js +0 -1
  215. package/assets/esri/core/workers/chunks/7a56c836c89a8b978800.js +0 -1
  216. package/assets/esri/core/workers/chunks/81d30c9062ad0120a863.js +0 -1
  217. package/assets/esri/core/workers/chunks/88c5f7c712c6b89b5109.js +0 -1
  218. package/assets/esri/core/workers/chunks/88e469b82d2594f23649.js +0 -1
  219. package/assets/esri/core/workers/chunks/8a8242e7cc7e6a9e7876.js +0 -1
  220. package/assets/esri/core/workers/chunks/9444ed8ea117861ae89b.js +0 -1
  221. package/assets/esri/core/workers/chunks/9a38fd68b02b617c45d3.js +0 -1
  222. package/assets/esri/core/workers/chunks/9be9ccce6369f67202bc.js +0 -1
  223. package/assets/esri/core/workers/chunks/a37c28e3c4a2be9fd1d5.js +0 -1
  224. package/assets/esri/core/workers/chunks/a8d7f59927bdad564141.js +0 -1
  225. package/assets/esri/core/workers/chunks/a94bd20551c1179c7ec5.js +0 -1
  226. package/assets/esri/core/workers/chunks/a9d2c83bb10b5ade0ca0.js +0 -1
  227. package/assets/esri/core/workers/chunks/abe22ae8ee0dcc9efbb7.js +0 -1
  228. package/assets/esri/core/workers/chunks/b702279c48f3009f6dd8.js +0 -1
  229. package/assets/esri/core/workers/chunks/bc887bd62579dba81e2b.js +0 -1
  230. package/assets/esri/core/workers/chunks/be0341567bb19e101a4f.js +0 -1
  231. package/assets/esri/core/workers/chunks/be1d6a571f76933dfbb0.js +0 -1
  232. package/assets/esri/core/workers/chunks/bfcdc5c315131aae34d8.js +0 -1
  233. package/assets/esri/core/workers/chunks/c0f624a2ca0d07ef8f8c.js +0 -1
  234. package/assets/esri/core/workers/chunks/c327fe276238af60fda4.js +0 -1
  235. package/assets/esri/core/workers/chunks/c5f155fe114a2a05aaf2.js +0 -2
  236. package/assets/esri/core/workers/chunks/c61002a117dc2218d6af.js +0 -1
  237. package/assets/esri/core/workers/chunks/c804a66ef7615aa8de89.js +0 -1
  238. package/assets/esri/core/workers/chunks/cb5e4b9b4a59c2622eb5.js +0 -1
  239. package/assets/esri/core/workers/chunks/d201a5dff18a5bb467ab.js +0 -1
  240. package/assets/esri/core/workers/chunks/d21fdd67477800101f3b.js +0 -1
  241. package/assets/esri/core/workers/chunks/db588bf3256e95c977b7.js +0 -1
  242. package/assets/esri/core/workers/chunks/dfdd474fddcd1d6091ce.js +0 -1
  243. package/assets/esri/core/workers/chunks/e235ea4293d5d463acfb.js +0 -1
  244. package/assets/esri/core/workers/chunks/e43486113aaf72ac4dc1.js +0 -1
  245. package/assets/esri/core/workers/chunks/ea4c3393c5757e309a71.js +0 -1
  246. package/assets/esri/core/workers/chunks/ed216ddeb7f59f510bd0.js +0 -1
  247. package/assets/esri/core/workers/chunks/ef8886dff54063928bcb.js +0 -1
  248. package/assets/esri/core/workers/chunks/f43a63094190d2074cd0.js +0 -1
  249. package/assets/esri/core/workers/chunks/f5223ffb3be548c9b0a1.js +0 -1
  250. package/views/support/MeasurementWorker.js +0 -2
  251. package/views/support/MeasurementWorkerHandle.js +0 -2
  252. /package/assets/esri/core/workers/chunks/{5511e640e171c294f52a.js.LICENSE.txt → 07aca5ecad659d55e795.js.LICENSE.txt} +0 -0
  253. /package/assets/esri/core/workers/chunks/{c5f155fe114a2a05aaf2.js.LICENSE.txt → bfe575da727ce7c8d331.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{EventedAccessor as i}from"../../../core/Evented.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{debounce as o}from"../../../core/promiseUtils.js";import{zeroMeters as r}from"../../../core/quantity.js";import{when as a,watch as h,syncAndInitial as c,initial as n}from"../../../core/reactiveUtils.js";import{property as l,subclass as p}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as _}from"../../../core/support/UpdatingHandles.js";import d from"../../../geometry/Point.js";import m from"../../../geometry/Polygon.js";import u from"../../../geometry/Polyline.js";import{create as g,center as y}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as v}from"../../../geometry/support/boundsUtils.js";import f from"../../../geometry/support/rotate.js";import G from"../../../symbols/SimpleFillSymbol.js";import b from"../../../symbols/SimpleLineSymbol.js";import x from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as w,scale as S,getRotationAngle as k,getScaleRatio as R}from"./drawUtils.js";import H from"./GraphicMover.js";import I from"./HighlightHelper.js";import{addUniqueLayer as C}from"./layerUtils.js";import{settings as M}from"./settings.js";import T from"../../interactive/sketch/SketchOptions.js";import{makeTooltip as O}from"../../interactive/tooltip/tooltipCommonUtils.js";import{ExtentRotateTooltipInfo as j}from"../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";import{ExtentScaleTooltipInfo as E}from"../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{TranslateTooltipInfo as B}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{MeasurementWorkerHandle as L}from"../../support/MeasurementWorkerHandle.js";const N=M.transformGraphics,z={centerIndicator:new x({style:"cross",size:N.center.size,color:N.center.color}),fill:{default:new G({color:N.fill.color,outline:{color:N.fill.outlineColor,join:"round",width:1}}),active:new G({color:N.fill.stagedColor,outline:{color:N.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new x({style:"square",size:N.vertex.size,color:N.vertex.color,outline:{color:N.vertex.outlineColor,width:1}}),hover:new x({style:"square",size:N.vertex.hoverSize,color:N.vertex.hoverColor,outline:{color:N.vertex.hoverOutlineColor,width:1}})},rotator:{default:new x({style:"circle",size:N.vertex.size,color:N.vertex.color,outline:{color:N.vertex.outlineColor,width:1}}),hover:new x({style:"circle",size:N.vertex.hoverSize,color:N.vertex.hoverColor,outline:{color:N.vertex.hoverOutlineColor,width:1}})},rotatorLine:new b({color:N.line.color,width:1})},Y=Symbol();let A=class extends i{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._centerGraphic=null,this._backgroundGraphic=null,this._vertexGraphics=[],this._rotateHandleGraphic=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.tooltip=null,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=z,this.sketchOptions=new T,this.view=null,this._updatingHandles=new _,this._getBounds=(()=>{const t=g();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,o,r,a;if("point"===s.type)i=r=s.x,o=a=s.y;else if("extent"===s.type)[i,o,r,a]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=v(t,s);[i,o,r,a]=e}e[0]=Math.min(i,e[0]),e[1]=Math.min(o,e[1]),e[2]=Math.max(r,e[2]),e[3]=Math.max(a,e[3])}return e}})(),this._extentScaleTooltipInfo=new E({sketchOptions:this.sketchOptions}),this._measurementWorker=new L({preloadGeodetic:!0}),this._updateScaleTooltipAsync=o(async()=>{const t=this._getCoordinates(),e=this.view.spatialReference,{width:i,height:s}=await this._measurementWorker.autoSize2D(new d({x:t[0][0],y:t[0][1],spatialReference:e}),new d({x:t[1][0],y:t[1][1],spatialReference:e}),new d({x:t[2][0],y:t[2][1],spatialReference:e}),new d({x:t[3][0],y:t[3][1],spatialReference:e}));this._extentScaleTooltipInfo.xSize=i,this._extentScaleTooltipInfo.ySize=s}),this._translateTooltipInfo=new B({sketchOptions:this.sketchOptions}),this._updateMoveTooltipAsync=o(async t=>{const{view:e}=this,i=this._translateTooltipInfo;if(!t)return void(i.distance=r);const{x:s,y:o}=t.origin,a=e.toMap(t),h=e.toMap({x:s,y:o}),c=await this._measurementWorker.autoDistance2DBetweenPoints(h,a);i.distance=null!=c?c:r})}initialize(){const t=this.view;this._highlightHelper=new I({view:t}),this._setup(),this.addHandles([a(()=>t?.ready,()=>{const{layer:t,view:e}=this;C(e,t)},{once:!0,initial:!0}),h(()=>this.preserveAspectRatio,()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))}),h(()=>t?.scale,()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()}),h(()=>this.graphics,()=>this.refresh()),h(()=>this.layer,(t,e)=>{e&&this._resetGraphics(e),this.refresh()}),h(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),h(()=>this.sketchOptions.tooltips.effectiveEnabled,e=>{this.tooltip=e?O(()=>({view:t,options:this.sketchOptions.tooltips})):s(this.tooltip)},c),h(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),n),this.on("move-start",t=>this.callbacks?.onMoveStart?.(t)),this.on("move",t=>this.callbacks?.onMove?.(t)),this.on("move-stop",t=>this.callbacks?.onMoveStop?.(t)),this.on("rotate-start",t=>this.callbacks?.onRotateStart?.(t)),this.on("rotate",t=>this.callbacks?.onRotate?.(t)),this.on("rotate-stop",t=>this.callbacks?.onRotateStop?.(t)),this.on("scale-start",t=>this.callbacks?.onScaleStart?.(t)),this.on("scale",t=>this.callbacks?.onScale?.(t)),this.on("scale-stop",t=>this.callbacks?.onScaleStop?.(t))])}destroy(){this._reset(),this.tooltip=s(this.tooltip)}get state(){const t=this.view?.ready??!1,e=this.graphics.length&&this.layer;return t&&e?"active":t?"ready":"disabled"}get updating(){return this._updatingHandles.updating}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=w(s,t,e,this.view);i.geometry=o}this.refresh(),this.emit("move-stop",{graphics:this.graphics,mover:null,dx:t,dy:e,type:"move-stop"})}}scale(t,e){if(!this._mover||!this.graphics.length)return;const i=this._getBoxBounds(g()),s=y(i);for(const o of this.graphics){const i=o.geometry,r=S(i,t,e,s);o.geometry=r}this.refresh(),this.emit("scale-stop",{graphics:this.graphics,mover:null,xScale:t,yScale:e,type:"scale-stop"})}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this._vertexGraphics[1].geometry.x,i=this._vertexGraphics[3].geometry.y;e=new d(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,o=f(s,t,e);i.geometry=o}this.refresh(),this.emit("rotate-stop",{graphics:this.graphics,mover:null,angle:t,type:"rotate-stop"})}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._highlightHelper?.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._updateTooltip(),this._mover?.destroy(),this._mover=null,this.removeHandles(Y)}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){(t=t||this.layer)&&(t.removeMany(this._vertexGraphics),t.remove(this._backgroundGraphic),t.remove(this._centerGraphic),t.remove(this._rotateHandleGraphic),t.remove(this._rotateLineGraphic)),this._vertexGraphics.forEach(t=>!t.destroyed&&t.destroy()),!this._backgroundGraphic.destroyed&&this._backgroundGraphic.destroy(),!this._centerGraphic.destroyed&&this._centerGraphic.destroy(),!this._rotateHandleGraphic.destroyed&&this._rotateHandleGraphic.destroy(),!this._rotateLineGraphic.destroyed&&this._rotateLineGraphic.destroy(),this._vertexGraphics=[],this._backgroundGraphic=null,this._centerGraphic=null,this._rotateHandleGraphic=null,this._rotateLineGraphic=null}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this._vertexGraphics)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new H({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setCursor(t){this.addHandles(this.view.acquireCursor(t,"high"),Y)}_getStartInfo(t){const[e,i,s,o]=this._getBoxBounds(g()),r=Math.abs(s-e),a=Math.abs(o-i),h=(s+e)/2,c=(o+i)/2,{x:n,y:l}=t.geometry;return{width:r,height:a,centerX:h,centerY:c,startX:n,startY:l,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map(t=>this._getGraphicInfo(t))}_getGraphicInfo(t){const e=t.geometry,[i,s,o,r]=this._getBounds(g(),[e]);return{width:Math.abs(o-i),height:Math.abs(r-s),centerX:(o+i)/2,centerY:(r+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,_backgroundGraphic:o,_vertexGraphics:r,_rotateHandleGraphic:a,symbols:h,graphics:c}=this,{graphic:n,dx:l,dy:p,viewEvent:_}=t;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),o.symbol=h.fill.active,this._startInfo=this._getStartInfo(n),this._updateTooltip(n,_),n===a?(this._setCursor("grabbing"),this.emit("rotate-start",{type:"rotate-start",mover:n,graphics:c,angle:e})):r.includes(n)?(this._activeHandleGraphic=n,this.emit("scale-start",{type:"scale-start",mover:n,graphics:c,xScale:i,yScale:s})):this.emit("move-start",{type:"move-start",graphics:c,mover:n,dx:l,dy:p})}_onGraphicMoveCallback(t){const e=t.graphic;if(!this._startInfo)return;const{_xScale:i,_yScale:s,_angleOfRotation:o,graphics:r}=this;if(this._vertexGraphics.includes(e))this._scaleGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("scale",{type:"scale",graphics:r,mover:e,xScale:i,yScale:s});else if(e===this._rotateHandleGraphic)this._rotateGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("rotate",{type:"rotate",graphics:r,mover:e,angle:o});else{const{dx:i,dy:s}=t;this._totalDx+=i,this._totalDy+=s,this._moveGraphic(e,i,s),this._updateTooltip(e,t.viewEvent),this.emit("move",{type:"move",graphics:r,mover:e,dx:i,dy:s})}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:s,_totalDy:o,_xScale:r,_yScale:a,_vertexGraphics:h,_rotateHandleGraphic:c,graphics:n}=this;this.refresh(),e===c?(this._setCursor("pointer"),this.emit("rotate-stop",{type:"rotate-stop",graphics:n,mover:e,angle:i})):h.includes(e)?this.emit("scale-stop",{type:"scale-stop",mover:e,graphics:n,xScale:r,yScale:a}):this.emit("move-stop",{type:"move-stop",graphics:n,mover:e,dx:s,dy:o})}_onGraphicPointerOverCallback(t){const{_backgroundGraphic:e,_vertexGraphics:i,graphics:s,_rotateHandleGraphic:o,symbols:r,view:a}=this,h=t.graphic;if(this._hoveredGraphic=h,h===o)return o.symbol=r.rotator.hover,this._setCursor("pointer"),void this._updateTooltip(h);if(s.includes(h)||h===e)return void this._setCursor("move");if(!i.includes(h))return void this._setCursor("pointer");this._updateTooltip(h),t.graphic.symbol=r.handles.hover;const c=a.rotation;let n,l=t.index;switch(l<8&&(c>=0&&c<45?l%=8:l=c>=45&&c<90?(l+1)%8:c>=90&&c<135?(l+2)%8:c>=135&&c<180?(l+3)%8:c>=180&&c<225?(l+4)%8:c>=225&&c<270?(l+5)%8:c>=270&&c<315?(l+6)%8:(l+7)%8),l){case 0:case 4:n="nwse-resize";break;case 1:case 5:n="ns-resize";break;case 2:case 6:n="nesw-resize";break;case 3:case 7:n="ew-resize";break;default:n="pointer"}this._setCursor(n)}_onGraphicPointerOutCallback(t){const{_vertexGraphics:e,_rotateHandleGraphic:i,symbols:s}=this;this._hoveredGraphic=null,t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),this.removeHandles(Y),this._updateTooltip()}_scaleGraphic(t){const{_startInfo:e,_vertexGraphics:i,preserveAspectRatio:s,view:o}=this,{centerX:r,centerY:a,graphicInfos:h,height:c,startX:n,startY:l,width:p}=e,{resolution:_,transform:m}=o.state,u=i.indexOf(t);1!==u&&5!==u||this._updateX(t,r),3!==u&&7!==u||this._updateY(t,a);const{x:g,y}=t.geometry,v=m[0]*g+m[2]*y+m[4],f=m[1]*g+m[3]*y+m[5],G=h?.map(t=>t.geometry)??[],b=G.every(t=>"point"===t.type);if((0===p||0===c)&&b){const t=P((g-n)/_),i=P((l-y)/_);for(let e=0;e<G.length;e++)this.graphics[e].geometry=w(G[e],t,i,o,!0);return this._centerGraphic.geometry=new d(g,y,o.spatialReference),void(this._backgroundGraphic.geometry=w(e.box,t,i,o,!0))}if(s){const t=P(m[0]*r+m[2]*a+m[4],2),e=P(m[1]*r+m[3]*a+m[5],2),i=P(m[0]*n+m[2]*l+m[4],2),s=P(m[1]*n+m[3]*l+m[5],2);let o=R(t,e,i,s,v,f);0!==o&&Math.abs(o)!==1/0||(o=1),this._xScale=this._yScale=o;for(const h of G){const t=G.indexOf(h);this.graphics[t].geometry=S(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=g-n,i=l-y;if(1===u||5===u?t=0:3!==u&&7!==u||(i=0),0===t&&0===i)return;const s=r+t/2,h=a+i/2;let m=(p+(n>r?t:-1*t))/p,v=(c+(l<a?i:-1*i))/c;1!==u&&5!==u&&0!==m&&Math.abs(m)!==1/0||(m=1),3!==u&&7!==u&&0!==v&&Math.abs(v)!==1/0||(v=1),this._xScale=m,this._yScale=v;const f=(s-r)/_,b=(h-a)/_,x=S(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=w(x,f,b,o,!0);const{centerX:k,centerY:R}=this._getGraphicInfo(this._backgroundGraphic),H=(k-r)/_,I=-1*(R-a)/_;for(const e of G){const t=G.indexOf(e),i=S(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=w(i,H,I,o,!0)}this._centerGraphic.geometry=new d(k,R,o.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:o,box:r,rotate:a}=this._startInfo,h=this.view.spatialReference,c=new d(s,o,h),n=new d(e,i,h),l=t.geometry;this._angleOfRotation=k(c,l,n);const p=this._startInfo.graphicInfos?.map(t=>t.geometry)??[];for(const _ of p){const t=p.indexOf(_),e=f(_,this._angleOfRotation,n);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=f(r,this._angleOfRotation,n),this._rotateHandleGraphic.geometry=f(a,this._angleOfRotation,n)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=w(s,e,i,this.view);for(const o of this.graphics)o!==t&&(o.geometry=w(o.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=w(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=w(s.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics,this.highlightName)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new e({symbol:i.centerIndicator,attributes:t}),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new e({symbol:i.fill.default,attributes:t}),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new e({symbol:i.rotatorLine,attributes:t}),this._rotateHandleGraphic=new e({symbol:i.rotator.default,attributes:t}),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let s=0;s<8;s++)this._vertexGraphics.push(new e({symbol:i.handles.default,attributes:t}));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:this.symbols.fill.active?.clone().set("outline.color",t),default:this.symbols.fill.default?.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const e of this._vertexGraphics)e.symbol=e===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach(t=>t.visible=!1)}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach((e,i)=>{const[s,o]=t[i];this._updateXY(e,s,o)})}_updateBackgroundGraphic(){const t=this._getCoordinates().map(([t,e])=>[t,e]);this._backgroundGraphic.geometry=new m({rings:[t],spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(g()),o=(i+t)/2,r=(s+e)/2;this._centerGraphic.geometry=new d(o,r,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:e}=this._vertexGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new d(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this._vertexGraphics.length||!this._rotateHandleGraphic?.geometry)return;const t=this._vertexGraphics[1].geometry,e=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new u({paths:[[[t.x,t.y],[e.x,e.y]]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new d(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new d(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new d(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some(t=>null!=t?.geometry&&"extent"===t.geometry.type)}_getBoxBounds(t){const e=this.graphics.map(t=>t.geometry);return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,o]=this._getBoxBounds(g());if(t){const t=(e+s)/2,r=(o+i)/2;return[[e,o],[t,o],[s,o],[s,r],[s,i],[t,i],[e,i],[e,r]]}return[[e,o],[s,o],[s,i],[e,i]]}_updateTooltip(t,e){if(null==this.tooltip)return;if(!t)return void this.tooltip.clear();const{_backgroundGraphic:i,graphics:s,_vertexGraphics:o,_rotateHandleGraphic:r}=this;t===r?this._updateRotateTooltip():o.includes(t)?this._updateScaleTooltip():(s.includes(t)||t===i)&&this._updateMoveTooltip(e)}_updateRotateTooltip(){null!=this.tooltip&&(this.tooltip.info=new j({sketchOptions:this.sketchOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,sketchOptions:s}=this;if(null==t)return;const o=Math.abs(e),r=Math.abs(i),a=this._extentScaleTooltipInfo;a.sketchOptions=s,a.xScale=o,a.yScale=r,this._updatingHandles.consumePromise(this._updateScaleTooltipAsync()),t.info=a}_updateMoveTooltip(t){const{tooltip:e}=this;if(null==e)return;const i=this._translateTooltipInfo;this._updatingHandles.consumePromise(this._updateMoveTooltipAsync(t)),e.info=i}};function P(t,e=2){return Number.parseFloat(t.toFixed(e))}t([l()],A.prototype,"tooltip",void 0),t([l({readOnly:!0})],A.prototype,"type",void 0),t([l()],A.prototype,"callbacks",void 0),t([l()],A.prototype,"enableMovement",void 0),t([l()],A.prototype,"enableRotation",void 0),t([l()],A.prototype,"enableScaling",void 0),t([l()],A.prototype,"graphics",void 0),t([l()],A.prototype,"highlightName",void 0),t([l()],A.prototype,"highlightsEnabled",void 0),t([l()],A.prototype,"layer",void 0),t([l()],A.prototype,"preserveAspectRatio",void 0),t([l()],A.prototype,"showCenterGraphic",void 0),t([l({readOnly:!0})],A.prototype,"state",null),t([l()],A.prototype,"symbols",void 0),t([l({type:T})],A.prototype,"sketchOptions",void 0),t([l({constructOnly:!0})],A.prototype,"view",void 0),A=t([p("esri.views.draw.support.Box")],A);const U=A;export{U as default};
2
+ import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{EventedAccessor as i}from"../../../core/Evented.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{debounce as o}from"../../../core/promiseUtils.js";import{zeroMeters as r}from"../../../core/quantity.js";import{when as a,watch as h,syncAndInitial as c,initial as n}from"../../../core/reactiveUtils.js";import{property as l,subclass as p}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as _}from"../../../core/support/UpdatingHandles.js";import d from"../../../geometry/Point.js";import m from"../../../geometry/Polygon.js";import u from"../../../geometry/Polyline.js";import{create as g,center as y}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as v}from"../../../geometry/support/boundsUtils.js";import f from"../../../geometry/support/rotate.js";import G from"../../../symbols/SimpleFillSymbol.js";import b from"../../../symbols/SimpleLineSymbol.js";import x from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as w,scale as S,getRotationAngle as k,getScaleRatio as R}from"./drawUtils.js";import H from"./GraphicMover.js";import I from"./HighlightHelper.js";import{addUniqueLayer as C}from"./layerUtils.js";import{settings as M}from"./settings.js";import T from"../../interactive/sketch/SketchOptions.js";import{makeTooltip as O}from"../../interactive/tooltip/tooltipCommonUtils.js";import{ExtentRotateTooltipInfo as j}from"../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";import{ExtentScaleTooltipInfo as E}from"../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{TranslateTooltipInfo as B}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{GeometryWorkerHandle as L}from"../../support/GeometryWorkerHandle.js";const N=M.transformGraphics,z={centerIndicator:new x({style:"cross",size:N.center.size,color:N.center.color}),fill:{default:new G({color:N.fill.color,outline:{color:N.fill.outlineColor,join:"round",width:1}}),active:new G({color:N.fill.stagedColor,outline:{color:N.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new x({style:"square",size:N.vertex.size,color:N.vertex.color,outline:{color:N.vertex.outlineColor,width:1}}),hover:new x({style:"square",size:N.vertex.hoverSize,color:N.vertex.hoverColor,outline:{color:N.vertex.hoverOutlineColor,width:1}})},rotator:{default:new x({style:"circle",size:N.vertex.size,color:N.vertex.color,outline:{color:N.vertex.outlineColor,width:1}}),hover:new x({style:"circle",size:N.vertex.hoverSize,color:N.vertex.hoverColor,outline:{color:N.vertex.hoverOutlineColor,width:1}})},rotatorLine:new b({color:N.line.color,width:1})},Y=Symbol();let A=class extends i{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._centerGraphic=null,this._backgroundGraphic=null,this._vertexGraphics=[],this._rotateHandleGraphic=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.tooltip=null,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=z,this.sketchOptions=new T,this.view=null,this._updatingHandles=new _,this._getBounds=(()=>{const t=g();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,o,r,a;if("point"===s.type)i=r=s.x,o=a=s.y;else if("extent"===s.type)[i,o,r,a]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=v(t,s);[i,o,r,a]=e}e[0]=Math.min(i,e[0]),e[1]=Math.min(o,e[1]),e[2]=Math.max(r,e[2]),e[3]=Math.max(a,e[3])}return e}})(),this._extentScaleTooltipInfo=new E({sketchOptions:this.sketchOptions}),this._measurementWorker=new L({preloadGeodetic:!0}),this._updateScaleTooltipAsync=o(async()=>{const t=this._getCoordinates(),e=this.view.spatialReference,{width:i,height:s}=await this._measurementWorker.autoSize2D(new d({x:t[0][0],y:t[0][1],spatialReference:e}),new d({x:t[1][0],y:t[1][1],spatialReference:e}),new d({x:t[2][0],y:t[2][1],spatialReference:e}),new d({x:t[3][0],y:t[3][1],spatialReference:e}));this._extentScaleTooltipInfo.xSize=i,this._extentScaleTooltipInfo.ySize=s}),this._translateTooltipInfo=new B({sketchOptions:this.sketchOptions}),this._updateMoveTooltipAsync=o(async t=>{const{view:e}=this,i=this._translateTooltipInfo;if(!t)return void(i.distance=r);const{x:s,y:o}=t.origin,a=e.toMap(t),h=e.toMap({x:s,y:o}),c=await this._measurementWorker.autoDistance2DBetweenPoints(h,a);i.distance=null!=c?c:r})}initialize(){const t=this.view;this._highlightHelper=new I({view:t}),this._setup(),this.addHandles([a(()=>t?.ready,()=>{const{layer:t,view:e}=this;C(e,t)},{once:!0,initial:!0}),h(()=>this.preserveAspectRatio,()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))}),h(()=>t?.scale,()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()}),h(()=>this.graphics,()=>this.refresh()),h(()=>this.layer,(t,e)=>{e&&this._resetGraphics(e),this.refresh()}),h(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),h(()=>this.sketchOptions.tooltips.effectiveEnabled,e=>{this.tooltip=e?O(()=>({view:t,options:this.sketchOptions.tooltips})):s(this.tooltip)},c),h(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),n),this.on("move-start",t=>this.callbacks?.onMoveStart?.(t)),this.on("move",t=>this.callbacks?.onMove?.(t)),this.on("move-stop",t=>this.callbacks?.onMoveStop?.(t)),this.on("rotate-start",t=>this.callbacks?.onRotateStart?.(t)),this.on("rotate",t=>this.callbacks?.onRotate?.(t)),this.on("rotate-stop",t=>this.callbacks?.onRotateStop?.(t)),this.on("scale-start",t=>this.callbacks?.onScaleStart?.(t)),this.on("scale",t=>this.callbacks?.onScale?.(t)),this.on("scale-stop",t=>this.callbacks?.onScaleStop?.(t))])}destroy(){this._reset(),this.tooltip=s(this.tooltip)}get state(){const t=this.view?.ready??!1,e=this.graphics.length&&this.layer;return t&&e?"active":t?"ready":"disabled"}get updating(){return this._updatingHandles.updating}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=w(s,t,e,this.view);i.geometry=o}this.refresh(),this.emit("move-stop",{graphics:this.graphics,mover:null,dx:t,dy:e,type:"move-stop"})}}scale(t,e){if(!this._mover||!this.graphics.length)return;const i=this._getBoxBounds(g()),s=y(i);for(const o of this.graphics){const i=o.geometry,r=S(i,t,e,s);o.geometry=r}this.refresh(),this.emit("scale-stop",{graphics:this.graphics,mover:null,xScale:t,yScale:e,type:"scale-stop"})}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this._vertexGraphics[1].geometry.x,i=this._vertexGraphics[3].geometry.y;e=new d(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,o=f(s,t,e);i.geometry=o}this.refresh(),this.emit("rotate-stop",{graphics:this.graphics,mover:null,angle:t,type:"rotate-stop"})}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._highlightHelper?.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._updateTooltip(),this._mover?.destroy(),this._mover=null,this.removeHandles(Y)}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){(t=t||this.layer)&&(t.removeMany(this._vertexGraphics),t.remove(this._backgroundGraphic),t.remove(this._centerGraphic),t.remove(this._rotateHandleGraphic),t.remove(this._rotateLineGraphic)),this._vertexGraphics.forEach(t=>!t.destroyed&&t.destroy()),!this._backgroundGraphic.destroyed&&this._backgroundGraphic.destroy(),!this._centerGraphic.destroyed&&this._centerGraphic.destroy(),!this._rotateHandleGraphic.destroyed&&this._rotateHandleGraphic.destroy(),!this._rotateLineGraphic.destroyed&&this._rotateLineGraphic.destroy(),this._vertexGraphics=[],this._backgroundGraphic=null,this._centerGraphic=null,this._rotateHandleGraphic=null,this._rotateLineGraphic=null}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this._vertexGraphics)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new H({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setCursor(t){this.addHandles(this.view.acquireCursor(t,"high"),Y)}_getStartInfo(t){const[e,i,s,o]=this._getBoxBounds(g()),r=Math.abs(s-e),a=Math.abs(o-i),h=(s+e)/2,c=(o+i)/2,{x:n,y:l}=t.geometry;return{width:r,height:a,centerX:h,centerY:c,startX:n,startY:l,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map(t=>this._getGraphicInfo(t))}_getGraphicInfo(t){const e=t.geometry,[i,s,o,r]=this._getBounds(g(),[e]);return{width:Math.abs(o-i),height:Math.abs(r-s),centerX:(o+i)/2,centerY:(r+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,_backgroundGraphic:o,_vertexGraphics:r,_rotateHandleGraphic:a,symbols:h,graphics:c}=this,{graphic:n,dx:l,dy:p,viewEvent:_}=t;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),o.symbol=h.fill.active,this._startInfo=this._getStartInfo(n),this._updateTooltip(n,_),n===a?(this._setCursor("grabbing"),this.emit("rotate-start",{type:"rotate-start",mover:n,graphics:c,angle:e})):r.includes(n)?(this._activeHandleGraphic=n,this.emit("scale-start",{type:"scale-start",mover:n,graphics:c,xScale:i,yScale:s})):this.emit("move-start",{type:"move-start",graphics:c,mover:n,dx:l,dy:p})}_onGraphicMoveCallback(t){const e=t.graphic;if(!this._startInfo)return;const{_xScale:i,_yScale:s,_angleOfRotation:o,graphics:r}=this;if(this._vertexGraphics.includes(e))this._scaleGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("scale",{type:"scale",graphics:r,mover:e,xScale:i,yScale:s});else if(e===this._rotateHandleGraphic)this._rotateGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("rotate",{type:"rotate",graphics:r,mover:e,angle:o});else{const{dx:i,dy:s}=t;this._totalDx+=i,this._totalDy+=s,this._moveGraphic(e,i,s),this._updateTooltip(e,t.viewEvent),this.emit("move",{type:"move",graphics:r,mover:e,dx:i,dy:s})}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:s,_totalDy:o,_xScale:r,_yScale:a,_vertexGraphics:h,_rotateHandleGraphic:c,graphics:n}=this;this.refresh(),e===c?(this._setCursor("pointer"),this.emit("rotate-stop",{type:"rotate-stop",graphics:n,mover:e,angle:i})):h.includes(e)?this.emit("scale-stop",{type:"scale-stop",mover:e,graphics:n,xScale:r,yScale:a}):this.emit("move-stop",{type:"move-stop",graphics:n,mover:e,dx:s,dy:o})}_onGraphicPointerOverCallback(t){const{_backgroundGraphic:e,_vertexGraphics:i,graphics:s,_rotateHandleGraphic:o,symbols:r,view:a}=this,h=t.graphic;if(this._hoveredGraphic=h,h===o)return o.symbol=r.rotator.hover,this._setCursor("pointer"),void this._updateTooltip(h);if(s.includes(h)||h===e)return void this._setCursor("move");if(!i.includes(h))return void this._setCursor("pointer");this._updateTooltip(h),t.graphic.symbol=r.handles.hover;const c=a.rotation;let n,l=t.index;switch(l<8&&(c>=0&&c<45?l%=8:l=c>=45&&c<90?(l+1)%8:c>=90&&c<135?(l+2)%8:c>=135&&c<180?(l+3)%8:c>=180&&c<225?(l+4)%8:c>=225&&c<270?(l+5)%8:c>=270&&c<315?(l+6)%8:(l+7)%8),l){case 0:case 4:n="nwse-resize";break;case 1:case 5:n="ns-resize";break;case 2:case 6:n="nesw-resize";break;case 3:case 7:n="ew-resize";break;default:n="pointer"}this._setCursor(n)}_onGraphicPointerOutCallback(t){const{_vertexGraphics:e,_rotateHandleGraphic:i,symbols:s}=this;this._hoveredGraphic=null,t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),this.removeHandles(Y),this._updateTooltip()}_scaleGraphic(t){const{_startInfo:e,_vertexGraphics:i,preserveAspectRatio:s,view:o}=this,{centerX:r,centerY:a,graphicInfos:h,height:c,startX:n,startY:l,width:p}=e,{resolution:_,transform:m}=o.state,u=i.indexOf(t);1!==u&&5!==u||this._updateX(t,r),3!==u&&7!==u||this._updateY(t,a);const{x:g,y}=t.geometry,v=m[0]*g+m[2]*y+m[4],f=m[1]*g+m[3]*y+m[5],G=h?.map(t=>t.geometry)??[],b=G.every(t=>"point"===t.type);if((0===p||0===c)&&b){const t=P((g-n)/_),i=P((l-y)/_);for(let e=0;e<G.length;e++)this.graphics[e].geometry=w(G[e],t,i,o,!0);return this._centerGraphic.geometry=new d(g,y,o.spatialReference),void(this._backgroundGraphic.geometry=w(e.box,t,i,o,!0))}if(s){const t=P(m[0]*r+m[2]*a+m[4],2),e=P(m[1]*r+m[3]*a+m[5],2),i=P(m[0]*n+m[2]*l+m[4],2),s=P(m[1]*n+m[3]*l+m[5],2);let o=R(t,e,i,s,v,f);0!==o&&Math.abs(o)!==1/0||(o=1),this._xScale=this._yScale=o;for(const h of G){const t=G.indexOf(h);this.graphics[t].geometry=S(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=g-n,i=l-y;if(1===u||5===u?t=0:3!==u&&7!==u||(i=0),0===t&&0===i)return;const s=r+t/2,h=a+i/2;let m=(p+(n>r?t:-1*t))/p,v=(c+(l<a?i:-1*i))/c;1!==u&&5!==u&&0!==m&&Math.abs(m)!==1/0||(m=1),3!==u&&7!==u&&0!==v&&Math.abs(v)!==1/0||(v=1),this._xScale=m,this._yScale=v;const f=(s-r)/_,b=(h-a)/_,x=S(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=w(x,f,b,o,!0);const{centerX:k,centerY:R}=this._getGraphicInfo(this._backgroundGraphic),H=(k-r)/_,I=-1*(R-a)/_;for(const e of G){const t=G.indexOf(e),i=S(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=w(i,H,I,o,!0)}this._centerGraphic.geometry=new d(k,R,o.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:o,box:r,rotate:a}=this._startInfo,h=this.view.spatialReference,c=new d(s,o,h),n=new d(e,i,h),l=t.geometry;this._angleOfRotation=k(c,l,n);const p=this._startInfo.graphicInfos?.map(t=>t.geometry)??[];for(const _ of p){const t=p.indexOf(_),e=f(_,this._angleOfRotation,n);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=f(r,this._angleOfRotation,n),this._rotateHandleGraphic.geometry=f(a,this._angleOfRotation,n)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=w(s,e,i,this.view);for(const o of this.graphics)o!==t&&(o.geometry=w(o.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=w(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=w(s.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics,this.highlightName)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new e({symbol:i.centerIndicator,attributes:t}),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new e({symbol:i.fill.default,attributes:t}),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new e({symbol:i.rotatorLine,attributes:t}),this._rotateHandleGraphic=new e({symbol:i.rotator.default,attributes:t}),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let s=0;s<8;s++)this._vertexGraphics.push(new e({symbol:i.handles.default,attributes:t}));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:this.symbols.fill.active?.clone().set("outline.color",t),default:this.symbols.fill.default?.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const e of this._vertexGraphics)e.symbol=e===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach(t=>t.visible=!1)}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach((e,i)=>{const[s,o]=t[i];this._updateXY(e,s,o)})}_updateBackgroundGraphic(){const t=this._getCoordinates().map(([t,e])=>[t,e]);this._backgroundGraphic.geometry=new m({rings:[t],spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(g()),o=(i+t)/2,r=(s+e)/2;this._centerGraphic.geometry=new d(o,r,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:e}=this._vertexGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new d(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this._vertexGraphics.length||!this._rotateHandleGraphic?.geometry)return;const t=this._vertexGraphics[1].geometry,e=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new u({paths:[[[t.x,t.y],[e.x,e.y]]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new d(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new d(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new d(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some(t=>null!=t?.geometry&&"extent"===t.geometry.type)}_getBoxBounds(t){const e=this.graphics.map(t=>t.geometry);return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,o]=this._getBoxBounds(g());if(t){const t=(e+s)/2,r=(o+i)/2;return[[e,o],[t,o],[s,o],[s,r],[s,i],[t,i],[e,i],[e,r]]}return[[e,o],[s,o],[s,i],[e,i]]}_updateTooltip(t,e){if(null==this.tooltip)return;if(!t)return void this.tooltip.clear();const{_backgroundGraphic:i,graphics:s,_vertexGraphics:o,_rotateHandleGraphic:r}=this;t===r?this._updateRotateTooltip():o.includes(t)?this._updateScaleTooltip():(s.includes(t)||t===i)&&this._updateMoveTooltip(e)}_updateRotateTooltip(){null!=this.tooltip&&(this.tooltip.info=new j({sketchOptions:this.sketchOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,sketchOptions:s}=this;if(null==t)return;const o=Math.abs(e),r=Math.abs(i),a=this._extentScaleTooltipInfo;a.sketchOptions=s,a.xScale=o,a.yScale=r,this._updatingHandles.consumePromise(this._updateScaleTooltipAsync()),t.info=a}_updateMoveTooltip(t){const{tooltip:e}=this;if(null==e)return;const i=this._translateTooltipInfo;this._updatingHandles.consumePromise(this._updateMoveTooltipAsync(t)),e.info=i}};function P(t,e=2){return Number.parseFloat(t.toFixed(e))}t([l()],A.prototype,"tooltip",void 0),t([l({readOnly:!0})],A.prototype,"type",void 0),t([l()],A.prototype,"callbacks",void 0),t([l()],A.prototype,"enableMovement",void 0),t([l()],A.prototype,"enableRotation",void 0),t([l()],A.prototype,"enableScaling",void 0),t([l()],A.prototype,"graphics",void 0),t([l()],A.prototype,"highlightName",void 0),t([l()],A.prototype,"highlightsEnabled",void 0),t([l()],A.prototype,"layer",void 0),t([l()],A.prototype,"preserveAspectRatio",void 0),t([l()],A.prototype,"showCenterGraphic",void 0),t([l({readOnly:!0})],A.prototype,"state",null),t([l()],A.prototype,"symbols",void 0),t([l({type:T})],A.prototype,"sketchOptions",void 0),t([l({constructOnly:!0})],A.prototype,"view",void 0),A=t([p("esri.views.draw.support.Box")],A);const U=A;export{U as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,abortMaybe as p,assertIsSome as l}from"../../../core/maybe.js";import{throwIfAborted as c}from"../../../core/promiseUtils.js";import{pausable as d,when as m,watch as v,initial as u,sync as y}from"../../../core/reactiveUtils.js";import{property as _,subclass as g}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../../core/support/UpdatingHandles.js";import G from"../../../geometry/Point.js";import b from"../../../geometry/Polyline.js";import{fromPolylineUsingImportOperator as x,toGeometry as M}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as E}from"../../../geometry/support/jsonUtils.js";import{isPoint as w}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as I}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as V,toEllipticArc7 as k}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as H,getEndpoint as O,isCircularArc as L,isEllipticArc4 as P,isBezierCurve as T,isCoordinate as R,cloneCurve as A,isEllipticArc7 as j}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as U}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as F}from"../../../geometry/support/curves/mathUtils.js";import D from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as z}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as K}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as N,getZFromVertexSnappingCandidates as W,cloneMove as $}from"./drawUtils.js";import q from"./GraphicMover.js";import X from"./HighlightHelper.js";import{addUniqueLayer as Y,isConnectedReshapeSupportedLayer as Z}from"./layerUtils.js";import{createTooltipInfos as B,connectTooltip as J,updateTranslateTooltipInfo as Q,updateTranslateVertexTooltipInfo as tt}from"./reshapeTooltipUtils.js";import{defaultSymbols as et,createMidpointGraphics as it,createVertexGraphics as st,createCurveControlPointGraphics as ot,createCurveConstructionLineGraphics as rt,attributeKeys as nt,getMidpoint as at,controlPointKinds as ht,fastCloneGeometry as pt,saveUpdatedCurveOrCoordinate as lt,toolIdAttribute as ct,splitCurve as dt,isSingleSegmentCircle as mt,isSingleSegmentEllipse as vt}from"./reshapeUtils.js";import{ViewEventPriorities as ut}from"../../input/InputManager.js";import{createCoordinateHelper as yt}from"../../interactive/coordinateHelper.js";import{sketchKeys as _t}from"../../interactive/keybindings.js";import{EditGeometryOperations as gt}from"../../interactive/editGeometry/EditGeometryOperations.js";import ft from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as Gt}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as bt,enterInputModeIfAvailable as xt}from"../../interactive/tooltip/tooltipCommonUtils.js";import{MeasurementWorkerHandle as Mt}from"../../support/MeasurementWorkerHandle.js";const St=Symbol(),Ct={mode:"on-the-ground",offset:0};let Et=class extends r{constructor(t){super(t),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new f,this._measurementWorker=new Mt({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=et,this.tooltip=null,this.activeTooltipInfo=null,this.sketchOptions=new ft,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const t=this.view;this._highlightHelper=new X({view:t}),this._setup(),this._updateHandlesOnExternalGeometryChange=d(()=>this.graphic?.geometry,t=>{if(!t||!0===this._primaryGraphicMoving)return;const e=new Set(this.selectedManipulators.map(Rt));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(t=>e.has(Rt(t))).forEach(t=>this._addToSelection(t)),this.curveControlPointGraphics.filter(t=>e.has(Rt(t))).forEach(t=>this._addToSelection(t));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).toArray();i&&h.push(o),s?.set("graphics",h)},y),this.tooltip=bt(()=>({view:t,options:this.sketchOptions.tooltips})),this.tooltipInfos=B(this.sketchOptions),this.addHandles([m(()=>t?.ready,()=>{const{layer:t,view:e}=this;Y(e,t),this.addHandles(e.on("key-down",t=>this._keyDownHandler(t),ut.TOOL))},{once:!0,initial:!0}),v(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[v(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],v(()=>this.layer,(t,e)=>{e&&(this._clearSelection(),this._resetGraphics(e)),this.refresh()}),v(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),v(()=>this.enableMidpoints,()=>this.refresh()),J(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),v(()=>this.sketchOptions.labels.enabled,t=>{this._segmentLabels?this._segmentLabels.visible=t:this._setUpGeometryHelper()}),v(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),u),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=h(this._mover),this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._updatingHandles=h(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??yt(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return"2d"===this.view?.type&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{sketchOptions:t,activeTooltipInfo:e,graphic:i}=this;return{sketchOptions:t,activeTooltipInfo:e,graphic:i,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(t,e,i,s,o)=>{this._setUpGeometryHelper();const r=t===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(t);const n=!0;if(this._syncGeometryAfterVertexMove(t,e,s,o,n),r){const{view:t}=this,s=t.toScreen(i),o=t.toScreen(e),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(t),this._emitReshapeStopEvent(t)}}}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}isUIGraphic(t){return t===this.graphic||this._isMidpoint(t)||this._isCurveControlPoint(t)||this._isVertex(t)||this._isConstructionLine(t)}refresh(t){if(this._reset(),this._setup(),t){for(const e of this.vertexGraphics)t.has(Rt(e))&&this._addToSelection(e);for(const e of this.curveControlPointGraphics)t.has(Rt(e))&&this._addToSelection(e)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:t}=this;t.length&&this._removeVertices(t)}_setup(){const{graphic:t,layer:e}=this;if(!e||null==t?.geometry)return;const i=t.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&S(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const t=this.graphic.geometry;if(null==t||"mesh"===t.type||"extent"===t.type)return this._segmentLabels=h(this._segmentLabels),void this._logGeometryTypeError();this._editGeometryOperations?this._syncEditGeometryOperations(t):this._editGeometryOperations=gt.fromGeometry(t,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels())}_saveSnappingContextForHandle(t,e){this._snappingGraphicsLayer=new D({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;l(i),this._snappingContext=new Gt({editGeometryOperations:i,elevationInfo:Ct,pointer:e.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new z(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._activeOperationInfo=null,this._mover=h(this._mover),this.removeHandles(St)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._removeCurveGraphics(t),this._updateTooltip()}_removeMidpointGraphics(t=this.layer){const{midpointGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeVertexGraphics(t=this.layer){const{vertexGraphics:e}=this;this._relatedGraphicIndex=null,t?.removeMany(e.items),e.drain(h)}_removeCurveGraphics(t=this.layer){const{curveControlPointGraphics:e,constructionLineGraphics:i}=this;t?.removeMany(e.items),t?.removeMany(i.items),e.drain(h),i.drain(h)}_setupGraphics(){const t=this.graphic.geometry;if(null!=t&&("polyline"===t.type||"polygon"===t.type||"multipoint"===t.type)){const e=wt(t);this.enableMidpoints&&"multipoint"!==t.type&&this._setUpMidpointGraphics(e),this.enableVertices&&(this._setUpVertexGraphics(e),this._setupCurveGraphics(e))}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=it(t,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){const e=st(t,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=e.graphicIndex,this.vertexGraphics.addMany(e.graphics),this.layer.addMany(e.graphics)}else{const e=st(t,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}}_setupCurveGraphics(t){this._removeCurveGraphics();const e=ot(t,this.symbols,this._coordinateHelper),i=rt(t,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(e),this.constructionLineGraphics.addMany(i),this.layer.addMany(i),this.layer.addMany(e)}async _setupSegmentLabels(){const t=this._editGeometryOperations,e=this.sketchOptions.labels.enabled;if(t&&this._segmentLabels?.context?.editGeometryOperations===t&&e||(this._segmentLabels=h(this._segmentLabels)),!this._segmentLabels&&t&&e){const e=this._segmentLabelsImportTask??=i(async t=>{const e=import("../../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(e);return t.aborted?null:i}),s=await e.promise;if(!s)return;this._segmentLabels=h(this._segmentLabels),this._segmentLabels=new s({context:{view:this.view,editGeometryOperations:t,elevationInfo:Ct,labelOptions:this.sketchOptions.labels},visible:!0})}}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:this.symbols.vertices.hover?.clone().set("color",t)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("color",t),hover:this.symbols.controlPoints.hover?.clone().set("color",t)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",t)};for(const e of this.vertexGraphics)this._isSelected(e)?e.symbol=this.symbols.vertices.selected:this._hoverGraphic===e?e.symbol=this.symbols.vertices.hover:e.symbol=this.symbols.vertices.default;for(const e of this.curveControlPointGraphics)this._isSelected(e)?e.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===e?e.symbol=this.symbols.controlPoints.hover:e.symbol=this.symbols.controlPoints.default;for(const e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:t})=>({x:t.x,y:t.y}));for(let i=0;i<e.length;i++){const s=[];for(let t=0;t<e.length;t++){if(i===t)continue;const o=e[i],r=e[t];o.x===r.x&&o.y===r.y&&s.push(t)}t[i].attributes[nt.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:t,graphic:e,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).toArray();t&&"multipoint"!==e.geometry?.type&&r.push(e),this._mover=new q({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:t}=this;null!=t&&0!==t.length&&(this._connectedReshapeManager=new K({providerFactories:t,view:this.view}))}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic,i=this._isCurveControlPoint(e);if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick?.(t);else if(this._isMidpoint(e)){if(2===t.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(t);this.refresh(),s.length&&this._emitVertexAddEvent([e],i,s)}else if(this._isVertex(e)||i){if(t.viewEvent.stopPropagation(),2===t.viewEvent.button)return void(i||this._removeVertices(e));t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)}}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t,o=this._connectedReshapeManager,r=o?jt(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._primaryGraphicMoving=!0,this._setUpOperation(t),this._emitMoveStartEvent(e,i),r&&o?.startFeatureMove([r]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),void(null!=n&&"point"===n.type&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(t);i.length&&(this._emitVertexAddEvent([s],e,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(t),r){const t=n.filter(t=>this._isVertex(t));o?.startVertexMove(r,Ut(t))}this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:r}=e,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else{if("point"===n.type)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const{dxMap:e,dyMap:o}=N(i,s,this.view);if(this._effectiveFilterVerticesEnabled){if(this.selectedManipulators.length>0){const t=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(const e of t){if("point"===e.geometry?.type){const{pathIndex:t,pointIndex:i}=e.attributes,s=H(n)[t][i];if(s){const t=O(s);e.geometry=this._coordinateHelper.arrayToPoint(t)}}this._addToSelection(e.clone())}}}else{const t=wt(n);this._updateVertexGraphicLocations(t)}this._connectedReshapeManager?.translate(e,o,0),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}this._syncEditGeometryOperations(n)}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!e)return;const{dx:i,dy:s,graphic:o,x:r,y:n}=t,{operationType:a}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>this._handleVertexSnap(o,{x:r,y:n},a))}_afterMoveStop(t,e){if(this._effectiveFilterVerticesEnabled&&"move"===e){const t=new Set;for(const e of this.selectedManipulators)t.add(Rt(e));return this.refresh(t),void this._updateTooltip()}if(this._isMidpoint(t)||t.getAttribute(nt.curveFromStraightEdgeFlag))return this.refresh(),void this._connectedReshapeManager?.finish();this._updateTooltip(this._isVertex(t)?t:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null}_handleVertexSnap(t,e,s){const o=t.geometry,r=this.snappingManager?.getVertexCandidates(),n=this.callbacks.onVertexSnap,a=()=>"move"===s?this._emitMoveStopEvent():this._emitReshapeStopEvent(t);if(!(n&&o&&w(o)&&r&&0!==r.length))return a(),void this._afterMoveStop(t,s);p(this._snappingTask),this._snappingTask=i(async i=>{try{const s=await n(o,e,r);c(i);const a=E(s);this._syncGeometryAfterVertexMove(t,a,0,0),t.geometry=a}finally{a(),this._afterMoveStop(t,s)}})}_updateVertexGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=e.arrayToPoint(O(t[s][o]))}this._updateMidpointGraphicLocations(t),this._updateCurveGraphicLocations(t)}_updateMidpointGraphicLocations(t,e){const{_coordinateHelper:i}=this;if(e)for(const s of this.midpointGraphics){const{pathIndex:o,pointIndexStart:r,pointIndexEnd:n}=s.attributes;if(!e.has(o))continue;const a=e.get(o);if(!a.has(r)&&!a.has(n))continue;const h=t[o];s.geometry=new G(at(h[r],h[n],i))}else for(const s of this.midpointGraphics){const{pathIndex:e,pointIndexStart:o,pointIndexEnd:r}=s.attributes,n=t[e];s.geometry=new G(at(n[o],n[r],i))}}_updateCurveGraphicLocations(t){const{spatialReference:e}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[t,e]=Tt(s);null!=t&&null!=e&&s.getAttribute(nt.controlPointKind)&&a(i,t,()=>new Set)?.add(e)}for(const s of this.curveControlPointGraphics){const[e,o]=Tt(s);if(i.get(e)?.has(o))continue;const r=t[e][o];if(L(r)||P(r)){const i=O(t[e][o-1]),n=L(r)?V(i,r):U(i,r),[a,h]=I(n,.25);s.geometry=new G({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(T(r)){const t=s.getAttribute(nt.controlPointKind),[e,i]=t===ht.bezier.cp1?r.b[1]:r.b[2];s.geometry=new G({x:e,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(nt.controlPointKind),[o,r]=Tt(s),n=t[o],a=O(n[r-1]),h=O(n[r]),p=t[o][r];i===ht.bezier.line1?s.geometry=new b({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:e}):s.geometry=new b({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:e})}}_refreshGraphicIndicesAttributes(t){const{componentIndex:e,vertexIndex:i}=t,s=t=>{const[s,o]=Tt(t);s===e&&o>=i&&t.setAttribute(nt.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(nt.pathIndex)!==e)continue;const t=o.getAttribute(nt.pointIndexStart);t>=i&&(o.setAttribute(nt.pointIndexStart,t+1),o.setAttribute(nt.pointIndexEnd,o.getAttribute(nt.pointIndexEnd)+1))}}_getVertexFromEditGeometry(t){const[e,i]=Tt(t);return l(this._editGeometryOperations),this._editGeometryOperations.data.parts[e].vertices[i]}_onHandleMove(t,e,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=t.geometry,h="graphic-move-stop"===o.type;if(a&&w(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(t,new G(this._stagedVertex),e,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});if(p.valid){const i=p.apply();i.z=W(this.snappingManager)??i.z,this._stagedVertex=i,this._syncGeometryAfterVertexMove(t,new G(this._stagedVertex),e,s,h),r()}})}else{const i=null!=this._stagedVertex?new G(this._stagedVertex):a;this._syncGeometryAfterVertexMove(t,i,e,s,h),r()}else r()}_syncGeometryAfterVertexMove(t,e,i,s,o=!1){const r=pt(this._editGeometryOperations?.data.geometry);if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(e),h=this._getVertexFromEditGeometry(t);let p=null;if(h){const t=n.getZ(a);p=[h.pos[0],h.pos[1]];const e=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=t?t-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],e,i,s),this._connectedReshapeManager?.translate(e,i,s)}if("point"===r.type)t.geometry=e;else if("mesh"===r.type)t.geometry=r.centerAt(e);else{if(t!==this.graphic){p&&!this._isVertex(t)&&(p=null);const o=n.spatialReference,[a,h]=Tt(t);let l=It(r);const c=n.pointToArray(e);if(this._updateGeometryFromGraphic(t,l,a,h,c,o,"polygon"===r.type),this._isVertex(t)||this._isCurveControlPoint(t)){const e=new Map;e.set(a,new Set([h])),l=this._moveRelatedCoordinates(l,t,c,e,p),l=this._moveSelectedHandleCoordinates(l,t,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(l,e),this._updateCurveGraphicLocations(l)}else this._isMidpoint(t)&&this._updateCurveGraphicLocations(l);lt(r,l)}this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_syncEditGeometryOperations(t){const e=this._editGeometryOperations?.trySetGeometry(t);e||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(t,e,i,s,o){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&o){const r=this._relatedGraphicIndex.search({minX:o[0],maxX:o[0],minY:o[1],maxY:o[1]});for(const n of r)n.coordinate[0]===o[0]&&n.coordinate[1]===o[1]&&n.graphic&&(s&&a(s,n.pathIndex,()=>new Set).add(n.pointIndex),Pt(t,n.pathIndex,n.pointIndex,i,this._coordinateHelper.spatialReference),this._relatedGraphicIndex.remove(n),n.coordinate[0]=e.geometry.x,n.coordinate[1]=e.geometry.y,n.graphic.geometry=e.geometry,this._relatedGraphicIndex.insert(n));return t}const{relatedGraphicIndices:r}=e.attributes,n=this._coordinateHelper.spatialReference;if(!r?.length)return t;for(const h of r){const o=this.vertexGraphics.at(h),[r,p]=Tt(o);s&&a(s,r,()=>new Set).add(p),Pt(t,r,p,i,n),o.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==e){const[e,a]=Tt(n),h=n.getAttribute(nt.relatedGraphicIndices),p=$(n.geometry,i,s,this.view),l=C(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,t,e,a,l,r,o),h?.length)for(const i of h){const e=this.vertexGraphics.at(i),[s,o]=Tt(e);Pt(t,s,o,l,r),e.geometry=p}}return t}_updateGeometryFromGraphic(t,e,i,s,o,r,n){const a=e[i].length-1;this._isCurveControlPoint(t)?kt(e,i,s,[o[0],o[1]],t.getAttribute(nt.controlPointKind)):(Pt(e,i,s,o,r),n&&(0===s?Pt(e,i,a,o,r):s===a&&(e[i][0]=o)))}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)?e.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.default),this.removeHandles(St),this._updateTooltip()}_handleMidpointClickOrStartMove(t){const{graphic:e}=t,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=pt(i),o=[],{[nt.pathIndex]:r,[nt.pointIndexStart]:n,[nt.pointIndexEnd]:a}=e.attributes,h=C(e.geometry),p=0===a?n+1:a;e.attributes={[nt.tool]:ct,[nt.pathIndex]:r,[nt.pointIndex]:p,[nt.relatedGraphicIndices]:[]};const l=It(s),c=l[r][a];if(R(c)){if(this.enableCurveOnMidpoint&&t.viewEvent.native.shiftKey){const t=O(l[r][p]);l[r].splice(p,1,{c:[t,[h[0],h[1]]]}),e.setAttribute(nt.controlPointKind,ht.circle.interior),e.setAttribute(nt.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(e),this.curveControlPointGraphics.push(e),lt(s,l)}else l[r].splice(p,0,h),o.push({coordinates:l[r][p],componentIndex:r,vertexIndex:p})}else{const t=O(l[r][n]),e=dt(t,c,.5,this._coordinateHelper);l[r].splice(a,1,...e),o.push({coordinates:O(l[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),this._syncEditGeometryOperations(s),o}_addToSelection(t){const e=At(t);for(const i of e)this._isCurveControlPoint(i)?i.symbol=this.symbols.controlPoints.selected:i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(e)}_removeFromSelection(t,e){if(this._isVertex(t)){const{vertices:i}=this.symbols;t.symbol=e?i.hover:i.default}else if(this._isCurveControlPoint(t)){const{controlPoints:i}=this.symbols;t.symbol=e?i.hover:i.default}this.selectedManipulators.remove(t),this._emitDeselectEvent([t]),this._updateTooltip()}_clearSelection(){const t=this.selectedManipulators.toArray(),{controlPoints:e,vertices:i}=this.symbols;if(t.length>0){for(const s of t)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=e.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(t),this._updateTooltip()}}_keyDownHandler(t){null==this._activeOperationInfo&&xt(t,this.tooltip)||_t.delete.includes(t.key)&&!t.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),t.stopPropagation())}_removeVertices(t){const e=this.graphic.geometry,i=this.vertexGraphics.length;if(null==e||"polygon"!==e.type&&"polyline"!==e.type&&"multipoint"!==e.type)return;if("polygon"===e.type&&i<4||"multipoint"===e.type&&i<2||"polyline"===e.type&&i<3)return;const s=this.graphic.clone(),o=pt(e);let r=It(o);const n=[],a=At(t);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:t,y:e}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=O(s[o]);if(t===a&&e===h){n.push({coordinates:O(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const t=r[i][o];t&&!R(t)&&(r[i][o]=O(t))}}}}if("polygon"===o.type)r=r.filter(t=>{if(t.length<2)return!1;const[e,i]=O(t[0]),[s,o]=O(t[t.length-1]);return(2!==t.length||e!==s||i!==o)&&(e===s&&i===o||t.push(t[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);lt(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isCurveControlPoint(t){return this.curveControlPointGraphics.includes(t)}_isConstructionLine(t){return this.constructionLineGraphics.includes(t)}_isSelected(t){return(this._isVertex(t)||this.curveControlPointGraphics.includes(t))&&this.selectedManipulators.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){const e=this._isMidpoint(t)?"copy":"move";this.addHandles(this.view.acquireCursor(e,"high"),St)}_updateTooltip(t,e){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:t===this.graphic?(i=r.translateGraphic,Q(i,o,this._tooltipsContext,this._updatingHandles,e)):t&&this.selectedManipulators.length>1&&(i=r.translateVertices,tt(i,o,n,this._tooltipsContext,this._updatingHandles,e)),this.activeTooltipInfo=i}_updateGraphicGeometry(t){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=t,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(t,e){const i={type:"move-start",mover:this.graphic,dx:t,dy:e};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(t,e){const i={type:"move",mover:this.graphic,dx:t,dy:e};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(t,e){if(null==t||null==e){const i=this._activeOperationInfo;if(!i)return;t=i.totalDx,e=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:t,dy:e};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(t){const e={type:"reshape-start",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",e),this.callbacks.onReshapeStart?.(e)}_emitReshapeEvent(t){const e={type:"reshape",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape",e),this.callbacks.onReshape?.(e)}_emitReshapeStopEvent(t){const e={type:"reshape-stop",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",e),this.callbacks.onReshapeStop?.(e)}_emitSelectEvent(t){const e={type:"vertex-select",added:t};this.emit("select",e),this.callbacks.onVertexSelect?.(e)}_emitDeselectEvent(t){const e={type:"vertex-deselect",removed:t};this.emit("deselect",e),this.callbacks.onVertexDeselect?.(e)}_emitVertexAddEvent(t,e,i){const s={type:"vertex-add",added:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(t,e,i){const s={type:"vertex-remove",removed:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function wt(t){let e=It(t);e=e.map(t=>t.slice());for(const i of e)for(let t=0;t<i.length;t++)i[t]=A(i[t]);if("polygon"===t.type)for(const i of e){const t=i[i.length-1];if(!R(t))continue;const e=i[0];e[0]===t[0]&&e[1]===t[1]&&i.length>2&&i.pop()}return e}function It(t){return"polygon"===t.type?t.curveRings?.slice()??t.rings.slice():"polyline"===t.type?t.curvePaths?.slice()??t.paths.slice():t.points.map(t=>[t])}function Vt(t,e,i,s){const o=t[e][i];if(L(o))o.c[1]=s;else if(P(o)){const o=O(t[e][i]);t[e][i]={c:[o,s]}}}function kt(t,e,i,s,o){switch(o){case ht.circle.interior:Vt(t,e,i,s);break;case ht.bezier.cp1:t[e][i].b[1]=s;break;case ht.bezier.cp2:t[e][i].b[2]=s}}function Ht(t,e){return t<1e-8*e}function Ot(t,{cx:e,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=t,[l,c]=n,d=l-h,m=c-p;e-=h,i-=p;const v=a?o>r:o<r,[u,y]=s?[e,i]:v?[-i,e]:[i,-e],[_,g]=[d,m],[f,G]=[u,y],b=_*G-g*f,x=(d**2+m**2)/2;if(Ht(Math.abs(b),x))return[(h+l)/2,(p+c)/2];const[M,S]=[G/b*x,-f/b*x],C=M**2+S**2,[E,w]=[d/2-M,m/2-S];if(Ht(E**2+w**2,C)){const[t,e]=v?[-S,M]:[S,-M];return[t+M+h,e+S+p]}const I=Math.sqrt((M**2+S**2)/(E**2+w**2))*Math.sign(d*u+m*y);return[E*I+M+h,w*I+S+p]}function Lt(t,e,i){const s=x(new b({curvePaths:[[t,e]],spatialReference:i})),{curvePaths:o}=M(s,i),r=o[0][1];return j(r)?r:k(t,r)}function Pt(t,e,i,s,o){const r=t[e][i],n=t[e].at(i+1);if(mt(t,e)){const i=t[e][1];return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0]})}if(vt(t,e)){const i=t[e][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,l]=[n-o,a-r],c=F(l,p);return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0,c,h,i.a[6]]})}const a=O(r);if(R(r))r.splice(0,r.length,...s);else if(T(r))r.b[0].splice(0,r.b[0].length,...s);else if(L(r)||P(r)){const o=O(t[e][i-1]),n=L(r)?V(o,r):U(o,r);t[e].splice(i,1,{c:[[...s],Ot(o,n,s,!0)]})}else if(j(r)){r.a[0].splice(0,r.a[0].length,...s);const n=O(t[e][i-1]);r.a=Lt(n,r,o).a}if(n&&!R(n)&&!T(r))if(L(n)||P(n)){const o=O(n),r=L(n)?V(a,n):U(a,n);t[e].splice(i+1,1,{c:[o,Ot(o,r,s,!1)]})}else if(j(n)){const t=O(r);n.a=Lt(t,n,o).a}}function Tt({attributes:t}){return[t?.[nt.pathIndex]||0,t?.[nt.pointIndex]||0]}function Rt({attributes:t}){return`${t?.[nt.pathIndex]}-${t?.[nt.pointIndex]}-${t?.[nt.controlPointKind]??"vertex"}`}function At(t){return t instanceof e?[t]:[...t]}function jt(t){const e=t.sourceLayer??t.layer;return Z(e)?{graphic:t,layer:e}:null}function Ut(t){return t.toArray().map(({attributes:t})=>({pathIndex:t[nt.pathIndex],vertexIndex:t[nt.pointIndex]}))}t([_()],Et.prototype,"_activeOperationInfo",void 0),t([_()],Et.prototype,"_connectedReshapeManager",void 0),t([_()],Et.prototype,"_coordinateHelper",null),t([_()],Et.prototype,"_editGeometryOperations",void 0),t([_()],Et.prototype,"_effectiveFilterVerticesEnabled",null),t([_()],Et.prototype,"_primaryGraphicMoving",void 0),t([_()],Et.prototype,"_segmentLabels",void 0),t([_()],Et.prototype,"test",null),t([_()],Et.prototype,"_segmentLabelsImportTask",void 0),t([_()],Et.prototype,"_updatingHandles",void 0),t([_()],Et.prototype,"_selectedManipulator",null),t([_()],Et.prototype,"_tooltipsContext",null),t([_()],Et.prototype,"callbacks",void 0),t([_()],Et.prototype,"connectedReshapeProviders",void 0),t([_()],Et.prototype,"enableMidpoints",void 0),t([_()],Et.prototype,"enableCurveOnMidpoint",void 0),t([_()],Et.prototype,"enableMovement",void 0),t([_()],Et.prototype,"enableVertices",void 0),t([_()],Et.prototype,"filterVerticesEnabled",void 0),t([_()],Et.prototype,"graphic",void 0),t([_()],Et.prototype,"highlightName",void 0),t([_()],Et.prototype,"highlightsEnabled",void 0),t([_()],Et.prototype,"layer",void 0),t([_()],Et.prototype,"snappingManager",void 0),t([_({readOnly:!0})],Et.prototype,"state",null),t([_()],Et.prototype,"symbols",void 0),t([_()],Et.prototype,"tooltip",void 0),t([_()],Et.prototype,"tooltipInfos",void 0),t([_()],Et.prototype,"activeTooltipInfo",void 0),t([_()],Et.prototype,"updating",null),t([_({type:ft})],Et.prototype,"sketchOptions",void 0),t([_({readOnly:!0})],Et.prototype,"type",void 0),t([_({readOnly:!0})],Et.prototype,"vertexGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"curveControlPointGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"constructionLineGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"midpointGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"selectedManipulators",void 0),t([_()],Et.prototype,"view",void 0),Et=t([g("esri.views.draw.support.Reshape")],Et);const Ft=Et;export{Ft as default};
2
+ import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,abortMaybe as p,assertIsSome as l}from"../../../core/maybe.js";import{throwIfAborted as c}from"../../../core/promiseUtils.js";import{pausable as d,when as m,watch as v,initial as u,sync as y}from"../../../core/reactiveUtils.js";import{property as _,subclass as g}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../../core/support/UpdatingHandles.js";import G from"../../../geometry/Point.js";import b from"../../../geometry/Polyline.js";import{fromPolylineUsingImportOperator as x,toGeometry as M}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as E}from"../../../geometry/support/jsonUtils.js";import{isPoint as w}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as I}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as V,toEllipticArc7 as k}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as H,getEndpoint as O,isCircularArc as L,isEllipticArc4 as P,isBezierCurve as T,isCoordinate as R,cloneCurve as A,isEllipticArc7 as j}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as U}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as F}from"../../../geometry/support/curves/mathUtils.js";import D from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as z}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as K}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as N,getZFromVertexSnappingCandidates as W,cloneMove as $}from"./drawUtils.js";import q from"./GraphicMover.js";import X from"./HighlightHelper.js";import{addUniqueLayer as Y,isConnectedReshapeSupportedLayer as Z}from"./layerUtils.js";import{createTooltipInfos as B,connectTooltip as J,updateTranslateTooltipInfo as Q,updateTranslateVertexTooltipInfo as tt}from"./reshapeTooltipUtils.js";import{defaultSymbols as et,createMidpointGraphics as it,createVertexGraphics as st,createCurveControlPointGraphics as ot,createCurveConstructionLineGraphics as rt,attributeKeys as nt,getMidpoint as at,controlPointKinds as ht,fastCloneGeometry as pt,saveUpdatedCurveOrCoordinate as lt,toolIdAttribute as ct,splitCurve as dt,isSingleSegmentCircle as mt,isSingleSegmentEllipse as vt}from"./reshapeUtils.js";import{ViewEventPriorities as ut}from"../../input/InputManager.js";import{createCoordinateHelper as yt}from"../../interactive/coordinateHelper.js";import{sketchKeys as _t}from"../../interactive/keybindings.js";import{EditGeometryOperations as gt}from"../../interactive/editGeometry/EditGeometryOperations.js";import ft from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as Gt}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as bt,enterInputModeIfAvailable as xt}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Mt}from"../../support/GeometryWorkerHandle.js";const St=Symbol(),Ct={mode:"on-the-ground",offset:0};let Et=class extends r{constructor(t){super(t),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new f,this._measurementWorker=new Mt({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=et,this.tooltip=null,this.activeTooltipInfo=null,this.sketchOptions=new ft,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const t=this.view;this._highlightHelper=new X({view:t}),this._setup(),this._updateHandlesOnExternalGeometryChange=d(()=>this.graphic?.geometry,t=>{if(!t||!0===this._primaryGraphicMoving)return;const e=new Set(this.selectedManipulators.map(Rt));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(t=>e.has(Rt(t))).forEach(t=>this._addToSelection(t)),this.curveControlPointGraphics.filter(t=>e.has(Rt(t))).forEach(t=>this._addToSelection(t));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).toArray();i&&h.push(o),s?.set("graphics",h)},y),this.tooltip=bt(()=>({view:t,options:this.sketchOptions.tooltips})),this.tooltipInfos=B(this.sketchOptions),this.addHandles([m(()=>t?.ready,()=>{const{layer:t,view:e}=this;Y(e,t),this.addHandles(e.on("key-down",t=>this._keyDownHandler(t),ut.TOOL))},{once:!0,initial:!0}),v(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[v(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],v(()=>this.layer,(t,e)=>{e&&(this._clearSelection(),this._resetGraphics(e)),this.refresh()}),v(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),v(()=>this.enableMidpoints,()=>this.refresh()),J(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),v(()=>this.sketchOptions.labels.enabled,t=>{this._segmentLabels?this._segmentLabels.visible=t:this._setUpGeometryHelper()}),v(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),u),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=h(this._mover),this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._updatingHandles=h(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??yt(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return"2d"===this.view?.type&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{sketchOptions:t,activeTooltipInfo:e,graphic:i}=this;return{sketchOptions:t,activeTooltipInfo:e,graphic:i,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(t,e,i,s,o)=>{this._setUpGeometryHelper();const r=t===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(t);const n=!0;if(this._syncGeometryAfterVertexMove(t,e,s,o,n),r){const{view:t}=this,s=t.toScreen(i),o=t.toScreen(e),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(t),this._emitReshapeStopEvent(t)}}}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}isUIGraphic(t){return t===this.graphic||this._isMidpoint(t)||this._isCurveControlPoint(t)||this._isVertex(t)||this._isConstructionLine(t)}refresh(t){if(this._reset(),this._setup(),t){for(const e of this.vertexGraphics)t.has(Rt(e))&&this._addToSelection(e);for(const e of this.curveControlPointGraphics)t.has(Rt(e))&&this._addToSelection(e)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:t}=this;t.length&&this._removeVertices(t)}_setup(){const{graphic:t,layer:e}=this;if(!e||null==t?.geometry)return;const i=t.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&S(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const t=this.graphic.geometry;if(null==t||"mesh"===t.type||"extent"===t.type)return this._segmentLabels=h(this._segmentLabels),void this._logGeometryTypeError();this._editGeometryOperations?this._syncEditGeometryOperations(t):this._editGeometryOperations=gt.fromGeometry(t,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels())}_saveSnappingContextForHandle(t,e){this._snappingGraphicsLayer=new D({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;l(i),this._snappingContext=new Gt({editGeometryOperations:i,elevationInfo:Ct,pointer:e.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new z(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._activeOperationInfo=null,this._mover=h(this._mover),this.removeHandles(St)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._removeCurveGraphics(t),this._updateTooltip()}_removeMidpointGraphics(t=this.layer){const{midpointGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeVertexGraphics(t=this.layer){const{vertexGraphics:e}=this;this._relatedGraphicIndex=null,t?.removeMany(e.items),e.drain(h)}_removeCurveGraphics(t=this.layer){const{curveControlPointGraphics:e,constructionLineGraphics:i}=this;t?.removeMany(e.items),t?.removeMany(i.items),e.drain(h),i.drain(h)}_setupGraphics(){const t=this.graphic.geometry;if(null!=t&&("polyline"===t.type||"polygon"===t.type||"multipoint"===t.type)){const e=wt(t);this.enableMidpoints&&"multipoint"!==t.type&&this._setUpMidpointGraphics(e),this.enableVertices&&(this._setUpVertexGraphics(e),this._setupCurveGraphics(e))}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=it(t,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){const e=st(t,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=e.graphicIndex,this.vertexGraphics.addMany(e.graphics),this.layer.addMany(e.graphics)}else{const e=st(t,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}}_setupCurveGraphics(t){this._removeCurveGraphics();const e=ot(t,this.symbols,this._coordinateHelper),i=rt(t,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(e),this.constructionLineGraphics.addMany(i),this.layer.addMany(i),this.layer.addMany(e)}async _setupSegmentLabels(){const t=this._editGeometryOperations,e=this.sketchOptions.labels.enabled;if(t&&this._segmentLabels?.context?.editGeometryOperations===t&&e||(this._segmentLabels=h(this._segmentLabels)),!this._segmentLabels&&t&&e){const e=this._segmentLabelsImportTask??=i(async t=>{const e=import("../../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(e);return t.aborted?null:i}),s=await e.promise;if(!s)return;this._segmentLabels=h(this._segmentLabels),this._segmentLabels=new s({context:{view:this.view,editGeometryOperations:t,elevationInfo:Ct,labelOptions:this.sketchOptions.labels},visible:!0})}}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:this.symbols.vertices.hover?.clone().set("color",t)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("color",t),hover:this.symbols.controlPoints.hover?.clone().set("color",t)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",t)};for(const e of this.vertexGraphics)this._isSelected(e)?e.symbol=this.symbols.vertices.selected:this._hoverGraphic===e?e.symbol=this.symbols.vertices.hover:e.symbol=this.symbols.vertices.default;for(const e of this.curveControlPointGraphics)this._isSelected(e)?e.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===e?e.symbol=this.symbols.controlPoints.hover:e.symbol=this.symbols.controlPoints.default;for(const e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:t})=>({x:t.x,y:t.y}));for(let i=0;i<e.length;i++){const s=[];for(let t=0;t<e.length;t++){if(i===t)continue;const o=e[i],r=e[t];o.x===r.x&&o.y===r.y&&s.push(t)}t[i].attributes[nt.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:t,graphic:e,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).toArray();t&&"multipoint"!==e.geometry?.type&&r.push(e),this._mover=new q({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:t}=this;null!=t&&0!==t.length&&(this._connectedReshapeManager=new K({providerFactories:t,view:this.view}))}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic,i=this._isCurveControlPoint(e);if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick?.(t);else if(this._isMidpoint(e)){if(2===t.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(t);this.refresh(),s.length&&this._emitVertexAddEvent([e],i,s)}else if(this._isVertex(e)||i){if(t.viewEvent.stopPropagation(),2===t.viewEvent.button)return void(i||this._removeVertices(e));t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)}}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t,o=this._connectedReshapeManager,r=o?jt(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._primaryGraphicMoving=!0,this._setUpOperation(t),this._emitMoveStartEvent(e,i),r&&o?.startFeatureMove([r]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),void(null!=n&&"point"===n.type&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(t);i.length&&(this._emitVertexAddEvent([s],e,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(t),r){const t=n.filter(t=>this._isVertex(t));o?.startVertexMove(r,Ut(t))}this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:r}=e,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else{if("point"===n.type)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const{dxMap:e,dyMap:o}=N(i,s,this.view);if(this._effectiveFilterVerticesEnabled){if(this.selectedManipulators.length>0){const t=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(const e of t){if("point"===e.geometry?.type){const{pathIndex:t,pointIndex:i}=e.attributes,s=H(n)[t][i];if(s){const t=O(s);e.geometry=this._coordinateHelper.arrayToPoint(t)}}this._addToSelection(e.clone())}}}else{const t=wt(n);this._updateVertexGraphicLocations(t)}this._connectedReshapeManager?.translate(e,o,0),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}this._syncEditGeometryOperations(n)}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!e)return;const{dx:i,dy:s,graphic:o,x:r,y:n}=t,{operationType:a}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>this._handleVertexSnap(o,{x:r,y:n},a))}_afterMoveStop(t,e){if(this._effectiveFilterVerticesEnabled&&"move"===e){const t=new Set;for(const e of this.selectedManipulators)t.add(Rt(e));return this.refresh(t),void this._updateTooltip()}if(this._isMidpoint(t)||t.getAttribute(nt.curveFromStraightEdgeFlag))return this.refresh(),void this._connectedReshapeManager?.finish();this._updateTooltip(this._isVertex(t)?t:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null}_handleVertexSnap(t,e,s){const o=t.geometry,r=this.snappingManager?.getVertexCandidates(),n=this.callbacks.onVertexSnap,a=()=>"move"===s?this._emitMoveStopEvent():this._emitReshapeStopEvent(t);if(!(n&&o&&w(o)&&r&&0!==r.length))return a(),void this._afterMoveStop(t,s);p(this._snappingTask),this._snappingTask=i(async i=>{try{const s=await n(o,e,r);c(i);const a=E(s);this._syncGeometryAfterVertexMove(t,a,0,0),t.geometry=a}finally{a(),this._afterMoveStop(t,s)}})}_updateVertexGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=e.arrayToPoint(O(t[s][o]))}this._updateMidpointGraphicLocations(t),this._updateCurveGraphicLocations(t)}_updateMidpointGraphicLocations(t,e){const{_coordinateHelper:i}=this;if(e)for(const s of this.midpointGraphics){const{pathIndex:o,pointIndexStart:r,pointIndexEnd:n}=s.attributes;if(!e.has(o))continue;const a=e.get(o);if(!a.has(r)&&!a.has(n))continue;const h=t[o];s.geometry=new G(at(h[r],h[n],i))}else for(const s of this.midpointGraphics){const{pathIndex:e,pointIndexStart:o,pointIndexEnd:r}=s.attributes,n=t[e];s.geometry=new G(at(n[o],n[r],i))}}_updateCurveGraphicLocations(t){const{spatialReference:e}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[t,e]=Tt(s);null!=t&&null!=e&&s.getAttribute(nt.controlPointKind)&&a(i,t,()=>new Set)?.add(e)}for(const s of this.curveControlPointGraphics){const[e,o]=Tt(s);if(i.get(e)?.has(o))continue;const r=t[e][o];if(L(r)||P(r)){const i=O(t[e][o-1]),n=L(r)?V(i,r):U(i,r),[a,h]=I(n,.25);s.geometry=new G({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(T(r)){const t=s.getAttribute(nt.controlPointKind),[e,i]=t===ht.bezier.cp1?r.b[1]:r.b[2];s.geometry=new G({x:e,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(nt.controlPointKind),[o,r]=Tt(s),n=t[o],a=O(n[r-1]),h=O(n[r]),p=t[o][r];i===ht.bezier.line1?s.geometry=new b({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:e}):s.geometry=new b({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:e})}}_refreshGraphicIndicesAttributes(t){const{componentIndex:e,vertexIndex:i}=t,s=t=>{const[s,o]=Tt(t);s===e&&o>=i&&t.setAttribute(nt.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(nt.pathIndex)!==e)continue;const t=o.getAttribute(nt.pointIndexStart);t>=i&&(o.setAttribute(nt.pointIndexStart,t+1),o.setAttribute(nt.pointIndexEnd,o.getAttribute(nt.pointIndexEnd)+1))}}_getVertexFromEditGeometry(t){const[e,i]=Tt(t);return l(this._editGeometryOperations),this._editGeometryOperations.data.parts[e].vertices[i]}_onHandleMove(t,e,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=t.geometry,h="graphic-move-stop"===o.type;if(a&&w(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(t,new G(this._stagedVertex),e,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});if(p.valid){const i=p.apply();i.z=W(this.snappingManager)??i.z,this._stagedVertex=i,this._syncGeometryAfterVertexMove(t,new G(this._stagedVertex),e,s,h),r()}})}else{const i=null!=this._stagedVertex?new G(this._stagedVertex):a;this._syncGeometryAfterVertexMove(t,i,e,s,h),r()}else r()}_syncGeometryAfterVertexMove(t,e,i,s,o=!1){const r=pt(this._editGeometryOperations?.data.geometry);if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(e),h=this._getVertexFromEditGeometry(t);let p=null;if(h){const t=n.getZ(a);p=[h.pos[0],h.pos[1]];const e=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=t?t-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],e,i,s),this._connectedReshapeManager?.translate(e,i,s)}if("point"===r.type)t.geometry=e;else if("mesh"===r.type)t.geometry=r.centerAt(e);else{if(t!==this.graphic){p&&!this._isVertex(t)&&(p=null);const o=n.spatialReference,[a,h]=Tt(t);let l=It(r);const c=n.pointToArray(e);if(this._updateGeometryFromGraphic(t,l,a,h,c,o,"polygon"===r.type),this._isVertex(t)||this._isCurveControlPoint(t)){const e=new Map;e.set(a,new Set([h])),l=this._moveRelatedCoordinates(l,t,c,e,p),l=this._moveSelectedHandleCoordinates(l,t,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(l,e),this._updateCurveGraphicLocations(l)}else this._isMidpoint(t)&&this._updateCurveGraphicLocations(l);lt(r,l)}this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_syncEditGeometryOperations(t){const e=this._editGeometryOperations?.trySetGeometry(t);e||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(t,e,i,s,o){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&o){const r=this._relatedGraphicIndex.search({minX:o[0],maxX:o[0],minY:o[1],maxY:o[1]});for(const n of r)n.coordinate[0]===o[0]&&n.coordinate[1]===o[1]&&n.graphic&&(s&&a(s,n.pathIndex,()=>new Set).add(n.pointIndex),Pt(t,n.pathIndex,n.pointIndex,i,this._coordinateHelper.spatialReference),this._relatedGraphicIndex.remove(n),n.coordinate[0]=e.geometry.x,n.coordinate[1]=e.geometry.y,n.graphic.geometry=e.geometry,this._relatedGraphicIndex.insert(n));return t}const{relatedGraphicIndices:r}=e.attributes,n=this._coordinateHelper.spatialReference;if(!r?.length)return t;for(const h of r){const o=this.vertexGraphics.at(h),[r,p]=Tt(o);s&&a(s,r,()=>new Set).add(p),Pt(t,r,p,i,n),o.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==e){const[e,a]=Tt(n),h=n.getAttribute(nt.relatedGraphicIndices),p=$(n.geometry,i,s,this.view),l=C(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,t,e,a,l,r,o),h?.length)for(const i of h){const e=this.vertexGraphics.at(i),[s,o]=Tt(e);Pt(t,s,o,l,r),e.geometry=p}}return t}_updateGeometryFromGraphic(t,e,i,s,o,r,n){const a=e[i].length-1;this._isCurveControlPoint(t)?kt(e,i,s,[o[0],o[1]],t.getAttribute(nt.controlPointKind)):(Pt(e,i,s,o,r),n&&(0===s?Pt(e,i,a,o,r):s===a&&(e[i][0]=o)))}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)?e.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.default),this.removeHandles(St),this._updateTooltip()}_handleMidpointClickOrStartMove(t){const{graphic:e}=t,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=pt(i),o=[],{[nt.pathIndex]:r,[nt.pointIndexStart]:n,[nt.pointIndexEnd]:a}=e.attributes,h=C(e.geometry),p=0===a?n+1:a;e.attributes={[nt.tool]:ct,[nt.pathIndex]:r,[nt.pointIndex]:p,[nt.relatedGraphicIndices]:[]};const l=It(s),c=l[r][a];if(R(c)){if(this.enableCurveOnMidpoint&&t.viewEvent.native.shiftKey){const t=O(l[r][p]);l[r].splice(p,1,{c:[t,[h[0],h[1]]]}),e.setAttribute(nt.controlPointKind,ht.circle.interior),e.setAttribute(nt.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(e),this.curveControlPointGraphics.push(e),lt(s,l)}else l[r].splice(p,0,h),o.push({coordinates:l[r][p],componentIndex:r,vertexIndex:p})}else{const t=O(l[r][n]),e=dt(t,c,.5,this._coordinateHelper);l[r].splice(a,1,...e),o.push({coordinates:O(l[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),this._syncEditGeometryOperations(s),o}_addToSelection(t){const e=At(t);for(const i of e)this._isCurveControlPoint(i)?i.symbol=this.symbols.controlPoints.selected:i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(e)}_removeFromSelection(t,e){if(this._isVertex(t)){const{vertices:i}=this.symbols;t.symbol=e?i.hover:i.default}else if(this._isCurveControlPoint(t)){const{controlPoints:i}=this.symbols;t.symbol=e?i.hover:i.default}this.selectedManipulators.remove(t),this._emitDeselectEvent([t]),this._updateTooltip()}_clearSelection(){const t=this.selectedManipulators.toArray(),{controlPoints:e,vertices:i}=this.symbols;if(t.length>0){for(const s of t)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=e.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(t),this._updateTooltip()}}_keyDownHandler(t){null==this._activeOperationInfo&&xt(t,this.tooltip)||_t.delete.includes(t.key)&&!t.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),t.stopPropagation())}_removeVertices(t){const e=this.graphic.geometry,i=this.vertexGraphics.length;if(null==e||"polygon"!==e.type&&"polyline"!==e.type&&"multipoint"!==e.type)return;if("polygon"===e.type&&i<4||"multipoint"===e.type&&i<2||"polyline"===e.type&&i<3)return;const s=this.graphic.clone(),o=pt(e);let r=It(o);const n=[],a=At(t);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:t,y:e}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=O(s[o]);if(t===a&&e===h){n.push({coordinates:O(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const t=r[i][o];t&&!R(t)&&(r[i][o]=O(t))}}}}if("polygon"===o.type)r=r.filter(t=>{if(t.length<2)return!1;const[e,i]=O(t[0]),[s,o]=O(t[t.length-1]);return(2!==t.length||e!==s||i!==o)&&(e===s&&i===o||t.push(t[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);lt(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isCurveControlPoint(t){return this.curveControlPointGraphics.includes(t)}_isConstructionLine(t){return this.constructionLineGraphics.includes(t)}_isSelected(t){return(this._isVertex(t)||this.curveControlPointGraphics.includes(t))&&this.selectedManipulators.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){const e=this._isMidpoint(t)?"copy":"move";this.addHandles(this.view.acquireCursor(e,"high"),St)}_updateTooltip(t,e){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:t===this.graphic?(i=r.translateGraphic,Q(i,o,this._tooltipsContext,this._updatingHandles,e)):t&&this.selectedManipulators.length>1&&(i=r.translateVertices,tt(i,o,n,this._tooltipsContext,this._updatingHandles,e)),this.activeTooltipInfo=i}_updateGraphicGeometry(t){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=t,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(t,e){const i={type:"move-start",mover:this.graphic,dx:t,dy:e};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(t,e){const i={type:"move",mover:this.graphic,dx:t,dy:e};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(t,e){if(null==t||null==e){const i=this._activeOperationInfo;if(!i)return;t=i.totalDx,e=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:t,dy:e};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(t){const e={type:"reshape-start",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",e),this.callbacks.onReshapeStart?.(e)}_emitReshapeEvent(t){const e={type:"reshape",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape",e),this.callbacks.onReshape?.(e)}_emitReshapeStopEvent(t){const e={type:"reshape-stop",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",e),this.callbacks.onReshapeStop?.(e)}_emitSelectEvent(t){const e={type:"vertex-select",added:t};this.emit("select",e),this.callbacks.onVertexSelect?.(e)}_emitDeselectEvent(t){const e={type:"vertex-deselect",removed:t};this.emit("deselect",e),this.callbacks.onVertexDeselect?.(e)}_emitVertexAddEvent(t,e,i){const s={type:"vertex-add",added:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(t,e,i){const s={type:"vertex-remove",removed:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function wt(t){let e=It(t);e=e.map(t=>t.slice());for(const i of e)for(let t=0;t<i.length;t++)i[t]=A(i[t]);if("polygon"===t.type)for(const i of e){const t=i[i.length-1];if(!R(t))continue;const e=i[0];e[0]===t[0]&&e[1]===t[1]&&i.length>2&&i.pop()}return e}function It(t){return"polygon"===t.type?t.curveRings?.slice()??t.rings.slice():"polyline"===t.type?t.curvePaths?.slice()??t.paths.slice():t.points.map(t=>[t])}function Vt(t,e,i,s){const o=t[e][i];if(L(o))o.c[1]=s;else if(P(o)){const o=O(t[e][i]);t[e][i]={c:[o,s]}}}function kt(t,e,i,s,o){switch(o){case ht.circle.interior:Vt(t,e,i,s);break;case ht.bezier.cp1:t[e][i].b[1]=s;break;case ht.bezier.cp2:t[e][i].b[2]=s}}function Ht(t,e){return t<1e-8*e}function Ot(t,{cx:e,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=t,[l,c]=n,d=l-h,m=c-p;e-=h,i-=p;const v=a?o>r:o<r,[u,y]=s?[e,i]:v?[-i,e]:[i,-e],[_,g]=[d,m],[f,G]=[u,y],b=_*G-g*f,x=(d**2+m**2)/2;if(Ht(Math.abs(b),x))return[(h+l)/2,(p+c)/2];const[M,S]=[G/b*x,-f/b*x],C=M**2+S**2,[E,w]=[d/2-M,m/2-S];if(Ht(E**2+w**2,C)){const[t,e]=v?[-S,M]:[S,-M];return[t+M+h,e+S+p]}const I=Math.sqrt((M**2+S**2)/(E**2+w**2))*Math.sign(d*u+m*y);return[E*I+M+h,w*I+S+p]}function Lt(t,e,i){const s=x(new b({curvePaths:[[t,e]],spatialReference:i})),{curvePaths:o}=M(s,i),r=o[0][1];return j(r)?r:k(t,r)}function Pt(t,e,i,s,o){const r=t[e][i],n=t[e].at(i+1);if(mt(t,e)){const i=t[e][1];return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0]})}if(vt(t,e)){const i=t[e][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,l]=[n-o,a-r],c=F(l,p);return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0,c,h,i.a[6]]})}const a=O(r);if(R(r))r.splice(0,r.length,...s);else if(T(r))r.b[0].splice(0,r.b[0].length,...s);else if(L(r)||P(r)){const o=O(t[e][i-1]),n=L(r)?V(o,r):U(o,r);t[e].splice(i,1,{c:[[...s],Ot(o,n,s,!0)]})}else if(j(r)){r.a[0].splice(0,r.a[0].length,...s);const n=O(t[e][i-1]);r.a=Lt(n,r,o).a}if(n&&!R(n)&&!T(r))if(L(n)||P(n)){const o=O(n),r=L(n)?V(a,n):U(a,n);t[e].splice(i+1,1,{c:[o,Ot(o,r,s,!1)]})}else if(j(n)){const t=O(r);n.a=Lt(t,n,o).a}}function Tt({attributes:t}){return[t?.[nt.pathIndex]||0,t?.[nt.pointIndex]||0]}function Rt({attributes:t}){return`${t?.[nt.pathIndex]}-${t?.[nt.pointIndex]}-${t?.[nt.controlPointKind]??"vertex"}`}function At(t){return t instanceof e?[t]:[...t]}function jt(t){const e=t.sourceLayer??t.layer;return Z(e)?{graphic:t,layer:e}:null}function Ut(t){return t.toArray().map(({attributes:t})=>({pathIndex:t[nt.pathIndex],vertexIndex:t[nt.pointIndex]}))}t([_()],Et.prototype,"_activeOperationInfo",void 0),t([_()],Et.prototype,"_connectedReshapeManager",void 0),t([_()],Et.prototype,"_coordinateHelper",null),t([_()],Et.prototype,"_editGeometryOperations",void 0),t([_()],Et.prototype,"_effectiveFilterVerticesEnabled",null),t([_()],Et.prototype,"_primaryGraphicMoving",void 0),t([_()],Et.prototype,"_segmentLabels",void 0),t([_()],Et.prototype,"test",null),t([_()],Et.prototype,"_segmentLabelsImportTask",void 0),t([_()],Et.prototype,"_updatingHandles",void 0),t([_()],Et.prototype,"_selectedManipulator",null),t([_()],Et.prototype,"_tooltipsContext",null),t([_()],Et.prototype,"callbacks",void 0),t([_()],Et.prototype,"connectedReshapeProviders",void 0),t([_()],Et.prototype,"enableMidpoints",void 0),t([_()],Et.prototype,"enableCurveOnMidpoint",void 0),t([_()],Et.prototype,"enableMovement",void 0),t([_()],Et.prototype,"enableVertices",void 0),t([_()],Et.prototype,"filterVerticesEnabled",void 0),t([_()],Et.prototype,"graphic",void 0),t([_()],Et.prototype,"highlightName",void 0),t([_()],Et.prototype,"highlightsEnabled",void 0),t([_()],Et.prototype,"layer",void 0),t([_()],Et.prototype,"snappingManager",void 0),t([_({readOnly:!0})],Et.prototype,"state",null),t([_()],Et.prototype,"symbols",void 0),t([_()],Et.prototype,"tooltip",void 0),t([_()],Et.prototype,"tooltipInfos",void 0),t([_()],Et.prototype,"activeTooltipInfo",void 0),t([_()],Et.prototype,"updating",null),t([_({type:ft})],Et.prototype,"sketchOptions",void 0),t([_({readOnly:!0})],Et.prototype,"type",void 0),t([_({readOnly:!0})],Et.prototype,"vertexGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"curveControlPointGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"constructionLineGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"midpointGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"selectedManipulators",void 0),t([_()],Et.prototype,"view",void 0),Et=t([g("esri.views.draw.support.Reshape")],Et);const Ft=Et;export{Ft as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.js";import{getOrCreateMapValue as t}from"../../../../core/MapUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as i}from"../../../../core/support/UpdatingHandles.js";import{MeasurementWorkerHandle as u}from"../../../support/MeasurementWorkerHandle.js";let m=class extends r{constructor(){super(...arguments),this._updatingHandles=new i,this._pluginAbortControllers=new WeakMap}destroy(){this._measurementWorker=s(this._measurementWorker)}get updating(){return this._updatingHandles.updating}get test(){return{overrideUtils:e=>{this._measurementWorker?.destroy(),this._measurementWorker=e}}}preloadMeasurementUtils(){this._measurementWorker??=new u({preloadGeodetic:!0})}suspendPlugin(e){const r=this._pluginAbortControllers.get(e);r?.forEach(e=>e.abort()),r?.clear()}async measureArea(e,r,t,s){this._measurementWorker??=new u({preloadGeodetic:!0});const n=this._setupAbortController(e,r);return o(n.signal),this._updatingHandles.addPromise(this._measurementWorker?.autoArea2D(t,{unit:s},n.signal)?.then(({area:e})=>e))}async measureLength(e,r,t,s){this._measurementWorker??=new u({preloadGeodetic:!0});const n=this._setupAbortController(e,r);return o(n.signal),this._updatingHandles.addPromise(this._measurementWorker?.autoLength2D(t,{unit:s},n.signal))}async measureDistance(e,r,t,s){this._measurementWorker??=new u({preloadGeodetic:!0});const n=this._setupAbortController(e,r);return o(n.signal),this._updatingHandles.addPromise(this._measurementWorker?.autoDistance2DBetweenPoints(t[0],t[1],{unit:s},n.signal))}_setupAbortController(e,r){const s=t(this._pluginAbortControllers,e,()=>new Map);s.get(r)?.abort();const o=new AbortController;return s.set(r,o),o}};e([n()],m.prototype,"updating",null),m=e([a("esri.views.draw.support.managers.MeasurementManager")],m);export{m as MeasurementManager};
2
+ import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.js";import{getOrCreateMapValue as t}from"../../../../core/MapUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as i}from"../../../../core/support/UpdatingHandles.js";import{GeometryWorkerHandle as u}from"../../../support/GeometryWorkerHandle.js";let m=class extends r{constructor(){super(...arguments),this._updatingHandles=new i,this._pluginAbortControllers=new WeakMap}destroy(){this._measurementWorker=s(this._measurementWorker)}get updating(){return this._updatingHandles.updating}get test(){return{overrideUtils:e=>{this._measurementWorker?.destroy(),this._measurementWorker=e}}}preloadMeasurementUtils(){this._measurementWorker??=new u({preloadGeodetic:!0})}suspendPlugin(e){const r=this._pluginAbortControllers.get(e);r?.forEach(e=>e.abort()),r?.clear()}async measureArea(e,r,t,s){this._measurementWorker??=new u({preloadGeodetic:!0});const n=this._setupAbortController(e,r);return o(n.signal),this._updatingHandles.addPromise(this._measurementWorker?.autoArea2D(t,{unit:s},n.signal)?.then(({area:e})=>e))}async measureLength(e,r,t,s){this._measurementWorker??=new u({preloadGeodetic:!0});const n=this._setupAbortController(e,r);return o(n.signal),this._updatingHandles.addPromise(this._measurementWorker?.autoLength2D(t,{unit:s},n.signal))}async measureDistance(e,r,t,s){this._measurementWorker??=new u({preloadGeodetic:!0});const n=this._setupAbortController(e,r);return o(n.signal),this._updatingHandles.addPromise(this._measurementWorker?.autoDistance2DBetweenPoints(t[0],t[1],{unit:s},n.signal))}_setupAbortController(e,r){const s=t(this._pluginAbortControllers,e,()=>new Map);s.get(r)?.abort();const o=new AbortController;return s.set(r,o),o}};e([n()],m.prototype,"updating",null),m=e([a("esri.views.draw.support.managers.MeasurementManager")],m);export{m as MeasurementManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../Color.js";import{onLocaleChange as s}from"../../intl.js";import o from"../../core/Accessor.js";import{createTask as r}from"../../core/asyncUtils.js";import{multiplyOpacity as i,getContrast as a}from"../../core/colorUtils.js";import{makeHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import{getOrCreateMapValue as l}from"../../core/MapUtils.js";import{deg2rad as d}from"../../core/mathUtils.js";import{debounce as c}from"../../core/promiseUtils.js";import{formatLength as p}from"../../core/quantityFormatUtils.js";import{on as m}from"../../core/reactiveUtils.js";import{createScreenPointArray as h}from"../../core/screenUtils.js";import{getMetersPerUnit as u,getMetersPerVerticalUnitForSR as f}from"../../core/units.js";import{property as g,subclass as _}from"../../core/accessorSupport/decorators.js";import{squaredDistance as b,set as x,normalize as y,scale as v,add as U,lerp as j}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as L}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{clone as I}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isVec3 as k}from"../../core/libs/gl-matrix-2/types/vec3.js";import{UpdatingHandles as C}from"../../core/support/UpdatingHandles.js";import w from"../../geometry/Polyline.js";import{isClockwise as P}from"../../geometry/support/coordsUtils.js";import{getEndpoint as T,isCoordinate as H,cloneCurve as M}from"../../geometry/support/curves/curveUtils.js";import{interpolate2D as D}from"../../geometry/support/curves/interpolateCurve.js";import{fetchMessageBundle as O}from"../../intl/messages.js";import{getConvertedElevationFromVector as S,absoluteHeightElevationInfo as R}from"../../support/elevationInfoUtils.js";import{getDefaultUnitForView as G}from"../../support/getDefaultUnitForView.js";import A from"../overlay/TextOverlayItem.js";import{MeasurementWorkerHandle as V}from"../support/MeasurementWorkerHandle.js";const W=3025,N={default:15,far:25};let q=class extends o{constructor(e){super(e),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance="default",this._updatingHandles=new C,this._messageUnitsTask=null,this._labelInfos=[],this._nextLabelIndex=0,this._debouncedLabelUpdates=new Map,this._measurementWorker=new V({preloadGeodetic:!0})}initialize(){this.addHandles([this._updatingHandles.add(()=>[null!=this.context&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits],()=>this._update()),m(()=>this.context?.editGeometryOperations,["vertex-add","vertex-remove"],()=>this._update()),m(()=>this.context?.editGeometryOperations,"vertex-update",e=>this._update(e.vertices)),this._updatingHandles.add(()=>this._colors,e=>this._updateStyle(e)),s(()=>this._refreshMessages()),n(()=>this._messageUnitsTask?.abort())]),this._refreshMessages()}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop());this._measurementWorker.destroy(),this._updatingHandles.destroy()}get updating(){return!this._messageUnitsTask?.finished||this._updatingHandles.updating}get test(){}get _messagesUnits(){return this._messageUnitsTask?.value}get _edgeDistancePixels(){return N[this.edgeDistance]}get _colors(){const e=this.context?.view.effectiveTheme.textColor??t.fromArray([255,255,255]);return{textColor:e,backgroundColor:i(a(e,160),.6)}}_update(e){if(this.destroyed)return;this._nextLabelIndex=0;const{context:t,stagedVertex:s}=this;if(!t)return this._destroyUnusedLabels();const o=t.editGeometryOperations.data,{parts:r,geometry:i,coordinateHelper:a}=o;if(!i)return this._destroyUnusedLabels();const n=r.length;for(let l=0;l<n;++l){const r=this.getRing(i,o,s,a,l),d=r.map(e=>k(e)?e:a.arrayToXYZ(T(e)));if(r.length<2||!z(r,t.view,t.elevationInfo,a.spatialReference))continue;const c=1===n&&!P(d);let p=Z,m=B;this.toScreenPointArray(t,d[0],p);for(let s=1;s<r.length;++s){const o=d[s-1],i=d[s],a=r[s];this.toScreenPointArray(t,i,m);const n=s===d.length-1,h=!(!e?.length||e.some(({index:e,part:t})=>t.index===l&&(e===s-1||e===s||n&&0===e)));this._addLabel(t,o,p,i,k(a)?null:a,m,c,h),[p,m]=[m,p]}}this._destroyUnusedLabels()}_updateStyle({textColor:e,backgroundColor:t}){const s=this._nextLabelIndex,o=this._labelInfos;for(let r=0;r<s;++r){const{label:s}=o[r];s.textColor=e,s.backgroundColor=t}}_updateLabelMeasurement(e,t,s,o,r){return l(this._debouncedLabelUpdates,o,()=>c(async(e,t,s,o,r)=>{const{spatialReference:i,coordinateHelper:a}=e.editGeometryOperations.data,n=!r||H(r),l=await(n?this._measurementWorker.autoDistance2DBetweenPoints(a.arrayToPoint(t),a.arrayToPoint(s)):this._measurementWorker.autoLength2D(new w({spatialReference:i,curvePaths:[[[t[0],t[1]],r]]})));if(o.destroyed)return;const d=this._messagesUnits,c=G(e.view);o.text=null==d||null==l||Number.isNaN(l.value)?"":p(d,l,c)}))(e,I(t),I(s),o,r?M(r):void 0)}_addLabel(e,t,s,o,r,i,a,n=!1){const{label:l,wasReused:d}=this._getOrCreateLabel(e);if(!this.visible||b(s,i)<W)return void(l.visible=!1);const{coordinateHelper:c}=e.editGeometryOperations.data;n&&d||this._updatingHandles.consumePromise(this._updateLabelMeasurement(e,t,o,l,r)),l.visible=!0;const p=i[0]-s[0],m=i[1]-s[1];if(a?x(X,-m,p):x(X,m,-p),y(X,X),v(X,X,this._edgeDistancePixels),r&&!H(r)){const s=c.arrayToXYZ(D(t,r,.5)),o=this.toScreenPointArray(e,s);U(Y,o,X)}else j(Y,s,i,.5),U(Y,Y,X);l.position=[Y[0],Y[1]],Math.abs(X[0])>Math.abs(X[1])?l.anchor=X[0]>0?"left":"right":l.anchor=-X[1]<0?"top":"bottom"}_getOrCreateLabel(e){const t=this._labelInfos.length>this._nextLabelIndex,{textColor:s,backgroundColor:o}=this._colors;if(t){const e=this._labelInfos[this._nextLabelIndex++],{label:t}=e;return t.textColor=s,t.backgroundColor=o,e.wasReused=!0,e}const r=new A({anchor:"center",fontSize:8,textColor:s,backgroundColor:o});e.view.overlay?.items.add(r);const i={label:r,wasReused:!1};return this._labelInfos.push(i),this._nextLabelIndex=this._labelInfos.length,i}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:e}){this.context?.view.overlay?.items.remove(e),e.destroy(),this._debouncedLabelUpdates.delete(e)}_refreshMessages(){this._messageUnitsTask?.abort(),this._messageUnitsTask=r(()=>O("esri/core/t9n/Units"))}};function z(e,t,s,o){if("2d"===t.type)return!0;const r=u(o)??1,i=f(o),a=e=>S(t,e,o,s,R)??0;for(let n=1;n<e.length;++n){const t=e[n-1],s=e[n];if(!k(t)||!k(s))return!1;const o=(s[0]-t[0])*r,l=(s[1]-t[1])*r,d=(a(s)-a(t))*i;if(Math.abs(d)/Math.sqrt(o*o+l*l)>F)return!1}return!0}e([g()],q.prototype,"context",void 0),e([g()],q.prototype,"stagedVertex",void 0),e([g()],q.prototype,"visible",void 0),e([g()],q.prototype,"edgeDistance",void 0),e([g()],q.prototype,"updating",null),e([g()],q.prototype,"_messageUnitsTask",void 0),e([g()],q.prototype,"_messagesUnits",null),e([g()],q.prototype,"_edgeDistancePixels",null),e([g()],q.prototype,"_colors",null),q=e([_("esri.views.interactive.SegmentLabels")],q);const F=d(5),X=L(),Y=L(),Z=h(),B=h();export{q as SegmentLabels};
2
+ import{__decorate as e}from"tslib";import t from"../../Color.js";import{onLocaleChange as s}from"../../intl.js";import o from"../../core/Accessor.js";import{createTask as r}from"../../core/asyncUtils.js";import{multiplyOpacity as i,getContrast as a}from"../../core/colorUtils.js";import{makeHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import{getOrCreateMapValue as l}from"../../core/MapUtils.js";import{deg2rad as d}from"../../core/mathUtils.js";import{debounce as c}from"../../core/promiseUtils.js";import{formatLength as p}from"../../core/quantityFormatUtils.js";import{on as m}from"../../core/reactiveUtils.js";import{createScreenPointArray as h}from"../../core/screenUtils.js";import{getMetersPerUnit as u,getMetersPerVerticalUnitForSR as f}from"../../core/units.js";import{property as g,subclass as _}from"../../core/accessorSupport/decorators.js";import{squaredDistance as b,set as x,normalize as y,scale as v,add as U,lerp as j}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as L}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{clone as I}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isVec3 as k}from"../../core/libs/gl-matrix-2/types/vec3.js";import{UpdatingHandles as C}from"../../core/support/UpdatingHandles.js";import w from"../../geometry/Polyline.js";import{isClockwise as P}from"../../geometry/support/coordsUtils.js";import{getEndpoint as T,isCoordinate as H,cloneCurve as D}from"../../geometry/support/curves/curveUtils.js";import{interpolate2D as M}from"../../geometry/support/curves/interpolateCurve.js";import{fetchMessageBundle as O}from"../../intl/messages.js";import{getConvertedElevationFromVector as S,absoluteHeightElevationInfo as G}from"../../support/elevationInfoUtils.js";import{getDefaultUnitForView as R}from"../../support/getDefaultUnitForView.js";import A from"../overlay/TextOverlayItem.js";import{GeometryWorkerHandle as V}from"../support/GeometryWorkerHandle.js";const W=3025,N={default:15,far:25};let q=class extends o{constructor(e){super(e),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance="default",this._updatingHandles=new C,this._messageUnitsTask=null,this._labelInfos=[],this._nextLabelIndex=0,this._debouncedLabelUpdates=new Map,this._measurementWorker=new V({preloadGeodetic:!0})}initialize(){this.addHandles([this._updatingHandles.add(()=>[null!=this.context&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits],()=>this._update()),m(()=>this.context?.editGeometryOperations,["vertex-add","vertex-remove"],()=>this._update()),m(()=>this.context?.editGeometryOperations,"vertex-update",e=>this._update(e.vertices)),this._updatingHandles.add(()=>this._colors,e=>this._updateStyle(e)),s(()=>this._refreshMessages()),n(()=>this._messageUnitsTask?.abort())]),this._refreshMessages()}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop());this._measurementWorker.destroy(),this._updatingHandles.destroy()}get updating(){return!this._messageUnitsTask?.finished||this._updatingHandles.updating}get test(){}get _messagesUnits(){return this._messageUnitsTask?.value}get _edgeDistancePixels(){return N[this.edgeDistance]}get _colors(){const e=this.context?.view.effectiveTheme.textColor??t.fromArray([255,255,255]);return{textColor:e,backgroundColor:i(a(e,160),.6)}}_update(e){if(this.destroyed)return;this._nextLabelIndex=0;const{context:t,stagedVertex:s}=this;if(!t)return this._destroyUnusedLabels();const o=t.editGeometryOperations.data,{parts:r,geometry:i,coordinateHelper:a}=o;if(!i)return this._destroyUnusedLabels();const n=r.length;for(let l=0;l<n;++l){const r=this.getRing(i,o,s,a,l),d=r.map(e=>k(e)?e:a.arrayToXYZ(T(e)));if(r.length<2||!z(r,t.view,t.elevationInfo,a.spatialReference))continue;const c=1===n&&!P(d);let p=Z,m=B;this.toScreenPointArray(t,d[0],p);for(let s=1;s<r.length;++s){const o=d[s-1],i=d[s],a=r[s];this.toScreenPointArray(t,i,m);const n=s===d.length-1,h=!(!e?.length||e.some(({index:e,part:t})=>t.index===l&&(e===s-1||e===s||n&&0===e)));this._addLabel(t,o,p,i,k(a)?null:a,m,c,h),[p,m]=[m,p]}}this._destroyUnusedLabels()}_updateStyle({textColor:e,backgroundColor:t}){const s=this._nextLabelIndex,o=this._labelInfos;for(let r=0;r<s;++r){const{label:s}=o[r];s.textColor=e,s.backgroundColor=t}}_updateLabelMeasurement(e,t,s,o,r){return l(this._debouncedLabelUpdates,o,()=>c(async(e,t,s,o,r)=>{const{spatialReference:i,coordinateHelper:a}=e.editGeometryOperations.data,n=!r||H(r),l=await(n?this._measurementWorker.autoDistance2DBetweenPoints(a.arrayToPoint(t),a.arrayToPoint(s)):this._measurementWorker.autoLength2D(new w({spatialReference:i,curvePaths:[[[t[0],t[1]],r]]})));if(o.destroyed)return;const d=this._messagesUnits,c=R(e.view);o.text=null==d||null==l||Number.isNaN(l.value)?"":p(d,l,c)}))(e,I(t),I(s),o,r?D(r):void 0)}_addLabel(e,t,s,o,r,i,a,n=!1){const{label:l,wasReused:d}=this._getOrCreateLabel(e);if(!this.visible||b(s,i)<W)return void(l.visible=!1);const{coordinateHelper:c}=e.editGeometryOperations.data;n&&d||this._updatingHandles.consumePromise(this._updateLabelMeasurement(e,t,o,l,r)),l.visible=!0;const p=i[0]-s[0],m=i[1]-s[1];if(a?x(X,-m,p):x(X,m,-p),y(X,X),v(X,X,this._edgeDistancePixels),r&&!H(r)){const s=c.arrayToXYZ(M(t,r,.5)),o=this.toScreenPointArray(e,s);U(Y,o,X)}else j(Y,s,i,.5),U(Y,Y,X);l.position=[Y[0],Y[1]],Math.abs(X[0])>Math.abs(X[1])?l.anchor=X[0]>0?"left":"right":l.anchor=-X[1]<0?"top":"bottom"}_getOrCreateLabel(e){const t=this._labelInfos.length>this._nextLabelIndex,{textColor:s,backgroundColor:o}=this._colors;if(t){const e=this._labelInfos[this._nextLabelIndex++],{label:t}=e;return t.textColor=s,t.backgroundColor=o,e.wasReused=!0,e}const r=new A({anchor:"center",fontSize:8,textColor:s,backgroundColor:o});e.view.overlay?.items.add(r);const i={label:r,wasReused:!1};return this._labelInfos.push(i),this._nextLabelIndex=this._labelInfos.length,i}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:e}){this.context?.view.overlay?.items.remove(e),e.destroy(),this._debouncedLabelUpdates.delete(e)}_refreshMessages(){this._messageUnitsTask?.abort(),this._messageUnitsTask=r(()=>O("esri/core/t9n/Units"))}};function z(e,t,s,o){if("2d"===t.type)return!0;const r=u(o)??1,i=f(o),a=e=>S(t,e,o,s,G)??0;for(let n=1;n<e.length;++n){const t=e[n-1],s=e[n];if(!k(t)||!k(s))return!1;const o=(s[0]-t[0])*r,l=(s[1]-t[1])*r,d=(a(s)-a(t))*i;if(Math.abs(d)/Math.sqrt(o*o+l*l)>F)return!1}return!0}e([g()],q.prototype,"context",void 0),e([g()],q.prototype,"stagedVertex",void 0),e([g()],q.prototype,"visible",void 0),e([g()],q.prototype,"edgeDistance",void 0),e([g()],q.prototype,"updating",null),e([g()],q.prototype,"_messageUnitsTask",void 0),e([g()],q.prototype,"_messagesUnits",null),e([g()],q.prototype,"_edgeDistancePixels",null),e([g()],q.prototype,"_colors",null),q=e([_("esri.views.interactive.SegmentLabels")],q);const F=d(5),X=L(),Y=L(),Z=h(),B=h();export{q as SegmentLabels};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as s}from"tslib";import t from"../../../core/Accessor.js";import e from"../../../core/Collection.js";import{property as o,subclass as i}from"../../../core/accessorSupport/decorators.js";import{LineSnapper as r}from"./LineSnapper.js";import{ParallelLineSnapper as n}from"./ParallelLineSnapper.js";import{RightAngleSnapper as p}from"./RightAngleSnapper.js";import{RightAngleTriangleSnapper as a}from"./RightAngleTriangleSnapper.js";import{sortCandidatesInPlace as m}from"./snappingUtils.js";import{MeasurementWorkerHandle as h}from"../../support/MeasurementWorkerHandle.js";let f=class extends t{constructor(s){super(s),this.updating=!1,this._measurementWorker=new h,this._snappers=new e,this._domain=2}initialize(){this._snappers.push(new n(this.view,this.options),new r(this.view,this.options,this._measurementWorker),new p(this.view,this.options,this._measurementWorker),new a(this.view,this.options))}destroy(){this._measurementWorker.destroy()}set options(s){this._set("options",s);for(const t of this._snappers)t.options=s}async fetchCandidates(s,t,e){if(!(t&this._domain)||!this.options.effectiveSelfEnabled||e.suppressSelfSnapping)return[];const o=[];for(const i of this._snappers.items)for(const t of await i.snap(s,e))o.push(t);return m(s,o),o}};s([o({readOnly:!0})],f.prototype,"updating",void 0),s([o({constructOnly:!0})],f.prototype,"view",void 0),s([o()],f.prototype,"options",null),f=s([i("esri.views.interactive.snapping.SelfSnappingEngine")],f);export{f as SelfSnappingEngine};
2
+ import{__decorate as s}from"tslib";import t from"../../../core/Accessor.js";import e from"../../../core/Collection.js";import{property as o,subclass as i}from"../../../core/accessorSupport/decorators.js";import{LineSnapper as r}from"./LineSnapper.js";import{ParallelLineSnapper as n}from"./ParallelLineSnapper.js";import{RightAngleSnapper as p}from"./RightAngleSnapper.js";import{RightAngleTriangleSnapper as a}from"./RightAngleTriangleSnapper.js";import{sortCandidatesInPlace as m}from"./snappingUtils.js";import{GeometryWorkerHandle as h}from"../../support/GeometryWorkerHandle.js";let f=class extends t{constructor(s){super(s),this.updating=!1,this._measurementWorker=new h,this._snappers=new e,this._domain=2}initialize(){this._snappers.push(new n(this.view,this.options),new r(this.view,this.options,this._measurementWorker),new p(this.view,this.options,this._measurementWorker),new a(this.view,this.options))}destroy(){this._measurementWorker.destroy()}set options(s){this._set("options",s);for(const t of this._snappers)t.options=s}async fetchCandidates(s,t,e){if(!(t&this._domain)||!this.options.effectiveSelfEnabled||e.suppressSelfSnapping)return[];const o=[];for(const i of this._snappers.items)for(const t of await i.snap(s,e))o.push(t);return m(s,o),o}};s([o({readOnly:!0})],f.prototype,"updating",void 0),s([o({constructOnly:!0})],f.prototype,"view",void 0),s([o()],f.prototype,"options",null),f=s([i("esri.views.interactive.snapping.SelfSnappingEngine")],f);export{f as SelfSnappingEngine};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{max as t,createLength as e,createArea as o}from"../../core/quantity.js";import{deriveLengthUnitFromAreaUnit as r}from"../../core/units.js";import{set as n,scale as i,normalize as s,cross as a,subtract as c,dot as m,add as f}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isEarth as p,isSphericalECEF as l}from"../../geometry/ellipsoidUtils.js";import g from"../../geometry/Multipoint.js";import y from"../../geometry/Point.js";import O from"../../geometry/Polygon.js";import h from"../../geometry/Polyline.js";import{projectWithoutEngine as S}from"../../geometry/projectionUtils.js";import J from"../../geometry/SpatialReference.js";import{WGS84ECEFSpatialReference as N,getSphericalPCPF as d,SphericalECEFSpatialReference as j}from"../../geometry/spatialReferenceEllipsoidUtils.js";import{e as R}from"../../chunks/areaOperator.js";import{e as w}from"../../chunks/centroidOperator.js";import{e as k}from"../../chunks/distanceOperator.js";import{l as v,e as P}from"../../chunks/geodeticAreaOperator.js";import{load as U,execute as x}from"../../geometry/operators/geodeticDistanceOperator.js";import{l as L,e as M}from"../../chunks/geodeticLengthOperator.js";import{e as b}from"../../chunks/lengthOperator.js";import{e as C}from"../../chunks/simplifyOperator.js";import{projectDirection as E}from"../../geometry/projection/projectDirection.js";import{fromJSON as q}from"../../geometry/support/jsonUtils.js";import{isWGS84 as z,isWebMercator as Z,isCGCS2000 as D,equals as W}from"../../geometry/support/spatialReferenceUtils.js";import{makeOrthonormal as $}from"../3d/support/mathUtils.js";import{autoMeasurementMode as A}from"./measurementWorkerUtils.js";async function I({geometryJSON:t,options:e}){await Promise.allSettled([v(),e?.returnLength?L():void 0]);const n=F(t,e),i=e?.unit??"square-meters",s=C(n)??n,a=P(s,{unit:i,...e}),c=o(a,i),m=e?.lengthUnit??r(i);return{area:c,centroid:e?.returnCentroid?G(s).toJSON():void 0,length:e?.returnLength?await H(s,{unit:m}):void 0}}function B(){v(),L(),U()}function F(t,e){const o="rings"in t?O.fromJSON(t):h.fromJSON(t);if(e?.stagedPoint){const t=y.fromJSON(e.stagedPoint),r=("rings"in o?o.rings:o.paths).at(-1);if(r){const{x:e,y:n,z:i,m:s}=t,a=o.hasZ&&o.hasM?[e,n,i??0,s??0]:o.hasZ?[e,n,i??0]:o.hasM?[e,n,s??0]:[e,n];r.push(a)}}return o}function G(t){return w(t)}async function H(t,o){await L();const r=o?.unit??"meters";return e(M(t,{...o,unit:r}),r)}function K({geometryJSON:t,options:e}){return H(F(t,e),e)}async function Q({geometry1JSON:t,geometry2JSON:o,options:r}){await U();const n=y.fromJSON(t),i=y.fromJSON(o),s=r?.unit??"meters";return e(x(n,i,{...r,unit:s}),s)}async function T({geometry1JSON:t,geometry2JSON:o,options:r}){await U();const n=g.fromJSON(t),i=g.fromJSON(o);if(n.points.length!==i.points.length)throw new Error("Input multipoints must have the same number of points.");const s=n.points.length,a=r?.unit??"meters",c=[],m={...r,unit:a};for(let f=0;f<s;f++){const t=n.getPoint(f),o=i.getPoint(f);c.push(null!=t&&null!=o?e(x(t,o,m),a):null)}return c}function V({geometryJSON:t,options:e}){return X(F(t,e),e)}function X(t,e){const n=e?.unit??"square-meters",i=e?.lengthUnit??r(n),s=C(t)??t,a=R(s,{unit:n,...e});return{area:o(a,n),centroid:e?.returnCentroid?G(s).toJSON():void 0,length:e?.returnLength?Y(s,{unit:i}):void 0}}function Y(t,o){const r=o?.unit??"meters";return e(b(t,{...o,unit:r}),r)}function _({geometryJSON:t,options:e}){return Y(F(t,e),e)}function tt({geometry1JSON:t,geometry2JSON:o,options:r}){const n=y.fromJSON(t),i=y.fromJSON(o),s=r?.unit??"meters";return e(k(n,i,{...r,unit:s}),s)}async function et(t){return it(t.geometryJSON.spatialReference,I,V)(t)}async function ot(t){return it(t.geometryJSON.spatialReference,K,_)(t)}async function rt(t){return it(t.geometry1JSON.spatialReference,Q,tt)(t)}async function nt(e){const o=it(e.topLeftJSON.spatialReference,Q,tt),{topLeftJSON:r,topRightJSON:n,bottomRightJSON:i,bottomLeftJSON:s,options:a}=e,[c,m,f,u]=await Promise.all([o({geometry1JSON:s,geometry2JSON:i,options:a}),o({geometry1JSON:r,geometry2JSON:n,options:a}),o({geometry1JSON:i,geometry2JSON:n,options:a}),o({geometry1JSON:s,geometry2JSON:r,options:a})]);return{width:t(c,m),height:t(u,f)}}function it(t,e,o){switch(A(t)){case 0:return e;case 1:return o}}function st(t){const{geometryJSON:e}=t,o=ut(e.spatialReference);if(!o)throw new Error("Cannot compute horizontal area without a valid spatial reference.");switch(o.mode){case 0:return V(t);case 1:return ct(o,t)}}function at({geometryJSON:t}){const e=q(t);if(!e)return null;const o=C(e);return o?o.toJSON():null}function ct(t,{geometryJSON:e,options:o}){const r=F(e,o),n=gt,i=pt,s=lt,a=W(r.spatialReference,t.spatialReference)?r.clone():S(r,r.spatialReference,t.spatialReference);if(!a)throw new Error(`Cannot project geometry from ${r.spatialReference?.wkid??"unknown"} to ${t.spatialReference.wkid}.`);ft(a,n,i,s);const{area:c,centroid:m,length:f}=X(a,o);return{area:c,centroid:mt(m,n,i,s,t.spatialReference,r.spatialReference),length:f}}function mt(t,e,o,r,n,s){if(!t)return t;i(o,o,t.x),i(r,r,t.y);const a=yt;return f(a,o,r),f(a,a,e),t.x=a[0],t.y=a[1],t.z=a[2],t.spatialReference=n,S(t,t.spatialReference,s)?.toJSON()??void 0}function ft(t,e,o,r){let f=0;n(e,0,0,0);for(const n of t.rings)for(const t of n)e[0]+=t[0],e[1]+=t[1],e[2]+=t[2],f++;i(e,e,1/f);const u=Ot;s(u,e);const p=ht,l=Math.atan2(u[1],u[0]);n(p,-Math.sin(l),Math.cos(l),0),W(t.spatialReference,N)&&(E(e,u,j,u,t.spatialReference),E(e,p,j,p,t.spatialReference)),$(p,u,o),a(r,o,u);const g=yt;for(const i of t.rings)for(const t of i){n(g,t[0],t[1],t[2]),c(g,g,e);const i=m(o,g),s=m(r,g);t[0]=i,t[1]=s}t.hasZ=!1,t.spatialReference=J.WebMercator}function ut(t){return t?p(t)?z(t)||Z(t)||D(t)||l(t)||W(t,N)?{mode:1,spatialReference:N}:{mode:0,spatialReference:t}:{mode:1,spatialReference:d(t)}:null}const pt=u(),lt=u(),gt=u(),yt=u(),Ot=u(),ht=u();export{V as area2D,st as areaHorizontal,et as autoArea2D,rt as autoDistance2DBetweenPoints,ot as autoLength2D,nt as autoSize2D,tt as distance2DBetweenPoints,I as geodeticArea,Q as geodeticDistanceBetweenPoints,T as geodeticDistanceBetweenPointsMany,K as geodeticLength,_ as length2D,B as preloadGeodetic,at as simplify};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{ignoreAbortErrors as t}from"../../core/promiseUtils.js";import{WorkerHandle as e}from"../../core/workers/WorkerHandle.js";import o from"../../geometry/Point.js";import{fromJSON as n}from"../../geometry/support/jsonUtils.js";class i extends e{constructor(t){super("GeometryWorker","geodeticArea",{},void 0,{strategy:"distributed"}),t?.preloadGeodetic&&this._preloadGeodetic()}async geodeticArea(t,e,n){const i=t.toJSON(),{area:r,centroid:s,length:a}=await this.invokeMethod("geodeticArea",{geometryJSON:i,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},n);return{area:r,centroid:s?o.fromJSON(s):void 0,length:a}}geodeticLength(t,e,o){const n=t.toJSON();return this.invokeMethod("geodeticLength",{geometryJSON:n,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},o)}geodeticDistanceBetweenPoints(t,e,o,n){const i=t.toJSON(),r=e.toJSON();return this.invokeMethod("geodeticDistanceBetweenPoints",{geometry1JSON:i,geometry2JSON:r,options:o},n)}geodeticDistanceBetweenPointsMany(t,e,o,n){const i=t.toJSON(),r=e.toJSON();return this.invokeMethod("geodeticDistanceBetweenPointsMany",{geometry1JSON:i,geometry2JSON:r,options:o},n)}_preloadGeodetic(){t(this.broadcast(void 0,"preloadGeodetic"))}async area2D(t,e,n){const i=t.toJSON(),{area:r,centroid:s,length:a}=await this.invokeMethod("area2D",{geometryJSON:i,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},n);return{area:r,centroid:s?o.fromJSON(s):void 0,length:a}}length2D(t,e,o){const n=t.toJSON();return this.invokeMethod("length2D",{geometryJSON:n,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},o)}distance2DBetweenPoints(t,e,o,n){const i=t.toJSON(),r=e.toJSON();return this.invokeMethod("distance2DBetweenPoints",{geometry1JSON:i,geometry2JSON:r,options:o},n)}async areaHorizontal(t,e,n){const i=t.toJSON(),{area:r,centroid:s,length:a}=await this.invokeMethod("areaHorizontal",{geometryJSON:i,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},n);return{area:r,centroid:s?o.fromJSON(s):void 0,length:a}}async autoArea2D(t,e,n){const i=t.toJSON(),{area:r,centroid:s,length:a}=await this.invokeMethod("autoArea2D",{geometryJSON:i,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},n);return{area:r,centroid:s?o.fromJSON(s):void 0,length:a}}async autoLength2D(t,e,o){const n=t.toJSON();return this.invokeMethod("autoLength2D",{geometryJSON:n,options:{...e,stagedPoint:e?.stagedPoint?.toJSON()}},o)}autoDistance2DBetweenPoints(t,e,o,n){const i=t.toJSON(),r=e.toJSON();return this.invokeMethod("autoDistance2DBetweenPoints",{geometry1JSON:i,geometry2JSON:r,options:o},n)}autoSize2D(t,e,o,n,i,r){const s=t.toJSON(),a=e.toJSON(),d=o.toJSON(),g=n.toJSON();return this.invokeMethod("autoSize2D",{topLeftJSON:s,topRightJSON:a,bottomRightJSON:d,bottomLeftJSON:g,options:i},r)}async simplify(t,e){const o=t.toJSON(),i=await this.invokeMethod("simplify",{geometryJSON:o},e);return i?n(i):null}}export{i as GeometryWorkerHandle};
@@ -20,7 +20,6 @@ import type { FieldValue } from "../../layers/support/fieldUtils.js";
20
20
  import type { TimeZone } from "../../time/types.js";
21
21
  import type { MapViewOrSceneView } from "../../views/MapViewOrSceneView.js";
22
22
  import type { ObjectId } from "../../views/types.js";
23
- import type { GridViewModelProperties } from "./Grid/GridViewModel.js";
24
23
  import type { DiscardPendingEditsParameters, FeatureStoreEdits, FeatureTableState, GridMultiSortPriority, GridSupportedColumns, TableInteractionCellClickEvent, TableInteractionCellDblclickEvent, TableInteractionCellKeydownEvent, TableInteractionCellPointeroverEvent, TableInteractionColumnReorderEvent, TableInteractionCellPointeroutEvent, TableMenuConfig } from "./Grid/types.js";
25
24
  import type { ColumnSortOrder, FeatureTableSupportedColumn as SupportedColumn, FeatureTableSupportedFilters as SupportedFilters, FeatureTableSupportedLayer, ActionColumnConfig, FeatureStoreItem } from "./support/types.js";
26
25
  import type { AttributeTableTemplateProperties } from "../../tables/AttributeTableTemplate.js";
@@ -33,7 +32,7 @@ import type { ExtentProperties } from "../../geometry/Extent.js";
33
32
  import type { TableTemplateProperties } from "./support/TableTemplate.js";
34
33
  import type { TimeExtentProperties } from "../../time/TimeExtent.js";
35
34
 
36
- export interface FeatureTableViewModelProperties extends GridViewModelProperties, Partial<Pick<FeatureTableViewModel, "actionColumnConfig" | "attachmentsEnabled" | "autoRefreshEnabled" | "autoSaveEnabled" | "columnPerformanceModeEnabled" | "columnReorderingEnabled" | "definitionExpression" | "editingEnabled" | "filterBySelectionEnabled" | "filterByViewExtent" | "highlightEnabled" | "initialSize" | "layer" | "layers" | "maxSize" | "menuConfig" | "multipleSelectionEnabled" | "multipleSortPriority" | "multiSortEnabled" | "outFields" | "pageIndex" | "pageSize" | "paginationEnabled" | "relatedRecordsEnabled" | "returnGeometryEnabled" | "returnMEnabled" | "returnZEnabled" | "selectionManager" | "syncTemplateOnChangesEnabled" | "syncViewSelection" | "tableController" | "tableParent" | "timeZone" | "view">> {
35
+ export interface FeatureTableViewModelProperties extends Partial<Pick<FeatureTableViewModel, "actionColumnConfig" | "attachmentsEnabled" | "autoRefreshEnabled" | "autoSaveEnabled" | "columnPerformanceModeEnabled" | "columnReorderingEnabled" | "definitionExpression" | "editingEnabled" | "filterBySelectionEnabled" | "filterByViewExtent" | "highlightEnabled" | "initialSize" | "layer" | "layers" | "maxSize" | "menuConfig" | "multipleSelectionEnabled" | "multipleSortPriority" | "multiSortEnabled" | "outFields" | "pageIndex" | "pageSize" | "paginationEnabled" | "relatedRecordsEnabled" | "returnGeometryEnabled" | "returnMEnabled" | "returnZEnabled" | "selectionManager" | "syncTemplateOnChangesEnabled" | "syncViewSelection" | "tableController" | "tableParent" | "timeZone" | "view">> {
37
36
  /**
38
37
  * Use this property to configure how columns display within the table in regard to visibility, column order, and sorting.
39
38
  *
@@ -289,7 +288,6 @@ export default class FeatureTableViewModel extends GridViewModel {
289
288
  * Use EventNames and EventTypes helpers from \@arcgis/core/Evented
290
289
  */
291
290
  "@eventTypes": FeatureTableViewModelEvents;
292
- /** @internal */
293
291
  constructor(properties?: FeatureTableViewModelProperties);
294
292
  /**
295
293
  * Reference to the current [action column](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/ActionColumn/). This column is only generated if a [configuration](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#actionColumnConfig) has been provided.
@@ -1,16 +1,7 @@
1
1
  import type { EventedAccessor } from "../../../core/Evented.js";
2
2
 
3
3
  /**
4
- * @internal
4
+ * @deprecated Not for direct use. See [FeatureTableViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/).
5
5
  * @since 5.0
6
6
  */
7
- export interface GridViewModelProperties {}
8
-
9
- /**
10
- * @internal
11
- * @since 5.0
12
- */
13
- export default class GridViewModel extends EventedAccessor {
14
- /** @internal */
15
- constructor(properties?: GridViewModelProperties);
16
- }
7
+ export default abstract class GridViewModel extends EventedAccessor {}
@@ -11,6 +11,7 @@ import type CatalogFootprintLayer from "../../../layers/catalog/CatalogFootprint
11
11
  import type KnowledgeGraphSublayer from "../../../layers/knowledgeGraph/KnowledgeGraphSublayer.js";
12
12
  import type Field from "../../../layers/support/Field.js";
13
13
  import type Sublayer from "../../../layers/support/Sublayer.js";
14
+ import type SubtypeSublayer from "../../../layers/support/SubtypeSublayer.js";
14
15
  import type AttachmentInfo from "../../../rest/query/support/AttachmentInfo.js";
15
16
  import type Column from "../Grid/Column.js";
16
17
  import type AttachmentsColumnTemplate from "./AttachmentsColumnTemplate.js";
@@ -80,7 +81,7 @@ export interface FormatFunctionParameters {
80
81
  }
81
82
 
82
83
  /** @since 5.0 */
83
- export type FeatureTableSupportedLayer = CatalogFootprintLayer | CSVLayer | FeatureLayer | GeoJSONLayer | ImageryLayer | KnowledgeGraphSublayer | SceneLayer | WFSLayer | OrientedImageryLayer | ParquetLayer | Sublayer;
84
+ export type FeatureTableSupportedLayer = CatalogFootprintLayer | CSVLayer | FeatureLayer | GeoJSONLayer | ImageryLayer | KnowledgeGraphSublayer | SceneLayer | WFSLayer | SubtypeSublayer | OrientedImageryLayer | ParquetLayer | Sublayer;
84
85
 
85
86
  /** @since 5.0 */
86
87
  export type FeatureTableSupportedColumn = Column;
@@ -0,0 +1,28 @@
1
+ import type Accessor from "../../core/Accessor.js";
2
+
3
+ /** @since 5.1 */
4
+ export interface OrientedImageryViewerVisibleElementsProperties extends Partial<Pick<OrientedImageryViewerVisibleElements, "menu" | "title">> {}
5
+
6
+ /**
7
+ * An object containing properties that control the visibility of certain elements within the [OrientedImageryViewer](https://developers.arcgis.com/javascript/latest/references/core/widgets/OrientedImageryViewer/) widget.
8
+ *
9
+ * @since 5.1
10
+ */
11
+ export default class OrientedImageryViewerVisibleElements extends Accessor {
12
+ /** @since 5.1 */
13
+ constructor(properties?: OrientedImageryViewerVisibleElementsProperties);
14
+ /**
15
+ * Indicates whether to display the action bar of the widget.
16
+ *
17
+ * @default true
18
+ * @since 5.1
19
+ */
20
+ accessor menu: boolean;
21
+ /**
22
+ * Indicates whether to display the title of the widget.
23
+ *
24
+ * @default true
25
+ * @since 5.1
26
+ */
27
+ accessor title: boolean;
28
+ }
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import e from"../../core/Accessor.js";import{deprecatedProperty as t}from"../../core/deprecate.js";import l from"../../core/Logger.js";import{property as n,subclass as a}from"../../core/accessorSupport/decorators.js";let i=class extends e{constructor(){super(...arguments),this.additionalFootprintToggle=!0,this.additionalCameraLocationsToggle=!0,this.currentFootprintToggle=!0,this.exploreImages=!0,this.exploreImages3D=!0,this.overlays=!0,this.enhancementTool=!0,this.imageGallery=!0,this.imageNavigationTools=!0,this.imageOverlays=!0,this.measurementTools=!0,this.mapImageConversionTool=!0,this.menu=!0,this.navigationTool=!0,this.digitization=!0,this.title=!0,this.searchTools=!0,this.showPopupsAction=!0,this.showSelectedImage=!0,this.directionalNavigation=!0,this.sequentialNavigation=!0,this.utilityTools=!0}get coverageMenu(){return t(l.getLogger(this),"coverageMenu",{replacement:"menu"}),this.menu}set coverageMenu(o){t(l.getLogger(this),"coverageMenu",{replacement:"menu"}),this.menu=o}};o([n({type:Boolean,nonNullable:!0})],i.prototype,"additionalFootprintToggle",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"additionalCameraLocationsToggle",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"currentFootprintToggle",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"coverageMenu",null),o([n({type:Boolean,nonNullable:!0})],i.prototype,"exploreImages",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"exploreImages3D",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"overlays",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"enhancementTool",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"imageGallery",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"imageNavigationTools",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"imageOverlays",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"measurementTools",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"mapImageConversionTool",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"menu",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"navigationTool",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"digitization",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"title",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"searchTools",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"showPopupsAction",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"showSelectedImage",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"directionalNavigation",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"sequentialNavigation",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"utilityTools",void 0),i=o([a("esri.widgets.OrientedImageryViewer.OrientedImageryViewerVisibleElements")],i);const p=i;export{p as default};
2
+ import{__decorate as o}from"tslib";import e from"../../core/Accessor.js";import{deprecatedProperty as t}from"../../core/deprecate.js";import l from"../../core/Logger.js";import{property as n,subclass as a}from"../../core/accessorSupport/decorators.js";let i=class extends e{constructor(o){super(o),this.additionalFootprintToggle=!0,this.additionalCameraLocationsToggle=!0,this.currentFootprintToggle=!0,this.exploreImages=!0,this.exploreImages3D=!0,this.overlays=!0,this.enhancementTool=!0,this.imageGallery=!0,this.imageNavigationTools=!0,this.imageOverlays=!0,this.measurementTools=!0,this.mapImageConversionTool=!0,this.menu=!0,this.navigationTool=!0,this.digitization=!0,this.title=!0,this.searchTools=!0,this.showPopupsAction=!0,this.showSelectedImage=!0,this.directionalNavigation=!0,this.sequentialNavigation=!0,this.utilityTools=!0}get coverageMenu(){return t(l.getLogger(this),"coverageMenu",{replacement:"menu"}),this.menu}set coverageMenu(o){t(l.getLogger(this),"coverageMenu",{replacement:"menu"}),this.menu=o}};o([n({type:Boolean,nonNullable:!0})],i.prototype,"additionalFootprintToggle",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"additionalCameraLocationsToggle",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"currentFootprintToggle",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"coverageMenu",null),o([n({type:Boolean,nonNullable:!0})],i.prototype,"exploreImages",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"exploreImages3D",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"overlays",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"enhancementTool",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"imageGallery",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"imageNavigationTools",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"imageOverlays",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"measurementTools",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"mapImageConversionTool",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"menu",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"navigationTool",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"digitization",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"title",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"searchTools",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"showPopupsAction",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"showSelectedImage",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"directionalNavigation",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"sequentialNavigation",void 0),o([n({type:Boolean,nonNullable:!0})],i.prototype,"utilityTools",void 0),i=o([a("esri.widgets.OrientedImageryViewer.OrientedImageryViewerVisibleElements")],i);const p=i;export{p as default};
@@ -2,8 +2,10 @@ import type Point from "../geometry/Point.js";
2
2
  import type OrientedImageryLayer from "../layers/OrientedImageryLayer.js";
3
3
  import type Widget from "./Widget.js";
4
4
  import type OrientedImageryViewerViewModel from "./OrientedImageryViewer/OrientedImageryViewerViewModel.js";
5
+ import type OrientedImageryViewerVisibleElements from "./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";
5
6
  import type { Icon } from "@esri/calcite-components/components/calcite-icon";
6
7
  import type { MapViewOrSceneView } from "../views/MapViewOrSceneView.js";
8
+ import type { OrientedImageryViewerVisibleElementsProperties } from "./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";
7
9
  import type { WidgetProperties } from "./Widget.js";
8
10
 
9
11
  export interface OrientedImageryViewerProperties extends WidgetProperties, Partial<Pick<OrientedImageryViewer, "currentCoverageVisible" | "dataCaptureEnabled" | "disabled" | "galleryOpened" | "imageEnhancementToolActive" | "imageOverlaysOpened" | "isAdditionalCoverageVisible" | "isAdditionalPointSourcesVisible" | "layer" | "mapImageConversionToolState" | "navigationToolActive" | "preloadMedia" | "view">> {
@@ -16,6 +18,18 @@ export interface OrientedImageryViewerProperties extends WidgetProperties, Parti
16
18
  * @see [Calcite Icon Search](https://developers.arcgis.com/calcite-design-system/icons/)
17
19
  */
18
20
  icon?: Icon["icon"] | null;
21
+ /**
22
+ * The visible elements that are displayed within the widget.
23
+ * This property provides the ability to turn individual elements of the widget's display on/off.
24
+ *
25
+ * @since 5.1
26
+ * @example
27
+ * orientedImageryViewer.visibleElements = {
28
+ * menu: true,
29
+ * title: false,
30
+ * }
31
+ */
32
+ visibleElements?: OrientedImageryViewerVisibleElementsProperties;
19
33
  }
20
34
 
21
35
  /**
@@ -169,6 +183,19 @@ export default class OrientedImageryViewer extends Widget {
169
183
  * all properties and methods on the widget.
170
184
  */
171
185
  get viewModel(): OrientedImageryViewerViewModel;
186
+ /**
187
+ * The visible elements that are displayed within the widget.
188
+ * This property provides the ability to turn individual elements of the widget's display on/off.
189
+ *
190
+ * @since 5.1
191
+ * @example
192
+ * orientedImageryViewer.visibleElements = {
193
+ * menu: true,
194
+ * title: false,
195
+ * }
196
+ */
197
+ get visibleElements(): OrientedImageryViewerVisibleElements;
198
+ set visibleElements(value: OrientedImageryViewerVisibleElementsProperties);
172
199
  /**
173
200
  * Resets the viewer to its initial state.
174
201
  * This method clears the currently displayed image or video from the viewer and removes all associated graphics from the map.
@@ -14,7 +14,6 @@ import type SnappingOptions from "../../views/interactive/snapping/SnappingOptio
14
14
  import type { EventedAccessor } from "../../core/Evented.js";
15
15
  import type { TextSymbolProperties } from "../../symbols/TextSymbol.js";
16
16
  import type { MapViewOrSceneView } from "../../views/MapViewOrSceneView.js";
17
- import type { PluginConfiguration } from "../../views/draw/support/types.js";
18
17
  import type { SnappingOptionsProperties } from "../../views/interactive/snapping/SnappingOptions.js";
19
18
  import type { CreateEvent, CreateOptions, CreateTool, CreationMode, DeleteEvent, RedoEvent, SketchPointSymbol, SketchPolygonSymbol, SketchPolylineSymbol, SketchTool, State, UpdateEvent, UpdateOptions, UndoEvent } from "./types.js";
20
19
  import type { CIMSymbolProperties } from "../../symbols/CIMSymbol.js";
@@ -642,6 +641,15 @@ export default class SketchViewModel extends EventedAccessor {
642
641
  */
643
642
  get defaultUpdateOptions(): UpdateOptions;
644
643
  set defaultUpdateOptions(value: Partial<UpdateOptions>);
644
+ /**
645
+ * Indicates whether an asynchronous geometry simplification operation is in progress.
646
+ *
647
+ * Starting new operations (update, create) are blocked when this is true. Call
648
+ * `cancel` to cancel the long-running operation.
649
+ *
650
+ * @since 5.1
651
+ */
652
+ get geometrySimplificationInProgress(): boolean;
645
653
  /**
646
654
  * Use this property to determine if the next generation geometry creation
647
655
  * has been disabled. This can happen when
@@ -871,7 +879,7 @@ export default class SketchViewModel extends EventedAccessor {
871
879
  * // create an ellipse
872
880
  * sketchVM.create("circle", { preserveAspectRatio: false });
873
881
  */
874
- create(tool: CreateTool | PluginConfiguration[], createOptions?: CreateOptions | null): Promise<void>;
882
+ create(tool: CreateTool, createOptions?: CreateOptions | null): Promise<void>;
875
883
  /**
876
884
  * Deletes the selected graphics used in the update workflow. Calling this method will fire the
877
885
  * [@delete](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/#event-delete) event.