@arcgis/core 5.2.0-next.145 → 5.2.0-next.147

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/arcade/featureSetUtils.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/2062d46f638eabfc9499.js +1 -0
  4. package/assets/esri/core/workers/chunks/{8ba32d3a0df4a206ef1c.js → 392bcef780df52fb4cca.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{d201fbf3ceff946d2bd6.js → 44d5508042cacdfcac47.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{d4926545193414cf2f16.js → 4ed8655770a3e018e366.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{cbe6c0f32608cb504695.js → 776ae25a34352d3468bc.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{fccbb902fe08448f91de.js → 9c1e69ac82e2bf746191.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{8b54589f173259c1ba55.js → b8054adc45bca069b948.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{43fc42405167a5537039.js → f095cf98940e3f95d51e.js} +1 -1
  11. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +0 -2
  12. package/assets/esri/themes/dark/main.css +1 -1
  13. package/assets/esri/themes/light/main.css +1 -1
  14. package/assets/esri/themes/light/view.css +1 -1
  15. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
  16. package/chunks/GlobalIllumination.glsl.js +4 -2
  17. package/chunks/GlobalIlluminationBlur.glsl.js +3 -5
  18. package/chunks/GlobalIlluminationUpscale.glsl.js +1 -1
  19. package/config.js +1 -1
  20. package/core/colorUtils.js +1 -1
  21. package/form/elements/inputs/DynamicChoiceInput.d.ts +35 -5
  22. package/kernel.js +1 -1
  23. package/layers/ParquetLayer.d.ts +9 -8
  24. package/layers/ParquetLayer.js +1 -1
  25. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  26. package/layers/raster/datasets/TIFFRaster.js +1 -1
  27. package/layers/support/ParquetPortalItemData.d.ts +2 -0
  28. package/layers/support/ParquetPortalItemData.js +1 -1
  29. package/layers/support/PortalItemData.d.ts +21 -0
  30. package/layers/support/parquetUtils.d.ts +1 -1
  31. package/layers/support/types.d.ts +1 -1
  32. package/package.json +2 -2
  33. package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
  34. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
  35. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  36. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js +2 -2
  37. package/views/interactive/options/SnappingOptions.d.ts +1 -0
  38. package/views/interactive/options/TooltipOptions.d.ts +1 -0
  39. package/views/interactive/options/ViewOptions.d.ts +1 -0
  40. package/views/interactive/support/Units.d.ts +1 -0
  41. package/views/layers/ParquetLayerView.js +1 -1
  42. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  43. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  44. package/widgets/BatchAttributeForm/expressions/expressionUtils.js +1 -1
  45. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +6 -0
  46. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  47. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
  48. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  49. package/widgets/BatchAttributeForm.js +1 -1
  50. package/widgets/FeatureForm.d.ts +2 -2
  51. package/assets/esri/core/workers/chunks/25e6013e2c095629b236.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 t from"../../../../core/Accessor.js";import{createTask as n}from"../../../../core/asyncUtils.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{abortMaybe as a}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{validateDomainValue as d}from"../../../../layers/support/domainUtils.js";import{makeArcadeContext as f,castArcadeValue as p}from"../../expressions/expressionUtils.js";let m=class extends t{constructor(e){super(e),this.filterValue=``,this._choices=[],this._evaluated=!1,this._choicesByCode=new Map,this._expressionTask=null,this._interactionActive=!1,this._updatingHandles=new u}destroy(){a(this._expressionTask),this._updatingHandles.destroy()}get arcadeContextInfo(){return this.fieldInput.expressionsManager.arcadeContext}get choices(){return this._choices}get evaluating(){return this._updatingHandles.updating}get evaluated(){return this._evaluated}get inputValue(){if(this._interactionActive)return this.filterValue;let e=this.fieldInput.value;return e==null?``:this.getLabel(e)}get features(){return this.fieldInput.features}get filteredChoices(){let e=this.choices,t=this.filterValue.trim().toLocaleLowerCase();return t?e.filter((e,n)=>this._normalizedChoiceNames[n].includes(t)):e}get input(){return this.fieldInput.input}get _normalizedChoiceNames(){return this._choices.map(({code:e,name:t})=>`${t}\n${this.getLabel(e)}`.toLocaleLowerCase())}beginInteraction(){this._interactionActive||(this._interactionActive=!0,this.filterValue=``,this.evaluateChoiceExpression())}getChoice(e){return this._choicesByCode.get(e)}getLabel(e){let t=this.fieldInput.domain;return t?.type===`coded-value`?t.getName(e)??this.getChoice(e)?.name??String(e):this.getChoice(e)?.name??String(e)}endInteraction(){this._interactionActive=!1,this.filterValue=``}async evaluateChoiceExpression(){this._expressionTask=a(this._expressionTask);let e=n(e=>this._evaluateChoiceExpression(e));this._expressionTask=e;try{return await o(this._updatingHandles.addPromise(e.promise))??this.choices}finally{this._expressionTask===e&&(this._expressionTask=null)}}async _evaluateChoiceExpression(e){let t=await import(`../../../../arcade/languageUtils.js`);s(e);let n=this.arcadeContextInfo,r=this.fieldInput.field,a=Array(this.features.length),o=new Map,c;this.features.forEach((t,r)=>{let s=this.fieldInput.template.getExpressionExecutorsForLayer(t.layer)?.choiceExpression;if(!s){a[r]=[];return}let l=f(n,t,e);c||=l.executeContext,i(o,s,()=>[]).push({index:r,variables:l.variables})});for(let[i,l]of o){let o=await i.executeAsyncBatch(l,({variables:e})=>e,c);s(e);for(let e=0;e<o.length;e++){let i=o[e];if(i.status===`rejected`){a[l[e].index]=[];continue}a[l[e].index]=this._parseChoices(i.value,n,r,t)}}let l=this.fieldInput.domain,u=_(g(a)).filter(({code:e})=>d(r,e,l)===null);return this._choicesByCode=new Map(u.map(e=>[e.code,e])),this._choices=u,this._evaluated=!0,u}_parseChoices(e,t,n,r){if(!v(e,r))return b(this),[];let i=y(e,`choices`),a=r.isImmutableArray(i)?i.toArray():Array.isArray(i)?i:[],o=[];for(let e of a){if(!v(e,r)){b(this);continue}let i=y(e,`name`),a=y(e,`code`);if(typeof i!=`string`||a===void 0||r.isVoid(a)||r.isFunctionParameter(a)){b(this);continue}let s=p(a,n,t.timeZone,r);s!=null&&o.push({name:i,code:s})}return o}};e([c()],m.prototype,`arcadeContextInfo`,null),e([c()],m.prototype,`choices`,null),e([c()],m.prototype,`evaluating`,null),e([c()],m.prototype,`evaluated`,null),e([c()],m.prototype,`inputValue`,null),e([c()],m.prototype,`features`,null),e([c({constructOnly:!0})],m.prototype,`fieldInput`,void 0),e([c()],m.prototype,`filteredChoices`,null),e([c()],m.prototype,`filterValue`,void 0),e([c()],m.prototype,`input`,null),e([c()],m.prototype,`_choices`,void 0),e([c()],m.prototype,`_evaluated`,void 0),e([c()],m.prototype,`_interactionActive`,void 0),e([c()],m.prototype,`_normalizedChoiceNames`,null),m=e([l(`esri.widgets.BatchAttributeForm.inputs.support.DynamicChoiceController`)],m);const h=m;function g(e){let[t,...n]=e;if(!t)return[];let r=t;for(let e of n.sort((e,t)=>e.length-t.length)){if(!e.length)return[];let t=new Map;for(let{code:n,name:r}of e)i(t,n,()=>new Set).add(r);if(r=r.filter(({code:e,name:n})=>t.get(e)?.has(n)),!r.length)break}return r}function _(e){let t=new Set;return e.filter(({code:e})=>!t.has(e)&&(t.add(e),!0))}function v(e,t){return t.isDictionary(e)&&typeof e.field==`function`&&typeof e.keys==`function`}function y(e,t){let n=e.keys().find(e=>e.toLowerCase()===t);return n==null?void 0:e.field(n)}function b(e){r.getLogger(e).error(`Value returned by choice expression does not conform to specification.`)}export{h as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as n}from"../../../../core/asyncUtils.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{abortMaybe as a}from"../../../../core/maybe.js";import{ignoreAbortErrors as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{validateDomainValue as d}from"../../../../layers/support/domainUtils.js";import{castArcadeValue as f}from"../../expressions/expressionUtils.js";import{makeUseId as p}from"./inputUtils.js";import{isEmptyValue as m}from"../../../support/forms/formUtils.js";let h=class extends t{constructor(e){super(e),this.initialEvaluationInProgress=!1,this.filterValue=``,this._choices=[],this._evaluated=!1,this._choicesByCode=new Map,this._expressionTask=null,this._interactionActive=!1,this._updatingHandles=new u}initialize(){!this._codedValueDomain&&!m(this.fieldInput.value)&&(this.initialEvaluationInProgress=!0,this.evaluateChoiceExpression().finally(()=>{this.initialEvaluationInProgress=!1}))}destroy(){a(this._expressionTask),this._updatingHandles.destroy()}get arcadeContextInfo(){return this.fieldInput.expressionsManager.arcadeContext}get choices(){return this._choices}get evaluating(){return this._updatingHandles.updating}get evaluated(){return this._evaluated}get inputValue(){if(this._interactionActive)return this.filterValue;let e=this.fieldInput.value;return e==null?``:this.getLabel(e)}get features(){return this.fieldInput.features}get filteredChoices(){let e=this.choices,t=this.filterValue.trim().toLocaleLowerCase();return t?e.filter((e,n)=>this._normalizedChoiceNames[n].includes(t)):e}get input(){return this.fieldInput.input}get _codedValueDomain(){let e=this.fieldInput.domain;return e?.type===`coded-value`?e:null}get _normalizedChoiceNames(){return this._choices.map(({code:e,name:t})=>`${t}\n${this.getLabel(e)}`.toLocaleLowerCase())}beginInteraction(){this._interactionActive||(this._interactionActive=!0,this.filterValue=``,this.evaluateChoiceExpression())}getChoice(e){return this._choicesByCode.get(e)}getLabel(e){let t=this._codedValueDomain;return t?t.getName(e)??this.getChoice(e)?.name??String(e):this.getChoice(e)?.name??String(e)}endInteraction(){this._interactionActive=!1,this.filterValue=``}async evaluateChoiceExpression(){this._expressionTask=a(this._expressionTask);let e=n(e=>this._evaluateChoiceExpression(e));this._expressionTask=e;try{return await o(this._updatingHandles.addPromise(e.promise))??this.choices}finally{this._expressionTask===e&&(this._expressionTask=null)}}async _evaluateChoiceExpression(e){let t=await import(`../../../../arcade/languageUtils.js`);s(e);let n=this.arcadeContextInfo,r=this.fieldInput.field,i=this.fieldInput.template;await this.requestDeferredExpressionEvaluation({features:this.features.toArray(),getExecutor:e=>i.getExpressionExecutorsForLayer(e)?.choiceExpression}),this._evaluated=!0;let a=[];for(let e of this.features){let i=this._lookupExpressionOutcome(e),o=i?.result?this._parseChoices(i.result,n,r,t):[];if(o.length===0)return[];a.push(o)}let o=this.fieldInput.domain,c=v(_(a)).filter(({code:e})=>d(r,e,o)===null);return this._choicesByCode=new Map(c.map(e=>[e.code,e])),this._choices=c,c}_lookupExpressionOutcome(e){return this.fieldInput.expressionsManager.outcomes.get(e)?.get(p({elementId:this.fieldInput.template.elementId,executorPurpose:`choiceExpression`}))}_parseChoices(e,t,n,r){if(!y(e,r))return x(this),[];let i=b(e,`choices`),a=r.isImmutableArray(i)?i.toArray():Array.isArray(i)?i:[],o=[];for(let e of a){if(!y(e,r)){x(this);continue}let i=b(e,`name`),a=b(e,`code`);if(typeof i!=`string`||a===void 0||r.isVoid(a)||r.isFunctionParameter(a)){x(this);continue}let s=f(a,n,t.timeZone,r);s!=null&&o.push({name:i,code:s})}return o}};e([c()],h.prototype,`arcadeContextInfo`,null),e([c()],h.prototype,`choices`,null),e([c()],h.prototype,`evaluating`,null),e([c()],h.prototype,`evaluated`,null),e([c()],h.prototype,`initialEvaluationInProgress`,void 0),e([c()],h.prototype,`inputValue`,null),e([c()],h.prototype,`features`,null),e([c({constructOnly:!0})],h.prototype,`fieldInput`,void 0),e([c()],h.prototype,`filteredChoices`,null),e([c()],h.prototype,`filterValue`,void 0),e([c()],h.prototype,`input`,null),e([c()],h.prototype,`requestDeferredExpressionEvaluation`,void 0),e([c()],h.prototype,`_choices`,void 0),e([c()],h.prototype,`_codedValueDomain`,null),e([c()],h.prototype,`_evaluated`,void 0),e([c()],h.prototype,`_choicesByCode`,void 0),e([c()],h.prototype,`_interactionActive`,void 0),e([c()],h.prototype,`_normalizedChoiceNames`,null),h=e([l(`esri.widgets.BatchAttributeForm.inputs.support.DynamicChoiceController`)],h);const g=h;function _(e){let[t,...n]=e;if(!t||t.length===0)return[];let r=t;for(let e of n.sort((e,t)=>e.length-t.length)){if(!e.length)return[];let t=new Map;for(let{code:n,name:r}of e)i(t,n,()=>new Set).add(r);if(r=r.filter(({code:e,name:n})=>t.get(e)?.has(n)),!r.length)break}return r}function v(e){let t=new Set;return e.filter(({code:e})=>!t.has(e)&&(t.add(e),!0))}function y(e,t){return t.isDictionary(e)&&typeof e.field==`function`&&typeof e.keys==`function`}function b(e,t){let n=e.keys().find(e=>e.toLowerCase()===t);return n==null?void 0:e.field(n)}function x(e){r.getLogger(e).error(`Value returned by choice expression does not conform to specification.`)}export{g as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import t from"../AttachmentElementInput.js";import n from"../BatchFormInputs.js";import r from"../FieldInput.js";import i from"../GroupInput.js";import a from"../RelationshipElementInput.js";import o from"../TextElementInput.js";import s from"../UtilityNetworkAssociationsElementInput.js";import{isMultipleChoiceController as c}from"./controllerUtils.js";import{hashGroupElementTemplateWithoutChildren as l}from"../../templates/support/hashElementTemplate.js";import{isFieldElementTemplate as u,isGroupElementTemplate as d,isRelationshipElementTemplate as f,isTextElementTemplate as p,isAttachmentElementTemplate as m,isUtilityNetworkAssociationsElementTemplate as h}from"../../templates/support/templateUtils.js";function g(e,t){let r=new n({inputs:e.elements.map(e=>S(e,t)),template:e});return x(r),r}function _(e,t,n){let r=g(t,n),{mergedInputs:i}=v(e.inputs,r.inputs,e.staleInputs);e.template=t,e.inputs=i,x(e)}function v(e,t,n){let r=new Set,i=[],a=new Map(e.map(e=>[b(e),e]));for(let e of t){let t=b(e);r.add(t);let o=a.get(t);if(o){y(o,e),i.push(o),e.destroy();continue}let s=n.get(t);if(s){y(s,e),i.push(s),n.delete(t),e.destroy();continue}i.push(e)}for(let t of e){let e=b(t);r.has(e)||n.set(e,t)}return{mergedInputs:i}}function y(e,t){if(e.features=t.features,e.existsInAllLayers=t.existsInAllLayers,e instanceof r&&t instanceof r&&e.template.foldIn(t.template),e.type!==`group`||t.type!==`group`)return;let{mergedInputs:n}=v(e.inputs,t.inputs,e.staleInputs);e.inputs=n;for(let t of n)t.group=e}function b(e){return e.type===`group`?l(e.template):e.template.elementId}function x(e){let t=e.allFieldInputs,n=new Set(t.map(e=>e.fieldName));for(let e of t){let t=c(e.inputController)?e.inputController:null,r=t?.otherChoiceFieldName;if(!r)continue;let i=e.layers[0]?.getField(r)?.name??r;n.has(i)&&(t.shouldShowOtherChoice=!1)}}function S(n,c){let{allFeatures:l,expressionsManager:g,getFieldValueOptionsForFeature:_,getExternalErrorForFeature:v,map:y}=c,b=new Set(n.layers),x=l.filter(e=>b.has(e.layer)),C=x.length===l.length;if(u(n))return new r({existsInAllLayers:C,features:x,template:n,expressionsManager:g,getExternalErrorForFeature:v,getFieldValueOptionsForFeature:_});if(d(n)){let e=n.elements.map(e=>S(e,c));return new i({existsInAllLayers:C,features:x,inputs:e,template:n,expressionsManager:g})}if(f(n))return new a({existsInAllLayers:C,features:x,map:y,template:n,expressionsManager:g});if(p(n))return new o({existsInAllLayers:C,features:x,template:n,expressionsManager:g});if(m(n))return new t({existsInAllLayers:C,features:x,template:n,expressionsManager:g});if(h(n))return new s({existsInAllLayers:C,features:x,template:n,expressionsManager:g,map:y});throw new e(`batch-attribute-form:unsupported-element-template`,`The type of form element template provided is not supported`)}export{g as createBatchFormInputsFromBatchFormTemplate,_ as mergeBatchFormInputsFromNewTemplate};
2
+ import e from"../../../../core/Error.js";import t from"../AttachmentElementInput.js";import n from"../BatchFormInputs.js";import r from"../FieldInput.js";import i from"../GroupInput.js";import a from"../RelationshipElementInput.js";import o from"../TextElementInput.js";import s from"../UtilityNetworkAssociationsElementInput.js";import{isMultipleChoiceController as c}from"./controllerUtils.js";import{hashGroupElementTemplateWithoutChildren as l}from"../../templates/support/hashElementTemplate.js";import{isFieldElementTemplate as u,isGroupElementTemplate as d,isRelationshipElementTemplate as f,isTextElementTemplate as p,isAttachmentElementTemplate as m,isUtilityNetworkAssociationsElementTemplate as h}from"../../templates/support/templateUtils.js";function g(e,t){let r=new n({inputs:e.elements.map(e=>S(e,t)),template:e});return x(r),r}function _(e,t,n){let r=g(t,n),{mergedInputs:i}=v(e.inputs,r.inputs,e.staleInputs);e.template=t,e.inputs=i,x(e)}function v(e,t,n){let r=new Set,i=[],a=new Map(e.map(e=>[b(e),e]));for(let e of t){let t=b(e);r.add(t);let o=a.get(t);if(o){y(o,e),i.push(o),e.destroy();continue}let s=n.get(t);if(s){y(s,e),i.push(s),n.delete(t),e.destroy();continue}i.push(e)}for(let t of e){let e=b(t);r.has(e)||n.set(e,t)}return{mergedInputs:i}}function y(e,t){if(e.features=t.features,e.existsInAllLayers=t.existsInAllLayers,e instanceof r&&t instanceof r&&e.template.foldIn(t.template),e.type!==`group`||t.type!==`group`)return;let{mergedInputs:n}=v(e.inputs,t.inputs,e.staleInputs);e.inputs=n;for(let t of n)t.group=e}function b(e){return e.type===`group`?l(e.template):e.template.elementId}function x(e){let t=e.allFieldInputs,n=new Set(t.map(e=>e.fieldName));for(let e of t){let t=c(e.inputController)?e.inputController:null,r=t?.otherChoiceFieldName;if(!r)continue;let i=e.layers[0]?.getField(r)?.name??r;n.has(i)&&(t.shouldShowOtherChoice=!1)}}function S(n,c){let{allFeatures:l,expressionsManager:g,getFieldValueOptionsForFeature:_,getExternalErrorForFeature:v,map:y,requestDeferredExpressionEvaluation:b}=c,x=new Set(n.layers),C=l.filter(e=>x.has(e.layer)),w=C.length===l.length;if(u(n))return new r({existsInAllLayers:w,features:C,template:n,expressionsManager:g,getExternalErrorForFeature:v,getFieldValueOptionsForFeature:_,requestDeferredExpressionEvaluation:b});if(d(n)){let e=n.elements.map(e=>S(e,c));return new i({existsInAllLayers:w,features:C,inputs:e,template:n,expressionsManager:g})}if(f(n))return new a({existsInAllLayers:w,features:C,map:y,template:n,expressionsManager:g});if(p(n))return new o({existsInAllLayers:w,features:C,template:n,expressionsManager:g});if(m(n))return new t({existsInAllLayers:w,features:C,template:n,expressionsManager:g});if(h(n))return new s({existsInAllLayers:w,features:C,template:n,expressionsManager:g,map:y});throw new e(`batch-attribute-form:unsupported-element-template`,`The type of form element template provided is not supported`)}export{g as createBatchFormInputsFromBatchFormTemplate,_ as mergeBatchFormInputsFromNewTemplate};
@@ -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 n}from"../core/deprecate.js";import r from"../core/Logger.js";import{getOrCreateMapValue as i}from"../core/MapUtils.js";import{destroyMaybe as a}from"../core/maybe.js";import o from"../core/ReactiveMap.js";import{watch as s,when as c,on as l,sync as u}from"../core/reactiveUtils.js";import{formatFileSize as d}from"../core/unitFormatUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{formatDate as m}from"../intl/date.js";import{isIntegerField as h}from"../layers/support/fieldUtils.js";import{isString as g}from"../support/guards.js";import ee from"./Widget.js";import{getAttachmentTypeCategory as te,getCalciteIconForAttachment as _}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as v,isImageAttachment as y,getAttachmentFilenameParts as b}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as ne,getMessageString as x,isElementTemplateWithInputType as S,subtypeChangeShouldPrompt as re,flattenInputs as ie}from"./BatchAttributeForm/batchAttributeFormUtils.js";import C from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as w}from"./BatchAttributeForm/css.js";import{makeViewingEditedAttachmentFooterButtons as ae,makeViewingAttachmentFooterButtons as oe,makeCancelFooterButton as T,makeDefaultFooterButtons as E}from"./BatchAttributeForm/interfaceUtils.js";import D from"./BatchAttributeForm/VisibleElements.js";import{isDynamicChoiceController as O,isMultipleChoiceController as k}from"./BatchAttributeForm/inputs/support/controllerUtils.js";import{isGroupInput as A,isFieldInput as j,isTextElementInput as se,isRelationshipElementInput as ce,isAttachmentElementInput as le,isUtilityNetworkAssociationsElementInput as ue,differentValuesString as M,getNormalizedFieldName as N,isGroupedInput as P}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as F,otherChoiceCheckedPlaceholderValue as I,canRestoreMultipleChoiceOtherChoiceDraftValue as L}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{loadRelationshipDetailsComponents as R,RelationshipDetails as z}from"./BatchAttributeForm/rendered-content/RelationshipDetails.js";import{Prompt as B}from"./Editor/components/Prompt.js";import{downloadAttachmentInfo as V}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as H}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as de,getIntlOptionsForField as fe,prepareISOFieldValueForDateComponents as U,prepareUnixFieldValueForDateComponents as W,normalizeTimeOnlyString as G,getISOFieldValueFromDateComponents as pe,getUnixFieldValueFromDateComponents as me}from"./support/dateUtils.js";import{globalCss as K}from"./support/globalCss.js";import{Heading as he}from"./support/Heading.js";import{calciteListFilterProps as ge}from"./support/listUtils.js";import{messageBundle as q,vmEvent as _e,tsx as J}from"./support/widget.js";import{setFocus as ve}from"./support/widgetUtils.js";import{isEmptyValue as Y,ContingentValuesValidationError as X}from"./support/forms/formUtils.js";const Z=`data-element-id`,Q=`data-field-name`;let $=class extends ee{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 C,this.visibleElements=new D,this.groupDisplay=`all`,this._associationsList=null,this._associationsWidgetsMap=new o,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,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=()=>{let 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=()=>{let e=this.selectedAttachmentDetails;if(!e?.attachment)return;let t=e.input.getAttachmentEditState(e.attachment).initialName;if(t==null)return;let n=e.input.template.elementId,r=v(e.attachment);this.viewModel.stageRenameAttachment(n,r,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=()=>{n(r.getLogger(this),`Editor`,`arcgis-editor`,{version:`5.0`})})}normalizeCtorArgs(e={}){let{suppressDeprecationWarning:t,...n}=e;return n}initialize(){this.addHandles([s(()=>this.features.toArray(),()=>{this._dateComponentMap.clear(),F(this.viewModel,{includeDraftValues:!0})}),s(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),F(this.viewModel),this._setFocusableInput()}),s(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),c(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),s(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=``}),s(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),l(()=>this.viewModel,`submit`,()=>{this.valid||this.goToFirstError()}),s(()=>[this._associationsEnabled,this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs],()=>this._setUpAssociationsWidgets(),u),s(()=>this.viewModel.activeAssociationsInput,e=>this._onActiveAssociationsInputChange(e)),s(()=>this.groupDisplay,()=>this._syncGroupInputStates())])}loadDependencies(){return Promise.all([H({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`)}),R()])}destroy(){this._destroyAssociationsWidgets(),this._associationsList=a(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(){let{features:e,messages:t,page:n}=this;return t?n===`replacing-attachment`?t.titles.replaceAttachment:n===`viewing-attachment-details`?t.titles.editAttachment:n===`adding-attachments`?t.titles.addAttachments:n===`viewing-attachments`?t.titles.attachments:e.length===1||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[];let{messages:e,messagesCommon:t,page:n}=this,r=this.effectiveDisabled;if(n===`adding-attachments`||n===`replacing-attachment`)return[];if(n===`viewing-attachment-details`){let t=this.selectedAttachmentDetails,n=t?.input?.getAttachmentEditState(t.attachment);return!t?.input||!n?[]:n.isRenamed||n.isReplaced?ae({doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons,resetOnclick:()=>this._resetSelectedAttachmentChanges(),resetDisabled:this._disableAttachmentModification(t.input)}):oe({deleteDisabled:this._disableAttachmentModification(t.input),deleteOnclick:()=>this._deleteSelectedAttachment(),doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons})}return n===`viewing-associated-features`?T({messages:t,purpose:`cancel-viewing-associated-features`,onclick:()=>this.goBack()}):n===`viewing-associated-layers`?T({messages:t,purpose:`cancel-viewing-associated-layers`,onclick:()=>this.goBack()}):n===`viewing-attachments`||n===`viewing-related-records`?[]:E({disabled:r||!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 this.viewModel.mode===`batch`||!this.viewModel.activeFeature?!1:!!(this.viewModel.formDescription||this.viewModel.formTitle)}get _associationsEnabled(){let{callbacks:e}=this;return!!(e?.addAssociation||e?.editAssociatedFeature)}get _formId(){return`${this.id}-form`}get _relatedRecordsEnabled(){let{callbacks:e}=this;return!!(e&&(e.addRelatedRecord||e.editRelatedRecord))}async goBack(){return this.viewModel.goBack()}async goHome(){return this.viewModel.goHome()}goToFirstError(){let e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;let{groupInput:t}=e;t&&(t.open||=!0),this._setFocusableInput(e.input),this.scheduleRender()}render(){return J(`div`,{class:this.classes(w.base,K.widget,K.panel),ondragover:this._handleDragAndDrop,ondrop:this._handleDragAndDrop},this._renderContent(),this._renderAttachmentDialog(),this._prompt?J(B,{...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,touchedInputs:this._touchedInputs}}_setDateTimeTimeZoneMap(e){let{datePart:t,elementId:n}=e.dataset,r=i(this._dateComponentMap,`${n}`,()=>({}));switch(t){case`date`:r.date=e;break;case`time`:r.time=e;break;case`timeZone`:r.timeZone=e}}_renderContent(){let{messages:e,viewModel:n}=this,{status:r}=n;if(r===`failed`)return n.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:n.maximumFeatureCountWithComplexForms})):n.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:n.maximumFeatureCount})):e.formFailedToLoad;if(n.hasLayersWithContingentValues&&this.viewModel.features.length>1)return this._renderErrorNotice(e.unsupportedContingentValues);if(r===`loading`&&this.visibleElements.loadingIndicator)return J(`calcite-loader`,{key:`loader`,label:this.messagesCommon?.loading});if(this.features.length!==0)return this._renderForm()}_renderErrorNotice(e,t=`warning`){return J(`calcite-notice`,{class:w.noticeError,icon:!0,kind:t,open:!0},J(`div`,{slot:`message`},e))}_renderForm(){return J(`form`,{class:w.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(){let{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:n}=e,r;if(!e.submitHasBeenAttempted)return null;if(n.invalidHiddenInputs.length>0){if(r=ne(n,e.mode,this.messages),this.viewModel.mode===`batch`){let e=n.invalidHiddenInputs.filter(e=>e.effectiveVisibilityCode===`hidden:group-visibility-expression:all-features`||e.visibilityCode===`hidden:visibility-expression:all-features`);e.length>0?r+=` (${e.map(e=>e.label).join(`, `)})`:r=null}else r=null}else if(t)return null;return r?this._renderErrorNotice(r,`danger`):null}_renderDefaultPage(){return[this._renderReadOnlyNotice(),this._renderFormHeader(),this._renderFormContent()]}_renderReadOnlyNotice(){if((this.disabled||this.readOnly)&&this.visibleElements.readOnlyNotice)return J(`calcite-notice`,{class:w.disabledNotice,"data-testid":`read-only-notice`,icon:`read-only-non-editable`,kind:`brand`,open:!0,scale:`s`,width:`full`},J(`div`,{slot:`message`},this.featureFormMessages.disabledForm))}_renderFormHeader(){let{formTitle:e,formDescription:t}=this.viewModel;if(!this._formHeaderVisible)return;let n=e?J(he,{key:`title`,level:this.headingLevel},e):void 0,r=t?J(`p`,{class:w.description,key:`description`},t):void 0;return J(`div`,{class:w.formHeader},n,r)}_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){if(A(e))return this._renderGroupInput(e);if(j(e))return this._renderLabeledField(e);if(se(e))return this._renderTextComponent(e);if(ce(e))return this._renderRelationshipElementInput(e);if(le(e))return this._renderAttachmentElementInput(e);if(ue(e))return this._renderUtilityNetworkAssociationsElementInput(e)}_renderGroupInput(e){let{inputs:t,template:n,open:r}=e,i=t.filter(e=>e.visible),a=e.label??``,o=this._focusedFieldInput?.group===e,s=this.groupDisplay===`sequential`;return J(`calcite-block`,{class:this.classes(w.group,s?w.groupSequential:null,o?w.groupActive:null,this.disabled?w.inputDisabled:null),collapsible:!0,description:e.description??void 0,expanded:r,heading:a,headingLevel:this.headingLevel,key:`{${n.elementId}-key}`,label:a,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0},onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},i.map(e=>this._renderInput(e)))}_renderLabeledField(e){let{elementId:n}=e.template,{label:r,required:i,dataType:a}=e,o=i?t(this.messages.requiredFieldLabel,{name:r}):r;return J(`calcite-label`,{"aria-label":o,class:w.label,key:`field--${n}`},J(`div`,{class:w.labelTextContent,key:`labelTextContainer`},r,i?J(`span`,{"aria-hidden":`true`,title:this.messagesCommon.required},`*`):void 0),a===`unsupported`?this._renderReadOnlyComponent(e):this._renderFieldInput(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){let t=this.getCommonInputProps(e),{dataType:n}=e;return O(e.inputController)?this._renderDynamicChoiceComponent({input:e,props:t,controller:e.inputController}):e.domain?.type===`coded-value`?this._renderCodedInputs({input:e,props:t}):k(e.inputController)?this._renderMultipleChoiceComponent({input:e,props:t}):n===`date`?this._renderDateComponents(e,t):(t.disabled=this.disabled,t.readOnly=t.readOnly||this.viewModel.updating,n===`number`?this._renderNumberComponent(e,t):this._renderStringComponent(e,t))}_renderAuxiliaryText(e){let{description:t}=e,n=this._getErrorToDisplay(e),r=n?x(e,n,this.messages):null;return r?J(`calcite-input-message`,{icon:!0,status:`invalid`},r):e.valueIsOutOfDomain&&(this._touchedInputs.has(e.template.elementId)||this.viewModel.submitHasBeenAttempted)?J(`calcite-input-message`,{icon:!0,status:`idle`},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):t?J(`calcite-input-message`,{class:w.description,icon:!1,status:`idle`},t):null}_renderCodedInputs({input:e,props:t}){let n=e.input?.type??null,r=e.codedValueOptions;switch(n){case`switch`:return this._renderSwitchField({input:e,props:t});case`radio-buttons`:return this._renderRadioButtonGroupComponent({input:e,options:r,props:t});default:return this._renderComboBoxComponent({options:r,props:t,input:e})}}_renderDynamicChoiceComponent({input:e,props:t,controller:n}){let r=n.filteredChoices,i=e.showNoValueLabel||this.messages.empty,a=n.evaluated&&!n.evaluating&&!n.choices.length&&J(`calcite-notice`,{appearance:`transparent`,kind:`neutral`,open:!0,scale:`s`,slot:`content-bottom`,width:`full`},J(`div`,{slot:`message`},e.showNoValueOptionEnabled?this.messages.noDynamicChoicesWithNoValue:this.messages.noDynamicChoices)),o=t=>{this._saveInput(e,t)},s=(e,t)=>{this._dynamicChoiceItemSelections.delete(n);let r=e.closest(`calcite-autocomplete`);if(r){let e=t==null?``:n.getLabel(t);n.filterValue=``,r.inputValue=e}o(t)},c=({currentTarget:t})=>{let r=t.inputValue??``;n.filterValue=r,!r&&e.value!=null&&o(null)},l=e.showNoValueOptionEnabled?J(`calcite-autocomplete-item`,{heading:i,key:`dynamic-choice-empty`,selected:e.value==null,value:``,onCalciteAutocompleteItemSelect:({currentTarget:e})=>s(e,null),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(n)}}):null,u=t=>{t.inputValue=e.value===M?this.messages.differentValuesPlaceholder:e.value==null?``:n.inputValue};return J(`calcite-autocomplete`,{...t,afterCreate:u,disabled:t.readOnly||t.disabled,placeholder:e.value==null?i:t.placeholder,value:String(t.value),onblur:e=>this._onDynamicChoiceBlur(e,n),onCalciteAutocompleteBeforeOpen:()=>n.beginInteraction(),onCalciteAutocompleteTextInput:c},n.evaluating?J(`calcite-loader`,{key:`dynamic-choice-loader`,label:this.messagesCommon.loading,scale:`s`,slot:`content-top`}):[a,l,...r.map(t=>J(`calcite-autocomplete-item`,{heading:t.name,key:`dynamic-choice-${t.code}`,selected:t.code===e.value,value:String(t.code),onCalciteAutocompleteItemSelect:({currentTarget:e})=>s(e,t.code),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(n)}}))])}_renderMultipleChoiceComponent({input:e,props:t}){let{messages:n}=this,r=this._getMultipleChoiceController(e);if(!r)return null;let{input:i}=r,a=i.includeSelectAllChoices===!0,{checkboxStatesByValue:o,selectAllState:s}=r.selectionState,c=s.checked?n.deselectAllLabel:n.selectAllLabel,l=r.otherChoiceRenderState;return J(`div`,{class:w.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},a?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:s,selectAllLabel:c,handleSelectAllCheckboxChange:t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})}}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})}}),l.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:a,otherChoiceRenderState:l,handleOtherChoiceCheckboxChange:t=>{let{fieldName:n}=l;n&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:n})},handleOtherChoiceInputChange:t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:l.fieldName??void 0})},differentValuesPlaceholder:n.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:n,handleSelectAllCheckboxChange:r}){return J(`calcite-checkbox`,{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e[`aria-invalid`],checked:t.checked,class:w.multipleChoiceSelectAll,"data-element-id":e[Z],disabled:e.readOnly||e.disabled,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:n,labelText:n,value:`esri_BatchAttributeForm_select_all`,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>r(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:n,handleChoiceCheckboxChange:r}){let i=this._getMultipleChoiceController(e);if(!i)return[];let{choices:a}=i;return a.map(e=>{let i=n.get(e.value)??{checked:!1,indeterminate:!1};return J(`calcite-checkbox`,{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t[`aria-invalid`],checked:i.checked,class:t.class,"data-element-id":t[Z],disabled:t.readOnly||t.disabled,indeterminate:i.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>r(e),onfocus:t.onfocus})})}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:n,handleOtherChoiceCheckboxChange:r,handleOtherChoiceInputChange:i,differentValuesPlaceholder:a}){let o=n.label??this.messages.otherOptionLabel;return J(`div`,{class:this.classes(w.multipleChoiceOtherChoice,t?w.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},J(`calcite-checkbox`,{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e[`aria-invalid`],checked:n.checkboxState.checked,class:e.class,"data-element-id":e[Z],disabled:e.readOnly||e.disabled,indeterminate:n.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:o,labelText:o,value:`esri_BatchAttributeForm_other_choice`,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>r(e),onfocus:e.onfocus}),n.checkboxState.checked?J(`calcite-input`,{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e[`aria-invalid`],"aria-label":o,class:w.textElementInput,"data-element-id":e[Z],disabled:e.readOnly||e.disabled,key:`${e.key}-other-choice-input`,maxLength:n.maxLength,placeholder:n.value===M?a:n.hint,status:n.status,type:`text`,value:n.normalizedValue===M?``:n.normalizedValue?String(n.normalizedValue):``,onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>i(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:n=!1}){this._markInputTouched(e);let r=this._getMultipleChoiceController(e);if(!r)return;if(r.input&&!n&&this.viewModel.mode===`batch`){await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});return}let i=e.value,a=this._parseValue(t,e,n);a!==i&&await this.viewModel.setValue(e.template.elementId,a)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:n}){if(!n)return;let r=t.value,i=r==null||r===``?null:r,a=this._getMultipleChoiceController(e);if(!a)return;a.initializeExplicitOtherChoiceCheckedState(),a.stashOtherChoiceDraftValueForFeatures(e.features,i);let o=N(e,n);o&&await this.viewModel.setValueForFieldName(o,i,Array.from(e.features,e=>e.source))}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:n}){let r=this._getMultipleChoiceController(e);if(!r)return;r.setExplicitOtherChoiceCheckedState(t),this._markInputTouched(e),t||r.setOtherChoiceDraftValuesFromFeatures(e.features.toArray());let i=N(e,n);if(!i)return;let a=new Map;for(let i of e.features){let e=i.getAttribute(n);if(t){if(!Y(e))continue;let t=r.getOtherChoiceDraftValue(i),n=L(t)?t:I;a.set(i,n);continue}e!=null&&a.set(i,null)}a.size!==0&&await this.viewModel.setValuePerFeatureForFieldName(i,new Map(Array.from(a,([e,t])=>[e.source,t])))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){let n=this._getMultipleChoiceController(e);if(!n)return;let r=new Map(e.features.map(r=>[r,n.getUpdatedValueForFeature({choiceValue:t.value,currentValue:r.getAttribute(e.fieldName),isChecked:t.checked})]));r.size!==0&&await this.viewModel.setFieldInputValuePerFeature(e,r)}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===M||e.value===M)&&this.viewModel.mode===`batch`){let n={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,onblur:t.onblur,onfocus:t.onfocus,[Z]:t[Z]},trigger:{appearance:`transparent`,iconEnd:`chevron-down`,kind:`neutral`,slot:`trigger`,label:t.label},group:{mode:`single`}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:n,options:[{name:this.messages.differentValuesPlaceholder,value:M,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return J(`calcite-switch`,{...t,checked:S(e.template,`switch`)?e.value===e.template.input.onValue:!1,class:w.inputSwitch,disabled:t.readOnly||t.disabled,onCalciteSwitchChange:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:n}){let{trigger:r,dropdown:i,group:a}=n;return J(`calcite-dropdown`,{...i,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInputFromElement(e)},J(`calcite-button`,{...r},e===M?this.messages.differentValuesPlaceholder:e),J(`calcite-dropdown-group`,{selectionMode:a.mode},t.map(t=>J(`calcite-dropdown-item`,{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:n}){let r=this.viewModel.editType===`INSERT`,i=this._touchedInputs.has(e?.template.elementId),a=r&&e.showNoValueOptionEnabled&&!i?()=>{}:n.onblur,o={...n,onblur:a};return J(`calcite-combobox`,{...o,clearDisabled:e.isSubtypeField,selectionMode:`single`,topLayerDisabled:this.topLayerDisabled,value:n.placeholder===this.messages.differentValuesPlaceholder?M:String(n.value),onCalciteComboboxChange:({currentTarget:t})=>{t.value!==M&&(e.isSubtypeField&&t.selectedItems.length===0?t.value=`${e.value}`:this._saveInputFromElement(t))}},this.renderComboboxOptionsList({input:e,options:t,props:n}))}renderComboboxOptionsList({input:e,options:t,props:n}){let r=e=>e.map(e=>{let{value:t}=e,r=Y(e.value)?this.messages.empty:e.name;return J(`calcite-combobox-item`,{heading:r,key:`#${t}`,selected:n.value===t,value:`${t}`})}),i=[],{messages:a}=this;t.other.length>0&&i.push(J(`calcite-combobox-item-group`,{key:`other`,label:a.other},r(t.other))),t.unsupported.length>0&&i.push(J(`calcite-combobox-item-group`,{key:`unsupported`,label:a.unsupported},r(t.unsupported)));let o=r(t.recommended);i.length>0?i.unshift(J(`calcite-combobox-item-group`,{key:`recommended`,label:a.recommended},o)):i=o;let s=n.placeholder===this.messages.differentValuesPlaceholder,c=!s&&Y(n.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&i.unshift(J(`calcite-combobox-item`,{heading:e.showNoValueLabel||this.messages.empty,key:`empty-option`,selected:c,value:``})),s&&i.unshift(J(`calcite-combobox-item`,{heading:this.messages.differentValuesPlaceholder,key:M,selected:!0,value:M})),i}_renderRadioButtonGroupComponent({input:e,options:t,props:n}){let r=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:r})=>this._renderRadioButtons({label:t,value:r,selected:r===e.value,props:n}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){let t=e.showNoValueLabel||this.messages.empty,i=Y(e.value);r.unshift(this._renderRadioButtons({label:t,value:``,selected:i,props:n}))}return J(`calcite-radio-button-group`,{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:w.inputRadioGroup,"data-field-name":n[Q],disabled:n.readOnly||n.disabled,key:`${n.key}-radio-group`,layout:`vertical`,name:`${n.name}-${this.id}`,required:n.required},r,n.placeholder===this.messages.differentValuesPlaceholder?J(`calcite-label`,{class:w.placeholderRadio,key:n.label,layout:`inline`},J(`calcite-radio-button`,{checked:!0,class:w.inputRadio,disabled:!0,value:n.placeholder}),n.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:n,props:r}){return J(`calcite-label`,{class:w.inputRadioLabel,key:r.label,layout:`inline`},J(`calcite-radio-button`,{...r,afterCreate:void 0,afterUpdate:void 0,checked:t,class:w.inputRadio,disabled:r.readOnly||r.disabled,name:void 0,value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInputFromElement(e)}}),n)}_renderStringComponent(e,t){let{template:n}=e;return!n.field.editable||this.readOnly?this._renderReadOnlyComponent(e):n.input?.type===`text-area`?J(`calcite-text-area`,{...t,class:this.classes(w.individualElement),resize:`vertical`,value:t.value?String(t.value):``,onblur:n=>{t.onblur(n),e.userHasChangedValue&&this._saveInputFromElement(n.currentTarget)},onCalciteTextAreaInput:t=>{e.userHasChangedValue=!0,t.currentTarget.value===``&&this._saveInputFromElement(t.currentTarget)}}):J(`calcite-input`,{...t,class:this.classes(w.individualElement),type:`text`,value:t.value?String(t.value):``,onblur:n=>{t.onblur(n),e.userHasChangedValue&&this._saveInputFromElement(n.currentTarget)},onCalciteInputInput:t=>{e.userHasChangedValue=!0,t.currentTarget.value===``&&this._saveInputFromElement(t.currentTarget)}})}_renderNumberComponent(e,t){let n=h(e.field);return J(`calcite-input-number`,{...t,integer:n,step:n?1:`any`,type:`number`,value:n&&t.value!==``?Math.round(parseFloat(String(t.value))).toString():String(t.value),onblur:n=>{t.onblur(n),e.userHasChangedValue&&this._saveInputFromElement(n.currentTarget)},onCalciteInputNumberInput:t=>{e.userHasChangedValue=!0,t.currentTarget.value===``&&this._saveInputFromElement(t.currentTarget)}})}_renderReadOnlyComponent(e,t){let n=this.getCommonInputProps(e);return J(`calcite-input`,{...n,class:this.classes(w.fieldInput,w.inputDisabled,w.individualElement),readOnly:!0,type:`text`,value:String(t??n.value??``)})}_renderDateComponents(e,t){let{field:n}=e,r;switch(n.type){case`date`:r=this._renderDateFieldComponents(e,t);break;case`date-only`:r=this._renderDateOnlyFieldComponent(e,t);break;case`time-only`:r=this._renderTimeOnlyFieldComponent(e,t);break;case`timestamp-offset`:r=this._renderTimestampOffsetFieldComponents(e,t);break;default:r=this._renderReadOnlyComponent(e,de(n,t.value,{timeZone:e.effectiveTimeZone,...fe(e.template.field)}))}return e.value===M?[r,J(`calcite-input-message`,{icon:`information`,key:`diff-values-message`,status:`idle`},this.messages.differentValues)]:r}_renderDateOnlyFieldComponent(e,t){let{class:n,disabled:r,key:i,readOnly:a}=t,{rawMax:o,rawMin:s}=e.range;return J(`calcite-input-date-picker`,{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:n,"data-date-part":`date`,"data-element-id":t[Z],"data-field-name":t[Q],disabled:r,key:`${i}-date-input`,max:g(o)?o:void 0,min:g(s)?s:void 0,overlayPositioning:`fixed`,readOnly:a,topLayerDisabled:this.topLayerDisabled,value:e.value===M?``:e.value?String(e.value):``,onblur:t.onblur,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_renderTimeOnlyFieldComponent(e,t){let{class:n,disabled:r,key:i,readOnly:a}=t;return J(`calcite-input-time-picker`,{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:n,"data-date-part":`time`,"data-element-id":t[Z],"data-field-name":t[Q],disabled:r,key:`${i}-time-input`,overlayPositioning:`fixed`,readOnly:a,step:e.timeStep,value:e.value===M?``:e.value?String(e.value):``,onblur:t.onblur,onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_renderTimestampOffsetFieldComponents(e,t){let{class:n,disabled:r,key:i,readOnly:a,onblur:o,onfocus:s}=t,{rawMax:c,rawMin:l}=e.range,u=e.effectiveTimeZone,d=U(c,u),f=U(l,u),p=U(e.value===M?``:e.value,u),m=e.includeTimeOffset,h={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:r,[Z]:t[Z],[Q]:t[Q],onblur:o,onfocus:s,overlayPositioning:`fixed`,readOnly:a};return J(`div`,{class:w.dateInputContainer,key:`${i}-date-time-container`},J(`calcite-input-date-picker`,{...h,class:n,"data-date-part":`date`,key:`${i}-date-input`,max:d?.date??void 0,min:f?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:p.date??``,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),J(`calcite-input-time-picker`,{...h,class:n,"data-date-part":`time`,key:`${i}-time-input`,step:e.timeStep,value:p.time??``,onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),m?J(`calcite-input-time-zone`,{...h,class:n,clearable:e.value===M||e.value==null,"data-date-part":`timeZone`,key:`${i}-timezone-input`,value:p.timeZoneOffset||``,onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){let{class:n,disabled:r,key:i,readOnly:a,min:o,max:s}=t,c=e.effectiveTimeZone,l=W(e.value===M?``:e.value,c),u=W(s,c),d=W(o,c),f=e.includeTime,p={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:r,[Z]:t[Z],[Q]:t[Q],onblur:t.onblur,onfocus:t.onfocus,overlayPositioning:`fixed`,readOnly:a};return J(`div`,{class:w.dateInputContainer,key:`${i}-date-time-container`},J(`calcite-input-date-picker`,{...p,class:n,"data-date-part":`date`,key:`${i}-date-input`,max:u?.date??void 0,min:d?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:l.date??``,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),f?J(`calcite-input-time-picker`,{...p,"data-date-part":`time`,key:`${i}-time-input`,step:1,value:l.time??``,onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){return this._relatedRecordsEnabled?J(z,{afterObserverCreated:this._afterListObserverCreated,afterObserverRemoved:this._afterListObserverRemoved,input:e,messages:this.messages,messagesCommon:this.messagesCommon,viewModel:this.viewModel}):null}_renderRelationshipListPage(){let{activeRelationshipInput:e}=this.viewModel;if(e)return this._renderRelationshipElementInput(e)}_renderAttachmentElementInput(e){if(!this.attachmentsEnabled)return;let{allAttachmentsVisibleOnDefaultPage:t,attachments:n,defaultPageAttachments:r,template:{description:i,elementId:a,label:o}}=e,s=t?n:r;return J(`div`,{class:w.attachmentElementInput,"data-testid":`attachment-element-${a}`,key:`attachment-element-${a}`},o?J(`div`,{class:w.attachmentElementLabel,key:`attachment-element-label-${a}`},o):null,i?J(`div`,{class:w.description,key:`attachment-element-description-${a}`},i):null,n.length?this._renderAttachmentList(e,s,{label:o||this.messagesCommon.details,viewAllCount:t?null:n.length}):J(`div`,{class:w.attachmentElementEmptyState,key:`attachment-element-empty-state-${a}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){let e=this.viewModel.selectedAttachmentListInput;if(e)return J(`div`,{class:w.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,n){let{filterEnabled:r,label:i,viewAllCount:a}=n;return J(`calcite-list`,{class:w.attachmentElementList,filterEnabled:r,filterPlaceholder:r?this.messages.attachments.searchAttachments:void 0,filterProps:r?ge:void 0,filterText:r?this._attachmentListFilterText:void 0,label:i,selectionAppearance:`border`,selectionMode:`none`,onCalciteListFilter:r?e=>{this._attachmentListFilterText=e.currentTarget.filterText??``}:void 0},this._renderAttachmentListItems(e,t),a==null?null:this._renderViewAllAttachmentsItem(e,a))}_renderAttachmentListItems(e,t){let{elementId:n}=e.template;return t.map((t,r)=>{let i=this._formatAttachmentSize(t.size),a=this._getAttachmentLabel(t,r,i,e.displayFilename),o=a===i?void 0:i,s=v(t),c=e.isStagedAttachmentAddition(t),l=e.getAttachmentEditState(t),u=l.isDeleted,d=!u&&(c||l.isRenamed||l.isReplaced);return J(`calcite-list-item`,{class:w.attachmentElementListItem,description:o,key:`attachment-item-${s}`,label:a,onCalciteListItemSelect:c||u?void 0:()=>this._setSelectedAttachment({attachmentKey:s,elementId:n})},J(`div`,{class:w.attachmentElementListItemStart,slot:`content-start`},this._renderAttachmentPreviewThumbnail(t,a,e)),d?J(`span`,{class:w.attachmentElementListItemStagedIndicator,slot:`content-end`}):null,c?[J(`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(n,v(t))})]:u?J(`calcite-chip`,{label:this.messages.attachments.deleted,scale:`s`,slot:`content-end`},this.messages.attachments.deleted):J(`calcite-icon`,{flipRtl:!0,icon:`chevron-right`,scale:`s`,slot:`content-end`}))})}_renderViewAllAttachmentsItem(e,n){let{elementId:r}=e.template,{viewAll:i}=this.messages.attachments;return J(`calcite-list-item`,{class:w.attachmentElementListItem,description:t(this.messages.attachments.count,{count:n}),key:`attachment-item-view-all-${r}`,label:i,onCalciteListItemSelect:()=>this._setAttachmentListElementId(r)},J(`calcite-icon`,{flipRtl:!0,icon:`chevron-right`,scale:`s`,slot:`content-end`}))}_renderAttachmentAddAction(e){let{elementId:t}=e.template,n=this.effectiveDisabled||e.addDisabled,r=this._renderAttachmentCountLimitsLabel(e),i=this._getAttachmentNoticeMessage(e),a=e.hasMinimumAttachmentCountNotMet||e.hasExceededAttachmentLimit?`danger`:`info`,o=e.canUploadFiles,s=e.isCaptureOnly&&!this.effectiveDisabled&&!i;return J(`div`,{class:w.attachmentElementAddActions,key:`attachment-element-add-actions-${t}`},o?J(`calcite-button`,{appearance:`outline`,disabled:n,iconStart:`attachment`,kind:`neutral`,round:!0,scale:`s`,onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach):null,this._renderAttachmentCaptureButton(e),s?this._renderAttachmentCaptureDisabledNotice(t):null,r?J(`div`,{class:w.attachmentElementEmptyActionHint},r):null,!this.effectiveDisabled&&i?J(`calcite-notice`,{closable:!1,icon:a===`danger`?`exclamation-mark-circle`:`lightbulb`,kind:a,open:!0,scale:`s`,width:`full`},J(`div`,{slot:`message`},i)):null)}_renderAttachmentCaptureButton(e){if(!e.hasCaptureInputs)return null;let t=e.captureMediaType;return J(`calcite-button`,{appearance:`outline`,disabled:!0,iconStart:ye(t),kind:`neutral`,round:!0,scale:`s`},this._getCaptureButtonLabel(t))}_getAttachmentNoticeMessage(e){let t=this.messages.attachments;return e.hasUnsupportedFileTypeValidationError?this._getUnsupportedFileTypeMessage():e.hasMinimumAttachmentCountNotMet&&this._shouldShowMinimumAttachmentNotice(e)?t.minimumNotMet:e.hasExceededAttachmentLimit?t.attachmentLimitExceeded:e.hasReachedAttachmentLimit?t.attachmentLimitReached:null}_shouldShowMinimumAttachmentNotice(e){return e.hasAttachmentChanges||this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId)}_getCaptureButtonLabel(e){let{capture:t,recordAudio:n,takePhoto:r,takeVideo:i}=this.messages.attachments;switch(e){case`image`:return r||t;case`video`:return i||t;case`audio`:return n||t;default:return t}}_renderAttachmentAddPage(){let e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){let{maxAttachmentCount:t}=e,{elementId:n}=e.template;if(e.isCaptureOnly)return this._renderAttachmentCaptureDisabledNotice(n);let r=t==null||t-e.attachments.length>1,i=this.effectiveDisabled||e.addDisabled,a=this.messages.attachments,o=a.dragAndDropFile,s=e=>{this._attachmentFileInputMap.set(n,e)};return J(`div`,{class:w.attachmentElementAddPanel,key:`attachment-element-add-panel-${n}`},J(`input`,{accept:e.accept,afterCreate:s,afterRemoved:()=>{this._attachmentFileInputMap.delete(n)},afterUpdate:s,class:w.attachmentElementFileInput,"data-element-id":n,disabled:i,multiple:r,type:`file`,onchange:e=>{let t=e.currentTarget,r=t.files?Array.from(t.files):[];this._stageAttachmentFiles(n,r),t.value=``}}),J(`div`,{class:w.attachmentElementAddDropzone,"data-disabled":i?`true`:`false`,ondragover:e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`)},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),i)return;let t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(n,t)}},J(`calcite-icon`,{class:w.attachmentElementAddDropzoneIcon,icon:`upload`,scale:`l`}),J(`div`,{class:w.attachmentElementAddDropzoneHeading},a.addFile),J(`div`,{class:w.attachmentElementAddDropzoneDetail,title:o},o),J(`calcite-button`,{appearance:`transparent`,disabled:i,iconStart:`folder-open`,kind:`brand`,scale:`s`,type:`button`,onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(n,i)}},a.selectFile)),this._renderAttachmentValidationCriteria(e,{includeCountCriteria:!0}))}_renderAttachmentCaptureDisabledNotice(e){return J(`calcite-notice`,{class:w.attachmentElementCaptureNotice,icon:!0,key:`attachment-element-capture-disabled-notice-${e}`,kind:`warning`,open:!0,scale:`s`},J(`div`,{slot:`message`},this.messages.attachments.captureMethodNotSupported))}async _stageAttachmentFiles(e,t){if(t.length===0)return;let n=this.viewModel.selectedAttachmentAddInput,r=!0;try{r=(await this.viewModel.stageAddAttachments(e,t)).length>0&&!n?.hasInvalidValidationCriteria&&!n?.hasUnsupportedFileTypeValidationError}finally{r&&this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){let e=this.selectedAttachmentDetails;if(!e)return;if(this.page===`replacing-attachment`)return this._renderAttachmentReplacePanel(e);let{attachment:t,input:n}=e,r=v(t),i=!!n.getAttachmentPreviewUrl(t),a=!this._disableAttachmentModification(n)&&n.canUploadFiles,o=n.getAttachmentEditState(t);return J(`div`,{class:w.attachmentElementDetail,key:`attachment-detail-panel-${n.template.elementId}-${r}`},J(`div`,{class:w.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,n)),J(`div`,{class:w.attachmentElementDetailActions},y(t)?J(`calcite-button`,{appearance:`outline`,disabled:!i,iconStart:`expand`,kind:`neutral`,label:this.messages.attachments.maximize,scale:`m`,title:this.messages.attachments.maximize,onclick:this._maximizeSelectedAttachment}):null,J(`calcite-button`,{appearance:`outline`,disabled:!i||o.isReplaced,iconStart:`download`,kind:`neutral`,label:this.messages.attachments.download,scale:`m`,title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),J(`calcite-button`,{appearance:`outline`,disabled:!a,iconStart:`upload-to`,kind:`neutral`,label:this.messages.attachments.replace,scale:`m`,title:this.messages.attachments.replace,onclick:this._enterAttachmentReplaceView})),J(`div`,{class:w.attachmentElementDetailMetadata},J(`div`,{class:w.attachmentElementDetailMetadataGroup},J(`span`,{class:w.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),this._renderFileNameContent(t,n)),J(`div`,{class:w.attachmentElementDetailMetadataGroup},J(`span`,{class:w.attachmentElementDetailMetadataLabel},this.messages.attachments.size),J(`span`,{class:w.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),J(`div`,{class:w.attachmentElementDetailMetadataGroup},J(`span`,{class:w.attachmentElementDetailMetadataLabel},this.messages.attachments.type),J(`span`,{class:w.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderFileNameContent(e,t){if(!t.allowUserRename)return J(`span`,{class:w.attachmentElementDetailMetadataValue},e.name);let n=t.getAttachmentEditState(e),{baseName:r,extension:i}=b(e.name),a=this._disableAttachmentModification(t),o=!a&&e.name.trim().length===0;return[J(`div`,{class:w.attachmentElementDetailFileNameRow,key:`file-name-row`},J(`calcite-input`,{class:w.attachmentElementDetailFileNameInput,disabled:a,scale:`m`,status:o?`invalid`:`idle`,suffixText:i,value:r,onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),J(`calcite-button`,{appearance:`transparent`,disabled:a||n.initialName==null||!n.isRenamed,iconStart:`reset`,kind:`neutral`,label:this.messages.footerButtons.reset,scale:`m`,title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})),o?J(`calcite-input-message`,{icon:!0,key:`file-name-message`,status:`invalid`},this.messages.validationErrors.cannotBeNull):null]}_renderAttachmentReplacePanel(e){let{attachment:t,input:n}=e,r=this._disableAttachmentModification(n)||!n.canUploadFiles,i=n.template.elementId;return J(`div`,{class:w.attachmentElementAddPanel,key:`attachment-replace-panel-${i}-${v(t)}`},J(`input`,{accept:n.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:w.attachmentElementFileInput,disabled:r,type:`file`,onchange:e=>{let t=e.currentTarget,n=t.files?.[0];n&&this._stageSelectedAttachmentReplacement(n),t.value=``}}),J(`div`,{class:w.attachmentElementAddDropzone,"data-disabled":r?`true`:`false`,ondragover:e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`)},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),r)return;let t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},J(`calcite-icon`,{class:w.attachmentElementAddDropzoneIcon,icon:`refresh`,scale:`l`}),J(`div`,{class:w.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),J(`div`,{class:w.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),J(`calcite-button`,{appearance:`transparent`,disabled:r,iconStart:`folder-open`,kind:`brand`,scale:`s`,onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),this._renderAttachmentValidationCriteria(n,{includeCountCriteria:!1}),J(`div`,{class:w.attachmentElementDetailMetadata},J(`div`,{class:w.attachmentElementDetailMetadataGroup},J(`span`,{class:w.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),J(`span`,{class:w.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){let e=this._attachmentDialogInfo;if(!e)return null;let{attachment:t,input:n}=e;return J(`calcite-dialog`,{heading:t.name||this.messagesCommon.details,key:`attachment-preview-dialog`,modal:!0,open:!0,placement:`cover`,width:`l`,onCalciteDialogClose:this._closeAttachmentDialog},J(`div`,{class:w.attachmentElementDialogPreview},this._renderAttachmentPreviewImageForInput(t,n)))}_setSelectedAttachment(e,t){this._markInputTouched(t),this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){let{viewModel:t}=this;t.setSelectedAttachmentAddElementId(e),this._markInputTouched(t.selectedAttachmentAddInput),t.selectedAttachmentAddInput?.clearValidationCriteriaState(),this.hideAttachmentDialog()}_setAttachmentListElementId(e){let{viewModel:t}=this;t.setSelectedAttachmentListElementId(e),this._markInputTouched(t.selectedAttachmentListInput),this.hideAttachmentDialog()}_getAttachmentLabel(e,n,r,i){return i!==!1&&g(e.name)&&e.name.length>0?e.name:r===this.messagesCommon.notApplicable?t(this.messages.attachments.attachmentNumberedLabel,{index:n+1}):r}_renderAttachmentCountLimitsLabel(e){let t=this.messages.attachments,n=e.minAttachmentCount!=null&&e.minAttachmentCount>0?this._renderAttachmentCountLimitLabel(t.minAttachmentsShort,e.minAttachmentCount,`min`):null,r=e.maxAttachmentCount==null?null:this._renderAttachmentCountLimitLabel(t.maxAttachmentsShort,e.maxAttachmentCount,`max`);return!n&&!r?null:[n,n&&r?J(`span`,{key:`attachment-count-limits-separator`},`, `):null,r]}_renderAttachmentCountLimitLabel(e,n,r){let i=`__count__`,[a,o]=t(e,{count:i}).split(i);return J(`span`,{key:r},a,J(`span`,{class:w.attachmentElementEmptyActionHintValue},n),o)}_renderAttachmentValidationCriteria(e,{includeCountCriteria:t}){let n=this._getAttachmentValidationCriteria(e,{includeCountCriteria:t}),r=`attachment-validation-criteria-${e.template.elementId}`;return n.length===0?null:J(`div`,{class:w.attachmentElementValidationCriteria,key:r},n.map(({key:e,message:t,state:n})=>J(`calcite-notice`,{appearance:n===`danger`?`outline-fill`:`transparent`,closable:!1,icon:!0,key:e,kind:n,open:!0,scale:`s`,width:`full`},J(`div`,{slot:`message`},t))))}_getAttachmentValidationCriteria(e,{includeCountCriteria:n}){let r=[],i=e.validationCriterionStates,a=this.messages.attachments,o=this._getNestableAttachmentInputs(e.input);e.hasUnsupportedFileTypeValidationError&&r.push({key:`unsupported-file-type`,message:this._getUnsupportedFileTypeMessage(),state:`danger`});for(let e of o)e.type===`document`&&e.maxFileSize!=null&&r.push({key:`maximum-file-size`,message:t(a.maximumFileSize,{maxSize:this._formatAttachmentSizeLimitInMegabytes(e.maxFileSize)}),state:i.get(`maximum-file-size`)??`info`}),e.type===`audio`&&e.maxDuration!=null&&r.push({key:`maximum-audio-length`,message:t(a.maximumAudioLength,{maxDuration:this._formatAttachmentDurationLimit(e.maxDuration)}),state:i.get(`maximum-audio-length`)??`info`}),e.type===`video`&&e.maxDuration!=null&&r.push({key:`maximum-video-length`,message:t(a.maximumVideoLength,{maxDuration:this._formatAttachmentDurationLimit(e.maxDuration)}),state:i.get(`maximum-video-length`)??`info`}),e.type===`image`&&e.maxImageSize!=null&&r.push({key:`maximum-image-size`,message:t(a.attachmentMustBeSmallerThan,{maxSize:`${e.maxImageSize}px`}),state:i.get(`maximum-image-size`)??`info`});return n&&e.minAttachmentCount!=null&&e.minAttachmentCount>0&&r.push({key:`minimum-number-of-files`,message:t(a.minimumNumberOfFiles,{count:e.minAttachmentCount}),state:i.get(`minimum-number-of-files`)??`info`}),n&&e.maxAttachmentCount!=null&&r.push({key:`maximum-number-of-files`,message:t(a.maximumNumberOfFiles,{count:e.maxAttachmentCount}),state:i.get(`maximum-number-of-files`)??`info`}),r}_getNestableAttachmentInputs(e){return e==null?[]:e.type===`attachment`?e.inputTypes?.slice()??[]:[e]}_getUnsupportedFileTypeMessage(){return this.featureTableMessages.errorFileUnsupported}_formatAttachmentSize(e){return e==null||Number.isNaN(e)?this.messagesCommon.notApplicable:d(this.messagesUnits,e)}_formatAttachmentSizeLimitInMegabytes(e){return d(this.messagesUnits,e*1048576)}_formatAttachmentDurationLimit(e){return m(Math.round(e)*1e3,{...e>=3600?{hour:`2-digit`,hourCycle:`h23`}:{},minute:`2-digit`,second:`2-digit`,timeZone:`UTC`})}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;let t=this.messages.attachments.attachmentTypes,n=te(e);return t?.[n]||e}_renderAttachmentPreviewThumbnail(e,t,n){let r=n.getAttachmentPreviewUrl(e,64);return r&&y(e)?J(`img`,{alt:t,class:w.attachmentElementListItemThumb,src:r}):J(`calcite-icon`,{class:w.attachmentElementListItemIcon,icon:_(e.contentType),scale:`s`})}_renderAttachmentPreviewImageForInput(e,t){let n=t.getAttachmentPreviewUrl(e),r=e.name||this.messagesCommon.details;return n&&y(e)?J(`img`,{alt:r,class:w.attachmentElementDetailPreviewImage,src:n,title:r}):[J(`calcite-icon`,{class:w.attachmentElementDetailPreviewIcon,icon:_(e.contentType),scale:`l`,textLabel:r,title:r}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await V(e)}_canReplaceSelectedAttachment(){return!this.effectiveDisabled&&!!this.selectedAttachmentDetails?.input.canUploadFiles}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){let t=this.selectedAttachmentDetails;if(!t?.attachment)return;let n=t.input.template.elementId,r=v(t.attachment),i=!1;try{i=await this.viewModel.stageReplaceAttachment(n,r,e)}finally{i&&this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){let t=this.selectedAttachmentDetails;if(!t?.attachment)return;let n=t.input.template.elementId,r=v(t.attachment);this.viewModel.stageRenameAttachment(n,r,e)}_resetSelectedAttachmentChanges(){let e=this.selectedAttachmentDetails;e?.attachment&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,v(e.attachment))}_deleteSelectedAttachment(){let e=this.selectedAttachmentDetails;if(!e?.attachment||this._disableAttachmentModification(e.input))return;let t=e.input.template.elementId,n=v(e.attachment);this.viewModel.stageDeleteAttachment(t,n),this._setSelectedAttachment(null)}_disableAttachmentModification(e){return this.disabledOrReadOnly||!e.editable}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){let{elementId:t}=e.template;return J(`div`,{class:w.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){if(!this._associationsEnabled)return;let{elementId:t}=e.template;return J(`div`,{class:w.utilityNetworkAssociationsElementInput,"data-testid":t,key:t},this._associationsWidgetsMap.get(e)?.render())}getCommonInputProps(e){let{template:t,valid:n,value:r,minLength:i,maxLength:a,required:o,fieldName:s,editable:c,range:{max:l,min:u}}=e,d=!c||this.readOnly,f=this.disabled||this.viewModel.updating,p=this._getErrorToDisplay(e)?`invalid`:`idle`,m=t.hint??void 0,h=!1;return r===M&&(m=this.messages.differentValuesPlaceholder,h=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":n?`false`:`true`,class:this.classes(w.fieldInput,d?w.inputDisabled:null),status:p,maxLength:a&&a>-1?a:void 0,minLength:i&&i>-1?i:void 0,key:t.elementId,label:s,name:s,max:l??void 0,min:u??void 0,disabled:f,readOnly:d,onblur:this._onComponentBlur,required:o,placeholder:m,value:h?``:r??``,[Z]:t.elementId,[Q]:s,onfocus:this._onComponentFocus}}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);let 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(Z))}_afterRadioGroupCreateOrUpdate(e){let t=e.selectedItem,n=e.querySelector(`calcite-radio-button`),r=t||n;r&&this._afterComponentCreateOrUpdate(r)}_onComponentFocus(e){let t=e.target,n=this._getFieldInputFromHTMLElement(t);this._focusedFieldInput=n}_markInputTouched(e){e&&this._touchedInputs.add(e.template.elementId)}_isMultipleChoiceCheckbox(e,t){let n=this._getMultipleChoiceController(t);return e.tagName===`CALCITE-CHECKBOX`&&n?.input!=null}_afterComponentCreateOrUpdate(e){let t=this._getFieldInputFromHTMLElement(e),n=this._focusedFieldInput;this._attemptFocusOnNextRender&&n===t&&(this._attemptFocusOnNextRender=!1,ve(e))}_onComponentBlur(e){let t=e.target,n=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,n)||this._markInputTouched(n),this._focusedFieldInput=null}_onDynamicChoiceBlur(e,t){let n=e.currentTarget;if(this._dynamicChoiceItemSelections.delete(t))return;let r=e.relatedTarget;r instanceof Node&&n.contains(r)||(t.endInteraction(),n.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,n=!1){let r=this._getMultipleChoiceController(t);if(r){let{input:t,values:i}=r;if(t&&i){let t=e;return r.getValueFromCheckboxChange({choiceValue:t.value,isChecked:t.checked,isSelectAllCheckbox:n})}}if(S(t.template,`switch`)){if(e.localName===`calcite-dropdown`&&t.domain){for(let n of t.domain.codedValues)if(n.name===e.selectedItems[0].textContent)return n.code}return e.checked?t.template.input.onValue:t.template.input.offValue}let i=e.value;return i==null||i===``?null:t.dataType===`number`?i===`-0`||i===`-0.`||i===`-0,`?i:parseFloat(i):t.field.type===`date`?parseFloat(i):i}_getMultipleChoiceController(e){return k(e.inputController)?e.inputController:null}_saveInputFromElement(e){let t=this._getFieldInputFromHTMLElement(e);if(!t)return;let n=this._parseValue(e,t);this._saveInput(t,n)}_saveInput(e,t){let{elementId:n}=e.template,r=e?.value,{viewModel:a}=this;if(S(e.template,`switch`)&&a.mode!==`single`){let t=i(this._batchSwitchInputInitialValues,e,()=>e.value);this._batchSwitchInputInitialValues.set(e,t===null?r:t)}t!==r&&(this._markInputTouched(e),!e.isSubtypeField||a.mode===`batch`||!re(a.activeLayer,r,t)?a.setValue(n,t):this._pendingSubtypeChoice||=this._handleSubtypeChoice(e,t))}async _handleSubtypeChoice(e,n){let{value:r,template:i}=e,{elementId:a}=i,{messages:o,viewModel:s,messagesCommon:c}=this,{subtypes:l,activeFeatureIndex:u}=s;if(await s.setValue(a,n),!l?.length)return;let d=l.find(e=>e.code===n),f=l.find(e=>e.code===r)?.name??`${r}`;if(!d)return;let p=Promise.withResolvers();s.pendingSubtypeChoice=p;let m=`update-fields`,h=[{label:o.subtypes.useDefaultValuesOption,value:`update-fields`},{label:o.subtypes.keepCurrentValuesOption,value:`keep-existing`}],g={context:`info`,title:o.subtypes.changeWarningTitle,message:t(o.subtypes.changeWarning,{originalType:f,newType:d.name}),radios:h,defaultRadioSelection:`update-fields`,onRadioSelection:e=>{m=e},actions:{primary:{label:c.apply,action:()=>p.resolve(m),type:`positive`},secondary:{label:c.cancel,type:`neutral`,action:()=>p.resolve(`undo`)}},cancel:()=>p.reject()};try{switch(this.showPrompt(g),await p.promise){case`update-fields`:await s.applySubtypeDefaults(d),await s.handleSubtypeChanged(u);break;case`keep-existing`:await s.handleSubtypeChanged(u);break;case`undo`:await this.viewModel.setValue(a,r)}}finally{s.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_afterDateComponentCreateOrUpdate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){let{elementId:n}=e.template,r=e.field.type,i=this._dateComponentMap.get(`${n}`);if(!i)return;let a=e.effectiveTimeZone,o=e.value===M?void 0:e.value,s=null;r===`date-only`?s=Array.isArray(t.value)?t.value[0]:t.value:r===`time-only`?(o=G(o),s=G(t.value)):s=r===`timestamp-offset`?t.value==null?null:pe({dateComponent:i.date,timeComponent:i.time,oldValue:o,timeZoneComponent:i.timeZone,defaultTimeZone:a}):t.value==null?null:me({oldValue:o,dateComponent:i.date,timeZone:a,timeComponent:i.time?.value===M?void 0:i.time}),o!==s&&(this._markInputTouched(e),s===null||!t.value?this.viewModel.setValue(n,null):this.viewModel.setValue(n,s))}_getErrorToDisplay(e){let t=e.compositeError;return e.valid||!t?null:t===X.CONTINGENCY_VIOLATION_ERROR||t===X.CONTINGENCY_VIOLATION_WARNING?t:!this._touchedInputs.has(e.template.elementId)&&!this.viewModel.submitHasBeenAttempted?null:t}_renderViewingAssociationsPage(){return this._associationsList?.render()}_onActiveAssociationsInputChange(e){let t=this._associationsList;t&&(e?(t.associationInput=e,t.viewModel=e.viewModel):t.associationInput=null)}async _setUpAssociationsWidgets(){let e=this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs;if(this._associationsEnabled&&e.length!==0){await this._setUpUtilityNetworkAssociationList();for(let t of e)this._associationsWidgetsMap.set(t,await this._createAssociationsWidget(t))}}async _setUpUtilityNetworkAssociationList(){if(this._associationsList)return;let 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)});let t=this.viewModel.activeAssociationsInput;t&&(this._associationsList.associationInput=t,this._associationsList.viewModel=t.viewModel)}async _createAssociationsWidget(e){let t=(await import(`./Feature/FeatureUtilityNetworkAssociations.js`)).default;return new t({viewModel:e.viewModel,onSelectAssociationType:t=>this._onSelectAssociationType(e,t)})}_destroyAssociationsWidgets(){this._associationsWidgetsMap.forEach(e=>a(e)),this._associationsWidgetsMap.clear()}_onSelectAssociationType(e,{listType:t}){this.setActiveAssociationsInput(e),this.setActiveAssociationType(t)}_onSelectAssociatedLayer({layer:e}){this.setActiveAssociationsLayer(e)}async _onEditAssociatedFeature(e){let t=this.callbacks?.editAssociatedFeature,n=this.viewModel.activeAssociationsInput;if(!t||!n?.feature)return;let{association:r,feature:i}=e;await t({parentFeature:n.feature.plainGraphic,association:r,feature:i})}_onAddAssociation(e){let t=this.callbacks?.addAssociation,n=this.viewModel.activeAssociationsInput;if(!t||!n?.feature)return;let{associationType:r,utilityNetwork:i}=e;t({feature:n.feature.plainGraphic,associationType:r,utilityNetwork:i})}_setFocusableInput(e){let t=e&&j(e)?e:this._findFocusableInput(e);this._syncGroupInputStates(),this._focusedFieldInput=t,this._attemptFocusOnNextRender=!0}_findFocusableInput(e){let t=this.viewModel.activeForm.inputs;if(!t.length)return;let n=ie(t),r;if(!e)r=0;else if(A(e)){let t=e.inputs.find(e=>e.visible);r=t?n.indexOf(t):0}else{let i;i=P(e)&&!e.group.open?e.group.inputs.filter(j)[t.length-1]:e,r=n.indexOf(i)+1}for(let e=r;e<n.length;e++){let t=n[e];if(t.visible&&j(t)){if(this.disabledOrReadOnly&&(t?.inputType===`switch`||t?.inputType===`radio-buttons`))continue;return t}}return null}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._setFocusableInput(t),this.groupDisplay===`sequential`&&this.viewModel.activeForm.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_syncGroupInputStates(){if(this.groupDisplay!==`sequential`)return;let e=this.viewModel.activeForm?.allGroupInputs;if(!e.length)return;let t=e.filter(e=>e.open);t.length===0?e[0].open=!0:t.length>1&&t.slice(1).forEach(e=>e.open=!1)}};e([f()],$.prototype,`activeFeatureIndex`,null),e([f()],$.prototype,`attachmentsEnabled`,null),e([f()],$.prototype,`callbacks`,null),e([f()],$.prototype,`disabled`,null),e([f()],$.prototype,`effectiveTitle`,null),e([f()],$.prototype,`effectiveDisabled`,null),e([f()],$.prototype,`disabledOrReadOnly`,null),e([f()],$.prototype,`features`,null),e([f()],$.prototype,`footerButtonInfos`,null),e([f()],$.prototype,`map`,null),e([f()],$.prototype,`maximumFeatureCount`,null),e([f()],$.prototype,`maximumFeatureCountWithComplexForms`,null),e([f()],$.prototype,`spatialReference`,null),e([f()],$.prototype,`layerInfos`,null),e([f()],$.prototype,`timeZone`,null),e([f()],$.prototype,`headingLevel`,void 0),e([f()],$.prototype,`icon`,null),e([f(),q(`esri/t9n/common`)],$.prototype,`messagesCommon`,void 0),e([f(),q(`esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm`)],$.prototype,`messages`,void 0),e([f(),q(`esri/widgets/FeatureForm/t9n/FeatureForm`)],$.prototype,`featureFormMessages`,void 0),e([f(),q(`esri/widgets/FeatureTable/t9n/FeatureTable`)],$.prototype,`featureTableMessages`,void 0),e([f(),q(`esri/core/t9n/Units`)],$.prototype,`messagesUnits`,void 0),e([f()],$.prototype,`page`,null),e([f()],$.prototype,`readOnly`,null),e([f()],$.prototype,`showPrompt`,null),e([f()],$.prototype,`clearPrompt`,null),e([f()],$.prototype,`selectedAttachment`,null),e([f()],$.prototype,`selectedAttachmentDetails`,null),e([f()],$.prototype,`valid`,null),e([f({type:C}),_e([`attachments-change`,`value-change`,`values-change`,`submit`])],$.prototype,`viewModel`,void 0),e([f({type:D,nonNullable:!0})],$.prototype,`visibleElements`,void 0),e([f()],$.prototype,`groupDisplay`,void 0),e([f()],$.prototype,`_formHeaderVisible`,null),e([f()],$.prototype,`_associationsEnabled`,null),e([f()],$.prototype,`_associationsList`,void 0),e([f()],$.prototype,`_attemptFocusOnNextRender`,void 0),e([f()],$.prototype,`_formId`,null),e([f()],$.prototype,`_focusedFieldInput`,void 0),e([f()],$.prototype,`_pendingSubtypeChoice`,void 0),e([f()],$.prototype,`_relatedRecordsEnabled`,null),e([f()],$.prototype,`_listObserverNode`,void 0),e([f()],$.prototype,`_attachmentDialogInfo`,void 0),e([f()],$.prototype,`_attachmentListFilterText`,void 0),e([f()],$.prototype,`_prompt`,void 0),e([f()],$.prototype,`test`,null),$=e([p(`esri.widgets.BatchAttributeForm`)],$);function ye(e){switch(e){case`audio`:return _(`audio/mpeg`);case`video`:return _(`video/mp4`);case`image`:return _(`image/png`);default:return`camera`}}const be=$;export{be as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as n}from"../core/deprecate.js";import r from"../core/Logger.js";import{getOrCreateMapValue as i}from"../core/MapUtils.js";import{destroyMaybe as a}from"../core/maybe.js";import o from"../core/ReactiveMap.js";import{watch as s,when as c,on as l,sync as u}from"../core/reactiveUtils.js";import{formatFileSize as d}from"../core/unitFormatUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{formatDate as m}from"../intl/date.js";import{isIntegerField as h}from"../layers/support/fieldUtils.js";import{isString as g}from"../support/guards.js";import ee from"./Widget.js";import{getAttachmentTypeCategory as te,getCalciteIconForAttachment as _}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as v,isImageAttachment as y,getAttachmentFilenameParts as b}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as ne,getMessageString as x,isElementTemplateWithInputType as S,subtypeChangeShouldPrompt as re,flattenInputs as ie}from"./BatchAttributeForm/batchAttributeFormUtils.js";import C from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as w}from"./BatchAttributeForm/css.js";import{makeViewingEditedAttachmentFooterButtons as ae,makeViewingAttachmentFooterButtons as oe,makeCancelFooterButton as T,makeDefaultFooterButtons as E}from"./BatchAttributeForm/interfaceUtils.js";import D from"./BatchAttributeForm/VisibleElements.js";import{isDynamicChoiceController as O,isMultipleChoiceController as k}from"./BatchAttributeForm/inputs/support/controllerUtils.js";import{isGroupInput as A,isFieldInput as j,isTextElementInput as se,isRelationshipElementInput as ce,isAttachmentElementInput as le,isUtilityNetworkAssociationsElementInput as ue,differentValuesString as M,getNormalizedFieldName as N,isGroupedInput as P}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as F,otherChoiceCheckedPlaceholderValue as I,canRestoreMultipleChoiceOtherChoiceDraftValue as L}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{loadRelationshipDetailsComponents as R,RelationshipDetails as z}from"./BatchAttributeForm/rendered-content/RelationshipDetails.js";import{Prompt as B}from"./Editor/components/Prompt.js";import{downloadAttachmentInfo as V}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as H}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as de,getIntlOptionsForField as fe,prepareISOFieldValueForDateComponents as U,prepareUnixFieldValueForDateComponents as W,normalizeTimeOnlyString as G,getISOFieldValueFromDateComponents as pe,getUnixFieldValueFromDateComponents as me}from"./support/dateUtils.js";import{globalCss as K}from"./support/globalCss.js";import{Heading as he}from"./support/Heading.js";import{calciteListFilterProps as ge}from"./support/listUtils.js";import{messageBundle as q,vmEvent as _e,tsx as J}from"./support/widget.js";import{setFocus as ve}from"./support/widgetUtils.js";import{isEmptyValue as Y,ContingentValuesValidationError as X}from"./support/forms/formUtils.js";const Z=`data-element-id`,Q=`data-field-name`;let $=class extends ee{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 C,this.visibleElements=new D,this.groupDisplay=`all`,this._associationsList=null,this._associationsWidgetsMap=new o,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,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=()=>{let 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=()=>{let e=this.selectedAttachmentDetails;if(!e?.attachment)return;let t=e.input.getAttachmentEditState(e.attachment).initialName;if(t==null)return;let n=e.input.template.elementId,r=v(e.attachment);this.viewModel.stageRenameAttachment(n,r,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=()=>{n(r.getLogger(this),`Editor`,`arcgis-editor`,{version:`5.0`})})}normalizeCtorArgs(e={}){let{suppressDeprecationWarning:t,...n}=e;return n}initialize(){this.addHandles([s(()=>this.features.toArray(),()=>{this._dateComponentMap.clear(),F(this.viewModel,{includeDraftValues:!0})}),s(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),F(this.viewModel),this._setFocusableInput()}),s(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),c(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),s(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=``}),s(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),l(()=>this.viewModel,`submit`,()=>{this.valid||this.goToFirstError()}),s(()=>[this._associationsEnabled,this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs],()=>this._setUpAssociationsWidgets(),u),s(()=>this.viewModel.activeAssociationsInput,e=>this._onActiveAssociationsInputChange(e)),s(()=>this.groupDisplay,()=>this._syncGroupInputStates())])}loadDependencies(){return Promise.all([H({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`)}),R()])}destroy(){this._destroyAssociationsWidgets(),this._associationsList=a(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(){let{features:e,messages:t,page:n}=this;return t?n===`replacing-attachment`?t.titles.replaceAttachment:n===`viewing-attachment-details`?t.titles.editAttachment:n===`adding-attachments`?t.titles.addAttachments:n===`viewing-attachments`?t.titles.attachments:e.length===1||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[];let{messages:e,messagesCommon:t,page:n}=this,r=this.effectiveDisabled;if(n===`adding-attachments`||n===`replacing-attachment`)return[];if(n===`viewing-attachment-details`){let t=this.selectedAttachmentDetails,n=t?.input?.getAttachmentEditState(t.attachment);return!t?.input||!n?[]:n.isRenamed||n.isReplaced?ae({doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons,resetOnclick:()=>this._resetSelectedAttachmentChanges(),resetDisabled:this._disableAttachmentModification(t.input)}):oe({deleteDisabled:this._disableAttachmentModification(t.input),deleteOnclick:()=>this._deleteSelectedAttachment(),doneOnclick:()=>this._setSelectedAttachment(null),messages:e.footerButtons})}return n===`viewing-associated-features`?T({messages:t,purpose:`cancel-viewing-associated-features`,onclick:()=>this.goBack()}):n===`viewing-associated-layers`?T({messages:t,purpose:`cancel-viewing-associated-layers`,onclick:()=>this.goBack()}):n===`viewing-attachments`||n===`viewing-related-records`?[]:E({disabled:r||!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 this.viewModel.mode===`batch`||!this.viewModel.activeFeature?!1:!!(this.viewModel.formDescription||this.viewModel.formTitle)}get _associationsEnabled(){let{callbacks:e}=this;return!!(e?.addAssociation||e?.editAssociatedFeature)}get _formId(){return`${this.id}-form`}get _relatedRecordsEnabled(){let{callbacks:e}=this;return!!(e&&(e.addRelatedRecord||e.editRelatedRecord))}async goBack(){return this.viewModel.goBack()}async goHome(){return this.viewModel.goHome()}goToFirstError(){let e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;let{groupInput:t}=e;t&&(t.open||=!0),this._setFocusableInput(e.input),this.scheduleRender()}render(){return J(`div`,{class:this.classes(w.base,K.widget,K.panel),ondragover:this._handleDragAndDrop,ondrop:this._handleDragAndDrop},this._renderContent(),this._renderAttachmentDialog(),this._prompt?J(B,{...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,touchedInputs:this._touchedInputs}}_setDateTimeTimeZoneMap(e){let{datePart:t,elementId:n}=e.dataset,r=i(this._dateComponentMap,`${n}`,()=>({}));switch(t){case`date`:r.date=e;break;case`time`:r.time=e;break;case`timeZone`:r.timeZone=e}}_renderContent(){let{messages:e,viewModel:n}=this,{status:r}=n;if(r===`failed`)return n.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:n.maximumFeatureCountWithComplexForms})):n.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:n.maximumFeatureCount})):e.formFailedToLoad;if(n.hasLayersWithContingentValues&&this.viewModel.features.length>1)return this._renderErrorNotice(e.unsupportedContingentValues);if(r===`loading`&&this.visibleElements.loadingIndicator)return J(`calcite-loader`,{key:`loader`,label:this.messagesCommon?.loading});if(this.features.length!==0)return this._renderForm()}_renderErrorNotice(e,t=`warning`){return J(`calcite-notice`,{class:w.noticeError,icon:!0,kind:t,open:!0},J(`div`,{slot:`message`},e))}_renderForm(){return J(`form`,{class:w.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(){let{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:n}=e,r;if(!e.submitHasBeenAttempted)return null;if(n.invalidHiddenInputs.length>0){if(r=ne(n,e.mode,this.messages),this.viewModel.mode===`batch`){let e=n.invalidHiddenInputs.filter(e=>e.effectiveVisibilityCode===`hidden:group-visibility-expression:all-features`||e.visibilityCode===`hidden:visibility-expression:all-features`);e.length>0?r+=` (${e.map(e=>e.label).join(`, `)})`:r=null}else r=null}else if(t)return null;return r?this._renderErrorNotice(r,`danger`):null}_renderDefaultPage(){return[this._renderReadOnlyNotice(),this._renderFormHeader(),this._renderFormContent()]}_renderReadOnlyNotice(){if((this.disabled||this.readOnly)&&this.visibleElements.readOnlyNotice)return J(`calcite-notice`,{class:w.disabledNotice,"data-testid":`read-only-notice`,icon:`read-only-non-editable`,kind:`brand`,open:!0,scale:`s`,width:`full`},J(`div`,{slot:`message`},this.featureFormMessages.disabledForm))}_renderFormHeader(){let{formTitle:e,formDescription:t}=this.viewModel;if(!this._formHeaderVisible)return;let n=e?J(he,{key:`title`,level:this.headingLevel},e):void 0,r=t?J(`p`,{class:w.description,key:`description`},t):void 0;return J(`div`,{class:w.formHeader},n,r)}_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){if(A(e))return this._renderGroupInput(e);if(j(e))return this._renderLabeledField(e);if(se(e))return this._renderTextComponent(e);if(ce(e))return this._renderRelationshipElementInput(e);if(le(e))return this._renderAttachmentElementInput(e);if(ue(e))return this._renderUtilityNetworkAssociationsElementInput(e)}_renderGroupInput(e){let{inputs:t,template:n,open:r}=e,i=t.filter(e=>e.visible),a=e.label??``,o=this._focusedFieldInput?.group===e,s=this.groupDisplay===`sequential`;return J(`calcite-block`,{class:this.classes(w.group,s?w.groupSequential:null,o?w.groupActive:null,this.disabled?w.inputDisabled:null),collapsible:!0,description:e.description??void 0,expanded:r,heading:a,headingLevel:this.headingLevel,key:`{${n.elementId}-key}`,label:a,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0},onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},i.map(e=>this._renderInput(e)))}_renderLabeledField(e){let{elementId:n}=e.template,{label:r,required:i,dataType:a}=e,o=i?t(this.messages.requiredFieldLabel,{name:r}):r;return J(`calcite-label`,{"aria-label":o,class:w.label,key:`field--${n}`},J(`div`,{class:w.labelTextContent,key:`labelTextContainer`},r,i?J(`span`,{"aria-hidden":`true`,title:this.messagesCommon.required},`*`):void 0),a===`unsupported`?this._renderReadOnlyComponent(e):this._renderFieldInput(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){let t=this.getCommonInputProps(e),{dataType:n}=e;return O(e.inputController)?this._renderDynamicChoiceComponent({input:e,props:t,controller:e.inputController}):e.domain?.type===`coded-value`?this._renderCodedInputs({input:e,props:t}):k(e.inputController)?this._renderMultipleChoiceComponent({input:e,props:t}):n===`date`?this._renderDateComponents(e,t):(t.disabled=this.disabled,t.readOnly=t.readOnly||this.viewModel.updating,n===`number`?this._renderNumberComponent(e,t):this._renderStringComponent(e,t))}_renderAuxiliaryText(e){let{description:t}=e,n=this._getErrorToDisplay(e),r=n?x(e,n,this.messages):null;return r?J(`calcite-input-message`,{icon:!0,status:`invalid`},r):e.valueIsOutOfDomain&&(this._touchedInputs.has(e.template.elementId)||this.viewModel.submitHasBeenAttempted)?J(`calcite-input-message`,{icon:!0,status:`idle`},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):t?J(`calcite-input-message`,{class:w.description,icon:!1,status:`idle`},t):null}_renderCodedInputs({input:e,props:t}){let n=e.input?.type??null,r=e.codedValueOptions;switch(n){case`switch`:return this._renderSwitchField({input:e,props:t});case`radio-buttons`:return this._renderRadioButtonGroupComponent({input:e,options:r,props:t});default:return this._renderComboBoxComponent({options:r,props:t,input:e})}}_renderDynamicChoiceComponent({input:e,props:t,controller:n}){let r=n.filteredChoices,i=e.showNoValueLabel||this.messages.empty,a=n.evaluated&&!n.evaluating&&!n.choices.length&&J(`calcite-notice`,{appearance:`transparent`,kind:`neutral`,open:!0,scale:`s`,slot:`content-bottom`,width:`full`},J(`div`,{slot:`message`},e.showNoValueOptionEnabled?this.messages.noDynamicChoicesWithNoValue:this.messages.noDynamicChoices)),o=t=>{this._saveInput(e,t)},s=(e,t)=>{this._dynamicChoiceItemSelections.delete(n);let r=e.closest(`calcite-autocomplete`);if(r){let e=t==null?``:n.getLabel(t);n.filterValue=``,r.inputValue=e}o(t)},l=({currentTarget:t})=>{let r=t.inputValue??``;n.filterValue=r,!r&&e.value!=null&&o(null)},u=e.showNoValueOptionEnabled?J(`calcite-autocomplete-item`,{heading:i,key:`dynamic-choice-empty`,selected:e.value==null,value:``,onCalciteAutocompleteItemSelect:({currentTarget:e})=>s(e,null),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(n)}}):null,d=t=>{this.addHandles(c(()=>!n.initialEvaluationInProgress,()=>{t.inputValue=e.value===M?this.messages.differentValuesPlaceholder:e.value==null?``:n.inputValue},{once:!0,initial:!0}))};return J(`calcite-autocomplete`,{...t,afterCreate:d,disabled:t.readOnly||t.disabled,loading:n.initialEvaluationInProgress,placeholder:e.value==null?i:t.placeholder,value:String(t.value),onblur:e=>this._onDynamicChoiceBlur(e,n),onCalciteAutocompleteBeforeOpen:()=>n.beginInteraction(),onCalciteAutocompleteTextInput:l},n.evaluating?J(`calcite-loader`,{key:`dynamic-choice-loader`,label:this.messagesCommon.loading,scale:`s`,slot:`content-top`}):[a,u,...r.map(t=>J(`calcite-autocomplete-item`,{heading:t.name,key:`dynamic-choice-${t.code}`,selected:t.code===e.value,value:String(t.code),onCalciteAutocompleteItemSelect:({currentTarget:e})=>s(e,t.code),onpointerdown:()=>{this._dynamicChoiceItemSelections.add(n)}}))])}_renderMultipleChoiceComponent({input:e,props:t}){let{messages:n}=this,r=this._getMultipleChoiceController(e);if(!r)return null;let{input:i}=r,a=i.includeSelectAllChoices===!0,{checkboxStatesByValue:o,selectAllState:s}=r.selectionState,c=s.checked?n.deselectAllLabel:n.selectAllLabel,l=r.otherChoiceRenderState;return J(`div`,{class:w.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},a?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:s,selectAllLabel:c,handleSelectAllCheckboxChange:t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})}}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})}}),l.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:a,otherChoiceRenderState:l,handleOtherChoiceCheckboxChange:t=>{let{fieldName:n}=l;n&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:n})},handleOtherChoiceInputChange:t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:l.fieldName??void 0})},differentValuesPlaceholder:n.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:n,handleSelectAllCheckboxChange:r}){return J(`calcite-checkbox`,{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e[`aria-invalid`],checked:t.checked,class:w.multipleChoiceSelectAll,"data-element-id":e[Z],disabled:e.readOnly||e.disabled,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:n,labelText:n,value:`esri_BatchAttributeForm_select_all`,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>r(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:n,handleChoiceCheckboxChange:r}){let i=this._getMultipleChoiceController(e);if(!i)return[];let{choices:a}=i;return a.map(e=>{let i=n.get(e.value)??{checked:!1,indeterminate:!1};return J(`calcite-checkbox`,{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t[`aria-invalid`],checked:i.checked,class:t.class,"data-element-id":t[Z],disabled:t.readOnly||t.disabled,indeterminate:i.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>r(e),onfocus:t.onfocus})})}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:n,handleOtherChoiceCheckboxChange:r,handleOtherChoiceInputChange:i,differentValuesPlaceholder:a}){let o=n.label??this.messages.otherOptionLabel;return J(`div`,{class:this.classes(w.multipleChoiceOtherChoice,t?w.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},J(`calcite-checkbox`,{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e[`aria-invalid`],checked:n.checkboxState.checked,class:e.class,"data-element-id":e[Z],disabled:e.readOnly||e.disabled,indeterminate:n.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:o,labelText:o,value:`esri_BatchAttributeForm_other_choice`,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>r(e),onfocus:e.onfocus}),n.checkboxState.checked?J(`calcite-input`,{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e[`aria-invalid`],"aria-label":o,class:w.textElementInput,"data-element-id":e[Z],disabled:e.readOnly||e.disabled,key:`${e.key}-other-choice-input`,maxLength:n.maxLength,placeholder:n.value===M?a:n.hint,status:n.status,type:`text`,value:n.normalizedValue===M?``:n.normalizedValue?String(n.normalizedValue):``,onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>i(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:n=!1}){this._markInputTouched(e);let r=this._getMultipleChoiceController(e);if(!r)return;if(r.input&&!n&&this.viewModel.mode===`batch`){await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});return}let i=e.value,a=this._parseValue(t,e,n);a!==i&&await this.viewModel.setValue(e.template.elementId,a)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:n}){if(!n)return;let r=t.value,i=r==null||r===``?null:r,a=this._getMultipleChoiceController(e);if(!a)return;a.initializeExplicitOtherChoiceCheckedState(),a.stashOtherChoiceDraftValueForFeatures(e.features,i);let o=N(e,n);o&&await this.viewModel.setValueForFieldName(o,i,Array.from(e.features,e=>e.source))}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:n}){let r=this._getMultipleChoiceController(e);if(!r)return;r.setExplicitOtherChoiceCheckedState(t),this._markInputTouched(e),t||r.setOtherChoiceDraftValuesFromFeatures(e.features.toArray());let i=N(e,n);if(!i)return;let a=new Map;for(let i of e.features){let e=i.getAttribute(n);if(t){if(!Y(e))continue;let t=r.getOtherChoiceDraftValue(i),n=L(t)?t:I;a.set(i,n);continue}e!=null&&a.set(i,null)}a.size!==0&&await this.viewModel.setValuePerFeatureForFieldName(i,new Map(Array.from(a,([e,t])=>[e.source,t])))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){let n=this._getMultipleChoiceController(e);if(!n)return;let r=new Map(e.features.map(r=>[r,n.getUpdatedValueForFeature({choiceValue:t.value,currentValue:r.getAttribute(e.fieldName),isChecked:t.checked})]));r.size!==0&&await this.viewModel.setFieldInputValuePerFeature(e,r)}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===M||e.value===M)&&this.viewModel.mode===`batch`){let n={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,onblur:t.onblur,onfocus:t.onfocus,[Z]:t[Z]},trigger:{appearance:`transparent`,iconEnd:`chevron-down`,kind:`neutral`,slot:`trigger`,label:t.label},group:{mode:`single`}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:n,options:[{name:this.messages.differentValuesPlaceholder,value:M,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return J(`calcite-switch`,{...t,checked:S(e.template,`switch`)?e.value===e.template.input.onValue:!1,class:w.inputSwitch,disabled:t.readOnly||t.disabled,onCalciteSwitchChange:({currentTarget:e})=>this._saveInputFromElement(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:n}){let{trigger:r,dropdown:i,group:a}=n;return J(`calcite-dropdown`,{...i,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInputFromElement(e)},J(`calcite-button`,{...r},e===M?this.messages.differentValuesPlaceholder:e),J(`calcite-dropdown-group`,{selectionMode:a.mode},t.map(t=>J(`calcite-dropdown-item`,{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:n}){let r=this.viewModel.editType===`INSERT`,i=this._touchedInputs.has(e?.template.elementId),a=r&&e.showNoValueOptionEnabled&&!i?()=>{}:n.onblur,o={...n,onblur:a};return J(`calcite-combobox`,{...o,clearDisabled:e.isSubtypeField,selectionMode:`single`,topLayerDisabled:this.topLayerDisabled,value:n.placeholder===this.messages.differentValuesPlaceholder?M:String(n.value),onCalciteComboboxChange:({currentTarget:t})=>{t.value!==M&&(e.isSubtypeField&&t.selectedItems.length===0?t.value=`${e.value}`:this._saveInputFromElement(t))}},this.renderComboboxOptionsList({input:e,options:t,props:n}))}renderComboboxOptionsList({input:e,options:t,props:n}){let r=e=>e.map(e=>{let{value:t}=e,r=Y(e.value)?this.messages.empty:e.name;return J(`calcite-combobox-item`,{heading:r,key:`#${t}`,selected:n.value===t,value:`${t}`})}),i=[],{messages:a}=this;t.other.length>0&&i.push(J(`calcite-combobox-item-group`,{key:`other`,label:a.other},r(t.other))),t.unsupported.length>0&&i.push(J(`calcite-combobox-item-group`,{key:`unsupported`,label:a.unsupported},r(t.unsupported)));let o=r(t.recommended);i.length>0?i.unshift(J(`calcite-combobox-item-group`,{key:`recommended`,label:a.recommended},o)):i=o;let s=n.placeholder===this.messages.differentValuesPlaceholder,c=!s&&Y(n.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&i.unshift(J(`calcite-combobox-item`,{heading:e.showNoValueLabel||this.messages.empty,key:`empty-option`,selected:c,value:``})),s&&i.unshift(J(`calcite-combobox-item`,{heading:this.messages.differentValuesPlaceholder,key:M,selected:!0,value:M})),i}_renderRadioButtonGroupComponent({input:e,options:t,props:n}){let r=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:r})=>this._renderRadioButtons({label:t,value:r,selected:r===e.value,props:n}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){let t=e.showNoValueLabel||this.messages.empty,i=Y(e.value);r.unshift(this._renderRadioButtons({label:t,value:``,selected:i,props:n}))}return J(`calcite-radio-button-group`,{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:w.inputRadioGroup,"data-field-name":n[Q],disabled:n.readOnly||n.disabled,key:`${n.key}-radio-group`,layout:`vertical`,name:`${n.name}-${this.id}`,required:n.required},r,n.placeholder===this.messages.differentValuesPlaceholder?J(`calcite-label`,{class:w.placeholderRadio,key:n.label,layout:`inline`},J(`calcite-radio-button`,{checked:!0,class:w.inputRadio,disabled:!0,value:n.placeholder}),n.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:n,props:r}){return J(`calcite-label`,{class:w.inputRadioLabel,key:r.label,layout:`inline`},J(`calcite-radio-button`,{...r,afterCreate:void 0,afterUpdate:void 0,checked:t,class:w.inputRadio,disabled:r.readOnly||r.disabled,name:void 0,value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInputFromElement(e)}}),n)}_renderStringComponent(e,t){let{template:n}=e;return!n.field.editable||this.readOnly?this._renderReadOnlyComponent(e):n.input?.type===`text-area`?J(`calcite-text-area`,{...t,class:this.classes(w.individualElement),resize:`vertical`,value:t.value?String(t.value):``,onblur:n=>{t.onblur(n),e.userHasChangedValue&&this._saveInputFromElement(n.currentTarget)},onCalciteTextAreaInput:t=>{e.userHasChangedValue=!0,t.currentTarget.value===``&&this._saveInputFromElement(t.currentTarget)}}):J(`calcite-input`,{...t,class:this.classes(w.individualElement),type:`text`,value:t.value?String(t.value):``,onblur:n=>{t.onblur(n),e.userHasChangedValue&&this._saveInputFromElement(n.currentTarget)},onCalciteInputInput:t=>{e.userHasChangedValue=!0,t.currentTarget.value===``&&this._saveInputFromElement(t.currentTarget)}})}_renderNumberComponent(e,t){let n=h(e.field);return J(`calcite-input-number`,{...t,integer:n,step:n?1:`any`,type:`number`,value:n&&t.value!==``?Math.round(parseFloat(String(t.value))).toString():String(t.value),onblur:n=>{t.onblur(n),e.userHasChangedValue&&this._saveInputFromElement(n.currentTarget)},onCalciteInputNumberInput:t=>{e.userHasChangedValue=!0,t.currentTarget.value===``&&this._saveInputFromElement(t.currentTarget)}})}_renderReadOnlyComponent(e,t){let n=this.getCommonInputProps(e);return J(`calcite-input`,{...n,class:this.classes(w.fieldInput,w.inputDisabled,w.individualElement),readOnly:!0,type:`text`,value:String(t??n.value??``)})}_renderDateComponents(e,t){let{field:n}=e,r;switch(n.type){case`date`:r=this._renderDateFieldComponents(e,t);break;case`date-only`:r=this._renderDateOnlyFieldComponent(e,t);break;case`time-only`:r=this._renderTimeOnlyFieldComponent(e,t);break;case`timestamp-offset`:r=this._renderTimestampOffsetFieldComponents(e,t);break;default:r=this._renderReadOnlyComponent(e,de(n,t.value,{timeZone:e.effectiveTimeZone,...fe(e.template.field)}))}return e.value===M?[r,J(`calcite-input-message`,{icon:`information`,key:`diff-values-message`,status:`idle`},this.messages.differentValues)]:r}_renderDateOnlyFieldComponent(e,t){let{class:n,disabled:r,key:i,readOnly:a}=t,{rawMax:o,rawMin:s}=e.range;return J(`calcite-input-date-picker`,{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:n,"data-date-part":`date`,"data-element-id":t[Z],"data-field-name":t[Q],disabled:r,key:`${i}-date-input`,max:g(o)?o:void 0,min:g(s)?s:void 0,overlayPositioning:`fixed`,readOnly:a,topLayerDisabled:this.topLayerDisabled,value:e.value===M?``:e.value?String(e.value):``,onblur:t.onblur,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_renderTimeOnlyFieldComponent(e,t){let{class:n,disabled:r,key:i,readOnly:a}=t;return J(`calcite-input-time-picker`,{afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,class:n,"data-date-part":`time`,"data-element-id":t[Z],"data-field-name":t[Q],disabled:r,key:`${i}-time-input`,overlayPositioning:`fixed`,readOnly:a,step:e.timeStep,value:e.value===M?``:e.value?String(e.value):``,onblur:t.onblur,onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:t.onfocus})}_renderTimestampOffsetFieldComponents(e,t){let{class:n,disabled:r,key:i,readOnly:a,onblur:o,onfocus:s}=t,{rawMax:c,rawMin:l}=e.range,u=e.effectiveTimeZone,d=U(c,u),f=U(l,u),p=U(e.value===M?``:e.value,u),m=e.includeTimeOffset,h={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:r,[Z]:t[Z],[Q]:t[Q],onblur:o,onfocus:s,overlayPositioning:`fixed`,readOnly:a};return J(`div`,{class:w.dateInputContainer,key:`${i}-date-time-container`},J(`calcite-input-date-picker`,{...h,class:n,"data-date-part":`date`,key:`${i}-date-input`,max:d?.date??void 0,min:f?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:p.date??``,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),J(`calcite-input-time-picker`,{...h,class:n,"data-date-part":`time`,key:`${i}-time-input`,step:e.timeStep,value:p.time??``,onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),m?J(`calcite-input-time-zone`,{...h,class:n,clearable:e.value===M||e.value==null,"data-date-part":`timeZone`,key:`${i}-timezone-input`,value:p.timeZoneOffset||``,onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){let{class:n,disabled:r,key:i,readOnly:a,min:o,max:s}=t,c=e.effectiveTimeZone,l=W(e.value===M?``:e.value,c),u=W(s,c),d=W(o,c),f=e.includeTime,p={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,disabled:r,[Z]:t[Z],[Q]:t[Q],onblur:t.onblur,onfocus:t.onfocus,overlayPositioning:`fixed`,readOnly:a};return J(`div`,{class:w.dateInputContainer,key:`${i}-date-time-container`},J(`calcite-input-date-picker`,{...p,class:n,"data-date-part":`date`,key:`${i}-date-input`,max:u?.date??void 0,min:d?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:l.date??``,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),f?J(`calcite-input-time-picker`,{...p,"data-date-part":`time`,key:`${i}-time-input`,step:1,value:l.time??``,onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){return this._relatedRecordsEnabled?J(z,{afterObserverCreated:this._afterListObserverCreated,afterObserverRemoved:this._afterListObserverRemoved,input:e,messages:this.messages,messagesCommon:this.messagesCommon,viewModel:this.viewModel}):null}_renderRelationshipListPage(){let{activeRelationshipInput:e}=this.viewModel;if(e)return this._renderRelationshipElementInput(e)}_renderAttachmentElementInput(e){if(!this.attachmentsEnabled)return;let{allAttachmentsVisibleOnDefaultPage:t,attachments:n,defaultPageAttachments:r,template:{description:i,elementId:a,label:o}}=e,s=t?n:r;return J(`div`,{class:w.attachmentElementInput,"data-testid":`attachment-element-${a}`,key:`attachment-element-${a}`},o?J(`div`,{class:w.attachmentElementLabel,key:`attachment-element-label-${a}`},o):null,i?J(`div`,{class:w.description,key:`attachment-element-description-${a}`},i):null,n.length?this._renderAttachmentList(e,s,{label:o||this.messagesCommon.details,viewAllCount:t?null:n.length}):J(`div`,{class:w.attachmentElementEmptyState,key:`attachment-element-empty-state-${a}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){let e=this.viewModel.selectedAttachmentListInput;if(e)return J(`div`,{class:w.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,n){let{filterEnabled:r,label:i,viewAllCount:a}=n;return J(`calcite-list`,{class:w.attachmentElementList,filterEnabled:r,filterPlaceholder:r?this.messages.attachments.searchAttachments:void 0,filterProps:r?ge:void 0,filterText:r?this._attachmentListFilterText:void 0,label:i,selectionAppearance:`border`,selectionMode:`none`,onCalciteListFilter:r?e=>{this._attachmentListFilterText=e.currentTarget.filterText??``}:void 0},this._renderAttachmentListItems(e,t),a==null?null:this._renderViewAllAttachmentsItem(e,a))}_renderAttachmentListItems(e,t){let{elementId:n}=e.template;return t.map((t,r)=>{let i=this._formatAttachmentSize(t.size),a=this._getAttachmentLabel(t,r,i,e.displayFilename),o=a===i?void 0:i,s=v(t),c=e.isStagedAttachmentAddition(t),l=e.getAttachmentEditState(t),u=l.isDeleted,d=!u&&(c||l.isRenamed||l.isReplaced);return J(`calcite-list-item`,{class:w.attachmentElementListItem,description:o,key:`attachment-item-${s}`,label:a,onCalciteListItemSelect:c||u?void 0:()=>this._setSelectedAttachment({attachmentKey:s,elementId:n})},J(`div`,{class:w.attachmentElementListItemStart,slot:`content-start`},this._renderAttachmentPreviewThumbnail(t,a,e)),d?J(`span`,{class:w.attachmentElementListItemStagedIndicator,slot:`content-end`}):null,c?[J(`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(n,v(t))})]:u?J(`calcite-chip`,{label:this.messages.attachments.deleted,scale:`s`,slot:`content-end`},this.messages.attachments.deleted):J(`calcite-icon`,{flipRtl:!0,icon:`chevron-right`,scale:`s`,slot:`content-end`}))})}_renderViewAllAttachmentsItem(e,n){let{elementId:r}=e.template,{viewAll:i}=this.messages.attachments;return J(`calcite-list-item`,{class:w.attachmentElementListItem,description:t(this.messages.attachments.count,{count:n}),key:`attachment-item-view-all-${r}`,label:i,onCalciteListItemSelect:()=>this._setAttachmentListElementId(r)},J(`calcite-icon`,{flipRtl:!0,icon:`chevron-right`,scale:`s`,slot:`content-end`}))}_renderAttachmentAddAction(e){let{elementId:t}=e.template,n=this.effectiveDisabled||e.addDisabled,r=this._renderAttachmentCountLimitsLabel(e),i=this._getAttachmentNoticeMessage(e),a=e.hasMinimumAttachmentCountNotMet||e.hasExceededAttachmentLimit?`danger`:`info`,o=e.canUploadFiles,s=e.isCaptureOnly&&!this.effectiveDisabled&&!i;return J(`div`,{class:w.attachmentElementAddActions,key:`attachment-element-add-actions-${t}`},o?J(`calcite-button`,{appearance:`outline`,disabled:n,iconStart:`attachment`,kind:`neutral`,round:!0,scale:`s`,onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach):null,this._renderAttachmentCaptureButton(e),s?this._renderAttachmentCaptureDisabledNotice(t):null,r?J(`div`,{class:w.attachmentElementEmptyActionHint},r):null,!this.effectiveDisabled&&i?J(`calcite-notice`,{closable:!1,icon:a===`danger`?`exclamation-mark-circle`:`lightbulb`,kind:a,open:!0,scale:`s`,width:`full`},J(`div`,{slot:`message`},i)):null)}_renderAttachmentCaptureButton(e){if(!e.hasCaptureInputs)return null;let t=e.captureMediaType;return J(`calcite-button`,{appearance:`outline`,disabled:!0,iconStart:ye(t),kind:`neutral`,round:!0,scale:`s`},this._getCaptureButtonLabel(t))}_getAttachmentNoticeMessage(e){let t=this.messages.attachments;return e.hasUnsupportedFileTypeValidationError?this._getUnsupportedFileTypeMessage():e.hasMinimumAttachmentCountNotMet&&this._shouldShowMinimumAttachmentNotice(e)?t.minimumNotMet:e.hasExceededAttachmentLimit?t.attachmentLimitExceeded:e.hasReachedAttachmentLimit?t.attachmentLimitReached:null}_shouldShowMinimumAttachmentNotice(e){return e.hasAttachmentChanges||this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId)}_getCaptureButtonLabel(e){let{capture:t,recordAudio:n,takePhoto:r,takeVideo:i}=this.messages.attachments;switch(e){case`image`:return r||t;case`video`:return i||t;case`audio`:return n||t;default:return t}}_renderAttachmentAddPage(){let e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){let{maxAttachmentCount:t}=e,{elementId:n}=e.template;if(e.isCaptureOnly)return this._renderAttachmentCaptureDisabledNotice(n);let r=t==null||t-e.attachments.length>1,i=this.effectiveDisabled||e.addDisabled,a=this.messages.attachments,o=a.dragAndDropFile,s=e=>{this._attachmentFileInputMap.set(n,e)};return J(`div`,{class:w.attachmentElementAddPanel,key:`attachment-element-add-panel-${n}`},J(`input`,{accept:e.accept,afterCreate:s,afterRemoved:()=>{this._attachmentFileInputMap.delete(n)},afterUpdate:s,class:w.attachmentElementFileInput,"data-element-id":n,disabled:i,multiple:r,type:`file`,onchange:e=>{let t=e.currentTarget,r=t.files?Array.from(t.files):[];this._stageAttachmentFiles(n,r),t.value=``}}),J(`div`,{class:w.attachmentElementAddDropzone,"data-disabled":i?`true`:`false`,ondragover:e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`)},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),i)return;let t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(n,t)}},J(`calcite-icon`,{class:w.attachmentElementAddDropzoneIcon,icon:`upload`,scale:`l`}),J(`div`,{class:w.attachmentElementAddDropzoneHeading},a.addFile),J(`div`,{class:w.attachmentElementAddDropzoneDetail,title:o},o),J(`calcite-button`,{appearance:`transparent`,disabled:i,iconStart:`folder-open`,kind:`brand`,scale:`s`,type:`button`,onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(n,i)}},a.selectFile)),this._renderAttachmentValidationCriteria(e,{includeCountCriteria:!0}))}_renderAttachmentCaptureDisabledNotice(e){return J(`calcite-notice`,{class:w.attachmentElementCaptureNotice,icon:!0,key:`attachment-element-capture-disabled-notice-${e}`,kind:`warning`,open:!0,scale:`s`},J(`div`,{slot:`message`},this.messages.attachments.captureMethodNotSupported))}async _stageAttachmentFiles(e,t){if(t.length===0)return;let n=this.viewModel.selectedAttachmentAddInput,r=!0;try{r=(await this.viewModel.stageAddAttachments(e,t)).length>0&&!n?.hasInvalidValidationCriteria&&!n?.hasUnsupportedFileTypeValidationError}finally{r&&this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){let e=this.selectedAttachmentDetails;if(!e)return;if(this.page===`replacing-attachment`)return this._renderAttachmentReplacePanel(e);let{attachment:t,input:n}=e,r=v(t),i=!!n.getAttachmentPreviewUrl(t),a=!this._disableAttachmentModification(n)&&n.canUploadFiles,o=n.getAttachmentEditState(t);return J(`div`,{class:w.attachmentElementDetail,key:`attachment-detail-panel-${n.template.elementId}-${r}`},J(`div`,{class:w.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,n)),J(`div`,{class:w.attachmentElementDetailActions},y(t)?J(`calcite-button`,{appearance:`outline`,disabled:!i,iconStart:`expand`,kind:`neutral`,label:this.messages.attachments.maximize,scale:`m`,title:this.messages.attachments.maximize,onclick:this._maximizeSelectedAttachment}):null,J(`calcite-button`,{appearance:`outline`,disabled:!i||o.isReplaced,iconStart:`download`,kind:`neutral`,label:this.messages.attachments.download,scale:`m`,title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),J(`calcite-button`,{appearance:`outline`,disabled:!a,iconStart:`upload-to`,kind:`neutral`,label:this.messages.attachments.replace,scale:`m`,title:this.messages.attachments.replace,onclick:this._enterAttachmentReplaceView})),J(`div`,{class:w.attachmentElementDetailMetadata},J(`div`,{class:w.attachmentElementDetailMetadataGroup},J(`span`,{class:w.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),this._renderFileNameContent(t,n)),J(`div`,{class:w.attachmentElementDetailMetadataGroup},J(`span`,{class:w.attachmentElementDetailMetadataLabel},this.messages.attachments.size),J(`span`,{class:w.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),J(`div`,{class:w.attachmentElementDetailMetadataGroup},J(`span`,{class:w.attachmentElementDetailMetadataLabel},this.messages.attachments.type),J(`span`,{class:w.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderFileNameContent(e,t){if(!t.allowUserRename)return J(`span`,{class:w.attachmentElementDetailMetadataValue},e.name);let n=t.getAttachmentEditState(e),{baseName:r,extension:i}=b(e.name),a=this._disableAttachmentModification(t),o=!a&&e.name.trim().length===0;return[J(`div`,{class:w.attachmentElementDetailFileNameRow,key:`file-name-row`},J(`calcite-input`,{class:w.attachmentElementDetailFileNameInput,disabled:a,scale:`m`,status:o?`invalid`:`idle`,suffixText:i,value:r,onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),J(`calcite-button`,{appearance:`transparent`,disabled:a||n.initialName==null||!n.isRenamed,iconStart:`reset`,kind:`neutral`,label:this.messages.footerButtons.reset,scale:`m`,title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})),o?J(`calcite-input-message`,{icon:!0,key:`file-name-message`,status:`invalid`},this.messages.validationErrors.cannotBeNull):null]}_renderAttachmentReplacePanel(e){let{attachment:t,input:n}=e,r=this._disableAttachmentModification(n)||!n.canUploadFiles,i=n.template.elementId;return J(`div`,{class:w.attachmentElementAddPanel,key:`attachment-replace-panel-${i}-${v(t)}`},J(`input`,{accept:n.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:w.attachmentElementFileInput,disabled:r,type:`file`,onchange:e=>{let t=e.currentTarget,n=t.files?.[0];n&&this._stageSelectedAttachmentReplacement(n),t.value=``}}),J(`div`,{class:w.attachmentElementAddDropzone,"data-disabled":r?`true`:`false`,ondragover:e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`)},ondrop:e=>{if(e.preventDefault(),e.stopPropagation(),r)return;let t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},J(`calcite-icon`,{class:w.attachmentElementAddDropzoneIcon,icon:`refresh`,scale:`l`}),J(`div`,{class:w.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),J(`div`,{class:w.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),J(`calcite-button`,{appearance:`transparent`,disabled:r,iconStart:`folder-open`,kind:`brand`,scale:`s`,onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),this._renderAttachmentValidationCriteria(n,{includeCountCriteria:!1}),J(`div`,{class:w.attachmentElementDetailMetadata},J(`div`,{class:w.attachmentElementDetailMetadataGroup},J(`span`,{class:w.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),J(`span`,{class:w.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){let e=this._attachmentDialogInfo;if(!e)return null;let{attachment:t,input:n}=e;return J(`calcite-dialog`,{heading:t.name||this.messagesCommon.details,key:`attachment-preview-dialog`,modal:!0,open:!0,placement:`cover`,width:`l`,onCalciteDialogClose:this._closeAttachmentDialog},J(`div`,{class:w.attachmentElementDialogPreview},this._renderAttachmentPreviewImageForInput(t,n)))}_setSelectedAttachment(e,t){this._markInputTouched(t),this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){let{viewModel:t}=this;t.setSelectedAttachmentAddElementId(e),this._markInputTouched(t.selectedAttachmentAddInput),t.selectedAttachmentAddInput?.clearValidationCriteriaState(),this.hideAttachmentDialog()}_setAttachmentListElementId(e){let{viewModel:t}=this;t.setSelectedAttachmentListElementId(e),this._markInputTouched(t.selectedAttachmentListInput),this.hideAttachmentDialog()}_getAttachmentLabel(e,n,r,i){return i!==!1&&g(e.name)&&e.name.length>0?e.name:r===this.messagesCommon.notApplicable?t(this.messages.attachments.attachmentNumberedLabel,{index:n+1}):r}_renderAttachmentCountLimitsLabel(e){let t=this.messages.attachments,n=e.minAttachmentCount!=null&&e.minAttachmentCount>0?this._renderAttachmentCountLimitLabel(t.minAttachmentsShort,e.minAttachmentCount,`min`):null,r=e.maxAttachmentCount==null?null:this._renderAttachmentCountLimitLabel(t.maxAttachmentsShort,e.maxAttachmentCount,`max`);return!n&&!r?null:[n,n&&r?J(`span`,{key:`attachment-count-limits-separator`},`, `):null,r]}_renderAttachmentCountLimitLabel(e,n,r){let i=`__count__`,[a,o]=t(e,{count:i}).split(i);return J(`span`,{key:r},a,J(`span`,{class:w.attachmentElementEmptyActionHintValue},n),o)}_renderAttachmentValidationCriteria(e,{includeCountCriteria:t}){let n=this._getAttachmentValidationCriteria(e,{includeCountCriteria:t}),r=`attachment-validation-criteria-${e.template.elementId}`;return n.length===0?null:J(`div`,{class:w.attachmentElementValidationCriteria,key:r},n.map(({key:e,message:t,state:n})=>J(`calcite-notice`,{appearance:n===`danger`?`outline-fill`:`transparent`,closable:!1,icon:!0,key:e,kind:n,open:!0,scale:`s`,width:`full`},J(`div`,{slot:`message`},t))))}_getAttachmentValidationCriteria(e,{includeCountCriteria:n}){let r=[],i=e.validationCriterionStates,a=this.messages.attachments,o=this._getNestableAttachmentInputs(e.input);e.hasUnsupportedFileTypeValidationError&&r.push({key:`unsupported-file-type`,message:this._getUnsupportedFileTypeMessage(),state:`danger`});for(let e of o)e.type===`document`&&e.maxFileSize!=null&&r.push({key:`maximum-file-size`,message:t(a.maximumFileSize,{maxSize:this._formatAttachmentSizeLimitInMegabytes(e.maxFileSize)}),state:i.get(`maximum-file-size`)??`info`}),e.type===`audio`&&e.maxDuration!=null&&r.push({key:`maximum-audio-length`,message:t(a.maximumAudioLength,{maxDuration:this._formatAttachmentDurationLimit(e.maxDuration)}),state:i.get(`maximum-audio-length`)??`info`}),e.type===`video`&&e.maxDuration!=null&&r.push({key:`maximum-video-length`,message:t(a.maximumVideoLength,{maxDuration:this._formatAttachmentDurationLimit(e.maxDuration)}),state:i.get(`maximum-video-length`)??`info`}),e.type===`image`&&e.maxImageSize!=null&&r.push({key:`maximum-image-size`,message:t(a.attachmentMustBeSmallerThan,{maxSize:`${e.maxImageSize}px`}),state:i.get(`maximum-image-size`)??`info`});return n&&e.minAttachmentCount!=null&&e.minAttachmentCount>0&&r.push({key:`minimum-number-of-files`,message:t(a.minimumNumberOfFiles,{count:e.minAttachmentCount}),state:i.get(`minimum-number-of-files`)??`info`}),n&&e.maxAttachmentCount!=null&&r.push({key:`maximum-number-of-files`,message:t(a.maximumNumberOfFiles,{count:e.maxAttachmentCount}),state:i.get(`maximum-number-of-files`)??`info`}),r}_getNestableAttachmentInputs(e){return e==null?[]:e.type===`attachment`?e.inputTypes?.slice()??[]:[e]}_getUnsupportedFileTypeMessage(){return this.featureTableMessages.errorFileUnsupported}_formatAttachmentSize(e){return e==null||Number.isNaN(e)?this.messagesCommon.notApplicable:d(this.messagesUnits,e)}_formatAttachmentSizeLimitInMegabytes(e){return d(this.messagesUnits,e*1048576)}_formatAttachmentDurationLimit(e){return m(Math.round(e)*1e3,{...e>=3600?{hour:`2-digit`,hourCycle:`h23`}:{},minute:`2-digit`,second:`2-digit`,timeZone:`UTC`})}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;let t=this.messages.attachments.attachmentTypes,n=te(e);return t?.[n]||e}_renderAttachmentPreviewThumbnail(e,t,n){let r=n.getAttachmentPreviewUrl(e,64);return r&&y(e)?J(`img`,{alt:t,class:w.attachmentElementListItemThumb,src:r}):J(`calcite-icon`,{class:w.attachmentElementListItemIcon,icon:_(e.contentType),scale:`s`})}_renderAttachmentPreviewImageForInput(e,t){let n=t.getAttachmentPreviewUrl(e),r=e.name||this.messagesCommon.details;return n&&y(e)?J(`img`,{alt:r,class:w.attachmentElementDetailPreviewImage,src:n,title:r}):[J(`calcite-icon`,{class:w.attachmentElementDetailPreviewIcon,icon:_(e.contentType),scale:`l`,textLabel:r,title:r}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await V(e)}_canReplaceSelectedAttachment(){return!this.effectiveDisabled&&!!this.selectedAttachmentDetails?.input.canUploadFiles}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){let t=this.selectedAttachmentDetails;if(!t?.attachment)return;let n=t.input.template.elementId,r=v(t.attachment),i=!1;try{i=await this.viewModel.stageReplaceAttachment(n,r,e)}finally{i&&this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){let t=this.selectedAttachmentDetails;if(!t?.attachment)return;let n=t.input.template.elementId,r=v(t.attachment);this.viewModel.stageRenameAttachment(n,r,e)}_resetSelectedAttachmentChanges(){let e=this.selectedAttachmentDetails;e?.attachment&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,v(e.attachment))}_deleteSelectedAttachment(){let e=this.selectedAttachmentDetails;if(!e?.attachment||this._disableAttachmentModification(e.input))return;let t=e.input.template.elementId,n=v(e.attachment);this.viewModel.stageDeleteAttachment(t,n),this._setSelectedAttachment(null)}_disableAttachmentModification(e){return this.disabledOrReadOnly||!e.editable}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){let{elementId:t}=e.template;return J(`div`,{class:w.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){if(!this._associationsEnabled)return;let{elementId:t}=e.template;return J(`div`,{class:w.utilityNetworkAssociationsElementInput,"data-testid":t,key:t},this._associationsWidgetsMap.get(e)?.render())}getCommonInputProps(e){let{template:t,valid:n,value:r,minLength:i,maxLength:a,required:o,fieldName:s,editable:c,range:{max:l,min:u}}=e,d=!c||this.readOnly,f=this.disabled||this.viewModel.updating,p=this._getErrorToDisplay(e)?`invalid`:`idle`,m=t.hint??void 0,h=!1;return r===M&&(m=this.messages.differentValuesPlaceholder,h=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":n?`false`:`true`,class:this.classes(w.fieldInput,d?w.inputDisabled:null),status:p,maxLength:a&&a>-1?a:void 0,minLength:i&&i>-1?i:void 0,key:t.elementId,label:s,name:s,max:l??void 0,min:u??void 0,disabled:f,readOnly:d,onblur:this._onComponentBlur,required:o,placeholder:m,value:h?``:r??``,[Z]:t.elementId,[Q]:s,onfocus:this._onComponentFocus}}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);let 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(Z))}_afterRadioGroupCreateOrUpdate(e){let t=e.selectedItem,n=e.querySelector(`calcite-radio-button`),r=t||n;r&&this._afterComponentCreateOrUpdate(r)}_onComponentFocus(e){let t=e.target,n=this._getFieldInputFromHTMLElement(t);this._focusedFieldInput=n}_markInputTouched(e){e&&this._touchedInputs.add(e.template.elementId)}_isMultipleChoiceCheckbox(e,t){let n=this._getMultipleChoiceController(t);return e.tagName===`CALCITE-CHECKBOX`&&n?.input!=null}_afterComponentCreateOrUpdate(e){let t=this._getFieldInputFromHTMLElement(e),n=this._focusedFieldInput;this._attemptFocusOnNextRender&&n===t&&(this._attemptFocusOnNextRender=!1,ve(e))}_onComponentBlur(e){let t=e.target,n=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,n)||this._markInputTouched(n),this._focusedFieldInput=null}_onDynamicChoiceBlur(e,t){let n=e.currentTarget;if(this._dynamicChoiceItemSelections.delete(t))return;let r=e.relatedTarget;r instanceof Node&&n.contains(r)||(t.endInteraction(),n.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,n=!1){let r=this._getMultipleChoiceController(t);if(r){let{input:t,values:i}=r;if(t&&i){let t=e;return r.getValueFromCheckboxChange({choiceValue:t.value,isChecked:t.checked,isSelectAllCheckbox:n})}}if(S(t.template,`switch`)){if(e.localName===`calcite-dropdown`&&t.domain){for(let n of t.domain.codedValues)if(n.name===e.selectedItems[0].textContent)return n.code}return e.checked?t.template.input.onValue:t.template.input.offValue}let i=e.value;return i==null||i===``?null:t.dataType===`number`?i===`-0`||i===`-0.`||i===`-0,`?i:parseFloat(i):t.field.type===`date`?parseFloat(i):i}_getMultipleChoiceController(e){return k(e.inputController)?e.inputController:null}_saveInputFromElement(e){let t=this._getFieldInputFromHTMLElement(e);if(!t)return;let n=this._parseValue(e,t);this._saveInput(t,n)}_saveInput(e,t){let{elementId:n}=e.template,r=e?.value,{viewModel:a}=this;if(S(e.template,`switch`)&&a.mode!==`single`){let t=i(this._batchSwitchInputInitialValues,e,()=>e.value);this._batchSwitchInputInitialValues.set(e,t===null?r:t)}t!==r&&(this._markInputTouched(e),!e.isSubtypeField||a.mode===`batch`||!re(a.activeLayer,r,t)?a.setValue(n,t):this._pendingSubtypeChoice||=this._handleSubtypeChoice(e,t))}async _handleSubtypeChoice(e,n){let{value:r,template:i}=e,{elementId:a}=i,{messages:o,viewModel:s,messagesCommon:c}=this,{subtypes:l,activeFeatureIndex:u}=s;if(await s.setValue(a,n),!l?.length)return;let d=l.find(e=>e.code===n),f=l.find(e=>e.code===r)?.name??`${r}`;if(!d)return;let p=Promise.withResolvers();s.pendingSubtypeChoice=p;let m=`update-fields`,h=[{label:o.subtypes.useDefaultValuesOption,value:`update-fields`},{label:o.subtypes.keepCurrentValuesOption,value:`keep-existing`}],g={context:`info`,title:o.subtypes.changeWarningTitle,message:t(o.subtypes.changeWarning,{originalType:f,newType:d.name}),radios:h,defaultRadioSelection:`update-fields`,onRadioSelection:e=>{m=e},actions:{primary:{label:c.apply,action:()=>p.resolve(m),type:`positive`},secondary:{label:c.cancel,type:`neutral`,action:()=>p.resolve(`undo`)}},cancel:()=>p.reject()};try{switch(this.showPrompt(g),await p.promise){case`update-fields`:await s.applySubtypeDefaults(d),await s.handleSubtypeChanged(u);break;case`keep-existing`:await s.handleSubtypeChanged(u);break;case`undo`:await this.viewModel.setValue(a,r)}}finally{s.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_afterDateComponentCreateOrUpdate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){let{elementId:n}=e.template,r=e.field.type,i=this._dateComponentMap.get(`${n}`);if(!i)return;let a=e.effectiveTimeZone,o=e.value===M?void 0:e.value,s=null;r===`date-only`?s=Array.isArray(t.value)?t.value[0]:t.value:r===`time-only`?(o=G(o),s=G(t.value)):s=r===`timestamp-offset`?t.value==null?null:pe({dateComponent:i.date,timeComponent:i.time,oldValue:o,timeZoneComponent:i.timeZone,defaultTimeZone:a}):t.value==null?null:me({oldValue:o,dateComponent:i.date,timeZone:a,timeComponent:i.time?.value===M?void 0:i.time}),o!==s&&(this._markInputTouched(e),s===null||!t.value?this.viewModel.setValue(n,null):this.viewModel.setValue(n,s))}_getErrorToDisplay(e){let t=e.compositeError;return e.valid||!t?null:t===X.CONTINGENCY_VIOLATION_ERROR||t===X.CONTINGENCY_VIOLATION_WARNING?t:!this._touchedInputs.has(e.template.elementId)&&!this.viewModel.submitHasBeenAttempted?null:t}_renderViewingAssociationsPage(){return this._associationsList?.render()}_onActiveAssociationsInputChange(e){let t=this._associationsList;t&&(e?(t.associationInput=e,t.viewModel=e.viewModel):t.associationInput=null)}async _setUpAssociationsWidgets(){let e=this.viewModel.activeForm.allUtilityNetworkAssociationsElementInputs;if(this._associationsEnabled&&e.length!==0){await this._setUpUtilityNetworkAssociationList();for(let t of e)this._associationsWidgetsMap.set(t,await this._createAssociationsWidget(t))}}async _setUpUtilityNetworkAssociationList(){if(this._associationsList)return;let 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)});let t=this.viewModel.activeAssociationsInput;t&&(this._associationsList.associationInput=t,this._associationsList.viewModel=t.viewModel)}async _createAssociationsWidget(e){let t=(await import(`./Feature/FeatureUtilityNetworkAssociations.js`)).default;return new t({viewModel:e.viewModel,onSelectAssociationType:t=>this._onSelectAssociationType(e,t)})}_destroyAssociationsWidgets(){this._associationsWidgetsMap.forEach(e=>a(e)),this._associationsWidgetsMap.clear()}_onSelectAssociationType(e,{listType:t}){this.setActiveAssociationsInput(e),this.setActiveAssociationType(t)}_onSelectAssociatedLayer({layer:e}){this.setActiveAssociationsLayer(e)}async _onEditAssociatedFeature(e){let t=this.callbacks?.editAssociatedFeature,n=this.viewModel.activeAssociationsInput;if(!t||!n?.feature)return;let{association:r,feature:i}=e;await t({parentFeature:n.feature.plainGraphic,association:r,feature:i})}_onAddAssociation(e){let t=this.callbacks?.addAssociation,n=this.viewModel.activeAssociationsInput;if(!t||!n?.feature)return;let{associationType:r,utilityNetwork:i}=e;t({feature:n.feature.plainGraphic,associationType:r,utilityNetwork:i})}_setFocusableInput(e){let t=e&&j(e)?e:this._findFocusableInput(e);this._syncGroupInputStates(),this._focusedFieldInput=t,this._attemptFocusOnNextRender=!0}_findFocusableInput(e){let t=this.viewModel.activeForm.inputs;if(!t.length)return;let n=ie(t),r;if(!e)r=0;else if(A(e)){let t=e.inputs.find(e=>e.visible);r=t?n.indexOf(t):0}else{let i;i=P(e)&&!e.group.open?e.group.inputs.filter(j)[t.length-1]:e,r=n.indexOf(i)+1}for(let e=r;e<n.length;e++){let t=n[e];if(t.visible&&j(t)){if(this.disabledOrReadOnly&&(t?.inputType===`switch`||t?.inputType===`radio-buttons`))continue;return t}}return null}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._setFocusableInput(t),this.groupDisplay===`sequential`&&this.viewModel.activeForm.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_syncGroupInputStates(){if(this.groupDisplay!==`sequential`)return;let e=this.viewModel.activeForm?.allGroupInputs;if(!e.length)return;let t=e.filter(e=>e.open);t.length===0?e[0].open=!0:t.length>1&&t.slice(1).forEach(e=>e.open=!1)}};e([f()],$.prototype,`activeFeatureIndex`,null),e([f()],$.prototype,`attachmentsEnabled`,null),e([f()],$.prototype,`callbacks`,null),e([f()],$.prototype,`disabled`,null),e([f()],$.prototype,`effectiveTitle`,null),e([f()],$.prototype,`effectiveDisabled`,null),e([f()],$.prototype,`disabledOrReadOnly`,null),e([f()],$.prototype,`features`,null),e([f()],$.prototype,`footerButtonInfos`,null),e([f()],$.prototype,`map`,null),e([f()],$.prototype,`maximumFeatureCount`,null),e([f()],$.prototype,`maximumFeatureCountWithComplexForms`,null),e([f()],$.prototype,`spatialReference`,null),e([f()],$.prototype,`layerInfos`,null),e([f()],$.prototype,`timeZone`,null),e([f()],$.prototype,`headingLevel`,void 0),e([f()],$.prototype,`icon`,null),e([f(),q(`esri/t9n/common`)],$.prototype,`messagesCommon`,void 0),e([f(),q(`esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm`)],$.prototype,`messages`,void 0),e([f(),q(`esri/widgets/FeatureForm/t9n/FeatureForm`)],$.prototype,`featureFormMessages`,void 0),e([f(),q(`esri/widgets/FeatureTable/t9n/FeatureTable`)],$.prototype,`featureTableMessages`,void 0),e([f(),q(`esri/core/t9n/Units`)],$.prototype,`messagesUnits`,void 0),e([f()],$.prototype,`page`,null),e([f()],$.prototype,`readOnly`,null),e([f()],$.prototype,`showPrompt`,null),e([f()],$.prototype,`clearPrompt`,null),e([f()],$.prototype,`selectedAttachment`,null),e([f()],$.prototype,`selectedAttachmentDetails`,null),e([f()],$.prototype,`valid`,null),e([f({type:C}),_e([`attachments-change`,`value-change`,`values-change`,`submit`])],$.prototype,`viewModel`,void 0),e([f({type:D,nonNullable:!0})],$.prototype,`visibleElements`,void 0),e([f()],$.prototype,`groupDisplay`,void 0),e([f()],$.prototype,`_formHeaderVisible`,null),e([f()],$.prototype,`_associationsEnabled`,null),e([f()],$.prototype,`_associationsList`,void 0),e([f()],$.prototype,`_attemptFocusOnNextRender`,void 0),e([f()],$.prototype,`_formId`,null),e([f()],$.prototype,`_focusedFieldInput`,void 0),e([f()],$.prototype,`_pendingSubtypeChoice`,void 0),e([f()],$.prototype,`_relatedRecordsEnabled`,null),e([f()],$.prototype,`_listObserverNode`,void 0),e([f()],$.prototype,`_attachmentDialogInfo`,void 0),e([f()],$.prototype,`_attachmentListFilterText`,void 0),e([f()],$.prototype,`_prompt`,void 0),e([f()],$.prototype,`test`,null),$=e([p(`esri.widgets.BatchAttributeForm`)],$);function ye(e){switch(e){case`audio`:return _(`audio/mpeg`);case`video`:return _(`video/mp4`);case`image`:return _(`image/png`);default:return`camera`}}const be=$;export{be as default};
@@ -18,7 +18,7 @@ export interface FeatureFormProperties extends WidgetProperties, Partial<Pick<Fe
18
18
  *
