@arcgis/core 5.2.0-next.33 → 5.2.0-next.35

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 (244) hide show
  1. package/analysis/Viewshed.d.ts +0 -5
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{39c994536ce6c1e5c956.js → 03350a56f840cffe5459.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{2628136bf9f47d238a24.js → 050aba7089318e1c7d53.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{dd5dddf7e422216d3806.js → 0a2f08298a3c932614f2.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{a844c4e031e77db11478.js → 0df978697328b6453c94.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0f8fcbd0650b6a924f75.js +1 -0
  8. package/assets/esri/core/workers/chunks/{83ae56c7fa8d84865605.js → 0f976bfb7db98c2c0e05.js} +1 -1
  9. package/assets/esri/core/workers/chunks/10510f76f8538c2dfb84.js +1 -0
  10. package/assets/esri/core/workers/chunks/{9508fa53da5f92a0ab70.js → 155940ef3d1888272d73.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{3f63b14b53b5ca716e3a.js → 18c4c437ded8bfbd3305.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{b60f24a6c777301803f4.js → 1958facb000b6c16bfe4.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{1664434dc7a67c8ce453.js → 1ad5fcae6d6a9801cf58.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{390fda094fa8695d98cf.js → 22c447fcc9a28afeb6e3.js} +1 -1
  15. package/assets/esri/core/workers/chunks/24aa98cb2021ddd789ce.js +1 -0
  16. package/assets/esri/core/workers/chunks/{7656900713e55036c3c1.js → 29542a3d7f3fa8d42380.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{1e386475937e02b3f523.js → 2b669473aa2c7cfb63c7.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{c8091e8fd7ca43a4490a.js → 2bb3494659609594c4ca.js} +1 -1
  19. package/assets/esri/core/workers/chunks/2c00f89030c7a4201033.js +2 -0
  20. package/assets/esri/core/workers/chunks/{b75a4753cea6544da8bb.js → 2c61bb25578f73ba49bc.js} +1 -1
  21. package/assets/esri/core/workers/chunks/2d92f0042facb55edcff.js +1 -0
  22. package/assets/esri/core/workers/chunks/2da797ae5af9d2ede42d.js +1 -0
  23. package/assets/esri/core/workers/chunks/{34eb22ee13df24271532.js → 2e495a28494c2351837b.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{a0b78cbeb0e53107d819.js → 367a3031abbeff0c0090.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{aba7a053015a9738d8a0.js → 368db1420b8520beae05.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{92458803531fdfe1557a.js → 38a6a7c56c592f336a12.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{c63b315c6b76b4860fc5.js → 39ff5b2a05a90e1cb214.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{0a52373c4ba652e0ee0f.js → 3b914ca36e7e2b00cfe6.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{f6afc597eaf2afa9a4a0.js → 3dd8145ef89f32920177.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{b289c46ce2dc04d32e81.js → 3e8fa2a7a36881234479.js} +1 -1
  31. package/assets/esri/core/workers/chunks/406c7723e8db470822bf.js +1 -0
  32. package/assets/esri/core/workers/chunks/{5bf01e0eff8a78b65e9e.js → 4656a4bf430d7eed1465.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{43ef6dee2e1d9ed7885e.js → 472ec242cd3070e6acfe.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{1bbf5f5da5842b93f638.js → 4f08b69f4a33a114c5f7.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{c60b4f2dd5fccdf362a7.js → 514ab968c0d75062e6ab.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{ba1c4a8794ac55942e35.js → 51d7145f748b4865de7f.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{2f40193d1b2e534c5226.js → 570a4725b2a4a19c5148.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{1305690054214a9cf48d.js → 586ca90e46f5cbdfeece.js} +1 -1
  39. package/assets/esri/core/workers/chunks/595401947e74a0a67144.js +1 -0
  40. package/assets/esri/core/workers/chunks/{70cb825bb37f1977d2ab.js → 59c22bab85f9cdbb9948.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{b624796ff4a9d4c406bf.js → 61efc7f5fab1c2b1f764.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{c593539c2cce7a2b9d44.js → 6596b12bb286a0b45a68.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{bb1fad01d9f070e7d795.js → 661f50cb97604453f942.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{51a53011478e0cf96e0b.js → 6c02493a1c1deff49c7e.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{7832d94f35b79e27ee51.js → 6c746ac4bd2e57b8cb41.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{71f09e34d56c9fe5c307.js → 6d72a1bdc2664df62c4c.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{4ea325c829d3b82854b1.js → 7085b4c655a19694da04.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{9f3d37e5f42bf1529673.js → 71b672259bac2befd9c7.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{a536904fe6f3b16fdbdc.js → 757982a73174aa7ab0d1.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{d0321dd4b5b2d863eecd.js → 777b16b76db406c99c69.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{32b5d2537feefe6e94a3.js → 7d65a8ec5e1f871b9321.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{fe42fa2144691b9186fd.js → 828b64624c76156a6416.js} +1 -1
  53. package/assets/esri/core/workers/chunks/857532de88f21e8c3466.js +1 -0
  54. package/assets/esri/core/workers/chunks/85a280ee915010a8da3c.js +1 -0
  55. package/assets/esri/core/workers/chunks/{3d1e5bfd88771d4a0bf6.js → 866950e9ab96aebc6b32.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{8c62e2dabd1f1e13d244.js → 86731e276b31453bc235.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{25932fa010f9a32475c1.js → 88ec63501fa2f6fdadca.js} +1 -1
  58. package/assets/esri/core/workers/chunks/8a9b2efa0603e9fa4e8b.js +1 -0
  59. package/assets/esri/core/workers/chunks/{af3b060fdfa3b6174340.js → 8aa5bbf9a9b09815725a.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{2353fbc1ff4481dcfb1f.js → 8b68a69ab8fb1679e7b2.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{35b3ff25f5fe24fe15e2.js → 96860b6035e0b06672dd.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{e2f33945d838183a2192.js → 98685bd149dee1d6dc99.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{122892f365f5327d290c.js → 9de9cec5c644bc452294.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{456b77b8f13933a75b68.js → 9fb0431b0628dcb53004.js} +54 -54
  65. package/assets/esri/core/workers/chunks/{940ebb13618d38c6b459.js → a2a688dd2ed4565e01ff.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{47f21b65065558d583ca.js → a2e754df3215e8b00a8f.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{f59b76fde2cbd17f64b3.js → a3ae7c41832c7a8b0570.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{6dc60afb0c39bbb001a3.js → a3e86830460e52706a4d.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{c030a974a63155f450e9.js → a58b8903ae17acf117d6.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{c4a2ec2e5897300163ac.js → ab3d1c00ef514b61ce0b.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{b324bdb9c74fc3f956db.js → add79af151e3eb560599.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{3b3f91a61e3f29af1fb2.js → ae5363956b4467208e04.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{38b69fba9ae4ccbae6b7.js → afaf6874a645854c3357.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{36913f0f944a9eb82cd3.js → b24b7411a73d1da87c30.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{a3393780655152102c45.js → b97b83159fec34f383af.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{977e6f589bd266d6067d.js → bbcb213d20693fcad5be.js} +12 -12
  77. package/assets/esri/core/workers/chunks/{8ade399db21938822a7c.js → bec660ee2e7828f965e2.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{6b56971783bf4c31a563.js → c19fe4f31e4ef84bbcf6.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{5cccb8b06014ccef30f8.js → c228b058dd91bf0e1102.js} +1 -1
  80. package/assets/esri/core/workers/chunks/c2a02c33462bcdabd39d.js +1 -0
  81. package/assets/esri/core/workers/chunks/{cb30e8a66d6dcfebd439.js → cda2bae39135e5519d8c.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{414691f7758c78e2a704.js → cfbbfa5edffa57bd3a8e.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{de83c177f8a1234a5b2e.js → cffef41791f0cfa6c26c.js} +1 -1
  84. package/assets/esri/core/workers/chunks/d0217187aed8bb7038f4.js +1 -0
  85. package/assets/esri/core/workers/chunks/{70c94bcfa20453134037.js → d1928a8c86a8966e5582.js} +1 -1
  86. package/assets/esri/core/workers/chunks/{58e0e50b6c3abaa4798f.js → d26b1a9f47b4b2744c89.js} +1 -1
  87. package/assets/esri/core/workers/chunks/{2baee42e1797a709fe4b.js → d4a96f0402172787823a.js} +1 -1
  88. package/assets/esri/core/workers/chunks/d7e17df1c3675bf3633e.js +1 -0
  89. package/assets/esri/core/workers/chunks/dd785e595cd08b2d6284.js +1 -0
  90. package/assets/esri/core/workers/chunks/{bd260798b8de09a1eeb2.js → e3a4695c31d3f9d55213.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{197b9f8483fad2258650.js → e6263e1983e703befe48.js} +1 -1
  92. package/assets/esri/core/workers/chunks/{6991ba1b204668e7d4da.js → e67a9f9298d63026e7f6.js} +1 -1
  93. package/assets/esri/core/workers/chunks/{4e803d12486c8de4c901.js → ee446250a40e5d89bb5a.js} +42 -42
  94. package/assets/esri/core/workers/chunks/{6f240fe78b299e6c4fcc.js → eeee7421f64a52074ff4.js} +1 -1
  95. package/assets/esri/core/workers/chunks/{1e109a521ca8772fdf04.js → eef7e0bee19c4258ba55.js} +1 -1
  96. package/assets/esri/core/workers/chunks/{49a45083a9a155614c1c.js → ef32e454012f3b0e3f77.js} +1 -1
  97. package/assets/esri/core/workers/chunks/{83ce38342796bd6d73ce.js → f137e544076482e348ad.js} +1 -1
  98. package/assets/esri/core/workers/chunks/{4ecc345c3732f7fc130f.js → f1f3fe9d2d96578f4f6b.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{e181d0f5562878b3dc01.js → f72f38e7609756a7f8ea.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{ef5d11581a98fb333ad2.js → f83e3ad67b60744afd6d.js} +1 -1
  101. package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
  102. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  103. package/chunks/FocusAreaColor.glsl.js +1 -10
  104. package/chunks/GaussianSplatComposition.glsl.js +4 -4
  105. package/chunks/OITAddEmission.glsl.js +6 -0
  106. package/chunks/OITFilterOpaque.glsl.js +4 -0
  107. package/chunks/RibbonLine.glsl.js +22 -22
  108. package/chunks/lerc-wasm.js +1 -1
  109. package/config.js +1 -1
  110. package/core/workers/workerFactory.js +1 -1
  111. package/form/elements/inputs/attachments/AttachmentInput.js +1 -1
  112. package/geometry/support/frustum.js +1 -1
  113. package/geometry/support/plane.js +1 -1
  114. package/geometry/support/triangle.js +1 -1
  115. package/kernel.js +1 -1
  116. package/layers/AnnotationFeatureLayer.d.ts +110 -67
  117. package/layers/CSVLayer.d.ts +144 -175
  118. package/layers/CatalogLayer.d.ts +129 -132
  119. package/layers/DimensionFeatureLayer.d.ts +106 -63
  120. package/layers/FeatureLayer.d.ts +77 -150
  121. package/layers/GeoJSONLayer.d.ts +111 -168
  122. package/layers/OrientedImageryLayer.d.ts +125 -79
  123. package/layers/ParquetLayer.d.ts +116 -75
  124. package/layers/SubtypeGroupLayer.d.ts +86 -111
  125. package/layers/WFSLayer.d.ts +157 -127
  126. package/layers/catalog/CatalogFootprintLayer.d.ts +142 -129
  127. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  128. package/layers/graphics/sources/support/QueryTask.js +1 -1
  129. package/layers/mixins/EditBusLayer.js +1 -1
  130. package/layers/pointCloudFilters/PointCloudBitfieldFilter.d.ts +1 -1
  131. package/layers/raster/datasets/pixelReader.js +1 -1
  132. package/layers/raster/functions/pixelUtils.js +1 -1
  133. package/layers/video/VideoController.js +1 -1
  134. package/package.json +2 -2
  135. package/popup/Features.d.ts +2 -2
  136. package/popup/Features.js +1 -1
  137. package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
  138. package/support/revision.js +1 -1
  139. package/views/2d/engine/webgl/definitions.js +1 -1
  140. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  141. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  142. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  143. package/views/2d/input/MapViewInputManager.js +1 -1
  144. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  145. package/views/2d/layers/support/annodime/virtualFields.js +1 -1
  146. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  147. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  148. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  149. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  150. package/views/3d/analysis/Viewshed/types.d.ts +17 -0
  151. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +3 -14
  152. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  153. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  154. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  155. package/views/3d/input/SceneInputManager.js +1 -1
  156. package/views/3d/interactive/manipulators/RotateManipulator.js +1 -1
  157. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  158. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  159. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  160. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  161. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  162. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  163. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  164. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  165. package/views/3d/terrain/PatchRenderData.js +1 -1
  166. package/views/3d/webgl/ManagedFBO.js +1 -1
  167. package/views/3d/webgl-engine/core/shaderLibrary/util/emissionFilter.glsl.js +2 -0
  168. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColor.glsl.js +1 -1
  169. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +1 -1
  170. package/views/3d/webgl-engine/effects/focusArea/FocusAreaVisualization.js +1 -1
  171. package/views/3d/webgl-engine/effects/transparency/OITAddEmission.glsl.js +2 -0
  172. package/views/3d/webgl-engine/effects/transparency/OITAddEmissionTechnique.js +2 -0
  173. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  174. package/views/3d/webgl-engine/effects/transparency/OITFilterOpaque.glsl.js +2 -0
  175. package/views/3d/webgl-engine/effects/transparency/OITFilterOpaqueTechnique.js +2 -0
  176. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  177. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  178. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  179. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
  180. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  181. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  182. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  183. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  184. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  185. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  186. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  187. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  188. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  189. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  190. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  191. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  192. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  193. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  194. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  195. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  196. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  197. package/views/3d/webgl-engine/materials/intersectWithPolygonOffset.js +1 -1
  198. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  199. package/views/3d/webgl-engine/shaders/CheckerBoardTechniqueConfiguration.js +1 -1
  200. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  201. package/views/3d/webgl-engine/shaders/GaussianSplatComposition.glsl.js +1 -1
  202. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  203. package/views/3d/webgl-engine/shaders/ImageMaterialTechniqueConfiguration.js +1 -1
  204. package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
  205. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +3 -3
  206. package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +1 -1
  207. package/views/input/BrowserEventSource.js +1 -1
  208. package/views/input/handlers/PreventTouchSelection.js +2 -0
  209. package/views/layers/FeatureLikeLayerView.d.ts +9 -64
  210. package/views/layers/GraphicsLayerView.d.ts +1 -1
  211. package/views/layers/ViewshedLayerView.d.ts +0 -10
  212. package/views/layers/types.d.ts +8 -1
  213. package/views/support/LayerViewManager.js +1 -1
  214. package/widgets/BatchAttributeForm/VisibleElements.js +1 -1
  215. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  216. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  217. package/widgets/BatchAttributeForm.js +1 -1
  218. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  219. package/widgets/Editor/VisibleElements.d.ts +14 -1
  220. package/widgets/FeatureForm.js +1 -1
  221. package/assets/esri/core/workers/chunks/209460f8aae3f9f8c9b8.js +0 -1
  222. package/assets/esri/core/workers/chunks/2f02880a7f081eb210cd.js +0 -1
  223. package/assets/esri/core/workers/chunks/4be31fcc5482a2526d2b.js +0 -1
  224. package/assets/esri/core/workers/chunks/58acc18b92533166135d.js +0 -1
  225. package/assets/esri/core/workers/chunks/6162f6735ea4622e54d8.js +0 -1
  226. package/assets/esri/core/workers/chunks/718d2d430c1a5a940b83.js +0 -1
  227. package/assets/esri/core/workers/chunks/a6379a8df8c08b729b9c.js +0 -1
  228. package/assets/esri/core/workers/chunks/b0253fe7b3529bc22270.js +0 -1
  229. package/assets/esri/core/workers/chunks/bd0829eb79efff5b7223.js +0 -1
  230. package/assets/esri/core/workers/chunks/c193b4a175a544c4fcd6.js +0 -1
  231. package/assets/esri/core/workers/chunks/d28169816c768d55aa09.js +0 -1
  232. package/assets/esri/core/workers/chunks/d7c0ab622caf495dbcef.js +0 -1
  233. package/assets/esri/core/workers/chunks/f10a339b16d84b650012.js +0 -2
  234. package/assets/esri/core/workers/chunks/f69d3ff8a69c1985bca3.js +0 -1
  235. package/assets/esri/core/workers/chunks/f847a4846c427f671455.js +0 -1
  236. package/chunks/OITBlendEmission.glsl.js +0 -6
  237. package/chunks/OITDimOpaque.glsl.js +0 -4
  238. package/views/2d/layers/support/annodime/fields.js +0 -2
  239. package/views/3d/webgl-engine/core/shaderLibrary/util/EmissionDimming.glsl.js +0 -2
  240. package/views/3d/webgl-engine/effects/transparency/OITBlendEmission.glsl.js +0 -2
  241. package/views/3d/webgl-engine/effects/transparency/OITBlendEmissionTechnique.js +0 -2
  242. package/views/3d/webgl-engine/effects/transparency/OITDimOpaque.glsl.js +0 -2
  243. package/views/3d/webgl-engine/effects/transparency/OITDimOpaqueTechnique.js +0 -2
  244. /package/assets/esri/core/workers/chunks/{f10a339b16d84b650012.js.LICENSE.txt → 2c00f89030c7a4201033.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import e from"../../core/Accessor.js";import{property as t,subclass as r}from"../../core/accessorSupport/decorators.js";let l=class extends e{constructor(o){super(o),this.errorsForNonVisibleFields=!0,this.featureInfo=!0,this.featureSwitcher=!0,this.loadingIndicator=!0,this.readOnlyNotice=!0}};o([t({type:Boolean,nonNullable:!0})],l.prototype,"errorsForNonVisibleFields",void 0),o([t({type:Boolean,nonNullable:!0})],l.prototype,"featureInfo",void 0),o([t({type:Boolean,nonNullable:!0})],l.prototype,"featureSwitcher",void 0),o([t({type:Boolean,nonNullable:!0})],l.prototype,"loadingIndicator",void 0),o([t({type:Boolean,nonNullable:!0})],l.prototype,"readOnlyNotice",void 0),l=o([r("esri.widgets.BatchAttributeForm.VisibleElements")],l);const i=l;export{i as default};
2
+ import{__decorate as o}from"tslib";import e from"../../core/Accessor.js";import{property as t,subclass as r}from"../../core/accessorSupport/decorators.js";let i=class extends e{constructor(o){super(o),this.errorsForNonVisibleFields=!0,this.featureInfo=!0,this.featureSwitcher=!0,this.loadingIndicator=!0,this.readOnlyNotice=!0,this.expressionsErrorNotice=!1}};o([t({type:Boolean,nonNullable:!0})],i.prototype,"errorsForNonVisibleFields",void 0),o([t({type:Boolean,nonNullable:!0})],i.prototype,"featureInfo",void 0),o([t({type:Boolean,nonNullable:!0})],i.prototype,"featureSwitcher",void 0),o([t({type:Boolean,nonNullable:!0})],i.prototype,"loadingIndicator",void 0),o([t({type:Boolean,nonNullable:!0})],i.prototype,"readOnlyNotice",void 0),o([t({type:Boolean,nonNullable:!0})],i.prototype,"expressionsErrorNotice",void 0),i=o([r("esri.widgets.BatchAttributeForm.VisibleElements")],i);const l=i;export{l as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../request.js";import a from"../../../core/Collection.js";import n from"../../../core/Error.js";import i from"../../../core/Logger.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import r from"../../../core/ReactiveMap.js";import o from"../../../core/ReactiveSet.js";import{generateBracedUUID as d}from"../../../core/uuid.js";import{property as l,subclass as h}from"../../../core/accessorSupport/decorators.js";import{getEffectiveLayerCapabilities as c}from"../../../layers/support/layerUtils.js";import m from"../../../rest/query/support/AttachmentInfo.js";import{getAttachmentCategoryForFile as p}from"../../Attachments/support/attachmentUtils.js";import{getAttachmentKey as u,getAttachmentUrl as g,preserveAttachmentFilenameExtension as y,attachmentValidationUtils as f}from"../attachmentUtils.js";import _ from"./EditableInput.js";import A from"./SingleFeatureInputAdapter.js";let U=-1;const v=["maximum-audio-length","maximum-file-size","maximum-image-size","minimum-number-of-files","maximum-number-of-files","maximum-video-length"];let S=class extends _{constructor(t){super(t),this.attachments=[],this.displayCount=3,this.group=null,this.single=new A({input:this}),this.type="attachment",this._initialAttachments=[],this._stagedAdds=new a,this._stagedDeletes=new o,this._stagedUpdates=new r,this._failedStagedUpdateHydrations=new o,this._pendingStagedUpdateHydrations=new r,this._temporaryAttachmentUrls=new r,this._validationCriterionStates=new r,this._hasUnsupportedFileTypeValidationError=!1}get allowUserRename(){return this.template.allowUserRename}get addDisabled(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return!this.editable||null!=t&&e>=t}get effectiveAttachmentCount(){return this._initialAttachments.length-this._stagedDeletes.size+this._stagedAdds.length}get accept(){const{categories:t}=this;if(!t.size)return;const e=[];return t.has("image")&&e.push("image/*"),t.has("audio")&&e.push("audio/*"),t.has("video")&&e.push("video/*"),t.has("document")&&e.push("text/*","application/*","model/*"),e.length>0?e.join(","):void 0}get categories(){const t=new Set;for(const e of this._nestableInputs)b(t,e.type);return t}get _nestableInputs(){const{input:t}=this;return null==t?[]:"attachment"===t.type?t.inputTypes??[]:[t]}get attachmentKeyword(){return this.template.attachmentKeyword?.trim()}get displayFilename(){return this.template.displayFilename}get allAttachmentsVisibleOnDefaultPage(){return this.defaultPageAttachments.length===this.attachments.length}get canUploadFiles(){const t=this._nestableInputs;return!t.length||t.some(x)}get hasCaptureInputs(){return this._nestableInputs.some(w)}get captureMediaType(){const t=new Set;for(const e of this._nestableInputs)if(w(e))switch(e.type){case"audio":t.add("audio");break;case"video":t.add("video");break;case"image":case"signature":t.add("image")}return 1===t.size?Array.from(t)[0]:null}get isCaptureOnly(){const t=this._nestableInputs;return!!t.length&&t.every(T)}get defaultPageAttachments(){return this.attachments.slice(0,this.displayCount)}get feature(){return this.single.feature}get hasAttachmentChanges(){return this._stagedAdds.length>0||this._stagedUpdates.size>0||this._stagedDeletes.size>0}get hasInvalidAttachmentName(){return!!this.allowUserRename&&this.attachments.some(t=>0===t.name.trim().length)}get attachmentCount(){return this.attachments.length}get hasMinimumAttachmentCountNotMet(){const t=this.minAttachmentCount;return null!=t&&(this.effectiveAttachmentCount<t&&!this.isCaptureOnly)}get hasReachedAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e===t}get hasExceededAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e>t}get hasPendingAttachmentUpdateData(){return this._pendingStagedUpdateHydrations.size>0}get input(){return this.template.input}get layer(){return this.single.layer}get maxAttachmentCount(){return this.template.maxAttachmentCount}get minAttachmentCount(){return this.template.minAttachmentCount}get supportsResize(){const{layer:t}=this;if(!t)return!1;const e=c(t);return!!e&&("attachment"in e&&!!e.attachment?.supportsResize)}get useOriginalFilename(){return this.template.useOriginalFilename}get valid(){return!(this._failedStagedUpdateHydrations.size>0||this.hasInvalidAttachmentName||this.hasExceededAttachmentLimit||this.hasMinimumAttachmentCountNotMet)}get _expressionLayer(){const t=this.layer;if(t)return"scene"===t.type&&"associatedLayer"in t&&null!=t.associatedLayer?t.associatedLayer:"feature"===t.type?t:void 0}destroy(){this._clearTemporaryAttachmentUrls()}applyFetchedAttachments(t){for(const e of t)this._normalizeAttachmentName(e);this._initialAttachments=t,this._failedStagedUpdateHydrations.clear(),this._recomputeAttachments()}applyStashedEdits(t){const{adds:e,deletes:a,updates:n}=t;for(const i of e){const t=this._getAttachmentKey(i.info);this._stagedAdds.add({data:i.data,globalId:i.globalId??d(),info:i.info,key:t}),this._setTemporaryAttachmentUrl(t,i.data)}for(const i of n){const t=this._getAttachmentKey(i.info);this._stagedUpdates.set(t,{contentType:i.contentType,data:i.data,info:i.info,key:t,name:i.name,size:F(i)}),this._setTemporaryAttachmentUrl(t,i.data)}for(const i of a){const t=this._getAttachmentKey(i.info);this._stagedDeletes.add(t)}this._recomputeAttachments()}clearAttachmentChanges(){this.clearValidationCriteriaState(),this._clearTemporaryAttachmentUrls(),this._stagedAdds.removeAll(),this._stagedUpdates.clear(),this._stagedDeletes.clear(),this._failedStagedUpdateHydrations.clear(),this._pendingStagedUpdateHydrations.clear(),this._recomputeAttachments()}clearValidationCriteriaState(){this._validationCriterionStates.clear(),this._hasUnsupportedFileTypeValidationError=!1}get hasInvalidValidationCriteria(){for(const t of this._validationCriterionStates.values())if("danger"===t)return!0;return!1}get hasUnsupportedFileTypeValidationError(){return this._hasUnsupportedFileTypeValidationError}get validationCriterionStates(){return this._validationCriterionStates}getValidationCriterionState(t){return this._validationCriterionStates.get(t)??null}stageAddAttachment(t){if(!this._assertEditable())throw new n("batch-attribute-form:not-editable","Cannot modify attachments when editableExpression is false.");const{contentType:e,data:a,name:i}=t,s=t.globalId??d(),r=a instanceof Blob?a.size:void 0,o=i.trim(),l=new m({contentType:e??void 0,globalId:s,id:U--,keywords:this.attachmentKeyword??void 0,name:o,size:r});return this._setTemporaryAttachmentUrl(s,a),this._stagedAdds.add({key:s,globalId:s,info:l,data:a}),this._recomputeAttachments(),l}async stageAddAttachments(t,e){if(this.clearValidationCriteriaState(),!this._assertEditable())return[];const a=t.filter(t=>this.isFileAllowed(t));if(this._setUnsupportedFileTypeValidationError(a.length!==t.length),0===a.length)return[];const n=[],i=new Map,s=Date.now(),r={},o=this.effectiveAttachmentCount,d=o+a.length;if(null!=this.minAttachmentCount&&this.minAttachmentCount>0&&this._setValidationCriterionState(r,"minimum-number-of-files",d>=this.minAttachmentCount?"success":"danger"),null!=this.maxAttachmentCount){const t=d<=this.maxAttachmentCount;if(this._setValidationCriterionState(r,"maximum-number-of-files",t?"success":"danger"),!t)return this._setValidationCriteriaState(r),[]}let l=!0;for(let h=0;h<a.length;h++){const t=a[h];await this._validateAttachmentFile(t,o+h+1,r)||(l=!1)}if(!l)return this._setValidationCriteriaState(r),[];for(let h=0;h<a.length;h++){const t=a[h],r=t instanceof File?t.name:`attachment-${s}_${h+1}`,o=await this._resolveAttachmentFilename(r,e),d=this._makeUniqueFilenameForOperation(i,o);n.push(this.stageAddAttachment({contentType:t.type,data:t,name:d}))}return this._setValidationCriteriaState(r),n}findAttachment(t){if(t)return this.attachments.find(e=>u(e)===t)}getAttachmentEditState(t){const e=this._getAttachmentKey(t),a=e?this._initialAttachments.find(t=>this._getAttachmentKey(t)===e):void 0,n=a?.name??null,i=e?this._stagedUpdates.get(e):void 0,s=i?.name??t.name??null;return{initialName:n,isDeleted:!!e&&this._stagedDeletes.has(e),isRenamed:null!=s&&null!=n&&s!==n,isReplaced:!0===i?.isReplacement}}getAttachmentPreviewUrl(t,e){const a=this._getAttachmentKey(t);return(a?this._temporaryAttachmentUrls.get(a):void 0)??g({attachment:t,supportsResizeAttachments:this.supportsResize,layer:this.layer,thumbnailSize:e})}async ensureStagedUpdateData(t){const e=this._getAttachmentKey(t);if(!e)return!1;const a=this._stagedUpdates.get(e);if(!a||a.data||this._stagedDeletes.has(e))return this._failedStagedUpdateHydrations.delete(e),!1;const n=this._pendingStagedUpdateHydrations.get(e);if(n)return await n;const i=this._hydrateStagedUpdateData(t);this._pendingStagedUpdateHydrations.set(e,i);try{return await i}finally{this._pendingStagedUpdateHydrations.get(e)===i&&this._pendingStagedUpdateHydrations.delete(e)}}async waitForPendingAttachmentUpdateData(){await Promise.allSettled(Array.from(this._pendingStagedUpdateHydrations.values()))}discardStagedEdits(t){if(!this._assertEditable())return;const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.delete(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}isFileAllowed(t){const{categories:e}=this;if(!e.size)return!0;const a=p(t);return null!=a&&e.has(a)}isStagedAttachmentAddition(t){return"number"==typeof t.id&&t.id<0}stageDeleteAttachment(t){if(!this._assertEditable())return;const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.add(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}stageRenameAttachment(t,e){if(!this._assertEditable())return;const a=this._getAttachmentKey(t);if(!a)return;const n=this._stagedAdds.find(t=>t.key===a);if(n){const a=y(t.name,e);return n.info.name=a,void this._recomputeAttachments()}const i=this._stagedUpdates.get(a),s=this._getInitialAttachment(a)?.name??null,r=0===t.name.trim().length?s??t.name:t.name,o=!0===i?.isReplacement&&null!=s&&e===s?s:y(r,e),d=null!=s&&o===s;if(d&&!0!==i?.isReplacement)return this._stagedUpdates.delete(a),this._failedStagedUpdateHydrations.delete(a),this._pendingStagedUpdateHydrations.delete(a),void this._recomputeAttachments();const l={key:a,...i,info:t};d?delete l.name:l.name=o,this._stagedUpdates.set(a,l),this._recomputeAttachments(),this.ensureStagedUpdateData(t)}async stageReplaceAttachment(t,e,a){if(this.clearValidationCriteriaState(),!this._assertEditable())return!1;if(!this.isFileAllowed(e))return this._setUnsupportedFileTypeValidationError(!0),!1;const n={},i=await this._validateAttachmentFile(e,void 0,n);if(this._setValidationCriteriaState(n),!i)return!1;const s=e instanceof File?e.name:t.name,r=await this._resolveAttachmentFilename(s,a);return this._stageReplaceAttachment(t,e,r),!0}toSubmitEdits(){const t=[],e=[],a=[],n=this.feature?.plainGraphic;if(!n||0===this._stagedAdds.length&&0===this._stagedUpdates.size&&0===this._stagedDeletes.size)return null;const i=this.attachmentKeyword;for(const s of this._stagedAdds)null!=s.data&&t.push({feature:n,contentType:s.info.contentType,data:s.data,info:s.info,globalId:s.info.globalId,keywords:i,name:s.info.name});for(const s of this._stagedUpdates.values()){const t=null==s.name||s.name.trim().length>0;if(null==s.data||!t)continue;const a=s.name??this._getInitialAttachment(s.key)?.name??s.info.name;e.push({feature:n,contentType:s.contentType,data:s.data,globalId:s.info.globalId,id:s.info.id,info:s.info,keywords:i,name:a})}for(const s of this._stagedDeletes.values()){const t=this._getInitialAttachment(s);t&&a.push({feature:n,contentType:t.contentType,globalId:t.globalId,id:t.id,info:t,keywords:i,name:t.name})}return 0===t.length&&0===e.length&&0===a.length?null:{label:this.template.label,keywords:i,adds:t,deletes:a,updates:e}}_assertEditable(){return!!this.editable||(i.getLogger(this).error("batch-attribute-form:not-editable","Cannot modify attachments when editableExpression is false."),!1)}_recomputeAttachments(){const t=[];for(const e of this._stagedAdds)t.push(e.info);for(const e of this._initialAttachments){const a=this._getAttachmentKey(e);if(a&&this._stagedUpdates.has(a)){const n=this._stagedUpdates.get(a),i=e.clone();null!=n.name&&(i.name=n.name),null!=n.contentType&&(i.contentType=n.contentType),null!=n.size&&(i.size=n.size),t.push(i);continue}t.push(e)}this.attachments=t}async _computeAttachmentFilename(t,e){const a=this.template.filenameExpressionExecutor;if(!a)return t;const n=this.single.feature,r=n?.plainGraphic,o=this._expressionLayer,{attachmentKeyword:d,description:l,label:h}=this.template,c={$originalfeature:n?.original,$editcontext:{editType:e.editType},$layer:o,$featureset:o,$datastore:o?.url,$feature:r,$map:e.map,$formElement:{attachmentKeyword:d,description:l,label:h}},m={rawOutput:!0,spatialReference:e.spatialReference,timeZone:e.timeZone};try{const e=a.isAsync?await a.executeAsync(c,m):a.execute(c,m);if("string"==typeof e&&e.trim().length>0){const{extension:a}=I(t);return z(e.trim(),a)}}catch(p){s(p)||i.getLogger(this).error("Failed evaluating attachment filename expression",p)}return t}async _resolveAttachmentFilename(t,e){return!1===this.useOriginalFilename?await this._computeAttachmentFilename(t,e):t}_makeUniqueFilenameForOperation(t,e){const a=e.toLowerCase(),n=t.get(a)??0;if(t.set(a,n+1),0===n)return e;const{base:i,extension:s}=I(e);return z(`${i}_${n}`,s)}_setValidationCriteriaState(t){this._validationCriterionStates.clear();for(const e of v){const a=t[e];a&&this._validationCriterionStates.set(e,a)}}_setUnsupportedFileTypeValidationError(t){this._hasUnsupportedFileTypeValidationError!==t&&(this._hasUnsupportedFileTypeValidationError=t)}_setValidationCriterionState(t,e,a){"danger"!==t[e]&&(t[e]=a)}async _validateAttachmentFile(t,e,a){let n=!0;const i=p(t);for(const s of this._nestableInputs){const e=f.getAttachmentCategoryForInputType(s.type);if(null==i||e===i){if("document"===s.type&&null!=s.maxFileSize){const e=t.size<=1048576*s.maxFileSize;this._setValidationCriterionState(a,"maximum-file-size",e?"success":"danger"),n=n&&e}if(("audio"===s.type||"video"===s.type)&&null!=s.maxDuration){const e=await f.getMediaDurationInSeconds(t,s.type),i=null!=e&&e<=s.maxDuration;this._setValidationCriterionState(a,"audio"===s.type?"maximum-audio-length":"maximum-video-length",i?"success":"danger"),n=n&&i}if("image"===s.type&&null!=s.maxImageSize){const e=await f.getImageDimensionsInPixels(t),i=e?Math.max(e.width,e.height):null,r=null==i||i<=s.maxImageSize;this._setValidationCriterionState(a,"maximum-image-size",r?"success":"danger"),n=n&&r}}}if(null!=e&&null!=this.maxAttachmentCount){const t=e<=this.maxAttachmentCount;this._setValidationCriterionState(a,"maximum-number-of-files",t?"success":"danger"),n=n&&t}return n}_stageReplaceAttachment(t,e,a){const n=this._getAttachmentKey(t);if(!n)return;const i=this._stagedAdds.find(t=>t.key===n);if(i)return i.data=e,i.info.name=a,i.info.contentType=e.type,i.info.size=e.size,this._setTemporaryAttachmentUrl(n,e),void this._recomputeAttachments();const s=this._stagedUpdates.get(n);this._setTemporaryAttachmentUrl(n,e),this._failedStagedUpdateHydrations.delete(n),this._pendingStagedUpdateHydrations.delete(n),this._stagedUpdates.set(n,{...s,key:n,info:t,isReplacement:!0,contentType:e.type||s?.contentType||t.contentType,data:e,name:a,size:e.size}),this._recomputeAttachments()}_getInitialAttachment(t){return this._initialAttachments.find(e=>this._getAttachmentKey(e)===t)}_normalizeAttachmentName(t){const{name:e}=t;"string"==typeof e&&(t.name=e.trim())}_getAttachmentKey(t){return u(t)}_clearStagedUpdateTracking(t){this._stagedUpdates.delete(t),this._failedStagedUpdateHydrations.delete(t),this._pendingStagedUpdateHydrations.delete(t)}async _hydrateStagedUpdateData(t){const a=this._getAttachmentKey(t),n=t.url;if(!a||!n)return!1;try{const{data:i}=await e(n,{responseType:"blob"});this._failedStagedUpdateHydrations.delete(a);const s=this._stagedUpdates.get(a);return!(!s||s.data||this._stagedDeletes.has(a))&&(this._stagedUpdates.set(a,{...s,info:t,isReplacement:s.isReplacement??!1,contentType:s.contentType??t.contentType??i.type,data:i}),!0)}catch(r){const t=this._stagedUpdates.get(a);return!t||t.data||this._stagedDeletes.has(a)||this._failedStagedUpdateHydrations.add(a),s(r)||i.getLogger(this).error("Failed to fetch attachment data for staged update",r),!1}}_setTemporaryAttachmentUrl(t,e){if(this._clearTemporaryAttachmentUrl(t),!(e instanceof Blob))return;const a=URL.createObjectURL(e);return this._temporaryAttachmentUrls.set(t,a),a}_clearTemporaryAttachmentUrl(t){const e=this._temporaryAttachmentUrls.get(t);e&&(URL.revokeObjectURL(e),this._temporaryAttachmentUrls.delete(t))}_clearTemporaryAttachmentUrls(){for(const t of this._temporaryAttachmentUrls.values())URL.revokeObjectURL(t);this._temporaryAttachmentUrls.clear()}};t([l()],S.prototype,"allowUserRename",null),t([l()],S.prototype,"addDisabled",null),t([l()],S.prototype,"effectiveAttachmentCount",null),t([l()],S.prototype,"accept",null),t([l()],S.prototype,"categories",null),t([l()],S.prototype,"attachmentKeyword",null),t([l()],S.prototype,"attachments",void 0),t([l()],S.prototype,"displayFilename",null),t([l({readOnly:!0})],S.prototype,"allAttachmentsVisibleOnDefaultPage",null),t([l()],S.prototype,"canUploadFiles",null),t([l()],S.prototype,"hasCaptureInputs",null),t([l()],S.prototype,"captureMediaType",null),t([l()],S.prototype,"isCaptureOnly",null),t([l({readOnly:!0})],S.prototype,"defaultPageAttachments",null),t([l()],S.prototype,"displayCount",void 0),t([l()],S.prototype,"feature",null),t([l()],S.prototype,"group",void 0),t([l()],S.prototype,"hasAttachmentChanges",null),t([l()],S.prototype,"hasInvalidAttachmentName",null),t([l()],S.prototype,"attachmentCount",null),t([l()],S.prototype,"hasMinimumAttachmentCountNotMet",null),t([l()],S.prototype,"hasReachedAttachmentLimit",null),t([l()],S.prototype,"hasExceededAttachmentLimit",null),t([l({readOnly:!0})],S.prototype,"hasPendingAttachmentUpdateData",null),t([l()],S.prototype,"input",null),t([l()],S.prototype,"layer",null),t([l()],S.prototype,"maxAttachmentCount",null),t([l()],S.prototype,"minAttachmentCount",null),t([l({readOnly:!0})],S.prototype,"single",void 0),t([l({readOnly:!0})],S.prototype,"type",void 0),t([l({readOnly:!0})],S.prototype,"supportsResize",null),t([l()],S.prototype,"useOriginalFilename",null),t([l({readOnly:!0})],S.prototype,"valid",null),t([l()],S.prototype,"_initialAttachments",void 0),t([l()],S.prototype,"_expressionLayer",null),t([l()],S.prototype,"_stagedAdds",void 0),t([l()],S.prototype,"_stagedDeletes",void 0),t([l()],S.prototype,"_stagedUpdates",void 0),t([l()],S.prototype,"_failedStagedUpdateHydrations",void 0),t([l()],S.prototype,"_pendingStagedUpdateHydrations",void 0),t([l()],S.prototype,"_temporaryAttachmentUrls",void 0),t([l()],S.prototype,"_hasUnsupportedFileTypeValidationError",void 0),t([l()],S.prototype,"hasInvalidValidationCriteria",null),t([l()],S.prototype,"hasUnsupportedFileTypeValidationError",null),t([l()],S.prototype,"validationCriterionStates",null),S=t([h("esri.widgets.BatchAttributeForm.inputs.AttachmentElementInput")],S);const C=S;function b(t,e){switch(e){case"audio":t.add("audio");break;case"document":t.add("document");break;case"image":case"signature":t.add("image");break;case"video":t.add("video")}}function T(t){return"document"!==t.type&&"capture"===t.inputMethod}function w(t){return T(t)}function x(t){return"document"===t.type||"capture"!==t.inputMethod}function F(t){return t.data&&"string"!=typeof t.data?t.data.size:t.info.size}function I(t){const e=t.lastIndexOf(".");return-1===e?{base:t,extension:null}:{base:t.slice(0,e),extension:t.slice(e+1)}}function z(t,e){return e?`${t}.${e}`:t}export{C as default};
2
+ import{__decorate as t}from"tslib";import e from"../../../request.js";import a from"../../../core/Collection.js";import n from"../../../core/Error.js";import i from"../../../core/Logger.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import r from"../../../core/ReactiveMap.js";import o from"../../../core/ReactiveSet.js";import{generateBracedUUID as d}from"../../../core/uuid.js";import{property as l,subclass as h}from"../../../core/accessorSupport/decorators.js";import{getEffectiveLayerCapabilities as c}from"../../../layers/support/layerUtils.js";import m from"../../../rest/query/support/AttachmentInfo.js";import{getAttachmentCategoryForFile as p}from"../../Attachments/support/attachmentUtils.js";import{getAttachmentKey as u,getAttachmentUrl as g,preserveAttachmentFilenameExtension as y,attachmentValidationUtils as f}from"../attachmentUtils.js";import _ from"./EditableInput.js";import A from"./SingleFeatureInputAdapter.js";let U=-1;const v=["maximum-audio-length","maximum-file-size","maximum-image-size","minimum-number-of-files","maximum-number-of-files","maximum-video-length"];let S=class extends _{constructor(t){super(t),this.attachments=[],this.displayCount=3,this.group=null,this.single=new A({input:this}),this.type="attachment",this._initialAttachments=[],this._stagedAdds=new a,this._stagedDeletes=new o,this._stagedUpdates=new r,this._failedStagedUpdateHydrations=new o,this._pendingStagedUpdateHydrations=new r,this._temporaryAttachmentUrls=new r,this._validationCriterionStates=new r,this._hasUnsupportedFileTypeValidationError=!1}get allowUserRename(){return this.template.allowUserRename}get addDisabled(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return!this.editable||null!=t&&e>=t}get effectiveAttachmentCount(){return this._initialAttachments.length-this._stagedDeletes.size+this._stagedAdds.length}get accept(){const{categories:t}=this;if(!t.size)return;const e=[];return t.has("image")&&e.push("image/*"),t.has("audio")&&e.push("audio/*"),t.has("video")&&e.push("video/*"),t.has("document")&&e.push("text/*","application/*","model/*"),e.length>0?e.join(","):void 0}get categories(){const t=new Set;for(const e of this._nestableInputs)b(t,e.type);return t}get _nestableInputs(){const{input:t}=this;return null==t?[]:"attachment"===t.type?t.inputTypes??[]:[t]}get attachmentKeyword(){return this.template.attachmentKeyword?.trim()}get displayFilename(){return this.template.displayFilename}get allAttachmentsVisibleOnDefaultPage(){return this.defaultPageAttachments.length===this.attachments.length}get canUploadFiles(){const t=this._nestableInputs;return!t.length||t.some(x)}get hasCaptureInputs(){return this._nestableInputs.some(w)}get captureMediaType(){const t=new Set;for(const e of this._nestableInputs)if(w(e))switch(e.type){case"audio":t.add("audio");break;case"video":t.add("video");break;case"image":case"signature":t.add("image")}return 1===t.size?Array.from(t)[0]:null}get isCaptureOnly(){const t=this._nestableInputs;return!!t.length&&t.every(T)}get defaultPageAttachments(){return this.attachments.slice(0,this.displayCount)}get feature(){return this.single.feature}get hasAttachmentChanges(){return this._stagedAdds.length>0||this._stagedUpdates.size>0||this._stagedDeletes.size>0}get hasInvalidAttachmentName(){return!!this.allowUserRename&&this.attachments.some(t=>0===t.name.trim().length)}get attachmentCount(){return this.attachments.length}get hasMinimumAttachmentCountNotMet(){const t=this.minAttachmentCount;return null!=t&&(this.effectiveAttachmentCount<t&&!this.isCaptureOnly)}get hasReachedAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e===t}get hasExceededAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e>t}get hasPendingAttachmentUpdateData(){return this._pendingStagedUpdateHydrations.size>0}get input(){return this.template.input}get layer(){return this.single.layer}get maxAttachmentCount(){return this.template.maxAttachmentCount}get minAttachmentCount(){return this.template.minAttachmentCount}get supportsResize(){const{layer:t}=this;if(!t)return!1;const e=c(t);return!!e&&("attachment"in e&&!!e.attachment?.supportsResize)}get useOriginalFilename(){return this.template.useOriginalFilename}get valid(){return!(this._failedStagedUpdateHydrations.size>0||this.hasInvalidAttachmentName||this.hasExceededAttachmentLimit||this.hasMinimumAttachmentCountNotMet)}get _expressionLayer(){const t=this.layer;if(t)return"scene"===t.type&&"associatedLayer"in t&&null!=t.associatedLayer?t.associatedLayer:"feature"===t.type?t:void 0}destroy(){this._clearTemporaryAttachmentUrls()}applyFetchedAttachments(t){for(const e of t)this._normalizeAttachmentName(e);this._initialAttachments=t,this._failedStagedUpdateHydrations.clear(),this._recomputeAttachments()}applyStashedEdits(t){const{adds:e,deletes:a,updates:n}=t;for(const i of e){const t=this._getAttachmentKey(i.info);this._stagedAdds.add({data:i.data,globalId:i.globalId??d(),info:i.info,key:t}),this._setTemporaryAttachmentUrl(t,i.data)}for(const i of n){const t=this._getAttachmentKey(i.info);this._stagedUpdates.set(t,{contentType:i.contentType,data:i.data,info:i.info,key:t,name:i.name,size:F(i)}),this._setTemporaryAttachmentUrl(t,i.data)}for(const i of a){const t=this._getAttachmentKey(i.info);this._stagedDeletes.add(t)}this._recomputeAttachments()}clearAttachmentChanges(){this.clearValidationCriteriaState(),this._clearTemporaryAttachmentUrls(),this._stagedAdds.removeAll(),this._stagedUpdates.clear(),this._stagedDeletes.clear(),this._failedStagedUpdateHydrations.clear(),this._pendingStagedUpdateHydrations.clear(),this._recomputeAttachments()}clearValidationCriteriaState(){this._validationCriterionStates.clear(),this._hasUnsupportedFileTypeValidationError=!1}get hasInvalidValidationCriteria(){for(const t of this._validationCriterionStates.values())if("danger"===t)return!0;return!1}get hasUnsupportedFileTypeValidationError(){return this._hasUnsupportedFileTypeValidationError}get validationCriterionStates(){return this._validationCriterionStates}getValidationCriterionState(t){return this._validationCriterionStates.get(t)??null}stageAddAttachment(t){if(!this._assertEditable())throw new n("batch-attribute-form:not-editable","Cannot modify attachments when editableExpression is false.");const{contentType:e,data:a,name:i}=t,s=t.globalId??d(),r=a instanceof Blob?a.size:void 0,o=i.trim(),l=new m({contentType:e??void 0,globalId:s,id:U--,keywords:this.attachmentKeyword??void 0,name:o,size:r});return this._setTemporaryAttachmentUrl(s,a),this._stagedAdds.add({key:s,globalId:s,info:l,data:a}),this._recomputeAttachments(),l}async stageAddAttachments(t,e){if(this.clearValidationCriteriaState(),!this._assertEditable())return[];const a=t.filter(t=>this.isFileAllowed(t));if(this._setUnsupportedFileTypeValidationError(a.length!==t.length),0===a.length)return[];const n=[],i=new Map,s=Date.now(),r={},o=this.effectiveAttachmentCount,d=o+a.length;if(null!=this.minAttachmentCount&&this.minAttachmentCount>0&&this._setValidationCriterionState(r,"minimum-number-of-files",d>=this.minAttachmentCount?"success":"danger"),null!=this.maxAttachmentCount){const t=d<=this.maxAttachmentCount;if(this._setValidationCriterionState(r,"maximum-number-of-files",t?"success":"danger"),!t)return this._setValidationCriteriaState(r),[]}let l=!0;for(let h=0;h<a.length;h++){const t=a[h];await this._validateAttachmentFile(t,o+h+1,r)||(l=!1)}if(!l)return this._setValidationCriteriaState(r),[];for(let h=0;h<a.length;h++){const t=a[h],r=t instanceof File?t.name:`attachment-${s}_${h+1}`,o=await this._resolveAttachmentFilename(r,e),d=this._makeUniqueFilenameForOperation(i,o);n.push(this.stageAddAttachment({contentType:t.type,data:t,name:d}))}return this._setValidationCriteriaState(r),n}findAttachment(t){if(t)return this.attachments.find(e=>u(e)===t)}getAttachmentEditState(t){const e=this._getAttachmentKey(t),a=e?this._initialAttachments.find(t=>this._getAttachmentKey(t)===e):void 0,n=a?.name??null,i=e?this._stagedUpdates.get(e):void 0,s=i?.name??t.name??null;return{initialName:n,isDeleted:!!e&&this._stagedDeletes.has(e),isRenamed:null!=s&&null!=n&&s!==n,isReplaced:!0===i?.isReplacement}}getAttachmentPreviewUrl(t,e){const a=this._getAttachmentKey(t);return(a?this._temporaryAttachmentUrls.get(a):void 0)??g({attachment:t,supportsResizeAttachments:this.supportsResize,layer:this.layer,thumbnailSize:e})}async ensureStagedUpdateData(t){const e=this._getAttachmentKey(t);if(!e)return!1;const a=this._stagedUpdates.get(e);if(!a||a.data||this._stagedDeletes.has(e))return this._failedStagedUpdateHydrations.delete(e),!1;const n=this._pendingStagedUpdateHydrations.get(e);if(n)return await n;const i=this._hydrateStagedUpdateData(t);this._pendingStagedUpdateHydrations.set(e,i);try{return await i}finally{this._pendingStagedUpdateHydrations.get(e)===i&&this._pendingStagedUpdateHydrations.delete(e)}}async waitForPendingAttachmentUpdateData(){await Promise.allSettled(Array.from(this._pendingStagedUpdateHydrations.values()))}discardStagedEdits(t){if(!this._assertEditable())return;const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.delete(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}isFileAllowed(t){const{categories:e}=this;if(!e.size)return!0;const a=p(t);return null!=a&&e.has(a)}isStagedAttachmentAddition(t){return"number"==typeof t.id&&t.id<0}stageDeleteAttachment(t){if(!this._assertEditable())return;const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.add(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}stageRenameAttachment(t,e){if(!this._assertEditable())return;const a=this._getAttachmentKey(t);if(!a)return;const n=this._stagedAdds.find(t=>t.key===a);if(n){const a=y(t.name,e);return n.info.name=a,void this._recomputeAttachments()}const i=this._stagedUpdates.get(a),s=this._getInitialAttachment(a)?.name??null,r=0===t.name.trim().length?s??t.name:t.name,o=y(r,!0===i?.isReplacement&&null!=s&&e===s?I(s).base:e),d=null!=s&&o===s;if(d&&!0!==i?.isReplacement)return this._stagedUpdates.delete(a),this._failedStagedUpdateHydrations.delete(a),this._pendingStagedUpdateHydrations.delete(a),void this._recomputeAttachments();const l={key:a,...i,info:t};d?delete l.name:l.name=o,this._stagedUpdates.set(a,l),this._recomputeAttachments(),this.ensureStagedUpdateData(t)}async stageReplaceAttachment(t,e,a){if(this.clearValidationCriteriaState(),!this._assertEditable())return!1;if(!this.isFileAllowed(e))return this._setUnsupportedFileTypeValidationError(!0),!1;const n={},i=await this._validateAttachmentFile(e,void 0,n);if(this._setValidationCriteriaState(n),!i)return!1;const s=e instanceof File?e.name:t.name,r=await this._resolveAttachmentFilename(s,a);return this._stageReplaceAttachment(t,e,r),!0}toSubmitEdits(){const t=[],e=[],a=[],n=this.feature?.plainGraphic;if(!n||0===this._stagedAdds.length&&0===this._stagedUpdates.size&&0===this._stagedDeletes.size)return null;const i=this.attachmentKeyword;for(const s of this._stagedAdds)null!=s.data&&t.push({feature:n,contentType:s.info.contentType,data:s.data,info:s.info,globalId:s.info.globalId,keywords:i,name:s.info.name});for(const s of this._stagedUpdates.values()){const t=null==s.name||s.name.trim().length>0;if(null==s.data||!t)continue;const a=s.name??this._getInitialAttachment(s.key)?.name??s.info.name;e.push({feature:n,contentType:s.contentType,data:s.data,globalId:s.info.globalId,id:s.info.id,info:s.info,keywords:i,name:a})}for(const s of this._stagedDeletes.values()){const t=this._getInitialAttachment(s);t&&a.push({feature:n,contentType:t.contentType,globalId:t.globalId,id:t.id,info:t,keywords:i,name:t.name})}return 0===t.length&&0===e.length&&0===a.length?null:{label:this.template.label,keywords:i,adds:t,deletes:a,updates:e}}_assertEditable(){return!!this.editable||(i.getLogger(this).error("batch-attribute-form:not-editable","Cannot modify attachments when editableExpression is false."),!1)}_recomputeAttachments(){const t=[];for(const e of this._stagedAdds)t.push(e.info);for(const e of this._initialAttachments){const a=this._getAttachmentKey(e);if(a&&this._stagedUpdates.has(a)){const n=this._stagedUpdates.get(a),i=e.clone();null!=n.name&&(i.name=n.name),null!=n.contentType&&(i.contentType=n.contentType),null!=n.size&&(i.size=n.size),t.push(i);continue}t.push(e)}this.attachments=t}async _computeAttachmentFilename(t,e){const a=this.template.filenameExpressionExecutor;if(!a)return t;const n=this.single.feature,r=n?.plainGraphic,o=this._expressionLayer,{attachmentKeyword:d,description:l,label:h}=this.template,c={$originalfeature:n?.original,$editcontext:{editType:e.editType},$layer:o,$featureset:o,$datastore:o?.url,$feature:r,$map:e.map,$formElement:{attachmentKeyword:d,description:l,label:h}},m={rawOutput:!0,spatialReference:e.spatialReference,timeZone:e.timeZone};try{const e=a.isAsync?await a.executeAsync(c,m):a.execute(c,m);if("string"==typeof e&&e.trim().length>0){const{extension:a}=I(t);return z(e.trim(),a)}}catch(p){s(p)||i.getLogger(this).error("Failed evaluating attachment filename expression",p)}return t}async _resolveAttachmentFilename(t,e){return!1===this.useOriginalFilename?await this._computeAttachmentFilename(t,e):t}_makeUniqueFilenameForOperation(t,e){const a=e.toLowerCase(),n=t.get(a)??0;if(t.set(a,n+1),0===n)return e;const{base:i,extension:s}=I(e);return z(`${i}_${n}`,s)}_setValidationCriteriaState(t){this._validationCriterionStates.clear();for(const e of v){const a=t[e];a&&this._validationCriterionStates.set(e,a)}}_setUnsupportedFileTypeValidationError(t){this._hasUnsupportedFileTypeValidationError!==t&&(this._hasUnsupportedFileTypeValidationError=t)}_setValidationCriterionState(t,e,a){"danger"!==t[e]&&(t[e]=a)}async _validateAttachmentFile(t,e,a){let n=!0;const i=p(t);for(const s of this._nestableInputs){const e=f.getAttachmentCategoryForInputType(s.type);if(null==i||e===i){if("document"===s.type&&null!=s.maxFileSize){const e=t.size<=1048576*s.maxFileSize;this._setValidationCriterionState(a,"maximum-file-size",e?"success":"danger"),n=n&&e}if(("audio"===s.type||"video"===s.type)&&null!=s.maxDuration){const e=await f.getMediaDurationInSeconds(t,s.type),i=null!=e&&e<=s.maxDuration;this._setValidationCriterionState(a,"audio"===s.type?"maximum-audio-length":"maximum-video-length",i?"success":"danger"),n=n&&i}if("image"===s.type&&null!=s.maxImageSize){const e=await f.getImageDimensionsInPixels(t),i=e?Math.max(e.width,e.height):null,r=null==i||i<=s.maxImageSize;this._setValidationCriterionState(a,"maximum-image-size",r?"success":"danger"),n=n&&r}}}if(null!=e&&null!=this.maxAttachmentCount){const t=e<=this.maxAttachmentCount;this._setValidationCriterionState(a,"maximum-number-of-files",t?"success":"danger"),n=n&&t}return n}_stageReplaceAttachment(t,e,a){const n=this._getAttachmentKey(t);if(!n)return;const i=this._stagedAdds.find(t=>t.key===n);if(i)return i.data=e,i.info.name=a,i.info.contentType=e.type,i.info.size=e.size,this._setTemporaryAttachmentUrl(n,e),void this._recomputeAttachments();const s=this._stagedUpdates.get(n);this._setTemporaryAttachmentUrl(n,e),this._failedStagedUpdateHydrations.delete(n),this._pendingStagedUpdateHydrations.delete(n),this._stagedUpdates.set(n,{...s,key:n,info:t,isReplacement:!0,contentType:e.type||s?.contentType||t.contentType,data:e,name:a,size:e.size}),this._recomputeAttachments()}_getInitialAttachment(t){return this._initialAttachments.find(e=>this._getAttachmentKey(e)===t)}_normalizeAttachmentName(t){const{name:e}=t;"string"==typeof e&&(t.name=e.trim())}_getAttachmentKey(t){return u(t)}_clearStagedUpdateTracking(t){this._stagedUpdates.delete(t),this._failedStagedUpdateHydrations.delete(t),this._pendingStagedUpdateHydrations.delete(t)}async _hydrateStagedUpdateData(t){const a=this._getAttachmentKey(t),n=t.url;if(!a||!n)return!1;try{const{data:i}=await e(n,{responseType:"blob"});this._failedStagedUpdateHydrations.delete(a);const s=this._stagedUpdates.get(a);return!(!s||s.data||this._stagedDeletes.has(a))&&(this._stagedUpdates.set(a,{...s,info:t,isReplacement:s.isReplacement??!1,contentType:s.contentType??t.contentType??i.type,data:i}),!0)}catch(r){const t=this._stagedUpdates.get(a);return!t||t.data||this._stagedDeletes.has(a)||this._failedStagedUpdateHydrations.add(a),s(r)||i.getLogger(this).error("Failed to fetch attachment data for staged update",r),!1}}_setTemporaryAttachmentUrl(t,e){if(this._clearTemporaryAttachmentUrl(t),!(e instanceof Blob))return;const a=URL.createObjectURL(e);return this._temporaryAttachmentUrls.set(t,a),a}_clearTemporaryAttachmentUrl(t){const e=this._temporaryAttachmentUrls.get(t);e&&(URL.revokeObjectURL(e),this._temporaryAttachmentUrls.delete(t))}_clearTemporaryAttachmentUrls(){for(const t of this._temporaryAttachmentUrls.values())URL.revokeObjectURL(t);this._temporaryAttachmentUrls.clear()}};t([l()],S.prototype,"allowUserRename",null),t([l()],S.prototype,"addDisabled",null),t([l()],S.prototype,"effectiveAttachmentCount",null),t([l()],S.prototype,"accept",null),t([l()],S.prototype,"categories",null),t([l()],S.prototype,"attachmentKeyword",null),t([l()],S.prototype,"attachments",void 0),t([l()],S.prototype,"displayFilename",null),t([l({readOnly:!0})],S.prototype,"allAttachmentsVisibleOnDefaultPage",null),t([l()],S.prototype,"canUploadFiles",null),t([l()],S.prototype,"hasCaptureInputs",null),t([l()],S.prototype,"captureMediaType",null),t([l()],S.prototype,"isCaptureOnly",null),t([l({readOnly:!0})],S.prototype,"defaultPageAttachments",null),t([l()],S.prototype,"displayCount",void 0),t([l()],S.prototype,"feature",null),t([l()],S.prototype,"group",void 0),t([l()],S.prototype,"hasAttachmentChanges",null),t([l()],S.prototype,"hasInvalidAttachmentName",null),t([l()],S.prototype,"attachmentCount",null),t([l()],S.prototype,"hasMinimumAttachmentCountNotMet",null),t([l()],S.prototype,"hasReachedAttachmentLimit",null),t([l()],S.prototype,"hasExceededAttachmentLimit",null),t([l({readOnly:!0})],S.prototype,"hasPendingAttachmentUpdateData",null),t([l()],S.prototype,"input",null),t([l()],S.prototype,"layer",null),t([l()],S.prototype,"maxAttachmentCount",null),t([l()],S.prototype,"minAttachmentCount",null),t([l({readOnly:!0})],S.prototype,"single",void 0),t([l({readOnly:!0})],S.prototype,"type",void 0),t([l({readOnly:!0})],S.prototype,"supportsResize",null),t([l()],S.prototype,"useOriginalFilename",null),t([l({readOnly:!0})],S.prototype,"valid",null),t([l()],S.prototype,"_initialAttachments",void 0),t([l()],S.prototype,"_expressionLayer",null),t([l()],S.prototype,"_stagedAdds",void 0),t([l()],S.prototype,"_stagedDeletes",void 0),t([l()],S.prototype,"_stagedUpdates",void 0),t([l()],S.prototype,"_failedStagedUpdateHydrations",void 0),t([l()],S.prototype,"_pendingStagedUpdateHydrations",void 0),t([l()],S.prototype,"_temporaryAttachmentUrls",void 0),t([l()],S.prototype,"_hasUnsupportedFileTypeValidationError",void 0),t([l()],S.prototype,"hasInvalidValidationCriteria",null),t([l()],S.prototype,"hasUnsupportedFileTypeValidationError",null),t([l()],S.prototype,"validationCriterionStates",null),S=t([h("esri.widgets.BatchAttributeForm.inputs.AttachmentElementInput")],S);const C=S;function b(t,e){switch(e){case"audio":t.add("audio");break;case"document":t.add("document");break;case"image":case"signature":t.add("image");break;case"video":t.add("video")}}function T(t){return"document"!==t.type&&"capture"===t.inputMethod}function w(t){return T(t)}function x(t){return"document"===t.type||"capture"!==t.inputMethod}function F(t){return t.data&&"string"!=typeof t.data?t.data.size:t.info.size}function I(t){const e=t.lastIndexOf(".");return-1===e?{base:t,extension:null}:{base:t.slice(0,e),extension:t.slice(e+1)}}function z(t,e){return e?`${t}.${e}`:t}export{C as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{getEffectiveFieldAlias as o}from"../../../../editing/fieldUtils.js";import i from"../../../../form/ExpressionInfo.js";import a from"../../../../form/elements/AttachmentElement.js";import{isMultipleChoiceInput as s}from"../../../../form/elements/inputs/inputUtils.js";import l from"../../../../form/elements/inputs/attachments/AttachmentInput.js";import{isAttachmentElement as m,isFieldElement as c,isGroupElement as p,isRelationshipElement as d,isTextElement as f,isUtilityNetworkAssociationsElement as u}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as x,isFieldVisibleByDefault as y}from"../../../../layers/support/fieldUtils.js";import{isNumber as h}from"../../../../support/guards.js";import{layerSupportsQueryAttachments as w,getLayerTimeZone as E}from"../../batchAttributeFormUtils.js";import{makeExpressionInfosMap as T,makeExecutorSetForFormElement as v}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as b}from"../AttachmentElementTemplate.js";import I from"../BatchFormTemplate.js";import{FieldElementTemplate as j}from"../FieldElementTemplate.js";import{GroupElementTemplate as P}from"../GroupElementTemplate.js";import{RelationshipElementTemplate as g}from"../RelationshipElementTemplate.js";import{TextElementTemplate as Z}from"../TextElementTemplate.js";import{UtilityNetworkAssociationsElementTemplate as A}from"../UtilityNetworkAssociationsElementTemplate.js";import{isGroupElementTemplate as F}from"./templateUtils.js";import{compileTextElementMarkdownToHTML as U}from"./textElementTemplateUtils.js";const C="expression/dea57012-47ca4b55a000-8df62742ed0c",L=e("form-attachment-filename-calculation"),B=()=>n.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function H(e,t,r=e.formTemplate){return await e.load(),r?.elements&&r.elements.length>0?V(r,e,t):N(e,t)}async function N(e,{arcadeExecutorProvider:t,attachmentsEnabled:r,formTimeZone:n}){const o=new Set(x(e)),i={arcadeExecutorProvider:t,formTimeZone:n,layer:e},a=[];for(const l of e.fields)D(l,e,o)&&a.push(z(l,i));const s=await Promise.all(a);return r&&await S(s,{arcadeExecutorProvider:t,expressionInfos:T(void 0),layer:e}),new I({elements:s,title:e.formTemplate?.title,preserveFieldValuesWhenHidden:!0})}function R(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type&&!1===r.editable&&!r.editableExpression)return!0}else if(R(r.elements??[]))return!0;return!1}async function S(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){if(!w(n))return;const o=await W(new a({displayFilename:!0,input:new l({attachmentAssociationType:"any"})}),{arcadeExecutorProvider:t,expressionInfos:r,layer:n});e.push(o)}async function V(e,t,r){let n=null;R(e.elements??[])&&(n=new i({title:"",name:C,expression:"false"}));const o=T(n?[...e.expressionInfos??[],n]:e.expressionInfos),a={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:s}=e;if(!s)return new I(a);let l=!1;const{arcadeExecutorProvider:m,formTimeZone:c}=r;for(const i of s){const e=await k(i,{arcadeExecutorProvider:m,expressionInfos:o,layer:t,formTimeZone:c});if(e){if(a.elements.push(e),l)continue;"attachment"===e.type&&(l=!0),F(e)&&e.elements.some(e=>("attachment"===e.type&&(l=!0),l))}}return e.supportsAttachmentElements||!r.attachmentsEnabled||l||await S(a.elements,{arcadeExecutorProvider:m,expressionInfos:o,layer:t}),new I(a)}async function W(e,{arcadeExecutorProvider:r,expressionInfos:n,layer:o}){let i=null;if(e.filenameExpression)try{i=await t(e.filenameExpression,L)}catch(l){B().error("Failed to compile attachment filename expression",l)}const a=new b({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,filenameExpressionExecutor:i,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),s=await v({element:e,expressionInfos:n,provider:r});return a.addLayer(o,s),a}async function k(e,t){return m(e)?W(e,{arcadeExecutorProvider:t.arcadeExecutorProvider,expressionInfos:t.expressionInfos,layer:t.layer}):c(e)?K(e,t):p(e)?O(e,t):d(e)?G(e,t):f(e)?$(e,t):u(e)?q(e,t):null}async function K(e,{arcadeExecutorProvider:t,expressionInfos:n,layer:o,formTimeZone:i}){const{fieldsIndex:a}=o,{description:l,domain:m,fieldName:c,hint:p,input:d,label:f}=e;if(null==c||!a.has(c))return B().warn(new r("batch-attribute-form:invalid-form-element-field",`Field element with label '${f}' does not refer to a valid field`)),null;if(!1!==e.editable||e.editableExpression||((e=e.clone()).editableExpression=C),d&&s(d)&&d.otherChoice){const e=d.otherChoice.fieldName,t=a.get(e);t&&t.name!==e&&(d.otherChoice=d.otherChoice.clone(),d.otherChoice.fieldName=t.name)}const u=new j({description:l,domain:m,field:a.get(c),hint:p,input:d,formTimeZone:i,layerTimeZone:E(o),label:f}),x=await v({element:e,expressionInfos:n,provider:t});return u.addLayer(o,x),u}async function O(e,t){const{arcadeExecutorProvider:r,expressionInfos:n,layer:o}=t,{description:i,label:a,initialState:s}=e,l=[];for(const p of e.elements){const e=await k(p,t);e&&l.push(e)}const m=new P({description:i,elements:l,label:a,initialState:s??"expanded"}),c=await v({element:e,expressionInfos:n,provider:r});return m.addLayer(o,c),m}async function G(e,t){const{description:r,label:n,displayCount:o,displayType:i,orderByFields:a,relationshipId:s}=e,{arcadeExecutorProvider:l,expressionInfos:m,layer:c,formTimeZone:p}=t,d=new g({description:r,...h(o)&&{displayCount:o},displayType:i,formTimeZone:p,label:n,layerTimeZone:E(c),orderByFields:a,relationshipId:s}),f=await v({element:e,expressionInfos:m,provider:l});return d.addLayer(c,f),d}async function $(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n,formTimeZone:o}){const{description:i,label:a,text:s,textFormat:l}=e,{fieldsIndex:m}=n,c=s&&"markdown"===l?await U(s):s,p=new Z({compiledText:c,description:i,fieldsIndex:m,formTimeZone:o,label:a,layerTimeZone:E(n)}),d=await v({element:e,expressionInfos:r,provider:t}),{expressionParts:f}=p;if(f.length){const e=await Promise.all(f.map(e=>{const n=r.get(e)?.expression??e;return t.getArcadeExecutor(n)}));d.textExpressions=e}return p.addLayer(n,d),p}async function q(e,t){const{associationTypes:r,description:n,label:o}=e,{arcadeExecutorProvider:i,expressionInfos:a,formTimeZone:s,layer:l}=t,m=new A({associationTypes:r,description:n,formTimeZone:s,label:o,layerTimeZone:E(l)}),c=await v({element:e,expressionInfos:a,provider:i});return m.addLayer(l,c),m}async function z(e,{arcadeExecutorProvider:t,layer:r,formTimeZone:n}){const i=o(e,r)||e.name,a=new j({field:e,formTimeZone:n,label:i,layerTimeZone:E(r)}),s={};return e.editable&&r.userHasUpdateItemPrivileges&&(s.editableExpression=await t.getArcadeExecutor("true")),a.addLayer(r,s),a}function D(e,t,r){return!r.has(e.name.toLowerCase())&&y(e,t)}export{H as createBatchFormTemplate,N as createBatchFormTemplateFromFields};
2
+ import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{getEffectiveFieldAlias as o}from"../../../../editing/fieldUtils.js";import i from"../../../../form/ExpressionInfo.js";import s from"../../../../form/elements/AttachmentElement.js";import{isMultipleChoiceInput as a}from"../../../../form/elements/inputs/inputUtils.js";import m from"../../../../form/elements/inputs/attachments/AttachmentInput.js";import l from"../../../../form/elements/inputs/attachments/AudioInput.js";import p from"../../../../form/elements/inputs/attachments/DocumentInput.js";import c from"../../../../form/elements/inputs/attachments/ImageInput.js";import d from"../../../../form/elements/inputs/attachments/VideoInput.js";import{isAttachmentElement as f,isFieldElement as u,isGroupElement as x,isRelationshipElement as y,isTextElement as h,isUtilityNetworkAssociationsElement as w}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as E,isFieldVisibleByDefault as T}from"../../../../layers/support/fieldUtils.js";import{isNumber as I}from"../../../../support/guards.js";import{layerSupportsQueryAttachments as v,getLayerTimeZone as b}from"../../batchAttributeFormUtils.js";import{makeExpressionInfosMap as j,makeExecutorSetForFormElement as P}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as g}from"../AttachmentElementTemplate.js";import Z from"../BatchFormTemplate.js";import{FieldElementTemplate as A}from"../FieldElementTemplate.js";import{GroupElementTemplate as F}from"../GroupElementTemplate.js";import{RelationshipElementTemplate as U}from"../RelationshipElementTemplate.js";import{TextElementTemplate as C}from"../TextElementTemplate.js";import{UtilityNetworkAssociationsElementTemplate as L}from"../UtilityNetworkAssociationsElementTemplate.js";import{isGroupElementTemplate as B}from"./templateUtils.js";import{compileTextElementMarkdownToHTML as H}from"./textElementTemplateUtils.js";const N="expression/dea57012-47ca4b55a000-8df62742ed0c",V=e("form-attachment-filename-calculation"),R=()=>n.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function S(e,t,r=e.formTemplate){return await e.load(),r?.elements&&r.elements.length>0?O(r,e,t):W(e,t)}async function W(e,{arcadeExecutorProvider:t,attachmentsEnabled:r,formTimeZone:n}){const o=new Set(E(e)),i={arcadeExecutorProvider:t,formTimeZone:n,layer:e},s=[];for(const m of e.fields)X(m,e,o)&&s.push(Q(m,i));const a=await Promise.all(s);return r&&await K(a,{arcadeExecutorProvider:t,expressionInfos:j(void 0),layer:e}),new Z({elements:a,title:e.formTemplate?.title,preserveFieldValuesWhenHidden:!0})}function k(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type&&!1===r.editable&&!r.editableExpression)return!0}else if(k(r.elements??[]))return!0;return!1}async function K(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){if(!v(n))return;const o=await D(new s({displayFilename:!0,input:new m({attachmentAssociationType:"any",inputTypes:[new c,new p,new d,new l]})}),{arcadeExecutorProvider:t,expressionInfos:r,layer:n});e.push(o)}async function O(e,t,r){let n=null;k(e.elements??[])&&(n=new i({title:"",name:N,expression:"false"}));const o=j(n?[...e.expressionInfos??[],n]:e.expressionInfos),s={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new Z(s);let m=!1;const{arcadeExecutorProvider:l,formTimeZone:p}=r;for(const i of a){const e=await G(i,{arcadeExecutorProvider:l,expressionInfos:o,layer:t,formTimeZone:p});if(e){if(s.elements.push(e),m)continue;"attachment"===e.type&&(m=!0),B(e)&&e.elements.some(e=>("attachment"===e.type&&(m=!0),m))}}return e.supportsAttachmentElements||!r.attachmentsEnabled||m||await K(s.elements,{arcadeExecutorProvider:l,expressionInfos:o,layer:t}),new Z(s)}async function D(e,{arcadeExecutorProvider:r,expressionInfos:n,layer:o}){let i=null;if(e.filenameExpression)try{i=await t(e.filenameExpression,V)}catch(m){R().error("Failed to compile attachment filename expression",m)}const s=new g({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,filenameExpressionExecutor:i,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),a=await P({element:e,expressionInfos:n,provider:r});return s.addLayer(o,a),s}async function G(e,t){return f(e)?D(e,{arcadeExecutorProvider:t.arcadeExecutorProvider,expressionInfos:t.expressionInfos,layer:t.layer}):u(e)?$(e,t):x(e)?q(e,t):y(e)?z(e,t):h(e)?J(e,t):w(e)?M(e,t):null}async function $(e,{arcadeExecutorProvider:t,expressionInfos:n,layer:o,formTimeZone:i}){const{fieldsIndex:s}=o,{description:m,domain:l,fieldName:p,hint:c,input:d,label:f}=e;if(null==p||!s.has(p))return R().warn(new r("batch-attribute-form:invalid-form-element-field",`Field element with label '${f}' does not refer to a valid field`)),null;if(!1!==e.editable||e.editableExpression||((e=e.clone()).editableExpression=N),d&&a(d)&&d.otherChoice){const e=d.otherChoice.fieldName,t=s.get(e);t&&t.name!==e&&(d.otherChoice=d.otherChoice.clone(),d.otherChoice.fieldName=t.name)}const u=new A({description:m,domain:l,field:s.get(p),hint:c,input:d,formTimeZone:i,layerTimeZone:b(o),label:f}),x=await P({element:e,expressionInfos:n,provider:t});return u.addLayer(o,x),u}async function q(e,t){const{arcadeExecutorProvider:r,expressionInfos:n,layer:o}=t,{description:i,label:s,initialState:a}=e,m=[];for(const c of e.elements){const e=await G(c,t);e&&m.push(e)}const l=new F({description:i,elements:m,label:s,initialState:a??"expanded"}),p=await P({element:e,expressionInfos:n,provider:r});return l.addLayer(o,p),l}async function z(e,t){const{description:r,label:n,displayCount:o,displayType:i,orderByFields:s,relationshipId:a}=e,{arcadeExecutorProvider:m,expressionInfos:l,layer:p,formTimeZone:c}=t,d=new U({description:r,...I(o)&&{displayCount:o},displayType:i,formTimeZone:c,label:n,layerTimeZone:b(p),orderByFields:s,relationshipId:a}),f=await P({element:e,expressionInfos:l,provider:m});return d.addLayer(p,f),d}async function J(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n,formTimeZone:o}){const{description:i,label:s,text:a,textFormat:m}=e,{fieldsIndex:l}=n,p=a&&"markdown"===m?await H(a):a,c=new C({compiledText:p,description:i,fieldsIndex:l,formTimeZone:o,label:s,layerTimeZone:b(n)}),d=await P({element:e,expressionInfos:r,provider:t}),{expressionParts:f}=c;if(f.length){const e=await Promise.all(f.map(e=>{const n=r.get(e)?.expression??e;return t.getArcadeExecutor(n)}));d.textExpressions=e}return c.addLayer(n,d),c}async function M(e,t){const{associationTypes:r,description:n,label:o}=e,{arcadeExecutorProvider:i,expressionInfos:s,formTimeZone:a,layer:m}=t,l=new L({associationTypes:r,description:n,formTimeZone:a,label:o,layerTimeZone:b(m)}),p=await P({element:e,expressionInfos:s,provider:i});return l.addLayer(m,p),l}async function Q(e,{arcadeExecutorProvider:t,layer:r,formTimeZone:n}){const i=o(e,r)||e.name,s=new A({field:e,formTimeZone:n,label:i,layerTimeZone:b(r)}),a={};return e.editable&&r.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),s.addLayer(r,a),s}function X(e,t,r){return!r.has(e.name.toLowerCase())&&T(e,t)}export{S as createBatchFormTemplate,W as createBatchFormTemplateFromFields};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i}from"../core/deprecate.js";import a from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{destroyMaybe as s}from"../core/maybe.js";import l from"../core/ReactiveMap.js";import{watch as o,when as r,on as c,sync as d}from"../core/reactiveUtils.js";import{formatFileSize as m}from"../core/unitFormatUtils.js";import{property as u,subclass as h}from"../core/accessorSupport/decorators.js";import{formatDate as p}from"../intl/date.js";import{isIntegerField as g}from"../layers/support/fieldUtils.js";import{isString as v}from"../support/guards.js";import b from"./Widget.js";import{getAttachmentTypeCategory as f,getCalciteIconForAttachment as _}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as C,isImageAttachment as y,getAttachmentFilenameParts as A}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as w,getVisibleFieldInputValidationErrorMessage as I,isElementTemplateWithInputType as F,subtypeChangeShouldPrompt as k,flattenInputs as M}from"./BatchAttributeForm/batchAttributeFormUtils.js";import x from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as D}from"./BatchAttributeForm/css.js";import{makeViewingEditedAttachmentFooterButtons as S,makeViewingAttachmentFooterButtons as E,makeCancelFooterButton as O,makeDefaultFooterButtons as L}from"./BatchAttributeForm/interfaceUtils.js";import T from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as V,isFieldInput as R,isTextElementInput as N,isRelationshipElementInput as P,isAttachmentElementInput as U,isUtilityNetworkAssociationsElementInput as B,differentValuesString as $,getNormalizedFieldName as z,isGroupedInput as j}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as H,getMultipleChoiceCheckboxState as W,otherChoiceCheckedPlaceholderValue as G,getUpdatedMultipleChoiceValueForFeature as Z,getMultipleChoiceSelectAllState as q,splitMultipleChoiceValue as K,canRestoreMultipleChoiceOtherChoiceDraftValue as X}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{loadRelationshipDetailsComponents as J,RelationshipDetails as Q}from"./BatchAttributeForm/rendered-content/RelationshipDetails.js";import{Prompt as Y}from"./Editor/components/Prompt.js";import{downloadAttachmentInfo as ee}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as te}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as ie,getIntlOptionsForField as ae,prepareISOFieldValueForDateComponents as ne,prepareUnixFieldValueForDateComponents as se,normalizeTimeOnlyString as le,getISOFieldValueFromDateComponents as oe,getUnixFieldValueFromDateComponents as re}from"./support/dateUtils.js";import{globalCss as ce}from"./support/globalCss.js";import{Heading as de}from"./support/Heading.js";import{calciteListFilterProps as me}from"./support/listUtils.js";import{messageBundle as ue,vmEvent as he,tsx as pe}from"./support/widget.js";import{setFocus as ge}from"./support/widgetUtils.js";import{isEmptyValue as ve}from"./support/forms/formUtils.js";const be="data-element-id",fe="data-field-name",_e="esri_BatchAttributeForm_select_all",Ce="esri_BatchAttributeForm_other_choice";let ye=class extends b{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.featureTableMessages=null,this.messagesUnits=null,this.viewModel=new x,this.visibleElements=new T,this.groupDisplay="all",this._associationsList=null,this._associationsWidgetsMap=new l,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._pendingSubtypeChoice=null,this._batchSwitchInputInitialValues=new Map,this._listObserverNode=null,this._listObserver=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.viewModel.activeRelationshipInput?.incrementPage()},{root:window.document}),this._attachmentDialogInfo=null,this._attachmentListFilterText="",this._attachmentFileInputMap=new Map,this._prompt=null,this._selectedAttachmentReplaceFileInput=null,this._afterListObserverCreated=e=>{this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)},this._afterListObserverRemoved=()=>{this._listObserverNode=null},this._maximizeSelectedAttachment=()=>{this._attachmentDialogInfo=this.selectedAttachmentDetails},this._enterAttachmentReplaceView=()=>{const e=this.selectedAttachmentDetails;this._canReplaceSelectedAttachment()&&e&&(e.input.clearValidationCriteriaState(),this.viewModel.setShowingSelectedAttachmentReplacePage(!0))},this._setSelectedAttachmentReplaceFileInput=e=>{this._selectedAttachmentReplaceFileInput=e},this._openSelectedAttachmentReplaceFilePicker=()=>{this._canReplaceSelectedAttachment()&&this._selectedAttachmentReplaceFileInput?.click()},this._resetSelectedAttachmentName=()=>{const e=this.selectedAttachmentDetails;if(!e?.attachment)return;const t=e.input.getAttachmentEditState(e.attachment).initialName;if(null==t)return;const i=e.input.template.elementId,a=C(e.attachment);this.viewModel.stageRenameAttachment(i,a,t)},this._closeAttachmentDialog=()=>{this.hideAttachmentDialog()},this._saveInputFromElement=this._saveInputFromElement.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=()=>{i(a.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...i}=e;return i}initialize(){this.addHandles([o(()=>this.features,()=>{this._dateComponentMap.clear(),H(this.viewModel,{includeDraftValues:!0})}),o(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),H(this.viewModel),this._setFocusableInput()}),o(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),r(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),o(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),o(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),c(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()}),o(()=>[this._associationsEnabled,this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs],()=>this._setUpAssociationsWidgets(),d),o(()=>this.viewModel.activeAssociationsInput,e=>this._onActiveAssociationsInputChange(e)),o(()=>this.groupDisplay,()=>this._syncGroupInputStates())])}loadDependencies(){return Promise.all([te({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"),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"),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")}),J()])}destroy(){this._destroyAssociationsWidgets(),this._associationsList=s(this._associationsList),this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=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:i}=this;return t?"replacing-attachment"===i?t.titles.replaceAttachment:"viewing-attachment-details"===i?t.titles.editAttachment:"adding-attachments"===i?t.titles.addAttachments:"viewing-attachments"===i?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:"":""}get effectiveDisabled(){return this.disabledOrReadOnly||this.viewModel.updating}get disabledOrReadOnly(){return this.disabled||this.readOnly}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get footerButtonInfos(){if(!this.features.length||!this.messages||!this.messagesCommon)return[];const{messages:e,messagesCommon:t,page:i}=this,a=this.effectiveDisabled;if("adding-attachments"===i||"replacing-attachment"===i)return[];if("viewing-attachment-details"===i){const t=this.selectedAttachmentDetails,i=t?.input?.getAttachmentEditState(t.attachment);if(!t?.input||!i)return[];return i.isRenamed||i.isReplaced?S({doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons,resetOnclick:()=>this._resetSelectedAttachmentChanges(),resetDisabled:this._disableAttachmentModification(t.input)}):E({deleteDisabled:this._disableAttachmentModification(t.input),deleteOnclick:()=>this._deleteSelectedAttachment(),doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons})}return"viewing-associated-features"===i?O({messages:t,purpose:"cancel-viewing-associated-features",onclick:()=>this.goBack()}):"viewing-associated-layers"===i?O({messages:t,purpose:"cancel-viewing-associated-layers",onclick:()=>this.goBack()}):"viewing-attachments"===i||"viewing-related-records"===i?[]:L({disabled:a||!this.valid,formId:this._formId,messages:e,callback:()=>this.submit()})}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 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)}get selectedAttachment(){return this.viewModel.selectedAttachment}get selectedAttachmentDetails(){return this.viewModel.selectedAttachmentDetails}get valid(){return this.viewModel.valid}get _formHeaderVisible(){return!("batch"===this.viewModel.mode||!this.viewModel.activeFeature)&&!(!this.viewModel.formDescription&&!this.viewModel.formTitle)}get _associationsEnabled(){const{callbacks:e}=this;return!(!e?.addAssociation&&!e?.editAssociatedFeature)}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._setFocusableInput(e.input),this.scheduleRender()}render(){return pe("div",{class:this.classes(D.base,ce.widget,ce.panel)},this._renderContent(),this._renderAttachmentDialog(),this._prompt?pe(Y,{...this._prompt,headingLevel:this.headingLevel}):void 0)}setActiveAssociationsInput(e){this.viewModel.setActiveAssociationsInput(e)}setActiveAssociationsLayer(e){this.viewModel.setActiveAssociationsLayer(e)}setActiveAssociationType(e){this.viewModel.setActiveAssociationType(e)}submit(){return this.viewModel.submit()}get test(){return{saveInput:this._saveInput.bind(this),pendingSubtypeChoice:this._pendingSubtypeChoice}}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:i}=e.dataset,a=n(this._dateComponentMap,`${i}`,()=>({}));switch(t){case"date":a.date=e;break;case"time":a.time=e;break;case"timeZone":a.timeZone=e}}_renderContent(){const{messages:e,viewModel:i}=this,{status:a}=i;return"failed"===a?i.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:i.maximumFeatureCountWithComplexForms})):i.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:i.maximumFeatureCount})):e.formFailedToLoad:i.expressionEvaluationFailed?this._renderErrorNotice(e.expressionEvaluationFailed):i.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===a&&this.visibleElements.loadingIndicator?pe("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return pe("calcite-notice",{class:D.noticeError,icon:!0,kind:t,open:!0},pe("div",{slot:"message"},e))}_renderForm(){return pe("form",{class:D.form,id:this._formId,inert:!!this._prompt,onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderPage())}_renderPage(){switch(this.page){case"adding-attachments":return this._renderAttachmentAddPage();case"viewing-attachment-details":case"replacing-attachment":return this._renderAttachmentDetailPage();case"viewing-attachments":return this._renderAttachmentListPage();case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewingAssociationsPage();case"viewing-related-categories":case"viewing-related-records":return this._renderRelationshipListPage();default:return this._renderDefaultPage()}}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let a;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(a=w(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?a+=` (${e.map(e=>e.label).join(", ")})`:a=null}else a+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return a?this._renderErrorNotice(a,"danger"):null}_renderDefaultPage(){return[this._renderReadOnlyNotice(),this._renderFormHeader(),this._renderFormContent()]}_renderReadOnlyNotice(){if((this.disabled||this.readOnly)&&this.visibleElements.readOnlyNotice)return pe("calcite-notice",{class:D.disabledNotice,icon:"read-only-non-editable",kind:"brand",open:!0,scale:"s",width:"full"},pe("div",{slot:"message"},this.featureFormMessages.disabledForm))}_renderFormHeader(){const{formTitle:e,formDescription:t}=this.viewModel;if(!this._formHeaderVisible)return;const i=e?pe(de,{key:"title",level:this.headingLevel},e):void 0,a=t?pe("p",{class:D.description,key:"description"},t):void 0;return pe("div",{class:D.formHeader},i,a)}_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 V(e)?this._renderGroupInput(e):R(e)?this._renderLabeledField(e):N(e)?this._renderTextComponent(e):P(e)?this._renderRelationshipElementInput(e):U(e)?this._renderAttachmentElementInput(e):B(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:a}=e,n=t.filter(e=>e.visible),s=e.label??"",l=this._focusedFieldInput?.group===e,o="sequential"===this.groupDisplay;return pe("calcite-block",{class:this.classes(D.group,o?D.groupSequential:null,l?D.groupActive:null,this.disabled?D.inputDisabled:null),collapsible:!0,description:e.description??void 0,expanded:a,heading:s,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:s,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0},onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:a,required:n,dataType:s}=e,l=n?t(this.messages.requiredFieldLabel,{name:a}):a;return pe("calcite-label",{"aria-label":l,class:D.label,key:`field--${i}`},pe("div",{class:D.labelTextContent,key:"labelTextContainer"},a,n?pe("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==s?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):null!==e.multipleChoiceChoices?this._renderMultipleChoiceComponent({input:e,props:t}):"date"===i?this._renderDateComponents(e,t):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{description:t}=e,i=this._getErrorToDisplay(e),a=i?I(e,i,this.messages):null;return a?pe("calcite-input-message",{icon:!0,status:"invalid"},a):t?pe("calcite-input-message",{class:D.description,icon:!1,status:"idle"},t):null}_renderCodedInputs({input:e,props:t}){const i=e.input?.type??null,a=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:a,props:t});default:return this._renderComboBoxComponent({options:a,props:t,input:e})}}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:i}=this,{multipleChoiceChoices:a,multipleChoiceInput:n,multipleChoiceValues:s}=e;if(!n||!a||!s)return null;const l=!0===n.includeSelectAllChoices,o=new Map;let r=s.length>0,c=!1;for(const b of s){const t=W({input:e,choiceValue:b});o.set(b,t),(t.checked||t.indeterminate)&&(c=!0),t.checked||(r=!1)}const d={checked:r,indeterminate:!r&&c},m=d.checked?i.deselectAllLabel:i.selectAllLabel,u=e.getMultipleChoiceOtherChoiceRenderState(this.messages.otherOptionLabel),h=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},p=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},g=t=>{const{fieldName:i}=u;i&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:i})},v=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:u.fieldName})};return pe("div",{class:D.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},l?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:d,selectAllLabel:m,handleSelectAllCheckboxChange:h}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:p}),u.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:l,otherChoiceRenderState:u,handleOtherChoiceCheckboxChange:g,handleOtherChoiceInputChange:v,differentValuesPlaceholder:i.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:i,handleSelectAllCheckboxChange:a}){return pe("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:D.multipleChoiceSelectAll,"data-element-id":e[be],disabled:e.readOnly||e.disabled,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:i,labelText:i,value:_e,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>a(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:i,handleChoiceCheckboxChange:a}){const{multipleChoiceChoices:n}=e;return n?n.map(e=>{const n=i.get(e.value)??{checked:!1,indeterminate:!1};return pe("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[be],disabled:t.readOnly||t.disabled,indeterminate:n.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>a(e),onfocus:t.onfocus})}):[]}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:i,handleOtherChoiceCheckboxChange:a,handleOtherChoiceInputChange:n,differentValuesPlaceholder:s}){return pe("div",{class:this.classes(D.multipleChoiceOtherChoice,t?D.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},pe("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:i.checkboxState.checked,class:e.class,"data-element-id":e[be],disabled:e.readOnly||e.disabled,indeterminate:i.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:i.label,labelText:i.label,value:Ce,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>a(e),onfocus:e.onfocus}),i.checkboxState.checked?pe("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":i.label,class:D.textElementInput,"data-element-id":e[be],disabled:e.readOnly||e.disabled,key:`${e.key}-other-choice-input`,maxLength:i.maxLength,placeholder:i.value===$?s:i.hint,type:"text",value:i.normalizedValue===$?"":i.normalizedValue?String(i.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:i=!1}){if(this._markFieldInputTouched(e),e.multipleChoiceInput&&!i&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const a=e.value,n=this._parseValue(t,e,i);n!==a&&await this.viewModel.setValue(e.template.elementId,n)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:i}){if(!i)return;const a=t.value,n=null==a||""===a?null:a;e.initializeExplicitMultipleChoiceOtherChoiceCheckedState(),e.stashMultipleChoiceOtherChoiceDraftValueForFeatures(e.features,n);const s=z(e,i);s&&await this.viewModel.setValueForFieldName(s,n,Array.from(e.features,e=>e.source))}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:i}){e.setExplicitMultipleChoiceOtherChoiceCheckedState(t),this._markFieldInputTouched(e),t||e.setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e.features.toArray());const a=z(e,i);if(!a)return;const n=new Map;for(const s of e.features){const a=s.getAttribute(i);if(t){if(!ve(a))continue;const t=e.getMultipleChoiceOtherChoiceDraftValue(s),i=X(t)?t:G;n.set(s,i);continue}null!=a&&n.set(s,null)}0!==n.size&&await this.viewModel.setValuePerFeatureForFieldName(a,new Map(Array.from(n,([e,t])=>[e.source,t])))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){if(!e.multipleChoiceInput||!e.multipleChoiceValues)return;const i=new Map(e.features.map(i=>[i,Z({input:e,choiceValue:t.value,currentValue:i.getAttribute(e.fieldName),isChecked:t.checked})]));0!==i.size&&await this.viewModel.setFieldInputValuePerFeature(e,i)}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===$||e.value===$)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[be]:t[be]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:$,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return pe("calcite-switch",{...t,checked:!!F(e.template,"switch")&&e.value===e.template.input.onValue,class:D.inputSwitch,disabled:t.readOnly||t.disabled,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:a,dropdown:n,group:s}=i;return pe("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onblur:()=>{this._focusedFieldInput=null},onCalciteDropdownSelect:({currentTarget:e})=>this._saveInputFromElement(e),onfocus:this._onComponentFocus},pe("calcite-button",{...a},e===$?this.messages.differentValuesPlaceholder:e),pe("calcite-dropdown-group",{selectionMode:s.mode},t.map(t=>pe("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const a="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),s=a&&e.showNoValueOptionEnabled&&!n?()=>{}:i.onblur,l={...i,onblur:s};return pe("calcite-combobox",{...l,clearDisabled:e.isSubtypeField,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:i.placeholder===this.messages.differentValuesPlaceholder?$:String(i.value),onCalciteComboboxChange:({currentTarget:t})=>{t.value!==$&&(e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveInputFromElement(t))}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const a=e=>e.map(e=>{const{value:t}=e,a=ve(e.value)?this.messages.empty:e.name;return pe("calcite-combobox-item",{heading:a,key:`#${t}`,selected:i.value===t,value:`${t}`})});let n=[];const{messages:s}=this;t.other.length>0&&n.push(pe("calcite-combobox-item-group",{key:"other",label:s.other},a(t.other))),t.unsupported.length>0&&n.push(pe("calcite-combobox-item-group",{key:"unsupported",label:s.unsupported},a(t.unsupported)));const l=a(t.recommended);n.length>0?n.unshift(pe("calcite-combobox-item-group",{key:"recommended",label:s.recommended},l)):n=l;const o=i.placeholder===this.messages.differentValuesPlaceholder,r=!o&&ve(i.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(pe("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),o&&n.unshift(pe("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:$,selected:!0,value:$})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const a=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:a})=>this._renderRadioButtons({label:t,value:a,selected:a===e.value,props:i}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,s=ve(e.value);a.unshift(this._renderRadioButtons({label:n,value:t,selected:s,props:i}))}return pe("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:D.inputRadioGroup,"data-field-name":i[fe],disabled:i.readOnly||i.disabled,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},a,i.placeholder===this.messages.differentValuesPlaceholder?pe("calcite-label",{class:D.placeholderRadio,key:i.label,layout:"inline"},pe("calcite-radio-button",{checked:!0,class:D.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:a}){return pe("calcite-label",{class:D.inputRadioLabel,key:a.label,layout:"inline"},pe("calcite-radio-button",{...a,afterCreate:void 0,afterUpdate:void 0,checked:t,class:D.inputRadio,disabled:a.readOnly||a.disabled,name:a.label,value:e,onblur:()=>{this._focusedFieldInput=null},onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInputFromElement(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?pe("calcite-text-area",{...t,class:this.classes(D.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInputFromElement(e)}):pe("calcite-input",{...t,class:this.classes(D.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderNumberComponent(e,t){const i=g(e.field);return pe("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return pe("calcite-input",{...i,class:this.classes(D.fieldInput,D.inputDisabled,D.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let a;switch(i.type){case"date":a=this._renderDateFieldComponents(e,t);break;case"date-only":a=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":a=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":a=this._renderTimestampOffsetFieldComponents(e,t);break;default:a=this._renderReadOnlyComponent(e,ie(i,t.value,{timeZone:e.effectiveTimeZone,...ae(e.template.field)}))}return e.value===$?[a,pe("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:a}_renderDateOnlyFieldComponent(e,t){const{class:i,disabled:a,key:n,readOnly:s}=t,{rawMax:l,rawMin:o}=e.range;return pe("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[be],"data-field-name":t[fe],disabled:a,key:`${n}-date-input`,max:v(l)?l:void 0,min:v(o)?o:void 0,overlayPositioning:"fixed",readOnly:s,topLayerDisabled:this.topLayerDisabled,value:e.value===$?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimeOnlyFieldComponent(e,t){const{class:i,disabled:a,key:n,readOnly:s}=t;return pe("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[be],"data-field-name":t[fe],disabled:a,key:`${n}-time-input`,overlayPositioning:"fixed",readOnly:s,value:e.value===$?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,disabled:a,key:n,readOnly:s}=t,{rawMax:l,rawMin:o}=e.range,r=e.effectiveTimeZone,c=ne(l,r),d=ne(o,r),m=ne(e.value===$?"":e.value,r),u=e.includeTimeOffset,h={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:a,[be]:t[be],[fe]:t[fe],onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s};return pe("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},pe("calcite-input-date-picker",{...h,class:i,"data-date-part":"date",key:`${n}-date-input`,max:c?.date??void 0,min:d?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:m.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),pe("calcite-input-time-picker",{...h,class:i,"data-date-part":"time",key:`${n}-time-input`,value:m.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?pe("calcite-input-time-zone",{...h,class:i,clearable:e.value===$||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,value:m.timeZoneOffset||"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,disabled:a,key:n,readOnly:s,min:l,max:o}=t,r=e.effectiveTimeZone,c=se(e.value===$?"":e.value,r),d=se(o,r),m=se(l,r),u=e.includeTime,h={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:a,[be]:t[be],[fe]:t[fe],onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s};return pe("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},pe("calcite-input-date-picker",{...h,class:i,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:m?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?pe("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${n}-time-input`,step:1,value:c.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){return this._relatedRecordsEnabled?pe(Q,{afterObserverCreated:this._afterListObserverCreated,afterObserverRemoved:this._afterListObserverRemoved,input:e,messages:this.messages,messagesCommon:this.messagesCommon,viewModel:this.viewModel}):null}_renderRelationshipListPage(){const{activeRelationshipInput:e}=this.viewModel;if(e)return this._renderRelationshipElementInput(e)}_renderAttachmentElementInput(e){if(!this.attachmentsEnabled)return;const{allAttachmentsVisibleOnDefaultPage:t,attachments:i,defaultPageAttachments:a,template:{description:n,elementId:s,label:l}}=e,o=t?i:a;return pe("div",{class:D.attachmentElementInput,"data-testid":`attachment-element-${s}`,key:`attachment-element-${s}`},l?pe("div",{class:D.attachmentElementLabel,key:`attachment-element-label-${s}`},l):null,n?pe("div",{class:D.description,key:`attachment-element-description-${s}`},n):null,i.length?this._renderAttachmentList(e,o,{label:l||this.messagesCommon.details,viewAllCount:t?null:i.length}):pe("div",{class:D.attachmentElementEmptyState,key:`attachment-element-empty-state-${s}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){const e=this.viewModel.selectedAttachmentListInput;if(e)return pe("div",{class:D.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,i){const{filterEnabled:a,label:n,viewAllCount:s}=i;return pe("calcite-list",{class:D.attachmentElementList,filterEnabled:a,filterPlaceholder:a?this.messages.attachments.searchAttachments:void 0,filterProps:a?me:void 0,filterText:a?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:a?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=s?this._renderViewAllAttachmentsItem(e,s):null)}_renderAttachmentListItems(e,t){const{elementId:i}=e.template;return t.map((t,a)=>{const n=this._formatAttachmentSize(t.size),s=this._getAttachmentLabel(t,a,n,e.displayFilename),l=s===n?void 0:n,o=C(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=c.isDeleted,m=!d&&(r||c.isRenamed||c.isReplaced);return pe("calcite-list-item",{class:D.attachmentElementListItem,description:l,key:`attachment-item-${o}`,label:s,onCalciteListItemSelect:r||d?void 0:()=>this._setSelectedAttachment({attachmentKey:o,elementId:i})},pe("div",{class:D.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,s,e)),m?pe("span",{class:D.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[pe("calcite-action",{disabled:this._disableAttachmentModification(e),icon:"x",scale:"s",slot:"actions-end",text:this.messagesCommon.delete,title:this.messagesCommon.delete,onclick:()=>this.viewModel.stageDeleteAttachment(i,C(t))})]:d?pe("calcite-chip",{label:this.messages.attachments.deleted,scale:"s",slot:"content-end"},this.messages.attachments.deleted):pe("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))})}_renderViewAllAttachmentsItem(e,i){const{elementId:a}=e.template,{viewAll:n}=this.messages.attachments;return pe("calcite-list-item",{class:D.attachmentElementListItem,description:t(this.messages.attachments.count,{count:i}),key:`attachment-item-view-all-${a}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(a)},pe("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,i=this.effectiveDisabled||e.addDisabled,a=this._renderAttachmentCountLimitsLabel(e),n=this._getAttachmentNoticeMessage(e),s=e.hasMinimumAttachmentCountNotMet||e.hasExceededAttachmentLimit?"danger":"info",l=e.canUploadFiles,o=e.isCaptureOnly&&!this.effectiveDisabled&&!n;return pe("div",{class:D.attachmentElementAddActions,key:`attachment-element-add-actions-${t}`},l?pe("calcite-button",{appearance:"outline",disabled:i,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach):null,this._renderAttachmentCaptureButton(e),o?this._renderAttachmentCaptureDisabledNotice(t):null,a?pe("div",{class:D.attachmentElementEmptyActionHint},a):null,!this.effectiveDisabled&&n?pe("calcite-notice",{closable:!1,icon:"danger"===s?"exclamation-mark-circle":"lightbulb",kind:s,open:!0,scale:"s",width:"full"},pe("div",{slot:"message"},n)):null)}_renderAttachmentCaptureButton(e){if(!e.hasCaptureInputs)return null;const t=e.captureMediaType;return pe("calcite-button",{appearance:"outline",disabled:!0,iconStart:Ae(t),kind:"neutral",round:!0,scale:"s"},this._getCaptureButtonLabel(t))}_getAttachmentNoticeMessage(e){const t=this.messages.attachments;return e.hasUnsupportedFileTypeValidationError?this._getUnsupportedFileTypeMessage():e.hasMinimumAttachmentCountNotMet&&this._shouldShowMinimumAttachmentNotice(e)?t.minimumNotMet:e.hasExceededAttachmentLimit?t.attachmentLimitExceeded:e.hasReachedAttachmentLimit?t.attachmentLimitReached:null}_shouldShowMinimumAttachmentNotice(e){return e.hasAttachmentChanges||this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId)}_getCaptureButtonLabel(e){const{capture:t,recordAudio:i,takePhoto:a,takeVideo:n}=this.messages.attachments;switch(e){case"image":return a||t;case"video":return n||t;case"audio":return i||t;default:return t}}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:i}=e.template;if(e.isCaptureOnly)return this._renderAttachmentCaptureDisabledNotice(i);const a=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,s=this.messages.attachments,l=s.dragAndDropFile,o="upload",r=e=>{this._attachmentFileInputMap.set(i,e)};return pe("div",{class:D.attachmentElementAddPanel,key:`attachment-element-add-panel-${i}`},pe("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(i)},afterUpdate:r,class:D.attachmentElementFileInput,"data-element-id":i,disabled:n,multiple:a,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?Array.from(t.files):[];this._stageAttachmentFiles(i,a),t.value=""}}),pe("div",{class:D.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(i,t)}},pe("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:o,scale:"l"}),pe("div",{class:D.attachmentElementAddDropzoneHeading},s.addFile),pe("div",{class:D.attachmentElementAddDropzoneDetail,title:l},l),pe("calcite-button",{appearance:"transparent",disabled:n,iconStart:"folder-open",kind:"brand",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(i,n)}},s.selectFile)),this._renderAttachmentValidationCriteria(e,{includeCountCriteria:!0}))}_renderAttachmentCaptureDisabledNotice(e){return pe("calcite-notice",{class:D.attachmentElementCaptureNotice,icon:!0,key:`attachment-element-capture-disabled-notice-${e}`,kind:"warning",open:!0,scale:"s"},pe("div",{slot:"message"},this.messages.attachments.captureMethodNotSupported))}async _stageAttachmentFiles(e,t){if(0===t.length)return;const i=this.viewModel.selectedAttachmentAddInput;let a=!0;try{a=(await this.viewModel.stageAddAttachments(e,t)).length>0&&!i?.hasInvalidValidationCriteria&&!i?.hasUnsupportedFileTypeValidationError}finally{a&&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:i}=e,a=C(t),n=!!i.getAttachmentPreviewUrl(t),s=!this._disableAttachmentModification(i)&&i.canUploadFiles,l=i.getAttachmentEditState(t);return pe("div",{class:D.attachmentElementDetail,key:`attachment-detail-panel-${i.template.elementId}-${a}`},pe("div",{class:D.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,i)),pe("div",{class:D.attachmentElementDetailActions},y(t)?pe("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,pe("calcite-button",{appearance:"outline",disabled:!n||l.isReplaced,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),pe("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})),pe("div",{class:D.attachmentElementDetailMetadata},pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),this._renderFileNameContent(t,i)),pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.size),pe("span",{class:D.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.type),pe("span",{class:D.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderFileNameContent(e,t){if(!t.allowUserRename)return pe("span",{class:D.attachmentElementDetailMetadataValue},e.name);const i=t.getAttachmentEditState(e),{baseName:a,extension:n}=A(e.name),s=this._disableAttachmentModification(t),l=!s&&0===e.name.trim().length;return[pe("div",{class:D.attachmentElementDetailFileNameRow,key:"file-name-row"},pe("calcite-input",{class:D.attachmentElementDetailFileNameInput,disabled:s,scale:"m",status:l?"invalid":"idle",suffixText:n,value:a,onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),pe("calcite-button",{appearance:"transparent",disabled:s||null==i.initialName||!i.isRenamed,iconStart:"reset",kind:"neutral",label:this.messages.footerButtons.reset,scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})),l?pe("calcite-input-message",{icon:!0,key:"file-name-message",status:"invalid"},this.messages.validationErrors.cannotBeNull):null]}_renderAttachmentReplacePanel(e){const{attachment:t,input:i}=e,a=this._disableAttachmentModification(i)||!i.canUploadFiles,n=i.template.elementId;return pe("div",{class:D.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${C(t)}`},pe("input",{accept:i.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:D.attachmentElementFileInput,disabled:a,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?.[0];i&&this._stageSelectedAttachmentReplacement(i),t.value=""}}),pe("div",{class:D.attachmentElementAddDropzone,"data-disabled":a?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),a)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},pe("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),pe("div",{class:D.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),pe("div",{class:D.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),pe("calcite-button",{appearance:"transparent",disabled:a,iconStart:"folder-open",kind:"brand",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),this._renderAttachmentValidationCriteria(i,{includeCountCriteria:!1}),pe("div",{class:D.attachmentElementDetailMetadata},pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),pe("span",{class:D.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:i}=e;return pe("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},pe("div",{class:D.attachmentElementDialogPreview},this._renderAttachmentPreviewImageForInput(t,i)))}_setSelectedAttachment(e){e?.elementId&&this._touchedInputs.add(e.elementId),this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){e&&this._touchedInputs.add(e),this.viewModel.setSelectedAttachmentAddElementId(e),this.viewModel.selectedAttachmentAddInput?.clearValidationCriteriaState(),this.hideAttachmentDialog()}_setAttachmentListElementId(e){e&&this._touchedInputs.add(e),this.viewModel.setSelectedAttachmentListElementId(e),this.hideAttachmentDialog()}_getAttachmentLabel(e,i,a,n){return!1!==n&&v(e.name)&&e.name.length>0?e.name:a!==this.messagesCommon.notApplicable?a:t(this.messages.attachments.attachmentNumberedLabel,{index:i+1})}_renderAttachmentCountLimitsLabel(e){const t=this.messages.attachments,i=null!=e.minAttachmentCount&&e.minAttachmentCount>0?this._renderAttachmentCountLimitLabel(t.minAttachmentsShort,e.minAttachmentCount,"min"):null,a=null!=e.maxAttachmentCount?this._renderAttachmentCountLimitLabel(t.maxAttachmentsShort,e.maxAttachmentCount,"max"):null;return i||a?[i,i&&a?pe("span",{key:"attachment-count-limits-separator"},", "):null,a]:null}_renderAttachmentCountLimitLabel(e,i,a){const n="__count__",[s,l]=t(e,{count:n}).split(n);return pe("span",{key:a},s,pe("span",{class:D.attachmentElementEmptyActionHintValue},i),l)}_renderAttachmentValidationCriteria(e,{includeCountCriteria:t}){const i=this._getAttachmentValidationCriteria(e,{includeCountCriteria:t}),a=`attachment-validation-criteria-${e.template.elementId}`;return 0===i.length?null:pe("div",{class:D.attachmentElementValidationCriteria,key:a},i.map(({key:e,message:t,state:i})=>pe("calcite-notice",{appearance:"danger"===i?"outline-fill":"transparent",closable:!1,icon:!0,key:e,kind:i,open:!0,scale:"s",width:"full"},pe("div",{slot:"message"},t))))}_getAttachmentValidationCriteria(e,{includeCountCriteria:i}){const a=[],n=e.validationCriterionStates,s=this.messages.attachments,l=this._getNestableAttachmentInputs(e.input);e.hasUnsupportedFileTypeValidationError&&a.push({key:"unsupported-file-type",message:this._getUnsupportedFileTypeMessage(),state:"danger"});for(const o of l)"document"===o.type&&null!=o.maxFileSize&&a.push({key:"maximum-file-size",message:t(s.maximumFileSize,{maxSize:this._formatAttachmentSizeLimitInMegabytes(o.maxFileSize)}),state:n.get("maximum-file-size")??"info"}),"audio"===o.type&&null!=o.maxDuration&&a.push({key:"maximum-audio-length",message:t(s.maximumAudioLength,{maxDuration:this._formatAttachmentDurationLimit(o.maxDuration)}),state:n.get("maximum-audio-length")??"info"}),"video"===o.type&&null!=o.maxDuration&&a.push({key:"maximum-video-length",message:t(s.maximumVideoLength,{maxDuration:this._formatAttachmentDurationLimit(o.maxDuration)}),state:n.get("maximum-video-length")??"info"}),"image"===o.type&&null!=o.maxImageSize&&a.push({key:"maximum-image-size",message:t(s.attachmentMustBeSmallerThan,{maxSize:`${o.maxImageSize}px`}),state:n.get("maximum-image-size")??"info"});return i&&null!=e.minAttachmentCount&&e.minAttachmentCount>0&&a.push({key:"minimum-number-of-files",message:t(s.minimumNumberOfFiles,{count:e.minAttachmentCount}),state:n.get("minimum-number-of-files")??"info"}),i&&null!=e.maxAttachmentCount&&a.push({key:"maximum-number-of-files",message:t(s.maximumNumberOfFiles,{count:e.maxAttachmentCount}),state:n.get("maximum-number-of-files")??"info"}),a}_getNestableAttachmentInputs(e){return null==e?[]:"attachment"===e.type?e.inputTypes?.slice()??[]:[e]}_getUnsupportedFileTypeMessage(){return this.featureTableMessages.errorFileUnsupported}_formatAttachmentSize(e){return null==e||Number.isNaN(e)?this.messagesCommon.notApplicable:m(this.messagesUnits,e)}_formatAttachmentSizeLimitInMegabytes(e){return m(this.messagesUnits,1048576*e)}_formatAttachmentDurationLimit(e){return p(1e3*Math.round(e),{...e>=3600?{hour:"2-digit",hourCycle:"h23"}:{},minute:"2-digit",second:"2-digit",timeZone:"UTC"})}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;const t=this.messages.attachments.attachmentTypes,i=f(e);return t?.[i]||e}_renderAttachmentPreviewThumbnail(e,t,i){const a=i.getAttachmentPreviewUrl(e,64);return a&&y(e)?pe("img",{alt:t,class:D.attachmentElementListItemThumb,src:a}):pe("calcite-icon",{class:D.attachmentElementListItemIcon,icon:_(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const i=t.getAttachmentPreviewUrl(e),a=e.name||this.messagesCommon.details;return i&&y(e)?pe("img",{alt:a,class:D.attachmentElementDetailPreviewImage,src:i,title:a}):[pe("calcite-icon",{class:D.attachmentElementDetailPreviewIcon,icon:_(e.contentType),scale:"l",textLabel:a,title:a}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await ee(e)}_canReplaceSelectedAttachment(){return!this.effectiveDisabled&&!!this.selectedAttachmentDetails?.input.canUploadFiles}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const i=t.input.template.elementId,a=C(t.attachment);let n=!1;try{n=await this.viewModel.stageReplaceAttachment(i,a,e)}finally{n&&this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const i=t.input.template.elementId,a=C(t.attachment);this.viewModel.stageRenameAttachment(i,a,e)}_resetSelectedAttachmentChanges(){const e=this.selectedAttachmentDetails;e?.attachment&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,C(e.attachment))}_deleteSelectedAttachment(){const e=this.selectedAttachmentDetails;if(!e?.attachment||this._disableAttachmentModification(e.input))return;const t=e.input.template.elementId,i=C(e.attachment);this.viewModel.stageDeleteAttachment(t,i),this._setSelectedAttachment(null)}_disableAttachmentModification(e){return this.disabledOrReadOnly||!e.editable}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return pe("div",{class:D.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 pe("div",{class:D.utilityNetworkAssociationsElementInput,"data-testid":t,key:t},this._associationsWidgetsMap.get(e)?.render())}getCommonInputProps(e){const{template:t,valid:i,value:a,minLength:n,maxLength:s,required:l,fieldName:o,editable:r,userHasChangedValue:c,range:{max:d,min:m}}=e,u=!r||this.readOnly,h=this.disabled||this.viewModel.updating;let p=t.hint??void 0,g=!1;return a===$&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(D.fieldInput,u?D.inputDisabled:null),status:!c&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:s&&s>-1?s: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:h,readOnly:u,onblur:this._onComponentBlur,required:l,placeholder:p,value:g?"":a??"",[be]:t.elementId,[fe]:o,onfocus:this._onComponentFocus}}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(be))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),a=t||i;a&&this._afterComponentCreateOrUpdate(a)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,i)||this._markFieldInputTouched(i),this._focusedFieldInput=i}_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),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,ge(e))}_onComponentBlur(){this._focusedFieldInput=null}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear(),this._touchedInputs.clear()}_parseValue(e,t,i=!1){const a=t.multipleChoiceInput,n=t.multipleChoiceValues;if(a&&n){const s=a.choiceDelimiter,l=e;if(i){return q({input:t}).checked?null:n.length>0?n.join(s):null}const o=K(t.value,s).filter(e=>e!==$),r=new Set(o);l.checked?r.add(l.value):r.delete(l.value);const c=n.filter(e=>r.has(e));return c.length?c.join(s):null}if(F(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const s=e.value;return null==s||""===s?null:"number"===t.dataType?"-0"===s||"-0."===s||"-0,"===s?s:parseFloat(s):"date"===t.field.type?parseFloat(s):s}_saveInputFromElement(e){const t=this._getFieldInputFromHTMLElement(e);if(!t)return;const i=this._parseValue(e,t);this._saveInput(t,i)}_saveInput(e,t){const{elementId:i}=e.template,a=e?.value,{viewModel:s}=this;if(F(e.template,"switch")&&"single"!==s.mode){const t=n(this._batchSwitchInputInitialValues,e,()=>e.value);this._batchSwitchInputInitialValues.set(e,null===t?a:t)}t!==a&&(e.isSubtypeField&&"batch"!==s.mode&&k(s.activeLayer,a,t)?this._pendingSubtypeChoice||(this._pendingSubtypeChoice=this._handleSubtypeChoice(e,t)):s.setValue(i,t))}async _handleSubtypeChoice(e,i){const{value:a,template:n}=e,{elementId:s}=n,{messages:l,viewModel:o,messagesCommon:r}=this,{subtypes:c,activeFeatureIndex:d}=o;if(await o.setValue(s,i),!c?.length)return;const m=c.find(e=>e.code===i),u=c.find(e=>e.code===a)?.name??`${a}`;if(!m)return;const h=Promise.withResolvers();o.pendingSubtypeChoice=h;let p="update-fields";const g=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}],v={context:"info",title:l.subtypes.changeWarningTitle,message:t(l.subtypes.changeWarning,{originalType:u,newType:m.name}),radios:g,defaultRadioSelection:"update-fields",onRadioSelection:e=>{p=e},actions:{primary:{label:r.apply,action:()=>h.resolve(p),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>h.resolve("undo")}},cancel:()=>h.reject()};try{this.showPrompt(v);switch(await h.promise){case"update-fields":await o.applySubtypeDefaults(m),await o.handleSubtypeChanged(d);break;case"keep-existing":await o.handleSubtypeChanged(d);break;case"undo":await this.viewModel.setValue(s,a)}}finally{o.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,a=e.field.type,n=this._dateComponentMap.get(`${i}`);if(!n)return;const s=e.effectiveTimeZone;let l=e.value===$?void 0:e.value,o=null;"date-only"===a?o=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===a?(l=le(l),o=le(t.value)):o="timestamp-offset"===a?null!=t.value?oe({dateComponent:n.date,timeComponent:n.time,oldValue:l,timeZoneComponent:n.timeZone,defaultTimeZone:s}):null:null!=t.value?re({oldValue:l,dateComponent:n.date,timeZone:s,timeComponent:n.time?.value===$?void 0:n.time}):null,l!==o&&(null!==o&&t.value?this.viewModel.setValue(`${i}`,o):this.viewModel.setValue(`${i}`,null))}_getErrorToDisplay(e){const t=e.compositeError;return e.valid||!t?null:"contingent-values-validation-error::contingency-violation-error"===t||"contingent-values-validation-error::contingency-violation-warning"===t||this._touchedInputs.has(e.template.elementId)||this.viewModel.submitHasBeenAttempted?t:null}_renderViewingAssociationsPage(){return this._associationsList?.render()}_onActiveAssociationsInputChange(e){const t=this._associationsList;t&&(e?(t.associationInput=e,t.viewModel=e.viewModel):t.associationInput=null)}async _setUpAssociationsWidgets(){const e=this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs;if(this._associationsEnabled&&0!==e.length){await this._setUpUtilityNetworkAssociationList();for(const t of e)this._associationsWidgetsMap.set(t,await this._createAssociationsWidget(t))}}async _setUpUtilityNetworkAssociationList(){if(this._associationsList)return;const e=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js")).default;this._associationsList=new e({onSelectLayer:this._onSelectAssociatedLayer.bind(this),onSelectFeature:this._onEditAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)});const t=this.viewModel.activeAssociationsInput;t&&(this._associationsList.associationInput=t,this._associationsList.viewModel=t.viewModel)}async _createAssociationsWidget(e){return new(0,(await import("./Feature/FeatureUtilityNetworkAssociations.js")).default)({viewModel:e.viewModel,onSelectAssociationType:t=>this._onSelectAssociationType(e,t)})}_destroyAssociationsWidgets(){this._associationsWidgetsMap.forEach(e=>s(e)),this._associationsWidgetsMap.clear()}_onSelectAssociationType(e,{listType:t}){this.setActiveAssociationsInput(e),this.setActiveAssociationType(t)}_onSelectAssociatedLayer({layer:e}){this.setActiveAssociationsLayer(e)}async _onEditAssociatedFeature(e){const t=this.callbacks?.editAssociatedFeature,i=this.viewModel.activeAssociationsInput;if(!t||!i?.feature)return;const{association:a,feature:n}=e;await t({parentFeature:i.feature.plainGraphic,association:a,feature:n})}_onAddAssociation(e){const t=this.callbacks?.addAssociation,i=this.viewModel.activeAssociationsInput;if(!t||!i?.feature)return;const{associationType:a,utilityNetwork:n}=e;t({feature:i.feature.plainGraphic,associationType:a,utilityNetwork:n})}_setFocusableInput(e){const t=e&&R(e)?e:this._findFocusableInput(e);this._syncGroupInputStates(),this._focusedFieldInput=t,this._attemptFocusOnNextRender=!0}_findFocusableInput(e){const t=this.viewModel.activeForm.inputs;if(!t.length)return;const i=M(t);let a;if(e)if(V(e)){const t=e.inputs.find(e=>e.visible);a=t?i.indexOf(t):0}else{let n;if(j(e)&&!e.group.open){n=e.group.inputs.filter(R)[t.length-1]}else n=e;a=i.indexOf(n)+1}else a=0;for(let n=a;n<i.length;n++){const e=i[n];if(e.visible&&R(e)){if(this.disabledOrReadOnly&&("switch"===e?.inputType||"radio-buttons"===e?.inputType))continue;return e}}return null}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._setFocusableInput(t),"sequential"===this.groupDisplay&&this.viewModel.activeForm.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.activeForm?.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)}};function Ae(e){switch(e){case"audio":return _("audio/mpeg");case"video":return _("video/mp4");case"image":return _("image/png");default:return"camera"}}e([u()],ye.prototype,"activeFeatureIndex",null),e([u()],ye.prototype,"attachmentsEnabled",null),e([u()],ye.prototype,"callbacks",null),e([u()],ye.prototype,"disabled",null),e([u()],ye.prototype,"effectiveTitle",null),e([u()],ye.prototype,"effectiveDisabled",null),e([u()],ye.prototype,"disabledOrReadOnly",null),e([u()],ye.prototype,"features",null),e([u()],ye.prototype,"footerButtonInfos",null),e([u()],ye.prototype,"map",null),e([u()],ye.prototype,"maximumFeatureCount",null),e([u()],ye.prototype,"maximumFeatureCountWithComplexForms",null),e([u()],ye.prototype,"spatialReference",null),e([u()],ye.prototype,"layerInfos",null),e([u()],ye.prototype,"timeZone",null),e([u()],ye.prototype,"headingLevel",void 0),e([u()],ye.prototype,"icon",null),e([u(),ue("esri/t9n/common")],ye.prototype,"messagesCommon",void 0),e([u(),ue("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],ye.prototype,"messages",void 0),e([u(),ue("esri/widgets/FeatureForm/t9n/FeatureForm")],ye.prototype,"featureFormMessages",void 0),e([u(),ue("esri/widgets/FeatureTable/t9n/FeatureTable")],ye.prototype,"featureTableMessages",void 0),e([u(),ue("esri/core/t9n/Units")],ye.prototype,"messagesUnits",void 0),e([u()],ye.prototype,"page",null),e([u()],ye.prototype,"readOnly",null),e([u()],ye.prototype,"showPrompt",null),e([u()],ye.prototype,"clearPrompt",null),e([u()],ye.prototype,"selectedAttachment",null),e([u()],ye.prototype,"selectedAttachmentDetails",null),e([u()],ye.prototype,"valid",null),e([u({type:x}),he(["attachments-change","value-change","values-change","submit"])],ye.prototype,"viewModel",void 0),e([u({type:T,nonNullable:!0})],ye.prototype,"visibleElements",void 0),e([u()],ye.prototype,"groupDisplay",void 0),e([u()],ye.prototype,"_formHeaderVisible",null),e([u()],ye.prototype,"_associationsEnabled",null),e([u()],ye.prototype,"_associationsList",void 0),e([u()],ye.prototype,"_attemptFocusOnNextRender",void 0),e([u()],ye.prototype,"_formId",null),e([u()],ye.prototype,"_focusedFieldInput",void 0),e([u()],ye.prototype,"_pendingSubtypeChoice",void 0),e([u()],ye.prototype,"_relatedRecordsEnabled",null),e([u()],ye.prototype,"_listObserverNode",void 0),e([u()],ye.prototype,"_attachmentDialogInfo",void 0),e([u()],ye.prototype,"_attachmentListFilterText",void 0),e([u()],ye.prototype,"_prompt",void 0),e([u()],ye.prototype,"test",null),ye=e([h("esri.widgets.BatchAttributeForm")],ye);const we=ye;export{we as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i}from"../core/deprecate.js";import a from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{destroyMaybe as s}from"../core/maybe.js";import l from"../core/ReactiveMap.js";import{watch as o,when as r,on as c,sync as d}from"../core/reactiveUtils.js";import{formatFileSize as m}from"../core/unitFormatUtils.js";import{property as u,subclass as h}from"../core/accessorSupport/decorators.js";import{formatDate as p}from"../intl/date.js";import{isIntegerField as g}from"../layers/support/fieldUtils.js";import{isString as v}from"../support/guards.js";import b from"./Widget.js";import{getAttachmentTypeCategory as f,getCalciteIconForAttachment as _}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as C,isImageAttachment as y,getAttachmentFilenameParts as A}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as w,getVisibleFieldInputValidationErrorMessage as F,isElementTemplateWithInputType as I,subtypeChangeShouldPrompt as k,flattenInputs as M}from"./BatchAttributeForm/batchAttributeFormUtils.js";import x from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as D}from"./BatchAttributeForm/css.js";import{makeViewingEditedAttachmentFooterButtons as S,makeViewingAttachmentFooterButtons as E,makeCancelFooterButton as O,makeDefaultFooterButtons as L}from"./BatchAttributeForm/interfaceUtils.js";import T from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as V,isFieldInput as R,isTextElementInput as N,isRelationshipElementInput as U,isAttachmentElementInput as P,isUtilityNetworkAssociationsElementInput as B,differentValuesString as $,getNormalizedFieldName as z,isGroupedInput as j}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as H,getMultipleChoiceCheckboxState as W,otherChoiceCheckedPlaceholderValue as G,getUpdatedMultipleChoiceValueForFeature as Z,getMultipleChoiceSelectAllState as q,splitMultipleChoiceValue as K,canRestoreMultipleChoiceOtherChoiceDraftValue as X}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{loadRelationshipDetailsComponents as J,RelationshipDetails as Q}from"./BatchAttributeForm/rendered-content/RelationshipDetails.js";import{Prompt as Y}from"./Editor/components/Prompt.js";import{downloadAttachmentInfo as ee}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as te}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as ie,getIntlOptionsForField as ae,prepareISOFieldValueForDateComponents as ne,prepareUnixFieldValueForDateComponents as se,normalizeTimeOnlyString as le,getISOFieldValueFromDateComponents as oe,getUnixFieldValueFromDateComponents as re}from"./support/dateUtils.js";import{globalCss as ce}from"./support/globalCss.js";import{Heading as de}from"./support/Heading.js";import{calciteListFilterProps as me}from"./support/listUtils.js";import{messageBundle as ue,vmEvent as he,tsx as pe}from"./support/widget.js";import{setFocus as ge}from"./support/widgetUtils.js";import{isEmptyValue as ve}from"./support/forms/formUtils.js";const be="data-element-id",fe="data-field-name",_e="esri_BatchAttributeForm_select_all",Ce="esri_BatchAttributeForm_other_choice";let ye=class extends b{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.featureTableMessages=null,this.messagesUnits=null,this.viewModel=new x,this.visibleElements=new T,this.groupDisplay="all",this._associationsList=null,this._associationsWidgetsMap=new l,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._pendingSubtypeChoice=null,this._batchSwitchInputInitialValues=new Map,this._listObserverNode=null,this._listObserver=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.viewModel.activeRelationshipInput?.incrementPage()},{root:window.document}),this._attachmentDialogInfo=null,this._attachmentListFilterText="",this._attachmentFileInputMap=new Map,this._prompt=null,this._selectedAttachmentReplaceFileInput=null,this._afterListObserverCreated=e=>{this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)},this._afterListObserverRemoved=()=>{this._listObserverNode=null},this._maximizeSelectedAttachment=()=>{this._attachmentDialogInfo=this.selectedAttachmentDetails},this._enterAttachmentReplaceView=()=>{const e=this.selectedAttachmentDetails;this._canReplaceSelectedAttachment()&&e&&(e.input.clearValidationCriteriaState(),this.viewModel.setShowingSelectedAttachmentReplacePage(!0))},this._setSelectedAttachmentReplaceFileInput=e=>{this._selectedAttachmentReplaceFileInput=e},this._openSelectedAttachmentReplaceFilePicker=()=>{this._canReplaceSelectedAttachment()&&this._selectedAttachmentReplaceFileInput?.click()},this._resetSelectedAttachmentName=()=>{const e=this.selectedAttachmentDetails;if(!e?.attachment)return;const t=e.input.getAttachmentEditState(e.attachment).initialName;if(null==t)return;const i=e.input.template.elementId,a=C(e.attachment);this.viewModel.stageRenameAttachment(i,a,t)},this._closeAttachmentDialog=()=>{this.hideAttachmentDialog()},this._saveInputFromElement=this._saveInputFromElement.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._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{i(a.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...i}=e;return i}initialize(){this.addHandles([o(()=>this.features.toArray(),()=>{this._dateComponentMap.clear(),H(this.viewModel,{includeDraftValues:!0})}),o(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),H(this.viewModel),this._setFocusableInput()}),o(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),r(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),o(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),o(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),c(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()}),o(()=>[this._associationsEnabled,this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs],()=>this._setUpAssociationsWidgets(),d),o(()=>this.viewModel.activeAssociationsInput,e=>this._onActiveAssociationsInputChange(e)),o(()=>this.groupDisplay,()=>this._syncGroupInputStates())])}loadDependencies(){return Promise.all([te({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"),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"),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")}),J()])}destroy(){this._destroyAssociationsWidgets(),this._associationsList=s(this._associationsList),this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=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:i}=this;return t?"replacing-attachment"===i?t.titles.replaceAttachment:"viewing-attachment-details"===i?t.titles.editAttachment:"adding-attachments"===i?t.titles.addAttachments:"viewing-attachments"===i?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:"":""}get effectiveDisabled(){return this.disabledOrReadOnly||this.viewModel.updating}get disabledOrReadOnly(){return this.disabled||this.readOnly}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get footerButtonInfos(){if(!this.features.length||!this.messages||!this.messagesCommon)return[];const{messages:e,messagesCommon:t,page:i}=this,a=this.effectiveDisabled;if("adding-attachments"===i||"replacing-attachment"===i)return[];if("viewing-attachment-details"===i){const t=this.selectedAttachmentDetails,i=t?.input?.getAttachmentEditState(t.attachment);if(!t?.input||!i)return[];return i.isRenamed||i.isReplaced?S({doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons,resetOnclick:()=>this._resetSelectedAttachmentChanges(),resetDisabled:this._disableAttachmentModification(t.input)}):E({deleteDisabled:this._disableAttachmentModification(t.input),deleteOnclick:()=>this._deleteSelectedAttachment(),doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons})}return"viewing-associated-features"===i?O({messages:t,purpose:"cancel-viewing-associated-features",onclick:()=>this.goBack()}):"viewing-associated-layers"===i?O({messages:t,purpose:"cancel-viewing-associated-layers",onclick:()=>this.goBack()}):"viewing-attachments"===i||"viewing-related-records"===i?[]:L({disabled:a||!this.valid,formId:this._formId,messages:e,callback:()=>this.submit()})}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 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)}get selectedAttachment(){return this.viewModel.selectedAttachment}get selectedAttachmentDetails(){return this.viewModel.selectedAttachmentDetails}get valid(){return this.viewModel.valid}get _formHeaderVisible(){return!("batch"===this.viewModel.mode||!this.viewModel.activeFeature)&&!(!this.viewModel.formDescription&&!this.viewModel.formTitle)}get _associationsEnabled(){const{callbacks:e}=this;return!(!e?.addAssociation&&!e?.editAssociatedFeature)}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._setFocusableInput(e.input),this.scheduleRender()}render(){return pe("div",{class:this.classes(D.base,ce.widget,ce.panel)},this._renderContent(),this._renderAttachmentDialog(),this._prompt?pe(Y,{...this._prompt,headingLevel:this.headingLevel}):void 0)}setActiveAssociationsInput(e){this.viewModel.setActiveAssociationsInput(e)}setActiveAssociationsLayer(e){this.viewModel.setActiveAssociationsLayer(e)}setActiveAssociationType(e){this.viewModel.setActiveAssociationType(e)}submit(){return this.viewModel.submit()}get test(){return{saveInput:this._saveInput.bind(this),pendingSubtypeChoice:this._pendingSubtypeChoice}}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:i}=e.dataset,a=n(this._dateComponentMap,`${i}`,()=>({}));switch(t){case"date":a.date=e;break;case"time":a.time=e;break;case"timeZone":a.timeZone=e}}_renderContent(){const{messages:e,viewModel:i}=this,{status:a}=i;return"failed"===a?i.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:i.maximumFeatureCountWithComplexForms})):i.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:i.maximumFeatureCount})):e.formFailedToLoad:i.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===a&&this.visibleElements.loadingIndicator?pe("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return pe("calcite-notice",{class:D.noticeError,icon:!0,kind:t,open:!0},pe("div",{slot:"message"},e))}_renderForm(){return pe("form",{class:D.form,id:this._formId,inert:!!this._prompt,onsubmit:this._onFormSubmit},this.viewModel.expressionEvaluationFailed&&this.visibleElements.expressionsErrorNotice&&this._renderErrorNotice(this.messages.expressionEvaluationFailed),this._renderInvisibleFieldsError(),this._renderPage())}_renderPage(){switch(this.page){case"adding-attachments":return this._renderAttachmentAddPage();case"viewing-attachment-details":case"replacing-attachment":return this._renderAttachmentDetailPage();case"viewing-attachments":return this._renderAttachmentListPage();case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewingAssociationsPage();case"viewing-related-categories":case"viewing-related-records":return this._renderRelationshipListPage();default:return this._renderDefaultPage()}}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let a;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(a=w(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?a+=` (${e.map(e=>e.label).join(", ")})`:a=null}else a+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return a?this._renderErrorNotice(a,"danger"):null}_renderDefaultPage(){return[this._renderReadOnlyNotice(),this._renderFormHeader(),this._renderFormContent()]}_renderReadOnlyNotice(){if((this.disabled||this.readOnly)&&this.visibleElements.readOnlyNotice)return pe("calcite-notice",{class:D.disabledNotice,icon:"read-only-non-editable",kind:"brand",open:!0,scale:"s",width:"full"},pe("div",{slot:"message"},this.featureFormMessages.disabledForm))}_renderFormHeader(){const{formTitle:e,formDescription:t}=this.viewModel;if(!this._formHeaderVisible)return;const i=e?pe(de,{key:"title",level:this.headingLevel},e):void 0,a=t?pe("p",{class:D.description,key:"description"},t):void 0;return pe("div",{class:D.formHeader},i,a)}_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 V(e)?this._renderGroupInput(e):R(e)?this._renderLabeledField(e):N(e)?this._renderTextComponent(e):U(e)?this._renderRelationshipElementInput(e):P(e)?this._renderAttachmentElementInput(e):B(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:a}=e,n=t.filter(e=>e.visible),s=e.label??"",l=this._focusedFieldInput?.group===e,o="sequential"===this.groupDisplay;return pe("calcite-block",{class:this.classes(D.group,o?D.groupSequential:null,l?D.groupActive:null,this.disabled?D.inputDisabled:null),collapsible:!0,description:e.description??void 0,expanded:a,heading:s,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:s,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0},onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:a,required:n,dataType:s}=e,l=n?t(this.messages.requiredFieldLabel,{name:a}):a;return pe("calcite-label",{"aria-label":l,class:D.label,key:`field--${i}`},pe("div",{class:D.labelTextContent,key:"labelTextContainer"},a,n?pe("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==s?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):null!==e.multipleChoiceChoices?this._renderMultipleChoiceComponent({input:e,props:t}):"date"===i?this._renderDateComponents(e,t):(t.disabled=this.disabled,t.readOnly=t.readOnly||this.viewModel.updating,"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t))}_renderAuxiliaryText(e){const{description:t}=e,i=this._getErrorToDisplay(e),a=i?F(e,i,this.messages):null;return a?pe("calcite-input-message",{icon:!0,status:"invalid"},a):t?pe("calcite-input-message",{class:D.description,icon:!1,status:"idle"},t):null}_renderCodedInputs({input:e,props:t}){const i=e.input?.type??null,a=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:a,props:t});default:return this._renderComboBoxComponent({options:a,props:t,input:e})}}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:i}=this,{multipleChoiceChoices:a,multipleChoiceInput:n,multipleChoiceValues:s}=e;if(!n||!a||!s)return null;const l=!0===n.includeSelectAllChoices,o=new Map;let r=s.length>0,c=!1;for(const b of s){const t=W({input:e,choiceValue:b});o.set(b,t),(t.checked||t.indeterminate)&&(c=!0),t.checked||(r=!1)}const d={checked:r,indeterminate:!r&&c},m=d.checked?i.deselectAllLabel:i.selectAllLabel,u=e.getMultipleChoiceOtherChoiceRenderState(this.messages.otherOptionLabel),h=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},p=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},g=t=>{const{fieldName:i}=u;i&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:i})},v=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:u.fieldName})};return pe("div",{class:D.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},l?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:d,selectAllLabel:m,handleSelectAllCheckboxChange:h}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:p}),u.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:l,otherChoiceRenderState:u,handleOtherChoiceCheckboxChange:g,handleOtherChoiceInputChange:v,differentValuesPlaceholder:i.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:i,handleSelectAllCheckboxChange:a}){return pe("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:D.multipleChoiceSelectAll,"data-element-id":e[be],disabled:e.readOnly||e.disabled,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:i,labelText:i,value:_e,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>a(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:i,handleChoiceCheckboxChange:a}){const{multipleChoiceChoices:n}=e;return n?n.map(e=>{const n=i.get(e.value)??{checked:!1,indeterminate:!1};return pe("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[be],disabled:t.readOnly||t.disabled,indeterminate:n.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>a(e),onfocus:t.onfocus})}):[]}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:i,handleOtherChoiceCheckboxChange:a,handleOtherChoiceInputChange:n,differentValuesPlaceholder:s}){return pe("div",{class:this.classes(D.multipleChoiceOtherChoice,t?D.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},pe("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:i.checkboxState.checked,class:e.class,"data-element-id":e[be],disabled:e.readOnly||e.disabled,indeterminate:i.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:i.label,labelText:i.label,value:Ce,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>a(e),onfocus:e.onfocus}),i.checkboxState.checked?pe("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":i.label,class:D.textElementInput,"data-element-id":e[be],disabled:e.readOnly||e.disabled,key:`${e.key}-other-choice-input`,maxLength:i.maxLength,placeholder:i.value===$?s:i.hint,type:"text",value:i.normalizedValue===$?"":i.normalizedValue?String(i.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:i=!1}){if(this._markFieldInputTouched(e),e.multipleChoiceInput&&!i&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const a=e.value,n=this._parseValue(t,e,i);n!==a&&await this.viewModel.setValue(e.template.elementId,n)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:i}){if(!i)return;const a=t.value,n=null==a||""===a?null:a;e.initializeExplicitMultipleChoiceOtherChoiceCheckedState(),e.stashMultipleChoiceOtherChoiceDraftValueForFeatures(e.features,n);const s=z(e,i);s&&await this.viewModel.setValueForFieldName(s,n,Array.from(e.features,e=>e.source))}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:i}){e.setExplicitMultipleChoiceOtherChoiceCheckedState(t),this._markFieldInputTouched(e),t||e.setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e.features.toArray());const a=z(e,i);if(!a)return;const n=new Map;for(const s of e.features){const a=s.getAttribute(i);if(t){if(!ve(a))continue;const t=e.getMultipleChoiceOtherChoiceDraftValue(s),i=X(t)?t:G;n.set(s,i);continue}null!=a&&n.set(s,null)}0!==n.size&&await this.viewModel.setValuePerFeatureForFieldName(a,new Map(Array.from(n,([e,t])=>[e.source,t])))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){if(!e.multipleChoiceInput||!e.multipleChoiceValues)return;const i=new Map(e.features.map(i=>[i,Z({input:e,choiceValue:t.value,currentValue:i.getAttribute(e.fieldName),isChecked:t.checked})]));0!==i.size&&await this.viewModel.setFieldInputValuePerFeature(e,i)}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===$||e.value===$)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[be]:t[be]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:$,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return pe("calcite-switch",{...t,checked:!!I(e.template,"switch")&&e.value===e.template.input.onValue,class:D.inputSwitch,disabled:t.readOnly||t.disabled,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:a,dropdown:n,group:s}=i;return pe("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onblur:()=>{this._focusedFieldInput=null},onCalciteDropdownSelect:({currentTarget:e})=>this._saveInputFromElement(e),onfocus:this._onComponentFocus},pe("calcite-button",{...a},e===$?this.messages.differentValuesPlaceholder:e),pe("calcite-dropdown-group",{selectionMode:s.mode},t.map(t=>pe("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const a="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),s=a&&e.showNoValueOptionEnabled&&!n?()=>{}:i.onblur,l={...i,onblur:s};return pe("calcite-combobox",{...l,clearDisabled:e.isSubtypeField,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:i.placeholder===this.messages.differentValuesPlaceholder?$:String(i.value),onCalciteComboboxChange:({currentTarget:t})=>{t.value!==$&&(e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveInputFromElement(t))}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const a=e=>e.map(e=>{const{value:t}=e,a=ve(e.value)?this.messages.empty:e.name;return pe("calcite-combobox-item",{heading:a,key:`#${t}`,selected:i.value===t,value:`${t}`})});let n=[];const{messages:s}=this;t.other.length>0&&n.push(pe("calcite-combobox-item-group",{key:"other",label:s.other},a(t.other))),t.unsupported.length>0&&n.push(pe("calcite-combobox-item-group",{key:"unsupported",label:s.unsupported},a(t.unsupported)));const l=a(t.recommended);n.length>0?n.unshift(pe("calcite-combobox-item-group",{key:"recommended",label:s.recommended},l)):n=l;const o=i.placeholder===this.messages.differentValuesPlaceholder,r=!o&&ve(i.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(pe("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),o&&n.unshift(pe("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:$,selected:!0,value:$})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const a=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:a})=>this._renderRadioButtons({label:t,value:a,selected:a===e.value,props:i}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,s=ve(e.value);a.unshift(this._renderRadioButtons({label:n,value:t,selected:s,props:i}))}return pe("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:D.inputRadioGroup,"data-field-name":i[fe],disabled:i.readOnly||i.disabled,key:`${i.key}-radio-group`,layout:"vertical",name:`${i.name}-${this.id}`,required:i.required},a,i.placeholder===this.messages.differentValuesPlaceholder?pe("calcite-label",{class:D.placeholderRadio,key:i.label,layout:"inline"},pe("calcite-radio-button",{checked:!0,class:D.inputRadio,disabled:!0,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:a}){return pe("calcite-label",{class:D.inputRadioLabel,key:a.label,layout:"inline"},pe("calcite-radio-button",{...a,afterCreate:void 0,afterUpdate:void 0,checked:t,class:D.inputRadio,disabled:a.readOnly||a.disabled,name:void 0,value:e,onblur:()=>{this._focusedFieldInput=null},onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInputFromElement(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?pe("calcite-text-area",{...t,class:this.classes(D.individualElement),resize:"vertical",value:t.value?String(t.value):"",onblur:e=>{t.onblur(e),this._saveInputFromElement(e.currentTarget)}}):pe("calcite-input",{...t,class:this.classes(D.individualElement),type:"text",value:t.value?String(t.value):"",onblur:e=>{t.onblur(e),this._saveInputFromElement(e.currentTarget)}})}_renderNumberComponent(e,t){const i=g(e.field);return pe("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onblur:e=>{t.onblur(e),this._saveInputFromElement(e.currentTarget)}})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return pe("calcite-input",{...i,class:this.classes(D.fieldInput,D.inputDisabled,D.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let a;switch(i.type){case"date":a=this._renderDateFieldComponents(e,t);break;case"date-only":a=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":a=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":a=this._renderTimestampOffsetFieldComponents(e,t);break;default:a=this._renderReadOnlyComponent(e,ie(i,t.value,{timeZone:e.effectiveTimeZone,...ae(e.template.field)}))}return e.value===$?[a,pe("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:a}_renderDateOnlyFieldComponent(e,t){const{class:i,disabled:a,key:n,readOnly:s}=t,{rawMax:l,rawMin:o}=e.range;return pe("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[be],"data-field-name":t[fe],disabled:a,key:`${n}-date-input`,max:v(l)?l:void 0,min:v(o)?o:void 0,overlayPositioning:"fixed",readOnly:s,topLayerDisabled:this.topLayerDisabled,value:e.value===$?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimeOnlyFieldComponent(e,t){const{class:i,disabled:a,key:n,readOnly:s}=t;return pe("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[be],"data-field-name":t[fe],disabled:a,key:`${n}-time-input`,overlayPositioning:"fixed",readOnly:s,value:e.value===$?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,disabled:a,key:n,readOnly:s}=t,{rawMax:l,rawMin:o}=e.range,r=e.effectiveTimeZone,c=ne(l,r),d=ne(o,r),m=ne(e.value===$?"":e.value,r),u=e.includeTimeOffset,h={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:a,[be]:t[be],[fe]:t[fe],onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s};return pe("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},pe("calcite-input-date-picker",{...h,class:i,"data-date-part":"date",key:`${n}-date-input`,max:c?.date??void 0,min:d?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:m.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),pe("calcite-input-time-picker",{...h,class:i,"data-date-part":"time",key:`${n}-time-input`,value:m.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?pe("calcite-input-time-zone",{...h,class:i,clearable:e.value===$||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,value:m.timeZoneOffset||"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,disabled:a,key:n,readOnly:s,min:l,max:o}=t,r=e.effectiveTimeZone,c=se(e.value===$?"":e.value,r),d=se(o,r),m=se(l,r),u=e.includeTime,h={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:a,[be]:t[be],[fe]:t[fe],onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s};return pe("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},pe("calcite-input-date-picker",{...h,class:i,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:m?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?pe("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${n}-time-input`,step:1,value:c.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){return this._relatedRecordsEnabled?pe(Q,{afterObserverCreated:this._afterListObserverCreated,afterObserverRemoved:this._afterListObserverRemoved,input:e,messages:this.messages,messagesCommon:this.messagesCommon,viewModel:this.viewModel}):null}_renderRelationshipListPage(){const{activeRelationshipInput:e}=this.viewModel;if(e)return this._renderRelationshipElementInput(e)}_renderAttachmentElementInput(e){if(!this.attachmentsEnabled)return;const{allAttachmentsVisibleOnDefaultPage:t,attachments:i,defaultPageAttachments:a,template:{description:n,elementId:s,label:l}}=e,o=t?i:a;return pe("div",{class:D.attachmentElementInput,"data-testid":`attachment-element-${s}`,key:`attachment-element-${s}`},l?pe("div",{class:D.attachmentElementLabel,key:`attachment-element-label-${s}`},l):null,n?pe("div",{class:D.description,key:`attachment-element-description-${s}`},n):null,i.length?this._renderAttachmentList(e,o,{label:l||this.messagesCommon.details,viewAllCount:t?null:i.length}):pe("div",{class:D.attachmentElementEmptyState,key:`attachment-element-empty-state-${s}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){const e=this.viewModel.selectedAttachmentListInput;if(e)return pe("div",{class:D.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,i){const{filterEnabled:a,label:n,viewAllCount:s}=i;return pe("calcite-list",{class:D.attachmentElementList,filterEnabled:a,filterPlaceholder:a?this.messages.attachments.searchAttachments:void 0,filterProps:a?me:void 0,filterText:a?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:a?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=s?this._renderViewAllAttachmentsItem(e,s):null)}_renderAttachmentListItems(e,t){const{elementId:i}=e.template;return t.map((t,a)=>{const n=this._formatAttachmentSize(t.size),s=this._getAttachmentLabel(t,a,n,e.displayFilename),l=s===n?void 0:n,o=C(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=c.isDeleted,m=!d&&(r||c.isRenamed||c.isReplaced);return pe("calcite-list-item",{class:D.attachmentElementListItem,description:l,key:`attachment-item-${o}`,label:s,onCalciteListItemSelect:r||d?void 0:()=>this._setSelectedAttachment({attachmentKey:o,elementId:i})},pe("div",{class:D.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,s,e)),m?pe("span",{class:D.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[pe("calcite-action",{disabled:this._disableAttachmentModification(e),icon:"x",scale:"s",slot:"actions-end",text:this.messagesCommon.delete,title:this.messagesCommon.delete,onclick:()=>this.viewModel.stageDeleteAttachment(i,C(t))})]:d?pe("calcite-chip",{label:this.messages.attachments.deleted,scale:"s",slot:"content-end"},this.messages.attachments.deleted):pe("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))})}_renderViewAllAttachmentsItem(e,i){const{elementId:a}=e.template,{viewAll:n}=this.messages.attachments;return pe("calcite-list-item",{class:D.attachmentElementListItem,description:t(this.messages.attachments.count,{count:i}),key:`attachment-item-view-all-${a}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(a)},pe("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,i=this.effectiveDisabled||e.addDisabled,a=this._renderAttachmentCountLimitsLabel(e),n=this._getAttachmentNoticeMessage(e),s=e.hasMinimumAttachmentCountNotMet||e.hasExceededAttachmentLimit?"danger":"info",l=e.canUploadFiles,o=e.isCaptureOnly&&!this.effectiveDisabled&&!n;return pe("div",{class:D.attachmentElementAddActions,key:`attachment-element-add-actions-${t}`},l?pe("calcite-button",{appearance:"outline",disabled:i,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach):null,this._renderAttachmentCaptureButton(e),o?this._renderAttachmentCaptureDisabledNotice(t):null,a?pe("div",{class:D.attachmentElementEmptyActionHint},a):null,!this.effectiveDisabled&&n?pe("calcite-notice",{closable:!1,icon:"danger"===s?"exclamation-mark-circle":"lightbulb",kind:s,open:!0,scale:"s",width:"full"},pe("div",{slot:"message"},n)):null)}_renderAttachmentCaptureButton(e){if(!e.hasCaptureInputs)return null;const t=e.captureMediaType;return pe("calcite-button",{appearance:"outline",disabled:!0,iconStart:Ae(t),kind:"neutral",round:!0,scale:"s"},this._getCaptureButtonLabel(t))}_getAttachmentNoticeMessage(e){const t=this.messages.attachments;return e.hasUnsupportedFileTypeValidationError?this._getUnsupportedFileTypeMessage():e.hasMinimumAttachmentCountNotMet&&this._shouldShowMinimumAttachmentNotice(e)?t.minimumNotMet:e.hasExceededAttachmentLimit?t.attachmentLimitExceeded:e.hasReachedAttachmentLimit?t.attachmentLimitReached:null}_shouldShowMinimumAttachmentNotice(e){return e.hasAttachmentChanges||this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId)}_getCaptureButtonLabel(e){const{capture:t,recordAudio:i,takePhoto:a,takeVideo:n}=this.messages.attachments;switch(e){case"image":return a||t;case"video":return n||t;case"audio":return i||t;default:return t}}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:i}=e.template;if(e.isCaptureOnly)return this._renderAttachmentCaptureDisabledNotice(i);const a=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,s=this.messages.attachments,l=s.dragAndDropFile,o="upload",r=e=>{this._attachmentFileInputMap.set(i,e)};return pe("div",{class:D.attachmentElementAddPanel,key:`attachment-element-add-panel-${i}`},pe("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(i)},afterUpdate:r,class:D.attachmentElementFileInput,"data-element-id":i,disabled:n,multiple:a,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?Array.from(t.files):[];this._stageAttachmentFiles(i,a),t.value=""}}),pe("div",{class:D.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(i,t)}},pe("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:o,scale:"l"}),pe("div",{class:D.attachmentElementAddDropzoneHeading},s.addFile),pe("div",{class:D.attachmentElementAddDropzoneDetail,title:l},l),pe("calcite-button",{appearance:"transparent",disabled:n,iconStart:"folder-open",kind:"brand",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(i,n)}},s.selectFile)),this._renderAttachmentValidationCriteria(e,{includeCountCriteria:!0}))}_renderAttachmentCaptureDisabledNotice(e){return pe("calcite-notice",{class:D.attachmentElementCaptureNotice,icon:!0,key:`attachment-element-capture-disabled-notice-${e}`,kind:"warning",open:!0,scale:"s"},pe("div",{slot:"message"},this.messages.attachments.captureMethodNotSupported))}async _stageAttachmentFiles(e,t){if(0===t.length)return;const i=this.viewModel.selectedAttachmentAddInput;let a=!0;try{a=(await this.viewModel.stageAddAttachments(e,t)).length>0&&!i?.hasInvalidValidationCriteria&&!i?.hasUnsupportedFileTypeValidationError}finally{a&&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:i}=e,a=C(t),n=!!i.getAttachmentPreviewUrl(t),s=!this._disableAttachmentModification(i)&&i.canUploadFiles,l=i.getAttachmentEditState(t);return pe("div",{class:D.attachmentElementDetail,key:`attachment-detail-panel-${i.template.elementId}-${a}`},pe("div",{class:D.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,i)),pe("div",{class:D.attachmentElementDetailActions},y(t)?pe("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,pe("calcite-button",{appearance:"outline",disabled:!n||l.isReplaced,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),pe("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})),pe("div",{class:D.attachmentElementDetailMetadata},pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),this._renderFileNameContent(t,i)),pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.size),pe("span",{class:D.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.type),pe("span",{class:D.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderFileNameContent(e,t){if(!t.allowUserRename)return pe("span",{class:D.attachmentElementDetailMetadataValue},e.name);const i=t.getAttachmentEditState(e),{baseName:a,extension:n}=A(e.name),s=this._disableAttachmentModification(t),l=!s&&0===e.name.trim().length;return[pe("div",{class:D.attachmentElementDetailFileNameRow,key:"file-name-row"},pe("calcite-input",{class:D.attachmentElementDetailFileNameInput,disabled:s,scale:"m",status:l?"invalid":"idle",suffixText:n,value:a,onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),pe("calcite-button",{appearance:"transparent",disabled:s||null==i.initialName||!i.isRenamed,iconStart:"reset",kind:"neutral",label:this.messages.footerButtons.reset,scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})),l?pe("calcite-input-message",{icon:!0,key:"file-name-message",status:"invalid"},this.messages.validationErrors.cannotBeNull):null]}_renderAttachmentReplacePanel(e){const{attachment:t,input:i}=e,a=this._disableAttachmentModification(i)||!i.canUploadFiles,n=i.template.elementId;return pe("div",{class:D.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${C(t)}`},pe("input",{accept:i.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:D.attachmentElementFileInput,disabled:a,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?.[0];i&&this._stageSelectedAttachmentReplacement(i),t.value=""}}),pe("div",{class:D.attachmentElementAddDropzone,"data-disabled":a?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),a)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},pe("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),pe("div",{class:D.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),pe("div",{class:D.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),pe("calcite-button",{appearance:"transparent",disabled:a,iconStart:"folder-open",kind:"brand",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),this._renderAttachmentValidationCriteria(i,{includeCountCriteria:!1}),pe("div",{class:D.attachmentElementDetailMetadata},pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),pe("span",{class:D.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:i}=e;return pe("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},pe("div",{class:D.attachmentElementDialogPreview},this._renderAttachmentPreviewImageForInput(t,i)))}_setSelectedAttachment(e){e?.elementId&&this._touchedInputs.add(e.elementId),this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){e&&this._touchedInputs.add(e),this.viewModel.setSelectedAttachmentAddElementId(e),this.viewModel.selectedAttachmentAddInput?.clearValidationCriteriaState(),this.hideAttachmentDialog()}_setAttachmentListElementId(e){e&&this._touchedInputs.add(e),this.viewModel.setSelectedAttachmentListElementId(e),this.hideAttachmentDialog()}_getAttachmentLabel(e,i,a,n){return!1!==n&&v(e.name)&&e.name.length>0?e.name:a!==this.messagesCommon.notApplicable?a:t(this.messages.attachments.attachmentNumberedLabel,{index:i+1})}_renderAttachmentCountLimitsLabel(e){const t=this.messages.attachments,i=null!=e.minAttachmentCount&&e.minAttachmentCount>0?this._renderAttachmentCountLimitLabel(t.minAttachmentsShort,e.minAttachmentCount,"min"):null,a=null!=e.maxAttachmentCount?this._renderAttachmentCountLimitLabel(t.maxAttachmentsShort,e.maxAttachmentCount,"max"):null;return i||a?[i,i&&a?pe("span",{key:"attachment-count-limits-separator"},", "):null,a]:null}_renderAttachmentCountLimitLabel(e,i,a){const n="__count__",[s,l]=t(e,{count:n}).split(n);return pe("span",{key:a},s,pe("span",{class:D.attachmentElementEmptyActionHintValue},i),l)}_renderAttachmentValidationCriteria(e,{includeCountCriteria:t}){const i=this._getAttachmentValidationCriteria(e,{includeCountCriteria:t}),a=`attachment-validation-criteria-${e.template.elementId}`;return 0===i.length?null:pe("div",{class:D.attachmentElementValidationCriteria,key:a},i.map(({key:e,message:t,state:i})=>pe("calcite-notice",{appearance:"danger"===i?"outline-fill":"transparent",closable:!1,icon:!0,key:e,kind:i,open:!0,scale:"s",width:"full"},pe("div",{slot:"message"},t))))}_getAttachmentValidationCriteria(e,{includeCountCriteria:i}){const a=[],n=e.validationCriterionStates,s=this.messages.attachments,l=this._getNestableAttachmentInputs(e.input);e.hasUnsupportedFileTypeValidationError&&a.push({key:"unsupported-file-type",message:this._getUnsupportedFileTypeMessage(),state:"danger"});for(const o of l)"document"===o.type&&null!=o.maxFileSize&&a.push({key:"maximum-file-size",message:t(s.maximumFileSize,{maxSize:this._formatAttachmentSizeLimitInMegabytes(o.maxFileSize)}),state:n.get("maximum-file-size")??"info"}),"audio"===o.type&&null!=o.maxDuration&&a.push({key:"maximum-audio-length",message:t(s.maximumAudioLength,{maxDuration:this._formatAttachmentDurationLimit(o.maxDuration)}),state:n.get("maximum-audio-length")??"info"}),"video"===o.type&&null!=o.maxDuration&&a.push({key:"maximum-video-length",message:t(s.maximumVideoLength,{maxDuration:this._formatAttachmentDurationLimit(o.maxDuration)}),state:n.get("maximum-video-length")??"info"}),"image"===o.type&&null!=o.maxImageSize&&a.push({key:"maximum-image-size",message:t(s.attachmentMustBeSmallerThan,{maxSize:`${o.maxImageSize}px`}),state:n.get("maximum-image-size")??"info"});return i&&null!=e.minAttachmentCount&&e.minAttachmentCount>0&&a.push({key:"minimum-number-of-files",message:t(s.minimumNumberOfFiles,{count:e.minAttachmentCount}),state:n.get("minimum-number-of-files")??"info"}),i&&null!=e.maxAttachmentCount&&a.push({key:"maximum-number-of-files",message:t(s.maximumNumberOfFiles,{count:e.maxAttachmentCount}),state:n.get("maximum-number-of-files")??"info"}),a}_getNestableAttachmentInputs(e){return null==e?[]:"attachment"===e.type?e.inputTypes?.slice()??[]:[e]}_getUnsupportedFileTypeMessage(){return this.featureTableMessages.errorFileUnsupported}_formatAttachmentSize(e){return null==e||Number.isNaN(e)?this.messagesCommon.notApplicable:m(this.messagesUnits,e)}_formatAttachmentSizeLimitInMegabytes(e){return m(this.messagesUnits,1048576*e)}_formatAttachmentDurationLimit(e){return p(1e3*Math.round(e),{...e>=3600?{hour:"2-digit",hourCycle:"h23"}:{},minute:"2-digit",second:"2-digit",timeZone:"UTC"})}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;const t=this.messages.attachments.attachmentTypes,i=f(e);return t?.[i]||e}_renderAttachmentPreviewThumbnail(e,t,i){const a=i.getAttachmentPreviewUrl(e,64);return a&&y(e)?pe("img",{alt:t,class:D.attachmentElementListItemThumb,src:a}):pe("calcite-icon",{class:D.attachmentElementListItemIcon,icon:_(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const i=t.getAttachmentPreviewUrl(e),a=e.name||this.messagesCommon.details;return i&&y(e)?pe("img",{alt:a,class:D.attachmentElementDetailPreviewImage,src:i,title:a}):[pe("calcite-icon",{class:D.attachmentElementDetailPreviewIcon,icon:_(e.contentType),scale:"l",textLabel:a,title:a}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await ee(e)}_canReplaceSelectedAttachment(){return!this.effectiveDisabled&&!!this.selectedAttachmentDetails?.input.canUploadFiles}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const i=t.input.template.elementId,a=C(t.attachment);let n=!1;try{n=await this.viewModel.stageReplaceAttachment(i,a,e)}finally{n&&this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const i=t.input.template.elementId,a=C(t.attachment);this.viewModel.stageRenameAttachment(i,a,e)}_resetSelectedAttachmentChanges(){const e=this.selectedAttachmentDetails;e?.attachment&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,C(e.attachment))}_deleteSelectedAttachment(){const e=this.selectedAttachmentDetails;if(!e?.attachment||this._disableAttachmentModification(e.input))return;const t=e.input.template.elementId,i=C(e.attachment);this.viewModel.stageDeleteAttachment(t,i),this._setSelectedAttachment(null)}_disableAttachmentModification(e){return this.disabledOrReadOnly||!e.editable}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return pe("div",{class:D.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 pe("div",{class:D.utilityNetworkAssociationsElementInput,"data-testid":t,key:t},this._associationsWidgetsMap.get(e)?.render())}getCommonInputProps(e){const{template:t,valid:i,value:a,minLength:n,maxLength:s,required:l,fieldName:o,editable:r,userHasChangedValue:c,range:{max:d,min:m}}=e,u=!r||this.readOnly,h=this.disabled||this.viewModel.updating;let p=t.hint??void 0,g=!1;return a===$&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(D.fieldInput,u?D.inputDisabled:null),status:!c&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:s&&s>-1?s: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:h,readOnly:u,onblur:this._onComponentBlur,required:l,placeholder:p,value:g?"":a??"",[be]:t.elementId,[fe]:o,onfocus:this._onComponentFocus}}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(be))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),a=t||i;a&&this._afterComponentCreateOrUpdate(a)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,i)||this._markFieldInputTouched(i),this._focusedFieldInput=i}_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),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,ge(e))}_onComponentBlur(){this._focusedFieldInput=null}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear(),this._touchedInputs.clear()}_parseValue(e,t,i=!1){const a=t.multipleChoiceInput,n=t.multipleChoiceValues;if(a&&n){const s=a.choiceDelimiter,l=e;if(i){return q({input:t}).checked?null:n.length>0?n.join(s):null}const o=K(t.value,s).filter(e=>e!==$),r=new Set(o);l.checked?r.add(l.value):r.delete(l.value);const c=n.filter(e=>r.has(e));return c.length?c.join(s):null}if(I(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const s=e.value;return null==s||""===s?null:"number"===t.dataType?"-0"===s||"-0."===s||"-0,"===s?s:parseFloat(s):"date"===t.field.type?parseFloat(s):s}_saveInputFromElement(e){const t=this._getFieldInputFromHTMLElement(e);if(!t)return;const i=this._parseValue(e,t);this._saveInput(t,i)}_saveInput(e,t){const{elementId:i}=e.template,a=e?.value,{viewModel:s}=this;if(I(e.template,"switch")&&"single"!==s.mode){const t=n(this._batchSwitchInputInitialValues,e,()=>e.value);this._batchSwitchInputInitialValues.set(e,null===t?a:t)}t!==a&&(e.isSubtypeField&&"batch"!==s.mode&&k(s.activeLayer,a,t)?this._pendingSubtypeChoice||(this._pendingSubtypeChoice=this._handleSubtypeChoice(e,t)):s.setValue(i,t))}async _handleSubtypeChoice(e,i){const{value:a,template:n}=e,{elementId:s}=n,{messages:l,viewModel:o,messagesCommon:r}=this,{subtypes:c,activeFeatureIndex:d}=o;if(await o.setValue(s,i),!c?.length)return;const m=c.find(e=>e.code===i),u=c.find(e=>e.code===a)?.name??`${a}`;if(!m)return;const h=Promise.withResolvers();o.pendingSubtypeChoice=h;let p="update-fields";const g=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}],v={context:"info",title:l.subtypes.changeWarningTitle,message:t(l.subtypes.changeWarning,{originalType:u,newType:m.name}),radios:g,defaultRadioSelection:"update-fields",onRadioSelection:e=>{p=e},actions:{primary:{label:r.apply,action:()=>h.resolve(p),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>h.resolve("undo")}},cancel:()=>h.reject()};try{this.showPrompt(v);switch(await h.promise){case"update-fields":await o.applySubtypeDefaults(m),await o.handleSubtypeChanged(d);break;case"keep-existing":await o.handleSubtypeChanged(d);break;case"undo":await this.viewModel.setValue(s,a)}}finally{o.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_afterDateComponentCreateOrUpdate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,a=e.field.type,n=this._dateComponentMap.get(`${i}`);if(!n)return;const s=e.effectiveTimeZone;let l=e.value===$?void 0:e.value,o=null;"date-only"===a?o=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===a?(l=le(l),o=le(t.value)):o="timestamp-offset"===a?null!=t.value?oe({dateComponent:n.date,timeComponent:n.time,oldValue:l,timeZoneComponent:n.timeZone,defaultTimeZone:s}):null:null!=t.value?re({oldValue:l,dateComponent:n.date,timeZone:s,timeComponent:n.time?.value===$?void 0:n.time}):null,l!==o&&(null!==o&&t.value?this.viewModel.setValue(`${i}`,o):this.viewModel.setValue(`${i}`,null))}_getErrorToDisplay(e){const t=e.compositeError;return e.valid||!t?null:"contingent-values-validation-error::contingency-violation-error"===t||"contingent-values-validation-error::contingency-violation-warning"===t||this._touchedInputs.has(e.template.elementId)||this.viewModel.submitHasBeenAttempted?t:null}_renderViewingAssociationsPage(){return this._associationsList?.render()}_onActiveAssociationsInputChange(e){const t=this._associationsList;t&&(e?(t.associationInput=e,t.viewModel=e.viewModel):t.associationInput=null)}async _setUpAssociationsWidgets(){const e=this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs;if(this._associationsEnabled&&0!==e.length){await this._setUpUtilityNetworkAssociationList();for(const t of e)this._associationsWidgetsMap.set(t,await this._createAssociationsWidget(t))}}async _setUpUtilityNetworkAssociationList(){if(this._associationsList)return;const e=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js")).default;this._associationsList=new e({onSelectLayer:this._onSelectAssociatedLayer.bind(this),onSelectFeature:this._onEditAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)});const t=this.viewModel.activeAssociationsInput;t&&(this._associationsList.associationInput=t,this._associationsList.viewModel=t.viewModel)}async _createAssociationsWidget(e){return new(0,(await import("./Feature/FeatureUtilityNetworkAssociations.js")).default)({viewModel:e.viewModel,onSelectAssociationType:t=>this._onSelectAssociationType(e,t)})}_destroyAssociationsWidgets(){this._associationsWidgetsMap.forEach(e=>s(e)),this._associationsWidgetsMap.clear()}_onSelectAssociationType(e,{listType:t}){this.setActiveAssociationsInput(e),this.setActiveAssociationType(t)}_onSelectAssociatedLayer({layer:e}){this.setActiveAssociationsLayer(e)}async _onEditAssociatedFeature(e){const t=this.callbacks?.editAssociatedFeature,i=this.viewModel.activeAssociationsInput;if(!t||!i?.feature)return;const{association:a,feature:n}=e;await t({parentFeature:i.feature.plainGraphic,association:a,feature:n})}_onAddAssociation(e){const t=this.callbacks?.addAssociation,i=this.viewModel.activeAssociationsInput;if(!t||!i?.feature)return;const{associationType:a,utilityNetwork:n}=e;t({feature:i.feature.plainGraphic,associationType:a,utilityNetwork:n})}_setFocusableInput(e){const t=e&&R(e)?e:this._findFocusableInput(e);this._syncGroupInputStates(),this._focusedFieldInput=t,this._attemptFocusOnNextRender=!0}_findFocusableInput(e){const t=this.viewModel.activeForm.inputs;if(!t.length)return;const i=M(t);let a;if(e)if(V(e)){const t=e.inputs.find(e=>e.visible);a=t?i.indexOf(t):0}else{let n;if(j(e)&&!e.group.open){n=e.group.inputs.filter(R)[t.length-1]}else n=e;a=i.indexOf(n)+1}else a=0;for(let n=a;n<i.length;n++){const e=i[n];if(e.visible&&R(e)){if(this.disabledOrReadOnly&&("switch"===e?.inputType||"radio-buttons"===e?.inputType))continue;return e}}return null}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._setFocusableInput(t),"sequential"===this.groupDisplay&&this.viewModel.activeForm.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.activeForm?.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)}};function Ae(e){switch(e){case"audio":return _("audio/mpeg");case"video":return _("video/mp4");case"image":return _("image/png");default:return"camera"}}e([u()],ye.prototype,"activeFeatureIndex",null),e([u()],ye.prototype,"attachmentsEnabled",null),e([u()],ye.prototype,"callbacks",null),e([u()],ye.prototype,"disabled",null),e([u()],ye.prototype,"effectiveTitle",null),e([u()],ye.prototype,"effectiveDisabled",null),e([u()],ye.prototype,"disabledOrReadOnly",null),e([u()],ye.prototype,"features",null),e([u()],ye.prototype,"footerButtonInfos",null),e([u()],ye.prototype,"map",null),e([u()],ye.prototype,"maximumFeatureCount",null),e([u()],ye.prototype,"maximumFeatureCountWithComplexForms",null),e([u()],ye.prototype,"spatialReference",null),e([u()],ye.prototype,"layerInfos",null),e([u()],ye.prototype,"timeZone",null),e([u()],ye.prototype,"headingLevel",void 0),e([u()],ye.prototype,"icon",null),e([u(),ue("esri/t9n/common")],ye.prototype,"messagesCommon",void 0),e([u(),ue("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],ye.prototype,"messages",void 0),e([u(),ue("esri/widgets/FeatureForm/t9n/FeatureForm")],ye.prototype,"featureFormMessages",void 0),e([u(),ue("esri/widgets/FeatureTable/t9n/FeatureTable")],ye.prototype,"featureTableMessages",void 0),e([u(),ue("esri/core/t9n/Units")],ye.prototype,"messagesUnits",void 0),e([u()],ye.prototype,"page",null),e([u()],ye.prototype,"readOnly",null),e([u()],ye.prototype,"showPrompt",null),e([u()],ye.prototype,"clearPrompt",null),e([u()],ye.prototype,"selectedAttachment",null),e([u()],ye.prototype,"selectedAttachmentDetails",null),e([u()],ye.prototype,"valid",null),e([u({type:x}),he(["attachments-change","value-change","values-change","submit"])],ye.prototype,"viewModel",void 0),e([u({type:T,nonNullable:!0})],ye.prototype,"visibleElements",void 0),e([u()],ye.prototype,"groupDisplay",void 0),e([u()],ye.prototype,"_formHeaderVisible",null),e([u()],ye.prototype,"_associationsEnabled",null),e([u()],ye.prototype,"_associationsList",void 0),e([u()],ye.prototype,"_attemptFocusOnNextRender",void 0),e([u()],ye.prototype,"_formId",null),e([u()],ye.prototype,"_focusedFieldInput",void 0),e([u()],ye.prototype,"_pendingSubtypeChoice",void 0),e([u()],ye.prototype,"_relatedRecordsEnabled",null),e([u()],ye.prototype,"_listObserverNode",void 0),e([u()],ye.prototype,"_attachmentDialogInfo",void 0),e([u()],ye.prototype,"_attachmentListFilterText",void 0),e([u()],ye.prototype,"_prompt",void 0),e([u()],ye.prototype,"test",null),ye=e([h("esri.widgets.BatchAttributeForm")],ye);const we=ye;export{we as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../core/Collection.js";import i from"../../core/Error.js";import{makeHandle as r,abortHandle as a}from"../../core/handleUtils.js";import o from"../../core/Logger.js";import{isAborted as s}from"../../core/promiseUtils.js";import{watch as l}from"../../core/reactiveUtils.js";import{property as n,subclass as d}from"../../core/accessorSupport/decorators.js";import h from"../../views/draw/support/HighlightHelper.js";import{temporaryHighlightName as c}from"../../views/support/HighlightDefaults.js";import u from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import p from"./UpdateRecordWorkflowData.js";import m from"./Workflow.js";import{fetchFullFeatures as f,handleFormValuesChangeEvent as g}from"./workflowUtils.js";import{toAttachmentEdit as w,toEditAttachmentsPayload as y}from"./support/attachmentUtils.js";var b;const F={exit:Symbol()};let v=class extends m{static{b=this}constructor(t){super(t),this._highlightHelper=null,this.fullFeature=null,this.type="update-table-record"}initialize(){const{data:t}=this,{edits:e}=t,{view:l}=t.viewModel,n=e.feature;l&&(this._highlightHelper=new h({view:l,highlightName:c}),this.addHandles(r(()=>this._highlightHelper?.removeAll())));const d=new AbortController;this.addHandles(a(d)),this._updatingHandles.consumePromise(f([n],n.sourceLayer,t.viewModel.view.spatialReference,d.signal).then(([t])=>{s(d)||(this._onFullFeatureLoaded(t),this._initializeFormViewModel())},t=>(o.getLogger(this).error("initialize()","Failed to fetch full feature for update workflow.",t),this.cancel({force:!0,error:new i("editor:failed-to-fetch-full-feature","Failed to retrieve all information for this feature. The update cannot proceed.",{detail:{error:t}})}))))}get allowSave(){return!this.data.readOnly&&this.hasPendingEdits&&!this.updating}get editorItem(){return this.data.editorItem}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return this.data.editorItem.hasInvalidFormTemplate}get hasPendingEdits(){return this.data.edits.modified&&!this.data.readOnly}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get saveActionLabel(){return"update"}get shouldShowAttachments(){return this.editorItem.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return this.editorItem.capabilities.update.attachments.enabled}get reliesOnOwnerAdminPrivileges(){const t=this.editorItem.capabilities;return t.update.reliesOnOwnerAdminPrivileges||t.delete.reliesOnOwnerAdminPrivileges}async enter(){}exit(t){this.removeHandles(F.exit)}async start(){return await super.start(),null}_initializeFormViewModel(){const{association:t,edits:i,viewModel:{view:r},readOnly:a,editorItem:o}=this.data,{fullFeature:s}=this,n=o.layerInfo?[o.layerInfo]:null,d=this._formViewModel=new u({activeFeatureIndex:0,attachmentsEnabled:!0,editType:"UPDATE",features:new e([s]),highlightHelper:this._highlightHelper,layerInfos:n,map:r?.map,readOnly:a,spatialReference:r.spatialReference,timeZone:r?.timeZone,callbacks:this.data.formCallbacks});t&&d.setActiveAssociation(t);const{initialFeature:h}=i;h&&d.overrideOriginalFeature(s,h),this.addHandles([d.on("values-change",g({filter:t=>t===s,forEachFeature:()=>{i.updateAttributes(d.getValues(s)),s.attributes=i.feature.attributes}})),d.on("attachments-change",t=>i.setAttachmentEdits(t.attachmentEdits)),l(()=>r?.timeZone,t=>d.timeZone=t)])}_onFullFeatureLoaded(t){this.fullFeature=t;const{edits:e}=this.data;e.updateAttributes(t.attributes),e.trackChanges()}static async create(t){const e=new b({data:await p.create(t),onCommit:this._onCommitFactory(t.applyEdits,t.applyAttachmentEdits)});return e._set("steps",this._createWorkflowSteps(e)),e}static _createWorkflowSteps(t){return[{id:"editing-attributes",async setUp(){},async tearDown(){}},{id:"adding-attachment",async setUp(){},async tearDown(){}},{id:"editing-attachment",async setUp(){},async tearDown(){}}]}static{this._onCommitFactory=(t,e)=>async i=>{const{edits:r,editorItem:a}=i,{feature:o}=r;if(!o)return;const s=o.sourceLayer,l=o.clone();if(!r.attributesModified||r.stagedForDelete){const t=s.objectIdField;if(l.attributes={[t]:o.getAttribute(t)},"scene"===s.type&&null!=s.infoFor3D){const t=s.associatedLayer?.globalIdField;null!=t&&l.setAttribute(t,o.getAttribute(t))}}const n=a.supportsGlobalIds&&"globalIdField"in s;if(n){const t=s.globalIdField;null!=t&&l.setAttribute(t,o.getAttribute(t))}r.geometryModified&&!r.stagedForDelete||(l.geometry=null);const d=r.stagedForDelete?"deleteFeatures":"updateFeatures",h=[],c=[],u=[],p={[d]:[l]};let m;r.attachmentsModified&&(r.attachmentEdits.forEach(t=>{t.adds.forEach(t=>h.push(w(t))),t.updates.forEach(t=>c.push(w(t))),t.deletes.forEach(t=>u.push(t.globalId))}),n&&(m={globalIdUsed:!0},h.length&&(p.addAttachments=h),c.length&&(p.updateAttachments=c),u.length&&(p.deleteAttachments=u)));await t(s,p,m)&&r.attachmentsModified&&!n&&await e(s,y(o,r.attachmentEdits))}}get test(){return{formViewModel:this._formViewModel}}};t([n()],v.prototype,"_formViewModel",void 0),t([n()],v.prototype,"allowSave",null),t([n()],v.prototype,"editorItem",null),t([n()],v.prototype,"formViewModel",null),t([n()],v.prototype,"fullFeature",void 0),t([n()],v.prototype,"hasInvalidFormTemplate",null),t([n()],v.prototype,"hasPendingEdits",null),t([n()],v.prototype,"layer",null),t([n()],v.prototype,"parent",null),t([n()],v.prototype,"saveActionLabel",null),t([n()],v.prototype,"shouldShowAttachments",null),t([n()],v.prototype,"shouldAllowAttachmentEditing",null),t([n()],v.prototype,"reliesOnOwnerAdminPrivileges",null),v=b=t([d("esri.widgets.Editor.UpdateRecordWorkflow")],v);export{v as UpdateRecordWorkflow,F as handleKeys};
2
+ import{__decorate as t}from"tslib";import e from"../../core/Collection.js";import i from"../../core/Error.js";import{makeHandle as r,abortHandle as a}from"../../core/handleUtils.js";import o from"../../core/Logger.js";import{isAborted as s}from"../../core/promiseUtils.js";import{watch as l}from"../../core/reactiveUtils.js";import{property as n,subclass as d}from"../../core/accessorSupport/decorators.js";import c from"../../views/draw/support/HighlightHelper.js";import{temporaryHighlightName as h}from"../../views/support/HighlightDefaults.js";import u from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import p from"./UpdateRecordWorkflowData.js";import m from"./Workflow.js";import{fetchFullFeatures as f,handleFormValuesChangeEvent as g}from"./workflowUtils.js";import{toEditAttachmentsPayload as w,toAttachmentEdit as y}from"./support/attachmentUtils.js";var b;const F={exit:Symbol()};let v=class extends m{static{b=this}constructor(t){super(t),this._highlightHelper=null,this.fullFeature=null,this.type="update-table-record"}initialize(){const{data:t}=this,{edits:e}=t,{view:l}=t.viewModel,n=e.feature;l&&(this._highlightHelper=new c({view:l,highlightName:h}),this.addHandles(r(()=>this._highlightHelper?.removeAll())));const d=new AbortController;this.addHandles(a(d)),this._updatingHandles.consumePromise(f([n],n.sourceLayer,t.viewModel.view.spatialReference,d.signal).then(([t])=>{s(d)||(this._onFullFeatureLoaded(t),this._initializeFormViewModel())},t=>(o.getLogger(this).error("initialize()","Failed to fetch full feature for update workflow.",t),this.cancel({force:!0,error:new i("editor:failed-to-fetch-full-feature","Failed to retrieve all information for this feature. The update cannot proceed.",{detail:{error:t}})}))))}get allowSave(){return!this.data.readOnly&&this.hasPendingEdits&&!this.updating}get editorItem(){return this.data.editorItem}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return this.data.editorItem.hasInvalidFormTemplate}get hasPendingEdits(){return this.data.edits.modified&&!this.data.readOnly}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get saveActionLabel(){return"update"}get shouldShowAttachments(){return this.editorItem.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return this.editorItem.capabilities.update.attachments.enabled}get reliesOnOwnerAdminPrivileges(){const t=this.editorItem.capabilities;return t.update.reliesOnOwnerAdminPrivileges||t.delete.reliesOnOwnerAdminPrivileges}async enter(){}exit(t){this.removeHandles(F.exit)}async start(){return await super.start(),null}_initializeFormViewModel(){const{association:t,edits:i,viewModel:{view:r},readOnly:a,editorItem:o}=this.data,{fullFeature:s}=this,n=o.layerInfo?[o.layerInfo]:null,d=this._formViewModel=new u({activeFeatureIndex:0,attachmentsEnabled:!0,editType:"UPDATE",features:new e([s]),highlightHelper:this._highlightHelper,layerInfos:n,map:r?.map,readOnly:a,spatialReference:r.spatialReference,timeZone:r?.timeZone,callbacks:this.data.formCallbacks});t&&d.setActiveAssociation(t);const{initialFeature:c}=i;c&&d.overrideOriginalFeature(s,c),this.addHandles([d.on("values-change",g({filter:t=>t===s,forEachFeature:()=>{i.updateAttributes(d.getValues(s)),s.attributes=i.feature.attributes}})),d.on("attachments-change",t=>i.setAttachmentEdits(t.attachmentEdits)),l(()=>r?.timeZone,t=>d.timeZone=t)])}_onFullFeatureLoaded(t){this.fullFeature=t;const{edits:e}=this.data;e.updateAttributes(t.attributes),e.trackChanges()}static async create(t){const e=new b({data:await p.create(t),onCommit:this._onCommitFactory(t.applyEdits,t.applyAttachmentEdits)});return e._set("steps",this._createWorkflowSteps(e)),e}static _createWorkflowSteps(t){return[{id:"editing-attributes",async setUp(){},async tearDown(){}},{id:"adding-attachment",async setUp(){},async tearDown(){}},{id:"editing-attachment",async setUp(){},async tearDown(){}}]}static{this._onCommitFactory=(t,e)=>async i=>{const{edits:r,editorItem:a}=i,{feature:o}=r;if(!o)return;const s=o.sourceLayer,l=a.supportsGlobalIds&&"globalIdField"in s,n={};let d;A(n,r,a),r.attachmentsModified&&l&&(d={globalIdUsed:!0},I(n,r));if(Object.keys(n).length>0){if(!await t(s,n,d))return}r.attachmentsModified&&!l&&await e(s,w(o,r.attachmentEdits))}}get test(){return{formViewModel:this._formViewModel}}};function A(t,e,i){const{feature:r,attributesModified:a,geometryModified:o,stagedForDelete:s}=e;if(!r||!(a||o||s))return;const l=r.sourceLayer,n=r.clone();if(!a||s){const t=l.objectIdField;if(n.attributes={[t]:r.getAttribute(t)},"scene"===l.type&&null!=l.infoFor3D){const t=l.associatedLayer?.globalIdField;null!=t&&n.setAttribute(t,r.getAttribute(t))}}if(i.supportsGlobalIds&&"globalIdField"in l){const t=l.globalIdField;null!=t&&n.setAttribute(t,r.getAttribute(t))}o&&!s||(n.geometry=null);t[s?"deleteFeatures":"updateFeatures"]=[n]}function I(t,e){const i=[],r=[],a=[];e.attachmentEdits.forEach(t=>{t.adds.forEach(t=>i.push(y(t))),t.updates.forEach(t=>r.push(y(t))),t.deletes.forEach(t=>a.push(t.globalId))}),i.length>0&&(t.addAttachments=i),r.length>0&&(t.updateAttachments=r),a.length>0&&(t.deleteAttachments=a)}t([n()],v.prototype,"_formViewModel",void 0),t([n()],v.prototype,"allowSave",null),t([n()],v.prototype,"editorItem",null),t([n()],v.prototype,"formViewModel",null),t([n()],v.prototype,"fullFeature",void 0),t([n()],v.prototype,"hasInvalidFormTemplate",null),t([n()],v.prototype,"hasPendingEdits",null),t([n()],v.prototype,"layer",null),t([n()],v.prototype,"parent",null),t([n()],v.prototype,"saveActionLabel",null),t([n()],v.prototype,"shouldShowAttachments",null),t([n()],v.prototype,"shouldAllowAttachmentEditing",null),t([n()],v.prototype,"reliesOnOwnerAdminPrivileges",null),v=b=t([d("esri.widgets.Editor.UpdateRecordWorkflow")],v);export{v as UpdateRecordWorkflow,F as handleKeys};
@@ -3,7 +3,7 @@ import type SnappingControlsVisibleElements from "../support/SnappingControls/Vi
3
3
  import type { SnappingControlsVisibleElementsProperties } from "../support/SnappingControls/VisibleElements.js";
4
4
 
5
5
  /** @since 5.0 */
6
- export interface VisibleElementsProperties extends Partial<Pick<VisibleElements, "createFeaturesSection" | "editFeaturesSection" | "flow" | "labelsToggle" | "mergeButton" | "settingsMenu" | "sketch" | "snappingControls" | "splitButton" | "tooltipsToggle" | "undoRedoButtons" | "zoomToButton">> {
6
+ export interface VisibleElementsProperties extends Partial<Pick<VisibleElements, "createFeaturesSection" | "editFeaturesSection" | "flow" | "labelsToggle" | "mergeButton" | "selectionToolbar" | "settingsMenu" | "sketch" | "snappingControls" | "splitButton" | "tooltipsToggle" | "undoRedoButtons" | "zoomToButton">> {
7
7
  /**
8
8
  * The available [SnappingControls](https://developers.arcgis.com/javascript/latest/references/core/widgets/support/SnappingControls/) elements within the widget.
9
9
  *
@@ -63,6 +63,19 @@ export default class VisibleElements extends Accessor {
63
63
  * @since 5.0
64
64
  */
65
65
  accessor mergeButton: boolean;
66
+ /**
67
+ * Whether to use the fully featured selection experience. This includes the
68
+ * selection toolbar — which provides multiple selection tools — and the
69
+ * selection list, which allows modifying selections and starting
70
+ * multi-feature editing workflows, like bulk updates and merges.
71
+ *
72
+ * If set to `false`, the widget will use a simplified selection experience,
73
+ * consisting of a single "Select" button.
74
+ *
75
+ * @default true
76
+ * @internal
77
+ */
78
+ accessor selectionToolbar: boolean;
66
79
  /**
67
80
  * Indicates whether to display the settings menu. This menu contains the snapping and tooltips settings.
68
81
  *