/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../chunks/_rollupPluginBabelHelpers","../chunks/tslib.es6","../core/lang","../core/accessorSupport/decorators/property","../core/accessorSupport/ensureType","../core/accessorSupport/decorators/subclass","../core/accessorSupport/decorators/writer","../layers/support/fieldUtils","./Renderer","./mixins/VisualVariablesMixin","./support/DictionaryLoader"],(function(e,r,t,i,s,o,n,l,a,c,u){"use strict";var p;let d=p=function(r){function i(e){var t;return(t=r.call(this,e)||this).config=null,t.fieldMap=null,t.scaleExpression=null,t.scaleExpressionTitle=null,t.url=null,t.type="dictionary",t}e._inheritsLoose(i,r);var s=i.prototype;return s.writeData=function(e,r){e&&(r.scalingExpressionInfo={expression:e,returnType:"number"})},s.writeVisualVariables=function(e,t,i,s){null!=s&&s.origin||r.prototype.writeVisualVariables.call(this,e,t,i,s)},s.clone=function(){return new p({config:t.clone(this.config),scaleExpression:this.scaleExpression,scaleExpressionTitle:this.scaleExpressionTitle,fieldMap:t.clone(this.fieldMap),url:t.clone(this.url),visualVariables:t.clone(this.visualVariables)})},s.getSymbolAsync=function(){var r=e._asyncToGenerator((function*(e,r){return this._loader.getSymbolAsync(e,r)}));function t(e,t){return r.apply(this,arguments)}return t}(),s.collectRequiredFields=function(){var r=e._asyncToGenerator((function*(e,r){yield this.collectVVRequiredFields(e,r),this.scaleExpression&&(yield l.collectArcadeFieldNames(e,r,this.scaleExpression));for(const t in this.fieldMap){const i=this.fieldMap[t];r.has(i)&&e.add(i)}}));function t(e,t){return r.apply(this,arguments)}return t}(),s.getSymbol=function(){return null},s.getSymbols=function(){return[]},s.getAttributeHash=function(){return this.visualVariables&&this.visualVariables.reduce(((e,r)=>e+r.getAttributeHash()),"")},s.getMeshHash=function(){return`${this.url}-${JSON.stringify(this.fieldMap)}`},s.getSymbolFields=function(){return this._loader.getSymbolFields()},e._createClass(i,[{key:"_loader",get:function(){return new u.DictionaryLoader(this.url,this.config,this.fieldMap)}},{key:"arcadeRequired",get:function(){return!0}}]),i}(c.VisualVariablesMixin(a));r.__decorate([i.property({type:u.DictionaryLoader})],d.prototype,"_loader",null),r.__decorate([i.property({type:Object,json:{read:{source:"configuration"},write:{target:"configuration"}}})],d.prototype,"config",void 0),r.__decorate([i.property({type:Object,json:{write:!0}})],d.prototype,"fieldMap",void 0),r.__decorate([i.property({type:String,json:{read:{source:"scalingExpressionInfo.expression"},write:!0}})],d.prototype,"scaleExpression",void 0),r.__decorate([n.writer("scaleExpression")],d.prototype,"writeData",null),r.__decorate([i.property({type:String,json:{read:{source:"scalingExpressionInfo.title"},write:{target:"scalingExpressionInfo.title",overridePolicy(e){return{enabled:!!e&&!!this.scaleExpression}}}}})],d.prototype,"scaleExpressionTitle",void 0),r.__decorate([i.property({type:String,json:{write:!0}})],d.prototype,"url",void 0),r.__decorate([n.writer("visualVariables")],d.prototype,"writeVisualVariables",null),d=p=r.__decorate([o.subclass("esri.renderers.DictionaryRenderer")],d);return d}));
