/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as e}from"tslib";import r from"../../request.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import{clone as o}from"../../core/lang.js";import{on as s,sync as i}from"../../core/reactiveUtils.js";import{property as a,subclass as n}from"../../core/accessorSupport/decorators.js";import{persistable as l}from"../../core/accessorSupport/decorators/persistable.js";import p from"./PolygonCollection.js";import{f as m}from"../../chunks/persistableUrlUtils.js";import{reader as c}from"../../core/accessorSupport/decorators/reader.js";var u;let g=u=class extends t{constructor(e){super(e),this.spatialRelationship="disjoint",this.geometries=new p,this._geometriesSource=null}initialize(){this.addHandles(s(()=>this.geometries,"after-changes",()=>this.geometries=this.geometries,i))}readGeometries(e,r,t){Array.isArray(e)?this.geometries=p.fromJSON(e,t):"web-scene"!==t.origin&&"portal-item"!==t.origin||(this._geometriesSource={url:m(e,t),context:t})}async loadGeometries(e,t){if(null==this._geometriesSource)return;const{url:o,context:s}=this._geometriesSource,i=await r(o,{responseType:"json",signal:t?.signal}),a=e.toJSON(),n=i.data.map(e=>({...e,spatialReference:a}));this.geometries=p.fromJSON(n,s),this._geometriesSource=null}clone(){const e=new u({geometries:o(this.geometries),spatialRelationship:this.spatialRelationship});return e._geometriesSource=this._geometriesSource,e}};e([a({type:["disjoint","contains"],nonNullable:!0,json:{write:{isRequired:!0}}})],g.prototype,"spatialRelationship",void 0),e([a({type:p,nonNullable:!0,json:{write:!0,origins:{"web-scene":{write:{isRequired:!0}}}}}),l({origins:["web-scene","portal-item"],type:"resource",prefix:"geometries",contentAddressed:!0})],g.prototype,"geometries",void 0),e([c(["web-scene","portal-item","service"],"geometries")],g.prototype,"readGeometries",null),g=u=e([n("esri.layers.support.SceneFilter")],g);const d=g;export{d as default};
