/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{getDataValues as i,quantizeFeatures as a,calculateHeatmapStats as e}from"./utils.js";import{calculateStringStatistics as n,calculateStatistics as t,processSummaryStatisticsResult as o,calculateUniqueValuesCount as l,createUVResult as s,calculateClassBreaks as r,resolveCBResult as m,calculateHistogram as u,isNullCountSupported as f}from"../../../statistics/utils.js";async function d(a){const{attribute:e,features:l}=a,{normalizationType:s,normalizationField:r,minValue:m,maxValue:u,fieldType:d,outStatisticTypes:p}=e,c=await i({field:e.field,valueExpression:e.valueExpression,normalizationType:s,normalizationField:r,normalizationTotal:e.normalizationTotal,viewInfoParams:e.viewInfoParams,timeZone:e.timeZone,fieldInfos:e.fieldInfos},l),v=f({normalizationType:s,normalizationField:r,minValue:m,maxValue:u}),z={value:.5,fieldType:d},T="esriFieldTypeString"===d?n({values:c,supportsNullCount:v,percentileParams:z,outStatisticTypes:p}):t({values:c,minValue:m,maxValue:u,useSampleStdDev:!s,supportsNullCount:v,percentileParams:z,outStatisticTypes:p});return o(T,p,"esriFieldTypeDate"===d)}async function p(a){const{attribute:e,features:n}=a,t=await i({field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:e.valueExpression,viewInfoParams:e.viewInfoParams,timeZone:e.timeZone,fieldInfos:e.fieldInfos},n,!1),o=l(t);return s(o,e.domains,e.returnAllCodedValues,e.fieldDelimiter)}async function c(a){const{attribute:e,features:n}=a,{field:t,normalizationType:o,normalizationField:l,normalizationTotal:s,classificationMethod:u}=e,f=await i({field:t,valueExpression:e.valueExpression,normalizationType:o,normalizationField:l,normalizationTotal:s,viewInfoParams:e.viewInfoParams,timeZone:e.timeZone,fieldInfos:e.fieldInfos},n),d=r(f,{field:t,normalizationType:o,normalizationField:l,normalizationTotal:s,classificationMethod:u,standardDeviationInterval:e.standardDeviationInterval,numClasses:e.numClasses,minValue:e.minValue,maxValue:e.maxValue});return m(d,u)}async function v(a){const{attribute:e,features:n}=a,{field:t,normalizationType:o,normalizationField:l,normalizationTotal:s,classificationMethod:r}=e,m=await i({field:t,valueExpression:e.valueExpression,normalizationType:o,normalizationField:l,normalizationTotal:s,viewInfoParams:e.viewInfoParams,timeZone:e.timeZone,fieldInfos:e.fieldInfos},n);return u(m,{field:t,normalizationType:o,normalizationField:l,normalizationTotal:s,classificationMethod:r,standardDeviationInterval:e.standardDeviationInterval,numBins:e.numBins,minValue:e.minValue,maxValue:e.maxValue})}async function z(i){const{attribute:n,features:t}=i,{field:o,radius:l,transform:s,spatialReference:r}=n,m=n.size??[0,0],u=a(t??[],s,r,m);return e(u,l??void 0,o,m[0],m[1])}export{c as classBreaks,z as heatmapStatistics,v as histogram,d as summaryStatistics,p as uniqueValues};
