@arcgis/core 5.0.0-next.43 → 5.0.0-next.44

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 (305) hide show
  1. package/applications/Components/imageryUtils.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{f97a7cb367634353177d.js → 001a7a4cf6fe74432ed6.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{324d66962aeec17d3e28.js → 1e0e7cef7ef947894bbe.js} +1 -1
  5. package/assets/esri/core/workers/chunks/20ad34f9d45c64392022.js +1 -0
  6. package/assets/esri/core/workers/chunks/23396a6318edf9264c1f.js +1 -0
  7. package/assets/esri/core/workers/chunks/{ad891ac388fa6c1c9b94.js → 2b34a010f76e5f289868.js} +1 -1
  8. package/assets/esri/core/workers/chunks/2ef4c0092c59a98a5532.js +1 -0
  9. package/assets/esri/core/workers/chunks/35272810c2ed04eb403d.js +1 -0
  10. package/assets/esri/core/workers/chunks/{d1f4152b2b8d47cbf586.js → 72fbee59d5d909615408.js} +1 -1
  11. package/assets/esri/core/workers/chunks/75c66e38bdc1c786c599.js +1 -0
  12. package/assets/esri/core/workers/chunks/7d3c2a063598bdd015e2.js +1 -0
  13. package/assets/esri/core/workers/chunks/897ce6fc9cefb1e14a64.js +1 -0
  14. package/assets/esri/core/workers/chunks/992e9bbdf9d3787ddb0e.js +1 -0
  15. package/assets/esri/core/workers/chunks/a2442549c5daf3653eb4.js +1 -0
  16. package/assets/esri/core/workers/chunks/a7cd795042ebb8585906.js +1 -0
  17. package/assets/esri/core/workers/chunks/{385cfd3087f00dbd1146.js → ca1c65eb7f5900c60170.js} +1 -1
  18. package/assets/esri/core/workers/chunks/cddce67919e13e2f365e.js +1 -0
  19. package/assets/esri/core/workers/chunks/e6784251bbb8b71ead93.js +1 -0
  20. package/assets/esri/core/workers/chunks/{96f798ee286b59396131.js → ea3cba01c60d9bc72719.js} +1 -1
  21. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  22. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  23. package/config.js +1 -1
  24. package/interfaces.d.ts +78 -2
  25. package/kernel.js +1 -1
  26. package/layers/ImageryTileLayer.js +1 -1
  27. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  28. package/layers/WCSLayer.js +1 -1
  29. package/layers/mixins/ArcGISImageService.js +1 -1
  30. package/layers/mixins/ImageryTileMixin.js +1 -1
  31. package/layers/mixins/RasterJobHandlerMixin.js +1 -1
  32. package/layers/ogc/wcsUtils.js +1 -1
  33. package/layers/raster/datasets/BaseRaster.js +5 -0
  34. package/layers/raster/datasets/CovJSONRaster.js +5 -0
  35. package/layers/raster/datasets/FunctionRaster.js +5 -0
  36. package/layers/raster/datasets/ImageAuxRaster.js +5 -0
  37. package/layers/raster/datasets/ImageServerRaster.js +5 -0
  38. package/layers/raster/datasets/InMemoryRaster.js +5 -0
  39. package/layers/raster/datasets/MRFRaster.js +5 -0
  40. package/layers/raster/datasets/RawBlockCache.js +5 -0
  41. package/layers/raster/datasets/TIFFRaster.js +5 -0
  42. package/layers/raster/datasets/WCSRaster.js +5 -0
  43. package/layers/raster/datasets/covJSONParser.js +5 -0
  44. package/layers/raster/datasets/multidimensionalUtils.js +5 -0
  45. package/layers/raster/datasets/pamParser.js +5 -0
  46. package/layers/raster/datasets/pixelReader.js +5 -0
  47. package/layers/raster/datasets/wcsCoverageParser.js +5 -0
  48. package/layers/raster/formats/Lerc.js +5 -0
  49. package/layers/raster/formats/Qb3.js +5 -0
  50. package/layers/raster/formats/RasterCodec.js +5 -0
  51. package/layers/raster/formats/TiffDecoder.js +5 -0
  52. package/layers/raster/functions/ArithmeticFunction.js +5 -0
  53. package/layers/{support/rasterFunctions → raster/functions}/ArithmeticFunctionArguments.js +1 -1
  54. package/layers/{support/rasterFunctions → raster/functions}/AspectFunction.js +1 -1
  55. package/layers/{support/rasterFunctions → raster/functions}/AspectFunctionArguments.js +1 -1
  56. package/layers/raster/functions/BandArithmeticFunction.js +5 -0
  57. package/layers/{support/rasterFunctions → raster/functions}/BandArithmeticFunctionArguments.js +1 -1
  58. package/layers/{support/rasterFunctions → raster/functions}/BaseFunctionArguments.js +1 -1
  59. package/layers/raster/functions/BaseRasterFunction.js +5 -0
  60. package/layers/{support/rasterFunctions → raster/functions}/ClipFunction.js +1 -1
  61. package/layers/{support/rasterFunctions → raster/functions}/ClipFunctionArguments.js +1 -1
  62. package/layers/raster/functions/ColormapFunction.js +5 -0
  63. package/layers/{support/rasterFunctions → raster/functions}/ColormapFunctionArguments.js +1 -1
  64. package/layers/raster/functions/ColormapToRGBFunction.js +5 -0
  65. package/layers/{support/rasterFunctions → raster/functions}/ColormapToRGBFunctionArguments.js +1 -1
  66. package/layers/raster/functions/CompositeBandFunction.js +5 -0
  67. package/layers/raster/functions/CompositeBandFunctionArguments.js +5 -0
  68. package/layers/raster/functions/ComputeChangeFunction.js +5 -0
  69. package/layers/{support/rasterFunctions → raster/functions}/ComputeChangeFunctionArguments.js +1 -1
  70. package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunction.js +1 -1
  71. package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunctionArguments.js +1 -1
  72. package/layers/raster/functions/ConvolutionFunction.js +5 -0
  73. package/layers/raster/functions/ConvolutionFunctionArguments.js +5 -0
  74. package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunction.js +1 -1
  75. package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunctionArguments.js +1 -1
  76. package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunction.js +1 -1
  77. package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunctionArguments.js +1 -1
  78. package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunction.js +1 -1
  79. package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunctionArguments.js +1 -1
  80. package/layers/raster/functions/HillshadeFunction.js +5 -0
  81. package/layers/{support/rasterFunctions → raster/functions}/HillshadeFunctionArguments.js +1 -1
  82. package/layers/raster/functions/LocalFunction.js +5 -0
  83. package/layers/{support/rasterFunctions → raster/functions}/LocalFunctionArguments.js +1 -1
  84. package/layers/{support/rasterFunctions → raster/functions}/MaskFunction.js +1 -1
  85. package/layers/{support/rasterFunctions → raster/functions}/MaskFunctionArguments.js +1 -1
  86. package/layers/{support/rasterFunctions → raster/functions}/NDVIFunction.js +1 -1
  87. package/layers/{support/rasterFunctions → raster/functions}/NDVIFunctionArguments.js +1 -1
  88. package/layers/raster/functions/RemapFunction.js +5 -0
  89. package/layers/{support/rasterFunctions → raster/functions}/RemapFunctionArguments.js +1 -1
  90. package/layers/raster/functions/ShadedReliefFunction.js +5 -0
  91. package/layers/{support/rasterFunctions → raster/functions}/ShadedReliefFunctionArguments.js +1 -1
  92. package/layers/raster/functions/SlopeFunction.js +5 -0
  93. package/layers/{support/rasterFunctions → raster/functions}/SlopeFunctionArguments.js +1 -1
  94. package/layers/raster/functions/StatisticsFunction.js +5 -0
  95. package/layers/{support/rasterFunctions → raster/functions}/StatisticsFunctionArguments.js +1 -1
  96. package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunction.js +1 -1
  97. package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunctionArguments.js +1 -1
  98. package/layers/raster/functions/StretchFunction.js +5 -0
  99. package/layers/{support/rasterFunctions → raster/functions}/StretchFunctionArguments.js +1 -1
  100. package/layers/{support/rasterFunctions → raster/functions}/TableFunction.js +1 -1
  101. package/layers/{support/rasterFunctions → raster/functions}/TableFunctionArguments.js +1 -1
  102. package/layers/raster/functions/bandIndexUtils.js +5 -0
  103. package/layers/raster/functions/changeDetectionUtils.js +5 -0
  104. package/layers/raster/functions/clipUtils.js +5 -0
  105. package/layers/raster/functions/conversionUtils.js +5 -0
  106. package/layers/raster/functions/convolutionUtils.js +5 -0
  107. package/layers/raster/functions/creators/createDataManagementFunctions.js +5 -0
  108. package/layers/raster/functions/creators/utils.js +5 -0
  109. package/layers/raster/functions/focalStatUtils.js +5 -0
  110. package/layers/raster/functions/localUtils.js +5 -0
  111. package/layers/raster/functions/pixelTransformUtils.js +5 -0
  112. package/layers/raster/functions/pixelUtils.js +5 -0
  113. package/layers/raster/functions/stretchUtils.js +5 -0
  114. package/layers/raster/functions/surfaceUtils.js +5 -0
  115. package/layers/raster/functions/vectorFieldUtils.js +5 -0
  116. package/layers/raster/transforms/BaseRasterTransform.js +5 -0
  117. package/layers/{support/rasterTransforms → raster/transforms}/GCSShiftTransform.js +1 -1
  118. package/layers/{support/rasterTransforms → raster/transforms}/IdentityTransform.js +1 -1
  119. package/layers/{support/rasterTransforms → raster/transforms}/PolynomialTransform.js +1 -1
  120. package/layers/save/imageryUtils.js +1 -1
  121. package/layers/support/PixelBlock.js +1 -1
  122. package/layers/support/RasterWorker.js +1 -1
  123. package/layers/support/imageryRendererUtils.js +1 -1
  124. package/layers/support/rasterFunctionUtils.js +1 -1
  125. package/package.json +1 -1
  126. package/renderers/VectorFieldRenderer.js +1 -1
  127. package/renderers/support/RasterSymbolizer.js +1 -1
  128. package/renderers/support/rasterRendererHelper.js +1 -1
  129. package/rest/locator/addressToLocations.js +1 -1
  130. package/rest/locator/addressesToLocations.js +1 -1
  131. package/rest/locator/suggestLocations.js +1 -1
  132. package/rest/networks/support/Association.js +1 -1
  133. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  134. package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
  135. package/support/revision.js +1 -1
  136. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  137. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterRangeHighlightShader.js +1 -1
  138. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MaskShader.js +1 -1
  139. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/RemapShader.js +1 -1
  140. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
  141. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  142. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  143. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  144. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  145. package/views/2d/layers/imagery/ImageryView2D.js +1 -1
  146. package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
  147. package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
  148. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  149. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  150. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  151. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  152. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  153. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
  154. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
  155. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  156. package/views/3d/webgl-engine/materials/DrawParameters.js +1 -1
  157. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  158. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  159. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  160. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  161. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  163. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  164. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  165. package/views/3d/webgl-engine/materials/renderers/Instance.js +1 -1
  166. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
  167. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  168. package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
  169. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  170. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  171. package/views/DOMContainer.js +1 -1
  172. package/views/GroundView.js +1 -1
  173. package/views/layers/ImageryLayerViewMixin.js +1 -1
  174. package/views/layers/ImageryTileLayerViewMixin.js +1 -1
  175. package/views/support/imageReprojection.js +1 -1
  176. package/widgets/BatchAttributeForm.js +1 -1
  177. package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
  178. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  179. package/widgets/CoordinateConversion.js +1 -1
  180. package/widgets/DirectLineMeasurement3D.js +1 -1
  181. package/widgets/DistanceMeasurement2D.js +1 -1
  182. package/widgets/Editor/EditorViewModel.js +1 -1
  183. package/widgets/Editor.js +1 -1
  184. package/widgets/ElevationProfile.js +1 -1
  185. package/widgets/Feature.js +1 -1
  186. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  187. package/widgets/FeatureForm.js +1 -1
  188. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  189. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  190. package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
  191. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  192. package/widgets/FeatureTable.js +1 -1
  193. package/widgets/FeatureTemplates.js +1 -1
  194. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  195. package/widgets/Legend.js +1 -1
  196. package/widgets/LineOfSight.js +1 -1
  197. package/widgets/Locate.js +1 -1
  198. package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
  199. package/widgets/OrientedImageryViewer/services/DepthImageService.js +1 -1
  200. package/widgets/PanoramicViewer/support/importUtils.js +1 -1
  201. package/widgets/Print.js +1 -1
  202. package/widgets/ScaleBar.js +1 -1
  203. package/widgets/ScaleRangeSlider.js +1 -1
  204. package/widgets/Search/SearchResultRenderer.js +1 -1
  205. package/widgets/Search/SearchViewModel.js +1 -1
  206. package/widgets/Search/types.js +1 -1
  207. package/widgets/Search.js +1 -1
  208. package/widgets/ShadowCast.js +1 -1
  209. package/widgets/Sketch/SketchViewModel.js +1 -1
  210. package/widgets/Sketch.js +1 -1
  211. package/assets/esri/core/workers/chunks/1f6ead46b723630db897.js +0 -1
  212. package/assets/esri/core/workers/chunks/3a16347e17312556e02c.js +0 -1
  213. package/assets/esri/core/workers/chunks/478def691ae6763686f3.js +0 -1
  214. package/assets/esri/core/workers/chunks/4c4a55be41ba105c091c.js +0 -1
  215. package/assets/esri/core/workers/chunks/4cbf5a97b2b3c6553f6f.js +0 -1
  216. package/assets/esri/core/workers/chunks/646f58b69d2354f1ef27.js +0 -1
  217. package/assets/esri/core/workers/chunks/93d11075f65a5b6625ea.js +0 -1
  218. package/assets/esri/core/workers/chunks/9f2a8445a5848502c7e7.js +0 -1
  219. package/assets/esri/core/workers/chunks/a1b08aab73747f4e7e25.js +0 -1
  220. package/assets/esri/core/workers/chunks/ba59568e748f0ba53b78.js +0 -1
  221. package/assets/esri/core/workers/chunks/f21cb5b34d4d1e3af1a9.js +0 -1
  222. package/assets/esri/core/workers/chunks/f93f0586ce10cb5d98b3.js +0 -1
  223. package/layers/support/rasterDatasets/BaseRaster.js +0 -5
  224. package/layers/support/rasterDatasets/CovJSONRaster.js +0 -5
  225. package/layers/support/rasterDatasets/FunctionRaster.js +0 -5
  226. package/layers/support/rasterDatasets/ImageAuxRaster.js +0 -5
  227. package/layers/support/rasterDatasets/ImageServerRaster.js +0 -5
  228. package/layers/support/rasterDatasets/InMemoryRaster.js +0 -5
  229. package/layers/support/rasterDatasets/MRFRaster.js +0 -5
  230. package/layers/support/rasterDatasets/RawBlockCache.js +0 -5
  231. package/layers/support/rasterDatasets/TIFFRaster.js +0 -5
  232. package/layers/support/rasterDatasets/WCSRaster.js +0 -5
  233. package/layers/support/rasterDatasets/covJSONParser.js +0 -5
  234. package/layers/support/rasterDatasets/multidimensionalUtils.js +0 -5
  235. package/layers/support/rasterDatasets/pamParser.js +0 -5
  236. package/layers/support/rasterDatasets/pixelReader.js +0 -5
  237. package/layers/support/rasterDatasets/wcsCoverageParser.js +0 -5
  238. package/layers/support/rasterFormats/Lerc.js +0 -5
  239. package/layers/support/rasterFormats/Qb3.js +0 -5
  240. package/layers/support/rasterFormats/RasterCodec.js +0 -5
  241. package/layers/support/rasterFormats/TiffDecoder.js +0 -5
  242. package/layers/support/rasterFunctions/ArithmeticFunction.js +0 -5
  243. package/layers/support/rasterFunctions/BandArithmeticFunction.js +0 -5
  244. package/layers/support/rasterFunctions/BaseRasterFunction.js +0 -5
  245. package/layers/support/rasterFunctions/ColormapFunction.js +0 -5
  246. package/layers/support/rasterFunctions/ColormapToRGBFunction.js +0 -5
  247. package/layers/support/rasterFunctions/CompositeBandFunction.js +0 -5
  248. package/layers/support/rasterFunctions/CompositeBandFunctionArguments.js +0 -5
  249. package/layers/support/rasterFunctions/ComputeChangeFunction.js +0 -5
  250. package/layers/support/rasterFunctions/ConvolutionFunction.js +0 -5
  251. package/layers/support/rasterFunctions/ConvolutionFunctionArguments.js +0 -5
  252. package/layers/support/rasterFunctions/HillshadeFunction.js +0 -5
  253. package/layers/support/rasterFunctions/LocalFunction.js +0 -5
  254. package/layers/support/rasterFunctions/RemapFunction.js +0 -5
  255. package/layers/support/rasterFunctions/ShadedReliefFunction.js +0 -5
  256. package/layers/support/rasterFunctions/SlopeFunction.js +0 -5
  257. package/layers/support/rasterFunctions/StatisticsFunction.js +0 -5
  258. package/layers/support/rasterFunctions/StretchFunction.js +0 -5
  259. package/layers/support/rasterFunctions/bandIndexUtils.js +0 -5
  260. package/layers/support/rasterFunctions/changeDetectionUtils.js +0 -5
  261. package/layers/support/rasterFunctions/clipUtils.js +0 -5
  262. package/layers/support/rasterFunctions/conversionUtils.js +0 -5
  263. package/layers/support/rasterFunctions/convolutionUtils.js +0 -5
  264. package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +0 -5
  265. package/layers/support/rasterFunctions/creators/utils.js +0 -5
  266. package/layers/support/rasterFunctions/focalStatUtils.js +0 -5
  267. package/layers/support/rasterFunctions/localUtils.js +0 -5
  268. package/layers/support/rasterFunctions/pixelTransformUtils.js +0 -5
  269. package/layers/support/rasterFunctions/pixelUtils.js +0 -5
  270. package/layers/support/rasterFunctions/stretchUtils.js +0 -5
  271. package/layers/support/rasterFunctions/surfaceUtils.js +0 -5
  272. package/layers/support/rasterFunctions/vectorFieldUtils.js +0 -5
  273. package/layers/support/rasterTransforms/BaseRasterTransform.js +0 -5
  274. /package/assets/esri/layers/{support/rasterFormats → raster/formats}/lerc-wasm.wasm +0 -0
  275. /package/assets/esri/layers/{support/rasterFormats → raster/formats}/qb3-wasm.wasm +0 -0
  276. /package/layers/{support/rasterDatasets → raster/datasets}/DBFParser.js +0 -0
  277. /package/layers/{support/rasterDatasets → raster/datasets}/EphemeralBlockCache.js +0 -0
  278. /package/layers/{support/rasterDatasets → raster/datasets}/RasterFactory.js +0 -0
  279. /package/layers/{support/rasterDatasets → raster/datasets}/byteStreamUtils.js +0 -0
  280. /package/layers/{support/rasterDatasets → raster/datasets}/datasetUtils.js +0 -0
  281. /package/layers/{support/rasterDatasets → raster/datasets}/multipartParser.js +0 -0
  282. /package/layers/{support/rasterDatasets → raster/datasets}/wcsCapabilitiesParser.js +0 -0
  283. /package/layers/{support/rasterDatasets → raster/datasets}/xmlUtilities.js +0 -0
  284. /package/layers/{support/rasterFormats → raster/formats}/ImageCanvasDecoder.js +0 -0
  285. /package/layers/{support/rasterFormats → raster/formats}/JpgPlus.js +0 -0
  286. /package/layers/{support/rasterFormats → raster/formats}/Lzw.js +0 -0
  287. /package/layers/{support/rasterFormats → raster/formats}/Raw.js +0 -0
  288. /package/layers/{support/rasterFormats → raster/formats}/pixelRangeUtils.js +0 -0
  289. /package/layers/{support/rasterFormats → raster/formats}/tiffTag.js +0 -0
  290. /package/layers/{support/rasterFormats → raster/formats}/utils.js +0 -0
  291. /package/layers/{support/rasterFunctions → raster/functions}/colormaps.js +0 -0
  292. /package/layers/{support/rasterFunctions → raster/functions}/creators/createAppearenceFunctions.js +0 -0
  293. /package/layers/{support/rasterFunctions → raster/functions}/creators/createBandIndexFunctions.js +0 -0
  294. /package/layers/{support/rasterFunctions → raster/functions}/creators/createChangeFunctions.js +0 -0
  295. /package/layers/{support/rasterFunctions → raster/functions}/creators/createConversionFunctions.js +0 -0
  296. /package/layers/{support/rasterFunctions → raster/functions}/creators/createLocalFunctions.js +0 -0
  297. /package/layers/{support/rasterFunctions → raster/functions}/creators/createMultiRasterAnalysisFunctions.js +0 -0
  298. /package/layers/{support/rasterFunctions → raster/functions}/creators/createStatisticsFunctions.js +0 -0
  299. /package/layers/{support/rasterFunctions → raster/functions}/creators/createSurfaceFunctions.js +0 -0
  300. /package/layers/{support/rasterFunctions → raster/functions}/customBandIndexUtils.js +0 -0
  301. /package/layers/{support/rasterFunctions → raster/functions}/mirror.js +0 -0
  302. /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionHelper.js +0 -0
  303. /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionSchema.js +0 -0
  304. /package/layers/{support/rasterFunctions → raster/functions}/rasterProjectionHelper.js +0 -0
  305. /package/layers/{support/rasterTransforms → raster/transforms}/utils.js +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{watch as i,initial as s}from"../core/reactiveUtils.js";import{property as n,cast as o,subclass as r}from"../core/accessorSupport/decorators.js";import l from"./Widget.js";import d from"./Feature/FeatureAttachments.js";import a from"./Feature/FeatureContent.js";import c from"./Feature/FeatureExpression.js";import u from"./Feature/FeatureFields.js";import p from"./Feature/FeatureMedia.js";import m from"./Feature/FeatureRelationship.js";import h from"./Feature/FeatureUtilityNetworkAssociations.js";import y from"./Feature/FeatureViewModel.js";import{css as v}from"./Feature/resources.js";import{FeatureContentMixin as w}from"./Feature/support/FeatureContentMixin.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{globalCss as f}from"./support/globalCss.js";import{Heading as _}from"./support/Heading.js";import{tsx as M,messageBundle as E}from"./support/widget.js";const b={title:!0,content:!0,lastEditedInfo:!0};let F=class extends(w(l)){constructor(e,t){super(e,t),this._contentWidgets=[],this.flowType="feature",this.flowItems=null,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.visibleElements={...b},this.viewModel=new y}initialize(){this.addHandles(i(()=>this.viewModel?.contentViewModels,()=>this._setupContentWidgets(),s))}loadDependencies(){return g({notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}destroy(){this._destroyContentWidgets()}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(e){this.viewModel.defaultPopupTemplateEnabled=e}get isTable(){return this.viewModel.isFeatureFromTable}get icon(){return"polygon"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get title(){return this.viewModel.title}castVisibleElements(e){return{...b,...e}}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}setActiveMedia(e,t){return this.viewModel.setActiveMedia(e,t)}nextMedia(e){return this.viewModel.nextMedia(e)}previousMedia(e){return this.viewModel.previousMedia(e)}render(){const{state:e}=this.viewModel,t=M("div",{class:v.container,key:"container"},this._renderTitle(),"error"===e?this._renderError():"loading"===e?this._renderLoading():this._renderContentContainer());return M("div",{class:this.classes(v.base,f.widget)},t)}_renderError(){const{messagesCommon:e,messages:t,visibleElements:i}=this;return M("calcite-notice",{icon:"exclamation-mark-circle",kind:"danger",open:!0,scale:"s"},i.title?M("div",{key:"error-title",slot:"title"},e.errorMessage):null,M("div",{key:"error-message",slot:"message"},t.loadingError))}_renderLoading(){return M("div",{class:v.loadingSpinnerContainer,key:"loading-container"},M("calcite-loader",{inline:!0,label:""}))}_renderContentContainer(){const{visibleElements:e}=this;return e.content?M("div",{class:v.main},[this._renderContent(),this._renderLastEditInfo()]):null}_renderTitle(){const{visibleElements:e,title:t}=this;return e.title?M(_,{class:v.title,innerHTML:t,level:this.headingLevel}):null}_renderContent(){const e=this.viewModel.content,t="content";if(!e)return null;if(Array.isArray(e))return e.length?M("div",{class:v.contentNode,key:`${t}-content-elements`},e.map(this._renderContentElement,this)):null;if("string"==typeof e){const e=this._contentWidgets[0];return!e||e.destroyed?null:M("div",{class:this.classes(v.contentNode,v.contentNodeText),key:`${t}-content`},e.render())}return this.renderNodeContent(e)}_renderContentElement(e,t){const{visibleElements:i}=this;if("boolean"!=typeof i.content&&!i.content?.[e.type])return null;switch(e.type){case"attachments":return this._renderAttachments(t);case"custom":return this._renderCustom(e,t);case"fields":return this._renderFields(t);case"media":return this._renderMedia(t);case"text":return this._renderText(e,t);case"expression":return this._renderExpression(t);case"relationship":return this._renderRelationship(t);case"utility-network-associations":return this._renderAssociation(t);default:return null}}_renderAttachments(e){const t=this._contentWidgets[e];if(!t||t.destroyed)return null;const{state:i,attachmentInfos:s}=t.viewModel;return"loading"===i||s.length>0?M("div",{class:this.classes(v.contentElement),key:this._buildKey("attachments-element",e)},t.render()):null}_renderRelationship(e){const t=this._contentWidgets[e];return t&&!t.destroyed&&this.flowItems?M("div",{class:v.contentElement,key:this._buildKey("relationship-element",e)},t.render()):null}_renderAssociation(e){const t=this._contentWidgets[e];return t&&!t.destroyed&&this.flowItems?M("div",{class:v.contentElement,key:this._buildKey("utility-network-association-element",e)},t.render()):null}_renderExpression(e){const t=this._contentWidgets[e];return t&&!t.destroyed&&t.viewModel.contentElement?M("div",{class:v.contentElement,key:this._buildKey("expression-element",e)},t.render()):null}_renderCustom(e,t){const{creator:i}=e,s=this._contentWidgets[t];return!s||s.destroyed?null:i?M("div",{class:v.contentElement,key:this._buildKey("custom-element",t)},s.render()):null}_renderFields(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:M("div",{class:v.contentElement,key:this._buildKey("fields-element",e)},t.render())}_renderMedia(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:M("div",{class:v.contentElement,key:this._buildKey("media-element",e)},t.render())}_renderLastEditInfo(){const{visibleElements:e,messages:i}=this,{lastEditInfo:s}=this.viewModel;if(!s||!e.lastEditedInfo)return null;const{date:n,user:o}=s,r="edit"===s.type?o?i.lastEditedByUser:i.lastEdited:o?i.lastCreatedByUser:i.lastCreated,l=t(r,{date:n,user:o});return M("div",{class:this.classes(v.lastEditedInfo,v.contentElement),key:"edit-info-element"},l)}_renderText(e,t){const i=e.text,s=this._contentWidgets[t];return!s||s.destroyed?null:i?M("div",{class:this.classes(v.contentElement,v.text),key:this._buildKey("text-element",t)},s.render()):null}_buildKey(e,...t){return`${e}__${this.viewModel?.graphic?.uid||"0"}-${t.join("-")}`}_destroyContentWidget(e){e&&(e.viewModel=null,!e.destroyed&&e.destroy())}_destroyContentWidgets(){this._contentWidgets.forEach(e=>this._destroyContentWidget(e)),this._contentWidgets=[]}_setupContentWidgets(){this._destroyContentWidgets();const{headingLevel:e,visibleElements:t,flowItems:i,viewModel:s}=this,n=s?.content,{contentViewModels:o}=s;if(Array.isArray(n))n.forEach((n,r)=>{if("attachments"===n.type&&(this._contentWidgets[r]=new d({displayType:n.displayType,headingLevel:t.title&&e<6?e+1:e,viewModel:o[r]})),"fields"===n.type&&(this._contentWidgets[r]=new u({viewModel:o[r]})),"media"===n.type&&(this._contentWidgets[r]=new p({viewModel:o[r]})),"text"===n.type&&(this._contentWidgets[r]=new a({viewModel:o[r]})),"custom"===n.type&&(this._contentWidgets[r]=new a({viewModel:o[r]})),"expression"===n.type&&(this._contentWidgets[r]=new c({viewModel:o[r]})),"relationship"===n.type){const e=new m({flowItems:i,featureVisibleElements:t,viewModel:o[r]});this._contentWidgets[r]=e}if("utility-network-associations"===n.type){const e=async e=>{const{viewModel:n,listType:o,title:r}=e;if(!i)return;n.activeAssociationType=o;const{default:l}=await import("./Feature/FeatureUtilityNetworkAssociationList.js"),d=new l({viewModel:n,parentFeatureViewModel:s,listType:o,title:r,featureVisibleElements:t,description:s.title,flowItems:i});i.push(d)},n=new h({flowItems:i,onSelectAssociationType:e,parentFeatureViewModel:s,featureVisibleElements:t,viewModel:o[r]});this._contentWidgets[r]=n}},this);else{const e=o[0];e&&!e.destroyed&&(this._contentWidgets[0]=new a({viewModel:e}))}this.scheduleRender()}};e([n()],F.prototype,"flowType",void 0),e([n()],F.prototype,"graphic",null),e([n()],F.prototype,"defaultPopupTemplateEnabled",null),e([n()],F.prototype,"flowItems",void 0),e([n()],F.prototype,"headingLevel",void 0),e([n({readOnly:!0})],F.prototype,"isTable",null),e([n()],F.prototype,"icon",null),e([n()],F.prototype,"label",null),e([n()],F.prototype,"location",null),e([n(),E("esri/widgets/Feature/t9n/Feature")],F.prototype,"messages",void 0),e([n(),E("esri/t9n/common")],F.prototype,"messagesCommon",void 0),e([n()],F.prototype,"spatialReference",null),e([n()],F.prototype,"timeZone",null),e([n({readOnly:!0})],F.prototype,"title",null),e([n()],F.prototype,"visibleElements",void 0),e([o("visibleElements")],F.prototype,"castVisibleElements",null),e([n()],F.prototype,"map",null),e([n()],F.prototype,"view",null),e([n({type:y})],F.prototype,"viewModel",void 0),F=e([r("esri.widgets.Feature")],F);export{F as default};
5
+ import{__decorate as e}from"tslib";import t from"../Graphic.js";import{substitute as i}from"../intl.js";import{watch as s,initial as n}from"../core/reactiveUtils.js";import{property as o,cast as r,subclass as l}from"../core/accessorSupport/decorators.js";import d from"../geometry/Point.js";import a from"./Widget.js";import c from"./Feature/FeatureAttachments.js";import p from"./Feature/FeatureContent.js";import u from"./Feature/FeatureExpression.js";import m from"./Feature/FeatureFields.js";import h from"./Feature/FeatureMedia.js";import y from"./Feature/FeatureRelationship.js";import v from"./Feature/FeatureUtilityNetworkAssociations.js";import w from"./Feature/FeatureViewModel.js";import{css as g}from"./Feature/resources.js";import{FeatureContentMixin as f}from"./Feature/support/FeatureContentMixin.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{globalCss as M}from"./support/globalCss.js";import{Heading as E}from"./support/Heading.js";import{tsx as b,messageBundle as F}from"./support/widget.js";const W={title:!0,content:!0,lastEditedInfo:!0};let C=class extends(f(a)){constructor(e,t){super(e,t),this._contentWidgets=[],this.flowType="feature",this.flowItems=null,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.visibleElements={...W},this.viewModel=new w}initialize(){this.addHandles(s(()=>this.viewModel?.contentViewModels,()=>this._setupContentWidgets(),n))}loadDependencies(){return _({notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}destroy(){this._destroyContentWidgets()}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(e){this.viewModel.defaultPopupTemplateEnabled=e}get isTable(){return this.viewModel.isFeatureFromTable}get icon(){return"polygon"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get title(){return this.viewModel.title}castVisibleElements(e){return{...W,...e}}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}setActiveMedia(e,t){return this.viewModel.setActiveMedia(e,t)}nextMedia(e){return this.viewModel.nextMedia(e)}previousMedia(e){return this.viewModel.previousMedia(e)}render(){const{state:e}=this.viewModel,t=b("div",{class:g.container,key:"container"},this._renderTitle(),"error"===e?this._renderError():"loading"===e?this._renderLoading():this._renderContentContainer());return b("div",{class:this.classes(g.base,M.widget)},t)}_renderError(){const{messagesCommon:e,messages:t,visibleElements:i}=this;return b("calcite-notice",{icon:"exclamation-mark-circle",kind:"danger",open:!0,scale:"s"},i.title?b("div",{key:"error-title",slot:"title"},e.errorMessage):null,b("div",{key:"error-message",slot:"message"},t.loadingError))}_renderLoading(){return b("div",{class:g.loadingSpinnerContainer,key:"loading-container"},b("calcite-loader",{inline:!0,label:""}))}_renderContentContainer(){const{visibleElements:e}=this;return e.content?b("div",{class:g.main},[this._renderContent(),this._renderLastEditInfo()]):null}_renderTitle(){const{visibleElements:e,title:t}=this;return e.title?b(E,{class:g.title,innerHTML:t,level:this.headingLevel}):null}_renderContent(){const e=this.viewModel.content,t="content";if(!e)return null;if(Array.isArray(e))return e.length?b("div",{class:g.contentNode,key:`${t}-content-elements`},e.map(this._renderContentElement,this)):null;if("string"==typeof e){const e=this._contentWidgets[0];return!e||e.destroyed?null:b("div",{class:this.classes(g.contentNode,g.contentNodeText),key:`${t}-content`},e.render())}return this.renderNodeContent(e)}_renderContentElement(e,t){const{visibleElements:i}=this;if("boolean"!=typeof i.content&&!i.content?.[e.type])return null;switch(e.type){case"attachments":return this._renderAttachments(t);case"custom":return this._renderCustom(e,t);case"fields":return this._renderFields(t);case"media":return this._renderMedia(t);case"text":return this._renderText(e,t);case"expression":return this._renderExpression(t);case"relationship":return this._renderRelationship(t);case"utility-network-associations":return this._renderAssociation(t);default:return null}}_renderAttachments(e){const t=this._contentWidgets[e];if(!t||t.destroyed)return null;const{state:i,attachmentInfos:s}=t.viewModel;return"loading"===i||s.length>0?b("div",{class:this.classes(g.contentElement),key:this._buildKey("attachments-element",e)},t.render()):null}_renderRelationship(e){const t=this._contentWidgets[e];return t&&!t.destroyed&&this.flowItems?b("div",{class:g.contentElement,key:this._buildKey("relationship-element",e)},t.render()):null}_renderAssociation(e){const t=this._contentWidgets[e];return t&&!t.destroyed&&this.flowItems?b("div",{class:g.contentElement,key:this._buildKey("utility-network-association-element",e)},t.render()):null}_renderExpression(e){const t=this._contentWidgets[e];return t&&!t.destroyed&&t.viewModel.contentElement?b("div",{class:g.contentElement,key:this._buildKey("expression-element",e)},t.render()):null}_renderCustom(e,t){const{creator:i}=e,s=this._contentWidgets[t];return!s||s.destroyed?null:i?b("div",{class:g.contentElement,key:this._buildKey("custom-element",t)},s.render()):null}_renderFields(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:b("div",{class:g.contentElement,key:this._buildKey("fields-element",e)},t.render())}_renderMedia(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:b("div",{class:g.contentElement,key:this._buildKey("media-element",e)},t.render())}_renderLastEditInfo(){const{visibleElements:e,messages:t}=this,{lastEditInfo:s}=this.viewModel;if(!s||!e.lastEditedInfo)return null;const{date:n,user:o}=s,r="edit"===s.type?o?t.lastEditedByUser:t.lastEdited:o?t.lastCreatedByUser:t.lastCreated,l=i(r,{date:n,user:o});return b("div",{class:this.classes(g.lastEditedInfo,g.contentElement),key:"edit-info-element"},l)}_renderText(e,t){const i=e.text,s=this._contentWidgets[t];return!s||s.destroyed?null:i?b("div",{class:this.classes(g.contentElement,g.text),key:this._buildKey("text-element",t)},s.render()):null}_buildKey(e,...t){return`${e}__${this.viewModel?.graphic?.uid||"0"}-${t.join("-")}`}_destroyContentWidget(e){e&&(e.viewModel=null,!e.destroyed&&e.destroy())}_destroyContentWidgets(){this._contentWidgets.forEach(e=>this._destroyContentWidget(e)),this._contentWidgets=[]}_setupContentWidgets(){this._destroyContentWidgets();const{headingLevel:e,visibleElements:t,flowItems:i,viewModel:s}=this,n=s?.content,{contentViewModels:o}=s;if(Array.isArray(n))n.forEach((n,r)=>{if("attachments"===n.type&&(this._contentWidgets[r]=new c({displayType:n.displayType,headingLevel:t.title&&e<6?e+1:e,viewModel:o[r]})),"fields"===n.type&&(this._contentWidgets[r]=new m({viewModel:o[r]})),"media"===n.type&&(this._contentWidgets[r]=new h({viewModel:o[r]})),"text"===n.type&&(this._contentWidgets[r]=new p({viewModel:o[r]})),"custom"===n.type&&(this._contentWidgets[r]=new p({viewModel:o[r]})),"expression"===n.type&&(this._contentWidgets[r]=new u({viewModel:o[r]})),"relationship"===n.type){const e=new y({flowItems:i,featureVisibleElements:t,viewModel:o[r]});this._contentWidgets[r]=e}if("utility-network-associations"===n.type){const e=async e=>{const{viewModel:n,listType:o,title:r}=e;if(!i)return;n.activeAssociationType=o;const{default:l}=await import("./Feature/FeatureUtilityNetworkAssociationList.js"),d=new l({viewModel:n,parentFeatureViewModel:s,listType:o,title:r,featureVisibleElements:t,description:s.title,flowItems:i});i.push(d)},n=new v({flowItems:i,onSelectAssociationType:e,parentFeatureViewModel:s,featureVisibleElements:t,viewModel:o[r]});this._contentWidgets[r]=n}},this);else{const e=o[0];e&&!e.destroyed&&(this._contentWidgets[0]=new p({viewModel:e}))}this.scheduleRender()}};e([o()],C.prototype,"flowType",void 0),e([o({type:t})],C.prototype,"graphic",null),e([o()],C.prototype,"defaultPopupTemplateEnabled",null),e([o()],C.prototype,"flowItems",void 0),e([o()],C.prototype,"headingLevel",void 0),e([o({readOnly:!0})],C.prototype,"isTable",null),e([o()],C.prototype,"icon",null),e([o()],C.prototype,"label",null),e([o({type:d})],C.prototype,"location",null),e([o(),F("esri/widgets/Feature/t9n/Feature")],C.prototype,"messages",void 0),e([o(),F("esri/t9n/common")],C.prototype,"messagesCommon",void 0),e([o()],C.prototype,"spatialReference",null),e([o()],C.prototype,"timeZone",null),e([o({readOnly:!0})],C.prototype,"title",null),e([o()],C.prototype,"visibleElements",void 0),e([r("visibleElements")],C.prototype,"castVisibleElements",null),e([o()],C.prototype,"map",null),e([o()],C.prototype,"view",null),e([o({type:w})],C.prototype,"viewModel",void 0),C=e([l("esri.widgets.Feature")],C);export{C as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{neverReached as n}from"../../core/compilerUtils.js";import{EventedAccessor as s}from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import{EsriPromiseMixin as r}from"../../core/Promise.js";import{debounce as a}from"../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,whenOnce as p,on as c}from"../../core/reactiveUtils.js";import{templateHasKey as h}from"../../core/string.js";import{property as d,subclass as f}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import y from"../../form/FormTemplate.js";import{isUtilityNetworkAssociationsElement as g,isGroupElement as _,isFieldElement as v,isRelationshipElement as I,isTextElement as x}from"../../form/support/formUtils.js";import E from"../../layers/support/ContingentValue.js";import{isEditableLayer as C}from"../../layers/support/editableLayers.js";import F from"../../layers/support/LayerContingentValuesCache.js";import{utc as b,unknown as V,system as w}from"../../time/constants.js";import{flattenAssociationInputs as A,flattenFieldInputs as j,isGroupInput as T,flattenRelationshipInputs as M,parseFormTemplateString as N,isRelationshipInput as k,isFieldInput as L,isTextElementInput as S,getNormalizedFeatureTypeInfo as R,valueIsValidContingentValue as U}from"./featureFormUtils.js";import Z from"./FieldInput.js";import{FormExpressionsManager as H}from"./FormExpressionsManager.js";import O from"./GroupInput.js";import P from"./RelationshipInput.js";import W from"./TextElementInput.js";import{createFormExpressionArcadeExecutor as G}from"../support/forms/expressions/FormExpressionArcadeExecutor.js";const $=new t({attributes:{}}),D={field:["editableExpression","requiredExpression","valueExpression","visibilityExpression"],group:["visibilityExpression"],relationship:["editableExpression","visibilityExpression"],text:["visibilityExpression"],utilityNetworkAssociations:["editableExpression","visibilityExpression"]},z="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",J="#JSAPI_CONTINGENT_VALUE_ANY_HASH",B="#JSAPI_CONTINGENT_VALUE_NULL_HASH";let K=class extends(r(s)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=$.clone(),this._initialFeature=$.clone(),this._timeZone=null,this._updatingHandles=new m,this.activeAssociation=null,this.editType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.highlightHelper=null,this.inputs=[],this.map=null,this.callbacks=null,this.strict=!1,this.pendingSubtypeChoice=null,this._updateInputs=a(async()=>{this._stopExpressions();const{_featureClone:e,_initialFeature:t,editType:n,formTemplate:s,inputs:i,layer:o,timeZone:r}=this;if(!o)return;const a={editType:n,feature:e,initialFeature:t,layer:o,timeZone:r},l=i.slice(),u=s?.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(l,s.elements,a):this._updateInputsUsingLayerFields(l,o?.fields,a);this.inputs=u,this._startExpressions()})}initialize(){const e=l(()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this._initialFeature,this.timeZone,this.editType],([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch(()=>{}))},u),t=l(()=>this._arcadeContextInfo,e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e,this._evaluateExpressions(e=>e.evaluateAll()))}),n=l(()=>this.layer,e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(F.createLoadedLayerContingentValuesCache(t).then(e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")}))},{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this.highlightHelper?.removeAll(),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map(e=>[e.name,e]))}get activeAssociationInput(){return this.allAssociationInputs.find(e=>e.uid===this.associationId)}get activeRelationshipInput(){return this.allRelationshipInputs.find(e=>e.relationshipId===this.relationshipId||e.activeCategory||e.showAllEnabled)}get _arcadeContextInfo(){const{_initialFeature:e,editType:t,layer:n,map:s,spatialReference:i,timeZone:o}=this;return{layer:C(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i,timeZone:o}}get associationId(){return this._get("associationId")}set associationId(e){null==e&&this.activeAssociationInput?.viewModel&&(this.activeAssociationInput.associatedLayer=null,this.activeAssociationInput.viewModel.activeAssociationType=null),this._set("associationId",e)}get associatedLayer(){return this.activeAssociationInput?.associatedLayer}set associatedLayer(e){this.activeAssociationInput&&(this.activeAssociationInput.associatedLayer=e)}get allAssociationInputs(){return A(this.inputs)}get allFieldInputs(){return j(this.inputs)}get allGroupInputs(){return this.inputs.filter(T)}get allRelationshipInputs(){return M(this.inputs)}get _layerFieldsByName(){return new Map(this.layer?.fields.map(e=>[e.name,e]))}get feature(){return this._get("feature")}set feature(e){const t=this._get("feature");e!==t&&(this._featureClone=e?.clone()??$.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach(t=>t.feature=e)):(this.inputs.forEach(e=>e.destroy()),this.inputs.length=0),t!==e&&(this.pendingSubtypeChoice=null),this.contingencyConstraintViolations.clear(),this._set("feature",e),this._initialFeature=this._featureClone.clone())}get fieldsWithContingentValues(){if(null==this._contingentValuesCache)return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap(e=>e.fields);return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get formDescription(){const{formTemplate:e,layer:t}=this;return e?.description&&t?N({attributes:this.getValues(),label:e.description,layer:t,timeZone:this.timeZone}):null}get formTitle(){const{formTemplate:e,layer:t}=this;return e?.title&&t?N({attributes:this.getValues(),label:e.title,layer:t,timeZone:this.timeZone}):null}get formHeaderVisible(){const{activeRelationshipInput:e,activeAssociationInput:t,formDescription:n,formTitle:s}=this;return!(e||t||!n&&!s)}get joinedContingentValues(){return this._joinContingentValues()}get layer(){const e=this._initialFeature;return e?.sourceLayer&&"applyEdits"in e.sourceLayer?e.sourceLayer:null}set layer(e){this._override("layer",e)}get relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach(e=>{e.showAllEnabled=!1,e.activeCategory=null}),null!=e){const n=t.find(t=>t.relationshipId===e);n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter(e=>!e.valid).every(({submittable:e})=>e)}get timeZone(){const{layer:e}=this;if(e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone)return b;const t=e&&"preferredTimeZone"in e&&e.preferredTimeZone;return this._timeZone===V?t||b:this._timeZone||w}set timeZone(e){this._timeZone=e}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every(({valid:e})=>e)}findField(e){return this.allFieldInputs.find(t=>t.name===e)}findGroup(e){return this.allGroupInputs.find(t=>t.id===e)}getFieldValueOptionsForField(e,t){const n=this.findField(e);if(!n)return[[],[],[]];const s="coded-value"===n.domain?.type?n.domain.codedValues.map(({name:e,code:t})=>({name:e,value:t})):[],i=null==n.value||s.some(e=>e.value===n.value)?[]:[{name:`${n.value}`,value:n.value}],o=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(o.length>0){const e=new Set(o.map(e=>e.value));return[o,s.filter(t=>!e.has(t.value)),i]}return[s,[],i]}getValue(e){const t=this.layer?.getField(e);if(null!=t)return this._featureClone.getAttribute(t.name)??null}setValue(e,t){const{_featureClone:n,strict:s}=this,i=this.findField(e);t=""===t?null:t,i&&n.getAttribute(e)!==t&&(i.value=t,s&&!i.valid||(this._afterValueChange(i),this._evaluateExpressions(t=>t.evaluateInvalidated([e]))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,t=new Set(e.filter(e=>e.valid).map(({name:e})=>e)),n=e.filter(e=>!e.valid).map(({name:e})=>e),s=this.getValues();if(this.validateContingencyConstraints(s,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),n.push(i));this.notifyChange("submittable"),this.notifyChange("valid"),this.emit("submit",{valid:[...t],invalid:n,values:s})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,s=new Map;if(this.contingencyConstraintViolations=s,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{feature:e,_featureClone:t}=this;e&&(t.geometry=e.geometry,this._evaluateExpressions(e=>e.evaluateInvalidatedByGeometry()))}applySubtypeDefaults(e){const{defaultValues:t}=e,{allFieldInputs:n}=this;for(const{name:s}of n){const e=t[s];null!=e&&this.setValue(s,e)}}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}_evaluateExpressions(e){const t=this._expressionsManager;null!=t&&this._updatingHandles.addPromise(e(t).finally(()=>this._afterExpressionsEvaluated()))}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(T(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(e=>this._isSupportedElement(e)),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}async _updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):g(a)?await this._makeUtilityNetworkAssociationInputFromElement(a,s,i):this._makeInputFromElement(a,s,i);if(n){if(r.push(n),await p(()=>!n.updating),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),T(n)){const{feature:e,timeZone:t}=s;n.set({feature:e,timeZone:t})}else if(k(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else g(n)?(n.set(s),n.set({map:this.map})):n.set(s);if(_(a)){const e=a.elements.filter(e=>this._isSupportedElement(e));n.inputs=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return i.getLogger(this).warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const i of e)if(T(i)){for(const e of i.inputs)e.destroy();i.inputs.length=0,i.destroy()}else k(i)?i.destroy():L(i)&&(null!==i.element?i.destroy():s.set(i.field,i));const o=[];for(const i of t){const e=n.feature?.getAttribute(i.name)??null,t=s.get(i)??new Z({field:i,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});o.push(t.set({...n,value:e})),s.delete(i)}for(const[i,r]of s.entries())s.delete(i),r.destroy();return o}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)??null}_makeInputFromElement(e,t,s){return _(e)?Y(e,t):v(e)?this._makeFieldInputFromElement(e,t,s):I(e)?this._makeRelationshipInputFromElement(e,t,s):g(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):x(e)?q(e,t):g(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):n()}_makeFieldInputFromElement(e,t,n){const{editType:s,feature:i,initialFeature:o,layer:r,timeZone:a}=t,{fieldName:l}=e,u=l&&this._layerFieldsByName.get(l);return u?new Z({editType:s,element:e,field:u,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden,timeZone:a}):null}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t,a=new P({element:e,feature:i,group:n,layer:o,map:s,timeZone:r});return a.addHandles(c(()=>a.relatedLayer,"edits",()=>this._evaluateExpressions(e=>e.evaluateAsyncExpressions()))),a}async _makeUtilityNetworkAssociationInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t;return new(0,(await import("./UtilityNetworkAssociationInput.js")).default)({element:e,feature:i,group:n,layer:o,map:s,timeZone:r})}_assignExpressionExecutors(e,t,n){const s=D[t.type],i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const r=t[o];if(null!=r&&""!==r){const t=this._expressionInfosLookup.get(r)?.expression??r;i.push(this._getOrCreateExecutorForExpression(t,n).then(t=>{e[s]=this._useExecutor(t)}))}}return S(e)&&i.push(...this._assignTextElementExpressionExecutors(e,n)),i}_assignTextElementExpressionExecutors(e,t){const{_expressionInfosLookup:n}=this,s=[];for(const o of e.expressionsUsed){const r=n.get(o);null!=r?s.push(this._getOrCreateExecutorForExpression(r.expression,t).then(t=>e.setExpressionExecutor(o,this._useExecutor(t)))):i.getLogger(this).error("feature-form:expression-not-found",`Could not find expressionInfo object with name '${o}'`)}for(const i of e.fieldsUsed){const n=`return $feature['${i}'];`;s.push(this._getOrCreateExecutorForExpression(n,t).then(t=>e.setFieldExecutor(i,this._useExecutor(t))))}return s}async _getOrCreateExecutorForExpression(e,t){const{_expressionExecutorLookup:n}=this;if(n.has(e))return n.get(e);if(t.has(e))return t.get(e);const s=G(e,this.layer);t.set(e,s);const i=await s;return n.set(e,i),i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new H({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s,preserveFieldValuesWhenHidden:!0===i?.preserveFieldValuesWhenHidden})}_startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),this._evaluateExpressions(e=>e.evaluateAll())}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:l}=R(o);if((e.isSubtypeField||t===a)&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);e&&(this.feature&&(this.feature.sourceLayer=e),s.sourceLayer=e,this._initialFeature.sourceLayer=e)}const e=new Set;for(const t of l)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}this.notifyChange("joinedContingentValues")}if(null!=i){const{description:e,title:n}=i;n&&h(n,t)&&this.notifyChange("formTitle"),e&&h(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=R(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap(e=>this._joinFieldGroupContingencies(e)),...o.flatMap(e=>e.contingencies)]}_generateJoinPlan(e){const t=new Map,n=[],s=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map(e=>[...e]),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(J)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(J),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(J)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(J),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=e.values[s]&&(n.values[s]=e.values[s]);return n}_joinContingenciesWithRangeDomains(e,t,n){const s=this._joinContingencies(e,t);for(const i of n){const n=e.values[i],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:c,leftIsRange:h,rightIsRange:d}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new E({objectType:"null"});continue}if(r&&d||a&&h)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const f=Math.max(n.minValue,o.minValue),m=Math.min(n.maxValue,o.maxValue);if(f>m)return null;s.values[i]=new E({objectType:"range",minValue:f,maxValue:m})}return s}_findMatchingContingenciesContainingAny(e,t,n){return t.filter(t=>n.every(n=>{const s=t.values[n],i=e.values[n];return"any"===s.objectType||"any"===i.objectType||s.codedValue?.code===i.codedValue?.code}))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=new RegExp(`${t}$`),s=[];for(const[i,o]of e){if(i===J)break;n.test(i)&&s.push(...o)}return s}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,s=Array.isArray(t)?new Set(t):t,i=n.size<s.size?n:s,o=i===n?s:n,{feature:r}=this,a=new Set,l=new Set;for(const u of i)if(o.has(u)){const e=this.layer?.getFieldDomain(u,{feature:r??void 0,excludeImpliedDomains:!0});if(null==e)continue;switch(e.type){case"coded-value":a.add(u);break;case"range":l.add(u)}}return{codedValueFields:[...a],rangeFields:[...l]}}_contingencyIsValid(e,t){const n={};for(const{name:s,value:i}of this.allFieldInputs)this.fieldsWithContingentValues.has(s)&&null!=i&&s!==e&&(n[s]=i);return Object.entries(n).every(([e,n])=>!t.values.hasOwnProperty(e)||U(n,t.values[e]))}_getContingentValueOptionsForField(e,t){const n=this.joinedContingentValues.slice(),s=new Map,i={code:"",name:t??"No value"};for(const o of n){const t=o.values[e];if("code"===t?.objectType||"null"===t?.objectType){const{code:n,name:r}=t.codedValue&&"null"!==t.objectType?t.codedValue:i;!s.has(n)&&this._contingencyIsValid(e,o)&&s.set(n,{name:r,value:n})}}return[...s.values()]}_hashContingency(e,t,n=!1){if(t.length<1)return[z,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[J,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${B}`):s.push(`${o}:${t.codedValue?.code}`)}return[s.sort().join("&"),i]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}_isSupportedElement(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||"text"===e.type||"utilityNetworkAssociations"===e.type||(i.getLogger(this).warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}get test(){return{featureClone:this._featureClone}}};function Y(e,t){const{feature:n,layer:s}=t;return new O({element:e,inputs:[],feature:n,layer:s})}function q(e,t,n=null){const{feature:s,layer:i,timeZone:o}=t;return new W({element:e,feature:s,group:n,layer:i,timeZone:o})}e([d()],K.prototype,"_expressionInfosLookup",null),e([d()],K.prototype,"_featureClone",void 0),e([d()],K.prototype,"_initialFeature",void 0),e([d()],K.prototype,"_timeZone",void 0),e([d()],K.prototype,"activeAssociation",void 0),e([d()],K.prototype,"activeAssociationInput",null),e([d()],K.prototype,"activeRelationshipInput",null),e([d()],K.prototype,"_arcadeContextInfo",null),e([d()],K.prototype,"associationId",null),e([d()],K.prototype,"associatedLayer",null),e([d()],K.prototype,"allAssociationInputs",null),e([d()],K.prototype,"allFieldInputs",null),e([d()],K.prototype,"allGroupInputs",null),e([d()],K.prototype,"allRelationshipInputs",null),e([d()],K.prototype,"_layerFieldsByName",null),e([d()],K.prototype,"editType",void 0),e([d()],K.prototype,"contingencyConstraintViolations",void 0),e([d()],K.prototype,"disabled",void 0),e([d()],K.prototype,"feature",null),e([d()],K.prototype,"fieldsWithContingentValues",null),e([d({type:y})],K.prototype,"formTemplate",null),e([d()],K.prototype,"formDescription",null),e([d()],K.prototype,"formTitle",null),e([d()],K.prototype,"formHeaderVisible",null),e([d()],K.prototype,"highlightHelper",void 0),e([d()],K.prototype,"inputs",void 0),e([d()],K.prototype,"joinedContingentValues",null),e([d()],K.prototype,"layer",null),e([d()],K.prototype,"map",void 0),e([d()],K.prototype,"callbacks",void 0),e([d()],K.prototype,"relationshipId",null),e([d()],K.prototype,"spatialReference",null),e([d()],K.prototype,"state",null),e([d()],K.prototype,"strict",void 0),e([d()],K.prototype,"submittable",null),e([d()],K.prototype,"timeZone",null),e([d()],K.prototype,"updating",null),e([d()],K.prototype,"valid",null),e([d()],K.prototype,"pendingSubtypeChoice",void 0),e([d()],K.prototype,"getValues",null),e([d()],K.prototype,"submit",null),e([d()],K.prototype,"test",null),K=e([f("esri.widgets.FeatureForm.FeatureFormViewModel")],K);const Q=K;export{Q as default};
5
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{neverReached as n}from"../../core/compilerUtils.js";import{EventedAccessor as s}from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import{EsriPromiseMixin as r}from"../../core/Promise.js";import{debounce as a}from"../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,whenOnce as p,on as c}from"../../core/reactiveUtils.js";import{templateHasKey as h}from"../../core/string.js";import{property as d,subclass as f}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import y from"../../form/FormTemplate.js";import{isUtilityNetworkAssociationsElement as g,isGroupElement as _,isFieldElement as v,isRelationshipElement as I,isTextElement as x}from"../../form/support/formUtils.js";import E from"../../layers/support/ContingentValue.js";import{isEditableLayer as C}from"../../layers/support/editableLayers.js";import F from"../../layers/support/LayerContingentValuesCache.js";import b from"../../rest/networks/support/Association.js";import{utc as V,unknown as w,system as A}from"../../time/constants.js";import{flattenAssociationInputs as j,flattenFieldInputs as T,isGroupInput as M,flattenRelationshipInputs as k,parseFormTemplateString as N,isRelationshipInput as S,isFieldInput as L,isTextElementInput as R,getNormalizedFeatureTypeInfo as U,valueIsValidContingentValue as Z}from"./featureFormUtils.js";import H from"./FieldInput.js";import{FormExpressionsManager as P}from"./FormExpressionsManager.js";import O from"./GroupInput.js";import W from"./RelationshipInput.js";import G from"./TextElementInput.js";import{createFormExpressionArcadeExecutor as $}from"../support/forms/expressions/FormExpressionArcadeExecutor.js";const D=new t({attributes:{}}),z={field:["editableExpression","requiredExpression","valueExpression","visibilityExpression"],group:["visibilityExpression"],relationship:["editableExpression","visibilityExpression"],text:["visibilityExpression"],utilityNetworkAssociations:["editableExpression","visibilityExpression"]},J="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",B="#JSAPI_CONTINGENT_VALUE_ANY_HASH",K="#JSAPI_CONTINGENT_VALUE_NULL_HASH";let Y=class extends(r(s)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=D.clone(),this._initialFeature=D.clone(),this._timeZone=null,this._updatingHandles=new m,this.activeAssociation=null,this.editType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.highlightHelper=null,this.inputs=[],this.map=null,this.callbacks=null,this.strict=!1,this.pendingSubtypeChoice=null,this._updateInputs=a(async()=>{this._stopExpressions();const{_featureClone:e,_initialFeature:t,editType:n,formTemplate:s,inputs:i,layer:o,timeZone:r}=this;if(!o)return;const a={editType:n,feature:e,initialFeature:t,layer:o,timeZone:r},l=i.slice(),u=s?.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(l,s.elements,a):this._updateInputsUsingLayerFields(l,o?.fields,a);this.inputs=u,this._startExpressions()})}initialize(){const e=l(()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this._initialFeature,this.timeZone,this.editType],([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch(()=>{}))},u),t=l(()=>this._arcadeContextInfo,e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e,this._evaluateExpressions(e=>e.evaluateAll()))}),n=l(()=>this.layer,e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(F.createLoadedLayerContingentValuesCache(t).then(e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")}))},{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this.highlightHelper?.removeAll(),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map(e=>[e.name,e]))}get activeAssociationInput(){return this.allAssociationInputs.find(e=>e.uid===this.associationId)}get activeRelationshipInput(){return this.allRelationshipInputs.find(e=>e.relationshipId===this.relationshipId||e.activeCategory||e.showAllEnabled)}get _arcadeContextInfo(){const{_initialFeature:e,editType:t,layer:n,map:s,spatialReference:i,timeZone:o}=this;return{layer:C(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i,timeZone:o}}get associationId(){return this._get("associationId")}set associationId(e){null==e&&this.activeAssociationInput?.viewModel&&(this.activeAssociationInput.associatedLayer=null,this.activeAssociationInput.viewModel.activeAssociationType=null),this._set("associationId",e)}get associatedLayer(){return this.activeAssociationInput?.associatedLayer}set associatedLayer(e){this.activeAssociationInput&&(this.activeAssociationInput.associatedLayer=e)}get allAssociationInputs(){return j(this.inputs)}get allFieldInputs(){return T(this.inputs)}get allGroupInputs(){return this.inputs.filter(M)}get allRelationshipInputs(){return k(this.inputs)}get _layerFieldsByName(){return new Map(this.layer?.fields.map(e=>[e.name,e]))}get feature(){return this._get("feature")}set feature(e){const t=this._get("feature");e!==t&&(this._featureClone=e?.clone()??D.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach(t=>t.feature=e)):(this.inputs.forEach(e=>e.destroy()),this.inputs.length=0),t!==e&&(this.pendingSubtypeChoice=null),this.contingencyConstraintViolations.clear(),this._set("feature",e),this._initialFeature=this._featureClone.clone())}get fieldsWithContingentValues(){if(null==this._contingentValuesCache)return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap(e=>e.fields);return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){this._overrideIfSome("formTemplate",e)}get formDescription(){const{formTemplate:e,layer:t}=this;return e?.description&&t?N({attributes:this.getValues(),label:e.description,layer:t,timeZone:this.timeZone}):null}get formTitle(){const{formTemplate:e,layer:t}=this;return e?.title&&t?N({attributes:this.getValues(),label:e.title,layer:t,timeZone:this.timeZone}):null}get formHeaderVisible(){const{activeRelationshipInput:e,activeAssociationInput:t,formDescription:n,formTitle:s}=this;return!(e||t||!n&&!s)}get joinedContingentValues(){return this._joinContingentValues()}get layer(){const e=this._initialFeature;return e?.sourceLayer&&"applyEdits"in e.sourceLayer?e.sourceLayer:null}set layer(e){this._override("layer",e)}get relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach(e=>{e.showAllEnabled=!1,e.activeCategory=null}),null!=e){const n=t.find(t=>t.relationshipId===e);n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter(e=>!e.valid).every(({submittable:e})=>e)}get timeZone(){const{layer:e}=this;if(e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone)return V;const t=e&&"preferredTimeZone"in e&&e.preferredTimeZone;return this._timeZone===w?t||V:this._timeZone||A}set timeZone(e){this._timeZone=e}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every(({valid:e})=>e)}findField(e){return this.allFieldInputs.find(t=>t.name===e)}findGroup(e){return this.allGroupInputs.find(t=>t.id===e)}getFieldValueOptionsForField(e,t){const n=this.findField(e);if(!n)return[[],[],[]];const s="coded-value"===n.domain?.type?n.domain.codedValues.map(({name:e,code:t})=>({name:e,value:t})):[],i=null==n.value||s.some(e=>e.value===n.value)?[]:[{name:`${n.value}`,value:n.value}],o=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(o.length>0){const e=new Set(o.map(e=>e.value));return[o,s.filter(t=>!e.has(t.value)),i]}return[s,[],i]}getValue(e){const t=this.layer?.getField(e);if(null!=t)return this._featureClone.getAttribute(t.name)??null}setValue(e,t){const{_featureClone:n,strict:s}=this,i=this.findField(e);t=""===t?null:t,i&&n.getAttribute(e)!==t&&(i.value=t,s&&!i.valid||(this._afterValueChange(i),this._evaluateExpressions(t=>t.evaluateInvalidated([e]))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,t=new Set(e.filter(e=>e.valid).map(({name:e})=>e)),n=e.filter(e=>!e.valid).map(({name:e})=>e),s=this.getValues();if(this.validateContingencyConstraints(s,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),n.push(i));this.notifyChange("submittable"),this.notifyChange("valid"),this.emit("submit",{valid:[...t],invalid:n,values:s})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,s=new Map;if(this.contingencyConstraintViolations=s,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{feature:e,_featureClone:t}=this;e&&(t.geometry=e.geometry,this._evaluateExpressions(e=>e.evaluateInvalidatedByGeometry()))}applySubtypeDefaults(e){const{defaultValues:t}=e,{allFieldInputs:n}=this;for(const{name:s}of n){const e=t[s];null!=e&&this.setValue(s,e)}}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}_evaluateExpressions(e){const t=this._expressionsManager;null!=t&&this._updatingHandles.addPromise(e(t).finally(()=>this._afterExpressionsEvaluated()))}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(M(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(e=>this._isSupportedElement(e)),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}async _updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):g(a)?await this._makeUtilityNetworkAssociationInputFromElement(a,s,i):this._makeInputFromElement(a,s,i);if(n){if(r.push(n),await p(()=>!n.updating),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),M(n)){const{feature:e,timeZone:t}=s;n.set({feature:e,timeZone:t})}else if(S(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else g(n)?(n.set(s),n.set({map:this.map})):n.set(s);if(_(a)){const e=a.elements.filter(e=>this._isSupportedElement(e));n.inputs=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return i.getLogger(this).warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const i of e)if(M(i)){for(const e of i.inputs)e.destroy();i.inputs.length=0,i.destroy()}else S(i)?i.destroy():L(i)&&(null!==i.element?i.destroy():s.set(i.field,i));const o=[];for(const i of t){const e=n.feature?.getAttribute(i.name)??null,t=s.get(i)??new H({field:i,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});o.push(t.set({...n,value:e})),s.delete(i)}for(const[i,r]of s.entries())s.delete(i),r.destroy();return o}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)??null}_makeInputFromElement(e,t,s){return _(e)?q(e,t):v(e)?this._makeFieldInputFromElement(e,t,s):I(e)?this._makeRelationshipInputFromElement(e,t,s):g(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):x(e)?Q(e,t):g(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):n()}_makeFieldInputFromElement(e,t,n){const{editType:s,feature:i,initialFeature:o,layer:r,timeZone:a}=t,{fieldName:l}=e,u=l&&this._layerFieldsByName.get(l);return u?new H({editType:s,element:e,field:u,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden,timeZone:a}):null}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t,a=new W({element:e,feature:i,group:n,layer:o,map:s,timeZone:r});return a.addHandles(c(()=>a.relatedLayer,"edits",()=>this._evaluateExpressions(e=>e.evaluateAsyncExpressions()))),a}async _makeUtilityNetworkAssociationInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t;return new(0,(await import("./UtilityNetworkAssociationInput.js")).default)({element:e,feature:i,group:n,layer:o,map:s,timeZone:r})}_assignExpressionExecutors(e,t,n){const s=z[t.type],i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const r=t[o];if(null!=r&&""!==r){const t=this._expressionInfosLookup.get(r)?.expression??r;i.push(this._getOrCreateExecutorForExpression(t,n).then(t=>{e[s]=this._useExecutor(t)}))}}return R(e)&&i.push(...this._assignTextElementExpressionExecutors(e,n)),i}_assignTextElementExpressionExecutors(e,t){const{_expressionInfosLookup:n}=this,s=[];for(const o of e.expressionsUsed){const r=n.get(o);null!=r?s.push(this._getOrCreateExecutorForExpression(r.expression,t).then(t=>e.setExpressionExecutor(o,this._useExecutor(t)))):i.getLogger(this).error("feature-form:expression-not-found",`Could not find expressionInfo object with name '${o}'`)}for(const i of e.fieldsUsed){const n=`return $feature['${i}'];`;s.push(this._getOrCreateExecutorForExpression(n,t).then(t=>e.setFieldExecutor(i,this._useExecutor(t))))}return s}async _getOrCreateExecutorForExpression(e,t){const{_expressionExecutorLookup:n}=this;if(n.has(e))return n.get(e);if(t.has(e))return t.get(e);const s=$(e,this.layer);t.set(e,s);const i=await s;return n.set(e,i),i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new P({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s,preserveFieldValuesWhenHidden:!0===i?.preserveFieldValuesWhenHidden})}_startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),this._evaluateExpressions(e=>e.evaluateAll())}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:l}=U(o);if((e.isSubtypeField||t===a)&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);e&&(this.feature&&(this.feature.sourceLayer=e),s.sourceLayer=e,this._initialFeature.sourceLayer=e)}const e=new Set;for(const t of l)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}this.notifyChange("joinedContingentValues")}if(null!=i){const{description:e,title:n}=i;n&&h(n,t)&&this.notifyChange("formTitle"),e&&h(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=U(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap(e=>this._joinFieldGroupContingencies(e)),...o.flatMap(e=>e.contingencies)]}_generateJoinPlan(e){const t=new Map,n=[],s=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map(e=>[...e]),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(B)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(B),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(B)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(B),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=e.values[s]&&(n.values[s]=e.values[s]);return n}_joinContingenciesWithRangeDomains(e,t,n){const s=this._joinContingencies(e,t);for(const i of n){const n=e.values[i],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:c,leftIsRange:h,rightIsRange:d}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new E({objectType:"null"});continue}if(r&&d||a&&h)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const f=Math.max(n.minValue,o.minValue),m=Math.min(n.maxValue,o.maxValue);if(f>m)return null;s.values[i]=new E({objectType:"range",minValue:f,maxValue:m})}return s}_findMatchingContingenciesContainingAny(e,t,n){return t.filter(t=>n.every(n=>{const s=t.values[n],i=e.values[n];return"any"===s.objectType||"any"===i.objectType||s.codedValue?.code===i.codedValue?.code}))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=new RegExp(`${t}$`),s=[];for(const[i,o]of e){if(i===B)break;n.test(i)&&s.push(...o)}return s}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,s=Array.isArray(t)?new Set(t):t,i=n.size<s.size?n:s,o=i===n?s:n,{feature:r}=this,a=new Set,l=new Set;for(const u of i)if(o.has(u)){const e=this.layer?.getFieldDomain(u,{feature:r??void 0,excludeImpliedDomains:!0});if(null==e)continue;switch(e.type){case"coded-value":a.add(u);break;case"range":l.add(u)}}return{codedValueFields:[...a],rangeFields:[...l]}}_contingencyIsValid(e,t){const n={};for(const{name:s,value:i}of this.allFieldInputs)this.fieldsWithContingentValues.has(s)&&null!=i&&s!==e&&(n[s]=i);return Object.entries(n).every(([e,n])=>!t.values.hasOwnProperty(e)||Z(n,t.values[e]))}_getContingentValueOptionsForField(e,t){const n=this.joinedContingentValues.slice(),s=new Map,i={code:"",name:t??"No value"};for(const o of n){const t=o.values[e];if("code"===t?.objectType||"null"===t?.objectType){const{code:n,name:r}=t.codedValue&&"null"!==t.objectType?t.codedValue:i;!s.has(n)&&this._contingencyIsValid(e,o)&&s.set(n,{name:r,value:n})}}return[...s.values()]}_hashContingency(e,t,n=!1){if(t.length<1)return[J,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[B,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${K}`):s.push(`${o}:${t.codedValue?.code}`)}return[s.sort().join("&"),i]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}_isSupportedElement(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||"text"===e.type||"utilityNetworkAssociations"===e.type||(i.getLogger(this).warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}get test(){return{featureClone:this._featureClone}}};function q(e,t){const{feature:n,layer:s}=t;return new O({element:e,inputs:[],feature:n,layer:s})}function Q(e,t,n=null){const{feature:s,layer:i,timeZone:o}=t;return new G({element:e,feature:s,group:n,layer:i,timeZone:o})}e([d()],Y.prototype,"_expressionInfosLookup",null),e([d()],Y.prototype,"_featureClone",void 0),e([d()],Y.prototype,"_initialFeature",void 0),e([d()],Y.prototype,"_timeZone",void 0),e([d({type:b})],Y.prototype,"activeAssociation",void 0),e([d()],Y.prototype,"activeAssociationInput",null),e([d()],Y.prototype,"activeRelationshipInput",null),e([d()],Y.prototype,"_arcadeContextInfo",null),e([d()],Y.prototype,"associationId",null),e([d()],Y.prototype,"associatedLayer",null),e([d()],Y.prototype,"allAssociationInputs",null),e([d()],Y.prototype,"allFieldInputs",null),e([d()],Y.prototype,"allGroupInputs",null),e([d()],Y.prototype,"allRelationshipInputs",null),e([d()],Y.prototype,"_layerFieldsByName",null),e([d()],Y.prototype,"editType",void 0),e([d()],Y.prototype,"contingencyConstraintViolations",void 0),e([d()],Y.prototype,"disabled",void 0),e([d()],Y.prototype,"feature",null),e([d()],Y.prototype,"fieldsWithContingentValues",null),e([d({type:y})],Y.prototype,"formTemplate",null),e([d()],Y.prototype,"formDescription",null),e([d()],Y.prototype,"formTitle",null),e([d()],Y.prototype,"formHeaderVisible",null),e([d()],Y.prototype,"highlightHelper",void 0),e([d()],Y.prototype,"inputs",void 0),e([d()],Y.prototype,"joinedContingentValues",null),e([d()],Y.prototype,"layer",null),e([d()],Y.prototype,"map",void 0),e([d()],Y.prototype,"callbacks",void 0),e([d()],Y.prototype,"relationshipId",null),e([d()],Y.prototype,"spatialReference",null),e([d()],Y.prototype,"state",null),e([d()],Y.prototype,"strict",void 0),e([d()],Y.prototype,"submittable",null),e([d()],Y.prototype,"timeZone",null),e([d()],Y.prototype,"updating",null),e([d()],Y.prototype,"valid",null),e([d()],Y.prototype,"pendingSubtypeChoice",void 0),e([d()],Y.prototype,"getValues",null),e([d()],Y.prototype,"submit",null),e([d()],Y.prototype,"test",null),Y=e([f("esri.widgets.FeatureForm.FeatureFormViewModel")],Y);const X=Y;export{X as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{substitute as t,formatNumber as i}from"../intl.js";import{isSome as o}from"../core/arrayUtils.js";import"../core/has.js";import s from"../core/Logger.js";import{createResolver as n}from"../core/promiseUtils.js";import a from"../core/ReactiveMap.js";import{watch as r,whenOnce as l,initial as d}from"../core/reactiveUtils.js";import{property as c,subclass as u}from"../core/accessorSupport/decorators.js";import{isIntegerField as p}from"../layers/support/fieldUtils.js";import{isSubtypeGroupLayer as m,getSubtypesFromLayer as h}from"../layers/support/layerUtils.js";import{isString as v}from"../support/guards.js";import _ from"./Widget.js";import{Prompt as g}from"./Editor/components/Prompt.js";import{isRelatableFeatureSupportedLayer as b}from"./Feature/support/featureUtils.js";import{css as f}from"./FeatureForm/css.js";import{isUtilityNetworkAssociationInput as y,isGroupInput as C,isFieldInput as F,isRelationshipInput as w,isTextElementInput as R,flattenInputs as k,isInputInGroupInput as I,isFieldElementWithInputType as O,getErrorMessageForFieldInput as N,getIconForFeature as M,isNumberFieldInput as L,isInputInThisGroupInput as T,subtypeChangeShouldPrompt as A}from"./FeatureForm/featureFormUtils.js";import x from"./FeatureForm/FeatureFormViewModel.js";import D from"./FeatureForm/VisibleElements.js";import{loadCalciteComponents as V}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as S,getIntlOptionsForField as U,numberingSystem as E,prepareISOFieldValueForDateComponents as $,prepareUnixFieldValueForDateComponents as j,normalizeTimeOnlyString as P,getISOFieldValueFromDateComponents as G,getUnixFieldValueFromDateComponents as H}from"./support/dateUtils.js";import{globalCss as W}from"./support/globalCss.js";import{Heading as Z,incrementHeadingLevel as B}from"./support/Heading.js";import{messageBundle as K,vmEvent as q,tsx as z}from"./support/widget.js";import{setFocus as J}from"./support/widgetUtils.js";const Q="data-field-name";let X=class extends _{constructor(e,t){super(e,t),this._associationsWidgetsMap=new a,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._pendingSubtypeChoice=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()},{root:window.document}),this._prompt=null,this._featureFormUNAssociationList=null,this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new x,this.visibleElements=new D,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,callbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t,i)=>{const{feature:o,callbacks:s}=this;let n=i;if(o&&s?.addRelatedRecord){if(m(i)&&e.activeCategory){const t=e.activeCategory.value,o=i.findSublayerForSubtypeCode(t);o&&b(o)&&(n=o)}s.addRelatedRecord({parentFeature:o,relatedLayer:n,relationshipId:t})}},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),this._afterGroupCreate=this._afterGroupCreate.bind(this)}initialize(){this.addHandles([r(()=>this.feature,()=>{this._inputsWithChanges.clear(),this._dateComponentMap.clear(),l(()=>!this.viewModel.updating).then(()=>{const e=this._getFocusableInput("forward");this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0})}),r(()=>[this._featureFormUNAssociationList,this.visibleElements.associationDetails],([e,t])=>{e&&(e.visibleElements.associationDetails=t)},d),r(()=>this.groupDisplay,()=>this._syncGroupInputStates()),this.on("submit",e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach(e=>this._inputsWithChanges.add(e)),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}}),r(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),r(()=>this.viewModel.activeAssociationInput,e=>{e&&this._featureFormUNAssociationList&&(this._featureFormUNAssociationList.associationInput=e,this._featureFormUNAssociationList.viewModel=e.viewModel)}),r(()=>this.viewModel.inputs.filter(y),async e=>{this._featureFormUNAssociationList||await this._setUpUtilityNetworkAssociationList();for(const t of e)this._associationsWidgetsMap.has(t)||this._associationsWidgetsMap.set(t,await this._makeAssociationsWidget(t))})])}loadDependencies(){return V({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const{callbacks:e}=this;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get _utilityNetworkAssociationsEnabled(){const{callbacks:e}=this;return!(!e?.viewAssociatedLayers||!e.viewAssociatedFeatures)}get _subtypes(){return h(this.layer)}get associationId(){return this.viewModel.associationId}set associationId(e){this.viewModel.associationId=e}get associatedLayer(){return this.viewModel.associatedLayer}set associatedLayer(e){this.viewModel.associatedLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get icon(){return"form-field"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return z("div",{class:this.classes(f.base,W.widget,W.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return z("div",null,z("form",{class:f.form,inert:!!this._prompt,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderReadOnlyNotice(),this._renderHeader(),this._renderContent()),this._prompt?z(g,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderReadOnlyNotice(){const{disabled:e,messages:t}=this;if(e&&this.visibleElements.readOnlyNotice)return z("calcite-notice",{class:f.disabledNotice,icon:"read-only-non-editable",kind:"brand",open:!0,scale:"s",width:"full"},z("div",{slot:"message"},t.disabledForm))}_renderHeader(){const e=this.viewModel,{formTitle:t,formDescription:i}=e;if(!e.formHeaderVisible)return;const o=null!=t&&z(Z,{key:"title",level:this.headingLevel},t),s=null!=i&&z("p",{class:f.description,key:"description"},i);return z("div",{class:f.formHeader},o,s)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderRelationshipInput(e.activeRelationshipInput):e.activeAssociationInput?this._renderFeatureFormUtilityNetworkAssociationList():e.inputs.filter(o).filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){return C(e)?this._renderGroup(e):F(e)?this._renderLabeledField(e):w(e)?this._renderRelationshipInput(e):R(e)?this._renderTextElementInput(e):y(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderFeatureFormUtilityNetworkAssociationList(){return this._featureFormUNAssociationList?.render()}_selectAssociatedLayer(e){const{feature:t,callbacks:i}=this;t&&i?.viewAssociatedFeatures&&i.viewAssociatedFeatures({associatedLayer:e.layer})}async _selectAssociatedFeature(e){const{feature:t,callbacks:i}=this;t&&i?.selectAssociatedFeature&&await i.selectAssociatedFeature({parentFeature:t,...e})}_onAddAssociation(e){const{feature:t,callbacks:i}=this;t&&i?.addAssociation&&i.addAssociation(e)}async _setUpUtilityNetworkAssociationList(){if(!this._featureFormUNAssociationList){const e=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js")).default;this._featureFormUNAssociationList=new e({onSelectLayer:this._selectAssociatedLayer.bind(this),onSelectFeature:this._selectAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)})}}async _makeAssociationsWidget(e){return new(0,(await import("./Feature/FeatureUtilityNetworkAssociations.js")).default)({onSelectAssociationType:({viewModel:t,listType:i})=>{t.activeAssociationType=i;const{feature:o,callbacks:s}=this;o&&s?.viewAssociatedLayers&&s.viewAssociatedLayers({associationId:e.uid})},viewModel:e.associationsViewModel})}_renderUtilityNetworkAssociationsElementInput(e){if(this._utilityNetworkAssociationsEnabled)return this._associationsWidgetsMap.get(e)?.render()}_renderDescriptionOrEmpty(e,t){return null==e?null:z("div",{class:this.classes(f.description),id:t},e)}_renderGroup(e){const{formTemplate:t,headingLevel:i}=this,{description:o,id:s,inputs:n,label:a,open:r}=e,l=n.filter(e=>e.visible),d=this.viewModel.findField(this._focusedFieldName),c=d?.group===e,u="sequential"===this.groupDisplay;return z("calcite-block",{afterCreate:this._afterGroupCreate,class:this.classes(f.group,u?f.groupSequential:null,c?f.groupActive:null),collapsible:!0,"data-group":e,description:o||void 0,expanded:r,heading:a??"",headingLevel:t?.title?B(i):i,id:s,key:s,onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},l.map(e=>this._renderInput(e)))}_getFocusableInput(e,t){const i=k(this.viewModel.inputs);let o;if("backward"===e&&i.reverse(),t)if(C(t)){const e=t.inputs.find(e=>e.visible);o=e?i.indexOf(e):0}else{let s;if(I(t)&&!t.group.open){const i=t.group.inputs.filter(F);s="forward"===e?i[i.length-1]:i[0]}else s=t;o=i.indexOf(s)+1}else o=0;for(let s=o;s<i.length;s++){const e=i[s];if(e.visible&&F(e)){if(this.disabled&&e.inputType&&("switch"===e.inputType||"radio-buttons"===e.inputType))continue;return e}}return null}_renderLabeledField(e){const{dataType:i,feature:o,label:s,layer:n,required:a}=e,r={"aria-label":a?t(this.messages.requiredFieldLabel,{name:s}):s,class:f.label,key:`${n.id}-${o.uid}-${e.name}`},l=[z("div",{class:f.labelTextContent,key:"labelTextContainer"},s,a?z("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==i?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return"date"===i&&"coded-value"!==e.domain?.type?z("label",{...r},l):z("calcite-label",{...r},l)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:o,name:s}=e,n=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(s,this.messages.empty);return"switch"!==o||e.hasInvalidSwitchValue?"radio-buttons"===o?this._renderRadioButtonComponents(e,t.flat(),n):this._renderComboBoxComponent(e,t,n):this._renderSwitchComponent(e,n)}return"datetime-picker"===o||"date"===t?this._renderDateComponents(e,n):"number"===t?this._renderNumberComponent(e,n):this._renderStringComponent(e,n)}_renderStringComponent(e,t){return"text-area"===e.inputType?t.readOnly?z("calcite-input",{...t,loading:e.updating,type:"textarea",onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)}):z("calcite-text-area",{...t,resize:"vertical",onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.currentTarget)}):z("calcite-input",{...t,loading:e.updating,type:"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderNumberComponent(e,t){const i=p(e.field),o=i&&""!==t.value?Math.round(parseFloat(t.value)).toString():t.value;return z("calcite-input-number",{...t,integer:i,loading:e.updating,type:"number",value:o,onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderDateComponents(e,t){const{field:i}=e;switch(i.type){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,S(i,t.value,{timeZone:this.timeZone,...U(i)}))}}_renderDateOnlyFieldComponent(e,t){const{range:i,valid:o,value:s}=e,{class:n,key:a,readOnly:r}=t,{rawMax:l,rawMin:d}=i;return z("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!o,class:n,"data-date-part":"date","data-field-name":t[Q],key:`${a}-date-input`,max:v(l)?l:void 0,min:v(d)?d:void 0,numberingSystem:E,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:r,value:null!=s?`${s}`:void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:s,key:n,readOnly:a}=t;return z("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:s,"data-date-part":"time","data-field-name":t[Q],key:`${n}-time-input`,numberingSystem:E,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:a,step:e.timeStep,value:null!=o?`${o}`:void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{name:i,range:o,timeZone:s,valid:n,value:a}=e,{class:r,key:l,readOnly:d}=t,{rawMax:c,rawMin:u}=o,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:E,overlayPositioning:"fixed",readOnly:d,[Q]:i,onfocus:this._onComponentFocus},m=$(c,s),h=$(u,s),v=$(a,s);return z("div",{class:f.dateInputContainer,key:`${l}-date-time-container`},z("calcite-input-date-picker",{...p,class:r,"data-date-part":"date",key:`${l}-date-input`,max:m?.date??void 0,min:h?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:v.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),z("calcite-input-time-picker",{...p,class:r,"data-date-part":"time",key:`${l}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:e.timeStep,value:v.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),e.includeTimeOffset?z("calcite-input-time-zone",{...p,class:r,"data-date-part":"timeZone",disabled:d,key:`${l}-timezone-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:v.timeZoneOffset??"0",onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderDateFieldComponents(e,t){const{includeTime:i,name:o,valid:s,value:n}=e,{class:a,key:r,max:l,min:d,readOnly:c}=t,{timeZone:u}=this,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!s,numberingSystem:E,overlayPositioning:"fixed",readOnly:c,[Q]:o,onfocus:this._onComponentFocus},m=j(n,u),h=j(l,u),v=j(d,u);return z("div",{class:f.dateInputContainer,key:`${r}-date-time-container`},z("calcite-input-date-picker",{...p,class:a,"data-date-part":"date",key:`${r}-date-input`,max:h?.date??void 0,min:v?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:m.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),i?z("calcite-input-time-picker",{...p,class:a,"data-date-part":"time",key:`${r}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:1,value:m.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return z("calcite-input",{...i,class:this.classes(f.fieldInput,f.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:o,name:s}=e,{viewModel:n,_inputsWithChanges:a}=this,r="INSERT"===n.editType,l=a.has(s),d=null==o&&(!r||l),c=r&&e.showNoValueOptionEnabled&&!l?()=>{}:i.onblur;return z("calcite-combobox",{...i,allowCustomValues:!1,clearDisabled:!0,onblur:c,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:t})=>{d&&0===t.selectedItems.length?this._ignoreDeselectionOfNoValueOption(t):e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveValueFromComponent(t)}},this.renderComboboxOptionsList(e,t))}renderComboboxOptionsList(e,t){const{value:i,name:o}=e,{messages:s,messagesTemplates:n,viewModel:a,_inputsWithChanges:r}=this,[l,d,c]=t.map(e=>e.map(({name:e,value:t})=>z("calcite-combobox-item",{key:`#${t}`,selected:i===t,textLabel:e,value:`${t}`}))),u=[];d.length>0&&u.push(z("calcite-combobox-item-group",{key:"other",label:n.other},d)),c.length>0&&u.push(z("calcite-combobox-item-group",{key:"unsupported",label:s.subtypes.unsupportedDomainGroupTitle},c)),u.length>0?u.unshift(z("calcite-combobox-item-group",{key:"recommended",label:s.recommended},l)):u.push(...l);const p="INSERT"===a.editType,m=r.has(o),h=null==i&&(!p||m);return e.showNoValueOptionEnabled&&u.unshift(z("calcite-combobox-item",{key:"empty-option",selected:h,textLabel:e.showNoValueLabel||s.empty,value:""})),u}_renderRadioButtonComponents(e,t,i){const{name:o,value:s}=e,n=t.map(({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:o,value:t,selected:t===s,props:i}));if(e.showNoValueOptionEnabled){const t="",a=e.showNoValueLabel||this.messages.empty,r=s===t||null===s;n.unshift(this._renderRadioButtonComponent({key:"empty-option",label:a,name:o,value:t,selected:r,props:i}))}return z("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:f.inputRadioGroup,"data-field-name":i[Q],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},n)}_renderSwitchComponent(e,t){const{value:i}=e,o=!!O(e.element,"switch")&&i===e.element.input.onValue;return z("calcite-switch",{...t,checked:o,class:f.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.currentTarget)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:o,label:s,props:n}){return z("calcite-label",{class:f.inputRadioLabel,key:e,layout:"inline"},z("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:o,class:f.inputRadio,disabled:n.readOnly,name:t,onblur:()=>{this._focusedFieldName=null},value:i,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveValueFromComponent(e)}}),s)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.submittable?N(e,this.messages,this.timeZone):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?z("calcite-input-message",{icon:!0,status:"invalid"},i):this._inputsWithChanges.has(t)&&e.valueIsOutOfDomain?z("calcite-input-message",{icon:!0,status:"idle"},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){if(!e.showAllActionVisible||!this.callbacks?.showAllRelatedRecords)return;const i=this.messages;return z("calcite-list-item",{description:t(i.totalCount,{count:e.featureCount}),key:"show-all-related-features",label:i.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(e.relationshipId)},z("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:o,editable:s}=e,{messages:n,callbacks:a,disabled:r}=this,l=!s||r;if(t&&a?.addRelatedRecord&&o&&!l)return z("calcite-button",{alignment:"center",appearance:"outline-fill",class:f.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,onclick:()=>{!e.updating&&e.originHasValidKey&&this._onAddRelatedRecordsClick(e,i,o)},round:!0,scale:"s",width:"full"},e.relatedLayerIsTable?n.addRecord:n.addFeature)}_renderRelatedRecordListItem(e,t,i){const{feature:o,description:s,title:n}=e,{feature:a,callbacks:r}=this,{highlightHelper:l}=this.viewModel,d=()=>{l?.removeAll(),r?.editRelatedRecord&&a&&r.editRelatedRecord({parentFeature:a,relationshipId:t,relatedFeature:o,readOnly:i})},c=l?()=>l.add(o):void 0,u=l?()=>l.remove(o):void 0;return z("calcite-list-item",{bind:this,description:s,key:`${t}-${o.uid}`,label:n,onmouseenter:c,onmouseleave:u,value:n,onCalciteListItemSelect:d},z("calcite-icon",{icon:M(o),slot:"content-start"}),z("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled)return;const{relationshipId:t,activeCategory:i}=e,o=i?null:this._renderDescriptionOrEmpty(e.description);return z("calcite-label",{class:this.classes(f.label,f.relatedRecordsLabel),key:`relationship-${t}-container`},z("div",null,this._renderRelatedRecordsHeaderContainer(e),o,this._renderRelationshipInputContent(e)),this._renderAddRelatedRecordButton(e))}_renderRelationshipInputContent(e){return e.featureCount>0?this._renderRelatedRecordsList(e):e.activeCategory&&0===e.featureCount?this._renderNoRelatedRecordsNotice():e.allCategories?.length?this._renderCategoryList(e):e.loaded?e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e):void 0}_renderCategoryList(e){return z("calcite-list",{displayMode:"flat",label:this.messages.relatedRecordsList,loading:e.updating},e.categories?.map(t=>this._renderCategory(e,t)),this._renderShowAllCategoriesListItem(e))}_renderCategory(e,t){const{count:o,name:s,value:n}=t,a=i(o);return z("calcite-list-item",{key:`${s}-${n}`,label:s,onCalciteListItemSelect:()=>this._selectCategory(e,t)},z("calcite-chip",{label:a,scale:"s",slot:"content-end"},a),z("calcite-icon",{flipRtl:!0,icon:"chevron-left",scale:"s",slot:"content-end"}))}_selectCategory(e,t){this.relationshipId=e.relationshipId,e.activeCategory=t}_renderShowAllCategoriesListItem(e){if(!e.showAllCategoriesVisible)return;const i=this.messages;return z("calcite-list-item",{description:t(i.totalCount,{count:e.allCategories?.length??0}),key:"show-all-categories",label:i.showAll,value:!0,onCalciteListItemSelect:()=>e.showAllEnabled=!0},z("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return z("div",{class:f.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},z("span",null,e.label),t?z("calcite-loader",{inline:!0,key:"loader",label:this.messagesCommon?.loading,scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t,editable:i}=e,{disabled:o}=this,s=!i||o;return z("calcite-list",{class:f.relatedRecordsList,label:this.messages?.relatedRecordsList},e.relatedFeatureInfos.map(e=>this._renderRelatedRecordListItem(e,t,s)),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){const{messages:i}=this,o=e.relatedLayerIsTable?i.noOriginKeyRecord:i.noOriginKeyFeature,s=e.relationship?.keyField,n=this.viewModel.findField(s),a=e.layer?.fieldsIndex.get(s),r=n?.label||a?.alias||s,l=t(o,{relatedLayerName:e.relatedLayer?.title,originKeyField:r});return z("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},z("div",{slot:"message"},l))}_renderNoRelatedRecordsNotice(){return z("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},z("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return z("div",{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:f.listObserver,key:"feature-observer"})}_renderTextElementInput(e){return z("div",{class:f.textElement,"data-testid":`text-element-${e.label}`,innerHTML:e.text,key:e.id})}getCommonInputProps(e){const{disabled:t}=this,{editable:i,hint:o,label:s,maxLength:n,minLength:a,name:r,range:{max:l,min:d},required:c,valid:u,value:p}=e,m=this._inputsWithChanges.has(r),h=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":u?"false":"true",class:this.classes(f.fieldInput,h?f.inputDisabled:null),status:m&&!u?"invalid":"idle",key:r,label:s,max:null!=l?l:void 0,min:null!=d?d:void 0,maxLength:n>-1?n:void 0,minLength:a>-1?a:void 0,placeholder:o??void 0,readOnly:h,required:c,value:null==p?"":`${p}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[Q]:r}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(Q))}_afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e),i=e.dataset.datePart,o=this._dateComponentMap.get(t.name);if("valueAsDate"in e&&null!=e.value&&null!=t.value){const i=new ResizeObserver(()=>{switch(e.value=void 0,t.field.type){case"date":e.value=j(t.value,this.timeZone).date??"";break;case"timestamp-offset":e.value=$(t.value,this.timeZone).date??"";break;default:e.value=`${t.value}`}i.unobserve(e)});i.observe(e)}if(null!=o)switch(i){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}else this._dateComponentMap.set(t.name,{[i]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);L(t)&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),o=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&o===i&&(this._attemptFocusOnNextRender=!1,I(i)&&(i.group.open=!0),J(e))}async _afterGroupCreate(e){const t=this.viewModel.findGroup(e.id),i=this.viewModel.findField(this._focusedFieldName);i&&t&&T(i,t)&&(!i.editable||this.disabled)&&(await e.componentOnReady(),this._attemptFocusOnNextRender=!0,this.scheduleRender())}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name}_onComponentBlur(e){const t=e.target;this._focusedFieldName=null;"readOnly"in t&&t.readOnly||this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){const{timeZone:t}=this,i=this._getFieldInputFromHTMLElement(e),o=i.field.type,{name:s,range:n}=i,a=this._dateComponentMap.get(s);if(!a)return;let r=this.viewModel.getValue(s),l=null;"date-only"===o?l=Array.isArray(e.value)?e.value[0]:e.value:"time-only"===o?(r=P(r),l=P(e.value)):l="timestamp-offset"===o?null!=e.value?G({dateComponent:a.date,timeComponent:a.time,timeZoneComponent:a.timeZone,oldValue:r,defaultTimeZone:t}):null:null!=e.value?H({oldValue:r,dateComponent:a.date,timeComponent:a.time,timeZone:t,max:n.max,min:n.min}):null,null!==l&&e.value?r!==l&&this._updateFieldValue(s,l):this._updateFieldValue(s,null)}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e),i=this._parseValue(e),o=t.value;t.isSubtypeField&&A(this.layer,o,i)?this._pendingSubtypeChoice||i===o||(this._pendingSubtypeChoice=this._handleSubtypeChoice(t,i)):this._updateFieldValue(t.name,i)}async _handleSubtypeChoice(e,i){const{value:o,name:s}=e,{messages:a,viewModel:r,messagesCommon:l,_subtypes:d}=this;if(this._updateFieldValue(s,i),!d?.length)return;const c=d.find(e=>e.code===i),u=d.find(e=>e.code===o)?.name??`${o}`;if(!c)return;const p=n();r.pendingSubtypeChoice=p;let m="update-fields";const h=[{label:a.subtypes.useDefaultValuesOption,value:"update-fields"},{label:a.subtypes.keepCurrentValuesOption,value:"keep-existing"}],v={context:"info",title:a.subtypes.changeWarningTitle,message:t(a.subtypes.changeWarning,{originalType:u,newType:c.name}),radios:h,defaultRadioSelection:"update-fields",onRadioSelection:e=>m=e,actions:{primary:{label:l.apply,action:()=>p.resolve(m),type:"positive"},secondary:{label:l.cancel,type:"neutral",action:()=>p.resolve("undo")}},cancel:()=>p.reject()};try{this.showPrompt(v);switch(await p.promise){case"update-fields":r.applySubtypeDefaults(c),this._validateContingenciesForNonNullFields();break;case"keep-existing":this._validateContingenciesForNonNullFields();break;case"undo":this._updateFieldValue(e.name,o)}}finally{r.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&I(i)&&!i.group.open&&(i.group.open=!0)}_updateFieldValue(e,t){const i=this.viewModel.getValue(e);this.viewModel.setValue(e,t),this._inputsWithChanges.add(e);i!==t&&this.viewModel.fieldsWithContingentValues.has(e)&&this._validateContingenciesForNonNullFields()}_validateContingenciesForNonNullFields(){const e=Object.fromEntries(Object.entries(this.getValues()).filter(([e,t])=>null!=t));this.viewModel.validateContingencyConstraints(e)}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;return O(t.element,"switch")?e.checked?t.element.input.onValue:t.element.input.offValue:null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:i}=e;0===i.length&&t&&"selected"in t?t.selected=!0:s.getLogger(this).warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,this._attemptFocusOnNextRender=!0,"sequential"===this.groupDisplay&&this.viewModel.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.allGroupInputs;if(!e.length)return;const t=e.filter(e=>e.open);0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach(e=>e.open=!1)}get test(){return{inputsWithChanges:this._inputsWithChanges,updateValue:this._saveValueFromComponent.bind(this)}}};e([c()],X.prototype,"_listObserverNode",void 0),e([c()],X.prototype,"_relatedRecordsEnabled",null),e([c()],X.prototype,"_utilityNetworkAssociationsEnabled",null),e([c()],X.prototype,"_prompt",void 0),e([c()],X.prototype,"_subtypes",null),e([c()],X.prototype,"associationId",null),e([c()],X.prototype,"associatedLayer",null),e([c()],X.prototype,"disabled",null),e([c()],X.prototype,"feature",null),e([c()],X.prototype,"_featureFormUNAssociationList",void 0),e([c()],X.prototype,"formTemplate",null),e([c()],X.prototype,"groupDisplay",void 0),e([c()],X.prototype,"headingLevel",void 0),e([c()],X.prototype,"icon",null),e([c()],X.prototype,"label",null),e([c()],X.prototype,"layer",null),e([c()],X.prototype,"map",null),e([c(),K("esri/widgets/FeatureForm/t9n/FeatureForm")],X.prototype,"messages",void 0),e([c(),K("esri/t9n/common")],X.prototype,"messagesCommon",void 0),e([c(),K("esri/widgets/Feature/t9n/Feature")],X.prototype,"messagesFeature",void 0),e([c(),K("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],X.prototype,"messagesTemplates",void 0),e([c()],X.prototype,"callbacks",null),e([c()],X.prototype,"relationshipId",null),e([c()],X.prototype,"spatialReference",null),e([c()],X.prototype,"strict",null),e([c()],X.prototype,"timeZone",null),e([c()],X.prototype,"showPrompt",null),e([c()],X.prototype,"clearPrompt",null),e([c(),q(["value-change","submit"])],X.prototype,"viewModel",void 0),e([c({type:D,nonNullable:!0})],X.prototype,"visibleElements",void 0),e([c()],X.prototype,"test",null),X=e([u("esri.widgets.FeatureForm")],X);const Y=X;export{Y as default};
5
+ import{__decorate as e}from"tslib";import{substitute as t,formatNumber as i}from"../intl.js";import{isSome as o}from"../core/arrayUtils.js";import"../core/has.js";import s from"../core/Logger.js";import{createResolver as n}from"../core/promiseUtils.js";import a from"../core/ReactiveMap.js";import{watch as r,whenOnce as l,initial as d}from"../core/reactiveUtils.js";import{property as c,subclass as u}from"../core/accessorSupport/decorators.js";import{isIntegerField as p}from"../layers/support/fieldUtils.js";import{isSubtypeGroupLayer as m,getSubtypesFromLayer as h}from"../layers/support/layerUtils.js";import{isString as v}from"../support/guards.js";import _ from"./Widget.js";import{Prompt as g}from"./Editor/components/Prompt.js";import{isRelatableFeatureSupportedLayer as b}from"./Feature/support/featureUtils.js";import{css as f}from"./FeatureForm/css.js";import{isUtilityNetworkAssociationInput as y,isGroupInput as C,isFieldInput as F,isRelationshipInput as w,isTextElementInput as R,flattenInputs as k,isInputInGroupInput as I,isFieldElementWithInputType as O,getErrorMessageForFieldInput as N,getIconForFeature as M,isNumberFieldInput as L,isInputInThisGroupInput as T,subtypeChangeShouldPrompt as A}from"./FeatureForm/featureFormUtils.js";import x from"./FeatureForm/FeatureFormViewModel.js";import D from"./FeatureForm/VisibleElements.js";import{loadCalciteComponents as V}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as S,getIntlOptionsForField as U,numberingSystem as E,prepareISOFieldValueForDateComponents as $,prepareUnixFieldValueForDateComponents as j,normalizeTimeOnlyString as P,getISOFieldValueFromDateComponents as G,getUnixFieldValueFromDateComponents as H}from"./support/dateUtils.js";import{globalCss as W}from"./support/globalCss.js";import{Heading as Z,incrementHeadingLevel as B}from"./support/Heading.js";import{messageBundle as K,vmEvent as q,tsx as z}from"./support/widget.js";import{setFocus as J}from"./support/widgetUtils.js";const Q="data-field-name";let X=class extends _{constructor(e,t){super(e,t),this._associationsWidgetsMap=new a,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._pendingSubtypeChoice=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()},{root:window.document}),this._prompt=null,this._featureFormUNAssociationList=null,this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new x,this.visibleElements=new D,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,callbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t,i)=>{const{feature:o,callbacks:s}=this;let n=i;if(o&&s?.addRelatedRecord){if(m(i)&&e.activeCategory){const t=e.activeCategory.value,o=i.findSublayerForSubtypeCode(t);o&&b(o)&&(n=o)}s.addRelatedRecord({parentFeature:o,relatedLayer:n,relationshipId:t})}},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),this._afterGroupCreate=this._afterGroupCreate.bind(this)}initialize(){this.addHandles([r(()=>this.feature,()=>{this._inputsWithChanges.clear(),this._dateComponentMap.clear(),l(()=>!this.viewModel.updating).then(()=>{const e=this._getFocusableInput("forward");this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0})}),r(()=>[this._featureFormUNAssociationList,this.visibleElements.associationDetails],([e,t])=>{e&&(e.visibleElements.associationDetails=t)},d),r(()=>this.groupDisplay,()=>this._syncGroupInputStates()),this.on("submit",e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach(e=>this._inputsWithChanges.add(e)),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}}),r(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),r(()=>this.viewModel.activeAssociationInput,e=>{e&&this._featureFormUNAssociationList&&(this._featureFormUNAssociationList.associationInput=e,this._featureFormUNAssociationList.viewModel=e.viewModel)}),r(()=>this.viewModel.inputs.filter(y),async e=>{this._featureFormUNAssociationList||await this._setUpUtilityNetworkAssociationList();for(const t of e)this._associationsWidgetsMap.has(t)||this._associationsWidgetsMap.set(t,await this._makeAssociationsWidget(t))})])}loadDependencies(){return V({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const{callbacks:e}=this;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get _utilityNetworkAssociationsEnabled(){const{callbacks:e}=this;return!(!e?.viewAssociatedLayers||!e.viewAssociatedFeatures)}get _subtypes(){return h(this.layer)}get associationId(){return this.viewModel.associationId}set associationId(e){this.viewModel.associationId=e}get associatedLayer(){return this.viewModel.associatedLayer}set associatedLayer(e){this.viewModel.associatedLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get icon(){return"form-field"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return z("div",{class:this.classes(f.base,W.widget,W.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return z("div",null,z("form",{class:f.form,inert:!!this._prompt,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderReadOnlyNotice(),this._renderHeader(),this._renderContent()),this._prompt?z(g,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderReadOnlyNotice(){const{disabled:e,messages:t}=this;if(e&&this.visibleElements.readOnlyNotice)return z("calcite-notice",{class:f.disabledNotice,icon:"read-only-non-editable",kind:"brand",open:!0,scale:"s",width:"full"},z("div",{slot:"message"},t.disabledForm))}_renderHeader(){const e=this.viewModel,{formTitle:t,formDescription:i}=e;if(!e.formHeaderVisible)return;const o=null!=t&&z(Z,{key:"title",level:this.headingLevel},t),s=null!=i&&z("p",{class:f.description,key:"description"},i);return z("div",{class:f.formHeader},o,s)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderRelationshipInput(e.activeRelationshipInput):e.activeAssociationInput?this._renderFeatureFormUtilityNetworkAssociationList():e.inputs.filter(o).filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){return C(e)?this._renderGroup(e):F(e)?this._renderLabeledField(e):w(e)?this._renderRelationshipInput(e):R(e)?this._renderTextElementInput(e):y(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderFeatureFormUtilityNetworkAssociationList(){return this._featureFormUNAssociationList?.render()}_selectAssociatedLayer(e){const{feature:t,callbacks:i}=this;t&&i?.viewAssociatedFeatures&&i.viewAssociatedFeatures({associatedLayer:e.layer})}async _selectAssociatedFeature(e){const{feature:t,callbacks:i}=this;t&&i?.selectAssociatedFeature&&await i.selectAssociatedFeature({parentFeature:t,...e})}_onAddAssociation(e){const{feature:t,callbacks:i}=this;t&&i?.addAssociation&&i.addAssociation(e)}async _setUpUtilityNetworkAssociationList(){if(!this._featureFormUNAssociationList){const e=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js")).default;this._featureFormUNAssociationList=new e({onSelectLayer:this._selectAssociatedLayer.bind(this),onSelectFeature:this._selectAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)})}}async _makeAssociationsWidget(e){return new(0,(await import("./Feature/FeatureUtilityNetworkAssociations.js")).default)({onSelectAssociationType:({viewModel:t,listType:i})=>{t.activeAssociationType=i;const{feature:o,callbacks:s}=this;o&&s?.viewAssociatedLayers&&s.viewAssociatedLayers({associationId:e.uid})},viewModel:e.associationsViewModel})}_renderUtilityNetworkAssociationsElementInput(e){if(this._utilityNetworkAssociationsEnabled)return this._associationsWidgetsMap.get(e)?.render()}_renderDescriptionOrEmpty(e,t){return null==e?null:z("div",{class:this.classes(f.description),id:t},e)}_renderGroup(e){const{formTemplate:t,headingLevel:i}=this,{description:o,id:s,inputs:n,label:a,open:r}=e,l=n.filter(e=>e.visible),d=this.viewModel.findField(this._focusedFieldName),c=d?.group===e,u="sequential"===this.groupDisplay;return z("calcite-block",{afterCreate:this._afterGroupCreate,class:this.classes(f.group,u?f.groupSequential:null,c?f.groupActive:null),collapsible:!0,"data-group":e,description:o||void 0,expanded:r,heading:a??"",headingLevel:t?.title?B(i):i,id:s,key:s,onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},l.map(e=>this._renderInput(e)))}_getFocusableInput(e,t){const i=k(this.viewModel.inputs);let o;if("backward"===e&&i.reverse(),t)if(C(t)){const e=t.inputs.find(e=>e.visible);o=e?i.indexOf(e):0}else{let s;if(I(t)&&!t.group.open){const i=t.group.inputs.filter(F);s="forward"===e?i[i.length-1]:i[0]}else s=t;o=i.indexOf(s)+1}else o=0;for(let s=o;s<i.length;s++){const e=i[s];if(e.visible&&F(e)){if(this.disabled&&e.inputType&&("switch"===e.inputType||"radio-buttons"===e.inputType))continue;return e}}return null}_renderLabeledField(e){const{dataType:i,feature:o,label:s,layer:n,required:a}=e,r={"aria-label":a?t(this.messages.requiredFieldLabel,{name:s}):s,class:f.label,key:`${n.id}-${o.uid}-${e.name}`},l=[z("div",{class:f.labelTextContent,key:"labelTextContainer"},s,a?z("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==i?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return"date"===i&&"coded-value"!==e.domain?.type?z("label",{...r},l):z("calcite-label",{...r},l)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:o,name:s}=e,n=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(s,this.messages.empty);return"switch"!==o||e.hasInvalidSwitchValue?"radio-buttons"===o?this._renderRadioButtonComponents(e,t.flat(),n):this._renderComboBoxComponent(e,t,n):this._renderSwitchComponent(e,n)}return"datetime-picker"===o||"date"===t?this._renderDateComponents(e,n):"number"===t?this._renderNumberComponent(e,n):this._renderStringComponent(e,n)}_renderStringComponent(e,t){return"text-area"===e.inputType?t.readOnly?z("calcite-input",{...t,loading:e.updating,type:"textarea",onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)}):z("calcite-text-area",{...t,resize:"vertical",onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.currentTarget)}):z("calcite-input",{...t,loading:e.updating,type:"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderNumberComponent(e,t){const i=p(e.field),o=i&&""!==t.value?Math.round(parseFloat(t.value)).toString():t.value;return z("calcite-input-number",{...t,integer:i,loading:e.updating,type:"number",value:o,onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderDateComponents(e,t){const{field:i}=e;switch(i.type){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,S(i,t.value,{timeZone:this.timeZone,...U(i)}))}}_renderDateOnlyFieldComponent(e,t){const{range:i,valid:o,value:s}=e,{class:n,key:a,readOnly:r}=t,{rawMax:l,rawMin:d}=i;return z("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!o,class:n,"data-date-part":"date","data-field-name":t[Q],key:`${a}-date-input`,max:v(l)?l:void 0,min:v(d)?d:void 0,numberingSystem:E,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:r,value:null!=s?`${s}`:void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:s,key:n,readOnly:a}=t;return z("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:s,"data-date-part":"time","data-field-name":t[Q],key:`${n}-time-input`,numberingSystem:E,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:a,step:e.timeStep,value:null!=o?`${o}`:void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{name:i,range:o,timeZone:s,valid:n,value:a}=e,{class:r,key:l,readOnly:d}=t,{rawMax:c,rawMin:u}=o,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:E,overlayPositioning:"fixed",readOnly:d,[Q]:i,onfocus:this._onComponentFocus},m=$(c,s),h=$(u,s),v=$(a,s);return z("div",{class:f.dateInputContainer,key:`${l}-date-time-container`},z("calcite-input-date-picker",{...p,class:r,"data-date-part":"date",key:`${l}-date-input`,max:m?.date??void 0,min:h?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:v.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),z("calcite-input-time-picker",{...p,class:r,"data-date-part":"time",key:`${l}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:e.timeStep,value:v.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),e.includeTimeOffset?z("calcite-input-time-zone",{...p,class:r,"data-date-part":"timeZone",disabled:d,key:`${l}-timezone-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:v.timeZoneOffset??"0",onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderDateFieldComponents(e,t){const{includeTime:i,name:o,valid:s,value:n}=e,{class:a,key:r,max:l,min:d,readOnly:c}=t,{timeZone:u}=this,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!s,numberingSystem:E,overlayPositioning:"fixed",readOnly:c,[Q]:o,onfocus:this._onComponentFocus},m=j(n,u),h=j(l,u),v=j(d,u);return z("div",{class:f.dateInputContainer,key:`${r}-date-time-container`},z("calcite-input-date-picker",{...p,class:a,"data-date-part":"date",key:`${r}-date-input`,max:h?.date??void 0,min:v?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:m.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),i?z("calcite-input-time-picker",{...p,class:a,"data-date-part":"time",key:`${r}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:1,value:m.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return z("calcite-input",{...i,class:this.classes(f.fieldInput,f.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:o,name:s}=e,{viewModel:n,_inputsWithChanges:a}=this,r="INSERT"===n.editType,l=a.has(s),d=null==o&&(!r||l),c=r&&e.showNoValueOptionEnabled&&!l?()=>{}:i.onblur;return z("calcite-combobox",{...i,allowCustomValues:!1,clearDisabled:!0,onblur:c,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:t})=>{d&&0===t.selectedItems.length?this._ignoreDeselectionOfNoValueOption(t):e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveValueFromComponent(t)}},this.renderComboboxOptionsList(e,t))}renderComboboxOptionsList(e,t){const{value:i,name:o}=e,{messages:s,messagesTemplates:n,viewModel:a,_inputsWithChanges:r}=this,[l,d,c]=t.map(e=>e.map(({name:e,value:t})=>z("calcite-combobox-item",{key:`#${t}`,selected:i===t,textLabel:e,value:`${t}`}))),u=[];d.length>0&&u.push(z("calcite-combobox-item-group",{key:"other",label:n.other},d)),c.length>0&&u.push(z("calcite-combobox-item-group",{key:"unsupported",label:s.subtypes.unsupportedDomainGroupTitle},c)),u.length>0?u.unshift(z("calcite-combobox-item-group",{key:"recommended",label:s.recommended},l)):u.push(...l);const p="INSERT"===a.editType,m=r.has(o),h=null==i&&(!p||m);return e.showNoValueOptionEnabled&&u.unshift(z("calcite-combobox-item",{key:"empty-option",selected:h,textLabel:e.showNoValueLabel||s.empty,value:""})),u}_renderRadioButtonComponents(e,t,i){const{name:o,value:s}=e,n=t.map(({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:o,value:t,selected:t===s,props:i}));if(e.showNoValueOptionEnabled){const t="",a=e.showNoValueLabel||this.messages.empty,r=s===t||null===s;n.unshift(this._renderRadioButtonComponent({key:"empty-option",label:a,name:o,value:t,selected:r,props:i}))}return z("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:f.inputRadioGroup,"data-field-name":i[Q],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},n)}_renderSwitchComponent(e,t){const{value:i}=e,o=!!O(e.element,"switch")&&i===e.element.input.onValue;return z("calcite-switch",{...t,checked:o,class:f.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.currentTarget)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:o,label:s,props:n}){return z("calcite-label",{class:f.inputRadioLabel,key:e,layout:"inline"},z("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:o,class:f.inputRadio,disabled:n.readOnly,name:t,onblur:()=>{this._focusedFieldName=null},value:i,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveValueFromComponent(e)}}),s)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.submittable?N(e,this.messages,this.timeZone):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?z("calcite-input-message",{icon:!0,status:"invalid"},i):this._inputsWithChanges.has(t)&&e.valueIsOutOfDomain?z("calcite-input-message",{icon:!0,status:"idle"},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){if(!e.showAllActionVisible||!this.callbacks?.showAllRelatedRecords)return;const i=this.messages;return z("calcite-list-item",{description:t(i.totalCount,{count:e.featureCount}),key:"show-all-related-features",label:i.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(e.relationshipId)},z("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:o,editable:s}=e,{messages:n,callbacks:a,disabled:r}=this,l=!s||r;if(t&&a?.addRelatedRecord&&o&&!l)return z("calcite-button",{alignment:"center",appearance:"outline-fill",class:f.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,onclick:()=>{!e.updating&&e.originHasValidKey&&this._onAddRelatedRecordsClick(e,i,o)},round:!0,scale:"s",width:"full"},e.relatedLayerIsTable?n.addRecord:n.addFeature)}_renderRelatedRecordListItem(e,t,i){const{feature:o,description:s,title:n}=e,{feature:a,callbacks:r}=this,{highlightHelper:l}=this.viewModel,d=()=>{l?.removeAll(),r?.editRelatedRecord&&a&&r.editRelatedRecord({parentFeature:a,relationshipId:t,relatedFeature:o,readOnly:i})},c=l?()=>l.add(o):void 0,u=l?()=>l.remove(o):void 0;return z("calcite-list-item",{bind:this,description:s,key:`${t}-${o.uid}`,label:n,onmouseenter:c,onmouseleave:u,value:n,onCalciteListItemSelect:d},z("calcite-icon",{icon:M(o),slot:"content-start"}),z("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled)return;const{relationshipId:t,activeCategory:i}=e,o=i?null:this._renderDescriptionOrEmpty(e.description);return z("calcite-label",{class:this.classes(f.label,f.relatedRecordsLabel),key:`relationship-${t}-container`},z("div",null,this._renderRelatedRecordsHeaderContainer(e),o,this._renderRelationshipInputContent(e)),this._renderAddRelatedRecordButton(e))}_renderRelationshipInputContent(e){return e.featureCount>0?this._renderRelatedRecordsList(e):e.activeCategory&&0===e.featureCount?this._renderNoRelatedRecordsNotice():e.allCategories?.length?this._renderCategoryList(e):e.loaded?e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e):void 0}_renderCategoryList(e){return z("calcite-list",{displayMode:"flat",label:this.messages.relatedRecordsList,loading:e.updating},e.categories?.map(t=>this._renderCategory(e,t)),this._renderShowAllCategoriesListItem(e))}_renderCategory(e,t){const{count:o,name:s,value:n}=t,a=i(o);return z("calcite-list-item",{key:`${s}-${n}`,label:s,onCalciteListItemSelect:()=>this._selectCategory(e,t)},z("calcite-chip",{label:a,scale:"s",slot:"content-end"},a),z("calcite-icon",{flipRtl:!0,icon:"chevron-left",scale:"s",slot:"content-end"}))}_selectCategory(e,t){this.relationshipId=e.relationshipId,e.activeCategory=t}_renderShowAllCategoriesListItem(e){if(!e.showAllCategoriesVisible)return;const i=this.messages;return z("calcite-list-item",{description:t(i.totalCount,{count:e.allCategories?.length??0}),key:"show-all-categories",label:i.showAll,value:!0,onCalciteListItemSelect:()=>e.showAllEnabled=!0},z("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return z("div",{class:f.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},z("span",null,e.label),t?z("calcite-loader",{inline:!0,key:"loader",label:this.messagesCommon?.loading,scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t,editable:i}=e,{disabled:o}=this,s=!i||o;return z("calcite-list",{class:f.relatedRecordsList,label:this.messages?.relatedRecordsList},e.relatedFeatureInfos.map(e=>this._renderRelatedRecordListItem(e,t,s)),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){const{messages:i}=this,o=e.relatedLayerIsTable?i.noOriginKeyRecord:i.noOriginKeyFeature,s=e.relationship?.keyField,n=this.viewModel.findField(s),a=e.layer?.fieldsIndex.get(s),r=n?.label||a?.alias||s,l=t(o,{relatedLayerName:e.relatedLayer?.title,originKeyField:r});return z("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},z("div",{slot:"message"},l))}_renderNoRelatedRecordsNotice(){return z("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},z("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return z("div",{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:f.listObserver,key:"feature-observer"})}_renderTextElementInput(e){return z("div",{class:f.textElement,"data-testid":`text-element-${e.label}`,innerHTML:e.text,key:e.id})}getCommonInputProps(e){const{disabled:t}=this,{editable:i,hint:o,label:s,maxLength:n,minLength:a,name:r,range:{max:l,min:d},required:c,valid:u,value:p}=e,m=this._inputsWithChanges.has(r),h=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":u?"false":"true",class:this.classes(f.fieldInput,h?f.inputDisabled:null),status:m&&!u?"invalid":"idle",key:r,label:s,max:null!=l?l:void 0,min:null!=d?d:void 0,maxLength:n>-1?n:void 0,minLength:a>-1?a:void 0,placeholder:o??void 0,readOnly:h,required:c,value:null==p?"":`${p}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[Q]:r}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(Q))}_afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e),i=e.dataset.datePart,o=this._dateComponentMap.get(t.name);if("valueAsDate"in e&&null!=e.value&&null!=t.value){const i=new ResizeObserver(()=>{switch(e.value=void 0,t.field.type){case"date":e.value=j(t.value,this.timeZone).date??"";break;case"timestamp-offset":e.value=$(t.value,this.timeZone).date??"";break;default:e.value=`${t.value}`}i.unobserve(e)});i.observe(e)}if(null!=o)switch(i){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}else this._dateComponentMap.set(t.name,{[i]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);L(t)&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),o=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&o===i&&(this._attemptFocusOnNextRender=!1,I(i)&&(i.group.open=!0),J(e))}async _afterGroupCreate(e){const t=this.viewModel.findGroup(e.id),i=this.viewModel.findField(this._focusedFieldName);i&&t&&T(i,t)&&(!i.editable||this.disabled)&&(await e.componentOnReady(),this._attemptFocusOnNextRender=!0,this.scheduleRender())}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name}_onComponentBlur(e){const t=e.target;this._focusedFieldName=null;"readOnly"in t&&t.readOnly||this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){const{timeZone:t}=this,i=this._getFieldInputFromHTMLElement(e),o=i.field.type,{name:s,range:n}=i,a=this._dateComponentMap.get(s);if(!a)return;let r=this.viewModel.getValue(s),l=null;"date-only"===o?l=Array.isArray(e.value)?e.value[0]:e.value:"time-only"===o?(r=P(r),l=P(e.value)):l="timestamp-offset"===o?null!=e.value?G({dateComponent:a.date,timeComponent:a.time,timeZoneComponent:a.timeZone,oldValue:r,defaultTimeZone:t}):null:null!=e.value?H({oldValue:r,dateComponent:a.date,timeComponent:a.time,timeZone:t,max:n.max,min:n.min}):null,null!==l&&e.value?r!==l&&this._updateFieldValue(s,l):this._updateFieldValue(s,null)}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e),i=this._parseValue(e),o=t.value;t.isSubtypeField&&A(this.layer,o,i)?this._pendingSubtypeChoice||i===o||(this._pendingSubtypeChoice=this._handleSubtypeChoice(t,i)):this._updateFieldValue(t.name,i)}async _handleSubtypeChoice(e,i){const{value:o,name:s}=e,{messages:a,viewModel:r,messagesCommon:l,_subtypes:d}=this;if(this._updateFieldValue(s,i),!d?.length)return;const c=d.find(e=>e.code===i),u=d.find(e=>e.code===o)?.name??`${o}`;if(!c)return;const p=n();r.pendingSubtypeChoice=p;let m="update-fields";const h=[{label:a.subtypes.useDefaultValuesOption,value:"update-fields"},{label:a.subtypes.keepCurrentValuesOption,value:"keep-existing"}],v={context:"info",title:a.subtypes.changeWarningTitle,message:t(a.subtypes.changeWarning,{originalType:u,newType:c.name}),radios:h,defaultRadioSelection:"update-fields",onRadioSelection:e=>m=e,actions:{primary:{label:l.apply,action:()=>p.resolve(m),type:"positive"},secondary:{label:l.cancel,type:"neutral",action:()=>p.resolve("undo")}},cancel:()=>p.reject()};try{this.showPrompt(v);switch(await p.promise){case"update-fields":r.applySubtypeDefaults(c),this._validateContingenciesForNonNullFields();break;case"keep-existing":this._validateContingenciesForNonNullFields();break;case"undo":this._updateFieldValue(e.name,o)}}finally{r.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&I(i)&&!i.group.open&&(i.group.open=!0)}_updateFieldValue(e,t){const i=this.viewModel.getValue(e);this.viewModel.setValue(e,t),this._inputsWithChanges.add(e);i!==t&&this.viewModel.fieldsWithContingentValues.has(e)&&this._validateContingenciesForNonNullFields()}_validateContingenciesForNonNullFields(){const e=Object.fromEntries(Object.entries(this.getValues()).filter(([e,t])=>null!=t));this.viewModel.validateContingencyConstraints(e)}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;return O(t.element,"switch")?e.checked?t.element.input.onValue:t.element.input.offValue:null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:i}=e;0===i.length&&t&&"selected"in t?t.selected=!0:s.getLogger(this).warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,this._attemptFocusOnNextRender=!0,"sequential"===this.groupDisplay&&this.viewModel.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.allGroupInputs;if(!e.length)return;const t=e.filter(e=>e.open);0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach(e=>e.open=!1)}get test(){return{inputsWithChanges:this._inputsWithChanges,updateValue:this._saveValueFromComponent.bind(this)}}};e([c()],X.prototype,"_listObserverNode",void 0),e([c()],X.prototype,"_relatedRecordsEnabled",null),e([c()],X.prototype,"_utilityNetworkAssociationsEnabled",null),e([c()],X.prototype,"_prompt",void 0),e([c()],X.prototype,"_subtypes",null),e([c()],X.prototype,"associationId",null),e([c()],X.prototype,"associatedLayer",null),e([c()],X.prototype,"disabled",null),e([c()],X.prototype,"feature",null),e([c()],X.prototype,"_featureFormUNAssociationList",void 0),e([c()],X.prototype,"formTemplate",null),e([c()],X.prototype,"groupDisplay",void 0),e([c()],X.prototype,"headingLevel",void 0),e([c()],X.prototype,"icon",null),e([c()],X.prototype,"label",null),e([c()],X.prototype,"layer",null),e([c()],X.prototype,"map",null),e([c(),K("esri/widgets/FeatureForm/t9n/FeatureForm")],X.prototype,"messages",void 0),e([c(),K("esri/t9n/common")],X.prototype,"messagesCommon",void 0),e([c(),K("esri/widgets/Feature/t9n/Feature")],X.prototype,"messagesFeature",void 0),e([c(),K("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],X.prototype,"messagesTemplates",void 0),e([c()],X.prototype,"callbacks",null),e([c()],X.prototype,"relationshipId",null),e([c()],X.prototype,"spatialReference",null),e([c()],X.prototype,"strict",null),e([c()],X.prototype,"timeZone",null),e([c()],X.prototype,"showPrompt",null),e([c()],X.prototype,"clearPrompt",null),e([c({type:x}),q(["value-change","submit"])],X.prototype,"viewModel",void 0),e([c({type:D,nonNullable:!0})],X.prototype,"visibleElements",void 0),e([c()],X.prototype,"test",null),X=e([u("esri.widgets.FeatureForm")],X);const Y=X;export{Y as default};