/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as e}from"tslib";import r from"../analysis/Viewshed.js";import t from"../analysis/ViewshedAnalysis.js";import s from"../core/Collection.js";import{MultiOriginJSONSupportMixin as i}from"../core/MultiOriginJSONSupport.js";import{watch as o,syncAndInitial as a}from"../core/reactiveUtils.js";import{property as n,subclass as p}from"../core/accessorSupport/decorators.js";import l from"./Layer.js";import{OperationalLayer as d}from"./mixins/OperationalLayer.js";import{writer as c}from"../core/accessorSupport/decorators/writer.js";let y=class extends(d(i(l))){constructor(e){super(e),this.type="viewshed",this.operationalLayerType="ViewshedLayer",this.source=new t,this.opacity=1}initialize(){this.addHandles(o(()=>this.source,(e,r)=>{null!=r&&r.parent===this&&(r.parent=null),null!=e&&(e.parent=this)},a))}async load(){return this.addResolvingPromise(this.source.waitComputeExtent()),this}get spatialReference(){return this.source.spatialReference}get fullExtent(){return this.source.extent}releaseAnalysis(e){this.source===e&&(this.source=new t)}get analysis(){return this.source}set analysis(e){this.source=e}get viewsheds(){return this.source.viewsheds}set viewsheds(e){this.source.viewsheds=e}writeViewsheds(e,r,t,s){r.viewsheds=e.filter(e=>e.valid).toJSON(s)}};e([n({json:{read:!1},readOnly:!0})],y.prototype,"type",void 0),e([n({type:["ViewshedLayer"]})],y.prototype,"operationalLayerType",void 0),e([n({type:t,nonNullable:!0})],y.prototype,"source",void 0),e([n({readOnly:!0})],y.prototype,"spatialReference",null),e([n({readOnly:!0})],y.prototype,"fullExtent",null),e([n({readOnly:!0,json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}}})],y.prototype,"opacity",void 0),e([n({type:["show","hide"]})],y.prototype,"listMode",void 0),e([n({type:s.ofType(r),json:{write:{ignoreOrigin:!0},origins:{"web-scene":{write:{ignoreOrigin:!0}}}}})],y.prototype,"viewsheds",null),e([c("web-scene","viewsheds")],y.prototype,"writeViewsheds",null),y=e([p("esri.layers.ViewshedLayer")],y);const h=y;export{h as default};
