/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../Color.js";import{clone as o}from"../core/lang.js";import{property as i,subclass as r}from"../core/accessorSupport/decorators.js";import{collectArcadeFieldNames as s}from"../layers/support/fieldUtils.js";import l from"./Renderer.js";import{VisualVariablesMixin as n}from"./mixins/VisualVariablesMixin.js";import a from"./support/AttributeColorInfo.js";import p from"./support/DotDensityLegendOptions.js";import d from"../symbols/SimpleFillSymbol.js";import u from"../symbols/SimpleLineSymbol.js";import{enumeration as h}from"../core/accessorSupport/decorators/enumeration.js";var m;let y=m=class extends(n(l)){constructor(e){super(e),this.attributes=null,this.backgroundColor=new t([0,0,0,0]),this.dotBlendingEnabled=!0,this.dotShape="square",this.dotSize=1,this.legendOptions=null,this.outline=new u,this.dotValue=null,this.referenceScale=null,this.seed=1,this.type="dot-density"}calculateDotValue(e){if(null==this.referenceScale)return this.dotValue;const t=e/this.referenceScale*this.dotValue;return t<1?1:t}getSymbol(){return new d({outline:this.outline})}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol()]}get visualVariables(){return super.visualVariables}set visualVariables(e){super.visualVariables=e}clone(){return new m({attributes:o(this.attributes),backgroundColor:o(this.backgroundColor),dotBlendingEnabled:o(this.dotBlendingEnabled),dotShape:o(this.dotShape),dotSize:o(this.dotSize),dotValue:o(this.dotValue),legendOptions:o(this.legendOptions),outline:o(this.outline),referenceScale:o(this.referenceScale),seed:o(this.seed),visualVariables:o(this.visualVariables),authoringInfo:o(this.authoringInfo)})}getControllerHash(){const e=this.attributes?.map(e=>e.field||e.valueExpression||"");return`${e}-${this.outline&&JSON.stringify(this.outline.toJSON())||""}`}async collectRequiredFields(e,t){await this.collectVVRequiredFields(e,t);for(const o of this.attributes??[])o.valueExpression&&await s(e,t,null,o.valueExpression),o.field&&e.add(o.field)}};e([i({type:[a],json:{write:!0}})],y.prototype,"attributes",void 0),e([i({type:t,json:{write:!0}})],y.prototype,"backgroundColor",void 0),e([i({type:Boolean,json:{write:!0}})],y.prototype,"dotBlendingEnabled",void 0),e([i({type:String,json:{write:!1}})],y.prototype,"dotShape",void 0),e([i({type:Number,json:{write:!0}})],y.prototype,"dotSize",void 0),e([i({type:p,json:{write:!0}})],y.prototype,"legendOptions",void 0),e([i({type:u,json:{default:null,write:!0}})],y.prototype,"outline",void 0),e([i({type:Number,json:{write:!0}})],y.prototype,"dotValue",void 0),e([i({type:Number,json:{write:!0}})],y.prototype,"referenceScale",void 0),e([i({type:Number,json:{write:!0}})],y.prototype,"seed",void 0),e([h({dotDensity:"dot-density"})],y.prototype,"type",void 0),y=m=e([r("esri.renderers.DotDensityRenderer")],y);export{y as default};
