/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{convertGeometryToFlat as e,convertOptimizedGeometryToFlat as t}from"../../geometry/FlatGeometry.js";import{featureGeometryTypeKebabDictionary as r}from"../../geometry/support/typeUtils.js";import{FlatFeature as s,convertOptimizedFeatureToFlat 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(e){const s=r.fromJSON(e.geometryType),a=new l;return a.globalIdFieldName=e.globalIdFieldName,a.geohashFieldName=e.geohashFieldName,a.geometryProperties=e.geometryProperties,a.geometryType=e.geometryType,a.spatialReference=e.spatialReference,a.hasZ=e.hasZ,a.hasM=e.hasM,a.features=e.features.map(t=>i(s,t,e.spatialReference)),a.fields=e.fields,a.transform=e.transform,a.exceededTransferLimit=e.exceededTransferLimit,a.uniqueIdField=e.uniqueIdField,a.queryGeometry=e.queryGeometry&&t(s,e.queryGeometry),a.queryGeometryType=e.queryGeometryType,a}function n({exceededTransferLimit:t,features:r,fields:i,geometryType:m,hasM:n,hasZ:y,spatialReference:d,transform:h},u){const f=new l;f.exceededTransferLimit=t??!1;for(const l of r??[]){let t,r;m&&(t=l.geometry&&e(l.geometry),r=l.centroid&&new a([],[l.centroid.x,l.centroid.y]));const i=o(l,u),n=void 0;f.features.push(new s(t,l.attributes,r,i,n,l.distance))}return f.fields=i??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};
