@arcgis/core 5.1.0-next.77 → 5.1.0-next.79

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 (589) hide show
  1. package/analysis/ElevationProfile/ElevationProfileGroup.d.ts +74 -0
  2. package/analysis/ElevationProfile/ElevationProfileGroup.js +2 -0
  3. package/analysis/ElevationProfileAnalysis.d.ts +29 -14
  4. package/analysis/ElevationProfileAnalysis.js +1 -1
  5. package/analysis/ShadowCast/DiscreteOptions.d.ts +33 -6
  6. package/analysis/ShadowCast/DiscreteOptions.js +1 -1
  7. package/analysis/ShadowCast/MinDurationOptions.d.ts +6 -4
  8. package/analysis/ShadowCast/TotalDurationOptions.d.ts +33 -6
  9. package/analysis/ShadowCast/TotalDurationOptions.js +1 -1
  10. package/analysis/ShadowCast/colorStopsUtils.js +2 -0
  11. package/analysis/ShadowCastAnalysis.d.ts +24 -1
  12. package/analysis/ShadowCastAnalysis.js +1 -1
  13. package/analysis/Viewshed.d.ts +27 -0
  14. package/analysis/Viewshed.js +1 -1
  15. package/analysis/ViewshedAnalysis.js +1 -1
  16. package/applications/Components/OrientedImageryViewer/ImageViewer/utils.d.ts +34 -0
  17. package/applications/Components/OrientedImageryViewer/ImageViewer/utils.js +2 -0
  18. package/arcade/FunctionWrapper.js +1 -1
  19. package/arcade/arcadeAsyncRuntime.js +1 -1
  20. package/arcade/arcadeCompiler.js +1 -1
  21. package/arcade/arcadeRuntime.js +1 -1
  22. package/arcade/compilerUtils.js +1 -1
  23. package/arcade/debug.d.ts +139 -0
  24. package/arcade/debug.js +2 -0
  25. package/arcade/featureSetCollection.js +1 -1
  26. package/arcade/featureSetUtils.js +1 -1
  27. package/arcade/featureset/actions/GroupBy.js +1 -1
  28. package/arcade/featureset/actions/OrderBy.js +1 -1
  29. package/arcade/functions/featuresetstring.js +1 -1
  30. package/arcade/languageUtils.js +1 -1
  31. package/arcade.d.ts +46 -2
  32. package/arcade.js +1 -1
  33. package/assets/esri/core/workers/RemoteClient.js +1 -1
  34. package/assets/esri/core/workers/chunks/{1c7183551f5269bdcf13.js → 01bd1b86ba899c6aa4c0.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{1f8ccf96069ac3a40c3d.js → 01ee18782a50279f907e.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{34ea3ed78041437a8fc8.js → 022067e807905cabeaa1.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{537fe2522dff1e6ce03b.js → 052cdc7aaa803b5873f0.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{8d75f6f27c1c17c33992.js → 056fd7847caaff2c9514.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{8acee3fba488f202f82f.js → 05c3146d87d917606193.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{75d5ea0da181f9e7425f.js → 0aebcbf41cb193e76809.js} +11 -11
  41. package/assets/esri/core/workers/chunks/{54023458195549f66215.js → 0b77c124b743067e4155.js} +1 -1
  42. package/assets/esri/core/workers/chunks/10408183681fd6c7b4ed.js +2 -0
  43. package/assets/esri/core/workers/chunks/17acbf40e7c1cb42d9bd.js +1 -0
  44. package/assets/esri/core/workers/chunks/{baeb96aef03d4c566af7.js → 1f53620f82cc7c3daabe.js} +1 -1
  45. package/assets/esri/core/workers/chunks/2387613b855771a3e537.js +1 -0
  46. package/assets/esri/core/workers/chunks/283d39dfb1625b5a74db.js +1 -0
  47. package/assets/esri/core/workers/chunks/{7595ceba529ed01c7590.js → 2c87c3112a43db8624f6.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{13e60f19f436b8d683ae.js → 3c9482764c9e4f8bcbb0.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{5e1b847b116d21908a54.js → 3e37019eee1c49d2bf64.js} +1 -1
  50. package/assets/esri/core/workers/chunks/45c83eb7c2a06166e3b0.js +1 -0
  51. package/assets/esri/core/workers/chunks/48acd146bf0241d87647.js +1 -0
  52. package/assets/esri/core/workers/chunks/5818f1f526577068d6ca.js +2 -0
  53. package/assets/esri/core/workers/chunks/5b6f2bfdcdd207d8ae42.js +1 -0
  54. package/assets/esri/core/workers/chunks/{330b47ac0759c3c35cc5.js → 5ccc325d83cec4f5ccdb.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{30e710ec4d22c43d4e7e.js → 5cffc7b49966201eccdb.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{1a87e9bbd85ba29b1514.js → 5da2051f548c2942e01a.js} +1 -1
  57. package/assets/esri/core/workers/chunks/5ec66e39e53c11e75179.js +2 -0
  58. package/assets/esri/core/workers/chunks/{0b1454a77a6a682541dc.js.LICENSE.txt → 5ec66e39e53c11e75179.js.LICENSE.txt} +9 -1
  59. package/assets/esri/core/workers/chunks/5f6fd20a7f4e80eafa25.js +1 -0
  60. package/assets/esri/core/workers/chunks/{abc06d10c7ac8ba5b0e4.js → 67ec1694d6e18b7c234c.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{32e22d6eee9fed1f70b0.js → 6d696beddcc5fbed5875.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{f590b60fca607d66001a.js → 716a4d7e8b908b81870b.js} +1 -1
  63. package/assets/esri/core/workers/chunks/71fe127734f33d020a44.js +1 -0
  64. package/assets/esri/core/workers/chunks/7cdd0492b2191df95102.js +2 -0
  65. package/assets/esri/core/workers/chunks/7cea68257d24ffd205bb.js +1 -0
  66. package/assets/esri/core/workers/chunks/7e530e635325dba07864.js +1 -0
  67. package/assets/esri/core/workers/chunks/{6b66fc32451433129a88.js → 8508f238d99021e87f71.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{bc75ab48f4c7609ef09d.js → 85d3475667c503ec4fc6.js} +1 -1
  69. package/assets/esri/core/workers/chunks/8f6f5dad52747d252aac.js +596 -0
  70. package/assets/esri/core/workers/chunks/{d950d5c2844206502ff0.js → 992cd87ba0ab6346f692.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{73c87eb9bd8f0f848481.js → 9c11e1fe785e1385fdb1.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{5ed8d8b5336c81fbcda3.js → 9d216e30d04ea21fc8a2.js} +1 -1
  73. package/assets/esri/core/workers/chunks/a54aa93b6012a2597f82.js +1 -0
  74. package/assets/esri/core/workers/chunks/{cf14b3a44705dacefac4.js → a9b5ce00323cd5574bf7.js} +1 -1
  75. package/assets/esri/core/workers/chunks/ae6b3dfe5f757df539d6.js +1 -0
  76. package/assets/esri/core/workers/chunks/b14c4c3f295970f731ab.js +1 -0
  77. package/assets/esri/core/workers/chunks/{c70df6ed190f9ebcf6aa.js → bf2c202dec5ab7bc770b.js} +1 -1
  78. package/assets/esri/core/workers/chunks/c1d4110aa494a1dba3c4.js +1 -0
  79. package/assets/esri/core/workers/chunks/{9d6491f996eeb0c646ed.js → c442916805975744dd92.js} +1 -1
  80. package/assets/esri/core/workers/chunks/dacc2e5fa462495ed1cc.js +2 -0
  81. package/assets/esri/core/workers/chunks/f227b34cce6843df0fb6.js +1 -0
  82. package/assets/esri/core/workers/chunks/{dda2cb5c073d1e65f14f.js → f43d628d47eec7d530c7.js} +1 -1
  83. package/assets/esri/core/workers/chunks/f7531aa69a87814c60d1.js +1 -0
  84. package/assets/esri/core/workers/chunks/{bf8f603848bad4a7deb4.js → fb100935fd8948d779f5.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{88b480a1d1fb01778798.js → fb9e3e7cd532ac4353f1.js} +25 -30
  86. package/assets/esri/core/workers/chunks/fc6ca7ffb9f1b875059c.js +1 -0
  87. package/assets/esri/core/workers/chunks/{14eb2cc8e2ad6d8d03fd.js → ffc4f3406ce383b9bd88.js} +1 -1
  88. package/assets/esri/themes/base/_core.scss +2 -0
  89. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +6 -0
  90. package/assets/esri/themes/base/widgets/_PluginSettingsControls.scss +29 -0
  91. package/assets/esri/themes/dark/main.css +1 -1
  92. package/assets/esri/themes/light/main.css +1 -1
  93. package/assets/esri/themes/light/view.css +1 -1
  94. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  95. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  96. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  97. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  98. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  99. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  100. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  101. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  102. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  103. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  104. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  105. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  106. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  107. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  108. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  109. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  110. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  111. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  112. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  113. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  114. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  115. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  116. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  117. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  118. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  119. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  120. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  121. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  122. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  123. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  124. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  125. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  126. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  127. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  128. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  129. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  130. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  131. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  132. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  133. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  134. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  135. package/assets/esri/widgets/Sketch/t9n/Sketch.json +1 -1
  136. package/assets/esri/widgets/Sketch/t9n/Sketch_ar.json +1 -1
  137. package/assets/esri/widgets/Sketch/t9n/Sketch_bg.json +1 -1
  138. package/assets/esri/widgets/Sketch/t9n/Sketch_bs.json +1 -1
  139. package/assets/esri/widgets/Sketch/t9n/Sketch_ca.json +1 -1
  140. package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
  141. package/assets/esri/widgets/Sketch/t9n/Sketch_da.json +1 -1
  142. package/assets/esri/widgets/Sketch/t9n/Sketch_de.json +1 -1
  143. package/assets/esri/widgets/Sketch/t9n/Sketch_el.json +1 -1
  144. package/assets/esri/widgets/Sketch/t9n/Sketch_en.json +1 -1
  145. package/assets/esri/widgets/Sketch/t9n/Sketch_es.json +1 -1
  146. package/assets/esri/widgets/Sketch/t9n/Sketch_et.json +1 -1
  147. package/assets/esri/widgets/Sketch/t9n/Sketch_fi.json +1 -1
  148. package/assets/esri/widgets/Sketch/t9n/Sketch_fr.json +1 -1
  149. package/assets/esri/widgets/Sketch/t9n/Sketch_he.json +1 -1
  150. package/assets/esri/widgets/Sketch/t9n/Sketch_hr.json +1 -1
  151. package/assets/esri/widgets/Sketch/t9n/Sketch_hu.json +1 -1
  152. package/assets/esri/widgets/Sketch/t9n/Sketch_id.json +1 -1
  153. package/assets/esri/widgets/Sketch/t9n/Sketch_it.json +1 -1
  154. package/assets/esri/widgets/Sketch/t9n/Sketch_ja.json +1 -1
  155. package/assets/esri/widgets/Sketch/t9n/Sketch_ko.json +1 -1
  156. package/assets/esri/widgets/Sketch/t9n/Sketch_lt.json +1 -1
  157. package/assets/esri/widgets/Sketch/t9n/Sketch_lv.json +1 -1
  158. package/assets/esri/widgets/Sketch/t9n/Sketch_nl.json +1 -1
  159. package/assets/esri/widgets/Sketch/t9n/Sketch_no.json +1 -1
  160. package/assets/esri/widgets/Sketch/t9n/Sketch_pl.json +1 -1
  161. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-BR.json +1 -1
  162. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-PT.json +1 -1
  163. package/assets/esri/widgets/Sketch/t9n/Sketch_ro.json +1 -1
  164. package/assets/esri/widgets/Sketch/t9n/Sketch_ru.json +1 -1
  165. package/assets/esri/widgets/Sketch/t9n/Sketch_sk.json +1 -1
  166. package/assets/esri/widgets/Sketch/t9n/Sketch_sl.json +1 -1
  167. package/assets/esri/widgets/Sketch/t9n/Sketch_sr.json +1 -1
  168. package/assets/esri/widgets/Sketch/t9n/Sketch_sv.json +1 -1
  169. package/assets/esri/widgets/Sketch/t9n/Sketch_th.json +1 -1
  170. package/assets/esri/widgets/Sketch/t9n/Sketch_tr.json +1 -1
  171. package/assets/esri/widgets/Sketch/t9n/Sketch_uk.json +1 -1
  172. package/assets/esri/widgets/Sketch/t9n/Sketch_vi.json +1 -1
  173. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-CN.json +1 -1
  174. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-HK.json +1 -1
  175. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-TW.json +1 -1
  176. package/chunks/ImageMaterial.glsl.js +7 -5
  177. package/chunks/SlicePlaneMaterial.glsl.js +21 -13
  178. package/chunks/arcade.js +1 -1
  179. package/chunks/languageUtils.js +1 -1
  180. package/config.js +1 -1
  181. package/core/MapUtils.js +1 -1
  182. package/core/arrayUtils.js +1 -1
  183. package/core/types.d.ts +28 -0
  184. package/form/elements/inputs/MultipleChoiceInput.d.ts +2 -2
  185. package/form/elements/inputs/MultipleChoiceInput.js +1 -1
  186. package/geometry/operators/types.d.ts +2 -2
  187. package/interfaces.d.ts +4 -7
  188. package/kernel.js +1 -1
  189. package/layers/ImageryLayer.d.ts +7 -1
  190. package/layers/ImageryLayer.js +1 -1
  191. package/layers/ImageryTileLayer.d.ts +7 -1
  192. package/layers/ImageryTileLayer.js +1 -1
  193. package/layers/IntegratedMeshLayer.d.ts +18 -14
  194. package/layers/SceneLayer.d.ts +35 -1
  195. package/layers/SceneLayer.js +1 -1
  196. package/layers/WCSLayer.d.ts +7 -1
  197. package/layers/WCSLayer.js +1 -1
  198. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  199. package/layers/save/imageryUtils.js +1 -1
  200. package/layers/scene/ModelFileInfo.d.ts +29 -0
  201. package/layers/scene/ModelFileInfo.js +2 -0
  202. package/layers/scene/ModelInfo.d.ts +38 -0
  203. package/layers/scene/ModelInfo.js +2 -0
  204. package/layers/scene/modelQuerySupport.js +2 -0
  205. package/layers/scene/types.d.ts +14 -0
  206. package/layers/support/infoFor3D.js +1 -1
  207. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  208. package/layers/types.d.ts +13 -1
  209. package/layers/video/VideoController.js +1 -1
  210. package/networks/UnitIdentifierManager.d.ts +15 -15
  211. package/networks/UnitIdentifierManager.js +1 -1
  212. package/networks/support/jsonTypes.d.ts +125 -13
  213. package/package.json +4 -4
  214. package/popup/Features.d.ts +1 -7
  215. package/popup/Features.js +1 -1
  216. package/popup/actions.js +1 -1
  217. package/renderers/visualVariables/support/ColorStop.js +1 -1
  218. package/rest/networks/unitIdentifiers/reserve.js +2 -0
  219. package/rest/networks/unitIdentifiers/support/ReserveParameters.js +2 -0
  220. package/rest/networks/unitIdentifiers/support/ResizeParameters.js +1 -1
  221. package/rest/networks/unitIdentifiers/support/UnitQueryResult.js +1 -1
  222. package/support/arcadeUtils.js +1 -1
  223. package/support/revision.js +1 -1
  224. package/views/2d/analysis/ElevationProfile/ElevationProfileVisualization2D.js +1 -1
  225. package/views/2d/analysis/ElevationProfileAnalysisView2D.d.ts +5 -1
  226. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  227. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  228. package/views/2d/engine/flow/styles/Particles.js +1 -1
  229. package/views/2d/engine/flow/styles/Streamlines.js +1 -1
  230. package/views/2d/engine/vectorTiles/Placement.js +1 -1
  231. package/views/2d/engine/vectorTiles/TextShaping.js +1 -1
  232. package/views/2d/engine/webgl/AFeatureTile.js +1 -1
  233. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  234. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  235. package/views/2d/engine/webgl/GlyphSource.js +1 -1
  236. package/views/2d/engine/webgl/Overlay.js +1 -1
  237. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  238. package/views/2d/engine/webgl/RenderingDevice.js +1 -1
  239. package/views/2d/engine/webgl/TextureManager.js +1 -1
  240. package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
  241. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  242. package/views/2d/engine/webgl/shaderGraph/GLSLShaderModule.js +1 -1
  243. package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
  244. package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
  245. package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueProgramCache.js +1 -1
  246. package/views/2d/engine/webgl/shaderGraph/techniques/TestTechnique.js +1 -1
  247. package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
  248. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
  249. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
  250. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimationUniformInfo.js +1 -1
  251. package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
  252. package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
  253. package/views/2d/engine/webgl/shaderGraph/techniques/bloom/BloomTechnique.js +1 -1
  254. package/views/2d/engine/webgl/shaderGraph/techniques/blur/BlurTechnique.js +1 -1
  255. package/views/2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js +1 -1
  256. package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +1 -1
  257. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPointShader.js +1 -1
  258. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPolygonShader.js +1 -1
  259. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
  260. package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
  261. package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
  262. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
  263. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
  264. package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillTechnique.js +1 -1
  265. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
  266. package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillTechnique.js +1 -1
  267. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
  268. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
  269. package/views/2d/engine/webgl/shaderGraph/techniques/flow/FlowTechnique.js +1 -1
  270. package/views/2d/engine/webgl/shaderGraph/techniques/grid/GridTechnique.js +1 -1
  271. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
  272. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  273. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
  274. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineTechnique.js +1 -1
  275. package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
  276. package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
  277. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  278. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
  279. package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
  280. package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
  281. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
  282. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
  283. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  284. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
  285. package/views/2d/engine/webgl/shaderGraph/techniques/raster/VectorFieldTechnique.js +1 -1
  286. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/AspectTechnique.js +1 -1
  287. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BandArithmeticTechnique.js +1 -1
  288. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BaseRasterProcessorTechnique.js +1 -1
  289. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ColormapToRGBTechnique.js +1 -1
  290. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/CompositeBandTechnique.js +1 -1
  291. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ComputeChangeTechnique.js +1 -1
  292. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ContrastBrightnessTechnique.js +1 -1
  293. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ConvolutionTechnique.js +1 -1
  294. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/CurvatureTechnique.js +1 -1
  295. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ExtractBandTechnique.js +1 -1
  296. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/FocalStatisticsTechnique.js +1 -1
  297. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/GrayscaleTechnique.js +1 -1
  298. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/HillshadeTechnique.js +1 -1
  299. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/LocalTechnique.js +1 -1
  300. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/MaskTechnique.js +1 -1
  301. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/NDVITechnique.js +1 -1
  302. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/RemapTechnique.js +1 -1
  303. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ReprojectTechnique.js +1 -1
  304. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ShadedReliefTechnique.js +1 -1
  305. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/SlopeTechnique.js +1 -1
  306. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/SpectralConversionTechnique.js +1 -1
  307. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/StretchTechnique.js +1 -1
  308. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
  309. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BitmapShader.js +1 -1
  310. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js +1 -1
  311. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js +1 -1
  312. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js +1 -1
  313. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js +1 -1
  314. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js +1 -1
  315. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexFillShader.js +1 -1
  316. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexOutlineFillShader.js +1 -1
  317. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js +1 -1
  318. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/EntityStorage.js +1 -1
  319. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientFillShader.js +1 -1
  320. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientStrokeShader.js +1 -1
  321. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapAccumulateShader.js +1 -1
  322. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapResolveShader.js +1 -1
  323. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  324. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js +1 -1
  325. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/MosaicInfo.js +1 -1
  326. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js +1 -1
  327. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OverlayShader.js +1 -1
  328. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternFillShader.js +1 -1
  329. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternOutlineFillShader.js +1 -1
  330. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ShaderHittest.js +1 -1
  331. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsDiffShader.js +1 -1
  332. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsMinMaxSumShader.js +1 -1
  333. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsStdDevShader.js +1 -1
  334. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsSumOfSquaredDiffShader.js +1 -1
  335. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TexturedLineShader.js +1 -1
  336. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js +1 -1
  337. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js +1 -1
  338. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowImageryShader.js +1 -1
  339. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowUtils.js +1 -1
  340. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  341. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
  342. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterHighlightShader.js +1 -1
  343. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerLUTShader.js +1 -1
  344. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerShadedReliefShader.js +1 -1
  345. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerStretchShader.js +1 -1
  346. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterXYBandHighlightShader.js +1 -1
  347. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/lut.js +1 -1
  348. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/AspectShader.js +1 -1
  349. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/BaseRasterProcessorShader.js +1 -1
  350. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ColormapToRGBShader.js +1 -1
  351. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ConvolutionShader.js +1 -1
  352. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/CurvatureShader.js +1 -1
  353. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/FocalStatisticsShader.js +1 -1
  354. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/HillshadeShader.js +1 -1
  355. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MultiRasterMixin.js +1 -1
  356. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ShadedReliefShader.js +1 -1
  357. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/SlopeShader.js +1 -1
  358. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/projection.js +1 -1
  359. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/stretch.js +1 -1
  360. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderBackground.js +1 -1
  361. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderFill.js +1 -1
  362. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderIcon.js +1 -1
  363. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderLine.js +1 -1
  364. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderText.js +1 -1
  365. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vvUtils.js +1 -1
  366. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  367. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
  368. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
  369. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileStencilTechnique.js +1 -1
  370. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
  371. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
  372. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
  373. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
  374. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
  375. package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
  376. package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
  377. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  378. package/views/2d/layers/BaseLayerView2D.d.ts +3 -3
  379. package/views/2d/layers/BaseLayerViewGL2D.d.ts +3 -3
  380. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  381. package/views/2d/layers/TileLayerView2D.js +1 -1
  382. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  383. package/views/2d/layers/features/FeatureContainer.js +1 -1
  384. package/views/2d/support/clippingUtils.js +1 -1
  385. package/views/2d/support/hitTestUtils.js +1 -1
  386. package/views/3d/FocusAreasView.js +1 -1
  387. package/views/3d/StencilGeometry.js +2 -0
  388. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization3D.js +1 -1
  389. package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +5 -1
  390. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  391. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  392. package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
  393. package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
  394. package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
  395. package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
  396. package/views/3d/analysis/Viewshed/ViewshedShapeVisualElement.js +1 -1
  397. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  398. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  399. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  400. package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
  401. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  402. package/views/3d/focusAreaUtils.js +2 -0
  403. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  404. package/views/3d/layers/I3SMeshView3D.js +1 -1
  405. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  406. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  407. package/views/3d/layers/IntegratedMeshNormals.js +1 -1
  408. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  409. package/views/3d/layers/SceneLayerView3D.js +1 -1
  410. package/views/3d/layers/SceneLayerWorker.js +1 -1
  411. package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
  412. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  413. package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
  414. package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
  415. package/views/3d/terrain/ElevationData.js +1 -1
  416. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  417. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  418. package/views/3d/webgl-engine/collections/Component/Renderable.js +1 -1
  419. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +1 -5
  420. package/views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js +1 -5
  421. package/views/3d/webgl-engine/core/shaderLibrary/util/MixExternalColor.glsl.js +16 -21
  422. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
  423. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
  424. package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
  425. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
  426. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  427. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
  428. package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
  429. package/views/3d/webgl-engine/effects/clouds/CloudsTechnique.js +1 -1
  430. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +1 -1
  431. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  432. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  433. package/views/3d/webgl-engine/effects/focusArea/focusAreaMaskUtils.js +2 -0
  434. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  435. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  436. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  437. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  438. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  439. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  440. package/views/3d/webgl-engine/effects/highlight/ShadowHighlightBuffer.js +1 -1
  441. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  442. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
  443. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  444. package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
  445. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  446. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  447. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  448. package/views/3d/webgl-engine/effects/stars/StarsTechnique.js +1 -1
  449. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  450. package/views/3d/webgl-engine/lib/Compositor.js +1 -1
  451. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
  452. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
  453. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  454. package/views/3d/webgl-engine/lib/Material.js +1 -1
  455. package/views/3d/webgl-engine/lib/Normals.js +1 -1
  456. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  457. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  458. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  459. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  460. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  461. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  462. package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
  463. package/views/3d/webgl-engine/shaders/BlackLevelLightSoftCompression.glsl.js +5 -1
  464. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  465. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  466. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  467. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  468. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  469. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  470. package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
  471. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +10 -10
  472. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  473. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  474. package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechnique.js +1 -1
  475. package/views/VideoView.js +1 -1
  476. package/views/View2D.js +1 -1
  477. package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
  478. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  479. package/views/analysis/ElevationProfile/ElevationProfileIndicatorPointVisualization.js +1 -1
  480. package/views/analysis/ElevationProfile/ElevationProfileResult.d.ts +6 -4
  481. package/views/draw/DrawTool.js +1 -1
  482. package/views/draw/plugins/BezierSegmentPlugin.js +1 -1
  483. package/views/draw/plugins/FreehandSegmentPlugin.js +1 -1
  484. package/views/draw/support/GraphicMover.js +1 -1
  485. package/views/draw/support/PluginContext.js +1 -1
  486. package/views/draw/support/Reshape.js +1 -1
  487. package/views/draw/support/editingSessionUtils.js +1 -1
  488. package/views/draw/support/types.d.ts +21 -0
  489. package/views/draw/support/types.js +1 -1
  490. package/views/types.d.ts +2 -2
  491. package/views/webgl/FramebufferObject.js +1 -1
  492. package/widgets/BatchAttributeForm/css.js +1 -1
  493. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  494. package/widgets/BatchAttributeForm/inputs/GroupInput.d.ts +2 -1
  495. package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.d.ts +54 -0
  496. package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +2 -0
  497. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  498. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  499. package/widgets/BatchAttributeForm/inputs/types.d.ts +4 -3
  500. package/widgets/BatchAttributeForm/templates/AttachmentElementTemplate.js +1 -1
  501. package/widgets/BatchAttributeForm/templates/RelationshipElementTemplate.js +2 -0
  502. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  503. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  504. package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
  505. package/widgets/BatchAttributeForm.js +1 -1
  506. package/widgets/CoordinateConversion/CoordinateConversionViewModel.d.ts +21 -1
  507. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  508. package/widgets/CoordinateConversion/support/Format.js +1 -1
  509. package/widgets/CoordinateConversion/support/coordinateConversionUtils.js +1 -1
  510. package/widgets/CoordinateConversion.d.ts +21 -1
  511. package/widgets/CoordinateConversion.js +1 -1
  512. package/widgets/Daylight/DaylightViewModel.js +1 -1
  513. package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
  514. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  515. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  516. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  517. package/widgets/Editor/components/Settings.js +1 -1
  518. package/widgets/Editor/support/SketchController.js +1 -1
  519. package/widgets/Editor/workflowUtils.js +1 -1
  520. package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
  521. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  522. package/widgets/ElevationProfile/support/ElevationProfileView.js +1 -1
  523. package/widgets/ElevationProfile/support/ElevationProfileView2D.js +1 -1
  524. package/widgets/ElevationProfile/support/ElevationProfileView3D.js +1 -1
  525. package/widgets/ElevationProfile/support/InputRepresentation2D.js +1 -1
  526. package/widgets/ElevationProfile/support/InputRepresentation3D.js +1 -1
  527. package/widgets/ElevationProfile/support/ProfileLine2D.js +1 -1
  528. package/widgets/ElevationProfile/support/ProfileLines3D.js +1 -1
  529. package/widgets/FeatureForm/FieldInput.js +1 -1
  530. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  531. package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.js +1 -1
  532. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  533. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.d.ts +5 -5
  534. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
  535. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  536. package/widgets/OrientedImageryViewer/constants.js +1 -1
  537. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  538. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +2 -0
  539. package/widgets/OrientedImageryViewer/support/superimposeUtils.js +2 -0
  540. package/widgets/OrientedImageryViewer/types.d.ts +10 -0
  541. package/widgets/OrientedImageryViewer.d.ts +17 -2
  542. package/widgets/OrientedImageryViewer.js +1 -1
  543. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  544. package/widgets/Sketch/SketchViewModel.js +1 -1
  545. package/widgets/Sketch/support/PluginManager.js +1 -1
  546. package/widgets/Sketch/support/SettingsManager.js +2 -0
  547. package/widgets/Sketch.js +1 -1
  548. package/widgets/Slider/SliderViewModel.d.ts +2 -1
  549. package/widgets/Slider/SliderViewModel.js +1 -1
  550. package/widgets/Slider.js +1 -1
  551. package/widgets/smartMapping/ColorSlider/ColorSliderViewModel.js +1 -1
  552. package/widgets/smartMapping/OpacitySlider/OpacitySliderViewModel.js +1 -1
  553. package/widgets/smartMapping/SizeSlider/SizeSliderViewModel.js +1 -1
  554. package/widgets/smartMapping/SmartMappingSliderViewModel.js +1 -1
  555. package/widgets/support/ContingentValuesManager.js +1 -1
  556. package/widgets/support/PluginSettingsControls.js +2 -0
  557. package/widgets/support/SnappingControls.js +1 -1
  558. package/widgets/support/forms/formUtils.js +1 -1
  559. package/widgets/types.d.ts +1 -1
  560. package/analysis/ElevationProfile/elevationProfileLineTypes.js +0 -2
  561. package/assets/esri/core/workers/chunks/003476e950bd27a2f884.js +0 -596
  562. package/assets/esri/core/workers/chunks/07aca5ecad659d55e795.js +0 -2
  563. package/assets/esri/core/workers/chunks/07eff82916681fcff069.js +0 -1
  564. package/assets/esri/core/workers/chunks/0b1454a77a6a682541dc.js +0 -2
  565. package/assets/esri/core/workers/chunks/3697e51e1e4cf442f39a.js +0 -1
  566. package/assets/esri/core/workers/chunks/3cce9dad8ee0e4971d50.js +0 -1
  567. package/assets/esri/core/workers/chunks/68a313155ddc29bd024d.js +0 -1
  568. package/assets/esri/core/workers/chunks/751609831b283903ba48.js +0 -1
  569. package/assets/esri/core/workers/chunks/7540f7df86620f067b5a.js +0 -1
  570. package/assets/esri/core/workers/chunks/76e34f81bb4a7b0e694c.js +0 -1
  571. package/assets/esri/core/workers/chunks/7bacdd65a6cc4d284e0a.js +0 -2
  572. package/assets/esri/core/workers/chunks/7e97684e851274efd11f.js +0 -1
  573. package/assets/esri/core/workers/chunks/85aac8539996372f1ee8.js +0 -1
  574. package/assets/esri/core/workers/chunks/99c161fecae710b53b40.js +0 -1
  575. package/assets/esri/core/workers/chunks/99d298d0039c536fcf3e.js +0 -1
  576. package/assets/esri/core/workers/chunks/9aaf78b831f8739bc127.js +0 -1
  577. package/assets/esri/core/workers/chunks/bfe575da727ce7c8d331.js +0 -2
  578. package/assets/esri/core/workers/chunks/cb45e5d4a4ef82cda583.js +0 -1
  579. package/assets/esri/core/workers/chunks/e262c4864dc06c43b380.js +0 -1
  580. package/assets/esri/core/workers/chunks/ea59b81299acaf0d85ee.js +0 -1
  581. package/assets/esri/core/workers/chunks/ef0eae13408cbf83a64f.js +0 -1
  582. package/assets/esri/core/workers/chunks/f09a41ad239d467d9438.js +0 -2
  583. package/assets/esri/core/workers/chunks/f6912532aae1638cbe8f.js +0 -1
  584. package/rest/networks/unitIdentifiers/insertGap.js +0 -2
  585. package/rest/networks/unitIdentifiers/support/InsertGapParameters.js +0 -2
  586. /package/assets/esri/core/workers/chunks/{7bacdd65a6cc4d284e0a.js.LICENSE.txt → 10408183681fd6c7b4ed.js.LICENSE.txt} +0 -0
  587. /package/assets/esri/core/workers/chunks/{f09a41ad239d467d9438.js.LICENSE.txt → 5818f1f526577068d6ca.js.LICENSE.txt} +0 -0
  588. /package/assets/esri/core/workers/chunks/{bfe575da727ce7c8d331.js.LICENSE.txt → 7cdd0492b2191df95102.js.LICENSE.txt} +0 -0
  589. /package/assets/esri/core/workers/chunks/{07aca5ecad659d55e795.js.LICENSE.txt → dacc2e5fa462495ed1cc.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{getAssetUrl as e}from"../../assets.js";import o from"../../Graphic.js";import{onLocaleChange as i,getLocale as s,fetchMessageBundle as r}from"../../intl.js";import n from"../../core/Collection.js";import a from"../../core/Error.js";import{EventedAccessor as h}from"../../core/Evented.js";import c from"../../core/Logger.js";import{watch as d,initial as l,when as m,whenOnce as v}from"../../core/reactiveUtils.js";import{property as p,subclass as u}from"../../core/accessorSupport/decorators.js";import{ensureType as f}from"../../core/accessorSupport/ensureType.js";import g from"../../geometry/Point.js";import{load as w}from"../../geometry/projectionUtils.js";import _ from"../../symbols/PictureMarkerSymbol.js";import{pointSymbolTypes as y}from"../../symbols/support/typeUtils.js";import C from"./support/Conversion.js";import{isValidPoint as b,isSupportedNotation as L}from"./support/coordinateConversionUtils.js";import M from"./support/Format.js";import{generateDefaultFormats as P,setDefaultPatterns as F}from"./support/formatUtils.js";import{GoTo as S}from"../support/GoTo.js";const j=new g([0,0,500]),H="xy",G=["mgrs","utm","usng","dd","dms","ddm"],x="esri__coordinateConversionWidgetState",E={conversions:"conversions",formats:"formats",view:"view",viewChange:"view-change",cursor:"cursor"},W="esri/images/search/search-symbol-32.png";let U=class extends(S(h)){constructor(t){super(t),this._conversionPromise=null,this._locationGraphic=null,this._pointerCount=0,this.formats=new n,this.formatterAvailable=!1,this.formatterLoading=!0,this.messages=null,this.filteredFormats=new n,this.locationSymbol=new _({url:e(W),width:24,height:24}),this.storageEnabled=!0,this.storageType="session",this.view=null,this._saveWidgetState=this._saveWidgetState.bind(this),this._handleFormatChange=this._handleFormatChange.bind(this),this._handleConversionChange=this._handleConversionChange.bind(this),this._handleViewChange=this._handleViewChange.bind(this),this._onClick=this._onClick.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this.conversions=new n}initialize(){const t=async()=>this.messages=await r("esri/widgets/CoordinateConversion/t9n/CoordinateConversion");this.formats.addMany(P()),t().then(()=>{this.destroyed||(F(this.messages,this.formats),this.storageEnabled&&this._loadWidgetState(),this.formats.forEach(t=>{t.viewModel=this,this.addHandles(d(()=>t.currentPattern,this._saveWidgetState),t.name??"unnamed-format")}),this.addHandles(this.conversions.on("change",this._handleConversionChange),E.conversions),this.addHandles(this.formats.on("change",this._handleFormatChange),E.formats),this.addHandles(i(()=>{t().then(()=>{F(this.messages,this.formats)})})),w().then(()=>{this.formatterAvailable=!0}).catch(t=>{c.getLogger(this).error(new a("coordinate-conversion:projection-load-failed","Failed to load the projection module.",{error:t})),this.formatterAvailable=!1,this._filterFormatsAndConversions()}).then(()=>this.addHandles(d(()=>this.view,this._handleViewChange,l),E.viewChange)).finally(()=>this.formatterLoading=!1),0===this.conversions.length&&this._addDefaultConversion())})}destroy(){this.removeHandles(),this._cleanUpView(this.view),this.view=null}get conversions(){return this._get("conversions")}set conversions(t){const e=new n;t.forEach(t=>{let o=null;if("string"==typeof t){const e=this.formats.find(e=>e.name===t);e&&(o=new C({format:e}))}else o=f(C,t);o&&e.add(o)}),this._set("conversions",e)}set currentLocation(t){this._set("currentLocation",t),this._updateConversions()}get currentLocation(){return this._get("currentLocation")||null}set mode(t){switch(t){case"capture":this.currentLocation=null,this._startCaptureMode(),this._set("mode",t);break;case"live":this._startLiveMode(),this._set("mode",t)}}get mode(){return this._get("mode")||"live"}get state(){const{messages:t,view:e}=this,o=e?.ready;return t?o?"ready":e?"loading":"disabled":"disabled"}get storage(){return"session"===this.storageType?sessionStorage:localStorage}get waitingForConversions(){return null!=this._conversionPromise}setLocation(t){if(this._locationGraphic&&this.view?.graphics.remove(this._locationGraphic),!t)return;const e=t.clone();e.hasZ&&(e.z=void 0),this._locationGraphic=new o({geometry:e,symbol:this.locationSymbol}),this.view?.graphics.add(this._locationGraphic)}async convert(t,e){if(!b(e))throw new a("coordinate-conversion:invalid-point","Invalid point cannot be converted.",{point:e});return await this._waitForFormatter(),Promise.resolve().then(()=>t.convert(e))}async goToLocation(t){const{view:e}=this;if(!e)throw new a("coordinate-conversion:go-to-failed","no view");const o="3d"===e.type?e.clippingArea:null,i=e.map?.basemap?.baseLayers;if(o||(i?.length??0)>0){const e=o??i?.at(0)?.fullExtent;if(null!=e&&!e.contains(t))throw new a("coordinate-conversion:go-to-failed","Point outside basemap extent.",{point:t})}return this.callGoTo({target:t})}pause(){this.currentLocation=null,this.removeHandles(E.view),this.view&&(this.removeHandles(E.cursor),this._locationGraphic&&this.view.graphics.remove(this._locationGraphic))}async previewConversion(t,e=this.currentLocation||j){return(await A(t,e)).displayCoordinate}resume(){"capture"===this.mode?this._startCaptureMode():this._startLiveMode()}async reverseConvert(t,e){return await this._waitForFormatter(),e.reverseConvert(t)}async updateConversions(t,e){if(await this._waitForFormatter(),"point"!==e?.type)throw this._clearConversions(this.conversions),new a("coordinate-conversion:invalid-input-point","Point is invalid, conversions cannot be updated.",{point:e});return this._convertMany(t,e)}_addDefaultConversion(){const t=this.formats.find(t=>t.name===H)||this.formats.at(0);t&&this.conversions.add(new C({format:t}))}_cleanUpView(t){t&&(this._locationGraphic&&t.graphics.remove(this._locationGraphic),this.removeHandles(E.view),this.removeHandles(E.cursor))}_clearConversions(t){t.forEach(t=>{t.position={location:null,coordinate:null}})}async _convertMany(t,e){return Promise.all(t.map(t=>A(t,e)))}_handleConversionChange(t){for(const e of t.added){const{format:t}=e;t&&(t.viewModel=this,this.currentLocation&&(this._set("waitingForConversions",!0),this.convert(t,this.currentLocation).then(t=>{e.position=t,this._set("waitingForConversions",!1)})))}this._saveWidgetState()}_handleFormatChange(t){t.added.forEach(t=>{this.addHandles(d(()=>t.currentPattern,this._saveWidgetState),t.name??"unnamed-format"),t.viewModel=this}),t.removed.forEach(t=>{t.viewModel=null;const e=this.conversions.filter(e=>e.format===t);this.conversions.removeMany(e),t.name&&this.removeHandles(t.name)}),0===this.conversions.length&&this._addDefaultConversion()}_loadWidgetState(){try{const t=JSON.parse(this.storage.getItem(x));t&&this._setWidgetState(t)}catch(t){c.getLogger(this).error(new a("coordinate-conversion:invalid-session-storage-json","Could not read from storage.",{error:t}))}}_startCaptureMode(){this.removeHandles(E.view),this.view&&(this.currentLocation&&this.setLocation(this.currentLocation),this.removeHandles(E.cursor),this.addHandles(this.view.acquireCursor("crosshair","high"),E.cursor),this.addHandles(this.view.on("click",this._onClick),E.view))}_startLiveMode(){this._pointerCount=0,this.removeHandles(E.view),this.view&&(this.removeHandles(E.cursor),this._locationGraphic&&this.view.graphics.remove(this._locationGraphic),this.addHandles([this.view.on("pointer-down",this._onPointerDown),this.view.on("pointer-up",this._onPointerUp),this.view.on("pointer-move",this._onPointerMove)],E.view))}_handleViewChange(t,e){e&&e!==t&&this._cleanUpView(e),t&&("capture"===this.mode?this._startCaptureMode():this._startLiveMode(),e&&this._filterFormatsAndConversions())}_onClick(t){if(0===t.button){const e=this.view?.toMap(t),o=e?.normalize();this.setLocation(o),this.currentLocation=o}}_onPointerDown(t){const{pointerType:e}=t;if(this._pointerCount++,("touch"===e||"pen"===e)&&1===this._pointerCount){const e=this.view?.toMap(t);this.currentLocation=e?.normalize()}}_onPointerMove(t){const{pointerType:e}=t;if("mouse"===e||1===this._pointerCount){const e=this.view?.toMap(t);this.currentLocation=e?.normalize()}}_onPointerUp(){this._pointerCount--}_setWidgetState(t){try{t.formats.forEach(e=>{const o=this.formats.find(t=>t.name===e.name);o&&t.locale===s()&&e.currentPattern&&(o.currentPattern=e.currentPattern),o&&e.index>=0&&this.conversions.add(new C({format:o}))})}catch(e){c.getLogger(this).warn(new a("coordinate-conversion:session-storage-read-error","Could not get state from stored JSON.",{error:e}))}}_saveWidgetState(){if(!this.storageEnabled)return;const t=this._toJSON();try{this.storage.setItem(x,JSON.stringify({formats:t,locale:s()}))}catch(e){c.getLogger(this).error(new a("coordinate-conversion:local-storage-write-error","Could not write to localStorage.",{error:e}))}}async _updateConversions(){try{await this.updateConversions(this.conversions.toArray(),this.currentLocation)}catch{}}_toJSON(){return this.formats.filter(t=>{const e=t.name;return"xy"===e||"basemap"===e||L(e)}).map(t=>({name:t.name,currentPattern:t.currentPattern,defaultPattern:t.defaultPattern,index:this.conversions.findIndex(e=>e.format===t)})).sort((t,e)=>t.index-e.index).toArray()}_filterFormatsAndConversions(){const{formatterAvailable:t,conversions:e,formats:o}=this;t||this.addHandles(m(()=>this.view?.spatialReference,t=>{const i=t.isWebMercator||t.isWGS84,s=o.filter(t=>{const{name:e}=t;return!!T(e)||"xy"===e&&!i}),r=this.filteredFormats.filter(t=>"xy"===t.name&&i&&!this.formats.includes(t)),n=e.filter(t=>s.includes(t.format));o.removeMany(s),e.removeMany(n),this.filteredFormats.addMany(s.filter(t=>!this.filteredFormats.includes(t))),o.addMany(r)},{once:!0,initial:!0}),E.view)}async _waitForFormatter(){this.formatterLoading&&await v(()=>!1===this.formatterLoading)}};async function A(t,e){try{t.position=await(t.format?.convert(e))}catch(o){t.position=null}return t}function T(t){return G.includes(t)}t([p()],U.prototype,"conversions",null),t([p({type:g})],U.prototype,"currentLocation",null),t([p({type:n.ofType(M)})],U.prototype,"formats",void 0),t([p()],U.prototype,"formatterLoading",void 0),t([p()],U.prototype,"messages",void 0),t([p()],U.prototype,"mode",null),t([p()],U.prototype,"filteredFormats",void 0),t([p({readOnly:!0})],U.prototype,"state",null),t([p({types:y})],U.prototype,"locationSymbol",void 0),t([p({readOnly:!0})],U.prototype,"storage",null),t([p()],U.prototype,"storageEnabled",void 0),t([p()],U.prototype,"storageType",void 0),t([p({readOnly:!0})],U.prototype,"waitingForConversions",null),t([p()],U.prototype,"view",void 0),U=t([u("esri.widgets.CoordinateConversion.CoordinateConversionViewModel")],U);const O=U;export{O as default};
2
+ import{__decorate as t}from"tslib";import{getAssetUrl as e}from"../../assets.js";import o from"../../Graphic.js";import{onLocaleChange as i,getLocale as s,fetchMessageBundle as r}from"../../intl.js";import n from"../../core/Collection.js";import a from"../../core/Error.js";import{EventedAccessor as h}from"../../core/Evented.js";import c from"../../core/Logger.js";import{watch as d,initial as l,when as m,whenOnce as v}from"../../core/reactiveUtils.js";import{property as p,subclass as u}from"../../core/accessorSupport/decorators.js";import{ensureType as f}from"../../core/accessorSupport/ensureType.js";import g from"../../geometry/Point.js";import{load as w}from"../../geometry/projectionUtils.js";import _ from"../../symbols/PictureMarkerSymbol.js";import{pointSymbolTypes as y}from"../../symbols/support/typeUtils.js";import C from"./support/Conversion.js";import{isValidPoint as b,isSupportedNotation as L}from"./support/coordinateConversionUtils.js";import P from"./support/Format.js";import{generateDefaultFormats as M,setDefaultPatterns as F}from"./support/formatUtils.js";import{GoTo as S}from"../support/GoTo.js";const j=new g([0,0,500]),H="xy",G=["mgrs","utm","usng","dd","dms","ddm"],x="esri__coordinateConversionWidgetState",E={conversions:"conversions",formats:"formats",view:"view",viewChange:"view-change",cursor:"cursor"},W="esri/images/search/search-symbol-32.png";let U=class extends(S(h)){constructor(t){super(t),this._conversionPromise=null,this._locationGraphic=null,this._pointerCount=0,this.calculateCoordinatePrecision=!0,this.formats=new n,this.formatterAvailable=!1,this.formatterLoading=!0,this.messages=null,this.filteredFormats=new n,this.locationSymbol=new _({url:e(W),width:24,height:24}),this.removeLeadingZeros=!1,this.storageEnabled=!0,this.storageType="session",this.view=null,this._saveWidgetState=this._saveWidgetState.bind(this),this._handleFormatChange=this._handleFormatChange.bind(this),this._handleConversionChange=this._handleConversionChange.bind(this),this._handleViewChange=this._handleViewChange.bind(this),this._onClick=this._onClick.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this.conversions=new n}initialize(){const t=async()=>this.messages=await r("esri/widgets/CoordinateConversion/t9n/CoordinateConversion");this.formats.addMany(M()),t().then(()=>{this.destroyed||(F(this.messages,this.formats),this.storageEnabled&&this._loadWidgetState(),this.formats.forEach(t=>{t.viewModel=this,this.addHandles(d(()=>t.currentPattern,this._saveWidgetState),t.name??"unnamed-format")}),this.addHandles(this.conversions.on("change",this._handleConversionChange),E.conversions),this.addHandles(this.formats.on("change",this._handleFormatChange),E.formats),this.addHandles(i(()=>{t().then(()=>{F(this.messages,this.formats)})})),w().then(()=>{this.formatterAvailable=!0}).catch(t=>{c.getLogger(this).error(new a("coordinate-conversion:projection-load-failed","Failed to load the projection module.",{error:t})),this.formatterAvailable=!1,this._filterFormatsAndConversions()}).then(()=>this.addHandles(d(()=>this.view,this._handleViewChange,l),E.viewChange)).finally(()=>this.formatterLoading=!1),0===this.conversions.length&&this._addDefaultConversion())})}destroy(){this.removeHandles(),this._cleanUpView(this.view),this.view=null}get conversions(){return this._get("conversions")}set conversions(t){const e=new n;t.forEach(t=>{let o=null;if("string"==typeof t){const e=this.formats.find(e=>e.name===t);e&&(o=new C({format:e}))}else o=f(C,t);o&&e.add(o)}),this._set("conversions",e)}set currentLocation(t){this._set("currentLocation",t),this._updateConversions()}get currentLocation(){return this._get("currentLocation")||null}set mode(t){switch(t){case"capture":this.currentLocation=null,this._startCaptureMode(),this._set("mode",t);break;case"live":this._startLiveMode(),this._set("mode",t);break;case"idle":this.removeHandles(E.view),this.removeHandles(E.cursor),this._set("mode",t)}}get mode(){return this._get("mode")||"live"}get state(){const{messages:t,view:e}=this,o=e?.ready;return t?o?"ready":e?"loading":"disabled":"disabled"}get storage(){return"session"===this.storageType?sessionStorage:localStorage}get waitingForConversions(){return null!=this._conversionPromise}setLocation(t){if(this._locationGraphic&&this.view?.graphics.remove(this._locationGraphic),!t)return;const e=t.clone();e.hasZ&&(e.z=void 0),this._locationGraphic=new o({geometry:e,symbol:this.locationSymbol}),this.view?.graphics.add(this._locationGraphic)}async convert(t,e){if(!b(e))throw new a("coordinate-conversion:invalid-point","Invalid point cannot be converted.",{point:e});return await this._waitForFormatter(),Promise.resolve().then(()=>t.convert(e))}async goToLocation(t){const{view:e}=this;if(!e)throw new a("coordinate-conversion:go-to-failed","no view");const o="3d"===e.type?e.clippingArea:null,i=e.map?.basemap?.baseLayers;if(o||(i?.length??0)>0){const e=o??i?.at(0)?.fullExtent;if(null!=e&&!e.contains(t))throw new a("coordinate-conversion:go-to-failed","Point outside basemap extent.",{point:t})}return this.callGoTo({target:t})}pause(){this.currentLocation=null,this.removeHandles(E.view),this.view&&(this.removeHandles(E.cursor),this._locationGraphic&&this.view.graphics.remove(this._locationGraphic))}async previewConversion(t,e=this.currentLocation||j){return(await A(t,e)).displayCoordinate}resume(){const{mode:t}=this;"capture"===t?this._startCaptureMode():this._startLiveMode()}async reverseConvert(t,e){return await this._waitForFormatter(),e.reverseConvert(t)}async updateConversions(t,e){if(await this._waitForFormatter(),"point"!==e?.type)throw this._clearConversions(this.conversions),new a("coordinate-conversion:invalid-input-point","Point is invalid, conversions cannot be updated.",{point:e});return this._convertMany(t,e)}_addDefaultConversion(){const t=this.formats.find(t=>t.name===H)||this.formats.at(0);t&&this.conversions.add(new C({format:t}))}_cleanUpView(t){t&&(this._locationGraphic&&t.graphics.remove(this._locationGraphic),this.removeHandles(E.view),this.removeHandles(E.cursor))}_clearConversions(t){t.forEach(t=>{t.position={location:null,coordinate:null}})}async _convertMany(t,e){return Promise.all(t.map(t=>A(t,e)))}_handleConversionChange(t){for(const e of t.added){const{format:t}=e;t&&(t.viewModel=this,this.currentLocation&&(this._set("waitingForConversions",!0),this.convert(t,this.currentLocation).then(t=>{e.position=t,this._set("waitingForConversions",!1)})))}this._saveWidgetState()}_handleFormatChange(t){t.added.forEach(t=>{this.addHandles(d(()=>t.currentPattern,this._saveWidgetState),t.name??"unnamed-format"),t.viewModel=this}),t.removed.forEach(t=>{t.viewModel=null;const e=this.conversions.filter(e=>e.format===t);this.conversions.removeMany(e),t.name&&this.removeHandles(t.name)}),0===this.conversions.length&&this._addDefaultConversion()}_loadWidgetState(){try{const t=JSON.parse(this.storage.getItem(x));t&&this._setWidgetState(t)}catch(t){c.getLogger(this).error(new a("coordinate-conversion:invalid-session-storage-json","Could not read from storage.",{error:t}))}}_startCaptureMode(){this.removeHandles(E.view),this.view&&(this.currentLocation&&this.setLocation(this.currentLocation),this.removeHandles(E.cursor),this.addHandles(this.view.acquireCursor("crosshair","high"),E.cursor),this.addHandles(this.view.on("click",this._onClick),E.view))}_startLiveMode(){this._pointerCount=0,this.removeHandles(E.view),this.view&&(this.removeHandles(E.cursor),this._locationGraphic&&this.view.graphics.remove(this._locationGraphic),this.addHandles([this.view.on("pointer-down",this._onPointerDown),this.view.on("pointer-up",this._onPointerUp),this.view.on("pointer-move",this._onPointerMove)],E.view))}_handleViewChange(t,e){e&&e!==t&&this._cleanUpView(e),t&&("capture"===this.mode?this._startCaptureMode():"live"===this.mode&&this._startLiveMode(),e&&this._filterFormatsAndConversions())}_onClick(t){if(0===t.button){const e=this.view?.toMap(t),o=e?.normalize();this.setLocation(o),this.currentLocation=o}}_onPointerDown(t){const{pointerType:e}=t;if(this._pointerCount++,("touch"===e||"pen"===e)&&1===this._pointerCount){const e=this.view?.toMap(t);this.currentLocation=e?.normalize()}}_onPointerMove(t){const{pointerType:e}=t;if("mouse"===e||1===this._pointerCount){const e=this.view?.toMap(t);this.currentLocation=e?.normalize()}}_onPointerUp(){this._pointerCount--}_setWidgetState(t){try{t.formats.forEach(e=>{const o=this.formats.find(t=>t.name===e.name);o&&t.locale===s()&&e.currentPattern&&(o.currentPattern=e.currentPattern),o&&e.index>=0&&this.conversions.add(new C({format:o}))})}catch(e){c.getLogger(this).warn(new a("coordinate-conversion:session-storage-read-error","Could not get state from stored JSON.",{error:e}))}}_saveWidgetState(){if(!this.storageEnabled)return;const t=this._toJSON();try{this.storage.setItem(x,JSON.stringify({formats:t,locale:s()}))}catch(e){c.getLogger(this).error(new a("coordinate-conversion:local-storage-write-error","Could not write to localStorage.",{error:e}))}}async _updateConversions(){try{await this.updateConversions(this.conversions.toArray(),this.currentLocation)}catch{}}_toJSON(){return this.formats.filter(t=>{const e=t.name;return"xy"===e||"basemap"===e||L(e)}).map(t=>({name:t.name,currentPattern:t.currentPattern,defaultPattern:t.defaultPattern,index:this.conversions.findIndex(e=>e.format===t)})).sort((t,e)=>t.index-e.index).toArray()}_filterFormatsAndConversions(){const{formatterAvailable:t,conversions:e,formats:o}=this;t||this.addHandles(m(()=>this.view?.spatialReference,t=>{const i=t.isWebMercator||t.isWGS84,s=o.filter(t=>{const{name:e}=t;return!!T(e)||"xy"===e&&!i}),r=this.filteredFormats.filter(t=>"xy"===t.name&&i&&!this.formats.includes(t)),n=e.filter(t=>s.includes(t.format));o.removeMany(s),e.removeMany(n),this.filteredFormats.addMany(s.filter(t=>!this.filteredFormats.includes(t))),o.addMany(r)},{once:!0,initial:!0}),E.view)}async _waitForFormatter(){this.formatterLoading&&await v(()=>!1===this.formatterLoading)}};async function A(t,e){try{t.position=await(t.format?.convert(e))}catch(o){t.position=null}return t}function T(t){return G.includes(t)}t([p()],U.prototype,"calculateCoordinatePrecision",void 0),t([p()],U.prototype,"conversions",null),t([p({type:g})],U.prototype,"currentLocation",null),t([p({type:n.ofType(P)})],U.prototype,"formats",void 0),t([p()],U.prototype,"formatterLoading",void 0),t([p()],U.prototype,"messages",void 0),t([p()],U.prototype,"mode",null),t([p()],U.prototype,"filteredFormats",void 0),t([p({readOnly:!0})],U.prototype,"state",null),t([p({types:y})],U.prototype,"locationSymbol",void 0),t([p()],U.prototype,"removeLeadingZeros",void 0),t([p({readOnly:!0})],U.prototype,"storage",null),t([p()],U.prototype,"storageEnabled",void 0),t([p()],U.prototype,"storageType",void 0),t([p({readOnly:!0})],U.prototype,"waitingForConversions",null),t([p()],U.prototype,"view",void 0),U=t([u("esri.widgets.CoordinateConversion.CoordinateConversionViewModel")],U);const k=U;export{k 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 t from"../../../core/Accessor.js";import r from"../../../core/Error.js";import"../../../core/has.js";import{property as n,subclass as i}from"../../../core/accessorSupport/decorators.js";import{fromUsng as o,fromUtm as a,fromMgrs as s,fromLatitudeLongitude as l,toUtm as c,toUsng as p,toMgrs as u,toLatitudeLongitude as m}from"../../../geometry/coordinateFormatter.js";import{isLoaded as h,project as d}from"../../../geometry/projectionUtils.js";import f from"../../../geometry/SpatialReference.js";import{equals as v}from"../../../geometry/support/spatialReferenceUtils.js";import{project as g}from"../../../geometry/support/webMercatorUtils.js";import{isValidPoint as y,fromXY as w,pointToCoordinate as b,getDegreePrecision as S}from"./coordinateConversionUtils.js";let _=class extends t{constructor(e){super(e),this.conversionInfo=null,this.coordinateSegments=null,this._currentPattern=void 0,this.defaultPattern=null,this.name=null,this.viewModel=null}get currentPattern(){return(this._currentPattern||this.defaultPattern)??""}set currentPattern(e){this._currentPattern=e}get label(){return this.name??""}set label(e){this._overrideIfSome("label",e)}get hasDisplayProperties(){return!(!this.defaultPattern||!this.coordinateSegments)}get spatialReference(){return"basemap"===this.name?this._viewSpatialReference:this.conversionInfo?.spatialReference??f.WGS84}set spatialReference(e){this._overrideIfSome("spatialReference",e)}get _viewSpatialReference(){return this.viewModel?.view?.spatialReference??f.WGS84}get _additionalCharactersPattern(){const e=this.coordinateSegments;if(!e)return null;const t=e.map(e=>e.alias),r=this.currentPattern.replaceAll(new RegExp(`["nsew${t.join()}]`,"gi"),"").replaceAll(" ","");return new RegExp(`[${r}]`,"g")}get test(){}async convert(e){if(!y(e))throw new r("format:invalid-point","Could not convert invalid point.",{point:e});const t=this.conversionInfo?.convert;if(t)return Promise.resolve().then(()=>t(e));const n=this._project(e,this.spatialReference);return{location:n,coordinate:this._getCoordinate(n)}}getConversionStrategy(){const e=this._viewSpatialReference;return this.conversionInfo?.convert||this.viewModel?.formatterAvailable||"xy"===this.name&&(e.isWebMercator||e.isWGS84)||"basemap"===this.name?"client":"server"}getDisplayCoordinate(e){if(!e)return null;if(!this.coordinateSegments||!this.currentPattern)return e;let t=this.currentPattern;const r=this._getSegmentMatches(e,!1);for(let n=this.coordinateSegments.length-1;n>=0;n--){const e=this.coordinateSegments[n];t=t.replace(e.alias,r[n])}return t}_parseUserInput(e){const{defaultPattern:t,_additionalCharactersPattern:r,coordinateSegments:n}=this;if(!t||!r)return"";let i=t.replace(r,"");e=e.replace(r,"");const o=this._getSegmentMatches(e,!0);if(n)for(let a=n.length-1;a>=0;a--){const e=n[a];i=i.replace(e.alias,o[a])}return i}_getSegmentMatches(e,t){const r=new Array,{coordinateSegments:n}=this;if(!n)return r;for(let i=0;i<n.length;i++){const o=n[i],a=e.match(o.searchPattern);if(!a){r.push("");continue}let s=a[0];if(e=e.replace(s,"").trim(),o.substitution){const e=t?o.substitution.input(s):o.substitution.output(s);e&&(s=`${e}`)}r.push(s)}return r}async reverseConvert(e){const t=this._parseUserInput(e),n=this.conversionInfo?.reverseConvert;let i;if(n)i=n(t);else if("xy"===this.name||"basemap"===this.name)i=w(t,this.spatialReference);else if(this.viewModel?.formatterAvailable)switch(this.name){case"dd":case"ddm":case"dms":i=l(t,this.spatialReference);break;case"mgrs":{const e="automatic";i=s(t,this.spatialReference,e);break}case"utm":{const e="latitude-band-indicators";i=a(t,this.spatialReference,e);break}case"usng":i=o(t,this.spatialReference);break;default:i=null}if(!i)throw new r("format:invalid-input","Could not parse input into point.",{coordinate:e});return this._project(i,this._viewSpatialReference)}_getCoordinate(e){const t=this.viewModel?.view?.scale??0;if(!y(e))throw new r("format:invalid-point","Could not transform invalid point into coordinate.",{point:e});if(this.viewModel?.formatterAvailable||"basemap"===this.name||"xy"===this.name)switch(this.name){case"dd":case"ddm":case"dms":{const r=S(t);return m(e,this.name,r)}case"mgrs":return u(e,"automatic",5,!1);case"usng":return p(e,5,!1);case"utm":return c(e,"latitude-band-indicators",!0);default:return b(e,t)}return b(e,t)}_project(e,t){if(v(e.spatialReference,t)||!t)return e;if(this.viewModel?.formatterAvailable&&h())return d(e,t);if(!this.viewModel?.formatterAvailable){const r=g(e,t);if(null!=r)return r}return null}};e([n()],_.prototype,"conversionInfo",void 0),e([n()],_.prototype,"coordinateSegments",void 0),e([n()],_.prototype,"currentPattern",null),e([n()],_.prototype,"_currentPattern",void 0),e([n()],_.prototype,"label",null),e([n()],_.prototype,"defaultPattern",void 0),e([n({readOnly:!0})],_.prototype,"hasDisplayProperties",null),e([n()],_.prototype,"name",void 0),e([n({type:f})],_.prototype,"spatialReference",null),e([n()],_.prototype,"viewModel",void 0),e([n({readOnly:!0})],_.prototype,"_viewSpatialReference",null),e([n({readOnly:!0})],_.prototype,"_additionalCharactersPattern",null),_=e([i("esri.widgets.CoordinateConversion.support.Format")],_);const P=_;export{P as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import r from"../../../core/Error.js";import"../../../core/has.js";import{property as i,subclass as n}from"../../../core/accessorSupport/decorators.js";import{fromUsng as o,fromUtm as s,fromMgrs as a,fromLatitudeLongitude as l,toUtm as c,toUsng as p,toMgrs as u,toLatitudeLongitude as d}from"../../../geometry/coordinateFormatter.js";import{isLoaded as h,project as m}from"../../../geometry/projectionUtils.js";import f from"../../../geometry/SpatialReference.js";import{equals as v}from"../../../geometry/support/spatialReferenceUtils.js";import{project as g}from"../../../geometry/support/webMercatorUtils.js";import{isValidPoint as w,fromXY as y,pointToCoordinate as _,removeLeadingZeros as P,getGeometryPrecision as b,getDegreePrecision as S}from"./coordinateConversionUtils.js";let R=class extends t{constructor(e){super(e),this.conversionInfo=null,this.coordinateSegments=null,this._currentPattern=void 0,this.defaultPattern=null,this.name=null,this.viewModel=null}get currentPattern(){return(this._currentPattern||this.defaultPattern)??""}set currentPattern(e){this._currentPattern=e}get label(){return this.name??""}set label(e){this._overrideIfSome("label",e)}get hasDisplayProperties(){return!(!this.defaultPattern||!this.coordinateSegments)}get spatialReference(){return"basemap"===this.name?this._viewSpatialReference:this.conversionInfo?.spatialReference??f.WGS84}set spatialReference(e){this._overrideIfSome("spatialReference",e)}get _viewSpatialReference(){return this.viewModel?.view?.spatialReference??f.WGS84}get _additionalCharactersPattern(){const e=this.coordinateSegments;if(!e)return null;const t=e.map(e=>e.alias),r=this.currentPattern.replaceAll(new RegExp(`["nsew${t.join()}]`,"gi"),"").replaceAll(" ","");return new RegExp(`[${r}]`,"g")}get test(){}async convert(e){if(!w(e))throw new r("format:invalid-point","Could not convert invalid point.",{point:e});const t=this.conversionInfo?.convert;if(t)return Promise.resolve().then(()=>t(e));const i=this._project(e,this.spatialReference);return{location:i,coordinate:this._getCoordinate(i)}}getConversionStrategy(){const e=this._viewSpatialReference;return this.conversionInfo?.convert||this.viewModel?.formatterAvailable||"xy"===this.name&&(e.isWebMercator||e.isWGS84)||"basemap"===this.name?"client":"server"}getDisplayCoordinate(e){if(!e)return null;if(!this.coordinateSegments||!this.currentPattern)return e;let t=this.currentPattern;const r=this._getSegmentMatches(e,!1);for(let i=this.coordinateSegments.length-1;i>=0;i--){const e=this.coordinateSegments[i];t=t.replace(e.alias,r[i])}return t}_parseUserInput(e){const{defaultPattern:t,_additionalCharactersPattern:r,coordinateSegments:i}=this;if(!t||!r)return"";let n=t.replace(r,"");e=e.replace(r,"");const o=this._getSegmentMatches(e,!0);if(i)for(let s=i.length-1;s>=0;s--){const e=i[s];n=n.replace(e.alias,o[s])}return n}_getSegmentMatches(e,t){const r=new Array,{coordinateSegments:i}=this;if(!i)return r;for(let n=0;n<i.length;n++){const o=i[n],s=e.match(o.searchPattern);if(!s){r.push("");continue}let a=s[0];if(e=e.replace(a,"").trim(),o.substitution){const e=t?o.substitution.input(a):o.substitution.output(a);e&&(a=`${e}`)}r.push(a)}return r}async reverseConvert(e){const t=this._parseUserInput(e),i=this.conversionInfo?.reverseConvert;let n;if(i)n=i(t);else if("xy"===this.name||"basemap"===this.name)n=y(t,this.spatialReference);else if(this.viewModel?.formatterAvailable)switch(this.name){case"dd":case"ddm":case"dms":n=l(t,this.spatialReference);break;case"mgrs":{const e="automatic";n=a(t,this.spatialReference,e);break}case"utm":{const e="latitude-band-indicators";n=s(t,this.spatialReference,e);break}case"usng":n=o(t,this.spatialReference);break;default:n=null}if(!n)throw new r("format:invalid-input","Could not parse input into point.",{coordinate:e});return this._project(n,this._viewSpatialReference)}_getCoordinate(e){const t=this.viewModel?.view?.resolution??0,i=this.viewModel?.view?.scale??0,n=this.viewModel?.view?.spatialReference??f.WebMercator;if(!w(e))throw new r("format:invalid-point","Could not transform invalid point into coordinate.",{point:e});if(this.viewModel?.formatterAvailable||"basemap"===this.name||"xy"===this.name)switch(this.name){case"dd":case"ddm":case"dms":{const r=this._getPrecision(i,t,n,this.name),o=d(e,this.name,r);return this.viewModel?.removeLeadingZeros?P(o):o}case"mgrs":return u(e,"automatic",5,!1);case"usng":return p(e,5,!1);case"utm":return c(e,"latitude-band-indicators",!0);default:return _(e,this._getPrecision(i,t,n,"dd"))}return _(e,this._getPrecision(i,t,n,"dd"))}_getPrecision(e,t,r,i){return this.viewModel?.calculateCoordinatePrecision?b(t,r,i):S(e)}_project(e,t){if(v(e.spatialReference,t)||!t)return e;if(this.viewModel?.formatterAvailable&&h())return m(e,t);if(!this.viewModel?.formatterAvailable){const r=g(e,t);if(null!=r)return r}return null}};e([i()],R.prototype,"conversionInfo",void 0),e([i()],R.prototype,"coordinateSegments",void 0),e([i()],R.prototype,"currentPattern",null),e([i()],R.prototype,"_currentPattern",void 0),e([i()],R.prototype,"label",null),e([i()],R.prototype,"defaultPattern",void 0),e([i({readOnly:!0})],R.prototype,"hasDisplayProperties",null),e([i()],R.prototype,"name",void 0),e([i({type:f})],R.prototype,"spatialReference",null),e([i()],R.prototype,"viewModel",void 0),e([i({readOnly:!0})],R.prototype,"_viewSpatialReference",null),e([i({readOnly:!0})],R.prototype,"_additionalCharactersPattern",null),R=e([n("esri.widgets.CoordinateConversion.support.Format")],R);const M=R;export{M as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import n from"../../../geometry/Point.js";import t from"../../../geometry/SpatialReference.js";function e(n,t){const e=r(t);return[n[0].toFixed(e),n[1].toFixed(e)]}function r(n){return n>=500?6:n<500&&n>=50?7:n<50&&n>=5?8:9}function i(e,r){const i=e.includes(",")?",":" ",[u,c,s]=e.split(i).map(n=>{const t=n.trim();return t?Number(t):null});if(!o(u)||!o(c))return null;const f=new n({x:u,y:c,spatialReference:r||t.WGS84});return s&&(f.z=s,f.hasZ=!0),f}function o(n){return"number"==typeof n&&isFinite(n)}function u(n){return!!n&&o(n.x)&&o(n.y)}function c(n,t){if(n.spatialReference.isGeographic&&t){const[r,i]=e([n.x,n.y],t);return`${r}, ${i}`}return`${n.x.toFixed(3)}, ${n.y.toFixed(3)}`}const s=["dd","dms","ddm","mgrs","usng","utm"];function f(n){return s.includes(n)}export{e as clipLonLat,i as fromXY,r as getDegreePrecision,f as isSupportedNotation,u as isValidPoint,c as pointToCoordinate};
2
+ import{clamp as t}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as n}from"../../../core/units.js";import r from"../../../geometry/Point.js";import e from"../../../geometry/SpatialReference.js";function i(t,n){return[t[0].toFixed(n),t[1].toFixed(n)]}const o=new Map;function u(r,e,i,u=4){if(null==r||!e)return u;if(o.has(r)){const t=o.get(r);if(void 0!==t[i])return t[i]}const s=n(e);if(!Number.isFinite(s)||s<=0)return u;const c=r*s/111320,f="dd"===i?c:"ddm"===i?60*c:3600*c,m=t(Math.ceil(-Math.log10(f)),0,7);return o.has(r)||(o.clear(),o.set(r,{})),o.get(r)[i]=m,m}function s(t){return t>=500?6:t<500&&t>=50?7:t<50&&t>=5?8:9}function c(t,n){const i=t.includes(",")?",":" ",[o,u,s]=t.split(i).map(t=>{const n=t.trim();return n?Number(n):null});if(!f(o)||!f(u))return null;const c=new r({x:o,y:u,spatialReference:n||e.WGS84});return s&&(c.z=s,c.hasZ=!0),c}function f(t){return"number"==typeof t&&isFinite(t)}function m(t){return!!t&&f(t.x)&&f(t.y)}function l(t,n){const[r,e]=i([t.x,t.y],n);return`${r}, ${e}`}const d=["dd","dms","ddm","mgrs","usng","utm"];function a(t){return d.includes(t)}function p(t){return t?t.replaceAll(/(?<![\d.])0+(?=\d)/g,""):t}export{c as fromXY,s as getDegreePrecision,u as getGeometryPrecision,a as isSupportedNotation,m as isValidPoint,l as pointToCoordinate,p as removeLeadingZeros};
@@ -23,7 +23,7 @@ import type { PictureMarkerSymbolProperties } from "../symbols/PictureMarkerSymb
23
23
  import type { SimpleMarkerSymbolProperties } from "../symbols/SimpleMarkerSymbol.js";
24
24
  import type { CoordinateConversionViewModelProperties } from "./CoordinateConversion/CoordinateConversionViewModel.js";
25
25
 
26
- export interface CoordinateConversionProperties extends WidgetProperties, Partial<Pick<CoordinateConversion, "currentLocation" | "goToOverride" | "headingLevel" | "mode" | "multipleConversions" | "orientation" | "storageEnabled" | "storageType" | "view" | "visibleElements">> {
26
+ export interface CoordinateConversionProperties extends WidgetProperties, Partial<Pick<CoordinateConversion, "calculateCoordinatePrecision" | "currentLocation" | "goToOverride" | "headingLevel" | "mode" | "multipleConversions" | "orientation" | "removeLeadingZeros" | "storageEnabled" | "storageType" | "view" | "visibleElements">> {
27
27
  /**
28
28
  * A [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) containing every [Conversion](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/support/Conversion/)
29
29
  * that the widget is currently displaying.
@@ -146,6 +146,14 @@ export default class CoordinateConversion extends Widget {
146
146
  * });
147
147
  */
148
148
  constructor(properties?: CoordinateConversionProperties);
149
+ /**
150
+ * This property determines whether the coordinates output by the viewModel will be truncated based
151
+ * on the current scale of the associated [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
152
+ *
153
+ * @default true
154
+ * @since 5.1
155
+ */
156
+ accessor calculateCoordinatePrecision: boolean;
149
157
  /**
150
158
  * A [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) containing every [Conversion](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/support/Conversion/)
151
159
  * that the widget is currently displaying.
@@ -251,6 +259,7 @@ export default class CoordinateConversion extends Widget {
251
259
  * * While in `live` mode, the widget will update as the cursor moves.
252
260
  * * While in `capture` mode, the widget will update on mouse click and display a graphic
253
261
  * marking the current location.
262
+ * * While in `idle` mode, no updates occur but the coordinate remains visible.
254
263
  *
255
264
  * @default "live"
256
265
  * @since 4.7
@@ -272,6 +281,17 @@ export default class CoordinateConversion extends Widget {
272
281
  * @since 4.7
273
282
  */
274
283
  accessor orientation: CoordinateConversionOrientation;
284
+ /**
285
+ * This property determines whether leading zeros in the coordinates will be removed.
286
+ * For example, the first coordinate includes leading zeros whereas the second does not:
287
+ *
288
+ * 1. 02 01 55.478822N 005 39 51.120259E
289
+ * 2. 1 55.478822N 5 39 51.120259E does not.
290
+ *
291
+ * @default false
292
+ * @since 5.1
293
+ */
294
+ accessor removeLeadingZeros: boolean;
275
295
  /**
276
296
  * If this property is set to `true`, sessionStorage or localStorage (depending on [storageType](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/#storageType))
277
297
  * will be used to hydrate and persist the CoordinateConversion widget's state.
@@ -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"../core/Collection.js";import{deprecateWidget as o}from"../core/deprecate.js";import i from"../core/Logger.js";import{maybeProperty as s}from"../core/maybe.js";import{property as n,cast as r,subclass as l}from"../core/accessorSupport/decorators.js";import{pointSymbolTypes as a}from"../symbols/support/typeUtils.js";import p from"./Widget.js";import c from"./CoordinateConversion/CoordinateConversionViewModel.js";import d from"./CoordinateConversion/support/Conversion.js";import u from"./CoordinateConversion/support/Format.js";import{loadCalciteComponents as h}from"./support/componentsUtils.js";import{globalCss as _}from"./support/globalCss.js";import{Heading as m}from"./support/Heading.js";import{legacyIcon as v}from"./support/legacyIcon.js";import{messageBundle as g,accessibleHandler as b,tsx as y,isRTL as C}from"./support/widget.js";import{storeNode as w}from"./support/widgetUtils.js";const f="esri-coordinate-conversion",T={base:f,captureMode:`${f}--capture-mode`,noBasemap:`${f}--no-basemap`,popup:`${f}__popup`,clipboardPopup:`${f}__clipboard-popup`,conversionList:`${f}__conversion-list`,conversionRow:`${f}__row`,coordDisplay:`${f}__display`,expandButton:`${f}__expand-button`,expanded:`${f}__conversions-view--expanded`,expandDown:`${f}__conversions-view--expand-down`,expandUp:`${f}__conversions-view--expand-up`,conversionsView:`${f}__conversions-view`,rowSelect:`${f}__select-row`,toolDisplay:`${f}__tools`,modeToggle:`${f}__mode-toggle`,rowButton:`${f}__row-button`,coordinateInput:`${f}__input-coordinate`,inputForm:`${f}__input-form`,inputFormGroup:`${f}__input-group`,inputSelect:`${f}__input-select`,sectionHeading:`${f}__heading`,patternInput:`${f}__pattern-input`,settings:`${f}__settings`,settingsFormGroup:`${f}__settings-group`,settingsFormGroupHorizontal:`${f}__settings-group-horizontal`,previewCoordinate:`${f}__preview-coordinate`},I={settingsButton:!0,inputButton:!0,captureButton:!0,expandButton:!0},x=750,P=2500;let M=class extends p{constructor(e,t){super(e,t),this._popupMessage=null,this._popupTimeoutId=void 0,this._clipboardPopupTimeoutId=void 0,this._coordinateInput=null,this._badInput=!1,this._goToEnabled=!1,this._conversionFormat=null,this._settingsFormat=null,this._previewConversion=null,this._expanded=!1,this._clipboardPopupVisible=!1,this._popupVisible=!1,this._settingsVisible=!1,this._inputVisible=!1,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.orientation="auto",this.viewModel=new c,this.visibleElements={...I},o(i.getLogger(this),"CoordinateConversion","arcgis-coordinate-conversion",{version:"4.34"})}loadDependencies(){return h({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),option:()=>import("@esri/calcite-components/dist/components/calcite-option"),select:()=>import("@esri/calcite-components/dist/components/calcite-select")})}get conversions(){return this.viewModel.conversions}set conversions(e){this.viewModel.conversions=e}get currentLocation(){return this.viewModel.currentLocation}set currentLocation(e){this.viewModel.currentLocation=e}get formats(){return this.viewModel.formats}set formats(e){this.viewModel.formats=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"coordinate-system"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}set multipleConversions(e){!1===e&&(this._expanded=!1,this.conversions.splice(1,this.conversions.length-1)),this._set("multipleConversions",e)}get multipleConversions(){const e=this._get("multipleConversions");return"boolean"!=typeof e||e}get locationSymbol(){return this.viewModel.locationSymbol}set locationSymbol(e){this.viewModel.locationSymbol=e}get storageEnabled(){return this.viewModel.storageEnabled}set storageEnabled(e){this.viewModel.storageEnabled=e}get storageType(){return this.viewModel.storageType}set storageType(e){this.viewModel.storageType=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...I,...e}}reverseConvert(e,t){return this.viewModel.reverseConvert(e,t)}render(){const e=this.viewModel?.state,t="disabled"===e?y("div",{key:"esri-coordinate__no-basemap"},this.messages?.noBasemap):null,o=!t&&this._inputVisible?this._renderInputForm():null,i=!t&&this._settingsVisible?this._renderSettings():null,s=t||o||i?null:this._renderConversionsView(),n=this._popupVisible?this._renderPopup():null,r={[T.captureMode]:"capture"===this.mode,[_.disabled]:"loading"===e,[T.noBasemap]:"disabled"===e};return y("div",{class:this.classes(T.base,_.widget,r)},n,t,s,i,o)}_addConversion(e){const t=e.target,o=t.selectedOption.value,i=$(t);if(null==o||null==i)return;const s=new d({format:o});t.value="default",i>=0?(this.conversions.removeAt(i),this.conversions.add(s,i)):this.conversions.add(s)}_findSettingsFormat(){return this._settingsFormat||this.conversions.reduceRight((e,t)=>{const o=t.format;return o?.hasDisplayProperties?o:e},null)||this.formats.find(e=>e.hasDisplayProperties)}_hidePopup(){this._popupTimeoutId&&(clearTimeout(this._popupTimeoutId),this._popupTimeoutId=void 0),this._popupVisible=!1,this._popupMessage=null,this.scheduleRender()}_hideClipboardPopup(){this._clipboardPopupTimeoutId&&(clearTimeout(this._clipboardPopupTimeoutId),this._clipboardPopupTimeoutId=void 0),this._clipboardPopupVisible=!1,this.scheduleRender()}_onConvertComplete(){this._inputVisible=!1,this._coordinateInput.value=""}_onCopy(e){const t=V(e.currentTarget)?.displayCoordinate;null!=t&&(e.clipboardData?.setData("text/plain",t),this._showClipboardPopup(),e.preventDefault())}_processUserInput(e){const t=s(e,"key"),o=this.viewModel;if("Enter"!==t&&t)this._badInput&&(this._badInput=!1);else{const e=this._conversionFormat||this.conversions.at(0).format;if(!e)return;const t=this._coordinateInput.value;this._reverseConvert(t,e).then(e=>{"capture"===this.mode?o.resume():this.mode="capture",this.currentLocation=e,o.setLocation(e),this._onConvertComplete()}).catch(e=>{i.getLogger(this).error(e),this._showPopup(this.messages?.invalidCoordinate),this._badInput=!0})}}async _reverseConvert(e,t){const o=this.viewModel,s=await t.reverseConvert(e);return this._goToEnabled&&s&&o.goToLocation(s).catch(e=>{i.getLogger(this).warn(e),this._showPopup(this.messages?.locationOffBasemap)}),s}_setInputFormat(e){const t=e.target.selectedOption.value;null!=t&&(this._conversionFormat=t)}_setPreviewConversion(){const e=this._findSettingsFormat(),t=this.viewModel;if(e){const o=this.conversions.find(t=>t.format===e);this._previewConversion=new d({format:e,position:{location:this.currentLocation,coordinate:o?.position?.coordinate}}),this._previewConversion.position?.coordinate||t.previewConversion(this._previewConversion)}}_setSettingsFormat(e){const t=e.target.selectedOption.value;null!=t&&(this._settingsFormat=t,this._setPreviewConversion())}_showClipboardPopup(){this._clipboardPopupVisible?clearTimeout(this._clipboardPopupTimeoutId):this._clipboardPopupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout(()=>{this._popupTimeoutId=void 0,this._hideClipboardPopup()},x)}_showPopup(e,t=P){this._popupMessage=e,this._popupVisible?clearTimeout(this._popupTimeoutId):this._popupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout(()=>{this._popupTimeoutId=void 0,this._hidePopup()},t)}_toggleGoTo(){this._goToEnabled=!this._goToEnabled}_updateCurrentPattern(e){e.stopPropagation();const t=e.target,o=this._findSettingsFormat();o&&(o.currentPattern=t.value)}_renderConversion(e,t){const{messages:o}=this;if(!o)return y("li",null);const{format:i}=e,s=i?.label??"",n=`${this.id}__list-item-${t}`,r=`${s} ${o.conversionOutputSuffix}`,l=0===t,a=l||this._expanded,p=l?this._renderFirstConversion(e):this._renderTools(t,e,n),c=l&&!e.displayCoordinate?o.noLocation:e.displayCoordinate,d=y("div",{"aria-label":c,class:T.coordDisplay,"data-conversion":e,role:"listitem",tabIndex:0,title:c??""},c),u=this._renderOptions(this.formats.filter(e=>e!==i));return a?y("li",{"aria-label":r,class:T.conversionRow,id:n,key:e,role:"group",tabIndex:0,title:r},y("calcite-select",{"aria-controls":n,bind:this,class:T.rowSelect,"data-index":t,label:o.selectFormat,scale:"s",onCalciteSelectChange:this._addConversion},y("calcite-option",{label:s.toUpperCase(),selected:!0},s.toUpperCase()),u),d,p):null}_renderCopyButton(e){const t=this._clipboardPopupVisible&&this._renderClipboardPopup(),{messagesCommon:o}=this;return o?y("li",{"aria-label":o.copy,bind:this,class:this.classes(_.widgetButton,T.rowButton),"data-conversion":e,onclick:this._copyCoordinateOutput,oncopy:this._onCopy,onkeydown:this._copyCoordinateOutput,role:"button",tabIndex:0,title:o.copy},t,y("span",{"aria-hidden":"true",class:v.duplicate})):y("li",null)}_renderFirstConversion(e){const t=this.id,{messages:o,messagesCommon:i,multipleConversions:s,visibleElements:n}=this;if(!i||!o)return y("ul",null);const r="live"===this.mode?o.captureMode:o.liveMode,l=this._expanded?i.collapse:i.expand,a=e.displayCoordinate&&"capture"===this.mode?this._renderCopyButton(e):null,p=s&&n.expandButton&&this._renderIconButton({iconType:this._expanded?"chevron-down":"chevron-up",clickFunction:this._toggleExpand,classes:[T.expandButton],attributes:{"aria-controls":`${t}__${T.conversionList}`,label:l}}),c=!s&&n.captureButton&&this._renderIconButton({iconType:"live"===this.mode?"pin-tear":"pin-tear-f",clickFunction:this._toggleMode,classes:[T.modeToggle],attributes:{label:r}});return y("ul",{class:T.toolDisplay},a,p,c)}_renderInputForm(){const e=this._conversionFormat||this.conversions.at(0).format,t=this.formats.findIndex(t=>t.name===e?.name),o=this.id,i=`${o}__${T.coordinateInput}`,s=`${o}__${T.coordinateInput}__header`,n=this._renderOptions(this.formats,!0,t),{messages:r,messagesCommon:l,headingLevel:a}=this;if(!l||!r)return y("div",null);const p=this._renderIconButton({iconType:C(this.container)?"arrow-right":"arrow-left",clickFunction:this._toggleInputVisibility,attributes:{label:l.back}});return y("div",{"aria-labelledby":s,class:T.inputForm,key:"esri-coordinate-conversion__input-form",role:"search"},y("div",{class:T.sectionHeading},p,y(m,{class:_.heading,id:s,level:a},r.inputCoordTitle)),y("div",{class:T.inputFormGroup},y("calcite-select",{"aria-controls":i,bind:this,class:T.inputSelect,label:r.selectFormat,scale:"s",onCalciteSelectChange:this._setInputFormat},n),y("calcite-input",{afterCreate:w,"aria-labelledby":s,bind:this,class:T.coordinateInput,"data-format":e,"data-node-ref":"_coordinateInput",id:i,onkeydown:this._processUserInput,placeholder:r.inputCoordTitle,required:!0,scale:"s",spellcheck:!1,status:this._badInput?"invalid":"idle"})),y("div",{class:T.inputFormGroup},y("calcite-label",{layout:"inline",scale:"s"},y("calcite-checkbox",{bind:this,checked:this._goToEnabled,onCalciteCheckboxChange:this._toggleGoTo}),r.goTo),y("calcite-button",{appearance:"outline",bind:this,kind:"neutral",onclick:this._processUserInput,type:"button",width:"auto"},r.convert)))}_renderConversionsView(){const{messages:e}=this;if(!e)return y("div",null);const t=`${this.id}__${T.conversionList}`,o=this._renderPrimaryTools(),i=this._renderOptions(this.formats),s=this.conversions.map((e,t)=>this._renderConversion(e,t)).toArray(),n=this._expanded?y("div",{class:T.conversionRow},y("calcite-select",{"aria-controls":t,bind:this,"data-index":-1,label:e.addConversion,scale:"s",onCalciteSelectChange:this._addConversion},y("calcite-option",{disabled:!0,selected:!0,value:"default"},e.addConversion),i),o):null,r={[T.expanded]:this._expanded,[T.expandUp]:"expand-up"===this.orientation,[T.expandDown]:"expand-down"===this.orientation};return y("div",{class:this.classes(T.conversionsView,r),key:"esri-coordinate-conversion__main-view"},y("ul",{"aria-expanded":this._expanded?"true":"false",class:T.conversionList,id:t},s),n)}_renderOptions(e,t,o){const i=this.conversions.at(0),s=i.format?.name;return e.map((e,n)=>{const r=!(t||!i)&&(s===e.name||this.conversions.map(e=>e.format?.name).includes(e.name));return y("calcite-option",{disabled:r,key:e.name??"unnamed-format",label:e.label.toUpperCase(),selected:n===o,value:e},e.label)}).toArray()}_renderPopup(){return y("div",{class:T.popup,role:"alert"},this._popupMessage)}_renderClipboardPopup(){const{messages:e}=this;return e?y("div",{class:this.classes(T.popup,T.clipboardPopup),role:"alert"},e.copySuccessMessage):y("div",null)}_renderPrimaryTools(){const{messages:e,visibleElements:t}=this;if(!e)return y("ul",null);const o="live"===this.mode?e.captureMode:e.liveMode,i=t.inputButton&&this._renderIconButton({iconType:"pencil",clickFunction:this._toggleInputVisibility,attributes:{label:e.inputCoordTitle}}),s=t.captureButton&&this._renderIconButton({iconType:"live"===this.mode?"pin-tear":"pin-tear-f",clickFunction:this._toggleMode,classes:[T.modeToggle],attributes:{label:o}}),n=t.settingsButton&&this._renderIconButton({iconType:"gear",clickFunction:this._toggleSettingsVisibility,attributes:{label:e.settingsTitle}});return y("ul",{class:T.toolDisplay},i,s,n)}_renderSettings(){const e=this.id,t=`${e}__${T.patternInput}`,o=`${e}__${T.patternInput}__header`,i=`${e}__${T.previewCoordinate}`,s=this.formats.filter(e=>e.hasDisplayProperties),n=this._findSettingsFormat(),r=n?s.indexOf(n):-1,l=this._renderOptions(s,!0,r),a=n?.currentPattern,{messages:p,messagesCommon:c,headingLevel:d}=this;if(!c||!p)return y("div",null);const u=this._renderIconButton({iconType:C(this.container)?"arrow-right":"arrow-left",clickFunction:this._toggleSettingsVisibility,attributes:{label:c.back}}),h=this._renderIconButton({iconType:"reset",clickFunction:this._setDefaultPattern,attributes:{label:p.defaultPattern}});return y("div",{"aria-labelledby":o,class:T.settings,key:T.settings},y("div",{class:T.sectionHeading},u,y(m,{class:_.heading,id:o,level:d},p.settingsTitle)),y("div",{class:T.settingsFormGroup},y("label",{for:t},p.changeCoordinateDisplay),y("calcite-select",{bind:this,label:p.selectFormat,width:"full",onCalciteSelectChange:this._setSettingsFormat},l),y("div",{class:T.settingsFormGroupHorizontal},y("calcite-input",{"aria-controls":i,bind:this,class:T.patternInput,id:t,spellcheck:!1,type:"text",value:a,onCalciteInputInput:this._updateCurrentPattern}),h)),y("div",{class:T.settingsFormGroup},y("label",null,c.preview,y("div",{class:T.previewCoordinate,id:i,tabIndex:0},this._previewConversion?.displayCoordinate))))}_renderIconButton(e){const{iconType:t,clickFunction:o,classes:i,attributes:s}=e;return y("calcite-button",{appearance:"transparent",bind:this,class:this.classes(i),iconStart:t,kind:"neutral",onclick:o,onkeydown:o,...s})}_renderTools(e,t,o){const i=t.displayCoordinate&&"capture"===this.mode?this._renderCopyButton(t):null,{messages:s}=this;if(!s)return y("ul",null);const n=this._renderIconButton({iconType:"x",clickFunction:this._removeConversion,attributes:{"aria-controls":o,label:s.removeConversion,"data-index":e}});return y("ul",{class:T.toolDisplay,role:"listitem"},i,y("li",{class:this.classes(T.rowButton)},n))}_copyCoordinateOutput(e){const t=e.target;if(!("createTextRange"in document.body)){const e=window.getSelection(),o=document.createRange();o.selectNodeContents(t),e?.removeAllRanges(),e?.addRange(o)}document.execCommand("copy")}_removeConversion(e){const t=$(e.currentTarget);null!=t&&this.conversions.removeAt(t)}_setDefaultPattern(e){e.stopPropagation();const t=this._findSettingsFormat();t&&(t.currentPattern=t.defaultPattern)}_toggleExpand(){this._expanded=!this._expanded}_toggleInputVisibility(){this._inputVisible=!this._inputVisible,this._popupVisible&&this._hidePopup(),this._inputVisible?this.viewModel.pause():this.viewModel.resume()}_toggleMode(){this.mode="live"===this.mode?"capture":"live"}_toggleSettingsVisibility(){this._settingsVisible=!this._settingsVisible,this._popupVisible&&this._hidePopup(),this._settingsVisible?(this._setPreviewConversion(),this.viewModel.pause()):this.viewModel.resume()}};e([n()],M.prototype,"conversions",null),e([n()],M.prototype,"currentLocation",null),e([n({type:t.ofType(u)})],M.prototype,"formats",null),e([n()],M.prototype,"goToOverride",null),e([n()],M.prototype,"headingLevel",void 0),e([n()],M.prototype,"icon",null),e([n()],M.prototype,"label",null),e([n(),g("esri/widgets/CoordinateConversion/t9n/CoordinateConversion")],M.prototype,"messages",void 0),e([n(),g("esri/t9n/common")],M.prototype,"messagesCommon",void 0),e([n()],M.prototype,"mode",null),e([n()],M.prototype,"orientation",void 0),e([n()],M.prototype,"multipleConversions",null),e([n({types:a})],M.prototype,"locationSymbol",null),e([n()],M.prototype,"storageEnabled",null),e([n()],M.prototype,"storageType",null),e([n()],M.prototype,"view",null),e([n({type:c})],M.prototype,"viewModel",void 0),e([n()],M.prototype,"visibleElements",void 0),e([r("visibleElements")],M.prototype,"castVisibleElements",null),e([b()],M.prototype,"_copyCoordinateOutput",null),e([b()],M.prototype,"_removeConversion",null),e([b()],M.prototype,"_setDefaultPattern",null),e([b()],M.prototype,"_toggleExpand",null),e([b()],M.prototype,"_toggleInputVisibility",null),e([b()],M.prototype,"_toggleMode",null),e([b()],M.prototype,"_toggleSettingsVisibility",null),M=e([l("esri.widgets.CoordinateConversion")],M);const F=M;function $(e){return e["data-index"]}function V(e){return e["data-conversion"]}export{F as default};
2
+ import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as o}from"../core/deprecate.js";import i from"../core/Logger.js";import{maybeProperty as s}from"../core/maybe.js";import{property as n,cast as r,subclass as a}from"../core/accessorSupport/decorators.js";import{pointSymbolTypes as l}from"../symbols/support/typeUtils.js";import p from"./Widget.js";import c from"./CoordinateConversion/CoordinateConversionViewModel.js";import d from"./CoordinateConversion/support/Conversion.js";import u from"./CoordinateConversion/support/Format.js";import{loadCalciteComponents as h}from"./support/componentsUtils.js";import{globalCss as _}from"./support/globalCss.js";import{Heading as m}from"./support/Heading.js";import{legacyIcon as v}from"./support/legacyIcon.js";import{messageBundle as g,accessibleHandler as b,tsx as y,isRTL as C}from"./support/widget.js";import{storeNode as w}from"./support/widgetUtils.js";const f="esri-coordinate-conversion",T={base:f,captureMode:`${f}--capture-mode`,noBasemap:`${f}--no-basemap`,popup:`${f}__popup`,clipboardPopup:`${f}__clipboard-popup`,conversionList:`${f}__conversion-list`,conversionRow:`${f}__row`,coordDisplay:`${f}__display`,expandButton:`${f}__expand-button`,expanded:`${f}__conversions-view--expanded`,expandDown:`${f}__conversions-view--expand-down`,expandUp:`${f}__conversions-view--expand-up`,conversionsView:`${f}__conversions-view`,rowSelect:`${f}__select-row`,toolDisplay:`${f}__tools`,modeToggle:`${f}__mode-toggle`,rowButton:`${f}__row-button`,coordinateInput:`${f}__input-coordinate`,inputForm:`${f}__input-form`,inputFormGroup:`${f}__input-group`,inputSelect:`${f}__input-select`,sectionHeading:`${f}__heading`,patternInput:`${f}__pattern-input`,settings:`${f}__settings`,settingsFormGroup:`${f}__settings-group`,settingsFormGroupHorizontal:`${f}__settings-group-horizontal`,previewCoordinate:`${f}__preview-coordinate`},I={settingsButton:!0,inputButton:!0,captureButton:!0,expandButton:!0},x=750,P=2500;let M=class extends p{constructor(e,t){super(e,t),this._popupMessage=null,this._popupTimeoutId=void 0,this._clipboardPopupTimeoutId=void 0,this._coordinateInput=null,this._badInput=!1,this._goToEnabled=!1,this._conversionFormat=null,this._settingsFormat=null,this._previewConversion=null,this._expanded=!1,this._clipboardPopupVisible=!1,this._popupVisible=!1,this._settingsVisible=!1,this._inputVisible=!1,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.orientation="auto",this.viewModel=new c,this.visibleElements={...I},o(i.getLogger(this),"CoordinateConversion","arcgis-coordinate-conversion",{version:"4.34"})}loadDependencies(){return h({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),option:()=>import("@esri/calcite-components/dist/components/calcite-option"),select:()=>import("@esri/calcite-components/dist/components/calcite-select")})}get calculateCoordinatePrecision(){return this.viewModel.calculateCoordinatePrecision}set calculateCoordinatePrecision(e){this.viewModel.calculateCoordinatePrecision=e}get conversions(){return this.viewModel.conversions}set conversions(e){this.viewModel.conversions=e}get currentLocation(){return this.viewModel.currentLocation}set currentLocation(e){this.viewModel.currentLocation=e}get formats(){return this.viewModel.formats}set formats(e){this.viewModel.formats=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"coordinate-system"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}set multipleConversions(e){!1===e&&(this._expanded=!1,this.conversions.splice(1,this.conversions.length-1)),this._set("multipleConversions",e)}get multipleConversions(){const e=this._get("multipleConversions");return"boolean"!=typeof e||e}get locationSymbol(){return this.viewModel.locationSymbol}set locationSymbol(e){this.viewModel.locationSymbol=e}get removeLeadingZeros(){return this.viewModel.removeLeadingZeros}set removeLeadingZeros(e){this.viewModel.removeLeadingZeros=e}get storageEnabled(){return this.viewModel.storageEnabled}set storageEnabled(e){this.viewModel.storageEnabled=e}get storageType(){return this.viewModel.storageType}set storageType(e){this.viewModel.storageType=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...I,...e}}reverseConvert(e,t){return this.viewModel.reverseConvert(e,t)}render(){const e=this.viewModel?.state,t="disabled"===e?y("div",{key:"esri-coordinate__no-basemap"},this.messages?.noBasemap):null,o=!t&&this._inputVisible?this._renderInputForm():null,i=!t&&this._settingsVisible?this._renderSettings():null,s=t||o||i?null:this._renderConversionsView(),n=this._popupVisible?this._renderPopup():null,r={[T.captureMode]:"capture"===this.mode,[_.disabled]:"loading"===e,[T.noBasemap]:"disabled"===e};return y("div",{class:this.classes(T.base,_.widget,r)},n,t,s,i,o)}_addConversion(e){const t=e.target,o=t.selectedOption.value,i=$(t);if(null==o||null==i)return;const s=new d({format:o});t.value="default",i>=0?(this.conversions.removeAt(i),this.conversions.add(s,i)):this.conversions.add(s)}_findSettingsFormat(){return this._settingsFormat||this.conversions.reduceRight((e,t)=>{const o=t.format;return o?.hasDisplayProperties?o:e},null)||this.formats.find(e=>e.hasDisplayProperties)}_hidePopup(){this._popupTimeoutId&&(clearTimeout(this._popupTimeoutId),this._popupTimeoutId=void 0),this._popupVisible=!1,this._popupMessage=null,this.scheduleRender()}_hideClipboardPopup(){this._clipboardPopupTimeoutId&&(clearTimeout(this._clipboardPopupTimeoutId),this._clipboardPopupTimeoutId=void 0),this._clipboardPopupVisible=!1,this.scheduleRender()}_onConvertComplete(){this._inputVisible=!1,this._coordinateInput.value=""}_onCopy(e){const t=V(e.currentTarget)?.displayCoordinate;null!=t&&(e.clipboardData?.setData("text/plain",t),this._showClipboardPopup(),e.preventDefault())}_processUserInput(e){const t=s(e,"key"),o=this.viewModel;if("Enter"!==t&&t)this._badInput&&(this._badInput=!1);else{const e=this._conversionFormat||this.conversions.at(0).format;if(!e)return;const t=this._coordinateInput.value;this._reverseConvert(t,e).then(e=>{"capture"===this.mode?o.resume():this.mode="capture",this.currentLocation=e,o.setLocation(e),this._onConvertComplete()}).catch(e=>{i.getLogger(this).error(e),this._showPopup(this.messages?.invalidCoordinate),this._badInput=!0})}}async _reverseConvert(e,t){const o=this.viewModel,s=await t.reverseConvert(e);return this._goToEnabled&&s&&o.goToLocation(s).catch(e=>{i.getLogger(this).warn(e),this._showPopup(this.messages?.locationOffBasemap)}),s}_setInputFormat(e){const t=e.target.selectedOption.value;null!=t&&(this._conversionFormat=t)}_setPreviewConversion(){const e=this._findSettingsFormat(),t=this.viewModel;if(e){const o=this.conversions.find(t=>t.format===e);this._previewConversion=new d({format:e,position:{location:this.currentLocation,coordinate:o?.position?.coordinate}}),this._previewConversion.position?.coordinate||t.previewConversion(this._previewConversion)}}_setSettingsFormat(e){const t=e.target.selectedOption.value;null!=t&&(this._settingsFormat=t,this._setPreviewConversion())}_showClipboardPopup(){this._clipboardPopupVisible?clearTimeout(this._clipboardPopupTimeoutId):this._clipboardPopupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout(()=>{this._popupTimeoutId=void 0,this._hideClipboardPopup()},x)}_showPopup(e,t=P){this._popupMessage=e,this._popupVisible?clearTimeout(this._popupTimeoutId):this._popupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout(()=>{this._popupTimeoutId=void 0,this._hidePopup()},t)}_toggleGoTo(){this._goToEnabled=!this._goToEnabled}_updateCurrentPattern(e){e.stopPropagation();const t=e.target,o=this._findSettingsFormat();o&&(o.currentPattern=t.value)}_renderConversion(e,t){const{messages:o}=this;if(!o)return y("li",null);const{format:i}=e,s=i?.label??"",n=`${this.id}__list-item-${t}`,r=`${s} ${o.conversionOutputSuffix}`,a=0===t,l=a||this._expanded,p=a?this._renderFirstConversion(e):this._renderTools(t,e,n),c=a&&!e.displayCoordinate?o.noLocation:e.displayCoordinate,d=y("div",{"aria-label":c,class:T.coordDisplay,"data-conversion":e,role:"listitem",tabIndex:0,title:c??""},c),u=this._renderOptions(this.formats.filter(e=>e!==i));return l?y("li",{"aria-label":r,class:T.conversionRow,id:n,key:e,role:"group",tabIndex:0,title:r},y("calcite-select",{"aria-controls":n,bind:this,class:T.rowSelect,"data-index":t,label:o.selectFormat,scale:"s",onCalciteSelectChange:this._addConversion},y("calcite-option",{label:s.toUpperCase(),selected:!0},s.toUpperCase()),u),d,p):null}_renderCopyButton(e){const t=this._clipboardPopupVisible&&this._renderClipboardPopup(),{messagesCommon:o}=this;return o?y("li",{"aria-label":o.copy,bind:this,class:this.classes(_.widgetButton,T.rowButton),"data-conversion":e,onclick:this._copyCoordinateOutput,oncopy:this._onCopy,onkeydown:this._copyCoordinateOutput,role:"button",tabIndex:0,title:o.copy},t,y("span",{"aria-hidden":"true",class:v.duplicate})):y("li",null)}_renderFirstConversion(e){const t=this.id,{messages:o,messagesCommon:i,multipleConversions:s,visibleElements:n}=this;if(!i||!o)return y("ul",null);const r="live"===this.mode?o.captureMode:o.liveMode,a=this._expanded?i.collapse:i.expand,l=!e.displayCoordinate||"capture"!==this.mode&&"idle"!==this.mode?null:this._renderCopyButton(e),p=s&&n.expandButton&&this._renderIconButton({iconType:this._expanded?"chevron-down":"chevron-up",clickFunction:this._toggleExpand,classes:[T.expandButton],attributes:{"aria-controls":`${t}__${T.conversionList}`,label:a}}),c=!s&&n.captureButton&&this._renderIconButton({iconType:"capture"===this.mode?"pin-tear-f":"pin-tear",clickFunction:this._toggleMode,classes:[T.modeToggle],attributes:{label:r}});return y("ul",{class:T.toolDisplay},l,p,c)}_renderInputForm(){const e=this._conversionFormat||this.conversions.at(0).format,t=this.formats.findIndex(t=>t.name===e?.name),o=this.id,i=`${o}__${T.coordinateInput}`,s=`${o}__${T.coordinateInput}__header`,n=this._renderOptions(this.formats,!0,t),{messages:r,messagesCommon:a,headingLevel:l}=this;if(!a||!r)return y("div",null);const p=this._renderIconButton({iconType:C(this.container)?"arrow-right":"arrow-left",clickFunction:this._toggleInputVisibility,attributes:{label:a.back}});return y("div",{"aria-labelledby":s,class:T.inputForm,key:"esri-coordinate-conversion__input-form",role:"search"},y("div",{class:T.sectionHeading},p,y(m,{class:_.heading,id:s,level:l},r.inputCoordTitle)),y("div",{class:T.inputFormGroup},y("calcite-select",{"aria-controls":i,bind:this,class:T.inputSelect,label:r.selectFormat,scale:"s",onCalciteSelectChange:this._setInputFormat},n),y("calcite-input",{afterCreate:w,"aria-labelledby":s,bind:this,class:T.coordinateInput,"data-format":e,"data-node-ref":"_coordinateInput",id:i,onkeydown:this._processUserInput,placeholder:r.inputCoordTitle,required:!0,scale:"s",spellcheck:!1,status:this._badInput?"invalid":"idle"})),y("div",{class:T.inputFormGroup},y("calcite-label",{layout:"inline",scale:"s"},y("calcite-checkbox",{bind:this,checked:this._goToEnabled,onCalciteCheckboxChange:this._toggleGoTo}),r.goTo),y("calcite-button",{appearance:"outline",bind:this,kind:"neutral",onclick:this._processUserInput,type:"button",width:"auto"},r.convert)))}_renderConversionsView(){const{messages:e}=this;if(!e)return y("div",null);const t=`${this.id}__${T.conversionList}`,o=this._renderPrimaryTools(),i=this._renderOptions(this.formats),s=this.conversions.map((e,t)=>this._renderConversion(e,t)).toArray(),n=this._expanded?y("div",{class:T.conversionRow},y("calcite-select",{"aria-controls":t,bind:this,"data-index":-1,label:e.addConversion,scale:"s",onCalciteSelectChange:this._addConversion},y("calcite-option",{disabled:!0,selected:!0,value:"default"},e.addConversion),i),o):null,r={[T.expanded]:this._expanded,[T.expandUp]:"expand-up"===this.orientation,[T.expandDown]:"expand-down"===this.orientation};return y("div",{class:this.classes(T.conversionsView,r),key:"esri-coordinate-conversion__main-view"},y("ul",{"aria-expanded":this._expanded?"true":"false",class:T.conversionList,id:t},s),n)}_renderOptions(e,t,o){const i=this.conversions.at(0),s=i.format?.name;return e.map((e,n)=>{const r=!(t||!i)&&(s===e.name||this.conversions.map(e=>e.format?.name).includes(e.name));return y("calcite-option",{disabled:r,key:e.name??"unnamed-format",label:e.label.toUpperCase(),selected:n===o,value:e},e.label)}).toArray()}_renderPopup(){return y("div",{class:T.popup,role:"alert"},this._popupMessage)}_renderClipboardPopup(){const{messages:e}=this;return e?y("div",{class:this.classes(T.popup,T.clipboardPopup),role:"alert"},e.copySuccessMessage):y("div",null)}_renderPrimaryTools(){const{messages:e,visibleElements:t}=this;if(!e)return y("ul",null);const o="live"===this.mode?e.captureMode:e.liveMode,i=t.inputButton&&this._renderIconButton({iconType:"pencil",clickFunction:this._toggleInputVisibility,attributes:{label:e.inputCoordTitle}}),s=t.captureButton&&this._renderIconButton({iconType:"capture"===this.mode?"pin-tear-f":"pin-tear",clickFunction:this._toggleMode,classes:[T.modeToggle],attributes:{label:o}}),n=t.settingsButton&&this._renderIconButton({iconType:"gear",clickFunction:this._toggleSettingsVisibility,attributes:{label:e.settingsTitle}});return y("ul",{class:T.toolDisplay},i,s,n)}_renderSettings(){const e=this.id,t=`${e}__${T.patternInput}`,o=`${e}__${T.patternInput}__header`,i=`${e}__${T.previewCoordinate}`,s=this.formats.filter(e=>e.hasDisplayProperties),n=this._findSettingsFormat(),r=n?s.indexOf(n):-1,a=this._renderOptions(s,!0,r),l=n?.currentPattern,{messages:p,messagesCommon:c,headingLevel:d}=this;if(!c||!p)return y("div",null);const u=this._renderIconButton({iconType:C(this.container)?"arrow-right":"arrow-left",clickFunction:this._toggleSettingsVisibility,attributes:{label:c.back}}),h=this._renderIconButton({iconType:"reset",clickFunction:this._setDefaultPattern,attributes:{label:p.defaultPattern}});return y("div",{"aria-labelledby":o,class:T.settings,key:T.settings},y("div",{class:T.sectionHeading},u,y(m,{class:_.heading,id:o,level:d},p.settingsTitle)),y("div",{class:T.settingsFormGroup},y("label",{for:t},p.changeCoordinateDisplay),y("calcite-select",{bind:this,label:p.selectFormat,width:"full",onCalciteSelectChange:this._setSettingsFormat},a),y("div",{class:T.settingsFormGroupHorizontal},y("calcite-input",{"aria-controls":i,bind:this,class:T.patternInput,id:t,spellcheck:!1,type:"text",value:l,onCalciteInputInput:this._updateCurrentPattern}),h)),y("div",{class:T.settingsFormGroup},y("label",null,c.preview,y("div",{class:T.previewCoordinate,id:i,tabIndex:0},this._previewConversion?.displayCoordinate))))}_renderIconButton(e){const{iconType:t,clickFunction:o,classes:i,attributes:s}=e;return y("calcite-button",{appearance:"transparent",bind:this,class:this.classes(i),iconStart:t,kind:"neutral",onclick:o,onkeydown:o,...s})}_renderTools(e,t,o){const i=!t.displayCoordinate||"capture"!==this.mode&&"idle"!==this.mode?null:this._renderCopyButton(t),{messages:s}=this;if(!s)return y("ul",null);const n=this._renderIconButton({iconType:"x",clickFunction:this._removeConversion,attributes:{"aria-controls":o,label:s.removeConversion,"data-index":e}});return y("ul",{class:T.toolDisplay,role:"listitem"},i,y("li",{class:this.classes(T.rowButton)},n))}_copyCoordinateOutput(e){const t=e.target;if(!("createTextRange"in document.body)){const e=window.getSelection(),o=document.createRange();o.selectNodeContents(t),e?.removeAllRanges(),e?.addRange(o)}document.execCommand("copy")}_removeConversion(e){const t=$(e.currentTarget);null!=t&&this.conversions.removeAt(t)}_setDefaultPattern(e){e.stopPropagation();const t=this._findSettingsFormat();t&&(t.currentPattern=t.defaultPattern)}_toggleExpand(){this._expanded=!this._expanded}_toggleInputVisibility(){this._inputVisible=!this._inputVisible,this._popupVisible&&this._hidePopup(),this._inputVisible?this.viewModel.pause():this.viewModel.resume()}_toggleMode(){this.mode="live"===this.mode?"capture":"live"}_toggleSettingsVisibility(){this._settingsVisible=!this._settingsVisible,this._popupVisible&&this._hidePopup(),this._settingsVisible?(this._setPreviewConversion(),this.viewModel.pause()):this.viewModel.resume()}};e([n()],M.prototype,"calculateCoordinatePrecision",null),e([n()],M.prototype,"conversions",null),e([n()],M.prototype,"currentLocation",null),e([n({type:t.ofType(u)})],M.prototype,"formats",null),e([n()],M.prototype,"goToOverride",null),e([n()],M.prototype,"headingLevel",void 0),e([n()],M.prototype,"icon",null),e([n()],M.prototype,"label",null),e([n(),g("esri/widgets/CoordinateConversion/t9n/CoordinateConversion")],M.prototype,"messages",void 0),e([n(),g("esri/t9n/common")],M.prototype,"messagesCommon",void 0),e([n()],M.prototype,"mode",null),e([n()],M.prototype,"orientation",void 0),e([n()],M.prototype,"multipleConversions",null),e([n({types:l})],M.prototype,"locationSymbol",null),e([n()],M.prototype,"removeLeadingZeros",null),e([n()],M.prototype,"storageEnabled",null),e([n()],M.prototype,"storageType",null),e([n()],M.prototype,"view",null),e([n({type:c})],M.prototype,"viewModel",void 0),e([n()],M.prototype,"visibleElements",void 0),e([r("visibleElements")],M.prototype,"castVisibleElements",null),e([b()],M.prototype,"_copyCoordinateOutput",null),e([b()],M.prototype,"_removeConversion",null),e([b()],M.prototype,"_setDefaultPattern",null),e([b()],M.prototype,"_toggleExpand",null),e([b()],M.prototype,"_toggleInputVisibility",null),e([b()],M.prototype,"_toggleMode",null),e([b()],M.prototype,"_toggleSettingsVisibility",null),M=e([a("esri.widgets.CoordinateConversion")],M);const F=M;function $(e){return e["data-index"]}function V(e){return e["data-conversion"]}export{F 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{deprecateUnnecessaryViewModel as e}from"../../core/deprecate.js";import{EventedAccessor as i}from"../../core/Evented.js";import{makeHandle as n}from"../../core/handleUtils.js";import s from"../../core/Logger.js";import{removeMaybe as a}from"../../core/maybe.js";import{when as l,initial as r,watch as h,on as o,syncAndInitial as g}from"../../core/reactiveUtils.js";import{schedule as d}from"../../core/scheduling.js";import{truncateLocalTime as p,isValidDate as u,resetUTCDate as y,offsetDate as c}from"../../core/timeUtils.js";import{property as m,subclass as _}from"../../core/accessorSupport/decorators.js";import f from"../../views/3d/environment/SunLighting.js";import D from"../../views/3d/environment/VirtualLighting.js";import{positionToTimezoneInfo as w}from"../../views/3d/support/earthUtils.js";import{dateTimeToSliderPos as U,sliderPosToDateTime as S,getSeasonFromDate as T,getNorthernHemisphereSeason as v,getSeasonDate as L,calculatePlaySpeed as P}from"./support/daylightUtils.js";import{SliderWithDropdownViewModel as b}from"./support/SliderWithDropdownViewModel.js";import{formatSliderLabel as C,getSunriseAndSunsetTimes as O}from"../support/timeWidgetUtils.js";let E=class extends i{constructor(t){super(t),this.view=null,this.timeSliderViewModel=new b({min:0,max:1439,values:[0],labelFormatFunction:C,inputFormatFunction:C}),this.lightingUpdateInterval=200,this._oldLighting=null,this.playSpeedMultiplier=1,this._lastTime=null,this._sunrise=null,this._sunset=null,this._cachedLightingDateUTC=new Date(0),this._cachedDisplayUTCOffset=0,this._lastLightingUpdate=0,this._lightingUpdateHandle=null,t?.suppressDeprecationWarning||e(s.getLogger(this),"Daylight","arcgis-daylight",{version:"4.34"})}normalizeCtorArgs(t={}){const{suppressDeprecationWarning:e,...i}=t;return i}initialize(){this.addHandles([l(()=>this.view,t=>t.when(()=>this._updateLighting()),r),h(()=>{const t=this._lighting;return"sun"===t?.type?t.date:null},t=>this._scheduleLightingUpdate(t)),o(()=>this._lighting,"timezone-will-change",t=>this._timezoneWillChange(t),{onListenerAdd:()=>this._timezoneWillChange(null)}),h(()=>!0===this.view?.stationary,()=>{(this.dayPlaying||this.yearPlaying)&&this._updateSunriseAndSunset()},r),h(()=>{const t=this.timeSliderViewModel;return{vm:t,state:t.state,sliderPosition:this.timeSliderPosition}},({vm:t,state:e,sliderPosition:i})=>{"ready"===e&&t.setValue(0,i)}),h(()=>this.timeSliderViewModel?.utcOffset,t=>{null!=t&&(this.utcOffset=t)}),h(()=>({utcOffset:this.utcOffset,sliderViewModel:this.timeSliderViewModel}),({utcOffset:t,sliderViewModel:e})=>{e&&(e.utcOffset=t)},g),h(()=>this.timeSliderViewModel.timezonePickerOpen,()=>this.stopPlaying()),h(()=>this.timeSliderViewModel.values,t=>this._setTimeSliderPosition(t?.[0]??0,{forceLightingUpdate:!1}))])}destroy(){this._cancelLightingUpdate(),this.view=null}get isSupported(){return null==this.view||"3d"===this.view.type}get utcOffset(){return this._cachedDisplayUTCOffset}set utcOffset(t){t!==this.utcOffset&&null!=this._lighting&&"virtual"!==this._lighting.type&&(this._lighting.displayUTCOffset=t,this._updateLighting())}get localDate(){return p(this._lightingDateDisplay)}set localDate(t){this.view?.ready?u(t)&&t.getTime()!==this.localDate.getTime()&&(this._lightingDateDisplay=y(this._lightingDateDisplay,t)):s.getLogger(this).error("The localDate property cannot be set before the view and the widget are ready.")}get timeSliderPosition(){return U(this._lightingDateDisplay)}set timeSliderPosition(t){this.view?.ready&&"ready"===this.timeSliderViewModel?.state?this._setTimeSliderPosition(t,{forceLightingUpdate:!0}):s.getLogger(this).error("The timeSliderPosition property cannot be set before the view and the widget are ready.")}_setTimeSliderPosition(t,e){Math.abs(t-this.timeSliderPosition)<=1/60||(this.stopPlaying(),this._onUserDateTimeChange(),e.forceLightingUpdate&&(this._cancelLightingUpdate(),this._updateLighting()),this._lightingDateDisplay=S(this._lightingDateDisplay,t))}_timezoneFromCamera(t,e){if(null==e||!t.cameraTrackingEnabled)return 0;const i=w([e.longitude,e.latitude]);return null==i?0:Math.round(i.hours+i.minutes/60+i.seconds/3600)}get directShadowsEnabled(){return this._lighting?.directShadowsEnabled??!1}set directShadowsEnabled(t){const e=this._lighting;e&&(e.directShadowsEnabled=t)}get sunLightingEnabled(){return"sun"===this._lightingType}set sunLightingEnabled(t){const e=this._environment;if(t===this._get("sunLightingEnabled")||null==e)return;const i=e.lighting,n=this._oldLighting;this._oldLighting=i;const s={directShadowsEnabled:i.directShadowsEnabled,cameraTrackingEnabled:i.cameraTrackingEnabled},a=t?"sun":"virtual";let l;l=null!=n&&n.type===a?n:t?new f:new D,l.set(s),e.lighting=l,t||(this.stopPlaying(),this.timeSliderViewModel.timezonePickerOpen=!1)}set playingState(t){this.playingState!==t&&(this._set("playingState",t),"none"!==t&&this.sunLightingEnabled&&(this._updateSunriseAndSunset(),this._lastTime=Date.now(),this._play(),this._onUserDateTimeChange()))}get dayPlaying(){return"day"===this.playingState}set dayPlaying(t){t?this.playingState="day":this.dayPlaying&&(this.playingState="none")}get yearPlaying(){return"year"===this.playingState}set yearPlaying(t){t?this.playingState="year":this.yearPlaying&&(this.playingState="none")}get currentSeason(){return T(this.localDate,this._currentHemisphere)}set currentSeason(t){this.stopPlaying(),this._onUserDateTimeChange();const e=v(t,this._currentHemisphere);this.localDate=L(this.localDate,e,0)}get _currentHemisphere(){const t=this.view?.camera?.position?.latitude;return null==t||t>=0?0:1}get _environment(){return this.view?.environment}get _lighting(){return this._environment?.lighting}get _lightingType(){return this._lighting?.type}get _lightingDateDisplay(){return c(this._cachedLightingDateUTC,this._cachedDisplayUTCOffset,"hours")}set _lightingDateDisplay(t){const e=this._lighting;if(null==e||!this.sunLightingEnabled||"virtual"===e.type||!u(t))return;const i=e.date,n=c(t,-this._cachedDisplayUTCOffset,"hours");n.getTime()!==i.getTime()&&(e.date=n,this._updateLighting())}stopPlaying(){this.playingState="none"}toggleDayPlaying(){this.dayPlaying=!this.dayPlaying}toggleYearPlaying(){this.yearPlaying=!this.yearPlaying}toggleSunLightingEnabled(){this.stopPlaying(),this.sunLightingEnabled=!this.sunLightingEnabled}toggleDirectShadowsEnabled(){this.stopPlaying(),this.directShadowsEnabled=!this.directShadowsEnabled}onDateChange(t){this.dayPlaying=!1,this.localDate=t,this._onUserDateTimeChange()}_updateLighting(t){const e=Date.now();this._lastLightingUpdate=e;const{view:i}=this,n=this._lighting;if(null==i||null==n||"virtual"===n.type)return;t??=n.date;const s=n.displayUTCOffset,a=null!=s?s:this._timezoneFromCamera(n,i.camera?.position);this._cachedLightingDateUTC.getTime()!==t.getTime()&&(this._cachedLightingDateUTC=new Date(t)),this._cachedDisplayUTCOffset!==a&&(this._cachedDisplayUTCOffset=a)}_timezoneWillChange(t){const e=this._lighting;if(null==e||"virtual"===e.type||!e.cameraTrackingEnabled)return;let i;if(t)i=t.timezoneOffset;else{if(null!=e.displayUTCOffset)return;i=f.calculateTimezoneOffset(e.positionTimezoneInfo)}e.displayUTCOffset=i,this._scheduleLightingUpdate()}_scheduleLightingUpdate(t){if(t&&(this._lightingUpdateHandle=a(this._lightingUpdateHandle),!u(t)))return;if(this._lightingUpdateHandle)return;const e=Date.now()-this._lastLightingUpdate,i=this.lightingUpdateInterval-e;let s=null;const l=()=>{this._updateLighting(t),this._lightingUpdateHandle===s&&(this._lightingUpdateHandle=null)};if(i<=0)this._lightingUpdateHandle=s=d(l);else{const t=setTimeout(l,i);this._lightingUpdateHandle=s=n(()=>clearTimeout(t))}}_cancelLightingUpdate(){this._lightingUpdateHandle=a(this._lightingUpdateHandle)}_play(){const t=this._lighting;if(null==t||!this.sunLightingEnabled||"virtual"===t.type)return;const e=t.date;if(this.dayPlaying||this.yearPlaying){const i=Date.now()-(this._lastTime??0);if(this.dayPlaying){this._lastTime=Date.now();const n=P(this._sunrise,this._sunset,e)*this.playSpeedMultiplier/100*i;if(n>0){let i=new Date(e.getTime()+n);const s=t.displayUTCOffset??0;if(((i.getUTCHours()+s)%24+24)%24<((e.getUTCHours()+s)%24+24)%24){const t=864e5;i=new Date(e.getTime()+n-t)}t.date=i}}else{if(i>1e3){this._lastTime=Date.now();const i=(e.getUTCMonth()+1)%12,n=new Date(e);n.setUTCMonth(i),t.date=n}}requestAnimationFrame(()=>this._play())}}_updateSunriseAndSunset(){const t=this._lighting;if(null==t||"virtual"===t.type||!this.sunLightingEnabled)return;const e=this.view?.camera?.position;if(null==e)return;const{latitude:i,longitude:n}=e,{date:s,displayUTCOffset:a}=t,l=O(s,i,n,a??0);l&&(this._sunrise=new Date(l.sunrise),this._sunset=new Date(l.sunset))}_onUserDateTimeChange(){this.emit("user-date-time-change",{})}};t([m()],E.prototype,"view",void 0),t([m({type:b,nonNullable:!0})],E.prototype,"timeSliderViewModel",void 0),t([m()],E.prototype,"isSupported",null),t([m()],E.prototype,"lightingUpdateInterval",void 0),t([m()],E.prototype,"utcOffset",null),t([m({type:Date})],E.prototype,"localDate",null),t([m()],E.prototype,"timeSliderPosition",null),t([m()],E.prototype,"directShadowsEnabled",null),t([m()],E.prototype,"sunLightingEnabled",null),t([m({type:["none","day","year"],value:"none"})],E.prototype,"playingState",null),t([m()],E.prototype,"dayPlaying",null),t([m()],E.prototype,"yearPlaying",null),t([m()],E.prototype,"playSpeedMultiplier",void 0),t([m()],E.prototype,"currentSeason",null),t([m()],E.prototype,"_lastTime",void 0),t([m()],E.prototype,"_sunrise",void 0),t([m()],E.prototype,"_sunset",void 0),t([m()],E.prototype,"_cachedLightingDateUTC",void 0),t([m()],E.prototype,"_cachedDisplayUTCOffset",void 0),t([m()],E.prototype,"_currentHemisphere",null),t([m()],E.prototype,"_environment",null),t([m()],E.prototype,"_lighting",null),t([m()],E.prototype,"_lightingType",null),t([m()],E.prototype,"_lightingDateDisplay",null),E=t([_("esri.widgets.Daylight.DaylightViewModel")],E);const M=E;export{M as default};
2
+ import{__decorate as t}from"tslib";import{deprecateUnnecessaryViewModel as e}from"../../core/deprecate.js";import{EventedAccessor as i}from"../../core/Evented.js";import{makeHandle as n}from"../../core/handleUtils.js";import s from"../../core/Logger.js";import{removeMaybe as a}from"../../core/maybe.js";import{when as l,initial as r,watch as o,on as h,syncAndInitial as g}from"../../core/reactiveUtils.js";import{schedule as d}from"../../core/scheduling.js";import{truncateLocalTime as p,isValidDate as u,resetUTCDate as c,offsetDate as y}from"../../core/timeUtils.js";import{property as m,subclass as _}from"../../core/accessorSupport/decorators.js";import f from"../../views/3d/environment/SunLighting.js";import D from"../../views/3d/environment/VirtualLighting.js";import{positionToTimezoneInfo as w}from"../../views/3d/support/earthUtils.js";import{dateTimeToSliderPos as U,sliderPosToDateTime as S,getSeasonFromDate as T,getNorthernHemisphereSeason as v,getSeasonDate as L,calculatePlaySpeed as P}from"./support/daylightUtils.js";import{SliderWithDropdownViewModel as b}from"./support/SliderWithDropdownViewModel.js";import{formatSliderLabel as C,getSunriseAndSunsetTimes as O}from"../support/timeWidgetUtils.js";let E=class extends i{constructor(t){super(t),this.view=null,this.timeSliderViewModel=new b({suppressDeprecationWarning:!0,min:0,max:1439,values:[0],labelFormatFunction:C,inputFormatFunction:C}),this.lightingUpdateInterval=200,this._oldLighting=null,this.playSpeedMultiplier=1,this._lastTime=null,this._sunrise=null,this._sunset=null,this._cachedLightingDateUTC=new Date(0),this._cachedDisplayUTCOffset=0,this._lastLightingUpdate=0,this._lightingUpdateHandle=null,t?.suppressDeprecationWarning||e(s.getLogger(this),"Daylight","arcgis-daylight",{version:"4.34"})}normalizeCtorArgs(t={}){const{suppressDeprecationWarning:e,...i}=t;return i}initialize(){this.addHandles([l(()=>this.view,t=>t.when(()=>this._updateLighting()),r),o(()=>{const t=this._lighting;return"sun"===t?.type?t.date:null},t=>this._scheduleLightingUpdate(t)),h(()=>this._lighting,"timezone-will-change",t=>this._timezoneWillChange(t),{onListenerAdd:()=>this._timezoneWillChange(null)}),o(()=>!0===this.view?.stationary,()=>{(this.dayPlaying||this.yearPlaying)&&this._updateSunriseAndSunset()},r),o(()=>{const t=this.timeSliderViewModel;return{vm:t,state:t.state,sliderPosition:this.timeSliderPosition}},({vm:t,state:e,sliderPosition:i})=>{"ready"===e&&t.setValue(0,i)}),o(()=>this.timeSliderViewModel?.utcOffset,t=>{null!=t&&(this.utcOffset=t)}),o(()=>({utcOffset:this.utcOffset,sliderViewModel:this.timeSliderViewModel}),({utcOffset:t,sliderViewModel:e})=>{e&&(e.utcOffset=t)},g),o(()=>this.timeSliderViewModel.timezonePickerOpen,()=>this.stopPlaying()),o(()=>this.timeSliderViewModel.values,t=>this._setTimeSliderPosition(t?.[0]??0,{forceLightingUpdate:!1}))])}destroy(){this._cancelLightingUpdate(),this.view=null}get isSupported(){return null==this.view||"3d"===this.view.type}get utcOffset(){return this._cachedDisplayUTCOffset}set utcOffset(t){t!==this.utcOffset&&null!=this._lighting&&"virtual"!==this._lighting.type&&(this._lighting.displayUTCOffset=t,this._updateLighting())}get localDate(){return p(this._lightingDateDisplay)}set localDate(t){this.view?.ready?u(t)&&t.getTime()!==this.localDate.getTime()&&(this._lightingDateDisplay=c(this._lightingDateDisplay,t)):s.getLogger(this).error("The localDate property cannot be set before the view and the widget are ready.")}get timeSliderPosition(){return U(this._lightingDateDisplay)}set timeSliderPosition(t){this.view?.ready&&"ready"===this.timeSliderViewModel?.state?this._setTimeSliderPosition(t,{forceLightingUpdate:!0}):s.getLogger(this).error("The timeSliderPosition property cannot be set before the view and the widget are ready.")}_setTimeSliderPosition(t,e){Math.abs(t-this.timeSliderPosition)<=1/60||(this.stopPlaying(),this._onUserDateTimeChange(),e.forceLightingUpdate&&(this._cancelLightingUpdate(),this._updateLighting()),this._lightingDateDisplay=S(this._lightingDateDisplay,t))}_timezoneFromCamera(t,e){if(null==e||!t.cameraTrackingEnabled)return 0;const i=w([e.longitude,e.latitude]);return null==i?0:Math.round(i.hours+i.minutes/60+i.seconds/3600)}get directShadowsEnabled(){return this._lighting?.directShadowsEnabled??!1}set directShadowsEnabled(t){const e=this._lighting;e&&(e.directShadowsEnabled=t)}get sunLightingEnabled(){return"sun"===this._lightingType}set sunLightingEnabled(t){const e=this._environment;if(t===this._get("sunLightingEnabled")||null==e)return;const i=e.lighting,n=this._oldLighting;this._oldLighting=i;const s={directShadowsEnabled:i.directShadowsEnabled,cameraTrackingEnabled:i.cameraTrackingEnabled},a=t?"sun":"virtual";let l;l=null!=n&&n.type===a?n:t?new f:new D,l.set(s),e.lighting=l,t||(this.stopPlaying(),this.timeSliderViewModel.timezonePickerOpen=!1)}set playingState(t){this.playingState!==t&&(this._set("playingState",t),"none"!==t&&this.sunLightingEnabled&&(this._updateSunriseAndSunset(),this._lastTime=Date.now(),this._play(),this._onUserDateTimeChange()))}get dayPlaying(){return"day"===this.playingState}set dayPlaying(t){t?this.playingState="day":this.dayPlaying&&(this.playingState="none")}get yearPlaying(){return"year"===this.playingState}set yearPlaying(t){t?this.playingState="year":this.yearPlaying&&(this.playingState="none")}get currentSeason(){return T(this.localDate,this._currentHemisphere)}set currentSeason(t){this.stopPlaying(),this._onUserDateTimeChange();const e=v(t,this._currentHemisphere);this.localDate=L(this.localDate,e,0)}get _currentHemisphere(){const t=this.view?.camera?.position?.latitude;return null==t||t>=0?0:1}get _environment(){return this.view?.environment}get _lighting(){return this._environment?.lighting}get _lightingType(){return this._lighting?.type}get _lightingDateDisplay(){return y(this._cachedLightingDateUTC,this._cachedDisplayUTCOffset,"hours")}set _lightingDateDisplay(t){const e=this._lighting;if(null==e||!this.sunLightingEnabled||"virtual"===e.type||!u(t))return;const i=e.date,n=y(t,-this._cachedDisplayUTCOffset,"hours");n.getTime()!==i.getTime()&&(e.date=n,this._updateLighting())}stopPlaying(){this.playingState="none"}toggleDayPlaying(){this.dayPlaying=!this.dayPlaying}toggleYearPlaying(){this.yearPlaying=!this.yearPlaying}toggleSunLightingEnabled(){this.stopPlaying(),this.sunLightingEnabled=!this.sunLightingEnabled}toggleDirectShadowsEnabled(){this.stopPlaying(),this.directShadowsEnabled=!this.directShadowsEnabled}onDateChange(t){this.dayPlaying=!1,this.localDate=t,this._onUserDateTimeChange()}_updateLighting(t){const e=Date.now();this._lastLightingUpdate=e;const{view:i}=this,n=this._lighting;if(null==i||null==n||"virtual"===n.type)return;t??=n.date;const s=n.displayUTCOffset,a=null!=s?s:this._timezoneFromCamera(n,i.camera?.position);this._cachedLightingDateUTC.getTime()!==t.getTime()&&(this._cachedLightingDateUTC=new Date(t)),this._cachedDisplayUTCOffset!==a&&(this._cachedDisplayUTCOffset=a)}_timezoneWillChange(t){const e=this._lighting;if(null==e||"virtual"===e.type||!e.cameraTrackingEnabled)return;let i;if(t)i=t.timezoneOffset;else{if(null!=e.displayUTCOffset)return;i=f.calculateTimezoneOffset(e.positionTimezoneInfo)}e.displayUTCOffset=i,this._scheduleLightingUpdate()}_scheduleLightingUpdate(t){if(t&&(this._lightingUpdateHandle=a(this._lightingUpdateHandle),!u(t)))return;if(this._lightingUpdateHandle)return;const e=Date.now()-this._lastLightingUpdate,i=this.lightingUpdateInterval-e;let s=null;const l=()=>{this._updateLighting(t),this._lightingUpdateHandle===s&&(this._lightingUpdateHandle=null)};if(i<=0)this._lightingUpdateHandle=s=d(l);else{const t=setTimeout(l,i);this._lightingUpdateHandle=s=n(()=>clearTimeout(t))}}_cancelLightingUpdate(){this._lightingUpdateHandle=a(this._lightingUpdateHandle)}_play(){const t=this._lighting;if(null==t||!this.sunLightingEnabled||"virtual"===t.type)return;const e=t.date;if(this.dayPlaying||this.yearPlaying){const i=Date.now()-(this._lastTime??0);if(this.dayPlaying){this._lastTime=Date.now();const n=P(this._sunrise,this._sunset,e)*this.playSpeedMultiplier/100*i;if(n>0){let i=new Date(e.getTime()+n);const s=t.displayUTCOffset??0;if(((i.getUTCHours()+s)%24+24)%24<((e.getUTCHours()+s)%24+24)%24){const t=864e5;i=new Date(e.getTime()+n-t)}t.date=i}}else{if(i>1e3){this._lastTime=Date.now();const i=(e.getUTCMonth()+1)%12,n=new Date(e);n.setUTCMonth(i),t.date=n}}requestAnimationFrame(()=>this._play())}}_updateSunriseAndSunset(){const t=this._lighting;if(null==t||"virtual"===t.type||!this.sunLightingEnabled)return;const e=this.view?.camera?.position;if(null==e)return;const{latitude:i,longitude:n}=e,{date:s,displayUTCOffset:a}=t,l=O(s,i,n,a??0);l&&(this._sunrise=new Date(l.sunrise),this._sunset=new Date(l.sunset))}_onUserDateTimeChange(){this.emit("user-date-time-change",{})}};t([m()],E.prototype,"view",void 0),t([m({type:b,nonNullable:!0})],E.prototype,"timeSliderViewModel",void 0),t([m()],E.prototype,"isSupported",null),t([m()],E.prototype,"lightingUpdateInterval",void 0),t([m()],E.prototype,"utcOffset",null),t([m({type:Date})],E.prototype,"localDate",null),t([m()],E.prototype,"timeSliderPosition",null),t([m()],E.prototype,"directShadowsEnabled",null),t([m()],E.prototype,"sunLightingEnabled",null),t([m({type:["none","day","year"],value:"none"})],E.prototype,"playingState",null),t([m()],E.prototype,"dayPlaying",null),t([m()],E.prototype,"yearPlaying",null),t([m()],E.prototype,"playSpeedMultiplier",void 0),t([m()],E.prototype,"currentSeason",null),t([m()],E.prototype,"_lastTime",void 0),t([m()],E.prototype,"_sunrise",void 0),t([m()],E.prototype,"_sunset",void 0),t([m()],E.prototype,"_cachedLightingDateUTC",void 0),t([m()],E.prototype,"_cachedDisplayUTCOffset",void 0),t([m()],E.prototype,"_currentHemisphere",null),t([m()],E.prototype,"_environment",null),t([m()],E.prototype,"_lighting",null),t([m()],E.prototype,"_lightingType",null),t([m()],E.prototype,"_lightingDateDisplay",null),E=t([_("esri.widgets.Daylight.DaylightViewModel")],E);const M=E;export{M 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{property as o,subclass as t}from"../../../core/accessorSupport/decorators.js";import i from"../../Slider.js";import{SliderWithDropdownViewModel as s}from"./SliderWithDropdownViewModel.js";import{TimezonePicker as r}from"../../support/TimezonePicker.js";import{tsx as n}from"../../support/widget.js";import{onResize as l}from"../../support/widgetUtils.js";const p="esri-slider-with-dropdown",d={label:"esri-slider__label",box:`${p}__box`,boxDropDownOn:`${p}__box--drop-down-on`,boxDropDownOff:`${p}__box--drop-down-off`};let h=class extends i{constructor(e,o){super({...e,suppressDeprecationWarning:!0},o),this.viewModel=new s,this.showDropDown=!0,this._labelWidth=0,this._onLabelAfterCreate=e=>{const o="label-size-observer";this.removeHandles(o),this.addHandles(l(e,({contentRect:e})=>{this._labelWidth=e.width}),o)},this._getLabelStyles=()=>{if(!this.trackElement)return;const e=this._trackWidth,o=this._labelWidth/2,t=this.getCurrentPosition(),i=t-o,s=t+o;let r=-o;return i<0?r+=-i:s>e&&(r+=e-s),{left:`${r}px`}},this._onTimezoneChange=e=>{this.viewModel.utcOffset=e},this._onTimezonePickerOpen=()=>{this.viewModel.timezonePickerOpen=!0},this._onTimezonePickerClose=()=>{this.viewModel.timezonePickerOpen=!1}}renderThumbLabel(e){const{showDropDown:o,viewModel:t}=this;return n("div",{afterCreate:this._onLabelAfterCreate,class:this.classes({[d.box]:!0,[d.label]:!0,[d.boxDropDownOn]:o,[d.boxDropDownOff]:!o}),key:"thumb-label",styles:this._getLabelStyles()},super.renderThumbLabel(e),o?n(r,{disabled:this.disabled,open:t.timezonePickerOpen,value:t.utcOffset,onChange:this._onTimezoneChange,onClose:this._onTimezonePickerClose,onOpen:this._onTimezonePickerOpen}):null)}};e([o()],h.prototype,"viewModel",void 0),e([o()],h.prototype,"showDropDown",void 0),e([o()],h.prototype,"_labelWidth",void 0),h=e([t("esri.widgets.Daylight.support.SliderWithDropdown")],h);const a=h;export{a as default};
2
+ import{__decorate as e}from"tslib";import{property as o,subclass as t}from"../../../core/accessorSupport/decorators.js";import i from"../../Slider.js";import{SliderWithDropdownViewModel as s}from"./SliderWithDropdownViewModel.js";import{TimezonePicker as r}from"../../support/TimezonePicker.js";import{tsx as n}from"../../support/widget.js";import{onResize as l}from"../../support/widgetUtils.js";const p="esri-slider-with-dropdown",d={label:"esri-slider__label",box:`${p}__box`,boxDropDownOn:`${p}__box--drop-down-on`,boxDropDownOff:`${p}__box--drop-down-off`};let h=class extends i{constructor(e,o){super({...e,suppressDeprecationWarning:!0},o),this.viewModel=new s({suppressDeprecationWarning:!0}),this.showDropDown=!0,this._labelWidth=0,this._onLabelAfterCreate=e=>{const o="label-size-observer";this.removeHandles(o),this.addHandles(l(e,({contentRect:e})=>{this._labelWidth=e.width}),o)},this._getLabelStyles=()=>{if(!this.trackElement)return;const e=this._trackWidth,o=this._labelWidth/2,t=this.getCurrentPosition(),i=t-o,s=t+o;let r=-o;return i<0?r+=-i:s>e&&(r+=e-s),{left:`${r}px`}},this._onTimezoneChange=e=>{this.viewModel.utcOffset=e},this._onTimezonePickerOpen=()=>{this.viewModel.timezonePickerOpen=!0},this._onTimezonePickerClose=()=>{this.viewModel.timezonePickerOpen=!1}}renderThumbLabel(e){const{showDropDown:o,viewModel:t}=this;return n("div",{afterCreate:this._onLabelAfterCreate,class:this.classes({[d.box]:!0,[d.label]:!0,[d.boxDropDownOn]:o,[d.boxDropDownOff]:!o}),key:"thumb-label",styles:this._getLabelStyles()},super.renderThumbLabel(e),o?n(r,{disabled:this.disabled,open:t.timezonePickerOpen,value:t.utcOffset,onChange:this._onTimezoneChange,onClose:this._onTimezonePickerClose,onOpen:this._onTimezonePickerOpen}):null)}};e([o()],h.prototype,"viewModel",void 0),e([o()],h.prototype,"showDropDown",void 0),e([o()],h.prototype,"_labelWidth",void 0),h=e([t("esri.widgets.Daylight.support.SliderWithDropdown")],h);const a=h;export{a 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 t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as i,handlesGroup as r,abortHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import o from"../../core/Logger.js";import{removeMaybe as n,destroyMaybe as l}from"../../core/maybe.js";import{isPromiseLike as d,debounce as c}from"../../core/promiseUtils.js";import{watch as u,when as p,initial as h,sync as m,whenOnce as f,syncAndInitial as g}from"../../core/reactiveUtils.js";import{generateBracedUUID as w}from"../../core/uuid.js";import{property as y,subclass as v}from"../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as _,isSharedTemplate as F,getCreationAttributes as b,isStandardFeatureTemplate as M}from"../../editing/templateUtils.js";import{getFullTemplate as I}from"../../editing/sharedTemplates/templateLoader.js";import V from"../../layers/GraphicsLayer.js";import{isSceneLayer as k,isTable as S}from"../../layers/support/layerUtils.js";import{isNumber as C}from"../../support/guards.js";import{getDisplayedSymbol as T}from"../../symbols/support/symbolUtils.js";import{updateGraphicSymbolWhenRequired as A}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as P}from"../../views/draw/support/helpMessageUtils.js";import E from"../../views/draw/support/HighlightHelper.js";import U from"../../views/interactive/sketch/SketchOptions.js";import H from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as L}from"../../views/support/HighlightDefaults.js";import O from"./CreateFeaturesWorkflowData.js";import{isModelUpload as j,handleModelUpload as x}from"./modelUploadUtils.js";import D from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as z,createToolFromGeometryType as R,containsUnsupportedCurve as W,findEditorItemForLayer as G,getServiceEditsFromWorkflowData as N,getServiceInfoForLayer as K,orderEditsByRelationshipDependencies as Z,getServiceLayersById as q,startCreatingNewFeature as B,syncUpdateOptions as J,findLayerInfo as Q,isTerminalUpdateEventType as X,getVisualVariableAttributes as Y,startUpdatingFeatureGeometry as $,createWorkflowSteps as ee,avoidFeatureTemplateSelectionWithOnlyOneItem as te,setUpSketchCreateWatchers as ae,setRelationshipFields as ie,prepareAttachmentsForCreateFeaturesWorkflow as re,showProgressCursor as se,setVisualVariablesAndElevationInfoForUpdate as oe,visualVariableInteractiveUpdate as ne}from"./workflowUtils.js";import le from"../FeatureForm/FeatureFormViewModel.js";import de from"../Sketch/SketchViewModel.js";var ce;const ue=Symbol(),pe=Symbol(),he=Symbol(),me=Symbol(),fe={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let ge=ce=class extends D{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._webStyleCache=new Map,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._formViewModel=new le,this._sketchLayer=null,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get allowSave(){return!this.updating}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;const{creationInfo:e,upload:t}=this.data,{activeComponent:a,createGraphic:i}=this._sketchViewModel,r=i?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==a?.type&&"draw-3d"!==a?.type)&&a.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get hasPreviousStep(){return this._stepIndex>0||"update-pending"===this.createFeatureState&&!!this.data.selectedPendingFeature&&!this.parent&&!j(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const{_sketchViewModel:a}=this,{drawTool:i,isUsingLegacyCreateTools:r}=a;if(!r)return i?.helpMessageKey??"noTool";const s=e.layer.geometryType,o=a.createGraphic;if("mesh"===s){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(o,e):void 0}const{activeCreateToolDrawMode:n,activeTool:l}=a;return P("rectangle"===l||"circle"===l?l:s,o?.geometry,n)}get noticeMessage(){if(z(this._sketchViewModel,this.data.editorItem))return"curveToolDensifyWarning"}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter(e=>this.data.isDisplayable(e)).length}get parent(){return this.data.parent}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get saveActionLabel(){return"create"}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchUpdateOptions(){const{editorItem:e}=this.data;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!k(e?.layer)&&!!e?.capabilities.supportsTrueCurve}}}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){const e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e)return[];if(this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(_(this.data.fullTemplate)){const{tool:t}=R(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...fe[e]]}get _attachmentsActive(){const e=this.data.viewModel.attachmentsViewModel.mode,t=this.stepId;return this.shouldShowAttachments&&("add"===e||"edit"===e||"adding-attachment"===t||"editing-attachment"===t)}getUpdating(){return!!this._sketchViewModel?.updating}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([he])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),S(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(e){const{formViewModel:t}=this;if(t.pendingSubtypeChoice)return;t.submit(),this._stashValidationState();const a=this.data.selectedPendingFeature,i=this._hasValidationErrors(a)?a:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));if(i)return await this._startUpdating({feature:i}),void t?.submit();const{pendingFeatures:r,editorItem:s}=this.data;if(s&&e&&W(r.toArray(),s)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.save()}back(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||j(this.data.creationInfo)||this._attachmentsActive||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||j(this.data.creationInfo)||this._attachmentsActive?super.previous(e):this._clearSelectedFeature()}cancelFeature(e){this.data.isSharedTemplateWorkflow?o.getLogger(this).warn("Cannot cancel individual features created by shared templates."):(this.data.removePendingFeature(e),this.sketchViewModel.removeGraphic(e))}static create(e){const{addAttachmentsCallback:t,applyEdits:a,applyEditsFeatureService:i,isNested:r,creationInfo:s,parent:o,snappingManager:n,startAt:l,viewModel:d}=e,c=e.sketchOptions??new U,u=s?.layer,p=u?G(d.editorItems,u):void 0,h=new ce({data:new O({creationInfo:s,editorItem:p,parent:o,sketchOptions:c,snappingManager:n,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;h._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:o}=r,n=o.capabilities?.editing.supportsGlobalId&&"globalIdField"in o,l=h._attachmentFileInfos,{fullTemplate:c}=e,u=N(h.data),p=F(c)&&u;if(n){if(_e(s),p){let t=be(u,l);const a=await(K(o,d.view)?.load());a&&(t=Z({edits:t,serviceInfo:a,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await i(c.featureService,t,{globalIdUsed:!0,honorSequenceOfEdits:!0,gdbVersion:c.layer.gdbVersion??void 0})}else{const e=Fe(s,l);await a(o,e,{globalIdUsed:!0})}return}const m=p?await i(c.featureService,u,{gdbVersion:c.layer.gdbVersion??void 0}):[await a(o,{addFeatures:s})];m&&l.size>0&&await Promise.all(m.map(e=>{if(e?.addFeatureResults)return t(o,ve(s,e.addFeatureResults,o,l))}))}});return h._set("steps",this._createWorkflowSteps(h,l)),h}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",i(()=>e.effect=t)}const t=e.opacity;return e.opacity=.7,i(()=>e.opacity=t)}async _initializeFullTemplateAndExecutorInfo(e){const{creationInfo:t}=e,{view:a}=e.viewModel;if(!t||!a)return null;const i=await I(a,t.template);if(e.fullTemplate=i,i&&F(i)){const{createTemplateExecutor:r}=await import("../../editing/sharedTemplates/executor/createTemplateExecutor.js"),s={completionResults:[],executor:await r(i),serviceLayersById:q(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(pe);const{data:e}=this;if(!e.creationInfo)return;const t=this.data.creationInfo?.maxFeatures;if(t&&this.numPendingFeatures>=t)return this.sketchViewModel.cancel(),void(this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)}));this.createFeatureState="create-new",await B(this._sketchViewModel,this._sketchLayer,e,this._webStyleCache)}async _clearSelectedFeature(){const e=this._formViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=n(this._featureFormHandle),this._formViewModel.feature=null;const t=this.data.viewModel.attachmentsViewModel;"add"!==t.mode&&"edit"!==t.mode||await(this.data.viewModel.activeWorkflow?.previous())}_stashValidationState(){const e=this._formViewModel.feature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._formViewModel.submittable)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();const{data:a,pendingFeatures:i,_webStyleCache:s}=this;i.includes(e)||a.addPendingFeature(e,t),a.selectedPendingFeature=e;const{_formViewModel:o,_sketchViewModel:l,sketchUpdateOptions:d}=this,{creationInfo:c,viewModel:p}=a,{attachmentsViewModel:h,layerInfos:m,view:f}=p;if(!f||!c)return;J(l,d),n(this._featureFormHandle);const g=e.sourceLayer,w=Q(m,g),y=w?.formTemplate,v=f.spatialReference;o.set({editType:"INSERT",feature:e,formTemplate:y,spatialReference:v,map:f.map}),"add"!==h.mode&&"edit"!==h.mode||await(p.activeWorkflow?.previous()),h.graphic=e,h.fileInfos.removeAll(),h.mode="view";(this._attachmentFileInfos.get(e)||[]).forEach(({file:e,form:t})=>h.addFile(e,t)),await A(e,s,"2d"===f.type?f.scale:null);const _=a.getEditsForPendingFeature(e);this._featureFormHandle=r([o.on("value-change",async({fieldName:t,value:a})=>{if(_?.updateAttributes(o.getValues()),C(a)){const e=this._visualVariableAttributes;e.size&&!e.size.isUpdatingInteractively&&t===e.size.field&&e.size.setInitialValue(a),e.rotation&&!e.rotation.isUpdatingInteractively&&t===e.rotation.field&&e.rotation.setInitialValue(a)}await A(e,s,"2d"===f.type?f.scale:null)}),l.on(["update","undo","redo"],e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&X(e.toolEventInfo.type))&&o.notifyFeatureGeometryChanged()}),u(()=>o.feature?.sourceLayer,t=>e.sourceLayer=t),u(()=>[o.feature,o.submittable],()=>this._stashValidationState())]),this.createFeatureState="update-pending"}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});const{_sketchLayer:a,_sketchViewModel:i,data:r}=this,{creationInfo:s,viewModel:o}=r,{view:n}=o;if(!n||!s)return;const l=e.sourceLayer??s.layer;return S(l)?void 0:(this._visualVariableAttributes=Y(e),$({graphic:e,sketchLayer:a,sketchViewModel:i,sourceLayer:l,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes,webStyleCache:this._webStyleCache}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=ee(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(j(t)?e.addHandles(await x({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(t.layer),this.id),e.addHandles(i.featureTemplatesViewModel.on("select",({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())}),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){const{viewModel:i}=a;t.canceled&&(e.removeHandles([he,ue,pe,me]),i.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear())}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}})});return te(a,i)}static _configureSketchViewModel(e){const{data:t,_sketchLayer:a,_sketchViewModel:s,_webStyleCache:o}=e,{creationInfo:n,viewModel:l}=t,{view:d}=l,h=[];if(!d)return i();if("2d"===d.type){n&&h.push(e._fadeExistingFeatures(n.layer));const t=c((e,t)=>Promise.all(e.map(e=>A(e,o,t))));h.push(u(()=>d.scale,e=>t(a.graphics,e)))}const m=b(t.fullTemplate,n?.attributeOverrides,n?.layer),f=u(()=>s.createGraphic&&s.activeComponent,()=>{s.createGraphic&&s.activeComponent&&!e.hasHandles(pe)&&e._updatingHandles.consumePromise(ae({creationAttributes:m,data:t,sketchViewModel:s,view:d,webStyleCache:o}).then(t=>e.addHandles(t,pe)))}),g=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(pe),"cancel"===t.state&&null!==d.activeTool&&d.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===d.type?d.scale:null,useSourceLayer:!0,webStyleCache:e._webStyleCache});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},w=async i=>{const{attachmentsViewModel:r}=l,{_formViewModel:o}=e;if(i.graphics.length>1)return void await e._clearSelectedFeature();const c=i.graphics[0];if("complete"===i.state){const{submittable:t}=o;if(e.numPendingFeatures!==n?.maxFeatures&&t||o.submit(),await e._clearSelectedFeature(),"add"!==r.mode&&"edit"!==r.mode||await(l.activeWorkflow?.previous()),!i.aborted&&d.activeTool===e.sketchViewModel.activeComponent&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===i.state)return c.sourceLayer??=t.creationInfo?.layer,await oe({graphic:c,sketchLayer:a,sketchViewModel:s,visualVariables:e._visualVariableAttributes,webStyleCache:e._webStyleCache,sourceLayer:c.sourceLayer}),e._selectFeatureForUpdate({feature:c});if("active"===i.state){await e.updatePendingFeature(c);const t=e._visualVariableAttributes;ne(d,c,i,t)&&await A(c,e._webStyleCache,"2d"===d.type?d.scale:null);const a=c.attributes,{rotation:r,size:s}=t;if(null!=r){const{field:e}=r;o.setValue(e,a[e])}if(null!=s){const{field:e}=s;o.setValue(e,a[e])}}}},y=async a=>{if(a.graphics.forEach(e=>{t.removePendingFeature(e)}),!j(t.creationInfo))return e._startCreating()},v=async()=>{if(j(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};h.push(f,s.on("create",t=>e._updatingHandles.addPromise(g(t))),s.on("update",t=>e._updatingHandles.addPromise(w(t))),s.on("delete",t=>e._updatingHandles.addPromise(y(t))),p(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(v())),i(()=>{s.cancel()}),we(s,a,t),...ye(t));const _=r(h);return s.addHandles(_),_}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new V({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),r=new de({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:t});this._sketchLayer=a,this._sketchViewModel=r,t?.map.add(a),this.addHandles([i(()=>{t?.destroyed||t?.map.remove(a),l(a)}),u(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,h),u(()=>this.sketchUpdateOptions,e=>{r.defaultUpdateOptions=e,J(r,e)},m)])}_hasValidationErrors(e){return!!e&&(!this.data.isSubmittable(e)||!!this._formViewModel.validateContingencyConstraints(e.attributes,{includeIncompleteViolations:!0})?.length)}async _processEdits(e,t){const{data:a,_formViewModel:i,_sketchLayer:r}=this,{layerInfos:s,view:o}=a.viewModel;i.editType="INSERT",i.map=o?.map,i.spatialReference=o?.spatialReference;const{templateExecutorInfo:n}=a;if(!n){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}r.remove(e);const{executor:l}=n,c=l(e.geometry,"completion"),u=d(c)?await c:c;n.completionResults.push(u),ie(u.relationships),i.editType="INSERT",i.map=o?.map,i.spatialReference=o?.spatialReference,u.primary&&a.creationInfo?.attributeOverrides&&(u.primary.graphic.attributes={...u.primary.graphic.attributes,...a.creationInfo.attributeOverrides});for(const d of u.edits){let e=null;if(d.addFeatures)for(const a of d.addFeatures){const i=a.clone();i.geometry=null,null!=a.geometry&&(a.symbol=await T(a,t),r.add(a)),a.sourceLayer!==e?.layer&&(e=Q(s,a.sourceLayer));const o=!!u.associationGraphics?.has(a);await this._addAndInitializeEdits(a,i,e,o)}}i.feature=null,await f(()=>!i.updating);return u.edits.reduce((e,t)=>e+(t.addFeatures?.length??0),0)>1?null:u.primary?.graphic}async _addAndInitializeEdits(e,t,a,i=!1){const{data:r,_formViewModel:s}=this,{layerInfos:o}=r.viewModel,n=r.addPendingFeature(e,t,{isAssociation:i});a??=Q(o,e.sourceLayer),s.feature=e,s.formTemplate=a?.formTemplate,await f(()=>!s.updating),n.updateAttributes(s.getValues()),n.submittable=s.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(he))return;const{data:e,sketchViewModel:s}=this,{creationInfo:o,viewModel:l}=e,{attachmentsViewModel:d,view:c}=l;if(!c||!o?.layer)throw new a("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");const{initialFeature:p,layer:m}=o,f=[],g=[];this._featureFormHandle=n(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=G(l.editorItems,o.layer),o.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),g.push(i(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),s.allowDeleteKey=!e.isSharedTemplateWorkflow,re(d),f.push(u(()=>d.mode,e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}}));const w=se(c);f.push(w);const y=S(o.layer),{template:v}=o,F=!v||M(v)||_(v)&&"feature"===v.type,I=y&&F;try{if(I){const a=p??new t({attributes:b(e.fullTemplate,o.attributeOverrides,m),sourceLayer:m}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else f.push(ce._configureSketchViewModel(this)),p?(j(o)&&o.geometryToPlace&&(p.attributes=b(e.fullTemplate,o.attributeOverrides,m)),s.addGraphic(p),await this._startUpdating({feature:p})):await this._startCreating()}finally{w.remove()}const V=i(()=>{for(const t of e.pendingFeatures)s.removeGraphic(t),e.removePendingFeature(t)}),k=u(()=>c?.timeZone,e=>{this._formViewModel.timeZone=e,this.data.timeZone=e},h),C=i(()=>{j(o)&&l.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&f.push(this._featureFormHandle),this.addHandles(f,this._handleKeys.beforeCommit),this.addHandles(g,this._handleKeys.afterCommit),this.addHandles([i(()=>d.fileInfos.removeAll()),r(f),r(g),C,V,k],he)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(s(t),me),await f(()=>null==e?.activeTool,t.signal),t.abort()}};function we(e,t,a){let s=null;const o=()=>e.snappingOptions.featureSources,n=()=>(s=new H({layer:t}),o().add(s),s),d=()=>{null!=s&&(o().remove(s),s=l(s))};return r([u(()=>{const e=a.creationInfo?.layer,t=o().find(t=>t.layer===e);return{hasFeatureLayerSource:!!t,enabled:t?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return d();s??=n(),s.enabled=t},g),i(d)])}function ye(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const r=new E({view:t});a.push(u(()=>e.selectedPendingFeature,(e,t)=>{r.remove(e),r.add(t)}),i(()=>r.destroy()))}const r=new E({view:t,highlightName:L});return a.push(u(()=>e.temporaryHighlightFeature,e=>{r.removeAll(),r.add(e)}),i(()=>r.destroy())),a}function ve(e,t,a,i){const r=[];return t.forEach((t,s)=>{if(!t.error){const o=e[s],n=i.get(o)||[];o.attributes[a.objectIdField]=t.objectId,n.forEach(({form:e})=>r.push({feature:o,attachment:e}))}}),r}function _e(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=w())}}function Fe(e,t){const a=[];if(!t||0===t.size)return{addFeatures:e};for(const[i,r]of t)for(const{file:e}of r)a.push({feature:i,attachment:{globalId:w(),data:e}});return a.length?{addFeatures:e,addAttachments:a}:{addFeatures:e}}function be(e,t){return e.map(e=>{const{addFeatures:a}=e;if(!a||0===a.length)return e;const i=[];for(const r of a){const e=t.get(r);if(e)for(const{file:t}of e)i.push({feature:r,attachment:{globalId:w(),data:t}})}return i.length?{...e,addAttachments:i}:e})}e([y()],ge.prototype,"allowSave",null),e([y()],ge.prototype,"createFeatureState",void 0),e([y()],ge.prototype,"curveResizeDisabled",null),e([y()],ge.prototype,"curveUpdatesDisabled",null),e([y()],ge.prototype,"data",void 0),e([y({constructOnly:!0})],ge.prototype,"isNested",void 0),e([y()],ge.prototype,"formViewModel",null),e([y()],ge.prototype,"hasInvalidFormTemplate",null),e([y()],ge.prototype,"hasPendingEdits",null),e([y()],ge.prototype,"hasPreviousStep",null),e([y()],ge.prototype,"_getDrawMeshHelpMessage",void 0),e([y()],ge.prototype,"helpMessage",null),e([y()],ge.prototype,"noticeMessage",null),e([y()],ge.prototype,"layer",null),e([y()],ge.prototype,"parent",null),e([y()],ge.prototype,"keyboardCancellationEnabled",null),e([y()],ge.prototype,"reliesOnOwnerAdminPrivileges",null),e([y()],ge.prototype,"saveActionLabel",null),e([y()],ge.prototype,"shouldShowAttachments",null),e([y()],ge.prototype,"shouldAllowAttachmentEditing",null),e([y()],ge.prototype,"sketchUpdateOptions",null),e([y()],ge.prototype,"sketchViewModel",null),e([y()],ge.prototype,"availableCreateTools",null),e([y()],ge.prototype,"_attachmentsActive",null),ge=ce=e([v("esri.widgets.Editor.CreateFeaturesWorkflow")],ge);const Me=ge;export{Me as default};
2
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as i,handlesGroup as r,abortHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import n from"../../core/Logger.js";import{removeMaybe as o,destroyMaybe as l}from"../../core/maybe.js";import{isPromiseLike as d,debounce as c}from"../../core/promiseUtils.js";import{watch as u,initial as p,sync as h,whenOnce as m,syncAndInitial as f}from"../../core/reactiveUtils.js";import{generateBracedUUID as g}from"../../core/uuid.js";import{property as w,subclass as y}from"../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as v,isSharedTemplate as _,getCreationAttributes as F,isStandardFeatureTemplate as b}from"../../editing/templateUtils.js";import{getFullTemplate as M}from"../../editing/sharedTemplates/templateLoader.js";import I from"../../layers/GraphicsLayer.js";import{isSceneLayer as V,isTable as k}from"../../layers/support/layerUtils.js";import{isNumber as S}from"../../support/guards.js";import{getDisplayedSymbol as T}from"../../symbols/support/symbolUtils.js";import{updateGraphicSymbolWhenRequired as C}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as A}from"../../views/draw/support/helpMessageUtils.js";import P from"../../views/draw/support/HighlightHelper.js";import E from"../../views/interactive/sketch/SketchOptions.js";import U from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as H}from"../../views/support/HighlightDefaults.js";import L from"./CreateFeaturesWorkflowData.js";import{isModelUpload as O,handleModelUpload as j}from"./modelUploadUtils.js";import x from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as D,createToolFromGeometryType as z,containsUnsupportedCurve as R,findEditorItemForLayer as W,getServiceEditsFromWorkflowData as G,getServiceInfoForLayer as N,orderEditsByRelationshipDependencies as K,getServiceLayersById as Z,startCreatingNewFeature as q,syncUpdateOptions as B,findLayerInfo as J,isTerminalUpdateEventType as Q,getVisualVariableAttributes as X,startUpdatingFeatureGeometry as Y,createWorkflowSteps as $,avoidFeatureTemplateSelectionWithOnlyOneItem as ee,setUpSketchCreateWatchers as te,setRelationshipFields as ae,prepareAttachmentsForCreateFeaturesWorkflow as ie,showProgressCursor as re,setVisualVariablesAndElevationInfoForUpdate as se,visualVariableInteractiveUpdate as ne}from"./workflowUtils.js";import oe from"../FeatureForm/FeatureFormViewModel.js";import le from"../Sketch/SketchViewModel.js";var de;const ce=Symbol(),ue=Symbol(),pe=Symbol(),he=Symbol(),me={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let fe=de=class extends x{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._webStyleCache=new Map,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._formViewModel=new oe,this._sketchLayer=null,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get allowSave(){return!this.updating}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;const{creationInfo:e,upload:t}=this.data,{activeComponent:a,createGraphic:i}=this._sketchViewModel,r=i?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==a?.type&&"draw-3d"!==a?.type)&&a.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get hasPreviousStep(){return this._stepIndex>0||"update-pending"===this.createFeatureState&&!!this.data.selectedPendingFeature&&!this.parent&&!O(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const{_sketchViewModel:a}=this,{drawTool:i,isUsingLegacyCreateTools:r}=a;if(!r)return i?.helpMessageKey??"noTool";const s=e.layer.geometryType,n=a.createGraphic;if("mesh"===s){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(n,e):void 0}const{activeCreateToolDrawMode:o,activeTool:l}=a;return A("rectangle"===l||"circle"===l?l:s,n?.geometry,o)}get noticeMessage(){if(D(this._sketchViewModel,this.data.editorItem))return"curveToolDensifyWarning"}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter(e=>this.data.isDisplayable(e)).length}get parent(){return this.data.parent}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get saveActionLabel(){return"create"}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchUpdateOptions(){const{editorItem:e}=this.data;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!V(e?.layer)&&!!e?.capabilities.supportsTrueCurve}}}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){const e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e)return[];if(this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(v(this.data.fullTemplate)){const{tool:t}=z(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...me[e]]}get _attachmentsActive(){const e=this.data.viewModel.attachmentsViewModel.mode,t=this.stepId;return this.shouldShowAttachments&&("add"===e||"edit"===e||"adding-attachment"===t||"editing-attachment"===t)}getUpdating(){return!!this._sketchViewModel?.updating}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([pe])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),k(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(e){const{formViewModel:t}=this;if(t.pendingSubtypeChoice)return;t.submit(),this._stashValidationState();const a=this.data.selectedPendingFeature,i=this._hasValidationErrors(a)?a:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));if(i)return await this._startUpdating({feature:i}),void t?.submit();const{pendingFeatures:r,editorItem:s}=this.data;if(s&&e&&R(r.toArray(),s)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.save()}back(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||O(this.data.creationInfo)||this._attachmentsActive||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||O(this.data.creationInfo)||this._attachmentsActive?super.previous(e):this._clearSelectedFeature()}cancelFeature(e){this.data.isSharedTemplateWorkflow?n.getLogger(this).warn("Cannot cancel individual features created by shared templates."):(this.data.removePendingFeature(e),this.sketchViewModel.removeGraphic(e))}static create(e){const{addAttachmentsCallback:t,applyEdits:a,applyEditsFeatureService:i,isNested:r,creationInfo:s,parent:n,snappingManager:o,startAt:l,viewModel:d}=e,c=e.sketchOptions??new E,u=s?.layer,p=u?W(d.editorItems,u):void 0,h=new de({data:new L({creationInfo:s,editorItem:p,parent:n,sketchOptions:c,snappingManager:o,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;h._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:n}=r,o=n.capabilities?.editing.supportsGlobalId&&"globalIdField"in n,l=h._attachmentFileInfos,{fullTemplate:c}=e,u=G(h.data),p=_(c)&&u;if(o){if(ve(s),p){let t=Fe(u,l);const a=await(N(n,d.view)?.load());a&&(t=K({edits:t,serviceInfo:a,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await i(c.featureService,t,{globalIdUsed:!0,honorSequenceOfEdits:!0,gdbVersion:c.layer.gdbVersion??void 0})}else{const e=_e(s,l);await a(n,e,{globalIdUsed:!0})}return}const m=p?await i(c.featureService,u,{gdbVersion:c.layer.gdbVersion??void 0}):[await a(n,{addFeatures:s})];m&&l.size>0&&await Promise.all(m.map(e=>{if(e?.addFeatureResults)return t(n,ye(s,e.addFeatureResults,n,l))}))}});return h._set("steps",this._createWorkflowSteps(h,l)),h}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",i(()=>e.effect=t)}const t=e.opacity;return e.opacity=.7,i(()=>e.opacity=t)}async _initializeFullTemplateAndExecutorInfo(e){const{creationInfo:t}=e,{view:a}=e.viewModel;if(!t||!a)return null;const i=await M(a,t.template);if(e.fullTemplate=i,i&&_(i)){const{createTemplateExecutor:r}=await import("../../editing/sharedTemplates/executor/createTemplateExecutor.js"),s={completionResults:[],executor:await r(i),serviceLayersById:Z(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(ue);const{data:e}=this;if(!e.creationInfo)return;const t=this.data.creationInfo?.maxFeatures;if(t&&this.numPendingFeatures>=t)return this.sketchViewModel.cancel(),void(this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)}));this.createFeatureState="create-new",await q(this._sketchViewModel,this._sketchLayer,e,this._webStyleCache)}async _clearSelectedFeature(){const e=this._formViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=o(this._featureFormHandle),this._formViewModel.feature=null;const t=this.data.viewModel.attachmentsViewModel;"add"!==t.mode&&"edit"!==t.mode||await(this.data.viewModel.activeWorkflow?.previous())}_stashValidationState(){const e=this._formViewModel.feature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._formViewModel.submittable)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();const{data:a,pendingFeatures:i,_webStyleCache:s}=this;i.includes(e)||a.addPendingFeature(e,t),a.selectedPendingFeature=e;const{_formViewModel:n,_sketchViewModel:l,sketchUpdateOptions:d}=this,{creationInfo:c,viewModel:p}=a,{attachmentsViewModel:h,layerInfos:m,view:f}=p;if(!f||!c)return;B(l,d),o(this._featureFormHandle);const g=e.sourceLayer,w=J(m,g),y=w?.formTemplate,v=f.spatialReference;n.set({editType:"INSERT",feature:e,formTemplate:y,spatialReference:v,map:f.map}),"add"!==h.mode&&"edit"!==h.mode||await(p.activeWorkflow?.previous()),h.graphic=e,h.fileInfos.removeAll(),h.mode="view";(this._attachmentFileInfos.get(e)||[]).forEach(({file:e,form:t})=>h.addFile(e,t)),await C(e,s,"2d"===f.type?f.scale:null);const _=a.getEditsForPendingFeature(e);this._featureFormHandle=r([n.on("value-change",async({fieldName:t,value:a})=>{if(_?.updateAttributes(n.getValues()),S(a)){const e=this._visualVariableAttributes;e.size&&!e.size.isUpdatingInteractively&&t===e.size.field&&e.size.setInitialValue(a),e.rotation&&!e.rotation.isUpdatingInteractively&&t===e.rotation.field&&e.rotation.setInitialValue(a)}await C(e,s,"2d"===f.type?f.scale:null)}),l.on(["update","undo","redo"],e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&Q(e.toolEventInfo.type))&&n.notifyFeatureGeometryChanged()}),u(()=>n.feature?.sourceLayer,t=>e.sourceLayer=t),u(()=>[n.feature,n.submittable],()=>this._stashValidationState())]),this.createFeatureState="update-pending"}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});const{_sketchLayer:a,_sketchViewModel:i,data:r}=this,{creationInfo:s,viewModel:n}=r,{view:o}=n;if(!o||!s)return;const l=e.sourceLayer??s.layer;return k(l)?void 0:(this._visualVariableAttributes=X(e),Y({graphic:e,sketchLayer:a,sketchViewModel:i,sourceLayer:l,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes,webStyleCache:this._webStyleCache}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=$(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(O(t)?e.addHandles(await j({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(t.layer),this.id),e.addHandles(i.featureTemplatesViewModel.on("select",({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())}),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){const{viewModel:i}=a;t.canceled&&(e.removeHandles([pe,ce,ue,he]),i.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear())}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}})});return ee(a,i)}static _configureSketchViewModel(e){const{data:t,_sketchLayer:a,_sketchViewModel:s,_webStyleCache:n}=e,{creationInfo:o,viewModel:l}=t,{view:d}=l,p=[];if(!d)return i();if("2d"===d.type){o&&p.push(e._fadeExistingFeatures(o.layer));const t=c((e,t)=>Promise.all(e.map(e=>C(e,n,t))));p.push(u(()=>d.scale,e=>t(a.graphics,e)))}const h=F(t.fullTemplate,o?.attributeOverrides,o?.layer),m=u(()=>s.createGraphic&&s.activeComponent,()=>{s.createGraphic&&s.activeComponent&&!e.hasHandles(ue)&&e._updatingHandles.consumePromise(te({creationAttributes:h,data:t,sketchViewModel:s,view:d,webStyleCache:n}).then(t=>e.addHandles(t,ue)))}),f=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(ue),"cancel"===t.state&&null!==d.activeTool&&d.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===d.type?d.scale:null,useSourceLayer:!0,webStyleCache:e._webStyleCache});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},g=async i=>{const{attachmentsViewModel:r}=l,{_formViewModel:n}=e;if(i.graphics.length>1)return void await e._clearSelectedFeature();const c=i.graphics[0];if("complete"===i.state){const{submittable:t}=n;if(e.numPendingFeatures!==o?.maxFeatures&&t||n.submit(),await e._clearSelectedFeature(),"add"!==r.mode&&"edit"!==r.mode||await(l.activeWorkflow?.previous()),null==e.data.selectedPendingFeature&&(null==d.activeTool||d.activeTool===e.sketchViewModel.activeComponent)&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===i.state)return c.sourceLayer??=t.creationInfo?.layer,await se({graphic:c,sketchLayer:a,sketchViewModel:s,visualVariables:e._visualVariableAttributes,webStyleCache:e._webStyleCache,sourceLayer:c.sourceLayer}),e._selectFeatureForUpdate({feature:c});if("active"===i.state){await e.updatePendingFeature(c);const t=e._visualVariableAttributes;ne(d,c,i,t)&&await C(c,e._webStyleCache,"2d"===d.type?d.scale:null);const a=c.attributes,{rotation:r,size:s}=t;if(null!=r){const{field:e}=r;n.setValue(e,a[e])}if(null!=s){const{field:e}=s;n.setValue(e,a[e])}}}},w=async a=>{if(a.graphics.forEach(e=>{t.removePendingFeature(e)}),!O(t.creationInfo))return e._startCreating()},y=async()=>{if(O(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};p.push(m,s.on("create",t=>e._updatingHandles.addPromise(f(t))),s.on("update",t=>e._updatingHandles.addPromise(g(t))),s.on("delete",t=>e._updatingHandles.addPromise(w(t))),e._updatingHandles.addWhen(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(y())),i(()=>{s.cancel()}),ge(s,a,t),...we(t));const v=r(p);return s.addHandles(v),v}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new I({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),r=new le({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:t});this._sketchLayer=a,this._sketchViewModel=r,t?.map.add(a),this.addHandles([i(()=>{t?.destroyed||t?.map.remove(a),l(a)}),u(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,p),u(()=>this.sketchUpdateOptions,e=>{r.defaultUpdateOptions=e,B(r,e)},h)])}_hasValidationErrors(e){return!!e&&(!this.data.isSubmittable(e)||!!this._formViewModel.validateContingencyConstraints(e.attributes,{includeIncompleteViolations:!0})?.length)}async _processEdits(e,t){const{data:a,_formViewModel:i,_sketchLayer:r}=this,{layerInfos:s,view:n}=a.viewModel;i.editType="INSERT",i.map=n?.map,i.spatialReference=n?.spatialReference;const{templateExecutorInfo:o}=a;if(!o){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}r.remove(e);const{executor:l}=o,c=l(e.geometry,"completion"),u=d(c)?await c:c;o.completionResults.push(u),ae(u.relationships),i.editType="INSERT",i.map=n?.map,i.spatialReference=n?.spatialReference,u.primary&&a.creationInfo?.attributeOverrides&&(u.primary.graphic.attributes={...u.primary.graphic.attributes,...a.creationInfo.attributeOverrides});for(const d of u.edits){let e=null;if(d.addFeatures)for(const a of d.addFeatures){const i=a.clone();i.geometry=null,null!=a.geometry&&(a.symbol=await T(a,t),r.add(a)),a.sourceLayer!==e?.layer&&(e=J(s,a.sourceLayer));const n=!!u.associationGraphics?.has(a);await this._addAndInitializeEdits(a,i,e,n)}}i.feature=null,await m(()=>!i.updating);return u.edits.reduce((e,t)=>e+(t.addFeatures?.length??0),0)>1?null:u.primary?.graphic}async _addAndInitializeEdits(e,t,a,i=!1){const{data:r,_formViewModel:s}=this,{layerInfos:n}=r.viewModel,o=r.addPendingFeature(e,t,{isAssociation:i});a??=J(n,e.sourceLayer),s.feature=e,s.formTemplate=a?.formTemplate,await m(()=>!s.updating),o.updateAttributes(s.getValues()),o.submittable=s.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(pe))return;const{data:e,sketchViewModel:s}=this,{creationInfo:n,viewModel:l}=e,{attachmentsViewModel:d,view:c}=l;if(!c||!n?.layer)throw new a("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");const{initialFeature:h,layer:m}=n,f=[],g=[];this._featureFormHandle=o(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=W(l.editorItems,n.layer),n.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),g.push(i(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),s.allowDeleteKey=!e.isSharedTemplateWorkflow,ie(d),f.push(u(()=>d.mode,e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}}));const w=re(c);f.push(w);const y=k(n.layer),{template:_}=n,M=!_||b(_)||v(_)&&"feature"===_.type,I=y&&M;try{if(I){const a=h??new t({attributes:F(e.fullTemplate,n.attributeOverrides,m),sourceLayer:m}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else f.push(de._configureSketchViewModel(this)),h?(O(n)&&n.geometryToPlace&&(h.attributes=F(e.fullTemplate,n.attributeOverrides,m)),s.addGraphic(h),await this._startUpdating({feature:h})):await this._startCreating()}finally{w.remove()}const V=i(()=>{for(const t of e.pendingFeatures)s.removeGraphic(t),e.removePendingFeature(t)}),S=u(()=>c?.timeZone,e=>{this._formViewModel.timeZone=e,this.data.timeZone=e},p),T=i(()=>{O(n)&&l.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&f.push(this._featureFormHandle),this.addHandles(f,this._handleKeys.beforeCommit),this.addHandles(g,this._handleKeys.afterCommit),this.addHandles([i(()=>d.fileInfos.removeAll()),r(f),r(g),T,V,S],pe)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(s(t),he),await m(()=>null==e?.activeTool,t.signal),t.abort()}};function ge(e,t,a){let s=null;const n=()=>e.snappingOptions.featureSources,o=()=>(s=new U({layer:t}),n().add(s),s),d=()=>{null!=s&&(n().remove(s),s=l(s))};return r([u(()=>{const e=a.creationInfo?.layer,t=n().find(t=>t.layer===e);return{hasFeatureLayerSource:!!t,enabled:t?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return d();s??=o(),s.enabled=t},f),i(d)])}function we(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const r=new P({view:t});a.push(u(()=>e.selectedPendingFeature,(e,t)=>{r.remove(e),r.add(t)}),i(()=>r.destroy()))}const r=new P({view:t,highlightName:H});return a.push(u(()=>e.temporaryHighlightFeature,e=>{r.removeAll(),r.add(e)}),i(()=>r.destroy())),a}function ye(e,t,a,i){const r=[];return t.forEach((t,s)=>{if(!t.error){const n=e[s],o=i.get(n)||[];n.attributes[a.objectIdField]=t.objectId,o.forEach(({form:e})=>r.push({feature:n,attachment:e}))}}),r}function ve(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=g())}}function _e(e,t){const a=[];if(!t||0===t.size)return{addFeatures:e};for(const[i,r]of t)for(const{file:e}of r)a.push({feature:i,attachment:{globalId:g(),data:e}});return a.length?{addFeatures:e,addAttachments:a}:{addFeatures:e}}function Fe(e,t){return e.map(e=>{const{addFeatures:a}=e;if(!a||0===a.length)return e;const i=[];for(const r of a){const e=t.get(r);if(e)for(const{file:t}of e)i.push({feature:r,attachment:{globalId:g(),data:t}})}return i.length?{...e,addAttachments:i}:e})}e([w()],fe.prototype,"allowSave",null),e([w()],fe.prototype,"createFeatureState",void 0),e([w()],fe.prototype,"curveResizeDisabled",null),e([w()],fe.prototype,"curveUpdatesDisabled",null),e([w()],fe.prototype,"data",void 0),e([w({constructOnly:!0})],fe.prototype,"isNested",void 0),e([w()],fe.prototype,"formViewModel",null),e([w()],fe.prototype,"hasInvalidFormTemplate",null),e([w()],fe.prototype,"hasPendingEdits",null),e([w()],fe.prototype,"hasPreviousStep",null),e([w()],fe.prototype,"_getDrawMeshHelpMessage",void 0),e([w()],fe.prototype,"helpMessage",null),e([w()],fe.prototype,"noticeMessage",null),e([w()],fe.prototype,"layer",null),e([w()],fe.prototype,"parent",null),e([w()],fe.prototype,"keyboardCancellationEnabled",null),e([w()],fe.prototype,"reliesOnOwnerAdminPrivileges",null),e([w()],fe.prototype,"saveActionLabel",null),e([w()],fe.prototype,"shouldShowAttachments",null),e([w()],fe.prototype,"shouldAllowAttachmentEditing",null),e([w()],fe.prototype,"sketchUpdateOptions",null),e([w()],fe.prototype,"sketchViewModel",null),e([w()],fe.prototype,"availableCreateTools",null),e([w()],fe.prototype,"_attachmentsActive",null),fe=de=e([y("esri.widgets.Editor.CreateFeaturesWorkflow")],fe);const be=fe;export{be 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 t from"../../core/Error.js";import{makeHandle as i,handlesGroup as r,destroyHandle as a}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as o}from"../../core/maybe.js";import{debounce as s}from"../../core/promiseUtils.js";import{watch as n,on as l,whenOnce as p,initial as d}from"../../core/reactiveUtils.js";import{property as u,subclass as c}from"../../core/accessorSupport/decorators.js";import h from"../../layers/GraphicsLayer.js";import{swapForEditingSession as m,updateGraphicSymbolWhenRequired as y}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as w}from"../../views/draw/support/helpMessageUtils.js";import g from"../../views/draw/support/HighlightHelper.js";import f from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as v}from"../../views/support/HighlightDefaults.js";import _ from"./Edits.js";import F from"./SplitFeatureWorkflowData.js";import M from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as S,containsUnsupportedCurve as b,createWorkflowSteps as k,makeMinimalAttributes as T}from"./workflowUtils.js";import{assertViewNot3D as I,assertSplitWorkflowCapabilities as V}from"./support/errors.js";import{getCompatibleSpitterGeometryType as E,ensureSplittableGeometry as G,makeNewFeatureAttributes as H,splitGeometry as j,canSplitByPoint as C,isSplitterGeometry as x}from"./support/splitFeatureUtils.js";import U from"../FeatureForm/FeatureFormViewModel.js";import L from"../Sketch/SketchViewModel.js";import{getDrawToolGeometryTypeFromCreateTool as W}from"../Sketch/support/sketchUtils.js";var O;const P=Symbol(),z=Symbol();let A=O=class extends M{constructor(e){super(e),this.defaultSplitterGeometryType=null,this.type="split-feature",this._activeFeature=null,this._formViewModel=null,this._graphicsLayer=null,this._highlightHelper=null,this._lastSplitterGeometryWasInvalid=!1,this._sketchViewModel=null,this._webStyleCache=new Map}initialize(){const e=this.data.viewModel.view;this._highlightHelper=e?new g({view:e,highlightName:v}):null,this._initializeFormViewModel();const t=this._initializeGraphicsLayer();this._initializeSketchViewModel(t)}destroy(){const e=this._graphicsLayer,{view:t}=this.data.viewModel;t?.destroyed||t?.map.remove(e),this._graphicsLayer=o(this._graphicsLayer),this._formViewModel.destroy(),this._sketchViewModel.destroy(),this._highlightHelper?.destroy()}get activeFeature(){return this._activeFeature}get allowSave(){const{data:e}=this;return null!=e.existingFeatureEdits&&null!=e.newFeatureEdits&&!this.updating}get availableCreateTools(){const e=["polyline","polygon","rectangle","circle","freehandPolyline","freehandPolygon"];switch(this.data.editorItem.layer.geometryType){case"polygon":case"multipoint":return e;case"polyline":return["point",...e];default:return[]}}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPreviousStep(){return null!==this._activeFeature||this._stepIndex>0}get helpMessage(){const{activeCreateToolDrawMode:e,activeTool:t,createGraphic:i,drawTool:r,isUsingLegacyCreateTools:a}=this._sketchViewModel;if(!a)return r?.helpMessageKey??"noTool";const o=W(t);return"mesh"!==o?w(o,i?.geometry,e):void 0}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get sketchUpdateOptions(){return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1}}get updating(){return this._updatingHandles.updating||this._formViewModel.updating||this._sketchViewModel.updating}get noticeMessage(){return this._splittingMayIntroduceCurves&&S(this._sketchViewModel,this.data.editorItem)?"curveToolDensifyWarning":this._lastSplitterGeometryWasInvalid?"invalidSplitterGeometry":void 0}get _splittingMayIntroduceCurves(){return"polygon"===this.data.editorItem.layer.geometryType}async back(e){return this.activeFeature?await this.setActiveFeature(null):await super.back(e)}static create(e){const{applyEdits:i,applyEditsFeatureService:r,defaultSplitterGeometryType:a,startAt:o,...s}=e;if(I(e.viewModel,"split-feature"),V(s.editorItem),"reviewing-features"===o){if(!s.splitterGeometry)throw new t("editing:split-geometry-required","Must provide the split geometry to start at the 'reviewing-features' step.");const e=E(G(s.feature.geometry),s.splitterGeometry.type);if(s.splitterGeometry.type!==e)throw new t("editing:incompatible-split-geometries",`Geometry of type '${s.splitterGeometry.type}' cannot be used to split geometry of type '${s.feature.geometry?.type}'.`)}const n=new O({data:new F(s),defaultSplitterGeometryType:a,onCommit:R(e.applyEdits)});return n._set("steps",O._createWorkflowSteps(n,o)),n}async enter(){}exit(){if("reviewing-features"!==this.stepId)throw new t("editing:invalid-exit-state","The SplitFeatureWorkflow can only be exited when in the 'reviewing-features' step.")}async setActiveFeature(e){const i=this._activeFeature;if(e===i)return;const r=this.data,a=i?r.getEditsForFeature(i):null;if(a&&(a.submittable=this._formViewModel.submittable),this._activeFeature=e,null==e)return;const o=this.data.getRoleForFeature(e);if(!o)throw new t("editing:unknown-feature","The provided feature is not part of this workflow.");await this._setFeatureOnFormViewModel(e,o)}async commit(e){const{newFeatureEdits:t,existingFeatureEdits:i,editorItem:r}=this.data,a=[i?.feature,t?.feature].filter(e=>!!e);if(e&&b(a,r)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.commit()}async start(){return await super.start(),this._makeSketchController()}async _createAndInitializeEdits({newPart:e,remainingPart:t}){const{data:i}=this,r=i.feature,a=this._formViewModel,o=r.clone();o.geometry=t;const s=new _({feature:o});i.existingFeatureEdits=s,s.trackChanges(i.initialFeature),await this._setFeatureOnFormViewModel(o,"existing"),s.submittable=a.submittable;const n=r.clone();n.geometry=e,n.attributes=H(r.attributes,i.editorItem.layer);const l=new _({feature:n});return i.newFeatureEdits=l,l.trackChanges(),await this._setFeatureOnFormViewModel(n,"new"),l.submittable=a.submittable,{featureToCreate:n,featureToUpdate:o}}static _createWorkflowSteps(e,i="drawing-splitter-geometry"){const{data:r}=e;return k(["drawing-splitter-geometry","reviewing-features"],i,{"drawing-splitter-geometry":()=>({id:"drawing-splitter-geometry",async setUp(){const i=G(r.feature.geometry),a=E(i,e.defaultSplitterGeometryType),{snappingManager:o}=r;C(i)&&o&&e.addHandles(N(o,e.layer));const s=e._sketchViewModel;e.addHandles([l(()=>s,"create",async i=>{if("start"===i.state&&e._lastSplitterGeometryWasInvalid&&(e._lastSplitterGeometryWasInvalid=!1),"complete"===i.state){e._graphicsLayer.removeAll();const o=i.graphic?.geometry;try{if(!x(o))throw new t("editing:invalid-split-geometry","The geometry produced by the Sketch operation cannot be used for splitting.");r.splitterGeometry=o,r.splitResult=await e._updatingHandles.addPromise(e._executeSplit(o)),await e.next()}catch(a){e._lastSplitterGeometryWasInvalid=!0,await s.create(i.tool)}}}),n(()=>s.activeTool,(t,i)=>{"point"===t&&!e.hasHandles(P)&&o?e.addHandles(Z(o,e.layer),P):"point"===i&&e.removeHandles(P)})],this.id),await s.create(a)},async tearDown(){e.removeHandles(this.id)}}),"reviewing-features":()=>({id:"reviewing-features",async setUp(){const i=r.splitterGeometry;if(!i)throw new t("editing:missing-splitter-geometry","The `splitterGeometry` property of the workflow's data must be set in order to start the 'reviewing-features' step.");const a=r.splitResult??await e._executeSplit(i),{featureToCreate:o,featureToUpdate:s}=await e._createAndInitializeEdits(a),n=await e._displayFeatureGraphics(s,o);e.addHandles(n,this.id)},async tearDown(){e.removeHandles(this.id)}})})}async _displayFeatureGraphics(e,t){const{data:a,_graphicsLayer:o}=this,l=a.viewModel.view,p=[];if(!e||!t||!l)return i();const d=s(i=>Promise.all([y(e,this._webStyleCache,i),y(t,this._webStyleCache,i)]));return await d("2d"===l.type?l.scale:null),"2d"===l.type&&p.push(n(()=>l.scale,e=>d(e))),o.add(t),p.push(i(()=>o.remove(t))),p.push(await m(o,l,a.feature,e)),r(p)}async _executeSplit(e){const{data:i}=this,{feature:r}=i,a=r.geometry;if(!a)throw new t("editing:feature-has-no-geometry","Cannot split the provided feature as it has no geometry.");const o=await j(a,e);if(!o||!o.newPart)throw new t("editing:split-failed","The split operation did not produce a valid result.");return o}_initializeFormViewModel(){const{data:e,_webStyleCache:t}=this,i=e.viewModel.view,r=new U({formTemplate:e.editorItem.formTemplate,highlightHelper:this._highlightHelper,map:i?.map,spatialReference:i?.spatialReference,timeZone:e.timeZone});this._formViewModel=r,this.addHandles(l(()=>r,"value-change",({feature:r,fieldName:a,value:o})=>{r&&(e.getEditsForFeature(r)?.setAttribute(a,o),y(r,t,i?.scale))}))}_initializeGraphicsLayer(){const{data:e}=this,{view:t}=e.viewModel,i=new h({elevationInfo:e.editorItem.layer.elevationInfo,internal:!0,listMode:"hide",title:"splitFeatureWorkflow-internal"});return this._graphicsLayer=i,t?.map.add(i),i}_initializeSketchViewModel(e){const{data:t}=this,{view:i}=t.viewModel;this._sketchViewModel=new L({layer:e,creationMode:"single",sketchOptions:t.sketchOptions,snappingManager:t.snappingManager,useLegacyCreateTools:t.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:i})}_makeSketchController(){return{enter:async()=>this.addHandles($(this)),exit:()=>this.removeHandles(z),viewModel:this._sketchViewModel}}async _setFeatureOnFormViewModel(e,t){const{data:i}=this,r=this._formViewModel;r.feature=e,"existing"===t?(r.editType="UPDATE",r.overrideInitialFeature(i.initialFeature)):r.editType="INSERT",await p(()=>!r.updating)}get test(){}};e([u()],A.prototype,"activeFeature",null),e([u()],A.prototype,"allowSave",null),e([u()],A.prototype,"availableCreateTools",null),e([u()],A.prototype,"defaultSplitterGeometryType",void 0),e([u()],A.prototype,"formViewModel",null),e([u()],A.prototype,"hasInvalidFormTemplate",null),e([u()],A.prototype,"hasPreviousStep",null),e([u()],A.prototype,"helpMessage",null),e([u()],A.prototype,"layer",null),e([u()],A.prototype,"parent",null),e([u()],A.prototype,"sketchUpdateOptions",null),e([u()],A.prototype,"type",void 0),e([u()],A.prototype,"updating",null),e([u()],A.prototype,"noticeMessage",null),e([u()],A.prototype,"_activeFeature",void 0),e([u()],A.prototype,"_formViewModel",void 0),e([u()],A.prototype,"_graphicsLayer",void 0),e([u()],A.prototype,"_highlightHelper",void 0),e([u()],A.prototype,"_lastSplitterGeometryWasInvalid",void 0),e([u()],A.prototype,"_sketchViewModel",void 0),e([u()],A.prototype,"_splittingMayIntroduceCurves",null),A=O=e([c("esri.widgets.Editor.SplitFeatureWorkflow")],A);const D=A;function R(e){return async i=>{const{existingFeatureEdits:r,newFeatureEdits:a}=i,o=r?.feature?.cloneShallow(),s=a?.feature?.cloneShallow(),n=i.editorItem.layer;if(null==o||null==s)throw new t("editing:missing-features","Expected both a feature to update and a feature to add for the split operation.");r?.attributesModified||(o.attributes=T(o,i.editorItem.layer)),await e(n,{addFeatures:[s],updateFeatures:[o]})}}function N(e,t){if(e.options.featureSources.some(e=>e.layer===t))return i();const r=new f({enabled:!1,layer:t});return e.options.featureSources.add(r),i(()=>{e.options.featureSources.remove(r),r.destroy()})}function Z(e,t){const{options:r}=e,a=r.enabled;r.enabled=!0;const o=r.featureEnabled;r.featureEnabled=!0;const s=r.distance;r.distance=15;const n=new Map;for(const i of r.featureSources)n.set(i,i.enabled),i.layer===t?i.enabled=!0:i.enabled=!1;return i(()=>{r.enabled=a,r.featureEnabled=o,r.distance=s;for(const[e,t]of n)e.enabled=t})}function $(e){const t=e.data,{feature:o,viewModel:s}=t,{view:l}=s;if(!l)return i();const p=new g({view:l}),u=n(()=>e.stepId,e=>{switch(p.removeAll(),e){case"drawing-splitter-geometry":p.add(o);break;case"reviewing-features":p.add(t.existingFeatureEdits?.feature),p.add(t.newFeatureEdits?.feature)}},d),c=new g({view:l,highlightName:v}),h=n(()=>t.temporaryHighlightFeature,(t,i)=>{i&&i!==e.activeFeature&&c.remove(i),t&&c.add(t)}),m=n(()=>e.activeFeature,(e,i)=>{i&&i!==t.temporaryHighlightFeature&&c.remove(i),e&&c.add(e)});return r([u,h,m,a(p),a(c)])}export{D as default};
2
+ import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{makeHandle as i,handlesGroup as r,destroyHandle as a}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as o}from"../../core/maybe.js";import{debounce as s}from"../../core/promiseUtils.js";import{watch as n,on as l,whenOnce as p,initial as d}from"../../core/reactiveUtils.js";import{property as u,subclass as c}from"../../core/accessorSupport/decorators.js";import h from"../../layers/GraphicsLayer.js";import{swapForEditingSession as m,updateGraphicSymbolWhenRequired as y}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as w}from"../../views/draw/support/helpMessageUtils.js";import g from"../../views/draw/support/HighlightHelper.js";import f from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as v}from"../../views/support/HighlightDefaults.js";import _ from"./Edits.js";import F from"./SplitFeatureWorkflowData.js";import M from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as S,containsUnsupportedCurve as b,createWorkflowSteps as k,makeMinimalAttributes as T}from"./workflowUtils.js";import{assertViewNot3D as I,assertSplitWorkflowCapabilities as V}from"./support/errors.js";import{getCompatibleSpitterGeometryType as E,ensureSplittableGeometry as G,makeNewFeatureAttributes as H,splitGeometry as j,canSplitByPoint as C,isSplitterGeometry as x}from"./support/splitFeatureUtils.js";import U from"../FeatureForm/FeatureFormViewModel.js";import L from"../Sketch/SketchViewModel.js";import{getDrawToolGeometryTypeFromCreateTool as W}from"../Sketch/support/sketchUtils.js";var O;const P=Symbol(),z=Symbol();let A=O=class extends M{constructor(e){super(e),this.defaultSplitterGeometryType=null,this.type="split-feature",this._activeFeature=null,this._formViewModel=null,this._graphicsLayer=null,this._highlightHelper=null,this._lastSplitterGeometryWasInvalid=!1,this._sketchViewModel=null,this._webStyleCache=new Map}initialize(){const e=this.data.viewModel.view;this._highlightHelper=e?new g({view:e,highlightName:v}):null,this._initializeFormViewModel();const t=this._initializeGraphicsLayer();this._initializeSketchViewModel(t)}destroy(){const e=this._graphicsLayer,{view:t}=this.data.viewModel;t?.destroyed||t?.map.remove(e),this._graphicsLayer=o(this._graphicsLayer),this._formViewModel.destroy(),this._sketchViewModel.destroy(),this._highlightHelper?.destroy()}get activeFeature(){return this._activeFeature}get allowSave(){const{data:e}=this;return null!=e.existingFeatureEdits&&null!=e.newFeatureEdits&&!this.updating}get availableCreateTools(){const e=["polyline","polygon","rectangle","circle","freehandPolyline","freehandPolygon"];switch(this.data.editorItem.layer.geometryType){case"polygon":case"multipoint":return e;case"polyline":return["point",...e];default:return[]}}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPreviousStep(){return null!==this._activeFeature||this._stepIndex>0}get helpMessage(){const{activeCreateToolDrawMode:e,activeTool:t,createGraphic:i,drawTool:r,isUsingLegacyCreateTools:a}=this._sketchViewModel;if(!a)return r?.helpMessageKey??"noTool";const o=W(t);return"mesh"!==o?w(o,i?.geometry,e):void 0}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get sketchUpdateOptions(){return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1}}get updating(){return this._updatingHandles.updating||this._formViewModel.updating||this._sketchViewModel.updating}get noticeMessage(){return this._splittingMayIntroduceCurves&&S(this._sketchViewModel,this.data.editorItem)?"curveToolDensifyWarning":this._lastSplitterGeometryWasInvalid?"invalidSplitterGeometry":void 0}get _splittingMayIntroduceCurves(){return"polygon"===this.data.editorItem.layer.geometryType}async back(e){if(this.activeFeature)return await this.setActiveFeature(null);await super.back(e)}static create(e){const{applyEdits:i,applyEditsFeatureService:r,defaultSplitterGeometryType:a,startAt:o,...s}=e;if(I(e.viewModel,"split-feature"),V(s.editorItem),"reviewing-features"===o){if(!s.splitterGeometry)throw new t("editing:split-geometry-required","Must provide the split geometry to start at the 'reviewing-features' step.");const e=E(G(s.feature.geometry),s.splitterGeometry.type);if(s.splitterGeometry.type!==e)throw new t("editing:incompatible-split-geometries",`Geometry of type '${s.splitterGeometry.type}' cannot be used to split geometry of type '${s.feature.geometry?.type}'.`)}const n=new O({data:new F(s),defaultSplitterGeometryType:a,onCommit:R(e.applyEdits)});return n._set("steps",O._createWorkflowSteps(n,o)),n}async enter(){}exit(){if("reviewing-features"!==this.stepId)throw new t("editing:invalid-exit-state","The SplitFeatureWorkflow can only be exited when in the 'reviewing-features' step.")}async setActiveFeature(e){const i=this._activeFeature;if(e===i)return;const r=this.data,a=i?r.getEditsForFeature(i):null;if(a&&(a.submittable=this._formViewModel.submittable),this._activeFeature=e,null==e)return;const o=this.data.getRoleForFeature(e);if(!o)throw new t("editing:unknown-feature","The provided feature is not part of this workflow.");await this._setFeatureOnFormViewModel(e,o)}async commit(e){const{newFeatureEdits:t,existingFeatureEdits:i,editorItem:r}=this.data,a=[i?.feature,t?.feature].filter(e=>!!e);if(e&&b(a,r)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.commit()}async start(){return await super.start(),this._makeSketchController()}async _createAndInitializeEdits({newPart:e,remainingPart:t}){const{data:i}=this,r=i.feature,a=this._formViewModel,o=r.clone();o.geometry=t;const s=new _({feature:o});i.existingFeatureEdits=s,s.trackChanges(i.initialFeature),await this._setFeatureOnFormViewModel(o,"existing"),s.submittable=a.submittable;const n=r.clone();n.geometry=e,n.attributes=H(r.attributes,i.editorItem.layer);const l=new _({feature:n});return i.newFeatureEdits=l,l.trackChanges(),await this._setFeatureOnFormViewModel(n,"new"),l.submittable=a.submittable,{featureToCreate:n,featureToUpdate:o}}static _createWorkflowSteps(e,i="drawing-splitter-geometry"){const{data:r}=e;return k(["drawing-splitter-geometry","reviewing-features"],i,{"drawing-splitter-geometry":()=>({id:"drawing-splitter-geometry",async setUp(){const i=G(r.feature.geometry),a=E(i,e.defaultSplitterGeometryType),{snappingManager:o}=r;C(i)&&o&&e.addHandles(N(o,e.layer));const s=e._sketchViewModel;e.addHandles([l(()=>s,"create",async i=>{if("start"===i.state&&e._lastSplitterGeometryWasInvalid&&(e._lastSplitterGeometryWasInvalid=!1),"complete"===i.state){e._graphicsLayer.removeAll();const o=i.graphic?.geometry;try{if(!x(o))throw new t("editing:invalid-split-geometry","The geometry produced by the Sketch operation cannot be used for splitting.");r.splitterGeometry=o,r.splitResult=await e._updatingHandles.addPromise(e._executeSplit(o)),await e.next()}catch(a){e._lastSplitterGeometryWasInvalid=!0,await s.create(i.tool)}}}),n(()=>s.activeTool,(t,i)=>{"point"===t&&!e.hasHandles(P)&&o?e.addHandles(Z(o,e.layer),P):"point"===i&&e.removeHandles(P)})],this.id),await s.create(a)},async tearDown(){e.removeHandles(this.id)}}),"reviewing-features":()=>({id:"reviewing-features",async setUp(){const i=r.splitterGeometry;if(!i)throw new t("editing:missing-splitter-geometry","The `splitterGeometry` property of the workflow's data must be set in order to start the 'reviewing-features' step.");const a=r.splitResult??await e._executeSplit(i),{featureToCreate:o,featureToUpdate:s}=await e._createAndInitializeEdits(a),n=await e._displayFeatureGraphics(s,o);e.addHandles(n,this.id)},async tearDown(){e.removeHandles(this.id)}})})}async _displayFeatureGraphics(e,t){const{data:a,_graphicsLayer:o}=this,l=a.viewModel.view,p=[];if(!e||!t||!l)return i();const d=s(i=>Promise.all([y(e,this._webStyleCache,i),y(t,this._webStyleCache,i)]));return await d("2d"===l.type?l.scale:null),"2d"===l.type&&p.push(n(()=>l.scale,e=>d(e))),o.add(t),p.push(i(()=>o.remove(t))),p.push(await m(o,l,a.feature,e)),r(p)}async _executeSplit(e){const{data:i}=this,{feature:r}=i,a=r.geometry;if(!a)throw new t("editing:feature-has-no-geometry","Cannot split the provided feature as it has no geometry.");const o=await j(a,e);if(!o||!o.newPart)throw new t("editing:split-failed","The split operation did not produce a valid result.");return o}_initializeFormViewModel(){const{data:e,_webStyleCache:t}=this,i=e.viewModel.view,r=new U({formTemplate:e.editorItem.formTemplate,highlightHelper:this._highlightHelper,map:i?.map,spatialReference:i?.spatialReference,timeZone:e.timeZone});this._formViewModel=r,this.addHandles(l(()=>r,"value-change",({feature:r,fieldName:a,value:o})=>{r&&(e.getEditsForFeature(r)?.setAttribute(a,o),y(r,t,i?.scale))}))}_initializeGraphicsLayer(){const{data:e}=this,{view:t}=e.viewModel,i=new h({elevationInfo:e.editorItem.layer.elevationInfo,internal:!0,listMode:"hide",title:"splitFeatureWorkflow-internal"});return this._graphicsLayer=i,t?.map.add(i),i}_initializeSketchViewModel(e){const{data:t}=this,{view:i}=t.viewModel;this._sketchViewModel=new L({layer:e,creationMode:"single",sketchOptions:t.sketchOptions,snappingManager:t.snappingManager,useLegacyCreateTools:t.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:i})}_makeSketchController(){return{enter:async()=>this.addHandles($(this)),exit:()=>this.removeHandles(z),viewModel:this._sketchViewModel}}async _setFeatureOnFormViewModel(e,t){const{data:i}=this,r=this._formViewModel;r.feature=e,"existing"===t?(r.editType="UPDATE",r.overrideInitialFeature(i.initialFeature)):r.editType="INSERT",await p(()=>!r.updating)}get test(){}};e([u()],A.prototype,"activeFeature",null),e([u()],A.prototype,"allowSave",null),e([u()],A.prototype,"availableCreateTools",null),e([u()],A.prototype,"defaultSplitterGeometryType",void 0),e([u()],A.prototype,"formViewModel",null),e([u()],A.prototype,"hasInvalidFormTemplate",null),e([u()],A.prototype,"hasPreviousStep",null),e([u()],A.prototype,"helpMessage",null),e([u()],A.prototype,"layer",null),e([u()],A.prototype,"parent",null),e([u()],A.prototype,"sketchUpdateOptions",null),e([u()],A.prototype,"type",void 0),e([u()],A.prototype,"updating",null),e([u()],A.prototype,"noticeMessage",null),e([u()],A.prototype,"_activeFeature",void 0),e([u()],A.prototype,"_formViewModel",void 0),e([u()],A.prototype,"_graphicsLayer",void 0),e([u()],A.prototype,"_highlightHelper",void 0),e([u()],A.prototype,"_lastSplitterGeometryWasInvalid",void 0),e([u()],A.prototype,"_sketchViewModel",void 0),e([u()],A.prototype,"_splittingMayIntroduceCurves",null),A=O=e([c("esri.widgets.Editor.SplitFeatureWorkflow")],A);const D=A;function R(e){return async i=>{const{existingFeatureEdits:r,newFeatureEdits:a}=i,o=r?.feature?.cloneShallow(),s=a?.feature?.cloneShallow(),n=i.editorItem.layer;if(null==o||null==s)throw new t("editing:missing-features","Expected both a feature to update and a feature to add for the split operation.");r?.attributesModified||(o.attributes=T(o,i.editorItem.layer)),await e(n,{addFeatures:[s],updateFeatures:[o]})}}function N(e,t){if(e.options.featureSources.some(e=>e.layer===t))return i();const r=new f({enabled:!1,layer:t});return e.options.featureSources.add(r),i(()=>{e.options.featureSources.remove(r),r.destroy()})}function Z(e,t){const{options:r}=e,a=r.enabled;r.enabled=!0;const o=r.featureEnabled;r.featureEnabled=!0;const s=r.distance;r.distance=15;const n=new Map;for(const i of r.featureSources)n.set(i,i.enabled),i.layer===t?i.enabled=!0:i.enabled=!1;return i(()=>{r.enabled=a,r.featureEnabled=o,r.distance=s;for(const[e,t]of n)e.enabled=t})}function $(e){const t=e.data,{feature:o,viewModel:s}=t,{view:l}=s;if(!l)return i();const p=new g({view:l}),u=n(()=>e.stepId,e=>{switch(p.removeAll(),e){case"drawing-splitter-geometry":p.add(o);break;case"reviewing-features":p.add(t.existingFeatureEdits?.feature),p.add(t.newFeatureEdits?.feature)}},d),c=new g({view:l,highlightName:v}),h=n(()=>t.temporaryHighlightFeature,(t,i)=>{i&&i!==e.activeFeature&&c.remove(i),t&&c.add(t)}),m=n(()=>e.activeFeature,(e,i)=>{i&&i!==t.temporaryHighlightFeature&&c.remove(i),e&&c.add(e)});return r([u,h,m,a(p),a(c)])}export{D 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 t from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as s}from"../../core/maybe.js";import{watch as a,sync as o}from"../../core/reactiveUtils.js";import{property as r,subclass as l}from"../../core/accessorSupport/decorators.js";import d from"../../layers/GraphicsLayer.js";import{isSceneLayer as h}from"../../layers/support/layerUtils.js";import{updateGraphicSymbolWhenRequired as n,swapForEditingSession as c}from"../../views/draw/support/editingSessionUtils.js";import{highlightsSupported as p}from"../../views/support/layerViewUtils.js";import u from"./UpdateFeatureWorkflowData.js";import{UpdateRecordWorkflow as w,handleKeys as y}from"./UpdateRecordWorkflow.js";import{getVisualVariableAttributes as m,setUpGeometryUpdate as f,syncUpdateOptions as k,cloneGraphicExceptMesh as g,canCreateInteractiveEditSession as _,isTerminalUpdateEventType as v}from"./workflowUtils.js";import V from"../Sketch/SketchViewModel.js";var S;const b={...y,highlights:Symbol(),sketchGraphics:Symbol(),sketchViewModel:Symbol(),waitingForTool:Symbol()};let M=S=class extends w{constructor(e){super(e),this.type="update-feature",this._layerViewEditSession=null,this._sketchGraphicClone=null,this._sketchLayer=null,this._sketchViewModel=null,this._webStyleCache=new Map}destroy(){this._layerViewEditSession?.rollback()}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get sketchUpdateOptions(){const{capabilities:e,layer:t}=this.data.editorItem;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!h(t)&&e.supportsTrueCurve}}}get supportsSplitFeatureWorkflow(){return this.data.supportsSplitFeatureWorkflow}get viewGraphic(){return this._sketchViewModel?this._sketchGraphicClone:this.data.edits.feature??this.fullFeature}getUpdating(){return!!this._sketchViewModel?.updating}async commit(){this.removeHandles(b.sketchGraphics);try{const e=this.data.edits.stagedForDelete;await super.commit();const t=this._layerViewEditSession;e?t?.rollback():t?.commit()}catch(e){throw await this._configureSketchViewModel(),new t("editor-workflow:failed-to-commit","An error occurred when sending the updates to the service",{error:e})}}async start(){return await super.start(),await this._initializeSketchViewModel()}_initializeFormViewModel(){super._initializeFormViewModel(),this.addHandles([this._formViewModel.on("value-change",e=>{this._layerViewEditSession?.setAttribute(e.fieldName,e.value)}),a(()=>this._formViewModel.feature?.sourceLayer,e=>this._sketchGraphicClone.sourceLayer=e)])}_configureHighlight(){const{edits:e,layerView:t}=this.data;p(t)&&this.addHandles(t.highlight(e.feature),b.highlights)}async _configureSketchViewModel(){const{_sketchLayer:e,_sketchViewModel:t}=this;if(!t||!e)return;const{data:i,_formViewModel:s,_sketchGraphicClone:a}=this,{edits:o,viewModel:r}=i,l=o.feature,{view:d}=r,h=m(l),n=await f({feature:l,featureClone:a,visualVariableAttributes:h,sketchLayer:e,sketchViewModel:t,getUpdateOptions:()=>this.sketchUpdateOptions,view:d,webStyleCache:this._webStyleCache,onUpdate:({geometry:e,attributes:t},i)=>{if(o.updateAttributes(t),o.updateGeometry(e),s.feature&&(s.feature.geometry=e),null!=h.rotation){const{field:e}=h.rotation;s.setValue(e,t[e])}if(null!=h.size){const{field:e}=h.size;s.setValue(e,t[e])}("undo"===i.type||"redo"===i.type||"update"===i.type&&null!=i.toolEventInfo&&v(i.toolEventInfo.type))&&s.notifyFeatureGeometryChanged()},addUpdatingPromise:e=>{this._updatingHandles.consumePromise(e)},addHandle:e=>{this.addHandles(e,b.waitingForTool)}});this.addHandles(n,b.sketchGraphics),t.addHandles(n)}async _initializeSketchViewModel(){const{data:e,_sketchGraphicClone:t}=this,{readOnly:r}=e,l=e.edits.feature,{capabilities:h,layer:p}=e.editorItem,u=e.viewModel.view;if(this.removeHandles([b.highlights,b.sketchGraphics,b.sketchViewModel,b.waitingForTool]),!h.update.geometry||r||this.curveUpdatesDisabled)return{enter:async()=>{this.hasHandles(b.highlights)||this._configureHighlight()},exit:()=>this.removeHandles([b.highlights])};const w=new d({elevationInfo:p.elevationInfo,internal:!0,listMode:"hide",title:"updateFeaturesWorkflow-internal"}),y=new V({allowDeleteKey:!1,layer:w,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:u});return this._sketchLayer=w,this._sketchViewModel=y,u?.map.add(w),await(u?.whenLayerView(w)),this.addHandles([i(()=>{u?.destroyed||u?.map.remove(w),w.destroyed||w.destroy(),this._sketchViewModel=s(y)}),a(()=>this.sketchUpdateOptions,e=>{y.defaultUpdateOptions=e,k(y,e)},o)],b.sketchViewModel),await n(t,this._webStyleCache,"2d"===u?.type?u.scale:null),this.addHandles([await c(w,u,l,t)]),{enter:async()=>{this.hasHandles(b.sketchGraphics)||await this._configureSketchViewModel()},exit:()=>this.removeHandles([b.sketchGraphics]),viewModel:y}}_onFullFeatureLoaded(e){super._onFullFeatureLoaded(e);const t=this._sketchGraphicClone=g(e),{edits:i,layerView:s}=this.data;i.updateGeometry(e.geometry),i.trackChanges(),_(s)&&(this._layerViewEditSession=s.createInteractiveEditSession(t))}static async create(e){const t=new S({data:await u.create(e),onCommit:this._onCommitFactory(e.applyEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}get test(){}};e([r()],M.prototype,"curveResizeDisabled",null),e([r()],M.prototype,"curveUpdatesDisabled",null),e([r()],M.prototype,"sketchUpdateOptions",null),e([r()],M.prototype,"supportsSplitFeatureWorkflow",null),e([r()],M.prototype,"_layerViewEditSession",void 0),e([r()],M.prototype,"_sketchGraphicClone",void 0),e([r()],M.prototype,"_sketchLayer",void 0),e([r()],M.prototype,"_sketchViewModel",void 0),M=S=e([l("esri.widgets.Editor.UpdateFeatureWorkflow")],M);export{M as UpdateFeatureWorkflow,b as handleKeys};
2
+ import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as s}from"../../core/maybe.js";import{watch as a,sync as o}from"../../core/reactiveUtils.js";import{property as r,subclass as l}from"../../core/accessorSupport/decorators.js";import d from"../../layers/GraphicsLayer.js";import{isSceneLayer as h}from"../../layers/support/layerUtils.js";import{updateGraphicSymbolWhenRequired as n,swapForEditingSession as c}from"../../views/draw/support/editingSessionUtils.js";import{highlightsSupported as p}from"../../views/support/layerViewUtils.js";import u from"./UpdateFeatureWorkflowData.js";import{UpdateRecordWorkflow as w,handleKeys as m}from"./UpdateRecordWorkflow.js";import{getVisualVariableAttributes as y,setUpGeometryUpdate as f,syncUpdateOptions as g,cloneGraphicExceptMesh as k,canCreateInteractiveEditSession as _,isTerminalUpdateEventType as v}from"./workflowUtils.js";import V from"../Sketch/SketchViewModel.js";var S;const b={...m,highlights:Symbol(),sketchGraphics:Symbol(),sketchViewModel:Symbol(),waitingForTool:Symbol()};let M=S=class extends w{constructor(e){super(e),this.type="update-feature",this._layerViewEditSession=null,this._sketchGraphicClone=null,this._sketchLayer=null,this._sketchViewModel=null,this._webStyleCache=new Map}destroy(){this._layerViewEditSession?.rollback()}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get sketchUpdateOptions(){const{capabilities:e,layer:t}=this.data.editorItem;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!h(t)&&e.supportsTrueCurve}}}get supportsSplitFeatureWorkflow(){return this.data.supportsSplitFeatureWorkflow}get viewGraphic(){return this._sketchViewModel?this._sketchGraphicClone:this.data.edits.feature??this.fullFeature}getUpdating(){return!!this._sketchViewModel?.updating}async commit(){this.removeHandles(b.sketchGraphics);try{const e=this.data.edits.stagedForDelete;await super.commit();const t=this._layerViewEditSession;e?t?.rollback():t?.commit()}catch(e){throw await this._configureSketchViewModel(),new t("editor-workflow:failed-to-commit","An error occurred when sending the updates to the service",{error:e})}}async start(){return await super.start(),await this._initializeSketchViewModel()}_initializeFormViewModel(){super._initializeFormViewModel(),this.addHandles([this._formViewModel.on("value-change",e=>{this._layerViewEditSession?.setAttribute(e.fieldName,e.value)}),a(()=>this._formViewModel.feature?.sourceLayer,e=>this._sketchGraphicClone.sourceLayer=e)])}_configureHighlight(){const{edits:e,layerView:t}=this.data;p(t)&&this.addHandles(t.highlight(e.feature),b.highlights)}async _configureSketchViewModel(){const{_sketchLayer:e,_sketchViewModel:t}=this;if(!t||!e)return;const{data:i,_formViewModel:s,_sketchGraphicClone:a}=this,{edits:o,viewModel:r}=i,l=o.feature,{view:d}=r,h=y(l),n=await f({feature:l,featureClone:a,visualVariableAttributes:h,sketchLayer:e,sketchViewModel:t,getUpdateOptions:()=>this.sketchUpdateOptions,view:d,webStyleCache:this._webStyleCache,onUpdate:({geometry:e,attributes:t},i)=>{if(o.updateAttributes(t),o.updateGeometry(e),s.feature&&(s.feature.geometry=e),null!=h.rotation){const{field:e}=h.rotation;s.setValue(e,t[e])}if(null!=h.size){const{field:e}=h.size;s.setValue(e,t[e])}("undo"===i.type||"redo"===i.type||"update"===i.type&&null!=i.toolEventInfo&&v(i.toolEventInfo.type))&&s.notifyFeatureGeometryChanged()},addUpdatingPromise:e=>{this._updatingHandles.consumePromise(e)},addHandle:e=>{this.addHandles(e,b.waitingForTool)}});this.addHandles(n,b.sketchGraphics),t.addHandles(n)}async _initializeSketchViewModel(){const{data:e,_sketchGraphicClone:t}=this,{readOnly:r}=e,l=e.edits.feature,{capabilities:h,layer:p}=e.editorItem,u=e.viewModel.view;if(this.removeHandles([b.highlights,b.sketchGraphics,b.sketchViewModel,b.waitingForTool]),!h.update.geometry||r||this.curveUpdatesDisabled)return{enter:async()=>{this.hasHandles(b.highlights)||this._configureHighlight()},exit:()=>this.removeHandles([b.highlights])};const w=new d({elevationInfo:p.elevationInfo,internal:!0,listMode:"hide",title:"updateFeaturesWorkflow-internal"}),m=new V({allowDeleteKey:!1,layer:w,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:u});return this._sketchLayer=w,this._sketchViewModel=m,u?.map.add(w),await(u?.whenLayerView(w)),this.addHandles([i(()=>{u?.destroyed||u?.map.remove(w),w.destroyed||w.destroy(),this._sketchViewModel=s(m)}),a(()=>this.sketchUpdateOptions,e=>{m.defaultUpdateOptions=e,g(m,e)},o)],b.sketchViewModel),await n(t,this._webStyleCache,"2d"===u?.type?u.scale:null),this.addHandles([await c(w,u,l,t)]),{enter:async()=>{this.hasHandles(b.sketchGraphics)||await this._updatingHandles.addPromise(this._configureSketchViewModel())},exit:()=>this.removeHandles([b.sketchGraphics]),viewModel:m}}_onFullFeatureLoaded(e){super._onFullFeatureLoaded(e);const t=this._sketchGraphicClone=k(e),{edits:i,layerView:s}=this.data;i.updateGeometry(e.geometry),i.trackChanges(),_(s)&&(this._layerViewEditSession=s.createInteractiveEditSession(t))}static async create(e){const t=new S({data:await u.create(e),onCommit:this._onCommitFactory(e.applyEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}get test(){}};e([r()],M.prototype,"curveResizeDisabled",null),e([r()],M.prototype,"curveUpdatesDisabled",null),e([r()],M.prototype,"sketchUpdateOptions",null),e([r()],M.prototype,"supportsSplitFeatureWorkflow",null),e([r()],M.prototype,"_layerViewEditSession",void 0),e([r()],M.prototype,"_sketchGraphicClone",void 0),e([r()],M.prototype,"_sketchLayer",void 0),e([r()],M.prototype,"_sketchViewModel",void 0),M=S=e([l("esri.widgets.Editor.UpdateFeatureWorkflow")],M);export{M as UpdateFeatureWorkflow,b as handleKeys};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{loadCalciteComponents as t}from"../../support/componentsUtils.js";import e from"../../support/SketchTooltipControls.js";import o from"../../support/SnappingControls.js";import{tsx as i}from"../../support/widget.js";import s from"../../support/SketchTooltipControls/VisibleElements.js";import n from"../../support/SnappingControls/VisibleElements.js";const p={settingsContainer:"esri-editor__settings"},r=()=>t({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item")});function c({editorViewModel:t,messagesCommon:r,visibleElements:c}){const{snappingOptions:a,sketchOptions:l,view:m,snappingManager:g}=t,d=[],u={directionModePicker:c.directionModePicker,labelsToggle:c.labelsToggle,tooltipsToggle:c.tooltipsToggle};return Object.values(u).includes(!0)&&d.push(i(e,{sketchOptions:l,view:m,visibleElements:new s(u)})),c.snappingControls&&d.push(i(o,{afterCreate:t=>t.layerListOpen=!1,snappingManager:g,snappingOptions:a,view:m,visibleElements:c.snappingControlsElements??new n})),0===d.length?null:i("calcite-accordion",{appearance:"transparent",class:p.settingsContainer,key:"settings"},i("calcite-accordion-item",{"data-testid":"settings",heading:r.settings,iconStart:"gear"},d))}export{c as Settings,p as css,r as loadSettingsComponents};
2
+ import{loadCalciteComponents as t}from"../../support/componentsUtils.js";import e from"../../support/PluginSettingsControls.js";import s from"../../support/SketchTooltipControls.js";import o from"../../support/SnappingControls.js";import{tsx as i}from"../../support/widget.js";import n from"../../support/SketchTooltipControls/VisibleElements.js";import r from"../../support/SnappingControls/VisibleElements.js";const p={settingsContainer:"esri-editor__settings"},a=()=>t({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item")});function c({editorViewModel:t,messagesCommon:a,visibleElements:c}){const{snappingOptions:l,sketchOptions:g,view:m,snappingManager:d,sketchViewModel:u}=t,h=[],C={directionModePicker:c.directionModePicker,labelsToggle:c.labelsToggle,tooltipsToggle:c.tooltipsToggle};Object.values(C).includes(!0)&&h.push(i(s,{sketchOptions:g,view:m,visibleElements:new n(C)})),c.snappingControls&&h.push(i(o,{afterCreate:t=>t.layerListOpen=!1,snappingManager:d,snappingOptions:l,view:m,visibleElements:c.snappingControlsElements??new r}));const f=u?.settingsManager;return f?.hasSettings&&h.push(i(e,{settingsManager:f})),0===h.length?null:i("calcite-accordion",{appearance:"transparent",class:p.settingsContainer,key:"settings"},i("calcite-accordion-item",{"data-testid":"settings",heading:a.settings,iconStart:"gear"},h))}export{c as Settings,p as css,a as loadSettingsComponents};