/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{convertOptimizedGeometryToFlat as e,convertGeometryToFlat as t}from"../../geometry/FlatGeometry.js";import{featureGeometryTypeKebabDictionary as r}from"../../geometry/support/typeUtils.js";import{convertOptimizedFeatureToFlat as s,FlatFeature as i}from"./FlatFeature.js";import a from"./OptimizedGeometry.js";import{createFeatureId as o}from"./data/createFeatureId.js";class l{constructor(){this.globalIdFieldName=null,this.geohashFieldName=null,this.geometryProperties=null,this.geometryType=null,this.spatialReference=null,this.hasZ=!1,this.hasM=!1,this.features=[],this.fields=[],this.transform=null,this.exceededTransferLimit=!1,this.uniqueIdField=null,this.queryGeometryType=null,this.queryGeometry=null}weakClone(){const e=new l;return e.globalIdFieldName=this.globalIdFieldName,e.geohashFieldName=this.geohashFieldName,e.geometryProperties=this.geometryProperties,e.geometryType=this.geometryType,e.spatialReference=this.spatialReference,e.hasZ=this.hasZ,e.hasM=this.hasM,e.features=this.features,e.fields=this.fields,e.transform=this.transform,e.exceededTransferLimit=this.exceededTransferLimit,e.uniqueIdField=this.uniqueIdField,e.queryGeometry=this.queryGeometry,e.queryGeometryType=this.queryGeometryType,e}}function m(t){const i=r.fromJSON(t.geometryType),a=new l;return a.globalIdFieldName=t.globalIdFieldName,a.geohashFieldName=t.geohashFieldName,a.geometryProperties=t.geometryProperties,a.geometryType=t.geometryType,a.spatialReference=t.spatialReference,a.hasZ=t.hasZ,a.hasM=t.hasM,a.features=t.features.map(e=>s(i,e)),a.fields=t.fields,a.transform=t.transform,a.exceededTransferLimit=t.exceededTransferLimit,a.uniqueIdField=t.uniqueIdField,a.queryGeometry=t.queryGeometry&&e(i,t.queryGeometry),a.queryGeometryType=t.queryGeometryType,a}function n({exceededTransferLimit:e,features:r,fields:s,geometryType:m,hasM:n,hasZ:y,spatialReference:d,transform:h},u){const f=new l;f.exceededTransferLimit=e??!1;for(const l of r??[]){let e,r;m&&(e=l.geometry&&t(l.geometry),r=l.centroid&&new a([],[l.centroid.x,l.centroid.y]));const s=o(l,u);f.features.push(new i(e,l.attributes,r,s))}return f.fields=s??f.fields,f.geometryType=m??null,f.hasM=n??!1,f.hasZ=y??!1,f.spatialReference=d??null,f.transform=h??null,f}export{l as FlatFeatureSet,n as convertFeatureSetToFlat,m as convertOptimizedFeatureSetToFlat};
