@arcgis/core 5.1.0-next.114 → 5.1.0-next.115

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 (294) hide show
  1. package/Map.js +1 -1
  2. package/analysis/ShadowCast/MinDurationOptions.d.ts +3 -5
  3. package/analysis/ShadowCastAnalysis.d.ts +1 -1
  4. package/arcgisGlobal.d.ts +4 -0
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/05c47ca3a266a271974b.js +1 -0
  7. package/assets/esri/core/workers/chunks/{29bbc0d6d847b065d10e.js → 062aadf426fe97a76bbb.js} +1 -1
  8. package/assets/esri/core/workers/chunks/0954e82f739d25001bcb.js +1 -0
  9. package/assets/esri/core/workers/chunks/0aaee272520c6e5bb617.js +1 -0
  10. package/assets/esri/core/workers/chunks/{12053c1213465d07d2f6.js → 0b445c1cf281f158c1f1.js} +1 -1
  11. package/assets/esri/core/workers/chunks/102ff3710db4ba5f083d.js +1 -0
  12. package/assets/esri/core/workers/chunks/163ce1be8bfe20e77f97.js +1 -0
  13. package/assets/esri/core/workers/chunks/{e87d02af6d6b05e19d93.js → 16713986893adfbc9331.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{9bd713d96502ddc2ce25.js → 1765042635084f75d2b3.js} +1 -1
  15. package/assets/esri/core/workers/chunks/185c670eb99474906836.js +1 -0
  16. package/assets/esri/core/workers/chunks/18ebf1d3ed05c8057f7d.js +1 -0
  17. package/assets/esri/core/workers/chunks/1da2c34743897d1b6a24.js +1 -0
  18. package/assets/esri/core/workers/chunks/22d4521637806a8b828f.js +1 -0
  19. package/assets/esri/core/workers/chunks/233ff588798c8a5eedf4.js +1 -0
  20. package/assets/esri/core/workers/chunks/24d9e4f1c7b8ff0d2cce.js +1 -0
  21. package/assets/esri/core/workers/chunks/2562d8905bd05ef6fd07.js +1 -0
  22. package/assets/esri/core/workers/chunks/{e5d969214d9eda5c0b4c.js → 2a5dbed88bbd96cfac9f.js} +1 -1
  23. package/assets/esri/core/workers/chunks/2bcd4d395bfe6a19ccc8.js +1 -0
  24. package/assets/esri/core/workers/chunks/3192586ec7fc73ed1165.js +1 -0
  25. package/assets/esri/core/workers/chunks/38ca59db0e8f45bd7811.js +1 -0
  26. package/assets/esri/core/workers/chunks/3b10a962e4ff2f3da5bc.js +1 -0
  27. package/assets/esri/core/workers/chunks/3e9709e61015993b1c7d.js +1 -0
  28. package/assets/esri/core/workers/chunks/425c04b26a6ec6d04b08.js +1 -0
  29. package/assets/esri/core/workers/chunks/4364a3e706294bb6ae41.js +1 -0
  30. package/assets/esri/core/workers/chunks/44e52fe98ffafe6a2807.js +1 -0
  31. package/assets/esri/core/workers/chunks/4cecc582513b8a83f194.js +1 -0
  32. package/assets/esri/core/workers/chunks/5022413f5a41b5d435ea.js +1 -0
  33. package/assets/esri/core/workers/chunks/{8ade869fa9bae446266a.js → 51816d79c6be15e4bfcf.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{cf9b0ba30a75c030ca92.js → 5524a71d1abc9568ce26.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{ba31616de9d73d83d867.js → 557e39e5156b313597f9.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{5ef37f37e405b3bb5450.js → 59dafa1e1340ea4043e6.js} +1 -1
  37. package/assets/esri/core/workers/chunks/624b1bb269744142b835.js +1 -0
  38. package/assets/esri/core/workers/chunks/{39987c06636e757d1f00.js → 62b5972d0ef9bf173308.js} +1 -1
  39. package/assets/esri/core/workers/chunks/641b8622fbb93c84671d.js +1 -0
  40. package/assets/esri/core/workers/chunks/643c7506f8fe8e06acd2.js +1 -0
  41. package/assets/esri/core/workers/chunks/65f02eca694cc1c9f5a7.js +1 -0
  42. package/assets/esri/core/workers/chunks/6d696beddcc5fbed5875.js +1 -0
  43. package/assets/esri/core/workers/chunks/728ad5bbbcbf88d6249f.js +1 -0
  44. package/assets/esri/core/workers/chunks/{0d2bc1be5802681666a4.js → 77859a61d059738d057f.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{03a4543b94f9adeb1852.js → 7a3b05e25de2ff150f38.js} +1 -1
  46. package/assets/esri/core/workers/chunks/7bbffe07e62897928773.js +1 -0
  47. package/assets/esri/core/workers/chunks/{14a241b07baa67743248.js → 7c292f7b181f3b93352b.js} +1 -1
  48. package/assets/esri/core/workers/chunks/7c2d7df4ef4d775cd648.js +1 -0
  49. package/assets/esri/core/workers/chunks/{6d20d741b8ae1a45b422.js → 7dc2c21d61ba66a3f461.js} +1 -1
  50. package/assets/esri/core/workers/chunks/7df05c3c82cd27b77300.js +1 -0
  51. package/assets/esri/core/workers/chunks/7eb94fc75926bc739233.js +1 -0
  52. package/assets/esri/core/workers/chunks/8461f50e9875db4ccfec.js +1 -0
  53. package/assets/esri/core/workers/chunks/{71e12db99589c98a4357.js → 8477b5fdd99c6ac5c27b.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{be1e4c3ec53fc92a26f1.js → 8598997340682113a2a5.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{548c34ea88f113d03c93.js → 86229634bf008f53dad4.js} +1 -1
  56. package/assets/esri/core/workers/chunks/86443e47ad99e555753a.js +1 -0
  57. package/assets/esri/core/workers/chunks/87a40e7f79f97ca637a9.js +1 -0
  58. package/assets/esri/core/workers/chunks/{27d6ad4ca5ab8c9d62cd.js → 8c443c52c846a096a250.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{86161025b53b916328ff.js → 8ca88cfc0b9f84dc5832.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{340f2c996f62f7f5ceae.js → 8e7ce4835b3106349684.js} +1 -1
  61. package/assets/esri/core/workers/chunks/90b0fe5584fb6fc99766.js +1 -0
  62. package/assets/esri/core/workers/chunks/9133c1b7cc1c9da27deb.js +1 -0
  63. package/assets/esri/core/workers/chunks/{d4749eb8a47869477037.js → 9250615c78f8570a9cda.js} +1 -1
  64. package/assets/esri/core/workers/chunks/92a7735973b2f82a66ce.js +1 -0
  65. package/assets/esri/core/workers/chunks/94a5a834e32fc6cc6ed4.js +1 -0
  66. package/assets/esri/core/workers/chunks/986d8c3907aeeb18c4f6.js +1 -0
  67. package/assets/esri/core/workers/chunks/98e489c2b85feded7776.js +1 -0
  68. package/assets/esri/core/workers/chunks/{271e42b7cd3c3441839e.js → 9eab1e1535494ff2050d.js} +10 -22
  69. package/assets/esri/core/workers/chunks/{466c250537415f12eb59.js → a01f0ffbe555f690bdca.js} +1 -1
  70. package/assets/esri/core/workers/chunks/a03c4c0bf138734a002e.js +1 -0
  71. package/assets/esri/core/workers/chunks/a814069325125466506b.js +1 -0
  72. package/assets/esri/core/workers/chunks/{e4b2120d7ee1c998b1fc.js → aa03f770178693167aa0.js} +1 -1
  73. package/assets/esri/core/workers/chunks/aea439d4c2308f88b295.js +1 -0
  74. package/assets/esri/core/workers/chunks/{7995e6983456c779adf9.js → b002304a45856b024b46.js} +1 -1
  75. package/assets/esri/core/workers/chunks/b0c242c4f5412e4cce73.js +1 -0
  76. package/assets/esri/core/workers/chunks/b44f1d08784f2e50c853.js +1 -0
  77. package/assets/esri/core/workers/chunks/c1b6de0d728d25d7905a.js +1 -0
  78. package/assets/esri/core/workers/chunks/{f8b884b529064df4a30a.js → caf80facb0322be054ab.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{25d795a1697803d77e56.js → ce0e627a5e1cb78adce8.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{63378b0b4265a547656b.js → d8ec0afb2b91ccf32e55.js} +1 -1
  81. package/assets/esri/core/workers/chunks/d97c0c18202b8c578f8c.js +1 -0
  82. package/assets/esri/core/workers/chunks/{2f99a95facddc44319a9.js → da3c54e27a808f4fcc18.js} +1 -1
  83. package/assets/esri/core/workers/chunks/db012650fb34c10cecd0.js +1 -0
  84. package/assets/esri/core/workers/chunks/dc6d50e1097a920ff820.js +1 -0
  85. package/assets/esri/core/workers/chunks/dce37324a2382d2eef0d.js +1 -0
  86. package/assets/esri/core/workers/chunks/e0bd550b10dd402c48f1.js +1 -0
  87. package/assets/esri/core/workers/chunks/e2ba57f7119b7182ba02.js +279 -0
  88. package/assets/esri/core/workers/chunks/e755477dc78e9d6038d4.js +1 -0
  89. package/assets/esri/core/workers/chunks/ea4057090cf15d602585.js +1 -0
  90. package/assets/esri/core/workers/chunks/ea8f642b1db933d2c26f.js +1 -0
  91. package/assets/esri/core/workers/chunks/eabd4a78221b7e733793.js +1 -0
  92. package/assets/esri/core/workers/chunks/eb16976b4eb7f1300f4a.js +1 -0
  93. package/assets/esri/core/workers/chunks/efae58f746b108163a50.js +1 -0
  94. package/assets/esri/core/workers/chunks/f231548c8ac7ecb59927.js +1 -0
  95. package/assets/esri/core/workers/chunks/fe2325efd0d8ad8369ed.js +1 -0
  96. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +26 -3
  97. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +4 -13
  98. package/assets/esri/themes/dark/main.css +1 -1
  99. package/assets/esri/themes/light/main.css +1 -1
  100. package/assets/esri/themes/light/view.css +1 -1
  101. package/chunks/GlobalIllumination.glsl.js +22 -34
  102. package/config.js +1 -1
  103. package/core/screenUtils.js +1 -1
  104. package/core/typedArrayUtil.js +1 -1
  105. package/editing/templates/TemplateListing.d.ts +32 -0
  106. package/editing/templates/TemplateListing.js +2 -0
  107. package/geometry/support/buffer/BufferView.js +1 -1
  108. package/geometry/support/heightModelInfoUtils.js +1 -1
  109. package/interfaces.d.ts +14 -0
  110. package/kernel.js +1 -1
  111. package/layers/AnnotationLayer.d.ts +42 -0
  112. package/layers/AnnotationLayer.js +2 -0
  113. package/layers/DimensionFeatureLayer.d.ts +36 -1
  114. package/layers/DimensionFeatureLayer.js +1 -1
  115. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  116. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  117. package/layers/types.d.ts +1 -1
  118. package/networks/support/networkFieldUtils.js +1 -1
  119. package/package.json +1 -1
  120. package/rest/support/OutDistance.js +1 -1
  121. package/rest/support/Query.js +1 -1
  122. package/support/basemapEnsureType.js +1 -1
  123. package/support/revision.js +1 -1
  124. package/symbols/cim/CIMOperators.js +1 -1
  125. package/symbols/cim/CIMSymbolHelper.js +1 -1
  126. package/symbols/cim/utils.js +1 -1
  127. package/views/2d/engine/webgl/mesh/factories/FeatureMeshFactory.js +1 -1
  128. package/views/2d/engine/webgl/mesh/factories/ResourceProxy.js +1 -1
  129. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  130. package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
  131. package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
  132. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  133. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
  134. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  135. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ViewInfo.js +1 -1
  136. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  137. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  138. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  139. package/views/2d/engine/webgl/util/AnnotationMatcher.js +2 -0
  140. package/views/2d/engine/webgl/util/DimensionMatcher.js +2 -0
  141. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  142. package/views/2d/engine/webgl/util/createMatcher.js +1 -1
  143. package/views/2d/layerViewModuleImportUtils.js +1 -1
  144. package/views/2d/layers/AnnotationLayerView2D.js +2 -0
  145. package/views/2d/layers/{DimensionLayerView2D.js → DimensionFeatureLayerView2D.js} +1 -1
  146. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  147. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  148. package/views/2d/layers/RouteLayerView2D.js +1 -1
  149. package/views/2d/layers/TileLayerView2D.js +1 -1
  150. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  151. package/views/2d/layers/features/FeatureContainer.js +1 -1
  152. package/views/2d/layers/features/Processor.js +1 -1
  153. package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +2 -0
  154. package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
  155. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  156. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  157. package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
  158. package/views/2d/layers/features/support/FeatureSetReaderAnnotationJSON.js +2 -0
  159. package/views/2d/layers/features/support/FeatureSetReaderDimensionJSON.js +2 -0
  160. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  161. package/views/2d/layers/support/annodime/DimensionInfo.js +2 -0
  162. package/views/2d/layers/support/annodime/DimensionMatcherSchema.js +2 -0
  163. package/views/2d/layers/support/annodime/PrivateDimensionEffect.js +2 -0
  164. package/views/2d/layers/support/annodime/PrivatePlacementMultipoint.js +2 -0
  165. package/views/2d/layers/support/annodime/annotationGraphic.js +2 -0
  166. package/views/2d/layers/support/annodime/annotationSchema.js +2 -0
  167. package/views/2d/layers/support/annodime/annotationUtils.js +2 -0
  168. package/views/2d/layers/support/annodime/cimAnnotations.js +2 -0
  169. package/views/2d/layers/support/annodime/dimensionSchema.js +2 -0
  170. package/views/2d/layers/support/annodime/dimensionSymbols.js +2 -0
  171. package/views/2d/layers/support/annodime/dimensionUtils.js +2 -0
  172. package/views/2d/layers/support/annodime/fields.js +2 -0
  173. package/views/2d/layers/support/annodime/unsupported.js +2 -0
  174. package/views/2d/layers/support/annodime/utils.js +2 -0
  175. package/views/2d/layers/support/annodime/virtualFields.js +2 -0
  176. package/views/2d/support/clippingUtils.js +1 -1
  177. package/views/2d/support/hitTestUtils.js +1 -1
  178. package/views/2d/types.d.ts +5 -1
  179. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  180. package/views/3d/layerViewModuleImportUtils.js +1 -1
  181. package/views/3d/layers/MapImageLayerView3D.js +1 -1
  182. package/views/3d/layers/TileLayerView3D.js +1 -1
  183. package/views/3d/terrain/isTerrainSurfaceLayer.js +1 -1
  184. package/views/3d/types.d.ts +2 -0
  185. package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
  186. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  187. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +8 -8
  188. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathEvaluate.glsl.js +53 -61
  189. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +23 -32
  190. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  191. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  192. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  193. package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
  194. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  195. package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
  196. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  197. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  198. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
  199. package/views/3d/webgl-engine/materials/PathLayouts.js +1 -1
  200. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  201. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  202. package/views/3d/webgl-engine/shaders/ditherNoise.glsl.js +18 -1
  203. package/views/PopupView.d.ts +3 -3
  204. package/views/PopupView.js +1 -1
  205. package/views/SceneView.js +1 -1
  206. package/views/View2D.js +1 -1
  207. package/views/layers/AnnotationLayerView.d.ts +18 -0
  208. package/views/layers/AnnotationLayerView.js +2 -0
  209. package/views/layers/DimensionFeatureLayerView.d.ts +18 -0
  210. package/views/layers/DimensionFeatureLayerView.js +2 -0
  211. package/views/layers/FeatureLikeLayerView.d.ts +2 -1
  212. package/views/layers/FeatureLikeLayerView.js +1 -1
  213. package/views/layers/ImageryLayerView.js +1 -1
  214. package/views/layers/ImageryTileLayerView.js +1 -1
  215. package/views/layers/WMSLayerView.js +1 -1
  216. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  217. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  218. package/widgets/BatchAttributeForm/css.js +1 -1
  219. package/widgets/BatchAttributeForm/rendered-content/RelationshipDetails.js +2 -0
  220. package/widgets/BatchAttributeForm.js +1 -1
  221. package/widgets/FeatureForm.js +1 -1
  222. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  223. package/widgets/OrientedImageryViewer/css.js +1 -1
  224. package/widgets/OrientedImageryViewer.js +1 -1
  225. package/widgets/support/iconUtils.js +1 -1
  226. package/assets/esri/core/workers/chunks/0175098da590a7109539.js +0 -1
  227. package/assets/esri/core/workers/chunks/019a4fe7e085b2fc6ae9.js +0 -1
  228. package/assets/esri/core/workers/chunks/023837e5d9d2b6af66d8.js +0 -1
  229. package/assets/esri/core/workers/chunks/03c46880b69ce75a010f.js +0 -1
  230. package/assets/esri/core/workers/chunks/040884cec4b84dd1bb17.js +0 -1
  231. package/assets/esri/core/workers/chunks/04ea806b933d4dd41609.js +0 -1
  232. package/assets/esri/core/workers/chunks/0e549d942d6cba1608cf.js +0 -1
  233. package/assets/esri/core/workers/chunks/13a8346abe5509167578.js +0 -1
  234. package/assets/esri/core/workers/chunks/13d43a0683c42b94feb6.js +0 -1
  235. package/assets/esri/core/workers/chunks/179ffa2168c42615ccf2.js +0 -1
  236. package/assets/esri/core/workers/chunks/1ebb613bbe09fcf274d8.js +0 -1
  237. package/assets/esri/core/workers/chunks/27d7c701306efeea6b82.js +0 -1
  238. package/assets/esri/core/workers/chunks/2b9661700743d1f9717e.js +0 -1
  239. package/assets/esri/core/workers/chunks/2bdfae998371e3aa9f2d.js +0 -1
  240. package/assets/esri/core/workers/chunks/2f0a3b22fc46d832e240.js +0 -1
  241. package/assets/esri/core/workers/chunks/3835097520296b0517af.js +0 -1
  242. package/assets/esri/core/workers/chunks/4605a68e40c5c3ac6e3e.js +0 -1
  243. package/assets/esri/core/workers/chunks/4b130db9b7b4e2e32ea4.js +0 -1
  244. package/assets/esri/core/workers/chunks/4bfeac7338df9e0b7ce1.js +0 -1
  245. package/assets/esri/core/workers/chunks/4c5cdd2712c938fafc5d.js +0 -1
  246. package/assets/esri/core/workers/chunks/4fa3840672c33adb9171.js +0 -1
  247. package/assets/esri/core/workers/chunks/4ffcca40e7aa24c8cc35.js +0 -1
  248. package/assets/esri/core/workers/chunks/534dd93c72ea448ee908.js +0 -1
  249. package/assets/esri/core/workers/chunks/5ea0096a282e87a269bd.js +0 -1
  250. package/assets/esri/core/workers/chunks/66fe1634c6e8f72fc653.js +0 -1
  251. package/assets/esri/core/workers/chunks/6920e7f700a9ba280dba.js +0 -1
  252. package/assets/esri/core/workers/chunks/6b1f2b36bdc6b2ff2ea5.js +0 -1
  253. package/assets/esri/core/workers/chunks/6b66a6f69aa03338c346.js +0 -1
  254. package/assets/esri/core/workers/chunks/6d59a9cf533ebc590f70.js +0 -1
  255. package/assets/esri/core/workers/chunks/75dfdd85abbac26ac899.js +0 -1
  256. package/assets/esri/core/workers/chunks/798c4d3201fcc9f2a42b.js +0 -1
  257. package/assets/esri/core/workers/chunks/817fd88fe9a48caf69fb.js +0 -1
  258. package/assets/esri/core/workers/chunks/825db2ea15308ee6e5dc.js +0 -1
  259. package/assets/esri/core/workers/chunks/82f7d83a2073d1b0111c.js +0 -1
  260. package/assets/esri/core/workers/chunks/89250d268dc2554a9ece.js +0 -1
  261. package/assets/esri/core/workers/chunks/8c8fed53c12fb80ef2ed.js +0 -1
  262. package/assets/esri/core/workers/chunks/8ff83c59462dea6e3427.js +0 -1
  263. package/assets/esri/core/workers/chunks/961995d8da45a9203255.js +0 -1
  264. package/assets/esri/core/workers/chunks/a9c9c00432ee41ec91ba.js +0 -1
  265. package/assets/esri/core/workers/chunks/af762422a65c551dcd54.js +0 -1
  266. package/assets/esri/core/workers/chunks/b041c22885193bdd3004.js +0 -1
  267. package/assets/esri/core/workers/chunks/b3e8ab68fc38306f13c6.js +0 -1
  268. package/assets/esri/core/workers/chunks/b684ff4bc93bd60d6a19.js +0 -1
  269. package/assets/esri/core/workers/chunks/bb2f6b0fcdfb8b158e26.js +0 -1
  270. package/assets/esri/core/workers/chunks/c5ab346a226df1894302.js +0 -1
  271. package/assets/esri/core/workers/chunks/cd2b2babcdc130b4c368.js +0 -1
  272. package/assets/esri/core/workers/chunks/cedf3e316d6f89cf7005.js +0 -1
  273. package/assets/esri/core/workers/chunks/d39f5590022d910ee951.js +0 -1
  274. package/assets/esri/core/workers/chunks/d412a43060441d347fb4.js +0 -1
  275. package/assets/esri/core/workers/chunks/d41b847d08c42e5329d6.js +0 -262
  276. package/assets/esri/core/workers/chunks/d52172439db02a349542.js +0 -1
  277. package/assets/esri/core/workers/chunks/d8c2bed12f937228c763.js +0 -1
  278. package/assets/esri/core/workers/chunks/de916dd0c11aefb6832e.js +0 -1
  279. package/assets/esri/core/workers/chunks/ecf4d07917efc97eb991.js +0 -1
  280. package/assets/esri/core/workers/chunks/eda51e512eff551ad858.js +0 -1
  281. package/assets/esri/core/workers/chunks/f14e3693cd644265f909.js +0 -1
  282. package/assets/esri/core/workers/chunks/f52c6efc5a2abf5ac845.js +0 -1
  283. package/assets/esri/core/workers/chunks/f635a8e3b0bfeda99ed5.js +0 -1
  284. package/assets/esri/core/workers/chunks/f9f331c76c96743d8522.js +0 -1
  285. package/assets/esri/core/workers/chunks/fcbacca99c5a3ee5b69a.js +0 -1
  286. package/symbols/dimensions/effects/LinearDimensionArrowEffect.js +0 -2
  287. package/symbols/dimensions/effects/LinearDimensionExtensionLineEffect.js +0 -2
  288. package/symbols/dimensions/effects/LinearDimensionLeaderLineEffect.js +0 -2
  289. package/symbols/dimensions/effects/LinearDimensionLineEffect.js +0 -2
  290. package/symbols/dimensions/effects/LinearDimensionPointEffect.js +0 -2
  291. package/symbols/dimensions/effects/LinearDimensionTextEffect.js +0 -2
  292. package/views/2d/layers/features/support/FeatureSetReaderDimension.js +0 -2
  293. package/views/3d/webgl-engine/effects/globalIllumination/BlueNoise.js +0 -2
  294. package/views/layers/support/dimensionUtils.js +0 -2
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{formatNumber as e}from"../../../intl/number.js";import{substitute as t}from"../../../intl/substitute.js";import{css as i}from"../css.js";import{loadCalciteComponents as n}from"../../support/componentsUtils.js";import{getIconForFeature as o}from"../../support/iconUtils.js";import{tsx as l,classes as s}from"../../support/widget.js";const c=()=>n({chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),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")});function a(e){const{input:t}=e,{template:n}=t;return l("div",{class:i.relationshipElementInput,"data-testid":`relationship-element-${n.elementId}`,key:`relationship-${t.relationshipId}-container`},r(t,e.messagesCommon),d(t),p(e))}function r(e,t){const n=e.updating||!e.loaded;return l("div",{class:i.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},l("span",null,e.label),n?l("calcite-loader",{inline:!0,key:"loader",label:t?.loading,scale:"s",type:"indeterminate"}):void 0)}function d(e){const{activeCategory:t,description:n}=e;if(!t&&n)return l("calcite-input-message",{class:s(i.description,i.relatedRecordsDescription)},n)}function p(e){const{input:t,messages:i}=e,{activeCategory:n,relatedFeatureCount:o}=t;return o>0?u(e):n&&!o?R(e.messages):t.allCategories?.length?f(e):t.loaded?t.originHasValidKey?R(i):v(e):void 0}function u(e){const{viewModel:t,input:n,messages:o}=e,s=!n.editable||t.readOnly;return l("calcite-list",{class:i.relatedRecordsList,label:o.relatedRecords.relatedRecordsTitle},n.relatedFeatureInfos.map(t=>m(t,s,e)),g(e))}function m(e,t,i){const{feature:n,description:s,title:c}=e,{viewModel:a,input:r}=i,{relationshipId:d,single:p}=r,{feature:u}=p,m=()=>{u&&a.callbacks?.editRelatedRecord?.({parentFeature:u,readOnly:t,relatedFeature:n,relationshipId:d})};return l("calcite-list-item",{description:s,key:`${d}-${n.uid}`,label:c,value:c,onCalciteListItemSelect:m},l("calcite-icon",{icon:o(n),slot:"content-start"}),l("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}function g(e){const{input:i,messages:n}=e;if(i.showAllActionVisible)return l("calcite-list-item",{description:t(n.totalCount,{count:i.relatedFeatureCount}),key:"show-all-related-features",label:n.showAll,value:!0,onCalciteListItemSelect:()=>{console.debug("should show all here")}},l("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}function f(e){const{input:t,messages:i}=e;return l("calcite-list",{displayMode:"flat",label:i.relatedRecords.relatedRecordsTitle,loading:t.updating},t.categories?.map(e=>h(t,e)),b(e))}function h(t,i){const{count:n,name:o,value:s}=i,c=e(n);return l("calcite-list-item",{key:`${o}-${s}`,label:o,onCalciteListItemSelect:()=>y(t,i)},l("calcite-chip",{label:c,scale:"s",slot:"content-end"},c),l("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}function y(e,t){e.setActiveCategory(t)}function b(e){const{input:i,messages:n}=e;if(i.showAllCategoriesVisible)return l("calcite-list-item",{description:t(n.totalCount,{count:i.allCategories?.length??0}),key:"show-all-categories",label:n.showAll,value:!0,onCalciteListItemSelect:()=>i.setShowAllEnabled(!0)},l("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}function v(e){const{viewModel:i,input:n,messages:o}=e,l=n.relatedLayerIsTable?o.relatedRecords.noOriginKeyRecord:o.relatedRecords.noOriginKeyFeature,s=n.relationship?.keyField,c=i.findFieldInput(s),a=n.layer?.fieldsIndex.get(s),r=c?.label||a?.alias||s;return C(t(l,{relatedLayerName:n.relatedLayer?.title??o.relatedRecords.untitledLayer,originKeyField:r}))}function R(e){return C(e.relatedRecords.noRecordsFound)}function C(e){return l("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},l("div",{slot:"message"},e))}export{a as RelationshipDetails,c as loadRelationshipDetailsComponents};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as a}from"../core/deprecate.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{watch as l,when as s,on as o}from"../core/reactiveUtils.js";import{formatFileSize as r}from"../core/unitFormatUtils.js";import{property as c,subclass as d}from"../core/accessorSupport/decorators.js";import{isIntegerField as m}from"../layers/support/fieldUtils.js";import{isString as h}from"../support/guards.js";import u from"./Widget.js";import{getAttachmentTypeCategory as p,getCalciteIconForAttachment as g}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as v,isImageAttachment as f}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as b,getVisibleFieldInputValidationErrorMessage as C,isElementTemplateWithInputType as _}from"./BatchAttributeForm/batchAttributeFormUtils.js";import A from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as y}from"./BatchAttributeForm/css.js";import{makeAddAttachmentFooterButtons as I,makeDiscardAttachmentFooterButtons as F,makeReplaceAttachmentFooterButtons as w,makeViewingAttachmentFooterButtons as k,makeDefaultFooterButtons as x}from"./BatchAttributeForm/interfaceUtils.js";import D from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as M,isFieldInput as S,isTextElementInput as E,isRelationshipElementInput as O,isAttachmentElementInput as T,isUtilityNetworkAssociationsElementInput as V,differentValuesString as L}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as R,getMultipleChoiceCheckboxState as P,otherChoiceCheckedPlaceholderValue as U,getUpdatedMultipleChoiceValueForFeature as N,getMultipleChoiceSelectAllState as B,splitMultipleChoiceValue as $,canRestoreMultipleChoiceOtherChoiceDraftValue as j}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{downloadAttachmentInfo as z}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as H}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as Z,getIntlOptionsForField as q,prepareISOFieldValueForDateComponents as G,prepareUnixFieldValueForDateComponents as W,normalizeTimeOnlyString as K,getISOFieldValueFromDateComponents as X,getUnixFieldValueFromDateComponents as J}from"./support/dateUtils.js";import{globalCss as Q}from"./support/globalCss.js";import{calciteListFilterProps as Y}from"./support/listUtils.js";import{messageBundle as ee,vmEvent as te,tsx as ae}from"./support/widget.js";import{setFocus as ie}from"./support/widgetUtils.js";import{isEmptyValue as ne}from"./support/forms/formUtils.js";const le="data-element-id",se="esri_BatchAttributeForm_select_all",oe="esri_BatchAttributeForm_other_choice";let re=class extends u{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.messagesUnits=null,this.viewModel=new A,this.visibleElements=new D,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._attachmentDialogInfo=null,this._attachmentListFilterText="",this._attachmentFileInputMap=new Map,this._selectedAttachmentReplaceFileInput=null,this._maximizeSelectedAttachment=()=>{this._attachmentDialogInfo=this.selectedAttachmentDetails},this._enterAttachmentReplaceView=()=>{this.readOnly||this.effectiveDisabled||!this.selectedAttachmentDetails||this.viewModel.setShowingSelectedAttachmentReplacePage(!0)},this._setSelectedAttachmentReplaceFileInput=e=>{this._selectedAttachmentReplaceFileInput=e},this._openSelectedAttachmentReplaceFilePicker=()=>{this.readOnly||this.effectiveDisabled||this._selectedAttachmentReplaceFileInput?.click()},this._resetSelectedAttachmentName=()=>{const e=this.selectedAttachmentDetails,t=e?.attachment.globalId,a=e?e.input.getAttachmentEditState(e.attachment).initialName:null;e&&t&&null!=a&&this.viewModel.stageRenameAttachment(e.input.template.elementId,t,a)},this._resetSelectedAttachmentChanges=()=>{const e=this.selectedAttachmentDetails,t=e?.attachment.globalId;e&&t&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,t)},this._deleteSelectedAttachment=()=>{const e=this.selectedAttachmentDetails,t=e?.attachment.globalId;e&&t&&!this._isSelectedAttachmentDeleteDisabled()&&(this.viewModel.stageDeleteAttachment(e.input.template.elementId,t),this._setSelectedAttachment(null))},this._closeAttachmentDialog=()=>{this.hideAttachmentDialog()},this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{a(i.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...a}=e;return a}initialize(){this.addHandles([l(()=>this.features,()=>{this._dateComponentMap.clear(),this._resetTransientFormState(),R(this.viewModel,{includeDraftValues:!0})}),l(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),R(this.viewModel)}),l(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),s(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),l(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),o(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()})])}loadDependencies(){return H({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),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"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),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-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"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get effectiveTitle(){const{features:e,messages:t,page:a}=this;return"replacing-attachment"===a?t.titles.replaceAttachment:"viewing-attachment-details"===a?t.titles.editAttachment:"adding-attachments"===a?t.titles.addAttachments:"viewing-attachments"===a?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:""}get effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get footerButtonInfos(){if(!this.features.length)return[];const{page:e,messages:t}=this,a=this.viewModel.selectedAttachmentAddElementId,i=this.selectedAttachmentDetails,n=i?i.input.getAttachmentEditState(i.attachment):null;if("adding-attachments"===e&&a)return I({messages:t,onclick:()=>this._attachmentFileInputMap.get(a)?.click()});return!!i&&"replacing-attachment"!==e&&!!n?.isReplaced?F({message:this.messagesCommon.remove,onclick:this._resetSelectedAttachmentChanges}):"replacing-attachment"===e?w({disabled:this.readOnly||this.effectiveDisabled,messages:t,onclick:this._openSelectedAttachmentReplaceFilePicker}):"viewing-attachment-details"===e?k({deleteDisabled:this._isSelectedAttachmentDeleteDisabled(),deleteOnclick:this._deleteSelectedAttachment,doneOnclick:()=>this._setSelectedAttachment(null),messages:t.footerButtons}):"viewing-attachments"===e?[]:x({formId:this._formId,callback:this.submit,messages:t})}get footerNoticeInfos(){if(!this.features.length)return[];const{messages:{footerNotices:e}}=this;return this._isSelectedAttachmentDeleteDisabled()?[{icon:"information",message:e.deleteDisabledMinimumAttachments}]:[]}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get page(){return this.viewModel.page}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get selectedAttachment(){return this.viewModel.selectedAttachment}get selectedAttachmentDetails(){return this.viewModel.selectedAttachmentDetails}get valid(){return this.viewModel.valid}get _associationsEnabled(){const{callbacks:e}=this;return!(!e?.addAssociation||!e.selectAssociatedFeature)}get _formId(){return`${this.id}-form`}async goBack(){return this.viewModel.goBack()}async goHome(){return this.viewModel.goHome()}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){return ae("div",{class:this.classes(y.base,Q.widget,Q.panel)},this._renderContent(),this._renderAttachmentDialog())}submit(){return this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:a}=e.dataset,i=n(this._dateComponentMap,`${a}`,()=>({}));switch(t){case"date":i.date=e;break;case"time":i.time=e;break;case"timeZone":i.timeZone=e}}_renderContent(){const{messages:e,viewModel:a}=this,{status:i}=a;return"failed"===i?a.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:a.maximumFeatureCountWithComplexForms})):a.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:a.maximumFeatureCount})):e.formFailedToLoad:a.expressionEvaluationFailed?this._renderErrorNotice(e.expressionEvaluationFailed):a.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===i&&this.visibleElements.loadingIndicator?ae("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return ae("calcite-notice",{class:y.noticeError,icon:!0,kind:t,open:!0},ae("div",{slot:"message"},e))}_renderForm(){return ae("form",{class:y.form,id:this._formId,onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderPage())}_renderPage(){switch(this.page){case"adding-attachments":return this._renderAttachmentAddPage();case"replacing-attachment":case"viewing-attachments":return this._renderAttachmentListPage();case"viewing-attachment-details":return this._renderAttachmentDetailPage();default:return this._renderFormContent()}}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:a}=e;let i;if(!e.submitHasBeenAttempted)return null;if(a.invalidHiddenInputs.length>0)if(i=b(a,e.mode,this.messages),"batch"===this.viewModel.mode){const e=a.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?i+=` (${e.map(e=>e.label).join(", ")})`:i=null}else i+=` (${a.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return i?this._renderErrorNotice(i,"danger"):null}_renderFormContent(){return this.viewModel.hasVisibleInputs?this.viewModel.activeForm.inputs.filter(e=>e.visible).map(e=>this._renderInput(e)):this._renderErrorNotice(this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason])}_renderInput(e){return M(e)?this._renderGroupInput(e):S(e)?this._renderLabeledField(e):E(e)?this._renderTextComponent(e):O(e)?this._renderRelationshipElementInput(e):T(e)?this._renderAttachmentElementInput(e):V(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:a,open:i}=e,n=t.filter(e=>e.visible),l=a.label??"";return ae("calcite-block",{class:this.classes(y.group,"sequential"===this.groupDisplay?y.groupSequential:null,this.disabled?y.inputDisabled:null),collapsible:!0,description:a.description??void 0,disabled:this.effectiveDisabled,expanded:i,heading:l,headingLevel:this.headingLevel,key:`{${a.elementId}-key}`,label:l,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:a}=e.template,{label:i,required:n,dataType:l}=e,s=n?t(this.messages.requiredFieldLabel,{name:i}):i;return ae("calcite-label",{"aria-label":s,class:y.label,key:`field--${a}`},ae("div",{class:y.labelTextContent,key:"labelTextContainer"},i,n?ae("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==l?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:a}=e;return"date"===a?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):null!==e.multipleChoiceChoices?this._renderMultipleChoiceComponent({input:e,props:t}):"number"===a?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:a,submittable:i}=e,n=!i&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?C(e,t,this.messages):null;return n?ae("calcite-input-message",{icon:!0,status:"invalid"},n):a?ae("calcite-input-message",{class:y.description,icon:!1,status:"idle"},a):null}_renderCodedInputs({input:e,props:t}){const a=e.input?.type??null,i=e.codedValueOptions;switch(a){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:i,props:t});default:return this._renderComboBoxComponent({options:i,props:t,input:e})}}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:a}=this,{multipleChoiceChoices:i,multipleChoiceInput:n,multipleChoiceValues:l}=e;if(!n||!i||!l)return null;const s=!0===n.includeSelectAllChoices,o=new Map;let r=l.length>0,c=!1;for(const f of l){const t=P({input:e,choiceValue:f});o.set(f,t),(t.checked||t.indeterminate)&&(c=!0),t.checked||(r=!1)}const d={checked:r,indeterminate:!r&&c},m=d.checked?a.deselectAllLabel:a.selectAllLabel,h=e.getMultipleChoiceOtherChoiceRenderState(this.messages.otherOptionLabel),u=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},p=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},g=t=>{const{fieldName:a}=h;a&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:a})},v=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:h.fieldName})};return ae("div",{class:y.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},s?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:d,selectAllLabel:m,handleSelectAllCheckboxChange:u}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:p}),h.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:s,otherChoiceRenderState:h,handleOtherChoiceCheckboxChange:g,handleOtherChoiceInputChange:v,differentValuesPlaceholder:a.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:a,handleSelectAllCheckboxChange:i}){return ae("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:y.multipleChoiceSelectAll,"data-element-id":e[le],disabled:e.readOnly,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:a,labelText:a,value:se,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:a,handleChoiceCheckboxChange:i}){const{multipleChoiceChoices:n}=e;return n?n.map(e=>{const n=a.get(e.value)??{checked:!1,indeterminate:!1};return ae("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[le],disabled:t.readOnly,indeterminate:n.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,required:t.required,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:t.onfocus})}):[]}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:a,handleOtherChoiceCheckboxChange:i,handleOtherChoiceInputChange:n,differentValuesPlaceholder:l}){return ae("div",{class:this.classes(y.multipleChoiceOtherChoice,t?y.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},ae("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:a.checkboxState.checked,class:e.class,"data-element-id":e[le],disabled:e.readOnly,indeterminate:a.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:a.label,labelText:a.label,value:oe,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus}),a.checkboxState.checked?ae("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":a.label,class:y.textElementInput,"data-element-id":e[le],disabled:e.readOnly,key:`${e.key}-other-choice-input`,maxLength:a.maxLength,placeholder:a.value===L?l:a.hint,required:e.required,type:"text",value:a.normalizedValue===L?"":a.normalizedValue?String(a.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:a=!1}){if(this._markFieldInputTouched(e),e.multipleChoiceInput&&!a&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const i=e.value,n=this._parseValue(t,e,a);n!==i&&await this.viewModel.setValue(e.template.elementId,n)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:a}){if(!a)return;const i=t.value,n=null==i||""===i?null:i;e.initializeExplicitMultipleChoiceOtherChoiceCheckedState(),e.stashMultipleChoiceOtherChoiceDraftValueForFeatures(e.features,n);const l=e.features.toArray().filter(e=>e.getAttribute(a)!==n);if(0!==l.length){for(const e of l)e.setAttribute(a,n);this.viewModel.userHasChangedValues=!0,await e.expressionsManager.valueChanged(a,l),this.viewModel.emit("value-change",{features:l.map(e=>e.source),fieldName:a,name:"value-change",value:n})}}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:a}){e.setExplicitMultipleChoiceOtherChoiceCheckedState(t),this._markFieldInputTouched(e),t||e.setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e.features.toArray());const i=e.features.toArray().filter(i=>{const n=i.getAttribute(a);if(t){if(!ne(n))return!1;const t=e.getMultipleChoiceOtherChoiceDraftValue(i),l=j(t)?t:U;return i.setAttribute(a,l),!0}return null!=n&&(i.setAttribute(a,null),!0)});0!==i.length&&(this.viewModel.userHasChangedValues=!0,await e.expressionsManager.valueChanged(a,i),this.viewModel.emit("value-change",{features:i.map(e=>e.source),fieldName:a,name:"value-change",value:this._getFieldValueByFieldNameForInput(e,a)}))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){if(!e.multipleChoiceInput||!e.multipleChoiceValues)return;const a=e.features.toArray().filter(a=>{const i=a.getAttribute(e.fieldName),n=N({input:e,choiceValue:t.value,currentValue:i,isChecked:t.checked});return i!==n&&(a.setAttribute(e.fieldName,n),!0)});0!==a.length&&(this.viewModel.userHasChangedValues=!0,await e.expressionsManager.valueChanged(e.fieldName,a),this.viewModel.emit("value-change",{features:a.map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:this._getFieldValueByFieldNameForInput(e,e.fieldName)}))}_getFieldValueByFieldNameForInput(e,t){const a=e.features.toArray().map(e=>e.getAttribute(t));if(0===a.length)return null;const[i]=a;return a.every(e=>e===i)?i:L}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===L||e.value===L)&&"batch"===this.viewModel.mode){const a={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[le]:t[le]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:a,options:[{name:this.messages.differentValuesPlaceholder,value:L,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return ae("calcite-switch",{...t,checked:!!_(e.template,"switch")&&e.value===e.template.input.onValue,class:y.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:a}){const{trigger:i,dropdown:n,group:l}=a;return ae("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onblur:()=>{this._focusedFieldInput=null},onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e),onfocus:this._onComponentFocus},ae("calcite-button",{...i},e===L?this.messages.differentValuesPlaceholder:e),ae("calcite-dropdown-group",{selectionMode:l.mode},t.map(t=>ae("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:a}){const i="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),l=i&&e.showNoValueOptionEnabled&&!n?()=>{}:a.onblur,s={...a,onblur:l};return ae("calcite-combobox",{...s,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:a.placeholder===this.messages.differentValuesPlaceholder?L:String(a.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==L&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:a}))}renderComboboxOptionsList({input:e,options:t,props:a}){const i=e=>e.map(e=>{const{value:t}=e,i=ne(e.value)?this.messages.empty:e.name;return ae("calcite-combobox-item",{heading:i,key:`#${t}`,selected:a.value===t,value:`${t}`})});let n=[];const{messages:l}=this;t.other.length>0&&n.push(ae("calcite-combobox-item-group",{key:"other",label:l.other},i(t.other))),t.unsupported.length>0&&n.push(ae("calcite-combobox-item-group",{key:"unsupported",label:l.unsupported},i(t.unsupported)));const s=i(t.recommended);n.length>0?n.unshift(ae("calcite-combobox-item-group",{key:"recommended",label:l.recommended},s)):n=s;const o=a.placeholder===this.messages.differentValuesPlaceholder,r=!o&&ne(a.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(ae("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),o&&n.unshift(ae("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:L,selected:!0,value:L})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:a}){const i=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:i})=>this._renderRadioButtons({label:t,value:i,selected:i===e.value,props:a}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,l=ne(e.value);i.unshift(this._renderRadioButtons({label:n,value:t,selected:l,props:a}))}return ae("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:y.inputRadioGroup,disabled:a.readOnly,key:`${a.key}-radio-group`,layout:"vertical",name:a.name,required:a.required},i,a.placeholder===this.messages.differentValuesPlaceholder?ae("calcite-label",{class:y.placeholderRadio,key:a.label,layout:"inline"},ae("calcite-radio-button",{checked:!0,class:y.inputRadio,disabled:!0,name:a.placeholder,value:a.placeholder}),a.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:a,props:i}){return ae("calcite-label",{class:y.inputRadioLabel,key:i.label,layout:"inline"},ae("calcite-radio-button",{...i,afterCreate:void 0,afterUpdate:void 0,checked:t,class:y.inputRadio,disabled:i.readOnly,name:i.label,value:e,onblur:()=>{this._focusedFieldInput=null},onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),a)}_renderStringComponent(e,t){const{template:a}=e;return!a.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===a.input?.type?ae("calcite-text-area",{...t,class:this.classes(y.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):ae("calcite-input",{...t,class:this.classes(y.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const a=m(e.field);return ae("calcite-input-number",{...t,integer:a,type:"number",value:a&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const a=this.getCommonInputProps(e);return ae("calcite-input",{...a,class:this.classes(y.fieldInput,y.inputDisabled,y.individualElement),readOnly:!0,type:"text",value:String(t??a.value??"")})}_renderDateComponents(e,t){const{field:a}=e;let i;switch(a.type){case"date":i=this._renderDateFieldComponents(e,t);break;case"date-only":i=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":i=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":i=this._renderTimestampOffsetFieldComponents(e,t);break;default:i=this._renderReadOnlyComponent(e,Z(a,t.value,{timeZone:e.effectiveTimeZone,...q(e.template.field)}))}return e.value===L?[i,ae("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:i}_renderDateOnlyFieldComponent(e,t){const{class:a,key:i,readOnly:n}=t,{rawMax:l,rawMin:s}=e.range;return ae("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:a,"data-date-part":"date","data-element-id":t[le],key:`${i}-date-input`,max:h(l)?l:void 0,min:h(s)?s:void 0,overlayPositioning:"fixed",readOnly:n,topLayerDisabled:this.topLayerDisabled,value:e.value===L?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimeOnlyFieldComponent(e,t){const{class:a,key:i,readOnly:n}=t;return ae("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:a,"data-date-part":"time","data-element-id":t[le],key:`${i}-time-input`,overlayPositioning:"fixed",readOnly:n,value:e.value===L?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:a,key:i,readOnly:n}=t,{rawMax:l,rawMin:s}=e.range,o=G(l),r=G(s),c=G(e.value===L?"":e.value),d=e.includeTimeOffset,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:n,[le]:t[le],onfocus:this._onComponentFocus};return ae("div",{class:y.dateInputContainer,key:`${i}-date-time-container`},ae("calcite-input-date-picker",{...m,class:a,"data-date-part":"date",key:`${i}-date-input`,max:o?.date??void 0,min:r?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),ae("calcite-input-time-picker",{...m,class:a,"data-date-part":"time",key:`${i}-time-input`,value:c.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),d?ae("calcite-input-time-zone",{...m,class:a,clearable:e.value===L||null==e.value,"data-date-part":"timeZone",key:`${i}-timezone-input`,value:c.timeZoneOffset||"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:a,key:i,readOnly:n,min:l,max:s}=t,o=e.effectiveTimeZone,r=W(e.value===L?"":e.value,o),c=W(s,o),d=W(l,o),m=e.includeTime,h={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:n,[le]:t[le],onfocus:this._onComponentFocus};return ae("div",{class:y.dateInputContainer,key:`${i}-date-time-container`},ae("calcite-input-date-picker",{...h,class:a,"data-date-part":"date",key:`${i}-date-input`,max:c?.date??void 0,min:d?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:r.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),m?ae("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${i}-time-input`,step:1,value:r.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){const{elementId:t}=e.template;return ae("div",{class:y.relationshipElementInput,"data-testid":`relationship-element-${t}`,key:`relationship-element-${t}`})}_renderAttachmentElementInput(e){const{allAttachmentsVisibleOnDefaultPage:t,attachments:a,defaultPageAttachments:i,template:{description:n,elementId:l,label:s}}=e,o=t?a:i;return ae("div",{class:y.attachmentElementInput,"data-testid":`attachment-element-${l}`,key:`attachment-element-${l}`},s?ae("div",{class:y.attachmentElementLabel,key:`attachment-element-label-${l}`},s):null,n?ae("div",{class:y.description,key:`attachment-element-description-${l}`},n):null,a.length?this._renderAttachmentList(e,o,{label:s||this.messagesCommon.details,viewAllCount:t?null:a.length}):ae("div",{class:y.attachmentElementEmptyState,key:`attachment-element-empty-state-${l}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){const e=this.viewModel.selectedAttachmentListInput;if(e)return ae("div",{class:y.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,a){const{filterEnabled:i,label:n,viewAllCount:l}=a;return ae("calcite-list",{class:y.attachmentElementList,filterEnabled:i,filterPlaceholder:i?this.messages.attachments.searchAttachments:void 0,filterProps:i?Y:void 0,filterText:i?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:i?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=l?this._renderViewAllAttachmentsItem(e,l):null)}_renderAttachmentListItems(e,t){const{elementId:a}=e.template;return t.map((t,i)=>{const n=this._formatAttachmentSize(t.size),l=this._getAttachmentLabel(t,i,n,e.displayFilename),s=l===n?void 0:n,o=v(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=r||c.isRenamed||c.isReplaced;return ae("calcite-list-item",{class:y.attachmentElementListItem,description:s,key:`attachment-item-${o}`,label:l,onCalciteListItemSelect:r?void 0:()=>this._setSelectedAttachment({attachmentKey:o,elementId:a})},ae("div",{class:y.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,l,e)),d?ae("span",{class:y.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[ae("calcite-action",{disabled:this.effectiveDisabled,icon:"x",scale:"s",slot:"actions-end",text:this.messagesCommon.delete,title:this.messagesCommon.delete,onclick:()=>this.viewModel.stageDeleteAttachment(a,t.globalId)})]:ae("calcite-action",{icon:"chevron-right",scale:"s",slot:"actions-end",text:l,title:l}))})}_renderViewAllAttachmentsItem(e,a){const{elementId:i}=e.template,{viewAll:n}=this.messages.attachments;return ae("calcite-list-item",{class:y.attachmentElementListItem,description:t(this.messages.attachments.count,{count:a}),key:`attachment-item-view-all-${i}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(i)},ae("calcite-action",{icon:"chevron-right",scale:"s",slot:"actions-end",text:n,title:n}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,a=this.effectiveDisabled||e.addDisabled;return ae("div",{class:y.attachmentElementEmptyAction,key:`attachment-element-empty-action-${t}`},ae("calcite-button",{appearance:"outline",disabled:a,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach))}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:a}=e.template,i=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,l=this.messages.attachments,s=l.dragAndDropFile,o="upload",r=e=>{this._attachmentFileInputMap.set(a,e)};return ae("div",{class:y.attachmentElementAddPanel,key:`attachment-element-add-panel-${a}`},ae("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(a)},afterUpdate:r,class:y.attachmentElementFileInput,"data-element-id":a,disabled:n,multiple:i,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?Array.from(t.files):[];this._stageAttachmentFiles(a,i),t.value=""}}),ae("div",{class:y.attachmentElementAddDropzone,"data-disabled":n?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),n)return;const t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(a,t)}},ae("calcite-icon",{class:y.attachmentElementAddDropzoneIcon,icon:o,scale:"l"}),ae("div",{class:y.attachmentElementAddDropzoneHeading},l.addFile),ae("div",{class:y.attachmentElementAddDropzoneDetail,title:s},s),ae("calcite-button",{appearance:"outline-fill",disabled:n,iconStart:"folder-open",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(a,n)}},l.selectFile)))}async _stageAttachmentFiles(e,t){if(0!==t.length)try{await this.viewModel.stageAddAttachments(e,t)}finally{this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){const e=this.selectedAttachmentDetails;if(!e)return;if("replacing-attachment"===this.page)return this._renderAttachmentReplacePanel(e);const{attachment:t,input:a}=e,i=v(t),n=!!a.getAttachmentPreviewUrl(t),l=a.getAttachmentEditState(t),s=!this.readOnly&&!this.effectiveDisabled;return ae("div",{class:y.attachmentElementDetail,key:`attachment-detail-panel-${a.template.elementId}-${i}`},ae("div",{class:y.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)),ae("div",{class:y.attachmentElementDetailActions},ae("calcite-button",{appearance:"outline",disabled:!n,iconStart:"download-to",kind:"neutral",scale:"s",onclick:()=>{this._downloadAttachment(t)}},this.messages.attachments.download),f(t)?ae("calcite-button",{appearance:"outline",disabled:!n,iconStart:"expand",kind:"neutral",label:this.messages.attachments.maximize,scale:"m",title:this.messages.attachments.maximize,onclick:this._maximizeSelectedAttachment}):null,ae("calcite-button",{appearance:"outline",disabled:!n,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),ae("calcite-button",{appearance:"outline",disabled:!s,iconStart:"upload-to",kind:"neutral",label:this.messages.attachments.replace,scale:"m",title:this.messages.attachments.replace,onclick:this._enterAttachmentReplaceView})),ae("div",{class:y.attachmentElementDetailMetadata},ae("div",{class:y.attachmentElementDetailMetadataGroup},ae("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),a.allowUserRename?ae("div",{class:y.attachmentElementDetailFileNameRow},ae("calcite-input",{class:y.attachmentElementDetailFileNameInput,disabled:!s,scale:"m",value:t.name||"",onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),ae("calcite-button",{appearance:"transparent",disabled:!s||null==l.initialName||!l.isRenamed,iconStart:"reset",kind:"neutral",scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})):ae("span",{class:y.attachmentElementDetailMetadataValue},t.name)),ae("div",{class:y.attachmentElementDetailMetadataGroup},ae("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.size),ae("span",{class:y.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),ae("div",{class:y.attachmentElementDetailMetadataGroup},ae("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.type),ae("span",{class:y.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderAttachmentReplacePanel(e){const{attachment:t,input:a}=e,i=this.readOnly||this.effectiveDisabled,n=a.template.elementId;return ae("div",{class:y.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${v(t)}`},ae("input",{accept:a.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:y.attachmentElementFileInput,disabled:i,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?.[0];a&&this._stageSelectedAttachmentReplacement(a),t.value=""}}),ae("div",{class:y.attachmentElementAddDropzone,"data-disabled":i?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),i)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},ae("calcite-icon",{class:y.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),ae("div",{class:y.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),ae("div",{class:y.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),ae("calcite-button",{appearance:"outline-fill",disabled:i,iconStart:"folder-open",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),ae("div",{class:y.attachmentElementDetailMetadata},ae("div",{class:y.attachmentElementDetailMetadataGroup},ae("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),ae("span",{class:y.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:a}=e;return ae("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},ae("div",{class:y.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)))}_setSelectedAttachment(e){this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){this.viewModel.setSelectedAttachmentAddElementId(e),this.hideAttachmentDialog()}_setAttachmentListElementId(e){this.viewModel.setSelectedAttachmentListElementId(e),this.hideAttachmentDialog()}_getAttachmentLabel(e,a,i,n){return!1!==n&&h(e.name)&&e.name.length>0?e.name:i!==this.messagesCommon.notApplicable?i:t(this.messages.attachments.attachmentNumberedLabel,{index:a+1})}_formatAttachmentSize(e){return null==e||Number.isNaN(e)?this.messagesCommon.notApplicable:r(this.messagesUnits,e)}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;const t=this.messages.attachments.attachmentTypes,a=p(e);return t?.[a]||e}_renderAttachmentPreviewThumbnail(e,t,a){const i=a.getAttachmentPreviewUrl(e,64);return i&&f(e)?ae("img",{alt:t,class:y.attachmentElementListItemThumb,src:i}):ae("calcite-icon",{class:y.attachmentElementListItemIcon,icon:g(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const a=t.getAttachmentPreviewUrl(e),i=e.name||this.messagesCommon.details;return a&&f(e)?ae("img",{alt:i,class:y.attachmentElementDetailPreviewImage,src:a,title:i}):[ae("calcite-icon",{class:y.attachmentElementDetailPreviewIcon,icon:g(e.contentType),scale:"l",textLabel:i,title:i}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await z(e)}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){const t=this.selectedAttachmentDetails,a=t?.attachment.globalId;if(t&&a)try{await this.viewModel.stageReplaceAttachment(t.input.template.elementId,a,e)}finally{this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails,a=t?.attachment.globalId;t&&a&&this.viewModel.stageRenameAttachment(t.input.template.elementId,a,e)}_isSelectedAttachmentDeleteDisabled(){const e=this.selectedAttachmentDetails;if(!e)return!1;if(this.readOnly||this.effectiveDisabled)return!0;const t=e.input.minAttachmentCount;return null!=t&&e.input.attachments.length<=t}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return ae("div",{class:y.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){if(!this._associationsEnabled)return;const{elementId:t}=e.template;return ae("div",{class:y.utilityNetworkAssociationsElementInput,"data-testid":t,key:t})}getCommonInputProps(e){const{template:t,valid:a,value:i,minLength:n,maxLength:l,required:s,fieldName:o,editable:r,userHasChangedValue:c,range:{max:d,min:m}}=e,h=!r||this.readOnly,u=!h&&this.effectiveDisabled;let p=t.hint??void 0,g=!1;return i===L&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":a?"false":"true",class:this.classes(y.fieldInput,h?y.inputDisabled:null),status:!c&&!this.viewModel.submitHasBeenAttempted||a?"idle":"invalid",maxLength:l&&l>-1?l:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:o,name:o,max:null!=d?d:void 0,min:null!=m?m:void 0,disabled:u,readOnly:h,onblur:this._onComponentBlur,required:s,placeholder:p,value:g?"":i??"",[le]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(le))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,a=e.querySelector("calcite-radio-button"),i=t||a;i&&this._afterComponentCreateOrUpdate(i)}_onComponentFocus(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,a)||this._markFieldInputTouched(a),this._focusedFieldInput=a}_markFieldInputTouched(e){this._touchedInputs.add(e.template.elementId)}_isMultipleChoiceCheckbox(e,t){return"CALCITE-CHECKBOX"===e.tagName&&null!=t.multipleChoiceInput}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),a=this._focusedFieldInput;this._attemptFocusOnNextRender&&a===t&&(this._attemptFocusOnNextRender=!1,ie(e))}_onComponentBlur(){this._focusedFieldInput=null}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear()}_parseValue(e,t,a=!1){const i=t.multipleChoiceInput,n=t.multipleChoiceValues;if(i&&n){const l=i.choiceDelimiter,s=e;if(a){return B({input:t}).checked?null:n.length>0?n.join(l):null}const o=$(t.value,l).filter(e=>e!==L),r=new Set(o);s.checked?r.add(s.value):r.delete(s.value);const c=n.filter(e=>r.has(e));return c.length?c.join(l):null}if(_(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const a of t.domain.codedValues)if(a.name===e.selectedItems[0].textContent)return a.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const l=e.value;return null==l||""===l?null:"number"===t.dataType?"-0"===l||"-0."===l||"-0,"===l?l:parseFloat(l):"date"===t.field.type?parseFloat(l):l}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:a}=t.template;if(!t)return;const i=t?.value;if(_(t.template,"switch")&&"single"!==this.viewModel.mode){const e=n(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?i:e)}const l=this._parseValue(e,t);l!==i&&this.viewModel.setValue(a,l)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:a}=e.template,i=e.field.type,n=this._dateComponentMap.get(`${a}`);if(!n)return;const l=e.effectiveTimeZone;let s=e.value===L?void 0:e.value,o=null;"date-only"===i?o=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===i?(s=K(s),o=K(t.value)):o="timestamp-offset"===i?null!=t.value?X({dateComponent:n.date,timeComponent:n.time,oldValue:s,timeZoneComponent:n.timeZone,defaultTimeZone:l}):null:null!=t.value?J({oldValue:s,dateComponent:n.date,timeZone:l,timeComponent:n.time?.value===L?void 0:n.time}):null,s!==o&&(null!==o&&t.value?this.viewModel.setValue(`${a}`,o):this.viewModel.setValue(`${a}`,null))}};e([c()],re.prototype,"activeFeatureIndex",null),e([c()],re.prototype,"callbacks",null),e([c()],re.prototype,"disabled",null),e([c()],re.prototype,"effectiveTitle",null),e([c()],re.prototype,"effectiveDisabled",null),e([c()],re.prototype,"features",null),e([c()],re.prototype,"footerButtonInfos",null),e([c()],re.prototype,"footerNoticeInfos",null),e([c()],re.prototype,"map",null),e([c()],re.prototype,"maximumFeatureCount",null),e([c()],re.prototype,"maximumFeatureCountWithComplexForms",null),e([c()],re.prototype,"spatialReference",null),e([c()],re.prototype,"layerInfos",null),e([c()],re.prototype,"timeZone",null),e([c()],re.prototype,"headingLevel",void 0),e([c()],re.prototype,"icon",null),e([c(),ee("esri/t9n/common")],re.prototype,"messagesCommon",void 0),e([c(),ee("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],re.prototype,"messages",void 0),e([c(),ee("esri/core/t9n/Units")],re.prototype,"messagesUnits",void 0),e([c()],re.prototype,"page",null),e([c()],re.prototype,"readOnly",null),e([c()],re.prototype,"selectedAttachment",null),e([c()],re.prototype,"selectedAttachmentDetails",null),e([c()],re.prototype,"valid",null),e([c({type:A}),te(["value-change","submit"])],re.prototype,"viewModel",void 0),e([c({type:D,nonNullable:!0})],re.prototype,"visibleElements",void 0),e([c()],re.prototype,"groupDisplay",void 0),e([c()],re.prototype,"_associationsEnabled",null),e([c()],re.prototype,"_attemptFocusOnNextRender",void 0),e([c()],re.prototype,"_formId",null),e([c()],re.prototype,"_focusedFieldInput",void 0),e([c()],re.prototype,"_attachmentDialogInfo",void 0),e([c()],re.prototype,"_attachmentListFilterText",void 0),re=e([d("esri.widgets.BatchAttributeForm")],re);const ce=re;export{ce as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as a}from"../core/deprecate.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{watch as l,when as s,on as o}from"../core/reactiveUtils.js";import{formatFileSize as r}from"../core/unitFormatUtils.js";import{property as c,subclass as d}from"../core/accessorSupport/decorators.js";import{isIntegerField as m}from"../layers/support/fieldUtils.js";import{isString as h}from"../support/guards.js";import u from"./Widget.js";import{getAttachmentTypeCategory as p,getCalciteIconForAttachment as g}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as v,isImageAttachment as f}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as b,getVisibleFieldInputValidationErrorMessage as C,isElementTemplateWithInputType as _}from"./BatchAttributeForm/batchAttributeFormUtils.js";import A from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as y}from"./BatchAttributeForm/css.js";import{makeAddAttachmentFooterButtons as I,makeDiscardAttachmentFooterButtons as F,makeReplaceAttachmentFooterButtons as w,makeViewingAttachmentFooterButtons as k,makeDefaultFooterButtons as x}from"./BatchAttributeForm/interfaceUtils.js";import D from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as M,isFieldInput as E,isTextElementInput as S,isRelationshipElementInput as O,isAttachmentElementInput as T,isUtilityNetworkAssociationsElementInput as V,differentValuesString as L}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as R,getMultipleChoiceCheckboxState as P,otherChoiceCheckedPlaceholderValue as U,getUpdatedMultipleChoiceValueForFeature as N,getMultipleChoiceSelectAllState as B,splitMultipleChoiceValue as $,canRestoreMultipleChoiceOtherChoiceDraftValue as j}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{loadRelationshipDetailsComponents as z,RelationshipDetails as H}from"./BatchAttributeForm/rendered-content/RelationshipDetails.js";import{downloadAttachmentInfo as Z}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as q}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as G,getIntlOptionsForField as W,prepareISOFieldValueForDateComponents as K,prepareUnixFieldValueForDateComponents as X,normalizeTimeOnlyString as J,getISOFieldValueFromDateComponents as Q,getUnixFieldValueFromDateComponents as Y}from"./support/dateUtils.js";import{globalCss as ee}from"./support/globalCss.js";import{calciteListFilterProps as te}from"./support/listUtils.js";import{messageBundle as ae,vmEvent as ie,tsx as ne}from"./support/widget.js";import{setFocus as le}from"./support/widgetUtils.js";import{isEmptyValue as se}from"./support/forms/formUtils.js";const oe="data-element-id",re="esri_BatchAttributeForm_select_all",ce="esri_BatchAttributeForm_other_choice";let de=class extends u{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.messagesUnits=null,this.viewModel=new A,this.visibleElements=new D,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._attachmentDialogInfo=null,this._attachmentListFilterText="",this._attachmentFileInputMap=new Map,this._selectedAttachmentReplaceFileInput=null,this._maximizeSelectedAttachment=()=>{this._attachmentDialogInfo=this.selectedAttachmentDetails},this._enterAttachmentReplaceView=()=>{this.readOnly||this.effectiveDisabled||!this.selectedAttachmentDetails||this.viewModel.setShowingSelectedAttachmentReplacePage(!0)},this._setSelectedAttachmentReplaceFileInput=e=>{this._selectedAttachmentReplaceFileInput=e},this._openSelectedAttachmentReplaceFilePicker=()=>{this.readOnly||this.effectiveDisabled||this._selectedAttachmentReplaceFileInput?.click()},this._resetSelectedAttachmentName=()=>{const e=this.selectedAttachmentDetails,t=e?.attachment.globalId,a=e?e.input.getAttachmentEditState(e.attachment).initialName:null;e&&t&&null!=a&&this.viewModel.stageRenameAttachment(e.input.template.elementId,t,a)},this._resetSelectedAttachmentChanges=()=>{const e=this.selectedAttachmentDetails,t=e?.attachment.globalId;e&&t&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,t)},this._deleteSelectedAttachment=()=>{const e=this.selectedAttachmentDetails,t=e?.attachment.globalId;e&&t&&!this._isSelectedAttachmentDeleteDisabled()&&(this.viewModel.stageDeleteAttachment(e.input.template.elementId,t),this._setSelectedAttachment(null))},this._closeAttachmentDialog=()=>{this.hideAttachmentDialog()},this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{a(i.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...a}=e;return a}initialize(){this.addHandles([l(()=>this.features,()=>{this._dateComponentMap.clear(),this._resetTransientFormState(),R(this.viewModel,{includeDraftValues:!0})}),l(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),R(this.viewModel)}),l(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),s(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),l(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),o(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()})])}loadDependencies(){return Promise.all([q({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),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"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),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"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")}),z()])}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get effectiveTitle(){const{features:e,messages:t,page:a}=this;return"replacing-attachment"===a?t.titles.replaceAttachment:"viewing-attachment-details"===a?t.titles.editAttachment:"adding-attachments"===a?t.titles.addAttachments:"viewing-attachments"===a?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:""}get effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get footerButtonInfos(){if(!this.features.length)return[];const{page:e,messages:t}=this,a=this.viewModel.selectedAttachmentAddElementId,i=this.selectedAttachmentDetails,n=i?i.input.getAttachmentEditState(i.attachment):null;if("adding-attachments"===e&&a)return I({messages:t,onclick:()=>this._attachmentFileInputMap.get(a)?.click()});return!!i&&"replacing-attachment"!==e&&!!n?.isReplaced?F({message:this.messagesCommon.remove,onclick:this._resetSelectedAttachmentChanges}):"replacing-attachment"===e?w({disabled:this.readOnly||this.effectiveDisabled,messages:t,onclick:this._openSelectedAttachmentReplaceFilePicker}):"viewing-attachment-details"===e?k({deleteDisabled:this._isSelectedAttachmentDeleteDisabled(),deleteOnclick:this._deleteSelectedAttachment,doneOnclick:()=>this._setSelectedAttachment(null),messages:t.footerButtons}):"viewing-attachments"===e?[]:x({formId:this._formId,callback:this.submit,messages:t})}get footerNoticeInfos(){if(!this.features.length)return[];const{messages:{footerNotices:e}}=this;return this._isSelectedAttachmentDeleteDisabled()?[{icon:"information",message:e.deleteDisabledMinimumAttachments}]:[]}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get page(){return this.viewModel.page}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get selectedAttachment(){return this.viewModel.selectedAttachment}get selectedAttachmentDetails(){return this.viewModel.selectedAttachmentDetails}get valid(){return this.viewModel.valid}get _associationsEnabled(){const{callbacks:e}=this;return!(!e?.addAssociation||!e.selectAssociatedFeature)}get _formId(){return`${this.id}-form`}get _relatedRecordsEnabled(){const{callbacks:e}=this;return!(!e||!e.addRelatedRecord&&!e.editRelatedRecord)}async goBack(){return this.viewModel.goBack()}async goHome(){return this.viewModel.goHome()}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){return ne("div",{class:this.classes(y.base,ee.widget,ee.panel)},this._renderContent(),this._renderAttachmentDialog())}submit(){return this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:a}=e.dataset,i=n(this._dateComponentMap,`${a}`,()=>({}));switch(t){case"date":i.date=e;break;case"time":i.time=e;break;case"timeZone":i.timeZone=e}}_renderContent(){const{messages:e,viewModel:a}=this,{status:i}=a;return"failed"===i?a.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:a.maximumFeatureCountWithComplexForms})):a.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:a.maximumFeatureCount})):e.formFailedToLoad:a.expressionEvaluationFailed?this._renderErrorNotice(e.expressionEvaluationFailed):a.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===i&&this.visibleElements.loadingIndicator?ne("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return ne("calcite-notice",{class:y.noticeError,icon:!0,kind:t,open:!0},ne("div",{slot:"message"},e))}_renderForm(){return ne("form",{class:y.form,id:this._formId,onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderPage())}_renderPage(){switch(this.page){case"adding-attachments":return this._renderAttachmentAddPage();case"replacing-attachment":case"viewing-attachments":return this._renderAttachmentListPage();case"viewing-attachment-details":return this._renderAttachmentDetailPage();default:return this._renderFormContent()}}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:a}=e;let i;if(!e.submitHasBeenAttempted)return null;if(a.invalidHiddenInputs.length>0)if(i=b(a,e.mode,this.messages),"batch"===this.viewModel.mode){const e=a.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?i+=` (${e.map(e=>e.label).join(", ")})`:i=null}else i+=` (${a.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return i?this._renderErrorNotice(i,"danger"):null}_renderFormContent(){return this.viewModel.hasVisibleInputs?this.viewModel.activeForm.inputs.filter(e=>e.visible).map(e=>this._renderInput(e)):this._renderErrorNotice(this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason])}_renderInput(e){return M(e)?this._renderGroupInput(e):E(e)?this._renderLabeledField(e):S(e)?this._renderTextComponent(e):O(e)?this._renderRelationshipElementInput(e):T(e)?this._renderAttachmentElementInput(e):V(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:a,open:i}=e,n=t.filter(e=>e.visible),l=a.label??"";return ne("calcite-block",{class:this.classes(y.group,"sequential"===this.groupDisplay?y.groupSequential:null,this.disabled?y.inputDisabled:null),collapsible:!0,description:a.description??void 0,disabled:this.effectiveDisabled,expanded:i,heading:l,headingLevel:this.headingLevel,key:`{${a.elementId}-key}`,label:l,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:a}=e.template,{label:i,required:n,dataType:l}=e,s=n?t(this.messages.requiredFieldLabel,{name:i}):i;return ne("calcite-label",{"aria-label":s,class:y.label,key:`field--${a}`},ne("div",{class:y.labelTextContent,key:"labelTextContainer"},i,n?ne("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==l?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:a}=e;return"date"===a?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):null!==e.multipleChoiceChoices?this._renderMultipleChoiceComponent({input:e,props:t}):"number"===a?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:a,submittable:i}=e,n=!i&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?C(e,t,this.messages):null;return n?ne("calcite-input-message",{icon:!0,status:"invalid"},n):a?ne("calcite-input-message",{class:y.description,icon:!1,status:"idle"},a):null}_renderCodedInputs({input:e,props:t}){const a=e.input?.type??null,i=e.codedValueOptions;switch(a){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:i,props:t});default:return this._renderComboBoxComponent({options:i,props:t,input:e})}}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:a}=this,{multipleChoiceChoices:i,multipleChoiceInput:n,multipleChoiceValues:l}=e;if(!n||!i||!l)return null;const s=!0===n.includeSelectAllChoices,o=new Map;let r=l.length>0,c=!1;for(const f of l){const t=P({input:e,choiceValue:f});o.set(f,t),(t.checked||t.indeterminate)&&(c=!0),t.checked||(r=!1)}const d={checked:r,indeterminate:!r&&c},m=d.checked?a.deselectAllLabel:a.selectAllLabel,h=e.getMultipleChoiceOtherChoiceRenderState(this.messages.otherOptionLabel),u=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},p=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},g=t=>{const{fieldName:a}=h;a&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:a})},v=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:h.fieldName})};return ne("div",{class:y.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},s?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:d,selectAllLabel:m,handleSelectAllCheckboxChange:u}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:p}),h.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:s,otherChoiceRenderState:h,handleOtherChoiceCheckboxChange:g,handleOtherChoiceInputChange:v,differentValuesPlaceholder:a.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:a,handleSelectAllCheckboxChange:i}){return ne("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:y.multipleChoiceSelectAll,"data-element-id":e[oe],disabled:e.readOnly,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:a,labelText:a,value:re,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:a,handleChoiceCheckboxChange:i}){const{multipleChoiceChoices:n}=e;return n?n.map(e=>{const n=a.get(e.value)??{checked:!1,indeterminate:!1};return ne("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[oe],disabled:t.readOnly,indeterminate:n.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,required:t.required,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:t.onfocus})}):[]}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:a,handleOtherChoiceCheckboxChange:i,handleOtherChoiceInputChange:n,differentValuesPlaceholder:l}){return ne("div",{class:this.classes(y.multipleChoiceOtherChoice,t?y.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},ne("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:a.checkboxState.checked,class:e.class,"data-element-id":e[oe],disabled:e.readOnly,indeterminate:a.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:a.label,labelText:a.label,value:ce,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus}),a.checkboxState.checked?ne("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":a.label,class:y.textElementInput,"data-element-id":e[oe],disabled:e.readOnly,key:`${e.key}-other-choice-input`,maxLength:a.maxLength,placeholder:a.value===L?l:a.hint,required:e.required,type:"text",value:a.normalizedValue===L?"":a.normalizedValue?String(a.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:a=!1}){if(this._markFieldInputTouched(e),e.multipleChoiceInput&&!a&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const i=e.value,n=this._parseValue(t,e,a);n!==i&&await this.viewModel.setValue(e.template.elementId,n)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:a}){if(!a)return;const i=t.value,n=null==i||""===i?null:i;e.initializeExplicitMultipleChoiceOtherChoiceCheckedState(),e.stashMultipleChoiceOtherChoiceDraftValueForFeatures(e.features,n);const l=e.features.toArray().filter(e=>e.getAttribute(a)!==n);if(0!==l.length){for(const e of l)e.setAttribute(a,n);this.viewModel.userHasChangedValues=!0,await e.expressionsManager.valueChanged(a,l),this.viewModel.emit("value-change",{features:l.map(e=>e.source),fieldName:a,name:"value-change",value:n})}}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:a}){e.setExplicitMultipleChoiceOtherChoiceCheckedState(t),this._markFieldInputTouched(e),t||e.setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e.features.toArray());const i=e.features.toArray().filter(i=>{const n=i.getAttribute(a);if(t){if(!se(n))return!1;const t=e.getMultipleChoiceOtherChoiceDraftValue(i),l=j(t)?t:U;return i.setAttribute(a,l),!0}return null!=n&&(i.setAttribute(a,null),!0)});0!==i.length&&(this.viewModel.userHasChangedValues=!0,await e.expressionsManager.valueChanged(a,i),this.viewModel.emit("value-change",{features:i.map(e=>e.source),fieldName:a,name:"value-change",value:this._getFieldValueByFieldNameForInput(e,a)}))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){if(!e.multipleChoiceInput||!e.multipleChoiceValues)return;const a=e.features.toArray().filter(a=>{const i=a.getAttribute(e.fieldName),n=N({input:e,choiceValue:t.value,currentValue:i,isChecked:t.checked});return i!==n&&(a.setAttribute(e.fieldName,n),!0)});0!==a.length&&(this.viewModel.userHasChangedValues=!0,await e.expressionsManager.valueChanged(e.fieldName,a),this.viewModel.emit("value-change",{features:a.map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:this._getFieldValueByFieldNameForInput(e,e.fieldName)}))}_getFieldValueByFieldNameForInput(e,t){const a=e.features.toArray().map(e=>e.getAttribute(t));if(0===a.length)return null;const[i]=a;return a.every(e=>e===i)?i:L}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===L||e.value===L)&&"batch"===this.viewModel.mode){const a={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[oe]:t[oe]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:a,options:[{name:this.messages.differentValuesPlaceholder,value:L,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return ne("calcite-switch",{...t,checked:!!_(e.template,"switch")&&e.value===e.template.input.onValue,class:y.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:a}){const{trigger:i,dropdown:n,group:l}=a;return ne("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onblur:()=>{this._focusedFieldInput=null},onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e),onfocus:this._onComponentFocus},ne("calcite-button",{...i},e===L?this.messages.differentValuesPlaceholder:e),ne("calcite-dropdown-group",{selectionMode:l.mode},t.map(t=>ne("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:a}){const i="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),l=i&&e.showNoValueOptionEnabled&&!n?()=>{}:a.onblur,s={...a,onblur:l};return ne("calcite-combobox",{...s,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:a.placeholder===this.messages.differentValuesPlaceholder?L:String(a.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==L&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:a}))}renderComboboxOptionsList({input:e,options:t,props:a}){const i=e=>e.map(e=>{const{value:t}=e,i=se(e.value)?this.messages.empty:e.name;return ne("calcite-combobox-item",{heading:i,key:`#${t}`,selected:a.value===t,value:`${t}`})});let n=[];const{messages:l}=this;t.other.length>0&&n.push(ne("calcite-combobox-item-group",{key:"other",label:l.other},i(t.other))),t.unsupported.length>0&&n.push(ne("calcite-combobox-item-group",{key:"unsupported",label:l.unsupported},i(t.unsupported)));const s=i(t.recommended);n.length>0?n.unshift(ne("calcite-combobox-item-group",{key:"recommended",label:l.recommended},s)):n=s;const o=a.placeholder===this.messages.differentValuesPlaceholder,r=!o&&se(a.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(ne("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),o&&n.unshift(ne("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:L,selected:!0,value:L})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:a}){const i=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:i})=>this._renderRadioButtons({label:t,value:i,selected:i===e.value,props:a}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,l=se(e.value);i.unshift(this._renderRadioButtons({label:n,value:t,selected:l,props:a}))}return ne("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:y.inputRadioGroup,disabled:a.readOnly,key:`${a.key}-radio-group`,layout:"vertical",name:a.name,required:a.required},i,a.placeholder===this.messages.differentValuesPlaceholder?ne("calcite-label",{class:y.placeholderRadio,key:a.label,layout:"inline"},ne("calcite-radio-button",{checked:!0,class:y.inputRadio,disabled:!0,name:a.placeholder,value:a.placeholder}),a.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:a,props:i}){return ne("calcite-label",{class:y.inputRadioLabel,key:i.label,layout:"inline"},ne("calcite-radio-button",{...i,afterCreate:void 0,afterUpdate:void 0,checked:t,class:y.inputRadio,disabled:i.readOnly,name:i.label,value:e,onblur:()=>{this._focusedFieldInput=null},onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),a)}_renderStringComponent(e,t){const{template:a}=e;return!a.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===a.input?.type?ne("calcite-text-area",{...t,class:this.classes(y.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):ne("calcite-input",{...t,class:this.classes(y.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const a=m(e.field);return ne("calcite-input-number",{...t,integer:a,type:"number",value:a&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const a=this.getCommonInputProps(e);return ne("calcite-input",{...a,class:this.classes(y.fieldInput,y.inputDisabled,y.individualElement),readOnly:!0,type:"text",value:String(t??a.value??"")})}_renderDateComponents(e,t){const{field:a}=e;let i;switch(a.type){case"date":i=this._renderDateFieldComponents(e,t);break;case"date-only":i=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":i=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":i=this._renderTimestampOffsetFieldComponents(e,t);break;default:i=this._renderReadOnlyComponent(e,G(a,t.value,{timeZone:e.effectiveTimeZone,...W(e.template.field)}))}return e.value===L?[i,ne("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:i}_renderDateOnlyFieldComponent(e,t){const{class:a,key:i,readOnly:n}=t,{rawMax:l,rawMin:s}=e.range;return ne("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:a,"data-date-part":"date","data-element-id":t[oe],key:`${i}-date-input`,max:h(l)?l:void 0,min:h(s)?s:void 0,overlayPositioning:"fixed",readOnly:n,topLayerDisabled:this.topLayerDisabled,value:e.value===L?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimeOnlyFieldComponent(e,t){const{class:a,key:i,readOnly:n}=t;return ne("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:a,"data-date-part":"time","data-element-id":t[oe],key:`${i}-time-input`,overlayPositioning:"fixed",readOnly:n,value:e.value===L?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:a,key:i,readOnly:n}=t,{rawMax:l,rawMin:s}=e.range,o=K(l),r=K(s),c=K(e.value===L?"":e.value),d=e.includeTimeOffset,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:n,[oe]:t[oe],onfocus:this._onComponentFocus};return ne("div",{class:y.dateInputContainer,key:`${i}-date-time-container`},ne("calcite-input-date-picker",{...m,class:a,"data-date-part":"date",key:`${i}-date-input`,max:o?.date??void 0,min:r?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),ne("calcite-input-time-picker",{...m,class:a,"data-date-part":"time",key:`${i}-time-input`,value:c.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),d?ne("calcite-input-time-zone",{...m,class:a,clearable:e.value===L||null==e.value,"data-date-part":"timeZone",key:`${i}-timezone-input`,value:c.timeZoneOffset||"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:a,key:i,readOnly:n,min:l,max:s}=t,o=e.effectiveTimeZone,r=X(e.value===L?"":e.value,o),c=X(s,o),d=X(l,o),m=e.includeTime,h={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:n,[oe]:t[oe],onfocus:this._onComponentFocus};return ne("div",{class:y.dateInputContainer,key:`${i}-date-time-container`},ne("calcite-input-date-picker",{...h,class:a,"data-date-part":"date",key:`${i}-date-input`,max:c?.date??void 0,min:d?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:r.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),m?ne("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${i}-time-input`,step:1,value:r.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){return this._relatedRecordsEnabled?ne(H,{input:e,messages:this.messages,messagesCommon:this.messagesCommon,viewModel:this.viewModel}):null}_renderAttachmentElementInput(e){const{allAttachmentsVisibleOnDefaultPage:t,attachments:a,defaultPageAttachments:i,template:{description:n,elementId:l,label:s}}=e,o=t?a:i;return ne("div",{class:y.attachmentElementInput,"data-testid":`attachment-element-${l}`,key:`attachment-element-${l}`},s?ne("div",{class:y.attachmentElementLabel,key:`attachment-element-label-${l}`},s):null,n?ne("div",{class:y.description,key:`attachment-element-description-${l}`},n):null,a.length?this._renderAttachmentList(e,o,{label:s||this.messagesCommon.details,viewAllCount:t?null:a.length}):ne("div",{class:y.attachmentElementEmptyState,key:`attachment-element-empty-state-${l}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){const e=this.viewModel.selectedAttachmentListInput;if(e)return ne("div",{class:y.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,a){const{filterEnabled:i,label:n,viewAllCount:l}=a;return ne("calcite-list",{class:y.attachmentElementList,filterEnabled:i,filterPlaceholder:i?this.messages.attachments.searchAttachments:void 0,filterProps:i?te:void 0,filterText:i?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:i?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=l?this._renderViewAllAttachmentsItem(e,l):null)}_renderAttachmentListItems(e,t){const{elementId:a}=e.template;return t.map((t,i)=>{const n=this._formatAttachmentSize(t.size),l=this._getAttachmentLabel(t,i,n,e.displayFilename),s=l===n?void 0:n,o=v(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=r||c.isRenamed||c.isReplaced;return ne("calcite-list-item",{class:y.attachmentElementListItem,description:s,key:`attachment-item-${o}`,label:l,onCalciteListItemSelect:r?void 0:()=>this._setSelectedAttachment({attachmentKey:o,elementId:a})},ne("div",{class:y.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,l,e)),d?ne("span",{class:y.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[ne("calcite-action",{disabled:this.effectiveDisabled,icon:"x",scale:"s",slot:"actions-end",text:this.messagesCommon.delete,title:this.messagesCommon.delete,onclick:()=>this.viewModel.stageDeleteAttachment(a,t.globalId)})]:ne("calcite-action",{icon:"chevron-right",scale:"s",slot:"actions-end",text:l,title:l}))})}_renderViewAllAttachmentsItem(e,a){const{elementId:i}=e.template,{viewAll:n}=this.messages.attachments;return ne("calcite-list-item",{class:y.attachmentElementListItem,description:t(this.messages.attachments.count,{count:a}),key:`attachment-item-view-all-${i}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(i)},ne("calcite-action",{icon:"chevron-right",scale:"s",slot:"actions-end",text:n,title:n}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,a=this.effectiveDisabled||e.addDisabled;return ne("div",{class:y.attachmentElementEmptyAction,key:`attachment-element-empty-action-${t}`},ne("calcite-button",{appearance:"outline",disabled:a,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach))}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:a}=e.template,i=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,l=this.messages.attachments,s=l.dragAndDropFile,o="upload",r=e=>{this._attachmentFileInputMap.set(a,e)};return ne("div",{class:y.attachmentElementAddPanel,key:`attachment-element-add-panel-${a}`},ne("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(a)},afterUpdate:r,class:y.attachmentElementFileInput,"data-element-id":a,disabled:n,multiple:i,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?Array.from(t.files):[];this._stageAttachmentFiles(a,i),t.value=""}}),ne("div",{class:y.attachmentElementAddDropzone,"data-disabled":n?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),n)return;const t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(a,t)}},ne("calcite-icon",{class:y.attachmentElementAddDropzoneIcon,icon:o,scale:"l"}),ne("div",{class:y.attachmentElementAddDropzoneHeading},l.addFile),ne("div",{class:y.attachmentElementAddDropzoneDetail,title:s},s),ne("calcite-button",{appearance:"outline-fill",disabled:n,iconStart:"folder-open",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(a,n)}},l.selectFile)))}async _stageAttachmentFiles(e,t){if(0!==t.length)try{await this.viewModel.stageAddAttachments(e,t)}finally{this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){const e=this.selectedAttachmentDetails;if(!e)return;if("replacing-attachment"===this.page)return this._renderAttachmentReplacePanel(e);const{attachment:t,input:a}=e,i=v(t),n=!!a.getAttachmentPreviewUrl(t),l=a.getAttachmentEditState(t),s=!this.readOnly&&!this.effectiveDisabled;return ne("div",{class:y.attachmentElementDetail,key:`attachment-detail-panel-${a.template.elementId}-${i}`},ne("div",{class:y.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)),ne("div",{class:y.attachmentElementDetailActions},ne("calcite-button",{appearance:"outline",disabled:!n,iconStart:"download-to",kind:"neutral",scale:"s",onclick:()=>{this._downloadAttachment(t)}},this.messages.attachments.download),f(t)?ne("calcite-button",{appearance:"outline",disabled:!n,iconStart:"expand",kind:"neutral",label:this.messages.attachments.maximize,scale:"m",title:this.messages.attachments.maximize,onclick:this._maximizeSelectedAttachment}):null,ne("calcite-button",{appearance:"outline",disabled:!n,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),ne("calcite-button",{appearance:"outline",disabled:!s,iconStart:"upload-to",kind:"neutral",label:this.messages.attachments.replace,scale:"m",title:this.messages.attachments.replace,onclick:this._enterAttachmentReplaceView})),ne("div",{class:y.attachmentElementDetailMetadata},ne("div",{class:y.attachmentElementDetailMetadataGroup},ne("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),a.allowUserRename?ne("div",{class:y.attachmentElementDetailFileNameRow},ne("calcite-input",{class:y.attachmentElementDetailFileNameInput,disabled:!s,scale:"m",value:t.name||"",onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),ne("calcite-button",{appearance:"transparent",disabled:!s||null==l.initialName||!l.isRenamed,iconStart:"reset",kind:"neutral",scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})):ne("span",{class:y.attachmentElementDetailMetadataValue},t.name)),ne("div",{class:y.attachmentElementDetailMetadataGroup},ne("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.size),ne("span",{class:y.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),ne("div",{class:y.attachmentElementDetailMetadataGroup},ne("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.type),ne("span",{class:y.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderAttachmentReplacePanel(e){const{attachment:t,input:a}=e,i=this.readOnly||this.effectiveDisabled,n=a.template.elementId;return ne("div",{class:y.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${v(t)}`},ne("input",{accept:a.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:y.attachmentElementFileInput,disabled:i,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?.[0];a&&this._stageSelectedAttachmentReplacement(a),t.value=""}}),ne("div",{class:y.attachmentElementAddDropzone,"data-disabled":i?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),i)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},ne("calcite-icon",{class:y.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),ne("div",{class:y.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),ne("div",{class:y.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),ne("calcite-button",{appearance:"outline-fill",disabled:i,iconStart:"folder-open",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),ne("div",{class:y.attachmentElementDetailMetadata},ne("div",{class:y.attachmentElementDetailMetadataGroup},ne("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),ne("span",{class:y.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:a}=e;return ne("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},ne("div",{class:y.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)))}_setSelectedAttachment(e){this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){this.viewModel.setSelectedAttachmentAddElementId(e),this.hideAttachmentDialog()}_setAttachmentListElementId(e){this.viewModel.setSelectedAttachmentListElementId(e),this.hideAttachmentDialog()}_getAttachmentLabel(e,a,i,n){return!1!==n&&h(e.name)&&e.name.length>0?e.name:i!==this.messagesCommon.notApplicable?i:t(this.messages.attachments.attachmentNumberedLabel,{index:a+1})}_formatAttachmentSize(e){return null==e||Number.isNaN(e)?this.messagesCommon.notApplicable:r(this.messagesUnits,e)}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;const t=this.messages.attachments.attachmentTypes,a=p(e);return t?.[a]||e}_renderAttachmentPreviewThumbnail(e,t,a){const i=a.getAttachmentPreviewUrl(e,64);return i&&f(e)?ne("img",{alt:t,class:y.attachmentElementListItemThumb,src:i}):ne("calcite-icon",{class:y.attachmentElementListItemIcon,icon:g(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const a=t.getAttachmentPreviewUrl(e),i=e.name||this.messagesCommon.details;return a&&f(e)?ne("img",{alt:i,class:y.attachmentElementDetailPreviewImage,src:a,title:i}):[ne("calcite-icon",{class:y.attachmentElementDetailPreviewIcon,icon:g(e.contentType),scale:"l",textLabel:i,title:i}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await Z(e)}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){const t=this.selectedAttachmentDetails,a=t?.attachment.globalId;if(t&&a)try{await this.viewModel.stageReplaceAttachment(t.input.template.elementId,a,e)}finally{this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails,a=t?.attachment.globalId;t&&a&&this.viewModel.stageRenameAttachment(t.input.template.elementId,a,e)}_isSelectedAttachmentDeleteDisabled(){const e=this.selectedAttachmentDetails;if(!e)return!1;if(this.readOnly||this.effectiveDisabled)return!0;const t=e.input.minAttachmentCount;return null!=t&&e.input.attachments.length<=t}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return ne("div",{class:y.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){if(!this._associationsEnabled)return;const{elementId:t}=e.template;return ne("div",{class:y.utilityNetworkAssociationsElementInput,"data-testid":t,key:t})}getCommonInputProps(e){const{template:t,valid:a,value:i,minLength:n,maxLength:l,required:s,fieldName:o,editable:r,userHasChangedValue:c,range:{max:d,min:m}}=e,h=!r||this.readOnly,u=!h&&this.effectiveDisabled;let p=t.hint??void 0,g=!1;return i===L&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":a?"false":"true",class:this.classes(y.fieldInput,h?y.inputDisabled:null),status:!c&&!this.viewModel.submitHasBeenAttempted||a?"idle":"invalid",maxLength:l&&l>-1?l:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:o,name:o,max:null!=d?d:void 0,min:null!=m?m:void 0,disabled:u,readOnly:h,onblur:this._onComponentBlur,required:s,placeholder:p,value:g?"":i??"",[oe]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(oe))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,a=e.querySelector("calcite-radio-button"),i=t||a;i&&this._afterComponentCreateOrUpdate(i)}_onComponentFocus(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,a)||this._markFieldInputTouched(a),this._focusedFieldInput=a}_markFieldInputTouched(e){this._touchedInputs.add(e.template.elementId)}_isMultipleChoiceCheckbox(e,t){return"CALCITE-CHECKBOX"===e.tagName&&null!=t.multipleChoiceInput}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),a=this._focusedFieldInput;this._attemptFocusOnNextRender&&a===t&&(this._attemptFocusOnNextRender=!1,le(e))}_onComponentBlur(){this._focusedFieldInput=null}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear()}_parseValue(e,t,a=!1){const i=t.multipleChoiceInput,n=t.multipleChoiceValues;if(i&&n){const l=i.choiceDelimiter,s=e;if(a){return B({input:t}).checked?null:n.length>0?n.join(l):null}const o=$(t.value,l).filter(e=>e!==L),r=new Set(o);s.checked?r.add(s.value):r.delete(s.value);const c=n.filter(e=>r.has(e));return c.length?c.join(l):null}if(_(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const a of t.domain.codedValues)if(a.name===e.selectedItems[0].textContent)return a.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const l=e.value;return null==l||""===l?null:"number"===t.dataType?"-0"===l||"-0."===l||"-0,"===l?l:parseFloat(l):"date"===t.field.type?parseFloat(l):l}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:a}=t.template;if(!t)return;const i=t?.value;if(_(t.template,"switch")&&"single"!==this.viewModel.mode){const e=n(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?i:e)}const l=this._parseValue(e,t);l!==i&&this.viewModel.setValue(a,l)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:a}=e.template,i=e.field.type,n=this._dateComponentMap.get(`${a}`);if(!n)return;const l=e.effectiveTimeZone;let s=e.value===L?void 0:e.value,o=null;"date-only"===i?o=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===i?(s=J(s),o=J(t.value)):o="timestamp-offset"===i?null!=t.value?Q({dateComponent:n.date,timeComponent:n.time,oldValue:s,timeZoneComponent:n.timeZone,defaultTimeZone:l}):null:null!=t.value?Y({oldValue:s,dateComponent:n.date,timeZone:l,timeComponent:n.time?.value===L?void 0:n.time}):null,s!==o&&(null!==o&&t.value?this.viewModel.setValue(`${a}`,o):this.viewModel.setValue(`${a}`,null))}};e([c()],de.prototype,"activeFeatureIndex",null),e([c()],de.prototype,"callbacks",null),e([c()],de.prototype,"disabled",null),e([c()],de.prototype,"effectiveTitle",null),e([c()],de.prototype,"effectiveDisabled",null),e([c()],de.prototype,"features",null),e([c()],de.prototype,"footerButtonInfos",null),e([c()],de.prototype,"footerNoticeInfos",null),e([c()],de.prototype,"map",null),e([c()],de.prototype,"maximumFeatureCount",null),e([c()],de.prototype,"maximumFeatureCountWithComplexForms",null),e([c()],de.prototype,"spatialReference",null),e([c()],de.prototype,"layerInfos",null),e([c()],de.prototype,"timeZone",null),e([c()],de.prototype,"headingLevel",void 0),e([c()],de.prototype,"icon",null),e([c(),ae("esri/t9n/common")],de.prototype,"messagesCommon",void 0),e([c(),ae("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],de.prototype,"messages",void 0),e([c(),ae("esri/core/t9n/Units")],de.prototype,"messagesUnits",void 0),e([c()],de.prototype,"page",null),e([c()],de.prototype,"readOnly",null),e([c()],de.prototype,"selectedAttachment",null),e([c()],de.prototype,"selectedAttachmentDetails",null),e([c()],de.prototype,"valid",null),e([c({type:A}),ie(["value-change","submit"])],de.prototype,"viewModel",void 0),e([c({type:D,nonNullable:!0})],de.prototype,"visibleElements",void 0),e([c()],de.prototype,"groupDisplay",void 0),e([c()],de.prototype,"_associationsEnabled",null),e([c()],de.prototype,"_attemptFocusOnNextRender",void 0),e([c()],de.prototype,"_formId",null),e([c()],de.prototype,"_focusedFieldInput",void 0),e([c()],de.prototype,"_relatedRecordsEnabled",null),e([c()],de.prototype,"_attachmentDialogInfo",void 0),e([c()],de.prototype,"_attachmentListFilterText",void 0),de=e([d("esri.widgets.BatchAttributeForm")],de);const me=de;export{me as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t,formatNumber as i}from"../intl.js";import{isSome as o}from"../core/arrayUtils.js";import{deprecateWidget as s}from"../core/deprecate.js";import n from"../core/Logger.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 p}from"../core/accessorSupport/decorators.js";import{isIntegerField as u}from"../layers/support/fieldUtils.js";import{isSubtypeGroupLayer as m,getSubtypesFromLayer as h}from"../layers/support/layerUtils.js";import{isRelatableFeatureSupportedLayer as v}from"../popup/support/featureUtils.js";import{isString as _}from"../support/guards.js";import g from"./Widget.js";import{Prompt as b}from"./Editor/components/Prompt.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 O,isFieldElementWithInputType as I,getErrorMessageForFieldInput as N,getIconForFeature as L,isNumberFieldInput as M,isInputInThisGroupInput as D,subtypeChangeShouldPrompt as A}from"./FeatureForm/featureFormUtils.js";import T from"./FeatureForm/FeatureFormViewModel.js";import x from"./FeatureForm/VisibleElements.js";import{loadCalciteComponents as V}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as S,getIntlOptionsForField as U,numberingSystem as E,prepareISOFieldValueForDateComponents as P,prepareUnixFieldValueForDateComponents as $,normalizeTimeOnlyString as j,getISOFieldValueFromDateComponents as W,getUnixFieldValueFromDateComponents as G}from"./support/dateUtils.js";import{globalCss as H}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 g{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 T,this.visibleElements=new x,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&&v(o)&&(n=o)}s.addRelatedRecord({parentFeature:o,relatedLayer:n,relationshipId:t})}},e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{s(n.getLogger(this),"Feature Form","arcgis-feature-form",{version:"5.0"})}),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)}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...i}=e;return i}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,H.widget,H.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(b,{...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,p="sequential"===this.groupDisplay;return z("calcite-block",{afterCreate:this._afterGroupCreate,class:this.classes(f.group,p?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(O(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 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-text-area",{...t,onCalciteTextAreaInput: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=u(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:_(l)?l:void 0,min:_(d)?d:void 0,numberingSystem:E,overlayPositioning:"fixed",readOnly:r,topLayerDisabled:this.topLayerDisabled,value:null!=s?`${s}`:void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget),onfocus:this._onComponentFocus})}_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,overlayPositioning:"fixed",readOnly:a,step:e.timeStep,value:null!=o?`${o}`:void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget),onfocus:this._onComponentFocus})}_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:p}=o,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:E,overlayPositioning:"fixed",readOnly:d,[Q]:i,onfocus:this._onComponentFocus},m=P(c,s),h=P(p,s),v=P(a,s);return z("div",{class:f.dateInputContainer,key:`${l}-date-time-container`},z("calcite-input-date-picker",{...u,class:r,"data-date-part":"date",key:`${l}-date-input`,max:m?.date??void 0,min:h?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:v.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),z("calcite-input-time-picker",{...u,class:r,"data-date-part":"time",key:`${l}-time-input`,step:e.timeStep,value:v.time??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),e.includeTimeOffset?z("calcite-input-time-zone",{...u,class:r,"data-date-part":"timeZone",disabled:d,key:`${l}-timezone-input`,value:v.timeZoneOffset??"0",onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},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:p}=this,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!s,numberingSystem:E,overlayPositioning:"fixed",readOnly:c,[Q]:o,onfocus:this._onComponentFocus},m=$(n,p),h=$(l,p),v=$(d,p);return z("div",{class:f.dateInputContainer,key:`${r}-date-time-container`},z("calcite-input-date-picker",{...u,class:a,"data-date-part":"date",key:`${r}-date-input`,max:h?.date??void 0,min:v?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:m.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),i?z("calcite-input-time-picker",{...u,class:a,"data-date-part":"time",key:`${r}-time-input`,step:1,value:m.time??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},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,overlayPositioning:"fixed",selectionMode:"single",topLayerDisabled:this.topLayerDisabled,onblur:c,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",{heading:e,key:`#${t}`,selected:i===t,value:`${t}`}))),p=[];d.length>0&&p.push(z("calcite-combobox-item-group",{key:"other",label:n.other},d)),c.length>0&&p.push(z("calcite-combobox-item-group",{key:"unsupported",label:s.subtypes.unsupportedDomainGroupTitle},c)),p.length>0?p.unshift(z("calcite-combobox-item-group",{key:"recommended",label:s.recommended},l)):p.push(...l);const u="INSERT"===a.editType,m=r.has(o),h=null==i&&(!u||m);return e.showNoValueOptionEnabled&&p.unshift(z("calcite-combobox-item",{heading:e.showNoValueLabel||s.empty,key:"empty-option",selected:h,value:""})),p}_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=!!I(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,value:i,onblur:()=>{this._focusedFieldName=null},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`,round:!0,scale:"s",width:"full",onclick:()=>{!e.updating&&e.originHasValidKey&&this._onAddRelatedRecordsClick(e,i,o)}},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,p=l?()=>l.remove(o):void 0;return z("calcite-list-item",{bind:this,description:s,key:`${t}-${o.uid}`,label:n,value:n,onCalciteListItemSelect:d,onmouseenter:c,onmouseleave:p},z("calcite-icon",{icon:L(o),slot:"content-start"}),z("calcite-icon",{flipRtl:!0,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:p,value:u}=e,m=this._inputsWithChanges.has(r),h=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":p?"false":"true",class:this.classes(f.fieldInput,h?f.inputDisabled:null),status:m&&!p?"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==u?"":`${u}`,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=$(t.value,this.timeZone).date??"";break;case"timestamp-offset":e.value=P(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);M(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,O(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&&D(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=j(r),l=j(e.value)):l="timestamp-offset"===o?null!=e.value?W({dateComponent:a.date,timeComponent:a.time,timeZoneComponent:a.timeZone,oldValue:r,defaultTimeZone:t}):null:null!=e.value?G({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:n,viewModel:a,messagesCommon:r,_subtypes:l}=this;if(this._updateFieldValue(s,i),!l?.length)return;const d=l.find(e=>e.code===i),c=l.find(e=>e.code===o)?.name??`${o}`;if(!d)return;const p=Promise.withResolvers();a.pendingSubtypeChoice=p;let u="update-fields";const m=[{label:n.subtypes.useDefaultValuesOption,value:"update-fields"},{label:n.subtypes.keepCurrentValuesOption,value:"keep-existing"}],h={context:"info",title:n.subtypes.changeWarningTitle,message:t(n.subtypes.changeWarning,{originalType:c,newType:d.name}),radios:m,defaultRadioSelection:"update-fields",onRadioSelection:e=>u=e,actions:{primary:{label:r.apply,action:()=>p.resolve(u),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>p.resolve("undo")}},cancel:()=>p.reject()};try{this.showPrompt(h);switch(await p.promise){case"update-fields":a.applySubtypeDefaults(d),this._validateContingenciesForNonNullFields();break;case"keep-existing":this._validateContingenciesForNonNullFields();break;case"undo":this._updateFieldValue(e.name,o)}}finally{a.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&O(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 I(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:n.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:T}),q(["value-change","submit"])],X.prototype,"viewModel",void 0),e([c({type:x,nonNullable:!0})],X.prototype,"visibleElements",void 0),e([c()],X.prototype,"test",null),X=e([p("esri.widgets.FeatureForm")],X);const Y=X;export{Y as default};
2
+ 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{deprecateWidget as s}from"../core/deprecate.js";import n from"../core/Logger.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 p}from"../core/accessorSupport/decorators.js";import{isIntegerField as u}from"../layers/support/fieldUtils.js";import{isSubtypeGroupLayer as m,getSubtypesFromLayer as h}from"../layers/support/layerUtils.js";import{isRelatableFeatureSupportedLayer as v}from"../popup/support/featureUtils.js";import{isString as _}from"../support/guards.js";import g from"./Widget.js";import{Prompt as b}from"./Editor/components/Prompt.js";import{css as y}from"./FeatureForm/css.js";import{isUtilityNetworkAssociationInput as f,isGroupInput as C,isFieldInput as F,isRelationshipInput as w,isTextElementInput as R,flattenInputs as k,isInputInGroupInput as O,isFieldElementWithInputType as I,getErrorMessageForFieldInput as N,getIconForFeature as L,isNumberFieldInput as M,isInputInThisGroupInput as D,subtypeChangeShouldPrompt as A}from"./FeatureForm/featureFormUtils.js";import T from"./FeatureForm/FeatureFormViewModel.js";import x from"./FeatureForm/VisibleElements.js";import{loadCalciteComponents as V}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as S,getIntlOptionsForField as U,numberingSystem as E,prepareISOFieldValueForDateComponents as P,prepareUnixFieldValueForDateComponents as $,normalizeTimeOnlyString as j,getISOFieldValueFromDateComponents as W,getUnixFieldValueFromDateComponents as G}from"./support/dateUtils.js";import{globalCss as H}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 g{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 T,this.visibleElements=new x,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&&v(o)&&(n=o)}s.addRelatedRecord({parentFeature:o,relatedLayer:n,relationshipId:t})}},e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{s(n.getLogger(this),"Feature Form","arcgis-feature-form",{version:"5.0"})}),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)}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...i}=e;return i}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(f),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(y.base,H.widget,H.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return z("div",null,z("form",{class:y.form,inert:!!this._prompt,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderReadOnlyNotice(),this._renderHeader(),this._renderContent()),this._prompt?z(b,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderReadOnlyNotice(){const{disabled:e,messages:t}=this;if(e&&this.visibleElements.readOnlyNotice)return z("calcite-notice",{class:y.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:y.description,key:"description"},i);return z("div",{class:y.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):f(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(y.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,p="sequential"===this.groupDisplay;return z("calcite-block",{afterCreate:this._afterGroupCreate,class:this.classes(y.group,p?y.groupSequential:null,c?y.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(O(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:y.label,key:`${n.id}-${o.uid}-${e.name}`},l=[z("div",{class:y.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 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-text-area",{...t,onCalciteTextAreaInput: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=u(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:_(l)?l:void 0,min:_(d)?d:void 0,numberingSystem:E,overlayPositioning:"fixed",readOnly:r,topLayerDisabled:this.topLayerDisabled,value:null!=s?`${s}`:void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget),onfocus:this._onComponentFocus})}_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,overlayPositioning:"fixed",readOnly:a,step:e.timeStep,value:null!=o?`${o}`:void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget),onfocus:this._onComponentFocus})}_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:p}=o,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:E,overlayPositioning:"fixed",readOnly:d,[Q]:i,onfocus:this._onComponentFocus},m=P(c,s),h=P(p,s),v=P(a,s);return z("div",{class:y.dateInputContainer,key:`${l}-date-time-container`},z("calcite-input-date-picker",{...u,class:r,"data-date-part":"date",key:`${l}-date-input`,max:m?.date??void 0,min:h?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:v.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),z("calcite-input-time-picker",{...u,class:r,"data-date-part":"time",key:`${l}-time-input`,step:e.timeStep,value:v.time??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),e.includeTimeOffset?z("calcite-input-time-zone",{...u,class:r,"data-date-part":"timeZone",disabled:d,key:`${l}-timezone-input`,value:v.timeZoneOffset??"0",onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},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:p}=this,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!s,numberingSystem:E,overlayPositioning:"fixed",readOnly:c,[Q]:o,onfocus:this._onComponentFocus},m=$(n,p),h=$(l,p),v=$(d,p);return z("div",{class:y.dateInputContainer,key:`${r}-date-time-container`},z("calcite-input-date-picker",{...u,class:a,"data-date-part":"date",key:`${r}-date-input`,max:h?.date??void 0,min:v?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:m.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),i?z("calcite-input-time-picker",{...u,class:a,"data-date-part":"time",key:`${r}-time-input`,step:1,value:m.time??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return z("calcite-input",{...i,class:this.classes(y.fieldInput,y.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,overlayPositioning:"fixed",selectionMode:"single",topLayerDisabled:this.topLayerDisabled,onblur:c,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",{heading:e,key:`#${t}`,selected:i===t,value:`${t}`}))),p=[];d.length>0&&p.push(z("calcite-combobox-item-group",{key:"other",label:n.other},d)),c.length>0&&p.push(z("calcite-combobox-item-group",{key:"unsupported",label:s.subtypes.unsupportedDomainGroupTitle},c)),p.length>0?p.unshift(z("calcite-combobox-item-group",{key:"recommended",label:s.recommended},l)):p.push(...l);const u="INSERT"===a.editType,m=r.has(o),h=null==i&&(!u||m);return e.showNoValueOptionEnabled&&p.unshift(z("calcite-combobox-item",{heading:e.showNoValueLabel||s.empty,key:"empty-option",selected:h,value:""})),p}_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:y.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=!!I(e.element,"switch")&&i===e.element.input.onValue;return z("calcite-switch",{...t,checked:o,class:y.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:y.inputRadioLabel,key:e,layout:"inline"},z("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:o,class:y.inputRadio,disabled:n.readOnly,name:t,value:i,onblur:()=>{this._focusedFieldName=null},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:y.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,round:!0,scale:"s",width:"full",onclick:()=>{!e.updating&&e.originHasValidKey&&this._onAddRelatedRecordsClick(e,i,o)}},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,p=l?()=>l.remove(o):void 0;return z("calcite-list-item",{bind:this,description:s,key:`${t}-${o.uid}`,label:n,value:n,onCalciteListItemSelect:d,onmouseenter:c,onmouseleave:p},z("calcite-icon",{icon:L(o),slot:"content-start"}),z("calcite-icon",{flipRtl:!0,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(y.label,y.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-right",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:y.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:y.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:y.listObserver,key:"feature-observer"})}_renderTextElementInput(e){return z("div",{class:y.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:p,value:u}=e,m=this._inputsWithChanges.has(r),h=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":p?"false":"true",class:this.classes(y.fieldInput,h?y.inputDisabled:null),status:m&&!p?"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==u?"":`${u}`,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=$(t.value,this.timeZone).date??"";break;case"timestamp-offset":e.value=P(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);M(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,O(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&&D(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=j(r),l=j(e.value)):l="timestamp-offset"===o?null!=e.value?W({dateComponent:a.date,timeComponent:a.time,timeZoneComponent:a.timeZone,oldValue:r,defaultTimeZone:t}):null:null!=e.value?G({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:n,viewModel:a,messagesCommon:r,_subtypes:l}=this;if(this._updateFieldValue(s,i),!l?.length)return;const d=l.find(e=>e.code===i),c=l.find(e=>e.code===o)?.name??`${o}`;if(!d)return;const p=Promise.withResolvers();a.pendingSubtypeChoice=p;let u="update-fields";const m=[{label:n.subtypes.useDefaultValuesOption,value:"update-fields"},{label:n.subtypes.keepCurrentValuesOption,value:"keep-existing"}],h={context:"info",title:n.subtypes.changeWarningTitle,message:t(n.subtypes.changeWarning,{originalType:c,newType:d.name}),radios:m,defaultRadioSelection:"update-fields",onRadioSelection:e=>u=e,actions:{primary:{label:r.apply,action:()=>p.resolve(u),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>p.resolve("undo")}},cancel:()=>p.reject()};try{this.showPrompt(h);switch(await p.promise){case"update-fields":a.applySubtypeDefaults(d),this._validateContingenciesForNonNullFields();break;case"keep-existing":this._validateContingenciesForNonNullFields();break;case"undo":this._updateFieldValue(e.name,o)}}finally{a.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&O(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 I(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:n.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:T}),q(["value-change","submit"])],X.prototype,"viewModel",void 0),e([c({type:x,nonNullable:!0})],X.prototype,"visibleElements",void 0),e([c()],X.prototype,"test",null),X=e([p("esri.widgets.FeatureForm")],X);const Y=X;export{Y as default};