/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import t from"../../core/Error.js";import{numericTypes as a}from"../../layers/support/fieldUtils.js";import{gaussianBlurRadiusPxToKernelDensityRadiusPt as r}from"../../renderers/support/heatmapUtils.js";import{verifyBasicFieldValidity as s,verifyFieldType as i}from"./support/utils.js";import{getFieldsList as e}from"../support/utils.js";import{createLayerAdapter as o,getLayerTypeLabels as l}from"../support/adapters/support/layerUtils.js";const p=a;async function n(a){if(!a?.layer||!a.view)throw new t("heatmap-statistics:missing-parameters","'layer' and 'view' parameters are required");const n=[2,3,4,6,7,8,9,12,15],{layer:u,...m}=a,d=o(u,n);if(!d)throw new t("heatmap-statistics:invalid-parameters","'layer' must be one of these types: "+l(n).join(", "));const f={layerAdapter:d,...m};f.radius=null==f.radius?null==f.blurRadius?18:r(f.blurRadius):f.radius;const c=null!=f.signal?{signal:f.signal}:null;await d.load(c);const h=f.field,w=h?d.getField(h):null,y=await e({field:h}),j=s(d,y,"heatmap-statistics:invalid-parameters");if(j)throw j;if(w){const t=i(d,w,"heatmap-statistics:invalid-parameters",p);if(t)throw t}return f}async function u(t){const{layerAdapter:a,...r}=await n(t);return a.heatmapStatistics(r)}export{u as default};
