/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as t}from"tslib";import e from"../Color.js";import{clone as i}from"../core/lang.js";import{toPt as s}from"../core/screenUtils.js";import{property as r,subclass as n}from"../core/accessorSupport/decorators.js";import{collectField as o,collectArcadeFieldNames as l}from"../layers/support/fieldUtils.js";import p from"./Renderer.js";import a from"./support/AuthoringInfo.js";import u from"./support/HeatmapColorStop.js";import y from"./support/HeatmapLegendOptions.js";import{kernelDensityRadiusPtToGaussianBlurRadiusPx as m,gaussianBlurRadiusPxToKernelDensityRadiusPt as h,magicKernelDensityRadiusInflationFactor as d}from"./support/heatmapUtils.js";import c from"../symbols/SimpleMarkerSymbol.js";import{enumeration as x}from"../core/accessorSupport/decorators/enumeration.js";var g;function f(t){if(null!=t){const{maxDensity:e,minDensity:i,radius:s}=t;if(null!=e||null!=i||null!=s){const{blurRadius:e,maxPixelIntensity:i,minPixelIntensity:s,...r}=t;return r}}return t}let w=g=class extends p{constructor(t){super(t),this.authoringInfo=null,this.colorStops=[new u({ratio:0,color:new e("rgba(255, 140, 0, 0)")}),new u({ratio:.75,color:new e("rgba(255, 140, 0, 1)")}),new u({ratio:.9,color:new e("rgba(255, 0,   0, 1)")})],this.field=null,this.legendOptions=null,this.maxDensity=.04,this.minDensity=0,this.referenceScale=0,this.type="heatmap",this.valueExpression=null,this.valueExpressionTitle=null}normalizeCtorArgs(t){return f(t)}get blurRadius(){return m(this.radius)}set blurRadius(t){const e=this.maxPixelIntensity,i=this.minPixelIntensity;this._set("radius",h(t)),this._set("maxDensity",e*this._pixelIntensityToDensity),this._set("minDensity",i*this._pixelIntensityToDensity)}get maxPixelIntensity(){return this.maxDensity/this._pixelIntensityToDensity}set maxPixelIntensity(t){this._set("maxDensity",t*this._pixelIntensityToDensity)}get minPixelIntensity(){return this.minDensity/this._pixelIntensityToDensity}set minPixelIntensity(t){this._set("minDensity",t*this._pixelIntensityToDensity)}get radius(){return this._get("radius")??18}set radius(t){this._set("radius",t)}get _pixelIntensityToDensity(){return 24/(d**2*this.blurRadius**4)}read(t,e){t=f(t),super.read(t,e)}getSymbol(){return new c}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol()]}async collectRequiredFields(t,e){const i=this.field,s=this.valueExpression;i&&"string"==typeof i&&o(t,e,i),s&&"string"==typeof s&&await l(t,e,null,s)}getAttributeHash(){return""}getMeshHash(){return`${JSON.stringify(this.colorStops)}.${this.blurRadius}.${this.field}`}clone(){return new g({authoringInfo:this.authoringInfo&&this.authoringInfo.clone(),colorStops:i(this.colorStops),field:this.field,legendOptions:i(this.legendOptions),maxDensity:this.maxDensity,minDensity:this.minDensity,radius:this.radius,referenceScale:this.referenceScale,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle})}};t([r({type:a,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],w.prototype,"authoringInfo",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"blurRadius",null),t([r({type:[u],json:{write:{isRequired:!0}}})],w.prototype,"colorStops",void 0),t([r({type:String,json:{write:!0}})],w.prototype,"field",void 0),t([r({type:y,json:{write:!0}})],w.prototype,"legendOptions",void 0),t([r({type:Number,json:{write:!0}})],w.prototype,"maxDensity",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"maxPixelIntensity",null),t([r({type:Number,json:{write:!0}})],w.prototype,"minDensity",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"minPixelIntensity",null),t([r({type:Number,cast:s,json:{write:!0}})],w.prototype,"radius",null),t([r({type:Number,range:{min:0},json:{default:0,write:!0}})],w.prototype,"referenceScale",void 0),t([x({heatmap:"heatmap"})],w.prototype,"type",void 0),t([r({type:String,json:{write:!0,origins:{"web-document":{write:!1},"portal-item":{write:!1}}}})],w.prototype,"valueExpression",void 0),t([r({type:String})],w.prototype,"valueExpressionTitle",void 0),t([r({readOnly:!0})],w.prototype,"_pixelIntensityToDensity",null),w=g=t([n("esri.renderers.HeatmapRenderer")],w);export{w as default};
