/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as t,__param as e}from"tslib";import{location as s,uniform as i,define as o,input as l,UniformGroup as r}from"../../GraphShaderModule.js";import{Vec2 as p,Float as n,Vec3 as a,Vec4 as u,length as m,step as d,ifElse as h,greaterThan as y}from"../../graph/glsl.js";import{FeatureVertexInput as c,AFeatureShader as f,FeatureFragmentInput as w}from"./AFeatureShader.js";import{trueHit as v,noHit as x}from"./constants.js";import{getHeatmapCompressionFactor as g}from"./heatmapUtils.js";import{hittestMarker as F}from"./hittestUtils.js";class j extends c{}t([s(5,p)],j.prototype,"offset",void 0);class V extends w{}class H extends r{}t([i(n)],H.prototype,"radius",void 0),t([i(n)],H.prototype,"isFieldActive",void 0);class M extends f{constructor(){super(...arguments),this.type="HeatmapAccumulateShader",this.usesHalfFloatPrecision=!1}vertex(t){const{radius:e,isFieldActive:s}=this.kernelControls,i=t.offset,o=s.multiply(this.getVVData(t.id).x).add(new n(1).subtract(s)),l=this.view.displayViewScreenMat3.multiply(new a(t.pos,1)).add(this.view.displayViewMat3.multiply(new a(i,0)).multiply(e)),r=this.clip(t.id);return{glPosition:new u(l.xy,r,1),offset:i,fieldValue:o,color:new u(0),...this.maybeRunHittest(t,{},null)}}fragment(t){const{offset:e,fieldValue:s}=t,i=m(e),o=d(i,new n(1)),l=new n(1).subtract(i.multiply(i)),r=l.multiply(l),p=o.multiply(r).multiply(s).multiply(new n(g(this.usesHalfFloatPrecision)));return this.getFragmentOutput(new u(p),t)}hittest(t){const{viewMat3:e,tileMat3:s}=this.view,i=e.multiply(s).multiply(new a(t.pos,1)),o=F(i.xy,this.kernelControls.radius,this.hittestRequest.position);return h(y(o,this.hittestRequest.distance),new n(x),new n(v))}}t([o],M.prototype,"usesHalfFloatPrecision",void 0),t([i(H)],M.prototype,"kernelControls",void 0),t([e(0,l(j))],M.prototype,"vertex",null),t([e(0,l(V))],M.prototype,"fragment",null);export{V as HeatmapAccumulateFragmentInput,M as HeatmapAccumulateShader,j as HeatmapAccumulateVertexInput};
