/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.js";import{AsyncUpdateMixin as t}from"../../../../core/AsyncUpdate.js";import i from"../../../../core/Logger.js";import{property as s,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{fixFields as o,collectLabelingFields as d,collectFilterFields as n}from"../../../../layers/support/fieldUtils.js";let a=class extends(t(r)){get layer(){return this.layerView.layer}get requiredFields(){const{layerView:{layer:{fieldsIndex:e},definitionExpressionFields:r},rendererFields:t,labelingFields:i,viewFilterFields:s}=this;return o(e,[...r??[],...t??[],...i??[],...s??[]])}constructor(e){super(e)}initialize(){this.addHandles([this.autoUpdateAsync("rendererFields",async()=>{const{fieldsIndex:e,renderer:r}=this.layer;return r?this._getFieldsAsync(t=>r.collectRequiredFields(t,e)):null}),this.autoUpdateAsync("labelingFields",async()=>{const{layer:e}=this;return e.labelsVisible?this._getFieldsAsync(r=>d(r,e)):null}),this.autoUpdateAsync("viewFilterFields",()=>{const{layer:e,mergedFilter:r}=this.layerView;return this._getFieldsAsync(t=>n(t,e,r))})])}async _getFieldsAsync(e){const r=new Set;try{return await e(r),Array.from(r).sort()}catch(t){return i.getLogger(this).error(t),null}}};e([s()],a.prototype,"layerView",void 0),e([s()],a.prototype,"layer",null),e([s()],a.prototype,"requiredFields",null),e([s()],a.prototype,"rendererFields",void 0),e([s()],a.prototype,"labelingFields",void 0),e([s()],a.prototype,"viewFilterFields",void 0),a=e([l("esri.views.3d.layers.support.SceneLayerViewRequiredFields")],a);export{a as SceneLayerViewRequiredFields};
