@arcgis/core 5.2.0-next.126 → 5.2.0-next.128

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 (234) hide show
  1. package/WebScene.js +1 -1
  2. package/applications/Components/basemapToggleUtils.d.ts +53 -0
  3. package/applications/Components/basemapToggleUtils.js +2 -0
  4. package/applications/SceneViewer/sceneViewerUtils.d.ts +14 -1
  5. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  6. package/applications/WebEditor/sketchUtils.js +1 -1
  7. package/arcgisGlobal.d.ts +1 -0
  8. package/assets/esri/core/libs/libtess/libtess-f32.wasm +0 -0
  9. package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/{e35eb93c0fb1f6de8db0.js → 00d9e41deecf5828975c.js} +1 -1
  12. package/assets/esri/core/workers/chunks/038d2b80d96237c25b6f.js +1 -0
  13. package/assets/esri/core/workers/chunks/{ab8a1140bf31f46f8ebf.js → 1262918b2161d79851c0.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{d3ef23923424ad8c5048.js → 1c2723f9630e7d597843.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{9ca98fffd43e63d5ade3.js → 1c33aa349beea9a3792f.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{54eeb4cac4fa092359ab.js → 2226c20c38e20713bcb5.js} +2 -2
  17. package/assets/esri/core/workers/chunks/{54eeb4cac4fa092359ab.js.LICENSE.txt → 2226c20c38e20713bcb5.js.LICENSE.txt} +2 -2
  18. package/assets/esri/core/workers/chunks/{4d18451e0ea6ca54101a.js → 2ebad7e588b26e74cefe.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{a8258636096416c837a2.js → 3b7dff15a0058ea29886.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{4716693eca44e8f89f5c.js → 3bf56c33876ba56c4b21.js} +1 -1
  21. package/assets/esri/core/workers/chunks/3c6ee445e49da0076ac1.js +1 -0
  22. package/assets/esri/core/workers/chunks/3f045f09ac95e7f22a97.js +1 -0
  23. package/assets/esri/core/workers/chunks/500f6d6f0ffa235cae85.js +1 -0
  24. package/assets/esri/core/workers/chunks/{56acda1eed3a013430e2.js → 58fb92775d668cfd295c.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{e6637f9176566382ed3e.js → 606cca69eaea84bfcdc6.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{fdbda3d2afea25142b86.js → 6267a1fe1603daa399b4.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{b013b70e40dfb6ce013e.js → 668ec0bdfb2095e90c9e.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{806f96ad09e882be41af.js → 67fd2cdb2e6834bfa710.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{5fe5ef5ccf480634d159.js → 75294f515c7f8393181c.js} +1 -1
  30. package/assets/esri/core/workers/chunks/75879ae88fd87b089a87.js +1 -0
  31. package/assets/esri/core/workers/chunks/761ea719ec1b4d562db2.js +1 -0
  32. package/assets/esri/core/workers/chunks/{24673aac70d6c949b6fa.js → 86d7a3ae672a51b75fcc.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{30604a29df320d7a4c6b.js → 88e11b645a1361f1bdbe.js} +1 -1
  34. package/assets/esri/core/workers/chunks/89dad6c1bfd81e4d7f8e.js +1 -0
  35. package/assets/esri/core/workers/chunks/{8daed13400d9e63e65ae.js → 8a842cde240aef12e417.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{c692e583e87af58f6d91.js → 8b0d6205ceeec1ab446f.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{57ab87e70ef85b9405f9.js → 8cb216404a6254bc695c.js} +1 -0
  38. package/assets/esri/core/workers/chunks/92509dd25996c6390a31.js +1 -0
  39. package/assets/esri/core/workers/chunks/9ccc2c8f7416943cc373.js +29 -0
  40. package/assets/esri/core/workers/chunks/a0a9c41400ae98df1912.js +1 -0
  41. package/assets/esri/core/workers/chunks/{b96358d475dc98034aa4.js → a15ed056e7493ddf3b4c.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{25e212fe9a2ea37c9e81.js → a3a33ffa34f4d645ddfe.js} +1 -1
  43. package/assets/esri/core/workers/chunks/af0704494398f33aa315.js +1 -0
  44. package/assets/esri/core/workers/chunks/{ce1ccf9ec90b786591e5.js → b396c4b4bb144200acc7.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{97602019a1ccad22a03a.js → bbfb80a6983574007ce5.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{d5f72670634e73c0b53a.js → bcf2e5cf6b9c6d0442bb.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{17218d714cb07b607c2f.js → c35e9dee87937f483a3d.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{85739ed6af0f0a3cb302.js → c94bdfed831c775e04c0.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{2e3fd81653dc0d86456c.js → cfeba0ffb7fdc2a9af05.js} +1 -1
  50. package/assets/esri/core/workers/chunks/d1187ad6cc4959683819.js +1 -0
  51. package/assets/esri/core/workers/chunks/d94a2b3b2ef49af9c2e3.js +1 -0
  52. package/assets/esri/core/workers/chunks/{cb7cb7d57c4e7f76600f.js → dc92710a8fdfb9135e55.js} +1 -1
  53. package/assets/esri/core/workers/chunks/ec187933b42fe65594b7.js +1 -0
  54. package/assets/esri/core/workers/chunks/eec5a93dbc258a90b6de.js +1 -0
  55. package/assets/esri/core/workers/chunks/{e1ae83ff3e0225708d4d.js → f479b4a4cee4bb2e046c.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{78abd6c42f39e6f6ffbb.js → f983296b6f4a62a911eb.js} +1 -1
  57. package/assets/esri/images/portal/gaussiansplatlayer16.png +0 -0
  58. package/assets/esri/images/portal/knowledgegraphlayer16.png +0 -0
  59. package/assets/esri/images/portal/propresentation16.png +0 -0
  60. package/assets/esri/images/portal/urbanproject16.png +0 -0
  61. package/assets/esri/images/support/loading-throb.gif +0 -0
  62. package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
  63. package/assets/esri/themes/base/icons/style.scss +0 -0
  64. package/assets/esri/themes/base/icons/variables.scss +0 -0
  65. package/assets/esri/themes/base/images/files/archive-32.svg +0 -0
  66. package/assets/esri/themes/base/images/files/cad-32.svg +0 -0
  67. package/assets/esri/themes/base/images/files/code-32.svg +0 -0
  68. package/assets/esri/themes/base/images/files/csv-32.svg +0 -0
  69. package/assets/esri/themes/base/images/files/excel-32.svg +0 -0
  70. package/assets/esri/themes/base/images/files/generic-32.svg +0 -0
  71. package/assets/esri/themes/base/images/files/gpx-32.svg +0 -0
  72. package/assets/esri/themes/base/images/files/image-32.svg +0 -0
  73. package/assets/esri/themes/base/images/files/pdf-32.svg +0 -0
  74. package/assets/esri/themes/base/images/files/report-32.svg +0 -0
  75. package/assets/esri/themes/base/images/files/sound-32.svg +0 -0
  76. package/assets/esri/themes/base/images/files/text-32.svg +0 -0
  77. package/assets/esri/themes/base/images/files/video-32.svg +0 -0
  78. package/assets/esri/themes/base/images/files/word-32.svg +0 -0
  79. package/assets/esri/themes/base/images/files/zip-32.svg +0 -0
  80. package/assets/esri/themes/base/images/loading-throb.gif +0 -0
  81. package/assets/esri/themes/base/widgets/_Bookmarks.scss +0 -0
  82. package/assets/esri/themes/base/widgets/_Tooltip.scss +42 -3
  83. package/assets/esri/themes/dark/main.css +1 -1
  84. package/assets/esri/themes/light/main.css +1 -1
  85. package/assets/esri/themes/light/view.css +1 -1
  86. package/assets/esri/views/interactive/tooltip/t9n/messages.en.json +1 -1
  87. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
  88. package/chunks/GlobalIllumination.glsl.js +1 -0
  89. package/config.js +1 -1
  90. package/core/Accessor.d.ts +1 -1
  91. package/core/lang.js +1 -1
  92. package/core/units.js +1 -1
  93. package/geometry/HeightModelInfo.js +1 -1
  94. package/geometry/ellipsoidUtils.js +1 -1
  95. package/geometry/support/heightModelInfoUtils.js +1 -1
  96. package/interfaces.d.ts +1 -0
  97. package/kernel.js +1 -1
  98. package/layers/ElevationLayer.js +1 -1
  99. package/layers/OrientedImageryLayer.js +1 -1
  100. package/layers/ParquetLayer.d.ts +21 -13
  101. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  102. package/layers/graphics/dehydratedFeatures.js +1 -1
  103. package/layers/graphics/transferFeatures.js +2 -0
  104. package/layers/mixins/FeatureLayerBase.js +1 -1
  105. package/layers/mixins/HeightModelInfoMixin.js +2 -0
  106. package/layers/mixins/SceneService.js +1 -1
  107. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  108. package/layers/raster/datasets/RasterFactory.js +1 -1
  109. package/package.json +3 -3
  110. package/popup/FeatureContentCollection.d.ts +15 -25
  111. package/popup/FeatureContentCollection.js +1 -1
  112. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  113. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  114. package/support/revision.js +1 -1
  115. package/symbols/cim/callouts/calloutAnalysisUtils.js +2 -0
  116. package/symbols/cim/callouts/effects/BackgroundCallout.js +1 -1
  117. package/symbols/cim/callouts/effects/BalloonCallout.js +1 -1
  118. package/symbols/cim/callouts/effects/PointSymbolCallout.js +1 -1
  119. package/symbols/cim/callouts/effects/SimpleLineCallout.js +1 -1
  120. package/symbols/cim/callouts/effects/calloutUtils.js +1 -1
  121. package/symbols/cim/cimAnalyzer.js +1 -1
  122. package/views/2d/engine/webgl/ClipMesh.js +1 -1
  123. package/views/2d/engine/webgl/mesh/factories/CalloutMeshWriterCoordinator.js +1 -1
  124. package/views/2d/engine/webgl/mesh/factories/MeshWriterGroupCoordinator.js +1 -1
  125. package/views/2d/engine/webgl/mesh/templates/templateUtils.js +1 -1
  126. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  127. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +1 -1
  128. package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
  129. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js +1 -1
  130. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
  131. package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js +1 -1
  132. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js +1 -1
  133. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js +1 -1
  134. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  135. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js +1 -1
  136. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
  137. package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js +1 -1
  138. package/views/2d/engine/webgl/shaderGraph/techniques/markers/ComputedMarkerParams.js +1 -1
  139. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  140. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/CalloutMeshWriterPolicy.js +1 -1
  141. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
  142. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterReferences.js +1 -1
  143. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  144. package/views/2d/engine/webgl/util/AnnotationMatcher.js +1 -1
  145. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  146. package/views/2d/layers/LayerView2D.js +1 -1
  147. package/views/2d/layers/support/annodime/MatcherGeometryOverride.js +1 -1
  148. package/views/2d/layers/support/annodime/PrivateMatcherGeometryOverrideEffect.js +1 -1
  149. package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +1 -1
  150. package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
  151. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
  152. package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
  153. package/views/3d/analysis/LineOfSight/LineOfSightRootPlugin.js +1 -1
  154. package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
  155. package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
  156. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +5 -3
  157. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  158. package/views/3d/analysis/Viewshed/ViewshedPlacementRootPlugin.js +1 -1
  159. package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
  160. package/views/3d/camera/intersectionUtils.js +1 -1
  161. package/views/3d/interactive/editingTools/manipulatedObjectUtils.js +1 -1
  162. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  163. package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
  164. package/views/3d/layers/I3SMeshView3D.js +1 -1
  165. package/views/3d/layers/graphics/FeatureGraphics3DGraphicsPipeline.js +1 -1
  166. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  167. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  168. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  169. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  170. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  171. package/views/3d/layers/support/FeatureMemory.js +2 -0
  172. package/views/3d/layers/support/FeatureTile.js +1 -1
  173. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  174. package/views/3d/layers/support/featureReference.js +1 -1
  175. package/views/3d/navigation/modes/GroundNavigationMode3D.js +1 -1
  176. package/views/3d/state/Constraints.js +1 -1
  177. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  178. package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
  179. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  180. package/views/3d/support/PBFDecoder.js +1 -1
  181. package/views/3d/support/PBFDecoderWorker.js +1 -1
  182. package/views/3d/support/QualityProfile.js +1 -1
  183. package/views/3d/support/popupHitTest.js +1 -1
  184. package/views/3d/terrain/TerrainRenderer.js +1 -1
  185. package/views/3d/terrain/TerrainSurface.js +1 -1
  186. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  187. package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
  188. package/views/DOMContainer.d.ts +2 -2
  189. package/views/DOMContainer.js +1 -1
  190. package/views/PopupView.d.ts +1 -1
  191. package/views/SceneView.js +1 -1
  192. package/views/ToolViewManager.js +1 -1
  193. package/views/interactive/options/TooltipVisibleElements.d.ts +11 -1
  194. package/views/interactive/options/TooltipVisibleElements.js +1 -1
  195. package/views/interactive/tooltip/components/ElevationModeSelect.js +2 -0
  196. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  197. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  198. package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
  199. package/views/interactive/tooltip/infos/SketchTooltipInfo.js +1 -1
  200. package/views/support/hitTestSelectUtils.js +1 -1
  201. package/widgets/BasemapToggle/BasemapToggleViewModel.d.ts +1 -0
  202. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  203. package/widgets/BasemapToggle.js +1 -1
  204. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +9 -1
  205. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
  206. package/widgets/BatchAttributeForm.js +1 -1
  207. package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +1 -0
  208. package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
  209. package/widgets/DirectionalPad.js +1 -1
  210. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  211. package/widgets/Editor/legacy/UpdateFeatureWorkflow.js +1 -1
  212. package/widgets/Editor/workflowUtils.js +1 -1
  213. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  214. package/widgets/OrientedImageryViewer/utils.js +1 -1
  215. package/widgets/Popup/types.d.ts +0 -7
  216. package/widgets/Popup.d.ts +7 -7
  217. package/widgets/TimeSlider/TimeSliderViewModel.d.ts +2 -0
  218. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  219. package/widgets/TimeSlider.js +1 -1
  220. package/assets/esri/core/workers/chunks/0a2b7c691a577cb3d189.js +0 -1
  221. package/assets/esri/core/workers/chunks/2146c25c01c9fc11b16c.js +0 -1
  222. package/assets/esri/core/workers/chunks/4678a8170d8a3ccd1a7b.js +0 -1
  223. package/assets/esri/core/workers/chunks/56e97b98dcb8a3f2bcb7.js +0 -1
  224. package/assets/esri/core/workers/chunks/6c3535aa7250c08b9e5b.js +0 -1
  225. package/assets/esri/core/workers/chunks/6e75f09fb9452bd5f9fb.js +0 -1
  226. package/assets/esri/core/workers/chunks/7441d121f00ce747c08e.js +0 -1
  227. package/assets/esri/core/workers/chunks/76548469fe1b9c3b2051.js +0 -1
  228. package/assets/esri/core/workers/chunks/82ce034b5ba54de9b970.js +0 -29
  229. package/assets/esri/core/workers/chunks/ba435cc73956d9c64a11.js +0 -1
  230. package/assets/esri/core/workers/chunks/c77496c350004ee66eb2.js +0 -1
  231. package/assets/esri/core/workers/chunks/d371d9279b30548efa02.js +0 -1
  232. package/assets/esri/core/workers/chunks/dc52e036547612949d32.js +0 -1
  233. package/assets/esri/core/workers/chunks/e5ee64e2fb5bfcb716d8.js +0 -1
  234. package/views/2d/engine/webgl/mesh/bufcut.js +0 -2
@@ -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 a}from"../core/deprecate.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{destroyMaybe as s}from"../core/maybe.js";import o from"../core/ReactiveMap.js";import{watch as l,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,getMessageString 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 T}from"./BatchAttributeForm/interfaceUtils.js";import L from"./BatchAttributeForm/VisibleElements.js";import{isDynamicChoiceController as V,isMultipleChoiceController as R}from"./BatchAttributeForm/inputs/support/controllerUtils.js";import{isGroupInput as N,isFieldInput as U,isTextElementInput as P,isRelationshipElementInput as B,isAttachmentElementInput as $,isUtilityNetworkAssociationsElementInput as z,differentValuesString as j,getNormalizedFieldName as H,isGroupedInput as W}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as G,otherChoiceCheckedPlaceholderValue as Z,canRestoreMultipleChoiceOtherChoiceDraftValue as q}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{loadRelationshipDetailsComponents as K,RelationshipDetails as X}from"./BatchAttributeForm/rendered-content/RelationshipDetails.js";import{Prompt as J}from"./Editor/components/Prompt.js";import{downloadAttachmentInfo as Q}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as Y}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as ee,getIntlOptionsForField as te,prepareISOFieldValueForDateComponents as ae,prepareUnixFieldValueForDateComponents as ie,normalizeTimeOnlyString as ne,getISOFieldValueFromDateComponents as se,getUnixFieldValueFromDateComponents as oe}from"./support/dateUtils.js";import{globalCss as le}from"./support/globalCss.js";import{Heading as re}from"./support/Heading.js";import{calciteListFilterProps as ce}from"./support/listUtils.js";import{messageBundle as de,vmEvent as me,tsx as ue}from"./support/widget.js";import{setFocus as he}from"./support/widgetUtils.js";import{isEmptyValue as pe}from"./support/forms/formUtils.js";const ge="data-element-id",ve="data-field-name",be="esri_BatchAttributeForm_select_all",fe="esri_BatchAttributeForm_other_choice";let _e=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 L,this.groupDisplay="all",this._associationsList=null,this._associationsWidgetsMap=new o,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._dynamicChoiceItemSelections=new WeakSet,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 a=e.input.template.elementId,i=C(e.attachment);this.viewModel.stageRenameAttachment(a,i,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=()=>{a(i.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...a}=e;return a}initialize(){this.addHandles([l(()=>this.features.toArray(),()=>{this._dateComponentMap.clear(),G(this.viewModel,{includeDraftValues:!0})}),l(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),G(this.viewModel),this._setFocusableInput()}),l(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),r(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),l(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),l(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),c(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()}),l(()=>[this._associationsEnabled,this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs],()=>this._setUpAssociationsWidgets(),d),l(()=>this.viewModel.activeAssociationsInput,e=>this._onActiveAssociationsInputChange(e)),l(()=>this.groupDisplay,()=>this._syncGroupInputStates())])}loadDependencies(){return Promise.all([Y({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),autocomplete:()=>import("@esri/calcite-components/dist/components/calcite-autocomplete"),"autocomplete-item":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item"),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")}),K()])}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:a}=this;return t?"replacing-attachment"===a?t.titles.replaceAttachment:"viewing-attachment-details"===a?t.titles.editAttachment:"adding-attachments"===a?t.titles.addAttachments:"viewing-attachments"===a?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:"":""}get effectiveDisabled(){return this.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:a}=this,i=this.effectiveDisabled;if("adding-attachments"===a||"replacing-attachment"===a)return[];if("viewing-attachment-details"===a){const t=this.selectedAttachmentDetails,a=t?.input?.getAttachmentEditState(t.attachment);if(!t?.input||!a)return[];return a.isRenamed||a.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"===a?O({messages:t,purpose:"cancel-viewing-associated-features",onclick:()=>this.goBack()}):"viewing-associated-layers"===a?O({messages:t,purpose:"cancel-viewing-associated-layers",onclick:()=>this.goBack()}):"viewing-attachments"===a||"viewing-related-records"===a?[]:T({disabled:i||!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 ue("div",{class:this.classes(D.base,le.widget,le.panel),ondragover:this._handleDragAndDrop,ondrop:this._handleDragAndDrop},this._renderContent(),this._renderAttachmentDialog(),this._prompt?ue(J,{...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:a}=e.dataset,i=n(this._dateComponentMap,`${a}`,()=>({}));switch(t){case"date":i.date=e;break;case"time":i.time=e;break;case"timeZone":i.timeZone=e}}_renderContent(){const{messages:e,viewModel:a}=this,{status:i}=a;return"failed"===i?a.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:a.maximumFeatureCountWithComplexForms})):a.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:a.maximumFeatureCount})):e.formFailedToLoad:a.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===i&&this.visibleElements.loadingIndicator?ue("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return ue("calcite-notice",{class:D.noticeError,icon:!0,kind:t,open:!0},ue("div",{slot:"message"},e))}_renderForm(){return ue("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:a}=e;let i;if(!e.submitHasBeenAttempted)return null;if(a.invalidHiddenInputs.length>0)if(i=w(a,e.mode,this.messages),"batch"===this.viewModel.mode){const e=a.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?i+=` (${e.map(e=>e.label).join(", ")})`:i=null}else i=null;else if(t)return null;return i?this._renderErrorNotice(i,"danger"):null}_renderDefaultPage(){return[this._renderReadOnlyNotice(),this._renderFormHeader(),this._renderFormContent()]}_renderReadOnlyNotice(){if((this.disabled||this.readOnly)&&this.visibleElements.readOnlyNotice)return ue("calcite-notice",{class:D.disabledNotice,"data-testid":"read-only-notice",icon:"read-only-non-editable",kind:"brand",open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},this.featureFormMessages.disabledForm))}_renderFormHeader(){const{formTitle:e,formDescription:t}=this.viewModel;if(!this._formHeaderVisible)return;const a=e?ue(re,{key:"title",level:this.headingLevel},e):void 0,i=t?ue("p",{class:D.description,key:"description"},t):void 0;return ue("div",{class:D.formHeader},a,i)}_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 N(e)?this._renderGroupInput(e):U(e)?this._renderLabeledField(e):P(e)?this._renderTextComponent(e):B(e)?this._renderRelationshipElementInput(e):$(e)?this._renderAttachmentElementInput(e):z(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:a,open:i}=e,n=t.filter(e=>e.visible),s=e.label??"",o=this._focusedFieldInput?.group===e,l="sequential"===this.groupDisplay;return ue("calcite-block",{class:this.classes(D.group,l?D.groupSequential:null,o?D.groupActive:null,this.disabled?D.inputDisabled:null),collapsible:!0,description:e.description??void 0,expanded:i,heading:s,headingLevel:this.headingLevel,key:`{${a.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:a}=e.template,{label:i,required:n,dataType:s}=e,o=n?t(this.messages.requiredFieldLabel,{name:i}):i;return ue("calcite-label",{"aria-label":o,class:D.label,key:`field--${a}`},ue("div",{class:D.labelTextContent,key:"labelTextContainer"},i,n?ue("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:a}=e;return V(e.inputController)?this._renderDynamicChoiceComponent({input:e,props:t,controller:e.inputController}):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):R(e.inputController)?this._renderMultipleChoiceComponent({input:e,props:t}):"date"===a?this._renderDateComponents(e,t):(t.disabled=this.disabled,t.readOnly=t.readOnly||this.viewModel.updating,"number"===a?this._renderNumberComponent(e,t):this._renderStringComponent(e,t))}_renderAuxiliaryText(e){const{description:t}=e,a=F(e,e.validationMessage,this.messages);return a?ue("calcite-input-message",{icon:!0,status:e.status},a):t?ue("calcite-input-message",{class:D.description,icon:!1,status:e.status},t):null}_renderCodedInputs({input:e,props:t}){const a=e.input?.type??null,i=e.codedValueOptions;switch(a){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:i,props:t});default:return this._renderComboBoxComponent({options:i,props:t,input:e})}}_renderDynamicChoiceComponent({input:e,props:t,controller:a}){const i=a.filteredChoices,n=e.showNoValueLabel||this.messages.empty,s=t=>{this._saveInput(e,t)},o=(e,t)=>{this._dynamicChoiceItemSelections.delete(a);const i=e.closest("calcite-autocomplete");if(i){const e=null==t?"":a.getLabel(t);a.filterValue=e,i.inputValue=e}s(t)},l=({currentTarget:t})=>{const i=t.inputValue??"";a.filterValue=i,i||null==e.value||s(null)},r=e.showNoValueOptionEnabled?ue("calcite-autocomplete-item",{heading:n,key:"dynamic-choice-empty",selected:null==e.value,value:"",onCalciteAutocompleteItemSelect:({currentTarget:e})=>o(e,null),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(a)}}):null,c=t=>{const i=e.value===j?this.messages.differentValuesPlaceholder:null==e.value?"":a.inputValue;t.inputValue=i};return ue("calcite-autocomplete",{...t,afterCreate:c,disabled:t.readOnly||t.disabled,loading:a.evaluating,placeholder:null==e.value?n:t.placeholder,value:String(t.value),onblur:e=>this._onDynamicChoiceBlur(e,a),onCalciteAutocompleteBeforeOpen:()=>a.beginInteraction(),onCalciteAutocompleteTextInput:l},r,i.map(t=>ue("calcite-autocomplete-item",{heading:t.name,key:`dynamic-choice-${t.code}`,selected:t.code===e.value,value:String(t.code),onCalciteAutocompleteItemSelect:({currentTarget:e})=>o(e,t.code),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(a)}})))}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:a}=this,i=this._getMultipleChoiceController(e);if(!i)return null;const{input:n}=i,s=!0===n.includeSelectAllChoices,{checkboxStatesByValue:o,selectAllState:l}=i.selectionState,r=l.checked?a.deselectAllLabel:a.selectAllLabel,c=i.otherChoiceRenderState,d=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},m=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},u=t=>{const{fieldName:a}=c;a&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:a})},h=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:c.fieldName??void 0})};return ue("div",{class:D.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},s?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:l,selectAllLabel:r,handleSelectAllCheckboxChange:d}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:m}),c.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:s,otherChoiceRenderState:c,handleOtherChoiceCheckboxChange:u,handleOtherChoiceInputChange:h,differentValuesPlaceholder:a.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:a,handleSelectAllCheckboxChange:i}){return ue("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:D.multipleChoiceSelectAll,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:a,labelText:a,value:be,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:a,handleChoiceCheckboxChange:i}){const n=this._getMultipleChoiceController(e);if(!n)return[];const{choices:s}=n;return s.map(e=>{const n=a.get(e.value)??{checked:!1,indeterminate:!1};return ue("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[ge],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})=>i(e),onfocus:t.onfocus})})}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:a,handleOtherChoiceCheckboxChange:i,handleOtherChoiceInputChange:n,differentValuesPlaceholder:s}){const o=a.label??this.messages.otherOptionLabel;return ue("div",{class:this.classes(D.multipleChoiceOtherChoice,t?D.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},ue("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:a.checkboxState.checked,class:e.class,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,indeterminate:a.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:o,labelText:o,value:fe,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus}),a.checkboxState.checked?ue("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":o,class:D.textElementInput,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,key:`${e.key}-other-choice-input`,maxLength:a.maxLength,placeholder:a.value===j?s:a.hint,status:a.status,type:"text",value:a.normalizedValue===j?"":a.normalizedValue?String(a.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:a=!1}){e.touch();const i=this._getMultipleChoiceController(e);if(!i)return;if(i.input&&!a&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const n=e.value,s=this._parseValue(t,e,a);s!==n&&await this.viewModel.setValue(e.template.elementId,s)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:a}){if(!a)return;const i=t.value,n=null==i||""===i?null:i,s=this._getMultipleChoiceController(e);if(!s)return;s.initializeExplicitOtherChoiceCheckedState(),s.stashOtherChoiceDraftValueForFeatures(e.features,n);const o=H(e,a);o&&await this.viewModel.setValueForFieldName(o,n,Array.from(e.features,e=>e.source))}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:a}){const i=this._getMultipleChoiceController(e);if(!i)return;i.setExplicitOtherChoiceCheckedState(t),e.touch(),t||i.setOtherChoiceDraftValuesFromFeatures(e.features.toArray());const n=H(e,a);if(!n)return;const s=new Map;for(const o of e.features){const e=o.getAttribute(a);if(t){if(!pe(e))continue;const t=i.getOtherChoiceDraftValue(o),a=q(t)?t:Z;s.set(o,a);continue}null!=e&&s.set(o,null)}0!==s.size&&await this.viewModel.setValuePerFeatureForFieldName(n,new Map(Array.from(s,([e,t])=>[e.source,t])))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){const a=this._getMultipleChoiceController(e);if(!a)return;const i=new Map(e.features.map(i=>[i,a.getUpdatedValueForFeature({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)===j||e.value===j)&&"batch"===this.viewModel.mode){const a={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,onblur:t.onblur,onfocus:t.onfocus,[ge]:t[ge]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:a,options:[{name:this.messages.differentValuesPlaceholder,value:j,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return ue("calcite-switch",{...t,checked:!!I(e.template,"switch")&&e.value===e.template.input.onValue,class:D.inputSwitch,disabled:t.readOnly||t.disabled,onCalciteSwitchChange:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:a}){const{trigger:i,dropdown:n,group:s}=a;return ue("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInputFromElement(e)},ue("calcite-button",{...i},e===j?this.messages.differentValuesPlaceholder:e),ue("calcite-dropdown-group",{selectionMode:s.mode},t.map(t=>ue("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:a}){const i="INSERT"===this.viewModel.editType&&e.showNoValueOptionEnabled&&!e.touched?()=>{}:a.onblur,n={...a,onblur:i};return ue("calcite-combobox",{...n,clearDisabled:e.isSubtypeField,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:a.placeholder===this.messages.differentValuesPlaceholder?j:String(a.value),onCalciteComboboxChange:({currentTarget:t})=>{t.value!==j&&(e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveInputFromElement(t))}},this.renderComboboxOptionsList({input:e,options:t,props:a}))}renderComboboxOptionsList({input:e,options:t,props:a}){const i=e=>e.map(e=>{const{value:t}=e,i=pe(e.value)?this.messages.empty:e.name;return ue("calcite-combobox-item",{heading:i,key:`#${t}`,selected:a.value===t,value:`${t}`})});let n=[];const{messages:s}=this;t.other.length>0&&n.push(ue("calcite-combobox-item-group",{key:"other",label:s.other},i(t.other))),t.unsupported.length>0&&n.push(ue("calcite-combobox-item-group",{key:"unsupported",label:s.unsupported},i(t.unsupported)));const o=i(t.recommended);n.length>0?n.unshift(ue("calcite-combobox-item-group",{key:"recommended",label:s.recommended},o)):n=o;const l=a.placeholder===this.messages.differentValuesPlaceholder,r=!l&&pe(a.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(ue("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),l&&n.unshift(ue("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:j,selected:!0,value:j})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:a}){const i=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:i})=>this._renderRadioButtons({label:t,value:i,selected:i===e.value,props:a}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,s=pe(e.value);i.unshift(this._renderRadioButtons({label:n,value:t,selected:s,props:a}))}return ue("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:D.inputRadioGroup,"data-field-name":a[ve],disabled:a.readOnly||a.disabled,key:`${a.key}-radio-group`,layout:"vertical",name:`${a.name}-${this.id}`,required:a.required},i,a.placeholder===this.messages.differentValuesPlaceholder?ue("calcite-label",{class:D.placeholderRadio,key:a.label,layout:"inline"},ue("calcite-radio-button",{checked:!0,class:D.inputRadio,disabled:!0,value:a.placeholder}),a.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:a,props:i}){return ue("calcite-label",{class:D.inputRadioLabel,key:i.label,layout:"inline"},ue("calcite-radio-button",{...i,afterCreate:void 0,afterUpdate:void 0,checked:t,class:D.inputRadio,disabled:i.readOnly||i.disabled,name:void 0,value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInputFromElement(e)}}),a)}_renderStringComponent(e,t){const{template:a}=e;return!a.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===a.input?.type?ue("calcite-text-area",{...t,class:this.classes(D.individualElement),resize:"vertical",value:t.value?String(t.value):"",onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteTextAreaInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}}):ue("calcite-input",{...t,class:this.classes(D.individualElement),type:"text",value:t.value?String(t.value):"",onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteInputInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}})}_renderNumberComponent(e,t){const a=g(e.field);return ue("calcite-input-number",{...t,integer:a,step:a?1:"any",type:"number",value:a&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteInputNumberInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}})}_renderReadOnlyComponent(e,t){const a=this.getCommonInputProps(e);return ue("calcite-input",{...a,class:this.classes(D.fieldInput,D.inputDisabled,D.individualElement),readOnly:!0,type:"text",value:String(t??a.value??"")})}_renderDateComponents(e,t){const{field:a}=e;let i;switch(a.type){case"date":i=this._renderDateFieldComponents(e,t);break;case"date-only":i=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":i=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":i=this._renderTimestampOffsetFieldComponents(e,t);break;default:i=this._renderReadOnlyComponent(e,ee(a,t.value,{timeZone:e.effectiveTimeZone,...te(e.template.field)}))}return e.value===j?[i,ue("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:i}_renderDateOnlyFieldComponent(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t,{rawMax:o,rawMin:l}=e.range;return ue("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:a,"data-date-part":"date","data-element-id":t[ge],"data-field-name":t[ve],disabled:i,key:`${n}-date-input`,max:v(o)?o:void 0,min:v(l)?l:void 0,overlayPositioning:"fixed",readOnly:s,topLayerDisabled:this.topLayerDisabled,value:e.value===j?"":e.value?String(e.value):"",onblur:t.onblur,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_renderTimeOnlyFieldComponent(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t;return ue("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:a,"data-date-part":"time","data-element-id":t[ge],"data-field-name":t[ve],disabled:i,key:`${n}-time-input`,overlayPositioning:"fixed",readOnly:s,step:e.timeStep,value:e.value===j?"":e.value?String(e.value):"",onblur:t.onblur,onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:a,disabled:i,key:n,readOnly:s,onblur:o,onfocus:l}=t,{rawMax:r,rawMin:c}=e.range,d=e.effectiveTimeZone,m=ae(r,d),u=ae(c,d),h=ae(e.value===j?"":e.value,d),p=e.includeTimeOffset,g={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:i,[ge]:t[ge],[ve]:t[ve],onblur:o,onfocus:l,overlayPositioning:"fixed",readOnly:s};return ue("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},ue("calcite-input-date-picker",{...g,class:a,"data-date-part":"date",key:`${n}-date-input`,max:m?.date??void 0,min:u?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:h.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),ue("calcite-input-time-picker",{...g,class:a,"data-date-part":"time",key:`${n}-time-input`,step:e.timeStep,value:h.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?ue("calcite-input-time-zone",{...g,class:a,clearable:e.value===j||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,value:h.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:a,disabled:i,key:n,readOnly:s,min:o,max:l}=t,r=e.effectiveTimeZone,c=ie(e.value===j?"":e.value,r),d=ie(l,r),m=ie(o,r),u=e.includeTime,h={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:i,[ge]:t[ge],[ve]:t[ve],onblur:t.onblur,onfocus:t.onfocus,overlayPositioning:"fixed",readOnly:s};return ue("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},ue("calcite-input-date-picker",{...h,class:a,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:m?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?ue("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${n}-time-input`,step:1,value:c.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){return this._relatedRecordsEnabled?ue(X,{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:a,defaultPageAttachments:i,template:{description:n,elementId:s,label:o}}=e,l=t?a:i;return ue("div",{class:D.attachmentElementInput,"data-testid":`attachment-element-${s}`,key:`attachment-element-${s}`},o?ue("div",{class:D.attachmentElementLabel,key:`attachment-element-label-${s}`},o):null,n?ue("div",{class:D.description,key:`attachment-element-description-${s}`},n):null,a.length?this._renderAttachmentList(e,l,{label:o||this.messagesCommon.details,viewAllCount:t?null:a.length}):ue("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 ue("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,a){const{filterEnabled:i,label:n,viewAllCount:s}=a;return ue("calcite-list",{class:D.attachmentElementList,filterEnabled:i,filterPlaceholder:i?this.messages.attachments.searchAttachments:void 0,filterProps:i?ce:void 0,filterText:i?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:i?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=s?this._renderViewAllAttachmentsItem(e,s):null)}_renderAttachmentListItems(e,t){const{elementId:a}=e.template;return t.map((t,i)=>{const n=this._formatAttachmentSize(t.size),s=this._getAttachmentLabel(t,i,n,e.displayFilename),o=s===n?void 0:n,l=C(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=c.isDeleted,m=!d&&(r||c.isRenamed||c.isReplaced);return ue("calcite-list-item",{class:D.attachmentElementListItem,description:o,key:`attachment-item-${l}`,label:s,onCalciteListItemSelect:r||d?void 0:()=>this._setSelectedAttachment({attachmentKey:l,elementId:a})},ue("div",{class:D.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,s,e)),m?ue("span",{class:D.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[ue("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(a,C(t))})]:d?ue("calcite-chip",{label:this.messages.attachments.deleted,scale:"s",slot:"content-end"},this.messages.attachments.deleted):ue("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))})}_renderViewAllAttachmentsItem(e,a){const{elementId:i}=e.template,{viewAll:n}=this.messages.attachments;return ue("calcite-list-item",{class:D.attachmentElementListItem,description:t(this.messages.attachments.count,{count:a}),key:`attachment-item-view-all-${i}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(i)},ue("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,a=this.effectiveDisabled||e.addDisabled,i=this._renderAttachmentCountLimitsLabel(e),n=this._getAttachmentNoticeMessage(e),s=e.hasMinimumAttachmentCountNotMet||e.hasExceededAttachmentLimit?"danger":"info",o=e.canUploadFiles,l=e.isCaptureOnly&&!this.effectiveDisabled&&!n;return ue("div",{class:D.attachmentElementAddActions,key:`attachment-element-add-actions-${t}`},o?ue("calcite-button",{appearance:"outline",disabled:a,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach):null,this._renderAttachmentCaptureButton(e),l?this._renderAttachmentCaptureDisabledNotice(t):null,i?ue("div",{class:D.attachmentElementEmptyActionHint},i):null,!this.effectiveDisabled&&n?ue("calcite-notice",{closable:!1,icon:"danger"===s?"exclamation-mark-circle":"lightbulb",kind:s,open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},n)):null)}_renderAttachmentCaptureButton(e){if(!e.hasCaptureInputs)return null;const t=e.captureMediaType;return ue("calcite-button",{appearance:"outline",disabled:!0,iconStart:Ce(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||e.touched}_getCaptureButtonLabel(e){const{capture:t,recordAudio:a,takePhoto:i,takeVideo:n}=this.messages.attachments;switch(e){case"image":return i||t;case"video":return n||t;case"audio":return a||t;default:return t}}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:a}=e.template;if(e.isCaptureOnly)return this._renderAttachmentCaptureDisabledNotice(a);const i=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,s=this.messages.attachments,o=s.dragAndDropFile,l="upload",r=e=>{this._attachmentFileInputMap.set(a,e)};return ue("div",{class:D.attachmentElementAddPanel,key:`attachment-element-add-panel-${a}`},ue("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(a)},afterUpdate:r,class:D.attachmentElementFileInput,"data-element-id":a,disabled:n,multiple:i,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?Array.from(t.files):[];this._stageAttachmentFiles(a,i),t.value=""}}),ue("div",{class:D.attachmentElementAddDropzone,"data-disabled":n?"true":"false",ondragover:e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),n)return;const t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(a,t)}},ue("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:l,scale:"l"}),ue("div",{class:D.attachmentElementAddDropzoneHeading},s.addFile),ue("div",{class:D.attachmentElementAddDropzoneDetail,title:o},o),ue("calcite-button",{appearance:"transparent",disabled:n,iconStart:"folder-open",kind:"brand",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(a,n)}},s.selectFile)),this._renderAttachmentValidationCriteria(e,{includeCountCriteria:!0}))}_renderAttachmentCaptureDisabledNotice(e){return ue("calcite-notice",{class:D.attachmentElementCaptureNotice,icon:!0,key:`attachment-element-capture-disabled-notice-${e}`,kind:"warning",open:!0,scale:"s"},ue("div",{slot:"message"},this.messages.attachments.captureMethodNotSupported))}async _stageAttachmentFiles(e,t){if(0===t.length)return;const a=this.viewModel.selectedAttachmentAddInput;let i=!0;try{i=(await this.viewModel.stageAddAttachments(e,t)).length>0&&!a?.hasInvalidValidationCriteria&&!a?.hasUnsupportedFileTypeValidationError}finally{i&&this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){const e=this.selectedAttachmentDetails;if(!e)return;if("replacing-attachment"===this.page)return this._renderAttachmentReplacePanel(e);const{attachment:t,input:a}=e,i=C(t),n=!!a.getAttachmentPreviewUrl(t),s=!this._disableAttachmentModification(a)&&a.canUploadFiles,o=a.getAttachmentEditState(t);return ue("div",{class:D.attachmentElementDetail,key:`attachment-detail-panel-${a.template.elementId}-${i}`},ue("div",{class:D.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)),ue("div",{class:D.attachmentElementDetailActions},y(t)?ue("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,ue("calcite-button",{appearance:"outline",disabled:!n||o.isReplaced,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),ue("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})),ue("div",{class:D.attachmentElementDetailMetadata},ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),this._renderFileNameContent(t,a)),ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.size),ue("span",{class:D.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.type),ue("span",{class:D.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderFileNameContent(e,t){if(!t.allowUserRename)return ue("span",{class:D.attachmentElementDetailMetadataValue},e.name);const a=t.getAttachmentEditState(e),{baseName:i,extension:n}=A(e.name),s=this._disableAttachmentModification(t),o=!s&&0===e.name.trim().length;return[ue("div",{class:D.attachmentElementDetailFileNameRow,key:"file-name-row"},ue("calcite-input",{class:D.attachmentElementDetailFileNameInput,disabled:s,scale:"m",status:o?"invalid":"idle",suffixText:n,value:i,onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),ue("calcite-button",{appearance:"transparent",disabled:s||null==a.initialName||!a.isRenamed,iconStart:"reset",kind:"neutral",label:this.messages.footerButtons.reset,scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})),o?ue("calcite-input-message",{icon:!0,key:"file-name-message",status:"invalid"},this.messages.validationErrors.cannotBeNull):null]}_renderAttachmentReplacePanel(e){const{attachment:t,input:a}=e,i=this._disableAttachmentModification(a)||!a.canUploadFiles,n=a.template.elementId;return ue("div",{class:D.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${C(t)}`},ue("input",{accept:a.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:D.attachmentElementFileInput,disabled:i,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?.[0];a&&this._stageSelectedAttachmentReplacement(a),t.value=""}}),ue("div",{class:D.attachmentElementAddDropzone,"data-disabled":i?"true":"false",ondragover:e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),i)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},ue("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),ue("div",{class:D.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),ue("div",{class:D.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),ue("calcite-button",{appearance:"transparent",disabled:i,iconStart:"folder-open",kind:"brand",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),this._renderAttachmentValidationCriteria(a,{includeCountCriteria:!1}),ue("div",{class:D.attachmentElementDetailMetadata},ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),ue("span",{class:D.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:a}=e;return ue("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},ue("div",{class:D.attachmentElementDialogPreview},this._renderAttachmentPreviewImageForInput(t,a)))}_setSelectedAttachment(e,t){t?.touch(),this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){const{viewModel:t}=this;t.setSelectedAttachmentAddElementId(e),t.selectedAttachmentAddInput?.touch(),t.selectedAttachmentAddInput?.clearValidationCriteriaState(),this.hideAttachmentDialog()}_setAttachmentListElementId(e){const{viewModel:t}=this;t.setSelectedAttachmentListElementId(e),t.selectedAttachmentListInput?.touch(),this.hideAttachmentDialog()}_getAttachmentLabel(e,a,i,n){return!1!==n&&v(e.name)&&e.name.length>0?e.name:i!==this.messagesCommon.notApplicable?i:t(this.messages.attachments.attachmentNumberedLabel,{index:a+1})}_renderAttachmentCountLimitsLabel(e){const t=this.messages.attachments,a=null!=e.minAttachmentCount&&e.minAttachmentCount>0?this._renderAttachmentCountLimitLabel(t.minAttachmentsShort,e.minAttachmentCount,"min"):null,i=null!=e.maxAttachmentCount?this._renderAttachmentCountLimitLabel(t.maxAttachmentsShort,e.maxAttachmentCount,"max"):null;return a||i?[a,a&&i?ue("span",{key:"attachment-count-limits-separator"},", "):null,i]:null}_renderAttachmentCountLimitLabel(e,a,i){const n="__count__",[s,o]=t(e,{count:n}).split(n);return ue("span",{key:i},s,ue("span",{class:D.attachmentElementEmptyActionHintValue},a),o)}_renderAttachmentValidationCriteria(e,{includeCountCriteria:t}){const a=this._getAttachmentValidationCriteria(e,{includeCountCriteria:t}),i=`attachment-validation-criteria-${e.template.elementId}`;return 0===a.length?null:ue("div",{class:D.attachmentElementValidationCriteria,key:i},a.map(({key:e,message:t,state:a})=>ue("calcite-notice",{appearance:"danger"===a?"outline-fill":"transparent",closable:!1,icon:!0,key:e,kind:a,open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},t))))}_getAttachmentValidationCriteria(e,{includeCountCriteria:a}){const i=[],n=e.validationCriterionStates,s=this.messages.attachments,o=this._getNestableAttachmentInputs(e.input);e.hasUnsupportedFileTypeValidationError&&i.push({key:"unsupported-file-type",message:this._getUnsupportedFileTypeMessage(),state:"danger"});for(const l of o)"document"===l.type&&null!=l.maxFileSize&&i.push({key:"maximum-file-size",message:t(s.maximumFileSize,{maxSize:this._formatAttachmentSizeLimitInMegabytes(l.maxFileSize)}),state:n.get("maximum-file-size")??"info"}),"audio"===l.type&&null!=l.maxDuration&&i.push({key:"maximum-audio-length",message:t(s.maximumAudioLength,{maxDuration:this._formatAttachmentDurationLimit(l.maxDuration)}),state:n.get("maximum-audio-length")??"info"}),"video"===l.type&&null!=l.maxDuration&&i.push({key:"maximum-video-length",message:t(s.maximumVideoLength,{maxDuration:this._formatAttachmentDurationLimit(l.maxDuration)}),state:n.get("maximum-video-length")??"info"}),"image"===l.type&&null!=l.maxImageSize&&i.push({key:"maximum-image-size",message:t(s.attachmentMustBeSmallerThan,{maxSize:`${l.maxImageSize}px`}),state:n.get("maximum-image-size")??"info"});return a&&null!=e.minAttachmentCount&&e.minAttachmentCount>0&&i.push({key:"minimum-number-of-files",message:t(s.minimumNumberOfFiles,{count:e.minAttachmentCount}),state:n.get("minimum-number-of-files")??"info"}),a&&null!=e.maxAttachmentCount&&i.push({key:"maximum-number-of-files",message:t(s.maximumNumberOfFiles,{count:e.maxAttachmentCount}),state:n.get("maximum-number-of-files")??"info"}),i}_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,a=f(e);return t?.[a]||e}_renderAttachmentPreviewThumbnail(e,t,a){const i=a.getAttachmentPreviewUrl(e,64);return i&&y(e)?ue("img",{alt:t,class:D.attachmentElementListItemThumb,src:i}):ue("calcite-icon",{class:D.attachmentElementListItemIcon,icon:_(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const a=t.getAttachmentPreviewUrl(e),i=e.name||this.messagesCommon.details;return a&&y(e)?ue("img",{alt:i,class:D.attachmentElementDetailPreviewImage,src:a,title:i}):[ue("calcite-icon",{class:D.attachmentElementDetailPreviewIcon,icon:_(e.contentType),scale:"l",textLabel:i,title:i}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await Q(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 a=t.input.template.elementId,i=C(t.attachment);let n=!1;try{n=await this.viewModel.stageReplaceAttachment(a,i,e)}finally{n&&this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const a=t.input.template.elementId,i=C(t.attachment);this.viewModel.stageRenameAttachment(a,i,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,a=C(e.attachment);this.viewModel.stageDeleteAttachment(t,a),this._setSelectedAttachment(null)}_disableAttachmentModification(e){return this.disabledOrReadOnly||!e.editable}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return ue("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 ue("div",{class:D.utilityNetworkAssociationsElementInput,"data-testid":t,key:t},this._associationsWidgetsMap.get(e)?.render())}getCommonInputProps(e){const{template:t,valid:a,value:i,minLength:n,maxLength:s,required:o,fieldName:l,editable:r,status: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 i===j&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":a?"false":"true",class:this.classes(D.fieldInput,u?D.inputDisabled:null),status:c,maxLength:s&&s>-1?s:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:l,name:l,max:null!=d?d:void 0,min:null!=m?m:void 0,disabled:h,readOnly:u,onblur:this._onComponentBlur,required:o,placeholder:p,value:g?"":i??"",[ge]:t.elementId,[ve]:l,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()}_handleDragAndDrop(e){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none")}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(ge))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,a=e.querySelector("calcite-radio-button"),i=t||a;i&&this._afterComponentCreateOrUpdate(i)}_onComponentFocus(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._focusedFieldInput=a}_isMultipleChoiceCheckbox(e,t){const a=this._getMultipleChoiceController(t);return"CALCITE-CHECKBOX"===e.tagName&&null!=a?.input}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),a=this._focusedFieldInput;this._attemptFocusOnNextRender&&a===t&&(this._attemptFocusOnNextRender=!1,he(e))}_onComponentBlur(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,a)||a.touch(),this._focusedFieldInput=null}_onDynamicChoiceBlur(e,t){const a=e.currentTarget;if(this._dynamicChoiceItemSelections.delete(t))return;const i=e.relatedTarget;i instanceof Node&&a.contains(i)||(t.endInteraction(),a.inputValue=t.inputValue,this._onComponentBlur(e))}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear()}_parseValue(e,t,a=!1){const i=this._getMultipleChoiceController(t);if(i){const{input:t,values:n}=i;if(t&&n){const t=e;return i.getValueFromCheckboxChange({choiceValue:t.value,isChecked:t.checked,isSelectAllCheckbox:a})}}if(I(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const a of t.domain.codedValues)if(a.name===e.selectedItems[0].textContent)return a.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const n=e.value;return null==n||""===n?null:"number"===t.dataType?"-0"===n||"-0."===n||"-0,"===n?n:parseFloat(n):"date"===t.field.type?parseFloat(n):n}_getMultipleChoiceController(e){return R(e.inputController)?e.inputController:null}_saveInputFromElement(e){const t=this._getFieldInputFromHTMLElement(e);if(!t)return;const a=this._parseValue(e,t);this._saveInput(t,a)}_saveInput(e,t){const{elementId:a}=e.template,i=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?i:t)}t!==i&&(e.touch(),e.isSubtypeField&&"batch"!==s.mode&&k(s.activeLayer,i,t)?this._pendingSubtypeChoice||(this._pendingSubtypeChoice=this._handleSubtypeChoice(e,t)):s.setValue(a,t))}async _handleSubtypeChoice(e,a){const{value:i,template:n}=e,{elementId:s}=n,{messages:o,viewModel:l,messagesCommon:r}=this,{subtypes:c,activeFeatureIndex:d}=l;if(await l.setValue(s,a),!c?.length)return;const m=c.find(e=>e.code===a),u=c.find(e=>e.code===i)?.name??`${i}`;if(!m)return;const h=Promise.withResolvers();l.pendingSubtypeChoice=h;let p="update-fields";const g=[{label:o.subtypes.useDefaultValuesOption,value:"update-fields"},{label:o.subtypes.keepCurrentValuesOption,value:"keep-existing"}],v={context:"info",title:o.subtypes.changeWarningTitle,message:t(o.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 l.applySubtypeDefaults(m),await l.handleSubtypeChanged(d);break;case"keep-existing":await l.handleSubtypeChanged(d);break;case"undo":await this.viewModel.setValue(s,i)}}finally{l.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_afterDateComponentCreateOrUpdate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:a}=e.template,i=e.field.type,n=this._dateComponentMap.get(`${a}`);if(!n)return;const s=e.effectiveTimeZone;let o=e.value===j?void 0:e.value,l=null;"date-only"===i?l=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===i?(o=ne(o),l=ne(t.value)):l="timestamp-offset"===i?null!=t.value?se({dateComponent:n.date,timeComponent:n.time,oldValue:o,timeZoneComponent:n.timeZone,defaultTimeZone:s}):null:null!=t.value?oe({oldValue:o,dateComponent:n.date,timeZone:s,timeComponent:n.time?.value===j?void 0:n.time}):null,o!==l&&(e.touch(),null!==l&&t.value?this.viewModel.setValue(a,l):this.viewModel.setValue(a,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,a=this.viewModel.activeAssociationsInput;if(!t||!a?.feature)return;const{association:i,feature:n}=e;await t({parentFeature:a.feature.plainGraphic,association:i,feature:n})}_onAddAssociation(e){const t=this.callbacks?.addAssociation,a=this.viewModel.activeAssociationsInput;if(!t||!a?.feature)return;const{associationType:i,utilityNetwork:n}=e;t({feature:a.feature.plainGraphic,associationType:i,utilityNetwork:n})}_setFocusableInput(e){const t=e&&U(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 a=M(t);let i;if(e)if(N(e)){const t=e.inputs.find(e=>e.visible);i=t?a.indexOf(t):0}else{let n;if(W(e)&&!e.group.open){n=e.group.inputs.filter(U)[t.length-1]}else n=e;i=a.indexOf(n)+1}else i=0;for(let n=i;n<a.length;n++){const e=a[n];if(e.visible&&U(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 Ce(e){switch(e){case"audio":return _("audio/mpeg");case"video":return _("video/mp4");case"image":return _("image/png");default:return"camera"}}e([u()],_e.prototype,"activeFeatureIndex",null),e([u()],_e.prototype,"attachmentsEnabled",null),e([u()],_e.prototype,"callbacks",null),e([u()],_e.prototype,"disabled",null),e([u()],_e.prototype,"effectiveTitle",null),e([u()],_e.prototype,"effectiveDisabled",null),e([u()],_e.prototype,"disabledOrReadOnly",null),e([u()],_e.prototype,"features",null),e([u()],_e.prototype,"footerButtonInfos",null),e([u()],_e.prototype,"map",null),e([u()],_e.prototype,"maximumFeatureCount",null),e([u()],_e.prototype,"maximumFeatureCountWithComplexForms",null),e([u()],_e.prototype,"spatialReference",null),e([u()],_e.prototype,"layerInfos",null),e([u()],_e.prototype,"timeZone",null),e([u()],_e.prototype,"headingLevel",void 0),e([u()],_e.prototype,"icon",null),e([u(),de("esri/t9n/common")],_e.prototype,"messagesCommon",void 0),e([u(),de("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],_e.prototype,"messages",void 0),e([u(),de("esri/widgets/FeatureForm/t9n/FeatureForm")],_e.prototype,"featureFormMessages",void 0),e([u(),de("esri/widgets/FeatureTable/t9n/FeatureTable")],_e.prototype,"featureTableMessages",void 0),e([u(),de("esri/core/t9n/Units")],_e.prototype,"messagesUnits",void 0),e([u()],_e.prototype,"page",null),e([u()],_e.prototype,"readOnly",null),e([u()],_e.prototype,"showPrompt",null),e([u()],_e.prototype,"clearPrompt",null),e([u()],_e.prototype,"selectedAttachment",null),e([u()],_e.prototype,"selectedAttachmentDetails",null),e([u()],_e.prototype,"valid",null),e([u({type:x}),me(["attachments-change","value-change","values-change","submit"])],_e.prototype,"viewModel",void 0),e([u({type:L,nonNullable:!0})],_e.prototype,"visibleElements",void 0),e([u()],_e.prototype,"groupDisplay",void 0),e([u()],_e.prototype,"_formHeaderVisible",null),e([u()],_e.prototype,"_associationsEnabled",null),e([u()],_e.prototype,"_associationsList",void 0),e([u()],_e.prototype,"_attemptFocusOnNextRender",void 0),e([u()],_e.prototype,"_formId",null),e([u()],_e.prototype,"_focusedFieldInput",void 0),e([u()],_e.prototype,"_pendingSubtypeChoice",void 0),e([u()],_e.prototype,"_relatedRecordsEnabled",null),e([u()],_e.prototype,"_listObserverNode",void 0),e([u()],_e.prototype,"_attachmentDialogInfo",void 0),e([u()],_e.prototype,"_attachmentListFilterText",void 0),e([u()],_e.prototype,"_prompt",void 0),e([u()],_e.prototype,"test",null),_e=e([h("esri.widgets.BatchAttributeForm")],_e);const ye=_e;export{ye as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as a}from"../core/deprecate.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{destroyMaybe as s}from"../core/maybe.js";import o from"../core/ReactiveMap.js";import{watch as l,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,getMessageString 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 T}from"./BatchAttributeForm/interfaceUtils.js";import L from"./BatchAttributeForm/VisibleElements.js";import{isDynamicChoiceController as V,isMultipleChoiceController as R}from"./BatchAttributeForm/inputs/support/controllerUtils.js";import{isGroupInput as N,isFieldInput as U,isTextElementInput as P,isRelationshipElementInput as B,isAttachmentElementInput as $,isUtilityNetworkAssociationsElementInput as z,differentValuesString as j,getNormalizedFieldName as H,isGroupedInput as W}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as G,otherChoiceCheckedPlaceholderValue as Z,canRestoreMultipleChoiceOtherChoiceDraftValue as q}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{loadRelationshipDetailsComponents as K,RelationshipDetails as X}from"./BatchAttributeForm/rendered-content/RelationshipDetails.js";import{Prompt as J}from"./Editor/components/Prompt.js";import{downloadAttachmentInfo as Q}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as Y}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as ee,getIntlOptionsForField as te,prepareISOFieldValueForDateComponents as ae,prepareUnixFieldValueForDateComponents as ie,normalizeTimeOnlyString as ne,getISOFieldValueFromDateComponents as se,getUnixFieldValueFromDateComponents as oe}from"./support/dateUtils.js";import{globalCss as le}from"./support/globalCss.js";import{Heading as re}from"./support/Heading.js";import{calciteListFilterProps as ce}from"./support/listUtils.js";import{messageBundle as de,vmEvent as me,tsx as ue}from"./support/widget.js";import{setFocus as he}from"./support/widgetUtils.js";import{isEmptyValue as pe}from"./support/forms/formUtils.js";const ge="data-element-id",ve="data-field-name",be="esri_BatchAttributeForm_select_all",fe="esri_BatchAttributeForm_other_choice";let _e=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 L,this.groupDisplay="all",this._associationsList=null,this._associationsWidgetsMap=new o,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._dynamicChoiceItemSelections=new WeakSet,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 a=e.input.template.elementId,i=C(e.attachment);this.viewModel.stageRenameAttachment(a,i,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=()=>{a(i.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...a}=e;return a}initialize(){this.addHandles([l(()=>this.features.toArray(),()=>{this._dateComponentMap.clear(),G(this.viewModel,{includeDraftValues:!0})}),l(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),G(this.viewModel),this._setFocusableInput()}),l(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),r(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),l(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),l(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),c(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()}),l(()=>[this._associationsEnabled,this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs],()=>this._setUpAssociationsWidgets(),d),l(()=>this.viewModel.activeAssociationsInput,e=>this._onActiveAssociationsInputChange(e)),l(()=>this.groupDisplay,()=>this._syncGroupInputStates())])}loadDependencies(){return Promise.all([Y({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),autocomplete:()=>import("@esri/calcite-components/dist/components/calcite-autocomplete"),"autocomplete-item":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item"),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")}),K()])}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:a}=this;return t?"replacing-attachment"===a?t.titles.replaceAttachment:"viewing-attachment-details"===a?t.titles.editAttachment:"adding-attachments"===a?t.titles.addAttachments:"viewing-attachments"===a?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:"":""}get effectiveDisabled(){return this.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:a}=this,i=this.effectiveDisabled;if("adding-attachments"===a||"replacing-attachment"===a)return[];if("viewing-attachment-details"===a){const t=this.selectedAttachmentDetails,a=t?.input?.getAttachmentEditState(t.attachment);if(!t?.input||!a)return[];return a.isRenamed||a.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"===a?O({messages:t,purpose:"cancel-viewing-associated-features",onclick:()=>this.goBack()}):"viewing-associated-layers"===a?O({messages:t,purpose:"cancel-viewing-associated-layers",onclick:()=>this.goBack()}):"viewing-attachments"===a||"viewing-related-records"===a?[]:T({disabled:i||!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 ue("div",{class:this.classes(D.base,le.widget,le.panel),ondragover:this._handleDragAndDrop,ondrop:this._handleDragAndDrop},this._renderContent(),this._renderAttachmentDialog(),this._prompt?ue(J,{...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:a}=e.dataset,i=n(this._dateComponentMap,`${a}`,()=>({}));switch(t){case"date":i.date=e;break;case"time":i.time=e;break;case"timeZone":i.timeZone=e}}_renderContent(){const{messages:e,viewModel:a}=this,{status:i}=a;return"failed"===i?a.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:a.maximumFeatureCountWithComplexForms})):a.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:a.maximumFeatureCount})):e.formFailedToLoad:a.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===i&&this.visibleElements.loadingIndicator?ue("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return ue("calcite-notice",{class:D.noticeError,icon:!0,kind:t,open:!0},ue("div",{slot:"message"},e))}_renderForm(){return ue("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:a}=e;let i;if(!e.submitHasBeenAttempted)return null;if(a.invalidHiddenInputs.length>0)if(i=w(a,e.mode,this.messages),"batch"===this.viewModel.mode){const e=a.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?i+=` (${e.map(e=>e.label).join(", ")})`:i=null}else i=null;else if(t)return null;return i?this._renderErrorNotice(i,"danger"):null}_renderDefaultPage(){return[this._renderReadOnlyNotice(),this._renderFormHeader(),this._renderFormContent()]}_renderReadOnlyNotice(){if((this.disabled||this.readOnly)&&this.visibleElements.readOnlyNotice)return ue("calcite-notice",{class:D.disabledNotice,"data-testid":"read-only-notice",icon:"read-only-non-editable",kind:"brand",open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},this.featureFormMessages.disabledForm))}_renderFormHeader(){const{formTitle:e,formDescription:t}=this.viewModel;if(!this._formHeaderVisible)return;const a=e?ue(re,{key:"title",level:this.headingLevel},e):void 0,i=t?ue("p",{class:D.description,key:"description"},t):void 0;return ue("div",{class:D.formHeader},a,i)}_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 N(e)?this._renderGroupInput(e):U(e)?this._renderLabeledField(e):P(e)?this._renderTextComponent(e):B(e)?this._renderRelationshipElementInput(e):$(e)?this._renderAttachmentElementInput(e):z(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:a,open:i}=e,n=t.filter(e=>e.visible),s=e.label??"",o=this._focusedFieldInput?.group===e,l="sequential"===this.groupDisplay;return ue("calcite-block",{class:this.classes(D.group,l?D.groupSequential:null,o?D.groupActive:null,this.disabled?D.inputDisabled:null),collapsible:!0,description:e.description??void 0,expanded:i,heading:s,headingLevel:this.headingLevel,key:`{${a.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:a}=e.template,{label:i,required:n,dataType:s}=e,o=n?t(this.messages.requiredFieldLabel,{name:i}):i;return ue("calcite-label",{"aria-label":o,class:D.label,key:`field--${a}`},ue("div",{class:D.labelTextContent,key:"labelTextContainer"},i,n?ue("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:a}=e;return V(e.inputController)?this._renderDynamicChoiceComponent({input:e,props:t,controller:e.inputController}):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):R(e.inputController)?this._renderMultipleChoiceComponent({input:e,props:t}):"date"===a?this._renderDateComponents(e,t):(t.disabled=this.disabled,t.readOnly=t.readOnly||this.viewModel.updating,"number"===a?this._renderNumberComponent(e,t):this._renderStringComponent(e,t))}_renderAuxiliaryText(e){const{description:t}=e,a=F(e,e.validationMessage,this.messages);return a?ue("calcite-input-message",{icon:!0,status:e.status},a):t?ue("calcite-input-message",{class:D.description,icon:!1,status:e.status},t):null}_renderCodedInputs({input:e,props:t}){const a=e.input?.type??null,i=e.codedValueOptions;switch(a){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:i,props:t});default:return this._renderComboBoxComponent({options:i,props:t,input:e})}}_renderDynamicChoiceComponent({input:e,props:t,controller:a}){const i=a.filteredChoices,n=e.showNoValueLabel||this.messages.empty,s=a.evaluated&&!a.evaluating&&!a.choices.length&&ue("calcite-notice",{appearance:"transparent",kind:"info",open:!0,scale:"s",slot:"content-top",width:"full"},ue("div",{slot:"message"},this.messages.noDynamicChoices)),o=t=>{this._saveInput(e,t)},l=(e,t)=>{this._dynamicChoiceItemSelections.delete(a);const i=e.closest("calcite-autocomplete");if(i){const e=null==t?"":a.getLabel(t);a.filterValue=e,i.inputValue=e}o(t)},r=({currentTarget:t})=>{const i=t.inputValue??"";a.filterValue=i,i||null==e.value||o(null)},c=e.showNoValueOptionEnabled?ue("calcite-autocomplete-item",{heading:n,key:"dynamic-choice-empty",selected:null==e.value,value:"",onCalciteAutocompleteItemSelect:({currentTarget:e})=>l(e,null),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(a)}}):null,d=t=>{const i=e.value===j?this.messages.differentValuesPlaceholder:null==e.value?"":a.inputValue;t.inputValue=i};return ue("calcite-autocomplete",{...t,afterCreate:d,disabled:t.readOnly||t.disabled,loading:a.evaluating,placeholder:null==e.value?n:t.placeholder,value:String(t.value),onblur:e=>this._onDynamicChoiceBlur(e,a),onCalciteAutocompleteBeforeOpen:()=>a.beginInteraction(),onCalciteAutocompleteTextInput:r},s,c,i.map(t=>ue("calcite-autocomplete-item",{heading:t.name,key:`dynamic-choice-${t.code}`,selected:t.code===e.value,value:String(t.code),onCalciteAutocompleteItemSelect:({currentTarget:e})=>l(e,t.code),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(a)}})))}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:a}=this,i=this._getMultipleChoiceController(e);if(!i)return null;const{input:n}=i,s=!0===n.includeSelectAllChoices,{checkboxStatesByValue:o,selectAllState:l}=i.selectionState,r=l.checked?a.deselectAllLabel:a.selectAllLabel,c=i.otherChoiceRenderState,d=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},m=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},u=t=>{const{fieldName:a}=c;a&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:a})},h=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:c.fieldName??void 0})};return ue("div",{class:D.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},s?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:l,selectAllLabel:r,handleSelectAllCheckboxChange:d}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:m}),c.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:s,otherChoiceRenderState:c,handleOtherChoiceCheckboxChange:u,handleOtherChoiceInputChange:h,differentValuesPlaceholder:a.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:a,handleSelectAllCheckboxChange:i}){return ue("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:D.multipleChoiceSelectAll,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:a,labelText:a,value:be,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:a,handleChoiceCheckboxChange:i}){const n=this._getMultipleChoiceController(e);if(!n)return[];const{choices:s}=n;return s.map(e=>{const n=a.get(e.value)??{checked:!1,indeterminate:!1};return ue("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[ge],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})=>i(e),onfocus:t.onfocus})})}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:a,handleOtherChoiceCheckboxChange:i,handleOtherChoiceInputChange:n,differentValuesPlaceholder:s}){const o=a.label??this.messages.otherOptionLabel;return ue("div",{class:this.classes(D.multipleChoiceOtherChoice,t?D.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},ue("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:a.checkboxState.checked,class:e.class,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,indeterminate:a.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:o,labelText:o,value:fe,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus}),a.checkboxState.checked?ue("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":o,class:D.textElementInput,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,key:`${e.key}-other-choice-input`,maxLength:a.maxLength,placeholder:a.value===j?s:a.hint,status:a.status,type:"text",value:a.normalizedValue===j?"":a.normalizedValue?String(a.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:a=!1}){e.touch();const i=this._getMultipleChoiceController(e);if(!i)return;if(i.input&&!a&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const n=e.value,s=this._parseValue(t,e,a);s!==n&&await this.viewModel.setValue(e.template.elementId,s)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:a}){if(!a)return;const i=t.value,n=null==i||""===i?null:i,s=this._getMultipleChoiceController(e);if(!s)return;s.initializeExplicitOtherChoiceCheckedState(),s.stashOtherChoiceDraftValueForFeatures(e.features,n);const o=H(e,a);o&&await this.viewModel.setValueForFieldName(o,n,Array.from(e.features,e=>e.source))}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:a}){const i=this._getMultipleChoiceController(e);if(!i)return;i.setExplicitOtherChoiceCheckedState(t),e.touch(),t||i.setOtherChoiceDraftValuesFromFeatures(e.features.toArray());const n=H(e,a);if(!n)return;const s=new Map;for(const o of e.features){const e=o.getAttribute(a);if(t){if(!pe(e))continue;const t=i.getOtherChoiceDraftValue(o),a=q(t)?t:Z;s.set(o,a);continue}null!=e&&s.set(o,null)}0!==s.size&&await this.viewModel.setValuePerFeatureForFieldName(n,new Map(Array.from(s,([e,t])=>[e.source,t])))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){const a=this._getMultipleChoiceController(e);if(!a)return;const i=new Map(e.features.map(i=>[i,a.getUpdatedValueForFeature({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)===j||e.value===j)&&"batch"===this.viewModel.mode){const a={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,onblur:t.onblur,onfocus:t.onfocus,[ge]:t[ge]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:a,options:[{name:this.messages.differentValuesPlaceholder,value:j,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return ue("calcite-switch",{...t,checked:!!I(e.template,"switch")&&e.value===e.template.input.onValue,class:D.inputSwitch,disabled:t.readOnly||t.disabled,onCalciteSwitchChange:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:a}){const{trigger:i,dropdown:n,group:s}=a;return ue("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInputFromElement(e)},ue("calcite-button",{...i},e===j?this.messages.differentValuesPlaceholder:e),ue("calcite-dropdown-group",{selectionMode:s.mode},t.map(t=>ue("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:a}){const i="INSERT"===this.viewModel.editType&&e.showNoValueOptionEnabled&&!e.touched?()=>{}:a.onblur,n={...a,onblur:i};return ue("calcite-combobox",{...n,clearDisabled:e.isSubtypeField,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:a.placeholder===this.messages.differentValuesPlaceholder?j:String(a.value),onCalciteComboboxChange:({currentTarget:t})=>{t.value!==j&&(e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveInputFromElement(t))}},this.renderComboboxOptionsList({input:e,options:t,props:a}))}renderComboboxOptionsList({input:e,options:t,props:a}){const i=e=>e.map(e=>{const{value:t}=e,i=pe(e.value)?this.messages.empty:e.name;return ue("calcite-combobox-item",{heading:i,key:`#${t}`,selected:a.value===t,value:`${t}`})});let n=[];const{messages:s}=this;t.other.length>0&&n.push(ue("calcite-combobox-item-group",{key:"other",label:s.other},i(t.other))),t.unsupported.length>0&&n.push(ue("calcite-combobox-item-group",{key:"unsupported",label:s.unsupported},i(t.unsupported)));const o=i(t.recommended);n.length>0?n.unshift(ue("calcite-combobox-item-group",{key:"recommended",label:s.recommended},o)):n=o;const l=a.placeholder===this.messages.differentValuesPlaceholder,r=!l&&pe(a.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(ue("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),l&&n.unshift(ue("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:j,selected:!0,value:j})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:a}){const i=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:i})=>this._renderRadioButtons({label:t,value:i,selected:i===e.value,props:a}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,s=pe(e.value);i.unshift(this._renderRadioButtons({label:n,value:t,selected:s,props:a}))}return ue("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:D.inputRadioGroup,"data-field-name":a[ve],disabled:a.readOnly||a.disabled,key:`${a.key}-radio-group`,layout:"vertical",name:`${a.name}-${this.id}`,required:a.required},i,a.placeholder===this.messages.differentValuesPlaceholder?ue("calcite-label",{class:D.placeholderRadio,key:a.label,layout:"inline"},ue("calcite-radio-button",{checked:!0,class:D.inputRadio,disabled:!0,value:a.placeholder}),a.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:a,props:i}){return ue("calcite-label",{class:D.inputRadioLabel,key:i.label,layout:"inline"},ue("calcite-radio-button",{...i,afterCreate:void 0,afterUpdate:void 0,checked:t,class:D.inputRadio,disabled:i.readOnly||i.disabled,name:void 0,value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInputFromElement(e)}}),a)}_renderStringComponent(e,t){const{template:a}=e;return!a.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===a.input?.type?ue("calcite-text-area",{...t,class:this.classes(D.individualElement),resize:"vertical",value:t.value?String(t.value):"",onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteTextAreaInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}}):ue("calcite-input",{...t,class:this.classes(D.individualElement),type:"text",value:t.value?String(t.value):"",onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteInputInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}})}_renderNumberComponent(e,t){const a=g(e.field);return ue("calcite-input-number",{...t,integer:a,step:a?1:"any",type:"number",value:a&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteInputNumberInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}})}_renderReadOnlyComponent(e,t){const a=this.getCommonInputProps(e);return ue("calcite-input",{...a,class:this.classes(D.fieldInput,D.inputDisabled,D.individualElement),readOnly:!0,type:"text",value:String(t??a.value??"")})}_renderDateComponents(e,t){const{field:a}=e;let i;switch(a.type){case"date":i=this._renderDateFieldComponents(e,t);break;case"date-only":i=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":i=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":i=this._renderTimestampOffsetFieldComponents(e,t);break;default:i=this._renderReadOnlyComponent(e,ee(a,t.value,{timeZone:e.effectiveTimeZone,...te(e.template.field)}))}return e.value===j?[i,ue("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:i}_renderDateOnlyFieldComponent(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t,{rawMax:o,rawMin:l}=e.range;return ue("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:a,"data-date-part":"date","data-element-id":t[ge],"data-field-name":t[ve],disabled:i,key:`${n}-date-input`,max:v(o)?o:void 0,min:v(l)?l:void 0,overlayPositioning:"fixed",readOnly:s,topLayerDisabled:this.topLayerDisabled,value:e.value===j?"":e.value?String(e.value):"",onblur:t.onblur,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_renderTimeOnlyFieldComponent(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t;return ue("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:a,"data-date-part":"time","data-element-id":t[ge],"data-field-name":t[ve],disabled:i,key:`${n}-time-input`,overlayPositioning:"fixed",readOnly:s,step:e.timeStep,value:e.value===j?"":e.value?String(e.value):"",onblur:t.onblur,onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:a,disabled:i,key:n,readOnly:s,onblur:o,onfocus:l}=t,{rawMax:r,rawMin:c}=e.range,d=e.effectiveTimeZone,m=ae(r,d),u=ae(c,d),h=ae(e.value===j?"":e.value,d),p=e.includeTimeOffset,g={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:i,[ge]:t[ge],[ve]:t[ve],onblur:o,onfocus:l,overlayPositioning:"fixed",readOnly:s};return ue("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},ue("calcite-input-date-picker",{...g,class:a,"data-date-part":"date",key:`${n}-date-input`,max:m?.date??void 0,min:u?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:h.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),ue("calcite-input-time-picker",{...g,class:a,"data-date-part":"time",key:`${n}-time-input`,step:e.timeStep,value:h.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?ue("calcite-input-time-zone",{...g,class:a,clearable:e.value===j||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,value:h.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:a,disabled:i,key:n,readOnly:s,min:o,max:l}=t,r=e.effectiveTimeZone,c=ie(e.value===j?"":e.value,r),d=ie(l,r),m=ie(o,r),u=e.includeTime,h={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:i,[ge]:t[ge],[ve]:t[ve],onblur:t.onblur,onfocus:t.onfocus,overlayPositioning:"fixed",readOnly:s};return ue("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},ue("calcite-input-date-picker",{...h,class:a,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:m?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?ue("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${n}-time-input`,step:1,value:c.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){return this._relatedRecordsEnabled?ue(X,{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:a,defaultPageAttachments:i,template:{description:n,elementId:s,label:o}}=e,l=t?a:i;return ue("div",{class:D.attachmentElementInput,"data-testid":`attachment-element-${s}`,key:`attachment-element-${s}`},o?ue("div",{class:D.attachmentElementLabel,key:`attachment-element-label-${s}`},o):null,n?ue("div",{class:D.description,key:`attachment-element-description-${s}`},n):null,a.length?this._renderAttachmentList(e,l,{label:o||this.messagesCommon.details,viewAllCount:t?null:a.length}):ue("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 ue("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,a){const{filterEnabled:i,label:n,viewAllCount:s}=a;return ue("calcite-list",{class:D.attachmentElementList,filterEnabled:i,filterPlaceholder:i?this.messages.attachments.searchAttachments:void 0,filterProps:i?ce:void 0,filterText:i?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:i?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=s?this._renderViewAllAttachmentsItem(e,s):null)}_renderAttachmentListItems(e,t){const{elementId:a}=e.template;return t.map((t,i)=>{const n=this._formatAttachmentSize(t.size),s=this._getAttachmentLabel(t,i,n,e.displayFilename),o=s===n?void 0:n,l=C(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=c.isDeleted,m=!d&&(r||c.isRenamed||c.isReplaced);return ue("calcite-list-item",{class:D.attachmentElementListItem,description:o,key:`attachment-item-${l}`,label:s,onCalciteListItemSelect:r||d?void 0:()=>this._setSelectedAttachment({attachmentKey:l,elementId:a})},ue("div",{class:D.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,s,e)),m?ue("span",{class:D.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[ue("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(a,C(t))})]:d?ue("calcite-chip",{label:this.messages.attachments.deleted,scale:"s",slot:"content-end"},this.messages.attachments.deleted):ue("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))})}_renderViewAllAttachmentsItem(e,a){const{elementId:i}=e.template,{viewAll:n}=this.messages.attachments;return ue("calcite-list-item",{class:D.attachmentElementListItem,description:t(this.messages.attachments.count,{count:a}),key:`attachment-item-view-all-${i}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(i)},ue("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,a=this.effectiveDisabled||e.addDisabled,i=this._renderAttachmentCountLimitsLabel(e),n=this._getAttachmentNoticeMessage(e),s=e.hasMinimumAttachmentCountNotMet||e.hasExceededAttachmentLimit?"danger":"info",o=e.canUploadFiles,l=e.isCaptureOnly&&!this.effectiveDisabled&&!n;return ue("div",{class:D.attachmentElementAddActions,key:`attachment-element-add-actions-${t}`},o?ue("calcite-button",{appearance:"outline",disabled:a,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach):null,this._renderAttachmentCaptureButton(e),l?this._renderAttachmentCaptureDisabledNotice(t):null,i?ue("div",{class:D.attachmentElementEmptyActionHint},i):null,!this.effectiveDisabled&&n?ue("calcite-notice",{closable:!1,icon:"danger"===s?"exclamation-mark-circle":"lightbulb",kind:s,open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},n)):null)}_renderAttachmentCaptureButton(e){if(!e.hasCaptureInputs)return null;const t=e.captureMediaType;return ue("calcite-button",{appearance:"outline",disabled:!0,iconStart:Ce(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||e.touched}_getCaptureButtonLabel(e){const{capture:t,recordAudio:a,takePhoto:i,takeVideo:n}=this.messages.attachments;switch(e){case"image":return i||t;case"video":return n||t;case"audio":return a||t;default:return t}}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:a}=e.template;if(e.isCaptureOnly)return this._renderAttachmentCaptureDisabledNotice(a);const i=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,s=this.messages.attachments,o=s.dragAndDropFile,l="upload",r=e=>{this._attachmentFileInputMap.set(a,e)};return ue("div",{class:D.attachmentElementAddPanel,key:`attachment-element-add-panel-${a}`},ue("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(a)},afterUpdate:r,class:D.attachmentElementFileInput,"data-element-id":a,disabled:n,multiple:i,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?Array.from(t.files):[];this._stageAttachmentFiles(a,i),t.value=""}}),ue("div",{class:D.attachmentElementAddDropzone,"data-disabled":n?"true":"false",ondragover:e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),n)return;const t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(a,t)}},ue("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:l,scale:"l"}),ue("div",{class:D.attachmentElementAddDropzoneHeading},s.addFile),ue("div",{class:D.attachmentElementAddDropzoneDetail,title:o},o),ue("calcite-button",{appearance:"transparent",disabled:n,iconStart:"folder-open",kind:"brand",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(a,n)}},s.selectFile)),this._renderAttachmentValidationCriteria(e,{includeCountCriteria:!0}))}_renderAttachmentCaptureDisabledNotice(e){return ue("calcite-notice",{class:D.attachmentElementCaptureNotice,icon:!0,key:`attachment-element-capture-disabled-notice-${e}`,kind:"warning",open:!0,scale:"s"},ue("div",{slot:"message"},this.messages.attachments.captureMethodNotSupported))}async _stageAttachmentFiles(e,t){if(0===t.length)return;const a=this.viewModel.selectedAttachmentAddInput;let i=!0;try{i=(await this.viewModel.stageAddAttachments(e,t)).length>0&&!a?.hasInvalidValidationCriteria&&!a?.hasUnsupportedFileTypeValidationError}finally{i&&this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){const e=this.selectedAttachmentDetails;if(!e)return;if("replacing-attachment"===this.page)return this._renderAttachmentReplacePanel(e);const{attachment:t,input:a}=e,i=C(t),n=!!a.getAttachmentPreviewUrl(t),s=!this._disableAttachmentModification(a)&&a.canUploadFiles,o=a.getAttachmentEditState(t);return ue("div",{class:D.attachmentElementDetail,key:`attachment-detail-panel-${a.template.elementId}-${i}`},ue("div",{class:D.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)),ue("div",{class:D.attachmentElementDetailActions},y(t)?ue("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,ue("calcite-button",{appearance:"outline",disabled:!n||o.isReplaced,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),ue("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})),ue("div",{class:D.attachmentElementDetailMetadata},ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),this._renderFileNameContent(t,a)),ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.size),ue("span",{class:D.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.type),ue("span",{class:D.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderFileNameContent(e,t){if(!t.allowUserRename)return ue("span",{class:D.attachmentElementDetailMetadataValue},e.name);const a=t.getAttachmentEditState(e),{baseName:i,extension:n}=A(e.name),s=this._disableAttachmentModification(t),o=!s&&0===e.name.trim().length;return[ue("div",{class:D.attachmentElementDetailFileNameRow,key:"file-name-row"},ue("calcite-input",{class:D.attachmentElementDetailFileNameInput,disabled:s,scale:"m",status:o?"invalid":"idle",suffixText:n,value:i,onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),ue("calcite-button",{appearance:"transparent",disabled:s||null==a.initialName||!a.isRenamed,iconStart:"reset",kind:"neutral",label:this.messages.footerButtons.reset,scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})),o?ue("calcite-input-message",{icon:!0,key:"file-name-message",status:"invalid"},this.messages.validationErrors.cannotBeNull):null]}_renderAttachmentReplacePanel(e){const{attachment:t,input:a}=e,i=this._disableAttachmentModification(a)||!a.canUploadFiles,n=a.template.elementId;return ue("div",{class:D.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${C(t)}`},ue("input",{accept:a.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:D.attachmentElementFileInput,disabled:i,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?.[0];a&&this._stageSelectedAttachmentReplacement(a),t.value=""}}),ue("div",{class:D.attachmentElementAddDropzone,"data-disabled":i?"true":"false",ondragover:e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),i)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},ue("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),ue("div",{class:D.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),ue("div",{class:D.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),ue("calcite-button",{appearance:"transparent",disabled:i,iconStart:"folder-open",kind:"brand",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),this._renderAttachmentValidationCriteria(a,{includeCountCriteria:!1}),ue("div",{class:D.attachmentElementDetailMetadata},ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),ue("span",{class:D.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:a}=e;return ue("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},ue("div",{class:D.attachmentElementDialogPreview},this._renderAttachmentPreviewImageForInput(t,a)))}_setSelectedAttachment(e,t){t?.touch(),this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){const{viewModel:t}=this;t.setSelectedAttachmentAddElementId(e),t.selectedAttachmentAddInput?.touch(),t.selectedAttachmentAddInput?.clearValidationCriteriaState(),this.hideAttachmentDialog()}_setAttachmentListElementId(e){const{viewModel:t}=this;t.setSelectedAttachmentListElementId(e),t.selectedAttachmentListInput?.touch(),this.hideAttachmentDialog()}_getAttachmentLabel(e,a,i,n){return!1!==n&&v(e.name)&&e.name.length>0?e.name:i!==this.messagesCommon.notApplicable?i:t(this.messages.attachments.attachmentNumberedLabel,{index:a+1})}_renderAttachmentCountLimitsLabel(e){const t=this.messages.attachments,a=null!=e.minAttachmentCount&&e.minAttachmentCount>0?this._renderAttachmentCountLimitLabel(t.minAttachmentsShort,e.minAttachmentCount,"min"):null,i=null!=e.maxAttachmentCount?this._renderAttachmentCountLimitLabel(t.maxAttachmentsShort,e.maxAttachmentCount,"max"):null;return a||i?[a,a&&i?ue("span",{key:"attachment-count-limits-separator"},", "):null,i]:null}_renderAttachmentCountLimitLabel(e,a,i){const n="__count__",[s,o]=t(e,{count:n}).split(n);return ue("span",{key:i},s,ue("span",{class:D.attachmentElementEmptyActionHintValue},a),o)}_renderAttachmentValidationCriteria(e,{includeCountCriteria:t}){const a=this._getAttachmentValidationCriteria(e,{includeCountCriteria:t}),i=`attachment-validation-criteria-${e.template.elementId}`;return 0===a.length?null:ue("div",{class:D.attachmentElementValidationCriteria,key:i},a.map(({key:e,message:t,state:a})=>ue("calcite-notice",{appearance:"danger"===a?"outline-fill":"transparent",closable:!1,icon:!0,key:e,kind:a,open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},t))))}_getAttachmentValidationCriteria(e,{includeCountCriteria:a}){const i=[],n=e.validationCriterionStates,s=this.messages.attachments,o=this._getNestableAttachmentInputs(e.input);e.hasUnsupportedFileTypeValidationError&&i.push({key:"unsupported-file-type",message:this._getUnsupportedFileTypeMessage(),state:"danger"});for(const l of o)"document"===l.type&&null!=l.maxFileSize&&i.push({key:"maximum-file-size",message:t(s.maximumFileSize,{maxSize:this._formatAttachmentSizeLimitInMegabytes(l.maxFileSize)}),state:n.get("maximum-file-size")??"info"}),"audio"===l.type&&null!=l.maxDuration&&i.push({key:"maximum-audio-length",message:t(s.maximumAudioLength,{maxDuration:this._formatAttachmentDurationLimit(l.maxDuration)}),state:n.get("maximum-audio-length")??"info"}),"video"===l.type&&null!=l.maxDuration&&i.push({key:"maximum-video-length",message:t(s.maximumVideoLength,{maxDuration:this._formatAttachmentDurationLimit(l.maxDuration)}),state:n.get("maximum-video-length")??"info"}),"image"===l.type&&null!=l.maxImageSize&&i.push({key:"maximum-image-size",message:t(s.attachmentMustBeSmallerThan,{maxSize:`${l.maxImageSize}px`}),state:n.get("maximum-image-size")??"info"});return a&&null!=e.minAttachmentCount&&e.minAttachmentCount>0&&i.push({key:"minimum-number-of-files",message:t(s.minimumNumberOfFiles,{count:e.minAttachmentCount}),state:n.get("minimum-number-of-files")??"info"}),a&&null!=e.maxAttachmentCount&&i.push({key:"maximum-number-of-files",message:t(s.maximumNumberOfFiles,{count:e.maxAttachmentCount}),state:n.get("maximum-number-of-files")??"info"}),i}_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,a=f(e);return t?.[a]||e}_renderAttachmentPreviewThumbnail(e,t,a){const i=a.getAttachmentPreviewUrl(e,64);return i&&y(e)?ue("img",{alt:t,class:D.attachmentElementListItemThumb,src:i}):ue("calcite-icon",{class:D.attachmentElementListItemIcon,icon:_(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const a=t.getAttachmentPreviewUrl(e),i=e.name||this.messagesCommon.details;return a&&y(e)?ue("img",{alt:i,class:D.attachmentElementDetailPreviewImage,src:a,title:i}):[ue("calcite-icon",{class:D.attachmentElementDetailPreviewIcon,icon:_(e.contentType),scale:"l",textLabel:i,title:i}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await Q(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 a=t.input.template.elementId,i=C(t.attachment);let n=!1;try{n=await this.viewModel.stageReplaceAttachment(a,i,e)}finally{n&&this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const a=t.input.template.elementId,i=C(t.attachment);this.viewModel.stageRenameAttachment(a,i,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,a=C(e.attachment);this.viewModel.stageDeleteAttachment(t,a),this._setSelectedAttachment(null)}_disableAttachmentModification(e){return this.disabledOrReadOnly||!e.editable}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return ue("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 ue("div",{class:D.utilityNetworkAssociationsElementInput,"data-testid":t,key:t},this._associationsWidgetsMap.get(e)?.render())}getCommonInputProps(e){const{template:t,valid:a,value:i,minLength:n,maxLength:s,required:o,fieldName:l,editable:r,status: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 i===j&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":a?"false":"true",class:this.classes(D.fieldInput,u?D.inputDisabled:null),status:c,maxLength:s&&s>-1?s:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:l,name:l,max:null!=d?d:void 0,min:null!=m?m:void 0,disabled:h,readOnly:u,onblur:this._onComponentBlur,required:o,placeholder:p,value:g?"":i??"",[ge]:t.elementId,[ve]:l,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()}_handleDragAndDrop(e){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none")}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(ge))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,a=e.querySelector("calcite-radio-button"),i=t||a;i&&this._afterComponentCreateOrUpdate(i)}_onComponentFocus(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._focusedFieldInput=a}_isMultipleChoiceCheckbox(e,t){const a=this._getMultipleChoiceController(t);return"CALCITE-CHECKBOX"===e.tagName&&null!=a?.input}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),a=this._focusedFieldInput;this._attemptFocusOnNextRender&&a===t&&(this._attemptFocusOnNextRender=!1,he(e))}_onComponentBlur(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,a)||a.touch(),this._focusedFieldInput=null}_onDynamicChoiceBlur(e,t){const a=e.currentTarget;if(this._dynamicChoiceItemSelections.delete(t))return;const i=e.relatedTarget;i instanceof Node&&a.contains(i)||(t.endInteraction(),a.inputValue=t.inputValue,this._onComponentBlur(e))}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear()}_parseValue(e,t,a=!1){const i=this._getMultipleChoiceController(t);if(i){const{input:t,values:n}=i;if(t&&n){const t=e;return i.getValueFromCheckboxChange({choiceValue:t.value,isChecked:t.checked,isSelectAllCheckbox:a})}}if(I(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const a of t.domain.codedValues)if(a.name===e.selectedItems[0].textContent)return a.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const n=e.value;return null==n||""===n?null:"number"===t.dataType?"-0"===n||"-0."===n||"-0,"===n?n:parseFloat(n):"date"===t.field.type?parseFloat(n):n}_getMultipleChoiceController(e){return R(e.inputController)?e.inputController:null}_saveInputFromElement(e){const t=this._getFieldInputFromHTMLElement(e);if(!t)return;const a=this._parseValue(e,t);this._saveInput(t,a)}_saveInput(e,t){const{elementId:a}=e.template,i=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?i:t)}t!==i&&(e.touch(),e.isSubtypeField&&"batch"!==s.mode&&k(s.activeLayer,i,t)?this._pendingSubtypeChoice||(this._pendingSubtypeChoice=this._handleSubtypeChoice(e,t)):s.setValue(a,t))}async _handleSubtypeChoice(e,a){const{value:i,template:n}=e,{elementId:s}=n,{messages:o,viewModel:l,messagesCommon:r}=this,{subtypes:c,activeFeatureIndex:d}=l;if(await l.setValue(s,a),!c?.length)return;const m=c.find(e=>e.code===a),u=c.find(e=>e.code===i)?.name??`${i}`;if(!m)return;const h=Promise.withResolvers();l.pendingSubtypeChoice=h;let p="update-fields";const g=[{label:o.subtypes.useDefaultValuesOption,value:"update-fields"},{label:o.subtypes.keepCurrentValuesOption,value:"keep-existing"}],v={context:"info",title:o.subtypes.changeWarningTitle,message:t(o.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 l.applySubtypeDefaults(m),await l.handleSubtypeChanged(d);break;case"keep-existing":await l.handleSubtypeChanged(d);break;case"undo":await this.viewModel.setValue(s,i)}}finally{l.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_afterDateComponentCreateOrUpdate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:a}=e.template,i=e.field.type,n=this._dateComponentMap.get(`${a}`);if(!n)return;const s=e.effectiveTimeZone;let o=e.value===j?void 0:e.value,l=null;"date-only"===i?l=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===i?(o=ne(o),l=ne(t.value)):l="timestamp-offset"===i?null!=t.value?se({dateComponent:n.date,timeComponent:n.time,oldValue:o,timeZoneComponent:n.timeZone,defaultTimeZone:s}):null:null!=t.value?oe({oldValue:o,dateComponent:n.date,timeZone:s,timeComponent:n.time?.value===j?void 0:n.time}):null,o!==l&&(e.touch(),null!==l&&t.value?this.viewModel.setValue(a,l):this.viewModel.setValue(a,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,a=this.viewModel.activeAssociationsInput;if(!t||!a?.feature)return;const{association:i,feature:n}=e;await t({parentFeature:a.feature.plainGraphic,association:i,feature:n})}_onAddAssociation(e){const t=this.callbacks?.addAssociation,a=this.viewModel.activeAssociationsInput;if(!t||!a?.feature)return;const{associationType:i,utilityNetwork:n}=e;t({feature:a.feature.plainGraphic,associationType:i,utilityNetwork:n})}_setFocusableInput(e){const t=e&&U(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 a=M(t);let i;if(e)if(N(e)){const t=e.inputs.find(e=>e.visible);i=t?a.indexOf(t):0}else{let n;if(W(e)&&!e.group.open){n=e.group.inputs.filter(U)[t.length-1]}else n=e;i=a.indexOf(n)+1}else i=0;for(let n=i;n<a.length;n++){const e=a[n];if(e.visible&&U(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 Ce(e){switch(e){case"audio":return _("audio/mpeg");case"video":return _("video/mp4");case"image":return _("image/png");default:return"camera"}}e([u()],_e.prototype,"activeFeatureIndex",null),e([u()],_e.prototype,"attachmentsEnabled",null),e([u()],_e.prototype,"callbacks",null),e([u()],_e.prototype,"disabled",null),e([u()],_e.prototype,"effectiveTitle",null),e([u()],_e.prototype,"effectiveDisabled",null),e([u()],_e.prototype,"disabledOrReadOnly",null),e([u()],_e.prototype,"features",null),e([u()],_e.prototype,"footerButtonInfos",null),e([u()],_e.prototype,"map",null),e([u()],_e.prototype,"maximumFeatureCount",null),e([u()],_e.prototype,"maximumFeatureCountWithComplexForms",null),e([u()],_e.prototype,"spatialReference",null),e([u()],_e.prototype,"layerInfos",null),e([u()],_e.prototype,"timeZone",null),e([u()],_e.prototype,"headingLevel",void 0),e([u()],_e.prototype,"icon",null),e([u(),de("esri/t9n/common")],_e.prototype,"messagesCommon",void 0),e([u(),de("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],_e.prototype,"messages",void 0),e([u(),de("esri/widgets/FeatureForm/t9n/FeatureForm")],_e.prototype,"featureFormMessages",void 0),e([u(),de("esri/widgets/FeatureTable/t9n/FeatureTable")],_e.prototype,"featureTableMessages",void 0),e([u(),de("esri/core/t9n/Units")],_e.prototype,"messagesUnits",void 0),e([u()],_e.prototype,"page",null),e([u()],_e.prototype,"readOnly",null),e([u()],_e.prototype,"showPrompt",null),e([u()],_e.prototype,"clearPrompt",null),e([u()],_e.prototype,"selectedAttachment",null),e([u()],_e.prototype,"selectedAttachmentDetails",null),e([u()],_e.prototype,"valid",null),e([u({type:x}),me(["attachments-change","value-change","values-change","submit"])],_e.prototype,"viewModel",void 0),e([u({type:L,nonNullable:!0})],_e.prototype,"visibleElements",void 0),e([u()],_e.prototype,"groupDisplay",void 0),e([u()],_e.prototype,"_formHeaderVisible",null),e([u()],_e.prototype,"_associationsEnabled",null),e([u()],_e.prototype,"_associationsList",void 0),e([u()],_e.prototype,"_attemptFocusOnNextRender",void 0),e([u()],_e.prototype,"_formId",null),e([u()],_e.prototype,"_focusedFieldInput",void 0),e([u()],_e.prototype,"_pendingSubtypeChoice",void 0),e([u()],_e.prototype,"_relatedRecordsEnabled",null),e([u()],_e.prototype,"_listObserverNode",void 0),e([u()],_e.prototype,"_attachmentDialogInfo",void 0),e([u()],_e.prototype,"_attachmentListFilterText",void 0),e([u()],_e.prototype,"_prompt",void 0),e([u()],_e.prototype,"test",null),_e=e([h("esri.widgets.BatchAttributeForm")],_e);const ye=_e;export{ye as default};
@@ -10,6 +10,7 @@ export type DirectionalPadViewModelState = "ready" | "disabled" | "moving";
10
10
  /**
11
11
  * Provides the logic for the [DirectionalPad](https://developers.arcgis.com/javascript/latest/references/core/widgets/DirectionalPad/) widget and [component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-directional-pad/).
12
12
  *
13
+ * @deprecated since 5.2. Use the [Directional Pad component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-directional-pad/) instead.
13
14
  * @since 4.29
14
15
  * @see [DirectionalPad](https://developers.arcgis.com/javascript/latest/references/core/widgets/DirectionalPad/) widget - _Deprecated since 4.32. Use the [DirectionalPad component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-directional-pad/) instead._
15
16
  * @see [Directional Pad component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-directional-pad/)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{EventedAccessor as e}from"../../core/Evented.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{directionalPadMoveOnceDuration as n}from"./constants.js";import{css as s}from"./css.js";import{angleToUnitVector as r,toUnitVector as v,vectorToClosestAngle as m}from"./utils.js";import{GoTo as a}from"../support/GoTo.js";let d=class extends(a(e)){constructor(t){super(t),this._initialAngle=void 0,this._movementVector=void 0,this._widgetCenter=void 0,this._anyAngleMovementEnabled=!1,this._movementTimeout=void 0,this._disabled=!1,this._moveOnceDuration=n,this.angle=void 0,this.speed=1,this.view=null,this.beginFollowingPointer=(t,e)=>{if(this.disabled)return;this._widgetCenter=e;const o=this._pointerLocationToVector(t);if(void 0===o)return;const i=this._resolveClosestAngle(t,o);void 0!==i&&(this._emitMove(r(i)),this.angle=i,this._initialAngle=i,this._setMovementTimeout(()=>{void 0===this._widgetCenter&&this._stopMovement()}),document.addEventListener("pointermove",this._onPointerMove,{passive:!0}),document.addEventListener("pointerup",this._onPointerUp,{passive:!0,once:!0}))},this.moveOnce=t=>{const e=r(t);this._emitMove(e),this._setMovementTimeout(this._stopMovement)},this._pointerLocationToVector=t=>{if(void 0===this._widgetCenter)return;const{x:e,y:o}=v(this._widgetCenter,t);return{x:e,y:-o}},this._resolveClosestAngle=(t,e)=>{const o=t.target,i=o?.getAttribute?.("data-angle"),n=o?.classList?.contains(s.compassButton);if(n)return;const r=Number.parseInt(i??"",10);return Number.isNaN(r)?m(e):r},this._onPointerMove=t=>{if(0===t.buttons)return void this._stopMovement();const e=this._pointerLocationToVector(t);if(void 0===e)return;this._setMovementTimeout(void 0);const o=this._resolveClosestAngle(t,e);if(void 0===o)return void this._emitStop();const i=r(o),n=null!=this._initialAngle&&this._initialAngle!==o;this._anyAngleMovementEnabled||=n;const s=this._anyAngleMovementEnabled?e:i;(s.x!==this._movementVector?.x||s.y!==this._movementVector?.y)&&(this.angle=o,this._emitMove(s))},this._onPointerUp=()=>{void 0===this._movementTimeout?this._stopMovement():this._widgetCenter=void 0},this._stopMovement=()=>{this._emitStop(),this._widgetCenter=void 0,this._initialAngle=void 0,this._anyAngleMovementEnabled=!1,document.removeEventListener("pointermove",this._onPointerMove),document.removeEventListener("pointerup",this._stopMovement),this._setMovementTimeout(void 0)},this.on("move-start",()=>this.view?.mapViewNavigation.begin()),this.on("move-direction-change",({vector:{x:t,y:e}})=>this.view?.mapViewNavigation.continuousPanVector({x:t*this.speed,y:e*this.speed})),this.on("move-stop",()=>this.view?.mapViewNavigation.stop())}destroy(){this._stopMovement()}get disabled(){const{view:t,_disabled:e,supported:o}=this;return!1===t?.ready||e||!o}set disabled(t){this._disabled=t}get rotation(){return this.view?.rotation??this._get("rotation")??0}set rotation(t){this.view?this.view.constraints.rotationEnabled&&this.callGoTo({target:{rotation:t},options:{animate:0===t&&void 0}}):this._set("rotation",t)}get supported(){return null==this.view||"2d"===this.view.type}get state(){const{disabled:t,angle:e}=this;return t?"disabled":null!=e?"moving":"ready"}_setMovementTimeout(t){clearTimeout(this._movementTimeout),this._movementTimeout=void 0===t?void 0:setTimeout(()=>{this._movementTimeout=void 0,t()},this._moveOnceDuration)}_emitMove(t){null==this._movementVector&&this._emitMoveStartEvent({vector:t});const e=this._movementVector;this._movementVector=t,this._emitMoveDirectionChangeEvent({vector:t,oldVector:e})}_emitStop(){this.angle=void 0,void 0!==this._movementVector&&(this._emitMoveStopEvent({oldVector:this._movementVector}),this._movementVector=void 0)}_emitMoveStartEvent(t){this.emit("move-start",{...t,type:"move-start"})}_emitMoveDirectionChangeEvent(t){this.emit("move-direction-change",{...t,type:"move-direction-change"})}_emitMoveStopEvent(t){this.emit("move-stop",{...t,type:"move-stop"})}};t([o()],d.prototype,"_initialAngle",void 0),t([o()],d.prototype,"_movementVector",void 0),t([o()],d.prototype,"_widgetCenter",void 0),t([o()],d.prototype,"_anyAngleMovementEnabled",void 0),t([o()],d.prototype,"_movementTimeout",void 0),t([o()],d.prototype,"_disabled",void 0),t([o()],d.prototype,"_moveOnceDuration",void 0),t([o()],d.prototype,"disabled",null),t([o()],d.prototype,"angle",void 0),t([o({type:Number,range:{min:0,max:100}})],d.prototype,"speed",void 0),t([o()],d.prototype,"rotation",null),t([o()],d.prototype,"supported",null),t([o({readOnly:!0})],d.prototype,"state",null),t([o()],d.prototype,"view",void 0),d=t([i("esri.widgets.DirectionalPad.DirectionalPadViewModel")],d);const h=d;export{h as default};
2
+ import{__decorate as t}from"tslib";import{deprecateUnnecessaryViewModel as e}from"../../core/deprecate.js";import{EventedAccessor as o}from"../../core/Evented.js";import i from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{directionalPadMoveOnceDuration as r}from"./constants.js";import{css as v}from"./css.js";import{angleToUnitVector as m,toUnitVector as a,vectorToClosestAngle as d}from"./utils.js";import{GoTo as p}from"../support/GoTo.js";let h=class extends(p(o)){constructor(t){super(t),this._initialAngle=void 0,this._movementVector=void 0,this._widgetCenter=void 0,this._anyAngleMovementEnabled=!1,this._movementTimeout=void 0,this._disabled=!1,this._moveOnceDuration=r,this.angle=void 0,this.speed=1,this.view=null,this.beginFollowingPointer=(t,e)=>{if(this.disabled)return;this._widgetCenter=e;const o=this._pointerLocationToVector(t);if(void 0===o)return;const i=this._resolveClosestAngle(t,o);void 0!==i&&(this._emitMove(m(i)),this.angle=i,this._initialAngle=i,this._setMovementTimeout(()=>{void 0===this._widgetCenter&&this._stopMovement()}),document.addEventListener("pointermove",this._onPointerMove,{passive:!0}),document.addEventListener("pointerup",this._onPointerUp,{passive:!0,once:!0}))},this.moveOnce=t=>{const e=m(t);this._emitMove(e),this._setMovementTimeout(this._stopMovement)},this._pointerLocationToVector=t=>{if(void 0===this._widgetCenter)return;const{x:e,y:o}=a(this._widgetCenter,t);return{x:e,y:-o}},this._resolveClosestAngle=(t,e)=>{const o=t.target,i=o?.getAttribute?.("data-angle"),s=o?.classList?.contains(v.compassButton);if(s)return;const n=Number.parseInt(i??"",10);return Number.isNaN(n)?d(e):n},this._onPointerMove=t=>{if(0===t.buttons)return void this._stopMovement();const e=this._pointerLocationToVector(t);if(void 0===e)return;this._setMovementTimeout(void 0);const o=this._resolveClosestAngle(t,e);if(void 0===o)return void this._emitStop();const i=m(o),s=null!=this._initialAngle&&this._initialAngle!==o;this._anyAngleMovementEnabled||=s;const n=this._anyAngleMovementEnabled?e:i;(n.x!==this._movementVector?.x||n.y!==this._movementVector?.y)&&(this.angle=o,this._emitMove(n))},this._onPointerUp=()=>{void 0===this._movementTimeout?this._stopMovement():this._widgetCenter=void 0},this._stopMovement=()=>{this._emitStop(),this._widgetCenter=void 0,this._initialAngle=void 0,this._anyAngleMovementEnabled=!1,document.removeEventListener("pointermove",this._onPointerMove),document.removeEventListener("pointerup",this._stopMovement),this._setMovementTimeout(void 0)},t?.suppressDeprecationWarning||e(i.getLogger(this),"Directional Pad","arcgis-directional-pad",{version:"5.2"}),this.on("move-start",()=>this.view?.mapViewNavigation.begin()),this.on("move-direction-change",({vector:{x:t,y:e}})=>this.view?.mapViewNavigation.continuousPanVector({x:t*this.speed,y:e*this.speed})),this.on("move-stop",()=>this.view?.mapViewNavigation.stop())}normalizeCtorArgs(t){const{suppressDeprecationWarning:e,...o}=t??{};return o}destroy(){this._stopMovement()}get disabled(){const{view:t,_disabled:e,supported:o}=this;return!1===t?.ready||e||!o}set disabled(t){this._disabled=t}get rotation(){return this.view?.rotation??this._get("rotation")??0}set rotation(t){this.view?this.view.constraints.rotationEnabled&&this.callGoTo({target:{rotation:t},options:{animate:0===t&&void 0}}):this._set("rotation",t)}get supported(){return null==this.view||"2d"===this.view.type}get state(){const{disabled:t,angle:e}=this;return t?"disabled":null!=e?"moving":"ready"}_setMovementTimeout(t){clearTimeout(this._movementTimeout),this._movementTimeout=void 0===t?void 0:setTimeout(()=>{this._movementTimeout=void 0,t()},this._moveOnceDuration)}_emitMove(t){null==this._movementVector&&this._emitMoveStartEvent({vector:t});const e=this._movementVector;this._movementVector=t,this._emitMoveDirectionChangeEvent({vector:t,oldVector:e})}_emitStop(){this.angle=void 0,void 0!==this._movementVector&&(this._emitMoveStopEvent({oldVector:this._movementVector}),this._movementVector=void 0)}_emitMoveStartEvent(t){this.emit("move-start",{...t,type:"move-start"})}_emitMoveDirectionChangeEvent(t){this.emit("move-direction-change",{...t,type:"move-direction-change"})}_emitMoveStopEvent(t){this.emit("move-stop",{...t,type:"move-stop"})}};t([s()],h.prototype,"_initialAngle",void 0),t([s()],h.prototype,"_movementVector",void 0),t([s()],h.prototype,"_widgetCenter",void 0),t([s()],h.prototype,"_anyAngleMovementEnabled",void 0),t([s()],h.prototype,"_movementTimeout",void 0),t([s()],h.prototype,"_disabled",void 0),t([s()],h.prototype,"_moveOnceDuration",void 0),t([s()],h.prototype,"disabled",null),t([s()],h.prototype,"angle",void 0),t([s({type:Number,range:{min:0,max:100}})],h.prototype,"speed",void 0),t([s()],h.prototype,"rotation",null),t([s()],h.prototype,"supported",null),t([s({readOnly:!0})],h.prototype,"state",null),t([s()],h.prototype,"view",void 0),h=t([n("esri.widgets.DirectionalPad.DirectionalPadViewModel")],h);const l=h;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{deprecateWidget as e}from"../core/deprecate.js";import i from"../core/Logger.js";import{watch as o}from"../core/reactiveUtils.js";import{property as n,subclass as s}from"../core/accessorSupport/decorators.js";import r from"./Widget.js";import{canShowNorth as a}from"./Compass/utils.js";import{directionalPadAngles as l,directionalPadArrows as d}from"./DirectionalPad/constants.js";import{css as c}from"./DirectionalPad/css.js";import u from"./DirectionalPad/DirectionalPadViewModel.js";import{findElementCenter as p}from"./DirectionalPad/utils.js";import h from"./DirectionalPad/VisibleElements.js";import{loadCalciteComponents as m}from"./support/componentsUtils.js";import{globalCss as v}from"./support/globalCss.js";import{messageBundle as b,isActivationKey as _,tsx as g}from"./support/widget.js";import{setFocus as w}from"./support/widgetUtils.js";let f=class extends r{constructor(t,o){super(t,o),this._buttonsContainer=null,this._buttons={},this.messages=null,this.visibleElements=new h,this.viewModel=new u,this.visualScale="s",this._rotateIcon=t=>({"--rotation":`rotate(${t}deg)`}),this._afterButtonContainerCreate=t=>{this._buttonsContainer=t,this._buttonsContainer.addEventListener("contextmenu",this._onContextMenu,{capture:!0})},this._afterButtonContainerRemoved=()=>{this._buttonsContainer?.removeEventListener("contextmenu",this._onContextMenu,{capture:!0}),this._buttonsContainer=null},this._afterButtonCreate=(t,e)=>{this._buttons[t]=e},this._afterButtonRemoved=t=>{this._buttons[t]=void 0},this._onContextMenu=t=>t.preventDefault(),this._onButtonPointerDown=t=>{if(null===this._buttonsContainer)return;const e=t.target,i=e?.shadowRoot?.querySelector("button");i?.hasPointerCapture(t.pointerId)&&i.releasePointerCapture(t.pointerId);const o=p(this._buttonsContainer);this.viewModel.beginFollowingPointer(t,o)},this._onKeyDown=(t,{key:e})=>{_(e)&&this.viewModel.moveOnce(t)},this._onSliderInput=({currentTarget:t})=>{"number"==typeof t.value&&(this.viewModel.rotation=t.value)},this._onRotationReset=()=>{this.viewModel.rotation=0},e(i.getLogger(this),"Directional Pad","arcgis-directional-pad",{version:"4.32"})}loadDependencies(){return m({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider")})}initialize(){this.addHandles(o(()=>this.viewModel.angle,()=>{const t=this._buttonsContainer?.contains(document.activeElement);t&&(null==this.viewModel.angle?this.container?.focus():w(this._buttons[this.viewModel.angle]))}))}get disabled(){return this.viewModel.disabled}set disabled(t){this.viewModel.disabled=t}get icon(){return"move"}set icon(t){this._overrideIfSome("icon",t)}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get speed(){return this.viewModel.speed}set speed(t){this.viewModel.speed=t}get _rotationEnabled(){return!this.view?.ready||this.view.constraints.rotationEnabled}render(){const{label:t,disabled:e,viewModel:i}=this,o=this.classes(c.base,v.widget,e?v.disabled:null);return g("div",{"aria-label":t,class:o,tabIndex:-1},i.supported?this._renderContent():this._renderUnsupportedMessage())}_renderUnsupportedMessage(){return g("section",{class:c.error,key:"unsupported"},g("p",null,this.messages.unsupported))}_renderContent(){return[this.visibleElements.directionalButtons?this._renderDirectionalButtons():void 0,this.visibleElements.rotationSlider?this._renderRotation():void 0]}_renderDirectionalButtons(){return g("calcite-action-bar",{expandDisabled:!0,floating:!0,key:"directional-buttons-container",layout:"grid",overflowActionsDisabled:!0},g("calcite-action-group",{afterCreate:this._afterButtonContainerCreate,afterRemoved:this._afterButtonContainerRemoved,class:c.buttonsContainer,dir:"ltr"},l.slice(0,4).map(t=>this._renderButton(t)),this._renderCompass(),l.slice(4).map(t=>this._renderButton(t))))}_renderButton(t){const{label:e,iconName:i}=d[t],o=this.messages[e];return g("calcite-action",{active:this.viewModel.angle===t,afterCreate:e=>this._afterButtonCreate(t,e),afterRemoved:()=>this._afterButtonRemoved(t),alignment:"center",class:c.button,"data-angle":t.toString(),disabled:this.disabled,key:t,scale:this.visualScale,text:o,title:o,onkeydown:this._onKeyDown.bind(void 0,t),onpointerdown:this._onButtonPointerDown},g("calcite-icon",{icon:i,scale:this.visualScale}))}_renderCompass(){const t=this.disabled||a(this.view)?"compass-needle":"arrow-up",e=0===this.viewModel.rotation,i=this.messages.resetHeading;return g("calcite-action",{alignment:"center",class:c.compassButton,disabled:this.disabled||!this._rotationEnabled||e,key:"compass",scale:this.visualScale,styles:this._rotateIcon(this.viewModel.rotation),text:i,title:i,onclick:this._onRotationReset},!e&&g("calcite-icon",{icon:t,scale:this.visualScale}))}_renderRotation(){return g("calcite-action-bar",{expandDisabled:!0,floating:!0,key:"slider-container",layout:"horizontal"},g("calcite-action-group",{class:c.rotationContainer},this.visibleElements.rotationResetButton?this._renderRotationResetButton():null,this._renderRotationSlider()))}_renderRotationResetButton(){const t=this.messages.resetHeading;return g("calcite-action",{alignment:"center",class:c.rotationReset,disabled:this.disabled||!this._rotationEnabled,scale:this.visualScale,text:t,title:t,onclick:this._onRotationReset},g("calcite-icon",{flipRtl:!0,icon:"rotate",scale:this.visualScale}))}_renderRotationSlider(){return g("div",{class:c.rotationSliderContainer},g("calcite-slider",{"aria-label":this.messages.heading,disabled:this.disabled||!this._rotationEnabled,labelHandles:!0,max:360,min:0,required:!0,scale:this.visualScale,value:Math.round(this.viewModel.rotation),onCalciteSliderInput:this._onSliderInput}))}};t([n()],f.prototype,"_buttonsContainer",void 0),t([n()],f.prototype,"_buttons",void 0),t([n()],f.prototype,"disabled",null),t([n()],f.prototype,"icon",null),t([n()],f.prototype,"label",null),t([n(),b("esri/widgets/DirectionalPad/t9n/DirectionalPad")],f.prototype,"messages",void 0),t([n({type:h,nonNullable:!0})],f.prototype,"visibleElements",void 0),t([n()],f.prototype,"view",null),t([n({type:u})],f.prototype,"viewModel",void 0),t([n()],f.prototype,"visualScale",void 0),t([n()],f.prototype,"speed",null),t([n({readOnly:!0})],f.prototype,"_rotationEnabled",null),f=t([s("esri.widgets.DirectionalPad")],f);const C=f;export{C as default};
2
+ import{__decorate as t}from"tslib";import{deprecateWidget as e}from"../core/deprecate.js";import i from"../core/Logger.js";import{watch as o}from"../core/reactiveUtils.js";import{property as n,subclass as s}from"../core/accessorSupport/decorators.js";import r from"./Widget.js";import{canShowNorth as a}from"./Compass/utils.js";import{directionalPadAngles as l,directionalPadArrows as d}from"./DirectionalPad/constants.js";import{css as c}from"./DirectionalPad/css.js";import u from"./DirectionalPad/DirectionalPadViewModel.js";import{findElementCenter as p}from"./DirectionalPad/utils.js";import h from"./DirectionalPad/VisibleElements.js";import{loadCalciteComponents as m}from"./support/componentsUtils.js";import{globalCss as v}from"./support/globalCss.js";import{messageBundle as b,isActivationKey as _,tsx as g}from"./support/widget.js";import{setFocus as w}from"./support/widgetUtils.js";let f=class extends r{constructor(t,o){super(t,o),this._buttonsContainer=null,this._buttons={},this.messages=null,this.visibleElements=new h,this.viewModel=new u({suppressDeprecationWarning:!0}),this.visualScale="s",this._rotateIcon=t=>({"--rotation":`rotate(${t}deg)`}),this._afterButtonContainerCreate=t=>{this._buttonsContainer=t,this._buttonsContainer.addEventListener("contextmenu",this._onContextMenu,{capture:!0})},this._afterButtonContainerRemoved=()=>{this._buttonsContainer?.removeEventListener("contextmenu",this._onContextMenu,{capture:!0}),this._buttonsContainer=null},this._afterButtonCreate=(t,e)=>{this._buttons[t]=e},this._afterButtonRemoved=t=>{this._buttons[t]=void 0},this._onContextMenu=t=>t.preventDefault(),this._onButtonPointerDown=t=>{if(null===this._buttonsContainer)return;const e=t.target,i=e?.shadowRoot?.querySelector("button");i?.hasPointerCapture(t.pointerId)&&i.releasePointerCapture(t.pointerId);const o=p(this._buttonsContainer);this.viewModel.beginFollowingPointer(t,o)},this._onKeyDown=(t,{key:e})=>{_(e)&&this.viewModel.moveOnce(t)},this._onSliderInput=({currentTarget:t})=>{"number"==typeof t.value&&(this.viewModel.rotation=t.value)},this._onRotationReset=()=>{this.viewModel.rotation=0},e(i.getLogger(this),"Directional Pad","arcgis-directional-pad",{version:"4.32"})}loadDependencies(){return m({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider")})}initialize(){this.addHandles(o(()=>this.viewModel.angle,()=>{const t=this._buttonsContainer?.contains(document.activeElement);t&&(null==this.viewModel.angle?this.container?.focus():w(this._buttons[this.viewModel.angle]))}))}get disabled(){return this.viewModel.disabled}set disabled(t){this.viewModel.disabled=t}get icon(){return"move"}set icon(t){this._overrideIfSome("icon",t)}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get speed(){return this.viewModel.speed}set speed(t){this.viewModel.speed=t}get _rotationEnabled(){return!this.view?.ready||this.view.constraints.rotationEnabled}render(){const{label:t,disabled:e,viewModel:i}=this,o=this.classes(c.base,v.widget,e?v.disabled:null);return g("div",{"aria-label":t,class:o,tabIndex:-1},i.supported?this._renderContent():this._renderUnsupportedMessage())}_renderUnsupportedMessage(){return g("section",{class:c.error,key:"unsupported"},g("p",null,this.messages.unsupported))}_renderContent(){return[this.visibleElements.directionalButtons?this._renderDirectionalButtons():void 0,this.visibleElements.rotationSlider?this._renderRotation():void 0]}_renderDirectionalButtons(){return g("calcite-action-bar",{expandDisabled:!0,floating:!0,key:"directional-buttons-container",layout:"grid",overflowActionsDisabled:!0},g("calcite-action-group",{afterCreate:this._afterButtonContainerCreate,afterRemoved:this._afterButtonContainerRemoved,class:c.buttonsContainer,dir:"ltr"},l.slice(0,4).map(t=>this._renderButton(t)),this._renderCompass(),l.slice(4).map(t=>this._renderButton(t))))}_renderButton(t){const{label:e,iconName:i}=d[t],o=this.messages[e];return g("calcite-action",{active:this.viewModel.angle===t,afterCreate:e=>this._afterButtonCreate(t,e),afterRemoved:()=>this._afterButtonRemoved(t),alignment:"center",class:c.button,"data-angle":t.toString(),disabled:this.disabled,key:t,scale:this.visualScale,text:o,title:o,onkeydown:this._onKeyDown.bind(void 0,t),onpointerdown:this._onButtonPointerDown},g("calcite-icon",{icon:i,scale:this.visualScale}))}_renderCompass(){const t=this.disabled||a(this.view)?"compass-needle":"arrow-up",e=0===this.viewModel.rotation,i=this.messages.resetHeading;return g("calcite-action",{alignment:"center",class:c.compassButton,disabled:this.disabled||!this._rotationEnabled||e,key:"compass",scale:this.visualScale,styles:this._rotateIcon(this.viewModel.rotation),text:i,title:i,onclick:this._onRotationReset},!e&&g("calcite-icon",{icon:t,scale:this.visualScale}))}_renderRotation(){return g("calcite-action-bar",{expandDisabled:!0,floating:!0,key:"slider-container",layout:"horizontal"},g("calcite-action-group",{class:c.rotationContainer},this.visibleElements.rotationResetButton?this._renderRotationResetButton():null,this._renderRotationSlider()))}_renderRotationResetButton(){const t=this.messages.resetHeading;return g("calcite-action",{alignment:"center",class:c.rotationReset,disabled:this.disabled||!this._rotationEnabled,scale:this.visualScale,text:t,title:t,onclick:this._onRotationReset},g("calcite-icon",{flipRtl:!0,icon:"rotate",scale:this.visualScale}))}_renderRotationSlider(){return g("div",{class:c.rotationSliderContainer},g("calcite-slider",{"aria-label":this.messages.heading,disabled:this.disabled||!this._rotationEnabled,labelHandles:!0,max:360,min:0,required:!0,scale:this.visualScale,value:Math.round(this.viewModel.rotation),onCalciteSliderInput:this._onSliderInput}))}};t([n()],f.prototype,"_buttonsContainer",void 0),t([n()],f.prototype,"_buttons",void 0),t([n()],f.prototype,"disabled",null),t([n()],f.prototype,"icon",null),t([n()],f.prototype,"label",null),t([n(),b("esri/widgets/DirectionalPad/t9n/DirectionalPad")],f.prototype,"messages",void 0),t([n({type:h,nonNullable:!0})],f.prototype,"visibleElements",void 0),t([n()],f.prototype,"view",null),t([n({type:u})],f.prototype,"viewModel",void 0),t([n()],f.prototype,"visualScale",void 0),t([n()],f.prototype,"speed",null),t([n({readOnly:!0})],f.prototype,"_rotationEnabled",null),f=t([s("esri.widgets.DirectionalPad")],f);const C=f;export{C as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as s}from"../../core/maybe.js";import{watch as a,sync as r}from"../../core/reactiveUtils.js";import{property as o,subclass as l}from"../../core/accessorSupport/decorators.js";import d from"../../layers/GraphicsLayer.js";import{isSceneLayer as n}from"../../layers/support/layerUtils.js";import{updateGraphicSymbolWhenRequired as h,swapForEditingSession as c}from"../../views/draw/support/editingSessionUtils.js";import{highlightsSupported as p}from"../../views/support/layerViewUtils.js";import u from"./UpdateFeatureWorkflowData.js";import{UpdateRecordWorkflow as m,handleKeys as w}from"./UpdateRecordWorkflow.js";import{handleFormValuesChangeEvent as y,getVisualVariableAttributes as k,setUpGeometryUpdate as f,syncUpdateOptions as g,cloneGraphicExceptMesh as _,canCreateInteractiveEditSession as v,isTerminalUpdateEventType as V}from"./workflowUtils.js";import M from"../Sketch/SketchViewModel.js";var S;const b={...w,highlights:Symbol(),sketchGraphics:Symbol(),sketchViewModel:Symbol()};let U=S=class extends m{constructor(e){super(e),this.type="update-feature",this._layerViewEditSession=null,this._sketchGraphicClone=null,this._sketchLayer=null,this._sketchViewModel=null}destroy(){this._layerViewEditSession?.rollback()}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get sketchUpdateOptions(){const{capabilities:e,layer:t}=this.data.editorItem;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!n(t)&&e.supportsTrueCurve}}}get supportsSplitFeatureWorkflow(){return this.data.supportsSplitFeatureWorkflow}get viewGraphic(){return this._sketchViewModel?this._sketchGraphicClone:this.data.edits.feature??this.fullFeature}getUpdating(){return!!this._sketchViewModel?.updating}async commit(){this.removeHandles(b.sketchGraphics);try{const e=this.data.edits.stagedForDelete;await super.commit();const t=this._layerViewEditSession;e?t?.rollback():t?.commit()}catch(e){throw await this._configureSketchViewModel(),new t("editor-workflow:failed-to-commit","An error occurred when sending the updates to the service",{error:e})}}async start(){return await super.start(),await this._initializeSketchViewModel()}_initializeFormViewModel(){super._initializeFormViewModel(),this.addHandles([this._formViewModel.on("values-change",y({filter:e=>e===this.fullFeature,forEachValueChange:(e,t)=>this._layerViewEditSession?.setAttribute(e,t)})),a(()=>this._formViewModel.activeFeature?.sourceLayer,e=>this._sketchGraphicClone.sourceLayer=e)])}_configureHighlight(){const{edits:e,layerView:t}=this.data;p(t)&&this.addHandles(t.highlight(e.feature),b.highlights)}async _configureSketchViewModel(){const{_sketchLayer:e,_sketchViewModel:t}=this;if(!t||!e)return;const{data:i,_formViewModel:s,_sketchGraphicClone:a}=this,{edits:r,viewModel:o}=i,l=r.feature,{view:d}=o,n=k(l),h=await f({feature:l,featureClone:a,visualVariableAttributes:n,sketchLayer:e,sketchViewModel:t,getUpdateOptions:()=>this.sketchUpdateOptions,view:d,onUpdate:({geometry:e,attributes:t},i)=>{r.updateAttributes(t),r.updateGeometry(e);const a=s.activeFeature;if(a&&(a.geometry=e),null!=n.rotation){const{field:e}=n.rotation;this._updatingHandles.consumePromise(s.setFieldValue(e,t[e]))}if(null!=n.size){const{field:e}=n.size;this._updatingHandles.consumePromise(s.setFieldValue(e,t[e]))}("undo"===i.type||"redo"===i.type||"update"===i.type&&null!=i.toolEventInfo&&V(i.toolEventInfo.type))&&a&&s.notifyGeometriesChanged([a])},addUpdatingPromise:e=>{this._updatingHandles.consumePromise(e)},addHandle:e=>{this.addHandles(e,b.sketchGraphics)}});this.addHandles(h,b.sketchGraphics),t.addHandles(h)}async _initializeSketchViewModel(){const{data:e,_sketchGraphicClone:t}=this,{readOnly:o}=e,l=e.edits.feature,{capabilities:n,layer:p}=e.editorItem,u=e.viewModel.view;if(this.removeHandles([b.highlights,b.sketchGraphics,b.sketchViewModel]),!n.update.geometry||o||this.curveUpdatesDisabled)return{enter:async()=>{this.hasHandles(b.highlights)||this._configureHighlight()},exit:()=>this.removeHandles([b.highlights])};const m=new d({elevationInfo:p.elevationInfo,internal:!0,listMode:"hide",title:"updateFeaturesWorkflow-internal"}),w=new M({allowDeleteKey:!1,layer:m,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,cancelUpdateOnClickAway:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:u});return this._sketchLayer=m,this._sketchViewModel=w,u?.map.add(m),await(u?.whenLayerView(m)),this.addHandles([i(()=>{u?.destroyed||u?.map.remove(m),m.destroyed||m.destroy(),this._sketchViewModel=s(w)}),a(()=>this.sketchUpdateOptions,e=>{w.defaultUpdateOptions=e,g(w,e)},r)],b.sketchViewModel),await h(t,"2d"===u?.type?u.scale:null),this.addHandles([await c(m,u,l,t)]),{enter:async()=>{this.hasHandles(b.sketchGraphics)||await this._updatingHandles.addPromise(this._configureSketchViewModel())},exit:()=>this.removeHandles([b.sketchGraphics]),viewModel:w}}_onFullFeatureLoaded(e){super._onFullFeatureLoaded(e);const t=this._sketchGraphicClone=_(e),{edits:i,layerView:s}=this.data;i.updateGeometry(e.geometry),i.trackChanges(),v(s)&&(this._layerViewEditSession=s.createInteractiveEditSession(t))}static async create(e){const t=new S({data:await u.create(e),onCommit:this._onCommitFactory(e.applyEdits,e.applyAttachmentEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}get test(){}};e([o()],U.prototype,"curveResizeDisabled",null),e([o()],U.prototype,"curveUpdatesDisabled",null),e([o()],U.prototype,"sketchUpdateOptions",null),e([o()],U.prototype,"supportsSplitFeatureWorkflow",null),e([o()],U.prototype,"_layerViewEditSession",void 0),e([o()],U.prototype,"_sketchGraphicClone",void 0),e([o()],U.prototype,"_sketchLayer",void 0),e([o()],U.prototype,"_sketchViewModel",void 0),U=S=e([l("esri.widgets.Editor.UpdateFeatureWorkflow")],U);export{U as UpdateFeatureWorkflow,b as handleKeys};
2
+ import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as s}from"../../core/maybe.js";import{watch as a,sync as r}from"../../core/reactiveUtils.js";import{property as o,subclass as l}from"../../core/accessorSupport/decorators.js";import d from"../../layers/GraphicsLayer.js";import{isSceneLayer as n}from"../../layers/support/layerUtils.js";import{updateGraphicSymbolWhenRequired as h,swapForEditingSession as c}from"../../views/draw/support/editingSessionUtils.js";import{highlightsSupported as p}from"../../views/support/layerViewUtils.js";import u from"./UpdateFeatureWorkflowData.js";import{UpdateRecordWorkflow as w,handleKeys as m}from"./UpdateRecordWorkflow.js";import{handleFormValuesChangeEvent as y,getVisualVariableAttributes as k,setUpGeometryUpdate as f,syncUpdateOptions as g,cloneGraphicExceptMesh as _,canCreateInteractiveEditSession as v,isTerminalUpdateEventType as V}from"./workflowUtils.js";import M from"../Sketch/SketchViewModel.js";var S;const b={...m,highlights:Symbol(),sketchGraphics:Symbol(),sketchViewModel:Symbol()};let U=S=class extends w{constructor(e){super(e),this.type="update-feature",this._layerViewEditSession=null,this._sketchGraphicClone=null,this._sketchLayer=null,this._sketchViewModel=null}destroy(){this._layerViewEditSession?.rollback()}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get sketchUpdateOptions(){const{capabilities:e,layer:t}=this.data.editorItem;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!n(t)&&e.supportsTrueCurve}}}get supportsSplitFeatureWorkflow(){return this.data.supportsSplitFeatureWorkflow}get viewGraphic(){return this._sketchViewModel?this._sketchGraphicClone:this.data.edits.feature??this.fullFeature}getUpdating(){return!!this._sketchViewModel?.updating}async commit(){this.removeHandles(b.sketchGraphics);try{const e=this.data.edits.stagedForDelete;await super.commit();const t=this._layerViewEditSession;e?t?.rollback():t?.commit()}catch(e){throw await this._configureSketchViewModel(),new t("editor-workflow:failed-to-commit","An error occurred when sending the updates to the service",{error:e})}}async start(){return await super.start(),await this._initializeSketchViewModel()}_initializeFormViewModel(){super._initializeFormViewModel(),this.addHandles([this._formViewModel.on("values-change",y({filter:e=>e===this.fullFeature,forEachValueChange:(e,t)=>this._layerViewEditSession?.setAttribute(e,t)})),a(()=>this._formViewModel.activeFeature?.sourceLayer,e=>this._sketchGraphicClone.sourceLayer=e)])}_configureHighlight(){const{edits:e,layerView:t}=this.data;p(t)&&this.addHandles(t.highlight(e.feature),b.highlights)}async _configureSketchViewModel(){const{_sketchLayer:e,_sketchViewModel:t}=this;if(!t||!e)return;const{data:i,_formViewModel:s,_sketchGraphicClone:a}=this,{edits:r,viewModel:o}=i,l=r.feature,{view:d}=o,n=k(l),h=await f({feature:l,featureClone:a,visualVariableAttributes:n,sketchLayer:e,sketchViewModel:t,getUpdateOptions:()=>this.sketchUpdateOptions,view:d,onUpdate:({geometry:e,attributes:t},i)=>{r.updateAttributes(t),r.updateGeometry(e);const a=s.activeFeature;if(a&&(a.geometry=e),null!=n.rotation){const{field:e}=n.rotation;this._updatingHandles.consumePromise(s.setFieldValue(e,t[e]))}if(null!=n.size){const{field:e}=n.size;this._updatingHandles.consumePromise(s.setFieldValue(e,t[e]))}("undo"===i.type||"redo"===i.type||"update"===i.type&&null!=i.toolEventInfo&&V(i.toolEventInfo.type))&&a&&s.notifyGeometriesChanged([a])},updatingHandles:this._updatingHandles,addHandle:e=>{this.addHandles(e,b.sketchGraphics)}});this.addHandles(h,b.sketchGraphics),t.addHandles(h)}async _initializeSketchViewModel(){const{data:e,_sketchGraphicClone:t}=this,{readOnly:o}=e,l=e.edits.feature,{capabilities:n,layer:p}=e.editorItem,u=e.viewModel.view;if(this.removeHandles([b.highlights,b.sketchGraphics,b.sketchViewModel]),!n.update.geometry||o||this.curveUpdatesDisabled)return{enter:async()=>{this.hasHandles(b.highlights)||this._configureHighlight()},exit:()=>this.removeHandles([b.highlights])};const w=new d({elevationInfo:p.elevationInfo,internal:!0,listMode:"hide",title:"updateFeaturesWorkflow-internal"}),m=new M({allowDeleteKey:!1,layer:w,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,cancelUpdateOnClickAway:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:u});return this._sketchLayer=w,this._sketchViewModel=m,u?.map.add(w),await(u?.whenLayerView(w)),this.addHandles([i(()=>{u?.destroyed||u?.map.remove(w),w.destroyed||w.destroy(),this._sketchViewModel=s(m)}),a(()=>this.sketchUpdateOptions,e=>{m.defaultUpdateOptions=e,g(m,e)},r)],b.sketchViewModel),await h(t,"2d"===u?.type?u.scale:null),this.addHandles([await c(w,u,l,t)]),{enter:async()=>{this.hasHandles(b.sketchGraphics)||await this._updatingHandles.addPromise(this._configureSketchViewModel())},exit:()=>this.removeHandles([b.sketchGraphics]),viewModel:m}}_onFullFeatureLoaded(e){super._onFullFeatureLoaded(e);const t=this._sketchGraphicClone=_(e),{edits:i,layerView:s}=this.data;i.updateGeometry(e.geometry),i.trackChanges(),v(s)&&(this._layerViewEditSession=s.createInteractiveEditSession(t))}static async create(e){const t=new S({data:await u.create(e),onCommit:this._onCommitFactory(e.applyEdits,e.applyAttachmentEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}get test(){}};e([o()],U.prototype,"curveResizeDisabled",null),e([o()],U.prototype,"curveUpdatesDisabled",null),e([o()],U.prototype,"sketchUpdateOptions",null),e([o()],U.prototype,"supportsSplitFeatureWorkflow",null),e([o()],U.prototype,"_layerViewEditSession",void 0),e([o()],U.prototype,"_sketchGraphicClone",void 0),e([o()],U.prototype,"_sketchLayer",void 0),e([o()],U.prototype,"_sketchViewModel",void 0),U=S=e([l("esri.widgets.Editor.UpdateFeatureWorkflow")],U);export{U as UpdateFeatureWorkflow,b as handleKeys};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{makeHandle as i}from"../../../core/handleUtils.js";import"../../../core/has.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as a,sync as r}from"../../../core/reactiveUtils.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import d from"../../../layers/GraphicsLayer.js";import{isSceneLayer as n}from"../../../layers/support/layerUtils.js";import{updateGraphicSymbolWhenRequired as h,swapForEditingSession as c}from"../../../views/draw/support/editingSessionUtils.js";import{highlightsSupported as p}from"../../../views/support/layerViewUtils.js";import{getVisualVariableAttributes as u,setUpGeometryUpdate as w,isTerminalUpdateEventType as m,syncUpdateOptions as y,cloneGraphicExceptMesh as k,canCreateInteractiveEditSession as f}from"../workflowUtils.js";import g from"./UpdateFeatureWorkflowData.js";import{UpdateRecordWorkflow as _,handleKeys as v}from"./UpdateRecordWorkflow.js";import V from"../../Sketch/SketchViewModel.js";var M;const S={...v,highlights:Symbol(),sketchGraphics:Symbol(),sketchViewModel:Symbol()};let b=M=class extends _{constructor(e){super(e),this.type="update-feature",this._layerViewEditSession=null,this._sketchGraphicClone=null,this._sketchLayer=null,this._sketchViewModel=null}destroy(){this._layerViewEditSession?.rollback()}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get sketchUpdateOptions(){const{capabilities:e,layer:t}=this.data.editorItem;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!n(t)&&e.supportsTrueCurve}}}get supportsSplitFeatureWorkflow(){return this.data.supportsSplitFeatureWorkflow}get viewGraphic(){return this._sketchViewModel?this._sketchGraphicClone:this.data.edits.feature??this.fullFeature}getUpdating(){return!!this._sketchViewModel?.updating}async commit(){this.removeHandles(S.sketchGraphics);try{const e=this.data.edits.stagedForDelete;await super.commit();const t=this._layerViewEditSession;e?t?.rollback():t?.commit()}catch(e){throw await this._configureSketchViewModel(),new t("editor-workflow:failed-to-commit","An error occurred when sending the updates to the service",{error:e})}}async start(){return await super.start(),await this._initializeSketchViewModel()}_initializeFormViewModel(){super._initializeFormViewModel(),this.addHandles([this._formViewModel.on("value-change",e=>{this._layerViewEditSession?.setAttribute(e.fieldName,e.value)}),a(()=>this._formViewModel.feature?.sourceLayer,e=>this._sketchGraphicClone.sourceLayer=e)])}_configureHighlight(){const{edits:e,layerView:t}=this.data;p(t)&&this.addHandles(t.highlight(e.feature),S.highlights)}async _configureSketchViewModel(){const{_sketchLayer:e,_sketchViewModel:t}=this;if(!t||!e)return;const{data:i,_formViewModel:s,_sketchGraphicClone:a}=this,{edits:r,viewModel:o}=i,l=r.feature,{view:d}=o,n=u(l),h=await w({feature:l,featureClone:a,visualVariableAttributes:n,sketchLayer:e,sketchViewModel:t,getUpdateOptions:()=>this.sketchUpdateOptions,view:d,onUpdate:({geometry:e,attributes:t},i)=>{if(r.updateAttributes(t),r.updateGeometry(e),s.feature&&(s.feature.geometry=e),null!=n.rotation){const{field:e}=n.rotation;s.setValue(e,t[e])}if(null!=n.size){const{field:e}=n.size;s.setValue(e,t[e])}("undo"===i.type||"redo"===i.type||"update"===i.type&&null!=i.toolEventInfo&&m(i.toolEventInfo.type))&&s.notifyFeatureGeometryChanged()},addUpdatingPromise:e=>{this._updatingHandles.consumePromise(e)},addHandle:e=>{this.addHandles(e,S.sketchGraphics)}});this.addHandles(h,S.sketchGraphics),t.addHandles(h)}async _initializeSketchViewModel(){const{data:e,_sketchGraphicClone:t}=this,{readOnly:o}=e,l=e.edits.feature,{capabilities:n,layer:p}=e.editorItem,u=e.viewModel.view;if(this.removeHandles([S.highlights,S.sketchGraphics,S.sketchViewModel]),!n.update.geometry||o||this.curveUpdatesDisabled)return{enter:async()=>{this.hasHandles(S.highlights)||this._configureHighlight()},exit:()=>this.removeHandles([S.highlights])};const w=new d({elevationInfo:p.elevationInfo,internal:!0,listMode:"hide",title:"updateFeaturesWorkflow-internal"}),m=new V({allowDeleteKey:!1,layer:w,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,cancelUpdateOnClickAway:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:u});return this._sketchLayer=w,this._sketchViewModel=m,u?.map.add(w),await(u?.whenLayerView(w)),this.addHandles([i(()=>{u?.destroyed||u?.map.remove(w),w.destroyed||w.destroy(),this._sketchViewModel=s(m)}),a(()=>this.sketchUpdateOptions,e=>{m.defaultUpdateOptions=e,y(m,e)},r)],S.sketchViewModel),await h(t,"2d"===u?.type?u.scale:null),this.addHandles([await c(w,u,l,t)]),{enter:async()=>{this.hasHandles(S.sketchGraphics)||await this._updatingHandles.addPromise(this._configureSketchViewModel())},exit:()=>this.removeHandles([S.sketchGraphics]),viewModel:m}}_onFullFeatureLoaded(e){super._onFullFeatureLoaded(e);const t=this._sketchGraphicClone=k(e),{edits:i,layerView:s}=this.data;i.updateGeometry(e.geometry),i.trackChanges(),f(s)&&(this._layerViewEditSession=s.createInteractiveEditSession(t))}static async create(e){const t=new M({data:await g.create(e),onCommit:this._onCommitFactory(e.applyEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}get test(){}};e([o()],b.prototype,"curveResizeDisabled",null),e([o()],b.prototype,"curveUpdatesDisabled",null),e([o()],b.prototype,"sketchUpdateOptions",null),e([o()],b.prototype,"supportsSplitFeatureWorkflow",null),e([o()],b.prototype,"_layerViewEditSession",void 0),e([o()],b.prototype,"_sketchGraphicClone",void 0),e([o()],b.prototype,"_sketchLayer",void 0),e([o()],b.prototype,"_sketchViewModel",void 0),b=M=e([l("esri.widgets.Editor.legacy.UpdateFeatureWorkflow")],b);export{b as UpdateFeatureWorkflow,S as handleKeys};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{makeHandle as i}from"../../../core/handleUtils.js";import"../../../core/has.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as a,sync as r}from"../../../core/reactiveUtils.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import d from"../../../layers/GraphicsLayer.js";import{isSceneLayer as n}from"../../../layers/support/layerUtils.js";import{updateGraphicSymbolWhenRequired as h,swapForEditingSession as c}from"../../../views/draw/support/editingSessionUtils.js";import{highlightsSupported as p}from"../../../views/support/layerViewUtils.js";import{getVisualVariableAttributes as u,setUpGeometryUpdate as w,isTerminalUpdateEventType as y,syncUpdateOptions as m,cloneGraphicExceptMesh as k,canCreateInteractiveEditSession as f}from"../workflowUtils.js";import g from"./UpdateFeatureWorkflowData.js";import{UpdateRecordWorkflow as _,handleKeys as v}from"./UpdateRecordWorkflow.js";import V from"../../Sketch/SketchViewModel.js";var M;const S={...v,highlights:Symbol(),sketchGraphics:Symbol(),sketchViewModel:Symbol()};let b=M=class extends _{constructor(e){super(e),this.type="update-feature",this._layerViewEditSession=null,this._sketchGraphicClone=null,this._sketchLayer=null,this._sketchViewModel=null}destroy(){this._layerViewEditSession?.rollback()}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get sketchUpdateOptions(){const{capabilities:e,layer:t}=this.data.editorItem;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!n(t)&&e.supportsTrueCurve}}}get supportsSplitFeatureWorkflow(){return this.data.supportsSplitFeatureWorkflow}get viewGraphic(){return this._sketchViewModel?this._sketchGraphicClone:this.data.edits.feature??this.fullFeature}getUpdating(){return!!this._sketchViewModel?.updating}async commit(){this.removeHandles(S.sketchGraphics);try{const e=this.data.edits.stagedForDelete;await super.commit();const t=this._layerViewEditSession;e?t?.rollback():t?.commit()}catch(e){throw await this._configureSketchViewModel(),new t("editor-workflow:failed-to-commit","An error occurred when sending the updates to the service",{error:e})}}async start(){return await super.start(),await this._initializeSketchViewModel()}_initializeFormViewModel(){super._initializeFormViewModel(),this.addHandles([this._formViewModel.on("value-change",e=>{this._layerViewEditSession?.setAttribute(e.fieldName,e.value)}),a(()=>this._formViewModel.feature?.sourceLayer,e=>this._sketchGraphicClone.sourceLayer=e)])}_configureHighlight(){const{edits:e,layerView:t}=this.data;p(t)&&this.addHandles(t.highlight(e.feature),S.highlights)}async _configureSketchViewModel(){const{_sketchLayer:e,_sketchViewModel:t}=this;if(!t||!e)return;const{data:i,_formViewModel:s,_sketchGraphicClone:a}=this,{edits:r,viewModel:o}=i,l=r.feature,{view:d}=o,n=u(l),h=await w({feature:l,featureClone:a,visualVariableAttributes:n,sketchLayer:e,sketchViewModel:t,getUpdateOptions:()=>this.sketchUpdateOptions,view:d,onUpdate:({geometry:e,attributes:t},i)=>{if(r.updateAttributes(t),r.updateGeometry(e),s.feature&&(s.feature.geometry=e),null!=n.rotation){const{field:e}=n.rotation;s.setValue(e,t[e])}if(null!=n.size){const{field:e}=n.size;s.setValue(e,t[e])}("undo"===i.type||"redo"===i.type||"update"===i.type&&null!=i.toolEventInfo&&y(i.toolEventInfo.type))&&s.notifyFeatureGeometryChanged()},updatingHandles:this._updatingHandles,addHandle:e=>{this.addHandles(e,S.sketchGraphics)}});this.addHandles(h,S.sketchGraphics),t.addHandles(h)}async _initializeSketchViewModel(){const{data:e,_sketchGraphicClone:t}=this,{readOnly:o}=e,l=e.edits.feature,{capabilities:n,layer:p}=e.editorItem,u=e.viewModel.view;if(this.removeHandles([S.highlights,S.sketchGraphics,S.sketchViewModel]),!n.update.geometry||o||this.curveUpdatesDisabled)return{enter:async()=>{this.hasHandles(S.highlights)||this._configureHighlight()},exit:()=>this.removeHandles([S.highlights])};const w=new d({elevationInfo:p.elevationInfo,internal:!0,listMode:"hide",title:"updateFeaturesWorkflow-internal"}),y=new V({allowDeleteKey:!1,layer:w,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,cancelUpdateOnClickAway:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:u});return this._sketchLayer=w,this._sketchViewModel=y,u?.map.add(w),await(u?.whenLayerView(w)),this.addHandles([i(()=>{u?.destroyed||u?.map.remove(w),w.destroyed||w.destroy(),this._sketchViewModel=s(y)}),a(()=>this.sketchUpdateOptions,e=>{y.defaultUpdateOptions=e,m(y,e)},r)],S.sketchViewModel),await h(t,"2d"===u?.type?u.scale:null),this.addHandles([await c(w,u,l,t)]),{enter:async()=>{this.hasHandles(S.sketchGraphics)||await this._updatingHandles.addPromise(this._configureSketchViewModel())},exit:()=>this.removeHandles([S.sketchGraphics]),viewModel:y}}_onFullFeatureLoaded(e){super._onFullFeatureLoaded(e);const t=this._sketchGraphicClone=k(e),{edits:i,layerView:s}=this.data;i.updateGeometry(e.geometry),i.trackChanges(),f(s)&&(this._layerViewEditSession=s.createInteractiveEditSession(t))}static async create(e){const t=new M({data:await g.create(e),onCommit:this._onCommitFactory(e.applyEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}get test(){}};e([o()],b.prototype,"curveResizeDisabled",null),e([o()],b.prototype,"curveUpdatesDisabled",null),e([o()],b.prototype,"sketchUpdateOptions",null),e([o()],b.prototype,"supportsSplitFeatureWorkflow",null),e([o()],b.prototype,"_layerViewEditSession",void 0),e([o()],b.prototype,"_sketchGraphicClone",void 0),e([o()],b.prototype,"_sketchLayer",void 0),e([o()],b.prototype,"_sketchViewModel",void 0),b=M=e([l("esri.widgets.Editor.legacy.UpdateFeatureWorkflow")],b);export{b as UpdateFeatureWorkflow,S as handleKeys};