/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import{property as r,subclass as s}from"../../../core/accessorSupport/decorators.js";import o from"../../LayerList/LayerListViewModel.js";import{isValidSnappingLayer as i}from"./snappingLayerListUtils.js";import{SnappingListItem as a}from"./SnappingListItem.js";let p=class extends o{constructor(){super(...arguments),this.featureSnappingSources=new t}get operationalItemsFlat(){return this.operationalItems.flatten(e=>e.children)}get selectableItems(){return this.operationalItemsFlat.filter(e=>!e.children?.length)}_compileList(){const e=this.view?.map?.layers;if(!e)return;const t=e.filter(i);this._watchLayersListMode(t);const r=this._getViewableLayers(t);r?.length?(this._createNewItems(r),this._removeItems(r),this._sortItems(r)):this._removeAllItems()}_createListItem(e){return new a({layer:e,view:this.view,getFeatureSnappingSources:()=>this.featureSnappingSources})}};e([r()],p.prototype,"featureSnappingSources",void 0),e([r()],p.prototype,"operationalItems",void 0),e([r()],p.prototype,"operationalItemsFlat",null),e([r()],p.prototype,"selectableItems",null),p=e([s("esri.widgets.support.SnappingControls.SnappingLayerListViewModel")],p);export{p as SnappingLayerListViewModel};