19
19
  * The [FormTemplate](https://developers.arcgis.com/javascript/latest/references/core/form/FormTemplate/) is used to configure how the form should display and set any associated properties for the form, e.g. title, description, field elements, etc.
20
20
  *
21
- * * > [!NOTE]
21
+ * > [!NOTE]
22
22
  * >
23
23
  * > It is recommended to set the `formTemplate` property on the layer itself so that it can be accessed by other widgets and components that also reference the same layer, such as the [Editor](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-editor/). In addition, it can also be set on the [Editor's `layerInfo`](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-editor/#layerInfos/). If a template is set on the `layerInfo`, it will take precedence over a template set directly on the layer.
24
24
  *
@@ -155,7 +155,7 @@ export default class FeatureForm extends Widget {
155
155
  *
156
156
  * The [FormTemplate](https://developers.arcgis.com/javascript/latest/references/core/form/FormTemplate/) is used to configure how the form should display and set any associated properties for the form, e.g. title, description, field elements, etc.
157
157
  *
158
- * * > [!NOTE]
158
+ * > [!NOTE]
159
159
  * >
160
160
  * > It is recommended to set the `formTemplate` property on the layer itself so that it can be accessed by other widgets and components that also reference the same layer, such as the [Editor](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-editor/). In addition, it can also be set on the [Editor's `layerInfo`](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-editor/#layerInfos/). If a template is set on the `layerInfo`, it will take precedence over a template set directly on the layer.
161
161
  *
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3483],{6797(e,t,r){r.d(t,{Ui:()=>d});var i=r(69622),o=r(7762),n=r(88620);const l=new Set(["esri.Color","esri.portal.Portal","esri.symbols.support.Symbol3DAnchorPosition2D","esri.symbols.support.Symbol3DAnchorPosition3D"]);function a(e){return e instanceof i.A}function s(e){return e instanceof o.A?Object.keys(e.items):a(e)?(0,n.oY)(e).keys():e?Object.keys(e):[]}function p(e,t){return e instanceof o.A?e.items[t]:e[t]}function u(e){return e?e.declaredClass:null}function y(e,t){let r=e.diff;if(r&&"function"==typeof r)return r(e,t);let i=s(e),o=s(t);if(0===i.length&&0===o.length)return;if(!i.length||!o.length||function(e,t){return!(!Array.isArray(e)||!Array.isArray(t))&&e.length!==t.length}(e,t))return{type:"complete",oldValue:e,newValue:t};let n=o.filter(e=>!i.includes(e)),d=i.filter(e=>!o.includes(e)),c=i.filter(r=>o.includes(r)&&p(e,r)!==p(t,r)).concat(n,d).sort(),g=u(e);if(g&&l.has(g)&&c.length)return{type:"complete",oldValue:e,newValue:t};let h,m=a(e)&&a(t);for(let i of c){let o,n=p(e,i),l=p(t,i);if((m||"function"!=typeof n&&"function"!=typeof l)&&n!==l&&(null!=n||null!=l)){if(r&&r[i]&&"function"==typeof r[i])o=r[i]?.(n,l);else if(n instanceof Date&&l instanceof Date){if(n.getTime()===l.getTime())continue;o={type:"complete",oldValue:n,newValue:l}}else o="object"==typeof n&&"object"==typeof l&&u(n)===u(l)?y(n,l):{type:"complete",oldValue:n,newValue:l};null!=o&&(null==h?h={type:"partial",diff:{[i]:o}}:h.diff[i]=o)}}return h}function d(e,t){if("function"!=typeof e&&"function"!=typeof t&&(null!=e||null!=t))return null==e||null==t||"object"==typeof e&&"object"==typeof t&&u(e)!==u(t)?{type:"complete",oldValue:e,newValue:t}:y(e,t)}},99680(e,t,r){r.r(t),r.d(t,{default:()=>se});var i=r(32198),o=r(37838),n=r(69540),l=r(7762),a=r(51447),s=r(49186),p=r(44208),u=r(53966),y=r(25728),d=r(93637),c=r(36708),g=r(84952),h=r(10107),m=r(64108),f=r(43937),w=r(5443),v=r(16930),b=r(41910),x=r(55156),C=r(60950),S=r(89808),M=r(99959);const P=Symbol("isParquetGraphicOrigin");var Z;class A extends M.A{get[(Z=P,C.ym)](){return this.layer}get[x.e](){return this.layer}get[S.Q](){return this.layer}get[b.e7](){return this.layer}constructor(e){super(),this[Z]=!0,this.type="parquet",this.layer=e}get id(){return this.layer.id}}var E=r(4146),L=r(65529),T=r(92474),O=r(17676),j=r(83027),F=r(42760),I=r(22671);let z=class extends((0,L.Zt)(T.x_)){constructor(e){super(e),this.type="parquet"}load(e){let t=null==e?null:e.signal;return this.addResolvingPromise(this._initialize(t)),this.addHandles([(0,c.wB)(()=>this.layer.data,async e=>{if(e)try{await this._proxy.updateFileProvider(await(0,F.Dt)(e))}catch{}}),(0,c.wB)(()=>this.layer.customParameters,e=>this._setCustomParameters(e))]),Promise.resolve(this)}async reload(e){let t=await this._createLoadParameters(e);return this._proxy.reload(t)}destroy(){this._connection?.destroy()}async openPorts(){return await this.load(),this._connection.openPorts()}async getDiagnosticsSnapshot(){return await this.load(),this._proxy.getDiagnosticsSnapshot()}async getColumnIndex(e){return await this.load(),this._proxy.getColumnIndex(e)}async getOffsetIndex(e){return await this.load(),this._proxy.getOffsetIndex(e)}async queryFeaturesJSON(e,t={}){return await this.load(t),this._proxy.queryFeatures(e.toJSON(),{signal:t?.signal})}async queryFeatures(e,t={}){let r=await this.queryFeaturesJSON(e,{signal:t?.signal});return I.A.fromJSON(r)}async queryObjectIds(e,t){return await this._proxy.queryObjectIds(e.toJSON(),{signal:t?.signal})}async queryFeatureCount(e,t){return this._proxy.queryFeatureCount(e.toJSON(),{signal:t?.signal})}async queryExtent(e,t){if(null==this.layer.geometryEncoding)return u.A.getLogger(this).warn("Tried to queryExtent, but source does not have a geometry. Returning null extent."),{count:0,extent:null};let r=await this._proxy.queryExtent(e.toJSON(),{signal:t?.signal});return{count:r.count,extent:w.A.fromJSON(r.extent)}}async _initialize(e){let t={onSourceChange:()=>this.emit("source-changed"),onRangeRead:e=>this.emit("range-read",e)};this._connection=await(0,j.h)("ParquetSourceWorker",{strategy:"dedicated",signal:e,registryTarget:this,client:t}),(0,O.Te)(e),this._proxy=this._connection.createInvokeProxy();let r=await this._createLoadParameters(e),{layerDefinition:i,capabilities:o}=await this._proxy.load(r);(0,O.Te)(e),this.sourceJSON=i,this.capabilities=o}async _createLoadParameters(e){if(!this.layer.data)throw new s.A("parquet:missing-data","A data source must be specified",this.layer);let t=await(0,F.Dt)(this.layer.data,{signal:e});return(0,O.Te)(e),{provider:t,fields:this.layer.fields?.map(e=>e.toJSON()),geometryType:this.layer.geometryType?(0,F.sA)(this.layer.geometryType):null,spatialReference:this.layer.spatialReference?.toJSON(),geometryEncoding:this.layer.geometryEncoding?.toJSON(),displayOptimization:this.layer.displayOptimization,customParameters:this.layer.customParameters}}_setCustomParameters(e){this._proxy.setCustomParameters(e).catch(()=>{u.A.getLogger(this).warn("Failed to update customParameters")})}_queryStream(e,t){return this._proxy.queryStream(e,t)}_getStreamNextFeatures(e,t){return this._proxy.getStreamNextFeatures(e,t)}};(0,i.Cg)([(0,h.MZ)()],z.prototype,"type",void 0),(0,i.Cg)([(0,h.MZ)({constructOnly:!0})],z.prototype,"layer",void 0),(0,i.Cg)([(0,h.MZ)()],z.prototype,"sourceJSON",void 0),(0,i.Cg)([(0,h.MZ)()],z.prototype,"capabilities",void 0),z=(0,i.Cg)([(0,m.$)("esri.layers.graphics.sources.ParquetSource")],z);var q=r(63074),_=r(69208),R=r(10497),N=r(87718),D=r(56658),J=r(34287),B=r(32756),V=r(54310),G=r(25036),K=r(10873),k=r(29005),$=r(20437),Q=r(17036),U=r(30524),H=r(9075),W=r(34582),X=r(46499),Y=r(39383),ee=r(56370),te=r(89160),re=r(41214),ie=r(97552),oe=r(30291);r(98623);const ne=(0,Q.p)(),le="__OBJECTID",ae={types:{key:"type",base:null,typeMap:{wkb:W.A,location:H.A}},json:{name:"layerDefinition.geometryEncoding",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{read:{source:"geometryEncoding"}}}}};let se=class extends((0,D.J)((0,N.F)((0,q.dM)((0,B.fY)((0,R.z)((0,G.j)((0,V.J)((0,J.q)((0,y.M)((0,_.d)((0,n.OU)(E.A)))))))))))){constructor(e){super(e),this._emptyUrls=new l.A,this.charts=null,this.copyright=null,this.definitionExpression=null,this.returnM=void 0,this.returnZ=void 0,this.displayOptimization=null,this.fields=null,this.fieldsIndex=null,this.geometryEncoding=null,this.fullExtent=null,this.geometryType=null,this.graphicOrigin=new A(this),this.labelsVisible=!0,this.labelingInfo=null,this.objectIdField=le,this.operationalLayerType="ParquetLayer",this.outFields=null,this.persistenceEnabled=!!(0,p.A)("parquetlayer-persistence-enabled"),this.popupTemplate=null,this.source=null,this.spatialReference=null,this.templates=null,this.type="parquet",this.data=null}initialize(){this.addHandles((0,c.on)(()=>this.source,"source-changed",()=>{this.emit("refresh",{dataChanged:!0})}))}destroy(){this.source?.destroy()}async load(e){return this.addResolvingPromise(this._load(e)),this}get capabilities(){return this.source?.capabilities}get dateFieldsTimeZone(){return"UTC"}get defaultPopupTemplate(){return this.createPopupTemplate()}writeFields(e,t,r,i){let o=e.filter(e=>e.name!==le||"oid"!==e.type).map(e=>e.toJSON(i));(0,d.sM)(r,o,t)}get isTable(){return null==this.geometryEncoding&&null==this.displayOptimization}set renderer(e){(0,U.yp)(e,this.fieldsIndex),this._set("renderer",e)}get title(){let e=this._get("title");if(e&&"defaults"!==this.originOf("title"))return e;switch(this.data?.type){case"files":{let t=this.data.urls?.at(0);e=t?(0,g.e7)(t,["parquet"]):null;break}case"portal-item":e=this.data.portalItem?.title}return e||"Parquet"}set title(e){this._set("title",e)}writeData(e,t,r,i){if(!e)return;if("portal-item"===e.type&&"Parquet Feature Layer"!==e.portalItem?.type)return void i.messages?.push(new s.A("parquet-layer:unsupported-data",`Portal item with type '${e.portalItem?.type}' is not supported in web maps`,{layer:this,itemId:e.portalItem?.id}));let o=e.write({},i);o&&(t.source=o)}get urls(){return"files"===this.data?.type?this.data.urls:this._emptyUrls}set urls(e){(0,a.Lx)(u.A.getLogger(this),"urls",{replacement:"data",version:"5.1",warnOnce:!0}),this.data=new ee.A({urls:this._normalizeUrls(e)})}createPopupTemplate(e){return(0,oe.tn)(this,e)}createQuery(){let e=new ie.A;return e.returnGeometry=!0,e.outFields=["*"],e.where=this.definitionExpression||"1=1",e}async createSource(e){let t=new z({layer:this});return await t.load(e),t}getFieldDomain(e,t){return null}getField(e){return this.fieldsIndex.get(e)}async queryFeatures(e,t){await this.load();let r=await this.source.queryFeatures(this._normalizeQuery(e),t),i=this.graphicOrigin;if(r?.features)for(let e of r.features)e.layer=e.sourceLayer=this,e.origin=i;return r}async queryObjectIds(e,t){return await this.load(),this.source.queryObjectIds(this._normalizeQuery(e),t)}async queryFeatureCount(e,t){return await this.load(),this.source.queryFeatureCount(this._normalizeQuery(e),t)}async queryExtent(e,t){return await this.load(),this.source.queryExtent(this._normalizeQuery(e),t)}async hasDataChanged(){if("portal-item"===this.data?.type){let e=this.data.portalItem,t=e.modified?.getTime();if(await e.reload(),t===e.modified?.getTime())return!1}return await this.source.reload(null),!0}_normalizeQuery(e){return ie.A.from(e)??this.createQuery()}_normalizeUrls(e){return Array.isArray(e)?new l.A(e):e??new l.A}async _load(e){"portal-item"===this.data?.type&&await this.data.portalItem.load();let t=await this.createSource(e);this._set("source",t),this.read(t.sourceJSON,{origin:"service"}),["fields"].forEach(e=>this.revertToOrigin(e,"service")),(0,U.yp)(this.renderer,this.fieldsIndex),this.spatialReference??=v.A.WGS84}};(0,i.Cg)([(0,h.MZ)({readOnly:!0,json:{read:!1,write:!1}})],se.prototype,"capabilities",null),(0,i.Cg)([(0,h.MZ)({json:{origins:{"web-scene":{write:!1}},write:!0}})],se.prototype,"charts",void 0),(0,i.Cg)([(0,h.MZ)({type:String})],se.prototype,"copyright",void 0),(0,i.Cg)([(0,h.MZ)({readOnly:!0})],se.prototype,"dateFieldsTimeZone",null),(0,i.Cg)([(0,h.MZ)({readOnly:!0})],se.prototype,"defaultPopupTemplate",null),(0,i.Cg)([(0,h.MZ)({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],se.prototype,"definitionExpression",void 0),(0,i.Cg)([(0,h.MZ)({type:Boolean})],se.prototype,"returnM",void 0),(0,i.Cg)([(0,h.MZ)({type:Boolean})],se.prototype,"returnZ",void 0),(0,i.Cg)([(0,h.MZ)()],se.prototype,"displayOptimization",void 0),(0,i.Cg)([(0,h.MZ)({type:[$.A],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],se.prototype,"fields",void 0),(0,i.Cg)([(0,f.K)("fields")],se.prototype,"writeFields",null),(0,i.Cg)([(0,h.MZ)(ne.fieldsIndex)],se.prototype,"fieldsIndex",void 0),(0,i.Cg)([(0,h.MZ)(ae)],se.prototype,"geometryEncoding",void 0),(0,i.Cg)([(0,h.MZ)({type:w.A,json:{name:"extent"}})],se.prototype,"fullExtent",void 0),(0,i.Cg)([(0,h.MZ)({type:F.ye.apiValues,json:{name:"layerDefinition.geometryType",read:{reader:F.ye.read},write:{writer:F.ye.write,ignoreOrigin:!0,isRequired:!0},origins:{service:{read:{source:"geometryType",reader:F.ye.read}}}}})],se.prototype,"geometryType",void 0),(0,i.Cg)([(0,h.MZ)({readOnly:!0,clonable:!1})],se.prototype,"graphicOrigin",void 0),(0,i.Cg)([(0,h.MZ)(K.kF)],se.prototype,"labelsVisible",void 0),(0,i.Cg)([(0,h.MZ)({type:[X.A],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:Y.w},write:!0}})],se.prototype,"labelingInfo",void 0),(0,i.Cg)([(0,h.MZ)(K.fV)],se.prototype,"legendEnabled",void 0),(0,i.Cg)([(0,h.MZ)()],se.prototype,"file",void 0),(0,i.Cg)([(0,h.MZ)({type:String,readOnly:!0})],se.prototype,"objectIdField",void 0),(0,i.Cg)([(0,h.MZ)({type:["ParquetLayer"]})],se.prototype,"operationalLayerType",void 0),(0,i.Cg)([(0,h.MZ)(ne.outFields)],se.prototype,"outFields",void 0),(0,i.Cg)([(0,h.MZ)(K.M6)],se.prototype,"popupEnabled",void 0),(0,i.Cg)([(0,h.MZ)({type:o.A,json:{name:"popupInfo",write:!0}})],se.prototype,"popupTemplate",void 0),(0,i.Cg)([(0,h.MZ)({types:re.Hg,json:{name:"layerDefinition.drawingInfo.renderer",write:!0,origins:{service:{read:{source:"drawingInfo.renderer"}}}}})],se.prototype,"renderer",null),(0,i.Cg)([(0,h.MZ)({type:z,readOnly:!0,cast:null,json:{read:!1}})],se.prototype,"source",void 0),(0,i.Cg)([(0,h.MZ)({type:v.A,json:{name:"layerDefinition.spatialReference",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{read:{source:"extent.spatialReference"}}}}})],se.prototype,"spatialReference",void 0),(0,i.Cg)([(0,h.MZ)({type:[k.A]})],se.prototype,"templates",void 0),(0,i.Cg)([(0,h.MZ)()],se.prototype,"title",null),(0,i.Cg)([(0,h.MZ)({json:{read:!1},readOnly:!0})],se.prototype,"type",void 0),(0,i.Cg)([(0,h.MZ)({types:{key:"type",base:null,typeMap:{files:ee.A,"portal-item":te.A}},json:{name:"source",origins:{"web-map":{write:{target:"source",ignoreOrigin:!0}}}}})],se.prototype,"data",void 0),(0,i.Cg)([(0,f.K)("web-map","data")],se.prototype,"writeData",null),(0,i.Cg)([(0,h.MZ)({type:l.A.ofType(String),json:{read:!1,write:!1}})],se.prototype,"urls",null),se=(0,i.Cg)([(0,m.$)("esri.layers.ParquetLayer")],se)},32756(e,t,r){r.d(t,{Rr:()=>a});var i=r(32198),o=r(93637),n=r(91429),l=r(91880);function a(e,t,r){if(!e)return null;let i=e.find(e=>!!e.field);if(!i)return null;let o=new l.A;return o.read(i,r),[o]}const s={type:[l.A],json:{origins:{"web-scene":{write:!1,read:!1}},name:"layerDefinition.orderBy",read:{reader:a},write:{writer:function(e,t,r,i){let n=e.find(e=>!!e.field);n&&(0,o.sM)(r,[n.toJSON()],t)}}}};r.d(t,["fY",0,e=>{let t=e,r=class extends t{constructor(){super(...arguments),this.orderBy=null}};return(0,i.Cg)([(0,n.MZ)(s)],r.prototype,"orderBy",void 0),r=(0,i.Cg)([(0,n.$K)("esri.layers.mixins.OrderedLayer")],r),r},"ne",0,s])},29005(e,t,r){r.d(t,{A:()=>p});var i=r(32198),o=r(69540),n=r(66552),l=r(25482),a=r(91429);const s=new n.J({esriFeatureEditToolAutoCompletePolygon:"auto-complete-polygon",esriFeatureEditToolCircle:"circle",esriFeatureEditToolEllipse:"ellipse",esriFeatureEditToolFreehand:"freehand",esriFeatureEditToolLine:"line",esriFeatureEditToolNone:"none",esriFeatureEditToolPoint:"point",esriFeatureEditToolPolygon:"polygon",esriFeatureEditToolRectangle:"rectangle",esriFeatureEditToolArrow:"arrow",esriFeatureEditToolTriangle:"triangle",esriFeatureEditToolLeftArrow:"left-arrow",esriFeatureEditToolRightArrow:"right-arrow",esriFeatureEditToolUpArrow:"up-arrow",esriFeatureEditToolDownArrow:"down-arrow"});let p=class extends((0,o.OU)(l.o)){constructor(e){super(e),this.name=null,this.description=null,this.drawingTool=null,this.prototype=null,this.thumbnail=null}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],p.prototype,"name",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],p.prototype,"description",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:s.read,write:s.write}})],p.prototype,"drawingTool",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],p.prototype,"prototype",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],p.prototype,"thumbnail",void 0),p=(0,i.Cg)([(0,a.$K)("esri.layers.support.FeatureTemplate")],p)},46499(e,t,r){r.d(t,{A:()=>M});var i,o,n=r(32198),l=(r(44208),r(66552)),a=r(25482),s=r(4718),p=r(90629),u=r(91429),y=r(90360),d=r(73913),c=r(32730),g=r(77548),h=r(59868),m=r(73838),f=r(33910),w=r(36005),v=r(43937);const b=new l.J({esriServerPointLabelPlacementAboveCenter:"above-center",esriServerPointLabelPlacementAboveLeft:"above-left",esriServerPointLabelPlacementAboveRight:"above-right",esriServerPointLabelPlacementBelowCenter:"below-center",esriServerPointLabelPlacementBelowLeft:"below-left",esriServerPointLabelPlacementBelowRight:"below-right",esriServerPointLabelPlacementCenterCenter:"center-center",esriServerPointLabelPlacementCenterLeft:"center-left",esriServerPointLabelPlacementCenterRight:"center-right",esriServerLinePlacementAboveAfter:"above-after",esriServerLinePlacementAboveAlong:"above-along",esriServerLinePlacementAboveBefore:"above-before",esriServerLinePlacementAboveStart:"above-start",esriServerLinePlacementAboveEnd:"above-end",esriServerLinePlacementBelowAfter:"below-after",esriServerLinePlacementBelowAlong:"below-along",esriServerLinePlacementBelowBefore:"below-before",esriServerLinePlacementBelowStart:"below-start",esriServerLinePlacementBelowEnd:"below-end",esriServerLinePlacementCenterAfter:"center-after",esriServerLinePlacementCenterAlong:"center-along",esriServerLinePlacementCenterBefore:"center-before",esriServerLinePlacementCenterStart:"center-start",esriServerLinePlacementCenterEnd:"center-end",esriServerPolygonPlacementAlwaysHorizontal:"always-horizontal"},{ignoreUnknown:!0});function x(e,t,r){return{enabled:!(0,g.TU)(r?.layer)}}function C(e){return!e||"service"!==e.origin&&"map-image"!==e.layer?.type}function S(e){return!!function(e){return"map-image"===e?.type}(e)&&!!e.capabilities?.exportMap?.supportsArcadeExpressionForLabeling}let M=class extends a.o{static{i=c.vK}static{o=this}static evaluateWhere(e,t){let r=(e,t,r)=>{switch(t){case"=":return e==r;case"<>":return e!=r;case">":return e>r;case">=":return e>=r;case"<":return e<r;case"<=":return e<=r}return!1};try{if(null==e)return!0;let i=e.split(" ");if(3===i.length)return r(t[i[0]],i[1],i[2]);if(7===i.length){let e=r(t[i[0]],i[1],i[2]),o=i[3],n=r(t[i[4]],i[5],i[6]);switch(o){case"AND":return e&&n;case"OR":return e||n}}return!1}catch{}}constructor(e){super(e),this[i]=!0,this.type="label",this.name=null,this.allowOverrun=!1,this.deconflictionStrategy="static",this.labelExpression=null,this.labelExpressionInfo=null,this.labelPlacement=null,this.offsetDistance=0,this.labelPosition="curved",this.maxScale=0,this.minScale=0,this.repeatLabel=!0,this.symbol=h.Hk,this.useCodedValues=void 0,this.where=null}readLabelExpression(e,t){let r=t.labelExpressionInfo;if(!r||!r.value&&!r.expression)return e}writeLabelExpression(e,t,r){if(this.labelExpressionInfo)if(null!=this.labelExpressionInfo.value)e=(0,c.D3)(this.labelExpressionInfo.value);else if(null!=this.labelExpressionInfo.expression){let t=(0,c.tH)(this.labelExpressionInfo.expression);t&&(e="["+t+"]")}null!=e&&(t[r]=e)}writeLabelExpressionInfo(e,t,r,i){if(null==e&&null!=this.labelExpression&&C(i))e=new d.A({expression:this.getLabelExpressionArcade()});else if(!e)return;let o=e.toJSON(i);o.expression&&(t[r]=o)}writeMaxScale(e,t){(e||this.minScale)&&(t.maxScale=e)}writeMinScale(e,t){(e||this.maxScale)&&(t.minScale=e)}get repeatLabelDistance(){return this._get("repeatLabelDistance")}set repeatLabelDistance(e){this._set("repeatLabelDistance",e)}getLabelExpression(){return(0,c.XJ)(this)}getLabelExpressionArcade(){return(0,c.BI)(this)}getLabelExpressionSingleField(){return(0,c.rU)(this)}hash(){return JSON.stringify(this)}clone(){return new o({allowOverrun:this.allowOverrun,deconflictionStrategy:this.deconflictionStrategy,labelExpression:this.labelExpression,labelExpressionInfo:(0,s.o8)(this.labelExpressionInfo),labelPosition:this.labelPosition,labelPlacement:this.labelPlacement,offsetDistance:this.offsetDistance,maxScale:this.maxScale,minScale:this.minScale,name:this.name,repeatLabel:this.repeatLabel,repeatLabelDistance:this.repeatLabelDistance,symbol:(0,s.o8)(this.symbol),where:this.where,useCodedValues:this.useCodedValues})}};(0,n.Cg)([(0,u.MZ)({type:String,json:{write:!0}})],M.prototype,"name",void 0),(0,n.Cg)([(0,u.MZ)({type:Boolean,json:{write:!0,default:!1,origins:{"web-scene":{write:!1},"portal-item":{default:!1,write:{overridePolicy:x}}}}})],M.prototype,"allowOverrun",void 0),(0,n.Cg)([(0,u.MZ)({type:String,json:{write:!0,default:"static",origins:{"web-scene":{write:!1},"portal-item":{default:"static",write:{overridePolicy:x}}}}})],M.prototype,"deconflictionStrategy",void 0),(0,n.Cg)([(0,u.MZ)({type:String,json:{write:{overridePolicy(e,t,r){return this.labelExpressionInfo&&"service"===r?.origin&&S(r.layer)?{enabled:!1}:{allowNull:!0}}}}})],M.prototype,"labelExpression",void 0),(0,n.Cg)([(0,w.w)("labelExpression")],M.prototype,"readLabelExpression",null),(0,n.Cg)([(0,v.K)("labelExpression")],M.prototype,"writeLabelExpression",null),(0,n.Cg)([(0,u.MZ)({type:d.A,json:{write:{overridePolicy:(e,t,r)=>function(e){return C(e)||S(e?.layer)}(r)?{allowNull:!0}:{enabled:!1}}}})],M.prototype,"labelExpressionInfo",void 0),(0,n.Cg)([(0,v.K)("labelExpressionInfo")],M.prototype,"writeLabelExpressionInfo",null),(0,n.Cg)([(0,u.MZ)({type:b.apiValues,json:{type:b.jsonValues,read:b.read,write:b.write}})],M.prototype,"labelPlacement",void 0),(0,n.Cg)([(0,u.MZ)({type:Number,json:{read:!0,write:!0,default:0,origins:{"web-scene":{write:!1}}}})],M.prototype,"offsetDistance",void 0),(0,n.Cg)([(0,u.MZ)({type:["curved","parallel"],json:{write:!0,origins:{"web-map":{write:!1},"web-scene":{write:!1},"portal-item":{write:!1}}}})],M.prototype,"labelPosition",void 0),(0,n.Cg)([(0,u.MZ)({type:Number})],M.prototype,"maxScale",void 0),(0,n.Cg)([(0,v.K)("maxScale")],M.prototype,"writeMaxScale",null),(0,n.Cg)([(0,u.MZ)({type:Number})],M.prototype,"minScale",void 0),(0,n.Cg)([(0,v.K)("minScale")],M.prototype,"writeMinScale",null),(0,n.Cg)([(0,u.MZ)({type:Boolean,json:{write:!0,origins:{"web-scene":{write:!1},"portal-item":{write:{overridePolicy:x}}}}})],M.prototype,"repeatLabel",void 0),(0,n.Cg)([(0,u.MZ)({type:Number,cast:p.cr,json:{write:!0,origins:{"web-scene":{write:!1},"portal-item":{write:{overridePolicy:x}}}}})],M.prototype,"repeatLabelDistance",null),(0,n.Cg)([(0,u.MZ)({types:f.em,json:{types:f.em,origins:{"portal-item":{types:f.em,read:{reader:(0,y.C)({types:f.em})},default:null},"web-scene":{types:f.Rv,read:{reader:(0,y.C)({types:f.Rv})},write:m.oO,default:null}},write:m.oO,default:null}})],M.prototype,"symbol",void 0),(0,n.Cg)([(0,u.MZ)({type:Boolean,json:{write:!0}})],M.prototype,"useCodedValues",void 0),(0,n.Cg)([(0,u.MZ)({type:String,json:{write:!0}})],M.prototype,"where",void 0),M=o=(0,n.Cg)([(0,u.$K)("esri.layers.support.LabelClass")],M)},73913(e,t,r){r.d(t,{A:()=>u});var i,o=r(32198),n=r(25482),l=r(91429),a=r(32730),s=r(36005),p=r(43937);let u=class extends n.o{static{i=this}constructor(e){super(e),this.name=null,this.expression=null,this.title=null,this.value=null}readExpression(e,t){return t.value?(0,a.mX)(t.value):e}writeExpression(e,t,r){null!=this.value&&(e=(0,a.mX)(this.value)),null!=e&&(t[r]=e)}clone(){return new i({name:this.name,expression:this.expression,title:this.title,value:this.value})}};(0,o.Cg)([(0,l.MZ)({type:String,json:{write:!0,origins:{"web-scene":{write:!1}}}})],u.prototype,"name",void 0),(0,o.Cg)([(0,l.MZ)({type:String,json:{write:{writerEnsuresNonNull:!0}}})],u.prototype,"expression",void 0),(0,o.Cg)([(0,s.w)("expression",["expression","value"])],u.prototype,"readExpression",null),(0,o.Cg)([(0,p.K)("expression")],u.prototype,"writeExpression",null),(0,o.Cg)([(0,l.MZ)({type:String,json:{write:!0,origins:{"web-scene":{write:!1}}}})],u.prototype,"title",void 0),(0,o.Cg)([(0,l.MZ)({json:{read:!1,write:!1}})],u.prototype,"value",void 0),u=i=(0,o.Cg)([(0,l.$K)("esri.layers.support.LabelExpressionInfo")],u)},91880(e,t,r){r.d(t,{A:()=>p});var i,o=r(32198),n=r(66552),l=r(25482),a=r(91429);const s=new n.J({asc:"ascending",desc:"descending"});let p=class extends l.o{static{i=this}constructor(e){super(e),this.field=null,this.valueExpression=null,this.order="ascending"}clone(){return new i({field:this.field,valueExpression:this.valueExpression,order:this.order})}};(0,o.Cg)([(0,a.MZ)({type:String,json:{write:!0}})],p.prototype,"field",void 0),(0,o.Cg)([(0,a.MZ)({type:String,json:{write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],p.prototype,"valueExpression",void 0),(0,o.Cg)([(0,a.MZ)({type:s.apiValues,json:{type:s.jsonValues,read:s.read,write:s.write}})],p.prototype,"order",void 0),p=i=(0,o.Cg)([(0,a.$K)("esri.layers.support.OrderByInfo")],p)},89160(e,t,r){r.d(t,{A:()=>y});var i=r(32198),o=r(69540),n=r(25482),l=r(91429),a=r(64108),s=r(80812),p=r(36005),u=r(43937);let y=class extends((0,n.T)(o.Pw)){constructor(e){super(e),this.type="portal-item"}readPortalItem(e,t,r){if(t.itemId)return new s.default({id:t.itemId,portal:r?.portal})}writePortalItem(e,t){e?.id&&(t.itemId=e.id)}};(0,i.Cg)([(0,l.MZ)({type:["portal-item"],nonNullable:!0,readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],y.prototype,"type",void 0),(0,i.Cg)([(0,l.MZ)({type:s.default,json:{write:{isRequired:!0}}})],y.prototype,"portalItem",void 0),(0,i.Cg)([(0,p.w)("portalItem",["itemId"])],y.prototype,"readPortalItem",null),(0,i.Cg)([(0,u.K)("portalItem",{itemId:{type:String}})],y.prototype,"writePortalItem",null),y=(0,i.Cg)([(0,a.$)("esri.layers.support.ParquetPortalItemData")],y)},39383(e,t,r){r.d(t,{w:()=>s,z:()=>y});var i=r(49186),o=r(53966),n=r(46499);const l=()=>o.A.getLogger("esri.layers.support.labelingInfo"),a=/\[([^[\]]+)\]/gi;function s(e,t,r){return e?e.map(e=>{let i=new n.A;if(i.read(e,r),i.labelExpression){let e=t.fields||t.layerDefinition?.fields||this.fields;i.labelExpression=i.labelExpression.replaceAll(a,(t,r)=>`[${function(e,t){if(!t)return e;let r=e.toLowerCase();for(let e=0;e<t.length;e++){let i=t[e].name;if(i.toLowerCase()===r)return i}return e}(r,e)}]`)}return i}):null}const p=["above-right","above-center","above-left","center-center","center-left","center-right","below-center","below-left","below-right"],u={esriGeometryPoint:p,esriGeometryMultiPatch:["always-horizontal"],esriGeometryPolygon:["always-horizontal"],esriGeometryPolyline:["center-along","above-along","below-along"],esriGeometryMultipoint:p,esriGeometryEnvelope:null};function y(e,t){let r=[];for(let o of e){let e=o.labelPlacement,n=u[t];if(!o.symbol)return l().warn("No ILabelClass symbol specified."),[];if(!n)return l().error(new i.A("labeling:unsupported-geometry-type",`Unable to create labels for layer, geometry type '${t}' is not supported`)),[];if(n.includes(e))r.push(o);else{let i=n[0];e&&l().warn(`Found invalid label placement type ${e} for ${t}. Defaulting to ${i}`);let a=o.clone();a.labelPlacement=i,r.push(a)}}return r}},22671(e,t,r){r.d(t,{A:()=>w});var i,o=r(32198),n=r(52106),l=r(66552),a=r(25482),s=r(4718),p=r(91429),u=r(16930),y=r(60408),d=r(65864),c=r(50498),g=r(20437),h=r(36005),m=r(43937);const f=new l.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let w=i=class extends a.o{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){return this.readFeaturesWithClass(e,t,n.A)}writeGeometryType(e,t,r,i){if(e)return void f.write(e,t,r,i);let{features:o}=this;if(o)for(let e of o)if(null!=e?.geometry)return void f.write(e.geometry.type,t,r,i)}readQueryGeometry(e,t){if(!e)return null;let r=!!e.spatialReference,i=(0,d.rS)(e);return i&&!r&&t.spatialReference&&(i.spatialReference=u.A.fromJSON(t.spatialReference)),i}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());let{features:r}=this;if(r)for(let e of r)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new i(this.cloneProperties())}cloneProperties(){return(0,s.o8)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){let t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let r=0;r<t.features.length;r++){let i=t.features[r];i.geometry&&=(e?.[r])?.toJSON()||i.geometry}return t}quantize(e){let{scale:[t,r],translate:[i,o]}=e,n=this.features,l=this._getQuantizationFunction(this.geometryType,e=>Math.round((e-i)/t),e=>Math.round((o-e)/r));for(let e=0,t=n.length;e<t;e++)l?.(n[e].geometry)||(n.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){let{geometryType:e,features:t,transform:r}=this;if(!r)return this;let{translate:[i,o],scale:[n,l]}=r,a=null,s=null;if(this.hasZ&&null!=r?.scale?.[2]){let{translate:[,,e],scale:[,,t]}=r;a=r=>r*t+e}if(this.hasM&&null!=r?.scale?.[3]){let{translate:[,,,e],scale:[,,,t]}=r;s=r=>null==r?r:r*t+e}let p=this._getHydrationFunction(e,e=>e*n+i,e=>o-e*l,a,s);for(let{geometry:e}of t)null!=e&&p&&p(e);return this.transform=null,this}readFeaturesWithClass(e,t,r){let i=u.A.fromJSON(t.spatialReference),o=[];for(let t=0;t<e.length;t++){let n=e[t],l=r.fromJSON(n),a=n.geometry?.spatialReference;null!=l.geometry&&!a&&(l.geometry.spatialReference=i);let s=n.aggregateGeometries,p=l.aggregateGeometries;if(s&&null!=p)for(let e in p){let t=p[e],r=s[e]?.spatialReference;null!=t&&!r&&(t.spatialReference=i)}o.push(l)}return o}_quantizePoints(e,t,r){let i,o,n=[];for(let l=0,a=e.length;l<a;l++){let a=e[l];if(l>0){let e=t(a[0]),l=r(a[1]);(e!==i||l!==o)&&(n.push([e-i,l-o]),i=e,o=l)}else i=t(a[0]),o=r(a[1]),n.push([i,o])}return n.length>0?n:null}_getQuantizationFunction(e,t,r){return"point"===e?e=>(e.x=t(e.x),e.y=r(e.y),e):"polyline"===e||"polygon"===e?e=>{let i=(0,y.Bi)(e)?e.rings:e.paths,o=[];for(let e=0,n=i.length;e<n;e++){let n=i[e],l=this._quantizePoints(n,t,r);l&&o.push(l)}return o.length>0?((0,y.Bi)(e)?e.rings=o:e.paths=o,e):null}:"multipoint"===e?e=>{let i=this._quantizePoints(e.points,t,r);return i&&i.length>0?(e.points=i,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,r,i,o){return"point"===e?e=>{e.x=t(e.x),e.y=r(e.y),i&&(e.z=i(e.z))}:"polyline"===e||"polygon"===e?e=>{let n,l,a=(0,y.Bi)(e)?e.rings:e.paths;for(let e=0,i=a.length;e<i;e++){let i=a[e];for(let e=0,o=i.length;e<o;e++){let o=i[e];e>0?(n+=o[0],l+=o[1]):(n=o[0],l=o[1]),o[0]=t(n),o[1]=r(l)}}if(i&&o)for(let e=0,t=a.length;e<t;e++){let t=a[e];for(let e=0,r=t.length;e<r;e++){let r=t[e];r[2]=i(r[2]),r[3]=o(r[3])}}else if(i)for(let e=0,t=a.length;e<t;e++){let t=a[e];for(let e=0,r=t.length;e<r;e++){let r=t[e];r[2]=i(r[2])}}else if(o)for(let e=0,t=a.length;e<t;e++){let t=a[e];for(let e=0,r=t.length;e<r;e++){let r=t[e];r[2]=o(r[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=r(e.ymin),e.xmax=t(e.xmax),e.ymax=r(e.ymax),i&&null!=e.zmax&&null!=e.zmin&&(e.zmax=i(e.zmax),e.zmin=i(e.zmin)),o&&null!=e.mmax&&null!=e.mmin&&(e.mmax=o(e.mmax),e.mmin=o(e.mmin))}:"multipoint"===e?e=>{let n,l,a=e.points;for(let e=0,i=a.length;e<i;e++){let i=a[e];e>0?(n+=i[0],l+=i[1]):(n=i[0],l=i[1]),i[0]=t(n),i[1]=r(l)}if(i&&o)for(let e=0,t=a.length;e<t;e++){let t=a[e];t[2]=i(t[2]),t[3]=o(t[3])}else if(i)for(let e=0,t=a.length;e<t;e++){let t=a[e];t[2]=i(t[2])}else if(o)for(let e=0,t=a.length;e<t;e++){let t=a[e];t[2]=o(t[2])}}:null}};(0,o.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],w.prototype,"displayFieldName",void 0),(0,o.Cg)([(0,p.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],w.prototype,"exceededTransferLimit",void 0),(0,o.Cg)([(0,p.MZ)({type:[n.A],json:{write:!0}})],w.prototype,"features",void 0),(0,o.Cg)([(0,h.w)("features")],w.prototype,"readFeatures",null),(0,o.Cg)([(0,p.MZ)({type:[g.A],json:{write:!0}})],w.prototype,"fields",void 0),(0,o.Cg)([(0,p.MZ)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:f.read}}})],w.prototype,"geometryType",void 0),(0,o.Cg)([(0,m.K)("geometryType")],w.prototype,"writeGeometryType",null),(0,o.Cg)([(0,p.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],w.prototype,"hasM",void 0),(0,o.Cg)([(0,p.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],w.prototype,"hasZ",void 0),(0,o.Cg)([(0,p.MZ)({types:c.yR,json:{write:!0}})],w.prototype,"queryGeometry",void 0),(0,o.Cg)([(0,h.w)("queryGeometry")],w.prototype,"readQueryGeometry",null),(0,o.Cg)([(0,p.MZ)({type:u.A,json:{write:!0}})],w.prototype,"spatialReference",void 0),(0,o.Cg)([(0,m.K)("spatialReference")],w.prototype,"writeSpatialReference",null),(0,o.Cg)([(0,p.MZ)({json:{write:!0}})],w.prototype,"transform",void 0),w=i=(0,o.Cg)([(0,p.$K)("esri.rest.support.FeatureSet")],w),w.prototype.toJSON.isDefaultToJSON=!0},41366(e,t,r){var i=r(32198),o=r(66552),n=r(53966),l=r(91429),a=r(93223);const s=(0,o.O)()({naturalLog:"natural-log",squareRoot:"square-root",percentOfTotal:"percent-of-total",log:"log",field:"field"}),p="percent-of-total",u="field";r.d(t,["K",0,e=>{let t=e,r=class extends t{constructor(){super(...arguments),this.normalizationField=null,this.normalizationMaxValue=null,this.normalizationMinValue=null,this.normalizationTotal=null}get normalizationType(){let e=this._get("normalizationType"),t=!!this.normalizationField,r=null!=this.normalizationTotal;return t||r?(e=t&&u||r&&p||null,t&&r&&n.A.getLogger(this).warn("warning: both normalizationField and normalizationTotal are set!")):(e===u||e===p)&&(e=null),e}set normalizationType(e){this._set("normalizationType",e)}};return(0,i.Cg)([(0,l.MZ)({type:String,json:{name:"parameters.normalizationField",write:!0}})],r.prototype,"normalizationField",void 0),(0,i.Cg)([(0,l.MZ)({type:Number,json:{name:"parameters.normalizationMaxValue",write:!0}})],r.prototype,"normalizationMaxValue",void 0),(0,i.Cg)([(0,l.MZ)({type:Number,json:{name:"parameters.normalizationMinValue",write:!0}})],r.prototype,"normalizationMinValue",void 0),(0,i.Cg)([(0,l.MZ)({type:Number,json:{name:"parameters.normalizationTotal",write:!0}})],r.prototype,"normalizationTotal",void 0),(0,i.Cg)([(0,a.e)(s,{name:"parameters.normalizationType"})],r.prototype,"normalizationType",null),r=(0,i.Cg)([(0,l.$K)("esri.rest.support.NormalizationBinParametersMixin")],r),r},"Q",0,s])}}]);