/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as e}from"tslib";import{handlesGroup as r}from"../../../../core/handleUtils.js";import{on as t}from"../../../../core/reactiveUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators.js";class a{constructor(e){this.layer=e}get elevationInfo(){}add(e,r){const t=this._getSublayerForCreateTool(r)??this._getSublayerForGraphic(e);t?.add(e)}addMany(e,r){if(r){const t=this._getSublayerForCreateTool(r);if(t)return void t.addMany(e)}e.forEach(e=>this._getSublayerForGraphic(e)?.add(e))}onGraphicsChange(e){const{layer:o}=this;if(o.sublayers?.length)return r(o.sublayers?.toArray().map(r=>t(()=>r.graphics,"change",r=>e(r))))}has(e){const{layer:r}=this;return e.layer===r||e.sourceLayer===r||!!r.sublayers?.some(r=>e.layer===r||e.sourceLayer===r)}remove(e){this._getSublayerForGraphic(e)?.remove(e)}removeMany(e){e.forEach(e=>this._getSublayerForGraphic(e)?.remove(e))}removeAll(){this.layer.sublayers?.forEach(e=>e.removeAll())}_getSublayerForCreateTool(e){const{layer:r}=this;switch(e){case"point":return r.pointLayer;case"polyline":return r.polylineLayer;case"polygon":return r.polygonLayer;case"multipoint":return r.multipointLayer;case"text":return r.textLayer}}_getSublayerForGraphic(e){const{layer:r}=this;if(e?.geometry)switch(e.geometry.type){case"point":return"text"===e.symbol?.type?r.textLayer:r.pointLayer;case"polyline":return r.polylineLayer;case"polygon":return r.polygonLayer;case"multipoint":return r.multipointLayer}}}e([o()],a.prototype,"elevationInfo",null);export{a as default};
