@arcgis/core 5.2.0-next.29 → 5.2.0-next.30

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 (131) hide show
  1. package/assets/esri/core/t9n/Units_en.json +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/0af6b87a3d77bb93b893.js +1 -0
  4. package/assets/esri/core/workers/chunks/{7ff37a4f315f7621462b.js → 125edba5c618c6257cb8.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{4ba4fd8fa31169760fee.js → 1282598516cd0e3056b7.js} +3 -3
  6. package/assets/esri/core/workers/chunks/414691f7758c78e2a704.js +1 -0
  7. package/assets/esri/core/workers/chunks/4452fd0c59431904d533.js +1 -0
  8. package/assets/esri/core/workers/chunks/451331f69d21c61ec93b.js +1 -0
  9. package/assets/esri/core/workers/chunks/{11f47a012dd8881e3d55.js → 4e803d12486c8de4c901.js} +23 -23
  10. package/assets/esri/core/workers/chunks/{992a90ecbab931198fd0.js → 4ecc345c3732f7fc130f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/557300ec03bae84d8afc.js +1 -0
  12. package/assets/esri/core/workers/chunks/{b18b6bb85e52b03b85e3.js → 6df54132299b9e8f6dad.js} +18 -18
  13. package/assets/esri/core/workers/chunks/{c6f5688074ae89c37add.js → 7b1678dcf62481469544.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{a90619adff41658f8057.js → 8d21f3d6edbcd7b335d0.js} +1 -1
  15. package/assets/esri/core/workers/chunks/b1a0eb6598309e11337f.js +1 -0
  16. package/assets/esri/core/workers/chunks/bd0829eb79efff5b7223.js +1 -0
  17. package/assets/esri/core/workers/chunks/bee56a6ac99312f03109.js +1 -0
  18. package/assets/esri/core/workers/chunks/c7316fd2bdb7ac9eada3.js +1 -0
  19. package/assets/esri/core/workers/chunks/daf539e9f88fc9e101e4.js +1 -0
  20. package/assets/esri/core/workers/chunks/{9fe71d49c888fd871312.js → e2d500ac1a264d09c857.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{aded4e704e09a28edc8f.js → f63e7b01c70352538b1e.js} +1 -1
  22. package/assets/esri/core/workers/chunks/f71f5778e03f68f27482.js +1 -0
  23. package/assets/esri/core/workers/chunks/fc9664d3282b052ef40f.js +1 -0
  24. package/assets/esri/widgets/Features/t9n/Features_en.json +1 -1
  25. package/assets/esri/widgets/VideoPlayer/t9n/VideoPlayer_en.json +1 -1
  26. package/chunks/CutFillComposition.glsl.js +16 -10
  27. package/chunks/CutFillDepth.glsl.js +1 -14
  28. package/chunks/HUDMaterial.glsl.js +7 -7
  29. package/chunks/Viewshed.glsl.js +3 -3
  30. package/config.js +1 -1
  31. package/core/PooledArray.js +1 -1
  32. package/geometry/support/lineSegment.js +1 -1
  33. package/geometry/support/triangle.js +1 -1
  34. package/kernel.js +1 -1
  35. package/layers/AnnotationFeatureLayer.js +1 -1
  36. package/layers/DimensionFeatureLayer.js +1 -1
  37. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  38. package/layers/knowledgeGraph/nodeMovementUtils.js +1 -1
  39. package/layers/mixins/ArcGISImageService.js +1 -1
  40. package/layers/raster/datasets/pixelReader.js +1 -1
  41. package/layers/support/ExportImageServiceParameters.js +1 -1
  42. package/package.json +1 -1
  43. package/support/revision.js +1 -1
  44. package/views/2d/engine/webgl/mesh/bufcut.js +1 -1
  45. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  46. package/views/2d/engine/webgl/util/AnnotationMatcher.js +1 -1
  47. package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
  48. package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
  49. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  50. package/views/2d/layers/support/annodime/MatcherGeometryOverride.js +1 -1
  51. package/views/2d/layers/support/annodime/annotationGraphic.js +1 -1
  52. package/views/2d/layers/support/annodime/cimAnnotations.js +1 -1
  53. package/views/2d/layers/support/annodime/dimensionSymbols.js +1 -1
  54. package/views/2d/layers/support/annodime/dimensionUtils.js +1 -1
  55. package/views/2d/layers/support/annodime/fields.js +1 -1
  56. package/views/2d/layers/support/annodime/utils.js +1 -1
  57. package/views/2d/layers/support/annodime/virtualFields.js +1 -1
  58. package/views/3d/FocusAreasView.js +1 -1
  59. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  60. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  61. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  62. package/views/3d/support/hitTest.js +1 -1
  63. package/views/3d/webgl/RenderCamera.js +1 -1
  64. package/views/3d/webgl-engine/core/shaderLibrary/util/LocalFromScreenSpace.glsl.js +2 -2
  65. package/views/3d/webgl-engine/core/shaderModules/FloatsDrawUniform.js +2 -0
  66. package/views/3d/webgl-engine/effects/focusArea/{FocusAreaMaskNode.js → FocusAreaMask.js} +1 -1
  67. package/views/3d/webgl-engine/effects/focusArea/{FocusAreaColorNode.js → FocusAreaVisualization.js} +1 -1
  68. package/views/3d/webgl-engine/effects/geometry/{ObjectAndLayerIDRenderNode.js → ObjectAndLayerID.js} +1 -1
  69. package/views/3d/webgl-engine/effects/geometry/{RenderOccludedRenderNode.js → RenderOccluded.js} +1 -1
  70. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  71. package/views/3d/webgl-engine/lib/CutFillComputation.js +2 -0
  72. package/views/3d/webgl-engine/lib/CutFillVisualization.js +2 -0
  73. package/views/3d/webgl-engine/lib/{GaussianSplatRenderNode.js → GaussianSplatRenderer.js} +1 -1
  74. package/views/3d/webgl-engine/lib/GaussianSplatShadows.js +2 -0
  75. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  76. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  77. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  78. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  79. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  80. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  81. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  82. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  83. package/views/3d/webgl-engine/lib/intersectionConstants.js +2 -0
  84. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +2 -0
  85. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +2 -0
  86. package/views/3d/webgl-engine/lib/triangleIntersectionUtils.js +1 -1
  87. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  88. package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
  89. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  90. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  91. package/views/3d/webgl-engine/materials/intersectWithPolygonOffset.js +2 -0
  92. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  93. package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +1 -1
  94. package/views/3d/webgl-engine/shaders/CutFillCompositionTechnique.js +1 -1
  95. package/views/3d/webgl-engine/shaders/CutFillDepth.glsl.js +1 -1
  96. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  97. package/views/3d/webgl-engine/shaders/Viewshed.glsl.js +1 -1
  98. package/views/3d/webgl-engine/shaders/ViewshedTechnique.js +1 -1
  99. package/views/SceneView.js +1 -1
  100. package/views/draw/support/Reshape.js +1 -1
  101. package/views/layers/FeatureLikeLayerView.js +1 -1
  102. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  103. package/views/webgl/ShaderBuilder.js +1 -1
  104. package/widgets/Attachments/support/attachmentUtils.js +1 -1
  105. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  106. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  107. package/widgets/BatchAttributeForm.js +1 -1
  108. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  109. package/widgets/Editor.js +1 -1
  110. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  111. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  112. package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
  113. package/widgets/PanoramicViewer/support/PanoramicTileNode.js +1 -1
  114. package/widgets/PanoramicViewer/utils.js +1 -1
  115. package/widgets/Sketch/support/OperationHandle.js +1 -1
  116. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  117. package/assets/esri/core/workers/chunks/0d3c9112ae07fa4a97d6.js +0 -1
  118. package/assets/esri/core/workers/chunks/1849f72f23b434e6c78d.js +0 -1
  119. package/assets/esri/core/workers/chunks/218e2d8d6cd147c769ce.js +0 -1
  120. package/assets/esri/core/workers/chunks/294f2803aac000c99693.js +0 -1
  121. package/assets/esri/core/workers/chunks/2c15c227d057292d4fa8.js +0 -1
  122. package/assets/esri/core/workers/chunks/38a2f34661563c7c29c1.js +0 -1
  123. package/assets/esri/core/workers/chunks/5468a65698931603656d.js +0 -1
  124. package/assets/esri/core/workers/chunks/780519b60aa674a61a74.js +0 -1
  125. package/assets/esri/core/workers/chunks/88827e23f8938342781c.js +0 -1
  126. package/assets/esri/core/workers/chunks/bfe9c8ab35d9bf7e1035.js +0 -1
  127. package/assets/esri/core/workers/chunks/caf150028aeac91b8d80.js +0 -1
  128. package/assets/esri/core/workers/chunks/e98a8f80023c6023e72c.js +0 -1
  129. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +0 -2
  130. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +0 -2
  131. package/views/3d/webgl-engine/lib/GaussianSplatShadowRenderNode.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 i}from"../core/deprecate.js";import a from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{destroyMaybe as s}from"../core/maybe.js";import l from"../core/ReactiveMap.js";import{watch as o,when as r,on as c,sync as d}from"../core/reactiveUtils.js";import{formatFileSize as m}from"../core/unitFormatUtils.js";import{property as u,subclass as h}from"../core/accessorSupport/decorators.js";import{formatDate as p}from"../intl/date.js";import{isIntegerField as g}from"../layers/support/fieldUtils.js";import{isString as v}from"../support/guards.js";import b from"./Widget.js";import{getAttachmentTypeCategory as f,getCalciteIconForAttachment as _}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as C,isImageAttachment as y,getAttachmentFilenameParts as A}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as w,getVisibleFieldInputValidationErrorMessage as I,isElementTemplateWithInputType as F,subtypeChangeShouldPrompt as k,flattenInputs as M}from"./BatchAttributeForm/batchAttributeFormUtils.js";import x from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as D}from"./BatchAttributeForm/css.js";import{makeViewingEditedAttachmentFooterButtons as S,makeViewingAttachmentFooterButtons as E,makeCancelFooterButton as O,makeDefaultFooterButtons as L}from"./BatchAttributeForm/interfaceUtils.js";import T from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as V,isFieldInput as R,isTextElementInput as N,isRelationshipElementInput as P,isAttachmentElementInput as U,isUtilityNetworkAssociationsElementInput as B,differentValuesString as $,getNormalizedFieldName as z,isGroupedInput as j}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as H,getMultipleChoiceCheckboxState as W,otherChoiceCheckedPlaceholderValue as G,getUpdatedMultipleChoiceValueForFeature as Z,getMultipleChoiceSelectAllState as q,splitMultipleChoiceValue as K,canRestoreMultipleChoiceOtherChoiceDraftValue as X}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{loadRelationshipDetailsComponents as J,RelationshipDetails as Q}from"./BatchAttributeForm/rendered-content/RelationshipDetails.js";import{Prompt as Y}from"./Editor/components/Prompt.js";import{downloadAttachmentInfo as ee}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as te}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as ie,getIntlOptionsForField as ae,prepareISOFieldValueForDateComponents as ne,prepareUnixFieldValueForDateComponents as se,normalizeTimeOnlyString as le,getISOFieldValueFromDateComponents as oe,getUnixFieldValueFromDateComponents as re}from"./support/dateUtils.js";import{globalCss as ce}from"./support/globalCss.js";import{Heading as de}from"./support/Heading.js";import{calciteListFilterProps as me}from"./support/listUtils.js";import{messageBundle as ue,vmEvent as he,tsx as pe}from"./support/widget.js";import{setFocus as ge}from"./support/widgetUtils.js";import{isEmptyValue as ve}from"./support/forms/formUtils.js";const be="data-element-id",fe="data-field-name",_e="esri_BatchAttributeForm_select_all",Ce="esri_BatchAttributeForm_other_choice";let ye=class extends b{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.featureTableMessages=null,this.messagesUnits=null,this.viewModel=new x,this.visibleElements=new T,this.groupDisplay="all",this._associationsList=null,this._associationsWidgetsMap=new l,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._pendingSubtypeChoice=null,this._batchSwitchInputInitialValues=new Map,this._listObserverNode=null,this._listObserver=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.viewModel.activeRelationshipInput?.incrementPage()},{root:window.document}),this._attachmentDialogInfo=null,this._attachmentListFilterText="",this._attachmentFileInputMap=new Map,this._prompt=null,this._selectedAttachmentReplaceFileInput=null,this._afterListObserverCreated=e=>{this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)},this._afterListObserverRemoved=()=>{this._listObserverNode=null},this._maximizeSelectedAttachment=()=>{this._attachmentDialogInfo=this.selectedAttachmentDetails},this._enterAttachmentReplaceView=()=>{const e=this.selectedAttachmentDetails;this._canReplaceSelectedAttachment()&&e&&(e.input.clearValidationCriteriaState(),this.viewModel.setShowingSelectedAttachmentReplacePage(!0))},this._setSelectedAttachmentReplaceFileInput=e=>{this._selectedAttachmentReplaceFileInput=e},this._openSelectedAttachmentReplaceFilePicker=()=>{this._canReplaceSelectedAttachment()&&this._selectedAttachmentReplaceFileInput?.click()},this._resetSelectedAttachmentName=()=>{const e=this.selectedAttachmentDetails;if(!e?.attachment)return;const t=e.input.getAttachmentEditState(e.attachment).initialName;if(null==t)return;const i=e.input.template.elementId,a=C(e.attachment);this.viewModel.stageRenameAttachment(i,a,t)},this._closeAttachmentDialog=()=>{this.hideAttachmentDialog()},this._saveInputFromElement=this._saveInputFromElement.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{i(a.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...i}=e;return i}initialize(){this.addHandles([o(()=>this.features,()=>{this._dateComponentMap.clear(),H(this.viewModel,{includeDraftValues:!0})}),o(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),H(this.viewModel),this._setFocusableInput()}),o(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),r(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),o(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),o(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),c(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()}),o(()=>[this._associationsEnabled,this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs],()=>this._setUpAssociationsWidgets(),d),o(()=>this.viewModel.activeAssociationsInput,e=>this._onActiveAssociationsInputChange(e)),o(()=>this.groupDisplay,()=>this._syncGroupInputStates())])}loadDependencies(){return Promise.all([te({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")}),J()])}destroy(){this._destroyAssociationsWidgets(),this._associationsList=s(this._associationsList),this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get effectiveTitle(){const{features:e,messages:t,page:i}=this;return t?"replacing-attachment"===i?t.titles.replaceAttachment:"viewing-attachment-details"===i?t.titles.editAttachment:"adding-attachments"===i?t.titles.addAttachments:"viewing-attachments"===i?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:"":""}get effectiveDisabled(){return this.disabledOrReadOnly||this.viewModel.updating}get disabledOrReadOnly(){return this.disabled||this.readOnly}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get footerButtonInfos(){if(!this.features.length||!this.messages||!this.messagesCommon)return[];const{messages:e,messagesCommon:t,page:i}=this,a=this.effectiveDisabled;if("adding-attachments"===i||"replacing-attachment"===i)return[];if("viewing-attachment-details"===i){const t=this.selectedAttachmentDetails,i=t?.input?.getAttachmentEditState(t.attachment);if(!t?.input||!i)return[];return i.isRenamed||i.isReplaced?S({doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons,resetOnclick:()=>this._resetSelectedAttachmentChanges(),resetDisabled:this._disableAttachmentModification(t.input)}):E({deleteDisabled:this._disableAttachmentModification(t.input),deleteOnclick:()=>this._deleteSelectedAttachment(),doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons})}return"viewing-associated-features"===i?O({messages:t,purpose:"cancel-viewing-associated-features",onclick:()=>this.goBack()}):"viewing-associated-layers"===i?O({messages:t,purpose:"cancel-viewing-associated-layers",onclick:()=>this.goBack()}):"viewing-attachments"===i||"viewing-related-records"===i?[]:L({disabled:a||!this.valid,formId:this._formId,messages:e,callback:()=>this.submit()})}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get page(){return this.viewModel.page}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get selectedAttachment(){return this.viewModel.selectedAttachment}get selectedAttachmentDetails(){return this.viewModel.selectedAttachmentDetails}get valid(){return this.viewModel.valid}get _formHeaderVisible(){return!("batch"===this.viewModel.mode||!this.viewModel.activeFeature)&&!(!this.viewModel.formDescription&&!this.viewModel.formTitle)}get _associationsEnabled(){const{callbacks:e}=this;return!(!e?.addAssociation&&!e?.editAssociatedFeature)}get _formId(){return`${this.id}-form`}get _relatedRecordsEnabled(){const{callbacks:e}=this;return!(!e||!e.addRelatedRecord&&!e.editRelatedRecord)}async goBack(){return this.viewModel.goBack()}async goHome(){return this.viewModel.goHome()}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._setFocusableInput(e.input),this.scheduleRender()}render(){return pe("div",{class:this.classes(D.base,ce.widget,ce.panel)},this._renderContent(),this._renderAttachmentDialog(),this._prompt?pe(Y,{...this._prompt,headingLevel:this.headingLevel}):void 0)}setActiveAssociationsInput(e){this.viewModel.setActiveAssociationsInput(e)}setActiveAssociationsLayer(e){this.viewModel.setActiveAssociationsLayer(e)}setActiveAssociationType(e){this.viewModel.setActiveAssociationType(e)}submit(){return this.viewModel.submit()}get test(){return{saveInput:this._saveInput.bind(this),pendingSubtypeChoice:this._pendingSubtypeChoice}}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:i}=e.dataset,a=n(this._dateComponentMap,`${i}`,()=>({}));switch(t){case"date":a.date=e;break;case"time":a.time=e;break;case"timeZone":a.timeZone=e}}_renderContent(){const{messages:e,viewModel:i}=this,{status:a}=i;return"failed"===a?i.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:i.maximumFeatureCountWithComplexForms})):i.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:i.maximumFeatureCount})):e.formFailedToLoad:i.expressionEvaluationFailed?this._renderErrorNotice(e.expressionEvaluationFailed):i.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===a&&this.visibleElements.loadingIndicator?pe("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return pe("calcite-notice",{class:D.noticeError,icon:!0,kind:t,open:!0},pe("div",{slot:"message"},e))}_renderForm(){return pe("form",{class:D.form,id:this._formId,inert:!!this._prompt,onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderPage())}_renderPage(){switch(this.page){case"adding-attachments":return this._renderAttachmentAddPage();case"viewing-attachment-details":case"replacing-attachment":return this._renderAttachmentDetailPage();case"viewing-attachments":return this._renderAttachmentListPage();case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewingAssociationsPage();case"viewing-related-categories":case"viewing-related-records":return this._renderRelationshipListPage();default:return this._renderDefaultPage()}}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let a;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(a=w(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?a+=` (${e.map(e=>e.label).join(", ")})`:a=null}else a+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return a?this._renderErrorNotice(a,"danger"):null}_renderDefaultPage(){return[this._renderReadOnlyNotice(),this._renderFormHeader(),this._renderFormContent()]}_renderReadOnlyNotice(){if((this.disabled||this.readOnly)&&this.visibleElements.readOnlyNotice)return pe("calcite-notice",{class:D.disabledNotice,icon:"read-only-non-editable",kind:"brand",open:!0,scale:"s",width:"full"},pe("div",{slot:"message"},this.featureFormMessages.disabledForm))}_renderFormHeader(){const{formTitle:e,formDescription:t}=this.viewModel;if(!this._formHeaderVisible)return;const i=e?pe(de,{key:"title",level:this.headingLevel},e):void 0,a=t?pe("p",{class:D.description,key:"description"},t):void 0;return pe("div",{class:D.formHeader},i,a)}_renderFormContent(){return this.viewModel.hasVisibleInputs?this.viewModel.activeForm.inputs.filter(e=>e.visible).map(e=>this._renderInput(e)):this._renderErrorNotice(this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason])}_renderInput(e){return V(e)?this._renderGroupInput(e):R(e)?this._renderLabeledField(e):N(e)?this._renderTextComponent(e):P(e)?this._renderRelationshipElementInput(e):U(e)?this._renderAttachmentElementInput(e):B(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:a}=e,n=t.filter(e=>e.visible),s=e.label??"",l=this._focusedFieldInput?.group===e,o="sequential"===this.groupDisplay;return pe("calcite-block",{class:this.classes(D.group,o?D.groupSequential:null,l?D.groupActive:null,this.disabled?D.inputDisabled:null),collapsible:!0,description:e.description??void 0,disabled:this.effectiveDisabled,expanded:a,heading:s,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:s,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0},onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:a,required:n,dataType:s}=e,l=n?t(this.messages.requiredFieldLabel,{name:a}):a;return pe("calcite-label",{"aria-label":l,class:D.label,key:`field--${i}`},pe("div",{class:D.labelTextContent,key:"labelTextContainer"},a,n?pe("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==s?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):null!==e.multipleChoiceChoices?this._renderMultipleChoiceComponent({input:e,props:t}):"date"===i?this._renderDateComponents(e,t):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{description:t}=e,i=this._getErrorToDisplay(e),a=i?I(e,i,this.messages):null;return a?pe("calcite-input-message",{icon:!0,status:"invalid"},a):t?pe("calcite-input-message",{class:D.description,icon:!1,status:"idle"},t):null}_renderCodedInputs({input:e,props:t}){const i=e.input?.type??null,a=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:a,props:t});default:return this._renderComboBoxComponent({options:a,props:t,input:e})}}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:i}=this,{multipleChoiceChoices:a,multipleChoiceInput:n,multipleChoiceValues:s}=e;if(!n||!a||!s)return null;const l=!0===n.includeSelectAllChoices,o=new Map;let r=s.length>0,c=!1;for(const b of s){const t=W({input:e,choiceValue:b});o.set(b,t),(t.checked||t.indeterminate)&&(c=!0),t.checked||(r=!1)}const d={checked:r,indeterminate:!r&&c},m=d.checked?i.deselectAllLabel:i.selectAllLabel,u=e.getMultipleChoiceOtherChoiceRenderState(this.messages.otherOptionLabel),h=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},p=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},g=t=>{const{fieldName:i}=u;i&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:i})},v=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:u.fieldName})};return pe("div",{class:D.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},l?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:d,selectAllLabel:m,handleSelectAllCheckboxChange:h}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:p}),u.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:l,otherChoiceRenderState:u,handleOtherChoiceCheckboxChange:g,handleOtherChoiceInputChange:v,differentValuesPlaceholder:i.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:i,handleSelectAllCheckboxChange:a}){return pe("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:D.multipleChoiceSelectAll,"data-element-id":e[be],disabled:e.readOnly||e.disabled,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:i,labelText:i,value:_e,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>a(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:i,handleChoiceCheckboxChange:a}){const{multipleChoiceChoices:n}=e;return n?n.map(e=>{const n=i.get(e.value)??{checked:!1,indeterminate:!1};return pe("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[be],disabled:t.readOnly||t.disabled,indeterminate:n.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>a(e),onfocus:t.onfocus})}):[]}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:i,handleOtherChoiceCheckboxChange:a,handleOtherChoiceInputChange:n,differentValuesPlaceholder:s}){return pe("div",{class:this.classes(D.multipleChoiceOtherChoice,t?D.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},pe("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:i.checkboxState.checked,class:e.class,"data-element-id":e[be],disabled:e.readOnly||e.disabled,indeterminate:i.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:i.label,labelText:i.label,value:Ce,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>a(e),onfocus:e.onfocus}),i.checkboxState.checked?pe("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":i.label,class:D.textElementInput,"data-element-id":e[be],disabled:e.readOnly||e.disabled,key:`${e.key}-other-choice-input`,maxLength:i.maxLength,placeholder:i.value===$?s:i.hint,type:"text",value:i.normalizedValue===$?"":i.normalizedValue?String(i.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:i=!1}){if(this._markFieldInputTouched(e),e.multipleChoiceInput&&!i&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const a=e.value,n=this._parseValue(t,e,i);n!==a&&await this.viewModel.setValue(e.template.elementId,n)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:i}){if(!i)return;const a=t.value,n=null==a||""===a?null:a;e.initializeExplicitMultipleChoiceOtherChoiceCheckedState(),e.stashMultipleChoiceOtherChoiceDraftValueForFeatures(e.features,n);const s=z(e,i);s&&await this.viewModel.setValueForFieldName(s,n,Array.from(e.features,e=>e.source))}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:i}){e.setExplicitMultipleChoiceOtherChoiceCheckedState(t),this._markFieldInputTouched(e),t||e.setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e.features.toArray());const a=z(e,i);if(!a)return;const n=new Map;for(const s of e.features){const a=s.getAttribute(i);if(t){if(!ve(a))continue;const t=e.getMultipleChoiceOtherChoiceDraftValue(s),i=X(t)?t:G;n.set(s,i);continue}null!=a&&n.set(s,null)}0!==n.size&&await this.viewModel.setValuePerFeatureForFieldName(a,new Map(Array.from(n,([e,t])=>[e.source,t])))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){if(!e.multipleChoiceInput||!e.multipleChoiceValues)return;const i=new Map(e.features.map(i=>[i,Z({input:e,choiceValue:t.value,currentValue:i.getAttribute(e.fieldName),isChecked:t.checked})]));0!==i.size&&await this.viewModel.setFieldInputValuePerFeature(e,i)}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===$||e.value===$)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[be]:t[be]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:$,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return pe("calcite-switch",{...t,checked:!!F(e.template,"switch")&&e.value===e.template.input.onValue,class:D.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:a,dropdown:n,group:s}=i;return pe("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onblur:()=>{this._focusedFieldInput=null},onCalciteDropdownSelect:({currentTarget:e})=>this._saveInputFromElement(e),onfocus:this._onComponentFocus},pe("calcite-button",{...a},e===$?this.messages.differentValuesPlaceholder:e),pe("calcite-dropdown-group",{selectionMode:s.mode},t.map(t=>pe("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const a="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),s=a&&e.showNoValueOptionEnabled&&!n?()=>{}:i.onblur,l={...i,onblur:s};return pe("calcite-combobox",{...l,clearDisabled:e.isSubtypeField,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:i.placeholder===this.messages.differentValuesPlaceholder?$:String(i.value),onCalciteComboboxChange:({currentTarget:t})=>{t.value!==$&&(e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveInputFromElement(t))}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const a=e=>e.map(e=>{const{value:t}=e,a=ve(e.value)?this.messages.empty:e.name;return pe("calcite-combobox-item",{heading:a,key:`#${t}`,selected:i.value===t,value:`${t}`})});let n=[];const{messages:s}=this;t.other.length>0&&n.push(pe("calcite-combobox-item-group",{key:"other",label:s.other},a(t.other))),t.unsupported.length>0&&n.push(pe("calcite-combobox-item-group",{key:"unsupported",label:s.unsupported},a(t.unsupported)));const l=a(t.recommended);n.length>0?n.unshift(pe("calcite-combobox-item-group",{key:"recommended",label:s.recommended},l)):n=l;const o=i.placeholder===this.messages.differentValuesPlaceholder,r=!o&&ve(i.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(pe("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),o&&n.unshift(pe("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:$,selected:!0,value:$})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const a=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:a})=>this._renderRadioButtons({label:t,value:a,selected:a===e.value,props:i}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,s=ve(e.value);a.unshift(this._renderRadioButtons({label:n,value:t,selected:s,props:i}))}return pe("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:D.inputRadioGroup,"data-field-name":i[fe],disabled:i.readOnly||i.disabled,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},a,i.placeholder===this.messages.differentValuesPlaceholder?pe("calcite-label",{class:D.placeholderRadio,key:i.label,layout:"inline"},pe("calcite-radio-button",{checked:!0,class:D.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:a}){return pe("calcite-label",{class:D.inputRadioLabel,key:a.label,layout:"inline"},pe("calcite-radio-button",{...a,afterCreate:void 0,afterUpdate:void 0,checked:t,class:D.inputRadio,disabled:a.readOnly||a.disabled,name:a.label,value:e,onblur:()=>{this._focusedFieldInput=null},onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInputFromElement(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?pe("calcite-text-area",{...t,class:this.classes(D.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInputFromElement(e)}):pe("calcite-input",{...t,class:this.classes(D.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderNumberComponent(e,t){const i=g(e.field);return pe("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return pe("calcite-input",{...i,class:this.classes(D.fieldInput,D.inputDisabled,D.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let a;switch(i.type){case"date":a=this._renderDateFieldComponents(e,t);break;case"date-only":a=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":a=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":a=this._renderTimestampOffsetFieldComponents(e,t);break;default:a=this._renderReadOnlyComponent(e,ie(i,t.value,{timeZone:e.effectiveTimeZone,...ae(e.template.field)}))}return e.value===$?[a,pe("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:a}_renderDateOnlyFieldComponent(e,t){const{class:i,disabled:a,key:n,readOnly:s}=t,{rawMax:l,rawMin:o}=e.range;return pe("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[be],"data-field-name":t[fe],key:`${n}-date-input`,max:v(l)?l:void 0,min:v(o)?o:void 0,overlayPositioning:"fixed",readOnly:s||a,topLayerDisabled:this.topLayerDisabled,value:e.value===$?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimeOnlyFieldComponent(e,t){const{class:i,disabled:a,key:n,readOnly:s}=t;return pe("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[be],"data-field-name":t[fe],key:`${n}-time-input`,overlayPositioning:"fixed",readOnly:s||a,value:e.value===$?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,disabled:a,key:n,readOnly:s}=t,{rawMax:l,rawMin:o}=e.range,r=e.effectiveTimeZone,c=ne(l,r),d=ne(o,r),m=ne(e.value===$?"":e.value,r),u=e.includeTimeOffset,h={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:s||a,[be]:t[be],[fe]:t[fe],onfocus:this._onComponentFocus};return pe("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},pe("calcite-input-date-picker",{...h,class:i,"data-date-part":"date",key:`${n}-date-input`,max:c?.date??void 0,min:d?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:m.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),pe("calcite-input-time-picker",{...h,class:i,"data-date-part":"time",key:`${n}-time-input`,value:m.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?pe("calcite-input-time-zone",{...h,class:i,clearable:e.value===$||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,value:m.timeZoneOffset||"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,disabled:a,key:n,readOnly:s,min:l,max:o}=t,r=e.effectiveTimeZone,c=se(e.value===$?"":e.value,r),d=se(o,r),m=se(l,r),u=e.includeTime,h={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:s||a,[be]:t[be],[fe]:t[fe],onfocus:this._onComponentFocus};return pe("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},pe("calcite-input-date-picker",{...h,class:i,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:m?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?pe("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${n}-time-input`,step:1,value:c.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){return this._relatedRecordsEnabled?pe(Q,{afterObserverCreated:this._afterListObserverCreated,afterObserverRemoved:this._afterListObserverRemoved,input:e,messages:this.messages,messagesCommon:this.messagesCommon,viewModel:this.viewModel}):null}_renderRelationshipListPage(){const{activeRelationshipInput:e}=this.viewModel;if(e)return this._renderRelationshipElementInput(e)}_renderAttachmentElementInput(e){if(!this.attachmentsEnabled)return;const{allAttachmentsVisibleOnDefaultPage:t,attachments:i,defaultPageAttachments:a,template:{description:n,elementId:s,label:l}}=e,o=t?i:a;return pe("div",{class:D.attachmentElementInput,"data-testid":`attachment-element-${s}`,key:`attachment-element-${s}`},l?pe("div",{class:D.attachmentElementLabel,key:`attachment-element-label-${s}`},l):null,n?pe("div",{class:D.description,key:`attachment-element-description-${s}`},n):null,i.length?this._renderAttachmentList(e,o,{label:l||this.messagesCommon.details,viewAllCount:t?null:i.length}):pe("div",{class:D.attachmentElementEmptyState,key:`attachment-element-empty-state-${s}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){const e=this.viewModel.selectedAttachmentListInput;if(e)return pe("div",{class:D.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,i){const{filterEnabled:a,label:n,viewAllCount:s}=i;return pe("calcite-list",{class:D.attachmentElementList,filterEnabled:a,filterPlaceholder:a?this.messages.attachments.searchAttachments:void 0,filterProps:a?me:void 0,filterText:a?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:a?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=s?this._renderViewAllAttachmentsItem(e,s):null)}_renderAttachmentListItems(e,t){const{elementId:i}=e.template;return t.map((t,a)=>{const n=this._formatAttachmentSize(t.size),s=this._getAttachmentLabel(t,a,n,e.displayFilename),l=s===n?void 0:n,o=C(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=c.isDeleted,m=!d&&(r||c.isRenamed||c.isReplaced);return pe("calcite-list-item",{class:D.attachmentElementListItem,description:l,key:`attachment-item-${o}`,label:s,onCalciteListItemSelect:r||d?void 0:()=>this._setSelectedAttachment({attachmentKey:o,elementId:i})},pe("div",{class:D.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,s,e)),m?pe("span",{class:D.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[pe("calcite-action",{disabled:this._disableAttachmentModification(e),icon:"x",scale:"s",slot:"actions-end",text:this.messagesCommon.delete,title:this.messagesCommon.delete,onclick:()=>this.viewModel.stageDeleteAttachment(i,C(t))})]:d?pe("calcite-chip",{label:this.messages.attachments.deleted,scale:"s",slot:"content-end"},this.messages.attachments.deleted):pe("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))})}_renderViewAllAttachmentsItem(e,i){const{elementId:a}=e.template,{viewAll:n}=this.messages.attachments;return pe("calcite-list-item",{class:D.attachmentElementListItem,description:t(this.messages.attachments.count,{count:i}),key:`attachment-item-view-all-${a}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(a)},pe("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,i=this.effectiveDisabled||e.addDisabled,a=this._renderAttachmentCountLimitsLabel(e),n=this._getAttachmentNoticeMessage(e),s=e.hasMinimumAttachmentCountNotMet||e.hasExceededAttachmentLimit?"danger":"info",l=e.canUploadFiles,o=e.isCaptureOnly&&!this.effectiveDisabled&&!n;return pe("div",{class:D.attachmentElementAddActions,key:`attachment-element-add-actions-${t}`},l?pe("calcite-button",{appearance:"outline",disabled:i,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach):null,this._renderAttachmentCaptureButton(e),o?this._renderAttachmentCaptureDisabledNotice(t):null,a?pe("div",{class:D.attachmentElementEmptyActionHint},a):null,!this.effectiveDisabled&&n?pe("calcite-notice",{closable:!1,icon:"danger"===s?"exclamation-mark-circle":"lightbulb",kind:s,open:!0,scale:"s",width:"full"},pe("div",{slot:"message"},n)):null)}_renderAttachmentCaptureButton(e){if(!e.hasCaptureInputs)return null;const t=e.captureMediaType;return pe("calcite-button",{appearance:"outline",disabled:!0,iconStart:Ae(t),kind:"neutral",round:!0,scale:"s"},this._getCaptureButtonLabel(t))}_getAttachmentNoticeMessage(e){const t=this.messages.attachments;return e.hasUnsupportedFileTypeValidationError?this._getUnsupportedFileTypeMessage():e.hasMinimumAttachmentCountNotMet&&this._shouldShowMinimumAttachmentNotice(e)?t.minimumNotMet:e.hasExceededAttachmentLimit?t.attachmentLimitExceeded:e.hasReachedAttachmentLimit?t.attachmentLimitReached:null}_shouldShowMinimumAttachmentNotice(e){return e.hasAttachmentChanges||this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId)}_getCaptureButtonLabel(e){const{capture:t,recordAudio:i,takePhoto:a,takeVideo:n}=this.messages.attachments;switch(e){case"image":return a||t;case"video":return n||t;case"audio":return i||t;default:return t}}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:i}=e.template;if(e.isCaptureOnly)return this._renderAttachmentCaptureDisabledNotice(i);const a=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,s=this.messages.attachments,l=s.dragAndDropFile,o="upload",r=e=>{this._attachmentFileInputMap.set(i,e)};return pe("div",{class:D.attachmentElementAddPanel,key:`attachment-element-add-panel-${i}`},pe("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(i)},afterUpdate:r,class:D.attachmentElementFileInput,"data-element-id":i,disabled:n,multiple:a,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?Array.from(t.files):[];this._stageAttachmentFiles(i,a),t.value=""}}),pe("div",{class:D.attachmentElementAddDropzone,"data-disabled":n?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),n)return;const t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(i,t)}},pe("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:o,scale:"l"}),pe("div",{class:D.attachmentElementAddDropzoneHeading},s.addFile),pe("div",{class:D.attachmentElementAddDropzoneDetail,title:l},l),pe("calcite-button",{appearance:"transparent",disabled:n,iconStart:"folder-open",kind:"brand",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(i,n)}},s.selectFile)),this._renderAttachmentValidationCriteria(e,{includeCountCriteria:!0}))}_renderAttachmentCaptureDisabledNotice(e){return pe("calcite-notice",{class:D.attachmentElementCaptureNotice,icon:!0,key:`attachment-element-capture-disabled-notice-${e}`,kind:"warning",open:!0,scale:"s"},pe("div",{slot:"message"},this.messages.attachments.captureMethodNotSupported))}async _stageAttachmentFiles(e,t){if(0===t.length)return;const i=this.viewModel.selectedAttachmentAddInput;let a=!0;try{a=(await this.viewModel.stageAddAttachments(e,t)).length>0&&!i?.hasInvalidValidationCriteria&&!i?.hasUnsupportedFileTypeValidationError}finally{a&&this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){const e=this.selectedAttachmentDetails;if(!e)return;if("replacing-attachment"===this.page)return this._renderAttachmentReplacePanel(e);const{attachment:t,input:i}=e,a=C(t),n=!!i.getAttachmentPreviewUrl(t),s=!this._disableAttachmentModification(i)&&i.canUploadFiles;return pe("div",{class:D.attachmentElementDetail,key:`attachment-detail-panel-${i.template.elementId}-${a}`},pe("div",{class:D.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,i)),pe("div",{class:D.attachmentElementDetailActions},y(t)?pe("calcite-button",{appearance:"outline",disabled:!n,iconStart:"expand",kind:"neutral",label:this.messages.attachments.maximize,scale:"m",title:this.messages.attachments.maximize,onclick:this._maximizeSelectedAttachment}):null,pe("calcite-button",{appearance:"outline",disabled:!n,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),pe("calcite-button",{appearance:"outline",disabled:!s,iconStart:"upload-to",kind:"neutral",label:this.messages.attachments.replace,scale:"m",title:this.messages.attachments.replace,onclick:this._enterAttachmentReplaceView})),pe("div",{class:D.attachmentElementDetailMetadata},pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),this._renderFileNameContent(t,i)),pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.size),pe("span",{class:D.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.type),pe("span",{class:D.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderFileNameContent(e,t){if(!t.allowUserRename)return pe("span",{class:D.attachmentElementDetailMetadataValue},e.name);const i=t.getAttachmentEditState(e),{baseName:a,extension:n}=A(e.name),s=this._disableAttachmentModification(t),l=!s&&0===e.name.trim().length;return[pe("div",{class:D.attachmentElementDetailFileNameRow,key:"file-name-row"},pe("calcite-input",{class:D.attachmentElementDetailFileNameInput,disabled:s,scale:"m",status:l?"invalid":"idle",suffixText:n,value:a,onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),pe("calcite-button",{appearance:"transparent",disabled:s||null==i.initialName||!i.isRenamed,iconStart:"reset",kind:"neutral",label:this.messages.footerButtons.reset,scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})),l?pe("calcite-input-message",{icon:!0,key:"file-name-message",status:"invalid"},this.messages.validationErrors.cannotBeNull):null]}_renderAttachmentReplacePanel(e){const{attachment:t,input:i}=e,a=this._disableAttachmentModification(i)||!i.canUploadFiles,n=i.template.elementId;return pe("div",{class:D.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${C(t)}`},pe("input",{accept:i.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:D.attachmentElementFileInput,disabled:a,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?.[0];i&&this._stageSelectedAttachmentReplacement(i),t.value=""}}),pe("div",{class:D.attachmentElementAddDropzone,"data-disabled":a?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),a)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},pe("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),pe("div",{class:D.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),pe("div",{class:D.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),pe("calcite-button",{appearance:"transparent",disabled:a,iconStart:"folder-open",kind:"brand",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),this._renderAttachmentValidationCriteria(i,{includeCountCriteria:!1}),pe("div",{class:D.attachmentElementDetailMetadata},pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),pe("span",{class:D.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:i}=e;return pe("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},pe("div",{class:D.attachmentElementDialogPreview},this._renderAttachmentPreviewImageForInput(t,i)))}_setSelectedAttachment(e){e?.elementId&&this._touchedInputs.add(e.elementId),this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){e&&this._touchedInputs.add(e),this.viewModel.setSelectedAttachmentAddElementId(e),this.viewModel.selectedAttachmentAddInput?.clearValidationCriteriaState(),this.hideAttachmentDialog()}_setAttachmentListElementId(e){e&&this._touchedInputs.add(e),this.viewModel.setSelectedAttachmentListElementId(e),this.hideAttachmentDialog()}_getAttachmentLabel(e,i,a,n){return!1!==n&&v(e.name)&&e.name.length>0?e.name:a!==this.messagesCommon.notApplicable?a:t(this.messages.attachments.attachmentNumberedLabel,{index:i+1})}_renderAttachmentCountLimitsLabel(e){const t=this.messages.attachments,i=null!=e.minAttachmentCount&&e.minAttachmentCount>0?this._renderAttachmentCountLimitLabel(t.minAttachmentsShort,e.minAttachmentCount,"min"):null,a=null!=e.maxAttachmentCount?this._renderAttachmentCountLimitLabel(t.maxAttachmentsShort,e.maxAttachmentCount,"max"):null;return i||a?[i,i&&a?pe("span",{key:"attachment-count-limits-separator"},", "):null,a]:null}_renderAttachmentCountLimitLabel(e,i,a){const n="__count__",[s,l]=t(e,{count:n}).split(n);return pe("span",{key:a},s,pe("span",{class:D.attachmentElementEmptyActionHintValue},i),l)}_renderAttachmentValidationCriteria(e,{includeCountCriteria:t}){const i=this._getAttachmentValidationCriteria(e,{includeCountCriteria:t}),a=`attachment-validation-criteria-${e.template.elementId}`;return 0===i.length?null:pe("div",{class:D.attachmentElementValidationCriteria,key:a},i.map(({key:e,message:t,state:i})=>pe("calcite-notice",{appearance:"danger"===i?"outline-fill":"transparent",closable:!1,icon:!0,key:e,kind:i,open:!0,scale:"s",width:"full"},pe("div",{slot:"message"},t))))}_getAttachmentValidationCriteria(e,{includeCountCriteria:i}){const a=[],n=e.validationCriterionStates,s=this.messages.attachments,l=this._getNestableAttachmentInputs(e.input);e.hasUnsupportedFileTypeValidationError&&a.push({key:"unsupported-file-type",message:this._getUnsupportedFileTypeMessage(),state:"danger"});for(const o of l)"document"===o.type&&null!=o.maxFileSize&&a.push({key:"maximum-file-size",message:t(s.maximumFileSize,{maxSize:this._formatAttachmentSizeLimitInMegabytes(o.maxFileSize)}),state:n.get("maximum-file-size")??"info"}),"audio"===o.type&&null!=o.maxDuration&&a.push({key:"maximum-audio-length",message:t(s.maximumAudioLength,{maxDuration:this._formatAttachmentDurationLimit(o.maxDuration)}),state:n.get("maximum-audio-length")??"info"}),"video"===o.type&&null!=o.maxDuration&&a.push({key:"maximum-video-length",message:t(s.maximumVideoLength,{maxDuration:this._formatAttachmentDurationLimit(o.maxDuration)}),state:n.get("maximum-video-length")??"info"}),"image"===o.type&&null!=o.maxImageSize&&a.push({key:"maximum-image-size",message:t(s.attachmentMustBeSmallerThan,{maxSize:`${o.maxImageSize}px`}),state:n.get("maximum-image-size")??"info"});return i&&null!=e.minAttachmentCount&&e.minAttachmentCount>0&&a.push({key:"minimum-number-of-files",message:t(s.minimumNumberOfFiles,{count:e.minAttachmentCount}),state:n.get("minimum-number-of-files")??"info"}),i&&null!=e.maxAttachmentCount&&a.push({key:"maximum-number-of-files",message:t(s.maximumNumberOfFiles,{count:e.maxAttachmentCount}),state:n.get("maximum-number-of-files")??"info"}),a}_getNestableAttachmentInputs(e){return null==e?[]:"attachment"===e.type?e.inputTypes?.slice()??[]:[e]}_getUnsupportedFileTypeMessage(){return this.featureTableMessages.errorFileUnsupported}_formatAttachmentSize(e){return null==e||Number.isNaN(e)?this.messagesCommon.notApplicable:m(this.messagesUnits,e)}_formatAttachmentSizeLimitInMegabytes(e){return m(this.messagesUnits,1048576*e)}_formatAttachmentDurationLimit(e){return p(1e3*Math.round(e),{...e>=3600?{hour:"2-digit",hourCycle:"h23"}:{},minute:"2-digit",second:"2-digit",timeZone:"UTC"})}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;const t=this.messages.attachments.attachmentTypes,i=f(e);return t?.[i]||e}_renderAttachmentPreviewThumbnail(e,t,i){const a=i.getAttachmentPreviewUrl(e,64);return a&&y(e)?pe("img",{alt:t,class:D.attachmentElementListItemThumb,src:a}):pe("calcite-icon",{class:D.attachmentElementListItemIcon,icon:_(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const i=t.getAttachmentPreviewUrl(e),a=e.name||this.messagesCommon.details;return i&&y(e)?pe("img",{alt:a,class:D.attachmentElementDetailPreviewImage,src:i,title:a}):[pe("calcite-icon",{class:D.attachmentElementDetailPreviewIcon,icon:_(e.contentType),scale:"l",textLabel:a,title:a}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await ee(e)}_canReplaceSelectedAttachment(){return!this.effectiveDisabled&&!!this.selectedAttachmentDetails?.input.canUploadFiles}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const i=t.input.template.elementId,a=C(t.attachment);let n=!1;try{n=await this.viewModel.stageReplaceAttachment(i,a,e)}finally{n&&this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const i=t.input.template.elementId,a=C(t.attachment);this.viewModel.stageRenameAttachment(i,a,e)}_resetSelectedAttachmentChanges(){const e=this.selectedAttachmentDetails;e?.attachment&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,C(e.attachment))}_deleteSelectedAttachment(){const e=this.selectedAttachmentDetails;if(!e?.attachment||this._disableAttachmentModification(e.input))return;const t=e.input.template.elementId,i=C(e.attachment);this.viewModel.stageDeleteAttachment(t,i),this._setSelectedAttachment(null)}_disableAttachmentModification(e){return this.disabledOrReadOnly||!e.editable}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return pe("div",{class:D.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){if(!this._associationsEnabled)return;const{elementId:t}=e.template;return pe("div",{class:D.utilityNetworkAssociationsElementInput,"data-testid":t,key:t},this._associationsWidgetsMap.get(e)?.render())}getCommonInputProps(e){const{template:t,valid:i,value:a,minLength:n,maxLength:s,required:l,fieldName:o,editable:r,userHasChangedValue:c,range:{max:d,min:m}}=e,u=!r||this.readOnly,h=!u&&(this.disabled||this.viewModel.updating);let p=t.hint??void 0,g=!1;return a===$&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(D.fieldInput,u?D.inputDisabled:null),status:!c&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:s&&s>-1?s:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:o,name:o,max:null!=d?d:void 0,min:null!=m?m:void 0,disabled:h,readOnly:u,onblur:this._onComponentBlur,required:l,placeholder:p,value:g?"":a??"",[be]:t.elementId,[fe]:o,onfocus:this._onComponentFocus}}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(be))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),a=t||i;a&&this._afterComponentCreateOrUpdate(a)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,i)||this._markFieldInputTouched(i),this._focusedFieldInput=i}_markFieldInputTouched(e){this._touchedInputs.add(e.template.elementId)}_isMultipleChoiceCheckbox(e,t){return"CALCITE-CHECKBOX"===e.tagName&&null!=t.multipleChoiceInput}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,ge(e))}_onComponentBlur(){this._focusedFieldInput=null}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear(),this._touchedInputs.clear()}_parseValue(e,t,i=!1){const a=t.multipleChoiceInput,n=t.multipleChoiceValues;if(a&&n){const s=a.choiceDelimiter,l=e;if(i){return q({input:t}).checked?null:n.length>0?n.join(s):null}const o=K(t.value,s).filter(e=>e!==$),r=new Set(o);l.checked?r.add(l.value):r.delete(l.value);const c=n.filter(e=>r.has(e));return c.length?c.join(s):null}if(F(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const s=e.value;return null==s||""===s?null:"number"===t.dataType?"-0"===s||"-0."===s||"-0,"===s?s:parseFloat(s):"date"===t.field.type?parseFloat(s):s}_saveInputFromElement(e){const t=this._getFieldInputFromHTMLElement(e);if(!t)return;const i=this._parseValue(e,t);this._saveInput(t,i)}_saveInput(e,t){const{elementId:i}=e.template,a=e?.value,{viewModel:s}=this;if(F(e.template,"switch")&&"single"!==s.mode){const t=n(this._batchSwitchInputInitialValues,e,()=>e.value);this._batchSwitchInputInitialValues.set(e,null===t?a:t)}t!==a&&(e.isSubtypeField&&"batch"!==s.mode&&k(s.activeLayer,a,t)?this._pendingSubtypeChoice||(this._pendingSubtypeChoice=this._handleSubtypeChoice(e,t)):s.setValue(i,t))}async _handleSubtypeChoice(e,i){const{value:a,template:n}=e,{elementId:s}=n,{messages:l,viewModel:o,messagesCommon:r}=this,{subtypes:c,activeFeatureIndex:d}=o;if(await o.setValue(s,i),!c?.length)return;const m=c.find(e=>e.code===i),u=c.find(e=>e.code===a)?.name??`${a}`;if(!m)return;const h=Promise.withResolvers();o.pendingSubtypeChoice=h;let p="update-fields";const g=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}],v={context:"info",title:l.subtypes.changeWarningTitle,message:t(l.subtypes.changeWarning,{originalType:u,newType:m.name}),radios:g,defaultRadioSelection:"update-fields",onRadioSelection:e=>{p=e},actions:{primary:{label:r.apply,action:()=>h.resolve(p),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>h.resolve("undo")}},cancel:()=>h.reject()};try{this.showPrompt(v);switch(await h.promise){case"update-fields":await o.applySubtypeDefaults(m),await o.handleSubtypeChanged(d);break;case"keep-existing":await o.handleSubtypeChanged(d);break;case"undo":await this.viewModel.setValue(s,a)}}finally{o.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,a=e.field.type,n=this._dateComponentMap.get(`${i}`);if(!n)return;const s=e.effectiveTimeZone;let l=e.value===$?void 0:e.value,o=null;"date-only"===a?o=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===a?(l=le(l),o=le(t.value)):o="timestamp-offset"===a?null!=t.value?oe({dateComponent:n.date,timeComponent:n.time,oldValue:l,timeZoneComponent:n.timeZone,defaultTimeZone:s}):null:null!=t.value?re({oldValue:l,dateComponent:n.date,timeZone:s,timeComponent:n.time?.value===$?void 0:n.time}):null,l!==o&&(null!==o&&t.value?this.viewModel.setValue(`${i}`,o):this.viewModel.setValue(`${i}`,null))}_getErrorToDisplay(e){const t=e.compositeError;return e.valid||!t?null:"contingent-values-validation-error::contingency-violation-error"===t||"contingent-values-validation-error::contingency-violation-warning"===t||this._touchedInputs.has(e.template.elementId)||this.viewModel.submitHasBeenAttempted?t:null}_renderViewingAssociationsPage(){return this._associationsList?.render()}_onActiveAssociationsInputChange(e){const t=this._associationsList;t&&(e?(t.associationInput=e,t.viewModel=e.viewModel):t.associationInput=null)}async _setUpAssociationsWidgets(){const e=this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs;if(this._associationsEnabled&&0!==e.length){await this._setUpUtilityNetworkAssociationList();for(const t of e)this._associationsWidgetsMap.set(t,await this._createAssociationsWidget(t))}}async _setUpUtilityNetworkAssociationList(){if(this._associationsList)return;const e=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js")).default;this._associationsList=new e({onSelectLayer:this._onSelectAssociatedLayer.bind(this),onSelectFeature:this._onEditAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)});const t=this.viewModel.activeAssociationsInput;t&&(this._associationsList.associationInput=t,this._associationsList.viewModel=t.viewModel)}async _createAssociationsWidget(e){return new(0,(await import("./Feature/FeatureUtilityNetworkAssociations.js")).default)({viewModel:e.viewModel,onSelectAssociationType:t=>this._onSelectAssociationType(e,t)})}_destroyAssociationsWidgets(){this._associationsWidgetsMap.forEach(e=>s(e)),this._associationsWidgetsMap.clear()}_onSelectAssociationType(e,{listType:t}){this.setActiveAssociationsInput(e),this.setActiveAssociationType(t)}_onSelectAssociatedLayer({layer:e}){this.setActiveAssociationsLayer(e)}async _onEditAssociatedFeature(e){const t=this.callbacks?.editAssociatedFeature,i=this.viewModel.activeAssociationsInput;if(!t||!i?.feature)return;const{association:a,feature:n}=e;await t({parentFeature:i.feature.plainGraphic,association:a,feature:n})}_onAddAssociation(e){const t=this.callbacks?.addAssociation,i=this.viewModel.activeAssociationsInput;if(!t||!i?.feature)return;const{associationType:a,utilityNetwork:n}=e;t({feature:i.feature.plainGraphic,associationType:a,utilityNetwork:n})}_setFocusableInput(e){const t=e&&R(e)?e:this._findFocusableInput(e);this._syncGroupInputStates(),this._focusedFieldInput=t,this._attemptFocusOnNextRender=!0}_findFocusableInput(e){const t=this.viewModel.activeForm.inputs;if(!t.length)return;const i=M(t);let a;if(e)if(V(e)){const t=e.inputs.find(e=>e.visible);a=t?i.indexOf(t):0}else{let n;if(j(e)&&!e.group.open){n=e.group.inputs.filter(R)[t.length-1]}else n=e;a=i.indexOf(n)+1}else a=0;for(let n=a;n<i.length;n++){const e=i[n];if(e.visible&&R(e)){if(this.disabledOrReadOnly&&("switch"===e?.inputType||"radio-buttons"===e?.inputType))continue;return e}}return null}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._setFocusableInput(t),"sequential"===this.groupDisplay&&this.viewModel.activeForm.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.activeForm?.allGroupInputs;if(!e.length)return;const t=e.filter(e=>e.open);0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach(e=>e.open=!1)}};function Ae(e){switch(e){case"audio":return _("audio/mpeg");case"video":return _("video/mp4");case"image":return _("image/png");default:return"camera"}}e([u()],ye.prototype,"activeFeatureIndex",null),e([u()],ye.prototype,"attachmentsEnabled",null),e([u()],ye.prototype,"callbacks",null),e([u()],ye.prototype,"disabled",null),e([u()],ye.prototype,"effectiveTitle",null),e([u()],ye.prototype,"effectiveDisabled",null),e([u()],ye.prototype,"disabledOrReadOnly",null),e([u()],ye.prototype,"features",null),e([u()],ye.prototype,"footerButtonInfos",null),e([u()],ye.prototype,"map",null),e([u()],ye.prototype,"maximumFeatureCount",null),e([u()],ye.prototype,"maximumFeatureCountWithComplexForms",null),e([u()],ye.prototype,"spatialReference",null),e([u()],ye.prototype,"layerInfos",null),e([u()],ye.prototype,"timeZone",null),e([u()],ye.prototype,"headingLevel",void 0),e([u()],ye.prototype,"icon",null),e([u(),ue("esri/t9n/common")],ye.prototype,"messagesCommon",void 0),e([u(),ue("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],ye.prototype,"messages",void 0),e([u(),ue("esri/widgets/FeatureForm/t9n/FeatureForm")],ye.prototype,"featureFormMessages",void 0),e([u(),ue("esri/widgets/FeatureTable/t9n/FeatureTable")],ye.prototype,"featureTableMessages",void 0),e([u(),ue("esri/core/t9n/Units")],ye.prototype,"messagesUnits",void 0),e([u()],ye.prototype,"page",null),e([u()],ye.prototype,"readOnly",null),e([u()],ye.prototype,"showPrompt",null),e([u()],ye.prototype,"clearPrompt",null),e([u()],ye.prototype,"selectedAttachment",null),e([u()],ye.prototype,"selectedAttachmentDetails",null),e([u()],ye.prototype,"valid",null),e([u({type:x}),he(["attachments-change","value-change","values-change","submit"])],ye.prototype,"viewModel",void 0),e([u({type:T,nonNullable:!0})],ye.prototype,"visibleElements",void 0),e([u()],ye.prototype,"groupDisplay",void 0),e([u()],ye.prototype,"_formHeaderVisible",null),e([u()],ye.prototype,"_associationsEnabled",null),e([u()],ye.prototype,"_associationsList",void 0),e([u()],ye.prototype,"_attemptFocusOnNextRender",void 0),e([u()],ye.prototype,"_formId",null),e([u()],ye.prototype,"_focusedFieldInput",void 0),e([u()],ye.prototype,"_pendingSubtypeChoice",void 0),e([u()],ye.prototype,"_relatedRecordsEnabled",null),e([u()],ye.prototype,"_listObserverNode",void 0),e([u()],ye.prototype,"_attachmentDialogInfo",void 0),e([u()],ye.prototype,"_attachmentListFilterText",void 0),e([u()],ye.prototype,"_prompt",void 0),e([u()],ye.prototype,"test",null),ye=e([h("esri.widgets.BatchAttributeForm")],ye);const we=ye;export{we as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i}from"../core/deprecate.js";import a from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{destroyMaybe as s}from"../core/maybe.js";import l from"../core/ReactiveMap.js";import{watch as o,when as r,on as c,sync as d}from"../core/reactiveUtils.js";import{formatFileSize as m}from"../core/unitFormatUtils.js";import{property as u,subclass as h}from"../core/accessorSupport/decorators.js";import{formatDate as p}from"../intl/date.js";import{isIntegerField as g}from"../layers/support/fieldUtils.js";import{isString as v}from"../support/guards.js";import b from"./Widget.js";import{getAttachmentTypeCategory as f,getCalciteIconForAttachment as _}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as C,isImageAttachment as y,getAttachmentFilenameParts as A}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as w,getVisibleFieldInputValidationErrorMessage as I,isElementTemplateWithInputType as F,subtypeChangeShouldPrompt as k,flattenInputs as M}from"./BatchAttributeForm/batchAttributeFormUtils.js";import x from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as D}from"./BatchAttributeForm/css.js";import{makeViewingEditedAttachmentFooterButtons as S,makeViewingAttachmentFooterButtons as E,makeCancelFooterButton as O,makeDefaultFooterButtons as L}from"./BatchAttributeForm/interfaceUtils.js";import T from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as V,isFieldInput as R,isTextElementInput as N,isRelationshipElementInput as P,isAttachmentElementInput as U,isUtilityNetworkAssociationsElementInput as B,differentValuesString as $,getNormalizedFieldName as z,isGroupedInput as j}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as H,getMultipleChoiceCheckboxState as W,otherChoiceCheckedPlaceholderValue as G,getUpdatedMultipleChoiceValueForFeature as Z,getMultipleChoiceSelectAllState as q,splitMultipleChoiceValue as K,canRestoreMultipleChoiceOtherChoiceDraftValue as X}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{loadRelationshipDetailsComponents as J,RelationshipDetails as Q}from"./BatchAttributeForm/rendered-content/RelationshipDetails.js";import{Prompt as Y}from"./Editor/components/Prompt.js";import{downloadAttachmentInfo as ee}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as te}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as ie,getIntlOptionsForField as ae,prepareISOFieldValueForDateComponents as ne,prepareUnixFieldValueForDateComponents as se,normalizeTimeOnlyString as le,getISOFieldValueFromDateComponents as oe,getUnixFieldValueFromDateComponents as re}from"./support/dateUtils.js";import{globalCss as ce}from"./support/globalCss.js";import{Heading as de}from"./support/Heading.js";import{calciteListFilterProps as me}from"./support/listUtils.js";import{messageBundle as ue,vmEvent as he,tsx as pe}from"./support/widget.js";import{setFocus as ge}from"./support/widgetUtils.js";import{isEmptyValue as ve}from"./support/forms/formUtils.js";const be="data-element-id",fe="data-field-name",_e="esri_BatchAttributeForm_select_all",Ce="esri_BatchAttributeForm_other_choice";let ye=class extends b{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.featureTableMessages=null,this.messagesUnits=null,this.viewModel=new x,this.visibleElements=new T,this.groupDisplay="all",this._associationsList=null,this._associationsWidgetsMap=new l,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._pendingSubtypeChoice=null,this._batchSwitchInputInitialValues=new Map,this._listObserverNode=null,this._listObserver=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.viewModel.activeRelationshipInput?.incrementPage()},{root:window.document}),this._attachmentDialogInfo=null,this._attachmentListFilterText="",this._attachmentFileInputMap=new Map,this._prompt=null,this._selectedAttachmentReplaceFileInput=null,this._afterListObserverCreated=e=>{this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)},this._afterListObserverRemoved=()=>{this._listObserverNode=null},this._maximizeSelectedAttachment=()=>{this._attachmentDialogInfo=this.selectedAttachmentDetails},this._enterAttachmentReplaceView=()=>{const e=this.selectedAttachmentDetails;this._canReplaceSelectedAttachment()&&e&&(e.input.clearValidationCriteriaState(),this.viewModel.setShowingSelectedAttachmentReplacePage(!0))},this._setSelectedAttachmentReplaceFileInput=e=>{this._selectedAttachmentReplaceFileInput=e},this._openSelectedAttachmentReplaceFilePicker=()=>{this._canReplaceSelectedAttachment()&&this._selectedAttachmentReplaceFileInput?.click()},this._resetSelectedAttachmentName=()=>{const e=this.selectedAttachmentDetails;if(!e?.attachment)return;const t=e.input.getAttachmentEditState(e.attachment).initialName;if(null==t)return;const i=e.input.template.elementId,a=C(e.attachment);this.viewModel.stageRenameAttachment(i,a,t)},this._closeAttachmentDialog=()=>{this.hideAttachmentDialog()},this._saveInputFromElement=this._saveInputFromElement.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{i(a.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...i}=e;return i}initialize(){this.addHandles([o(()=>this.features,()=>{this._dateComponentMap.clear(),H(this.viewModel,{includeDraftValues:!0})}),o(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),H(this.viewModel),this._setFocusableInput()}),o(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),r(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),o(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),o(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),c(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()}),o(()=>[this._associationsEnabled,this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs],()=>this._setUpAssociationsWidgets(),d),o(()=>this.viewModel.activeAssociationsInput,e=>this._onActiveAssociationsInputChange(e)),o(()=>this.groupDisplay,()=>this._syncGroupInputStates())])}loadDependencies(){return Promise.all([te({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")}),J()])}destroy(){this._destroyAssociationsWidgets(),this._associationsList=s(this._associationsList),this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get effectiveTitle(){const{features:e,messages:t,page:i}=this;return t?"replacing-attachment"===i?t.titles.replaceAttachment:"viewing-attachment-details"===i?t.titles.editAttachment:"adding-attachments"===i?t.titles.addAttachments:"viewing-attachments"===i?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:"":""}get effectiveDisabled(){return this.disabledOrReadOnly||this.viewModel.updating}get disabledOrReadOnly(){return this.disabled||this.readOnly}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get footerButtonInfos(){if(!this.features.length||!this.messages||!this.messagesCommon)return[];const{messages:e,messagesCommon:t,page:i}=this,a=this.effectiveDisabled;if("adding-attachments"===i||"replacing-attachment"===i)return[];if("viewing-attachment-details"===i){const t=this.selectedAttachmentDetails,i=t?.input?.getAttachmentEditState(t.attachment);if(!t?.input||!i)return[];return i.isRenamed||i.isReplaced?S({doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons,resetOnclick:()=>this._resetSelectedAttachmentChanges(),resetDisabled:this._disableAttachmentModification(t.input)}):E({deleteDisabled:this._disableAttachmentModification(t.input),deleteOnclick:()=>this._deleteSelectedAttachment(),doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons})}return"viewing-associated-features"===i?O({messages:t,purpose:"cancel-viewing-associated-features",onclick:()=>this.goBack()}):"viewing-associated-layers"===i?O({messages:t,purpose:"cancel-viewing-associated-layers",onclick:()=>this.goBack()}):"viewing-attachments"===i||"viewing-related-records"===i?[]:L({disabled:a||!this.valid,formId:this._formId,messages:e,callback:()=>this.submit()})}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get page(){return this.viewModel.page}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get selectedAttachment(){return this.viewModel.selectedAttachment}get selectedAttachmentDetails(){return this.viewModel.selectedAttachmentDetails}get valid(){return this.viewModel.valid}get _formHeaderVisible(){return!("batch"===this.viewModel.mode||!this.viewModel.activeFeature)&&!(!this.viewModel.formDescription&&!this.viewModel.formTitle)}get _associationsEnabled(){const{callbacks:e}=this;return!(!e?.addAssociation&&!e?.editAssociatedFeature)}get _formId(){return`${this.id}-form`}get _relatedRecordsEnabled(){const{callbacks:e}=this;return!(!e||!e.addRelatedRecord&&!e.editRelatedRecord)}async goBack(){return this.viewModel.goBack()}async goHome(){return this.viewModel.goHome()}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._setFocusableInput(e.input),this.scheduleRender()}render(){return pe("div",{class:this.classes(D.base,ce.widget,ce.panel)},this._renderContent(),this._renderAttachmentDialog(),this._prompt?pe(Y,{...this._prompt,headingLevel:this.headingLevel}):void 0)}setActiveAssociationsInput(e){this.viewModel.setActiveAssociationsInput(e)}setActiveAssociationsLayer(e){this.viewModel.setActiveAssociationsLayer(e)}setActiveAssociationType(e){this.viewModel.setActiveAssociationType(e)}submit(){return this.viewModel.submit()}get test(){return{saveInput:this._saveInput.bind(this),pendingSubtypeChoice:this._pendingSubtypeChoice}}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:i}=e.dataset,a=n(this._dateComponentMap,`${i}`,()=>({}));switch(t){case"date":a.date=e;break;case"time":a.time=e;break;case"timeZone":a.timeZone=e}}_renderContent(){const{messages:e,viewModel:i}=this,{status:a}=i;return"failed"===a?i.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:i.maximumFeatureCountWithComplexForms})):i.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:i.maximumFeatureCount})):e.formFailedToLoad:i.expressionEvaluationFailed?this._renderErrorNotice(e.expressionEvaluationFailed):i.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===a&&this.visibleElements.loadingIndicator?pe("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return pe("calcite-notice",{class:D.noticeError,icon:!0,kind:t,open:!0},pe("div",{slot:"message"},e))}_renderForm(){return pe("form",{class:D.form,id:this._formId,inert:!!this._prompt,onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderPage())}_renderPage(){switch(this.page){case"adding-attachments":return this._renderAttachmentAddPage();case"viewing-attachment-details":case"replacing-attachment":return this._renderAttachmentDetailPage();case"viewing-attachments":return this._renderAttachmentListPage();case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewingAssociationsPage();case"viewing-related-categories":case"viewing-related-records":return this._renderRelationshipListPage();default:return this._renderDefaultPage()}}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let a;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(a=w(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?a+=` (${e.map(e=>e.label).join(", ")})`:a=null}else a+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return a?this._renderErrorNotice(a,"danger"):null}_renderDefaultPage(){return[this._renderReadOnlyNotice(),this._renderFormHeader(),this._renderFormContent()]}_renderReadOnlyNotice(){if((this.disabled||this.readOnly)&&this.visibleElements.readOnlyNotice)return pe("calcite-notice",{class:D.disabledNotice,icon:"read-only-non-editable",kind:"brand",open:!0,scale:"s",width:"full"},pe("div",{slot:"message"},this.featureFormMessages.disabledForm))}_renderFormHeader(){const{formTitle:e,formDescription:t}=this.viewModel;if(!this._formHeaderVisible)return;const i=e?pe(de,{key:"title",level:this.headingLevel},e):void 0,a=t?pe("p",{class:D.description,key:"description"},t):void 0;return pe("div",{class:D.formHeader},i,a)}_renderFormContent(){return this.viewModel.hasVisibleInputs?this.viewModel.activeForm.inputs.filter(e=>e.visible).map(e=>this._renderInput(e)):this._renderErrorNotice(this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason])}_renderInput(e){return V(e)?this._renderGroupInput(e):R(e)?this._renderLabeledField(e):N(e)?this._renderTextComponent(e):P(e)?this._renderRelationshipElementInput(e):U(e)?this._renderAttachmentElementInput(e):B(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:a}=e,n=t.filter(e=>e.visible),s=e.label??"",l=this._focusedFieldInput?.group===e,o="sequential"===this.groupDisplay;return pe("calcite-block",{class:this.classes(D.group,o?D.groupSequential:null,l?D.groupActive:null,this.disabled?D.inputDisabled:null),collapsible:!0,description:e.description??void 0,expanded:a,heading:s,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:s,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0},onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:a,required:n,dataType:s}=e,l=n?t(this.messages.requiredFieldLabel,{name:a}):a;return pe("calcite-label",{"aria-label":l,class:D.label,key:`field--${i}`},pe("div",{class:D.labelTextContent,key:"labelTextContainer"},a,n?pe("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==s?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):null!==e.multipleChoiceChoices?this._renderMultipleChoiceComponent({input:e,props:t}):"date"===i?this._renderDateComponents(e,t):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{description:t}=e,i=this._getErrorToDisplay(e),a=i?I(e,i,this.messages):null;return a?pe("calcite-input-message",{icon:!0,status:"invalid"},a):t?pe("calcite-input-message",{class:D.description,icon:!1,status:"idle"},t):null}_renderCodedInputs({input:e,props:t}){const i=e.input?.type??null,a=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:a,props:t});default:return this._renderComboBoxComponent({options:a,props:t,input:e})}}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:i}=this,{multipleChoiceChoices:a,multipleChoiceInput:n,multipleChoiceValues:s}=e;if(!n||!a||!s)return null;const l=!0===n.includeSelectAllChoices,o=new Map;let r=s.length>0,c=!1;for(const b of s){const t=W({input:e,choiceValue:b});o.set(b,t),(t.checked||t.indeterminate)&&(c=!0),t.checked||(r=!1)}const d={checked:r,indeterminate:!r&&c},m=d.checked?i.deselectAllLabel:i.selectAllLabel,u=e.getMultipleChoiceOtherChoiceRenderState(this.messages.otherOptionLabel),h=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},p=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},g=t=>{const{fieldName:i}=u;i&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:i})},v=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:u.fieldName})};return pe("div",{class:D.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},l?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:d,selectAllLabel:m,handleSelectAllCheckboxChange:h}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:p}),u.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:l,otherChoiceRenderState:u,handleOtherChoiceCheckboxChange:g,handleOtherChoiceInputChange:v,differentValuesPlaceholder:i.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:i,handleSelectAllCheckboxChange:a}){return pe("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:D.multipleChoiceSelectAll,"data-element-id":e[be],disabled:e.readOnly||e.disabled,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:i,labelText:i,value:_e,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>a(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:i,handleChoiceCheckboxChange:a}){const{multipleChoiceChoices:n}=e;return n?n.map(e=>{const n=i.get(e.value)??{checked:!1,indeterminate:!1};return pe("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[be],disabled:t.readOnly||t.disabled,indeterminate:n.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>a(e),onfocus:t.onfocus})}):[]}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:i,handleOtherChoiceCheckboxChange:a,handleOtherChoiceInputChange:n,differentValuesPlaceholder:s}){return pe("div",{class:this.classes(D.multipleChoiceOtherChoice,t?D.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},pe("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:i.checkboxState.checked,class:e.class,"data-element-id":e[be],disabled:e.readOnly||e.disabled,indeterminate:i.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:i.label,labelText:i.label,value:Ce,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>a(e),onfocus:e.onfocus}),i.checkboxState.checked?pe("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":i.label,class:D.textElementInput,"data-element-id":e[be],disabled:e.readOnly||e.disabled,key:`${e.key}-other-choice-input`,maxLength:i.maxLength,placeholder:i.value===$?s:i.hint,type:"text",value:i.normalizedValue===$?"":i.normalizedValue?String(i.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:i=!1}){if(this._markFieldInputTouched(e),e.multipleChoiceInput&&!i&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const a=e.value,n=this._parseValue(t,e,i);n!==a&&await this.viewModel.setValue(e.template.elementId,n)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:i}){if(!i)return;const a=t.value,n=null==a||""===a?null:a;e.initializeExplicitMultipleChoiceOtherChoiceCheckedState(),e.stashMultipleChoiceOtherChoiceDraftValueForFeatures(e.features,n);const s=z(e,i);s&&await this.viewModel.setValueForFieldName(s,n,Array.from(e.features,e=>e.source))}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:i}){e.setExplicitMultipleChoiceOtherChoiceCheckedState(t),this._markFieldInputTouched(e),t||e.setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e.features.toArray());const a=z(e,i);if(!a)return;const n=new Map;for(const s of e.features){const a=s.getAttribute(i);if(t){if(!ve(a))continue;const t=e.getMultipleChoiceOtherChoiceDraftValue(s),i=X(t)?t:G;n.set(s,i);continue}null!=a&&n.set(s,null)}0!==n.size&&await this.viewModel.setValuePerFeatureForFieldName(a,new Map(Array.from(n,([e,t])=>[e.source,t])))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){if(!e.multipleChoiceInput||!e.multipleChoiceValues)return;const i=new Map(e.features.map(i=>[i,Z({input:e,choiceValue:t.value,currentValue:i.getAttribute(e.fieldName),isChecked:t.checked})]));0!==i.size&&await this.viewModel.setFieldInputValuePerFeature(e,i)}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===$||e.value===$)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[be]:t[be]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:$,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return pe("calcite-switch",{...t,checked:!!F(e.template,"switch")&&e.value===e.template.input.onValue,class:D.inputSwitch,disabled:t.readOnly||t.disabled,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:a,dropdown:n,group:s}=i;return pe("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onblur:()=>{this._focusedFieldInput=null},onCalciteDropdownSelect:({currentTarget:e})=>this._saveInputFromElement(e),onfocus:this._onComponentFocus},pe("calcite-button",{...a},e===$?this.messages.differentValuesPlaceholder:e),pe("calcite-dropdown-group",{selectionMode:s.mode},t.map(t=>pe("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const a="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),s=a&&e.showNoValueOptionEnabled&&!n?()=>{}:i.onblur,l={...i,onblur:s};return pe("calcite-combobox",{...l,clearDisabled:e.isSubtypeField,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:i.placeholder===this.messages.differentValuesPlaceholder?$:String(i.value),onCalciteComboboxChange:({currentTarget:t})=>{t.value!==$&&(e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveInputFromElement(t))}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const a=e=>e.map(e=>{const{value:t}=e,a=ve(e.value)?this.messages.empty:e.name;return pe("calcite-combobox-item",{heading:a,key:`#${t}`,selected:i.value===t,value:`${t}`})});let n=[];const{messages:s}=this;t.other.length>0&&n.push(pe("calcite-combobox-item-group",{key:"other",label:s.other},a(t.other))),t.unsupported.length>0&&n.push(pe("calcite-combobox-item-group",{key:"unsupported",label:s.unsupported},a(t.unsupported)));const l=a(t.recommended);n.length>0?n.unshift(pe("calcite-combobox-item-group",{key:"recommended",label:s.recommended},l)):n=l;const o=i.placeholder===this.messages.differentValuesPlaceholder,r=!o&&ve(i.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(pe("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),o&&n.unshift(pe("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:$,selected:!0,value:$})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const a=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:a})=>this._renderRadioButtons({label:t,value:a,selected:a===e.value,props:i}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,s=ve(e.value);a.unshift(this._renderRadioButtons({label:n,value:t,selected:s,props:i}))}return pe("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:D.inputRadioGroup,"data-field-name":i[fe],disabled:i.readOnly||i.disabled,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},a,i.placeholder===this.messages.differentValuesPlaceholder?pe("calcite-label",{class:D.placeholderRadio,key:i.label,layout:"inline"},pe("calcite-radio-button",{checked:!0,class:D.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:a}){return pe("calcite-label",{class:D.inputRadioLabel,key:a.label,layout:"inline"},pe("calcite-radio-button",{...a,afterCreate:void 0,afterUpdate:void 0,checked:t,class:D.inputRadio,disabled:a.readOnly||a.disabled,name:a.label,value:e,onblur:()=>{this._focusedFieldInput=null},onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInputFromElement(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?pe("calcite-text-area",{...t,class:this.classes(D.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInputFromElement(e)}):pe("calcite-input",{...t,class:this.classes(D.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderNumberComponent(e,t){const i=g(e.field);return pe("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return pe("calcite-input",{...i,class:this.classes(D.fieldInput,D.inputDisabled,D.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let a;switch(i.type){case"date":a=this._renderDateFieldComponents(e,t);break;case"date-only":a=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":a=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":a=this._renderTimestampOffsetFieldComponents(e,t);break;default:a=this._renderReadOnlyComponent(e,ie(i,t.value,{timeZone:e.effectiveTimeZone,...ae(e.template.field)}))}return e.value===$?[a,pe("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:a}_renderDateOnlyFieldComponent(e,t){const{class:i,disabled:a,key:n,readOnly:s}=t,{rawMax:l,rawMin:o}=e.range;return pe("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[be],"data-field-name":t[fe],disabled:a,key:`${n}-date-input`,max:v(l)?l:void 0,min:v(o)?o:void 0,overlayPositioning:"fixed",readOnly:s,topLayerDisabled:this.topLayerDisabled,value:e.value===$?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimeOnlyFieldComponent(e,t){const{class:i,disabled:a,key:n,readOnly:s}=t;return pe("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[be],"data-field-name":t[fe],disabled:a,key:`${n}-time-input`,overlayPositioning:"fixed",readOnly:s,value:e.value===$?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,disabled:a,key:n,readOnly:s}=t,{rawMax:l,rawMin:o}=e.range,r=e.effectiveTimeZone,c=ne(l,r),d=ne(o,r),m=ne(e.value===$?"":e.value,r),u=e.includeTimeOffset,h={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:a,[be]:t[be],[fe]:t[fe],onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s};return pe("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},pe("calcite-input-date-picker",{...h,class:i,"data-date-part":"date",key:`${n}-date-input`,max:c?.date??void 0,min:d?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:m.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),pe("calcite-input-time-picker",{...h,class:i,"data-date-part":"time",key:`${n}-time-input`,value:m.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?pe("calcite-input-time-zone",{...h,class:i,clearable:e.value===$||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,value:m.timeZoneOffset||"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,disabled:a,key:n,readOnly:s,min:l,max:o}=t,r=e.effectiveTimeZone,c=se(e.value===$?"":e.value,r),d=se(o,r),m=se(l,r),u=e.includeTime,h={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:a,[be]:t[be],[fe]:t[fe],onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s};return pe("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},pe("calcite-input-date-picker",{...h,class:i,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:m?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?pe("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${n}-time-input`,step:1,value:c.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){return this._relatedRecordsEnabled?pe(Q,{afterObserverCreated:this._afterListObserverCreated,afterObserverRemoved:this._afterListObserverRemoved,input:e,messages:this.messages,messagesCommon:this.messagesCommon,viewModel:this.viewModel}):null}_renderRelationshipListPage(){const{activeRelationshipInput:e}=this.viewModel;if(e)return this._renderRelationshipElementInput(e)}_renderAttachmentElementInput(e){if(!this.attachmentsEnabled)return;const{allAttachmentsVisibleOnDefaultPage:t,attachments:i,defaultPageAttachments:a,template:{description:n,elementId:s,label:l}}=e,o=t?i:a;return pe("div",{class:D.attachmentElementInput,"data-testid":`attachment-element-${s}`,key:`attachment-element-${s}`},l?pe("div",{class:D.attachmentElementLabel,key:`attachment-element-label-${s}`},l):null,n?pe("div",{class:D.description,key:`attachment-element-description-${s}`},n):null,i.length?this._renderAttachmentList(e,o,{label:l||this.messagesCommon.details,viewAllCount:t?null:i.length}):pe("div",{class:D.attachmentElementEmptyState,key:`attachment-element-empty-state-${s}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){const e=this.viewModel.selectedAttachmentListInput;if(e)return pe("div",{class:D.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,i){const{filterEnabled:a,label:n,viewAllCount:s}=i;return pe("calcite-list",{class:D.attachmentElementList,filterEnabled:a,filterPlaceholder:a?this.messages.attachments.searchAttachments:void 0,filterProps:a?me:void 0,filterText:a?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:a?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=s?this._renderViewAllAttachmentsItem(e,s):null)}_renderAttachmentListItems(e,t){const{elementId:i}=e.template;return t.map((t,a)=>{const n=this._formatAttachmentSize(t.size),s=this._getAttachmentLabel(t,a,n,e.displayFilename),l=s===n?void 0:n,o=C(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=c.isDeleted,m=!d&&(r||c.isRenamed||c.isReplaced);return pe("calcite-list-item",{class:D.attachmentElementListItem,description:l,key:`attachment-item-${o}`,label:s,onCalciteListItemSelect:r||d?void 0:()=>this._setSelectedAttachment({attachmentKey:o,elementId:i})},pe("div",{class:D.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,s,e)),m?pe("span",{class:D.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[pe("calcite-action",{disabled:this._disableAttachmentModification(e),icon:"x",scale:"s",slot:"actions-end",text:this.messagesCommon.delete,title:this.messagesCommon.delete,onclick:()=>this.viewModel.stageDeleteAttachment(i,C(t))})]:d?pe("calcite-chip",{label:this.messages.attachments.deleted,scale:"s",slot:"content-end"},this.messages.attachments.deleted):pe("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))})}_renderViewAllAttachmentsItem(e,i){const{elementId:a}=e.template,{viewAll:n}=this.messages.attachments;return pe("calcite-list-item",{class:D.attachmentElementListItem,description:t(this.messages.attachments.count,{count:i}),key:`attachment-item-view-all-${a}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(a)},pe("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,i=this.effectiveDisabled||e.addDisabled,a=this._renderAttachmentCountLimitsLabel(e),n=this._getAttachmentNoticeMessage(e),s=e.hasMinimumAttachmentCountNotMet||e.hasExceededAttachmentLimit?"danger":"info",l=e.canUploadFiles,o=e.isCaptureOnly&&!this.effectiveDisabled&&!n;return pe("div",{class:D.attachmentElementAddActions,key:`attachment-element-add-actions-${t}`},l?pe("calcite-button",{appearance:"outline",disabled:i,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach):null,this._renderAttachmentCaptureButton(e),o?this._renderAttachmentCaptureDisabledNotice(t):null,a?pe("div",{class:D.attachmentElementEmptyActionHint},a):null,!this.effectiveDisabled&&n?pe("calcite-notice",{closable:!1,icon:"danger"===s?"exclamation-mark-circle":"lightbulb",kind:s,open:!0,scale:"s",width:"full"},pe("div",{slot:"message"},n)):null)}_renderAttachmentCaptureButton(e){if(!e.hasCaptureInputs)return null;const t=e.captureMediaType;return pe("calcite-button",{appearance:"outline",disabled:!0,iconStart:Ae(t),kind:"neutral",round:!0,scale:"s"},this._getCaptureButtonLabel(t))}_getAttachmentNoticeMessage(e){const t=this.messages.attachments;return e.hasUnsupportedFileTypeValidationError?this._getUnsupportedFileTypeMessage():e.hasMinimumAttachmentCountNotMet&&this._shouldShowMinimumAttachmentNotice(e)?t.minimumNotMet:e.hasExceededAttachmentLimit?t.attachmentLimitExceeded:e.hasReachedAttachmentLimit?t.attachmentLimitReached:null}_shouldShowMinimumAttachmentNotice(e){return e.hasAttachmentChanges||this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId)}_getCaptureButtonLabel(e){const{capture:t,recordAudio:i,takePhoto:a,takeVideo:n}=this.messages.attachments;switch(e){case"image":return a||t;case"video":return n||t;case"audio":return i||t;default:return t}}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:i}=e.template;if(e.isCaptureOnly)return this._renderAttachmentCaptureDisabledNotice(i);const a=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,s=this.messages.attachments,l=s.dragAndDropFile,o="upload",r=e=>{this._attachmentFileInputMap.set(i,e)};return pe("div",{class:D.attachmentElementAddPanel,key:`attachment-element-add-panel-${i}`},pe("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(i)},afterUpdate:r,class:D.attachmentElementFileInput,"data-element-id":i,disabled:n,multiple:a,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?Array.from(t.files):[];this._stageAttachmentFiles(i,a),t.value=""}}),pe("div",{class:D.attachmentElementAddDropzone,"data-disabled":n?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),n)return;const t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(i,t)}},pe("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:o,scale:"l"}),pe("div",{class:D.attachmentElementAddDropzoneHeading},s.addFile),pe("div",{class:D.attachmentElementAddDropzoneDetail,title:l},l),pe("calcite-button",{appearance:"transparent",disabled:n,iconStart:"folder-open",kind:"brand",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(i,n)}},s.selectFile)),this._renderAttachmentValidationCriteria(e,{includeCountCriteria:!0}))}_renderAttachmentCaptureDisabledNotice(e){return pe("calcite-notice",{class:D.attachmentElementCaptureNotice,icon:!0,key:`attachment-element-capture-disabled-notice-${e}`,kind:"warning",open:!0,scale:"s"},pe("div",{slot:"message"},this.messages.attachments.captureMethodNotSupported))}async _stageAttachmentFiles(e,t){if(0===t.length)return;const i=this.viewModel.selectedAttachmentAddInput;let a=!0;try{a=(await this.viewModel.stageAddAttachments(e,t)).length>0&&!i?.hasInvalidValidationCriteria&&!i?.hasUnsupportedFileTypeValidationError}finally{a&&this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){const e=this.selectedAttachmentDetails;if(!e)return;if("replacing-attachment"===this.page)return this._renderAttachmentReplacePanel(e);const{attachment:t,input:i}=e,a=C(t),n=!!i.getAttachmentPreviewUrl(t),s=!this._disableAttachmentModification(i)&&i.canUploadFiles,l=i.getAttachmentEditState(t);return pe("div",{class:D.attachmentElementDetail,key:`attachment-detail-panel-${i.template.elementId}-${a}`},pe("div",{class:D.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,i)),pe("div",{class:D.attachmentElementDetailActions},y(t)?pe("calcite-button",{appearance:"outline",disabled:!n,iconStart:"expand",kind:"neutral",label:this.messages.attachments.maximize,scale:"m",title:this.messages.attachments.maximize,onclick:this._maximizeSelectedAttachment}):null,pe("calcite-button",{appearance:"outline",disabled:!n||l.isReplaced,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),pe("calcite-button",{appearance:"outline",disabled:!s,iconStart:"upload-to",kind:"neutral",label:this.messages.attachments.replace,scale:"m",title:this.messages.attachments.replace,onclick:this._enterAttachmentReplaceView})),pe("div",{class:D.attachmentElementDetailMetadata},pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),this._renderFileNameContent(t,i)),pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.size),pe("span",{class:D.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.type),pe("span",{class:D.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderFileNameContent(e,t){if(!t.allowUserRename)return pe("span",{class:D.attachmentElementDetailMetadataValue},e.name);const i=t.getAttachmentEditState(e),{baseName:a,extension:n}=A(e.name),s=this._disableAttachmentModification(t),l=!s&&0===e.name.trim().length;return[pe("div",{class:D.attachmentElementDetailFileNameRow,key:"file-name-row"},pe("calcite-input",{class:D.attachmentElementDetailFileNameInput,disabled:s,scale:"m",status:l?"invalid":"idle",suffixText:n,value:a,onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),pe("calcite-button",{appearance:"transparent",disabled:s||null==i.initialName||!i.isRenamed,iconStart:"reset",kind:"neutral",label:this.messages.footerButtons.reset,scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})),l?pe("calcite-input-message",{icon:!0,key:"file-name-message",status:"invalid"},this.messages.validationErrors.cannotBeNull):null]}_renderAttachmentReplacePanel(e){const{attachment:t,input:i}=e,a=this._disableAttachmentModification(i)||!i.canUploadFiles,n=i.template.elementId;return pe("div",{class:D.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${C(t)}`},pe("input",{accept:i.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:D.attachmentElementFileInput,disabled:a,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?.[0];i&&this._stageSelectedAttachmentReplacement(i),t.value=""}}),pe("div",{class:D.attachmentElementAddDropzone,"data-disabled":a?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),a)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},pe("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),pe("div",{class:D.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),pe("div",{class:D.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),pe("calcite-button",{appearance:"transparent",disabled:a,iconStart:"folder-open",kind:"brand",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),this._renderAttachmentValidationCriteria(i,{includeCountCriteria:!1}),pe("div",{class:D.attachmentElementDetailMetadata},pe("div",{class:D.attachmentElementDetailMetadataGroup},pe("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),pe("span",{class:D.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:i}=e;return pe("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},pe("div",{class:D.attachmentElementDialogPreview},this._renderAttachmentPreviewImageForInput(t,i)))}_setSelectedAttachment(e){e?.elementId&&this._touchedInputs.add(e.elementId),this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){e&&this._touchedInputs.add(e),this.viewModel.setSelectedAttachmentAddElementId(e),this.viewModel.selectedAttachmentAddInput?.clearValidationCriteriaState(),this.hideAttachmentDialog()}_setAttachmentListElementId(e){e&&this._touchedInputs.add(e),this.viewModel.setSelectedAttachmentListElementId(e),this.hideAttachmentDialog()}_getAttachmentLabel(e,i,a,n){return!1!==n&&v(e.name)&&e.name.length>0?e.name:a!==this.messagesCommon.notApplicable?a:t(this.messages.attachments.attachmentNumberedLabel,{index:i+1})}_renderAttachmentCountLimitsLabel(e){const t=this.messages.attachments,i=null!=e.minAttachmentCount&&e.minAttachmentCount>0?this._renderAttachmentCountLimitLabel(t.minAttachmentsShort,e.minAttachmentCount,"min"):null,a=null!=e.maxAttachmentCount?this._renderAttachmentCountLimitLabel(t.maxAttachmentsShort,e.maxAttachmentCount,"max"):null;return i||a?[i,i&&a?pe("span",{key:"attachment-count-limits-separator"},", "):null,a]:null}_renderAttachmentCountLimitLabel(e,i,a){const n="__count__",[s,l]=t(e,{count:n}).split(n);return pe("span",{key:a},s,pe("span",{class:D.attachmentElementEmptyActionHintValue},i),l)}_renderAttachmentValidationCriteria(e,{includeCountCriteria:t}){const i=this._getAttachmentValidationCriteria(e,{includeCountCriteria:t}),a=`attachment-validation-criteria-${e.template.elementId}`;return 0===i.length?null:pe("div",{class:D.attachmentElementValidationCriteria,key:a},i.map(({key:e,message:t,state:i})=>pe("calcite-notice",{appearance:"danger"===i?"outline-fill":"transparent",closable:!1,icon:!0,key:e,kind:i,open:!0,scale:"s",width:"full"},pe("div",{slot:"message"},t))))}_getAttachmentValidationCriteria(e,{includeCountCriteria:i}){const a=[],n=e.validationCriterionStates,s=this.messages.attachments,l=this._getNestableAttachmentInputs(e.input);e.hasUnsupportedFileTypeValidationError&&a.push({key:"unsupported-file-type",message:this._getUnsupportedFileTypeMessage(),state:"danger"});for(const o of l)"document"===o.type&&null!=o.maxFileSize&&a.push({key:"maximum-file-size",message:t(s.maximumFileSize,{maxSize:this._formatAttachmentSizeLimitInMegabytes(o.maxFileSize)}),state:n.get("maximum-file-size")??"info"}),"audio"===o.type&&null!=o.maxDuration&&a.push({key:"maximum-audio-length",message:t(s.maximumAudioLength,{maxDuration:this._formatAttachmentDurationLimit(o.maxDuration)}),state:n.get("maximum-audio-length")??"info"}),"video"===o.type&&null!=o.maxDuration&&a.push({key:"maximum-video-length",message:t(s.maximumVideoLength,{maxDuration:this._formatAttachmentDurationLimit(o.maxDuration)}),state:n.get("maximum-video-length")??"info"}),"image"===o.type&&null!=o.maxImageSize&&a.push({key:"maximum-image-size",message:t(s.attachmentMustBeSmallerThan,{maxSize:`${o.maxImageSize}px`}),state:n.get("maximum-image-size")??"info"});return i&&null!=e.minAttachmentCount&&e.minAttachmentCount>0&&a.push({key:"minimum-number-of-files",message:t(s.minimumNumberOfFiles,{count:e.minAttachmentCount}),state:n.get("minimum-number-of-files")??"info"}),i&&null!=e.maxAttachmentCount&&a.push({key:"maximum-number-of-files",message:t(s.maximumNumberOfFiles,{count:e.maxAttachmentCount}),state:n.get("maximum-number-of-files")??"info"}),a}_getNestableAttachmentInputs(e){return null==e?[]:"attachment"===e.type?e.inputTypes?.slice()??[]:[e]}_getUnsupportedFileTypeMessage(){return this.featureTableMessages.errorFileUnsupported}_formatAttachmentSize(e){return null==e||Number.isNaN(e)?this.messagesCommon.notApplicable:m(this.messagesUnits,e)}_formatAttachmentSizeLimitInMegabytes(e){return m(this.messagesUnits,1048576*e)}_formatAttachmentDurationLimit(e){return p(1e3*Math.round(e),{...e>=3600?{hour:"2-digit",hourCycle:"h23"}:{},minute:"2-digit",second:"2-digit",timeZone:"UTC"})}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;const t=this.messages.attachments.attachmentTypes,i=f(e);return t?.[i]||e}_renderAttachmentPreviewThumbnail(e,t,i){const a=i.getAttachmentPreviewUrl(e,64);return a&&y(e)?pe("img",{alt:t,class:D.attachmentElementListItemThumb,src:a}):pe("calcite-icon",{class:D.attachmentElementListItemIcon,icon:_(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const i=t.getAttachmentPreviewUrl(e),a=e.name||this.messagesCommon.details;return i&&y(e)?pe("img",{alt:a,class:D.attachmentElementDetailPreviewImage,src:i,title:a}):[pe("calcite-icon",{class:D.attachmentElementDetailPreviewIcon,icon:_(e.contentType),scale:"l",textLabel:a,title:a}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await ee(e)}_canReplaceSelectedAttachment(){return!this.effectiveDisabled&&!!this.selectedAttachmentDetails?.input.canUploadFiles}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const i=t.input.template.elementId,a=C(t.attachment);let n=!1;try{n=await this.viewModel.stageReplaceAttachment(i,a,e)}finally{n&&this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const i=t.input.template.elementId,a=C(t.attachment);this.viewModel.stageRenameAttachment(i,a,e)}_resetSelectedAttachmentChanges(){const e=this.selectedAttachmentDetails;e?.attachment&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,C(e.attachment))}_deleteSelectedAttachment(){const e=this.selectedAttachmentDetails;if(!e?.attachment||this._disableAttachmentModification(e.input))return;const t=e.input.template.elementId,i=C(e.attachment);this.viewModel.stageDeleteAttachment(t,i),this._setSelectedAttachment(null)}_disableAttachmentModification(e){return this.disabledOrReadOnly||!e.editable}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return pe("div",{class:D.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){if(!this._associationsEnabled)return;const{elementId:t}=e.template;return pe("div",{class:D.utilityNetworkAssociationsElementInput,"data-testid":t,key:t},this._associationsWidgetsMap.get(e)?.render())}getCommonInputProps(e){const{template:t,valid:i,value:a,minLength:n,maxLength:s,required:l,fieldName:o,editable:r,userHasChangedValue:c,range:{max:d,min:m}}=e,u=!r||this.readOnly,h=this.disabled||this.viewModel.updating;let p=t.hint??void 0,g=!1;return a===$&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(D.fieldInput,u?D.inputDisabled:null),status:!c&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:s&&s>-1?s:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:o,name:o,max:null!=d?d:void 0,min:null!=m?m:void 0,disabled:h,readOnly:u,onblur:this._onComponentBlur,required:l,placeholder:p,value:g?"":a??"",[be]:t.elementId,[fe]:o,onfocus:this._onComponentFocus}}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(be))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),a=t||i;a&&this._afterComponentCreateOrUpdate(a)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,i)||this._markFieldInputTouched(i),this._focusedFieldInput=i}_markFieldInputTouched(e){this._touchedInputs.add(e.template.elementId)}_isMultipleChoiceCheckbox(e,t){return"CALCITE-CHECKBOX"===e.tagName&&null!=t.multipleChoiceInput}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,ge(e))}_onComponentBlur(){this._focusedFieldInput=null}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear(),this._touchedInputs.clear()}_parseValue(e,t,i=!1){const a=t.multipleChoiceInput,n=t.multipleChoiceValues;if(a&&n){const s=a.choiceDelimiter,l=e;if(i){return q({input:t}).checked?null:n.length>0?n.join(s):null}const o=K(t.value,s).filter(e=>e!==$),r=new Set(o);l.checked?r.add(l.value):r.delete(l.value);const c=n.filter(e=>r.has(e));return c.length?c.join(s):null}if(F(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const s=e.value;return null==s||""===s?null:"number"===t.dataType?"-0"===s||"-0."===s||"-0,"===s?s:parseFloat(s):"date"===t.field.type?parseFloat(s):s}_saveInputFromElement(e){const t=this._getFieldInputFromHTMLElement(e);if(!t)return;const i=this._parseValue(e,t);this._saveInput(t,i)}_saveInput(e,t){const{elementId:i}=e.template,a=e?.value,{viewModel:s}=this;if(F(e.template,"switch")&&"single"!==s.mode){const t=n(this._batchSwitchInputInitialValues,e,()=>e.value);this._batchSwitchInputInitialValues.set(e,null===t?a:t)}t!==a&&(e.isSubtypeField&&"batch"!==s.mode&&k(s.activeLayer,a,t)?this._pendingSubtypeChoice||(this._pendingSubtypeChoice=this._handleSubtypeChoice(e,t)):s.setValue(i,t))}async _handleSubtypeChoice(e,i){const{value:a,template:n}=e,{elementId:s}=n,{messages:l,viewModel:o,messagesCommon:r}=this,{subtypes:c,activeFeatureIndex:d}=o;if(await o.setValue(s,i),!c?.length)return;const m=c.find(e=>e.code===i),u=c.find(e=>e.code===a)?.name??`${a}`;if(!m)return;const h=Promise.withResolvers();o.pendingSubtypeChoice=h;let p="update-fields";const g=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}],v={context:"info",title:l.subtypes.changeWarningTitle,message:t(l.subtypes.changeWarning,{originalType:u,newType:m.name}),radios:g,defaultRadioSelection:"update-fields",onRadioSelection:e=>{p=e},actions:{primary:{label:r.apply,action:()=>h.resolve(p),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>h.resolve("undo")}},cancel:()=>h.reject()};try{this.showPrompt(v);switch(await h.promise){case"update-fields":await o.applySubtypeDefaults(m),await o.handleSubtypeChanged(d);break;case"keep-existing":await o.handleSubtypeChanged(d);break;case"undo":await this.viewModel.setValue(s,a)}}finally{o.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,a=e.field.type,n=this._dateComponentMap.get(`${i}`);if(!n)return;const s=e.effectiveTimeZone;let l=e.value===$?void 0:e.value,o=null;"date-only"===a?o=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===a?(l=le(l),o=le(t.value)):o="timestamp-offset"===a?null!=t.value?oe({dateComponent:n.date,timeComponent:n.time,oldValue:l,timeZoneComponent:n.timeZone,defaultTimeZone:s}):null:null!=t.value?re({oldValue:l,dateComponent:n.date,timeZone:s,timeComponent:n.time?.value===$?void 0:n.time}):null,l!==o&&(null!==o&&t.value?this.viewModel.setValue(`${i}`,o):this.viewModel.setValue(`${i}`,null))}_getErrorToDisplay(e){const t=e.compositeError;return e.valid||!t?null:"contingent-values-validation-error::contingency-violation-error"===t||"contingent-values-validation-error::contingency-violation-warning"===t||this._touchedInputs.has(e.template.elementId)||this.viewModel.submitHasBeenAttempted?t:null}_renderViewingAssociationsPage(){return this._associationsList?.render()}_onActiveAssociationsInputChange(e){const t=this._associationsList;t&&(e?(t.associationInput=e,t.viewModel=e.viewModel):t.associationInput=null)}async _setUpAssociationsWidgets(){const e=this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs;if(this._associationsEnabled&&0!==e.length){await this._setUpUtilityNetworkAssociationList();for(const t of e)this._associationsWidgetsMap.set(t,await this._createAssociationsWidget(t))}}async _setUpUtilityNetworkAssociationList(){if(this._associationsList)return;const e=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js")).default;this._associationsList=new e({onSelectLayer:this._onSelectAssociatedLayer.bind(this),onSelectFeature:this._onEditAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)});const t=this.viewModel.activeAssociationsInput;t&&(this._associationsList.associationInput=t,this._associationsList.viewModel=t.viewModel)}async _createAssociationsWidget(e){return new(0,(await import("./Feature/FeatureUtilityNetworkAssociations.js")).default)({viewModel:e.viewModel,onSelectAssociationType:t=>this._onSelectAssociationType(e,t)})}_destroyAssociationsWidgets(){this._associationsWidgetsMap.forEach(e=>s(e)),this._associationsWidgetsMap.clear()}_onSelectAssociationType(e,{listType:t}){this.setActiveAssociationsInput(e),this.setActiveAssociationType(t)}_onSelectAssociatedLayer({layer:e}){this.setActiveAssociationsLayer(e)}async _onEditAssociatedFeature(e){const t=this.callbacks?.editAssociatedFeature,i=this.viewModel.activeAssociationsInput;if(!t||!i?.feature)return;const{association:a,feature:n}=e;await t({parentFeature:i.feature.plainGraphic,association:a,feature:n})}_onAddAssociation(e){const t=this.callbacks?.addAssociation,i=this.viewModel.activeAssociationsInput;if(!t||!i?.feature)return;const{associationType:a,utilityNetwork:n}=e;t({feature:i.feature.plainGraphic,associationType:a,utilityNetwork:n})}_setFocusableInput(e){const t=e&&R(e)?e:this._findFocusableInput(e);this._syncGroupInputStates(),this._focusedFieldInput=t,this._attemptFocusOnNextRender=!0}_findFocusableInput(e){const t=this.viewModel.activeForm.inputs;if(!t.length)return;const i=M(t);let a;if(e)if(V(e)){const t=e.inputs.find(e=>e.visible);a=t?i.indexOf(t):0}else{let n;if(j(e)&&!e.group.open){n=e.group.inputs.filter(R)[t.length-1]}else n=e;a=i.indexOf(n)+1}else a=0;for(let n=a;n<i.length;n++){const e=i[n];if(e.visible&&R(e)){if(this.disabledOrReadOnly&&("switch"===e?.inputType||"radio-buttons"===e?.inputType))continue;return e}}return null}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._setFocusableInput(t),"sequential"===this.groupDisplay&&this.viewModel.activeForm.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.activeForm?.allGroupInputs;if(!e.length)return;const t=e.filter(e=>e.open);0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach(e=>e.open=!1)}};function Ae(e){switch(e){case"audio":return _("audio/mpeg");case"video":return _("video/mp4");case"image":return _("image/png");default:return"camera"}}e([u()],ye.prototype,"activeFeatureIndex",null),e([u()],ye.prototype,"attachmentsEnabled",null),e([u()],ye.prototype,"callbacks",null),e([u()],ye.prototype,"disabled",null),e([u()],ye.prototype,"effectiveTitle",null),e([u()],ye.prototype,"effectiveDisabled",null),e([u()],ye.prototype,"disabledOrReadOnly",null),e([u()],ye.prototype,"features",null),e([u()],ye.prototype,"footerButtonInfos",null),e([u()],ye.prototype,"map",null),e([u()],ye.prototype,"maximumFeatureCount",null),e([u()],ye.prototype,"maximumFeatureCountWithComplexForms",null),e([u()],ye.prototype,"spatialReference",null),e([u()],ye.prototype,"layerInfos",null),e([u()],ye.prototype,"timeZone",null),e([u()],ye.prototype,"headingLevel",void 0),e([u()],ye.prototype,"icon",null),e([u(),ue("esri/t9n/common")],ye.prototype,"messagesCommon",void 0),e([u(),ue("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],ye.prototype,"messages",void 0),e([u(),ue("esri/widgets/FeatureForm/t9n/FeatureForm")],ye.prototype,"featureFormMessages",void 0),e([u(),ue("esri/widgets/FeatureTable/t9n/FeatureTable")],ye.prototype,"featureTableMessages",void 0),e([u(),ue("esri/core/t9n/Units")],ye.prototype,"messagesUnits",void 0),e([u()],ye.prototype,"page",null),e([u()],ye.prototype,"readOnly",null),e([u()],ye.prototype,"showPrompt",null),e([u()],ye.prototype,"clearPrompt",null),e([u()],ye.prototype,"selectedAttachment",null),e([u()],ye.prototype,"selectedAttachmentDetails",null),e([u()],ye.prototype,"valid",null),e([u({type:x}),he(["attachments-change","value-change","values-change","submit"])],ye.prototype,"viewModel",void 0),e([u({type:T,nonNullable:!0})],ye.prototype,"visibleElements",void 0),e([u()],ye.prototype,"groupDisplay",void 0),e([u()],ye.prototype,"_formHeaderVisible",null),e([u()],ye.prototype,"_associationsEnabled",null),e([u()],ye.prototype,"_associationsList",void 0),e([u()],ye.prototype,"_attemptFocusOnNextRender",void 0),e([u()],ye.prototype,"_formId",null),e([u()],ye.prototype,"_focusedFieldInput",void 0),e([u()],ye.prototype,"_pendingSubtypeChoice",void 0),e([u()],ye.prototype,"_relatedRecordsEnabled",null),e([u()],ye.prototype,"_listObserverNode",void 0),e([u()],ye.prototype,"_attachmentDialogInfo",void 0),e([u()],ye.prototype,"_attachmentListFilterText",void 0),e([u()],ye.prototype,"_prompt",void 0),e([u()],ye.prototype,"test",null),ye=e([h("esri.widgets.BatchAttributeForm")],ye);const we=ye;export{we as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{substitute as e}from"../../../intl/substitute.js";import{isNextOrLegacyCreateFeaturesWorkflow as t,isNextOrLegacySplitFeatureWorkflow as o,isNextOrLegacyMergeFeaturesWorkflow as i,isLegacyFeatureFormViewModel as n,isNextOrLegacyUpdateFeatureWorkflow as s,isNextOrLegacyUpdateFeaturesWorkflow as a}from"../compatibilityAdapters.js";import{css as l}from"../css.js";import{isBatchAttributeFormViewModel as r}from"../workflowUtils.js";import{loadFooterActionsComponents as c,FooterActions as u}from"./FooterActions.js";import p from"./MergeFeaturesList.js";import{loadNoticesComponents as m,Notices as d}from"./Notices.js";import{loadPanelContentComponents as f,PanelContentSection as g,PanelContentSectionGroup as k,PanelContent as b}from"./PanelContent.js";import w from"./PendingFeatureList.js";import{loadCalciteComponents as v}from"../../support/componentsUtils.js";import{Heading as h,incrementHeadingLevel as y}from"../../support/Heading.js";import{tsx as F,tsxFragment as j}from"../../support/widget.js";import{classes as A}from"../../support/widgetUtils.js";const C=()=>Promise.all([v({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),action:()=>import("@esri/calcite-components/dist/components/calcite-action")}),c(),m(),f()]);function M(e){const{editorViewModel:s,headingLevel:a,messages:c,renderAttachments:m,renderFeatureForm:f,formWidget:v,renderSketchToolbar:A}=e,{activeFeatureCount:C,activeLeafWorkflow:M,activeWorkflow:B,formViewModel:T}=s;if(!M||!B||!T)return null;const V=r(T),z=t(M)&&!M.data.selectedPendingFeature||o(M)&&!M.activeFeature,I=i(M),W=M.shouldShowAttachments&&!V&&!T.activeRelationshipInput&&!T.activeAssociationInput,x=V?T.activeForm.inputs:T.inputs,D=t(M)&&x.every(e=>!e.visible)&&!W,H=null!=s.featureFormViewModel?.activeAssociationInput,P=!z&&!D&&!H,U=D||t(M)&&!W&&!P&&!H,E=n(T)?f:v?.render.bind(v),N=D?F(g,null,F(w,{headingLevel:a,key:"pending-feature-list",workflow:M})):F(j,null,F(d,{activeFeatureCount:C,messages:c,workflow:B}),I?F(g,{class:l.mergeFeaturesListSection,key:"panel-section-merge"},F(p,{headingLevel:a,key:"merge-features-list",workflow:M})):void 0,F(g,{key:"panel-content-section-main"},F(k,null,z?F(w,{headingLevel:a,key:"pending-feature-list",workflow:M}):E?.(),W?F("div",{key:"attachments"},F(h,{level:y(a)},c.attachments),m()):null)));return F(j,null,P?L(M,e):void 0,U?A?.():void 0,F(b,{key:"attribute-panel-content"},N),F(u,{buttons:S(e)}))}function L(e,t){const o=[],i="3d"===t.editorViewModel.view?.type,{visibleElements:n}=t,r="s";if(n.zoomToButton&&t.editorViewModel.canZoomTo&&o.push(F("calcite-action",{alignment:"center",icon:"zoom-to-object",key:"zoom-to-button",scale:r,text:t.messages.zoomTo,title:t.messages.zoomTo,onclick:()=>t.editorViewModel.zoomTo()})),n.splitButton&&s(e)&&e.supportsSplitFeatureWorkflow&&!i&&t.onSplit){const{onSplit:e,messages:i}=t;o.push(F("calcite-action",{icon:"split-geometry",key:"split-button",scale:r,text:i.split,title:i.split,onclick:e}))}if(n.mergeButton&&a(e)&&e.supportsMergeFeaturesWorkflow&&!i&&t.onMerge){const{onMerge:e,messages:i}=t;o.push(F("calcite-action",{icon:"merge",key:"merge-button",scale:r,text:i.mergeFeatures,title:i.mergeFeatures,onclick:e}))}return o.length>0?F("calcite-action-bar",{class:A(l.sketchContainer,l.updateActionBar),"data-testid":"update-feature-panel-action-bar",expandDisabled:!0,layout:"horizontal",scale:r},o):void 0}function S({editorViewModel:t,formWidget:o,messages:i,messagesCommon:s,onDelete:a,onDeleteAssociation:l,onSave:r}){const{activeFeatureCount:c,activeLeafWorkflow:u,syncing:p}=t;if(!u)return[];const{page:m}=t;if("viewing-associated-features"===m||"viewing-associated-layers"===m)return[{appearance:"outline",onClick:()=>{const e=u.formViewModel;n(e)?null!=e.associationId&&(e.associationId=null):e?.goBack()},disabled:p,label:s.cancel,type:"button"}];const d=t.formViewModel,f=o?.footerButtonInfos??[];if(d&&!n(d)&&"default"!==d.page)return f.map(({appearance:e,disabled:t,form:o,icon:i,kind:n,label:s,onclick:a})=>({appearance:e,disabled:t,form:o,icon:i,kind:n,label:s,onClick:a,type:"button"}));const g=[],k=c>1?i.multiFeature:i.singleFeature,b=!u.allowSave||p,w=e(k[u.saveActionLabel],{count:c});g.push({appearance:"solid",onClick:r,disabled:b,kind:"brand",label:w,type:"button"});const v={appearance:"outline",disabled:p,kind:"danger",label:e(k.delete,{count:c}),type:"button"};return t.shouldShowDeleteButton&&!t.formHasAssociation&&a&&g.push({...v,onClick:a}),t.formHasAssociation&&!t.shouldShowDeleteButton&&l&&g.push({...v,onClick:l,label:i.deleteAssociationTitle}),t.formHasAssociation&&t.shouldShowDeleteButton&&l&&a&&g.push({...v,primaryLabel:s.delete,primaryText:s.delete,onClick:a,dropdownItems:[{onClick:l,label:i.deleteAssociationTitle}],type:"split-button"}),g}export{M as UpdateFeaturePanelContent,C as loadUpdateFeaturePanelContentComponents};
2
+ import{substitute as e}from"../../../intl/substitute.js";import{isNextOrLegacyCreateFeaturesWorkflow as t,isNextOrLegacySplitFeatureWorkflow as o,isNextOrLegacyMergeFeaturesWorkflow as i,isLegacyFeatureFormViewModel as n,isNextOrLegacyUpdateFeatureWorkflow as s,isNextOrLegacyUpdateFeaturesWorkflow as a}from"../compatibilityAdapters.js";import{css as l}from"../css.js";import{isBatchAttributeFormViewModel as r}from"../workflowUtils.js";import{loadFooterActionsComponents as c,FooterActions as u}from"./FooterActions.js";import p from"./MergeFeaturesList.js";import{loadNoticesComponents as m,Notices as d}from"./Notices.js";import{loadPanelContentComponents as f,PanelContentSection as g,PanelContentSectionGroup as k,PanelContent as b}from"./PanelContent.js";import w from"./PendingFeatureList.js";import{loadCalciteComponents as v}from"../../support/componentsUtils.js";import{Heading as h,incrementHeadingLevel as y}from"../../support/Heading.js";import{tsx as F,tsxFragment as j}from"../../support/widget.js";import{classes as A}from"../../support/widgetUtils.js";const C=()=>Promise.all([v({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),action:()=>import("@esri/calcite-components/dist/components/calcite-action")}),c(),m(),f()]);function M(e){const{editorViewModel:s,headingLevel:a,messages:c,renderAttachments:m,renderFeatureForm:f,formWidget:v,renderSketchToolbar:A}=e,{activeFeatureCount:C,activeLeafWorkflow:M,activeWorkflow:B,formViewModel:T}=s;if(!M||!B||!T)return null;const V=r(T),z=t(M)&&!M.data.selectedPendingFeature||o(M)&&!M.activeFeature,I=i(M),W=M.shouldShowAttachments&&!V&&!T.activeRelationshipInput&&!T.activeAssociationInput,x=V?T.activeForm.inputs:T.inputs,D=t(M)&&x.every(e=>!e.visible)&&!W,H=null!=s.featureFormViewModel?.activeAssociationInput,P=!z&&!D&&!H,U=D||t(M)&&!W&&!P&&!H,E=n(T)?f:v?.render.bind(v),N=D?F(g,null,F(w,{headingLevel:a,key:"pending-feature-list",workflow:M})):F(j,null,F(d,{activeFeatureCount:C,messages:c,workflow:B}),I?F(g,{class:l.mergeFeaturesListSection,key:"panel-section-merge"},F(p,{headingLevel:a,key:"merge-features-list",workflow:M})):void 0,F(g,{key:"panel-content-section-main"},F(k,null,z?F(w,{headingLevel:a,key:"pending-feature-list",workflow:M}):E?.(),W?F("div",{key:"attachments"},F(h,{level:y(a)},c.attachments),m()):null)));return F(j,null,P?S(M,e):void 0,U?A?.():void 0,F(b,{key:"attribute-panel-content"},N),F(u,{buttons:L(e)}))}function S(e,t){const o=[],i="3d"===t.editorViewModel.view?.type,{visibleElements:n}=t,r="s";if(n.zoomToButton&&t.editorViewModel.canZoomTo&&o.push(F("calcite-action",{alignment:"center",icon:"zoom-to-object",key:"zoom-to-button",scale:r,text:t.messages.zoomTo,title:t.messages.zoomTo,onclick:()=>t.editorViewModel.zoomTo()})),n.splitButton&&s(e)&&e.supportsSplitFeatureWorkflow&&!i&&t.onSplit){const{onSplit:e,messages:i}=t;o.push(F("calcite-action",{icon:"split-geometry",key:"split-button",scale:r,text:i.split,title:i.split,onclick:e}))}if(n.mergeButton&&a(e)&&e.supportsMergeFeaturesWorkflow&&!i&&t.onMerge){const{onMerge:e,messages:i}=t;o.push(F("calcite-action",{icon:"merge",key:"merge-button",scale:r,text:i.mergeFeatures,title:i.mergeFeatures,onclick:e}))}return o.length>0?F("calcite-action-bar",{class:A(l.sketchContainer,l.updateActionBar),"data-testid":"update-feature-panel-action-bar",expandDisabled:!0,layout:"horizontal",scale:r},o):void 0}function L({editorViewModel:t,formWidget:o,messages:i,messagesCommon:s,disallowSave:a,onDelete:l,onDeleteAssociation:r,onSave:c}){const{activeFeatureCount:u,activeLeafWorkflow:p,syncing:m}=t;if(!p)return[];const{page:d}=t;if("viewing-associated-features"===d||"viewing-associated-layers"===d)return[{appearance:"outline",onClick:()=>{const e=p.formViewModel;n(e)?null!=e.associationId&&(e.associationId=null):e?.goBack()},disabled:m,label:s.cancel,type:"button"}];const f=t.formViewModel,g=o?.footerButtonInfos??[];if(f&&!n(f)&&"default"!==f.page)return g.map(({appearance:e,disabled:t,form:o,icon:i,kind:n,label:s,onclick:a})=>({appearance:e,disabled:t,form:o,icon:i,kind:n,label:s,onClick:a,type:"button"}));const k=[],b=u>1?i.multiFeature:i.singleFeature,w=!p.allowSave||m,v=a||m,h=e(b[p.saveActionLabel],{count:u});k.push({appearance:"solid",onClick:w?()=>{}:c,disabled:v,kind:"brand",label:h,type:"button"});const y={appearance:"outline",disabled:m,kind:"danger",label:e(b.delete,{count:u}),type:"button"};return t.shouldShowDeleteButton&&!t.formHasAssociation&&l&&k.push({...y,onClick:l}),t.formHasAssociation&&!t.shouldShowDeleteButton&&r&&k.push({...y,onClick:r,label:i.deleteAssociationTitle}),t.formHasAssociation&&t.shouldShowDeleteButton&&r&&l&&k.push({...y,primaryLabel:s.delete,primaryText:s.delete,onClick:l,dropdownItems:[{onClick:r,label:i.deleteAssociationTitle}],type:"split-button"}),k}export{M as UpdateFeaturePanelContent,C as loadUpdateFeaturePanelContentComponents};
package/widgets/Editor.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i,deprecatedFunction as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{destroyMaybe as r,abortMaybe as a,mappedFind as n}from"../core/maybe.js";import{watch as l,initial as c,on as d,when as h}from"../core/reactiveUtils.js";import{property as m,subclass as p}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../core/support/UpdatingHandles.js";import g from"../views/interactive/sketch/SketchLabelOptions.js";import w from"../views/interactive/sketch/SketchTooltipOptions.js";import v from"../views/interactive/sketch/SketchValueOptions.js";import _ from"../views/interactive/snapping/SnappingOptions.js";import f from"./Attachments.js";import y from"./BatchAttributeForm.js";import b from"./FeatureForm.js";import k from"./FeatureTemplates.js";import M from"./Spinner.js";import F from"./Widget.js";import A from"./BatchAttributeForm/VisibleElements.js";import{isNextOrLegacyUpdateWorkflow as S,isNextOrLegacyUpdateFeaturesWorkflow as T,isNextOrLegacyUpdateFeatureWorkflow as C}from"./Editor/compatibilityAdapters.js";import{css as L}from"./Editor/css.js";import W from"./Editor/EditorViewModel.js";import{isModelUpload as E}from"./Editor/modelUploadUtils.js";import P from"./Editor/VisibleElements.js";import{findEditorItemForLayer as I,isBatchAttributeFormViewModel as U}from"./Editor/workflowUtils.js";import{loadCreateFeaturesPanelContentComponents as j,CreateFeaturesPanelContent as V}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as D,FeatureList as x}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as O,FooterActions as B}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as N,Notice as H}from"./Editor/components/Notices.js";import{loadPanelContentComponents as G,PanelContent as R,PanelContentSection as z,PanelContentMessage as q}from"./Editor/components/PanelContent.js";import{PanelToolbar as K,loadPanelToolbarComponents as Z}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as $,Prompt as J}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as Q,UpdateFeaturePanelContent as X}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as Y,UploadDetails as ee}from"./Editor/components/UploadDetails.js";import te from"./Sketch/CreateToolVisibilityMap.js";import ie from"./Sketch/SelectionToolVisibilityMap.js";import se from"./Sketch/VisibleElements.js";import{loadCalciteComponents as oe}from"./support/componentsUtils.js";import{globalCss as re}from"./support/globalCss.js";import{incrementHeadingLevel as ae,Heading as ne}from"./support/Heading.js";import{renderItem as le}from"./support/ItemList.js";import{connectDelayedLoading as ce}from"./support/loaderUtils.js";import de from"./support/SelectionList.js";import he from"./support/SelectionToolbar.js";import{messageBundle as me,vmEvent as pe,tsx as ue}from"./support/widget.js";import{isLayerItem as ge}from"./support/SelectionList/selectionListUtils.js";import we from"./support/SelectionList/VisibleElements.js";import ve from"./support/SelectionToolbar/VisibleElements.js";const _e=Symbol("sketch-setup-handles");let fe=class extends F{constructor(e,s){super(e,s),this._batchAttributeForm=new y({suppressDeprecationWarning:!0,visibleElements:new A({loadingIndicator:!1})}),this._featureForm=new b({suppressDeprecationWarning:!0}),this._sketchToolbar=null,this._attachments=new f({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1},suppressDeprecationWarning:!0}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new k({suppressDeprecationWarning:!0,enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?ue("calcite-icon",{class:L.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new M,this._loading=!1,this._selectionList=new de({displayMode:"layer",itemActionConfigs:this._selectionListItemActionConfigs,itemUnavailableFunction:({item:e})=>!I(this.editorItems,e.layer)?.editable,onListItemSelect:({item:e})=>this._onSelectionListItemSelect(e),visibleElements:new we({header:!1})}),this._selectionToolbar=new he({visibleElements:new ve({chip:!1})}),this._updatingHandles=new u,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=null,this.visibleElements=new P,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectionList=()=>this._selectionList.render(),this._renderSelectionToolbar=()=>this._selectionToolbar.render(),this._renderSketch=()=>this._sketchToolbar?ue("div",{class:L.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>ue("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:i},...s)=>{const{visibleElements:o}=this;return ue("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:i,onCalciteFlowItemBack:this._onBack},o.settingsMenu?ue(K,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...s)},this._showConfirmationPrompt=e=>this._showPromptAndWait(this.messages[e]),this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,i={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&E(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&t.formViewModel?.activeAssociationsInput?this._showPromptAndWait({...i,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(i)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onMerge=()=>{const{activeWorkflow:e}=this.viewModel;if(S(e)){const t=e.activeWorkflow;T(t)&&e.startMergingFeatures(t.viewGraphics,{initialFeatures:t.data.initialFeatures})}},this._onSplit=()=>{const{activeWorkflow:e}=this.viewModel;if(S(e)){const t=e.activeWorkflow;if(C(t)){const i=t.viewGraphic;i&&e.startSplittingFeature(i,{initialFeature:t.data.edits.initialFeature??i})}}},this._onDelete=()=>{const e=this.viewModel.activeFeatureCount,i=e>1?this.messages.multiFeature:this.messages.singleFeature;this._showPrompt({title:i.deleteWarningTitle,message:i.deleteWarningMessage,context:"danger",actions:{primary:{label:t(i.delete,{count:e}),action:()=>{this.deleteFeatures(),this._clearPrompt()}},secondary:{label:i.keep,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then(()=>e.back()))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then(()=>e.back()))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})},this.viewModel=e?.viewModel||new W({useLegacyCreateTools:e?.useLegacyCreateTools??"3d"===e?.view?.type,formSystem:e?.formSystem??"legacy"}),this.announceDeprecation=()=>{i(o.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this._batchAttributeForm.showPrompt=this._showPrompt,this._batchAttributeForm.clearPrompt=this._clearPrompt,this.addHandles([l(()=>ae(this.headingLevel),e=>{this._batchAttributeForm.headingLevel=e,this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e},c),d(()=>this.viewModel.activeWorkflow,"cancel-request",({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then(t=>t?e.allow():e.deny())}),h(()=>this.viewModel.formViewModel,e=>{U(e)?this._batchAttributeForm.viewModel=e:this._featureForm.viewModel=e},c),h(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel,e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.consumePromise(this._initializeAssociationItemList(e))},c),h(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association,()=>{this._setUpAssociationSettings()}),l(()=>[this.viewModel,this.viewModel?.attachmentsViewModel,this.viewModel?.featureTemplatesViewModel,this.viewModel?.spinnerViewModel,this.viewModel?.selectionListViewModel,this.viewModel?.selectionToolbarViewModel],([e,t,i,s,o,r])=>{this._attachments.viewModel=t,this._featureTemplates.viewModel=i,this._spinner.viewModel=s,this._selectionList.viewModel=o,this._selectionToolbar.viewModel=r,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt,e.showConfirmationPrompt=this._showConfirmationPrompt},c),l(()=>this.view,(e,t)=>{const i=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,i),e?.ui.add(this._spinner,{key:i,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)},c),l(()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel],([e])=>{e&&(e.attachments&&this._attachments.set(e.attachments),e.batchAttributeForm&&this._batchAttributeForm.set(e.batchAttributeForm),e.featureForm&&this._featureForm.set(e.featureForm),e.featureTemplates&&this._featureTemplates.set(e.featureTemplates),e.selectionToolbar&&this._selectionToolbar.set(e.selectionToolbar),e.sketch&&this.viewModel.sketchViewModel?.set(e.sketch))},c),h(()=>this._attachments?.error,e=>this._onAttachmentsError(e)),h(()=>this._selectionListItemActionConfigs,()=>{this._selectionList.itemActionConfigs=this._selectionListItemActionConfigs}),h(()=>this.viewModel?.failures,e=>{const{messages:i}=this,[{error:s,retry:o,cancel:r}]=e;this._showPrompt({title:i.errorWarningTitle,message:t(i.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:i.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:i.ignore,action:()=>{r(),this._clearPrompt()}}}})}),l(()=>this.viewModel?.state,e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}}),l(()=>this.viewModel.formDisabled,e=>this._batchAttributeForm.readOnly=e),l(()=>this.visibleElements.sketch,()=>this._setupSketch(),c),l(()=>this.visibleElements.zoomToButton,e=>this._selectionList.visibleElements.zoomToButton=e,c),ce({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._selectionList.destroy(),this._selectionToolbar.destroy(),this._attachments.destroy(),this._batchAttributeForm.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._spinner.destroy(),this._sketchToolbar=r(this._sketchToolbar),this._sketchImportAbortController=a(this._sketchImportAbortController)}loadDependencies(){return Promise.all([oe({flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),j(),D(),O(),N(),G(),Z(),$(),Q(),Y()])}get _hasInvalidBatchSelection(){return this._hasSelectionWithUneditableFeatures||this._hasSelectionFromMultipleLayers||this._selectionCountExceedsMaximum||0===this._selectionList.visibleFeatureCount}get _hasSelectionFromMultipleLayers(){return this._selectionList.visibleLayerCount>1}get _hasSelectionWithUneditableFeatures(){const e=this.editorItems;return this._selectionList.visibleFeatureItems.some(t=>!I(e,t.layer))}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _selectionCountExceedsMaximum(){const e=this._batchAttributeForm.maximumFeatureCount,{activeLayerItem:t,effectiveCount:i,filterText:s,visibleFeatureCount:o}=this._selectionList;return null!=s&&""!==s?o>e:t?t.total>e:i>e}get _selectionListItemActionConfigs(){const{messages:e,visibleElements:t}=this,i=t?.mergeButton??!0;return[{label:e?.batchEditing?.editThisFeature,icon:"edit-attributes",type:"feature",hidden:({item:e})=>!I(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.editTheseFeatures,icon:"edit-attributes",type:"layer",hidden:({item:e})=>!I(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.mergeTheseFeatures,icon:"merge",type:"layer",hidden:!i||(({item:e})=>{if(!ge(e))return!0;const t=I(this.editorItems,e.layer);return!t||(!t.editable||!t.supportsMergeFeaturesWorkflow||e.visibleTotal<2)}),callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"merge")}]}get _visibleSelectionCount(){const{activeLayerItem:e,effectiveCount:t,filterText:i,visibleFeatureCount:s}=this._selectionList;return null!=i&&""!==i?s:e?e.total:t}get activeWorkflow(){return this.viewModel.activeWorkflow}get editorItems(){return this.viewModel.editorItems}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get syncWithViewSelectionManager(){return this.syncViewSelection}set syncWithViewSelectionManager(e){this.syncViewSelection=e}get syncViewSelection(){return this.viewModel.syncViewSelection}set syncViewSelection(e){this.viewModel.syncViewSelection=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get formSystem(){return this.viewModel.formSystem}set formSystem(e){this.viewModel.formSystem=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}activateSelectionTool(e){return this.viewModel.activateSelectionTool(e)}cancelSelectionTool(){this.viewModel.cancelSelectionTool()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startMergeFeaturesWorkflow(e,t={}){return this.viewModel.startMergeFeaturesWorkflow(e,t)}startSplitFeatureWorkflow(e,t={}){return this.viewModel.startSplitFeatureWorkflow(e,t)}async startUpdateFeaturesWorkflow(e){return this.viewModel.startUpdateFeaturesWorkflow(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}startUpdateWorkflowWithActiveSelection(){return this.viewModel.startUpdateWorkflowWithActiveSelection()}deleteFeatureFromWorkflow(){return s(o.getLogger(this),"Editor.deleteFeatureFromWorkflow is deprecated. Use Editor.deleteFeatures instead.",{version:"4.33",replacement:"Editor.deleteFeatures",warnOnce:!0}),this.deleteFeatures()}async deleteFeatures(){await this.viewModel.deleteFeatures()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,i=this.classes(L.base,re.widget,re.panel);if(!t)return ue("div",{class:i,key:"empty"});const{pageStack:s}=t,o=s.length-1,r=s.map((e,t)=>this._renderPage(e,t===o));return ue("div",{class:i,key:"base"},e.flow?ue("calcite-flow",{inert:!!this._prompt,key:"flow"},r):r,this._prompt?ue(J,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const i={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(i);case"viewing-selection-list":return this._renderSelectionListPage(i);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(i);case"creating-features-upload-details":return this._renderUploadDetails(i);case"creating-features":return this._renderCreatingFeatures(i);case"editing-existing-feature":case"editing-features":case"editing-attributes":case"choosing-key-feature":return this._renderUpdateFeature(i);case"awaiting-update-feature-candidate":return this._renderFeatureList(i);case"adding-attachment":return this._renderAttachmentAdding(i);case"editing-attachment":return this._renderAttachmentEditing(i);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(i);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(i);case"add-association-create-association":return this._renderAddAssociation(i);case"drawing-splitter-geometry":return this._renderDrawingSplitGeometry(i);case"reviewing-features":return this._renderReviewingSplitFeatures(i)}return ue("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:i}=this;return ue(t,{heading:i.selectTemplate,key:"templates-panel",...e},ue(R,{key:"feature-templates"},ue(z,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:i,messages:s}=this;if("create-features"!==i?.type)return null;const o=i.data.upload;return o?ue(t,{heading:s.createFeatures,key:"upload-details-panel",...e},ue(ee,{helpMessage:this._helpMessage,messages:s,upload:o})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:i,messages:s,messagesCommon:o,headingLevel:r,viewModel:a}=this;if(!i)return null;const n="create-features"===i.type&&i.numPendingFeatures>0||"update"===i.type&&"create-features"===i?.activeWorkflow?.type&&i.activeWorkflow?.numPendingFeatures>0;return ue(t,{heading:s.createFeatures,key:"create-features-panel",...e},n?ue(X,{editorViewModel:a,formWidget:this._batchAttributeForm,headingLevel:r,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):ue(V,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this,a=r.activeFeatureCount>1?i.multiFeature.editPanelTitle:i.singleFeature.editPanelTitle;return ue(t,{heading:a,key:"update-feature-panel",...e},ue(X,{editorViewModel:r,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onMerge:this._onMerge,onSave:this._onSave,onSplit:this._onSplit}))}_renderDrawingSplitGeometry(e){const{EditorPanel:t}=this;return ue(t,{heading:this.messages.splitFeature,key:"draw-split-geometry-panel",...e},ue(V,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderReviewingSplitFeatures(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this;return ue(t,{heading:i.splitFeature,key:"review-split-features-panel",...e},ue(X,{editorViewModel:r,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,visibleElements:this.visibleElements,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;if(e.title)return e.title;const{messagesFeature:i}=this;switch(e.type){case"attachment":return i.associationsAttachments;case"connectivity":return i.associationsConnectivity;case"structure":return i.associationsStructure;case"content":return i.associationsContents;case"container":return i.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;const i=t.associations;switch(e.type){case"attachment":return i.addAttachment;case"connectivity":return i.addConnectivity;case"structure":return i.addStructure;case"content":return i.addContent;case"container":return i.addContainer}}async _initializeAssociationItemList(e){const t=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js")).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js")).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this,a=r.formViewModel?.activeAssociationType,n=this._getAssociationTypeTitle(a);return ue(t,{heading:n,key:"viewing-associated-layers-panel",...e},ue(X,{editorViewModel:r,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this,r=s.utilityNetworkAssociationAddAssociationViewModel,a=this._getAddAssociationTypeTitle(r?.associationType),n="ready"!==r?.state||this.viewModel.formDisabled;return t?ue(i,{heading:a,key:"add-association-select-feature",...e},ue(R,{key:"select-feature"},ue(z,null,t.render())),ue(B,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:o.apply,disabled:n,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&(r?.reset(),s.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):ue(i,{heading:a,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),i=e.utilityNetworkAssociationAddAssociationViewModel,s="update"===e.activeWorkflow?.type?e.activeWorkflow:null,o=s?s.activeWorkflow:null,r="add-association"===o?.type?o.sourceFeatureItem:null,a=i?.selectedFeature,n=i?.association,l=i?.utilityNetwork;r&&a&&n&&l&&(t.sourceFeature=r,t.targetFeature=a,t.association=n,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this;if(!t)return null;const r=s.utilityNetworkAssociationAddAssociationViewModel,a=this._getAddAssociationTypeTitle(r?.associationType),n="ready"!==r?.state;return ue(i,{heading:a,key:"add-association",...e},ue(R,{key:"add-association-content"},ue(z,null,t.render())),ue(B,{buttons:[{label:o.add,disabled:n||!r.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&s.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:i}=this,s=n(e.group.items,e=>i.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0);return s?ue(H,{kind:"warning",message:s}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:i,messages:s,messagesCommon:o}=this;return ue(t,{heading:s.addAttachment,key:"attachment-adding-panel",...e},ue(R,{key:"attachments"},this._renderAttachments()),ue(B,{buttons:[{label:i.submitting?o.cancel:o.add,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderSelectionListPage(e){const{_hasSelectionFromMultipleLayers:i,_hasInvalidBatchSelection:s,_selectionCountExceedsMaximum:o,_selectionList:r,_visibleSelectionCount:a,messages:n,EditorPanel:l}=this,{batchUpdateActions:c}=this.visibleElements,{maxVisibleFeatureCountPerLayer:d}=r;return ue(l,{heading:n.widgetLabel,key:"selection-list-panel",...e},this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?ue("div",{class:L.selectionToolbarContainer},this._renderSelectionToolbar()):void 0,ue(R,{key:"selection-list"},ue(z,null,this._renderSelectionList())),ue(B,{buttons:[c?{label:t(n.batchEditing.editCount,{count:a}),disabled:s,onClick:()=>this.startUpdateWorkflowWithActiveSelection(),type:"button"}:void 0],notice:c&&i?{text:n.batchEditing.selectOneLayer,icon:"information"}:c&&o?{text:t(this.messages.multiFeature.formFailedToLoadTooManyFeatures,{num:d}),icon:"information"}:void 0}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:i,activeWorkflow:s,messages:o,messagesCommon:r}=this;return s?ue(t,{heading:o.editAttachment,key:"attachment-editing-panel",...e},ue(R,{key:"attachments"},this._renderAttachments()),s.shouldAllowAttachmentEditing?ue(B,{buttons:[{label:r.update,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:i.submitting,label:r.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:i,visibleElements:s}=this,o=this._helpMessage;return ue(t,{heading:i.widgetLabel,key:"landing-panel",...e},ue(R,{key:"landing-content"},this.editorItems.length?[s.editFeaturesSection?ue(z,{key:"edit-actions"},this._renderUpdateActions()):null,s.createFeaturesSection&&this.viewModel.canCreateVisible?ue(z,{key:"create-actions"},this._renderCreateActions()):null]:ue(q,{key:"no-content"},i.noEditableLayers)),o?ue("div",{class:L.helpMessage,key:"footer-actions",slot:"footer"},o):void 0)}get _helpMessage(){return this.getHelpMessageString(this.activeWorkflow?.helpMessage)}get _noticeMessage(){return this.getHelpMessageString(this.activeWorkflow?.noticeMessage)}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:i}=this,s={id:"select",label:t.select};return ue("div",{class:L.updateActions,key:"update-actions"},ue(ne,{level:ae(this.headingLevel)},e.editFeatures),this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?ue("div",{class:L.selectionToolbarContainer},this._renderSelectionToolbar()):ue("calcite-list",{class:L.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},le({disabled:!i.canUpdateVisible,grouped:!1,item:s,selectedItem:"awaiting-feature-to-update"===i.activeWorkflow?.stepId?s:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return ue("div",{key:"create-actions"},ue(ne,{level:ae(this.headingLevel)},this.messages.createFeatures),ue("div",{class:L.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:i,viewModel:s}=this,{activeWorkflow:o}=s;if("update"!==o?.type)return null;const r=o.data.candidates,a=t(this.messages.multipleFeaturesTemplate,{total:r.length});return ue(i,{heading:a,key:"feature-list",...e},ue(x,{editorItems:this.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:o,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:i,noLabel:s}){const o=Promise.withResolvers(),{view:r}=this,a=r?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:i,action:()=>o.resolve(!0)},secondary:{label:s,action:()=>o.resolve(!1)}}}),o.promise.finally(()=>{this._clearPrompt(),a&&r?.focus()})}async _onSelectionListItemSelect(e){await this.viewModel.onSelectionListItemSelect(e)}async _onSelectionListMenuItemSelect(e,t){await this.viewModel.onSelectionListMenuItemSelect(e,t)}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=a(this._sketchImportAbortController),this._sketchToolbar=r(this._sketchToolbar),void this.removeHandles(_e);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const t=await import("./Sketch.js");if(!e.signal.aborted)try{this._sketchToolbar=new t.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",suppressDeprecationWarning:!0,visibleElements:new se({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,singlePluginBackButton:!1,createTools:new te({freehandPolygon:!0,freehandPolyline:!0}),selectionTools:new ie({"lasso-selection":!1,"rectangle-selection":!1}),geometrySimplificationActivityIndicator:!1})}),this.addHandles([l(()=>{const e=this.viewModel.activeLeafWorkflow;return e&&"availableCreateTools"in e?e.availableCreateTools:null},e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)},c),l(()=>this.visibleElements.undoRedoButtons,e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)},c),h(()=>this.viewModel?.sketchViewModel,e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)},c),h(()=>this.viewModel.sketchViewModel?.pluginManager,e=>{e.sketch=this._sketchToolbar},c)],_e)}finally{this._sketchImportAbortController=null}}getHelpMessageString(e){const{messages:t,view:i}=this;if("curveToolDensifyWarning"===e)return t.curveToolDensifyWarning;return e?t["3d"===i?.type?"helpMessages3d":"helpMessages2d"]?.[e]:void 0}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([m()],fe.prototype,"_batchAttributeForm",void 0),e([m()],fe.prototype,"_featureForm",void 0),e([m()],fe.prototype,"_sketchToolbar",void 0),e([m()],fe.prototype,"_attachments",void 0),e([m()],fe.prototype,"_associationItemList",void 0),e([m()],fe.prototype,"_associationSettings",void 0),e([m()],fe.prototype,"_featureTemplates",void 0),e([m()],fe.prototype,"_filterText",void 0),e([m()],fe.prototype,"_hasInvalidBatchSelection",null),e([m()],fe.prototype,"_hasSelectionFromMultipleLayers",null),e([m()],fe.prototype,"_hasSelectionWithUneditableFeatures",null),e([m()],fe.prototype,"_prompt",void 0),e([m()],fe.prototype,"_spinner",void 0),e([m()],fe.prototype,"_deleteButtonCommonInfo",null),e([m()],fe.prototype,"_loading",void 0),e([m()],fe.prototype,"_selectionCountExceedsMaximum",null),e([m()],fe.prototype,"_selectionList",void 0),e([m()],fe.prototype,"_selectionListItemActionConfigs",null),e([m()],fe.prototype,"_selectionToolbar",void 0),e([m()],fe.prototype,"_visibleSelectionCount",null),e([m({readOnly:!0})],fe.prototype,"activeWorkflow",null),e([m()],fe.prototype,"editorItems",null),e([m()],fe.prototype,"effectiveSelectionManager",null),e([m()],fe.prototype,"headingLevel",void 0),e([m()],fe.prototype,"hideTemplatesForInactiveLayers",null),e([m()],fe.prototype,"icon",null),e([m()],fe.prototype,"label",null),e([m({type:g})],fe.prototype,"labelOptions",null),e([m()],fe.prototype,"layerInfos",null),e([m(),me("esri/widgets/Editor/t9n/Editor")],fe.prototype,"messages",void 0),e([m(),me("esri/t9n/common")],fe.prototype,"messagesCommon",void 0),e([m(),me("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],fe.prototype,"messagesTemplates",void 0),e([m(),me("esri/widgets/Feature/t9n/Feature")],fe.prototype,"messagesFeature",void 0),e([m()],fe.prototype,"selectionManager",null),e([m({type:_})],fe.prototype,"snappingOptions",null),e([m()],fe.prototype,"syncWithViewSelectionManager",null),e([m()],fe.prototype,"syncViewSelection",null),e([m({type:w})],fe.prototype,"tooltipOptions",null),e([m()],fe.prototype,"supportingWidgetDefaults",void 0),e([m({type:v,nonNullable:!0})],fe.prototype,"valueOptions",null),e([m({value:!1})],fe.prototype,"useLegacyCreateTools",null),e([m()],fe.prototype,"formSystem",null),e([m()],fe.prototype,"isUsingLegacyCreateTools",null),e([m()],fe.prototype,"view",null),e([m({type:W}),pe(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],fe.prototype,"viewModel",void 0),e([m({type:P,nonNullable:!0})],fe.prototype,"visibleElements",void 0),e([m()],fe.prototype,"_helpMessage",null),e([m()],fe.prototype,"_noticeMessage",null),fe=e([p("esri.widgets.Editor")],fe);const ye=fe;export{ye as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i,deprecatedFunction as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{destroyMaybe as a,abortMaybe as r,mappedFind as n}from"../core/maybe.js";import{watch as l,initial as c,on as d,when as h}from"../core/reactiveUtils.js";import{property as m,subclass as p}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../core/support/UpdatingHandles.js";import g from"../views/interactive/sketch/SketchLabelOptions.js";import w from"../views/interactive/sketch/SketchTooltipOptions.js";import v from"../views/interactive/sketch/SketchValueOptions.js";import _ from"../views/interactive/snapping/SnappingOptions.js";import f from"./Attachments.js";import y from"./BatchAttributeForm.js";import b from"./FeatureForm.js";import k from"./FeatureTemplates.js";import M from"./Spinner.js";import F from"./Widget.js";import A from"./BatchAttributeForm/VisibleElements.js";import{isNextOrLegacyUpdateWorkflow as S,isNextOrLegacyUpdateFeaturesWorkflow as T,isNextOrLegacyUpdateFeatureWorkflow as C}from"./Editor/compatibilityAdapters.js";import{css as L}from"./Editor/css.js";import W from"./Editor/EditorViewModel.js";import{isModelUpload as E}from"./Editor/modelUploadUtils.js";import P from"./Editor/VisibleElements.js";import{findEditorItemForLayer as I,isBatchAttributeFormViewModel as U}from"./Editor/workflowUtils.js";import{loadCreateFeaturesPanelContentComponents as j,CreateFeaturesPanelContent as V}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as D,FeatureList as x}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as O,FooterActions as B}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as N,Notice as H}from"./Editor/components/Notices.js";import{loadPanelContentComponents as G,PanelContent as R,PanelContentSection as z,PanelContentMessage as q}from"./Editor/components/PanelContent.js";import{PanelToolbar as K,loadPanelToolbarComponents as Z}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as $,Prompt as J}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as Q,UpdateFeaturePanelContent as X}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as Y,UploadDetails as ee}from"./Editor/components/UploadDetails.js";import te from"./Sketch/CreateToolVisibilityMap.js";import ie from"./Sketch/SelectionToolVisibilityMap.js";import se from"./Sketch/VisibleElements.js";import{loadCalciteComponents as oe}from"./support/componentsUtils.js";import{globalCss as ae}from"./support/globalCss.js";import{incrementHeadingLevel as re,Heading as ne}from"./support/Heading.js";import{renderItem as le}from"./support/ItemList.js";import{connectDelayedLoading as ce}from"./support/loaderUtils.js";import de from"./support/SelectionList.js";import he from"./support/SelectionToolbar.js";import{messageBundle as me,vmEvent as pe,tsx as ue}from"./support/widget.js";import{isLayerItem as ge}from"./support/SelectionList/selectionListUtils.js";import we from"./support/SelectionList/VisibleElements.js";import ve from"./support/SelectionToolbar/VisibleElements.js";const _e=Symbol("sketch-setup-handles");let fe=class extends F{constructor(e,s){super(e,s),this._batchAttributeForm=new y({suppressDeprecationWarning:!0,visibleElements:new A({loadingIndicator:!1})}),this._featureForm=new b({suppressDeprecationWarning:!0}),this._sketchToolbar=null,this._attachments=new f({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1},suppressDeprecationWarning:!0}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new k({suppressDeprecationWarning:!0,enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?ue("calcite-icon",{class:L.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new M,this._loading=!1,this._disallowSave=!1,this._selectionList=new de({displayMode:"layer",itemActionConfigs:this._selectionListItemActionConfigs,itemUnavailableFunction:({item:e})=>!I(this.editorItems,e.layer)?.editable,onListItemSelect:({item:e})=>this._onSelectionListItemSelect(e),visibleElements:new we({header:!1})}),this._selectionToolbar=new he({visibleElements:new ve({chip:!1})}),this._updatingHandles=new u,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=null,this.visibleElements=new P,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectionList=()=>this._selectionList.render(),this._renderSelectionToolbar=()=>this._selectionToolbar.render(),this._renderSketch=()=>this._sketchToolbar?ue("div",{class:L.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>ue("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:i},...s)=>{const{visibleElements:o}=this;return ue("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:i,onCalciteFlowItemBack:this._onBack},o.settingsMenu?ue(K,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...s)},this._showConfirmationPrompt=e=>this._showPromptAndWait(this.messages[e]),this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,i={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&E(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&t.formViewModel?.activeAssociationsInput?this._showPromptAndWait({...i,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(i)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onMerge=()=>{const{activeWorkflow:e}=this.viewModel;if(S(e)){const t=e.activeWorkflow;T(t)&&e.startMergingFeatures(t.viewGraphics,{initialFeatures:t.data.initialFeatures})}},this._onSplit=()=>{const{activeWorkflow:e}=this.viewModel;if(S(e)){const t=e.activeWorkflow;if(C(t)){const i=t.viewGraphic;i&&e.startSplittingFeature(i,{initialFeature:t.data.edits.initialFeature??i})}}},this._onDelete=()=>{const e=this.viewModel.activeFeatureCount,i=e>1?this.messages.multiFeature:this.messages.singleFeature;this._showPrompt({title:i.deleteWarningTitle,message:i.deleteWarningMessage,context:"danger",actions:{primary:{label:t(i.delete,{count:e}),action:()=>{this.deleteFeatures(),this._clearPrompt()}},secondary:{label:i.keep,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then(()=>e.back()))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then(()=>e.back()))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})},this.viewModel=e?.viewModel||new W({useLegacyCreateTools:e?.useLegacyCreateTools??"3d"===e?.view?.type,formSystem:e?.formSystem??"legacy"}),this.announceDeprecation=()=>{i(o.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this._batchAttributeForm.showPrompt=this._showPrompt,this._batchAttributeForm.clearPrompt=this._clearPrompt,this.addHandles([l(()=>re(this.headingLevel),e=>{this._batchAttributeForm.headingLevel=e,this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e},c),d(()=>this.viewModel.activeWorkflow,"cancel-request",({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then(t=>t?e.allow():e.deny())}),h(()=>this.viewModel.formViewModel,e=>{U(e)?this._batchAttributeForm.viewModel=e:this._featureForm.viewModel=e},c),h(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel,e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.consumePromise(this._initializeAssociationItemList(e))},c),h(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association,()=>{this._setUpAssociationSettings()}),l(()=>[this.viewModel,this.viewModel?.attachmentsViewModel,this.viewModel?.featureTemplatesViewModel,this.viewModel?.spinnerViewModel,this.viewModel?.selectionListViewModel,this.viewModel?.selectionToolbarViewModel],([e,t,i,s,o,a])=>{this._attachments.viewModel=t,this._featureTemplates.viewModel=i,this._spinner.viewModel=s,this._selectionList.viewModel=o,this._selectionToolbar.viewModel=a,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt,e.showConfirmationPrompt=this._showConfirmationPrompt},c),l(()=>this.view,(e,t)=>{const i=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,i),e?.ui.add(this._spinner,{key:i,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)},c),l(()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel],([e])=>{e&&(e.attachments&&this._attachments.set(e.attachments),e.batchAttributeForm&&this._batchAttributeForm.set(e.batchAttributeForm),e.featureForm&&this._featureForm.set(e.featureForm),e.featureTemplates&&this._featureTemplates.set(e.featureTemplates),e.selectionToolbar&&this._selectionToolbar.set(e.selectionToolbar),e.sketch&&this.viewModel.sketchViewModel?.set(e.sketch))},c),h(()=>this._attachments?.error,e=>this._onAttachmentsError(e)),h(()=>this._selectionListItemActionConfigs,()=>{this._selectionList.itemActionConfigs=this._selectionListItemActionConfigs}),h(()=>this.viewModel?.failures,e=>{const{messages:i}=this,[{error:s,retry:o,cancel:a}]=e;this._showPrompt({title:i.errorWarningTitle,message:t(i.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:i.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:i.ignore,action:()=>{a(),this._clearPrompt()}}}})}),l(()=>this.viewModel?.state,e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}}),l(()=>this.viewModel.formDisabled,e=>this._batchAttributeForm.readOnly=e),l(()=>this.visibleElements.sketch,()=>this._setupSketch(),c),l(()=>this.visibleElements.zoomToButton,e=>this._selectionList.visibleElements.zoomToButton=e,c),ce({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}}),ce({getLoading:()=>!this.viewModel.activeLeafWorkflow?.allowSave,setEffectiveLoading:e=>{this._disallowSave=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._selectionList.destroy(),this._selectionToolbar.destroy(),this._attachments.destroy(),this._batchAttributeForm.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._spinner.destroy(),this._sketchToolbar=a(this._sketchToolbar),this._sketchImportAbortController=r(this._sketchImportAbortController)}loadDependencies(){return Promise.all([oe({flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),j(),D(),O(),N(),G(),Z(),$(),Q(),Y()])}get _hasInvalidBatchSelection(){return this._hasSelectionWithUneditableFeatures||this._hasSelectionFromMultipleLayers||this._selectionCountExceedsMaximum||0===this._selectionList.visibleFeatureCount}get _hasSelectionFromMultipleLayers(){return this._selectionList.visibleLayerCount>1}get _hasSelectionWithUneditableFeatures(){const e=this.editorItems;return this._selectionList.visibleFeatureItems.some(t=>!I(e,t.layer))}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _selectionCountExceedsMaximum(){const e=this._batchAttributeForm.maximumFeatureCount,{activeLayerItem:t,effectiveCount:i,filterText:s,visibleFeatureCount:o}=this._selectionList;return null!=s&&""!==s?o>e:t?t.total>e:i>e}get _selectionListItemActionConfigs(){const{messages:e,visibleElements:t}=this,i=t?.mergeButton??!0;return[{label:e?.batchEditing?.editThisFeature,icon:"edit-attributes",type:"feature",hidden:({item:e})=>!I(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.editTheseFeatures,icon:"edit-attributes",type:"layer",hidden:({item:e})=>!I(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.mergeTheseFeatures,icon:"merge",type:"layer",hidden:!i||(({item:e})=>{if(!ge(e))return!0;const t=I(this.editorItems,e.layer);return!t||(!t.editable||!t.supportsMergeFeaturesWorkflow||e.visibleTotal<2)}),callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"merge")}]}get _visibleSelectionCount(){const{activeLayerItem:e,effectiveCount:t,filterText:i,visibleFeatureCount:s}=this._selectionList;return null!=i&&""!==i?s:e?e.total:t}get activeWorkflow(){return this.viewModel.activeWorkflow}get editorItems(){return this.viewModel.editorItems}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get syncWithViewSelectionManager(){return this.syncViewSelection}set syncWithViewSelectionManager(e){this.syncViewSelection=e}get syncViewSelection(){return this.viewModel.syncViewSelection}set syncViewSelection(e){this.viewModel.syncViewSelection=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get formSystem(){return this.viewModel.formSystem}set formSystem(e){this.viewModel.formSystem=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}activateSelectionTool(e){return this.viewModel.activateSelectionTool(e)}cancelSelectionTool(){this.viewModel.cancelSelectionTool()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startMergeFeaturesWorkflow(e,t={}){return this.viewModel.startMergeFeaturesWorkflow(e,t)}startSplitFeatureWorkflow(e,t={}){return this.viewModel.startSplitFeatureWorkflow(e,t)}async startUpdateFeaturesWorkflow(e){return this.viewModel.startUpdateFeaturesWorkflow(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}startUpdateWorkflowWithActiveSelection(){return this.viewModel.startUpdateWorkflowWithActiveSelection()}deleteFeatureFromWorkflow(){return s(o.getLogger(this),"Editor.deleteFeatureFromWorkflow is deprecated. Use Editor.deleteFeatures instead.",{version:"4.33",replacement:"Editor.deleteFeatures",warnOnce:!0}),this.deleteFeatures()}async deleteFeatures(){await this.viewModel.deleteFeatures()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,i=this.classes(L.base,ae.widget,ae.panel);if(!t)return ue("div",{class:i,key:"empty"});const{pageStack:s}=t,o=s.length-1,a=s.map((e,t)=>this._renderPage(e,t===o));return ue("div",{class:i,key:"base"},e.flow?ue("calcite-flow",{inert:!!this._prompt,key:"flow"},a):a,this._prompt?ue(J,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const i={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(i);case"viewing-selection-list":return this._renderSelectionListPage(i);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(i);case"creating-features-upload-details":return this._renderUploadDetails(i);case"creating-features":return this._renderCreatingFeatures(i);case"editing-existing-feature":case"editing-features":case"editing-attributes":case"choosing-key-feature":return this._renderUpdateFeature(i);case"awaiting-update-feature-candidate":return this._renderFeatureList(i);case"adding-attachment":return this._renderAttachmentAdding(i);case"editing-attachment":return this._renderAttachmentEditing(i);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(i);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(i);case"add-association-create-association":return this._renderAddAssociation(i);case"drawing-splitter-geometry":return this._renderDrawingSplitGeometry(i);case"reviewing-features":return this._renderReviewingSplitFeatures(i)}return ue("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:i}=this;return ue(t,{heading:i.selectTemplate,key:"templates-panel",...e},ue(R,{key:"feature-templates"},ue(z,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:i,messages:s}=this;if("create-features"!==i?.type)return null;const o=i.data.upload;return o?ue(t,{heading:s.createFeatures,key:"upload-details-panel",...e},ue(ee,{helpMessage:this._helpMessage,messages:s,upload:o})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:i,messages:s,messagesCommon:o,headingLevel:a,viewModel:r}=this;if(!i)return null;const n="create-features"===i.type&&i.numPendingFeatures>0||"update"===i.type&&"create-features"===i?.activeWorkflow?.type&&i.activeWorkflow?.numPendingFeatures>0;return ue(t,{heading:s.createFeatures,key:"create-features-panel",...e},n?ue(X,{disallowSave:this._disallowSave,editorViewModel:r,formWidget:this._batchAttributeForm,headingLevel:a,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):ue(V,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:a}=this,r=a.activeFeatureCount>1?i.multiFeature.editPanelTitle:i.singleFeature.editPanelTitle;return ue(t,{heading:r,key:"update-feature-panel",...e},ue(X,{disallowSave:this._disallowSave,editorViewModel:a,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onMerge:this._onMerge,onSave:this._onSave,onSplit:this._onSplit}))}_renderDrawingSplitGeometry(e){const{EditorPanel:t}=this;return ue(t,{heading:this.messages.splitFeature,key:"draw-split-geometry-panel",...e},ue(V,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderReviewingSplitFeatures(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:a}=this;return ue(t,{heading:i.splitFeature,key:"review-split-features-panel",...e},ue(X,{disallowSave:this._disallowSave,editorViewModel:a,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,visibleElements:this.visibleElements,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;if(e.title)return e.title;const{messagesFeature:i}=this;switch(e.type){case"attachment":return i.associationsAttachments;case"connectivity":return i.associationsConnectivity;case"structure":return i.associationsStructure;case"content":return i.associationsContents;case"container":return i.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;const i=t.associations;switch(e.type){case"attachment":return i.addAttachment;case"connectivity":return i.addConnectivity;case"structure":return i.addStructure;case"content":return i.addContent;case"container":return i.addContainer}}async _initializeAssociationItemList(e){const t=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js")).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js")).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:a}=this,r=a.formViewModel?.activeAssociationType,n=this._getAssociationTypeTitle(r);return ue(t,{heading:n,key:"viewing-associated-layers-panel",...e},ue(X,{disallowSave:this._disallowSave,editorViewModel:a,formWidget:this._batchAttributeForm,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderFeatureForm:this._featureForm?.render,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this,a=s.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state||this.viewModel.formDisabled;return t?ue(i,{heading:r,key:"add-association-select-feature",...e},ue(R,{key:"select-feature"},ue(z,null,t.render())),ue(B,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:o.apply,disabled:n,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&(a?.reset(),s.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):ue(i,{heading:r,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),i=e.utilityNetworkAssociationAddAssociationViewModel,s="update"===e.activeWorkflow?.type?e.activeWorkflow:null,o=s?s.activeWorkflow:null,a="add-association"===o?.type?o.sourceFeatureItem:null,r=i?.selectedFeature,n=i?.association,l=i?.utilityNetwork;a&&r&&n&&l&&(t.sourceFeature=a,t.targetFeature=r,t.association=n,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this;if(!t)return null;const a=s.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state;return ue(i,{heading:r,key:"add-association",...e},ue(R,{key:"add-association-content"},ue(z,null,t.render())),ue(B,{buttons:[{label:o.add,disabled:n||!a.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&s.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:i}=this,s=n(e.group.items,e=>i.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0);return s?ue(H,{kind:"warning",message:s}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:i,messages:s,messagesCommon:o}=this;return ue(t,{heading:s.addAttachment,key:"attachment-adding-panel",...e},ue(R,{key:"attachments"},this._renderAttachments()),ue(B,{buttons:[{label:i.submitting?o.cancel:o.add,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderSelectionListPage(e){const{_hasSelectionFromMultipleLayers:i,_hasInvalidBatchSelection:s,_selectionCountExceedsMaximum:o,_selectionList:a,_visibleSelectionCount:r,messages:n,EditorPanel:l}=this,{batchUpdateActions:c}=this.visibleElements,{maxVisibleFeatureCountPerLayer:d}=a;return ue(l,{heading:n.widgetLabel,key:"selection-list-panel",...e},this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?ue("div",{class:L.selectionToolbarContainer},this._renderSelectionToolbar()):void 0,ue(R,{key:"selection-list"},ue(z,null,this._renderSelectionList())),ue(B,{buttons:[c?{label:t(n.batchEditing.editCount,{count:r}),disabled:s,onClick:()=>this.startUpdateWorkflowWithActiveSelection(),type:"button"}:void 0],notice:c&&i?{text:n.batchEditing.selectOneLayer,icon:"information"}:c&&o?{text:t(this.messages.multiFeature.formFailedToLoadTooManyFeatures,{num:d}),icon:"information"}:void 0}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:i,activeWorkflow:s,messages:o,messagesCommon:a}=this;return s?ue(t,{heading:o.editAttachment,key:"attachment-editing-panel",...e},ue(R,{key:"attachments"},this._renderAttachments()),s.shouldAllowAttachmentEditing?ue(B,{buttons:[{label:a.update,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:i.submitting,label:a.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:i,visibleElements:s}=this,o=this._helpMessage;return ue(t,{heading:i.widgetLabel,key:"landing-panel",...e},ue(R,{key:"landing-content"},this.editorItems.length?[s.editFeaturesSection?ue(z,{key:"edit-actions"},this._renderUpdateActions()):null,s.createFeaturesSection&&this.viewModel.canCreateVisible?ue(z,{key:"create-actions"},this._renderCreateActions()):null]:ue(q,{key:"no-content"},i.noEditableLayers)),o?ue("div",{class:L.helpMessage,key:"footer-actions",slot:"footer"},o):void 0)}get _helpMessage(){return this.getHelpMessageString(this.activeWorkflow?.helpMessage)}get _noticeMessage(){return this.getHelpMessageString(this.activeWorkflow?.noticeMessage)}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:i}=this,s={id:"select",label:t.select};return ue("div",{class:L.updateActions,key:"update-actions"},ue(ne,{level:re(this.headingLevel)},e.editFeatures),this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?ue("div",{class:L.selectionToolbarContainer},this._renderSelectionToolbar()):ue("calcite-list",{class:L.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},le({disabled:!i.canUpdateVisible,grouped:!1,item:s,selectedItem:"awaiting-feature-to-update"===i.activeWorkflow?.stepId?s:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return ue("div",{key:"create-actions"},ue(ne,{level:re(this.headingLevel)},this.messages.createFeatures),ue("div",{class:L.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:i,viewModel:s}=this,{activeWorkflow:o}=s;if("update"!==o?.type)return null;const a=o.data.candidates,r=t(this.messages.multipleFeaturesTemplate,{total:a.length});return ue(i,{heading:r,key:"feature-list",...e},ue(x,{editorItems:this.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:o,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:i,noLabel:s}){const o=Promise.withResolvers(),{view:a}=this,r=a?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:i,action:()=>o.resolve(!0)},secondary:{label:s,action:()=>o.resolve(!1)}}}),o.promise.finally(()=>{this._clearPrompt(),r&&a?.focus()})}async _onSelectionListItemSelect(e){await this.viewModel.onSelectionListItemSelect(e)}async _onSelectionListMenuItemSelect(e,t){await this.viewModel.onSelectionListMenuItemSelect(e,t)}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=r(this._sketchImportAbortController),this._sketchToolbar=a(this._sketchToolbar),void this.removeHandles(_e);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const t=await import("./Sketch.js");if(!e.signal.aborted)try{this._sketchToolbar=new t.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",suppressDeprecationWarning:!0,visibleElements:new se({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,singlePluginBackButton:!1,createTools:new te({freehandPolygon:!0,freehandPolyline:!0}),selectionTools:new ie({"lasso-selection":!1,"rectangle-selection":!1}),geometrySimplificationActivityIndicator:!1})}),this.addHandles([l(()=>{const e=this.viewModel.activeLeafWorkflow;return e&&"availableCreateTools"in e?e.availableCreateTools:null},e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)},c),l(()=>this.visibleElements.undoRedoButtons,e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)},c),h(()=>this.viewModel?.sketchViewModel,e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)},c),h(()=>this.viewModel.sketchViewModel?.pluginManager,e=>{e.sketch=this._sketchToolbar},c)],_e)}finally{this._sketchImportAbortController=null}}getHelpMessageString(e){const{messages:t,view:i}=this;if("curveToolDensifyWarning"===e)return t.curveToolDensifyWarning;return e?t["3d"===i?.type?"helpMessages3d":"helpMessages2d"]?.[e]:void 0}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([m()],fe.prototype,"_batchAttributeForm",void 0),e([m()],fe.prototype,"_featureForm",void 0),e([m()],fe.prototype,"_sketchToolbar",void 0),e([m()],fe.prototype,"_attachments",void 0),e([m()],fe.prototype,"_associationItemList",void 0),e([m()],fe.prototype,"_associationSettings",void 0),e([m()],fe.prototype,"_featureTemplates",void 0),e([m()],fe.prototype,"_filterText",void 0),e([m()],fe.prototype,"_hasInvalidBatchSelection",null),e([m()],fe.prototype,"_hasSelectionFromMultipleLayers",null),e([m()],fe.prototype,"_hasSelectionWithUneditableFeatures",null),e([m()],fe.prototype,"_prompt",void 0),e([m()],fe.prototype,"_spinner",void 0),e([m()],fe.prototype,"_deleteButtonCommonInfo",null),e([m()],fe.prototype,"_loading",void 0),e([m()],fe.prototype,"_disallowSave",void 0),e([m()],fe.prototype,"_selectionCountExceedsMaximum",null),e([m()],fe.prototype,"_selectionList",void 0),e([m()],fe.prototype,"_selectionListItemActionConfigs",null),e([m()],fe.prototype,"_selectionToolbar",void 0),e([m()],fe.prototype,"_visibleSelectionCount",null),e([m({readOnly:!0})],fe.prototype,"activeWorkflow",null),e([m()],fe.prototype,"editorItems",null),e([m()],fe.prototype,"effectiveSelectionManager",null),e([m()],fe.prototype,"headingLevel",void 0),e([m()],fe.prototype,"hideTemplatesForInactiveLayers",null),e([m()],fe.prototype,"icon",null),e([m()],fe.prototype,"label",null),e([m({type:g})],fe.prototype,"labelOptions",null),e([m()],fe.prototype,"layerInfos",null),e([m(),me("esri/widgets/Editor/t9n/Editor")],fe.prototype,"messages",void 0),e([m(),me("esri/t9n/common")],fe.prototype,"messagesCommon",void 0),e([m(),me("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],fe.prototype,"messagesTemplates",void 0),e([m(),me("esri/widgets/Feature/t9n/Feature")],fe.prototype,"messagesFeature",void 0),e([m()],fe.prototype,"selectionManager",null),e([m({type:_})],fe.prototype,"snappingOptions",null),e([m()],fe.prototype,"syncWithViewSelectionManager",null),e([m()],fe.prototype,"syncViewSelection",null),e([m({type:w})],fe.prototype,"tooltipOptions",null),e([m()],fe.prototype,"supportingWidgetDefaults",void 0),e([m({type:v,nonNullable:!0})],fe.prototype,"valueOptions",null),e([m({value:!1})],fe.prototype,"useLegacyCreateTools",null),e([m()],fe.prototype,"formSystem",null),e([m()],fe.prototype,"isUsingLegacyCreateTools",null),e([m()],fe.prototype,"view",null),e([m({type:W}),pe(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],fe.prototype,"viewModel",void 0),e([m({type:P,nonNullable:!0})],fe.prototype,"visibleElements",void 0),e([m()],fe.prototype,"_helpMessage",null),e([m()],fe.prototype,"_noticeMessage",null),fe=e([p("esri.widgets.Editor")],fe);const ye=fe;export{ye as default};