@arcgis/core 5.2.0-next.129 → 5.2.0-next.130
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.
- package/arcade/Feature.js +1 -1
- package/arcade/Voxel.js +1 -1
- package/arcade/functions/feature.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/051ccfea4268b357c44a.js +1 -0
- package/assets/esri/core/workers/chunks/1012cd1dff551025e605.js +1 -0
- package/assets/esri/core/workers/chunks/1538cfa272658871a3ad.js +1 -0
- package/assets/esri/core/workers/chunks/15f0cb6af89bafea61dc.js +1 -0
- package/assets/esri/core/workers/chunks/{8cb216404a6254bc695c.js → 18d5bad86ea3ef3ec747.js} +47 -47
- package/assets/esri/core/workers/chunks/{f652d1db26fbdea1a79b.js → 19fd46743daecd1f2dcb.js} +1 -1
- package/assets/esri/core/workers/chunks/{81327e10200065a0ccef.js → 1b5e0ab7e4f64a3aae09.js} +1 -1
- package/assets/esri/core/workers/chunks/1e66240ef0ae351d3275.js +1 -0
- package/assets/esri/core/workers/chunks/260fb3e021fe1a8e7ef1.js +1 -0
- package/assets/esri/core/workers/chunks/276cc95ae152ecf3048e.js +1 -0
- package/assets/esri/core/workers/chunks/34b6307fdd0226914dc4.js +1 -0
- package/assets/esri/core/workers/chunks/353acc00762b5ca450ef.js +1 -0
- package/assets/esri/core/workers/chunks/3df58dc89f2160893c66.js +1 -0
- package/assets/esri/core/workers/chunks/{1a02c68de65a67ab6a67.js → 550d8631450bb5eb7a6f.js} +1 -1
- package/assets/esri/core/workers/chunks/{f92178ac6dc9abff304f.js → 5f610ccf07bc73942b28.js} +1 -1
- package/assets/esri/core/workers/chunks/650618e7bfd932b9c5ff.js +1 -0
- package/assets/esri/core/workers/chunks/{cd1821bf601949674e02.js → 6ca2898aa500c81c7a8e.js} +1 -1
- package/assets/esri/core/workers/chunks/6fbc76b6e3494a09814e.js +1 -0
- package/assets/esri/core/workers/chunks/7185de70abe4face6f6e.js +1 -0
- package/assets/esri/core/workers/chunks/8048ce97ce22b32c454d.js +1 -0
- package/assets/esri/core/workers/chunks/9238409c942c24e26a0f.js +1 -0
- package/assets/esri/core/workers/chunks/{540acf6abdee9dbd453e.js → 92ec93287d4598377def.js} +1 -1
- package/assets/esri/core/workers/chunks/{88610ebfdf9c93ada781.js → 9c87a7f14298fd5e6c1d.js} +1 -1
- package/assets/esri/core/workers/chunks/a12773419465999fafe7.js +1 -0
- package/assets/esri/core/workers/chunks/{a3a5cb664bdb1db190dd.js → a61395db617fd26f048f.js} +1 -1
- package/assets/esri/core/workers/chunks/a826b7d9e6c59e951cb2.js +1 -0
- package/assets/esri/core/workers/chunks/a84cac7963ca3258bd75.js +1 -0
- package/assets/esri/core/workers/chunks/{c94bdfed831c775e04c0.js → abdb34cfaff49472223c.js} +1 -1
- package/assets/esri/core/workers/chunks/ba1d9d3cb90636dc9814.js +1 -0
- package/assets/esri/core/workers/chunks/bcab8bcb1fb1fd2aa65a.js +1 -0
- package/assets/esri/core/workers/chunks/d713c8d36cb7ed943003.js +1 -0
- package/assets/esri/core/workers/chunks/da8c881ea2dfcad8bbba.js +1 -0
- package/assets/esri/core/workers/chunks/ddafe5dfe178288ed721.js +1 -0
- package/assets/esri/core/workers/chunks/e5d2247187764c149854.js +1 -0
- package/assets/esri/core/workers/chunks/e706296a91780c665ab7.js +1 -0
- package/assets/esri/core/workers/chunks/e8a1abc881decf66e260.js +1 -0
- package/assets/esri/core/workers/chunks/ef527a7ea65fe6530a3e.js +1 -0
- package/assets/esri/core/workers/chunks/f5e24f1c38fe494585a8.js +1 -0
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ar.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.bg.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.bs.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ca.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.cs.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.da.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.de.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.el.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.es.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.et.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.fi.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.fr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.he.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.hr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.hu.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.id.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.it.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ja.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ko.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.lt.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.lv.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.nl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.no.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ro.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ru.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sk.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sv.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.th.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.tr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.uk.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.vi.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bg.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.da.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ja.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ko.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.no.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.vi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/messages.en.json +1 -1
- package/chunks/GlobalIllumination.glsl.js +1 -1
- package/config.js +1 -1
- package/geometry/support/heightModelInfoUtils.js +1 -1
- package/graphic/AggregateGraphicOrigin.js +1 -1
- package/graphic/AnnotationFeatureGraphicOrigin.js +1 -1
- package/graphic/BuildingGraphicOrigin.js +1 -1
- package/graphic/CSVGraphicOrigin.js +1 -1
- package/graphic/CatalogGraphicOrigin.js +1 -1
- package/graphic/DimensionFeatureGraphicOrigin.js +1 -1
- package/graphic/FeatureGraphicOrigin.js +1 -1
- package/graphic/GeoJSONGraphicOrigin.js +1 -1
- package/graphic/ImageryGraphicOrigin.js +1 -1
- package/graphic/ImageryTileGraphicOrigin.js +1 -1
- package/graphic/KnowledgeGraphGraphicOrigin.js +1 -1
- package/graphic/LinkChartGraphicOrigin.js +1 -1
- package/graphic/MapImageGraphicOrigin.js +1 -1
- package/graphic/OGCFeatureGraphicOrigin.js +1 -1
- package/graphic/OrientedImageryGraphicOrigin.js +1 -1
- package/graphic/ParquetGraphicOrigin.js +1 -1
- package/graphic/PointCloudGraphicOrigin.js +1 -1
- package/graphic/SceneGraphicOrigin.js +1 -1
- package/graphic/StreamGraphicOrigin.js +1 -1
- package/graphic/SubtypeGroupGraphicOrigin.js +1 -1
- package/graphic/TileGraphicOrigin.js +1 -1
- package/graphic/TrackGraphicOrigin.js +1 -1
- package/graphic/WCSGraphicOrigin.js +1 -1
- package/graphic/WFSGraphicOrigin.js +1 -1
- package/graphic/getArcadeFeatureSource.js +2 -0
- package/kernel.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/package.json +3 -3
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/selection/types.d.ts +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/videoViewerUtils.js +1 -1
- package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
- package/widgets/Sketch/support/PluginManager.js +1 -1
- package/widgets/support/SelectionList/FeatureItem.d.ts +14 -0
- package/widgets/support/SelectionList/FeatureItem.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/assets/esri/core/workers/chunks/06da350b4ea25732f52b.js +0 -1
- package/assets/esri/core/workers/chunks/0de140199161fcd15a0c.js +0 -1
- package/assets/esri/core/workers/chunks/0deceece4b465f653f58.js +0 -1
- package/assets/esri/core/workers/chunks/15dc28b4fa5b5110472b.js +0 -1
- package/assets/esri/core/workers/chunks/1beb32170d659bc43977.js +0 -1
- package/assets/esri/core/workers/chunks/237795866c075880531b.js +0 -1
- package/assets/esri/core/workers/chunks/25e4da9c6837ab0fa585.js +0 -1
- package/assets/esri/core/workers/chunks/28a04887ecaee5445d14.js +0 -1
- package/assets/esri/core/workers/chunks/2a5fde737dc99627142e.js +0 -1
- package/assets/esri/core/workers/chunks/323451ef52d0c2805f1d.js +0 -1
- package/assets/esri/core/workers/chunks/397ddcf0b8e858a17b70.js +0 -1
- package/assets/esri/core/workers/chunks/3d174a84b785fc633a5a.js +0 -1
- package/assets/esri/core/workers/chunks/5f794f4e0113d5dd50ba.js +0 -1
- package/assets/esri/core/workers/chunks/6994ba168465b77a36af.js +0 -1
- package/assets/esri/core/workers/chunks/7fccf53aa751cd9dae57.js +0 -1
- package/assets/esri/core/workers/chunks/88e11b645a1361f1bdbe.js +0 -1
- package/assets/esri/core/workers/chunks/8b0d6205ceeec1ab446f.js +0 -1
- package/assets/esri/core/workers/chunks/8dfea65341991e13ab71.js +0 -1
- package/assets/esri/core/workers/chunks/ab0b2a76247dfd56b92d.js +0 -1
- package/assets/esri/core/workers/chunks/ad372e399e20d5a3262d.js +0 -1
- package/assets/esri/core/workers/chunks/bb831d23422acfb00ae2.js +0 -1
- package/assets/esri/core/workers/chunks/bd231bc0624eb889ac14.js +0 -1
- package/assets/esri/core/workers/chunks/cf7b7e54cd87422ca62a.js +0 -1
- package/assets/esri/core/workers/chunks/df6992416cba9539f1ed.js +0 -1
- package/assets/esri/core/workers/chunks/e4005d95a396e1af9ac2.js +0 -1
- package/assets/esri/core/workers/chunks/ec187933b42fe65594b7.js +0 -1
- package/assets/esri/core/workers/chunks/f7ab606be37373312ebe.js +0 -1
- package/assets/esri/core/workers/chunks/fe1787a8d499832996b3.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as a}from"../core/deprecate.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{destroyMaybe as s}from"../core/maybe.js";import o from"../core/ReactiveMap.js";import{watch as l,when as r,on as c,sync as d}from"../core/reactiveUtils.js";import{formatFileSize as m}from"../core/unitFormatUtils.js";import{property as u,subclass as h}from"../core/accessorSupport/decorators.js";import{formatDate as p}from"../intl/date.js";import{isIntegerField as g}from"../layers/support/fieldUtils.js";import{isString as v}from"../support/guards.js";import b from"./Widget.js";import{getAttachmentTypeCategory as f,getCalciteIconForAttachment as _}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as C,isImageAttachment as y,getAttachmentFilenameParts as A}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as w,getMessageString as F,isElementTemplateWithInputType as I,subtypeChangeShouldPrompt as k,flattenInputs as M}from"./BatchAttributeForm/batchAttributeFormUtils.js";import x from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as D}from"./BatchAttributeForm/css.js";import{makeViewingEditedAttachmentFooterButtons as S,makeViewingAttachmentFooterButtons as E,makeCancelFooterButton as O,makeDefaultFooterButtons as T}from"./BatchAttributeForm/interfaceUtils.js";import L from"./BatchAttributeForm/VisibleElements.js";import{isDynamicChoiceController as V,isMultipleChoiceController as R}from"./BatchAttributeForm/inputs/support/controllerUtils.js";import{isGroupInput as N,isFieldInput as U,isTextElementInput as P,isRelationshipElementInput as B,isAttachmentElementInput as $,isUtilityNetworkAssociationsElementInput as z,differentValuesString as j,getNormalizedFieldName as H,isGroupedInput as W}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as G,otherChoiceCheckedPlaceholderValue as Z,canRestoreMultipleChoiceOtherChoiceDraftValue as q}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{loadRelationshipDetailsComponents as K,RelationshipDetails as X}from"./BatchAttributeForm/rendered-content/RelationshipDetails.js";import{Prompt as J}from"./Editor/components/Prompt.js";import{downloadAttachmentInfo as Q}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as Y}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as ee,getIntlOptionsForField as te,prepareISOFieldValueForDateComponents as ae,prepareUnixFieldValueForDateComponents as ie,normalizeTimeOnlyString as ne,getISOFieldValueFromDateComponents as se,getUnixFieldValueFromDateComponents as oe}from"./support/dateUtils.js";import{globalCss as le}from"./support/globalCss.js";import{Heading as re}from"./support/Heading.js";import{calciteListFilterProps as ce}from"./support/listUtils.js";import{messageBundle as de,vmEvent as me,tsx as ue}from"./support/widget.js";import{setFocus as he}from"./support/widgetUtils.js";import{isEmptyValue as pe}from"./support/forms/formUtils.js";const ge="data-element-id",ve="data-field-name",be="esri_BatchAttributeForm_select_all",fe="esri_BatchAttributeForm_other_choice";let _e=class extends b{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.featureTableMessages=null,this.messagesUnits=null,this.viewModel=new x,this.visibleElements=new L,this.groupDisplay="all",this._associationsList=null,this._associationsWidgetsMap=new o,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._dynamicChoiceItemSelections=new WeakSet,this._focusedFieldInput=null,this._pendingSubtypeChoice=null,this._batchSwitchInputInitialValues=new Map,this._listObserverNode=null,this._listObserver=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.viewModel.activeRelationshipInput?.incrementPage()},{root:window.document}),this._attachmentDialogInfo=null,this._attachmentListFilterText="",this._attachmentFileInputMap=new Map,this._prompt=null,this._selectedAttachmentReplaceFileInput=null,this._afterListObserverCreated=e=>{this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)},this._afterListObserverRemoved=()=>{this._listObserverNode=null},this._maximizeSelectedAttachment=()=>{this._attachmentDialogInfo=this.selectedAttachmentDetails},this._enterAttachmentReplaceView=()=>{const e=this.selectedAttachmentDetails;this._canReplaceSelectedAttachment()&&e&&(e.input.clearValidationCriteriaState(),this.viewModel.setShowingSelectedAttachmentReplacePage(!0))},this._setSelectedAttachmentReplaceFileInput=e=>{this._selectedAttachmentReplaceFileInput=e},this._openSelectedAttachmentReplaceFilePicker=()=>{this._canReplaceSelectedAttachment()&&this._selectedAttachmentReplaceFileInput?.click()},this._resetSelectedAttachmentName=()=>{const e=this.selectedAttachmentDetails;if(!e?.attachment)return;const t=e.input.getAttachmentEditState(e.attachment).initialName;if(null==t)return;const a=e.input.template.elementId,i=C(e.attachment);this.viewModel.stageRenameAttachment(a,i,t)},this._closeAttachmentDialog=()=>{this.hideAttachmentDialog()},this._saveInputFromElement=this._saveInputFromElement.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{a(i.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...a}=e;return a}initialize(){this.addHandles([l(()=>this.features.toArray(),()=>{this._dateComponentMap.clear(),G(this.viewModel,{includeDraftValues:!0})}),l(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),G(this.viewModel),this._setFocusableInput()}),l(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),r(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),l(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),l(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),c(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()}),l(()=>[this._associationsEnabled,this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs],()=>this._setUpAssociationsWidgets(),d),l(()=>this.viewModel.activeAssociationsInput,e=>this._onActiveAssociationsInputChange(e)),l(()=>this.groupDisplay,()=>this._syncGroupInputStates())])}loadDependencies(){return Promise.all([Y({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),autocomplete:()=>import("@esri/calcite-components/dist/components/calcite-autocomplete"),"autocomplete-item":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")}),K()])}destroy(){this._destroyAssociationsWidgets(),this._associationsList=s(this._associationsList),this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get effectiveTitle(){const{features:e,messages:t,page:a}=this;return t?"replacing-attachment"===a?t.titles.replaceAttachment:"viewing-attachment-details"===a?t.titles.editAttachment:"adding-attachments"===a?t.titles.addAttachments:"viewing-attachments"===a?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:"":""}get effectiveDisabled(){return this.disabledOrReadOnly||this.viewModel.updating}get disabledOrReadOnly(){return this.disabled||this.readOnly}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get footerButtonInfos(){if(!this.features.length||!this.messages||!this.messagesCommon)return[];const{messages:e,messagesCommon:t,page:a}=this,i=this.effectiveDisabled;if("adding-attachments"===a||"replacing-attachment"===a)return[];if("viewing-attachment-details"===a){const t=this.selectedAttachmentDetails,a=t?.input?.getAttachmentEditState(t.attachment);if(!t?.input||!a)return[];return a.isRenamed||a.isReplaced?S({doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons,resetOnclick:()=>this._resetSelectedAttachmentChanges(),resetDisabled:this._disableAttachmentModification(t.input)}):E({deleteDisabled:this._disableAttachmentModification(t.input),deleteOnclick:()=>this._deleteSelectedAttachment(),doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons})}return"viewing-associated-features"===a?O({messages:t,purpose:"cancel-viewing-associated-features",onclick:()=>this.goBack()}):"viewing-associated-layers"===a?O({messages:t,purpose:"cancel-viewing-associated-layers",onclick:()=>this.goBack()}):"viewing-attachments"===a||"viewing-related-records"===a?[]:T({disabled:i||!this.valid,formId:this._formId,messages:e,callback:()=>this.submit()})}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get page(){return this.viewModel.page}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get selectedAttachment(){return this.viewModel.selectedAttachment}get selectedAttachmentDetails(){return this.viewModel.selectedAttachmentDetails}get valid(){return this.viewModel.valid}get _formHeaderVisible(){return!("batch"===this.viewModel.mode||!this.viewModel.activeFeature)&&!(!this.viewModel.formDescription&&!this.viewModel.formTitle)}get _associationsEnabled(){const{callbacks:e}=this;return!(!e?.addAssociation&&!e?.editAssociatedFeature)}get _formId(){return`${this.id}-form`}get _relatedRecordsEnabled(){const{callbacks:e}=this;return!(!e||!e.addRelatedRecord&&!e.editRelatedRecord)}async goBack(){return this.viewModel.goBack()}async goHome(){return this.viewModel.goHome()}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._setFocusableInput(e.input),this.scheduleRender()}render(){return ue("div",{class:this.classes(D.base,le.widget,le.panel),ondragover:this._handleDragAndDrop,ondrop:this._handleDragAndDrop},this._renderContent(),this._renderAttachmentDialog(),this._prompt?ue(J,{...this._prompt,headingLevel:this.headingLevel}):void 0)}setActiveAssociationsInput(e){this.viewModel.setActiveAssociationsInput(e)}setActiveAssociationsLayer(e){this.viewModel.setActiveAssociationsLayer(e)}setActiveAssociationType(e){this.viewModel.setActiveAssociationType(e)}submit(){return this.viewModel.submit()}get test(){return{saveInput:this._saveInput.bind(this),pendingSubtypeChoice:this._pendingSubtypeChoice}}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:a}=e.dataset,i=n(this._dateComponentMap,`${a}`,()=>({}));switch(t){case"date":i.date=e;break;case"time":i.time=e;break;case"timeZone":i.timeZone=e}}_renderContent(){const{messages:e,viewModel:a}=this,{status:i}=a;return"failed"===i?a.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:a.maximumFeatureCountWithComplexForms})):a.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:a.maximumFeatureCount})):e.formFailedToLoad:a.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===i&&this.visibleElements.loadingIndicator?ue("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return ue("calcite-notice",{class:D.noticeError,icon:!0,kind:t,open:!0},ue("div",{slot:"message"},e))}_renderForm(){return ue("form",{class:D.form,id:this._formId,inert:!!this._prompt,onsubmit:this._onFormSubmit},this.viewModel.expressionEvaluationFailed&&this.visibleElements.expressionsErrorNotice&&this._renderErrorNotice(this.messages.expressionEvaluationFailed),this._renderInvisibleFieldsError(),this._renderPage())}_renderPage(){switch(this.page){case"adding-attachments":return this._renderAttachmentAddPage();case"viewing-attachment-details":case"replacing-attachment":return this._renderAttachmentDetailPage();case"viewing-attachments":return this._renderAttachmentListPage();case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewingAssociationsPage();case"viewing-related-categories":case"viewing-related-records":return this._renderRelationshipListPage();default:return this._renderDefaultPage()}}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:a}=e;let i;if(!e.submitHasBeenAttempted)return null;if(a.invalidHiddenInputs.length>0)if(i=w(a,e.mode,this.messages),"batch"===this.viewModel.mode){const e=a.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?i+=` (${e.map(e=>e.label).join(", ")})`:i=null}else i=null;else if(t)return null;return i?this._renderErrorNotice(i,"danger"):null}_renderDefaultPage(){return[this._renderReadOnlyNotice(),this._renderFormHeader(),this._renderFormContent()]}_renderReadOnlyNotice(){if((this.disabled||this.readOnly)&&this.visibleElements.readOnlyNotice)return ue("calcite-notice",{class:D.disabledNotice,"data-testid":"read-only-notice",icon:"read-only-non-editable",kind:"brand",open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},this.featureFormMessages.disabledForm))}_renderFormHeader(){const{formTitle:e,formDescription:t}=this.viewModel;if(!this._formHeaderVisible)return;const a=e?ue(re,{key:"title",level:this.headingLevel},e):void 0,i=t?ue("p",{class:D.description,key:"description"},t):void 0;return ue("div",{class:D.formHeader},a,i)}_renderFormContent(){return this.viewModel.hasVisibleInputs?this.viewModel.activeForm.inputs.filter(e=>e.visible).map(e=>this._renderInput(e)):this._renderErrorNotice(this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason])}_renderInput(e){return N(e)?this._renderGroupInput(e):U(e)?this._renderLabeledField(e):P(e)?this._renderTextComponent(e):B(e)?this._renderRelationshipElementInput(e):$(e)?this._renderAttachmentElementInput(e):z(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:a,open:i}=e,n=t.filter(e=>e.visible),s=e.label??"",o=this._focusedFieldInput?.group===e,l="sequential"===this.groupDisplay;return ue("calcite-block",{class:this.classes(D.group,l?D.groupSequential:null,o?D.groupActive:null,this.disabled?D.inputDisabled:null),collapsible:!0,description:e.description??void 0,expanded:i,heading:s,headingLevel:this.headingLevel,key:`{${a.elementId}-key}`,label:s,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0},onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:a}=e.template,{label:i,required:n,dataType:s}=e,o=n?t(this.messages.requiredFieldLabel,{name:i}):i;return ue("calcite-label",{"aria-label":o,class:D.label,key:`field--${a}`},ue("div",{class:D.labelTextContent,key:"labelTextContainer"},i,n?ue("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==s?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:a}=e;return V(e.inputController)?this._renderDynamicChoiceComponent({input:e,props:t,controller:e.inputController}):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):R(e.inputController)?this._renderMultipleChoiceComponent({input:e,props:t}):"date"===a?this._renderDateComponents(e,t):(t.disabled=this.disabled,t.readOnly=t.readOnly||this.viewModel.updating,"number"===a?this._renderNumberComponent(e,t):this._renderStringComponent(e,t))}_renderAuxiliaryText(e){const{description:t}=e,a=F(e,e.validationMessage,this.messages);return a?ue("calcite-input-message",{icon:!0,status:e.status},a):t?ue("calcite-input-message",{class:D.description,icon:!1,status:e.status},t):null}_renderCodedInputs({input:e,props:t}){const a=e.input?.type??null,i=e.codedValueOptions;switch(a){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:i,props:t});default:return this._renderComboBoxComponent({options:i,props:t,input:e})}}_renderDynamicChoiceComponent({input:e,props:t,controller:a}){const i=a.filteredChoices,n=e.showNoValueLabel||this.messages.empty,s=a.evaluated&&!a.evaluating&&!a.choices.length&&ue("calcite-notice",{appearance:"transparent",kind:"info",open:!0,scale:"s",slot:"content-top",width:"full"},ue("div",{slot:"message"},this.messages.noDynamicChoices)),o=t=>{this._saveInput(e,t)},l=(e,t)=>{this._dynamicChoiceItemSelections.delete(a);const i=e.closest("calcite-autocomplete");if(i){const e=null==t?"":a.getLabel(t);a.filterValue=e,i.inputValue=e}o(t)},r=({currentTarget:t})=>{const i=t.inputValue??"";a.filterValue=i,i||null==e.value||o(null)},c=e.showNoValueOptionEnabled?ue("calcite-autocomplete-item",{heading:n,key:"dynamic-choice-empty",selected:null==e.value,value:"",onCalciteAutocompleteItemSelect:({currentTarget:e})=>l(e,null),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(a)}}):null,d=t=>{const i=e.value===j?this.messages.differentValuesPlaceholder:null==e.value?"":a.inputValue;t.inputValue=i};return ue("calcite-autocomplete",{...t,afterCreate:d,disabled:t.readOnly||t.disabled,loading:a.evaluating,placeholder:null==e.value?n:t.placeholder,value:String(t.value),onblur:e=>this._onDynamicChoiceBlur(e,a),onCalciteAutocompleteBeforeOpen:()=>a.beginInteraction(),onCalciteAutocompleteTextInput:r},s,c,i.map(t=>ue("calcite-autocomplete-item",{heading:t.name,key:`dynamic-choice-${t.code}`,selected:t.code===e.value,value:String(t.code),onCalciteAutocompleteItemSelect:({currentTarget:e})=>l(e,t.code),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(a)}})))}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:a}=this,i=this._getMultipleChoiceController(e);if(!i)return null;const{input:n}=i,s=!0===n.includeSelectAllChoices,{checkboxStatesByValue:o,selectAllState:l}=i.selectionState,r=l.checked?a.deselectAllLabel:a.selectAllLabel,c=i.otherChoiceRenderState,d=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},m=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},u=t=>{const{fieldName:a}=c;a&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:a})},h=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:c.fieldName??void 0})};return ue("div",{class:D.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},s?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:l,selectAllLabel:r,handleSelectAllCheckboxChange:d}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:m}),c.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:s,otherChoiceRenderState:c,handleOtherChoiceCheckboxChange:u,handleOtherChoiceInputChange:h,differentValuesPlaceholder:a.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:a,handleSelectAllCheckboxChange:i}){return ue("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:D.multipleChoiceSelectAll,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:a,labelText:a,value:be,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:a,handleChoiceCheckboxChange:i}){const n=this._getMultipleChoiceController(e);if(!n)return[];const{choices:s}=n;return s.map(e=>{const n=a.get(e.value)??{checked:!1,indeterminate:!1};return ue("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[ge],disabled:t.readOnly||t.disabled,indeterminate:n.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:t.onfocus})})}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:a,handleOtherChoiceCheckboxChange:i,handleOtherChoiceInputChange:n,differentValuesPlaceholder:s}){const o=a.label??this.messages.otherOptionLabel;return ue("div",{class:this.classes(D.multipleChoiceOtherChoice,t?D.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},ue("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:a.checkboxState.checked,class:e.class,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,indeterminate:a.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:o,labelText:o,value:fe,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus}),a.checkboxState.checked?ue("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":o,class:D.textElementInput,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,key:`${e.key}-other-choice-input`,maxLength:a.maxLength,placeholder:a.value===j?s:a.hint,status:a.status,type:"text",value:a.normalizedValue===j?"":a.normalizedValue?String(a.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:a=!1}){e.touch();const i=this._getMultipleChoiceController(e);if(!i)return;if(i.input&&!a&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const n=e.value,s=this._parseValue(t,e,a);s!==n&&await this.viewModel.setValue(e.template.elementId,s)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:a}){if(!a)return;const i=t.value,n=null==i||""===i?null:i,s=this._getMultipleChoiceController(e);if(!s)return;s.initializeExplicitOtherChoiceCheckedState(),s.stashOtherChoiceDraftValueForFeatures(e.features,n);const o=H(e,a);o&&await this.viewModel.setValueForFieldName(o,n,Array.from(e.features,e=>e.source))}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:a}){const i=this._getMultipleChoiceController(e);if(!i)return;i.setExplicitOtherChoiceCheckedState(t),e.touch(),t||i.setOtherChoiceDraftValuesFromFeatures(e.features.toArray());const n=H(e,a);if(!n)return;const s=new Map;for(const o of e.features){const e=o.getAttribute(a);if(t){if(!pe(e))continue;const t=i.getOtherChoiceDraftValue(o),a=q(t)?t:Z;s.set(o,a);continue}null!=e&&s.set(o,null)}0!==s.size&&await this.viewModel.setValuePerFeatureForFieldName(n,new Map(Array.from(s,([e,t])=>[e.source,t])))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){const a=this._getMultipleChoiceController(e);if(!a)return;const i=new Map(e.features.map(i=>[i,a.getUpdatedValueForFeature({choiceValue:t.value,currentValue:i.getAttribute(e.fieldName),isChecked:t.checked})]));0!==i.size&&await this.viewModel.setFieldInputValuePerFeature(e,i)}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===j||e.value===j)&&"batch"===this.viewModel.mode){const a={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,onblur:t.onblur,onfocus:t.onfocus,[ge]:t[ge]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:a,options:[{name:this.messages.differentValuesPlaceholder,value:j,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return ue("calcite-switch",{...t,checked:!!I(e.template,"switch")&&e.value===e.template.input.onValue,class:D.inputSwitch,disabled:t.readOnly||t.disabled,onCalciteSwitchChange:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:a}){const{trigger:i,dropdown:n,group:s}=a;return ue("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInputFromElement(e)},ue("calcite-button",{...i},e===j?this.messages.differentValuesPlaceholder:e),ue("calcite-dropdown-group",{selectionMode:s.mode},t.map(t=>ue("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:a}){const i="INSERT"===this.viewModel.editType&&e.showNoValueOptionEnabled&&!e.touched?()=>{}:a.onblur,n={...a,onblur:i};return ue("calcite-combobox",{...n,clearDisabled:e.isSubtypeField,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:a.placeholder===this.messages.differentValuesPlaceholder?j:String(a.value),onCalciteComboboxChange:({currentTarget:t})=>{t.value!==j&&(e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveInputFromElement(t))}},this.renderComboboxOptionsList({input:e,options:t,props:a}))}renderComboboxOptionsList({input:e,options:t,props:a}){const i=e=>e.map(e=>{const{value:t}=e,i=pe(e.value)?this.messages.empty:e.name;return ue("calcite-combobox-item",{heading:i,key:`#${t}`,selected:a.value===t,value:`${t}`})});let n=[];const{messages:s}=this;t.other.length>0&&n.push(ue("calcite-combobox-item-group",{key:"other",label:s.other},i(t.other))),t.unsupported.length>0&&n.push(ue("calcite-combobox-item-group",{key:"unsupported",label:s.unsupported},i(t.unsupported)));const o=i(t.recommended);n.length>0?n.unshift(ue("calcite-combobox-item-group",{key:"recommended",label:s.recommended},o)):n=o;const l=a.placeholder===this.messages.differentValuesPlaceholder,r=!l&&pe(a.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(ue("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),l&&n.unshift(ue("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:j,selected:!0,value:j})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:a}){const i=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:i})=>this._renderRadioButtons({label:t,value:i,selected:i===e.value,props:a}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,s=pe(e.value);i.unshift(this._renderRadioButtons({label:n,value:t,selected:s,props:a}))}return ue("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:D.inputRadioGroup,"data-field-name":a[ve],disabled:a.readOnly||a.disabled,key:`${a.key}-radio-group`,layout:"vertical",name:`${a.name}-${this.id}`,required:a.required},i,a.placeholder===this.messages.differentValuesPlaceholder?ue("calcite-label",{class:D.placeholderRadio,key:a.label,layout:"inline"},ue("calcite-radio-button",{checked:!0,class:D.inputRadio,disabled:!0,value:a.placeholder}),a.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:a,props:i}){return ue("calcite-label",{class:D.inputRadioLabel,key:i.label,layout:"inline"},ue("calcite-radio-button",{...i,afterCreate:void 0,afterUpdate:void 0,checked:t,class:D.inputRadio,disabled:i.readOnly||i.disabled,name:void 0,value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInputFromElement(e)}}),a)}_renderStringComponent(e,t){const{template:a}=e;return!a.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===a.input?.type?ue("calcite-text-area",{...t,class:this.classes(D.individualElement),resize:"vertical",value:t.value?String(t.value):"",onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteTextAreaInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}}):ue("calcite-input",{...t,class:this.classes(D.individualElement),type:"text",value:t.value?String(t.value):"",onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteInputInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}})}_renderNumberComponent(e,t){const a=g(e.field);return ue("calcite-input-number",{...t,integer:a,step:a?1:"any",type:"number",value:a&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteInputNumberInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}})}_renderReadOnlyComponent(e,t){const a=this.getCommonInputProps(e);return ue("calcite-input",{...a,class:this.classes(D.fieldInput,D.inputDisabled,D.individualElement),readOnly:!0,type:"text",value:String(t??a.value??"")})}_renderDateComponents(e,t){const{field:a}=e;let i;switch(a.type){case"date":i=this._renderDateFieldComponents(e,t);break;case"date-only":i=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":i=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":i=this._renderTimestampOffsetFieldComponents(e,t);break;default:i=this._renderReadOnlyComponent(e,ee(a,t.value,{timeZone:e.effectiveTimeZone,...te(e.template.field)}))}return e.value===j?[i,ue("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:i}_renderDateOnlyFieldComponent(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t,{rawMax:o,rawMin:l}=e.range;return ue("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:a,"data-date-part":"date","data-element-id":t[ge],"data-field-name":t[ve],disabled:i,key:`${n}-date-input`,max:v(o)?o:void 0,min:v(l)?l:void 0,overlayPositioning:"fixed",readOnly:s,topLayerDisabled:this.topLayerDisabled,value:e.value===j?"":e.value?String(e.value):"",onblur:t.onblur,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_renderTimeOnlyFieldComponent(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t;return ue("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:a,"data-date-part":"time","data-element-id":t[ge],"data-field-name":t[ve],disabled:i,key:`${n}-time-input`,overlayPositioning:"fixed",readOnly:s,step:e.timeStep,value:e.value===j?"":e.value?String(e.value):"",onblur:t.onblur,onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:a,disabled:i,key:n,readOnly:s,onblur:o,onfocus:l}=t,{rawMax:r,rawMin:c}=e.range,d=e.effectiveTimeZone,m=ae(r,d),u=ae(c,d),h=ae(e.value===j?"":e.value,d),p=e.includeTimeOffset,g={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:i,[ge]:t[ge],[ve]:t[ve],onblur:o,onfocus:l,overlayPositioning:"fixed",readOnly:s};return ue("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},ue("calcite-input-date-picker",{...g,class:a,"data-date-part":"date",key:`${n}-date-input`,max:m?.date??void 0,min:u?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:h.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),ue("calcite-input-time-picker",{...g,class:a,"data-date-part":"time",key:`${n}-time-input`,step:e.timeStep,value:h.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?ue("calcite-input-time-zone",{...g,class:a,clearable:e.value===j||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,value:h.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:a,disabled:i,key:n,readOnly:s,min:o,max:l}=t,r=e.effectiveTimeZone,c=ie(e.value===j?"":e.value,r),d=ie(l,r),m=ie(o,r),u=e.includeTime,h={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:i,[ge]:t[ge],[ve]:t[ve],onblur:t.onblur,onfocus:t.onfocus,overlayPositioning:"fixed",readOnly:s};return ue("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},ue("calcite-input-date-picker",{...h,class:a,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:m?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?ue("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${n}-time-input`,step:1,value:c.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){return this._relatedRecordsEnabled?ue(X,{afterObserverCreated:this._afterListObserverCreated,afterObserverRemoved:this._afterListObserverRemoved,input:e,messages:this.messages,messagesCommon:this.messagesCommon,viewModel:this.viewModel}):null}_renderRelationshipListPage(){const{activeRelationshipInput:e}=this.viewModel;if(e)return this._renderRelationshipElementInput(e)}_renderAttachmentElementInput(e){if(!this.attachmentsEnabled)return;const{allAttachmentsVisibleOnDefaultPage:t,attachments:a,defaultPageAttachments:i,template:{description:n,elementId:s,label:o}}=e,l=t?a:i;return ue("div",{class:D.attachmentElementInput,"data-testid":`attachment-element-${s}`,key:`attachment-element-${s}`},o?ue("div",{class:D.attachmentElementLabel,key:`attachment-element-label-${s}`},o):null,n?ue("div",{class:D.description,key:`attachment-element-description-${s}`},n):null,a.length?this._renderAttachmentList(e,l,{label:o||this.messagesCommon.details,viewAllCount:t?null:a.length}):ue("div",{class:D.attachmentElementEmptyState,key:`attachment-element-empty-state-${s}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){const e=this.viewModel.selectedAttachmentListInput;if(e)return ue("div",{class:D.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,a){const{filterEnabled:i,label:n,viewAllCount:s}=a;return ue("calcite-list",{class:D.attachmentElementList,filterEnabled:i,filterPlaceholder:i?this.messages.attachments.searchAttachments:void 0,filterProps:i?ce:void 0,filterText:i?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:i?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=s?this._renderViewAllAttachmentsItem(e,s):null)}_renderAttachmentListItems(e,t){const{elementId:a}=e.template;return t.map((t,i)=>{const n=this._formatAttachmentSize(t.size),s=this._getAttachmentLabel(t,i,n,e.displayFilename),o=s===n?void 0:n,l=C(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=c.isDeleted,m=!d&&(r||c.isRenamed||c.isReplaced);return ue("calcite-list-item",{class:D.attachmentElementListItem,description:o,key:`attachment-item-${l}`,label:s,onCalciteListItemSelect:r||d?void 0:()=>this._setSelectedAttachment({attachmentKey:l,elementId:a})},ue("div",{class:D.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,s,e)),m?ue("span",{class:D.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[ue("calcite-action",{disabled:this._disableAttachmentModification(e),icon:"x",scale:"s",slot:"actions-end",text:this.messagesCommon.delete,title:this.messagesCommon.delete,onclick:()=>this.viewModel.stageDeleteAttachment(a,C(t))})]:d?ue("calcite-chip",{label:this.messages.attachments.deleted,scale:"s",slot:"content-end"},this.messages.attachments.deleted):ue("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))})}_renderViewAllAttachmentsItem(e,a){const{elementId:i}=e.template,{viewAll:n}=this.messages.attachments;return ue("calcite-list-item",{class:D.attachmentElementListItem,description:t(this.messages.attachments.count,{count:a}),key:`attachment-item-view-all-${i}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(i)},ue("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,a=this.effectiveDisabled||e.addDisabled,i=this._renderAttachmentCountLimitsLabel(e),n=this._getAttachmentNoticeMessage(e),s=e.hasMinimumAttachmentCountNotMet||e.hasExceededAttachmentLimit?"danger":"info",o=e.canUploadFiles,l=e.isCaptureOnly&&!this.effectiveDisabled&&!n;return ue("div",{class:D.attachmentElementAddActions,key:`attachment-element-add-actions-${t}`},o?ue("calcite-button",{appearance:"outline",disabled:a,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach):null,this._renderAttachmentCaptureButton(e),l?this._renderAttachmentCaptureDisabledNotice(t):null,i?ue("div",{class:D.attachmentElementEmptyActionHint},i):null,!this.effectiveDisabled&&n?ue("calcite-notice",{closable:!1,icon:"danger"===s?"exclamation-mark-circle":"lightbulb",kind:s,open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},n)):null)}_renderAttachmentCaptureButton(e){if(!e.hasCaptureInputs)return null;const t=e.captureMediaType;return ue("calcite-button",{appearance:"outline",disabled:!0,iconStart:Ce(t),kind:"neutral",round:!0,scale:"s"},this._getCaptureButtonLabel(t))}_getAttachmentNoticeMessage(e){const t=this.messages.attachments;return e.hasUnsupportedFileTypeValidationError?this._getUnsupportedFileTypeMessage():e.hasMinimumAttachmentCountNotMet&&this._shouldShowMinimumAttachmentNotice(e)?t.minimumNotMet:e.hasExceededAttachmentLimit?t.attachmentLimitExceeded:e.hasReachedAttachmentLimit?t.attachmentLimitReached:null}_shouldShowMinimumAttachmentNotice(e){return e.hasAttachmentChanges||this.viewModel.submitHasBeenAttempted||e.touched}_getCaptureButtonLabel(e){const{capture:t,recordAudio:a,takePhoto:i,takeVideo:n}=this.messages.attachments;switch(e){case"image":return i||t;case"video":return n||t;case"audio":return a||t;default:return t}}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:a}=e.template;if(e.isCaptureOnly)return this._renderAttachmentCaptureDisabledNotice(a);const i=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,s=this.messages.attachments,o=s.dragAndDropFile,l="upload",r=e=>{this._attachmentFileInputMap.set(a,e)};return ue("div",{class:D.attachmentElementAddPanel,key:`attachment-element-add-panel-${a}`},ue("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(a)},afterUpdate:r,class:D.attachmentElementFileInput,"data-element-id":a,disabled:n,multiple:i,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?Array.from(t.files):[];this._stageAttachmentFiles(a,i),t.value=""}}),ue("div",{class:D.attachmentElementAddDropzone,"data-disabled":n?"true":"false",ondragover:e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),n)return;const t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(a,t)}},ue("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:l,scale:"l"}),ue("div",{class:D.attachmentElementAddDropzoneHeading},s.addFile),ue("div",{class:D.attachmentElementAddDropzoneDetail,title:o},o),ue("calcite-button",{appearance:"transparent",disabled:n,iconStart:"folder-open",kind:"brand",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(a,n)}},s.selectFile)),this._renderAttachmentValidationCriteria(e,{includeCountCriteria:!0}))}_renderAttachmentCaptureDisabledNotice(e){return ue("calcite-notice",{class:D.attachmentElementCaptureNotice,icon:!0,key:`attachment-element-capture-disabled-notice-${e}`,kind:"warning",open:!0,scale:"s"},ue("div",{slot:"message"},this.messages.attachments.captureMethodNotSupported))}async _stageAttachmentFiles(e,t){if(0===t.length)return;const a=this.viewModel.selectedAttachmentAddInput;let i=!0;try{i=(await this.viewModel.stageAddAttachments(e,t)).length>0&&!a?.hasInvalidValidationCriteria&&!a?.hasUnsupportedFileTypeValidationError}finally{i&&this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){const e=this.selectedAttachmentDetails;if(!e)return;if("replacing-attachment"===this.page)return this._renderAttachmentReplacePanel(e);const{attachment:t,input:a}=e,i=C(t),n=!!a.getAttachmentPreviewUrl(t),s=!this._disableAttachmentModification(a)&&a.canUploadFiles,o=a.getAttachmentEditState(t);return ue("div",{class:D.attachmentElementDetail,key:`attachment-detail-panel-${a.template.elementId}-${i}`},ue("div",{class:D.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)),ue("div",{class:D.attachmentElementDetailActions},y(t)?ue("calcite-button",{appearance:"outline",disabled:!n,iconStart:"expand",kind:"neutral",label:this.messages.attachments.maximize,scale:"m",title:this.messages.attachments.maximize,onclick:this._maximizeSelectedAttachment}):null,ue("calcite-button",{appearance:"outline",disabled:!n||o.isReplaced,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),ue("calcite-button",{appearance:"outline",disabled:!s,iconStart:"upload-to",kind:"neutral",label:this.messages.attachments.replace,scale:"m",title:this.messages.attachments.replace,onclick:this._enterAttachmentReplaceView})),ue("div",{class:D.attachmentElementDetailMetadata},ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),this._renderFileNameContent(t,a)),ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.size),ue("span",{class:D.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.type),ue("span",{class:D.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderFileNameContent(e,t){if(!t.allowUserRename)return ue("span",{class:D.attachmentElementDetailMetadataValue},e.name);const a=t.getAttachmentEditState(e),{baseName:i,extension:n}=A(e.name),s=this._disableAttachmentModification(t),o=!s&&0===e.name.trim().length;return[ue("div",{class:D.attachmentElementDetailFileNameRow,key:"file-name-row"},ue("calcite-input",{class:D.attachmentElementDetailFileNameInput,disabled:s,scale:"m",status:o?"invalid":"idle",suffixText:n,value:i,onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),ue("calcite-button",{appearance:"transparent",disabled:s||null==a.initialName||!a.isRenamed,iconStart:"reset",kind:"neutral",label:this.messages.footerButtons.reset,scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})),o?ue("calcite-input-message",{icon:!0,key:"file-name-message",status:"invalid"},this.messages.validationErrors.cannotBeNull):null]}_renderAttachmentReplacePanel(e){const{attachment:t,input:a}=e,i=this._disableAttachmentModification(a)||!a.canUploadFiles,n=a.template.elementId;return ue("div",{class:D.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${C(t)}`},ue("input",{accept:a.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:D.attachmentElementFileInput,disabled:i,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?.[0];a&&this._stageSelectedAttachmentReplacement(a),t.value=""}}),ue("div",{class:D.attachmentElementAddDropzone,"data-disabled":i?"true":"false",ondragover:e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),i)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},ue("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),ue("div",{class:D.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),ue("div",{class:D.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),ue("calcite-button",{appearance:"transparent",disabled:i,iconStart:"folder-open",kind:"brand",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),this._renderAttachmentValidationCriteria(a,{includeCountCriteria:!1}),ue("div",{class:D.attachmentElementDetailMetadata},ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),ue("span",{class:D.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:a}=e;return ue("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},ue("div",{class:D.attachmentElementDialogPreview},this._renderAttachmentPreviewImageForInput(t,a)))}_setSelectedAttachment(e,t){t?.touch(),this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){const{viewModel:t}=this;t.setSelectedAttachmentAddElementId(e),t.selectedAttachmentAddInput?.touch(),t.selectedAttachmentAddInput?.clearValidationCriteriaState(),this.hideAttachmentDialog()}_setAttachmentListElementId(e){const{viewModel:t}=this;t.setSelectedAttachmentListElementId(e),t.selectedAttachmentListInput?.touch(),this.hideAttachmentDialog()}_getAttachmentLabel(e,a,i,n){return!1!==n&&v(e.name)&&e.name.length>0?e.name:i!==this.messagesCommon.notApplicable?i:t(this.messages.attachments.attachmentNumberedLabel,{index:a+1})}_renderAttachmentCountLimitsLabel(e){const t=this.messages.attachments,a=null!=e.minAttachmentCount&&e.minAttachmentCount>0?this._renderAttachmentCountLimitLabel(t.minAttachmentsShort,e.minAttachmentCount,"min"):null,i=null!=e.maxAttachmentCount?this._renderAttachmentCountLimitLabel(t.maxAttachmentsShort,e.maxAttachmentCount,"max"):null;return a||i?[a,a&&i?ue("span",{key:"attachment-count-limits-separator"},", "):null,i]:null}_renderAttachmentCountLimitLabel(e,a,i){const n="__count__",[s,o]=t(e,{count:n}).split(n);return ue("span",{key:i},s,ue("span",{class:D.attachmentElementEmptyActionHintValue},a),o)}_renderAttachmentValidationCriteria(e,{includeCountCriteria:t}){const a=this._getAttachmentValidationCriteria(e,{includeCountCriteria:t}),i=`attachment-validation-criteria-${e.template.elementId}`;return 0===a.length?null:ue("div",{class:D.attachmentElementValidationCriteria,key:i},a.map(({key:e,message:t,state:a})=>ue("calcite-notice",{appearance:"danger"===a?"outline-fill":"transparent",closable:!1,icon:!0,key:e,kind:a,open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},t))))}_getAttachmentValidationCriteria(e,{includeCountCriteria:a}){const i=[],n=e.validationCriterionStates,s=this.messages.attachments,o=this._getNestableAttachmentInputs(e.input);e.hasUnsupportedFileTypeValidationError&&i.push({key:"unsupported-file-type",message:this._getUnsupportedFileTypeMessage(),state:"danger"});for(const l of o)"document"===l.type&&null!=l.maxFileSize&&i.push({key:"maximum-file-size",message:t(s.maximumFileSize,{maxSize:this._formatAttachmentSizeLimitInMegabytes(l.maxFileSize)}),state:n.get("maximum-file-size")??"info"}),"audio"===l.type&&null!=l.maxDuration&&i.push({key:"maximum-audio-length",message:t(s.maximumAudioLength,{maxDuration:this._formatAttachmentDurationLimit(l.maxDuration)}),state:n.get("maximum-audio-length")??"info"}),"video"===l.type&&null!=l.maxDuration&&i.push({key:"maximum-video-length",message:t(s.maximumVideoLength,{maxDuration:this._formatAttachmentDurationLimit(l.maxDuration)}),state:n.get("maximum-video-length")??"info"}),"image"===l.type&&null!=l.maxImageSize&&i.push({key:"maximum-image-size",message:t(s.attachmentMustBeSmallerThan,{maxSize:`${l.maxImageSize}px`}),state:n.get("maximum-image-size")??"info"});return a&&null!=e.minAttachmentCount&&e.minAttachmentCount>0&&i.push({key:"minimum-number-of-files",message:t(s.minimumNumberOfFiles,{count:e.minAttachmentCount}),state:n.get("minimum-number-of-files")??"info"}),a&&null!=e.maxAttachmentCount&&i.push({key:"maximum-number-of-files",message:t(s.maximumNumberOfFiles,{count:e.maxAttachmentCount}),state:n.get("maximum-number-of-files")??"info"}),i}_getNestableAttachmentInputs(e){return null==e?[]:"attachment"===e.type?e.inputTypes?.slice()??[]:[e]}_getUnsupportedFileTypeMessage(){return this.featureTableMessages.errorFileUnsupported}_formatAttachmentSize(e){return null==e||Number.isNaN(e)?this.messagesCommon.notApplicable:m(this.messagesUnits,e)}_formatAttachmentSizeLimitInMegabytes(e){return m(this.messagesUnits,1048576*e)}_formatAttachmentDurationLimit(e){return p(1e3*Math.round(e),{...e>=3600?{hour:"2-digit",hourCycle:"h23"}:{},minute:"2-digit",second:"2-digit",timeZone:"UTC"})}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;const t=this.messages.attachments.attachmentTypes,a=f(e);return t?.[a]||e}_renderAttachmentPreviewThumbnail(e,t,a){const i=a.getAttachmentPreviewUrl(e,64);return i&&y(e)?ue("img",{alt:t,class:D.attachmentElementListItemThumb,src:i}):ue("calcite-icon",{class:D.attachmentElementListItemIcon,icon:_(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const a=t.getAttachmentPreviewUrl(e),i=e.name||this.messagesCommon.details;return a&&y(e)?ue("img",{alt:i,class:D.attachmentElementDetailPreviewImage,src:a,title:i}):[ue("calcite-icon",{class:D.attachmentElementDetailPreviewIcon,icon:_(e.contentType),scale:"l",textLabel:i,title:i}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await Q(e)}_canReplaceSelectedAttachment(){return!this.effectiveDisabled&&!!this.selectedAttachmentDetails?.input.canUploadFiles}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const a=t.input.template.elementId,i=C(t.attachment);let n=!1;try{n=await this.viewModel.stageReplaceAttachment(a,i,e)}finally{n&&this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const a=t.input.template.elementId,i=C(t.attachment);this.viewModel.stageRenameAttachment(a,i,e)}_resetSelectedAttachmentChanges(){const e=this.selectedAttachmentDetails;e?.attachment&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,C(e.attachment))}_deleteSelectedAttachment(){const e=this.selectedAttachmentDetails;if(!e?.attachment||this._disableAttachmentModification(e.input))return;const t=e.input.template.elementId,a=C(e.attachment);this.viewModel.stageDeleteAttachment(t,a),this._setSelectedAttachment(null)}_disableAttachmentModification(e){return this.disabledOrReadOnly||!e.editable}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return ue("div",{class:D.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){if(!this._associationsEnabled)return;const{elementId:t}=e.template;return ue("div",{class:D.utilityNetworkAssociationsElementInput,"data-testid":t,key:t},this._associationsWidgetsMap.get(e)?.render())}getCommonInputProps(e){const{template:t,valid:a,value:i,minLength:n,maxLength:s,required:o,fieldName:l,editable:r,status:c,range:{max:d,min:m}}=e,u=!r||this.readOnly,h=this.disabled||this.viewModel.updating;let p=t.hint??void 0,g=!1;return i===j&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":a?"false":"true",class:this.classes(D.fieldInput,u?D.inputDisabled:null),status:c,maxLength:s&&s>-1?s:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:l,name:l,max:null!=d?d:void 0,min:null!=m?m:void 0,disabled:h,readOnly:u,onblur:this._onComponentBlur,required:o,placeholder:p,value:g?"":i??"",[ge]:t.elementId,[ve]:l,onfocus:this._onComponentFocus}}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_onFormSubmit(e){e.preventDefault()}_handleDragAndDrop(e){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none")}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(ge))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,a=e.querySelector("calcite-radio-button"),i=t||a;i&&this._afterComponentCreateOrUpdate(i)}_onComponentFocus(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._focusedFieldInput=a}_isMultipleChoiceCheckbox(e,t){const a=this._getMultipleChoiceController(t);return"CALCITE-CHECKBOX"===e.tagName&&null!=a?.input}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),a=this._focusedFieldInput;this._attemptFocusOnNextRender&&a===t&&(this._attemptFocusOnNextRender=!1,he(e))}_onComponentBlur(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,a)||a.touch(),this._focusedFieldInput=null}_onDynamicChoiceBlur(e,t){const a=e.currentTarget;if(this._dynamicChoiceItemSelections.delete(t))return;const i=e.relatedTarget;i instanceof Node&&a.contains(i)||(t.endInteraction(),a.inputValue=t.inputValue,this._onComponentBlur(e))}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear()}_parseValue(e,t,a=!1){const i=this._getMultipleChoiceController(t);if(i){const{input:t,values:n}=i;if(t&&n){const t=e;return i.getValueFromCheckboxChange({choiceValue:t.value,isChecked:t.checked,isSelectAllCheckbox:a})}}if(I(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const a of t.domain.codedValues)if(a.name===e.selectedItems[0].textContent)return a.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const n=e.value;return null==n||""===n?null:"number"===t.dataType?"-0"===n||"-0."===n||"-0,"===n?n:parseFloat(n):"date"===t.field.type?parseFloat(n):n}_getMultipleChoiceController(e){return R(e.inputController)?e.inputController:null}_saveInputFromElement(e){const t=this._getFieldInputFromHTMLElement(e);if(!t)return;const a=this._parseValue(e,t);this._saveInput(t,a)}_saveInput(e,t){const{elementId:a}=e.template,i=e?.value,{viewModel:s}=this;if(I(e.template,"switch")&&"single"!==s.mode){const t=n(this._batchSwitchInputInitialValues,e,()=>e.value);this._batchSwitchInputInitialValues.set(e,null===t?i:t)}t!==i&&(e.touch(),e.isSubtypeField&&"batch"!==s.mode&&k(s.activeLayer,i,t)?this._pendingSubtypeChoice||(this._pendingSubtypeChoice=this._handleSubtypeChoice(e,t)):s.setValue(a,t))}async _handleSubtypeChoice(e,a){const{value:i,template:n}=e,{elementId:s}=n,{messages:o,viewModel:l,messagesCommon:r}=this,{subtypes:c,activeFeatureIndex:d}=l;if(await l.setValue(s,a),!c?.length)return;const m=c.find(e=>e.code===a),u=c.find(e=>e.code===i)?.name??`${i}`;if(!m)return;const h=Promise.withResolvers();l.pendingSubtypeChoice=h;let p="update-fields";const g=[{label:o.subtypes.useDefaultValuesOption,value:"update-fields"},{label:o.subtypes.keepCurrentValuesOption,value:"keep-existing"}],v={context:"info",title:o.subtypes.changeWarningTitle,message:t(o.subtypes.changeWarning,{originalType:u,newType:m.name}),radios:g,defaultRadioSelection:"update-fields",onRadioSelection:e=>{p=e},actions:{primary:{label:r.apply,action:()=>h.resolve(p),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>h.resolve("undo")}},cancel:()=>h.reject()};try{this.showPrompt(v);switch(await h.promise){case"update-fields":await l.applySubtypeDefaults(m),await l.handleSubtypeChanged(d);break;case"keep-existing":await l.handleSubtypeChanged(d);break;case"undo":await this.viewModel.setValue(s,i)}}finally{l.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_afterDateComponentCreateOrUpdate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:a}=e.template,i=e.field.type,n=this._dateComponentMap.get(`${a}`);if(!n)return;const s=e.effectiveTimeZone;let o=e.value===j?void 0:e.value,l=null;"date-only"===i?l=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===i?(o=ne(o),l=ne(t.value)):l="timestamp-offset"===i?null!=t.value?se({dateComponent:n.date,timeComponent:n.time,oldValue:o,timeZoneComponent:n.timeZone,defaultTimeZone:s}):null:null!=t.value?oe({oldValue:o,dateComponent:n.date,timeZone:s,timeComponent:n.time?.value===j?void 0:n.time}):null,o!==l&&(e.touch(),null!==l&&t.value?this.viewModel.setValue(a,l):this.viewModel.setValue(a,null))}_renderViewingAssociationsPage(){return this._associationsList?.render()}_onActiveAssociationsInputChange(e){const t=this._associationsList;t&&(e?(t.associationInput=e,t.viewModel=e.viewModel):t.associationInput=null)}async _setUpAssociationsWidgets(){const e=this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs;if(this._associationsEnabled&&0!==e.length){await this._setUpUtilityNetworkAssociationList();for(const t of e)this._associationsWidgetsMap.set(t,await this._createAssociationsWidget(t))}}async _setUpUtilityNetworkAssociationList(){if(this._associationsList)return;const e=(await(import("./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js"))).default;this._associationsList=new e({onSelectLayer:this._onSelectAssociatedLayer.bind(this),onSelectFeature:this._onEditAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)});const t=this.viewModel.activeAssociationsInput;t&&(this._associationsList.associationInput=t,this._associationsList.viewModel=t.viewModel)}async _createAssociationsWidget(e){return new(0,(await(import("./Feature/FeatureUtilityNetworkAssociations.js"))).default)({viewModel:e.viewModel,onSelectAssociationType:t=>this._onSelectAssociationType(e,t)})}_destroyAssociationsWidgets(){this._associationsWidgetsMap.forEach(e=>s(e)),this._associationsWidgetsMap.clear()}_onSelectAssociationType(e,{listType:t}){this.setActiveAssociationsInput(e),this.setActiveAssociationType(t)}_onSelectAssociatedLayer({layer:e}){this.setActiveAssociationsLayer(e)}async _onEditAssociatedFeature(e){const t=this.callbacks?.editAssociatedFeature,a=this.viewModel.activeAssociationsInput;if(!t||!a?.feature)return;const{association:i,feature:n}=e;await t({parentFeature:a.feature.plainGraphic,association:i,feature:n})}_onAddAssociation(e){const t=this.callbacks?.addAssociation,a=this.viewModel.activeAssociationsInput;if(!t||!a?.feature)return;const{associationType:i,utilityNetwork:n}=e;t({feature:a.feature.plainGraphic,associationType:i,utilityNetwork:n})}_setFocusableInput(e){const t=e&&U(e)?e:this._findFocusableInput(e);this._syncGroupInputStates(),this._focusedFieldInput=t,this._attemptFocusOnNextRender=!0}_findFocusableInput(e){const t=this.viewModel.activeForm.inputs;if(!t.length)return;const a=M(t);let i;if(e)if(N(e)){const t=e.inputs.find(e=>e.visible);i=t?a.indexOf(t):0}else{let n;if(W(e)&&!e.group.open){n=e.group.inputs.filter(U)[t.length-1]}else n=e;i=a.indexOf(n)+1}else i=0;for(let n=i;n<a.length;n++){const e=a[n];if(e.visible&&U(e)){if(this.disabledOrReadOnly&&("switch"===e?.inputType||"radio-buttons"===e?.inputType))continue;return e}}return null}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._setFocusableInput(t),"sequential"===this.groupDisplay&&this.viewModel.activeForm.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.activeForm?.allGroupInputs;if(!e.length)return;const t=e.filter(e=>e.open);0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach(e=>e.open=!1)}};function Ce(e){switch(e){case"audio":return _("audio/mpeg");case"video":return _("video/mp4");case"image":return _("image/png");default:return"camera"}}e([u()],_e.prototype,"activeFeatureIndex",null),e([u()],_e.prototype,"attachmentsEnabled",null),e([u()],_e.prototype,"callbacks",null),e([u()],_e.prototype,"disabled",null),e([u()],_e.prototype,"effectiveTitle",null),e([u()],_e.prototype,"effectiveDisabled",null),e([u()],_e.prototype,"disabledOrReadOnly",null),e([u()],_e.prototype,"features",null),e([u()],_e.prototype,"footerButtonInfos",null),e([u()],_e.prototype,"map",null),e([u()],_e.prototype,"maximumFeatureCount",null),e([u()],_e.prototype,"maximumFeatureCountWithComplexForms",null),e([u()],_e.prototype,"spatialReference",null),e([u()],_e.prototype,"layerInfos",null),e([u()],_e.prototype,"timeZone",null),e([u()],_e.prototype,"headingLevel",void 0),e([u()],_e.prototype,"icon",null),e([u(),de("esri/t9n/common")],_e.prototype,"messagesCommon",void 0),e([u(),de("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],_e.prototype,"messages",void 0),e([u(),de("esri/widgets/FeatureForm/t9n/FeatureForm")],_e.prototype,"featureFormMessages",void 0),e([u(),de("esri/widgets/FeatureTable/t9n/FeatureTable")],_e.prototype,"featureTableMessages",void 0),e([u(),de("esri/core/t9n/Units")],_e.prototype,"messagesUnits",void 0),e([u()],_e.prototype,"page",null),e([u()],_e.prototype,"readOnly",null),e([u()],_e.prototype,"showPrompt",null),e([u()],_e.prototype,"clearPrompt",null),e([u()],_e.prototype,"selectedAttachment",null),e([u()],_e.prototype,"selectedAttachmentDetails",null),e([u()],_e.prototype,"valid",null),e([u({type:x}),me(["attachments-change","value-change","values-change","submit"])],_e.prototype,"viewModel",void 0),e([u({type:L,nonNullable:!0})],_e.prototype,"visibleElements",void 0),e([u()],_e.prototype,"groupDisplay",void 0),e([u()],_e.prototype,"_formHeaderVisible",null),e([u()],_e.prototype,"_associationsEnabled",null),e([u()],_e.prototype,"_associationsList",void 0),e([u()],_e.prototype,"_attemptFocusOnNextRender",void 0),e([u()],_e.prototype,"_formId",null),e([u()],_e.prototype,"_focusedFieldInput",void 0),e([u()],_e.prototype,"_pendingSubtypeChoice",void 0),e([u()],_e.prototype,"_relatedRecordsEnabled",null),e([u()],_e.prototype,"_listObserverNode",void 0),e([u()],_e.prototype,"_attachmentDialogInfo",void 0),e([u()],_e.prototype,"_attachmentListFilterText",void 0),e([u()],_e.prototype,"_prompt",void 0),e([u()],_e.prototype,"test",null),_e=e([h("esri.widgets.BatchAttributeForm")],_e);const ye=_e;export{ye as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as a}from"../core/deprecate.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{destroyMaybe as s}from"../core/maybe.js";import o from"../core/ReactiveMap.js";import{watch as l,when as r,on as c,sync as d}from"../core/reactiveUtils.js";import{formatFileSize as m}from"../core/unitFormatUtils.js";import{property as u,subclass as h}from"../core/accessorSupport/decorators.js";import{formatDate as p}from"../intl/date.js";import{isIntegerField as g}from"../layers/support/fieldUtils.js";import{isString as v}from"../support/guards.js";import b from"./Widget.js";import{getAttachmentTypeCategory as f,getCalciteIconForAttachment as _}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as C,isImageAttachment as y,getAttachmentFilenameParts as A}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as w,getMessageString as F,isElementTemplateWithInputType as I,subtypeChangeShouldPrompt as k,flattenInputs as M}from"./BatchAttributeForm/batchAttributeFormUtils.js";import x from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as D}from"./BatchAttributeForm/css.js";import{makeViewingEditedAttachmentFooterButtons as S,makeViewingAttachmentFooterButtons as E,makeCancelFooterButton as O,makeDefaultFooterButtons as T}from"./BatchAttributeForm/interfaceUtils.js";import L from"./BatchAttributeForm/VisibleElements.js";import{isDynamicChoiceController as V,isMultipleChoiceController as R}from"./BatchAttributeForm/inputs/support/controllerUtils.js";import{isGroupInput as N,isFieldInput as U,isTextElementInput as P,isRelationshipElementInput as B,isAttachmentElementInput as $,isUtilityNetworkAssociationsElementInput as z,differentValuesString as j,getNormalizedFieldName as H,isGroupedInput as W}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as G,otherChoiceCheckedPlaceholderValue as Z,canRestoreMultipleChoiceOtherChoiceDraftValue as q}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{loadRelationshipDetailsComponents as K,RelationshipDetails as X}from"./BatchAttributeForm/rendered-content/RelationshipDetails.js";import{Prompt as J}from"./Editor/components/Prompt.js";import{downloadAttachmentInfo as Q}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as Y}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as ee,getIntlOptionsForField as te,prepareISOFieldValueForDateComponents as ae,prepareUnixFieldValueForDateComponents as ie,normalizeTimeOnlyString as ne,getISOFieldValueFromDateComponents as se,getUnixFieldValueFromDateComponents as oe}from"./support/dateUtils.js";import{globalCss as le}from"./support/globalCss.js";import{Heading as re}from"./support/Heading.js";import{calciteListFilterProps as ce}from"./support/listUtils.js";import{messageBundle as de,vmEvent as me,tsx as ue}from"./support/widget.js";import{setFocus as he}from"./support/widgetUtils.js";import{isEmptyValue as pe}from"./support/forms/formUtils.js";const ge="data-element-id",ve="data-field-name",be="esri_BatchAttributeForm_select_all",fe="esri_BatchAttributeForm_other_choice";let _e=class extends b{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.featureTableMessages=null,this.messagesUnits=null,this.viewModel=new x,this.visibleElements=new L,this.groupDisplay="all",this._associationsList=null,this._associationsWidgetsMap=new o,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._dynamicChoiceItemSelections=new WeakSet,this._focusedFieldInput=null,this._pendingSubtypeChoice=null,this._batchSwitchInputInitialValues=new Map,this._listObserverNode=null,this._listObserver=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.viewModel.activeRelationshipInput?.incrementPage()},{root:window.document}),this._attachmentDialogInfo=null,this._attachmentListFilterText="",this._attachmentFileInputMap=new Map,this._prompt=null,this._selectedAttachmentReplaceFileInput=null,this._afterListObserverCreated=e=>{this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)},this._afterListObserverRemoved=()=>{this._listObserverNode=null},this._maximizeSelectedAttachment=()=>{this._attachmentDialogInfo=this.selectedAttachmentDetails},this._enterAttachmentReplaceView=()=>{const e=this.selectedAttachmentDetails;this._canReplaceSelectedAttachment()&&e&&(e.input.clearValidationCriteriaState(),this.viewModel.setShowingSelectedAttachmentReplacePage(!0))},this._setSelectedAttachmentReplaceFileInput=e=>{this._selectedAttachmentReplaceFileInput=e},this._openSelectedAttachmentReplaceFilePicker=()=>{this._canReplaceSelectedAttachment()&&this._selectedAttachmentReplaceFileInput?.click()},this._resetSelectedAttachmentName=()=>{const e=this.selectedAttachmentDetails;if(!e?.attachment)return;const t=e.input.getAttachmentEditState(e.attachment).initialName;if(null==t)return;const a=e.input.template.elementId,i=C(e.attachment);this.viewModel.stageRenameAttachment(a,i,t)},this._closeAttachmentDialog=()=>{this.hideAttachmentDialog()},this._saveInputFromElement=this._saveInputFromElement.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{a(i.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...a}=e;return a}initialize(){this.addHandles([l(()=>this.features.toArray(),()=>{this._dateComponentMap.clear(),G(this.viewModel,{includeDraftValues:!0})}),l(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),G(this.viewModel),this._setFocusableInput()}),l(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),r(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),l(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),l(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),c(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()}),l(()=>[this._associationsEnabled,this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs],()=>this._setUpAssociationsWidgets(),d),l(()=>this.viewModel.activeAssociationsInput,e=>this._onActiveAssociationsInputChange(e)),l(()=>this.groupDisplay,()=>this._syncGroupInputStates())])}loadDependencies(){return Promise.all([Y({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),autocomplete:()=>import("@esri/calcite-components/dist/components/calcite-autocomplete"),"autocomplete-item":()=>import("@esri/calcite-components/dist/components/calcite-autocomplete-item"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")}),K()])}destroy(){this._destroyAssociationsWidgets(),this._associationsList=s(this._associationsList),this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get effectiveTitle(){const{features:e,messages:t,page:a}=this;return t?"replacing-attachment"===a?t.titles.replaceAttachment:"viewing-attachment-details"===a?t.titles.editAttachment:"adding-attachments"===a?t.titles.addAttachments:"viewing-attachments"===a?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:"":""}get effectiveDisabled(){return this.disabledOrReadOnly||this.viewModel.updating}get disabledOrReadOnly(){return this.disabled||this.readOnly}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get footerButtonInfos(){if(!this.features.length||!this.messages||!this.messagesCommon)return[];const{messages:e,messagesCommon:t,page:a}=this,i=this.effectiveDisabled;if("adding-attachments"===a||"replacing-attachment"===a)return[];if("viewing-attachment-details"===a){const t=this.selectedAttachmentDetails,a=t?.input?.getAttachmentEditState(t.attachment);if(!t?.input||!a)return[];return a.isRenamed||a.isReplaced?S({doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons,resetOnclick:()=>this._resetSelectedAttachmentChanges(),resetDisabled:this._disableAttachmentModification(t.input)}):E({deleteDisabled:this._disableAttachmentModification(t.input),deleteOnclick:()=>this._deleteSelectedAttachment(),doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons})}return"viewing-associated-features"===a?O({messages:t,purpose:"cancel-viewing-associated-features",onclick:()=>this.goBack()}):"viewing-associated-layers"===a?O({messages:t,purpose:"cancel-viewing-associated-layers",onclick:()=>this.goBack()}):"viewing-attachments"===a||"viewing-related-records"===a?[]:T({disabled:i||!this.valid,formId:this._formId,messages:e,callback:()=>this.submit()})}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get page(){return this.viewModel.page}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get selectedAttachment(){return this.viewModel.selectedAttachment}get selectedAttachmentDetails(){return this.viewModel.selectedAttachmentDetails}get valid(){return this.viewModel.valid}get _formHeaderVisible(){return!("batch"===this.viewModel.mode||!this.viewModel.activeFeature)&&!(!this.viewModel.formDescription&&!this.viewModel.formTitle)}get _associationsEnabled(){const{callbacks:e}=this;return!(!e?.addAssociation&&!e?.editAssociatedFeature)}get _formId(){return`${this.id}-form`}get _relatedRecordsEnabled(){const{callbacks:e}=this;return!(!e||!e.addRelatedRecord&&!e.editRelatedRecord)}async goBack(){return this.viewModel.goBack()}async goHome(){return this.viewModel.goHome()}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._setFocusableInput(e.input),this.scheduleRender()}render(){return ue("div",{class:this.classes(D.base,le.widget,le.panel),ondragover:this._handleDragAndDrop,ondrop:this._handleDragAndDrop},this._renderContent(),this._renderAttachmentDialog(),this._prompt?ue(J,{...this._prompt,headingLevel:this.headingLevel}):void 0)}setActiveAssociationsInput(e){this.viewModel.setActiveAssociationsInput(e)}setActiveAssociationsLayer(e){this.viewModel.setActiveAssociationsLayer(e)}setActiveAssociationType(e){this.viewModel.setActiveAssociationType(e)}submit(){return this.viewModel.submit()}get test(){return{saveInput:this._saveInput.bind(this),pendingSubtypeChoice:this._pendingSubtypeChoice}}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:a}=e.dataset,i=n(this._dateComponentMap,`${a}`,()=>({}));switch(t){case"date":i.date=e;break;case"time":i.time=e;break;case"timeZone":i.timeZone=e}}_renderContent(){const{messages:e,viewModel:a}=this,{status:i}=a;return"failed"===i?a.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:a.maximumFeatureCountWithComplexForms})):a.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:a.maximumFeatureCount})):e.formFailedToLoad:a.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===i&&this.visibleElements.loadingIndicator?ue("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return ue("calcite-notice",{class:D.noticeError,icon:!0,kind:t,open:!0},ue("div",{slot:"message"},e))}_renderForm(){return ue("form",{class:D.form,id:this._formId,inert:!!this._prompt,onsubmit:this._onFormSubmit},this.viewModel.expressionEvaluationFailed&&this.visibleElements.expressionsErrorNotice&&this._renderErrorNotice(this.messages.expressionEvaluationFailed),this._renderInvisibleFieldsError(),this._renderPage())}_renderPage(){switch(this.page){case"adding-attachments":return this._renderAttachmentAddPage();case"viewing-attachment-details":case"replacing-attachment":return this._renderAttachmentDetailPage();case"viewing-attachments":return this._renderAttachmentListPage();case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewingAssociationsPage();case"viewing-related-categories":case"viewing-related-records":return this._renderRelationshipListPage();default:return this._renderDefaultPage()}}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:a}=e;let i;if(!e.submitHasBeenAttempted)return null;if(a.invalidHiddenInputs.length>0)if(i=w(a,e.mode,this.messages),"batch"===this.viewModel.mode){const e=a.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?i+=` (${e.map(e=>e.label).join(", ")})`:i=null}else i=null;else if(t)return null;return i?this._renderErrorNotice(i,"danger"):null}_renderDefaultPage(){return[this._renderReadOnlyNotice(),this._renderFormHeader(),this._renderFormContent()]}_renderReadOnlyNotice(){if((this.disabled||this.readOnly)&&this.visibleElements.readOnlyNotice)return ue("calcite-notice",{class:D.disabledNotice,"data-testid":"read-only-notice",icon:"read-only-non-editable",kind:"brand",open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},this.featureFormMessages.disabledForm))}_renderFormHeader(){const{formTitle:e,formDescription:t}=this.viewModel;if(!this._formHeaderVisible)return;const a=e?ue(re,{key:"title",level:this.headingLevel},e):void 0,i=t?ue("p",{class:D.description,key:"description"},t):void 0;return ue("div",{class:D.formHeader},a,i)}_renderFormContent(){return this.viewModel.hasVisibleInputs?this.viewModel.activeForm.inputs.filter(e=>e.visible).map(e=>this._renderInput(e)):this._renderErrorNotice(this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason])}_renderInput(e){return N(e)?this._renderGroupInput(e):U(e)?this._renderLabeledField(e):P(e)?this._renderTextComponent(e):B(e)?this._renderRelationshipElementInput(e):$(e)?this._renderAttachmentElementInput(e):z(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:a,open:i}=e,n=t.filter(e=>e.visible),s=e.label??"",o=this._focusedFieldInput?.group===e,l="sequential"===this.groupDisplay;return ue("calcite-block",{class:this.classes(D.group,l?D.groupSequential:null,o?D.groupActive:null,this.disabled?D.inputDisabled:null),collapsible:!0,description:e.description??void 0,expanded:i,heading:s,headingLevel:this.headingLevel,key:`{${a.elementId}-key}`,label:s,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0},onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:a}=e.template,{label:i,required:n,dataType:s}=e,o=n?t(this.messages.requiredFieldLabel,{name:i}):i;return ue("calcite-label",{"aria-label":o,class:D.label,key:`field--${a}`},ue("div",{class:D.labelTextContent,key:"labelTextContainer"},i,n?ue("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==s?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:a}=e;return V(e.inputController)?this._renderDynamicChoiceComponent({input:e,props:t,controller:e.inputController}):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):R(e.inputController)?this._renderMultipleChoiceComponent({input:e,props:t}):"date"===a?this._renderDateComponents(e,t):(t.disabled=this.disabled,t.readOnly=t.readOnly||this.viewModel.updating,"number"===a?this._renderNumberComponent(e,t):this._renderStringComponent(e,t))}_renderAuxiliaryText(e){const{description:t}=e,a=F(e,e.validationMessage,this.messages);return a?ue("calcite-input-message",{icon:!0,status:e.status},a):t?ue("calcite-input-message",{class:D.description,icon:!1,status:e.status},t):null}_renderCodedInputs({input:e,props:t}){const a=e.input?.type??null,i=e.codedValueOptions;switch(a){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:i,props:t});default:return this._renderComboBoxComponent({options:i,props:t,input:e})}}_renderDynamicChoiceComponent({input:e,props:t,controller:a}){const i=a.filteredChoices,n=e.showNoValueLabel||this.messages.empty,s=a.evaluated&&!a.evaluating&&!a.choices.length&&ue("calcite-notice",{appearance:"transparent",kind:"info",open:!0,scale:"s",slot:"content-top",width:"full"},ue("div",{slot:"message"},this.messages.noDynamicChoices)),o=t=>{this._saveInput(e,t)},l=(e,t)=>{this._dynamicChoiceItemSelections.delete(a);const i=e.closest("calcite-autocomplete");if(i){const e=null==t?"":a.getLabel(t);a.filterValue="",i.inputValue=e}o(t)},r=({currentTarget:t})=>{const i=t.inputValue??"";a.filterValue=i,i||null==e.value||o(null)},c=e.showNoValueOptionEnabled?ue("calcite-autocomplete-item",{heading:n,key:"dynamic-choice-empty",selected:null==e.value,value:"",onCalciteAutocompleteItemSelect:({currentTarget:e})=>l(e,null),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(a)}}):null,d=t=>{const i=e.value===j?this.messages.differentValuesPlaceholder:null==e.value?"":a.inputValue;t.inputValue=i};return ue("calcite-autocomplete",{...t,afterCreate:d,disabled:t.readOnly||t.disabled,loading:a.evaluating,placeholder:null==e.value?n:t.placeholder,value:String(t.value),onblur:e=>this._onDynamicChoiceBlur(e,a),onCalciteAutocompleteBeforeOpen:()=>a.beginInteraction(),onCalciteAutocompleteTextInput:r},s,c,i.map(t=>ue("calcite-autocomplete-item",{heading:t.name,key:`dynamic-choice-${t.code}`,selected:t.code===e.value,value:String(t.code),onCalciteAutocompleteItemSelect:({currentTarget:e})=>l(e,t.code),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(a)}})))}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:a}=this,i=this._getMultipleChoiceController(e);if(!i)return null;const{input:n}=i,s=!0===n.includeSelectAllChoices,{checkboxStatesByValue:o,selectAllState:l}=i.selectionState,r=l.checked?a.deselectAllLabel:a.selectAllLabel,c=i.otherChoiceRenderState,d=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},m=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},u=t=>{const{fieldName:a}=c;a&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:a})},h=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:c.fieldName??void 0})};return ue("div",{class:D.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},s?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:l,selectAllLabel:r,handleSelectAllCheckboxChange:d}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:m}),c.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:s,otherChoiceRenderState:c,handleOtherChoiceCheckboxChange:u,handleOtherChoiceInputChange:h,differentValuesPlaceholder:a.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:a,handleSelectAllCheckboxChange:i}){return ue("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:D.multipleChoiceSelectAll,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:a,labelText:a,value:be,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:a,handleChoiceCheckboxChange:i}){const n=this._getMultipleChoiceController(e);if(!n)return[];const{choices:s}=n;return s.map(e=>{const n=a.get(e.value)??{checked:!1,indeterminate:!1};return ue("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[ge],disabled:t.readOnly||t.disabled,indeterminate:n.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:t.onfocus})})}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:a,handleOtherChoiceCheckboxChange:i,handleOtherChoiceInputChange:n,differentValuesPlaceholder:s}){const o=a.label??this.messages.otherOptionLabel;return ue("div",{class:this.classes(D.multipleChoiceOtherChoice,t?D.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},ue("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:a.checkboxState.checked,class:e.class,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,indeterminate:a.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:o,labelText:o,value:fe,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus}),a.checkboxState.checked?ue("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":o,class:D.textElementInput,"data-element-id":e[ge],disabled:e.readOnly||e.disabled,key:`${e.key}-other-choice-input`,maxLength:a.maxLength,placeholder:a.value===j?s:a.hint,status:a.status,type:"text",value:a.normalizedValue===j?"":a.normalizedValue?String(a.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:a=!1}){e.touch();const i=this._getMultipleChoiceController(e);if(!i)return;if(i.input&&!a&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const n=e.value,s=this._parseValue(t,e,a);s!==n&&await this.viewModel.setValue(e.template.elementId,s)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:a}){if(!a)return;const i=t.value,n=null==i||""===i?null:i,s=this._getMultipleChoiceController(e);if(!s)return;s.initializeExplicitOtherChoiceCheckedState(),s.stashOtherChoiceDraftValueForFeatures(e.features,n);const o=H(e,a);o&&await this.viewModel.setValueForFieldName(o,n,Array.from(e.features,e=>e.source))}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:a}){const i=this._getMultipleChoiceController(e);if(!i)return;i.setExplicitOtherChoiceCheckedState(t),e.touch(),t||i.setOtherChoiceDraftValuesFromFeatures(e.features.toArray());const n=H(e,a);if(!n)return;const s=new Map;for(const o of e.features){const e=o.getAttribute(a);if(t){if(!pe(e))continue;const t=i.getOtherChoiceDraftValue(o),a=q(t)?t:Z;s.set(o,a);continue}null!=e&&s.set(o,null)}0!==s.size&&await this.viewModel.setValuePerFeatureForFieldName(n,new Map(Array.from(s,([e,t])=>[e.source,t])))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){const a=this._getMultipleChoiceController(e);if(!a)return;const i=new Map(e.features.map(i=>[i,a.getUpdatedValueForFeature({choiceValue:t.value,currentValue:i.getAttribute(e.fieldName),isChecked:t.checked})]));0!==i.size&&await this.viewModel.setFieldInputValuePerFeature(e,i)}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===j||e.value===j)&&"batch"===this.viewModel.mode){const a={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,onblur:t.onblur,onfocus:t.onfocus,[ge]:t[ge]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:a,options:[{name:this.messages.differentValuesPlaceholder,value:j,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return ue("calcite-switch",{...t,checked:!!I(e.template,"switch")&&e.value===e.template.input.onValue,class:D.inputSwitch,disabled:t.readOnly||t.disabled,onCalciteSwitchChange:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:a}){const{trigger:i,dropdown:n,group:s}=a;return ue("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInputFromElement(e)},ue("calcite-button",{...i},e===j?this.messages.differentValuesPlaceholder:e),ue("calcite-dropdown-group",{selectionMode:s.mode},t.map(t=>ue("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:a}){const i="INSERT"===this.viewModel.editType&&e.showNoValueOptionEnabled&&!e.touched?()=>{}:a.onblur,n={...a,onblur:i};return ue("calcite-combobox",{...n,clearDisabled:e.isSubtypeField,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:a.placeholder===this.messages.differentValuesPlaceholder?j:String(a.value),onCalciteComboboxChange:({currentTarget:t})=>{t.value!==j&&(e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveInputFromElement(t))}},this.renderComboboxOptionsList({input:e,options:t,props:a}))}renderComboboxOptionsList({input:e,options:t,props:a}){const i=e=>e.map(e=>{const{value:t}=e,i=pe(e.value)?this.messages.empty:e.name;return ue("calcite-combobox-item",{heading:i,key:`#${t}`,selected:a.value===t,value:`${t}`})});let n=[];const{messages:s}=this;t.other.length>0&&n.push(ue("calcite-combobox-item-group",{key:"other",label:s.other},i(t.other))),t.unsupported.length>0&&n.push(ue("calcite-combobox-item-group",{key:"unsupported",label:s.unsupported},i(t.unsupported)));const o=i(t.recommended);n.length>0?n.unshift(ue("calcite-combobox-item-group",{key:"recommended",label:s.recommended},o)):n=o;const l=a.placeholder===this.messages.differentValuesPlaceholder,r=!l&&pe(a.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(ue("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),l&&n.unshift(ue("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:j,selected:!0,value:j})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:a}){const i=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:i})=>this._renderRadioButtons({label:t,value:i,selected:i===e.value,props:a}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,s=pe(e.value);i.unshift(this._renderRadioButtons({label:n,value:t,selected:s,props:a}))}return ue("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:D.inputRadioGroup,"data-field-name":a[ve],disabled:a.readOnly||a.disabled,key:`${a.key}-radio-group`,layout:"vertical",name:`${a.name}-${this.id}`,required:a.required},i,a.placeholder===this.messages.differentValuesPlaceholder?ue("calcite-label",{class:D.placeholderRadio,key:a.label,layout:"inline"},ue("calcite-radio-button",{checked:!0,class:D.inputRadio,disabled:!0,value:a.placeholder}),a.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:a,props:i}){return ue("calcite-label",{class:D.inputRadioLabel,key:i.label,layout:"inline"},ue("calcite-radio-button",{...i,afterCreate:void 0,afterUpdate:void 0,checked:t,class:D.inputRadio,disabled:i.readOnly||i.disabled,name:void 0,value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInputFromElement(e)}}),a)}_renderStringComponent(e,t){const{template:a}=e;return!a.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===a.input?.type?ue("calcite-text-area",{...t,class:this.classes(D.individualElement),resize:"vertical",value:t.value?String(t.value):"",onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteTextAreaInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}}):ue("calcite-input",{...t,class:this.classes(D.individualElement),type:"text",value:t.value?String(t.value):"",onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteInputInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}})}_renderNumberComponent(e,t){const a=g(e.field);return ue("calcite-input-number",{...t,integer:a,step:a?1:"any",type:"number",value:a&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onblur:a=>{t.onblur(a),e.userHasChangedValue&&this._saveInputFromElement(a.currentTarget)},onCalciteInputNumberInput:t=>{e.userHasChangedValue=!0,""===t.currentTarget.value&&this._saveInputFromElement(t.currentTarget)}})}_renderReadOnlyComponent(e,t){const a=this.getCommonInputProps(e);return ue("calcite-input",{...a,class:this.classes(D.fieldInput,D.inputDisabled,D.individualElement),readOnly:!0,type:"text",value:String(t??a.value??"")})}_renderDateComponents(e,t){const{field:a}=e;let i;switch(a.type){case"date":i=this._renderDateFieldComponents(e,t);break;case"date-only":i=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":i=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":i=this._renderTimestampOffsetFieldComponents(e,t);break;default:i=this._renderReadOnlyComponent(e,ee(a,t.value,{timeZone:e.effectiveTimeZone,...te(e.template.field)}))}return e.value===j?[i,ue("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:i}_renderDateOnlyFieldComponent(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t,{rawMax:o,rawMin:l}=e.range;return ue("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:a,"data-date-part":"date","data-element-id":t[ge],"data-field-name":t[ve],disabled:i,key:`${n}-date-input`,max:v(o)?o:void 0,min:v(l)?l:void 0,overlayPositioning:"fixed",readOnly:s,topLayerDisabled:this.topLayerDisabled,value:e.value===j?"":e.value?String(e.value):"",onblur:t.onblur,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_renderTimeOnlyFieldComponent(e,t){const{class:a,disabled:i,key:n,readOnly:s}=t;return ue("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:a,"data-date-part":"time","data-element-id":t[ge],"data-field-name":t[ve],disabled:i,key:`${n}-time-input`,overlayPositioning:"fixed",readOnly:s,step:e.timeStep,value:e.value===j?"":e.value?String(e.value):"",onblur:t.onblur,onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:a,disabled:i,key:n,readOnly:s,onblur:o,onfocus:l}=t,{rawMax:r,rawMin:c}=e.range,d=e.effectiveTimeZone,m=ae(r,d),u=ae(c,d),h=ae(e.value===j?"":e.value,d),p=e.includeTimeOffset,g={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:i,[ge]:t[ge],[ve]:t[ve],onblur:o,onfocus:l,overlayPositioning:"fixed",readOnly:s};return ue("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},ue("calcite-input-date-picker",{...g,class:a,"data-date-part":"date",key:`${n}-date-input`,max:m?.date??void 0,min:u?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:h.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),ue("calcite-input-time-picker",{...g,class:a,"data-date-part":"time",key:`${n}-time-input`,step:e.timeStep,value:h.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?ue("calcite-input-time-zone",{...g,class:a,clearable:e.value===j||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,value:h.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:a,disabled:i,key:n,readOnly:s,min:o,max:l}=t,r=e.effectiveTimeZone,c=ie(e.value===j?"":e.value,r),d=ie(l,r),m=ie(o,r),u=e.includeTime,h={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:i,[ge]:t[ge],[ve]:t[ve],onblur:t.onblur,onfocus:t.onfocus,overlayPositioning:"fixed",readOnly:s};return ue("div",{class:D.dateInputContainer,key:`${n}-date-time-container`},ue("calcite-input-date-picker",{...h,class:a,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:m?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?ue("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${n}-time-input`,step:1,value:c.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){return this._relatedRecordsEnabled?ue(X,{afterObserverCreated:this._afterListObserverCreated,afterObserverRemoved:this._afterListObserverRemoved,input:e,messages:this.messages,messagesCommon:this.messagesCommon,viewModel:this.viewModel}):null}_renderRelationshipListPage(){const{activeRelationshipInput:e}=this.viewModel;if(e)return this._renderRelationshipElementInput(e)}_renderAttachmentElementInput(e){if(!this.attachmentsEnabled)return;const{allAttachmentsVisibleOnDefaultPage:t,attachments:a,defaultPageAttachments:i,template:{description:n,elementId:s,label:o}}=e,l=t?a:i;return ue("div",{class:D.attachmentElementInput,"data-testid":`attachment-element-${s}`,key:`attachment-element-${s}`},o?ue("div",{class:D.attachmentElementLabel,key:`attachment-element-label-${s}`},o):null,n?ue("div",{class:D.description,key:`attachment-element-description-${s}`},n):null,a.length?this._renderAttachmentList(e,l,{label:o||this.messagesCommon.details,viewAllCount:t?null:a.length}):ue("div",{class:D.attachmentElementEmptyState,key:`attachment-element-empty-state-${s}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){const e=this.viewModel.selectedAttachmentListInput;if(e)return ue("div",{class:D.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,a){const{filterEnabled:i,label:n,viewAllCount:s}=a;return ue("calcite-list",{class:D.attachmentElementList,filterEnabled:i,filterPlaceholder:i?this.messages.attachments.searchAttachments:void 0,filterProps:i?ce:void 0,filterText:i?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:i?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=s?this._renderViewAllAttachmentsItem(e,s):null)}_renderAttachmentListItems(e,t){const{elementId:a}=e.template;return t.map((t,i)=>{const n=this._formatAttachmentSize(t.size),s=this._getAttachmentLabel(t,i,n,e.displayFilename),o=s===n?void 0:n,l=C(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=c.isDeleted,m=!d&&(r||c.isRenamed||c.isReplaced);return ue("calcite-list-item",{class:D.attachmentElementListItem,description:o,key:`attachment-item-${l}`,label:s,onCalciteListItemSelect:r||d?void 0:()=>this._setSelectedAttachment({attachmentKey:l,elementId:a})},ue("div",{class:D.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,s,e)),m?ue("span",{class:D.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[ue("calcite-action",{disabled:this._disableAttachmentModification(e),icon:"x",scale:"s",slot:"actions-end",text:this.messagesCommon.delete,title:this.messagesCommon.delete,onclick:()=>this.viewModel.stageDeleteAttachment(a,C(t))})]:d?ue("calcite-chip",{label:this.messages.attachments.deleted,scale:"s",slot:"content-end"},this.messages.attachments.deleted):ue("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))})}_renderViewAllAttachmentsItem(e,a){const{elementId:i}=e.template,{viewAll:n}=this.messages.attachments;return ue("calcite-list-item",{class:D.attachmentElementListItem,description:t(this.messages.attachments.count,{count:a}),key:`attachment-item-view-all-${i}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(i)},ue("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,a=this.effectiveDisabled||e.addDisabled,i=this._renderAttachmentCountLimitsLabel(e),n=this._getAttachmentNoticeMessage(e),s=e.hasMinimumAttachmentCountNotMet||e.hasExceededAttachmentLimit?"danger":"info",o=e.canUploadFiles,l=e.isCaptureOnly&&!this.effectiveDisabled&&!n;return ue("div",{class:D.attachmentElementAddActions,key:`attachment-element-add-actions-${t}`},o?ue("calcite-button",{appearance:"outline",disabled:a,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach):null,this._renderAttachmentCaptureButton(e),l?this._renderAttachmentCaptureDisabledNotice(t):null,i?ue("div",{class:D.attachmentElementEmptyActionHint},i):null,!this.effectiveDisabled&&n?ue("calcite-notice",{closable:!1,icon:"danger"===s?"exclamation-mark-circle":"lightbulb",kind:s,open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},n)):null)}_renderAttachmentCaptureButton(e){if(!e.hasCaptureInputs)return null;const t=e.captureMediaType;return ue("calcite-button",{appearance:"outline",disabled:!0,iconStart:Ce(t),kind:"neutral",round:!0,scale:"s"},this._getCaptureButtonLabel(t))}_getAttachmentNoticeMessage(e){const t=this.messages.attachments;return e.hasUnsupportedFileTypeValidationError?this._getUnsupportedFileTypeMessage():e.hasMinimumAttachmentCountNotMet&&this._shouldShowMinimumAttachmentNotice(e)?t.minimumNotMet:e.hasExceededAttachmentLimit?t.attachmentLimitExceeded:e.hasReachedAttachmentLimit?t.attachmentLimitReached:null}_shouldShowMinimumAttachmentNotice(e){return e.hasAttachmentChanges||this.viewModel.submitHasBeenAttempted||e.touched}_getCaptureButtonLabel(e){const{capture:t,recordAudio:a,takePhoto:i,takeVideo:n}=this.messages.attachments;switch(e){case"image":return i||t;case"video":return n||t;case"audio":return a||t;default:return t}}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:a}=e.template;if(e.isCaptureOnly)return this._renderAttachmentCaptureDisabledNotice(a);const i=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,s=this.messages.attachments,o=s.dragAndDropFile,l="upload",r=e=>{this._attachmentFileInputMap.set(a,e)};return ue("div",{class:D.attachmentElementAddPanel,key:`attachment-element-add-panel-${a}`},ue("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(a)},afterUpdate:r,class:D.attachmentElementFileInput,"data-element-id":a,disabled:n,multiple:i,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?Array.from(t.files):[];this._stageAttachmentFiles(a,i),t.value=""}}),ue("div",{class:D.attachmentElementAddDropzone,"data-disabled":n?"true":"false",ondragover:e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),n)return;const t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(a,t)}},ue("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:l,scale:"l"}),ue("div",{class:D.attachmentElementAddDropzoneHeading},s.addFile),ue("div",{class:D.attachmentElementAddDropzoneDetail,title:o},o),ue("calcite-button",{appearance:"transparent",disabled:n,iconStart:"folder-open",kind:"brand",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(a,n)}},s.selectFile)),this._renderAttachmentValidationCriteria(e,{includeCountCriteria:!0}))}_renderAttachmentCaptureDisabledNotice(e){return ue("calcite-notice",{class:D.attachmentElementCaptureNotice,icon:!0,key:`attachment-element-capture-disabled-notice-${e}`,kind:"warning",open:!0,scale:"s"},ue("div",{slot:"message"},this.messages.attachments.captureMethodNotSupported))}async _stageAttachmentFiles(e,t){if(0===t.length)return;const a=this.viewModel.selectedAttachmentAddInput;let i=!0;try{i=(await this.viewModel.stageAddAttachments(e,t)).length>0&&!a?.hasInvalidValidationCriteria&&!a?.hasUnsupportedFileTypeValidationError}finally{i&&this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){const e=this.selectedAttachmentDetails;if(!e)return;if("replacing-attachment"===this.page)return this._renderAttachmentReplacePanel(e);const{attachment:t,input:a}=e,i=C(t),n=!!a.getAttachmentPreviewUrl(t),s=!this._disableAttachmentModification(a)&&a.canUploadFiles,o=a.getAttachmentEditState(t);return ue("div",{class:D.attachmentElementDetail,key:`attachment-detail-panel-${a.template.elementId}-${i}`},ue("div",{class:D.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)),ue("div",{class:D.attachmentElementDetailActions},y(t)?ue("calcite-button",{appearance:"outline",disabled:!n,iconStart:"expand",kind:"neutral",label:this.messages.attachments.maximize,scale:"m",title:this.messages.attachments.maximize,onclick:this._maximizeSelectedAttachment}):null,ue("calcite-button",{appearance:"outline",disabled:!n||o.isReplaced,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),ue("calcite-button",{appearance:"outline",disabled:!s,iconStart:"upload-to",kind:"neutral",label:this.messages.attachments.replace,scale:"m",title:this.messages.attachments.replace,onclick:this._enterAttachmentReplaceView})),ue("div",{class:D.attachmentElementDetailMetadata},ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),this._renderFileNameContent(t,a)),ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.size),ue("span",{class:D.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.type),ue("span",{class:D.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderFileNameContent(e,t){if(!t.allowUserRename)return ue("span",{class:D.attachmentElementDetailMetadataValue},e.name);const a=t.getAttachmentEditState(e),{baseName:i,extension:n}=A(e.name),s=this._disableAttachmentModification(t),o=!s&&0===e.name.trim().length;return[ue("div",{class:D.attachmentElementDetailFileNameRow,key:"file-name-row"},ue("calcite-input",{class:D.attachmentElementDetailFileNameInput,disabled:s,scale:"m",status:o?"invalid":"idle",suffixText:n,value:i,onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),ue("calcite-button",{appearance:"transparent",disabled:s||null==a.initialName||!a.isRenamed,iconStart:"reset",kind:"neutral",label:this.messages.footerButtons.reset,scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})),o?ue("calcite-input-message",{icon:!0,key:"file-name-message",status:"invalid"},this.messages.validationErrors.cannotBeNull):null]}_renderAttachmentReplacePanel(e){const{attachment:t,input:a}=e,i=this._disableAttachmentModification(a)||!a.canUploadFiles,n=a.template.elementId;return ue("div",{class:D.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${C(t)}`},ue("input",{accept:a.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:D.attachmentElementFileInput,disabled:i,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?.[0];a&&this._stageSelectedAttachmentReplacement(a),t.value=""}}),ue("div",{class:D.attachmentElementAddDropzone,"data-disabled":i?"true":"false",ondragover:e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),i)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},ue("calcite-icon",{class:D.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),ue("div",{class:D.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),ue("div",{class:D.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),ue("calcite-button",{appearance:"transparent",disabled:i,iconStart:"folder-open",kind:"brand",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),this._renderAttachmentValidationCriteria(a,{includeCountCriteria:!1}),ue("div",{class:D.attachmentElementDetailMetadata},ue("div",{class:D.attachmentElementDetailMetadataGroup},ue("span",{class:D.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),ue("span",{class:D.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:a}=e;return ue("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},ue("div",{class:D.attachmentElementDialogPreview},this._renderAttachmentPreviewImageForInput(t,a)))}_setSelectedAttachment(e,t){t?.touch(),this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){const{viewModel:t}=this;t.setSelectedAttachmentAddElementId(e),t.selectedAttachmentAddInput?.touch(),t.selectedAttachmentAddInput?.clearValidationCriteriaState(),this.hideAttachmentDialog()}_setAttachmentListElementId(e){const{viewModel:t}=this;t.setSelectedAttachmentListElementId(e),t.selectedAttachmentListInput?.touch(),this.hideAttachmentDialog()}_getAttachmentLabel(e,a,i,n){return!1!==n&&v(e.name)&&e.name.length>0?e.name:i!==this.messagesCommon.notApplicable?i:t(this.messages.attachments.attachmentNumberedLabel,{index:a+1})}_renderAttachmentCountLimitsLabel(e){const t=this.messages.attachments,a=null!=e.minAttachmentCount&&e.minAttachmentCount>0?this._renderAttachmentCountLimitLabel(t.minAttachmentsShort,e.minAttachmentCount,"min"):null,i=null!=e.maxAttachmentCount?this._renderAttachmentCountLimitLabel(t.maxAttachmentsShort,e.maxAttachmentCount,"max"):null;return a||i?[a,a&&i?ue("span",{key:"attachment-count-limits-separator"},", "):null,i]:null}_renderAttachmentCountLimitLabel(e,a,i){const n="__count__",[s,o]=t(e,{count:n}).split(n);return ue("span",{key:i},s,ue("span",{class:D.attachmentElementEmptyActionHintValue},a),o)}_renderAttachmentValidationCriteria(e,{includeCountCriteria:t}){const a=this._getAttachmentValidationCriteria(e,{includeCountCriteria:t}),i=`attachment-validation-criteria-${e.template.elementId}`;return 0===a.length?null:ue("div",{class:D.attachmentElementValidationCriteria,key:i},a.map(({key:e,message:t,state:a})=>ue("calcite-notice",{appearance:"danger"===a?"outline-fill":"transparent",closable:!1,icon:!0,key:e,kind:a,open:!0,scale:"s",width:"full"},ue("div",{slot:"message"},t))))}_getAttachmentValidationCriteria(e,{includeCountCriteria:a}){const i=[],n=e.validationCriterionStates,s=this.messages.attachments,o=this._getNestableAttachmentInputs(e.input);e.hasUnsupportedFileTypeValidationError&&i.push({key:"unsupported-file-type",message:this._getUnsupportedFileTypeMessage(),state:"danger"});for(const l of o)"document"===l.type&&null!=l.maxFileSize&&i.push({key:"maximum-file-size",message:t(s.maximumFileSize,{maxSize:this._formatAttachmentSizeLimitInMegabytes(l.maxFileSize)}),state:n.get("maximum-file-size")??"info"}),"audio"===l.type&&null!=l.maxDuration&&i.push({key:"maximum-audio-length",message:t(s.maximumAudioLength,{maxDuration:this._formatAttachmentDurationLimit(l.maxDuration)}),state:n.get("maximum-audio-length")??"info"}),"video"===l.type&&null!=l.maxDuration&&i.push({key:"maximum-video-length",message:t(s.maximumVideoLength,{maxDuration:this._formatAttachmentDurationLimit(l.maxDuration)}),state:n.get("maximum-video-length")??"info"}),"image"===l.type&&null!=l.maxImageSize&&i.push({key:"maximum-image-size",message:t(s.attachmentMustBeSmallerThan,{maxSize:`${l.maxImageSize}px`}),state:n.get("maximum-image-size")??"info"});return a&&null!=e.minAttachmentCount&&e.minAttachmentCount>0&&i.push({key:"minimum-number-of-files",message:t(s.minimumNumberOfFiles,{count:e.minAttachmentCount}),state:n.get("minimum-number-of-files")??"info"}),a&&null!=e.maxAttachmentCount&&i.push({key:"maximum-number-of-files",message:t(s.maximumNumberOfFiles,{count:e.maxAttachmentCount}),state:n.get("maximum-number-of-files")??"info"}),i}_getNestableAttachmentInputs(e){return null==e?[]:"attachment"===e.type?e.inputTypes?.slice()??[]:[e]}_getUnsupportedFileTypeMessage(){return this.featureTableMessages.errorFileUnsupported}_formatAttachmentSize(e){return null==e||Number.isNaN(e)?this.messagesCommon.notApplicable:m(this.messagesUnits,e)}_formatAttachmentSizeLimitInMegabytes(e){return m(this.messagesUnits,1048576*e)}_formatAttachmentDurationLimit(e){return p(1e3*Math.round(e),{...e>=3600?{hour:"2-digit",hourCycle:"h23"}:{},minute:"2-digit",second:"2-digit",timeZone:"UTC"})}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;const t=this.messages.attachments.attachmentTypes,a=f(e);return t?.[a]||e}_renderAttachmentPreviewThumbnail(e,t,a){const i=a.getAttachmentPreviewUrl(e,64);return i&&y(e)?ue("img",{alt:t,class:D.attachmentElementListItemThumb,src:i}):ue("calcite-icon",{class:D.attachmentElementListItemIcon,icon:_(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const a=t.getAttachmentPreviewUrl(e),i=e.name||this.messagesCommon.details;return a&&y(e)?ue("img",{alt:i,class:D.attachmentElementDetailPreviewImage,src:a,title:i}):[ue("calcite-icon",{class:D.attachmentElementDetailPreviewIcon,icon:_(e.contentType),scale:"l",textLabel:i,title:i}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await Q(e)}_canReplaceSelectedAttachment(){return!this.effectiveDisabled&&!!this.selectedAttachmentDetails?.input.canUploadFiles}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const a=t.input.template.elementId,i=C(t.attachment);let n=!1;try{n=await this.viewModel.stageReplaceAttachment(a,i,e)}finally{n&&this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails;if(!t?.attachment)return;const a=t.input.template.elementId,i=C(t.attachment);this.viewModel.stageRenameAttachment(a,i,e)}_resetSelectedAttachmentChanges(){const e=this.selectedAttachmentDetails;e?.attachment&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,C(e.attachment))}_deleteSelectedAttachment(){const e=this.selectedAttachmentDetails;if(!e?.attachment||this._disableAttachmentModification(e.input))return;const t=e.input.template.elementId,a=C(e.attachment);this.viewModel.stageDeleteAttachment(t,a),this._setSelectedAttachment(null)}_disableAttachmentModification(e){return this.disabledOrReadOnly||!e.editable}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return ue("div",{class:D.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){if(!this._associationsEnabled)return;const{elementId:t}=e.template;return ue("div",{class:D.utilityNetworkAssociationsElementInput,"data-testid":t,key:t},this._associationsWidgetsMap.get(e)?.render())}getCommonInputProps(e){const{template:t,valid:a,value:i,minLength:n,maxLength:s,required:o,fieldName:l,editable:r,status:c,range:{max:d,min:m}}=e,u=!r||this.readOnly,h=this.disabled||this.viewModel.updating;let p=t.hint??void 0,g=!1;return i===j&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":a?"false":"true",class:this.classes(D.fieldInput,u?D.inputDisabled:null),status:c,maxLength:s&&s>-1?s:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:l,name:l,max:null!=d?d:void 0,min:null!=m?m:void 0,disabled:h,readOnly:u,onblur:this._onComponentBlur,required:o,placeholder:p,value:g?"":i??"",[ge]:t.elementId,[ve]:l,onfocus:this._onComponentFocus}}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_onFormSubmit(e){e.preventDefault()}_handleDragAndDrop(e){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none")}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(ge))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,a=e.querySelector("calcite-radio-button"),i=t||a;i&&this._afterComponentCreateOrUpdate(i)}_onComponentFocus(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._focusedFieldInput=a}_isMultipleChoiceCheckbox(e,t){const a=this._getMultipleChoiceController(t);return"CALCITE-CHECKBOX"===e.tagName&&null!=a?.input}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),a=this._focusedFieldInput;this._attemptFocusOnNextRender&&a===t&&(this._attemptFocusOnNextRender=!1,he(e))}_onComponentBlur(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,a)||a.touch(),this._focusedFieldInput=null}_onDynamicChoiceBlur(e,t){const a=e.currentTarget;if(this._dynamicChoiceItemSelections.delete(t))return;const i=e.relatedTarget;i instanceof Node&&a.contains(i)||(t.endInteraction(),a.inputValue=t.inputValue,this._onComponentBlur(e))}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear()}_parseValue(e,t,a=!1){const i=this._getMultipleChoiceController(t);if(i){const{input:t,values:n}=i;if(t&&n){const t=e;return i.getValueFromCheckboxChange({choiceValue:t.value,isChecked:t.checked,isSelectAllCheckbox:a})}}if(I(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const a of t.domain.codedValues)if(a.name===e.selectedItems[0].textContent)return a.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const n=e.value;return null==n||""===n?null:"number"===t.dataType?"-0"===n||"-0."===n||"-0,"===n?n:parseFloat(n):"date"===t.field.type?parseFloat(n):n}_getMultipleChoiceController(e){return R(e.inputController)?e.inputController:null}_saveInputFromElement(e){const t=this._getFieldInputFromHTMLElement(e);if(!t)return;const a=this._parseValue(e,t);this._saveInput(t,a)}_saveInput(e,t){const{elementId:a}=e.template,i=e?.value,{viewModel:s}=this;if(I(e.template,"switch")&&"single"!==s.mode){const t=n(this._batchSwitchInputInitialValues,e,()=>e.value);this._batchSwitchInputInitialValues.set(e,null===t?i:t)}t!==i&&(e.touch(),e.isSubtypeField&&"batch"!==s.mode&&k(s.activeLayer,i,t)?this._pendingSubtypeChoice||(this._pendingSubtypeChoice=this._handleSubtypeChoice(e,t)):s.setValue(a,t))}async _handleSubtypeChoice(e,a){const{value:i,template:n}=e,{elementId:s}=n,{messages:o,viewModel:l,messagesCommon:r}=this,{subtypes:c,activeFeatureIndex:d}=l;if(await l.setValue(s,a),!c?.length)return;const m=c.find(e=>e.code===a),u=c.find(e=>e.code===i)?.name??`${i}`;if(!m)return;const h=Promise.withResolvers();l.pendingSubtypeChoice=h;let p="update-fields";const g=[{label:o.subtypes.useDefaultValuesOption,value:"update-fields"},{label:o.subtypes.keepCurrentValuesOption,value:"keep-existing"}],v={context:"info",title:o.subtypes.changeWarningTitle,message:t(o.subtypes.changeWarning,{originalType:u,newType:m.name}),radios:g,defaultRadioSelection:"update-fields",onRadioSelection:e=>{p=e},actions:{primary:{label:r.apply,action:()=>h.resolve(p),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>h.resolve("undo")}},cancel:()=>h.reject()};try{this.showPrompt(v);switch(await h.promise){case"update-fields":await l.applySubtypeDefaults(m),await l.handleSubtypeChanged(d);break;case"keep-existing":await l.handleSubtypeChanged(d);break;case"undo":await this.viewModel.setValue(s,i)}}finally{l.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_afterDateComponentCreateOrUpdate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:a}=e.template,i=e.field.type,n=this._dateComponentMap.get(`${a}`);if(!n)return;const s=e.effectiveTimeZone;let o=e.value===j?void 0:e.value,l=null;"date-only"===i?l=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===i?(o=ne(o),l=ne(t.value)):l="timestamp-offset"===i?null!=t.value?se({dateComponent:n.date,timeComponent:n.time,oldValue:o,timeZoneComponent:n.timeZone,defaultTimeZone:s}):null:null!=t.value?oe({oldValue:o,dateComponent:n.date,timeZone:s,timeComponent:n.time?.value===j?void 0:n.time}):null,o!==l&&(e.touch(),null!==l&&t.value?this.viewModel.setValue(a,l):this.viewModel.setValue(a,null))}_renderViewingAssociationsPage(){return this._associationsList?.render()}_onActiveAssociationsInputChange(e){const t=this._associationsList;t&&(e?(t.associationInput=e,t.viewModel=e.viewModel):t.associationInput=null)}async _setUpAssociationsWidgets(){const e=this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs;if(this._associationsEnabled&&0!==e.length){await this._setUpUtilityNetworkAssociationList();for(const t of e)this._associationsWidgetsMap.set(t,await this._createAssociationsWidget(t))}}async _setUpUtilityNetworkAssociationList(){if(this._associationsList)return;const e=(await(import("./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js"))).default;this._associationsList=new e({onSelectLayer:this._onSelectAssociatedLayer.bind(this),onSelectFeature:this._onEditAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)});const t=this.viewModel.activeAssociationsInput;t&&(this._associationsList.associationInput=t,this._associationsList.viewModel=t.viewModel)}async _createAssociationsWidget(e){return new(0,(await(import("./Feature/FeatureUtilityNetworkAssociations.js"))).default)({viewModel:e.viewModel,onSelectAssociationType:t=>this._onSelectAssociationType(e,t)})}_destroyAssociationsWidgets(){this._associationsWidgetsMap.forEach(e=>s(e)),this._associationsWidgetsMap.clear()}_onSelectAssociationType(e,{listType:t}){this.setActiveAssociationsInput(e),this.setActiveAssociationType(t)}_onSelectAssociatedLayer({layer:e}){this.setActiveAssociationsLayer(e)}async _onEditAssociatedFeature(e){const t=this.callbacks?.editAssociatedFeature,a=this.viewModel.activeAssociationsInput;if(!t||!a?.feature)return;const{association:i,feature:n}=e;await t({parentFeature:a.feature.plainGraphic,association:i,feature:n})}_onAddAssociation(e){const t=this.callbacks?.addAssociation,a=this.viewModel.activeAssociationsInput;if(!t||!a?.feature)return;const{associationType:i,utilityNetwork:n}=e;t({feature:a.feature.plainGraphic,associationType:i,utilityNetwork:n})}_setFocusableInput(e){const t=e&&U(e)?e:this._findFocusableInput(e);this._syncGroupInputStates(),this._focusedFieldInput=t,this._attemptFocusOnNextRender=!0}_findFocusableInput(e){const t=this.viewModel.activeForm.inputs;if(!t.length)return;const a=M(t);let i;if(e)if(N(e)){const t=e.inputs.find(e=>e.visible);i=t?a.indexOf(t):0}else{let n;if(W(e)&&!e.group.open){n=e.group.inputs.filter(U)[t.length-1]}else n=e;i=a.indexOf(n)+1}else i=0;for(let n=i;n<a.length;n++){const e=a[n];if(e.visible&&U(e)){if(this.disabledOrReadOnly&&("switch"===e?.inputType||"radio-buttons"===e?.inputType))continue;return e}}return null}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._setFocusableInput(t),"sequential"===this.groupDisplay&&this.viewModel.activeForm.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.activeForm?.allGroupInputs;if(!e.length)return;const t=e.filter(e=>e.open);0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach(e=>e.open=!1)}};function Ce(e){switch(e){case"audio":return _("audio/mpeg");case"video":return _("video/mp4");case"image":return _("image/png");default:return"camera"}}e([u()],_e.prototype,"activeFeatureIndex",null),e([u()],_e.prototype,"attachmentsEnabled",null),e([u()],_e.prototype,"callbacks",null),e([u()],_e.prototype,"disabled",null),e([u()],_e.prototype,"effectiveTitle",null),e([u()],_e.prototype,"effectiveDisabled",null),e([u()],_e.prototype,"disabledOrReadOnly",null),e([u()],_e.prototype,"features",null),e([u()],_e.prototype,"footerButtonInfos",null),e([u()],_e.prototype,"map",null),e([u()],_e.prototype,"maximumFeatureCount",null),e([u()],_e.prototype,"maximumFeatureCountWithComplexForms",null),e([u()],_e.prototype,"spatialReference",null),e([u()],_e.prototype,"layerInfos",null),e([u()],_e.prototype,"timeZone",null),e([u()],_e.prototype,"headingLevel",void 0),e([u()],_e.prototype,"icon",null),e([u(),de("esri/t9n/common")],_e.prototype,"messagesCommon",void 0),e([u(),de("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],_e.prototype,"messages",void 0),e([u(),de("esri/widgets/FeatureForm/t9n/FeatureForm")],_e.prototype,"featureFormMessages",void 0),e([u(),de("esri/widgets/FeatureTable/t9n/FeatureTable")],_e.prototype,"featureTableMessages",void 0),e([u(),de("esri/core/t9n/Units")],_e.prototype,"messagesUnits",void 0),e([u()],_e.prototype,"page",null),e([u()],_e.prototype,"readOnly",null),e([u()],_e.prototype,"showPrompt",null),e([u()],_e.prototype,"clearPrompt",null),e([u()],_e.prototype,"selectedAttachment",null),e([u()],_e.prototype,"selectedAttachmentDetails",null),e([u()],_e.prototype,"valid",null),e([u({type:x}),me(["attachments-change","value-change","values-change","submit"])],_e.prototype,"viewModel",void 0),e([u({type:L,nonNullable:!0})],_e.prototype,"visibleElements",void 0),e([u()],_e.prototype,"groupDisplay",void 0),e([u()],_e.prototype,"_formHeaderVisible",null),e([u()],_e.prototype,"_associationsEnabled",null),e([u()],_e.prototype,"_associationsList",void 0),e([u()],_e.prototype,"_attemptFocusOnNextRender",void 0),e([u()],_e.prototype,"_formId",null),e([u()],_e.prototype,"_focusedFieldInput",void 0),e([u()],_e.prototype,"_pendingSubtypeChoice",void 0),e([u()],_e.prototype,"_relatedRecordsEnabled",null),e([u()],_e.prototype,"_listObserverNode",void 0),e([u()],_e.prototype,"_attachmentDialogInfo",void 0),e([u()],_e.prototype,"_attachmentListFilterText",void 0),e([u()],_e.prototype,"_prompt",void 0),e([u()],_e.prototype,"test",null),_e=e([h("esri.widgets.BatchAttributeForm")],_e);const ye=_e;export{ye as default};
|