/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{estimateAttributesMemory as t}from"../../core/memoryEstimations.js";import{convertFlatToOptimizedGeometry as e,convertOptimizedGeometryToFlat as r}from"../../geometry/FlatGeometry.js";import{getCentroidOptimizedGeometry as i}from"./centroid.js";class s{constructor(t=null,e={},r,i,s=0){this.geometry=t,this.attributes=e,this.centroid=r,this.objectId=i,this.displayId=s}weakClone(){return new s(this.geometry,this.attributes,this.centroid,this.objectId,this.displayId)}clone(){return new s(this.geometry?.clone(),{...this.attributes},this.centroid?.clone(),this.objectId,this.displayId)}get usedMemory(){return 128+t(this.attributes)+(this.geometry?.usedMemory??0)}ensureCentroid(t){return this.centroid??=i(this.geometry&&e(this.geometry)),this.centroid}}function o(t,{geometry:e,attributes:i,centroid:o,objectId:n,displayId:d}){return new s(e&&r(t,e),i,o,n,d)}export{s as FlatFeature,o as convertOptimizedFeatureToFlat};
