@arcgis/core 5.2.0-next.120 → 5.2.0-next.122

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 (534) hide show
  1. package/Ground.js +1 -1
  2. package/arcade/containerUtils.js +1 -1
  3. package/arcade/functions/feature.js +1 -1
  4. package/arcade/functions/featuresetstring.js +1 -1
  5. package/arcade/languageUtils.js +1 -1
  6. package/arcgisGlobal.d.ts +9 -0
  7. package/assets/components/assets/icon/addCellAbove16.json +1 -0
  8. package/assets/components/assets/icon/addCellAbove24.json +1 -0
  9. package/assets/components/assets/icon/addCellAbove32.json +1 -0
  10. package/assets/components/assets/icon/addCellBelow16.json +1 -0
  11. package/assets/components/assets/icon/addCellBelow24.json +1 -0
  12. package/assets/components/assets/icon/addCellBelow32.json +1 -0
  13. package/assets/components/assets/icon/linkedChart16.json +1 -0
  14. package/assets/components/assets/icon/linkedChart24.json +1 -0
  15. package/assets/components/assets/icon/linkedChart32.json +1 -0
  16. package/assets/components/assets/icon/polygonFromFeature16.json +1 -0
  17. package/assets/components/assets/icon/polygonFromFeature24.json +1 -0
  18. package/assets/components/assets/icon/polygonFromFeature32.json +1 -0
  19. package/assets/esri/core/workers/RemoteClient.js +1 -1
  20. package/assets/esri/core/workers/chunks/0148cb611bf7c8c5fe8a.js +1 -0
  21. package/assets/esri/core/workers/chunks/025da54eef112d7e8f66.js +1 -0
  22. package/assets/esri/core/workers/chunks/033debcbf6b3683dc4fe.js +2 -0
  23. package/assets/esri/core/workers/chunks/064445e6f9512817ac87.js +2 -0
  24. package/assets/esri/core/workers/chunks/{304462b049116f59accc.js → 09676cfa99b90fe0cc63.js} +1 -1
  25. package/assets/esri/core/workers/chunks/0aadee0437fa061e4ff5.js +1 -0
  26. package/assets/esri/core/workers/chunks/{deb5b1d772ca407654d4.js → 0acc754907395e83bbc6.js} +1 -1
  27. package/assets/esri/core/workers/chunks/1302bf9718747cd9fdd9.js +1 -0
  28. package/assets/esri/core/workers/chunks/{956432c9d45940983bc2.js → 1b42d163ef22e3565bb7.js} +1 -1
  29. package/assets/esri/core/workers/chunks/1b551ef3d84d9c1e93f9.js +1 -0
  30. package/assets/esri/core/workers/chunks/1c38ce72160d5a4e4b3d.js +1 -0
  31. package/assets/esri/core/workers/chunks/1c3b087fbf2d102376fc.js +1 -0
  32. package/assets/esri/core/workers/chunks/{e18b8646c7378213b618.js → 1e46703cb566c25458ad.js} +1 -1
  33. package/assets/esri/core/workers/chunks/1f135269aea3931e11b2.js +1 -0
  34. package/assets/esri/core/workers/chunks/{ea9e770efc85594e4dd2.js → 216d8cb86548e92a8196.js} +1 -1
  35. package/assets/esri/core/workers/chunks/23279303cd7698314c56.js +1 -0
  36. package/assets/esri/core/workers/chunks/{4bf2cc4d092601ff2b86.js → 24673aac70d6c949b6fa.js} +1 -1
  37. package/assets/esri/core/workers/chunks/24cf91aeab53a897e951.js +1 -0
  38. package/assets/esri/core/workers/chunks/26bc509a031788bfa678.js +1 -0
  39. package/assets/esri/core/workers/chunks/{d629708bf23da24ee523.js → 298f234f11a10c5120a2.js} +1 -1
  40. package/assets/esri/core/workers/chunks/29ae19206bbeb480be0f.js +1 -0
  41. package/assets/esri/core/workers/chunks/2ae6deade655fdbc28de.js +1 -0
  42. package/assets/esri/core/workers/chunks/{37cf4ca2083cd3b6002e.js → 2c7bb5c9751524687002.js} +1 -1
  43. package/assets/esri/core/workers/chunks/2c8957f9c7610805208c.js +1 -0
  44. package/assets/esri/core/workers/chunks/{dc1944a7601b518a9c48.js → 2ca49fb4590cc34a02bd.js} +1 -1
  45. package/assets/esri/core/workers/chunks/2d592c935571de80a2e2.js +1 -0
  46. package/assets/esri/core/workers/chunks/{a917a1df8270860dc514.js → 2f52ad525744b8793d49.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{f890359d972cce54459e.js → 2f829321bfbd3bacd64f.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{6efc5873747b9cd44fb9.js → 323451ef52d0c2805f1d.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{7232fc11b23777b6be94.js → 369012c032ea6882607c.js} +1 -1
  50. package/assets/esri/core/workers/chunks/37ae52c71bf9c70fbb92.js +1 -0
  51. package/assets/esri/core/workers/chunks/38890ac5917942374ab8.js +1 -0
  52. package/assets/esri/core/workers/chunks/3e33d953e41b281a120b.js +1 -0
  53. package/assets/esri/core/workers/chunks/3e52351e06d85bf9bedd.js +1 -0
  54. package/assets/esri/core/workers/chunks/{9f760dc4492a03e0504c.js → 45d87af48a21644590c2.js} +1 -1
  55. package/assets/esri/core/workers/chunks/462fd57af8ed7921d6ba.js +1 -0
  56. package/assets/esri/core/workers/chunks/463d69f596d1d34ef275.js +2 -0
  57. package/assets/esri/core/workers/chunks/475906b079f4f1ddacf2.js +1 -0
  58. package/assets/esri/core/workers/chunks/48a2f68e06a2e90b77d0.js +1 -0
  59. package/assets/esri/core/workers/chunks/49affbed22e201f7c32b.js +1 -0
  60. package/assets/esri/core/workers/chunks/{b6ca73c1384f07b30b74.js → 4bb8432d99a39733368f.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{cb983f65995e57fff7a1.js → 4f58e0322707f63f5bf2.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{8f0ecf4d06ec7b67d4ed.js → 52744dfd430cd0c0edfb.js} +1 -1
  63. package/assets/esri/core/workers/chunks/58a17fb3c0dd07c63d57.js +2 -0
  64. package/assets/esri/core/workers/chunks/5993db944b9e7825e0bc.js +1 -0
  65. package/assets/esri/core/workers/chunks/{b0058619e0363002ad86.js → 59cd139712d919e6a738.js} +1 -1
  66. package/assets/esri/core/workers/chunks/59d5247ac4075b024244.js +1 -0
  67. package/assets/esri/core/workers/chunks/5b9f3c4f65412c66316f.js +1 -0
  68. package/assets/esri/core/workers/chunks/{be3421ffb5b391bca02e.js → 5d35e0c2665f5e625ee9.js} +1 -1
  69. package/assets/esri/core/workers/chunks/5e70bfb9d6235a87b87a.js +1 -0
  70. package/assets/esri/core/workers/chunks/6006bd8a5ed945fa2776.js +1 -0
  71. package/assets/esri/core/workers/chunks/618927cfcb93dd1d92fd.js +1 -0
  72. package/assets/esri/core/workers/chunks/6709d24867d275b33d24.js +1 -0
  73. package/assets/esri/core/workers/chunks/68e24fa3f564c2a5c9fd.js +1 -0
  74. package/assets/esri/core/workers/chunks/{6ab7bb3834841834f839.js → 724ea2e2843e6dac0a90.js} +1 -1
  75. package/assets/esri/core/workers/chunks/7441d121f00ce747c08e.js +1 -0
  76. package/assets/esri/core/workers/chunks/{090c9c2dbf92f2cac0b8.js → 770ca70d363184e39d60.js} +1 -1
  77. package/assets/esri/core/workers/chunks/781fa83e8063b8f685dc.js +1 -0
  78. package/assets/esri/core/workers/chunks/78c1b75b1a8937eaa3cd.js +1 -0
  79. package/assets/esri/core/workers/chunks/793b072519ded0dc6f34.js +1 -0
  80. package/assets/esri/core/workers/chunks/7994fce5f36963aadc51.js +1 -0
  81. package/assets/esri/core/workers/chunks/7adee504107cb9ad8563.js +1 -0
  82. package/assets/esri/core/workers/chunks/7efc45858ebd3fd3302e.js +1 -0
  83. package/assets/esri/core/workers/chunks/7ff536284942c5284a16.js +1 -0
  84. package/assets/esri/core/workers/chunks/813dd84933b407c8fe86.js +1 -0
  85. package/assets/esri/core/workers/chunks/83c7c4218bc6ba2f16ee.js +1 -0
  86. package/assets/esri/core/workers/chunks/8daeac785af725c3ebdf.js +1 -0
  87. package/assets/esri/core/workers/chunks/{3ab25279aaa30f035038.js → 8daed13400d9e63e65ae.js} +1 -1
  88. package/assets/esri/core/workers/chunks/9020bd7a0e488d55ef14.js +1 -0
  89. package/assets/esri/core/workers/chunks/92f35b2c3c5f13778308.js +1 -0
  90. package/assets/esri/core/workers/chunks/97cd4145c016cf379120.js +1 -0
  91. package/assets/esri/core/workers/chunks/{cf7c06702babd6fa88b4.js → 9af36ee6a0df224859bc.js} +1 -1
  92. package/assets/esri/core/workers/chunks/{452d069ba7ad6759b558.js → 9c46c7f00d42f5c02b26.js} +1 -1
  93. package/assets/esri/core/workers/chunks/{32fc7d1db4b311f6b880.js → 9e5b30b907102bc0c201.js} +1 -1
  94. package/assets/esri/core/workers/chunks/a3ab53b534e2872131be.js +1 -0
  95. package/assets/esri/core/workers/chunks/{f18ee2eaa96d103627a6.js → aa6b2cc8f6f5627891c1.js} +1 -1
  96. package/assets/esri/core/workers/chunks/ac7af417ebf7721d7400.js +1 -0
  97. package/assets/esri/core/workers/chunks/aed479c14d93955f4798.js +1 -0
  98. package/assets/esri/core/workers/chunks/{60c61f34733063730386.js → b013b70e40dfb6ce013e.js} +1 -1
  99. package/assets/esri/core/workers/chunks/b22de8bf4a4a739bc36d.js +1 -0
  100. package/assets/esri/core/workers/chunks/b39cd78d2d97bef9909e.js +1 -0
  101. package/assets/esri/core/workers/chunks/b5f50955c1eee55b67d1.js +1 -0
  102. package/assets/esri/core/workers/chunks/b688e6463a651779a016.js +1 -0
  103. package/assets/esri/core/workers/chunks/bb5ed2a796a45c41b0b4.js +1 -0
  104. package/assets/esri/core/workers/chunks/bdf012e591a8476db467.js +1 -0
  105. package/assets/esri/core/workers/chunks/{daf7b647bd960d8bad56.js → be52c319a0a81ce1ba36.js} +1 -1
  106. package/assets/esri/core/workers/chunks/{066b7f6866d602f963e0.js → c3008b20cb5fd38bd900.js} +1 -1
  107. package/assets/esri/core/workers/chunks/{22e85819e23202a8ba90.js → c39ebd8d469f1e8bb61e.js} +1 -1
  108. package/assets/esri/core/workers/chunks/{7f2ac03efaa4a4898ba2.js → c3b96d1d43afccd23e45.js} +2 -2
  109. package/assets/esri/core/workers/chunks/{89edaa1ffa566908ebca.js → ca5a4f62b09cc8579dc0.js} +1 -1
  110. package/assets/esri/core/workers/chunks/ce08e3369641da0d7a27.js +2 -0
  111. package/assets/esri/core/workers/chunks/ce1ccf9ec90b786591e5.js +1 -0
  112. package/assets/esri/core/workers/chunks/cf0bed7ae27021fd7b05.js +1 -0
  113. package/assets/esri/core/workers/chunks/cf6f671823fa6c2a9a5e.js +1 -0
  114. package/assets/esri/core/workers/chunks/d25210574168ead2f813.js +1 -0
  115. package/assets/esri/core/workers/chunks/d3378c479052d566317c.js +1 -0
  116. package/assets/esri/core/workers/chunks/{1742dbc6a827cfda471b.js → d3d48401462ef3bf0ad9.js} +1 -1
  117. package/assets/esri/core/workers/chunks/d3ef23923424ad8c5048.js +1 -0
  118. package/assets/esri/core/workers/chunks/{46388b86d1b10e6121bd.js → d507d7d7a7282fc38e8d.js} +1 -1
  119. package/assets/esri/core/workers/chunks/dc0816f064be576a2fa6.js +1 -0
  120. package/assets/esri/core/workers/chunks/{862e1acd80c4e43831dc.js → dc923e50958b68a50014.js} +1 -1
  121. package/assets/esri/core/workers/chunks/dd4ecf81250cc001d040.js +1 -0
  122. package/assets/esri/core/workers/chunks/e10fe4c77b8dc4492092.js +1 -0
  123. package/assets/esri/core/workers/chunks/e4e1db4e9e5f13167401.js +1 -0
  124. package/assets/esri/core/workers/chunks/e5ee64e2fb5bfcb716d8.js +1 -0
  125. package/assets/esri/core/workers/chunks/{e755075ac2e02e881fad.js → e6637f9176566382ed3e.js} +1 -1
  126. package/assets/esri/core/workers/chunks/e6dc68c4bd8eddb168d1.js +1 -0
  127. package/assets/esri/core/workers/chunks/eb780f2dafa14f776166.js +1 -0
  128. package/assets/esri/core/workers/chunks/{723478607badcde5706b.js → eb7f45736c852725b0bb.js} +150 -118
  129. package/assets/esri/core/workers/chunks/ed31ec586b754241474d.js +1 -0
  130. package/assets/esri/core/workers/chunks/f38d11be766043413659.js +1 -0
  131. package/assets/esri/core/workers/chunks/{98a5327fd96d9542b39f.js → f90cad9f007a11154c0d.js} +1 -1
  132. package/assets/esri/libs/pdfjs/pdf.worker.mjs +63075 -0
  133. package/assets/esri/libs/pdfjs/wasm/jbig2.wasm +0 -0
  134. package/assets/esri/libs/pdfjs/wasm/openjpeg.wasm +0 -0
  135. package/assets/esri/libs/pdfjs/wasm/qcms_bg.wasm +0 -0
  136. package/assets/esri/libs/pdfjs/wasm/quickjs-eval.wasm +0 -0
  137. package/assets/esri/themes/dark/main.css +1 -1
  138. package/assets/esri/themes/light/main.css +1 -1
  139. package/assets/esri/themes/light/view.css +1 -1
  140. package/assets/esri/widgets/support/SelectionToolbar/t9n/messages.en.json +1 -1
  141. package/basemaps/BasemapCollection.d.ts +148 -0
  142. package/basemaps/BasemapCollection.js +2 -0
  143. package/basemaps/BasemapsSource.d.ts +39 -0
  144. package/basemaps/BasemapsSource.js +2 -0
  145. package/basemaps/LocalBasemapsSource.d.ts +55 -0
  146. package/basemaps/LocalBasemapsSource.js +2 -0
  147. package/basemaps/PortalBasemapsSource.d.ts +98 -0
  148. package/basemaps/PortalBasemapsSource.js +2 -0
  149. package/basemaps/support/BasemapItem.d.ts +74 -0
  150. package/basemaps/support/BasemapItem.js +2 -0
  151. package/basemaps/support/basemapCompatibilityUtils.js +2 -0
  152. package/basemaps/types.d.ts +42 -0
  153. package/chunks/CheckerBoard.glsl.js +1 -1
  154. package/chunks/CloudsComposition.glsl.js +2 -2
  155. package/chunks/ColorMaterial.glsl.js +1 -1
  156. package/chunks/Component.glsl.js +11 -11
  157. package/chunks/DeepSky.glsl.js +1 -1
  158. package/chunks/DefaultMaterial.glsl.js +4 -4
  159. package/chunks/EdgeShader.glsl.js +1 -1
  160. package/chunks/FocusArea.glsl.js +1 -1
  161. package/chunks/GaussianSplat.glsl.js +9 -9
  162. package/chunks/GlobalIllumination.glsl.js +42 -13
  163. package/chunks/GlobalIlluminationBlur.glsl.js +1 -1
  164. package/chunks/HUDMaterial.glsl.js +1 -1
  165. package/chunks/ImageMaterial.glsl.js +1 -1
  166. package/chunks/LineCallout.glsl.js +1 -1
  167. package/chunks/LineMarker.glsl.js +97 -89
  168. package/chunks/NativeLine.glsl.js +1 -1
  169. package/chunks/Path.glsl.js +8 -7
  170. package/chunks/Pattern.glsl.js +1 -1
  171. package/chunks/PointRenderer.glsl.js +1 -1
  172. package/chunks/RealisticTree.glsl.js +4 -4
  173. package/chunks/RibbonLine.glsl.js +58 -56
  174. package/chunks/ShadowCastAccumulate.glsl.js +3 -3
  175. package/chunks/ShadowHighlight.glsl.js +4 -4
  176. package/chunks/ShadowHighlightBuffer.glsl.js +3 -3
  177. package/chunks/Terrain.glsl.js +12 -14
  178. package/chunks/Viewshed.glsl.js +1 -1
  179. package/chunks/Water.glsl.js +3 -3
  180. package/chunks/languageUtils.js +1 -1
  181. package/config.js +1 -1
  182. package/core/Accessor.d.ts +10 -0
  183. package/core/arrayUtils.js +1 -1
  184. package/core/workers/registry.js +1 -1
  185. package/geometry/support/geometryUtils.js +1 -1
  186. package/geometry/support/heightModelInfoUtils.js +1 -1
  187. package/geometry/support/meshUtils/elevation.js +1 -1
  188. package/kernel.js +1 -1
  189. package/layers/CSVLayer.js +1 -1
  190. package/layers/GeoJSONLayer.d.ts +1 -1
  191. package/layers/GeoJSONLayer.js +1 -1
  192. package/layers/GeospatialPDFLayer.d.ts +40 -0
  193. package/layers/GeospatialPDFLayer.js +2 -0
  194. package/layers/IntegratedMeshLayer.js +1 -1
  195. package/layers/OGCFeatureLayer.js +1 -1
  196. package/layers/StreamLayer.js +1 -1
  197. package/layers/geospatialPDF/GeospatialPDFFrame.js +2 -0
  198. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +5 -0
  199. package/layers/geospatialPDF/GeospatialPDFParserUtils.js +2 -0
  200. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +2 -0
  201. package/layers/geospatialPDF/LGIDictMapFrame.js +2 -0
  202. package/layers/geospatialPDF/Projection.js +2 -0
  203. package/layers/geospatialPDF/ViewportMeasureFrame.js +2 -0
  204. package/layers/geospatialPDF/renderExtentUtils.js +2 -0
  205. package/layers/geospatialPDF/sharedUtils.js +2 -0
  206. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  207. package/layers/mixins/ArcGISImageService.js +1 -1
  208. package/layers/mixins/FeatureLayerBase.js +1 -1
  209. package/layers/raster/datasets/GeospatialPDFRaster.js +2 -0
  210. package/layers/support/ElevationQuery.js +1 -1
  211. package/layers/support/LabelClass.d.ts +13 -4
  212. package/layers/support/LabelClass.js +1 -1
  213. package/layers/support/commonProperties.js +1 -1
  214. package/layers/support/layersLoader.js +1 -1
  215. package/layers/types.d.ts +1 -1
  216. package/legend/ActiveLayerInfo.d.ts +130 -0
  217. package/legend/ActiveLayerInfo.js +2 -0
  218. package/legend/LegendContent.d.ts +118 -0
  219. package/legend/LegendContent.js +2 -0
  220. package/legend/support/clusterUtils.js +2 -0
  221. package/legend/support/colorRampUtils.js +2 -0
  222. package/legend/support/heatmapRampUtils.js +2 -0
  223. package/legend/support/relationshipRampUtils.js +2 -0
  224. package/legend/support/sizeRampUtils.js +2 -0
  225. package/legend/support/utils.js +2 -0
  226. package/legend/types.d.ts +403 -0
  227. package/libs/i3s/I3SModule.js +1 -1
  228. package/package.json +7 -7
  229. package/portal/PortalItem.js +1 -1
  230. package/portal/support/portalLayers.js +1 -1
  231. package/support/revision.js +1 -1
  232. package/support/userTypeGuards/isBasemapsSource.js +2 -0
  233. package/symbols/cim/CIMOperators.js +1 -1
  234. package/symbols/cim/callouts/effects/BackgroundCallout.js +2 -0
  235. package/symbols/cim/callouts/effects/BalloonCallout.js +2 -0
  236. package/symbols/cim/callouts/effects/PointSymbolCallout.js +2 -0
  237. package/symbols/cim/callouts/effects/SimpleLineCallout.js +2 -0
  238. package/symbols/cim/callouts/effects/calloutUtils.js +2 -0
  239. package/symbols/cim/cimAnalyzer.js +1 -1
  240. package/symbols/cim/utils.js +1 -1
  241. package/symbols/support/typeUtils.js +1 -1
  242. package/views/2d/LabelManager.js +1 -1
  243. package/views/2d/engine/AFeatureContainer.js +1 -1
  244. package/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js +1 -1
  245. package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
  246. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  247. package/views/2d/engine/webgl/GlyphWorker.js +1 -1
  248. package/views/2d/engine/webgl/TileCpuState.js +1 -1
  249. package/views/2d/engine/webgl/TileGpuState.js +1 -1
  250. package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
  251. package/views/2d/engine/webgl/collisions/LabelStore.js +2 -0
  252. package/views/2d/engine/webgl/cpuMapped/CpuBuffer.js +1 -1
  253. package/views/2d/engine/webgl/cpuMapped/CpuMeshData.js +1 -1
  254. package/views/2d/engine/webgl/cpuMapped/GpuMeshState.js +1 -1
  255. package/views/2d/engine/webgl/definitions.js +1 -1
  256. package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
  257. package/views/2d/engine/webgl/mesh/MultiTileMeshData.js +1 -1
  258. package/views/2d/engine/webgl/mesh/factories/CalloutMeshWriterCoordinator.js +2 -0
  259. package/views/2d/engine/webgl/mesh/factories/FeatureMeshFactory.js +1 -1
  260. package/views/2d/engine/webgl/mesh/factories/MeshWriterGroupCoordinator.js +2 -0
  261. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  262. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  263. package/views/2d/engine/webgl/shaderGraph/graph/glsl.js +1 -1
  264. package/views/2d/engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js +1 -1
  265. package/views/2d/engine/webgl/shaderGraph/techniques/GraphicInstanceStore.js +1 -1
  266. package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueInstance.js +1 -1
  267. package/views/2d/engine/webgl/shaderGraph/techniques/TestDisplayObject.js +1 -1
  268. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedPolyShader.js +1 -1
  269. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
  270. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedFillShader.js +1 -1
  271. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerShader.js +1 -1
  272. package/views/2d/engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js +1 -1
  273. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPolygonShader.js +1 -1
  274. package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
  275. package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
  276. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js +1 -1
  277. package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js +1 -1
  278. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js +1 -1
  279. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  280. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
  281. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
  282. package/views/2d/engine/webgl/shaderGraph/techniques/markers/ComputedMarkerParams.js +1 -1
  283. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  284. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  285. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/CalloutMeshWriterPolicy.js +2 -0
  286. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
  287. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterReferences.js +2 -0
  288. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterVertexPack.js +1 -1
  289. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/dataViewUtils.js +1 -1
  290. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
  291. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
  292. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexFillShader.js +1 -1
  293. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/FillShader.js +1 -1
  294. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapAccumulateShader.js +1 -1
  295. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  296. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OutlineFillShader.js +1 -1
  297. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
  298. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  299. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  300. package/views/2d/engine/webgl/util/AnnotationMatcher.js +1 -1
  301. package/views/2d/engine/webgl/util/DimensionMatcher.js +1 -1
  302. package/views/2d/engine/webgl/util/IntervalMatcher.js +1 -1
  303. package/views/2d/engine/webgl/util/LabelMatcher.js +1 -1
  304. package/views/2d/engine/webgl/util/MapMatcher.js +1 -1
  305. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  306. package/views/2d/engine/webgl/util/MatcherContext.js +1 -1
  307. package/views/2d/input/MapViewInputManager.js +1 -1
  308. package/views/2d/input/handlers/KeyPan.js +1 -1
  309. package/views/2d/input/handlers/KeyRotate.js +1 -1
  310. package/views/2d/layerViewModuleImportUtils.js +1 -1
  311. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  312. package/views/2d/layers/GeospatialPDFLayerView2D.js +2 -0
  313. package/views/2d/layers/MediaLayerView2D.js +1 -1
  314. package/views/2d/layers/TileLayerView2D.js +1 -1
  315. package/views/2d/layers/features/FeatureContainer.js +1 -1
  316. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  317. package/views/2d/layers/features/RenderState.js +1 -1
  318. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  319. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  320. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  321. package/views/2d/layers/graphics/AGraphicContainer.js +1 -1
  322. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  323. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  324. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  325. package/views/2d/layers/support/annodime/MatcherGeometryOverride.js +1 -1
  326. package/views/2d/layers/support/annodime/PrivateMatcherGeometryOverrideEffect.js +1 -1
  327. package/views/2d/layers/support/annodime/annotationGraphic.js +1 -1
  328. package/views/2d/layers/support/annodime/cimAnnotations.js +1 -1
  329. package/views/2d/layers/support/annodime/debugUtils.js +1 -1
  330. package/views/2d/layers/support/annodime/virtualFields.js +1 -1
  331. package/views/2d/types.d.ts +2 -0
  332. package/views/3d/GroundView3D.js +1 -1
  333. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  334. package/views/3d/input/SceneInputManager.js +1 -1
  335. package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
  336. package/views/3d/input/handlers/ground/GroundDoubleClickMove.js +2 -0
  337. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  338. package/views/3d/layerViewModuleImportUtils.js +1 -1
  339. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  340. package/views/3d/layers/GeospatialPDFLayerView3D.js +2 -0
  341. package/views/3d/layers/I3SMeshView3D.js +1 -1
  342. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  343. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  344. package/views/3d/layers/LayerView3D.js +1 -1
  345. package/views/3d/layers/SceneLayerWorker.js +1 -1
  346. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  347. package/views/3d/layers/i3s/Intersector.js +1 -1
  348. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  349. package/views/3d/support/GroundAndIMSurface.js +1 -1
  350. package/views/3d/support/MemoryController.js +1 -1
  351. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  352. package/views/3d/support/hitTest.js +1 -1
  353. package/views/3d/terrain/isTerrainSurfaceLayer.js +1 -1
  354. package/views/3d/types.d.ts +2 -0
  355. package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
  356. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  357. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +1 -3
  358. package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +1 -1
  359. package/views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js +1 -1
  360. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +8 -8
  361. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +6 -6
  362. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +1 -1
  363. package/views/3d/webgl-engine/core/shaderLibrary/forwardLinearDepthToReadShadow.glsl.js +4 -0
  364. package/views/3d/webgl-engine/core/shaderLibrary/{ForwardLinearDepthToWriteShadowMap.glsl.js → forwardLinearDepthToWriteShadow.glsl.js} +5 -5
  365. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +8 -6
  366. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +2 -2
  367. package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +1 -1
  368. package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterDistortion.glsl.js +1 -1
  369. package/views/3d/webgl-engine/core/shaderLibrary/shading/calculateUVZShadow.glsl.js +3 -4
  370. package/views/3d/webgl-engine/core/shaderLibrary/shading/calculateUVZShadowFromDepth.glsl.js +2 -2
  371. package/views/3d/webgl-engine/core/shaderLibrary/shading/readFragmentShadow.glsl.js +5 -0
  372. package/views/3d/webgl-engine/core/shaderLibrary/shading/readShadow.glsl.js +24 -0
  373. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js +1 -1
  374. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +6 -6
  375. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  376. package/views/3d/webgl-engine/core/shaderLibrary/util/cameraUniforms.js +1 -1
  377. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
  378. package/views/3d/webgl-engine/effects/focusArea/FocusArea.js +1 -1
  379. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  380. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  381. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.glsl.js +1 -1
  382. package/views/3d/webgl-engine/effects/highlight/ShadowHighlightBuffer.glsl.js +1 -1
  383. package/views/3d/webgl-engine/effects/highlight/ShadowHighlightTechnique.js +1 -1
  384. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +1 -1
  385. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulate.glsl.js +1 -1
  386. package/views/3d/webgl-engine/lib/LineMaterial.js +1 -1
  387. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  388. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  389. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  390. package/views/3d/webgl-engine/materials/DrawParameters.js +1 -1
  391. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  392. package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
  393. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  394. package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
  395. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  396. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  397. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  398. package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +1 -1
  399. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  400. package/views/3d/webgl-engine/shaders/LineTechniqueConfiguration.js +1 -1
  401. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  402. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  403. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  404. package/views/3d/webgl-engine/shaders/ScreenSpacePassAtmosphere.glsl.js +1 -1
  405. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  406. package/views/3d/webgl-engine/shaders/{AnimatedLine.glsl.js → animatedAlpha.glsl.js} +11 -17
  407. package/views/SceneView.d.ts +31 -0
  408. package/views/SceneView.js +1 -1
  409. package/views/ToolViewManager.js +1 -1
  410. package/views/VideoView.js +1 -1
  411. package/views/View.d.ts +35 -0
  412. package/views/View.js +1 -1
  413. package/views/analysis/ElevationProfile/ElevationProfileLineGroundComputation.js +1 -1
  414. package/views/analysis/ElevationProfile/elevationProfileQuerySourceUtils.js +1 -1
  415. package/views/interactive/options/ViewOptions.d.ts +98 -0
  416. package/views/interactive/options/ViewOptions.js +2 -0
  417. package/views/interactive/support/Units.d.ts +10 -2
  418. package/views/interactive/support/Units.js +1 -1
  419. package/views/layers/FeatureLikeLayerView.d.ts +27 -5
  420. package/views/layers/GraphicsLayerView.d.ts +25 -2
  421. package/views/layers/ImageryTileLayerView.js +1 -1
  422. package/views/selection/types.d.ts +1 -1
  423. package/views/support/DefaultsFromMap.js +1 -1
  424. package/views/types.d.ts +9 -3
  425. package/widgets/BasemapGallery/BasemapGalleryViewModel.d.ts +3 -0
  426. package/widgets/BasemapGallery/support/BasemapGalleryItem.d.ts +3 -0
  427. package/widgets/BasemapGallery/support/LocalBasemapsSource.d.ts +2 -0
  428. package/widgets/BasemapGallery/support/PortalBasemapsSource.d.ts +2 -0
  429. package/widgets/BasemapGallery/types.d.ts +6 -1
  430. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +2 -0
  431. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  432. package/widgets/Editor/EditorViewModel.d.ts +2 -1
  433. package/widgets/Editor/EditorViewModel.js +1 -1
  434. package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
  435. package/widgets/Editor.d.ts +2 -1
  436. package/widgets/Editor.js +1 -1
  437. package/widgets/ElevationProfile/ElevationProfileLineGround.js +1 -1
  438. package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.d.ts +1 -0
  439. package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.js +1 -1
  440. package/widgets/HistogramRangeSlider.js +1 -1
  441. package/widgets/Legend/LegendViewModel.d.ts +1 -0
  442. package/widgets/Legend/LegendViewModel.js +1 -1
  443. package/widgets/Legend/styles/card/CardView.d.ts +1 -0
  444. package/widgets/Legend/styles/card/CardView.js +1 -1
  445. package/widgets/Legend/styles/classic/ClassicView.d.ts +1 -0
  446. package/widgets/Legend/styles/classic/ClassicView.js +1 -1
  447. package/widgets/Legend/support/ActiveLayerInfo.d.ts +2 -0
  448. package/widgets/Legend.js +1 -1
  449. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.d.ts +8 -2
  450. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  451. package/widgets/support/SelectionToolbar/VisibleElements.d.ts +8 -1
  452. package/widgets/support/SelectionToolbar/VisibleElements.js +1 -1
  453. package/widgets/support/SelectionToolbar.d.ts +7 -1
  454. package/widgets/support/SelectionToolbar.js +1 -1
  455. package/assets/esri/core/workers/chunks/01ca17092545d72be7b6.js +0 -1
  456. package/assets/esri/core/workers/chunks/03918a862455191a8910.js +0 -1
  457. package/assets/esri/core/workers/chunks/0b727d7bf3e36e146725.js +0 -1
  458. package/assets/esri/core/workers/chunks/0bd067a5c0bac96caeb5.js +0 -1
  459. package/assets/esri/core/workers/chunks/0ff13f7a18b0123d253e.js +0 -1
  460. package/assets/esri/core/workers/chunks/114bc14c49176f64a2c5.js +0 -1
  461. package/assets/esri/core/workers/chunks/1630913399384030d0b9.js +0 -1
  462. package/assets/esri/core/workers/chunks/173417fe995e9bfc49d8.js +0 -1
  463. package/assets/esri/core/workers/chunks/1a39335aa2dce6d564d9.js +0 -1
  464. package/assets/esri/core/workers/chunks/25bb07d3c32b16a08813.js +0 -1
  465. package/assets/esri/core/workers/chunks/25cc6d7178a52f2f46b7.js +0 -1
  466. package/assets/esri/core/workers/chunks/2cf571d968118b6bdde0.js +0 -1
  467. package/assets/esri/core/workers/chunks/2e999b05ce179dd9fa08.js +0 -1
  468. package/assets/esri/core/workers/chunks/354912041363502c6a89.js +0 -1
  469. package/assets/esri/core/workers/chunks/36792b8a85e88044cb49.js +0 -1
  470. package/assets/esri/core/workers/chunks/3acc1299c1382c3b034d.js +0 -1
  471. package/assets/esri/core/workers/chunks/430802108b63194b7ddd.js +0 -2
  472. package/assets/esri/core/workers/chunks/43436c7ccc6baefc885d.js +0 -1
  473. package/assets/esri/core/workers/chunks/4396ef5ab3eb9e9a7df2.js +0 -1
  474. package/assets/esri/core/workers/chunks/445b0ca1b70730c9a2e6.js +0 -1
  475. package/assets/esri/core/workers/chunks/48d3da636be15581fd7d.js +0 -1
  476. package/assets/esri/core/workers/chunks/49e8ff5ed079a9e3be4b.js +0 -1
  477. package/assets/esri/core/workers/chunks/4efe5827a5c61db3b19d.js +0 -2
  478. package/assets/esri/core/workers/chunks/501df20cdd09384f6ee2.js +0 -1
  479. package/assets/esri/core/workers/chunks/50ae209237f104735a30.js +0 -1
  480. package/assets/esri/core/workers/chunks/54f9062526c2002b7fd7.js +0 -1
  481. package/assets/esri/core/workers/chunks/56b7ac280bf0be938c14.js +0 -1
  482. package/assets/esri/core/workers/chunks/5938d5f6e37f49867d5a.js +0 -1
  483. package/assets/esri/core/workers/chunks/61bcbafd676804ce3e1d.js +0 -1
  484. package/assets/esri/core/workers/chunks/63f7141c71f29dbe8270.js +0 -1
  485. package/assets/esri/core/workers/chunks/70347d25968975126fa7.js +0 -1
  486. package/assets/esri/core/workers/chunks/726ca458b98bb4334431.js +0 -1
  487. package/assets/esri/core/workers/chunks/75410a4de76e67ed5da4.js +0 -1
  488. package/assets/esri/core/workers/chunks/85780f4fa4b5509f864e.js +0 -1
  489. package/assets/esri/core/workers/chunks/862754d2d659528fe884.js +0 -1
  490. package/assets/esri/core/workers/chunks/8628c027198982baed7c.js +0 -1
  491. package/assets/esri/core/workers/chunks/8675ab3c4dec2f13b9c6.js +0 -1
  492. package/assets/esri/core/workers/chunks/8c521caf050a486b6548.js +0 -1
  493. package/assets/esri/core/workers/chunks/8ce14dd209462f88b163.js +0 -1
  494. package/assets/esri/core/workers/chunks/917dec9c004218c58950.js +0 -1
  495. package/assets/esri/core/workers/chunks/91f451b98e0f696043df.js +0 -1
  496. package/assets/esri/core/workers/chunks/9d92e6f0beed9a8580fa.js +0 -1
  497. package/assets/esri/core/workers/chunks/a42505b978d54d36d3b6.js +0 -1
  498. package/assets/esri/core/workers/chunks/a6d4132a16c51323a38a.js +0 -1
  499. package/assets/esri/core/workers/chunks/a86a4e550a92f770d6d5.js +0 -1
  500. package/assets/esri/core/workers/chunks/add834f867900a7091d2.js +0 -1
  501. package/assets/esri/core/workers/chunks/b45ebb1b64ee7314375e.js +0 -1
  502. package/assets/esri/core/workers/chunks/b56c5883a5468b18b122.js +0 -1
  503. package/assets/esri/core/workers/chunks/b5a102cf9f4377fb9842.js +0 -1
  504. package/assets/esri/core/workers/chunks/b6409d89914030d5854a.js +0 -1
  505. package/assets/esri/core/workers/chunks/baa8bce361a2677533ec.js +0 -1
  506. package/assets/esri/core/workers/chunks/c118b88a7c4359e68d9b.js +0 -1
  507. package/assets/esri/core/workers/chunks/c5e288d57bacb8451e2d.js +0 -2
  508. package/assets/esri/core/workers/chunks/ce3fb992f6c6ae7378a3.js +0 -1
  509. package/assets/esri/core/workers/chunks/ceda1e08c9ff26248db0.js +0 -1
  510. package/assets/esri/core/workers/chunks/cf1106eda10f3cccb1bd.js +0 -1
  511. package/assets/esri/core/workers/chunks/cfd8317ecd2e63af7c40.js +0 -1
  512. package/assets/esri/core/workers/chunks/d5e3f8e5b8d2576d3cb3.js +0 -2
  513. package/assets/esri/core/workers/chunks/d6130cd8a20d24dd9d3c.js +0 -1
  514. package/assets/esri/core/workers/chunks/da5b3421a984cb94fd58.js +0 -1
  515. package/assets/esri/core/workers/chunks/da6583e8d88441a1c02a.js +0 -1
  516. package/assets/esri/core/workers/chunks/ddb5d29a8998d0a76fd4.js +0 -1
  517. package/assets/esri/core/workers/chunks/de8a3a0796bd115426c0.js +0 -1
  518. package/assets/esri/core/workers/chunks/e52f30dfb7c82491a7f2.js +0 -1
  519. package/assets/esri/core/workers/chunks/e707534a700a2de687ca.js +0 -1
  520. package/assets/esri/core/workers/chunks/e88eee4c2fc4229c2a8b.js +0 -1
  521. package/assets/esri/core/workers/chunks/f465fb26541372fdc908.js +0 -2
  522. package/assets/esri/core/workers/chunks/f5423006fb07db7dd6ee.js +0 -1
  523. package/assets/esri/core/workers/chunks/f75e57d3e02f9828b049.js +0 -1
  524. package/assets/esri/core/workers/chunks/f774e5b94710ccee1af0.js +0 -1
  525. package/assets/esri/core/workers/chunks/fdad31bbe8aee68a6eaf.js +0 -1
  526. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepthToReadShadowMap.glsl.js +0 -4
  527. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +0 -18
  528. package/views/3d/webgl-engine/core/shaderLibrary/shading/ShadowmapFiltering.glsl.js +0 -4
  529. /package/assets/esri/core/workers/chunks/{430802108b63194b7ddd.js.LICENSE.txt → 033debcbf6b3683dc4fe.js.LICENSE.txt} +0 -0
  530. /package/assets/esri/core/workers/chunks/{4efe5827a5c61db3b19d.js.LICENSE.txt → 064445e6f9512817ac87.js.LICENSE.txt} +0 -0
  531. /package/assets/esri/core/workers/chunks/{c5e288d57bacb8451e2d.js.LICENSE.txt → 463d69f596d1d34ef275.js.LICENSE.txt} +0 -0
  532. /package/assets/esri/core/workers/chunks/{d5e3f8e5b8d2576d3cb3.js.LICENSE.txt → 58a17fb3c0dd07c63d57.js.LICENSE.txt} +0 -0
  533. /package/assets/esri/core/workers/chunks/{7f2ac03efaa4a4898ba2.js.LICENSE.txt → c3b96d1d43afccd23e45.js.LICENSE.txt} +0 -0
  534. /package/assets/esri/core/workers/chunks/{f465fb26541372fdc908.js.LICENSE.txt → ce08e3369641da0d7a27.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{deprecatedFunction as a}from"../../core/deprecate.js";import r from"../../core/Error.js";import{EventedAccessor as s}from"../../core/Evented.js";import{abortHandle as n,makeHandle as l}from"../../core/handleUtils.js";import"../../core/has.js";import c from"../../core/Logger.js";import{destroyMaybe as d,abortMaybe as p,removeMaybe as h}from"../../core/maybe.js";import{throwIfAborted as u}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{watch as f,syncAndInitial as m,initial as y,on as g,when as k,sync as v,whenOnce as _}from"../../core/reactiveUtils.js";import{property as M,subclass as W}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as b}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as T}from"../../editing/templateUtils.js";import{getGraphicLayer as F}from"../../graphic/graphicOriginUtils.js";import S from"../../layers/GraphicsLayer.js";import{isEditableLayer as V}from"../../layers/support/editableLayers.js";import{isFeatureLayer as A,isSubtypeGroupLayer as E,getOwningPortalUrl as I}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as L}from"../../portal/support/urlUtils.js";import C from"../../views/SelectionManager.js";import{fetchFullFeaturesByObjectId as U}from"../../views/draw/support/editingSessionUtils.js";import O from"../../views/interactive/sketch/SketchLabelOptions.js";import j from"../../views/interactive/sketch/SketchOptions.js";import P from"../../views/interactive/sketch/SketchTooltipOptions.js";import R from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as H}from"../../views/interactive/snapping/SnappingManager.js";import q from"../../views/interactive/snapping/SnappingOptions.js";import{isSelectableLayer as x}from"../../views/support/selectionUtils.js";import G from"../Attachments/AttachmentsViewModel.js";import{isNextOrLegacyCreateFeaturesWorkflow as D,isNextOrLegacyUpdateRecordWorkflow as B,isNextOrLegacyUpdateFeaturesWorkflow as N,isNextOrLegacyMergeFeaturesWorkflow as Q,isNextOrLegacySplitFeatureWorkflow as z,isNextOrLegacyUpdateWorkflow as Z,isLegacyFeatureFormViewModel as $}from"./compatibilityAdapters.js";import J from"./CreateFeaturesWorkflow.js";import K from"./UpdateWorkflow.js";import{getLayersFromWorkflow as X,isBatchAttributeFormViewModel as Y,findEditorItemForLayerOrThrow as ee,toFeatureInfos as te,fetchFullFeatures as ie,findEditorItemForLayer as oe,whenEditorLayerView as ae}from"./workflowUtils.js";import re from"./legacy/CreateFeaturesWorkflow.js";import se from"./legacy/UpdateWorkflow.js";import ne from"./support/EditorItem.js";import{assertViewNot3D as le,MultipleSourceLayersError as ce,InsufficientFeatureCountError as de,MissingOriginLayerError as pe,assertMergeWorkflowCapabilities as he,FetchFullFeatureError as ue,assertSplitWorkflowCapabilities as we}from"./support/errors.js";import{makeTemplateGroupInfoForLayer as fe}from"../FeatureTemplates/featureTemplatesUtils.js";import me from"../FeatureTemplates/FeatureTemplatesViewModel.js";import ye from"../Sketch/SketchViewModel.js";import ge from"../Spinner/SpinnerViewModel.js";import{goTo as ke}from"../support/goToUtils.js";import{isFeatureItem as ve,isLayerItem as _e}from"../support/SelectionList/selectionListUtils.js";import Me from"../support/SelectionList/SelectionListViewModel.js";import We from"../support/SelectionToolbar/SelectionToolbarViewModel.js";function be(e,t){return e?.find(e=>e.layer===t)}let Te=class extends s{constructor(e){super(e),this._defaultSelectionManager=new C,this._queuedSelectionTool=null,this._sketchEventListenerHandle=null,this._sketchGraphicsLayer=new S({listMode:"hide",internal:!0,title:"Editor sketch layer"}),this._snappingManager=null,this._templatesByLayer=new Map,this._updateItemsTask=null,this._updateTemplatesTask=null,this._updatingHandles=new b,this._featureTemplatesViewModelIsRestricted=!1,this.activeWorkflow=null,this._activityQueue=new o,this.editorItems=new o,this.editorItemsLayerMap=new w,this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new G({capabilities:{editing:!0}}),this.featureTemplatesViewModel=new me({disabledItemFunction:({layer:e})=>this._itemIsSuspended(e)}),this.layerInfos=null,this.ownSketchViewModel=new ye({layer:this._sketchGraphicsLayer,useLegacyCreateTools:this._get("useLegacyCreateTools")??!0}),this.selectionListViewModel=new Me,this.selectionManager=null,this.selectionToolbarViewModel=new We({continuousSelectionEnabled:!0,defaultOperationType:"replace",persistSelection:!1,returnGeometry:!1}),this.sketchOptions=new j,this.snappingOptions=new q({attributeRulesEnabled:!0}),this.spinnerViewModel=new ge,this.syncViewSelection=!1,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this.showConfirmationPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.formSystem="legacy",this.back=async()=>{if("viewing-selection-list"===this.state)return this.selectionListViewModel.filterText=void 0,void this.effectiveSelectionManager.clear();this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>await(this.activeWorkflow?.save(this.showConfirmationPrompt)),this.selectFeature=(e,t=!1)=>{const i=this.activeWorkflow;if(this._candidateCommitted||"update"!==i?.type)return;const{rootFeatures:o}=i.data;o.removeAll(),e&&o.add(e),t&&(i.next(),this._candidateCommitted=!0)}}initialize(){this.addHandles([f(()=>{const e=this.view,t=e?.map?.editableLayers.toArray(),i=e?.allLayerViews,o=i?.filter(e=>!!t?.includes(e.layer));return[t,o,this.layerInfos]},()=>this._updateEditorItems(),m),f(()=>this.hideTemplatesForInactiveLayers,()=>this.syncFeatureTemplates()),f(()=>this._selectionSources,()=>this._syncSelectionSources(),y),g(()=>this.activeWorkflow,"cancel",()=>this.emit("workflow-cancel")),g(()=>this.activeWorkflow,"commit",()=>this.emit("workflow-commit")),g(()=>this.activeWorkflow,"complete",()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)}),k(()=>!this.activeWorkflow&&this._queuedSelectionTool,()=>this._queuedSelectionTool&&this.selectionToolbarViewModel.activateTool(this._queuedSelectionTool)),f(()=>this.activeWorkflow,e=>this._defaultSelectionManager.highlightEnabled=!e),k(()=>this.view?.map,e=>e.add(this._sketchGraphicsLayer),y),g(()=>this.editorItems,"change",()=>this._afterEditorItemsChange()),f(()=>[this.canCreate,this.canUpdateVisible],()=>this._afterEditorItemsChange()),f(()=>this.page,(e,t)=>{const i=[...this.pageStack];if(-1===i.indexOf(e))i.push(e);else for(;i.length&&i.at(-1)!==e;)i.pop();this.pageStack=i},m),k(()=>"awaiting-update-feature-candidate"===this.state,()=>this._candidateCommitted=!1),g(()=>this.featureTemplatesViewModel,"select",async({item:e,oldItem:t})=>{const{activeWorkflow:i}=this;if(i){if("update"===i.type&&"awaiting-feature-creation-info"===i.activeWorkflow?.stepId)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return void this.featureTemplatesViewModel.select(t,{emit:!1})}}if(!e)return;const o={layer:e.layer,template:e.template};if(e.supportsUpload)return this.featureTemplatesViewModel.select(t,{emit:!1}),this.startCreateFeaturesWorkflow(o);await this.startCreateFeaturesWorkflowAtFeatureCreation(o)}),f(()=>[this.view,this.featureTemplatesViewModel],([e,t])=>{t.view=e},m),g(()=>this.view,"key-down",e=>{"Escape"===e.key&&this.activeWorkflow?.keyboardCancellationEnabled&&(e.stopPropagation(),this.back())}),g(()=>this.sketchViewModel,["create","delete","update"],e=>{const{activeWorkflow:t}=this,i=X(t),o=`sketch-${e.type}`;this.emit(o,{type:o,detail:e,layer:i[0],layers:i})},v),f(()=>this.view,e=>{if(this._snappingManager=d(this._snappingManager),!e)return;const t=this.snappingOptions;this._snappingManager=new H({view:e,options:t}),this.ownSketchViewModel.snappingManager=this._snappingManager},m),f(()=>this.snappingOptions,e=>{this._snappingManager&&(this._snappingManager.options=e)},m),g(()=>this.selectionToolbarViewModel,"complete",e=>this._onSelectionComplete(e)),f(()=>({view:this.view,selectionManager:this.effectiveSelectionManager,selectionListViewModel:this.selectionListViewModel,selectionToolbarViewModel:this.selectionToolbarViewModel}),({view:e,selectionManager:t,selectionListViewModel:i,selectionToolbarViewModel:o})=>{t.view=e,i.view=e,o.view=e},m),f(()=>this.effectiveSelectionManager,e=>{this.selectionListViewModel.selectionManager=e,this.selectionToolbarViewModel.selectionManager=e},m)])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then(()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null}),this._updateItemsTask=p(this._updateItemsTask),this._updatingHandles.destroy(),this._sketchEventListenerHandle=h(this._sketchEventListenerHandle),this.selectionListViewModel?.destroy(),this.selectionToolbarViewModel?.destroy(),this._defaultSelectionManager.destroy()}get _featureTemplatesLayersAndTables(){const e=new o;for(const t of this.editorItems){const i=this.hideTemplatesForInactiveLayers&&!t.visible;t.supportsCreateFeaturesWorkflow&&!i&&e.push(t.layer)}return e}get _selectionSources(){const e=new o;if(this.syncViewSelection||this.selectionManager)return e;for(const t of this.editorItems)x(t.layer)&&t.supportsUpdateWorkflow&&e.push(t.layer);return e}get activeFeatureCount(){const e=this.activeLeafWorkflow;return D(e)?e.pendingFeatures.length:B(e)&&e.data.edits.feature?1:N(e)?e.data.fullFeatures.length:Q(e)?e.data.features.length:z(e)?2:0}get activeLeafWorkflow(){const e=this.activeWorkflow;return e&&Z(e)?e.activeWorkflow??e:e}get canCreate(){return this.editorItems.some(e=>e.supportsCreateFeaturesWorkflow)}get canCreateVisible(){return!!this.featureTemplatesLayers.length}get canUpdate(){return this.editorItems.some(e=>e.supportsUpdateWorkflow)}get canUpdateVisible(){return this.editorItems.some(e=>e.supportsUpdateWorkflow&&e.visible)}get featureTemplatesLayers(){return this._featureTemplatesLayersAndTables.filter(e=>"scene"===e.type||!e.isTable)}get effectiveSelectionManager(){const e=this.view;return e&&this.syncViewSelection?e.selectionManager:this.selectionManager??this._defaultSelectionManager}get featureFormViewModel(){const e=this.activeWorkflow?.formViewModel;return $(e)?e:null}get formViewModel(){return this.activeWorkflow?.formViewModel}get utilityNetworkAssociationAddAssociationViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeUtilityNetworkAssociationAddAssociationViewModel:null}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get useLegacyCreateTools(){return this.ownSketchViewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.ownSketchViewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||"2d"!==this.view?.type}get sketchViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeSketchViewModel:"create-features"===e?.type?e.sketchViewModel:this.ownSketchViewModel}get state(){if(!this.view?.ready)return"disabled";const e=this.attachmentsViewModel.mode;if("add"===e)return"adding-attachment";if("edit"===e)return"editing-attachment";const{activeWorkflow:t}=this,i=!t?.stepId;return this.effectiveSelectionManager.count&&i?"viewing-selection-list":i?"ready":"update"===t.type&&t.activeWorkflow?.stepId?t.activeWorkflow.stepId:t.stepId}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}set view(e){this.ownSketchViewModel.view=e,this.spinnerViewModel.view=e,this._set("view",e)}get canZoomTo(){return this._getWorkingFeatures().some(e=>e.geometry)}get page(){const{activeWorkflow:e,state:t}=this;if(Y(e?.formViewModel)){if("update"===e?.type&&e.formViewModel?.activeAssociationsInput)return e.formViewModel.activeAssociationsInput.associatedLayer?"viewing-associated-features":"viewing-associated-layers"}else if("update"===e?.type&&e.formViewModel){const{associatedLayer:t,associationId:i}=e.formViewModel;if(t||null!=i)return"viewing-associated-features"}if("update"===e?.type&&"awaiting-feature-to-update"===e.stepId)return"ready";if("create-features"===e?.type&&0===e.numPendingFeatures){const t=e.data.upload;if(t)return"default"===t.state?"ready":"creating-features-upload-details"}return t??"disabled"}get formDisabled(){const{activeLeafWorkflow:e}=this;if(B(e)){const t=e.formViewModel,i=!$(t)&&t.readOnly;return!1===e.data.editorItem?.capabilities.update.attributes||!0===t.disabled||i}if(N(e)){const{formViewModel:t}=e;return t.disabled||t.readOnly}return!1}get featureFormDisabled(){const{activeLeafWorkflow:e}=this;if(B(e))return!1===e.data.editorItem?.capabilities.update.attributes||!0===e.formViewModel.disabled;if(N(e)){const{formViewModel:t}=e;return t.disabled||t.readOnly}return!1}get featureFormHasAssociation(){return!!this.featureFormViewModel?.activeAssociation}get formHasAssociation(){return!!this.formViewModel?.activeAssociation}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeLeafWorkflow:e}=this;if(B(e)){const{data:t}=e;return t.editorItem?.capabilities.delete.enabled&&!t.readOnly}return!!N(e)&&e.data.editorItems.every(e=>e.capabilities.delete.enabled)}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}get snappingManager(){return this._snappingManager}activateSelectionTool(e){return this.selectionToolbarViewModel.activateTool(e)}cancelSelectionTool(){this.selectionToolbarViewModel.cancel()}getTemplatesForLayer(e){return this._templatesByLayer.get(e)??[]}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateFeaturesWorkflowAtFeatureCreation(e){return this.startCreateFeaturesWorkflow(e,"creating-features")}async startCreateFeaturesWorkflow(e,t="awaiting-feature-creation-info"){if(await _(()=>!this.updating),!this.canCreate)throw new r("editing:unsupported-workflow","Creating features is unsupported or disabled.");const i=this._createUpdatingResolver();try{await this._cancelWorkflow();const i=this._createCreateFeaturesWorkflow(e,t);this._set("activeWorkflow",i),await i.start()}catch(o){this._logErrorAndCancelWorkflow(o)}finally{i.resolve()}}async startCreateFeaturesWorkflowAtFeatureEdit(e){await _(()=>!this.updating);const t=this._createUpdatingResolver();try{const{initialFeature:t}=e,i=t.sourceLayer=t.layer,o=i?ee(this.editorItems,i):void 0;if(!o?.supportsCreateFeaturesWorkflow)throw new r("editing:unsupported-workflow","Creating features is unsupported or disabled for this layer.");await this._cancelWorkflow();const a=this._createCreateFeaturesWorkflow({initialFeature:t,layer:o.layer,maxFeatures:1},"creating-features");this._set("activeWorkflow",a),await a.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startMergeFeaturesWorkflow(e,t={}){await _(()=>!this.updating),le(this,"merge-features");const i=Array.isArray(e)?te(e):[e];if(i.length>1)throw new ce;if(0===i.length||i[0].objectIds.length<2)throw new de(2);const a=i[0],r=a.layer;if(!r)throw new pe;const s=ee(this.editorItems,r);he(s);const l=this._createUpdatingResolver(),c=new AbortController;this.addHandles(n(c));try{await this._cancelWorkflow(),this.cancelSelectionTool();const e=await U(a.objectIds,r,this.view?.spatialReference,c.signal);if(e.length!==a.objectIds.length)throw new ue;let i;if(t.keyFeature){const o=t.keyFeature.getObjectId();i=e.find(e=>e.getObjectId()===o)??t.keyFeature}const s=this._createUpdateWorkflow("editing-existing-feature",{rootFeatures:new o(e),rootWorkflowOptions:{type:"merge",props:{...t,keyFeature:i}}});this._set("activeWorkflow",s),this.addHandles(this._destroyWorkflowOnCommit(s)),await s.start()}catch(d){this._logErrorAndCancelWorkflow(d)}finally{l.resolve()}}async startSplitFeatureWorkflow(e,t={}){await _(()=>!this.updating),le(this,"split-feature");const i=F(e);if(!i)throw new pe;const a=ee(this.editorItems,i);we(a);const r=this._createUpdatingResolver(),s=new AbortController;this.addHandles(n(s));try{await this._cancelWorkflow(),this.cancelSelectionTool();const a=await ie([e],i,this.view?.spatialReference,s.signal);if(1!==a.length)throw new ue;const r=this._createUpdateWorkflow("editing-existing-feature",{rootFeatures:new o(a),rootWorkflowOptions:{type:"split",props:t}});this._set("activeWorkflow",r),this.addHandles(this._destroyWorkflowOnCommit(r)),await r.start()}catch(l){this._logErrorAndCancelWorkflow(l)}finally{r.resolve()}}async startUpdateFeaturesWorkflow(e){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update features workflow is unsupported or disabled.");const t=Array.isArray(e)?te(e):[e];if(t.length>1)throw new ce;const i=this._createUpdatingResolver();try{await this._cancelWorkflow(),this.cancelSelectionTool();const e=this._createUpdateWorkflow("editing-existing-feature",{rootFeatureInfos:t,rootWorkflowOptions:{type:"update-multiple"}});e.addHandles(this._destroyWorkflowOnCommit(e)),this._set("activeWorkflow",e),await e.start()}catch(o){this._logErrorAndCancelWorkflow(o)}finally{i.resolve()}}async startUpdateWorkflowAtFeatureSelection(){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow();this._set("activeWorkflow",e),await e.start()}catch(t){this._logErrorAndCancelWorkflow(t)}finally{e.resolve()}}async startUpdateWorkflowAtMultipleFeatureSelection(e){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateWorkflow("awaiting-update-feature-candidate");t.data.candidates=e,this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowAtFeatureEdit(e){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow(),this.cancelSelectionTool();const t=this._createUpdateWorkflow("editing-existing-feature",{rootFeatures:new o([e])});t.addHandles(this._destroyWorkflowOnCommit(t)),this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowWithActiveSelection(){const{selectionListViewModel:e}=this;if(!e.visibleFeatureCount||!e.visibleLayerCount)throw new r("editing:missing-selection","Unable to determine visible selection.");if(e.visibleLayerCount>1)throw new r("editing:features-different-layers","Cannot start workflow with features from different layers.");const t=e.layerItems.find(e=>e.visible);t&&await this._startUpdateWorkflowWithLayerItem(t,"update")}async deleteFeatureFromWorkflow(){a(c.getLogger(this),"EditorViewModel.deleteFeatureFromWorkflow is deprecated. Use EditorViewModel.deleteFeatures instead.",{version:"4.33",replacement:"EditorViewModel.deleteFeatures",warnOnce:!0}),await this.deleteFeatures()}async deleteFeatures(){const e=this.activeWorkflow;if(Z(e))return e.deleteActiveFeatures();this._logError("editing:unsupported-workflow","Deleting features requires an active update workflow.")}async deleteAssociationFromWorkflow(){const{activeWorkflow:e}=this;e&&"update"===e.type?await e.deleteActiveAssociation():this._logError("editing:unsupported-workflow","Deleting an association requires an active update workflow.")}async cancelWorkflow(e){return this._cancelWorkflow({warnIfNoWorkflow:!0,...e})}itemHasInvalidFormTemplate(e){return null!=e&&!0===oe(this.editorItems,e.layer)?.hasInvalidFormTemplate}syncFeatureTemplates(){this._featureTemplatesViewModelIsRestricted||this._updateTemplates()}zoomTo(e){const{view:i,sketchViewModel:o}=this;if(!i)return;const a=void 0,r=e??o?.createGraphic;if(r)"mesh"===r.geometry?.type?ke(i,r.geometry,a):ke(i,r,a);else{const e=this._getWorkingFeatures();"3d"===i.type&&e?.some(e=>"mesh"===e.geometry?.type)?ke(i,e.map(e=>e.geometry).filter(t),a):e&&ke(i,e,a)}}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}async onSelectionListItemSelect(e){ve(e)&&await this.startUpdateWorkflowAtFeatureEdit(e.graphic)}async onSelectionListMenuItemSelect(e,t){ve(e)?await this.startUpdateWorkflowAtFeatureEdit(e.graphic):_e(e)&&await this._startUpdateWorkflowWithLayerItem(e,t)}restrictFeatureTemplatesViewModelToLayer(e){return this._featureTemplatesViewModelIsRestricted=!0,this._setFeatureTemplatesViewModelLayers([e]),l(()=>{this._featureTemplatesViewModelIsRestricted=!1,this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)})}async _getEditorItemCandidates(e){const{view:t}=this;if(!t?.map)return[];const{map:i}=t,o=i.editableLayers.toArray(),a=i.allTables.toArray().filter(e=>A(e)||E(e));return await Promise.allSettled([...o.flatMap(e=>this._getLayerLoadPromise(e)),...a.flatMap(e=>this._getLayerLoadPromise(e))]),u(e),[...o.reverse(),...a.reverse()].filter(e=>V(e)&&("mesh"!==e.geometryType||"3d"===t.type)).flatMap(e=>"subtype-group"===e.type?e.sublayers.toArray():e)}_getLayerLoadPromise(e){return E(e)?e.loadAll():e.load()}_drainEditorItems(){this.editorItems.drain(e=>e.destroy())}_updateEditorItems(){p(this._updateItemsTask);const{view:e}=this,t=i(async t=>{if(!e?.map||!e?.allLayerViews)return;const i=await this._getEditorItemCandidates(t);if(!i.length)return this._drainEditorItems(),void this.editorItemsLayerMap.clear();const o=[],a=[],r=[],{editorItemsLayerMap:s,layerInfos:n}=this;for(const c of i){const t=be(n,c),i=await ae(e,c).catch(()=>null),l=t?o:i?a:r,d=new ne({layer:c,layerInfo:t,layerView:i});l.push(d),s.set(c,d)}n?.length&&o.sort((e,t)=>n.findIndex(({layer:t})=>t===e.layer)-n.findIndex(({layer:e})=>e===t.layer));const l=[...o,...a,...r];t.aborted||(this._drainEditorItems(),this.editorItems.addMany(l))});this._updatingHandles.consumePromise(t.promise),this._updateItemsTask=t}_updateTemplates(){p(this._updateTemplatesTask);const e=i(async e=>{const t=this._templatesByLayer,i=this._featureTemplatesLayersAndTables.filter(e=>!t.has(e));if(i.length>0){const o=await T({layers:i.toArray(),view:this.view,signal:e,queryOptions:{returnVisibleTemplatesOnly:!0}});for(const{layer:e,templates:i}of o)t.set(e,i)}this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)});this._updatingHandles.consumePromise(e.promise),this._updateTemplatesTask=e}_setFeatureTemplatesViewModelLayers(e){const t=this._templatesByLayer,i=[];for(const o of e){const e=t.get(o);e&&e.length>0&&i.push(fe(o,e))}this.featureTemplatesViewModel.templateInfos=i}_afterEditorItemsChange(){const{activeWorkflow:e}=this;if(this.syncFeatureTemplates(),!e)return;const{stepId:t}=e;"create-features"!==e.type?"update"===e.type&&("awaiting-feature-to-update"===t&&!this.canUpdateVisible||"awaiting-update-feature-candidate"===t&&!e.hasUpdatableCandidates)&&this._cancelWorkflow():"awaiting-feature-creation-info"!==t||this.canCreate||this._cancelWorkflow()}async _cancelWorkflow(e){const t=this.activeWorkflow;if(!t)return void(e?.warnIfNoWorkflow&&this._logError("editing:no-active-workflow","There is no active workflow to cancel."));if(!e||!1!==e.force){this.emit("workflow-cancel"),this._set("activeWorkflow",null);try{await t.cancel(e)}finally{t.destroy()}}else try{await t.cancel(e),this._set("activeWorkflow",null),t.destroy()}catch(i){}}_createCreateFeaturesWorkflow(e,t){return"legacy"===this.formSystem?re.create({viewModel:this,creationInfo:e,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)}):J.create({viewModel:this,creationInfo:e,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)})}_createUpdateWorkflow(e,t){if("legacy"===this.formSystem)return se.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:e,...t,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)});const i=K.create({sketchOptions:this.sketchOptions,viewModel:this,snappingManager:this._snappingManager,startAt:e,...t,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t),applyAttachmentEdits:(e,t)=>this._editAttachments(e,t)});return i}async _editAttachments(e,i){const o=[];i.adds.forEach(t=>o.push(this._addAttachment(e,t))),i.updates.forEach(t=>o.push(this._updateAttachment(e,t))),i.deletes.forEach(t=>o.push(this._deleteAttachments(e,t)));return(await Promise.all(o)).filter(t).flat()}_addAttachments(e,t){return Promise.all(t.map(t=>this._addAttachment(e,t)))}async _addAttachment(e,t){let i=null;if(!("addAttachment"in e)||null==e.capabilities?.attachment)throw new r("editor:attachments-not-supported","Adding attachments is not supported for this layer.");const{feature:o,attachment:a,keywords:s}=t,n=s?{keywords:s}:void 0;return await this._queueOperation(async()=>(i=await(e.addAttachment?.(o,a,n).catch(e=>{throw e?.error||e}))??null,i)),i}async _updateAttachment(e,t){if(!("updateAttachment"in e)||!e.updateAttachment||null==e.capabilities?.attachment)throw new r("editor:attachments-not-supported","Updating attachments is not supported for this layer");const{feature:i,attachmentId:o,attachment:a}=t;let s=null;return await this._queueOperation(async()=>(s=await e.updateAttachment(i,o,a).catch(e=>{throw e?.error||e}),s)),s}async _deleteAttachments(e,t){if(!("deleteAttachments"in e)||!e.deleteAttachments||null==e.capabilities?.attachment)throw new r("editor:attachments-not-supported","Deleting attachments is not supported for this layer");const{feature:i,attachmentIds:o}=t;let a=null;return await this._queueOperation(async()=>(a=await e.deleteAttachments(i,o).catch(e=>{throw e?.error||e}),a)),a}async _applyEdits(e,t,i){let o=null;const a=e.url?await I(e.url):null,r={returnServiceEditsOption:(!a||!L(a))&&!/\/hosted\//i.test(e.url)?"original-and-current-features":void 0,editsRespectTrueCurves:!0,...i};return await this._queueOperation(async()=>{const{view:i}=this;if(!i)return null;const a=await ae(i,e).catch(()=>null);return o=await e.applyEdits(t,r),a&&await _(()=>!a.updating),o}),o}async _applyEditsFeatureService(e,t,i){let o=null;return await this._queueOperation(async()=>o=await e.applyEdits(t,i)),o}_destroyWorkflowOnCommit(e){return g(()=>e,"commit",()=>{e.destroy(),this.activeWorkflow===e&&this._set("activeWorkflow",null)})}_queueOperation(e){this._activityQueue.push(e);const t=(e,t)=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)};return e().then(e=>(Array.isArray(e)?e.forEach(e=>this._handleEditsResultError(e)):this._handleEditsResultError(e),e)).catch(i=>{this._logError("editing:operation-error","An error occurred.",{error:i});const o={error:i,retry:()=>(t(o,this.failures),this._queueOperation(e)),cancel:()=>{t(o,this.failures)}};this._set("failures",[...this.failures,o])}).then(()=>{t(e,this._activityQueue)})}_handleEditsResultError(e){if(null!=e&&"error"in e&&null!=e.error)throw e.error;if(null!=e&&"addFeatureResults"in e){const{addFeatureResults:t,deleteFeatureResults:i,updateFeatureResults:o}=e,a=t.find(e=>!!e.error)||o.find(e=>!!e.error)||i.find(e=>!!e.error);if(a)throw a.error}}_createUpdatingResolver(){const e=Promise.withResolvers();return this._updatingHandles.consumePromise(e.promise),e}_logErrorAndCancelWorkflow(e){const{name:t,message:i,details:o}=e;this._logError(t??"editing:workflow-start-failed",i??void 0,o??e),this._cancelWorkflow({force:!0})}_itemIsSuspended(e){const t=ee(this.editorItems,e);return null!=t&&(!t.visible||t.disabled)}_logError(e,t,i){c.getLogger(this).error(new r(e,t,i))}_syncSelectionSources(){this._defaultSelectionManager.sources.items=this._selectionSources.toArray()}async _onSelectionComplete(e){if(e.aborted)return;const{operationType:t,selection:i}=e,{effectiveSelectionManager:o}=this;this._queuedSelectionTool=void 0;const a=[],r=[];i.forEach(e=>{const t=F(e),i=this.editorItemsLayerMap.get(t);i?.editable&&r.push(e),!1!==i?.visible&&a.push(e)});const s=1===a.length&&r.includes(a[0]);if("ready"===this.state&&s&&"replace"===t)return this._queuedSelectionTool=e.toolName,this.startUpdateWorkflowAtFeatureEdit(a[0]);switch(t){case"remove":o.updateSelection({current:[],added:[],removed:a});break;case"replace":o.clear(),o.updateSelection({current:a,added:[],removed:[]});break;case"add":o.updateSelection({current:a,added:[],removed:[]})}}async _startUpdateWorkflowWithLayerItem(e,t){if(!e.objectIds?.length)return;const i=e.featureItems.filter(e=>e.visible).map(e=>e.graphic),o=this.selectionListViewModel.filterText;if(1===i.length)return await this.startUpdateWorkflowAtFeatureEdit(i[0]);let a;if(null!=o&&""!==o){const e=te(i);if(e.length>1)throw new ce;if(a=e[0],!a)throw new de("merge"===t?2:1)}else a={layer:e.layer,objectIds:e.objectIds};"update"===t?await this.startUpdateFeaturesWorkflow(a):"merge"===t&&await this.startMergeFeaturesWorkflow(a)}_getWorkingFeatures(){const{sketchViewModel:e}=this;if(e?.createGraphic)return[e.createGraphic];if(e?.updateGraphics?.length)return e.updateGraphics.toArray();const{formViewModel:i}=this;return i?$(i)?[i.feature].filter(t):i.activeFeature?[i.activeFeature]:i.features.toArray():[]}};e([M()],Te.prototype,"_defaultSelectionManager",void 0),e([M()],Te.prototype,"_featureTemplatesLayersAndTables",null),e([M()],Te.prototype,"_queuedSelectionTool",void 0),e([M()],Te.prototype,"_snappingManager",void 0),e([M()],Te.prototype,"_selectionSources",null),e([M()],Te.prototype,"activeFeatureCount",null),e([M({readOnly:!0})],Te.prototype,"activeWorkflow",void 0),e([M()],Te.prototype,"activeLeafWorkflow",null),e([M({readOnly:!0})],Te.prototype,"_activityQueue",void 0),e([M({readOnly:!0})],Te.prototype,"canCreate",null),e([M()],Te.prototype,"canCreateVisible",null),e([M({readOnly:!0})],Te.prototype,"canUpdate",null),e([M()],Te.prototype,"canUpdateVisible",null),e([M()],Te.prototype,"featureTemplatesLayers",null),e([M()],Te.prototype,"editorItems",void 0),e([M()],Te.prototype,"editorItemsLayerMap",void 0),e([M()],Te.prototype,"effectiveSelectionManager",null),e([M({readOnly:!0})],Te.prototype,"failures",void 0),e([M()],Te.prototype,"hideTemplatesForInactiveLayers",void 0),e([M({type:G})],Te.prototype,"attachmentsViewModel",void 0),e([M()],Te.prototype,"featureFormViewModel",null),e([M()],Te.prototype,"formViewModel",null),e([M()],Te.prototype,"utilityNetworkAssociationAddAssociationViewModel",null),e([M({type:me})],Te.prototype,"featureTemplatesViewModel",void 0),e([M({type:O})],Te.prototype,"labelOptions",null),e([M()],Te.prototype,"layerInfos",void 0),e([M()],Te.prototype,"useLegacyCreateTools",null),e([M()],Te.prototype,"isUsingLegacyCreateTools",null),e([M()],Te.prototype,"ownSketchViewModel",void 0),e([M()],Te.prototype,"selectionListViewModel",void 0),e([M()],Te.prototype,"selectionManager",void 0),e([M()],Te.prototype,"selectionToolbarViewModel",void 0),e([M()],Te.prototype,"sketchOptions",void 0),e([M()],Te.prototype,"sketchViewModel",null),e([M({type:q,nonNullable:!0})],Te.prototype,"snappingOptions",void 0),e([M()],Te.prototype,"spinnerViewModel",void 0),e([M()],Te.prototype,"state",null),e([M({readOnly:!0})],Te.prototype,"syncing",null),e([M()],Te.prototype,"syncViewSelection",void 0),e([M()],Te.prototype,"updating",null),e([M({type:P})],Te.prototype,"tooltipOptions",null),e([M({type:R})],Te.prototype,"valueOptions",null),e([M()],Te.prototype,"view",null),e([M()],Te.prototype,"canZoomTo",null),e([M()],Te.prototype,"pageStack",void 0),e([M()],Te.prototype,"showDiscardEditsPrompt",void 0),e([M()],Te.prototype,"showConfirmationPrompt",void 0),e([M()],Te.prototype,"_candidateCommitted",void 0),e([M()],Te.prototype,"page",null),e([M()],Te.prototype,"formDisabled",null),e([M()],Te.prototype,"featureFormDisabled",null),e([M()],Te.prototype,"featureFormHasAssociation",null),e([M()],Te.prototype,"formHasAssociation",null),e([M()],Te.prototype,"formSystem",void 0),e([M()],Te.prototype,"canGoBack",null),e([M()],Te.prototype,"shouldShowDeleteButton",null),e([M()],Te.prototype,"hasPendingEdits",null),e([M()],Te.prototype,"snappingManager",null),Te=e([W("esri.widgets.Editor.EditorViewModel")],Te);const Fe=Te;export{Fe as default};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{deprecatedFunction as o}from"../../core/deprecate.js";import r from"../../core/Error.js";import{EventedAccessor as s}from"../../core/Evented.js";import{abortHandle as n,makeHandle as l}from"../../core/handleUtils.js";import"../../core/has.js";import c from"../../core/Logger.js";import{destroyMaybe as d,abortMaybe as p,removeMaybe as h}from"../../core/maybe.js";import{throwIfAborted as u}from"../../core/promiseUtils.js";import f from"../../core/ReactiveMap.js";import{watch as w,syncAndInitial as m,initial as y,on as g,when as k,sync as v,whenOnce as _}from"../../core/reactiveUtils.js";import{property as M,subclass as W}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as b}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as T}from"../../editing/templateUtils.js";import{getGraphicLayer as F}from"../../graphic/graphicOriginUtils.js";import S from"../../layers/GraphicsLayer.js";import{isEditableLayer as V}from"../../layers/support/editableLayers.js";import{isFeatureLayer as A,isSubtypeGroupLayer as I,getOwningPortalUrl as E}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as L}from"../../portal/support/urlUtils.js";import C from"../../views/SelectionManager.js";import{fetchFullFeaturesByObjectId as U}from"../../views/draw/support/editingSessionUtils.js";import O from"../../views/interactive/sketch/SketchLabelOptions.js";import j from"../../views/interactive/sketch/SketchOptions.js";import P from"../../views/interactive/sketch/SketchTooltipOptions.js";import R from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as H}from"../../views/interactive/snapping/SnappingManager.js";import q from"../../views/interactive/snapping/SnappingOptions.js";import{isSelectableLayer as x}from"../../views/support/selectionUtils.js";import G from"../Attachments/AttachmentsViewModel.js";import{isNextOrLegacyCreateFeaturesWorkflow as D,isNextOrLegacyUpdateRecordWorkflow as B,isNextOrLegacyUpdateFeaturesWorkflow as N,isNextOrLegacyMergeFeaturesWorkflow as Q,isNextOrLegacySplitFeatureWorkflow as z,isNextOrLegacyUpdateWorkflow as Z,isLegacyFeatureFormViewModel as $}from"./compatibilityAdapters.js";import J from"./CreateFeaturesWorkflow.js";import K from"./UpdateWorkflow.js";import{getLayersFromWorkflow as X,isBatchAttributeFormViewModel as Y,findEditorItemForLayerOrThrow as ee,toFeatureInfos as te,fetchFullFeatures as ie,findEditorItemForLayer as ae,whenEditorLayerView as oe}from"./workflowUtils.js";import re from"./legacy/CreateFeaturesWorkflow.js";import se from"./legacy/UpdateWorkflow.js";import ne from"./support/EditorItem.js";import{assertViewNot3D as le,MultipleSourceLayersError as ce,InsufficientFeatureCountError as de,MissingOriginLayerError as pe,assertMergeWorkflowCapabilities as he,FetchFullFeatureError as ue,assertSplitWorkflowCapabilities as fe}from"./support/errors.js";import{makeTemplateGroupInfoForLayer as we}from"../FeatureTemplates/featureTemplatesUtils.js";import me from"../FeatureTemplates/FeatureTemplatesViewModel.js";import ye from"../Sketch/SketchViewModel.js";import ge from"../Spinner/SpinnerViewModel.js";import{goTo as ke}from"../support/goToUtils.js";import{isFeatureItem as ve,isLayerItem as _e}from"../support/SelectionList/selectionListUtils.js";import Me from"../support/SelectionList/SelectionListViewModel.js";import We from"../support/SelectionToolbar/SelectionToolbarViewModel.js";function be(e,t){return e?.find(e=>e.layer===t)}let Te=class extends s{constructor(e){super(e),this._defaultSelectionManager=new C,this._queuedSelectionTool=null,this._sketchEventListenerHandle=null,this._sketchGraphicsLayer=new S({listMode:"hide",internal:!0,title:"Editor sketch layer"}),this._snappingManager=null,this._templatesByLayer=new Map,this._updateItemsTask=null,this._updateTemplatesTask=null,this._updatingHandles=new b,this._featureTemplatesViewModelIsRestricted=!1,this.activeWorkflow=null,this._activityQueue=new a,this.editorItems=new a,this.editorItemsLayerMap=new f,this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new G({capabilities:{editing:!0}}),this.featureTemplatesViewModel=new me({disabledItemFunction:({layer:e})=>this._itemIsSuspended(e)}),this.layerInfos=null,this.ownSketchViewModel=new ye({layer:this._sketchGraphicsLayer,useLegacyCreateTools:this._get("useLegacyCreateTools")??!0}),this.selectionListViewModel=new Me,this.selectionManager=null,this.selectionToolbarViewModel=new We({continuousSelectionEnabled:!0,defaultOperationType:"replace",persistSelection:!1,returnGeometry:!1}),this.sketchOptions=new j,this.snappingOptions=new q({attributeRulesEnabled:!0}),this.spinnerViewModel=new ge,this.syncViewSelection=!1,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this.showConfirmationPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.formSystem="legacy",this.back=async()=>{if("viewing-selection-list"===this.state)return this.selectionListViewModel.filterText=void 0,void this.effectiveSelectionManager.clear();this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>await(this.activeWorkflow?.save(this.showConfirmationPrompt)),this.selectFeature=(e,t=!1)=>{const i=this.activeWorkflow;if(this._candidateCommitted||"update"!==i?.type)return;const{rootFeatures:a}=i.data;a.removeAll(),e&&a.add(e),t&&(i.next(),this._candidateCommitted=!0)}}initialize(){this.addHandles([w(()=>{const e=this.view,t=e?.map?.editableLayers.toArray(),i=e?.allLayerViews,a=i?.filter(e=>!!t?.includes(e.layer));return[t,a,this.layerInfos]},()=>this._updateEditorItems(),m),w(()=>this.hideTemplatesForInactiveLayers,()=>this.syncFeatureTemplates()),w(()=>this._selectionSources,()=>this._syncSelectionSources(),y),g(()=>this.activeWorkflow,"cancel",()=>this.emit("workflow-cancel")),g(()=>this.activeWorkflow,"commit",()=>this.emit("workflow-commit")),g(()=>this.activeWorkflow,"complete",()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)}),k(()=>!this.activeWorkflow&&this._queuedSelectionTool,()=>this._queuedSelectionTool&&this.selectionToolbarViewModel.activateTool(this._queuedSelectionTool)),w(()=>this.activeWorkflow,e=>this._defaultSelectionManager.highlightEnabled=!e),k(()=>this.view?.map,e=>e.add(this._sketchGraphicsLayer),y),g(()=>this.editorItems,"change",()=>this._afterEditorItemsChange()),w(()=>[this.canCreate,this.canUpdateVisible],()=>this._afterEditorItemsChange()),w(()=>this.page,(e,t)=>{const i=[...this.pageStack];if(-1===i.indexOf(e))i.push(e);else for(;i.length&&i.at(-1)!==e;)i.pop();this.pageStack=i},m),k(()=>"awaiting-update-feature-candidate"===this.state,()=>this._candidateCommitted=!1),g(()=>this.featureTemplatesViewModel,"select",async({item:e,oldItem:t})=>{const{activeWorkflow:i}=this;if(i){const e="update"===i.type&&"awaiting-feature-creation-info"===i.activeWorkflow?.stepId,a="create-features"===i.type&&"awaiting-feature-creation-info"===i.stepId&&i.data.creationInfo?.layer&&!i.data.creationInfo?.template;if(e||a)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return void this.featureTemplatesViewModel.select(t,{emit:!1})}}if(!e)return;const a={layer:e.layer,template:e.template};if(e.supportsUpload)return this.featureTemplatesViewModel.select(t,{emit:!1}),this.startCreateFeaturesWorkflow(a);await this.startCreateFeaturesWorkflowAtFeatureCreation(a)}),w(()=>[this.view,this.featureTemplatesViewModel],([e,t])=>{t.view=e},m),g(()=>this.view,"key-down",e=>{"Escape"===e.key&&this.activeWorkflow?.keyboardCancellationEnabled&&(e.stopPropagation(),this.back())}),g(()=>this.sketchViewModel,["create","delete","update"],e=>{const{activeWorkflow:t}=this,i=X(t),a=`sketch-${e.type}`;this.emit(a,{type:a,detail:e,layer:i[0],layers:i})},v),w(()=>this.view,e=>{if(this._snappingManager=d(this._snappingManager),!e)return;const t=this.snappingOptions;this._snappingManager=new H({view:e,options:t}),this.ownSketchViewModel.snappingManager=this._snappingManager},m),w(()=>this.snappingOptions,e=>{this._snappingManager&&(this._snappingManager.options=e)},m),g(()=>this.selectionToolbarViewModel,"complete",e=>this._onSelectionComplete(e)),w(()=>({view:this.view,selectionManager:this.effectiveSelectionManager,selectionListViewModel:this.selectionListViewModel,selectionToolbarViewModel:this.selectionToolbarViewModel}),({view:e,selectionManager:t,selectionListViewModel:i,selectionToolbarViewModel:a})=>{t.view=e,i.view=e,a.view=e},m),w(()=>this.effectiveSelectionManager,e=>{this.selectionListViewModel.selectionManager=e,this.selectionToolbarViewModel.selectionManager=e},m)])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then(()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null}),this._updateItemsTask=p(this._updateItemsTask),this._updatingHandles.destroy(),this._sketchEventListenerHandle=h(this._sketchEventListenerHandle),this.selectionListViewModel?.destroy(),this.selectionToolbarViewModel?.destroy(),this._defaultSelectionManager.destroy()}get _featureTemplatesLayersAndTables(){const e=new a;for(const t of this.editorItems){const i=this.hideTemplatesForInactiveLayers&&!t.visible;t.supportsCreateFeaturesWorkflow&&!i&&e.push(t.layer)}return e}get _selectionSources(){const e=new a;if(this.syncViewSelection||this.selectionManager)return e;for(const t of this.editorItems)x(t.layer)&&t.supportsUpdateWorkflow&&e.push(t.layer);return e}get activeFeatureCount(){const e=this.activeLeafWorkflow;return D(e)?e.pendingFeatures.length:B(e)&&e.data.edits.feature?1:N(e)?e.data.fullFeatures.length:Q(e)?e.data.features.length:z(e)?2:0}get activeLeafWorkflow(){const e=this.activeWorkflow;return e&&Z(e)?e.activeWorkflow??e:e}get canCreate(){return this.editorItems.some(e=>e.supportsCreateFeaturesWorkflow)}get canCreateVisible(){return!!this.featureTemplatesLayers.length}get canUpdate(){return this.editorItems.some(e=>e.supportsUpdateWorkflow)}get canUpdateVisible(){return this.editorItems.some(e=>e.supportsUpdateWorkflow&&e.visible)}get featureTemplatesLayers(){return this._featureTemplatesLayersAndTables.filter(e=>"scene"===e.type||!e.isTable)}get effectiveSelectionManager(){const e=this.view;return e&&this.syncViewSelection?e.selectionManager:this.selectionManager??this._defaultSelectionManager}get featureFormViewModel(){const e=this.activeWorkflow?.formViewModel;return $(e)?e:null}get formViewModel(){return this.activeWorkflow?.formViewModel}get utilityNetworkAssociationAddAssociationViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeUtilityNetworkAssociationAddAssociationViewModel:null}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get useLegacyCreateTools(){return this.ownSketchViewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.ownSketchViewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||"2d"!==this.view?.type}get sketchViewModel(){const{activeWorkflow:e}=this;return"update"===e?.type?e.activeSketchViewModel:"create-features"===e?.type?e.sketchViewModel:this.ownSketchViewModel}get state(){if(!this.view?.ready)return"disabled";const e=this.attachmentsViewModel.mode;if("add"===e)return"adding-attachment";if("edit"===e)return"editing-attachment";const{activeWorkflow:t}=this,i=!t?.stepId;return this.effectiveSelectionManager.count&&i?"viewing-selection-list":i?"ready":"update"===t.type&&t.activeWorkflow?.stepId?t.activeWorkflow.stepId:t.stepId}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}set view(e){this.ownSketchViewModel.view=e,this.spinnerViewModel.view=e,this._set("view",e)}get canZoomTo(){return this._getWorkingFeatures().some(e=>e.geometry)}get page(){const{activeWorkflow:e,state:t}=this;if(Y(e?.formViewModel)){if("update"===e?.type&&e.formViewModel?.activeAssociationsInput)return e.formViewModel.activeAssociationsInput.associatedLayer?"viewing-associated-features":"viewing-associated-layers"}else if("update"===e?.type&&e.formViewModel){const{associatedLayer:t,associationId:i}=e.formViewModel;if(t||null!=i)return"viewing-associated-features"}if("update"===e?.type&&"awaiting-feature-to-update"===e.stepId)return"ready";if("create-features"===e?.type&&0===e.numPendingFeatures){const t=e.data.upload;if(t)return"default"===t.state?"ready":"creating-features-upload-details"}return t??"disabled"}get formDisabled(){const{activeLeafWorkflow:e}=this;if(B(e)){const t=e.formViewModel,i=!$(t)&&t.readOnly;return!1===e.data.editorItem?.capabilities.update.attributes||!0===t.disabled||i}if(N(e)){const{formViewModel:t}=e;return t.disabled||t.readOnly}return!1}get featureFormDisabled(){const{activeLeafWorkflow:e}=this;if(B(e))return!1===e.data.editorItem?.capabilities.update.attributes||!0===e.formViewModel.disabled;if(N(e)){const{formViewModel:t}=e;return t.disabled||t.readOnly}return!1}get featureFormHasAssociation(){return!!this.featureFormViewModel?.activeAssociation}get formHasAssociation(){return!!this.formViewModel?.activeAssociation}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeLeafWorkflow:e}=this;if(B(e)){const{data:t}=e;return t.editorItem?.capabilities.delete.enabled&&!t.readOnly}return!!N(e)&&e.data.editorItems.every(e=>e.capabilities.delete.enabled)}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}get snappingManager(){return this._snappingManager}activateSelectionTool(e){return this.selectionToolbarViewModel.activateTool(e)}cancelSelectionTool(){this.selectionToolbarViewModel.cancel()}getTemplatesForLayer(e){return this._templatesByLayer.get(e)??[]}async startCreateFeaturesWorkflowAtFeatureTypeSelection(e){return this.startCreateFeaturesWorkflow(e)}async startCreateFeaturesWorkflowAtFeatureCreation(e){return this.startCreateFeaturesWorkflow(e,"creating-features")}async startCreateFeaturesWorkflow(e,t="awaiting-feature-creation-info"){if(await _(()=>!this.updating),!this.canCreate)throw new r("editing:unsupported-workflow","Creating features is unsupported or disabled.");const i=this._createUpdatingResolver();try{await this._cancelWorkflow();const i=this._createCreateFeaturesWorkflow(e,t);this._set("activeWorkflow",i),await i.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{i.resolve()}}async startCreateFeaturesWorkflowAtFeatureEdit(e){await _(()=>!this.updating);const t=this._createUpdatingResolver();try{const{initialFeature:t}=e,i=t.sourceLayer=t.layer,a=i?ee(this.editorItems,i):void 0;if(!a?.supportsCreateFeaturesWorkflow)throw new r("editing:unsupported-workflow","Creating features is unsupported or disabled for this layer.");await this._cancelWorkflow();const o=this._createCreateFeaturesWorkflow({initialFeature:t,layer:a.layer,maxFeatures:1},"creating-features");this._set("activeWorkflow",o),await o.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startMergeFeaturesWorkflow(e,t={}){await _(()=>!this.updating),le(this,"merge-features");const i=Array.isArray(e)?te(e):[e];if(i.length>1)throw new ce;if(0===i.length||i[0].objectIds.length<2)throw new de(2);const o=i[0],r=o.layer;if(!r)throw new pe;const s=ee(this.editorItems,r);he(s);const l=this._createUpdatingResolver(),c=new AbortController;this.addHandles(n(c));try{await this._cancelWorkflow(),this.cancelSelectionTool();const e=await U(o.objectIds,r,this.view?.spatialReference,c.signal);if(e.length!==o.objectIds.length)throw new ue;let i;if(t.keyFeature){const a=t.keyFeature.getObjectId();i=e.find(e=>e.getObjectId()===a)??t.keyFeature}const s=this._createUpdateWorkflow("editing-existing-feature",{rootFeatures:new a(e),rootWorkflowOptions:{type:"merge",props:{...t,keyFeature:i}}});this._set("activeWorkflow",s),this.addHandles(this._destroyWorkflowOnCommit(s)),await s.start()}catch(d){this._logErrorAndCancelWorkflow(d)}finally{l.resolve()}}async startSplitFeatureWorkflow(e,t={}){await _(()=>!this.updating),le(this,"split-feature");const i=F(e);if(!i)throw new pe;const o=ee(this.editorItems,i);fe(o);const r=this._createUpdatingResolver(),s=new AbortController;this.addHandles(n(s));try{await this._cancelWorkflow(),this.cancelSelectionTool();const o=await ie([e],i,this.view?.spatialReference,s.signal);if(1!==o.length)throw new ue;const r=this._createUpdateWorkflow("editing-existing-feature",{rootFeatures:new a(o),rootWorkflowOptions:{type:"split",props:t}});this._set("activeWorkflow",r),this.addHandles(this._destroyWorkflowOnCommit(r)),await r.start()}catch(l){this._logErrorAndCancelWorkflow(l)}finally{r.resolve()}}async startUpdateFeaturesWorkflow(e){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update features workflow is unsupported or disabled.");const t=Array.isArray(e)?te(e):[e];if(t.length>1)throw new ce;const i=this._createUpdatingResolver();try{await this._cancelWorkflow(),this.cancelSelectionTool();const e=this._createUpdateWorkflow("editing-existing-feature",{rootFeatureInfos:t,rootWorkflowOptions:{type:"update-multiple"}});e.addHandles(this._destroyWorkflowOnCommit(e)),this._set("activeWorkflow",e),await e.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{i.resolve()}}async startUpdateWorkflowAtFeatureSelection(){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow();this._set("activeWorkflow",e),await e.start()}catch(t){this._logErrorAndCancelWorkflow(t)}finally{e.resolve()}}async startUpdateWorkflowAtMultipleFeatureSelection(e){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateWorkflow("awaiting-update-feature-candidate");t.data.candidates=e,this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowAtFeatureEdit(e){if(await _(()=>!this.updating),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow(),this.cancelSelectionTool();const t=this._createUpdateWorkflow("editing-existing-feature",{rootFeatures:new a([e])});t.addHandles(this._destroyWorkflowOnCommit(t)),this._set("activeWorkflow",t),await t.start()}catch(i){this._logErrorAndCancelWorkflow(i)}finally{t.resolve()}}async startUpdateWorkflowWithActiveSelection(){const{selectionListViewModel:e}=this;if(!e.visibleFeatureCount||!e.visibleLayerCount)throw new r("editing:missing-selection","Unable to determine visible selection.");if(e.visibleLayerCount>1)throw new r("editing:features-different-layers","Cannot start workflow with features from different layers.");const t=e.layerItems.find(e=>e.visible);t&&await this._startUpdateWorkflowWithLayerItem(t,"update")}async deleteFeatureFromWorkflow(){o(c.getLogger(this),"EditorViewModel.deleteFeatureFromWorkflow is deprecated. Use EditorViewModel.deleteFeatures instead.",{version:"4.33",replacement:"EditorViewModel.deleteFeatures",warnOnce:!0}),await this.deleteFeatures()}async deleteFeatures(){const e=this.activeWorkflow;if(Z(e))return e.deleteActiveFeatures();this._logError("editing:unsupported-workflow","Deleting features requires an active update workflow.")}async deleteAssociationFromWorkflow(){const{activeWorkflow:e}=this;e&&"update"===e.type?await e.deleteActiveAssociation():this._logError("editing:unsupported-workflow","Deleting an association requires an active update workflow.")}async cancelWorkflow(e){return this._cancelWorkflow({warnIfNoWorkflow:!0,...e})}itemHasInvalidFormTemplate(e){return null!=e&&!0===ae(this.editorItems,e.layer)?.hasInvalidFormTemplate}syncFeatureTemplates(){this._featureTemplatesViewModelIsRestricted||this._updateTemplates()}zoomTo(e){const{view:i,sketchViewModel:a}=this;if(!i)return;const o=void 0,r=e??a?.createGraphic;if(r)"mesh"===r.geometry?.type?ke(i,r.geometry,o):ke(i,r,o);else{const e=this._getWorkingFeatures();"3d"===i.type&&e?.some(e=>"mesh"===e.geometry?.type)?ke(i,e.map(e=>e.geometry).filter(t),o):e&&ke(i,e,o)}}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}async onSelectionListItemSelect(e){ve(e)&&await this.startUpdateWorkflowAtFeatureEdit(e.graphic)}async onSelectionListMenuItemSelect(e,t){ve(e)?await this.startUpdateWorkflowAtFeatureEdit(e.graphic):_e(e)&&await this._startUpdateWorkflowWithLayerItem(e,t)}restrictFeatureTemplatesViewModelToLayer(e){return this._featureTemplatesViewModelIsRestricted=!0,this._setFeatureTemplatesViewModelLayers([e]),l(()=>{this._featureTemplatesViewModelIsRestricted=!1,this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)})}async _getEditorItemCandidates(e){const{view:t}=this;if(!t?.map)return[];const{map:i}=t,a=i.editableLayers.toArray(),o=i.allTables.toArray().filter(e=>A(e)||I(e));return await Promise.allSettled([...a.flatMap(e=>this._getLayerLoadPromise(e)),...o.flatMap(e=>this._getLayerLoadPromise(e))]),u(e),[...a.reverse(),...o.reverse()].filter(e=>V(e)&&("mesh"!==e.geometryType||"3d"===t.type)).flatMap(e=>"subtype-group"===e.type?e.sublayers.toArray():e)}_getLayerLoadPromise(e){return I(e)?e.loadAll():e.load()}_drainEditorItems(){this.editorItems.drain(e=>e.destroy())}_updateEditorItems(){p(this._updateItemsTask);const{view:e}=this,t=i(async t=>{if(!e?.map||!e?.allLayerViews)return;const i=await this._getEditorItemCandidates(t);if(!i.length)return this._drainEditorItems(),void this.editorItemsLayerMap.clear();const a=[],o=[],r=[],{editorItemsLayerMap:s,layerInfos:n}=this;for(const c of i){const t=be(n,c),i=await oe(e,c).catch(()=>null),l=t?a:i?o:r,d=new ne({layer:c,layerInfo:t,layerView:i});l.push(d),s.set(c,d)}n?.length&&a.sort((e,t)=>n.findIndex(({layer:t})=>t===e.layer)-n.findIndex(({layer:e})=>e===t.layer));const l=[...a,...o,...r];t.aborted||(this._drainEditorItems(),this.editorItems.addMany(l))});this._updatingHandles.consumePromise(t.promise),this._updateItemsTask=t}_updateTemplates(){p(this._updateTemplatesTask);const e=i(async e=>{const t=this._templatesByLayer,i=this._featureTemplatesLayersAndTables.filter(e=>!t.has(e));if(i.length>0){const a=await T({layers:i.toArray(),view:this.view,signal:e,queryOptions:{returnVisibleTemplatesOnly:!0}});for(const{layer:e,templates:i}of a)t.set(e,i)}this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)});this._updatingHandles.consumePromise(e.promise),this._updateTemplatesTask=e}_setFeatureTemplatesViewModelLayers(e){const t=this._templatesByLayer,i=[];for(const a of e){const e=t.get(a);e&&e.length>0&&i.push(we(a,e))}this.featureTemplatesViewModel.templateInfos=i}_afterEditorItemsChange(){const{activeWorkflow:e}=this;if(this.syncFeatureTemplates(),!e)return;const{stepId:t}=e;"create-features"!==e.type?"update"===e.type&&("awaiting-feature-to-update"===t&&!this.canUpdateVisible||"awaiting-update-feature-candidate"===t&&!e.hasUpdatableCandidates)&&this._cancelWorkflow():"awaiting-feature-creation-info"!==t||this.canCreate||this._cancelWorkflow()}async _cancelWorkflow(e){const t=this.activeWorkflow;if(!t)return void(e?.warnIfNoWorkflow&&this._logError("editing:no-active-workflow","There is no active workflow to cancel."));if(!e||!1!==e.force){this.emit("workflow-cancel"),this._set("activeWorkflow",null);try{await t.cancel(e)}finally{t.destroy()}}else try{await t.cancel(e),this._set("activeWorkflow",null),t.destroy()}catch(i){}}_createCreateFeaturesWorkflow(e,t){return"legacy"===this.formSystem?re.create({viewModel:this,creationInfo:e,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)}):J.create({viewModel:this,creationInfo:e,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)})}_createUpdateWorkflow(e,t){if("legacy"===this.formSystem)return se.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:e,...t,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)});const i=K.create({sketchOptions:this.sketchOptions,viewModel:this,snappingManager:this._snappingManager,startAt:e,...t,applyEdits:(e,t,i)=>this._applyEdits(e,t,i),applyEditsFeatureService:(e,t,i)=>this._applyEditsFeatureService(e,t,i),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t),applyAttachmentEdits:(e,t)=>this._editAttachments(e,t)});return i}async _editAttachments(e,i){const a=[];i.adds.forEach(t=>a.push(this._addAttachment(e,t))),i.updates.forEach(t=>a.push(this._updateAttachment(e,t))),i.deletes.forEach(t=>a.push(this._deleteAttachments(e,t)));return(await Promise.all(a)).filter(t).flat()}_addAttachments(e,t){return Promise.all(t.map(t=>this._addAttachment(e,t)))}async _addAttachment(e,t){let i=null;if(!("addAttachment"in e)||null==e.capabilities?.attachment)throw new r("editor:attachments-not-supported","Adding attachments is not supported for this layer.");const{feature:a,attachment:o,keywords:s}=t,n=s?{keywords:s}:void 0;return await this._queueOperation(async()=>(i=await(e.addAttachment?.(a,o,n).catch(e=>{throw e?.error||e}))??null,i)),i}async _updateAttachment(e,t){if(!("updateAttachment"in e)||!e.updateAttachment||null==e.capabilities?.attachment)throw new r("editor:attachments-not-supported","Updating attachments is not supported for this layer");const{feature:i,attachmentId:a,attachment:o}=t;let s=null;return await this._queueOperation(async()=>(s=await e.updateAttachment(i,a,o).catch(e=>{throw e?.error||e}),s)),s}async _deleteAttachments(e,t){if(!("deleteAttachments"in e)||!e.deleteAttachments||null==e.capabilities?.attachment)throw new r("editor:attachments-not-supported","Deleting attachments is not supported for this layer");const{feature:i,attachmentIds:a}=t;let o=null;return await this._queueOperation(async()=>(o=await e.deleteAttachments(i,a).catch(e=>{throw e?.error||e}),o)),o}async _applyEdits(e,t,i){let a=null;const o=e.url?await E(e.url):null,r={returnServiceEditsOption:(!o||!L(o))&&!/\/hosted\//i.test(e.url)?"original-and-current-features":void 0,editsRespectTrueCurves:!0,...i};return await this._queueOperation(async()=>{const{view:i}=this;if(!i)return null;const o=await oe(i,e).catch(()=>null);return a=await e.applyEdits(t,r),o&&await _(()=>!o.updating),a}),a}async _applyEditsFeatureService(e,t,i){let a=null;return await this._queueOperation(async()=>a=await e.applyEdits(t,i)),a}_destroyWorkflowOnCommit(e){return g(()=>e,"commit",()=>{e.destroy(),this.activeWorkflow===e&&this._set("activeWorkflow",null)})}_queueOperation(e){this._activityQueue.push(e);const t=(e,t)=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)};return e().then(e=>(Array.isArray(e)?e.forEach(e=>this._handleEditsResultError(e)):this._handleEditsResultError(e),e)).catch(i=>{this._logError("editing:operation-error","An error occurred.",{error:i});const a={error:i,retry:()=>(t(a,this.failures),this._queueOperation(e)),cancel:()=>{t(a,this.failures)}};this._set("failures",[...this.failures,a])}).then(()=>{t(e,this._activityQueue)})}_handleEditsResultError(e){if(null!=e&&"error"in e&&null!=e.error)throw e.error;if(null!=e&&"addFeatureResults"in e){const{addFeatureResults:t,deleteFeatureResults:i,updateFeatureResults:a}=e,o=t.find(e=>!!e.error)||a.find(e=>!!e.error)||i.find(e=>!!e.error);if(o)throw o.error}}_createUpdatingResolver(){const e=Promise.withResolvers();return this._updatingHandles.consumePromise(e.promise),e}_logErrorAndCancelWorkflow(e){const{name:t,message:i,details:a}=e;this._logError(t??"editing:workflow-start-failed",i??void 0,a??e),this._cancelWorkflow({force:!0})}_itemIsSuspended(e){const t=ee(this.editorItems,e);return null!=t&&(!t.visible||t.disabled)}_logError(e,t,i){c.getLogger(this).error(new r(e,t,i))}_syncSelectionSources(){this._defaultSelectionManager.sources.items=this._selectionSources.toArray()}async _onSelectionComplete(e){if(e.aborted)return;const{operationType:t,selection:i}=e,{effectiveSelectionManager:a}=this;this._queuedSelectionTool=void 0;const o=[],r=[];i.forEach(e=>{const t=F(e),i=this.editorItemsLayerMap.get(t);i?.editable&&r.push(e),!1!==i?.visible&&o.push(e)});const s=1===o.length&&r.includes(o[0]);if("ready"===this.state&&s&&"replace"===t)return this._queuedSelectionTool=e.toolName,this.startUpdateWorkflowAtFeatureEdit(o[0]);switch(t){case"remove":a.updateSelection({current:[],added:[],removed:o});break;case"replace":a.clear(),a.updateSelection({current:o,added:[],removed:[]});break;case"add":a.updateSelection({current:o,added:[],removed:[]})}}async _startUpdateWorkflowWithLayerItem(e,t){if(!e.objectIds?.length)return;const i=e.featureItems.filter(e=>e.visible).map(e=>e.graphic),a=this.selectionListViewModel.filterText;if(1===i.length)return await this.startUpdateWorkflowAtFeatureEdit(i[0]);let o;if(null!=a&&""!==a){const e=te(i);if(e.length>1)throw new ce;if(o=e[0],!o)throw new de("merge"===t?2:1)}else o={layer:e.layer,objectIds:e.objectIds};"update"===t?await this.startUpdateFeaturesWorkflow(o):"merge"===t&&await this.startMergeFeaturesWorkflow(o)}_getWorkingFeatures(){const{sketchViewModel:e}=this;if(e?.createGraphic)return[e.createGraphic];if(e?.updateGraphics?.length)return e.updateGraphics.toArray();const{formViewModel:i}=this;return i?$(i)?[i.feature].filter(t):i.activeFeature?[i.activeFeature]:i.features.toArray():[]}};e([M()],Te.prototype,"_defaultSelectionManager",void 0),e([M()],Te.prototype,"_featureTemplatesLayersAndTables",null),e([M()],Te.prototype,"_queuedSelectionTool",void 0),e([M()],Te.prototype,"_snappingManager",void 0),e([M()],Te.prototype,"_selectionSources",null),e([M()],Te.prototype,"activeFeatureCount",null),e([M({readOnly:!0})],Te.prototype,"activeWorkflow",void 0),e([M()],Te.prototype,"activeLeafWorkflow",null),e([M({readOnly:!0})],Te.prototype,"_activityQueue",void 0),e([M({readOnly:!0})],Te.prototype,"canCreate",null),e([M()],Te.prototype,"canCreateVisible",null),e([M({readOnly:!0})],Te.prototype,"canUpdate",null),e([M()],Te.prototype,"canUpdateVisible",null),e([M()],Te.prototype,"featureTemplatesLayers",null),e([M()],Te.prototype,"editorItems",void 0),e([M()],Te.prototype,"editorItemsLayerMap",void 0),e([M()],Te.prototype,"effectiveSelectionManager",null),e([M({readOnly:!0})],Te.prototype,"failures",void 0),e([M()],Te.prototype,"hideTemplatesForInactiveLayers",void 0),e([M({type:G})],Te.prototype,"attachmentsViewModel",void 0),e([M()],Te.prototype,"featureFormViewModel",null),e([M()],Te.prototype,"formViewModel",null),e([M()],Te.prototype,"utilityNetworkAssociationAddAssociationViewModel",null),e([M({type:me})],Te.prototype,"featureTemplatesViewModel",void 0),e([M({type:O})],Te.prototype,"labelOptions",null),e([M()],Te.prototype,"layerInfos",void 0),e([M()],Te.prototype,"useLegacyCreateTools",null),e([M()],Te.prototype,"isUsingLegacyCreateTools",null),e([M()],Te.prototype,"ownSketchViewModel",void 0),e([M()],Te.prototype,"selectionListViewModel",void 0),e([M()],Te.prototype,"selectionManager",void 0),e([M()],Te.prototype,"selectionToolbarViewModel",void 0),e([M()],Te.prototype,"sketchOptions",void 0),e([M()],Te.prototype,"sketchViewModel",null),e([M({type:q,nonNullable:!0})],Te.prototype,"snappingOptions",void 0),e([M()],Te.prototype,"spinnerViewModel",void 0),e([M()],Te.prototype,"state",null),e([M({readOnly:!0})],Te.prototype,"syncing",null),e([M()],Te.prototype,"syncViewSelection",void 0),e([M()],Te.prototype,"updating",null),e([M({type:P})],Te.prototype,"tooltipOptions",null),e([M({type:R})],Te.prototype,"valueOptions",null),e([M()],Te.prototype,"view",null),e([M()],Te.prototype,"canZoomTo",null),e([M()],Te.prototype,"pageStack",void 0),e([M()],Te.prototype,"showDiscardEditsPrompt",void 0),e([M()],Te.prototype,"showConfirmationPrompt",void 0),e([M()],Te.prototype,"_candidateCommitted",void 0),e([M()],Te.prototype,"page",null),e([M()],Te.prototype,"formDisabled",null),e([M()],Te.prototype,"featureFormDisabled",null),e([M()],Te.prototype,"featureFormHasAssociation",null),e([M()],Te.prototype,"formHasAssociation",null),e([M()],Te.prototype,"formSystem",void 0),e([M()],Te.prototype,"canGoBack",null),e([M()],Te.prototype,"shouldShowDeleteButton",null),e([M()],Te.prototype,"hasPendingEdits",null),e([M()],Te.prototype,"snappingManager",null),Te=e([W("esri.widgets.Editor.EditorViewModel")],Te);const Fe=Te;export{Fe as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/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,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 F,getCreationAttributes as _,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 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 C from"../../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as H}from"../../../views/support/HighlightDefaults.js";import{isModelUpload as L,handleModelUpload as j}from"../modelUploadUtils.js";import{activeSketchToolDrawsUnsupportedCurve as O,createToolFromGeometryType as x,containsUnsupportedCurve as D,findEditorItemForLayer as z,getServiceEditsFromWorkflowData as R,getServiceInfoForLayer as W,orderEditsByRelationshipDependencies as G,getServiceLayersById as N,startCreatingNewFeature as K,syncUpdateOptions as q,findLayerInfo as Z,isTerminalUpdateEventType as B,getVisualVariableAttributes as J,startUpdatingFeatureGeometry as Q,createWorkflowSteps as X,avoidFeatureTemplateSelectionWithOnlyOneItem as Y,setUpSketchCreateWatchers as $,setRelationshipFields as ee,showProgressCursor as te,setVisualVariablesAndElevationInfoForUpdate as ae,visualVariableInteractiveUpdate as ie}from"../workflowUtils.js";import re from"./CreateFeaturesWorkflowData.js";import se from"./Workflow.js";import{prepareAttachmentsForCreateFeaturesWorkflow as oe}from"./workflowUtils.js";import ne 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 se{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._formViewModel=new ne,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&&!L(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(O(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}=x(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&&D(r.toArray(),s)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.save()}back(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||L(this.data.creationInfo)||this._attachmentsActive||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||L(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?z(d.editorItems,u):void 0,h=new de({data:new re({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=R(h.data),p=F(c)&&u;if(n){if(ve(s),p){let t=_e(u,l);const a=await(W(o,d.view)?.load());a&&(t=G({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,ye(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 M(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:N(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 K(this._sketchViewModel,this._sketchLayer,e)}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}=this;i.includes(e)||a.addPendingFeature(e,t),a.selectedPendingFeature=e;const{_formViewModel:s,_sketchViewModel:o,sketchUpdateOptions:l}=this,{creationInfo:d,viewModel:c}=a,{attachmentsViewModel:p,layerInfos:h,view:m}=c;if(!m||!d)return;q(o,l),n(this._featureFormHandle);const f=e.sourceLayer,g=Z(h,f),w=g?.formTemplate,y=m.spatialReference;s.set({editType:"INSERT",feature:e,formTemplate:w,spatialReference:y,view:m}),"add"!==p.mode&&"edit"!==p.mode||await(c.activeWorkflow?.previous()),p.graphic=e,p.fileInfos.removeAll(),p.mode="view";(this._attachmentFileInfos.get(e)||[]).forEach(({file:e,form:t})=>p.addFile(e,t)),await A(e,"2d"===m.type?m.scale:null);const v=a.getEditsForPendingFeature(e);this._featureFormHandle=r([s.on("value-change",async({fieldName:t,value:a})=>{if(v?.updateAttributes(s.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 A(e,"2d"===m.type?m.scale:null)}),o.on(["update","undo","redo"],e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&B(e.toolEventInfo.type))&&s.notifyFeatureGeometryChanged()}),u(()=>s.feature?.sourceLayer,t=>e.sourceLayer=t),u(()=>[s.feature,s.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 k(l)?void 0:(this._visualVariableAttributes=J(e),Q({graphic:e,sketchLayer:a,sketchViewModel:i,sourceLayer:l,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=X(["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&&(L(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 Y(a,i)}static _configureSketchViewModel(e){const{data:t,_sketchLayer:a,_sketchViewModel:s}=e,{creationInfo:o,viewModel:n}=t,{view:l}=n,d=[];if(!l)return i();if("2d"===l.type){o&&d.push(e._fadeExistingFeatures(o.layer));const t=c((e,t)=>Promise.all(e.map(e=>A(e,t))));d.push(u(()=>l.scale,e=>t(a.graphics,e)))}const p=_(t.fullTemplate,o?.attributeOverrides,o?.layer),h=u(()=>s.createGraphic&&s.activeComponent,()=>{s.createGraphic&&s.activeComponent&&!e.hasHandles(ue)&&e._updatingHandles.consumePromise($({creationAttributes:p,data:t,sketchViewModel:s,view:l}).then(t=>e.addHandles(t,ue)))}),m=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(ue),"cancel"===t.state&&null!==l.activeTool&&l.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===l.type?l.scale:null,useSourceLayer:!0});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},f=async i=>{const{attachmentsViewModel:r}=n,{_formViewModel:d}=e;if(i.graphics.length>1)return void await e._clearSelectedFeature();const c=i.graphics[0];if("complete"===i.state){const{submittable:t}=d;if(e.numPendingFeatures!==o?.maxFeatures&&t||d.submit(),await e._clearSelectedFeature(),"add"!==r.mode&&"edit"!==r.mode||await(n.activeWorkflow?.previous()),null==e.data.selectedPendingFeature&&(null==l.activeTool||l.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 ae({graphic:c,sketchLayer:a,sketchViewModel:s,visualVariables:e._visualVariableAttributes,sourceLayer:c.sourceLayer}),e._selectFeatureForUpdate({feature:c});if("active"===i.state){await e.updatePendingFeature(c);const t=e._visualVariableAttributes;ie(l,c,i,t)&&await A(c,"2d"===l.type?l.scale:null);const a=c.attributes,{rotation:r,size:s}=t;if(null!=r){const{field:e}=r;d.setValue(e,a[e])}if(null!=s){const{field:e}=s;d.setValue(e,a[e])}}}},g=async a=>{if(a.graphics.forEach(e=>{t.removePendingFeature(e)}),!L(t.creationInfo))return e._startCreating()},w=async()=>{if(L(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};d.push(h,s.on("create",t=>e._updatingHandles.addPromise(m(t))),s.on("update",t=>e._updatingHandles.addPromise(f(t))),s.on("delete",t=>e._updatingHandles.addPromise(g(t))),e._updatingHandles.addWhen(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(w())),i(()=>{s.cancel()}),ge(s,a,t),...we(t));const y=r(d);return s.addHandles(y),y}_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,q(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:o}=a.viewModel;i.editType="INSERT",i.spatialReference=o?.spatialReference,i.view=o;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),ee(u.relationships),i.editType="INSERT",i.spatialReference=o?.spatialReference,i.view=o,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=Z(s,a.sourceLayer));const o=!!u.associationGraphics?.has(a);await this._addAndInitializeEdits(a,i,e,o)}}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:o}=r.viewModel,n=r.addPendingFeature(e,t,{isAssociation:i});a??=Z(o,e.sourceLayer),s.feature=e,s.formTemplate=a?.formTemplate,await m(()=>!s.updating),n.updateAttributes(s.getValues()),n.submittable=s.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(pe))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:h,layer:m}=o,f=[],g=[];this._featureFormHandle=n(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=z(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,oe(d),f.push(u(()=>d.mode,e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}}));const w=te(c);f.push(w);const y=k(o.layer),{template:F}=o,M=!F||b(F)||v(F)&&"feature"===F.type,I=y&&M;try{if(I){const a=h??new t({attributes:_(e.fullTemplate,o.attributeOverrides,m),sourceLayer:m}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else f.push(de._configureSketchViewModel(this)),h?(L(o)&&o.geometryToPlace&&(h.attributes=_(e.fullTemplate,o.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.data.timeZone=e,p),T=i(()=>{L(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),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 o=()=>e.snappingOptions.featureSources,n=()=>(s=new C({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},f),i(d)])}function we(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: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 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 ve(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=g())}}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:g(),data:e}});return a.length?{addFeatures:e,addAttachments:a}:{addFeatures:e}}function _e(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.legacy.CreateFeaturesWorkflow")],fe);const be=fe;export{be 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 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,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 F,getCreationAttributes as _,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 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 C from"../../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as H}from"../../../views/support/HighlightDefaults.js";import{isModelUpload as L,handleModelUpload as j}from"../modelUploadUtils.js";import{activeSketchToolDrawsUnsupportedCurve as O,createToolFromGeometryType as x,containsUnsupportedCurve as D,findEditorItemForLayer as z,getServiceEditsFromWorkflowData as R,getServiceInfoForLayer as W,orderEditsByRelationshipDependencies as G,getServiceLayersById as N,startCreatingNewFeature as K,syncUpdateOptions as q,findLayerInfo as Z,isTerminalUpdateEventType as B,getVisualVariableAttributes as J,startUpdatingFeatureGeometry as Q,createWorkflowSteps as X,avoidFeatureTemplateSelectionWithOnlyOneItem as Y,setUpSketchCreateWatchers as $,setRelationshipFields as ee,showProgressCursor as te,setVisualVariablesAndElevationInfoForUpdate as ae,visualVariableInteractiveUpdate as ie}from"../workflowUtils.js";import re from"./CreateFeaturesWorkflowData.js";import se from"./Workflow.js";import{prepareAttachmentsForCreateFeaturesWorkflow as oe}from"./workflowUtils.js";import ne 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 se{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._formViewModel=new ne,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&&!L(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(O(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}=x(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&&D(r.toArray(),s)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.save()}back(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||L(this.data.creationInfo)||this._attachmentsActive||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||L(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?z(d.editorItems,u):void 0,h=new de({data:new re({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=R(h.data),p=F(c)&&u;if(n){if(ve(s),p){let t=_e(u,l);const a=await(W(o,d.view)?.load());a&&(t=G({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,ye(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 M(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:N(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 K(this._sketchViewModel,this._sketchLayer,e)}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}=this;i.includes(e)||a.addPendingFeature(e,t),a.selectedPendingFeature=e;const{_formViewModel:s,_sketchViewModel:o,sketchUpdateOptions:l}=this,{creationInfo:d,viewModel:c}=a,{attachmentsViewModel:p,layerInfos:h,view:m}=c;if(!m||!d)return;q(o,l),n(this._featureFormHandle);const f=e.sourceLayer,g=Z(h,f),w=g?.formTemplate,y=m.spatialReference;s.set({editType:"INSERT",feature:e,formTemplate:w,spatialReference:y,view:m}),"add"!==p.mode&&"edit"!==p.mode||await(c.activeWorkflow?.previous()),p.graphic=e,p.fileInfos.removeAll(),p.mode="view";(this._attachmentFileInfos.get(e)||[]).forEach(({file:e,form:t})=>p.addFile(e,t)),await A(e,"2d"===m.type?m.scale:null);const v=a.getEditsForPendingFeature(e);this._featureFormHandle=r([s.on("value-change",async({fieldName:t,value:a})=>{if(v?.updateAttributes(s.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 A(e,"2d"===m.type?m.scale:null)}),o.on(["update","undo","redo"],e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&B(e.toolEventInfo.type))&&s.notifyFeatureGeometryChanged()}),u(()=>s.feature?.sourceLayer,t=>e.sourceLayer=t),u(()=>[s.feature,s.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 k(l)?void 0:(this._visualVariableAttributes=J(e),Q({graphic:e,sketchLayer:a,sketchViewModel:i,sourceLayer:l,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=a.creationInfo?.layer,r=X(["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:r}=a,{view:s}=r;s&&(L(t)?e.addHandles(await j({view:s,data:a,next:()=>e.next(),cancel:()=>r.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(i&&e.addHandles(r.restrictFeatureTemplatesViewModelToLayer(i),this.id),e.addHandles(r.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 Y(a,r)}static _configureSketchViewModel(e){const{data:t,_sketchLayer:a,_sketchViewModel:s}=e,{creationInfo:o,viewModel:n}=t,{view:l}=n,d=[];if(!l)return i();if("2d"===l.type){o&&d.push(e._fadeExistingFeatures(o.layer));const t=c((e,t)=>Promise.all(e.map(e=>A(e,t))));d.push(u(()=>l.scale,e=>t(a.graphics,e)))}const p=_(t.fullTemplate,o?.attributeOverrides,o?.layer),h=u(()=>s.createGraphic&&s.activeComponent,()=>{s.createGraphic&&s.activeComponent&&!e.hasHandles(ue)&&e._updatingHandles.consumePromise($({creationAttributes:p,data:t,sketchViewModel:s,view:l}).then(t=>e.addHandles(t,ue)))}),m=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(ue),"cancel"===t.state&&null!==l.activeTool&&l.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===l.type?l.scale:null,useSourceLayer:!0});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},f=async i=>{const{attachmentsViewModel:r}=n,{_formViewModel:d}=e;if(i.graphics.length>1)return void await e._clearSelectedFeature();const c=i.graphics[0];if("complete"===i.state){const{submittable:t}=d;if(e.numPendingFeatures!==o?.maxFeatures&&t||d.submit(),await e._clearSelectedFeature(),"add"!==r.mode&&"edit"!==r.mode||await(n.activeWorkflow?.previous()),null==e.data.selectedPendingFeature&&(null==l.activeTool||l.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 ae({graphic:c,sketchLayer:a,sketchViewModel:s,visualVariables:e._visualVariableAttributes,sourceLayer:c.sourceLayer}),e._selectFeatureForUpdate({feature:c});if("active"===i.state){await e.updatePendingFeature(c);const t=e._visualVariableAttributes;ie(l,c,i,t)&&await A(c,"2d"===l.type?l.scale:null);const a=c.attributes,{rotation:r,size:s}=t;if(null!=r){const{field:e}=r;d.setValue(e,a[e])}if(null!=s){const{field:e}=s;d.setValue(e,a[e])}}}},g=async a=>{if(a.graphics.forEach(e=>{t.removePendingFeature(e)}),!L(t.creationInfo))return e._startCreating()},w=async()=>{if(L(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};d.push(h,s.on("create",t=>e._updatingHandles.addPromise(m(t))),s.on("update",t=>e._updatingHandles.addPromise(f(t))),s.on("delete",t=>e._updatingHandles.addPromise(g(t))),e._updatingHandles.addWhen(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(w())),i(()=>{s.cancel()}),ge(s,a,t),...we(t));const y=r(d);return s.addHandles(y),y}_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,q(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:o}=a.viewModel;i.editType="INSERT",i.spatialReference=o?.spatialReference,i.view=o;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),ee(u.relationships),i.editType="INSERT",i.spatialReference=o?.spatialReference,i.view=o,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=Z(s,a.sourceLayer));const o=!!u.associationGraphics?.has(a);await this._addAndInitializeEdits(a,i,e,o)}}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:o}=r.viewModel,n=r.addPendingFeature(e,t,{isAssociation:i});a??=Z(o,e.sourceLayer),s.feature=e,s.formTemplate=a?.formTemplate,await m(()=>!s.updating),n.updateAttributes(s.getValues()),n.submittable=s.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(pe))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:h,layer:m}=o,f=[],g=[];this._featureFormHandle=n(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=z(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,oe(d),f.push(u(()=>d.mode,e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}}));const w=te(c);f.push(w);const y=k(o.layer),{template:F}=o,M=!F||b(F)||v(F)&&"feature"===F.type,I=y&&M;try{if(I){const a=h??new t({attributes:_(e.fullTemplate,o.attributeOverrides,m),sourceLayer:m}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else f.push(de._configureSketchViewModel(this)),h?(L(o)&&o.geometryToPlace&&(h.attributes=_(e.fullTemplate,o.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.data.timeZone=e,p),T=i(()=>{L(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),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 o=()=>e.snappingOptions.featureSources,n=()=>(s=new C({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},f),i(d)])}function we(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: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 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 ve(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=g())}}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:g(),data:e}});return a.length?{addFeatures:e,addAttachments:a}:{addFeatures:e}}function _e(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.legacy.CreateFeaturesWorkflow")],fe);const be=fe;export{be as default};
@@ -671,11 +671,12 @@ export default class Editor extends Widget {
671
671
  /**
672
672
  * Initiates the [CreateFeaturesWorkflow](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/CreateFeaturesWorkflow/) by displaying the [FeatureTemplates](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTemplates/) panel.
673
673
  *
674
+ * @param creationInfo - An optional object containing additional configuration information for the create features workflow.
674
675
  * @returns Resolves when the [CreateFeaturesWorkflow](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/CreateFeaturesWorkflow/) is initiated
675
676
  * and displays the [FeatureTemplates](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTemplates/) panel.
676
677
  * @since 4.23
677
678
  */
678
- startCreateFeaturesWorkflowAtFeatureTypeSelection(): Promise<void>;
679
+ startCreateFeaturesWorkflowAtFeatureTypeSelection(creationInfo?: Pick<CreationInfo, "layer" | "maxFeatures">): Promise<void>;
679
680
  /**
680
681
  * Starts a [MergeFeaturesWorkflow](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/MergeFeaturesWorkflow/) for the
681
682
  * specified features. All features must belong to the same layer.
package/widgets/Editor.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i,deprecatedFunction as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{destroyMaybe as a,abortMaybe as r,mappedFind as n}from"../core/maybe.js";import{watch as l,initial as c,on as d,when as h,syncAndInitial as m}from"../core/reactiveUtils.js";import{property as p,subclass as u}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../core/support/UpdatingHandles.js";import w from"../views/interactive/sketch/SketchLabelOptions.js";import v from"../views/interactive/sketch/SketchTooltipOptions.js";import _ from"../views/interactive/sketch/SketchValueOptions.js";import f from"../views/interactive/snapping/SnappingOptions.js";import y from"./Attachments.js";import b from"./BatchAttributeForm.js";import k from"./FeatureForm.js";import M from"./FeatureTemplates.js";import F from"./Spinner.js";import A from"./Widget.js";import S from"./BatchAttributeForm/VisibleElements.js";import{isNextOrLegacyUpdateWorkflow as T,isNextOrLegacyUpdateFeaturesWorkflow as C,isNextOrLegacyUpdateFeatureWorkflow as L}from"./Editor/compatibilityAdapters.js";import{css as E}from"./Editor/css.js";import W from"./Editor/EditorViewModel.js";import{isModelUpload as P}from"./Editor/modelUploadUtils.js";import I from"./Editor/VisibleElements.js";import{findEditorItemForLayer as U,isBatchAttributeFormViewModel as j}from"./Editor/workflowUtils.js";import{loadCreateFeaturesPanelContentComponents as D,CreateFeaturesPanelContent as V}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as x,FeatureList as O}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as B,FooterActions as N}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as H,Notice as G}from"./Editor/components/Notices.js";import{loadPanelContentComponents as R,PanelContent as z,PanelContentSection as q,PanelContentMessage as K}from"./Editor/components/PanelContent.js";import{PanelToolbar as Z,loadPanelToolbarComponents as $}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as J,Prompt as Q}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as X,UpdateFeaturePanelContent as Y}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as ee,UploadDetails as te}from"./Editor/components/UploadDetails.js";import ie from"./Sketch/CreateToolVisibilityMap.js";import se from"./Sketch/SelectionToolVisibilityMap.js";import oe from"./Sketch/VisibleElements.js";import{loadCalciteComponents as ae}from"./support/componentsUtils.js";import{globalCss as re}from"./support/globalCss.js";import{incrementHeadingLevel as ne,Heading as le}from"./support/Heading.js";import{renderItem as ce}from"./support/ItemList.js";import{connectDelayedLoading as de}from"./support/loaderUtils.js";import he from"./support/SelectionList.js";import me from"./support/SelectionToolbar.js";import{messageBundle as pe,vmEvent as ue,tsx as ge}from"./support/widget.js";import{isLayerItem as we}from"./support/SelectionList/selectionListUtils.js";import ve from"./support/SelectionList/VisibleElements.js";import _e from"./support/SelectionToolbar/VisibleElements.js";const fe=Symbol("sketch-setup-handles");let ye=class extends A{constructor(e,s){super(e,s),this._batchAttributeForm=new b({suppressDeprecationWarning:!0,visibleElements:new S({loadingIndicator:!1})}),this._featureForm=new k({suppressDeprecationWarning:!0}),this._sketchToolbar=null,this._attachments=new y({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1},suppressDeprecationWarning:!0}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new M({suppressDeprecationWarning:!0,enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?ge("calcite-icon",{class:E.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new F,this._loading=!1,this._disallowSave=!1,this._selectionList=new he({displayMode:"layer",itemActionConfigs:this._selectionListItemActionConfigs,itemUnavailableFunction:({item:e})=>!U(this.editorItems,e.layer)?.editable,onListItemSelect:({item:e})=>this._onSelectionListItemSelect(e),visibleElements:new ve({header:!1})}),this._selectionToolbar=new me({visibleElements:new _e({chip:!1})}),this._updatingHandles=new g,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=null,this.visibleElements=new I,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectionList=()=>this._selectionList.render(),this._renderSelectionToolbar=()=>this._selectionToolbar.render(),this._renderSketch=()=>this._sketchToolbar?ge("div",{class:E.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>ge("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:i},...s)=>{const{visibleElements:o}=this;return ge("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:i,onCalciteFlowItemBack:this._onBack},o.settingsMenu?ge(Z,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...s)},this._showConfirmationPrompt=e=>this._showPromptAndWait(this.messages[e]),this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,i={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&P(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&t.formViewModel?.activeAssociationsInput?this._showPromptAndWait({...i,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(i)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onMerge=()=>{const{activeWorkflow:e}=this.viewModel;if(T(e)){const t=e.activeWorkflow;C(t)&&e.startMergingFeatures(t.viewGraphics,{initialFeatures:t.data.initialFeatures})}},this._onSplit=()=>{const{activeWorkflow:e}=this.viewModel;if(T(e)){const t=e.activeWorkflow;if(L(t)){const i=t.viewGraphic;i&&e.startSplittingFeature(i,{initialFeature:t.data.edits.initialFeature??i})}}},this._onDelete=()=>{const e=this.viewModel.activeFeatureCount,i=e>1?this.messages.multiFeature:this.messages.singleFeature;this._showPrompt({title:i.deleteWarningTitle,message:i.deleteWarningMessage,context:"danger",actions:{primary:{label:t(i.delete,{count:e}),action:()=>{this.deleteFeatures(),this._clearPrompt()}},secondary:{label:i.keep,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then(()=>e.back()))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then(()=>e.back()))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})},this.viewModel=e?.viewModel||new W({useLegacyCreateTools:e?.useLegacyCreateTools??"3d"===e?.view?.type,formSystem:e?.formSystem??"legacy"}),this.announceDeprecation=()=>{i(o.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this._batchAttributeForm.showPrompt=this._showPrompt,this._batchAttributeForm.clearPrompt=this._clearPrompt,this.addHandles([l(()=>ne(this.headingLevel),e=>{this._batchAttributeForm.headingLevel=e,this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e},c),d(()=>this.viewModel.activeWorkflow,"cancel-request",({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then(t=>t?e.allow():e.deny())}),h(()=>this.viewModel.formViewModel,e=>{j(e)?this._batchAttributeForm.viewModel=e:this._featureForm.viewModel=e},m),h(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel,e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.consumePromise(this._initializeAssociationItemList(e))},c),h(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association,()=>{this._setUpAssociationSettings()}),l(()=>[this.viewModel,this.viewModel?.attachmentsViewModel,this.viewModel?.featureTemplatesViewModel,this.viewModel?.spinnerViewModel,this.viewModel?.selectionListViewModel,this.viewModel?.selectionToolbarViewModel],([e,t,i,s,o,a])=>{this._attachments.viewModel=t,this._featureTemplates.viewModel=i,this._spinner.viewModel=s,this._selectionList.viewModel=o,this._selectionToolbar.viewModel=a,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt,e.showConfirmationPrompt=this._showConfirmationPrompt},c),l(()=>this.view,(e,t)=>{const i=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,i),e?.ui.add(this._spinner,{key:i,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)},c),l(()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel],([e])=>{e&&(e.attachments&&this._attachments.set(e.attachments),e.batchAttributeForm&&this._batchAttributeForm.set(e.batchAttributeForm),e.featureForm&&this._featureForm.set(e.featureForm),e.featureTemplates&&this._featureTemplates.set(e.featureTemplates),e.selectionToolbar&&this._selectionToolbar.set(e.selectionToolbar),e.sketch&&this.viewModel.sketchViewModel?.set(e.sketch))},c),h(()=>this._attachments?.error,e=>this._onAttachmentsError(e)),h(()=>this._selectionListItemActionConfigs,()=>{this._selectionList.itemActionConfigs=this._selectionListItemActionConfigs}),h(()=>this.viewModel?.failures,e=>{const{messages:i}=this,[{error:s,retry:o,cancel:a}]=e;this._showPrompt({title:i.errorWarningTitle,message:t(i.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:i.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:i.ignore,action:()=>{a(),this._clearPrompt()}}}})}),l(()=>this.viewModel?.state,e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}}),l(()=>this.viewModel.formDisabled,e=>{this._batchAttributeForm.readOnly=e,this._featureForm.disabled=e}),l(()=>this.visibleElements.sketch,()=>this._setupSketch(),c),l(()=>this.visibleElements.zoomToButton,e=>this._selectionList.visibleElements.zoomToButton=e,c),de({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}}),de({getLoading:()=>!this.viewModel.activeLeafWorkflow?.allowSave,setEffectiveLoading:e=>{this._disallowSave=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._selectionList.destroy(),this._selectionToolbar.destroy(),this._attachments.destroy(),this._batchAttributeForm.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._spinner.destroy(),this._sketchToolbar=a(this._sketchToolbar),this._sketchImportAbortController=r(this._sketchImportAbortController)}loadDependencies(){return Promise.all([ae({flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),D(),x(),B(),H(),R(),$(),J(),X(),ee()])}get _hasInvalidBatchSelection(){return this._hasSelectionWithUneditableFeatures||this._hasSelectionFromMultipleLayers||this._selectionCountExceedsMaximum||0===this._selectionList.visibleFeatureCount}get _hasSelectionFromMultipleLayers(){return this._selectionList.visibleLayerCount>1}get _hasSelectionWithUneditableFeatures(){const e=this.editorItems;return this._selectionList.visibleFeatureItems.some(t=>!U(e,t.layer))}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _selectionCountExceedsMaximum(){const e=this._batchAttributeForm.maximumFeatureCount,{activeLayerItem:t,effectiveCount:i,filterText:s,visibleFeatureCount:o}=this._selectionList;return null!=s&&""!==s?o>e:t?t.total>e:i>e}get _selectionListItemActionConfigs(){const{messages:e,visibleElements:t}=this,i=t?.mergeButton??!0;return[{label:e?.batchEditing?.editThisFeature,icon:"edit-attributes",type:"feature",hidden:({item:e})=>!U(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.editTheseFeatures,icon:"edit-attributes",type:"layer",hidden:({item:e})=>!U(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.mergeTheseFeatures,icon:"merge",type:"layer",hidden:!i||(({item:e})=>{if(!we(e))return!0;const t=U(this.editorItems,e.layer);return!t||(!t.editable||!t.supportsMergeFeaturesWorkflow||e.visibleTotal<2)}),callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"merge")}]}get _visibleSelectionCount(){const{activeLayerItem:e,effectiveCount:t,filterText:i,visibleFeatureCount:s}=this._selectionList;return null!=i&&""!==i?s:e?e.total:t}get activeWorkflow(){return this.viewModel.activeWorkflow}get editorItems(){return this.viewModel.editorItems}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get syncWithViewSelectionManager(){return this.syncViewSelection}set syncWithViewSelectionManager(e){this.syncViewSelection=e}get syncViewSelection(){return this.viewModel.syncViewSelection}set syncViewSelection(e){this.viewModel.syncViewSelection=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get formSystem(){return this.viewModel.formSystem}set formSystem(e){this.viewModel.formSystem=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}activateSelectionTool(e){return this.viewModel.activateSelectionTool(e)}cancelSelectionTool(){this.viewModel.cancelSelectionTool()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startMergeFeaturesWorkflow(e,t={}){return this.viewModel.startMergeFeaturesWorkflow(e,t)}startSplitFeatureWorkflow(e,t={}){return this.viewModel.startSplitFeatureWorkflow(e,t)}async startUpdateFeaturesWorkflow(e){return this.viewModel.startUpdateFeaturesWorkflow(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}startUpdateWorkflowWithActiveSelection(){return this.viewModel.startUpdateWorkflowWithActiveSelection()}deleteFeatureFromWorkflow(){return s(o.getLogger(this),"Editor.deleteFeatureFromWorkflow is deprecated. Use Editor.deleteFeatures instead.",{version:"4.33",replacement:"Editor.deleteFeatures",warnOnce:!0}),this.deleteFeatures()}async deleteFeatures(){await this.viewModel.deleteFeatures()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,i=this.classes(E.base,re.widget,re.panel);if(!t)return ge("div",{class:i,key:"empty"});const{pageStack:s}=t,o=s.length-1,a=s.map((e,t)=>this._renderPage(e,t===o));return ge("div",{class:i,key:"base",ondragover:this._handleDragAndDrop,ondrop:this._handleDragAndDrop},e.flow?ge("calcite-flow",{inert:!!this._prompt,key:"flow"},a):a,this._prompt?ge(Q,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const i={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(i);case"viewing-selection-list":return this._renderSelectionListPage(i);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(i);case"creating-features-upload-details":return this._renderUploadDetails(i);case"creating-features":return this._renderCreatingFeatures(i);case"editing-existing-feature":case"editing-features":case"editing-attributes":case"choosing-key-feature":return this._renderUpdateFeature(i);case"awaiting-update-feature-candidate":return this._renderFeatureList(i);case"adding-attachment":return this._renderAttachmentAdding(i);case"editing-attachment":return this._renderAttachmentEditing(i);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(i);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(i);case"add-association-create-association":return this._renderAddAssociation(i);case"drawing-splitter-geometry":return this._renderDrawingSplitGeometry(i);case"reviewing-features":return this._renderReviewingSplitFeatures(i)}return ge("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:i}=this;return ge(t,{heading:i.selectTemplate,key:"templates-panel",...e},ge(z,{key:"feature-templates"},ge(q,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:i,messages:s}=this;if("create-features"!==i?.type)return null;const o=i.data.upload;return o?ge(t,{heading:s.createFeatures,key:"upload-details-panel",...e},ge(te,{helpMessage:this._helpMessage,messages:s,upload:o})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:i,messages:s,messagesCommon:o,headingLevel:a,viewModel:r}=this;if(!i)return null;const n="create-features"===i.type&&i.numPendingFeatures>0||"update"===i.type&&"create-features"===i?.activeWorkflow?.type&&i.activeWorkflow?.numPendingFeatures>0;return ge(t,{heading:s.createFeatures,key:"create-features-panel",...e},n?ge(Y,{disallowSave:this._disallowSave,editorViewModel:r,formWidget:this._batchAttributeForm,headingLevel:a,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):ge(V,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:a}=this,r=a.activeFeatureCount>1?i.multiFeature.editPanelTitle:i.singleFeature.editPanelTitle;return ge(t,{heading:r,key:"update-feature-panel",...e},ge(Y,{disallowSave:this._disallowSave,editorViewModel:a,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onMerge:this._onMerge,onSave:this._onSave,onSplit:this._onSplit}))}_renderDrawingSplitGeometry(e){const{EditorPanel:t}=this;return ge(t,{heading:this.messages.splitFeature,key:"draw-split-geometry-panel",...e},ge(V,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderReviewingSplitFeatures(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:a}=this;return ge(t,{heading:i.splitFeature,key:"review-split-features-panel",...e},ge(Y,{disallowSave:this._disallowSave,editorViewModel:a,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,visibleElements:this.visibleElements,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;if(e.title)return e.title;const{messagesFeature:i}=this;switch(e.type){case"attachment":return i.associationsAttachments;case"connectivity":return i.associationsConnectivity;case"structure":return i.associationsStructure;case"content":return i.associationsContents;case"container":return i.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;const i=t.associations;switch(e.type){case"attachment":return i.addAttachment;case"connectivity":return i.addConnectivity;case"structure":return i.addStructure;case"content":return i.addContent;case"container":return i.addContainer}}async _initializeAssociationItemList(e){const t=(await(import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js"))).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await(import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js"))).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:a}=this,r=a.formViewModel?.activeAssociationType,n=this._getAssociationTypeTitle(r);return ge(t,{heading:n,key:"viewing-associated-layers-panel",...e},ge(Y,{disallowSave:this._disallowSave,editorViewModel:a,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this,a=s.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state||this.viewModel.formDisabled;return t?ge(i,{heading:r,key:"add-association-select-feature",...e},ge(z,{key:"select-feature"},ge(q,null,t.render())),ge(N,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:o.apply,disabled:n,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&(a?.reset(),s.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):ge(i,{heading:r,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),i=e.utilityNetworkAssociationAddAssociationViewModel,s="update"===e.activeWorkflow?.type?e.activeWorkflow:null,o=s?s.activeWorkflow:null,a="add-association"===o?.type?o.sourceFeatureItem:null,r=i?.selectedFeature,n=i?.association,l=i?.utilityNetwork;a&&r&&n&&l&&(t.sourceFeature=a,t.targetFeature=r,t.association=n,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this;if(!t)return null;const a=s.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state;return ge(i,{heading:r,key:"add-association",...e},ge(z,{key:"add-association-content"},ge(q,null,t.render())),ge(N,{buttons:[{label:o.add,disabled:n||!a.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&s.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:i}=this,s=n(e.group.items,e=>i.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0);return s?ge(G,{kind:"warning",message:s}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:i,messages:s,messagesCommon:o}=this;return ge(t,{heading:s.addAttachment,key:"attachment-adding-panel",...e},ge(z,{key:"attachments"},this._renderAttachments()),ge(N,{buttons:[{label:i.submitting?o.cancel:o.add,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderSelectionListPage(e){const{_hasSelectionFromMultipleLayers:i,_hasInvalidBatchSelection:s,_selectionCountExceedsMaximum:o,_selectionList:a,_visibleSelectionCount:r,messages:n,EditorPanel:l}=this,{batchUpdateActions:c}=this.visibleElements,{maxVisibleFeatureCountPerLayer:d}=a;return ge(l,{heading:n.widgetLabel,key:"selection-list-panel",...e},this.visibleElements.selectionToolbar?ge("div",{class:E.selectionToolbarContainer},this._renderSelectionToolbar()):void 0,ge(z,{key:"selection-list"},ge(q,null,this._renderSelectionList())),ge(N,{buttons:[c?{label:t(n.batchEditing.editCount,{count:r}),disabled:s,onClick:()=>this.startUpdateWorkflowWithActiveSelection(),type:"button"}:void 0],notice:c&&i?{text:n.batchEditing.selectOneLayer,icon:"information"}:c&&o?{text:t(this.messages.multiFeature.formFailedToLoadTooManyFeatures,{num:d}),icon:"information"}:void 0}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:i,activeWorkflow:s,messages:o,messagesCommon:a}=this;return s?ge(t,{heading:o.editAttachment,key:"attachment-editing-panel",...e},ge(z,{key:"attachments"},this._renderAttachments()),s.shouldAllowAttachmentEditing?ge(N,{buttons:[{label:a.update,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:i.submitting,label:a.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:i,visibleElements:s}=this,o=this._helpMessage;return ge(t,{heading:i.widgetLabel,key:"landing-panel",...e},ge(z,{key:"landing-content"},this.editorItems.length?[s.editFeaturesSection?ge(q,{key:"edit-actions"},this._renderUpdateActions()):null,s.createFeaturesSection&&this.viewModel.canCreateVisible?ge(q,{key:"create-actions"},this._renderCreateActions()):null]:ge(K,{key:"no-content"},i.noEditableLayers)),o?ge("div",{class:E.helpMessage,key:"footer-actions",slot:"footer"},o):void 0)}_handleDragAndDrop(e){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none")}get _helpMessage(){return this.getHelpMessageString(this.activeWorkflow?.helpMessage)}get _noticeMessage(){return this.getHelpMessageString(this.activeWorkflow?.noticeMessage)}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:i}=this,s={id:"select",label:t.select};return ge("div",{class:E.updateActions,key:"update-actions"},ge(le,{level:ne(this.headingLevel)},e.editFeatures),this.visibleElements.selectionToolbar?ge("div",{class:E.selectionToolbarContainer},this._renderSelectionToolbar()):ge("calcite-list",{class:E.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},ce({disabled:!i.canUpdateVisible,grouped:!1,item:s,selectedItem:"awaiting-feature-to-update"===i.activeWorkflow?.stepId?s:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return ge("div",{key:"create-actions"},ge(le,{level:ne(this.headingLevel)},this.messages.createFeatures),ge("div",{class:E.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:i,viewModel:s}=this,{activeWorkflow:o}=s;if("update"!==o?.type)return null;const a=o.data.candidates,r=t(this.messages.multipleFeaturesTemplate,{total:a.length});return ge(i,{heading:r,key:"feature-list",...e},ge(O,{editorItems:this.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:o,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:i,noLabel:s}){const o=Promise.withResolvers(),{view:a}=this,r=a?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:i,action:()=>o.resolve(!0)},secondary:{label:s,action:()=>o.resolve(!1)}}}),o.promise.finally(()=>{this._clearPrompt(),r&&a?.focus()})}async _onSelectionListItemSelect(e){await this.viewModel.onSelectionListItemSelect(e)}async _onSelectionListMenuItemSelect(e,t){await this.viewModel.onSelectionListMenuItemSelect(e,t)}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=r(this._sketchImportAbortController),this._sketchToolbar=a(this._sketchToolbar),void this.removeHandles(fe);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const t=await(import("./Sketch.js"));if(!e.signal.aborted)try{this._sketchToolbar=new t.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",suppressDeprecationWarning:!0,visibleElements:new oe({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,singlePluginBackButton:!1,createTools:new ie({freehandPolygon:!0,freehandPolyline:!0}),selectionTools:new se({"lasso-selection":!1,"rectangle-selection":!1}),geometrySimplificationActivityIndicator:!1})}),this.addHandles([l(()=>{const e=this.viewModel.activeLeafWorkflow;return e&&"availableCreateTools"in e?e.availableCreateTools:null},e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)},c),l(()=>this.visibleElements.undoRedoButtons,e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)},c),h(()=>this.viewModel?.sketchViewModel,e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)},c),h(()=>this.viewModel.sketchViewModel?.pluginManager,e=>{e.sketch=this._sketchToolbar},c)],fe)}finally{this._sketchImportAbortController=null}}getHelpMessageString(e){const{messages:t,view:i}=this;if("curveToolDensifyWarning"===e)return t.curveToolDensifyWarning;return e?t["3d"===i?.type?"helpMessages3d":"helpMessages2d"]?.[e]:void 0}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([p()],ye.prototype,"_batchAttributeForm",void 0),e([p()],ye.prototype,"_featureForm",void 0),e([p()],ye.prototype,"_sketchToolbar",void 0),e([p()],ye.prototype,"_attachments",void 0),e([p()],ye.prototype,"_associationItemList",void 0),e([p()],ye.prototype,"_associationSettings",void 0),e([p()],ye.prototype,"_featureTemplates",void 0),e([p()],ye.prototype,"_filterText",void 0),e([p()],ye.prototype,"_hasInvalidBatchSelection",null),e([p()],ye.prototype,"_hasSelectionFromMultipleLayers",null),e([p()],ye.prototype,"_hasSelectionWithUneditableFeatures",null),e([p()],ye.prototype,"_prompt",void 0),e([p()],ye.prototype,"_spinner",void 0),e([p()],ye.prototype,"_deleteButtonCommonInfo",null),e([p()],ye.prototype,"_loading",void 0),e([p()],ye.prototype,"_disallowSave",void 0),e([p()],ye.prototype,"_selectionCountExceedsMaximum",null),e([p()],ye.prototype,"_selectionList",void 0),e([p()],ye.prototype,"_selectionListItemActionConfigs",null),e([p()],ye.prototype,"_selectionToolbar",void 0),e([p()],ye.prototype,"_visibleSelectionCount",null),e([p({readOnly:!0})],ye.prototype,"activeWorkflow",null),e([p()],ye.prototype,"editorItems",null),e([p()],ye.prototype,"effectiveSelectionManager",null),e([p()],ye.prototype,"headingLevel",void 0),e([p()],ye.prototype,"hideTemplatesForInactiveLayers",null),e([p()],ye.prototype,"icon",null),e([p()],ye.prototype,"label",null),e([p({type:w})],ye.prototype,"labelOptions",null),e([p()],ye.prototype,"layerInfos",null),e([p(),pe("esri/widgets/Editor/t9n/Editor")],ye.prototype,"messages",void 0),e([p(),pe("esri/t9n/common")],ye.prototype,"messagesCommon",void 0),e([p(),pe("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],ye.prototype,"messagesTemplates",void 0),e([p(),pe("esri/widgets/Feature/t9n/Feature")],ye.prototype,"messagesFeature",void 0),e([p()],ye.prototype,"selectionManager",null),e([p({type:f})],ye.prototype,"snappingOptions",null),e([p()],ye.prototype,"syncWithViewSelectionManager",null),e([p()],ye.prototype,"syncViewSelection",null),e([p({type:v})],ye.prototype,"tooltipOptions",null),e([p()],ye.prototype,"supportingWidgetDefaults",void 0),e([p({type:_,nonNullable:!0})],ye.prototype,"valueOptions",null),e([p({value:!1})],ye.prototype,"useLegacyCreateTools",null),e([p()],ye.prototype,"formSystem",null),e([p()],ye.prototype,"isUsingLegacyCreateTools",null),e([p()],ye.prototype,"view",null),e([p({type:W}),ue(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],ye.prototype,"viewModel",void 0),e([p({type:I,nonNullable:!0})],ye.prototype,"visibleElements",void 0),e([p()],ye.prototype,"_helpMessage",null),e([p()],ye.prototype,"_noticeMessage",null),ye=e([u("esri.widgets.Editor")],ye);const be=ye;export{be as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i,deprecatedFunction as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{destroyMaybe as a,abortMaybe as r,mappedFind as n}from"../core/maybe.js";import{watch as l,initial as c,on as d,when as h,syncAndInitial as m}from"../core/reactiveUtils.js";import{property as p,subclass as u}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../core/support/UpdatingHandles.js";import w from"../views/interactive/sketch/SketchLabelOptions.js";import v from"../views/interactive/sketch/SketchTooltipOptions.js";import _ from"../views/interactive/sketch/SketchValueOptions.js";import f from"../views/interactive/snapping/SnappingOptions.js";import y from"./Attachments.js";import b from"./BatchAttributeForm.js";import k from"./FeatureForm.js";import M from"./FeatureTemplates.js";import F from"./Spinner.js";import A from"./Widget.js";import S from"./BatchAttributeForm/VisibleElements.js";import{isNextOrLegacyUpdateWorkflow as T,isNextOrLegacyUpdateFeaturesWorkflow as C,isNextOrLegacyUpdateFeatureWorkflow as L}from"./Editor/compatibilityAdapters.js";import{css as E}from"./Editor/css.js";import W from"./Editor/EditorViewModel.js";import{isModelUpload as P}from"./Editor/modelUploadUtils.js";import I from"./Editor/VisibleElements.js";import{findEditorItemForLayer as U,isBatchAttributeFormViewModel as j}from"./Editor/workflowUtils.js";import{loadCreateFeaturesPanelContentComponents as D,CreateFeaturesPanelContent as V}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as x,FeatureList as O}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as B,FooterActions as N}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as H,Notice as G}from"./Editor/components/Notices.js";import{loadPanelContentComponents as R,PanelContent as z,PanelContentSection as q,PanelContentMessage as K}from"./Editor/components/PanelContent.js";import{PanelToolbar as Z,loadPanelToolbarComponents as $}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as J,Prompt as Q}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as X,UpdateFeaturePanelContent as Y}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as ee,UploadDetails as te}from"./Editor/components/UploadDetails.js";import ie from"./Sketch/CreateToolVisibilityMap.js";import se from"./Sketch/SelectionToolVisibilityMap.js";import oe from"./Sketch/VisibleElements.js";import{loadCalciteComponents as ae}from"./support/componentsUtils.js";import{globalCss as re}from"./support/globalCss.js";import{incrementHeadingLevel as ne,Heading as le}from"./support/Heading.js";import{renderItem as ce}from"./support/ItemList.js";import{connectDelayedLoading as de}from"./support/loaderUtils.js";import he from"./support/SelectionList.js";import me from"./support/SelectionToolbar.js";import{messageBundle as pe,vmEvent as ue,tsx as ge}from"./support/widget.js";import{isLayerItem as we}from"./support/SelectionList/selectionListUtils.js";import ve from"./support/SelectionList/VisibleElements.js";import _e from"./support/SelectionToolbar/VisibleElements.js";const fe=Symbol("sketch-setup-handles");let ye=class extends A{constructor(e,s){super(e,s),this._batchAttributeForm=new b({suppressDeprecationWarning:!0,visibleElements:new S({loadingIndicator:!1})}),this._featureForm=new k({suppressDeprecationWarning:!0}),this._sketchToolbar=null,this._attachments=new y({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1},suppressDeprecationWarning:!0}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new M({suppressDeprecationWarning:!0,enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?ge("calcite-icon",{class:E.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new F,this._loading=!1,this._disallowSave=!1,this._selectionList=new he({displayMode:"layer",itemActionConfigs:this._selectionListItemActionConfigs,itemUnavailableFunction:({item:e})=>!U(this.editorItems,e.layer)?.editable,onListItemSelect:({item:e})=>this._onSelectionListItemSelect(e),visibleElements:new ve({header:!1})}),this._selectionToolbar=new me({visibleElements:new _e({chip:!1})}),this._updatingHandles=new g,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=null,this.visibleElements=new I,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectionList=()=>this._selectionList.render(),this._renderSelectionToolbar=()=>this._selectionToolbar.render(),this._renderSketch=()=>this._sketchToolbar?ge("div",{class:E.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>ge("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:i},...s)=>{const{visibleElements:o}=this;return ge("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:i,onCalciteFlowItemBack:this._onBack},o.settingsMenu?ge(Z,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...s)},this._showConfirmationPrompt=e=>this._showPromptAndWait(this.messages[e]),this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,i={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&P(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&t.formViewModel?.activeAssociationsInput?this._showPromptAndWait({...i,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(i)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onMerge=()=>{const{activeWorkflow:e}=this.viewModel;if(T(e)){const t=e.activeWorkflow;C(t)&&e.startMergingFeatures(t.viewGraphics,{initialFeatures:t.data.initialFeatures})}},this._onSplit=()=>{const{activeWorkflow:e}=this.viewModel;if(T(e)){const t=e.activeWorkflow;if(L(t)){const i=t.viewGraphic;i&&e.startSplittingFeature(i,{initialFeature:t.data.edits.initialFeature??i})}}},this._onDelete=()=>{const e=this.viewModel.activeFeatureCount,i=e>1?this.messages.multiFeature:this.messages.singleFeature;this._showPrompt({title:i.deleteWarningTitle,message:i.deleteWarningMessage,context:"danger",actions:{primary:{label:t(i.delete,{count:e}),action:()=>{this.deleteFeatures(),this._clearPrompt()}},secondary:{label:i.keep,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then(()=>e.back()))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then(()=>e.back()))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})},this.viewModel=e?.viewModel||new W({useLegacyCreateTools:e?.useLegacyCreateTools??"3d"===e?.view?.type,formSystem:e?.formSystem??"legacy"}),this.announceDeprecation=()=>{i(o.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this._batchAttributeForm.showPrompt=this._showPrompt,this._batchAttributeForm.clearPrompt=this._clearPrompt,this.addHandles([l(()=>ne(this.headingLevel),e=>{this._batchAttributeForm.headingLevel=e,this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e},c),d(()=>this.viewModel.activeWorkflow,"cancel-request",({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then(t=>t?e.allow():e.deny())}),h(()=>this.viewModel.formViewModel,e=>{j(e)?this._batchAttributeForm.viewModel=e:this._featureForm.viewModel=e},m),h(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel,e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.consumePromise(this._initializeAssociationItemList(e))},c),h(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association,()=>{this._setUpAssociationSettings()}),l(()=>[this.viewModel,this.viewModel?.attachmentsViewModel,this.viewModel?.featureTemplatesViewModel,this.viewModel?.spinnerViewModel,this.viewModel?.selectionListViewModel,this.viewModel?.selectionToolbarViewModel],([e,t,i,s,o,a])=>{this._attachments.viewModel=t,this._featureTemplates.viewModel=i,this._spinner.viewModel=s,this._selectionList.viewModel=o,this._selectionToolbar.viewModel=a,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt,e.showConfirmationPrompt=this._showConfirmationPrompt},c),l(()=>this.view,(e,t)=>{const i=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,i),e?.ui.add(this._spinner,{key:i,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)},c),l(()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel],([e])=>{e&&(e.attachments&&this._attachments.set(e.attachments),e.batchAttributeForm&&this._batchAttributeForm.set(e.batchAttributeForm),e.featureForm&&this._featureForm.set(e.featureForm),e.featureTemplates&&this._featureTemplates.set(e.featureTemplates),e.selectionToolbar&&this._selectionToolbar.set(e.selectionToolbar),e.sketch&&this.viewModel.sketchViewModel?.set(e.sketch))},c),h(()=>this._attachments?.error,e=>this._onAttachmentsError(e)),h(()=>this._selectionListItemActionConfigs,()=>{this._selectionList.itemActionConfigs=this._selectionListItemActionConfigs}),h(()=>this.viewModel?.failures,e=>{const{messages:i}=this,[{error:s,retry:o,cancel:a}]=e;this._showPrompt({title:i.errorWarningTitle,message:t(i.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:i.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:i.ignore,action:()=>{a(),this._clearPrompt()}}}})}),l(()=>this.viewModel?.state,e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}}),l(()=>this.viewModel.formDisabled,e=>{this._batchAttributeForm.readOnly=e,this._featureForm.disabled=e}),l(()=>this.visibleElements.sketch,()=>this._setupSketch(),c),l(()=>this.visibleElements.zoomToButton,e=>this._selectionList.visibleElements.zoomToButton=e,c),de({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}}),de({getLoading:()=>!this.viewModel.activeLeafWorkflow?.allowSave,setEffectiveLoading:e=>{this._disallowSave=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._selectionList.destroy(),this._selectionToolbar.destroy(),this._attachments.destroy(),this._batchAttributeForm.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._spinner.destroy(),this._sketchToolbar=a(this._sketchToolbar),this._sketchImportAbortController=r(this._sketchImportAbortController)}loadDependencies(){return Promise.all([ae({flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),D(),x(),B(),H(),R(),$(),J(),X(),ee()])}get _hasInvalidBatchSelection(){return this._hasSelectionWithUneditableFeatures||this._hasSelectionFromMultipleLayers||this._selectionCountExceedsMaximum||0===this._selectionList.visibleFeatureCount}get _hasSelectionFromMultipleLayers(){return this._selectionList.visibleLayerCount>1}get _hasSelectionWithUneditableFeatures(){const e=this.editorItems;return this._selectionList.visibleFeatureItems.some(t=>!U(e,t.layer))}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _selectionCountExceedsMaximum(){const e=this._batchAttributeForm.maximumFeatureCount,{activeLayerItem:t,effectiveCount:i,filterText:s,visibleFeatureCount:o}=this._selectionList;return null!=s&&""!==s?o>e:t?t.total>e:i>e}get _selectionListItemActionConfigs(){const{messages:e,visibleElements:t}=this,i=t?.mergeButton??!0;return[{label:e?.batchEditing?.editThisFeature,icon:"edit-attributes",type:"feature",hidden:({item:e})=>!U(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.editTheseFeatures,icon:"edit-attributes",type:"layer",hidden:({item:e})=>!U(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.mergeTheseFeatures,icon:"merge",type:"layer",hidden:!i||(({item:e})=>{if(!we(e))return!0;const t=U(this.editorItems,e.layer);return!t||(!t.editable||!t.supportsMergeFeaturesWorkflow||e.visibleTotal<2)}),callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"merge")}]}get _visibleSelectionCount(){const{activeLayerItem:e,effectiveCount:t,filterText:i,visibleFeatureCount:s}=this._selectionList;return null!=i&&""!==i?s:e?e.total:t}get activeWorkflow(){return this.viewModel.activeWorkflow}get editorItems(){return this.viewModel.editorItems}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get syncWithViewSelectionManager(){return this.syncViewSelection}set syncWithViewSelectionManager(e){this.syncViewSelection=e}get syncViewSelection(){return this.viewModel.syncViewSelection}set syncViewSelection(e){this.viewModel.syncViewSelection=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get formSystem(){return this.viewModel.formSystem}set formSystem(e){this.viewModel.formSystem=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}activateSelectionTool(e){return this.viewModel.activateSelectionTool(e)}cancelSelectionTool(){this.viewModel.cancelSelectionTool()}startCreateFeaturesWorkflowAtFeatureTypeSelection(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection(e)}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startMergeFeaturesWorkflow(e,t={}){return this.viewModel.startMergeFeaturesWorkflow(e,t)}startSplitFeatureWorkflow(e,t={}){return this.viewModel.startSplitFeatureWorkflow(e,t)}async startUpdateFeaturesWorkflow(e){return this.viewModel.startUpdateFeaturesWorkflow(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}startUpdateWorkflowWithActiveSelection(){return this.viewModel.startUpdateWorkflowWithActiveSelection()}deleteFeatureFromWorkflow(){return s(o.getLogger(this),"Editor.deleteFeatureFromWorkflow is deprecated. Use Editor.deleteFeatures instead.",{version:"4.33",replacement:"Editor.deleteFeatures",warnOnce:!0}),this.deleteFeatures()}async deleteFeatures(){await this.viewModel.deleteFeatures()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,i=this.classes(E.base,re.widget,re.panel);if(!t)return ge("div",{class:i,key:"empty"});const{pageStack:s}=t,o=s.length-1,a=s.map((e,t)=>this._renderPage(e,t===o));return ge("div",{class:i,key:"base",ondragover:this._handleDragAndDrop,ondrop:this._handleDragAndDrop},e.flow?ge("calcite-flow",{inert:!!this._prompt,key:"flow"},a):a,this._prompt?ge(Q,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const i={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(i);case"viewing-selection-list":return this._renderSelectionListPage(i);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(i);case"creating-features-upload-details":return this._renderUploadDetails(i);case"creating-features":return this._renderCreatingFeatures(i);case"editing-existing-feature":case"editing-features":case"editing-attributes":case"choosing-key-feature":return this._renderUpdateFeature(i);case"awaiting-update-feature-candidate":return this._renderFeatureList(i);case"adding-attachment":return this._renderAttachmentAdding(i);case"editing-attachment":return this._renderAttachmentEditing(i);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(i);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(i);case"add-association-create-association":return this._renderAddAssociation(i);case"drawing-splitter-geometry":return this._renderDrawingSplitGeometry(i);case"reviewing-features":return this._renderReviewingSplitFeatures(i)}return ge("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:i}=this;return ge(t,{heading:i.selectTemplate,key:"templates-panel",...e},ge(z,{key:"feature-templates"},ge(q,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:i,messages:s}=this;if("create-features"!==i?.type)return null;const o=i.data.upload;return o?ge(t,{heading:s.createFeatures,key:"upload-details-panel",...e},ge(te,{helpMessage:this._helpMessage,messages:s,upload:o})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:i,messages:s,messagesCommon:o,headingLevel:a,viewModel:r}=this;if(!i)return null;const n="create-features"===i.type&&i.numPendingFeatures>0||"update"===i.type&&"create-features"===i?.activeWorkflow?.type&&i.activeWorkflow?.numPendingFeatures>0;return ge(t,{heading:s.createFeatures,key:"create-features-panel",...e},n?ge(Y,{disallowSave:this._disallowSave,editorViewModel:r,formWidget:this._batchAttributeForm,headingLevel:a,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):ge(V,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:a}=this,r=a.activeFeatureCount>1?i.multiFeature.editPanelTitle:i.singleFeature.editPanelTitle;return ge(t,{heading:r,key:"update-feature-panel",...e},ge(Y,{disallowSave:this._disallowSave,editorViewModel:a,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onMerge:this._onMerge,onSave:this._onSave,onSplit:this._onSplit}))}_renderDrawingSplitGeometry(e){const{EditorPanel:t}=this;return ge(t,{heading:this.messages.splitFeature,key:"draw-split-geometry-panel",...e},ge(V,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderReviewingSplitFeatures(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:a}=this;return ge(t,{heading:i.splitFeature,key:"review-split-features-panel",...e},ge(Y,{disallowSave:this._disallowSave,editorViewModel:a,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,visibleElements:this.visibleElements,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;if(e.title)return e.title;const{messagesFeature:i}=this;switch(e.type){case"attachment":return i.associationsAttachments;case"connectivity":return i.associationsConnectivity;case"structure":return i.associationsStructure;case"content":return i.associationsContents;case"container":return i.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;const i=t.associations;switch(e.type){case"attachment":return i.addAttachment;case"connectivity":return i.addConnectivity;case"structure":return i.addStructure;case"content":return i.addContent;case"container":return i.addContainer}}async _initializeAssociationItemList(e){const t=(await(import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js"))).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await(import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js"))).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:a}=this,r=a.formViewModel?.activeAssociationType,n=this._getAssociationTypeTitle(r);return ge(t,{heading:n,key:"viewing-associated-layers-panel",...e},ge(Y,{disallowSave:this._disallowSave,editorViewModel:a,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this,a=s.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state||this.viewModel.formDisabled;return t?ge(i,{heading:r,key:"add-association-select-feature",...e},ge(z,{key:"select-feature"},ge(q,null,t.render())),ge(N,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:o.apply,disabled:n,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&(a?.reset(),s.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):ge(i,{heading:r,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),i=e.utilityNetworkAssociationAddAssociationViewModel,s="update"===e.activeWorkflow?.type?e.activeWorkflow:null,o=s?s.activeWorkflow:null,a="add-association"===o?.type?o.sourceFeatureItem:null,r=i?.selectedFeature,n=i?.association,l=i?.utilityNetwork;a&&r&&n&&l&&(t.sourceFeature=a,t.targetFeature=r,t.association=n,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this;if(!t)return null;const a=s.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state;return ge(i,{heading:r,key:"add-association",...e},ge(z,{key:"add-association-content"},ge(q,null,t.render())),ge(N,{buttons:[{label:o.add,disabled:n||!a.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&s.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:i}=this,s=n(e.group.items,e=>i.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0);return s?ge(G,{kind:"warning",message:s}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:i,messages:s,messagesCommon:o}=this;return ge(t,{heading:s.addAttachment,key:"attachment-adding-panel",...e},ge(z,{key:"attachments"},this._renderAttachments()),ge(N,{buttons:[{label:i.submitting?o.cancel:o.add,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderSelectionListPage(e){const{_hasSelectionFromMultipleLayers:i,_hasInvalidBatchSelection:s,_selectionCountExceedsMaximum:o,_selectionList:a,_visibleSelectionCount:r,messages:n,EditorPanel:l}=this,{batchUpdateActions:c}=this.visibleElements,{maxVisibleFeatureCountPerLayer:d}=a;return ge(l,{heading:n.widgetLabel,key:"selection-list-panel",...e},this.visibleElements.selectionToolbar?ge("div",{class:E.selectionToolbarContainer},this._renderSelectionToolbar()):void 0,ge(z,{key:"selection-list"},ge(q,null,this._renderSelectionList())),ge(N,{buttons:[c?{label:t(n.batchEditing.editCount,{count:r}),disabled:s,onClick:()=>this.startUpdateWorkflowWithActiveSelection(),type:"button"}:void 0],notice:c&&i?{text:n.batchEditing.selectOneLayer,icon:"information"}:c&&o?{text:t(this.messages.multiFeature.formFailedToLoadTooManyFeatures,{num:d}),icon:"information"}:void 0}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:i,activeWorkflow:s,messages:o,messagesCommon:a}=this;return s?ge(t,{heading:o.editAttachment,key:"attachment-editing-panel",...e},ge(z,{key:"attachments"},this._renderAttachments()),s.shouldAllowAttachmentEditing?ge(N,{buttons:[{label:a.update,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:i.submitting,label:a.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:i,visibleElements:s}=this,o=this._helpMessage;return ge(t,{heading:i.widgetLabel,key:"landing-panel",...e},ge(z,{key:"landing-content"},this.editorItems.length?[s.editFeaturesSection?ge(q,{key:"edit-actions"},this._renderUpdateActions()):null,s.createFeaturesSection&&this.viewModel.canCreateVisible?ge(q,{key:"create-actions"},this._renderCreateActions()):null]:ge(K,{key:"no-content"},i.noEditableLayers)),o?ge("div",{class:E.helpMessage,key:"footer-actions",slot:"footer"},o):void 0)}_handleDragAndDrop(e){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none")}get _helpMessage(){return this.getHelpMessageString(this.activeWorkflow?.helpMessage)}get _noticeMessage(){return this.getHelpMessageString(this.activeWorkflow?.noticeMessage)}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:i}=this,s={id:"select",label:t.select};return ge("div",{class:E.updateActions,key:"update-actions"},ge(le,{level:ne(this.headingLevel)},e.editFeatures),this.visibleElements.selectionToolbar?ge("div",{class:E.selectionToolbarContainer},this._renderSelectionToolbar()):ge("calcite-list",{class:E.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},ce({disabled:!i.canUpdateVisible,grouped:!1,item:s,selectedItem:"awaiting-feature-to-update"===i.activeWorkflow?.stepId?s:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return ge("div",{key:"create-actions"},ge(le,{level:ne(this.headingLevel)},this.messages.createFeatures),ge("div",{class:E.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:i,viewModel:s}=this,{activeWorkflow:o}=s;if("update"!==o?.type)return null;const a=o.data.candidates,r=t(this.messages.multipleFeaturesTemplate,{total:a.length});return ge(i,{heading:r,key:"feature-list",...e},ge(O,{editorItems:this.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:o,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:i,noLabel:s}){const o=Promise.withResolvers(),{view:a}=this,r=a?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:i,action:()=>o.resolve(!0)},secondary:{label:s,action:()=>o.resolve(!1)}}}),o.promise.finally(()=>{this._clearPrompt(),r&&a?.focus()})}async _onSelectionListItemSelect(e){await this.viewModel.onSelectionListItemSelect(e)}async _onSelectionListMenuItemSelect(e,t){await this.viewModel.onSelectionListMenuItemSelect(e,t)}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=r(this._sketchImportAbortController),this._sketchToolbar=a(this._sketchToolbar),void this.removeHandles(fe);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const t=await(import("./Sketch.js"));if(!e.signal.aborted)try{this._sketchToolbar=new t.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",suppressDeprecationWarning:!0,visibleElements:new oe({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,singlePluginBackButton:!1,createTools:new ie({freehandPolygon:!0,freehandPolyline:!0}),selectionTools:new se({"lasso-selection":!1,"rectangle-selection":!1}),geometrySimplificationActivityIndicator:!1})}),this.addHandles([l(()=>{const e=this.viewModel.activeLeafWorkflow;return e&&"availableCreateTools"in e?e.availableCreateTools:null},e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)},c),l(()=>this.visibleElements.undoRedoButtons,e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)},c),h(()=>this.viewModel?.sketchViewModel,e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)},c),h(()=>this.viewModel.sketchViewModel?.pluginManager,e=>{e.sketch=this._sketchToolbar},c)],fe)}finally{this._sketchImportAbortController=null}}getHelpMessageString(e){const{messages:t,view:i}=this;if("curveToolDensifyWarning"===e)return t.curveToolDensifyWarning;return e?t["3d"===i?.type?"helpMessages3d":"helpMessages2d"]?.[e]:void 0}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([p()],ye.prototype,"_batchAttributeForm",void 0),e([p()],ye.prototype,"_featureForm",void 0),e([p()],ye.prototype,"_sketchToolbar",void 0),e([p()],ye.prototype,"_attachments",void 0),e([p()],ye.prototype,"_associationItemList",void 0),e([p()],ye.prototype,"_associationSettings",void 0),e([p()],ye.prototype,"_featureTemplates",void 0),e([p()],ye.prototype,"_filterText",void 0),e([p()],ye.prototype,"_hasInvalidBatchSelection",null),e([p()],ye.prototype,"_hasSelectionFromMultipleLayers",null),e([p()],ye.prototype,"_hasSelectionWithUneditableFeatures",null),e([p()],ye.prototype,"_prompt",void 0),e([p()],ye.prototype,"_spinner",void 0),e([p()],ye.prototype,"_deleteButtonCommonInfo",null),e([p()],ye.prototype,"_loading",void 0),e([p()],ye.prototype,"_disallowSave",void 0),e([p()],ye.prototype,"_selectionCountExceedsMaximum",null),e([p()],ye.prototype,"_selectionList",void 0),e([p()],ye.prototype,"_selectionListItemActionConfigs",null),e([p()],ye.prototype,"_selectionToolbar",void 0),e([p()],ye.prototype,"_visibleSelectionCount",null),e([p({readOnly:!0})],ye.prototype,"activeWorkflow",null),e([p()],ye.prototype,"editorItems",null),e([p()],ye.prototype,"effectiveSelectionManager",null),e([p()],ye.prototype,"headingLevel",void 0),e([p()],ye.prototype,"hideTemplatesForInactiveLayers",null),e([p()],ye.prototype,"icon",null),e([p()],ye.prototype,"label",null),e([p({type:w})],ye.prototype,"labelOptions",null),e([p()],ye.prototype,"layerInfos",null),e([p(),pe("esri/widgets/Editor/t9n/Editor")],ye.prototype,"messages",void 0),e([p(),pe("esri/t9n/common")],ye.prototype,"messagesCommon",void 0),e([p(),pe("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],ye.prototype,"messagesTemplates",void 0),e([p(),pe("esri/widgets/Feature/t9n/Feature")],ye.prototype,"messagesFeature",void 0),e([p()],ye.prototype,"selectionManager",null),e([p({type:f})],ye.prototype,"snappingOptions",null),e([p()],ye.prototype,"syncWithViewSelectionManager",null),e([p()],ye.prototype,"syncViewSelection",null),e([p({type:v})],ye.prototype,"tooltipOptions",null),e([p()],ye.prototype,"supportingWidgetDefaults",void 0),e([p({type:_,nonNullable:!0})],ye.prototype,"valueOptions",null),e([p({value:!1})],ye.prototype,"useLegacyCreateTools",null),e([p()],ye.prototype,"formSystem",null),e([p()],ye.prototype,"isUsingLegacyCreateTools",null),e([p()],ye.prototype,"view",null),e([p({type:W}),ue(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],ye.prototype,"viewModel",void 0),e([p({type:I,nonNullable:!0})],ye.prototype,"visibleElements",void 0),e([p()],ye.prototype,"_helpMessage",null),e([p()],ye.prototype,"_noticeMessage",null),ye=e([u("esri.widgets.Editor")],ye);const be=ye;export{be as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import o from"../../Color.js";import{handlesGroup as r}from"../../core/handleUtils.js";import{memoize as t}from"../../core/memoize.js";import{watch as n}from"../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../core/units.js";import{property as s,subclass as l}from"../../core/accessorSupport/decorators.js";import a from"./ElevationProfileLine.js";import{getGroundMinDemResolution as u}from"./support/elevationQuerySourceUtils.js";let p=class extends a{constructor(e){super(e),this.type="ground",this.color=new o("#ff7f00"),this.viewVisualizationEnabled=!0,this.numSamplesForPreview=50,this.numSamplesPerChunk=1e3,this._getQueryElevationDependencies=t((e,o)=>({ground:e,groundLayers:o}))}get available(){const e=this._ground;return null!=e&&e.layers.some(e=>e.visible)}get minDemResolution(){return u(this._ground)}get _queryElevationDependencies(){return this._getQueryElevationDependencies(this._ground,this._groundLayers)}get _ground(){return this._viewModel?.view?.map?.ground}get _groundLayers(){return this._ground?.layers?.toArray()??[]}async queryElevation(e,o){const r=this._queryElevationDependencies;if(null==r)throw new Error("ElevationProfileLineGround: no dependencies");const{ground:t}=r;if(null==t)throw new Error("No ground configured in the view");const n=await t.queryElevation(e,o),s=i(e.spatialReference),l=i(t.layers.at(0).spatialReference);if(s!==l){const e=n.geometry;e.points=e.points.map(([e,r,t])=>[e,r,t===o.noDataValue?t:t*l/s])}return n}attach(e){return r([super.attach(e),n(()=>this._queryElevationDependencies,()=>this._onChange())])}};e([s({type:o,nonNullable:!0})],p.prototype,"color",void 0),e([s()],p.prototype,"viewVisualizationEnabled",void 0),e([s()],p.prototype,"available",null),e([s({readOnly:!0})],p.prototype,"minDemResolution",null),e([s()],p.prototype,"_queryElevationDependencies",null),e([s()],p.prototype,"_ground",null),e([s()],p.prototype,"_groundLayers",null),p=e([l("esri.widgets.ElevationProfile.ElevationProfileLineGround")],p);const d=p;export{d as default};
2
+ import{__decorate as e}from"tslib";import o from"../../Color.js";import{handlesGroup as r}from"../../core/handleUtils.js";import{memoize as t}from"../../core/memoize.js";import{watch as n}from"../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../core/units.js";import{property as s,subclass as l}from"../../core/accessorSupport/decorators.js";import a from"./ElevationProfileLine.js";import{getGroundMinDemResolution as u}from"./support/elevationQuerySourceUtils.js";let p=class extends a{constructor(e){super(e),this.type="ground",this.color=new o("#ff7f00"),this.viewVisualizationEnabled=!0,this.numSamplesForPreview=50,this.numSamplesPerChunk=1e3,this._getQueryElevationDependencies=t((e,o)=>({ground:e,groundLayers:o}))}get available(){const e=this._ground;return null!=e&&e.allLayers.some(e=>e.visible)}get minDemResolution(){return u(this._ground)}get _queryElevationDependencies(){return this._getQueryElevationDependencies(this._ground,this._groundLayers)}get _ground(){return this._viewModel?.view?.map?.ground}get _groundLayers(){return this._ground?.allLayers?.toArray()??[]}async queryElevation(e,o){const r=this._queryElevationDependencies;if(null==r)throw new Error("ElevationProfileLineGround: no dependencies");const{ground:t}=r;if(null==t)throw new Error("No ground configured in the view");const n=await t.queryElevation(e,o),s=i(e.spatialReference),l=i(t.layers.at(0).spatialReference);if(s!==l){const e=n.geometry;e.points=e.points.map(([e,r,t])=>[e,r,t===o.noDataValue?t:t*l/s])}return n}attach(e){return r([super.attach(e),n(()=>this._queryElevationDependencies,()=>this._onChange())])}};e([s({type:o,nonNullable:!0})],p.prototype,"color",void 0),e([s()],p.prototype,"viewVisualizationEnabled",void 0),e([s()],p.prototype,"available",null),e([s({readOnly:!0})],p.prototype,"minDemResolution",null),e([s()],p.prototype,"_queryElevationDependencies",null),e([s()],p.prototype,"_ground",null),e([s()],p.prototype,"_groundLayers",null),p=e([l("esri.widgets.ElevationProfile.ElevationProfileLineGround")],p);const d=p;export{d as default};
@@ -24,6 +24,7 @@ export interface HistogramRangeSliderViewModelProperties extends SliderViewModel
24
24
  /**
25
25
  * Provides the logic for the [HistogramRangeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/HistogramRangeSlider/) widget.
26
26
  *
27
+ * @deprecated since version 5.2. Use the [Histogram Range Slider component](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider-histogram-range/) directly instead.
27
28
  * @since 4.12
28
29
  * @see [HistogramRangeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/HistogramRangeSlider/)
29
30
  * @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as r}from"../../core/accessorSupport/decorators.js";import a from"../Slider/SliderViewModel.js";import{formatDateLabel as s,formatNumberLabel as n}from"../smartMapping/support/utils.js";let o=class extends a{constructor(e){super({...e,suppressDeprecationWarning:!0}),this.average=null,this.bins=null,this.hasTimeData=!1,this.labelFormatFunction=e=>{if(this.hasTimeData)return s(e);const{max:t,min:r,precision:a}=this,o=t-r>10?2:a;return n(parseFloat(e.toFixed(o)))},this.rangeType="equal",this.standardDeviation=null}generateWhereClause(e){const{rangeType:t,state:r,values:a}=this;if("ready"!==r||!a?.length||null==e)return null;const s=a[0],n=a.length>1?a[a.length-1]:null;switch(t){case"equal":return`${e} = ${s}`;case"not-equal":return`${e} <> ${s}`;case"less-than":return`${e} < ${s}`;case"greater-than":return`${e} > ${s}`;case"at-least":return`${e} >= ${s}`;case"at-most":return`${e} <= ${s}`;case"between":return`${e} BETWEEN ${s} AND ${n}`;case"not-between":return`${e} NOT BETWEEN ${s} AND ${n}`;default:return null}}};e([t()],o.prototype,"average",void 0),e([t()],o.prototype,"bins",void 0),e([t()],o.prototype,"hasTimeData",void 0),e([t()],o.prototype,"labelFormatFunction",void 0),e([t()],o.prototype,"rangeType",void 0),e([t()],o.prototype,"standardDeviation",void 0),o=e([r("esri.widgets.HistogramRangeSlider.HistogramRangeSliderViewModel")],o);const i=o;export{i as default};
2
+ import{__decorate as e}from"tslib";import{deprecateUnnecessaryViewModel as r}from"../../core/deprecate.js";import t from"../../core/Logger.js";import{property as s,subclass as a}from"../../core/accessorSupport/decorators.js";import o from"../Slider/SliderViewModel.js";import{formatDateLabel as n,formatNumberLabel as i}from"../smartMapping/support/utils.js";let l=class extends o{constructor(e){super({...e,suppressDeprecationWarning:!0}),this.average=null,this.bins=null,this.hasTimeData=!1,this.labelFormatFunction=e=>{if(this.hasTimeData)return n(e);const{max:r,min:t,precision:s}=this,a=r-t>10?2:s;return i(parseFloat(e.toFixed(a)))},this.rangeType="equal",this.standardDeviation=null,e?.suppressDeprecationWarning||r(t.getLogger(this),"Histogram Range Slider","arcgis-slider-histogram-range",{version:"5.2"})}normalizeCtorArgs(e){const{suppressDeprecationWarning:r,...t}=e??{};return t}generateWhereClause(e){const{rangeType:r,state:t,values:s}=this;if("ready"!==t||!s?.length||null==e)return null;const a=s[0],o=s.length>1?s[s.length-1]:null;switch(r){case"equal":return`${e} = ${a}`;case"not-equal":return`${e} <> ${a}`;case"less-than":return`${e} < ${a}`;case"greater-than":return`${e} > ${a}`;case"at-least":return`${e} >= ${a}`;case"at-most":return`${e} <= ${a}`;case"between":return`${e} BETWEEN ${a} AND ${o}`;case"not-between":return`${e} NOT BETWEEN ${a} AND ${o}`;default:return null}}};e([s()],l.prototype,"average",void 0),e([s()],l.prototype,"bins",void 0),e([s()],l.prototype,"hasTimeData",void 0),e([s()],l.prototype,"labelFormatFunction",void 0),e([s()],l.prototype,"rangeType",void 0),e([s()],l.prototype,"standardDeviation",void 0),l=e([a("esri.widgets.HistogramRangeSlider.HistogramRangeSliderViewModel")],l);const p=l;export{p as default};