@arcgis/core 6.0.0-next.1 → 6.0.0-next.10

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 (701) hide show
  1. package/analysis/AreaMeasurementAnalysis.d.ts +11 -1
  2. package/analysis/DimensionSimpleStyle.js +1 -1
  3. package/analysis/DirectLineMeasurementAnalysis.d.ts +11 -1
  4. package/analysis/DistanceMeasurementAnalysis.d.ts +8 -0
  5. package/arcade/featureSetUtils.js +1 -1
  6. package/arcade/functions/knowledgegraph.js +1 -1
  7. package/arcade/geometry/unitConversion.js +1 -1
  8. package/arcgisGlobal.d.ts +5 -5
  9. package/assets/esri/core/workers/RemoteClient.js +1 -1
  10. package/assets/esri/core/workers/chunks/01803f76bc0d9f2cd566.js +1 -0
  11. package/assets/esri/core/workers/chunks/{f09c9d9a554c33a753b4.js → 02253bdffbd580af22d8.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{5078b66ba31b770b689f.js → 037a8cc19debbaaa4e10.js} +1 -1
  13. package/assets/esri/core/workers/chunks/066550852483ab8f77bc.js +1 -0
  14. package/assets/esri/core/workers/chunks/{1ede8666d804c553803e.js → 0b6941781e35ce0f7274.js} +1 -1
  15. package/assets/esri/core/workers/chunks/0ccab50877b24f862d6e.js +1 -0
  16. package/assets/esri/core/workers/chunks/0f725cf79ce00e790a7d.js +1 -0
  17. package/assets/esri/core/workers/chunks/{a0d459bdb91ee892d4b6.js → 116293b1ee788a89ce1e.js} +1 -1
  18. package/assets/esri/core/workers/chunks/12a7997a40c77f5c9160.js +1 -0
  19. package/assets/esri/core/workers/chunks/{a7325ebb7edf3273bb34.js → 12b84262dedc6b393136.js} +1 -1
  20. package/assets/esri/core/workers/chunks/1b077c92345ffb5916c2.js +1 -0
  21. package/assets/esri/core/workers/chunks/{6dd0b79fa3a629ab4f27.js → 1bca39e0e651426bdbb5.js} +1 -1
  22. package/assets/esri/core/workers/chunks/1c0c5cb13c2590aae906.js +1 -0
  23. package/assets/esri/core/workers/chunks/{8959a825f5e1ce6f38ac.js → 1c65ab9ed611c322ce27.js} +1 -1
  24. package/assets/esri/core/workers/chunks/1e0d2715d603f48a7e0b.js +1 -0
  25. package/assets/esri/core/workers/chunks/261fea092ee7d27608a0.js +1 -0
  26. package/assets/esri/core/workers/chunks/2686fe5b62dd0be699c0.js +1 -0
  27. package/assets/esri/core/workers/chunks/2a97268000c6d03ef720.js +1 -0
  28. package/assets/esri/core/workers/chunks/{83589144eeeb08f45557.js → 2aeb5cc32284dd3e4d22.js} +1 -1
  29. package/assets/esri/core/workers/chunks/2d9a1f23ec6ce90723ac.js +1 -0
  30. package/assets/esri/core/workers/chunks/2e096537a3a5555a4a93.js +1 -0
  31. package/assets/esri/core/workers/chunks/{7a05b18f655c1167ce0a.js → 2ef5237e4c876d6a4ee0.js} +1 -1
  32. package/assets/esri/core/workers/chunks/37d6a264a3f1d8072aa0.js +1 -0
  33. package/assets/esri/core/workers/chunks/3b3e519f15ed52c83f0c.js +1 -0
  34. package/assets/esri/core/workers/chunks/3c0ed15b544df6fb0903.js +1 -0
  35. package/assets/esri/core/workers/chunks/{b612de42ee86c0d95247.js → 3d9d7d3a40b51eb7ee3d.js} +1 -1
  36. package/assets/esri/core/workers/chunks/3df5500a85345577480a.js +1 -0
  37. package/assets/esri/core/workers/chunks/3ffda5bf0b91700dc308.js +1 -0
  38. package/assets/esri/core/workers/chunks/40a584cb952e94326e9e.js +1 -0
  39. package/assets/esri/core/workers/chunks/{1317ecdfd0cfa683a493.js → 42323093827adffe56d3.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{1ba0dfbe0958cdbd7c9f.js → 42fd2a7b22b03dacc6a7.js} +1 -1
  41. package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +1 -0
  42. package/assets/esri/core/workers/chunks/{d201fbf3ceff946d2bd6.js → 44d5508042cacdfcac47.js} +1 -1
  43. package/assets/esri/core/workers/chunks/4503b20ca6a80fb63d72.js +1 -0
  44. package/assets/esri/core/workers/chunks/45367aa8e5c5d574de94.js +1 -0
  45. package/assets/esri/core/workers/chunks/45800373650fbc8262e6.js +1 -0
  46. package/assets/esri/core/workers/chunks/{6a7ab1ef9a37e87db5ae.js → 46a7da93a63663878583.js} +1 -1
  47. package/assets/esri/core/workers/chunks/46b4fb6a7fe4877b0efc.js +1120 -0
  48. package/assets/esri/core/workers/chunks/47d074136a7f8e551a9a.js +1 -0
  49. package/assets/esri/core/workers/chunks/4911ce62421a6c3320b0.js +1 -0
  50. package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +1 -0
  51. package/assets/esri/core/workers/chunks/4a6b92ecbb1f1c55cc43.js +1 -0
  52. package/assets/esri/core/workers/chunks/4debf2d9c3465250ef7a.js +1 -0
  53. package/assets/esri/core/workers/chunks/4e544de61f07ca660236.js +1 -0
  54. package/assets/esri/core/workers/chunks/4e8e322b469657ac22e2.js +1 -0
  55. package/assets/esri/core/workers/chunks/505227797bcf2a1d908d.js +1 -0
  56. package/assets/esri/core/workers/chunks/{67ac6b326bf80fc3d33d.js → 53be85d04cd2da4f391d.js} +1 -1
  57. package/assets/esri/core/workers/chunks/54778dec1598818d93cb.js +1 -0
  58. package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +1 -0
  59. package/assets/esri/core/workers/chunks/557671c897ca5563be6c.js +1 -0
  60. package/assets/esri/core/workers/chunks/567a65f4203f6e81f4b4.js +1 -0
  61. package/assets/esri/core/workers/chunks/5c7780f804d789cb37f5.js +1 -0
  62. package/assets/esri/core/workers/chunks/606ea251075fe81a1206.js +1 -0
  63. package/assets/esri/core/workers/chunks/{ceb680688fe7e570a774.js → 608be1172a908e92b9f1.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{e521bb9ee2030245c3ce.js → 612104dff305ff062dfa.js} +2 -2
  65. package/assets/esri/core/workers/chunks/6299be5e7e26bf3c6859.js +1 -0
  66. package/assets/esri/core/workers/chunks/{3ac9dcbb0571a2580236.js → 62c8c9ad09e0166207fd.js} +1 -1
  67. package/assets/esri/core/workers/chunks/6400446b7615b97c3521.js +1 -0
  68. package/assets/esri/core/workers/chunks/6431480ba0fa8c8d487f.js +1 -0
  69. package/assets/esri/core/workers/chunks/6588725275c75fae0d9c.js +1 -0
  70. package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +1 -0
  71. package/assets/esri/core/workers/chunks/{9232f57623e1fa3ccabc.js → 67e4b5651fd7ff7d8cf0.js} +1 -1
  72. package/assets/esri/core/workers/chunks/68be3fb88ca61f82fb90.js +1 -0
  73. package/assets/esri/core/workers/chunks/6c9266120d46e8c69dbf.js +1 -0
  74. package/assets/esri/core/workers/chunks/6c9acd9e4e201dc380e9.js +1 -0
  75. package/assets/esri/core/workers/chunks/6ebe73f69ae822053b70.js +1 -0
  76. package/assets/esri/core/workers/chunks/709e019885822b1f6f3e.js +1 -0
  77. package/assets/esri/core/workers/chunks/70cc2d79653d66e85b58.js +1 -0
  78. package/assets/esri/core/workers/chunks/7449568eb2305bf2d650.js +1 -0
  79. package/assets/esri/core/workers/chunks/745a153d0cd34faa124e.js +1 -0
  80. package/assets/esri/core/workers/chunks/7572c2bc5062e66f6330.js +1 -0
  81. package/assets/esri/core/workers/chunks/76196c414e48834f7b92.js +1 -0
  82. package/assets/esri/core/workers/chunks/78472a57c2ba146fec65.js +1 -0
  83. package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +1 -0
  84. package/assets/esri/core/workers/chunks/7f0f9dddc44b1f1600f0.js +1 -0
  85. package/assets/esri/core/workers/chunks/814751e705c05099f864.js +1 -0
  86. package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +1 -0
  87. package/assets/esri/core/workers/chunks/8487727f1197cf7dbf50.js +1 -0
  88. package/assets/esri/core/workers/chunks/88e54449261ef94e390d.js +1 -0
  89. package/assets/esri/core/workers/chunks/8b0d5551978ab0aac0d1.js +1 -0
  90. package/assets/esri/core/workers/chunks/8d0c2de92770a1567536.js +1 -0
  91. package/assets/esri/core/workers/chunks/900181f68449d8f82eeb.js +1 -0
  92. package/assets/esri/core/workers/chunks/939942b00ba380e2957e.js +1 -0
  93. package/assets/esri/core/workers/chunks/943a0f140813ee4ab04a.js +1 -0
  94. package/assets/esri/core/workers/chunks/96c3900685cfb2a8ca12.js +1 -0
  95. package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +1 -0
  96. package/assets/esri/core/workers/chunks/{c76c42c74eedd43263d3.js → 9dd1fc56eb1ea6eb705e.js} +1 -1
  97. package/assets/esri/core/workers/chunks/{86a051e9fe71aa356108.js → 9e3e442a9874ed23a043.js} +1 -1
  98. package/assets/esri/core/workers/chunks/{aa1054834738aef48bda.js → a0356702f2d3f787aeac.js} +1 -1
  99. package/assets/esri/core/workers/chunks/a40b6d8b5c73e06e14d4.js +1 -0
  100. package/assets/esri/core/workers/chunks/{1ba1f705b6ce5c8ea702.js → a655ebdb4bf0660615a2.js} +1 -1
  101. package/assets/esri/core/workers/chunks/a8286febe371dc186aaa.js +1 -0
  102. package/assets/esri/core/workers/chunks/aaba33611753c6aada68.js +1 -0
  103. package/assets/esri/core/workers/chunks/aba42885c5d6b2b5fe7f.js +1 -0
  104. package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +1 -0
  105. package/assets/esri/core/workers/chunks/ae40eac1eadd1a537bf4.js +1 -0
  106. package/assets/esri/core/workers/chunks/aeaaff7a4b1a99540f52.js +1 -0
  107. package/assets/esri/core/workers/chunks/af349c7bc8ef41a0e1bd.js +1 -0
  108. package/assets/esri/core/workers/chunks/af75747b06d79446a855.js +1 -0
  109. package/assets/esri/core/workers/chunks/b564ec4e03478f5659db.js +1 -0
  110. package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +1 -0
  111. package/assets/esri/core/workers/chunks/bc0f54a2c15502b630ec.js +1 -0
  112. package/assets/esri/core/workers/chunks/{ff3a53c3f00335552317.js → c29c474c4b1049352d3e.js} +1 -1
  113. package/assets/esri/core/workers/chunks/{9ab25ee06041f907b9a2.js → c2c1f51a4668055c2838.js} +1 -1
  114. package/assets/esri/core/workers/chunks/c337fc0e6dc69c233e6d.js +1 -0
  115. package/assets/esri/core/workers/chunks/{a7985d20fa6e8d4878e7.js → d0f5bee9db1ad51ae687.js} +1 -1
  116. package/assets/esri/core/workers/chunks/d6ad4390df576198e45b.js +1 -0
  117. package/assets/esri/core/workers/chunks/d7f6021fd41b9571a02c.js +1 -0
  118. package/assets/esri/core/workers/chunks/d90a3bfd45b5ed4092e0.js +1 -0
  119. package/assets/esri/core/workers/chunks/dba280c370df13196711.js +1 -0
  120. package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +1 -0
  121. package/assets/esri/core/workers/chunks/{c18189710d6198516175.js → de5ecb567bd69c613e9d.js} +1 -1
  122. package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +1 -0
  123. package/assets/esri/core/workers/chunks/{534186fc921a0ccf58dc.js → e1f5d00878f27e1d413e.js} +1 -1
  124. package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +1 -0
  125. package/assets/esri/core/workers/chunks/e932951598499befabf5.js +1 -0
  126. package/assets/esri/core/workers/chunks/{e1ba915dae7747932c0f.js → eb04e1717a1002cda3ab.js} +1 -1
  127. package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +1 -0
  128. package/assets/esri/core/workers/chunks/f1df76f098a3cc924832.js +1 -0
  129. package/assets/esri/core/workers/chunks/f1f90adae13b04898008.js +1 -0
  130. package/assets/esri/core/workers/chunks/f46d9a19f79d4a4bd354.js +1 -0
  131. package/assets/esri/core/workers/chunks/f4f9d08b2df856e3b694.js +1 -0
  132. package/assets/esri/core/workers/chunks/{711cfb84659cb4437679.js → f528ac5c648ca6a98582.js} +1 -1
  133. package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +1 -0
  134. package/assets/esri/core/workers/chunks/fb444954be74c1962ced.js +1 -0
  135. package/assets/esri/core/workers/chunks/fc44227c1756f65b95df.js +1 -0
  136. package/assets/esri/core/workers/chunks/{72019baeba520edb6bb0.js → fc44d45598a7476bc606.js} +1 -1
  137. package/assets/esri/core/workers/chunks/fecaf0bc28aeea4d15db.js +1 -0
  138. package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
  139. package/assets/esri/themes/base/_mixins.scss +2 -2
  140. package/assets/esri/themes/base/widgets/_Attribution.scss +1 -1
  141. package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +2 -2
  142. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +5 -5
  143. package/assets/esri/themes/base/widgets/_Bookmarks.scss +1 -1
  144. package/assets/esri/themes/base/widgets/_BuildingLevelPicker.scss +2 -2
  145. package/assets/esri/themes/base/widgets/_BuildingPhasePicker.scss +5 -5
  146. package/assets/esri/themes/base/widgets/_CatalogLayerList.scss +1 -1
  147. package/assets/esri/themes/base/widgets/_Compass.scss +0 -2
  148. package/assets/esri/themes/base/widgets/_DirectionalPad.scss +4 -10
  149. package/assets/esri/themes/base/widgets/_Directions.scss +40 -40
  150. package/assets/esri/themes/base/widgets/_Editor.scss +7 -7
  151. package/assets/esri/themes/base/widgets/_Expand.scss +1 -1
  152. package/assets/esri/themes/base/widgets/_Feature.scss +1 -1
  153. package/assets/esri/themes/base/widgets/_FeatureForm.scss +6 -6
  154. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationLayers.scss +1 -1
  155. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationList.scss +1 -1
  156. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationSettings.scss +4 -4
  157. package/assets/esri/themes/base/widgets/_FeatureTable.scss +27 -27
  158. package/assets/esri/themes/base/widgets/_FeatureTemplates.scss +1 -1
  159. package/assets/esri/themes/base/widgets/_Features.scss +6 -6
  160. package/assets/esri/themes/base/widgets/_FilterBuilder.scss +1 -1
  161. package/assets/esri/themes/base/widgets/_FilterCondition.scss +1 -1
  162. package/assets/esri/themes/base/widgets/_Grid.scss +18 -18
  163. package/assets/esri/themes/base/widgets/_GridControls.scss +11 -11
  164. package/assets/esri/themes/base/widgets/_LayerList.scss +1 -1
  165. package/assets/esri/themes/base/widgets/_Legend.scss +5 -5
  166. package/assets/esri/themes/base/widgets/_NavigationToggle.scss +4 -1
  167. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +23 -28
  168. package/assets/esri/themes/base/widgets/_ResponsiveToolbar.scss +0 -2
  169. package/assets/esri/themes/base/widgets/_SearchResultRenderer.scss +1 -1
  170. package/assets/esri/themes/base/widgets/_SelectionList.scss +15 -15
  171. package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +3 -5
  172. package/assets/esri/themes/base/widgets/_ShadowCast.scss +11 -11
  173. package/assets/esri/themes/base/widgets/_Sketch.scss +1 -1
  174. package/assets/esri/themes/base/widgets/_Slice.scss +3 -3
  175. package/assets/esri/themes/base/widgets/_SnappingControls.scss +1 -1
  176. package/assets/esri/themes/base/widgets/_TimeSlider.scss +5 -5
  177. package/assets/esri/themes/base/widgets/_TimeZoneLabel.scss +5 -4
  178. package/assets/esri/themes/base/widgets/_Tooltip.scss +14 -17
  179. package/assets/esri/themes/base/widgets/_UtilityNetworkAssociations.scss +2 -2
  180. package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +1 -1
  181. package/assets/esri/themes/base/widgets/_UtilityNetworkValidateTopology.scss +2 -2
  182. package/assets/esri/themes/base/widgets/_ValuePicker.scss +2 -2
  183. package/assets/esri/themes/base/widgets/_VideoPlayer.scss +5 -5
  184. package/assets/esri/themes/base/widgets/_Widget.scss +5 -1
  185. package/assets/esri/themes/dark/main.css +1 -1
  186. package/assets/esri/themes/light/main.css +1 -1
  187. package/assets/esri/themes/light/view.css +1 -1
  188. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
  189. package/{basemaps/BasemapCollection.d.ts → basemapGallery/BasemapGalleryModel.d.ts} +8 -8
  190. package/{basemaps/BasemapCollection.js → basemapGallery/BasemapGalleryModel.js} +1 -1
  191. package/{basemaps → basemapGallery}/BasemapsSource.d.ts +1 -1
  192. package/{basemaps → basemapGallery}/BasemapsSource.js +1 -1
  193. package/{basemaps → basemapGallery}/LocalBasemapsSource.d.ts +2 -2
  194. package/{basemaps → basemapGallery}/LocalBasemapsSource.js +1 -1
  195. package/{basemaps → basemapGallery}/PortalBasemapsSource.d.ts +2 -2
  196. package/{basemaps → basemapGallery}/PortalBasemapsSource.js +1 -1
  197. package/{basemaps → basemapGallery}/support/BasemapItem.d.ts +2 -2
  198. package/{basemaps → basemapGallery}/support/BasemapItem.js +1 -1
  199. package/{basemaps → basemapGallery}/types.d.ts +2 -2
  200. package/chunks/AtmosphereCompositing.glsl.js +1 -1
  201. package/chunks/ChapmanAtmosphere.glsl.js +3 -3
  202. package/chunks/CloudsComposition.glsl.js +1 -1
  203. package/chunks/Component.glsl.js +41 -41
  204. package/chunks/DefaultMaterial.glsl.js +2 -2
  205. package/chunks/EdgeShader.glsl.js +9 -9
  206. package/chunks/Fog.glsl.js +5 -5
  207. package/chunks/GaussianSplat.glsl.js +2 -2
  208. package/chunks/GlobalIllumination.glsl.js +13 -11
  209. package/chunks/GlobalIlluminationBlur.glsl.js +3 -5
  210. package/chunks/GlobalIlluminationUpscale.glsl.js +1 -1
  211. package/chunks/HUDMaterial.glsl.js +13 -13
  212. package/chunks/Haze.glsl.js +6 -6
  213. package/chunks/HazeCompositing.glsl.js +1 -1
  214. package/chunks/LaserlinePath.glsl.js +6 -6
  215. package/chunks/LineCallout.glsl.js +1 -1
  216. package/chunks/LineMarker.glsl.js +5 -5
  217. package/chunks/NavigationDepth.glsl.js +2 -2
  218. package/chunks/Path.glsl.js +1 -1
  219. package/chunks/Pattern.glsl.js +26 -26
  220. package/chunks/Precipitation.glsl.js +7 -7
  221. package/chunks/RealisticTree.glsl.js +2 -2
  222. package/chunks/RibbonLine.glsl.js +80 -73
  223. package/chunks/ShadowCastAccumulate.glsl.js +1 -1
  224. package/chunks/ShadowHighlight.glsl.js +5 -5
  225. package/chunks/ShadowHighlightBuffer.glsl.js +1 -1
  226. package/chunks/SimpleAtmosphere.glsl.js +4 -4
  227. package/chunks/Terrain.glsl.js +29 -32
  228. package/chunks/Viewshed.glsl.js +2 -2
  229. package/chunks/Water.glsl.js +2 -2
  230. package/config.js +1 -1
  231. package/core/Loadable.js +1 -1
  232. package/core/arrayUtils.js +1 -1
  233. package/core/colorUtils.js +1 -1
  234. package/core/has.js +1 -1
  235. package/core/screenUtils.js +1 -1
  236. package/core/units.js +1 -1
  237. package/core/workers/workerFactory.js +1 -1
  238. package/form/elements/inputs/DynamicChoiceInput.d.ts +35 -5
  239. package/geometry/HeightModelInfo.js +1 -1
  240. package/geometry/operators/proximityOperator.js +1 -1
  241. package/geometry/projectionUtils.js +1 -1
  242. package/geometry/support/meshUtils.d.ts +1 -1
  243. package/geometry/support/scaleUtils.js +1 -1
  244. package/geometry/support/wkt.js +2 -0
  245. package/kernel.js +1 -1
  246. package/layers/BaseDynamicLayer.d.ts +1 -0
  247. package/layers/BaseElevationLayer.d.ts +2 -0
  248. package/layers/BaseTileLayer.d.ts +12 -9
  249. package/layers/CSVLayer.d.ts +0 -15
  250. package/layers/FeatureLayer.d.ts +2 -15
  251. package/layers/GeoJSONLayer.d.ts +0 -52
  252. package/layers/GeoRSSLayer.d.ts +0 -44
  253. package/layers/GeospatialPDFLayer.d.ts +2 -5
  254. package/layers/GeospatialPDFLayer.js +1 -1
  255. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  256. package/layers/OrientedImageryLayer.js +1 -1
  257. package/layers/ParquetLayer.d.ts +100 -12
  258. package/layers/ParquetLayer.js +1 -1
  259. package/layers/SketchLayer.d.ts +0 -1
  260. package/layers/VectorTileLayer.d.ts +2 -12
  261. package/layers/geospatialPDF/renderExtentUtils.js +1 -1
  262. package/layers/graphics/data/FeatureStore.js +1 -1
  263. package/layers/graphics/data/QueryEngineResult.js +1 -1
  264. package/layers/graphics/data/geometryUtils.js +1 -1
  265. package/layers/graphics/data/projectionSupport.js +1 -1
  266. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  267. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  268. package/layers/graphics/transferFeatures.js +1 -1
  269. package/layers/knowledgeGraph/layerUtils.js +1 -1
  270. package/layers/knowledgeGraph/nodeMovementUtils.js +1 -1
  271. package/layers/mixins/PortalLayer.js +1 -1
  272. package/layers/mixins/RefreshableLayer.d.ts +1 -3
  273. package/layers/mixins/ScaleRangeLayer.js +1 -1
  274. package/layers/mixins/SublayersOwner.js +1 -1
  275. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  276. package/layers/orientedImagery/core/utils.js +1 -1
  277. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  278. package/layers/raster/datasets/TIFFRaster.js +1 -1
  279. package/layers/raster/datasets/byteStreamUtils.js +1 -1
  280. package/layers/raster/formats/tiffParser.js +1 -1
  281. package/layers/support/ParquetPortalItemData.d.ts +2 -0
  282. package/layers/support/ParquetPortalItemData.js +1 -1
  283. package/layers/support/PortalItemData.d.ts +21 -0
  284. package/layers/support/PortalItemData.js +1 -1
  285. package/layers/support/Sublayer.js +1 -1
  286. package/layers/support/SubtypeSublayer.js +1 -1
  287. package/layers/support/layersLoader.js +1 -1
  288. package/layers/support/parquetUtils.d.ts +1 -1
  289. package/layers/support/types.d.ts +1 -1
  290. package/package.json +3 -3
  291. package/popup/FeaturesModel.d.ts +27 -6
  292. package/popup/FeaturesModel.js +1 -1
  293. package/portal/support/layersLoader.js +1 -1
  294. package/portal/support/portalLayers.js +1 -1
  295. package/renderers/VectorFieldRenderer.d.ts +4 -4
  296. package/rest/print.d.ts +49 -3
  297. package/rest/print.js +1 -1
  298. package/rest/query/operations/pbfFlatFeatureSet.js +1 -1
  299. package/rest/support/printTaskUtils.js +1 -1
  300. package/smartMapping/renderers/color.js +1 -1
  301. package/smartMapping/renderers/dotDensity.js +1 -1
  302. package/smartMapping/renderers/heatmap.js +1 -1
  303. package/smartMapping/renderers/pieChart.js +1 -1
  304. package/smartMapping/renderers/support/spikeUtils.js +3 -3
  305. package/smartMapping/renderers/type.js +1 -1
  306. package/smartMapping/statistics/heatmapStatistics.js +1 -1
  307. package/smartMapping/statistics/histogram.js +1 -1
  308. package/smartMapping/statistics/summaryStatistics.js +1 -1
  309. package/smartMapping/statistics/summaryStatisticsForAttributes.js +1 -1
  310. package/smartMapping/statistics/uniqueValues.js +1 -1
  311. package/smartMapping/support/adapters/support/layerUtils.js +1 -1
  312. package/smartMapping/types.d.ts +3 -1
  313. package/symbols/LineSymbol3DLayer.js +1 -1
  314. package/symbols/callouts/LineCallout3D.js +1 -1
  315. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  316. package/symbols/cim/CIMSymbolHelper.js +1 -1
  317. package/symbols/cim/cimAnalyzer.js +1 -1
  318. package/symbols/edges/Edges3D.js +1 -1
  319. package/symbols/support/Symbol3DIconOutline.js +1 -1
  320. package/symbols/support/Symbol3DOutline.js +1 -1
  321. package/symbols/support/Symbol3DTextBorder.js +1 -1
  322. package/symbols/support/defaults3D.js +1 -1
  323. package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
  324. package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +6 -4
  325. package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
  326. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
  327. package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +6 -4
  328. package/views/2d/analysis/DistanceMeasurementAnalysisView2D.js +1 -1
  329. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  330. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  331. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  332. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TexturedLineShader.js +1 -1
  333. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  334. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  335. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  336. package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
  337. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  338. package/views/2d/layers/LayerView2D.js +1 -1
  339. package/views/2d/layers/features/FeatureContainer.js +1 -1
  340. package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
  341. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  342. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  343. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  344. package/views/2d/layers/features/sources/strategies/AFeatureTileLoadStrategy.js +1 -1
  345. package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +1 -1
  346. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  347. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  348. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  349. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  350. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  351. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  352. package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
  353. package/views/3d/analysis/LineOfSight/LineOfSightInteractionVisuals.js +1 -1
  354. package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
  355. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
  356. package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
  357. package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
  358. package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
  359. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  360. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  361. package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
  362. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  363. package/views/3d/analysis/Viewshed/types.d.ts +3 -1
  364. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +3 -0
  365. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.d.ts +2 -1
  366. package/views/3d/environment/Environment.d.ts +2 -2
  367. package/views/3d/environment/Environment.js +1 -1
  368. package/views/3d/environment/EnvironmentView.js +2 -0
  369. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  370. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  371. package/views/3d/interactive/editingTools/originGeometryVisualElementUtils.js +1 -1
  372. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  373. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  374. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  375. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  376. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  377. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  378. package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
  379. package/views/3d/layers/FlowSubView3D.js +1 -1
  380. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  381. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  382. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  383. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  384. package/views/3d/layers/MediaLayerView3D.js +1 -1
  385. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  386. package/views/3d/layers/RouteLayerView3D.js +1 -1
  387. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  388. package/views/3d/layers/SceneLayerView3D.js +1 -1
  389. package/views/3d/layers/TiledLayerView3D.js +1 -1
  390. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  391. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  392. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  393. package/views/3d/layers/graphics/Graphics3DBufferGraphicLayer.js +2 -0
  394. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  395. package/views/3d/layers/graphics/Graphics3DDrapedBufferGraphicLayer.js +2 -0
  396. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
  397. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayerBase.js +2 -0
  398. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  399. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  400. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  401. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  402. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  403. package/views/3d/layers/graphics/Graphics3DStageObjectGraphicLayer.js +2 -0
  404. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  405. package/views/3d/layers/graphics/LabelInfo.js +1 -1
  406. package/views/3d/layers/graphics/Labeler.js +1 -1
  407. package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
  408. package/views/3d/layers/graphics/pointUtils.js +1 -1
  409. package/views/3d/layers/support/FeatureMemory.js +1 -1
  410. package/views/3d/layers/support/FeatureTile.js +1 -1
  411. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  412. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  413. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  414. package/views/3d/layers/support/SampledGeometryMaxDistanceRatio.js +1 -1
  415. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  416. package/views/3d/support/PBFDecoder.js +1 -1
  417. package/views/3d/support/elevationUpdateUtils.js +1 -1
  418. package/views/3d/support/popupHitTest.js +1 -1
  419. package/views/3d/terrain/OverlayManager.js +1 -1
  420. package/views/3d/terrain/OverlayRenderer.js +1 -1
  421. package/views/3d/terrain/TerrainRenderer.js +1 -1
  422. package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
  423. package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +5 -5
  424. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +13 -13
  425. package/views/3d/webgl-engine/core/shaderLibrary/bindUniforms.js +2 -0
  426. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +2 -2
  427. package/views/3d/webgl-engine/core/shaderLibrary/lastFrameUniforms.js +2 -0
  428. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +7 -7
  429. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +31 -29
  430. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +26 -12
  431. package/views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js +2 -2
  432. package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +14 -14
  433. package/views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js +1 -1
  434. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +16 -11
  435. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +5 -5
  436. package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +8 -8
  437. package/views/3d/webgl-engine/core/shaderLibrary/shading/evaluateSceneLightingFragment.glsl.js +1 -1
  438. package/views/3d/webgl-engine/core/shaderLibrary/shading/lightingUniforms.js +2 -0
  439. package/views/3d/webgl-engine/core/shaderLibrary/shading/pbrGlobals.glsl.js +1 -1
  440. package/views/3d/webgl-engine/core/shaderLibrary/shading/readShadow.glsl.js +6 -6
  441. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
  442. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +3 -3
  443. package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
  444. package/views/3d/webgl-engine/core/shaderLibrary/util/cameraUniforms.js +1 -1
  445. package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
  446. package/views/3d/webgl-engine/effects/atmosphere/ChapmanApproximation.glsl.js +3 -3
  447. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.glsl.js +1 -1
  448. package/views/3d/webgl-engine/effects/atmosphere/ChapmanRaymarching.glsl.js +1 -1
  449. package/views/3d/webgl-engine/effects/atmosphere/SimpleAtmosphere.glsl.js +1 -1
  450. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.glsl.js +1 -1
  451. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
  452. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
  453. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  454. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  455. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  456. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js +2 -2
  457. package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +5 -5
  458. package/views/3d/webgl-engine/effects/haze/Haze.glsl.js +1 -1
  459. package/views/3d/webgl-engine/effects/haze/HazeCompositing.glsl.js +1 -1
  460. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.glsl.js +1 -1
  461. package/views/3d/webgl-engine/effects/highlight/ShadowHighlightBuffer.glsl.js +1 -1
  462. package/views/3d/webgl-engine/effects/laserlines/LaserlinePath.glsl.js +1 -1
  463. package/views/3d/webgl-engine/effects/raymarching/DistanceFalloff.glsl.js +1 -1
  464. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulate.glsl.js +1 -1
  465. package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
  466. package/views/3d/webgl-engine/lib/BufferObject3D.js +1 -1
  467. package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
  468. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  469. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  470. package/views/3d/webgl-engine/lib/affectsGeometry.js +1 -1
  471. package/views/3d/webgl-engine/lib/bufferGeometryUtils.js +2 -0
  472. package/views/3d/webgl-engine/lib/edgeRendering/AdjustProjectedPosition.glsl.js +5 -5
  473. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShader.glsl.js +1 -1
  474. package/views/3d/webgl-engine/lib/edgeRendering/EdgeUtil.glsl.js +11 -11
  475. package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
  476. package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
  477. package/views/3d/webgl-engine/shaders/AtmosphereCompositing.glsl.js +1 -1
  478. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  479. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  480. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  481. package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
  482. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  483. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  484. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  485. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +1 -1
  486. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  487. package/views/3d/webgl-engine/shaders/Viewshed.glsl.js +1 -1
  488. package/views/3d/webgl-engine/shaders/lineUniforms.js +2 -0
  489. package/views/DOMContainer.d.ts +28 -9
  490. package/views/DOMContainer.js +1 -1
  491. package/views/PopupView.d.ts +6 -0
  492. package/views/SceneView.d.ts +4 -10
  493. package/views/SceneView.js +1 -1
  494. package/views/VideoView.d.ts +27 -9
  495. package/views/View.d.ts +20 -19
  496. package/views/View.js +1 -1
  497. package/views/View2D.d.ts +13 -13
  498. package/views/draw/Draw.d.ts +1 -1
  499. package/views/draw/support/InteractiveHandle.js +1 -1
  500. package/views/draw/support/PluginContext.js +1 -1
  501. package/views/draw/support/managers/TooltipManager.js +1 -1
  502. package/views/interactive/options/SnappingOptions.d.ts +29 -12
  503. package/views/interactive/options/TooltipOptions.d.ts +9 -1
  504. package/views/interactive/options/ValueOptions.d.ts +9 -2
  505. package/views/interactive/options/ViewOptions.d.ts +82 -6
  506. package/views/interactive/snapping/FeatureSnappingSourceInfo.js +1 -1
  507. package/views/interactive/snapping/SnappingManagerPool.js +1 -1
  508. package/views/interactive/snapping/SnappingOptions.d.ts +1 -1
  509. package/views/interactive/snapping/SnappingVisualizer.js +1 -1
  510. package/views/interactive/support/Units.d.ts +1 -0
  511. package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
  512. package/views/interactive/tooltip/components/ElevationModeSelect.js +1 -1
  513. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  514. package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
  515. package/views/layers/FeatureLikeLayerView.d.ts +2 -2
  516. package/views/layers/GraphicsLayerView.d.ts +1 -0
  517. package/views/layers/ImageryLayerView.d.ts +1 -0
  518. package/views/layers/LayerView.js +1 -1
  519. package/views/layers/LineOfSightLayerView.d.ts +3 -4
  520. package/views/layers/ParquetLayerView.d.ts +15 -0
  521. package/views/layers/ParquetLayerView.js +1 -1
  522. package/views/layers/ViewshedLayerView.d.ts +5 -6
  523. package/views/support/layerViewUtils.js +1 -1
  524. package/views/support/projectionUtils.js +1 -1
  525. package/views/types.d.ts +3 -1
  526. package/webdoc/support/saveUtils.js +1 -1
  527. package/webdoc/support/unsupportedErrors.js +1 -1
  528. package/widgets/BasemapGallery/BasemapGalleryViewModel.d.ts +2 -2
  529. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  530. package/widgets/BasemapGallery/support/BasemapGalleryItem.d.ts +3 -3
  531. package/widgets/BasemapGallery/support/LocalBasemapsSource.d.ts +2 -2
  532. package/widgets/BasemapGallery/support/PortalBasemapsSource.d.ts +2 -2
  533. package/widgets/BasemapGallery/types.d.ts +3 -3
  534. package/widgets/BasemapLayerList.js +1 -1
  535. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  536. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  537. package/widgets/BatchAttributeForm/expressions/expressionUtils.js +1 -1
  538. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +6 -0
  539. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  540. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
  541. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  542. package/widgets/BatchAttributeForm.js +1 -1
  543. package/widgets/DirectionalPad.js +1 -1
  544. package/widgets/Editor/EditorViewModel.d.ts +13 -8
  545. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  546. package/widgets/Editor/workflowUtils.js +1 -1
  547. package/widgets/Editor.d.ts +19 -9
  548. package/widgets/Expand.js +1 -1
  549. package/widgets/FeatureForm.d.ts +2 -2
  550. package/widgets/FeatureForm.js +1 -1
  551. package/widgets/FeatureTable/FieldColumn.js +1 -1
  552. package/widgets/FeatureTable.js +1 -1
  553. package/widgets/Features/FeaturesDrillIn.js +1 -1
  554. package/widgets/Features.js +1 -1
  555. package/widgets/Legend.d.ts +1 -0
  556. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  557. package/widgets/OrientedImageryViewer/adapters/draw/HeightMeasurementAdapter.js +1 -1
  558. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  559. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  560. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  561. package/widgets/OrientedImageryViewer/components/ImageLocationViewModel.js +1 -1
  562. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  563. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  564. package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
  565. package/widgets/OrientedImageryViewer/types.d.ts +20 -0
  566. package/widgets/OrientedImageryViewer.d.ts +9 -1
  567. package/widgets/PanoramicVideoViewer.js +1 -1
  568. package/widgets/Print/PrintViewModel.d.ts +3 -2
  569. package/widgets/Print/PrintViewModel.js +1 -1
  570. package/widgets/Print.js +1 -1
  571. package/widgets/ScaleRangeSlider.js +1 -1
  572. package/widgets/Search/SearchResultRenderer.js +1 -1
  573. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  574. package/widgets/Sketch/SketchViewModel.d.ts +14 -9
  575. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  576. package/widgets/Sketch.d.ts +10 -10
  577. package/widgets/Track/TrackViewModel.d.ts +1 -1
  578. package/widgets/UtilityNetworkAssociations.js +1 -1
  579. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  580. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  581. package/widgets/UtilityNetworkTrace/types.d.ts +2 -2
  582. package/widgets/UtilityNetworkTrace.js +1 -1
  583. package/widgets/UtilityNetworkValidateTopology.js +1 -1
  584. package/widgets/ValuePicker.js +1 -1
  585. package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
  586. package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
  587. package/widgets/support/GridControls.js +1 -1
  588. package/widgets/support/PluginSettingsControls.js +1 -1
  589. package/widgets/support/SelectionList/FeatureItem.d.ts +9 -2
  590. package/widgets/support/SelectionToolbar.js +1 -1
  591. package/widgets/support/SnappingControls.d.ts +1 -1
  592. package/widgets/support/SnappingControls.js +1 -1
  593. package/widgets/support/componentsUtils.js +1 -1
  594. package/arcade/geometry/wkt.js +0 -2
  595. package/assets/esri/core/workers/chunks/00a600c71ceebe7bfeee.js +0 -1
  596. package/assets/esri/core/workers/chunks/00d24415bdeb0adae3df.js +0 -1
  597. package/assets/esri/core/workers/chunks/0193df3f9fb23633da87.js +0 -1
  598. package/assets/esri/core/workers/chunks/01b00fbf6a6a22d573ee.js +0 -1
  599. package/assets/esri/core/workers/chunks/02d4f91652a79d2b637e.js +0 -1
  600. package/assets/esri/core/workers/chunks/050c4b212f2b5691db34.js +0 -1
  601. package/assets/esri/core/workers/chunks/05963f57cbe5a5249496.js +0 -1
  602. package/assets/esri/core/workers/chunks/05d865b2736f452ad2aa.js +0 -1
  603. package/assets/esri/core/workers/chunks/06e7400f5ebe0719b81c.js +0 -1
  604. package/assets/esri/core/workers/chunks/07aa6d36f1006b6ab7ff.js +0 -1
  605. package/assets/esri/core/workers/chunks/084222c00d263a534952.js +0 -1
  606. package/assets/esri/core/workers/chunks/0b36abcbf03037b4073d.js +0 -1
  607. package/assets/esri/core/workers/chunks/107b025dc5b09465a78f.js +0 -1
  608. package/assets/esri/core/workers/chunks/1b551ef3d84d9c1e93f9.js +0 -1
  609. package/assets/esri/core/workers/chunks/1ef39aef6b33c530cbe4.js +0 -1
  610. package/assets/esri/core/workers/chunks/1f3148cebee1961249a4.js +0 -1
  611. package/assets/esri/core/workers/chunks/1f43e06dcfe56229bb0f.js +0 -1
  612. package/assets/esri/core/workers/chunks/2164fcaced72b0fda31f.js +0 -1
  613. package/assets/esri/core/workers/chunks/25b0885d3bc190b28c04.js +0 -1
  614. package/assets/esri/core/workers/chunks/25d6c674b1c4829f040f.js +0 -1
  615. package/assets/esri/core/workers/chunks/260dcb79dfd0f981949f.js +0 -1
  616. package/assets/esri/core/workers/chunks/2a570ce6b99dac6ee996.js +0 -1
  617. package/assets/esri/core/workers/chunks/2e6a2f4d686b71249c0e.js +0 -1
  618. package/assets/esri/core/workers/chunks/2f9033890c465acff698.js +0 -1
  619. package/assets/esri/core/workers/chunks/303676d1b10676c9cab4.js +0 -1
  620. package/assets/esri/core/workers/chunks/303fde8f3459dde16555.js +0 -1
  621. package/assets/esri/core/workers/chunks/32d08b571bbd996d4e6d.js +0 -1
  622. package/assets/esri/core/workers/chunks/33956f12505e72e60293.js +0 -1
  623. package/assets/esri/core/workers/chunks/350540770781b281c39a.js +0 -1
  624. package/assets/esri/core/workers/chunks/37a636f61cfe89c6bfd1.js +0 -1
  625. package/assets/esri/core/workers/chunks/380cc538c1ab453870fa.js +0 -1
  626. package/assets/esri/core/workers/chunks/3880d2c7fb14955d7f93.js +0 -1
  627. package/assets/esri/core/workers/chunks/3b017b718ea2d4ed498f.js +0 -1
  628. package/assets/esri/core/workers/chunks/40fb1910f780e78c128c.js +0 -1
  629. package/assets/esri/core/workers/chunks/4310c8d2b40ae69c3681.js +0 -1
  630. package/assets/esri/core/workers/chunks/43fc42405167a5537039.js +0 -1
  631. package/assets/esri/core/workers/chunks/4848f195eb93cc93dd15.js +0 -1
  632. package/assets/esri/core/workers/chunks/4cddd217383b9333f32e.js +0 -1
  633. package/assets/esri/core/workers/chunks/4d82db661365daa513a6.js +0 -1
  634. package/assets/esri/core/workers/chunks/4fa59f8ed3b7b6239548.js +0 -1
  635. package/assets/esri/core/workers/chunks/57970d43cdcc5cf57a30.js +0 -1
  636. package/assets/esri/core/workers/chunks/5e184fd47e76eb976fa9.js +0 -1
  637. package/assets/esri/core/workers/chunks/5ea8809b6519c05ad9f6.js +0 -1
  638. package/assets/esri/core/workers/chunks/5f3ab77a79c408423fde.js +0 -1
  639. package/assets/esri/core/workers/chunks/5fd099ca1024707387b2.js +0 -1
  640. package/assets/esri/core/workers/chunks/604344e45c0f27497188.js +0 -1
  641. package/assets/esri/core/workers/chunks/61ad8306ab79aca79505.js +0 -1
  642. package/assets/esri/core/workers/chunks/633a9051580c5302d2f7.js +0 -1
  643. package/assets/esri/core/workers/chunks/6469c0d18d3663e7da4b.js +0 -1
  644. package/assets/esri/core/workers/chunks/65654e481cce9ae40e54.js +0 -1
  645. package/assets/esri/core/workers/chunks/669e39c3437d7273f0c7.js +0 -1
  646. package/assets/esri/core/workers/chunks/68e24fa3f564c2a5c9fd.js +0 -1
  647. package/assets/esri/core/workers/chunks/6aebf7cfd294e88bf926.js +0 -1
  648. package/assets/esri/core/workers/chunks/71f739bb3f7350704af6.js +0 -1
  649. package/assets/esri/core/workers/chunks/750a9f3cdb96b966274a.js +0 -1
  650. package/assets/esri/core/workers/chunks/776565dd9741ba2ba151.js +0 -1
  651. package/assets/esri/core/workers/chunks/798a63653f82c0e842c5.js +0 -1
  652. package/assets/esri/core/workers/chunks/841f67baf6a1634ada48.js +0 -1
  653. package/assets/esri/core/workers/chunks/84fcbf7a1d04f01685d1.js +0 -1
  654. package/assets/esri/core/workers/chunks/897fc8e78a0d54a5ff5a.js +0 -1
  655. package/assets/esri/core/workers/chunks/8af92bcc075e03e3e902.js +0 -1742
  656. package/assets/esri/core/workers/chunks/8e511079918e2fd9261f.js +0 -1
  657. package/assets/esri/core/workers/chunks/8e7a33cc1f83063043f2.js +0 -1
  658. package/assets/esri/core/workers/chunks/8fcfd515ee1b18c902e5.js +0 -1
  659. package/assets/esri/core/workers/chunks/9001e9a1e81bce175ddd.js +0 -1
  660. package/assets/esri/core/workers/chunks/9432feca48ca3e5849bd.js +0 -1
  661. package/assets/esri/core/workers/chunks/956a40f40bde416efe93.js +0 -1
  662. package/assets/esri/core/workers/chunks/95b82cbbe355266c65d7.js +0 -1
  663. package/assets/esri/core/workers/chunks/9673a9efec86040b8c13.js +0 -1
  664. package/assets/esri/core/workers/chunks/97dbbedea9fe03bd1306.js +0 -1
  665. package/assets/esri/core/workers/chunks/985b3f18cee87c3fe022.js +0 -1
  666. package/assets/esri/core/workers/chunks/9a7fc93cc693fd12b5d8.js +0 -1
  667. package/assets/esri/core/workers/chunks/9c0fd8baa00ee9733ba4.js +0 -1
  668. package/assets/esri/core/workers/chunks/a010d2e4e34eb7bc1fec.js +0 -1
  669. package/assets/esri/core/workers/chunks/a20526996d01386ec3b7.js +0 -1
  670. package/assets/esri/core/workers/chunks/a23272a7a47a95f6ddea.js +0 -1
  671. package/assets/esri/core/workers/chunks/a7edf7541569fef77cb3.js +0 -1
  672. package/assets/esri/core/workers/chunks/aa5b42e44d2959fdacd3.js +0 -1
  673. package/assets/esri/core/workers/chunks/ae2181805d8ba130babc.js +0 -1
  674. package/assets/esri/core/workers/chunks/b05a41a60e30935644be.js +0 -1
  675. package/assets/esri/core/workers/chunks/b0cfec11c758eed8095f.js +0 -1
  676. package/assets/esri/core/workers/chunks/bff767ec5bb4c0d6b324.js +0 -1
  677. package/assets/esri/core/workers/chunks/c906f984b2b6e7578c06.js +0 -1
  678. package/assets/esri/core/workers/chunks/ca7fb75e2c62e7d37122.js +0 -1
  679. package/assets/esri/core/workers/chunks/cbdebdfa5f2cded29d0d.js +0 -1
  680. package/assets/esri/core/workers/chunks/cbe6c0f32608cb504695.js +0 -1
  681. package/assets/esri/core/workers/chunks/cfae60b9d2f2939e9c16.js +0 -1
  682. package/assets/esri/core/workers/chunks/d270cc9807161033686e.js +0 -1
  683. package/assets/esri/core/workers/chunks/d56780290e0218d3e9de.js +0 -1
  684. package/assets/esri/core/workers/chunks/d6d5a9e73ee43d6066d3.js +0 -1
  685. package/assets/esri/core/workers/chunks/d89fe41c71c9621c41ae.js +0 -1
  686. package/assets/esri/core/workers/chunks/da18d96b35af20e73b3b.js +0 -1
  687. package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +0 -1
  688. package/assets/esri/core/workers/chunks/df0481bcc1613ee4b7af.js +0 -1
  689. package/assets/esri/core/workers/chunks/e22d45aeef293a5ffb78.js +0 -1
  690. package/assets/esri/core/workers/chunks/e5943f3a4bbc12c06c4d.js +0 -1
  691. package/assets/esri/core/workers/chunks/e7c60bd85abbd36cdc64.js +0 -1
  692. package/assets/esri/core/workers/chunks/ec9a2425b4a498054a19.js +0 -1
  693. package/assets/esri/core/workers/chunks/edf3be87a997f4f05b96.js +0 -1
  694. package/assets/esri/core/workers/chunks/f05de08e194a3f9b96f2.js +0 -1
  695. package/assets/esri/core/workers/chunks/f0a68d2900d24f56afa0.js +0 -1
  696. package/assets/esri/core/workers/chunks/f0aaa646b17ffdbdcefa.js +0 -1
  697. package/assets/esri/core/workers/chunks/f0c0c02730fe0d948fc1.js +0 -1
  698. package/assets/esri/core/workers/chunks/fd0254c6fc6c03ec11ba.js +0 -1
  699. package/assets/esri/core/workers/chunks/ffb3728e6ac428f62af1.js +0 -1
  700. package/views/3d/environment/EnvironmentManager.js +0 -2
  701. /package/{basemaps → basemapGallery}/support/basemapCompatibilityUtils.js +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{deprecatedModule as n}from"../../core/deprecate.js";import{Loadable as r,isLoadable as i}from"../../core/Loadable.js";import a from"../../core/Logger.js";import{watch as o,on as s,when as c}from"../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../core/accessorSupport/decorators.js";import{canProjectWithoutEngine as d,isLoaded as f,load as p}from"../../geometry/projectionUtils.js";import{equals as m}from"../../geometry/support/spatialReferenceUtils.js";import{isLinkChartView as h}from"../../linkChart/guards.js";import{basemapEnsureType as g}from"../../support/basemapEnsureType.js";import{contentEquals as _}from"../../support/basemapUtils.js";import{default3DCompatibility as v,default2DCompatibility as y}from"./support/basemapCompatibilityUtils.js";import b from"./support/BasemapGalleryItem.js";import x from"./support/LocalBasemapsSource.js";import S from"./support/PortalBasemapsSource.js";const C=t.ofType(b);function w(e){return e&&e.declaredClass===`esri.portal.Portal`}function T(e){return e&&!(e instanceof S)&&(!!e.portal||!!e.query)}function E(e){return e&&`basemaps`in e&&`state`in e&&`refresh`in e}let D=class extends r{constructor(e){super(e),this._loadingProjectionEngine=!1,this.items=new C,this.view=null,e?.suppressDeprecationWarning||n(a.getLogger(this),`esri.widgets.BasemapGallery.BasemapGalleryViewModel`,{version:`5.2`,replacement:`Use the @arcgis/core/basemaps/BasemapCollection class instead.`,warnOnce:!0}),this.source=new S}normalizeCtorArgs(e={}){let{suppressDeprecationWarning:t,...n}=e;return n}initialize(){let e=()=>this._recreateItems();this.addHandles([o(()=>this.state===`ready`?this.compatibilityFunction:null,()=>this._updateItems()),s(()=>this.source?.basemaps,`change`,e,{onListenerAdd:e}),c(()=>this.view,()=>{this.source instanceof S&&(this.source.viewType=this.view?.type)},{once:!0})])}destroy(){let e=this.source.basemaps.find(e=>e===this.activeBasemap);e&&this.source.basemaps.remove(e),this.source?.destroy()}get activeBasemap(){return this.view?.map?.basemap??null}set activeBasemap(e){let t=this.view;if(!t?.map)return;if(e=g(e),!e||!t.ready){t.map.basemap=e,this._clearOverride(`activeBasemap`);return}let n=e.spatialReference||this.items?.find(t=>this.basemapEquals(e,t.basemap))?.spatialReference;if(n&&`spatialReferenceLocked`in t&&!t.spatialReferenceLocked){let r=t.spatialReference;if(n!=null&&!m(r,n)&&!d(t.spatialReference,n)&&!f()){this._override(`activeBasemap`,e),this._loadingProjectionEngine=!0,p().then(()=>{this._get(`activeBasemap`)===e&&(t.map.basemap=e,t.spatialReference=n,this._clearOverride(`activeBasemap`))},()=>{}).then(()=>{this._loadingProjectionEngine=!1});return}t.map.basemap=e,this._clearOverride(`activeBasemap`),n!=null&&!m(t.spatialReference,n)&&(t.spatialReference=n)}else t.map.basemap=e,this._clearOverride(`activeBasemap`)}get activeBasemapIndex(){let{state:e,activeBasemap:t}=this;return e===`ready`?this._findBasemapIndex(t):-1}get compatibilityFunction(){return this.view?.type===`3d`?v:y}set compatibilityFunction(e){this._overrideIfSome(`compatibilityFunction`,e)}get source(){return this._get(`source`)}set source(e){(Array.isArray(e)||t.isCollection(e))&&(e=new x({basemaps:Array.isArray(e)?new t(e):e})),w(e)&&(e=new S({portal:e})),T(e)&&(e=new S(e)),E(e)||(e=null),this._set(`source`,e)}get state(){return!this.view?.ready||!this.source?`disabled`:h(this.view)&&!this.view.inGeographicLayout?`unsupported`:this._loadingProjectionEngine?`loading`:`ready`}basemapEquals(e,t){return _(e,t)}refresh(){this._recreateItems()}load(){return this.loadSource()}loadSource(e){return this.addResolvingPromise(i(this.source)?this.source.load(e):null),Promise.resolve(this)}_findBasemapIndex(e){let{items:t}=this,n=t.findIndex(t=>t.basemap===e);return n===-1?t.findIndex(t=>this.basemapEquals(t.basemap,e)):n}_recreateItems(){let e=this.source?.basemaps??[],{view:t,compatibilityFunction:n}=this,r=new Map(this.items.map(e=>[e.basemap,e])),i=e.map(e=>{let i=r.get(e);return i?(r.delete(e),i):new b({basemap:e,compatibilityFunction:n,view:t})});this.items.removeAll(),this.items.addMany(i),r.forEach(e=>e.destroy())}_updateItems(){for(let e of this.items)e.compatibilityFunction=this.compatibilityFunction,e.view=this.view}};e([l()],D.prototype,`_loadingProjectionEngine`,void 0),e([l()],D.prototype,`activeBasemap`,null),e([l({readOnly:!0})],D.prototype,`activeBasemapIndex`,null),e([l()],D.prototype,`compatibilityFunction`,null),e([l({readOnly:!0,type:C})],D.prototype,`items`,void 0),e([l()],D.prototype,`source`,null),e([l({readOnly:!0})],D.prototype,`state`,null),e([l()],D.prototype,`view`,void 0),D=e([u(`esri.widgets.BasemapGallery.BasemapGalleryViewModel`)],D);const O=D;export{O as default};
2
+ import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{deprecatedModule as n}from"../../core/deprecate.js";import{Loadable as r,isLoadable as i}from"../../core/Loadable.js";import a from"../../core/Logger.js";import{watch as o,on as s,when as c}from"../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../core/accessorSupport/decorators.js";import{canProjectWithoutEngine as d,isLoaded as f,load as p}from"../../geometry/projectionUtils.js";import{equals as m}from"../../geometry/support/spatialReferenceUtils.js";import{isLinkChartView as h}from"../../linkChart/guards.js";import{basemapEnsureType as g}from"../../support/basemapEnsureType.js";import{contentEquals as _}from"../../support/basemapUtils.js";import{default3DCompatibility as v,default2DCompatibility as y}from"./support/basemapCompatibilityUtils.js";import b from"./support/BasemapGalleryItem.js";import x from"./support/LocalBasemapsSource.js";import S from"./support/PortalBasemapsSource.js";const C=t.ofType(b);function w(e){return e&&e.declaredClass===`esri.portal.Portal`}function T(e){return e&&!(e instanceof S)&&(!!e.portal||!!e.query)}function E(e){return e&&`basemaps`in e&&`state`in e&&`refresh`in e}let D=class extends r{constructor(e){super(e),this._loadingProjectionEngine=!1,this.items=new C,this.view=null,e?.suppressDeprecationWarning||n(a.getLogger(this),`esri.widgets.BasemapGallery.BasemapGalleryViewModel`,{version:`5.2`,replacement:`Use the @arcgis/core/basemapGallery/BasemapGalleryModel class instead.`,warnOnce:!0}),this.source=new S}normalizeCtorArgs(e={}){let{suppressDeprecationWarning:t,...n}=e;return n}initialize(){let e=()=>this._recreateItems();this.addHandles([o(()=>this.state===`ready`?this.compatibilityFunction:null,()=>this._updateItems()),s(()=>this.source?.basemaps,`change`,e,{onListenerAdd:e}),c(()=>this.view,()=>{this.source instanceof S&&(this.source.viewType=this.view?.type)},{once:!0})])}destroy(){let e=this.source.basemaps.find(e=>e===this.activeBasemap);e&&this.source.basemaps.remove(e),this.source?.destroy()}get activeBasemap(){return this.view?.map?.basemap??null}set activeBasemap(e){let t=this.view;if(!t?.map)return;if(e=g(e),!e||!t.ready){t.map.basemap=e,this._clearOverride(`activeBasemap`);return}let n=e.spatialReference||this.items?.find(t=>this.basemapEquals(e,t.basemap))?.spatialReference;if(n&&`spatialReferenceLocked`in t&&!t.spatialReferenceLocked){let r=t.spatialReference;if(n!=null&&!m(r,n)&&!d(t.spatialReference,n)&&!f()){this._override(`activeBasemap`,e),this._loadingProjectionEngine=!0,p().then(()=>{this._get(`activeBasemap`)===e&&(t.map.basemap=e,t.spatialReference=n,this._clearOverride(`activeBasemap`))},()=>{}).then(()=>{this._loadingProjectionEngine=!1});return}t.map.basemap=e,this._clearOverride(`activeBasemap`),n!=null&&!m(t.spatialReference,n)&&(t.spatialReference=n)}else t.map.basemap=e,this._clearOverride(`activeBasemap`)}get activeBasemapIndex(){let{state:e,activeBasemap:t}=this;return e===`ready`?this._findBasemapIndex(t):-1}get compatibilityFunction(){return this.view?.type===`3d`?v:y}set compatibilityFunction(e){this._overrideIfSome(`compatibilityFunction`,e)}get source(){return this._get(`source`)}set source(e){(Array.isArray(e)||t.isCollection(e))&&(e=new x({basemaps:Array.isArray(e)?new t(e):e})),w(e)&&(e=new S({portal:e})),T(e)&&(e=new S(e)),E(e)||(e=null),this._set(`source`,e)}get state(){return!this.view?.ready||!this.source?`disabled`:h(this.view)&&!this.view.inGeographicLayout?`unsupported`:this._loadingProjectionEngine?`loading`:`ready`}basemapEquals(e,t){return _(e,t)}refresh(){this._recreateItems()}load(){return this.loadSource()}loadSource(e){return this.addResolvingPromise(i(this.source)?this.source.load(e):null),Promise.resolve(this)}_findBasemapIndex(e){let{items:t}=this,n=t.findIndex(t=>t.basemap===e);return n===-1?t.findIndex(t=>this.basemapEquals(t.basemap,e)):n}_recreateItems(){let e=this.source?.basemaps??[],{view:t,compatibilityFunction:n}=this,r=new Map(this.items.map(e=>[e.basemap,e])),i=e.map(e=>{let i=r.get(e);return i?(r.delete(e),i):new b({basemap:e,compatibilityFunction:n,view:t})});this.items.removeAll(),this.items.addMany(i),r.forEach(e=>e.destroy())}_updateItems(){for(let e of this.items)e.compatibilityFunction=this.compatibilityFunction,e.view=this.view}};e([l()],D.prototype,`_loadingProjectionEngine`,void 0),e([l()],D.prototype,`activeBasemap`,null),e([l({readOnly:!0})],D.prototype,`activeBasemapIndex`,null),e([l()],D.prototype,`compatibilityFunction`,null),e([l({readOnly:!0,type:C})],D.prototype,`items`,void 0),e([l()],D.prototype,`source`,null),e([l({readOnly:!0})],D.prototype,`state`,null),e([l()],D.prototype,`view`,void 0),D=e([u(`esri.widgets.BasemapGallery.BasemapGalleryViewModel`)],D);const O=D;export{O as default};
@@ -4,17 +4,17 @@ import type EsriError from "../../../core/Error.js";
4
4
  import type { IdentifiableMixin, IdentifiableMixinProperties } from "../../../core/Identifiable.js";
5
5
  import type { MapViewOrSceneView } from "../../../views/MapViewOrSceneView.js";
6
6
 
7
- /** @deprecated since version 5.2. Use [BasemapItemProperties](https://developers.arcgis.com/javascript/latest/references/core/basemaps/support/BasemapItem/#BasemapItemProperties) instead. */
7
+ /** @deprecated since version 5.2. Use [BasemapItemProperties](https://developers.arcgis.com/javascript/latest/references/core/basemapGallery/support/BasemapItem/#BasemapItemProperties) instead. */
8
8
  export interface BasemapGalleryItemProperties extends IdentifiableMixinProperties, Partial<Pick<BasemapGalleryItem, "basemap" | "view">> {}
9
9
 
10
- /** @deprecated since version 5.2. Use [BasemapItemState](https://developers.arcgis.com/javascript/latest/references/core/basemaps/support/BasemapItem/#BasemapItemState) instead. */
10
+ /** @deprecated since version 5.2. Use [BasemapItemState](https://developers.arcgis.com/javascript/latest/references/core/basemapGallery/support/BasemapItem/#BasemapItemState) instead. */
11
11
  export type BasemapGalleryItemState = "ready" | "loading" | "error";
12
12
 
13
13
  /**
14
14
  * The BasemapGalleryItem class represents one of the [BasemapGalleryViewModel.items](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/BasemapGalleryViewModel/#items)
15
15
  * in the [BasemapGallery](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/).
16
16
  *
17
- * @deprecated since version 5.2. Use [BasemapItem](https://developers.arcgis.com/javascript/latest/references/core/basemaps/support/BasemapItem/) instead.
17
+ * @deprecated since version 5.2. Use [BasemapItem](https://developers.arcgis.com/javascript/latest/references/core/basemapGallery/support/BasemapItem/) instead.
18
18
  * @since 4.3
19
19
  * @see [BasemapGalleryViewModel.items](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/BasemapGalleryViewModel/#items)
20
20
  */
@@ -5,7 +5,7 @@ import type { BasemapsSourceState } from "../types.js";
5
5
  import type { BasemapProperties } from "../../../Basemap.js";
6
6
  import type { ReadonlyArrayOrCollection } from "../../../core/Collection.js";
7
7
 
8
- /** @deprecated since version 5.2. Use [LocalBasemapsSourceProperties](https://developers.arcgis.com/javascript/latest/references/core/basemaps/LocalBasemapsSource/#LocalBasemapsSourceProperties) instead. */
8
+ /** @deprecated since version 5.2. Use [LocalBasemapsSourceProperties](https://developers.arcgis.com/javascript/latest/references/core/basemapGallery/LocalBasemapsSource/#LocalBasemapsSourceProperties) instead. */
9
9
  export interface LocalBasemapsSourceProperties {
10
10
  /** A collection of [Basemap](https://developers.arcgis.com/javascript/latest/references/core/Basemap/)s. */
11
11
  basemaps?: ReadonlyArrayOrCollection<BasemapProperties>;
@@ -15,7 +15,7 @@ export interface LocalBasemapsSourceProperties {
15
15
  * The LocalBasemapsSource class is a Collection-driven [Basemap](https://developers.arcgis.com/javascript/latest/references/core/Basemap/) [BasemapGalleryViewModel.source](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/BasemapGalleryViewModel/#source)
16
16
  * in the [BasemapGalleryViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/BasemapGalleryViewModel/) or [BasemapGallery](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/) widget.
17
17
  *
18
- * @deprecated since version 5.2. Use [LocalBasemapsSource](https://developers.arcgis.com/javascript/latest/references/core/basemaps/LocalBasemapsSource/) instead.
18
+ * @deprecated since version 5.2. Use [LocalBasemapsSource](https://developers.arcgis.com/javascript/latest/references/core/basemapGallery/LocalBasemapsSource/) instead.
19
19
  * @since 4.3
20
20
  * @see [BasemapGalleryViewModel.source](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/BasemapGalleryViewModel/#source)
21
21
  * @see [BasemapGallery](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/)
@@ -8,7 +8,7 @@ import type { BasemapFilter, BasemapsSourceState, UpdateBasemapsCallback } from
8
8
  import type { LocalBasemapsSourceProperties } from "./LocalBasemapsSource.js";
9
9
  import type { PortalProperties } from "../../../portal/Portal.js";
10
10
 
11
- /** @deprecated since version 5.2. Use [PortalBasemapsSourceProperties](https://developers.arcgis.com/javascript/latest/references/core/basemaps/PortalBasemapsSource/#PortalBasemapsSourceProperties) instead. */
11
+ /** @deprecated since version 5.2. Use [PortalBasemapsSourceProperties](https://developers.arcgis.com/javascript/latest/references/core/basemapGallery/PortalBasemapsSource/#PortalBasemapsSourceProperties) instead. */
12
12
  export interface PortalBasemapsSourceProperties extends LocalBasemapsSourceProperties, LoadableMixinProperties, Partial<Pick<PortalBasemapsSource, "filterFunction" | "query" | "updateBasemapsCallback">> {
13
13
  /** The Portal from which to fetch basemaps. */
14
14
  portal?: PortalProperties;
@@ -18,7 +18,7 @@ export interface PortalBasemapsSourceProperties extends LocalBasemapsSourcePrope
18
18
  * The PortalBasemapsSource class is a Portal-driven [Basemap](https://developers.arcgis.com/javascript/latest/references/core/Basemap/) [BasemapGalleryViewModel.source](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/BasemapGalleryViewModel/#source)
19
19
  * in the [BasemapGalleryViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/BasemapGalleryViewModel/) or [BasemapGallery](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/) widget.
20
20
  *
21
- * @deprecated since version 5.2. Use [PortalBasemapsSource](https://developers.arcgis.com/javascript/latest/references/core/basemaps/PortalBasemapsSource/) instead.
21
+ * @deprecated since version 5.2. Use [PortalBasemapsSource](https://developers.arcgis.com/javascript/latest/references/core/basemapGallery/PortalBasemapsSource/) instead.
22
22
  * @since 4.3
23
23
  * @see [BasemapGalleryViewModel.source](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/BasemapGalleryViewModel/#source)
24
24
  * @see [BasemapGallery](https://developers.arcgis.com/javascript/latest/references/core/widgets/BasemapGallery/)
@@ -10,7 +10,7 @@ import type Basemap from "../../Basemap.js";
10
10
  * @param index - The index of the Basemap being assessed.
11
11
  * @param array - The array of basemaps being filtered.
12
12
  * @returns Returns true if the test passes, false otherwise.
13
- * @deprecated since version 5.2. Use [BasemapFilter](https://developers.arcgis.com/javascript/latest/references/core/basemaps/types/#BasemapFilter) instead.
13
+ * @deprecated since version 5.2. Use [BasemapFilter](https://developers.arcgis.com/javascript/latest/references/core/basemapGallery/types/#BasemapFilter) instead.
14
14
  * @since 5.0
15
15
  */
16
16
  export type BasemapFilter = (item: Basemap, index: number, array: Basemap[]) => boolean | Promise<boolean>;
@@ -23,7 +23,7 @@ export type BasemapFilter = (item: Basemap, index: number, array: Basemap[]) =>
23
23
  *
24
24
  * @param items - An array of basemaps that have been fetched and filtered from the Portal.
25
25
  * @returns The array of basemaps to display in the BasemapGallery widget.
26
- * @deprecated since version 5.2. Use [UpdateBasemapsCallback](https://developers.arcgis.com/javascript/latest/references/core/basemaps/types/#UpdateBasemapsCallback) instead.
26
+ * @deprecated since version 5.2. Use [UpdateBasemapsCallback](https://developers.arcgis.com/javascript/latest/references/core/basemapGallery/types/#UpdateBasemapsCallback) instead.
27
27
  * @since 5.0
28
28
  * @example
29
29
  * // Create custom basemap to be added to the array of portal basemaps
@@ -71,7 +71,7 @@ export type BasemapFilter = (item: Basemap, index: number, array: Basemap[]) =>
71
71
  export type UpdateBasemapsCallback = (items: Basemap[]) => Basemap[] | Promise<Basemap[]>;
72
72
 
73
73
  /**
74
- * @deprecated since version 5.2. Use [BasemapsSourceState](https://developers.arcgis.com/javascript/latest/references/core/basemaps/types/#BasemapsSourceState) instead.
74
+ * @deprecated since version 5.2. Use [BasemapsSourceState](https://developers.arcgis.com/javascript/latest/references/core/basemapGallery/types/#BasemapsSourceState) instead.
75
75
  * @since 5.0
76
76
  */
77
77
  export type BasemapsSourceState = "ready" | "loading" | "not-loaded";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as n}from"../core/deprecate.js";import{IdentifiableMixin as r}from"../core/Identifiable.js";import i from"../core/Logger.js";import a from"../core/ReactiveMap.js";import{on as o,initial as s,watch as c,syncAndInitial as l}from"../core/reactiveUtils.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import f from"./Widget.js";import p from"./BasemapLayerList/BasemapLayerListViewModel.js";import m from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as h}from"./BasemapLayerList/css.js";import g from"./LayerList/LayerListItem.js";import _ from"./LayerList/ListItem.js";import{minFilterItems as v,getItem as y,getLayerType as b,removeDestroyedListItems as x,setFilterPredicate as S,sortLayersToIds as C,sortChildLayersToIds as w}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{globalCss as E}from"./support/globalCss.js";import{incrementHeadingLevel as D}from"./support/Heading.js";import{calciteListFilterProps as O}from"./support/listUtils.js";import{tsx as k,messageBundle as A,vmEvent as j}from"./support/widget.js";import{setFocus as M}from"./support/widgetUtils.js";const N=t.ofType(_),P=`nested`,F=`data-basemap-layer-type`;let I=class extends r(f){constructor(e,r){super(e,r),this._baseListEl=null,this._referenceListEl=null,this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._focusEditingFlowItem=!1,this._layerListMap=new a,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder=``,this.baseFilterPredicate=null,this.baseFilterText=``,this.referenceFilterPredicate=null,this.referenceFilterText=``,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t([`knowledge-graph`]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=v,this.openedLayers=new t,this.openedLayerLists=new t,this.tableList=null,this.selectedItems=new N,this.selectionMode=`none`,this.tileOptions=null,this.viewModel=new p({suppressDeprecationWarning:!0}),this.visibilityAppearance=`default`,this.visibleElements=new m,this._canMove=({dragEl:e,fromEl:t,toEl:n},r)=>{let i=r===`pull`?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,a=y(e);if(!a?.sortable)return!1;let o=y(t),s=b(t),c=y(n),l=b(n),u=!!s&&!!l&&s===l,d={selected:a,from:o,to:c},f=t.group,p=n.group,m=o?.layer?.type??``,h=c?.layer?.type??``,g=new Set([`map-image`,`catalog`,`knowledge-graph`]);return f&&p&&typeof i==`function`?i.call(null,d):u&&!g.has(m)&&!g.has(h)&&a?.layer?.type!==`sublayer`},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if(this.visibilityAppearance!=="default")return;let t=Array.from(e.composedPath()).find(e=>e.classList?.contains(h.item));this._activeItem=y(t)},this._onCalciteListOrderChange=e=>{let{_lastDragDetail:t}=this,{toEl:n,fromEl:r,dragEl:i,newIndex:a}=e,o=t?.newIndex===a&&t?.dragEl===i&&t?.toEl===n&&t?.fromEl===r;if(!r||!n||o)return;this._lastDragDetail=e,this._selectedDragItemLayerUid=i.value;let s=r,c=n;if(s===c){let e=Array.from(r.children).filter(e=>e?.matches(`calcite-list-item`)).map(e=>e.value);this._sortLayers(s,e)}else a!=null&&this._moveLayerFromChildList({toEl:c,fromEl:s,dragEl:i,newIndex:a})},this.announceDeprecation=()=>{n(i.getLogger(this),`Basemap Layer List (Next)`,`arcgis-basemap-layer-list-next`,{version:`5.0`})}}initialize(){this.addHandles([o(()=>this.openedLayers,`change`,()=>this._handleOpenedLayersChange(),s),c(()=>[this.viewModel.referenceItems.toArray(),this.viewModel.baseItems.toArray()],()=>x(this.selectedItems),l),c(()=>[this.baseFilterPredicate,this._baseListEl],()=>S(this._baseListEl,this.baseFilterPredicate)),c(()=>[this.referenceFilterPredicate,this._referenceListEl],()=>S(this._referenceListEl,this.referenceFilterPredicate))])}loadDependencies(){return T({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),tooltip:()=>import(`@esri/calcite-components/dist/components/calcite-tooltip`)})}destroy(){this._tooltipReferenceMap.clear(),this._destroyOpenedLayerLists()}get _visibleBaseItems(){return this.baseItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _visibleReferenceItems(){return this.referenceItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _openedPanelItems(){return this._visibleReferenceItems.concat(this._visibleBaseItems).flatten(e=>e.children).filter(({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)}get _totalBaseItems(){return this.viewModel.baseItems.flatten(e=>e.children.filter(e=>e.layer?.type!==`catalog-dynamic-group`)).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten(e=>e.children.filter(e=>e.layer?.type!==`catalog-dynamic-group`)).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){let{openedLayers:e}=this;return e.toArray().map((t,n)=>this._renderLayerFlowItem(t,n===e.length-1))}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get icon(){return`layers`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){let{state:e}=this.viewModel,t={[E.hidden]:e===`loading`,[E.disabled]:e===`disabled`};return k(`div`,{class:this.classes(h.base,E.widget,E.panel,t)},this._renderItems())}async _createCatalogLayerList(e){let{default:t}=await import(`./CatalogLayerList.js`),{headingLevel:n,catalogOptions:r,view:i,filterPlaceholder:a,minFilterItems:o,selectionMode:s,visibilityAppearance:c,_onCatalogOpen:l,_onTablesOpen:u,layerTablesEnabled:d}=this;return new t({headingLevel:n,view:i,filterPlaceholder:a,minFilterItems:o,selectionMode:s,visibilityAppearance:c,...r,catalogLayer:e,layerTablesEnabled:d,onCatalogOpen:l,onTablesOpen:u,suppressDeprecationWarning:!0})}_getTableListParams(e){switch(e.type){case`knowledge-graph`:return{...this.knowledgeGraphOptions,tables:e.tables};case`map-image`:return{...this.mapImageOptions,tables:e.subtables};case`tile`:return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){let{default:t}=await import(`./TableList.js`),{headingLevel:n,selectionMode:r,dragEnabled:i}=this;return new t({headingLevel:n,selectionMode:r,dragEnabled:i,...this._getTableListParams(e)})}async _createFlowList(e,t){let{_layerListMap:n}=this,r=n.get(e);if(r)return r;let i=e.type===`catalog`?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||n.set(e,i),i}async _handleOpenedLayersChange(){let{_layerListMap:e,openedLayers:t,openedLayerLists:n}=this;this._openedLayersController?.abort();let r=new AbortController,{signal:i}=r;this._openedLayersController=r,e.forEach((n,r)=>{t.includes(r)||(n.destroy(),e.delete(r))});let a=await Promise.all(t.map(e=>this._createFlowList(e,i)));if(i.aborted)return;n.removeAll(),n.addMany(a);let o=n.at(-1);o?`catalogLayer`in o?(this._set(`catalogLayerList`,o),this._set(`tableList`,null)):(this._set(`catalogLayerList`,null),this._set(`tableList`,o)):(this._set(`catalogLayerList`,null),this._set(`tableList`,null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){return e?k(`calcite-tooltip`,{key:`tooltip-${e.layer?.uid}`,overlayPositioning:`fixed`,referenceElement:this._tooltipReferenceMap.get(e.layer?.uid),topLayerDisabled:this.topLayerDisabled},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter(e=>!e.hidden).toArray().map(e=>this._renderItemTooltipNodes(e))}_renderItemTooltips(){return this._visibleReferenceItems.concat(this._visibleBaseItems)?.toArray().map(e=>this._renderItemTooltipNodes(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,M(e))}_renderPanelFlowItems(){let{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map(({title:n,panel:r},i)=>{let a=()=>this._handlePanelFlowItemBack(r);return k(`calcite-flow-item`,{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:n,heading:r.title,headingLevel:this.headingLevel,key:`flow-panel-${r.uid}`,selected:!t.length&&i===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),a()}},r.render(),k(`calcite-button`,{appearance:`transparent`,slot:`footer-start`,width:`full`,onclick:a},this.messagesCommon.back))})}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,M(e))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,M(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,M(e))}_renderItem(e,t,n,r){return k(g,{activeItem:this._activeItem,canMove:this._canMove,css:h,displayMode:P,dragDisabled:t,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:n,parentTitles:r,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:n,newIndex:r}){let i=y(n),a=y(e),o=y(t),s=L(t),c=L(e);s&&c&&this.viewModel.moveListItem({targetItem:i,fromParentItem:o,toParentItem:a,newIndex:r,from:s,to:c})}_handleCalciteListDragEnd({fromEl:e,dragEl:t,oldIndex:n}){n!=null&&e.insertBefore(t,e.children[n])}_sortLayers(e,t){if(e){if(e===this._referenceListEl||e===this._baseListEl){let n=e===this._referenceListEl?`reference`:`base`,r=n===`base`?this.view?.map?.basemap?.baseLayers:n===`reference`?this.view?.map?.basemap?.referenceLayers:null;C(r,t)}else{let n=y(e);if(!n)return;w(n,t)}}}_handleCalciteListChange(e){let{selectionMode:t,selectedItems:n}=this;if(t===`none`)return;let r=e.target.selectedItems.map(e=>y(e)).filter(Boolean);n.removeAll(),n.addMany(r)}_renderEditingInput(){let{messages:e}=this,{basemapTitle:t}=this.viewModel;return k(`div`,{class:h.editing},k(`calcite-label`,null,e.basemapTitle,k(`calcite-input`,{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:`basemaptitle`,pattern:`.*\\S+.*`,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:`text`,value:t??void 0})))}_renderCancelButton(){let{messagesCommon:{cancel:e}}=this;return k(`calcite-button`,{appearance:`outline`,bind:this,label:e,slot:`footer`,title:e,width:`full`,onclick:this._toggleEditingTitle},e)}_renderSubmitButton(){let{messagesCommon:e}=this;return k(`calcite-button`,{label:e.form.submit,slot:`footer`,title:e.form.submit,type:`submit`,width:`full`},e.form.ok)}_renderEditingFlowItem(){return this.editingTitle?k(`calcite-flow-item`,{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,selected:this.openedLayers.length===0&&this._openedPanelItems.length===0,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton()):null}_renderEditTitleButton(){let{editingTitle:e,visibleElements:t,messagesCommon:n}=this,r=n.edit;return t.editTitleButton&&!e?k(`calcite-action`,{bind:this,icon:`pencil`,slot:`header-actions-end`,text:r,title:r,onclick:this._toggleEditingTitle}):null}_renderNoLayersInfoMessage(e){return k(`div`,{slot:`message`},e)}_renderNoLayersInfo(e,t){return k(`div`,{class:h.itemMessage},k(`calcite-notice`,{icon:`information`,key:t,kind:`info`,open:!0,width:`full`},this._renderNoLayersInfoMessage(e)))}_renderItems(){let{collapsed:e,visible:t,visibleElements:{closeButton:n,collapseButton:r,heading:i,flow:a},messages:o,viewModel:s}=this,c=[k(`calcite-flow-item`,{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:n,closed:!t,collapsed:e,collapsible:r,heading:i?s.basemapTitle??o.widgetLabel:void 0,headingLevel:this.headingLevel,key:`root-flow-item`,selected:!this.editingTitle&&this.openedLayers.length===0&&this._openedPanelItems.length===0,onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(),this._renderBaseSection()),this._renderEditingFlowItem(),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems],l=a?k(`calcite-flow`,{key:`root-flow`},c):c;return t?[this.editingTitle?k(`form`,{bind:this,class:h.editingForm,onsubmit:this._formSubmit},l):l,this._renderItemTooltips()]:null}_renderLayerFlowItem(e,t){let{messages:n,openedLayers:r}=this,i=e.title||this.messages.untitledLayer;return k(`calcite-flow-item`,{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:i,heading:n[e.type===`catalog`?`catalogLayers`:`tables`],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),r.pop();let t=r.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderList(e,t,n){let{messages:r,dragEnabled:i,selectionMode:a,filterPlaceholder:o,baseFilterText:s,referenceFilterText:c,_baseFilterEnabled:l,_referenceFilterEnabled:u,_rootGroupUid:d}=this,f=t===`reference`?r.noReferenceLayers:r.noBaseLayers,p=t===`reference`?u:l;return k(`calcite-block`,{class:h.section,collapsible:!0,expanded:!0,heading:t===`reference`?r.referenceHeading:r.baseHeading,headingLevel:D(this.headingLevel),key:`block-${t}`},e?.length?null:this._renderNoLayersInfo(f,t),k(`calcite-list`,{afterCreate:e=>{t===`reference`?this._referenceListEl=e:this._baseListEl=e,e.addEventListener(`focusin`,this._setActiveItem),e.addEventListener(`focusout`,this._clearActiveItem)},afterRemoved:e=>{t===`reference`?this._referenceListEl=null:this._baseListEl=null,e.removeEventListener(`focusin`,this._setActiveItem),e.removeEventListener(`focusout`,this._clearActiveItem)},canPull:e=>this._canMove(e,`pull`),canPut:e=>this._canMove(e,`put`),displayMode:P,filterProps:O,[F]:t,"data-layer-type":d,dragEnabled:i,filterEnabled:p,filterPlaceholder:o,filterText:p?t===`reference`?c:s:``,group:d,key:`list-${t}`,label:r.widgetLabel,selectionAppearance:`border`,selectionMode:a,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this[t===`reference`?`referenceFilterText`:`baseFilterText`]=e.currentTarget?.filterText??``,onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail),onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem},e?.toArray().map(e=>this._renderItem(e,n)),p?k(`div`,{class:h.filterNoResults,slot:`filter-no-results`},k(`calcite-notice`,{kind:`info`,open:!0,width:`full`},this._renderNoLayersInfoMessage(f))):null))}_renderBaseSection(){let{_visibleBaseItems:e}=this;return this.visibleElements.baseLayers?this._renderList(e,`base`,e?.length===1):null}_renderReferenceSection(){return this.visibleElements.referenceLayers?this._renderList(this._visibleReferenceItems,`reference`,!1):null}_toggleEditingTitle(){let{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();let t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};e([u()],I.prototype,`_baseListEl`,void 0),e([u()],I.prototype,`_referenceListEl`,void 0),e([u()],I.prototype,`_activeItem`,void 0),e([u()],I.prototype,`_tooltipReferenceMap`,void 0),e([u()],I.prototype,`_focusRootFlowItem`,void 0),e([u()],I.prototype,`_focusPanelFlowItem`,void 0),e([u()],I.prototype,`_focusLayerFlowItem`,void 0),e([u()],I.prototype,`_focusEditingFlowItem`,void 0),e([u()],I.prototype,`_layerListMap`,void 0),e([u()],I.prototype,`_visibleBaseItems`,null),e([u()],I.prototype,`_visibleReferenceItems`,null),e([u()],I.prototype,`_openedPanelItems`,null),e([u()],I.prototype,`_totalBaseItems`,null),e([u()],I.prototype,`_totalReferenceItems`,null),e([u()],I.prototype,`_baseFilterEnabled`,null),e([u()],I.prototype,`_referenceFilterEnabled`,null),e([u()],I.prototype,`_renderedOpenLayerFlowItems`,null),e([u()],I.prototype,`basemapTitle`,null),e([u({readOnly:!0})],I.prototype,`catalogLayerList`,void 0),e([u()],I.prototype,`catalogOptions`,void 0),e([u()],I.prototype,`collapsed`,void 0),e([u()],I.prototype,`dragEnabled`,void 0),e([u()],I.prototype,`editingTitle`,void 0),e([u()],I.prototype,`filterPlaceholder`,void 0),e([u()],I.prototype,`baseFilterPredicate`,void 0),e([u()],I.prototype,`baseFilterText`,void 0),e([u()],I.prototype,`referenceFilterPredicate`,void 0),e([u()],I.prototype,`referenceFilterText`,void 0),e([u()],I.prototype,`listItemCanGiveFunction`,void 0),e([u()],I.prototype,`listItemCanReceiveFunction`,void 0),e([u()],I.prototype,`baseListItemCreatedFunction`,null),e([u()],I.prototype,`headingLevel`,void 0),e([u()],I.prototype,`icon`,null),e([u()],I.prototype,`knowledgeGraphOptions`,void 0),e([u()],I.prototype,`label`,null),e([u()],I.prototype,`layerTablesEnabled`,void 0),e([u()],I.prototype,`mapImageOptions`,void 0),e([u(),A(`esri/widgets/BasemapLayerList/t9n/BasemapLayerList`)],I.prototype,`messages`,void 0),e([u(),A(`esri/t9n/common`)],I.prototype,`messagesCommon`,void 0),e([u()],I.prototype,`minFilterItems`,void 0),e([u({readOnly:!0})],I.prototype,`openedLayers`,void 0),e([u({readOnly:!0})],I.prototype,`openedLayerLists`,void 0),e([u()],I.prototype,`referenceListItemCreatedFunction`,null),e([u({readOnly:!0})],I.prototype,`tableList`,void 0),e([u({readOnly:!0})],I.prototype,`baseItems`,null),e([u({readOnly:!0})],I.prototype,`referenceItems`,null),e([u({type:N})],I.prototype,`selectedItems`,void 0),e([u()],I.prototype,`selectionMode`,void 0),e([u()],I.prototype,`tileOptions`,void 0),e([u()],I.prototype,`view`,null),e([j(`trigger-action`),u({type:p})],I.prototype,`viewModel`,void 0),e([u()],I.prototype,`visibilityAppearance`,void 0),e([u({type:m,nonNullable:!0})],I.prototype,`visibleElements`,void 0),I=e([d(`esri.widgets.BasemapLayerList`)],I);function L(e){return e?.closest(`[${F}]`)?.getAttribute(F)}const R=I;export{R as default};
2
+ import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as n}from"../core/deprecate.js";import{IdentifiableMixin as r}from"../core/Identifiable.js";import i from"../core/Logger.js";import a from"../core/ReactiveMap.js";import{on as o,initial as s,watch as c,syncAndInitial as l}from"../core/reactiveUtils.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import f from"./Widget.js";import p from"./BasemapLayerList/BasemapLayerListViewModel.js";import m from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as h}from"./BasemapLayerList/css.js";import g from"./LayerList/LayerListItem.js";import _ from"./LayerList/ListItem.js";import{minFilterItems as v,getItem as y,getLayerType as b,removeDestroyedListItems as x,setFilterPredicate as S,sortLayersToIds as C,sortChildLayersToIds as w}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{globalCss as E}from"./support/globalCss.js";import{incrementHeadingLevel as D}from"./support/Heading.js";import{calciteListFilterProps as O}from"./support/listUtils.js";import{tsx as k,messageBundle as A,vmEvent as j}from"./support/widget.js";import{setFocus as M}from"./support/widgetUtils.js";const N=t.ofType(_),P=`nested`,F=`data-basemap-layer-type`;let I=class extends r(f){constructor(e,r){super(e,r),this._baseListEl=null,this._referenceListEl=null,this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._focusEditingFlowItem=!1,this._layerListMap=new a,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder=``,this.baseFilterPredicate=null,this.baseFilterText=``,this.referenceFilterPredicate=null,this.referenceFilterText=``,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t([`knowledge-graph`]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=v,this.openedLayers=new t,this.openedLayerLists=new t,this.tableList=null,this.selectedItems=new N,this.selectionMode=`none`,this.tileOptions=null,this.viewModel=new p({suppressDeprecationWarning:!0}),this.visibilityAppearance=`default`,this.visibleElements=new m,this._canMove=({dragEl:e,fromEl:t,toEl:n},r)=>{let i=r===`pull`?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,a=y(e);if(!a?.sortable)return!1;let o=y(t),s=b(t),c=y(n),l=b(n),u=!!s&&!!l&&s===l,d={selected:a,from:o,to:c},f=t.group,p=n.group,m=o?.layer?.type??``,h=c?.layer?.type??``,g=new Set([`map-image`,`catalog`,`knowledge-graph`]);return f&&p&&typeof i==`function`?i.call(null,d):u&&!g.has(m)&&!g.has(h)&&a?.layer?.type!==`sublayer`},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if(this.visibilityAppearance!=="default")return;let t=Array.from(e.composedPath()).find(e=>e.classList?.contains(h.item));this._activeItem=y(t)},this._onCalciteListOrderChange=e=>{let{_lastDragDetail:t}=this,{toEl:n,fromEl:r,dragEl:i,newIndex:a}=e,o=t?.newIndex===a&&t?.dragEl===i&&t?.toEl===n&&t?.fromEl===r;if(!r||!n||o)return;this._lastDragDetail=e,this._selectedDragItemLayerUid=i.value;let s=r,c=n;if(s===c){let e=Array.from(r.children).filter(e=>e?.matches(`calcite-list-item`)).map(e=>e.value);this._sortLayers(s,e)}else a!=null&&this._moveLayerFromChildList({toEl:c,fromEl:s,dragEl:i,newIndex:a})},this.announceDeprecation=()=>{n(i.getLogger(this),`Basemap Layer List (Next)`,`arcgis-basemap-layer-list-next`,{version:`5.0`})}}initialize(){this.addHandles([o(()=>this.openedLayers,`change`,()=>this._handleOpenedLayersChange(),s),c(()=>[this.viewModel.referenceItems.toArray(),this.viewModel.baseItems.toArray()],()=>x(this.selectedItems),l),c(()=>[this.baseFilterPredicate,this._baseListEl],()=>S(this._baseListEl,this.baseFilterPredicate)),c(()=>[this.referenceFilterPredicate,this._referenceListEl],()=>S(this._referenceListEl,this.referenceFilterPredicate))])}loadDependencies(){return T({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),tooltip:()=>import(`@esri/calcite-components/dist/components/calcite-tooltip`)})}destroy(){this._tooltipReferenceMap.clear(),this._destroyOpenedLayerLists()}get _visibleBaseItems(){return this.baseItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _visibleReferenceItems(){return this.referenceItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _openedPanelItems(){return this._visibleReferenceItems.concat(this._visibleBaseItems).flatten(e=>e.children).filter(({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)}get _totalBaseItems(){return this.viewModel.baseItems.flatten(e=>e.children.filter(e=>e.layer?.type!==`catalog-dynamic-group`)).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten(e=>e.children.filter(e=>e.layer?.type!==`catalog-dynamic-group`)).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){let{openedLayers:e}=this;return e.toArray().map((t,n)=>this._renderLayerFlowItem(t,n===e.length-1))}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get icon(){return`layers`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){let{state:e}=this.viewModel,t={[E.hidden]:e===`loading`,[E.disabled]:e===`disabled`};return k(`div`,{class:this.classes(h.base,E.widget,E.panel,t)},this._renderItems())}async _createCatalogLayerList(e){let{default:t}=await import(`./CatalogLayerList.js`),{headingLevel:n,catalogOptions:r,view:i,filterPlaceholder:a,minFilterItems:o,selectionMode:s,visibilityAppearance:c,_onCatalogOpen:l,_onTablesOpen:u,layerTablesEnabled:d}=this;return new t({headingLevel:n,view:i,filterPlaceholder:a,minFilterItems:o,selectionMode:s,visibilityAppearance:c,...r,catalogLayer:e,layerTablesEnabled:d,onCatalogOpen:l,onTablesOpen:u,suppressDeprecationWarning:!0})}_getTableListParams(e){switch(e.type){case`knowledge-graph`:return{...this.knowledgeGraphOptions,tables:e.tables};case`map-image`:return{...this.mapImageOptions,tables:e.subtables};case`tile`:return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){let{default:t}=await import(`./TableList.js`),{headingLevel:n,selectionMode:r,dragEnabled:i}=this;return new t({headingLevel:n,selectionMode:r,dragEnabled:i,...this._getTableListParams(e)})}async _createFlowList(e,t){let{_layerListMap:n}=this,r=n.get(e);if(r)return r;let i=e.type===`catalog`?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||n.set(e,i),i}async _handleOpenedLayersChange(){let{_layerListMap:e,openedLayers:t,openedLayerLists:n}=this;this._openedLayersController?.abort();let r=new AbortController,{signal:i}=r;this._openedLayersController=r,e.forEach((n,r)=>{t.includes(r)||(n.destroy(),e.delete(r))});let a=await Promise.all(t.map(e=>this._createFlowList(e,i)));if(i.aborted)return;n.removeAll(),n.addMany(a);let o=n.at(-1);o?`catalogLayer`in o?(this._set(`catalogLayerList`,o),this._set(`tableList`,null)):(this._set(`catalogLayerList`,null),this._set(`tableList`,o)):(this._set(`catalogLayerList`,null),this._set(`tableList`,null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){return e?k(`calcite-tooltip`,{key:`tooltip-${e.layer?.uid}`,overlayPositioning:`fixed`,referenceElement:this._tooltipReferenceMap.get(e.layer?.uid),topLayerDisabled:this.topLayerDisabled},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter(e=>!e.hidden).toArray().map(e=>this._renderItemTooltipNodes(e))}_renderItemTooltips(){return this._visibleReferenceItems.concat(this._visibleBaseItems)?.toArray().map(e=>this._renderItemTooltipNodes(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,M(e))}_renderPanelFlowItems(){let{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map(({title:n,panel:r},i)=>{let a=()=>this._handlePanelFlowItemBack(r);return k(`calcite-flow-item`,{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:n,heading:r.title,headingLevel:this.headingLevel,key:`flow-panel-${r.uid}`,selected:!t.length&&i===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),a()}},r.render(),k(`calcite-button`,{appearance:`transparent`,slot:`footer-start`,width:`full`,onclick:a},this.messagesCommon.back))})}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,M(e))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,M(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,M(e))}_renderItem(e,t,n,r){return k(g,{activeItem:this._activeItem,canMove:this._canMove,css:h,displayMode:P,dragDisabled:t,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:n,parentTitles:r,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:n,newIndex:r}){let i=y(n),a=y(e),o=y(t),s=L(t),c=L(e);s&&c&&this.viewModel.moveListItem({targetItem:i,fromParentItem:o,toParentItem:a,newIndex:r,from:s,to:c})}_handleCalciteListDragEnd({fromEl:e,dragEl:t,oldIndex:n}){n!=null&&e.insertBefore(t,e.children[n])}_sortLayers(e,t){if(e){if(e===this._referenceListEl||e===this._baseListEl){let n=e===this._referenceListEl?`reference`:`base`,r=n===`base`?this.view?.map?.basemap?.baseLayers:n===`reference`?this.view?.map?.basemap?.referenceLayers:null;C(r,t)}else{let n=y(e);if(!n)return;w(n,t)}}}_handleCalciteListChange(e){let{selectionMode:t,selectedItems:n}=this;if(t===`none`)return;let r=e.target.selectedItems.map(e=>y(e)).filter(Boolean);n.removeAll(),n.addMany(r)}_renderEditingInput(){let{messages:e}=this,{basemapTitle:t}=this.viewModel;return k(`div`,{class:h.editing},k(`calcite-label`,null,e.basemapTitle,k(`calcite-input`,{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:`basemaptitle`,pattern:`.*\\S+.*`,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:`text`,value:t??void 0})))}_renderCancelButton(){let{messagesCommon:{cancel:e}}=this;return k(`calcite-button`,{appearance:`outline`,bind:this,label:e,slot:`footer`,title:e,width:`full`,onclick:this._toggleEditingTitle},e)}_renderSubmitButton(){let{messagesCommon:e}=this;return k(`calcite-button`,{label:e.form.submit,slot:`footer`,title:e.form.submit,type:`submit`,width:`full`},e.form.ok)}_renderEditingFlowItem(){return this.editingTitle?k(`calcite-flow-item`,{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,selected:this.openedLayers.length===0&&this._openedPanelItems.length===0,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton()):null}_renderEditTitleButton(){let{editingTitle:e,visibleElements:t,messagesCommon:n}=this,r=n.edit;return t.editTitleButton&&!e?k(`calcite-action`,{bind:this,icon:`pencil`,slot:`header-actions-end`,text:r,title:r,onclick:this._toggleEditingTitle}):null}_renderNoLayersInfoMessage(e){return k(`div`,{slot:`message`},e)}_renderNoLayersInfo(e,t){return k(`div`,{class:h.itemMessage},k(`calcite-notice`,{icon:`information`,key:t,kind:`info`,open:!0,width:`full`},this._renderNoLayersInfoMessage(e)))}_renderItems(){let{collapsed:e,visible:t,visibleElements:{closeButton:n,collapseButton:r,heading:i,flow:a},messages:o,viewModel:s}=this,c=[k(`calcite-flow-item`,{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:n,closed:!t,collapsed:e,collapsible:r,heading:i?s.basemapTitle??o.widgetLabel:void 0,headingLevel:this.headingLevel,key:`root-flow-item`,selected:!this.editingTitle&&this.openedLayers.length===0&&this._openedPanelItems.length===0,onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(),this._renderBaseSection()),this._renderEditingFlowItem(),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems],l=a?k(`calcite-flow`,{key:`root-flow`},c):c;return t?[this.editingTitle?k(`form`,{bind:this,class:h.editingForm,onsubmit:this._formSubmit},l):l,this._renderItemTooltips()]:null}_renderLayerFlowItem(e,t){let{messages:n,openedLayers:r}=this,i=e.title||this.messages.untitledLayer;return k(`calcite-flow-item`,{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:i,heading:n[e.type===`catalog`?`catalogLayers`:`tables`],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),r.pop();let t=r.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderList(e,t,n){let{messages:r,dragEnabled:i,selectionMode:a,filterPlaceholder:o,baseFilterText:s,referenceFilterText:c,_baseFilterEnabled:l,_referenceFilterEnabled:u,_rootGroupUid:d}=this,f=t===`reference`?r.noReferenceLayers:r.noBaseLayers,p=t===`reference`?u:l;return k(`calcite-block`,{class:h.section,expandable:!0,expanded:!0,heading:t===`reference`?r.referenceHeading:r.baseHeading,headingLevel:D(this.headingLevel),key:`block-${t}`},e?.length?null:this._renderNoLayersInfo(f,t),k(`calcite-list`,{afterCreate:e=>{t===`reference`?this._referenceListEl=e:this._baseListEl=e,e.addEventListener(`focusin`,this._setActiveItem),e.addEventListener(`focusout`,this._clearActiveItem)},afterRemoved:e=>{t===`reference`?this._referenceListEl=null:this._baseListEl=null,e.removeEventListener(`focusin`,this._setActiveItem),e.removeEventListener(`focusout`,this._clearActiveItem)},canPull:e=>this._canMove(e,`pull`),canPut:e=>this._canMove(e,`put`),displayMode:P,filterProps:O,[F]:t,"data-layer-type":d,dragEnabled:i,filterEnabled:p,filterPlaceholder:o,filterText:p?t===`reference`?c:s:``,group:d,key:`list-${t}`,label:r.widgetLabel,selectionAppearance:`border`,selectionMode:a,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this[t===`reference`?`referenceFilterText`:`baseFilterText`]=e.currentTarget?.filterText??``,onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail),onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem},e?.toArray().map(e=>this._renderItem(e,n)),p?k(`div`,{class:h.filterNoResults,slot:`filter-no-results`},k(`calcite-notice`,{kind:`info`,open:!0,width:`full`},this._renderNoLayersInfoMessage(f))):null))}_renderBaseSection(){let{_visibleBaseItems:e}=this;return this.visibleElements.baseLayers?this._renderList(e,`base`,e?.length===1):null}_renderReferenceSection(){return this.visibleElements.referenceLayers?this._renderList(this._visibleReferenceItems,`reference`,!1):null}_toggleEditingTitle(){let{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();let t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};e([u()],I.prototype,`_baseListEl`,void 0),e([u()],I.prototype,`_referenceListEl`,void 0),e([u()],I.prototype,`_activeItem`,void 0),e([u()],I.prototype,`_tooltipReferenceMap`,void 0),e([u()],I.prototype,`_focusRootFlowItem`,void 0),e([u()],I.prototype,`_focusPanelFlowItem`,void 0),e([u()],I.prototype,`_focusLayerFlowItem`,void 0),e([u()],I.prototype,`_focusEditingFlowItem`,void 0),e([u()],I.prototype,`_layerListMap`,void 0),e([u()],I.prototype,`_visibleBaseItems`,null),e([u()],I.prototype,`_visibleReferenceItems`,null),e([u()],I.prototype,`_openedPanelItems`,null),e([u()],I.prototype,`_totalBaseItems`,null),e([u()],I.prototype,`_totalReferenceItems`,null),e([u()],I.prototype,`_baseFilterEnabled`,null),e([u()],I.prototype,`_referenceFilterEnabled`,null),e([u()],I.prototype,`_renderedOpenLayerFlowItems`,null),e([u()],I.prototype,`basemapTitle`,null),e([u({readOnly:!0})],I.prototype,`catalogLayerList`,void 0),e([u()],I.prototype,`catalogOptions`,void 0),e([u()],I.prototype,`collapsed`,void 0),e([u()],I.prototype,`dragEnabled`,void 0),e([u()],I.prototype,`editingTitle`,void 0),e([u()],I.prototype,`filterPlaceholder`,void 0),e([u()],I.prototype,`baseFilterPredicate`,void 0),e([u()],I.prototype,`baseFilterText`,void 0),e([u()],I.prototype,`referenceFilterPredicate`,void 0),e([u()],I.prototype,`referenceFilterText`,void 0),e([u()],I.prototype,`listItemCanGiveFunction`,void 0),e([u()],I.prototype,`listItemCanReceiveFunction`,void 0),e([u()],I.prototype,`baseListItemCreatedFunction`,null),e([u()],I.prototype,`headingLevel`,void 0),e([u()],I.prototype,`icon`,null),e([u()],I.prototype,`knowledgeGraphOptions`,void 0),e([u()],I.prototype,`label`,null),e([u()],I.prototype,`layerTablesEnabled`,void 0),e([u()],I.prototype,`mapImageOptions`,void 0),e([u(),A(`esri/widgets/BasemapLayerList/t9n/BasemapLayerList`)],I.prototype,`messages`,void 0),e([u(),A(`esri/t9n/common`)],I.prototype,`messagesCommon`,void 0),e([u()],I.prototype,`minFilterItems`,void 0),e([u({readOnly:!0})],I.prototype,`openedLayers`,void 0),e([u({readOnly:!0})],I.prototype,`openedLayerLists`,void 0),e([u()],I.prototype,`referenceListItemCreatedFunction`,null),e([u({readOnly:!0})],I.prototype,`tableList`,void 0),e([u({readOnly:!0})],I.prototype,`baseItems`,null),e([u({readOnly:!0})],I.prototype,`referenceItems`,null),e([u({type:N})],I.prototype,`selectedItems`,void 0),e([u()],I.prototype,`selectionMode`,void 0),e([u()],I.prototype,`tileOptions`,void 0),e([u()],I.prototype,`view`,null),e([j(`trigger-action`),u({type:p})],I.prototype,`viewModel`,void 0),e([u()],I.prototype,`visibilityAppearance`,void 0),e([u({type:m,nonNullable:!0})],I.prototype,`visibleElements`,void 0),I=e([d(`esri.widgets.BasemapLayerList`)],I);function L(e){return e?.closest(`[${F}]`)?.getAttribute(F)}const R=I;export{R as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{pushIfSome as t}from"../../core/arrayUtils.js";import{createTask as n}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as a}from"../../core/Evented.js";import o from"../../core/Logger.js";import{getOrCreateMapValue as s}from"../../core/MapUtils.js";import{destroyMaybe as c,abortMaybe as l}from"../../core/maybe.js";import{throwIfAborted as u,whenOrAbort as ee,ignoreAbortErrors as d,isAbortError as f}from"../../core/promiseUtils.js";import p from"../../core/ReactiveMap.js";import{on as te,sync as m,watch as h,syncAndInitial as g,initial as _,whenOnce as v}from"../../core/reactiveUtils.js";import{property as y,subclass as b}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as ne}from"../../core/support/UpdatingHandles.js";import x from"../../geometry/SpatialReference.js";import{getGraphicLayer as S}from"../../graphic/graphicOriginUtils.js";import{isSubtypeGroupLayer as C,isSubtypeSublayer as w,isFeatureLayer as re,getSubtypesFromLayer as ie}from"../../layers/support/layerUtils.js";import{system as T}from"../../time/constants.js";import{getAttachmentKey as E}from"./attachmentUtils.js";import{getLayerTimeZone as D,getEffectiveTimeZone as O,createReactiveGraphic as k,isAttributeFormSupportedLayerWithAttachments as A,layerSupportsAttachments as j,queryAttachmentsForElements as M}from"./batchAttributeFormUtils.js";import{ReactiveContingentValuesManager as N}from"./ReactiveContingentValuesManager.js";import{parseFormTemplateString as P}from"./stringUtils.js";import{ValueChangeTransaction as F}from"./ValueChangeTransaction.js";import{ArcadeExecutorProvider as I}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as L}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as R}from"./expressions/ExpressionsModel.js";import z from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as B,mergeBatchFormInputsFromNewTemplate as V}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as H,isFieldInput as U}from"./inputs/support/inputUtils.js";import W from"./templates/BatchFormTemplate.js";import{createBatchFormTemplate as G}from"./templates/support/createBatchFormTemplate.js";import{isExcludedFromSharedForm as K,isGroupElementTemplate as q}from"./templates/support/templateUtils.js";import{ContingentValuesManager as J,isLayerWithContingentValues as Y}from"../support/ContingentValuesManager.js";import{isEmptyValue as X}from"../support/forms/formUtils.js";function ae(e,t){return e?.find(e=>e.layer===t)}let Z=class extends a{constructor(e){super(e),this._attachmentCache=new p,this.activeFeatureIndex=-1,this.attachmentsEnabled=!1,this.callbacks=null,this.disabled=!1,this.editType=`NA`,this.features=new r,this._hasAsyncArcadeExpressions=!1,this.highlightHelper=null,this.maximumFeatureCount=2e3,this.maximumFeatureCountWithComplexForms=50,this.pageStack=[],this.readOnly=!1,this.pendingSubtypeChoice=null,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.view=null,this.userHasChangedValues=!1,this.layerInfos=null,this._arcadeExecutorProvider=new I,this._activeAssociation=null,this._activeAssociationsInput=null,this._activeRelationshipInput=null,this._ownContingentValuesManager=null,this._activeFormInputsByElementId=new Map,this._emptyForm=new z({inputs:[]}),this._emptyFormTemplate=new W({elements:[]}),this._featureFormMap=new p,this._prepareTask=null,this._layerTemplateUpdateTask=null,this._syncAttachmentsTask=null,this._reactiveGraphicLookup=new p,this._updatingHandles=new ne,this._submitTask=null,this._layerTemplateMap=new p,this._workingFeatures=new r,this._expressionsManager=new L({arcadeContext:{editType:`NA`,spatialReference:null,map:null,timeZone:T}}),this._getExternalErrorForFeature=(e,t)=>this._reactiveContingentValuesManager.getViolationTypeForField(e,t),this._getFieldValueOptionsForFeature=e=>this._reactiveContingentValuesManager.getAndWatchFieldValueOptions(e),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.contingentValuesManager||=this._ownContingentValuesManager=new J,this.addHandles([te(()=>this.features,`after-changes`,()=>{this.goHome(),this.notifyChange(`layers`),this._prepare()},m),h(()=>[this.attachmentsEnabled,this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),m),h(()=>this.activeForm,()=>{this.goHome(),this._activeFormInputsByElementId.clear(),this._syncAttachments()},m),h(()=>this.activeFeature,()=>{this.goHome()},m),h(()=>this.page,e=>{let t=[...this.pageStack];if(!t.includes(e))t.push(e);else for(;t.length&&t.at(-1)!==e;)t.pop();this.pageStack=t},g),h(()=>this.contingentValuesManager,e=>{c(this._reactiveContingentValuesManager),this._reactiveContingentValuesManager=new N({manager:e})},_)]),this._prepare()}destroy(){this._prepareTask=l(this._prepareTask),this.pendingSubtypeChoice?.reject(),this._layerTemplateUpdateTask=l(this._layerTemplateUpdateTask),this._syncAttachmentsTask=l(this._syncAttachmentsTask),this._workingFeatures.destroyAll(),c(this._expressionsManager),c(this._reactiveContingentValuesManager),this._updatingHandles.destroy(),this._reactiveGraphicLookup=new p,this._emptyForm.destroy(),this._emptyFormTemplate.destroy(),this._ownContingentValuesManager=c(this._ownContingentValuesManager),this.highlightHelper?.removeAll()}get activeFeature(){let e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if(this.mode===`batch`)return this.sharedForm;let e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;let t=this._featureFormMap.get(e);if(t)return t;let n=this._makeBatchFormInputsForFeature(e);return n!==this._emptyForm&&this._featureFormMap.set(e,n),n}get activeLayer(){let{activeFeature:e}=this;return e?S(e)??null:null}get activeAssociation(){return this._activeAssociation}get activeAssociationsInput(){return this._activeAssociationsInput}get activeAssociationType(){return this.activeAssociationsInput?.activeAssociationType}get activeRelationshipInput(){return this._activeRelationshipInput}get calculating(){return this._expressionsManager.calculating}get expressionsManager(){return this._expressionsManager}get canGoBack(){return this.pageStack.length>1}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if(this.mode===`batch`)return!1;let{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){let e=this.contingentValuesManager;for(let t of this.layers)if(e.getFieldsWithContingentValues(t).size>0)return!0;return!1}get formDescription(){return this._computeFormHeaderField(this.activeForm?.description)}get formTitle(){return this._computeFormHeaderField(this.activeForm?.title)}get effectiveTimeZone(){let{activeLayer:e,timeZone:t}=this;if(!e)return t??`system`;let n=D(e);return O(t,n)}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get map(){return this.view?.map??null}set map(e){this._override(`map`,e)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(this.activeForm.inputs.length===0)return`noElements`;let e=new Set;for(let t of this.activeForm.inputs)switch(t.visibilityCode){case`hidden:not-in-all-layers`:case`hidden:no-domain-in-common`:e.add(`noElementsInCommon`);break;case`hidden:field-definition`:case`hidden:group-visibility-expression:all-features`:case`hidden:visibility-expression:all-features`:e.add(`allElementsHidden`);break;case`hidden:group-visibility-expression:some-features`:case`hidden:visibility-expression:some-features`:return`elementsHiddenInSome`}return e.has(`allElementsHidden`)?`allElementsHidden`:`noElementsInCommon`}get page(){return this.showingSelectedAttachmentReplacePage&&this.selectedAttachmentDetails?`replacing-attachment`:this.selectedAttachmentDetails?`viewing-attachment-details`:this.selectedAttachmentAddInput?`adding-attachments`:this.selectedAttachmentListInput?`viewing-attachments`:this.activeAssociationsInput?.associatedLayer?`viewing-associated-features`:this.activeAssociationsInput?`viewing-associated-layers`:this.activeRelationshipInput?.showAllRelatedRecords?`viewing-related-records`:this.activeRelationshipInput?.showAllCategories?`viewing-related-categories`:`default`}get subtypes(){let e=this.activeLayer;return C(e)||w(e)||re(e)?ie(e):[]}get status(){let e=this._prepareTask;return e==null?`not-loaded`:e.finished?e.error==null?`loaded`:`failed`:`loading`}get timeZone(){return this.view?.timeZone??null}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid&&Array.from(this._featureFormMap.values()).every(e=>e.valid)}get layers(){return Array.from(this._layersSet)}get mode(){return this.activeFeatureIndex>-1?`single`:`batch`}submit(){if(this.submitHasBeenAttempted=!0,this.sharedForm.touchAll(),this._featureFormMap.forEach(e=>e.touchAll()),this.validateContingentValues(this._workingFeatures),!this._hasPendingAttachmentHydration)return this._emitSubmit(),Promise.resolve();if(this._submitTask)return this._submitTask.promise;let e=n(async()=>{await Promise.all(this._allAttachmentInputs.map(e=>e.waitForPendingAttachmentUpdateData())),this._emitSubmit()});return this._submitTask=e,e.promise.finally(()=>{this._submitTask===e&&(this._submitTask=null)}),e.promise}get selectedAttachment(){return this._get(`selectedAttachment`)??null}set selectedAttachment(e){this.showingSelectedAttachmentReplacePage=!1,this._set(`selectedAttachment`,e),e!=null&&(this.selectedAttachmentAddElementId=null)}get selectedAttachmentAddElementId(){return this._get(`selectedAttachmentAddElementId`)??null}set selectedAttachmentAddElementId(e){this.showingSelectedAttachmentReplacePage=!1,this._set(`selectedAttachmentAddElementId`,e),e!=null&&(this.selectedAttachment=null,this.selectedAttachmentListElementId=null)}get selectedAttachmentListElementId(){return this._get(`selectedAttachmentListElementId`)??null}set selectedAttachmentListElementId(e){this._set(`selectedAttachmentListElementId`,e),e!=null&&(this.selectedAttachment=null,this.selectedAttachmentAddElementId=null)}get selectedAttachmentListInput(){let e=this.selectedAttachmentListElementId,t=this.activeForm;if(!e||!t)return null;let n=t.allAttachmentElementInputs.find(t=>t.template.elementId===e)||null;return n?.attachments.length?n:null}get showingSelectedAttachmentReplacePage(){return this._get(`showingSelectedAttachmentReplacePage`)??!1}set showingSelectedAttachmentReplacePage(e){this._set(`showingSelectedAttachmentReplacePage`,e&&this.selectedAttachmentDetails!=null)}get selectedAttachmentAddInput(){let e=this.selectedAttachmentAddElementId,t=this.activeForm;return!e||!t?null:t.allAttachmentElementInputs.find(t=>t.template.elementId===e)||null}get selectedAttachmentDetails(){let e=this.selectedAttachment,t=this.activeForm;if(!e||!t)return null;let n=t.allAttachmentElementInputs.find(t=>t.template.elementId===e.elementId);if(!n)return null;let r=n.attachments.findIndex(t=>E(t)===e.attachmentKey);return r===-1?null:{attachment:n.attachments[r],input:n}}get _allAttachmentInputs(){let e=[...this.sharedForm.allAttachmentElementInputs];for(let t of this._featureFormMap.values())e.push(...t.allAttachmentElementInputs);return e}get _hasPendingAttachmentHydration(){return this._allAttachmentInputs.some(e=>e.hasPendingAttachmentUpdateData)}get _layersSet(){let e=new Set;for(let t of this._workingFeatures){let n=S(t.plainGraphic);n&&e.add(n)}return e}applyStashedAttachmentEdits(e){let t=this._allAttachmentInputs;for(let n of e){let e=t.find(e=>e.label===n.label&&e.attachmentKeyword===n.keywords);e&&e.applyStashedEdits(n)}}findFieldInput(e){if(e==null)return;let t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);let n=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);if(n!==void 0)return t.set(e,n),n}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(let e of this.visibleInputs){if(H(e)){let t=e.inputs.find(e=>U(e)&&!e.valid);if(t)return{input:t,groupInput:e}}if(U(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){let t=this._reactiveGraphicLookup.get(e);if(!t)throw new i(`feature-not-found`,`The given feature is not present in the BatchAttributeForm`);return{...t.attributes}}async goBack(){switch(this.page){case`replacing-attachment`:this.setShowingSelectedAttachmentReplacePage(!1);return;case`viewing-attachment-details`:this.setSelectedAttachment(null);return;case`adding-attachments`:this.setSelectedAttachmentAddElementId(null);return;case`viewing-attachments`:this.setSelectedAttachmentListElementId(null);return;case`viewing-associated-features`:this.setActiveAssociationsLayer(null);return;case`viewing-associated-layers`:this.setActiveAssociationsInput(null);return;case`viewing-related-categories`:case`viewing-related-records`:this.clearActiveRelationshipCategoryOrInput();return;default:return}}async goHome(){this.setShowingSelectedAttachmentReplacePage(!1),this.setSelectedAttachment(null),this.setSelectedAttachmentAddElementId(null),this.setSelectedAttachmentListElementId(null),this.setActiveAssociationsLayer(null),this.setActiveAssociationsInput(null),this.clearAllRelationshipSettings()}notifyGeometriesChanged(e){let t=[];for(let n of e){let e=this._reactiveGraphicLookup.get(n);e&&(t.push(e),e.geometry=n.geometry)}this._updatingHandles.consumePromise(this._valueChangeTransaction(async e=>this._expressionsManager.runGeometryDependentExpressions(t,e),`user`))}async overrideOriginalFeature(e,t){await this._prepareTask?.promise;let n=this._reactiveGraphicLookup.get(e);n&&(n.original=t,this._updatingHandles.consumePromise(this._valueChangeTransaction(e=>this._expressionsManager.runOriginalFeatureDependentExpressions(n,e),`expression`)))}async setFieldInputValue(e,t){let{fieldName:n}=e;await this._updatingHandles.addPromise(this._valueChangeTransaction(async r=>{for(let i of e.features)r.setValue(i,n,t)},`user`,e))}async setFieldInputValuePerFeature(e,t){await this._updatingHandles.addPromise(this._valueChangeTransaction(async n=>{for(let[r,i]of t)n.setValue(r,e.fieldName,i);n.hasChanges&&(e.userHasChangedValue=!0)},`user`,e))}async setValueForFieldName(e,t,n){await this._updatingHandles.addPromise(this._valueChangeTransaction(async r=>{for(let i of n){let n=this._reactiveGraphicLookup.get(i);n&&r.setValue(n,e,t)}},`user`,e))}async setValuePerFeatureForFieldName(e,t){await this._updatingHandles.addPromise(this._valueChangeTransaction(async n=>{for(let[r,i]of t){let t=this._reactiveGraphicLookup.get(r);t&&n.setValue(t,e,i)}},`user`,e))}async setFieldValue(e,t){let n=this.activeForm.allFieldInputs.find(t=>t.fieldName===e);if(n==null)throw new i(`no-field-input-found`,`Cannot set the value of FieldInput with field name: ${e} because none was found in the active form`);await this.setFieldInputValue(n,t)}async setValue(e,t){let n=this.findFieldInput(e);if(n==null)throw new i(`no-FieldInput-found`,`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);await this.setFieldInputValue(n,t)}async applySubtypeDefaults(e){let{defaultValues:t}=e,{allFieldInputs:n}=this.activeForm;await this._updatingHandles.addPromise(this._valueChangeTransaction(async e=>{for(let r of n){let{fieldName:n}=r,i=t[n];if(i!=null)for(let t of r.features)e.setValue(t,n,i)}},`user`))}async handleSubtypeChanged(e){let t=this._workingFeatures.at(e);if(t)return this._updatingHandles.addPromise(this._handleSubtypeChanged(t))}async stageAddAttachments(e,t){if(t.length===0)return[];let n=this._findAttachmentInput(e);if(!n)return[];let r=await this._updatingHandles.addPromise(n.stageAddAttachments(t,this._expressionsManager.arcadeContext));return r.length===0||(this.userHasChangedValues=!0,this._emitAttachmentsChange(n)),r}stageDeleteAttachment(e,t){let n=this._findAttachmentInput(e);if(!n)return;let r=this._findAttachment(n,t);r&&(n.stageDeleteAttachment(r),this.userHasChangedValues=!0,this._emitAttachmentsChange(n))}async stageRenameAttachment(e,t,n){let r=this._findAttachmentInput(e);if(!r)return;let i=this._findAttachment(r,t);i&&(r.stageRenameAttachment(i,n.trim()),this.userHasChangedValues=!0,await r.ensureStagedUpdateData(i),this._emitAttachmentsChange(r))}async stageReplaceAttachment(e,t,n){let r=this._findAttachmentInput(e);if(!r)return!1;let i=this._findAttachment(r,t);return!i||!await this._updatingHandles.addPromise(r.stageReplaceAttachment(i,n,this._expressionsManager.arcadeContext))?!1:(this.userHasChangedValues=!0,this._emitAttachmentsChange(r),!0)}clearAttachmentChanges(e){let t=this._findAttachmentInput(e);t&&(t.clearAttachmentChanges(),this._emitAttachmentsChange(t))}setActiveAssociation(e){this._activeAssociation=e}setActiveAssociationsInput(e){this._activeAssociationsInput=e}setActiveAssociationsLayer(e){this._activeAssociationsInput?.setAssociatedLayer(e)}setActiveAssociationType(e){this._activeAssociationsInput?.setActiveAssociationType(e)}setActiveRelationshipInput(e){e||this._activeRelationshipInput?.setActiveCategory(null),this._activeRelationshipInput=e}setActiveRelationshipCategory(e,t){t.setActiveCategory(e),this.setActiveRelationshipInput(t)}clearAllRelationshipSettings(){let e=this.activeRelationshipInput;e&&(e.setActiveCategory(null),e.setShowAllCategories(!1),e.setShowAllRelatedRecords(!1),this._activeRelationshipInput=null)}clearActiveRelationshipCategoryOrInput(){let e=this.activeRelationshipInput;e&&(e.showAllRelatedRecords?e.showAllCategories?e.setActiveCategory(null):this.setActiveRelationshipInput(null):e.showAllCategories&&(e.setShowAllCategories(!1),this.setActiveRelationshipInput(null)))}resetAttachmentChanges(e,t){let n=this._findAttachmentInput(e);if(!n||!n.editable)return;let r=this._findAttachment(n,t);r&&(n.discardStagedEdits(r),this._emitAttachmentsChange(n))}setSelectedAttachment(e){this.selectedAttachment=e??null}setShowingSelectedAttachmentReplacePage(e){this.showingSelectedAttachmentReplacePage=e}setSelectedAttachmentAddElementId(e){this.selectedAttachmentAddElementId=e??null}setSelectedAttachmentListElementId(e){this.selectedAttachmentListElementId=e??null}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}validate(){return!1}validateContingentValues(e,t=!1){if(t&&!this.submitHasBeenAttempted)for(let t of e)this._reactiveContingentValuesManager.validateContingenciesForNonNullFields(t);else for(let t of e)this._reactiveContingentValuesManager.validateContingencyConstraints(t,{includeIncompleteViolations:!0})}_makeBatchFormInputsForFeature(e){let t=this._layerTemplateMap.get(e.layer);return t?B(t,{allFeatures:new r([e]),expressionsManager:this._expressionsManager,getExternalErrorForFeature:this._getExternalErrorForFeature,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map}):this._emptyForm}async _ensureLayerTemplate(e,t){let{_layersSet:n,contingentValuesManager:r}=this,i=e.layer,a=!1;for(let e of this._layerTemplateMap.keys())n.has(e)||(this._layerTemplateMap.delete(e),this._expressionsManager.layerExpressionsModelMap.delete(e),r.resetOptionsForLayer(e),Y(e)&&r.resetViolationsForLayer(e),a=!0);this._layerTemplateMap.has(i)||(await this._prepareLayer(i,t),u(t),r.layers.add(i),a=!0),a&&(this._prepareSharedFormTemplate(),V(this.sharedForm,this.sharedFormTemplate,{allFeatures:this._workingFeatures,expressionsManager:this._expressionsManager,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map}),this._recomputeHasAsyncArcadeExpressions(),await v(()=>!r.updating,t))}_recomputeHasAsyncArcadeExpressions(){this._hasAsyncArcadeExpressions=!1;for(let e of this._expressionsManager.layerExpressionsModelMap.values())for(let t of e.arcadeExecutorUses.keys())if(t.isAsync){this._hasAsyncArcadeExpressions=!0;return}}_computeFormHeaderField(e){let{activeFeature:t,activeLayer:n}=this;return!e||!n||!t?null:P({attributes:t?.attributes,label:e,layer:n,timeZone:this.effectiveTimeZone})}_makeSubmitResults(){let e=new Map;for(let[n,r]of this._reactiveGraphicLookup){let i=[],a=[],o=this._featureFormMap.get(r)?.allAttachmentElementInputs??[];for(let e of o)t(i,e.toSubmitEdits()),e.valid||a.push(e.template.elementId);e.set(n,{feature:n,values:{...r.attributes},invalidFields:[],attachmentEdits:i,invalidAttachmentElementIds:a})}for(let t of this.sharedForm.allFieldInputs)for(let n of t.invalidFeatures)e.get(n)?.invalidFields.push(t.fieldName);return Array.from(e.values())}async _handleSubtypeChanged(e){let t=e.layer;if(this.contingentValuesManager.resetOptionsForFeature(t,e.plainGraphic),Y(t)&&this.contingentValuesManager.resetViolationsForFeature(t,e.plainGraphic),!w(t))return;let r=t.parent?.findSublayerForFeature(e.plainGraphic);if(!r)return;this._layerTemplateUpdateTask=l(this._layerTemplateUpdateTask);let i=n(async t=>{u(t),e.source.sourceLayer=r,e.source.origin=r.graphicOrigin,await this._ensureLayerTemplate(e,t),u(t),this._featureFormMap.get(e)?.destroy(),this._featureFormMap.set(e,this._makeBatchFormInputsForFeature(e)),await ee(this._valueChangeTransaction(t=>this._expressionsManager.runAllExpressions([e],t),`user`),t),u(t)});this._layerTemplateUpdateTask=i,await d(this._updatingHandles.addPromise(i.promise))}_emitSubmit(){this.emit(`submit`,{name:`submit`,results:this._makeSubmitResults(),valid:this.valid})}_findAttachmentInput(e){let t=this.activeForm.allAttachmentElementInputs.find(t=>t.template.elementId===e);return t||o.getLogger(this).error(`Attachment input not found for elementId '${e}'`),t}_findAttachment(e,t){let n=e.findAttachment(t);return n||o.getLogger(this).error(`Attachment '${t}' not found for attachment element '${e.template.elementId}'`),n}_makeAttachmentEdits(e){let n=[];for(let r of e.allAttachmentElementInputs)t(n,r.toSubmitEdits());return n}_emitAttachmentsChange(e){let t=e.single.feature;if(!t)return;let n=this._featureFormMap.get(t);this.emit(`attachments-change`,{name:`attachments-change`,feature:t.source,attachmentEdits:this._makeAttachmentEdits(n??this.activeForm),valid:this.valid})}async _valueChangeTransaction(e,t,n){let r=typeof n==`string`?n:n?.fieldName,i=new F(this,t,r);if(await e(i),t===`user`&&await this._expressionsManager.runExpressionsDependentOnChangedFields(i),await i.close(),i.hasChanges&&n){let e=typeof n==`string`?this.activeForm.allFieldInputs.find(e=>e.fieldName===n):n;e&&(e.userHasChangedValue=!0)}}_prepare(){this.pendingSubtypeChoice?.reject(),this._hasAsyncArcadeExpressions=!1,this._prepareTask=l(this._prepareTask),this._layerTemplateUpdateTask=l(this._layerTemplateUpdateTask),this._layerTemplateMap.clear(),this._updateWorkingFeatures(),c(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new L({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??x.WebMercator,map:this.map,timeZone:this.timeZone||`system`}});let{layers:e}=this;if(e.length===0)return;let t=n(async t=>{try{u(t),this._updateWorkingFeatures(),this.contingentValuesManager.layers.addMany(e),await Promise.all(e.map(e=>e.load()));for(let n of e)await this._prepareLayer(n,t);if(this.hasTooManyComplexFeatures)throw new i(`too-many-features-with-complex-forms`,`There are too many features to load into the form with the configured complexity`);if(this.hasTooManyFeatures)throw new i(`too-many-features`,`There are too many features to load into the form.`);this._prepareSharedFormTemplate(),this.sharedForm=B(this.sharedFormTemplate,{allFeatures:this._workingFeatures,expressionsManager:this._expressionsManager,getExternalErrorForFeature:this._getExternalErrorForFeature,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map}),await this._valueChangeTransaction(async e=>await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray(),e),`expression`),await v(()=>!this.contingentValuesManager.updating)}catch(e){throw f(e)||o.getLogger(this).error(`Failed preparing form`,e),e}});this._updatingHandles.consumePromise(t.promise),this._prepareTask=t}async _prepareLayer(e,t){let n=ae(this.layerInfos,e),r=await G(e,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this.timeZone,attachmentsEnabled:this.attachmentsEnabled},n?.formTemplate);u(t),this._layerTemplateMap.set(e,r);let i=r.getExpressionExecutorsForLayer(e);if(this._expressionsManager.layerExpressionsModelMap.set(e,new R({preserveFieldValuesWhenHidden:r.preserveFieldValuesWhenHidden,executorMap:i,fieldsIndex:e.fieldsIndex})),!this._hasAsyncArcadeExpressions){for(let e of i.values())if(e&&(this._hasAsyncArcadeExpressions=(e.editableExpression?.isAsync||e.requiredExpression?.isAsync||e.valueExpression?.isAsync||e.visibilityExpression?.isAsync)===!0,this._hasAsyncArcadeExpressions))break}}_prepareSharedFormTemplate(){let e=new Map;for(let t of this._layerTemplateMap.values())for(let n of t.elements){if(K(n))continue;let t=n.clone();q(t)&&(t.elements=t.elements.filter(e=>!K(e)));let{elementId:r}=t;e.has(r)?e.get(r).foldIn(t):e.set(r,t)}this.sharedFormTemplate=new W({elements:Array.from(e.values())})}_updateWorkingFeatures(){this._workingFeatures.destroyAll(),this._reactiveContingentValuesManager.reset();for(let e of this._featureFormMap.values())e.destroy();this._featureFormMap.clear(),this._attachmentCache.clear();let{features:e}=this;if(this._reactiveGraphicLookup=new p,e.length!==0){this._workingFeatures.addMany(e.map(k));for(let e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}async _syncAttachments(){let{activeFeature:e,activeLayer:t,activeForm:r}=this;if(!e||!r||!A(t)||!j(t))return;let i=e.getObjectId();if(i==null)return;let a=this._attachmentCache.get(t),o=r.allAttachmentElementInputs;if(!o.length)return;let c=n(async e=>{let n;if(a){let e=a.get(i);e&&(n=e)}n||(n=await M(t,i,o,e),s(this._attachmentCache,t,()=>new p).set(i,n));for(let e of o)e.applyFetchedAttachments(se(e,n))});this._syncAttachmentsTask=c,await d(c.promise)}get test(){return{expressionsManager:this._expressionsManager,reactiveGraphicLookup:this._reactiveGraphicLookup,syncAttachmentsTask:this._syncAttachmentsTask}}};e([y()],Z.prototype,`_attachmentCache`,void 0),e([y({readOnly:!0})],Z.prototype,`activeFeature`,null),e([y()],Z.prototype,`activeFeatureIndex`,void 0),e([y({readOnly:!0})],Z.prototype,`activeForm`,null),e([y({readOnly:!0})],Z.prototype,`activeLayer`,null),e([y()],Z.prototype,`activeAssociation`,null),e([y()],Z.prototype,`activeAssociationsInput`,null),e([y()],Z.prototype,`activeAssociationType`,null),e([y()],Z.prototype,`activeRelationshipInput`,null),e([y()],Z.prototype,`attachmentsEnabled`,void 0),e([y()],Z.prototype,`callbacks`,void 0),e([y()],Z.prototype,`disabled`,void 0),e([y()],Z.prototype,`calculating`,null),e([y()],Z.prototype,`canGoBack`,null),e([y()],Z.prototype,`contingentValuesManager`,void 0),e([y()],Z.prototype,`editType`,void 0),e([y()],Z.prototype,`features`,void 0),e([y()],Z.prototype,`expressionEvaluationFailed`,null),e([y()],Z.prototype,`hasNonActiveInvalidFeatures`,null),e([y()],Z.prototype,`hasAsyncArcadeExpressions`,null),e([y()],Z.prototype,`_hasAsyncArcadeExpressions`,void 0),e([y()],Z.prototype,`invalidFeatures`,null),e([y()],Z.prototype,`hasVisibleInputs`,null),e([y()],Z.prototype,`hasLayersWithContingentValues`,null),e([y()],Z.prototype,`formDescription`,null),e([y()],Z.prototype,`formTitle`,null),e([y()],Z.prototype,`effectiveTimeZone`,null),e([y()],Z.prototype,`highlightHelper`,void 0),e([y()],Z.prototype,`maximumFeatureCount`,void 0),e([y()],Z.prototype,`maximumFeatureCountWithComplexForms`,void 0),e([y()],Z.prototype,`visibleInputs`,null),e([y()],Z.prototype,`map`,null),e([y()],Z.prototype,`noVisibleElementsReason`,null),e([y()],Z.prototype,`page`,null),e([y()],Z.prototype,`pageStack`,void 0),e([y()],Z.prototype,`readOnly`,void 0),e([y()],Z.prototype,`pendingSubtypeChoice`,void 0),e([y()],Z.prototype,`subtypes`,null),e([y()],Z.prototype,`spatialReference`,void 0),e([y()],Z.prototype,`submitHasBeenAttempted`,void 0),e([y()],Z.prototype,`timeZone`,null),e([y()],Z.prototype,`view`,void 0),e([y()],Z.prototype,`updating`,null),e([y()],Z.prototype,`valid`,null),e([y()],Z.prototype,`layers`,null),e([y()],Z.prototype,`mode`,null),e([y()],Z.prototype,`sharedForm`,void 0),e([y()],Z.prototype,`sharedFormTemplate`,void 0),e([y()],Z.prototype,`selectedAttachment`,null),e([y()],Z.prototype,`selectedAttachmentAddElementId`,null),e([y()],Z.prototype,`selectedAttachmentListElementId`,null),e([y()],Z.prototype,`selectedAttachmentListInput`,null),e([y()],Z.prototype,`showingSelectedAttachmentReplacePage`,null),e([y()],Z.prototype,`selectedAttachmentAddInput`,null),e([y()],Z.prototype,`selectedAttachmentDetails`,null),e([y()],Z.prototype,`userHasChangedValues`,void 0),e([y()],Z.prototype,`layerInfos`,void 0),e([y()],Z.prototype,`_arcadeExecutorProvider`,void 0),e([y()],Z.prototype,`_activeAssociation`,void 0),e([y()],Z.prototype,`_activeAssociationsInput`,void 0),e([y()],Z.prototype,`_activeRelationshipInput`,void 0),e([y()],Z.prototype,`_prepareTask`,void 0),e([y()],Z.prototype,`_reactiveGraphicLookup`,void 0),e([y()],Z.prototype,`_allAttachmentInputs`,null),e([y()],Z.prototype,`_hasPendingAttachmentHydration`,null),e([y()],Z.prototype,`_layerTemplateMap`,void 0),e([y()],Z.prototype,`_layersSet`,null),e([y()],Z.prototype,`_workingFeatures`,void 0),e([y()],Z.prototype,`_expressionsManager`,void 0),Z=e([b(`esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel`)],Z);const oe=Z;function Q(e){return e!=null&&e.trim().length>0}function $(e,t){let n=e.keywords;return Q(n)&&n.toLowerCase()===t}function se(e,t){let n=e.input?.type===`attachment`?e.input.attachmentAssociationType:`exact`,r=e.attachmentKeyword;if(n===`any`)return t;if(n===`exactOrNone`){if(X(r))return t.filter(e=>!Q(e.keywords));let e=r.toLowerCase();return t.filter(t=>!Q(t.keywords)||$(t,e))}if(X(r))return t;let i=r.toLowerCase();return t.filter(e=>$(e,i))}export{oe as default};
2
+ import{__decorate as e}from"tslib";import{pushIfSome as t}from"../../core/arrayUtils.js";import{createTask as n}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as a}from"../../core/Evented.js";import o from"../../core/Logger.js";import{getOrCreateMapValue as s}from"../../core/MapUtils.js";import{destroyMaybe as c,abortMaybe as l}from"../../core/maybe.js";import{throwIfAborted as u,whenOrAbort as ee,ignoreAbortErrors as d,isAbortError as f}from"../../core/promiseUtils.js";import p from"../../core/ReactiveMap.js";import{on as te,sync as m,watch as h,syncAndInitial as g,initial as _,whenOnce as v}from"../../core/reactiveUtils.js";import{property as y,subclass as b}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as ne}from"../../core/support/UpdatingHandles.js";import x from"../../geometry/SpatialReference.js";import{getGraphicLayer as S}from"../../graphic/graphicOriginUtils.js";import{isSubtypeGroupLayer as C,isSubtypeSublayer as w,isFeatureLayer as re,getSubtypesFromLayer as ie}from"../../layers/support/layerUtils.js";import{system as T}from"../../time/constants.js";import{getAttachmentKey as E}from"./attachmentUtils.js";import{getLayerTimeZone as D,getEffectiveTimeZone as O,createReactiveGraphic as k,isAttributeFormSupportedLayerWithAttachments as A,layerSupportsAttachments as j,queryAttachmentsForElements as M}from"./batchAttributeFormUtils.js";import{ReactiveContingentValuesManager as N}from"./ReactiveContingentValuesManager.js";import{parseFormTemplateString as P}from"./stringUtils.js";import{ValueChangeTransaction as F}from"./ValueChangeTransaction.js";import{ArcadeExecutorProvider as I}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as L}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as R}from"./expressions/ExpressionsModel.js";import z from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as B,mergeBatchFormInputsFromNewTemplate as V}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as H,isFieldInput as U}from"./inputs/support/inputUtils.js";import W from"./templates/BatchFormTemplate.js";import{createBatchFormTemplate as G}from"./templates/support/createBatchFormTemplate.js";import{isExcludedFromSharedForm as K,isGroupElementTemplate as q}from"./templates/support/templateUtils.js";import{ContingentValuesManager as J,isLayerWithContingentValues as Y}from"../support/ContingentValuesManager.js";import{isEmptyValue as X}from"../support/forms/formUtils.js";function ae(e,t){return e?.find(e=>e.layer===t)}let Z=class extends a{constructor(e){super(e),this._attachmentCache=new p,this.activeFeatureIndex=-1,this.attachmentsEnabled=!1,this.callbacks=null,this.disabled=!1,this.editType=`NA`,this.features=new r,this._hasAsyncArcadeExpressions=!1,this.highlightHelper=null,this.maximumFeatureCount=2e3,this.maximumFeatureCountWithComplexForms=50,this.pageStack=[],this.readOnly=!1,this.pendingSubtypeChoice=null,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.view=null,this.userHasChangedValues=!1,this.layerInfos=null,this._arcadeExecutorProvider=new I,this._activeAssociation=null,this._activeAssociationsInput=null,this._activeRelationshipInput=null,this._ownContingentValuesManager=null,this._activeFormInputsByElementId=new Map,this._emptyForm=new z({inputs:[]}),this._emptyFormTemplate=new W({elements:[]}),this._featureFormMap=new p,this._prepareTask=null,this._layerTemplateUpdateTask=null,this._syncAttachmentsTask=null,this._reactiveGraphicLookup=new p,this._updatingHandles=new ne,this._submitTask=null,this._layerTemplateMap=new p,this._workingFeatures=new r,this._expressionsManager=new L({arcadeContext:{editType:`NA`,spatialReference:null,map:null,timeZone:T}}),this._getExternalErrorForFeature=(e,t)=>this._reactiveContingentValuesManager.getViolationTypeForField(e,t),this._getFieldValueOptionsForFeature=e=>this._reactiveContingentValuesManager.getAndWatchFieldValueOptions(e),this._requestDeferredExpressionEvaluation=async({features:e,getExecutor:t})=>this._valueChangeTransaction(n=>this._expressionsManager.requestDeferredExecution(e,t,n),`user`),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.contingentValuesManager||=this._ownContingentValuesManager=new J,this.addHandles([te(()=>this.features,`after-changes`,()=>{this.goHome(),this.notifyChange(`layers`),this._prepare()},m),h(()=>[this.attachmentsEnabled,this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),m),h(()=>this.activeForm,()=>{this.goHome(),this._activeFormInputsByElementId.clear(),this._syncAttachments()},m),h(()=>this.activeFeature,()=>{this.goHome()},m),h(()=>this.page,e=>{let t=[...this.pageStack];if(!t.includes(e))t.push(e);else for(;t.length&&t.at(-1)!==e;)t.pop();this.pageStack=t},g),h(()=>this.contingentValuesManager,e=>{c(this._reactiveContingentValuesManager),this._reactiveContingentValuesManager=new N({manager:e})},_)]),this._prepare()}destroy(){this._prepareTask=l(this._prepareTask),this.pendingSubtypeChoice?.reject(),this._layerTemplateUpdateTask=l(this._layerTemplateUpdateTask),this._syncAttachmentsTask=l(this._syncAttachmentsTask),this._workingFeatures.destroyAll(),c(this._expressionsManager),c(this._reactiveContingentValuesManager),this._updatingHandles.destroy(),this._reactiveGraphicLookup=new p,this._emptyForm.destroy(),this._emptyFormTemplate.destroy(),this._ownContingentValuesManager=c(this._ownContingentValuesManager),this.highlightHelper?.removeAll()}get activeFeature(){let e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if(this.mode===`batch`)return this.sharedForm;let e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;let t=this._featureFormMap.get(e);if(t)return t;let n=this._makeBatchFormInputsForFeature(e);return n!==this._emptyForm&&this._featureFormMap.set(e,n),n}get activeLayer(){let{activeFeature:e}=this;return e?S(e)??null:null}get activeAssociation(){return this._activeAssociation}get activeAssociationsInput(){return this._activeAssociationsInput}get activeAssociationType(){return this.activeAssociationsInput?.activeAssociationType}get activeRelationshipInput(){return this._activeRelationshipInput}get calculating(){return this._expressionsManager.calculating}get expressionsManager(){return this._expressionsManager}get canGoBack(){return this.pageStack.length>1}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if(this.mode===`batch`)return!1;let{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){let e=this.contingentValuesManager;for(let t of this.layers)if(e.getFieldsWithContingentValues(t).size>0)return!0;return!1}get formDescription(){return this._computeFormHeaderField(this.activeForm?.description)}get formTitle(){return this._computeFormHeaderField(this.activeForm?.title)}get effectiveTimeZone(){let{activeLayer:e,timeZone:t}=this;if(!e)return t??`system`;let n=D(e);return O(t,n)}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get map(){return this.view?.map??null}set map(e){this._override(`map`,e)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(this.activeForm.inputs.length===0)return`noElements`;let e=new Set;for(let t of this.activeForm.inputs)switch(t.visibilityCode){case`hidden:not-in-all-layers`:case`hidden:no-domain-in-common`:e.add(`noElementsInCommon`);break;case`hidden:field-definition`:case`hidden:group-visibility-expression:all-features`:case`hidden:visibility-expression:all-features`:e.add(`allElementsHidden`);break;case`hidden:group-visibility-expression:some-features`:case`hidden:visibility-expression:some-features`:return`elementsHiddenInSome`}return e.has(`allElementsHidden`)?`allElementsHidden`:`noElementsInCommon`}get page(){return this.showingSelectedAttachmentReplacePage&&this.selectedAttachmentDetails?`replacing-attachment`:this.selectedAttachmentDetails?`viewing-attachment-details`:this.selectedAttachmentAddInput?`adding-attachments`:this.selectedAttachmentListInput?`viewing-attachments`:this.activeAssociationsInput?.associatedLayer?`viewing-associated-features`:this.activeAssociationsInput?`viewing-associated-layers`:this.activeRelationshipInput?.showAllRelatedRecords?`viewing-related-records`:this.activeRelationshipInput?.showAllCategories?`viewing-related-categories`:`default`}get subtypes(){let e=this.activeLayer;return C(e)||w(e)||re(e)?ie(e):[]}get status(){let e=this._prepareTask;return e==null?`not-loaded`:e.finished?e.error==null?`loaded`:`failed`:`loading`}get timeZone(){return this.view?.timeZone??null}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid&&Array.from(this._featureFormMap.values()).every(e=>e.valid)}get layers(){return Array.from(this._layersSet)}get mode(){return this.activeFeatureIndex>-1?`single`:`batch`}submit(){if(this.submitHasBeenAttempted=!0,this.sharedForm.touchAll(),this._featureFormMap.forEach(e=>e.touchAll()),this.validateContingentValues(this._workingFeatures),!this._hasPendingAttachmentHydration)return this._emitSubmit(),Promise.resolve();if(this._submitTask)return this._submitTask.promise;let e=n(async()=>{await Promise.all(this._allAttachmentInputs.map(e=>e.waitForPendingAttachmentUpdateData())),this._emitSubmit()});return this._submitTask=e,e.promise.finally(()=>{this._submitTask===e&&(this._submitTask=null)}),e.promise}get selectedAttachment(){return this._get(`selectedAttachment`)??null}set selectedAttachment(e){this.showingSelectedAttachmentReplacePage=!1,this._set(`selectedAttachment`,e),e!=null&&(this.selectedAttachmentAddElementId=null)}get selectedAttachmentAddElementId(){return this._get(`selectedAttachmentAddElementId`)??null}set selectedAttachmentAddElementId(e){this.showingSelectedAttachmentReplacePage=!1,this._set(`selectedAttachmentAddElementId`,e),e!=null&&(this.selectedAttachment=null,this.selectedAttachmentListElementId=null)}get selectedAttachmentListElementId(){return this._get(`selectedAttachmentListElementId`)??null}set selectedAttachmentListElementId(e){this._set(`selectedAttachmentListElementId`,e),e!=null&&(this.selectedAttachment=null,this.selectedAttachmentAddElementId=null)}get selectedAttachmentListInput(){let e=this.selectedAttachmentListElementId,t=this.activeForm;if(!e||!t)return null;let n=t.allAttachmentElementInputs.find(t=>t.template.elementId===e)||null;return n?.attachments.length?n:null}get showingSelectedAttachmentReplacePage(){return this._get(`showingSelectedAttachmentReplacePage`)??!1}set showingSelectedAttachmentReplacePage(e){this._set(`showingSelectedAttachmentReplacePage`,e&&this.selectedAttachmentDetails!=null)}get selectedAttachmentAddInput(){let e=this.selectedAttachmentAddElementId,t=this.activeForm;return!e||!t?null:t.allAttachmentElementInputs.find(t=>t.template.elementId===e)||null}get selectedAttachmentDetails(){let e=this.selectedAttachment,t=this.activeForm;if(!e||!t)return null;let n=t.allAttachmentElementInputs.find(t=>t.template.elementId===e.elementId);if(!n)return null;let r=n.attachments.findIndex(t=>E(t)===e.attachmentKey);return r===-1?null:{attachment:n.attachments[r],input:n}}get _allAttachmentInputs(){let e=[...this.sharedForm.allAttachmentElementInputs];for(let t of this._featureFormMap.values())e.push(...t.allAttachmentElementInputs);return e}get _hasPendingAttachmentHydration(){return this._allAttachmentInputs.some(e=>e.hasPendingAttachmentUpdateData)}get _layersSet(){let e=new Set;for(let t of this._workingFeatures){let n=S(t.plainGraphic);n&&e.add(n)}return e}applyStashedAttachmentEdits(e){let t=this._allAttachmentInputs;for(let n of e){let e=t.find(e=>e.label===n.label&&e.attachmentKeyword===n.keywords);e&&e.applyStashedEdits(n)}}findFieldInput(e){if(e==null)return;let t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);let n=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);if(n!==void 0)return t.set(e,n),n}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(let e of this.visibleInputs){if(H(e)){let t=e.inputs.find(e=>U(e)&&!e.valid);if(t)return{input:t,groupInput:e}}if(U(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){let t=this._reactiveGraphicLookup.get(e);if(!t)throw new i(`feature-not-found`,`The given feature is not present in the BatchAttributeForm`);return{...t.attributes}}async goBack(){switch(this.page){case`replacing-attachment`:this.setShowingSelectedAttachmentReplacePage(!1);return;case`viewing-attachment-details`:this.setSelectedAttachment(null);return;case`adding-attachments`:this.setSelectedAttachmentAddElementId(null);return;case`viewing-attachments`:this.setSelectedAttachmentListElementId(null);return;case`viewing-associated-features`:this.setActiveAssociationsLayer(null);return;case`viewing-associated-layers`:this.setActiveAssociationsInput(null);return;case`viewing-related-categories`:case`viewing-related-records`:this.clearActiveRelationshipCategoryOrInput();return;default:return}}async goHome(){this.setShowingSelectedAttachmentReplacePage(!1),this.setSelectedAttachment(null),this.setSelectedAttachmentAddElementId(null),this.setSelectedAttachmentListElementId(null),this.setActiveAssociationsLayer(null),this.setActiveAssociationsInput(null),this.clearAllRelationshipSettings()}notifyGeometriesChanged(e){let t=[];for(let n of e){let e=this._reactiveGraphicLookup.get(n);e&&(t.push(e),e.geometry=n.geometry)}this._updatingHandles.consumePromise(this._valueChangeTransaction(async e=>this._expressionsManager.runGeometryDependentExpressions(t,e),`user`))}async overrideOriginalFeature(e,t){await this._prepareTask?.promise;let n=this._reactiveGraphicLookup.get(e);n&&(n.original=t,this._updatingHandles.consumePromise(this._valueChangeTransaction(e=>this._expressionsManager.runOriginalFeatureDependentExpressions(n,e),`expression`)))}async setFieldInputValue(e,t){let{fieldName:n}=e;await this._updatingHandles.addPromise(this._valueChangeTransaction(async r=>{for(let i of e.features)r.setValue(i,n,t)},`user`,e))}async setFieldInputValuePerFeature(e,t){await this._updatingHandles.addPromise(this._valueChangeTransaction(async n=>{for(let[r,i]of t)n.setValue(r,e.fieldName,i);n.hasChanges&&(e.userHasChangedValue=!0)},`user`,e))}async setValueForFieldName(e,t,n){await this._updatingHandles.addPromise(this._valueChangeTransaction(async r=>{for(let i of n){let n=this._reactiveGraphicLookup.get(i);n&&r.setValue(n,e,t)}},`user`,e))}async setValuePerFeatureForFieldName(e,t){await this._updatingHandles.addPromise(this._valueChangeTransaction(async n=>{for(let[r,i]of t){let t=this._reactiveGraphicLookup.get(r);t&&n.setValue(t,e,i)}},`user`,e))}async setFieldValue(e,t){let n=this.activeForm.allFieldInputs.find(t=>t.fieldName===e);if(n==null)throw new i(`no-field-input-found`,`Cannot set the value of FieldInput with field name: ${e} because none was found in the active form`);await this.setFieldInputValue(n,t)}async setValue(e,t){let n=this.findFieldInput(e);if(n==null)throw new i(`no-FieldInput-found`,`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);await this.setFieldInputValue(n,t)}async applySubtypeDefaults(e){let{defaultValues:t}=e,{allFieldInputs:n}=this.activeForm;await this._updatingHandles.addPromise(this._valueChangeTransaction(async e=>{for(let r of n){let{fieldName:n}=r,i=t[n];if(i!=null)for(let t of r.features)e.setValue(t,n,i)}},`user`))}async handleSubtypeChanged(e){let t=this._workingFeatures.at(e);if(t)return this._updatingHandles.addPromise(this._handleSubtypeChanged(t))}async stageAddAttachments(e,t){if(t.length===0)return[];let n=this._findAttachmentInput(e);if(!n)return[];let r=await this._updatingHandles.addPromise(n.stageAddAttachments(t,this._expressionsManager.arcadeContext));return r.length===0||(this.userHasChangedValues=!0,this._emitAttachmentsChange(n)),r}stageDeleteAttachment(e,t){let n=this._findAttachmentInput(e);if(!n)return;let r=this._findAttachment(n,t);r&&(n.stageDeleteAttachment(r),this.userHasChangedValues=!0,this._emitAttachmentsChange(n))}async stageRenameAttachment(e,t,n){let r=this._findAttachmentInput(e);if(!r)return;let i=this._findAttachment(r,t);i&&(r.stageRenameAttachment(i,n.trim()),this.userHasChangedValues=!0,await r.ensureStagedUpdateData(i),this._emitAttachmentsChange(r))}async stageReplaceAttachment(e,t,n){let r=this._findAttachmentInput(e);if(!r)return!1;let i=this._findAttachment(r,t);return!i||!await this._updatingHandles.addPromise(r.stageReplaceAttachment(i,n,this._expressionsManager.arcadeContext))?!1:(this.userHasChangedValues=!0,this._emitAttachmentsChange(r),!0)}clearAttachmentChanges(e){let t=this._findAttachmentInput(e);t&&(t.clearAttachmentChanges(),this._emitAttachmentsChange(t))}setActiveAssociation(e){this._activeAssociation=e}setActiveAssociationsInput(e){this._activeAssociationsInput=e}setActiveAssociationsLayer(e){this._activeAssociationsInput?.setAssociatedLayer(e)}setActiveAssociationType(e){this._activeAssociationsInput?.setActiveAssociationType(e)}setActiveRelationshipInput(e){e||this._activeRelationshipInput?.setActiveCategory(null),this._activeRelationshipInput=e}setActiveRelationshipCategory(e,t){t.setActiveCategory(e),this.setActiveRelationshipInput(t)}clearAllRelationshipSettings(){let e=this.activeRelationshipInput;e&&(e.setActiveCategory(null),e.setShowAllCategories(!1),e.setShowAllRelatedRecords(!1),this._activeRelationshipInput=null)}clearActiveRelationshipCategoryOrInput(){let e=this.activeRelationshipInput;e&&(e.showAllRelatedRecords?e.showAllCategories?e.setActiveCategory(null):this.setActiveRelationshipInput(null):e.showAllCategories&&(e.setShowAllCategories(!1),this.setActiveRelationshipInput(null)))}resetAttachmentChanges(e,t){let n=this._findAttachmentInput(e);if(!n||!n.editable)return;let r=this._findAttachment(n,t);r&&(n.discardStagedEdits(r),this._emitAttachmentsChange(n))}setSelectedAttachment(e){this.selectedAttachment=e??null}setShowingSelectedAttachmentReplacePage(e){this.showingSelectedAttachmentReplacePage=e}setSelectedAttachmentAddElementId(e){this.selectedAttachmentAddElementId=e??null}setSelectedAttachmentListElementId(e){this.selectedAttachmentListElementId=e??null}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}validate(){return!1}validateContingentValues(e,t=!1){if(t&&!this.submitHasBeenAttempted)for(let t of e)this._reactiveContingentValuesManager.validateContingenciesForNonNullFields(t);else for(let t of e)this._reactiveContingentValuesManager.validateContingencyConstraints(t,{includeIncompleteViolations:!0})}_makeBatchFormInputsForFeature(e){let t=this._layerTemplateMap.get(e.layer);return t?B(t,{allFeatures:new r([e]),expressionsManager:this._expressionsManager,requestDeferredExpressionEvaluation:this._requestDeferredExpressionEvaluation,getExternalErrorForFeature:this._getExternalErrorForFeature,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map}):this._emptyForm}async _ensureLayerTemplate(e,t){let{_layersSet:n,contingentValuesManager:r}=this,i=e.layer,a=!1;for(let e of this._layerTemplateMap.keys())n.has(e)||(this._layerTemplateMap.delete(e),this._expressionsManager.layerExpressionsModelMap.delete(e),r.resetOptionsForLayer(e),Y(e)&&r.resetViolationsForLayer(e),a=!0);this._layerTemplateMap.has(i)||(await this._prepareLayer(i,t),u(t),r.layers.add(i),a=!0),a&&(this._prepareSharedFormTemplate(),V(this.sharedForm,this.sharedFormTemplate,{allFeatures:this._workingFeatures,expressionsManager:this._expressionsManager,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,requestDeferredExpressionEvaluation:this._requestDeferredExpressionEvaluation,map:this.map}),this._recomputeHasAsyncArcadeExpressions(),await v(()=>!r.updating,t))}_recomputeHasAsyncArcadeExpressions(){this._hasAsyncArcadeExpressions=!1;for(let e of this._expressionsManager.layerExpressionsModelMap.values())for(let t of e.arcadeExecutorUses.keys())if(t.isAsync){this._hasAsyncArcadeExpressions=!0;return}}_computeFormHeaderField(e){let{activeFeature:t,activeLayer:n}=this;return!e||!n||!t?null:P({attributes:t?.attributes,label:e,layer:n,timeZone:this.effectiveTimeZone})}_makeSubmitResults(){let e=new Map;for(let[n,r]of this._reactiveGraphicLookup){let i=[],a=[],o=this._featureFormMap.get(r)?.allAttachmentElementInputs??[];for(let e of o)t(i,e.toSubmitEdits()),e.valid||a.push(e.template.elementId);e.set(n,{feature:n,values:{...r.attributes},invalidFields:[],attachmentEdits:i,invalidAttachmentElementIds:a})}for(let t of this.sharedForm.allFieldInputs)for(let n of t.invalidFeatures)e.get(n)?.invalidFields.push(t.fieldName);return Array.from(e.values())}async _handleSubtypeChanged(e){let t=e.layer;if(this.contingentValuesManager.resetOptionsForFeature(t,e.plainGraphic),Y(t)&&this.contingentValuesManager.resetViolationsForFeature(t,e.plainGraphic),!w(t))return;let r=t.parent?.findSublayerForFeature(e.plainGraphic);if(!r)return;this._layerTemplateUpdateTask=l(this._layerTemplateUpdateTask);let i=n(async t=>{u(t),e.source.sourceLayer=r,e.source.origin=r.graphicOrigin,await this._ensureLayerTemplate(e,t),u(t),this._featureFormMap.get(e)?.destroy(),this._featureFormMap.set(e,this._makeBatchFormInputsForFeature(e)),await ee(this._valueChangeTransaction(t=>this._expressionsManager.runAllExpressions([e],t),`user`),t),u(t)});this._layerTemplateUpdateTask=i,await d(this._updatingHandles.addPromise(i.promise))}_emitSubmit(){this.emit(`submit`,{name:`submit`,results:this._makeSubmitResults(),valid:this.valid})}_findAttachmentInput(e){let t=this.activeForm.allAttachmentElementInputs.find(t=>t.template.elementId===e);return t||o.getLogger(this).error(`Attachment input not found for elementId '${e}'`),t}_findAttachment(e,t){let n=e.findAttachment(t);return n||o.getLogger(this).error(`Attachment '${t}' not found for attachment element '${e.template.elementId}'`),n}_makeAttachmentEdits(e){let n=[];for(let r of e.allAttachmentElementInputs)t(n,r.toSubmitEdits());return n}_emitAttachmentsChange(e){let t=e.single.feature;if(!t)return;let n=this._featureFormMap.get(t);this.emit(`attachments-change`,{name:`attachments-change`,feature:t.source,attachmentEdits:this._makeAttachmentEdits(n??this.activeForm),valid:this.valid})}async _valueChangeTransaction(e,t,n){let r=typeof n==`string`?n:n?.fieldName,i=new F(this,t,r);if(await e(i),t===`user`&&await this._expressionsManager.runExpressionsDependentOnChangedFields(i),await i.close(),i.hasChanges&&n){let e=typeof n==`string`?this.activeForm.allFieldInputs.find(e=>e.fieldName===n):n;e&&(e.userHasChangedValue=!0)}}_prepare(){this.pendingSubtypeChoice?.reject(),this._hasAsyncArcadeExpressions=!1,this._prepareTask=l(this._prepareTask),this._layerTemplateUpdateTask=l(this._layerTemplateUpdateTask),this._layerTemplateMap.clear(),this._updateWorkingFeatures(),c(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new L({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??x.WebMercator,map:this.map,timeZone:this.timeZone||`system`}});let{layers:e}=this;if(e.length===0)return;let t=n(async t=>{try{u(t),this._updateWorkingFeatures(),this.contingentValuesManager.layers.addMany(e),await Promise.all(e.map(e=>e.load()));for(let n of e)await this._prepareLayer(n,t);if(this.hasTooManyComplexFeatures)throw new i(`too-many-features-with-complex-forms`,`There are too many features to load into the form with the configured complexity`);if(this.hasTooManyFeatures)throw new i(`too-many-features`,`There are too many features to load into the form.`);this._prepareSharedFormTemplate(),this.sharedForm=B(this.sharedFormTemplate,{allFeatures:this._workingFeatures,expressionsManager:this._expressionsManager,getExternalErrorForFeature:this._getExternalErrorForFeature,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map,requestDeferredExpressionEvaluation:this._requestDeferredExpressionEvaluation}),await this._valueChangeTransaction(async e=>await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray(),e),`expression`),await v(()=>!this.contingentValuesManager.updating)}catch(e){throw f(e)||o.getLogger(this).error(`Failed preparing form`,e),e}});this._updatingHandles.consumePromise(t.promise),this._prepareTask=t}async _prepareLayer(e,t){let n=ae(this.layerInfos,e),r=await G(e,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this.timeZone,attachmentsEnabled:this.attachmentsEnabled},n?.formTemplate);u(t),this._layerTemplateMap.set(e,r);let i=r.getExpressionExecutorsForLayer(e);if(this._expressionsManager.layerExpressionsModelMap.set(e,new R({preserveFieldValuesWhenHidden:r.preserveFieldValuesWhenHidden,executorMap:i,fieldsIndex:e.fieldsIndex})),!this._hasAsyncArcadeExpressions){for(let e of i.values())if(e&&(this._hasAsyncArcadeExpressions=(e.editableExpression?.isAsync||e.requiredExpression?.isAsync||e.valueExpression?.isAsync||e.visibilityExpression?.isAsync)===!0,this._hasAsyncArcadeExpressions))break}}_prepareSharedFormTemplate(){let e=new Map;for(let t of this._layerTemplateMap.values())for(let n of t.elements){if(K(n))continue;let t=n.clone();q(t)&&(t.elements=t.elements.filter(e=>!K(e)));let{elementId:r}=t;e.has(r)?e.get(r).foldIn(t):e.set(r,t)}this.sharedFormTemplate=new W({elements:Array.from(e.values())})}_updateWorkingFeatures(){this._workingFeatures.destroyAll(),this._reactiveContingentValuesManager.reset();for(let e of this._featureFormMap.values())e.destroy();this._featureFormMap.clear(),this._attachmentCache.clear();let{features:e}=this;if(this._reactiveGraphicLookup=new p,e.length!==0){this._workingFeatures.addMany(e.map(k));for(let e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}async _syncAttachments(){let{activeFeature:e,activeLayer:t,activeForm:r}=this;if(!e||!r||!A(t)||!j(t))return;let i=e.getObjectId();if(i==null)return;let a=this._attachmentCache.get(t),o=r.allAttachmentElementInputs;if(!o.length)return;let c=n(async e=>{let n;if(a){let e=a.get(i);e&&(n=e)}n||(n=await M(t,i,o,e),s(this._attachmentCache,t,()=>new p).set(i,n));for(let e of o)e.applyFetchedAttachments(se(e,n))});this._syncAttachmentsTask=c,await d(c.promise)}get test(){return{expressionsManager:this._expressionsManager,reactiveGraphicLookup:this._reactiveGraphicLookup,syncAttachmentsTask:this._syncAttachmentsTask,arcadeExecutorProvider:this._arcadeExecutorProvider,requestDeferredExpressionEvaluation:this._requestDeferredExpressionEvaluation}}};e([y()],Z.prototype,`_attachmentCache`,void 0),e([y({readOnly:!0})],Z.prototype,`activeFeature`,null),e([y()],Z.prototype,`activeFeatureIndex`,void 0),e([y({readOnly:!0})],Z.prototype,`activeForm`,null),e([y({readOnly:!0})],Z.prototype,`activeLayer`,null),e([y()],Z.prototype,`activeAssociation`,null),e([y()],Z.prototype,`activeAssociationsInput`,null),e([y()],Z.prototype,`activeAssociationType`,null),e([y()],Z.prototype,`activeRelationshipInput`,null),e([y()],Z.prototype,`attachmentsEnabled`,void 0),e([y()],Z.prototype,`callbacks`,void 0),e([y()],Z.prototype,`disabled`,void 0),e([y()],Z.prototype,`calculating`,null),e([y()],Z.prototype,`canGoBack`,null),e([y()],Z.prototype,`contingentValuesManager`,void 0),e([y()],Z.prototype,`editType`,void 0),e([y()],Z.prototype,`features`,void 0),e([y()],Z.prototype,`expressionEvaluationFailed`,null),e([y()],Z.prototype,`hasNonActiveInvalidFeatures`,null),e([y()],Z.prototype,`hasAsyncArcadeExpressions`,null),e([y()],Z.prototype,`_hasAsyncArcadeExpressions`,void 0),e([y()],Z.prototype,`invalidFeatures`,null),e([y()],Z.prototype,`hasVisibleInputs`,null),e([y()],Z.prototype,`hasLayersWithContingentValues`,null),e([y()],Z.prototype,`formDescription`,null),e([y()],Z.prototype,`formTitle`,null),e([y()],Z.prototype,`effectiveTimeZone`,null),e([y()],Z.prototype,`highlightHelper`,void 0),e([y()],Z.prototype,`maximumFeatureCount`,void 0),e([y()],Z.prototype,`maximumFeatureCountWithComplexForms`,void 0),e([y()],Z.prototype,`visibleInputs`,null),e([y()],Z.prototype,`map`,null),e([y()],Z.prototype,`noVisibleElementsReason`,null),e([y()],Z.prototype,`page`,null),e([y()],Z.prototype,`pageStack`,void 0),e([y()],Z.prototype,`readOnly`,void 0),e([y()],Z.prototype,`pendingSubtypeChoice`,void 0),e([y()],Z.prototype,`subtypes`,null),e([y()],Z.prototype,`spatialReference`,void 0),e([y()],Z.prototype,`submitHasBeenAttempted`,void 0),e([y()],Z.prototype,`timeZone`,null),e([y()],Z.prototype,`view`,void 0),e([y()],Z.prototype,`updating`,null),e([y()],Z.prototype,`valid`,null),e([y()],Z.prototype,`layers`,null),e([y()],Z.prototype,`mode`,null),e([y()],Z.prototype,`sharedForm`,void 0),e([y()],Z.prototype,`sharedFormTemplate`,void 0),e([y()],Z.prototype,`selectedAttachment`,null),e([y()],Z.prototype,`selectedAttachmentAddElementId`,null),e([y()],Z.prototype,`selectedAttachmentListElementId`,null),e([y()],Z.prototype,`selectedAttachmentListInput`,null),e([y()],Z.prototype,`showingSelectedAttachmentReplacePage`,null),e([y()],Z.prototype,`selectedAttachmentAddInput`,null),e([y()],Z.prototype,`selectedAttachmentDetails`,null),e([y()],Z.prototype,`userHasChangedValues`,void 0),e([y()],Z.prototype,`layerInfos`,void 0),e([y()],Z.prototype,`_arcadeExecutorProvider`,void 0),e([y()],Z.prototype,`_activeAssociation`,void 0),e([y()],Z.prototype,`_activeAssociationsInput`,void 0),e([y()],Z.prototype,`_activeRelationshipInput`,void 0),e([y()],Z.prototype,`_prepareTask`,void 0),e([y()],Z.prototype,`_reactiveGraphicLookup`,void 0),e([y()],Z.prototype,`_allAttachmentInputs`,null),e([y()],Z.prototype,`_hasPendingAttachmentHydration`,null),e([y()],Z.prototype,`_layerTemplateMap`,void 0),e([y()],Z.prototype,`_layersSet`,null),e([y()],Z.prototype,`_workingFeatures`,void 0),e([y()],Z.prototype,`_expressionsManager`,void 0),Z=e([b(`esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel`)],Z);const oe=Z;function Q(e){return e!=null&&e.trim().length>0}function $(e,t){let n=e.keywords;return Q(n)&&n.toLowerCase()===t}function se(e,t){let n=e.input?.type===`attachment`?e.input.attachmentAssociationType:`exact`,r=e.attachmentKeyword;if(n===`any`)return t;if(n===`exactOrNone`){if(X(r))return t.filter(e=>!Q(e.keywords));let e=r.toLowerCase();return t.filter(t=>!Q(t.keywords)||$(t,e))}if(X(r))return t;let i=r.toLowerCase();return t.filter(e=>$(e,i))}export{oe as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Error.js";import r from"../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../core/MapUtils.js";import{whenOrAbort as a,settleWithPromise as o}from"../../../core/promiseUtils.js";import s from"../../../core/ReactiveMap.js";import{addMany as c,first as l}from"../../../core/SetUtils.js";import{property as u,subclass as d}from"../../../core/accessorSupport/decorators.js";import{makeArcadeContext as f,castArcadeValue as p}from"./expressionUtils.js";import{makeUseId as m}from"../inputs/support/inputUtils.js";import{isFieldElementTemplate as h,isGroupElementTemplate as g}from"../templates/support/templateUtils.js";let _=null;const v=()=>r.getLogger(`esri.widgets.BatchAttributeForm.expressions.ExpressionsManager`);let y=class extends t{constructor(e){super(e),this.calculating=!1,this.arcadeContext=null,this._abortController=new AbortController,this.layerExpressionsModelMap=new Map,this.outcomes=new s,this.expressionEvaluationFailed=!1}destroy(){this.abort()}abort(){this._abortController.abort()}async runAllExpressions(e,t){return this._evaluateSpecifiedExecutorsForEachFeature(e,x,t)}async runGeometryDependentExpressions(e,t){return this._evaluateSpecifiedExecutorsForEachFeature(e,S,t)}async runOriginalFeatureDependentExpressions(e,t){return this._evaluateSpecifiedExecutorsForEachFeature([e],C,t)}async runExpressionsDependentOnChangedFields(e){try{this.calculating=!0;let t=Array.from(e.changes).map(([t,n])=>this.runExpressionsDependentOnChangedFieldsForFeature([...n.keys()],t,e));D(await Promise.allSettled(t))}catch(e){v().error(e),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}async runExpressionsDependentOnChangedFieldsForFeature(e,t,n){if(this._abortController.signal.aborted)return;let r=this.layerExpressionsModelMap.get(t.layer);if(!r||r.components.length===0)return;let i=T(r,e);i.length!==0&&await this.evaluateAffectedExecutors([...i],t,r,n)}async evaluateAffectedExecutors(e,t,n,r){let o=new Map,c=i(this.outcomes,t,()=>new s);for(let r of e){let e=N(r,c,n);e&&(e.invalidated||=!0);let a=n.dependencyGraphComponents.get(r);a&&i(o,a,()=>this.createSccEvaluator({scc:a,feature:t,evaluatorMap:o,expressionModel:n}))}let l=[...o.values()],u={transaction:r,previousOutcomes:new s},d=l.map(e=>e.evaluate(u));D(await a(Promise.allSettled(d),this._abortController))}createSccEvaluator({scc:e,feature:t,evaluatorMap:n,expressionModel:r}){let a=i(this.outcomes,t,()=>new s),o=new b(e,t,this.arcadeContext,r,a,this._abortController);for(let a of e.adjacencyList)i(n,a,()=>this.createSccEvaluator({scc:a,feature:t,evaluatorMap:n,expressionModel:r})).dependencies.push(o);return o}async _evaluateSpecifiedExecutorsForEachFeature(e,t,n){this.calculating=!0;try{let r=[];for(let i of e){let{layer:e}=i,a=this.layerExpressionsModelMap.get(e);a&&a.components.length!==0&&r.push(this.evaluateAffectedExecutors(t(a,e),i,a,n))}D(await a(Promise.allSettled(r),this._abortController))}catch(e){v().error(e),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}};e([u()],y.prototype,`calculating`,void 0),e([u({constructOnly:!0})],y.prototype,`arcadeContext`,void 0),e([u()],y.prototype,`_abortController`,void 0),e([u()],y.prototype,`layerExpressionsModelMap`,void 0),e([u()],y.prototype,`outcomes`,void 0),e([u()],y.prototype,`expressionEvaluationFailed`,void 0),y=e([d(`esri.widgets.BatchAttributeForm.expressions.ExpressionsManager`)],y);class b{constructor(e,t,n,r,i,a){this.scc=e,this.feature=t,this.arcadeContextInfo=n,this.expressionsModel=r,this.outcomes=i,this._abortController=a,this._resolver=null,this.dependencies=[]}get baseContext(){return f(this.arcadeContextInfo,this.feature,this._abortController.signal)}evaluate(e){return this._resolver||(this._resolver=Promise.withResolvers(),o(this._resolver,this._evaluate(e))),this._resolver.promise}async _evaluate(e){_===null&&(_=await import(`../../../arcade/languageUtils.js`));let t=[],n=this.dependencies.map(t=>t.evaluate(e));D(await a(Promise.allSettled(n),this._abortController));let{executors:r}=this.scc;if(r.size===1?await this._evaluateSingleExecutorComponent({context:e,executor:l(r),errorsToReport:t}):await this._evaluateMultiExecutorComponent({context:e,errorsToReport:t}),t.length>0)throw E(t)}async _evaluateMultiExecutorComponent({context:e,errorsToReport:t}){let{transaction:n}=e,r=new Map,i=!0,a=0;for(;i&&a<3;){i=!1,a++;for(let a of this.scc.executors){let o=this._findOutcome(a)??{status:`not-run`,invalidated:!0};o.invalidated||=this._invalidatedSinceCheckpoint(a,n,r.get(a)),this._shouldEvaluate(o)&&(i=!0,r.set(a,n.currentCheckpoint),await this._performEvaluation({context:e,executor:a,errorsToReport:t}))}}}async _evaluateSingleExecutorComponent({context:e,executor:t,errorsToReport:n}){let r=this._findOutcome(t)??{status:`not-run`,invalidated:!0};r.invalidated||=this._invalidatedSinceCheckpoint(t,e.transaction),this._shouldEvaluate(r)&&await this._performEvaluation({context:e,executor:t,errorsToReport:n})}async _performEvaluation({context:e,executor:t,errorsToReport:r}){let{variables:i,executeContext:a}=this.baseContext,o=null,s=null;try{o=t.isAsync?await t.executeAsync(i,a):t.execute(i,a),s={result:o,status:`success`}}catch(e){s={error:e,status:`error`}}let{transaction:c,previousOutcomes:l}=e,{outcomes:u}=this,d=this.expressionsModel.arcadeExecutorUses.get(t)??[];for(let e of d){let t=m(e),n=u.get(t);n&&l.set(t,n),u.set(m(e),s);let r=this.expressionsModel.elementTemplateMap.get(e.elementId);switch(e.executorPurpose){case`editableExpression`:if(s.result===!1&&n?.result!==!1){let e=u.get(m({elementId:r.elementId,executorPurpose:`valueExpression`}));if(e){let{fieldName:t}=r,n=w(this.feature,t),i=p(e.result,n,this.arcadeContextInfo.timeZone,_);c.setValue(this.feature,t,i)}}break;case`valueExpression`:{if(s?.status===`error`)continue;let e=r.getExpressionExecutorsForLayer(this.feature.layer),t=!0;if(e?.editableExpression&&(t=u.get(m({elementId:r.elementId,executorPurpose:`editableExpression`}))?.result===!1),t){let e=r.fieldName,t=this.feature.getAttribute(e)??null;try{let n=w(this.feature,e),r=p(s.result,n,this.arcadeContextInfo.timeZone,_);r!==t&&c.setValue(this.feature,e,r)}catch(t){v().error(`Failed to set calculated value for field '${e}'`,t)}}}break;case`visibilityExpression`:!this.expressionsModel.preserveFieldValuesWhenHidden&&n?.result===!0&&s.result===!1&&c.originActor===`user`&&O(r,this.feature,u,{transaction:c,previousOutcomes:l})}}if(s?.status===`error`){let e=new Set;for(let t of d){let n=this.expressionsModel.elementTemplateMap.get(t.elementId);if(n)switch(t.executorPurpose){case`editableExpression`:e.add(n.label+` - Editable expression`);break;case`requiredExpression`:e.add(n.label+` - Required expression`);break;case`valueExpression`:e.add(n.label+` - Value expression`);break;case`visibilityExpression`:e.add(n.label+` - Visibility expression`)}}r.push(e.size>0?new n(`expression-evaluation-failed`,`Arcade evaluation failed (`+[...e].join(`,`)+`)`):new n(`expression-evaluation-failed`,`Arcade evaluation failed `))}}_invalidatedSinceCheckpoint(e,t,n=-1){let r=t.changesForFeature(this.feature);return!r||r.size===0?!1:this.scc.getFieldsReferenced(e).values().some(e=>r.has(e)&&r.get(e)>n)}_shouldEvaluate(e){return!this._abortController.signal.aborted&&!!e.invalidated}_findOutcome(e){return N(e,this.outcomes,this.expressionsModel)}}function x(e){return Array.from(e.dependencyGraphComponents.keys())}function S(e){return Array.from(e.geometryReferences)}function C(e){return Array.from(e.originalFeatureReferences)}function w(e,t){let r=e.layer.fieldsIndex.get(t);if(!r)throw new n(`field-not-found`,`Field '${t}' not found on layer.`);return r}function T(e,t){let n=new Set;for(let r of t)c(n,e.fieldReferencesMap.get(r));return Array.from(n)}function E(e){return AggregateError(e,`One or more expression executions failed. First error message: ${e[0].message}`)}function D(e){let t=[],n=new Set;for(let r of e){if(r.status===`fulfilled`)continue;let e=r.reason instanceof AggregateError?r.reason.errors:[r.reason];for(let r of e)n.has(r)||(n.add(r),t.push(r))}if(t.length>0)throw E(t)}function O(e,t,n,r){h(e)?k(e,t,n,r):g(e)&&A(e,t,n,r)}function k(e,t,n,r){let{group:i}=e;(!i||M(i,n,r.previousOutcomes))&&j(t,e,r)}function A(e,t,n,r){for(let i of e.elements)h(i)&&M(i,n,r.previousOutcomes)&&j(t,i,r)}function j(e,{fieldName:t},n){n.transaction.setValue(e,t,null)}function M(e,t,n){let r=m({elementId:e.elementId,executorPurpose:`visibilityExpression`}),i=n.get(r)??t.get(r);return!i||!!i.result}function N(e,t,n){let r=n.arcadeExecutorUses.get(e);if(r)for(let e of r){let n=t.get(m(e));if(n)return n}}export{y as ExpressionsManager};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Error.js";import r from"../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../core/MapUtils.js";import{whenOrAbort as a,settleWithPromise as o}from"../../../core/promiseUtils.js";import s from"../../../core/ReactiveMap.js";import{addMany as c,first as l}from"../../../core/SetUtils.js";import{property as u,subclass as d}from"../../../core/accessorSupport/decorators.js";import{makeArcadeContext as f,castArcadeValue as p,isDeferredExpressionType as m}from"./expressionUtils.js";import{makeUseId as h}from"../inputs/support/inputUtils.js";import{isFieldElementTemplate as g,isGroupElementTemplate as _}from"../templates/support/templateUtils.js";let v=null;const y=()=>r.getLogger(`esri.widgets.BatchAttributeForm.expressions.ExpressionsManager`);let b=class extends t{constructor(e){super(e),this.calculating=!1,this.arcadeContext=null,this._abortController=new AbortController,this.layerExpressionsModelMap=new Map,this.outcomes=new s,this.expressionEvaluationFailed=!1}destroy(){this.abort()}abort(){this._abortController.abort()}async runAllExpressions(e,t){return this._evaluateSpecifiedExecutorsForEachFeature(e,S,t)}async requestDeferredExecution(e,t,n){return this._evaluateSpecifiedExecutorsForEachFeature(e,(e,n)=>{let r=t(n);return r?[r]:[]},n,!0)}async runGeometryDependentExpressions(e,t){return this._evaluateSpecifiedExecutorsForEachFeature(e,C,t)}async runOriginalFeatureDependentExpressions(e,t){return this._evaluateSpecifiedExecutorsForEachFeature([e],w,t)}async runExpressionsDependentOnChangedFields(e){try{this.calculating=!0;let t=Array.from(e.changes).map(([t,n])=>this.runExpressionsDependentOnChangedFieldsForFeature([...n.keys()],t,e));O(await Promise.allSettled(t))}catch(e){y().error(e),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}async runExpressionsDependentOnChangedFieldsForFeature(e,t,n){if(this._abortController.signal.aborted)return;let r=this.layerExpressionsModelMap.get(t.layer);if(!r||r.components.length===0)return;let i=E(r,e);i.length!==0&&await this.evaluateAffectedExecutors([...i],t,r,n)}async evaluateAffectedExecutors(e,t,n,r,o=!1){let c=new Map,l=i(this.outcomes,t,()=>new s);for(let r of e){if(!o){let e=P(r,l,n);e&&(e.invalidated=!0)}let e=n.dependencyGraphComponents.get(r);e&&i(c,e,()=>this.createSccEvaluator({scc:e,feature:t,evaluatorMap:c,expressionModel:n}))}let u=[...c.values()],d={transaction:r,previousOutcomes:new s,isDeferred:o},f=u.map(e=>e.evaluate(d));O(await a(Promise.allSettled(f),this._abortController))}createSccEvaluator({scc:e,feature:t,evaluatorMap:n,expressionModel:r}){let a=i(this.outcomes,t,()=>new s),o=new x(e,t,this.arcadeContext,r,a,this._abortController);for(let a of e.adjacencyList)i(n,a,()=>this.createSccEvaluator({scc:a,feature:t,evaluatorMap:n,expressionModel:r})).dependencies.push(o);return o}async _evaluateSpecifiedExecutorsForEachFeature(e,t,n,r=!1){r||(this.calculating=!0);try{let i=[];for(let a of e){let{layer:e}=a,o=this.layerExpressionsModelMap.get(e);o&&o.components.length!==0&&i.push(this.evaluateAffectedExecutors(t(o,e),a,o,n,r))}O(await a(Promise.allSettled(i),this._abortController))}catch(e){y().error(e),this.expressionEvaluationFailed=!0}finally{this.calculating=!1}}};e([u()],b.prototype,`calculating`,void 0),e([u({constructOnly:!0})],b.prototype,`arcadeContext`,void 0),e([u()],b.prototype,`_abortController`,void 0),e([u()],b.prototype,`layerExpressionsModelMap`,void 0),e([u()],b.prototype,`outcomes`,void 0),e([u()],b.prototype,`expressionEvaluationFailed`,void 0),b=e([d(`esri.widgets.BatchAttributeForm.expressions.ExpressionsManager`)],b);class x{constructor(e,t,n,r,i,a){this.scc=e,this.feature=t,this.arcadeContextInfo=n,this.expressionsModel=r,this.outcomes=i,this._abortController=a,this._resolver=null,this.dependencies=[]}get baseContext(){return f(this.arcadeContextInfo,this.feature,this._abortController.signal)}evaluate(e){return this._resolver||(this._resolver=Promise.withResolvers(),o(this._resolver,this._evaluate(e))),this._resolver.promise}async _evaluate(e){v===null&&(v=await import(`../../../arcade/languageUtils.js`));let t=[],n=this.dependencies.map(t=>t.evaluate(e));O(await a(Promise.allSettled(n),this._abortController));let{executors:r}=this.scc;if(r.size===1?await this._evaluateSingleExecutorComponent({context:e,executor:l(r),errorsToReport:t}):await this._evaluateMultiExecutorComponent({context:e,errorsToReport:t}),t.length>0)throw D(t)}async _evaluateMultiExecutorComponent({context:e,errorsToReport:t}){let{transaction:n}=e,r=new Map,i=!0,a=0;for(;i&&a<3;){i=!1,a++;for(let a of this.scc.executors){let o=this._findOutcome(a)??{status:`not-run`,invalidated:!0};o.invalidated||=this._invalidatedSinceCheckpoint(a,n,r.get(a)),this._shouldEvaluate(a,o,e)&&(i=!0,r.set(a,n.currentCheckpoint),await this._performEvaluation({context:e,executor:a,errorsToReport:t}))}}}async _evaluateSingleExecutorComponent({context:e,executor:t,errorsToReport:n}){let r=this._findOutcome(t)??{status:`not-run`,invalidated:!0};r.invalidated||=this._invalidatedSinceCheckpoint(t,e.transaction),this._shouldEvaluate(t,r,e)&&await this._performEvaluation({context:e,executor:t,errorsToReport:n})}async _performEvaluation({context:e,executor:t,errorsToReport:r}){let{variables:i,executeContext:a}=this.baseContext,o=null,s=null;try{o=t.isAsync?await t.executeAsync(i,a):t.execute(i,a),s={result:o,status:`success`}}catch(e){s={error:e,status:`error`}}let{transaction:c,previousOutcomes:l}=e,{outcomes:u}=this,d=this.expressionsModel.arcadeExecutorUses.get(t)??[];for(let t of d){let n=h(t),r=u.get(n);r&&l.set(n,r),u.set(h(t),s);let i=this.expressionsModel.elementTemplateMap.get(t.elementId);switch(t.executorPurpose){case`editableExpression`:if(s.result===!1&&r?.result!==!1){let e=u.get(h({elementId:i.elementId,executorPurpose:`valueExpression`}));if(e){let{fieldName:t}=i,n=T(this.feature,t),r=p(e.result,n,this.arcadeContextInfo.timeZone,v);c.setValue(this.feature,t,r)}}break;case`valueExpression`:{if(s?.status===`error`)continue;let e=i.getExpressionExecutorsForLayer(this.feature.layer),t=!0;if(e?.editableExpression&&(t=u.get(h({elementId:i.elementId,executorPurpose:`editableExpression`}))?.result===!1),t){let e=i.fieldName,t=this.feature.getAttribute(e)??null;try{let n=T(this.feature,e),r=p(s.result,n,this.arcadeContextInfo.timeZone,v);r!==t&&c.setValue(this.feature,e,r)}catch(t){y().error(`Failed to set calculated value for field '${e}'`,t)}}}break;case`visibilityExpression`:!this.expressionsModel.preserveFieldValuesWhenHidden&&r?.result===!0&&s.result===!1&&c.originActor===`user`&&k(i,this.feature,u,e)}}if(s?.status===`error`){let e=new Set;for(let t of d){let n=this.expressionsModel.elementTemplateMap.get(t.elementId);if(n)switch(t.executorPurpose){case`editableExpression`:e.add(n.label+` - Editable expression`);break;case`requiredExpression`:e.add(n.label+` - Required expression`);break;case`valueExpression`:e.add(n.label+` - Value expression`);break;case`visibilityExpression`:e.add(n.label+` - Visibility expression`)}}r.push(e.size>0?new n(`expression-evaluation-failed`,`Arcade evaluation failed (`+[...e].join(`,`)+`)`):new n(`expression-evaluation-failed`,`Arcade evaluation failed `))}}_invalidatedSinceCheckpoint(e,t,n=-1){let r=t.changesForFeature(this.feature);return!r||r.size===0?!1:this.scc.getFieldsReferenced(e).values().some(e=>r.has(e)&&r.get(e)>n)}_shouldEvaluate(e,t,{isDeferred:n}){return this._abortController.signal.aborted||F(this.expressionsModel.arcadeExecutorUses.get(e))&&!n?!1:!!t.invalidated}_findOutcome(e){return P(e,this.outcomes,this.expressionsModel)}}function S(e){return Array.from(e.dependencyGraphComponents.keys())}function C(e){return Array.from(e.geometryReferences)}function w(e){return Array.from(e.originalFeatureReferences)}function T(e,t){let r=e.layer.fieldsIndex.get(t);if(!r)throw new n(`field-not-found`,`Field '${t}' not found on layer.`);return r}function E(e,t){let n=new Set;for(let r of t)c(n,e.fieldReferencesMap.get(r));return Array.from(n)}function D(e){return AggregateError(e,`One or more expression executions failed. First error message: ${e[0].message}`)}function O(e){let t=[],n=new Set;for(let r of e){if(r.status===`fulfilled`)continue;let e=r.reason instanceof AggregateError?r.reason.errors:[r.reason];for(let r of e)n.has(r)||(n.add(r),t.push(r))}if(t.length>0)throw D(t)}function k(e,t,n,r){g(e)?A(e,t,n,r):_(e)&&j(e,t,n,r)}function A(e,t,n,r){let{group:i}=e;(!i||N(i,n,r.previousOutcomes))&&M(t,e,r)}function j(e,t,n,r){for(let i of e.elements)g(i)&&N(i,n,r.previousOutcomes)&&M(t,i,r)}function M(e,{fieldName:t},n){n.transaction.setValue(e,t,null)}function N(e,t,n){let r=h({elementId:e.elementId,executorPurpose:`visibilityExpression`}),i=n.get(r)??t.get(r);return!i||!!i.result}function P(e,t,n){let r=n.arcadeExecutorUses.get(e);if(r)for(let e of r){let n=t.get(h(e));if(n)return n}}function F(e){return e?.every(e=>m(e.executorPurpose))??!1}export{b as ExpressionsManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../core/Error.js";import{DateOnly as t}from"../../../core/sql/DateOnly.js";import{TimeOnly as n}from"../../../core/sql/TimeOnly.js";import{isDynamicChoiceInput as r}from"../../../form/elements/inputs/inputUtils.js";import{isFieldElement as i}from"../../../form/support/formUtils.js";async function a({element:e,expressionInfos:t,provider:n}){let a={};if(e.visibilityExpression){let r=t.get(e.visibilityExpression);a.visibilityExpression=r?await n.getArcadeExecutor(r.expression):void 0}if(`editableExpression`in e&&e.editableExpression){let r=t.get(e.editableExpression);a.editableExpression=r?await n.getArcadeExecutor(r.expression):void 0}if(`requiredExpression`in e&&e.requiredExpression){let r=t.get(e.requiredExpression);a.requiredExpression=r?await n.getArcadeExecutor(r.expression):void 0}if(`valueExpression`in e&&e.valueExpression){let r=t.get(e.valueExpression);a.valueExpression=r?await n.getArcadeExecutor(r.expression):void 0}let o=i(e)?e.input:void 0;if(o&&r(o)&&o.choiceExpression){let e=t.get(o.choiceExpression);a.choiceExpression=e?await n.getArcadeExecutor(e.expression):void 0}return a}function o(e){return new Map(e?.map(e=>[e.name,e]))}function s(r,i,a,o){if(r===null)return null;switch(i.type){case`big-integer`:case`integer`:case`long`:case`oid`:case`small-integer`:{let e=c(r,o);return e==null?null:Math.floor(e)}case`single`:case`double`:return c(r,o);case`global-id`:case`guid`:case`string`:return o.toString(r);case`date`:{let t=l(r,a,o);if(t)return t.getTime();let n=c(r,o);if(n!==null&&!Number.isNaN(n)&&Number.isInteger(n))return n;throw new e(`unsupported-value-type`,`Unable to convert value ${r} to a date`)}case`date-only`:{if(o.isDateOnly(r))return r.toStorageFormat();let n=l(r,a,o);if(!n)throw new e(`unsupported-value-type`,`Unable to convert value ${r} to a date-only string`);return t.fromDateTime(n.toDateTime()).toStorageFormat()}case`time-only`:{if(o.isTime(r))return r.toStorageString();if(o.isDate(r))return n.fromDateTime(r.toDateTime()).toStorageString();let t=n.fromString(o.toString(r));if(!t)throw new e(`unsupported-value-type`,`Unable to convert value ${r} to a time-only string`);return t.toStorageString()}case`timestamp-offset`:{let t=l(r,a,o);if(!t)throw new e(`unsupported-value-type`,`Unable to convert value ${r} to a timestamp-offset string`);return t.toISOString(!1)}}throw new e(`unsupported-value-type`,`Unable to convert value ${r} to a value matching field type`)}function c(e,t){if(e===``)return null;let n=t.toNumber(e);return Number.isNaN(n)?null:n}function l(e,t,n){if(n.isDate(e))return e;if(n.isDateOnly(e))return e.toArcadeDate();let r=n.toString(e),i=n.toDate(r,t);return!i||!/\d{4}-\d{2}-\d{2}/.test(r)?null:i}function u(e,t,n){let{editType:r,map:i,spatialReference:a,timeZone:o}=e,s=t.layer,c=s?.type===`scene`&&s.associatedLayer!=null?s.associatedLayer:s;return{variables:{$originalfeature:t.original,$editcontext:{editType:r},$layer:c,$featureset:c,$datastore:c?.url,$feature:t.plainGraphic,$map:i},executeContext:{rawOutput:!0,spatialReference:a??void 0,timeZone:o,abortSignal:n}}}export{s as castArcadeValue,u as makeArcadeContext,a as makeExecutorSetForFormElement,o as makeExpressionInfosMap};
2
+ import e from"../../../core/Error.js";import{DateOnly as t}from"../../../core/sql/DateOnly.js";import{TimeOnly as n}from"../../../core/sql/TimeOnly.js";import{isDynamicChoiceInput as r}from"../../../form/elements/inputs/inputUtils.js";import{isFieldElement as i}from"../../../form/support/formUtils.js";async function a({element:e,expressionInfos:t,provider:n}){let a={};if(e.visibilityExpression){let r=t.get(e.visibilityExpression);a.visibilityExpression=r?await n.getArcadeExecutor(r.expression):void 0}if(`editableExpression`in e&&e.editableExpression){let r=t.get(e.editableExpression);a.editableExpression=r?await n.getArcadeExecutor(r.expression):void 0}if(`requiredExpression`in e&&e.requiredExpression){let r=t.get(e.requiredExpression);a.requiredExpression=r?await n.getArcadeExecutor(r.expression):void 0}if(`valueExpression`in e&&e.valueExpression){let r=t.get(e.valueExpression);a.valueExpression=r?await n.getArcadeExecutor(r.expression):void 0}let o=i(e)?e.input:void 0;if(o&&r(o)&&o.choiceExpression){let e=t.get(o.choiceExpression);a.choiceExpression=e?await n.getArcadeExecutor(e.expression):void 0}return a}function o(e){return new Map(e?.map(e=>[e.name,e]))}function s(r,i,a,o){if(r===null)return null;switch(i.type){case`big-integer`:case`integer`:case`long`:case`oid`:case`small-integer`:{let e=c(r,o);return e==null?null:Math.floor(e)}case`single`:case`double`:return c(r,o);case`global-id`:case`guid`:case`string`:return o.toString(r);case`date`:{let t=l(r,a,o);if(t)return t.getTime();let n=c(r,o);if(n!==null&&!Number.isNaN(n)&&Number.isInteger(n))return n;throw new e(`unsupported-value-type`,`Unable to convert value ${r} to a date`)}case`date-only`:{if(o.isDateOnly(r))return r.toStorageFormat();let n=l(r,a,o);if(!n)throw new e(`unsupported-value-type`,`Unable to convert value ${r} to a date-only string`);return t.fromDateTime(n.toDateTime()).toStorageFormat()}case`time-only`:{if(o.isTime(r))return r.toStorageString();if(o.isDate(r))return n.fromDateTime(r.toDateTime()).toStorageString();let t=n.fromString(o.toString(r));if(!t)throw new e(`unsupported-value-type`,`Unable to convert value ${r} to a time-only string`);return t.toStorageString()}case`timestamp-offset`:{let t=l(r,a,o);if(!t)throw new e(`unsupported-value-type`,`Unable to convert value ${r} to a timestamp-offset string`);return t.toISOString(!1)}}throw new e(`unsupported-value-type`,`Unable to convert value ${r} to a value matching field type`)}function c(e,t){if(e===``)return null;let n=t.toNumber(e);return Number.isNaN(n)?null:n}function l(e,t,n){if(n.isDate(e))return e;if(n.isDateOnly(e))return e.toArcadeDate();let r=n.toString(e),i=n.toDate(r,t);return!i||!/\d{4}-\d{2}-\d{2}/.test(r)?null:i}function u(e,t,n){let{editType:r,map:i,spatialReference:a,timeZone:o}=e,s=t.layer,c=s?.type===`scene`&&s.associatedLayer!=null?s.associatedLayer:s;return{variables:{$originalfeature:t.original,$editcontext:{editType:r},$layer:c,$featureset:c,$datastore:c?.url,$feature:t.plainGraphic,$map:i},executeContext:{rawOutput:!0,spatialReference:a??void 0,timeZone:o,abortSignal:n}}}function d(e){return e===`choiceExpression`}export{s as castArcadeValue,d as isDeferredExpressionType,u as makeArcadeContext,a as makeExecutorSetForFormElement,o as makeExpressionInfosMap};
@@ -23,6 +23,12 @@ export interface FieldInputProperties extends EditableInputProperties, Partial<P
23
23
  * @see [BatchFormInputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/BatchFormInputs/)
24
24
  */
25
25
  export default class FieldInput extends EditableInput<any> {
26
+ /**
27
+ * @deprecated
28
+ * since 5.2. This is a read-only class. Instances should be
29
+ * created and accessed via
30
+ * [BatchAttributeFormViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/)
31
+ */
26
32
  constructor(properties: FieldInputProperties);
27
33
  /**
28
34
  * The type of data displayed by the field input. Possible values are listed below.
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../../core/arrayUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{isDynamicChoiceInput as a,isMultipleChoiceInput as o}from"../../../form/elements/inputs/inputUtils.js";import s from"../../../layers/support/CodedValue.js";import c from"../../../layers/support/CodedValueDomain.js";import{getDomainRange as l,validateDomainValue as u,dateTimeFieldValuesToNumericRange as d,isDomainValidForField as f}from"../../../layers/support/domainUtils.js";import{getFieldRange as p,isDateOnlyField as m,isTimeOnlyField as h,isTimestampOffsetField as g}from"../../../layers/support/fieldUtils.js";import{supportsFieldConfiguration as _}from"../../../layers/support/layerUtils.js";import v from"../../../layers/support/RangeDomain.js";import{isNumber as y}from"../../../support/guards.js";import b from"./EditableInput.js";import{isMultipleChoiceController as x}from"./support/controllerUtils.js";import S from"./support/DynamicChoiceController.js";import{MultiFeatureError as C,getFieldInputDataType as w,visibilityCodeToBoolean as T,isFieldInputWithShowNoValueOptionInput as E,isWarning as D,isContingentValuesError as O,FormValidationWarning as k,differentValuesString as A}from"./support/inputUtils.js";import j from"./support/MultipleChoiceController.js";import{otherChoiceCheckedPlaceholderValue as M}from"./support/multipleChoiceInputUtils.js";import{timeResolutionToStepMap as N}from"../../support/dateUtils.js";import{valuesAreEquivalent as P,getMaxLength as F,getMinLength as I,dateIsValid as L,validateFormValue as R}from"../../support/forms/formUtils.js";let z=class extends b{constructor(e){super(e),this.getExternalErrorForFeature=null,this.getFieldValueOptionsForFeature=null,this.group=null,this.inputController=null,this.touched=!1,this.type=`field`,this.userHasChangedValue=!1,this._hasIntersectionWithElementFieldDomain=!1}destroy(){this.inputController=n(this.inputController)}initialize(){this.input&&(a(this.input)&&(this.inputController=new S({fieldInput:this})),o(this.input)&&(this.inputController=new j({fieldInput:this})))}get compositeError(){if(this.valid)return null;let{errors:e}=this;if(e.length<this.features.length)return C.DIFFERENT_ERRORS;let t=e[0];for(let n of e)if(n.error!==t.error)return C.DIFFERENT_ERRORS;return t.error}get dataType(){return w(this.field)}get domain(){let e=this._allDomains.toArray();return this.calculateDomain(e)}get distinctValues(){if(this.featuresHaveSameValue)return[this.value];let e=new Set;for(let t of this.features)e.add(t.getAttribute(this.fieldName));return Array.from(e)}get editable(){return this.field.editable?this._evaluatedEditableExpression??!0:!1}get label(){let{label:e}=this.template,t=this._computeStringLiteralText(e);if(t)return t;let{field:n,layers:r}=this;if(r.length===1){let e=r[0];if(_(e)){let t=e.getFieldAlias(n.name);if(t!=null&&t!==``)return t}}return n.alias||n.name}get effectiveVisible(){return T(this.effectiveVisibilityCode)}get effectiveVisibilityCode(){let{visibilityCode:e}=this;if(e!==`visible`)return e;let{group:t}=this;if(t==null)return e;let n=t.visibilityCode;return n===`hidden:visibility-expression:all-features`?`hidden:group-visibility-expression:all-features`:n===`hidden:visibility-expression:some-features`?`hidden:group-visibility-expression:some-features`:e}get errors(){return this._validate()}get featuresHaveSameValue(){let{fieldName:e}=this,t=this.features.at(0)?.getAttribute(e);return this.features.every(n=>P(n.getAttribute(e),t))}get field(){return this.template.field}get fieldName(){return this.field.name}get input(){return this.template.input}get invalidFeatures(){return this.errors.map(e=>e.feature)}get isSubtypeField(){return this.layers.some(e=>{if(e&&`subtypeField`in e){let{subtypeField:t,fieldsIndex:n}=e;return(n.get(t)?.name??t)===this.fieldName}return!1})}get showNoValueOptionEnabled(){let{input:e}=this;return this.required?!1:!E(e)||e?.showNoValueOption===!0}get showNoValueLabel(){let{input:e}=this;return E(e)?e?.noValueOptionLabel:null}get includeTime(){let{template:e,field:t}=this;return this.dataType===`date`?t.type===`time-only`?!0:t.type===`date-only`?!1:e.input?.type!==`datetime-picker`||e.input.includeTime:!1}get includeTimeOffset(){if(this.field.type!==`timestamp-offset`)return!1;let{input:e}=this;return!e||e.type===`timestampoffset-picker`&&e.includeTimeOffset}get inputType(){return this.input?.type}get maxLength(){return F({dataType:this.dataType,field:this.field,input:this.input})}get minLength(){return I({dataType:this.dataType,field:this.field,input:this.input})}get multipleChoiceOtherChoiceCheckboxState(){return V(this.inputController)?.otherChoiceCheckboxState??{checked:!1,indeterminate:!1}}get placeholder(){return this.template.hint}get range(){if(this.dataType===`date`)return this._dateRange;let{domain:e,field:t}=this;if(e){let n=l(t,e);return{max:n?.max,min:n?.min}}let n=this._allDomains.toArray().every(e=>!e)?p(t):null;return{max:n?.max===Number.MAX_VALUE?null:n?.max??null,min:n?.min===-Number.MAX_VALUE?null:n?.min??null}}get required(){if(!this.editable)return!1;if(!this.field.nullable||this.isSubtypeField)return!0;let e=this.visible&&this.group?.visible!==!1,t=this._evaluatedRequiredExpression;return e&&t!=null?t:!1}get status(){let{validationMessage:e}=this;return e?D(e)?`idle`:`invalid`:this.valid?`valid`:`idle`}get timeResolution(){let e=this.input;if(!(!e||e.type!==`timestampoffset-picker`&&e.type!==`time-picker`))return e.timeResolution??`minutes`}get timeStep(){return this.timeResolution==null?void 0:N.get(this.timeResolution)}get userInvalid(){return this.errors.some(({error:e})=>O(e))?!0:!this.valid&&this.touched}get valid(){return this.errors.length===0||!this.editable}get validationMessage(){return this.valueIsOutOfDomain&&this.touched?k.OUT_OF_SUBTYPE_DOMAIN:this.userInvalid?this.compositeError??void 0:void 0}get value(){return this.featuresHaveSameValue?this.features.at(0)?.getAttribute(this.fieldName)??null:A}get valueIsOutOfDomain(){let{domain:e,value:t,field:n}=this;return!e||t==null?!1:u(n,t,e)!==null}get visibilityCode(){return this.field.visible?this._fieldShouldHaveDomain&&this.domain==null?`hidden:no-domain-in-common`:this._baseVisibilityCode:`hidden:field-definition`}get codedValueDomainOptions(){return this.domain?.type===`coded-value`?this.domain.codedValues.map(({name:e,code:t})=>({name:e,value:t})):[]}getExplicitMultipleChoiceOtherChoiceCheckedState(){return V(this.inputController)?.getExplicitOtherChoiceCheckedState()}getMultipleChoiceOtherChoiceRenderState(e){let t=V(this.inputController)?.otherChoiceRenderState;return t?{...t,label:t.label??e}:{fieldName:void 0,hint:``,label:e,shouldShow:!1,checkboxState:{checked:!1,indeterminate:!1},value:null,normalizedValue:null,maxLength:void 0,status:`idle`}}hasExplicitMultipleChoiceOtherChoiceCheckedState(){return V(this.inputController)?.hasExplicitOtherChoiceCheckedState()??!1}initializeExplicitMultipleChoiceOtherChoiceCheckedState(){V(this.inputController)?.initializeExplicitOtherChoiceCheckedState()}setExplicitMultipleChoiceOtherChoiceCheckedState(e){V(this.inputController)?.setExplicitOtherChoiceCheckedState(e)}get codedValueOptions(){let{getFieldValueOptionsForFeature:e}=this;if(this.features.length===1&&e){let t=this.features.at(0);return e({domain:this.domain??void 0,feature:t,fieldName:this.fieldName,layer:t.layer})}let t=this.codedValueDomainOptions,{value:n}=this;return{recommended:t,other:[],unsupported:n!=null&&n!==A&&!t.some(e=>e.value===n)?[{name:`${n}`,value:n}]:[],containsEmptyOption:!1}}get _evaluatedRequiredExpression(){let e=!1,t=!0,n=this.template;for(let r of this.features){if(n.getExpressionExecutorsForLayer(r.layer)?.requiredExpression==null)continue;t=!1;let i=this._lookupEvaluatedExpression(r,`requiredExpression`);i?.status===`success`?e||=i.result===!0:e=!0}return t?null:e}get _allDomains(){let e=this.template.domain;return this.features.map(t=>{let n=t.layer.getFieldDomain(this.fieldName,{feature:t.plainGraphic});return n?.type===`range`||e?.type===`range`?n??this.template.domain:n})}get _fieldShouldHaveDomain(){return this._hasIntersectionWithElementFieldDomain?!0:this._allDomains.some(t)}get _dateFormRange(){if(this.dataType!==`date`)return{};let{input:e}=this;if(!e)return{};let{type:t}=e,n={};if((t===`date-picker`||t===`time-picker`||t===`timestampoffset-picker`)&&(n=d(this.field,e.max,e.min)),t===`datetime-picker`){let{max:t,min:r}=e;n={max:t!=null&&L(t)?t.getTime():null,min:r!=null&&L(r)?r.getTime():null}}return{min:n.min,max:n.max,rawMax:n?.rawMax??null,rawMin:n?.rawMin??null}}get _dateRange(){let{_dateFormRange:e,template:t,field:n,domain:r}=this;if(this.dataType!==`date`)return{};if(!r)return this._fieldShouldHaveDomain?{}:e;let i=l(n,r);if(!i)return e;let{max:a,min:o,rawMax:s,rawMin:c}=e,{type:u}=t.field;if(u===`date`){let{max:e,min:t}=i;return{max:y(a)&&(e===null||e!=null&&a<=e)?a:e??null,min:y(o)&&(t===null||t!=null&&o>=t)?o:t??null}}if(u===`date-only`||u===`time-only`||u===`timestamp-offset`){let{max:e,min:t,rawMax:n,rawMin:r}=i,l=y(a)&&s&&(e==null||a<e),u=y(o)&&c&&(t==null||o>t);return{max:l?a:e,min:u?o:t,rawMax:l?s:n,rawMin:u?c:r}}return{}}touch(){this.touched=!0}_validate(){let{dataType:e,fieldName:t,maxLength:n,minLength:r,range:i}=this,a=[],o=x(this.inputController)?this.inputController:void 0,s=o?.input;for(let c of this.features){let{layer:l}=c,u=l.getField(t)??this.field,d=l.getFieldDomain(t,{feature:c.plainGraphic}),f=this.calculateDomain([d]),p=!f||f.type===`coded-value`?null:f,m=this._requiredForFeature(c),h=c.getAttribute(t),g=R(h,{dataType:e,domain:p,field:u,maxLength:n,minLength:r,multipleChoice:s,range:i,required:m})??this.getExternalErrorForFeature?.(c,t);if(!g&&s&&o){let{otherChoice:e}=s,t=o.otherChoiceFieldName,n=o.shouldShowOtherChoice,r=o.otherChoiceEffectiveCheckboxState;if(n&&e&&t&&r.checked){let e=l.getField(t),n=c.getAttribute(t),r=n===M?null:n;if(e){let t=w(e);g=R(r,{dataType:t,domain:e.domain,field:e,maxLength:F({dataType:t,field:e,input:null}),minLength:I({dataType:t,field:e,input:null}),multipleChoice:null,range:{max:void 0,min:void 0},required:!0})}}}g&&a.push({error:g,feature:c.source})}return a}_editableForFeature(e){if(!this.field.editable)return!1;if(this.template.getExpressionExecutorsForLayer(e.layer)?.editableExpression==null)return!0;let t=this._lookupEvaluatedExpression(e,`editableExpression`);return t?.status===`success`&&t.result===!0}_effectiveVisibleFeature(e){if(this.group&&!this.group.visibleForFeature(e))return!1;if(this.template.getExpressionExecutorsForLayer(e.layer)?.visibilityExpression==null)return!0;let t=this._lookupEvaluatedExpression(e,`visibilityExpression`);return t?.status===`success`&&t.result===!0}_requiredForFeature(e){if(!this._editableForFeature(e))return!1;if(!this.field.nullable||this.isSubtypeField)return!0;let t=this._effectiveVisibleFeature(e);if(this.template.getExpressionExecutorsForLayer(e.layer)?.requiredExpression==null)return!1;let n=this._lookupEvaluatedExpression(e,`requiredExpression`);return n?.status===`success`?t&&n.result===!0:t}calculateDomain(e){let t=e.find(e=>e!=null),n=this.template.domain;if(!t)return n&&f(this.field,n)?n:null;switch(t.type){case`coded-value`:if(e.some(e=>!e)){if(!n)return null;e=e.filter(e=>e!==null)}break;case`range`:e=e.filter(e=>e!==null)}if(!e.every(e=>e?.type===t?.type))return null;let r=null;switch(t?.type){case`range`:r=this._intersectRangeDomains(e);break;case`coded-value`:r=this._intersectCodedValueDomains(e)}return r}_intersectCodedValueDomains(e){if(!e.length)return null;let t=new Map(e[0].codedValues.map(({code:e,name:t})=>[e,t])),n=this.template.domain?new Map(this.template.domain.codedValues.map(({code:e,name:t})=>[e,t])):null;for(let n of e)for(let[e,r]of t)n.codedValues.some(t=>t.code===e&&t.name===r)||t.delete(e);let r=t;if(n){r=new Map;for(let[e,i]of n)t.has(e)&&r.set(e,i)}let i=Array.from(r.entries()).map(([e,t])=>new s({code:e,name:t}));return i.length?new c({codedValues:i}):null}_intersectRangeDomains(e){if(!e.length)return null;let t=e[0];for(let n=1;n<e.length;n++){if(!t)return null;t=this._findMinMaxValuesBetweenTwoDomains(t,e[n])}if(t&&!f(this.field,t))return null;let{domain:n}=this.template;if(t&&n&&n instanceof v){let e=this._findMinMaxValuesBetweenTwoDomains(t,n);return this._hasIntersectionWithElementFieldDomain=!!e,e}return t}_getMinMaxFromRangeDomain(e){let t=e.minValue,n=e.maxValue,{field:r}=this;return m(r)||h(r)||g(r)?d(r,n,t):{min:t!=null&&typeof t==`number`?t:null,max:n!=null&&typeof n==`number`?n:null}}_findMinMaxValuesBetweenTwoDomains(e,t){let n=new v,r=this._getMinMaxFromRangeDomain(e),i=this._getMinMaxFromRangeDomain(t),{field:a}=this,o=this._getValidRangeValue(r.min,-1/0),s=this._getValidRangeValue(r.max,1/0),c=this._getValidRangeValue(i.min,-1/0),l=this._getValidRangeValue(i.max,1/0);return n.minValue=Math.max(o,c),n.maxValue=Math.min(s,l),n.minValue===-1/0||n.maxValue===1/0||n.minValue>n.maxValue?null:((m(a)||h(a)||g(a))&&(n.minValue=Number(r.min)>Number(i.min)?r.rawMin:i.rawMin,n.maxValue=Number(r.max)<Number(i.max)?r.rawMax:i.rawMax),n.name=`intersection`,n)}_getValidRangeValue(e,t){return y(e)?e:t}};e([r()],z.prototype,`dataType`,null),e([r()],z.prototype,`domain`,null),e([r()],z.prototype,`distinctValues`,null),e([r()],z.prototype,`editable`,null),e([r()],z.prototype,`label`,null),e([r()],z.prototype,`effectiveVisible`,null),e([r()],z.prototype,`effectiveVisibilityCode`,null),e([r()],z.prototype,`errors`,null),e([r()],z.prototype,`featuresHaveSameValue`,null),e([r()],z.prototype,`field`,null),e([r()],z.prototype,`fieldName`,null),e([r()],z.prototype,`getExternalErrorForFeature`,void 0),e([r()],z.prototype,`getFieldValueOptionsForFeature`,void 0),e([r()],z.prototype,`group`,void 0),e([r()],z.prototype,`input`,null),e([r()],z.prototype,`inputController`,void 0),e([r()],z.prototype,`invalidFeatures`,null),e([r()],z.prototype,`isSubtypeField`,null),e([r()],z.prototype,`showNoValueOptionEnabled`,null),e([r()],z.prototype,`showNoValueLabel`,null),e([r()],z.prototype,`includeTime`,null),e([r()],z.prototype,`includeTimeOffset`,null),e([r({readOnly:!0})],z.prototype,`inputType`,null),e([r()],z.prototype,`maxLength`,null),e([r()],z.prototype,`minLength`,null),e([r()],z.prototype,`multipleChoiceOtherChoiceCheckboxState`,null),e([r()],z.prototype,`placeholder`,null),e([r()],z.prototype,`range`,null),e([r()],z.prototype,`required`,null),e([r()],z.prototype,`status`,null),e([r()],z.prototype,`timeResolution`,null),e([r()],z.prototype,`timeStep`,null),e([r()],z.prototype,`touched`,void 0),e([r({readOnly:!0})],z.prototype,`type`,void 0),e([r()],z.prototype,`userHasChangedValue`,void 0),e([r()],z.prototype,`userInvalid`,null),e([r()],z.prototype,`valid`,null),e([r()],z.prototype,`validationMessage`,null),e([r()],z.prototype,`value`,null),e([r()],z.prototype,`valueIsOutOfDomain`,null),e([r()],z.prototype,`visibilityCode`,null),e([r()],z.prototype,`codedValueDomainOptions`,null),e([r()],z.prototype,`codedValueOptions`,null),e([r()],z.prototype,`_evaluatedRequiredExpression`,null),e([r()],z.prototype,`_hasIntersectionWithElementFieldDomain`,void 0),e([r()],z.prototype,`_allDomains`,null),e([r()],z.prototype,`_fieldShouldHaveDomain`,null),e([r()],z.prototype,`_dateFormRange`,null),e([r()],z.prototype,`_dateRange`,null),z=e([i(`esri.widgets.BatchAttributeForm.inputs.FieldInput`)],z);const B=z;function V(e){return x(e)?e:null}export{B as default};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../../core/arrayUtils.js";import n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import{isDynamicChoiceInput as o,isMultipleChoiceInput as s}from"../../../form/elements/inputs/inputUtils.js";import c from"../../../layers/support/CodedValue.js";import l from"../../../layers/support/CodedValueDomain.js";import{getDomainRange as u,validateDomainValue as d,dateTimeFieldValuesToNumericRange as f,isDomainValidForField as p}from"../../../layers/support/domainUtils.js";import{getFieldRange as m,isDateOnlyField as h,isTimeOnlyField as g,isTimestampOffsetField as _}from"../../../layers/support/fieldUtils.js";import{supportsFieldConfiguration as v}from"../../../layers/support/layerUtils.js";import y from"../../../layers/support/RangeDomain.js";import{isNumber as b}from"../../../support/guards.js";import x from"./EditableInput.js";import{isMultipleChoiceController as S}from"./support/controllerUtils.js";import C from"./support/DynamicChoiceController.js";import{MultiFeatureError as w,getFieldInputDataType as T,visibilityCodeToBoolean as E,isFieldInputWithShowNoValueOptionInput as D,isWarning as O,isContingentValuesError as k,FormValidationWarning as A,differentValuesString as j}from"./support/inputUtils.js";import M from"./support/MultipleChoiceController.js";import{otherChoiceCheckedPlaceholderValue as N}from"./support/multipleChoiceInputUtils.js";import{timeResolutionToStepMap as P}from"../../support/dateUtils.js";import{valuesAreEquivalent as F,getMaxLength as I,getMinLength as L,dateIsValid as R,validateFormValue as z}from"../../support/forms/formUtils.js";let B=class extends x{constructor(e){super(e),this.getExternalErrorForFeature=null,this.getFieldValueOptionsForFeature=null,this.group=null,this.inputController=null,this.touched=!1,this.type=`field`,this.userHasChangedValue=!1,this._hasIntersectionWithElementFieldDomain=!1}destroy(){this.inputController=r(this.inputController)}initialize(){if(this.input){if(o(this.input)){let{requestDeferredExpressionEvaluation:e}=this;e?this.inputController=new C({fieldInput:this,requestDeferredExpressionEvaluation:e}):n.getLogger(this).error(`requestDeferredExpressionEvaluation callback is required for dynamic choice inputs.`)}s(this.input)&&(this.inputController=new M({fieldInput:this}))}}get compositeError(){if(this.valid)return null;let{errors:e}=this;if(e.length<this.features.length)return w.DIFFERENT_ERRORS;let t=e[0];for(let n of e)if(n.error!==t.error)return w.DIFFERENT_ERRORS;return t.error}get dataType(){return T(this.field)}get domain(){let e=this._allDomains.toArray();return this.calculateDomain(e)}get distinctValues(){if(this.featuresHaveSameValue)return[this.value];let e=new Set;for(let t of this.features)e.add(t.getAttribute(this.fieldName));return Array.from(e)}get editable(){return this.field.editable?this._evaluatedEditableExpression??!0:!1}get label(){let{label:e}=this.template,t=this._computeStringLiteralText(e);if(t)return t;let{field:n,layers:r}=this;if(r.length===1){let e=r[0];if(v(e)){let t=e.getFieldAlias(n.name);if(t!=null&&t!==``)return t}}return n.alias||n.name}get effectiveVisible(){return E(this.effectiveVisibilityCode)}get effectiveVisibilityCode(){let{visibilityCode:e}=this;if(e!==`visible`)return e;let{group:t}=this;if(t==null)return e;let n=t.visibilityCode;return n===`hidden:visibility-expression:all-features`?`hidden:group-visibility-expression:all-features`:n===`hidden:visibility-expression:some-features`?`hidden:group-visibility-expression:some-features`:e}get errors(){return this._validate()}get featuresHaveSameValue(){let{fieldName:e}=this,t=this.features.at(0)?.getAttribute(e);return this.features.every(n=>F(n.getAttribute(e),t))}get field(){return this.template.field}get fieldName(){return this.field.name}get input(){return this.template.input}get invalidFeatures(){return this.errors.map(e=>e.feature)}get isSubtypeField(){return this.layers.some(e=>{if(e&&`subtypeField`in e){let{subtypeField:t,fieldsIndex:n}=e;return(n.get(t)?.name??t)===this.fieldName}return!1})}get showNoValueOptionEnabled(){let{input:e}=this;return this.required?!1:!D(e)||e?.showNoValueOption===!0}get showNoValueLabel(){let{input:e}=this;return D(e)?e?.noValueOptionLabel:null}get includeTime(){let{template:e,field:t}=this;return this.dataType===`date`?t.type===`time-only`?!0:t.type===`date-only`?!1:e.input?.type!==`datetime-picker`||e.input.includeTime:!1}get includeTimeOffset(){if(this.field.type!==`timestamp-offset`)return!1;let{input:e}=this;return!e||e.type===`timestampoffset-picker`&&e.includeTimeOffset}get inputType(){return this.input?.type}get maxLength(){return I({dataType:this.dataType,field:this.field,input:this.input})}get minLength(){return L({dataType:this.dataType,field:this.field,input:this.input})}get multipleChoiceOtherChoiceCheckboxState(){return H(this.inputController)?.otherChoiceCheckboxState??{checked:!1,indeterminate:!1}}get placeholder(){return this.template.hint}get range(){if(this.dataType===`date`)return this._dateRange;let{domain:e,field:t}=this;if(e){let n=u(t,e);return{max:n?.max,min:n?.min}}let n=this._allDomains.toArray().every(e=>!e)?m(t):null;return{max:n?.max===Number.MAX_VALUE?null:n?.max??null,min:n?.min===-Number.MAX_VALUE?null:n?.min??null}}get required(){if(!this.editable)return!1;if(!this.field.nullable||this.isSubtypeField)return!0;let e=this.visible&&this.group?.visible!==!1,t=this._evaluatedRequiredExpression;return e&&t!=null?t:!1}get status(){let{validationMessage:e}=this;return e?O(e)?`idle`:`invalid`:this.valid?`valid`:`idle`}get timeResolution(){let e=this.input;if(!(!e||e.type!==`timestampoffset-picker`&&e.type!==`time-picker`))return e.timeResolution??`minutes`}get timeStep(){return this.timeResolution==null?void 0:P.get(this.timeResolution)}get userInvalid(){return this.errors.some(({error:e})=>k(e))?!0:!this.valid&&this.touched}get valid(){return this.errors.length===0||!this.editable}get validationMessage(){return this.valueIsOutOfDomain&&this.touched?A.OUT_OF_SUBTYPE_DOMAIN:this.userInvalid?this.compositeError??void 0:void 0}get value(){return this.featuresHaveSameValue?this.features.at(0)?.getAttribute(this.fieldName)??null:j}get valueIsOutOfDomain(){let{domain:e,value:t,field:n}=this;return!e||t==null?!1:d(n,t,e)!==null}get visibilityCode(){return this.field.visible?this._fieldShouldHaveDomain&&this.domain==null?`hidden:no-domain-in-common`:this._baseVisibilityCode:`hidden:field-definition`}get codedValueDomainOptions(){return this.domain?.type===`coded-value`?this.domain.codedValues.map(({name:e,code:t})=>({name:e,value:t})):[]}getExplicitMultipleChoiceOtherChoiceCheckedState(){return H(this.inputController)?.getExplicitOtherChoiceCheckedState()}getMultipleChoiceOtherChoiceRenderState(e){let t=H(this.inputController)?.otherChoiceRenderState;return t?{...t,label:t.label??e}:{fieldName:void 0,hint:``,label:e,shouldShow:!1,checkboxState:{checked:!1,indeterminate:!1},value:null,normalizedValue:null,maxLength:void 0,status:`idle`}}hasExplicitMultipleChoiceOtherChoiceCheckedState(){return H(this.inputController)?.hasExplicitOtherChoiceCheckedState()??!1}initializeExplicitMultipleChoiceOtherChoiceCheckedState(){H(this.inputController)?.initializeExplicitOtherChoiceCheckedState()}setExplicitMultipleChoiceOtherChoiceCheckedState(e){H(this.inputController)?.setExplicitOtherChoiceCheckedState(e)}get codedValueOptions(){let{getFieldValueOptionsForFeature:e}=this;if(this.features.length===1&&e){let t=this.features.at(0);return e({domain:this.domain??void 0,feature:t,fieldName:this.fieldName,layer:t.layer})}let t=this.codedValueDomainOptions,{value:n}=this;return{recommended:t,other:[],unsupported:n!=null&&n!==j&&!t.some(e=>e.value===n)?[{name:`${n}`,value:n}]:[],containsEmptyOption:!1}}get _evaluatedRequiredExpression(){let e=!1,t=!0,n=this.template;for(let r of this.features){if(n.getExpressionExecutorsForLayer(r.layer)?.requiredExpression==null)continue;t=!1;let i=this._lookupEvaluatedExpression(r,`requiredExpression`);i?.status===`success`?e||=i.result===!0:e=!0}return t?null:e}get _allDomains(){let e=this.template.domain;return this.features.map(t=>{let n=t.layer.getFieldDomain(this.fieldName,{feature:t.plainGraphic});return n?.type===`range`||e?.type===`range`?n??this.template.domain:n})}get _fieldShouldHaveDomain(){return this._hasIntersectionWithElementFieldDomain?!0:this._allDomains.some(t)}get _dateFormRange(){if(this.dataType!==`date`)return{};let{input:e}=this;if(!e)return{};let{type:t}=e,n={};if((t===`date-picker`||t===`time-picker`||t===`timestampoffset-picker`)&&(n=f(this.field,e.max,e.min)),t===`datetime-picker`){let{max:t,min:r}=e;n={max:t!=null&&R(t)?t.getTime():null,min:r!=null&&R(r)?r.getTime():null}}return{min:n.min,max:n.max,rawMax:n?.rawMax??null,rawMin:n?.rawMin??null}}get _dateRange(){let{_dateFormRange:e,template:t,field:n,domain:r}=this;if(this.dataType!==`date`)return{};if(!r)return this._fieldShouldHaveDomain?{}:e;let i=u(n,r);if(!i)return e;let{max:a,min:o,rawMax:s,rawMin:c}=e,{type:l}=t.field;if(l===`date`){let{max:e,min:t}=i;return{max:b(a)&&(e===null||e!=null&&a<=e)?a:e??null,min:b(o)&&(t===null||t!=null&&o>=t)?o:t??null}}if(l===`date-only`||l===`time-only`||l===`timestamp-offset`){let{max:e,min:t,rawMax:n,rawMin:r}=i,l=b(a)&&s&&(e==null||a<e),u=b(o)&&c&&(t==null||o>t);return{max:l?a:e,min:u?o:t,rawMax:l?s:n,rawMin:u?c:r}}return{}}touch(){this.touched=!0}_validate(){let{dataType:e,fieldName:t,maxLength:n,minLength:r,range:i}=this,a=[],o=S(this.inputController)?this.inputController:void 0,s=o?.input;for(let c of this.features){let{layer:l}=c,u=l.getField(t)??this.field,d=l.getFieldDomain(t,{feature:c.plainGraphic}),f=this.calculateDomain([d]),p=!f||f.type===`coded-value`?null:f,m=this._requiredForFeature(c),h=c.getAttribute(t),g=z(h,{dataType:e,domain:p,field:u,maxLength:n,minLength:r,multipleChoice:s,range:i,required:m})??this.getExternalErrorForFeature?.(c,t);if(!g&&s&&o){let{otherChoice:e}=s,t=o.otherChoiceFieldName,n=o.shouldShowOtherChoice,r=o.otherChoiceEffectiveCheckboxState;if(n&&e&&t&&r.checked){let e=l.getField(t),n=c.getAttribute(t),r=n===N?null:n;if(e){let t=T(e);g=z(r,{dataType:t,domain:e.domain,field:e,maxLength:I({dataType:t,field:e,input:null}),minLength:L({dataType:t,field:e,input:null}),multipleChoice:null,range:{max:void 0,min:void 0},required:!0})}}}g&&a.push({error:g,feature:c.source})}return a}_editableForFeature(e){if(!this.field.editable)return!1;if(this.template.getExpressionExecutorsForLayer(e.layer)?.editableExpression==null)return!0;let t=this._lookupEvaluatedExpression(e,`editableExpression`);return t?.status===`success`&&t.result===!0}_effectiveVisibleFeature(e){if(this.group&&!this.group.visibleForFeature(e))return!1;if(this.template.getExpressionExecutorsForLayer(e.layer)?.visibilityExpression==null)return!0;let t=this._lookupEvaluatedExpression(e,`visibilityExpression`);return t?.status===`success`&&t.result===!0}_requiredForFeature(e){if(!this._editableForFeature(e))return!1;if(!this.field.nullable||this.isSubtypeField)return!0;let t=this._effectiveVisibleFeature(e);if(this.template.getExpressionExecutorsForLayer(e.layer)?.requiredExpression==null)return!1;let n=this._lookupEvaluatedExpression(e,`requiredExpression`);return n?.status===`success`?t&&n.result===!0:t}calculateDomain(e){let t=e.find(e=>e!=null),n=this.template.domain;if(!t)return n&&p(this.field,n)?n:null;switch(t.type){case`coded-value`:if(e.some(e=>!e)){if(!n)return null;e=e.filter(e=>e!==null)}break;case`range`:e=e.filter(e=>e!==null)}if(!e.every(e=>e?.type===t?.type))return null;let r=null;switch(t?.type){case`range`:r=this._intersectRangeDomains(e);break;case`coded-value`:r=this._intersectCodedValueDomains(e)}return r}_intersectCodedValueDomains(e){if(!e.length)return null;let t=new Map(e[0].codedValues.map(({code:e,name:t})=>[e,t])),n=this.template.domain?new Map(this.template.domain.codedValues.map(({code:e,name:t})=>[e,t])):null;for(let n of e)for(let[e,r]of t)n.codedValues.some(t=>t.code===e&&t.name===r)||t.delete(e);let r=t;if(n){r=new Map;for(let[e,i]of n)t.has(e)&&r.set(e,i)}let i=Array.from(r.entries()).map(([e,t])=>new c({code:e,name:t}));return i.length?new l({codedValues:i}):null}_intersectRangeDomains(e){if(!e.length)return null;let t=e[0];for(let n=1;n<e.length;n++){if(!t)return null;t=this._findMinMaxValuesBetweenTwoDomains(t,e[n])}if(t&&!p(this.field,t))return null;let{domain:n}=this.template;if(t&&n&&n instanceof y){let e=this._findMinMaxValuesBetweenTwoDomains(t,n);return this._hasIntersectionWithElementFieldDomain=!!e,e}return t}_getMinMaxFromRangeDomain(e){let t=e.minValue,n=e.maxValue,{field:r}=this;return h(r)||g(r)||_(r)?f(r,n,t):{min:t!=null&&typeof t==`number`?t:null,max:n!=null&&typeof n==`number`?n:null}}_findMinMaxValuesBetweenTwoDomains(e,t){let n=new y,r=this._getMinMaxFromRangeDomain(e),i=this._getMinMaxFromRangeDomain(t),{field:a}=this,o=this._getValidRangeValue(r.min,-1/0),s=this._getValidRangeValue(r.max,1/0),c=this._getValidRangeValue(i.min,-1/0),l=this._getValidRangeValue(i.max,1/0);return n.minValue=Math.max(o,c),n.maxValue=Math.min(s,l),n.minValue===-1/0||n.maxValue===1/0||n.minValue>n.maxValue?null:((h(a)||g(a)||_(a))&&(n.minValue=Number(r.min)>Number(i.min)?r.rawMin:i.rawMin,n.maxValue=Number(r.max)<Number(i.max)?r.rawMax:i.rawMax),n.name=`intersection`,n)}_getValidRangeValue(e,t){return b(e)?e:t}};e([i()],B.prototype,`dataType`,null),e([i()],B.prototype,`domain`,null),e([i()],B.prototype,`distinctValues`,null),e([i()],B.prototype,`editable`,null),e([i()],B.prototype,`label`,null),e([i()],B.prototype,`effectiveVisible`,null),e([i()],B.prototype,`effectiveVisibilityCode`,null),e([i()],B.prototype,`errors`,null),e([i()],B.prototype,`featuresHaveSameValue`,null),e([i()],B.prototype,`field`,null),e([i()],B.prototype,`fieldName`,null),e([i()],B.prototype,`getExternalErrorForFeature`,void 0),e([i()],B.prototype,`getFieldValueOptionsForFeature`,void 0),e([i()],B.prototype,`group`,void 0),e([i()],B.prototype,`input`,null),e([i()],B.prototype,`inputController`,void 0),e([i()],B.prototype,`invalidFeatures`,null),e([i()],B.prototype,`isSubtypeField`,null),e([i()],B.prototype,`showNoValueOptionEnabled`,null),e([i()],B.prototype,`showNoValueLabel`,null),e([i()],B.prototype,`includeTime`,null),e([i()],B.prototype,`includeTimeOffset`,null),e([i({readOnly:!0})],B.prototype,`inputType`,null),e([i()],B.prototype,`maxLength`,null),e([i()],B.prototype,`minLength`,null),e([i()],B.prototype,`multipleChoiceOtherChoiceCheckboxState`,null),e([i()],B.prototype,`placeholder`,null),e([i()],B.prototype,`range`,null),e([i()],B.prototype,`requestDeferredExpressionEvaluation`,void 0),e([i()],B.prototype,`required`,null),e([i()],B.prototype,`status`,null),e([i()],B.prototype,`timeResolution`,null),e([i()],B.prototype,`timeStep`,null),e([i()],B.prototype,`touched`,void 0),e([i({readOnly:!0})],B.prototype,`type`,void 0),e([i()],B.prototype,`userHasChangedValue`,void 0),e([i()],B.prototype,`userInvalid`,null),e([i()],B.prototype,`valid`,null),e([i()],B.prototype,`validationMessage`,null),e([i()],B.prototype,`value`,null),e([i()],B.prototype,`valueIsOutOfDomain`,null),e([i()],B.prototype,`visibilityCode`,null),e([i()],B.prototype,`codedValueDomainOptions`,null),e([i()],B.prototype,`codedValueOptions`,null),e([i()],B.prototype,`_evaluatedRequiredExpression`,null),e([i()],B.prototype,`_hasIntersectionWithElementFieldDomain`,void 0),e([i()],B.prototype,`_allDomains`,null),e([i()],B.prototype,`_fieldShouldHaveDomain`,null),e([i()],B.prototype,`_dateFormRange`,null),e([i()],B.prototype,`_dateRange`,null),B=e([a(`esri.widgets.BatchAttributeForm.inputs.FieldInput`)],B);const V=B;function H(e){return S(e)?e:null}export{V as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as n}from"../../../../core/asyncUtils.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{abortMaybe as a}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{validateDomainValue as d}from"../../../../layers/support/domainUtils.js";import{makeArcadeContext as f,castArcadeValue as p}from"../../expressions/expressionUtils.js";let m=class extends t{constructor(e){super(e),this.filterValue=``,this._choices=[],this._evaluated=!1,this._choicesByCode=new Map,this._expressionTask=null,this._interactionActive=!1,this._updatingHandles=new u}destroy(){a(this._expressionTask),this._updatingHandles.destroy()}get arcadeContextInfo(){return this.fieldInput.expressionsManager.arcadeContext}get choices(){return this._choices}get evaluating(){return this._updatingHandles.updating}get evaluated(){return this._evaluated}get inputValue(){if(this._interactionActive)return this.filterValue;let e=this.fieldInput.value;return e==null?``:this.getLabel(e)}get features(){return this.fieldInput.features}get filteredChoices(){let e=this.choices,t=this.filterValue.trim().toLocaleLowerCase();return t?e.filter((e,n)=>this._normalizedChoiceNames[n].includes(t)):e}get input(){return this.fieldInput.input}get _normalizedChoiceNames(){return this._choices.map(({code:e,name:t})=>`${t}\n${this.getLabel(e)}`.toLocaleLowerCase())}beginInteraction(){this._interactionActive||(this._interactionActive=!0,this.filterValue=``,this.evaluateChoiceExpression())}getChoice(e){return this._choicesByCode.get(e)}getLabel(e){let t=this.fieldInput.domain;return t?.type===`coded-value`?t.getName(e)??this.getChoice(e)?.name??String(e):this.getChoice(e)?.name??String(e)}endInteraction(){this._interactionActive=!1,this.filterValue=``}async evaluateChoiceExpression(){this._expressionTask=a(this._expressionTask);let e=n(e=>this._evaluateChoiceExpression(e));this._expressionTask=e;try{return await o(this._updatingHandles.addPromise(e.promise))??this.choices}finally{this._expressionTask===e&&(this._expressionTask=null)}}async _evaluateChoiceExpression(e){let t=await import(`../../../../arcade/languageUtils.js`);s(e);let n=this.arcadeContextInfo,r=this.fieldInput.field,a=Array(this.features.length),o=new Map,c;this.features.forEach((t,r)=>{let s=this.fieldInput.template.getExpressionExecutorsForLayer(t.layer)?.choiceExpression;if(!s){a[r]=[];return}let l=f(n,t,e);c||=l.executeContext,i(o,s,()=>[]).push({index:r,variables:l.variables})});for(let[i,l]of o){let o=await i.executeAsyncBatch(l,({variables:e})=>e,c);s(e);for(let e=0;e<o.length;e++){let i=o[e];i.status===`rejected`?a[l[e].index]=[]:a[l[e].index]=this._parseChoices(i.value,n,r,t)}}let l=this.fieldInput.domain,u=_(g(a)).filter(({code:e})=>d(r,e,l)===null);return this._choicesByCode=new Map(u.map(e=>[e.code,e])),this._choices=u,this._evaluated=!0,u}_parseChoices(e,t,n,r){if(!v(e,r))return b(this),[];let i=y(e,`choices`),a=r.isImmutableArray(i)?i.toArray():Array.isArray(i)?i:[],o=[];for(let e of a){if(!v(e,r)){b(this);continue}let i=y(e,`name`),a=y(e,`code`);if(typeof i!=`string`||a===void 0||r.isVoid(a)||r.isFunctionParameter(a)){b(this);continue}let s=p(a,n,t.timeZone,r);s!=null&&o.push({name:i,code:s})}return o}};e([c()],m.prototype,`arcadeContextInfo`,null),e([c()],m.prototype,`choices`,null),e([c()],m.prototype,`evaluating`,null),e([c()],m.prototype,`evaluated`,null),e([c()],m.prototype,`inputValue`,null),e([c()],m.prototype,`features`,null),e([c({constructOnly:!0})],m.prototype,`fieldInput`,void 0),e([c()],m.prototype,`filteredChoices`,null),e([c()],m.prototype,`filterValue`,void 0),e([c()],m.prototype,`input`,null),e([c()],m.prototype,`_choices`,void 0),e([c()],m.prototype,`_evaluated`,void 0),e([c()],m.prototype,`_interactionActive`,void 0),e([c()],m.prototype,`_normalizedChoiceNames`,null),m=e([l(`esri.widgets.BatchAttributeForm.inputs.support.DynamicChoiceController`)],m);const h=m;function g(e){let[t,...n]=e;if(!t)return[];let r=t;for(let e of n.sort((e,t)=>e.length-t.length)){if(!e.length)return[];let t=new Map;for(let{code:n,name:r}of e)i(t,n,()=>new Set).add(r);if(r=r.filter(({code:e,name:n})=>t.get(e)?.has(n)),!r.length)break}return r}function _(e){let t=new Set;return e.filter(({code:e})=>!t.has(e)&&(t.add(e),!0))}function v(e,t){return t.isDictionary(e)&&typeof e.field==`function`&&typeof e.keys==`function`}function y(e,t){let n=e.keys().find(e=>e.toLowerCase()===t);return n==null?void 0:e.field(n)}function b(e){r.getLogger(e).error(`Value returned by choice expression does not conform to specification.`)}export{h as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as n}from"../../../../core/asyncUtils.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{abortMaybe as a}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{validateDomainValue as d}from"../../../../layers/support/domainUtils.js";import{castArcadeValue as f}from"../../expressions/expressionUtils.js";import{makeUseId as p}from"./inputUtils.js";import{isEmptyValue as m}from"../../../support/forms/formUtils.js";let h=class extends t{constructor(e){super(e),this.initialEvaluationInProgress=!1,this.filterValue=``,this._choices=[],this._evaluated=!1,this._choicesByCode=new Map,this._expressionTask=null,this._interactionActive=!1,this._updatingHandles=new u}initialize(){!this._codedValueDomain&&!m(this.fieldInput.value)&&(this.initialEvaluationInProgress=!0,this.evaluateChoiceExpression().finally(()=>{this.initialEvaluationInProgress=!1}))}destroy(){a(this._expressionTask),this._updatingHandles.destroy()}get arcadeContextInfo(){return this.fieldInput.expressionsManager.arcadeContext}get choices(){return this._choices}get evaluating(){return this._updatingHandles.updating}get evaluated(){return this._evaluated}get inputValue(){if(this._interactionActive)return this.filterValue;let e=this.fieldInput.value;return e==null?``:this.getLabel(e)}get features(){return this.fieldInput.features}get filteredChoices(){let e=this.choices,t=this.filterValue.trim().toLocaleLowerCase();return t?e.filter((e,n)=>this._normalizedChoiceNames[n].includes(t)):e}get input(){return this.fieldInput.input}get _codedValueDomain(){let e=this.fieldInput.domain;return e?.type===`coded-value`?e:null}get _normalizedChoiceNames(){return this._choices.map(({code:e,name:t})=>`${t}\n${this.getLabel(e)}`.toLocaleLowerCase())}beginInteraction(){this._interactionActive||(this._interactionActive=!0,this.filterValue=``,this.evaluateChoiceExpression())}getChoice(e){return this._choicesByCode.get(e)}getLabel(e){let t=this._codedValueDomain;return t?t.getName(e)??this.getChoice(e)?.name??String(e):this.getChoice(e)?.name??String(e)}endInteraction(){this._interactionActive=!1,this.filterValue=``}async evaluateChoiceExpression(){this._expressionTask=a(this._expressionTask);let e=n(e=>this._evaluateChoiceExpression(e));this._expressionTask=e;try{return await o(this._updatingHandles.addPromise(e.promise))??this.choices}finally{this._expressionTask===e&&(this._expressionTask=null)}}async _evaluateChoiceExpression(e){let t=await import(`../../../../arcade/languageUtils.js`);s(e);let n=this.arcadeContextInfo,r=this.fieldInput.field,i=this.fieldInput.template;await this.requestDeferredExpressionEvaluation({features:this.features.toArray(),getExecutor:e=>i.getExpressionExecutorsForLayer(e)?.choiceExpression}),this._evaluated=!0;let a=[];for(let e of this.features){let i=this._lookupExpressionOutcome(e),o=i?.result?this._parseChoices(i.result,n,r,t):[];if(o.length===0)return[];a.push(o)}let o=this.fieldInput.domain,c=v(_(a)).filter(({code:e})=>d(r,e,o)===null);return this._choicesByCode=new Map(c.map(e=>[e.code,e])),this._choices=c,c}_lookupExpressionOutcome(e){return this.fieldInput.expressionsManager.outcomes.get(e)?.get(p({elementId:this.fieldInput.template.elementId,executorPurpose:`choiceExpression`}))}_parseChoices(e,t,n,r){if(!y(e,r))return x(this),[];let i=b(e,`choices`),a=r.isImmutableArray(i)?i.toArray():Array.isArray(i)?i:[],o=[];for(let e of a){if(!y(e,r)){x(this);continue}let i=b(e,`name`),a=b(e,`code`);if(typeof i!=`string`||a===void 0||r.isVoid(a)||r.isFunctionParameter(a)){x(this);continue}let s=f(a,n,t.timeZone,r);s!=null&&o.push({name:i,code:s})}return o}};e([c()],h.prototype,`arcadeContextInfo`,null),e([c()],h.prototype,`choices`,null),e([c()],h.prototype,`evaluating`,null),e([c()],h.prototype,`evaluated`,null),e([c()],h.prototype,`initialEvaluationInProgress`,void 0),e([c()],h.prototype,`inputValue`,null),e([c()],h.prototype,`features`,null),e([c({constructOnly:!0})],h.prototype,`fieldInput`,void 0),e([c()],h.prototype,`filteredChoices`,null),e([c()],h.prototype,`filterValue`,void 0),e([c()],h.prototype,`input`,null),e([c()],h.prototype,`requestDeferredExpressionEvaluation`,void 0),e([c()],h.prototype,`_choices`,void 0),e([c()],h.prototype,`_codedValueDomain`,null),e([c()],h.prototype,`_evaluated`,void 0),e([c()],h.prototype,`_choicesByCode`,void 0),e([c()],h.prototype,`_interactionActive`,void 0),e([c()],h.prototype,`_normalizedChoiceNames`,null),h=e([l(`esri.widgets.BatchAttributeForm.inputs.support.DynamicChoiceController`)],h);const g=h;function _(e){let[t,...n]=e;if(!t||t.length===0)return[];let r=t;for(let e of n.sort((e,t)=>e.length-t.length)){if(!e.length)return[];let t=new Map;for(let{code:n,name:r}of e)i(t,n,()=>new Set).add(r);if(r=r.filter(({code:e,name:n})=>t.get(e)?.has(n)),!r.length)break}return r}function v(e){let t=new Set;return e.filter(({code:e})=>!t.has(e)&&(t.add(e),!0))}function y(e,t){return t.isDictionary(e)&&typeof e.field==`function`&&typeof e.keys==`function`}function b(e,t){let n=e.keys().find(e=>e.toLowerCase()===t);return n==null?void 0:e.field(n)}function x(e){r.getLogger(e).error(`Value returned by choice expression does not conform to specification.`)}export{g as default};