/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as r,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isTable as l}from"../../../layers/support/layerUtils.js";import o from"./EditorEditingCapabilities.js";import{isMergeableGeometryType as i}from"./mergeFeaturesUtils.js";import{isSplittableGeometryType as a}from"./splitFeatureUtils.js";import{formTemplateHasInvalidFields as p}from"../../FeatureForm/featureFormUtils.js";let n=class extends t{constructor(e){super(e),this.disabled=!1,this.layer=null,this.layerInfo=null,this.layerView=null}get _suspended(){return!!this.layerView?.suspended}get capabilities(){return new o({layer:this.layer,layerInfo:this.layerInfo,layerView:this.layerView})}get editable(){const{create:e,relationship:t,update:r,delete:{enabled:s}}=this.capabilities,l=e.attachments.enabled||r.attachments.enabled;return!this.disabled&&(e.enabled||r.enabled||l||s||t.enabled)}get formTemplate(){return this.capabilities.formTemplate}get hasInvalidFormTemplate(){return p(this.layer,this.formTemplate)}get isTable(){return l(this.layer)}get supportsCreateFeaturesWorkflow(){if(this.disabled)return!1;const{enabled:e,geometry:t}=this.capabilities.create;return this.isTable?e:e&&t}get supportsMergeFeaturesWorkflow(){const{capabilities:e,layer:t}=this;return!this.disabled&&e.update.enabled&&e.update.geometry&&e.delete.enabled&&!l(t)&&i(t.geometryType)}get supportsSplitFeatureWorkflow(){const{capabilities:e}=this;return!this.disabled&&e.update.enabled&&e.update.geometry&&e.create.enabled&&a(this.layer.geometryType)}get supportsUpdateWorkflow(){const{capabilities:e}=this;return!this.disabled&&(e.update.enabled||e.update.attachments.enabled||e.delete.enabled)}get visible(){const{layer:e}=this,t=e.parent;return!this._suspended&&e.visible&&(!t||!("visible"in t)||t.visible)}};e([r()],n.prototype,"_suspended",null),e([r()],n.prototype,"capabilities",null),e([r()],n.prototype,"disabled",void 0),e([r()],n.prototype,"editable",null),e([r()],n.prototype,"formTemplate",null),e([r()],n.prototype,"hasInvalidFormTemplate",null),e([r()],n.prototype,"isTable",null),e([r()],n.prototype,"layer",void 0),e([r()],n.prototype,"layerInfo",void 0),e([r()],n.prototype,"layerView",void 0),e([r()],n.prototype,"supportsCreateFeaturesWorkflow",null),e([r()],n.prototype,"supportsMergeFeaturesWorkflow",null),e([r()],n.prototype,"supportsSplitFeatureWorkflow",null),e([r()],n.prototype,"supportsUpdateWorkflow",null),e([r()],n.prototype,"visible",null),n=e([s("esri.widgets.Editor.support.EditorItem")],n);const d=n;export{d as default};
