/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../chunks/_rollupPluginBabelHelpers","../../PopupTemplate","../../core/Error","../../intl/messages","../../popup/ExpressionInfo","../../popup/FieldInfo","./support/utils","../statistics/support/predominanceUtils"],(function(e,n,t,i,r,o,s,l,d){"use strict";function a(e){return p.apply(this,arguments)}function p(){return(p=n._asyncToGenerator((function*(e){const{layer:n,renderer:t}=e;yield n.load();const r=t||n.renderer;if("dot-density"!==r.type)throw new i("dot-density-popup:invalid-parameters","renderer.type must be 'dot-density'");return{layer:n,renderer:r}}))).apply(this,arguments)}function f(e,n){return u.apply(this,arguments)}function u(){return(u=n._asyncToGenerator((function*(e,n){const{fieldInfos:i,expressionInfos:r}=yield l.getFieldAndExpressionInfos({renderer:e,layer:n});return new t({content:yield l.getContentFromFieldInfos(n,{fieldInfos:i,expressionInfos:r}),expressionInfos:r,fieldInfos:i})}))).apply(this,arguments)}function y(e,n,t){return c.apply(this,arguments)}function c(){return(c=n._asyncToGenerator((function*(e,n,i){const{fieldInfos:r,expressionInfos:a}=yield l.getFieldAndExpressionInfos({renderer:e,layer:n}),p=r.filter((e=>!e.fieldName.includes(l.expressionFieldPrefix))),f={fieldInfo:new s({fieldName:"expression/dot-density-categories-list"}),expressionInfo:new o({name:"dot-density-categories-list",title:i.listOfCategories,expression:d.getArcadeForOrderedFields(p,a)})},u=new t({expressionInfos:[f.expressionInfo],fieldInfos:[f.fieldInfo],title:i.competingFields,content:`{${f.fieldInfo.fieldName}}`});return{name:"dot-density-categories-list",title:i.orderedListOfValues,value:u}}))).apply(this,arguments)}function m(e,n,t){return I.apply(this,arguments)}function I(){return(I=n._asyncToGenerator((function*(e,n,i){const{fieldInfos:r,expressionInfos:a}=yield l.getFieldAndExpressionInfos({renderer:e,layer:n}),p=r.filter((e=>!e.fieldName.includes(l.expressionFieldPrefix))),f={fieldInfo:new s({fieldName:"expression/dot-density-category"}),expressionInfo:new o({name:"dot-density-category",title:i.predominantCategory,expression:d.getArcadeForPredominantCategoryAlias(p,a)})},u=new t({expressionInfos:[f.expressionInfo,...a],fieldInfos:[f.fieldInfo,...r],content:[{type:"text",text:`<div><b><font size="3">{${f.fieldInfo.fieldName}}</font></b></div>`},{type:"media",mediaInfos:{type:"pie-chart",title:i.competingFields,value:{fields:r.map((e=>e.fieldName))}}}]});return{name:"dot-density-category-chart",title:i.predominantCategoryWithChart,value:u}}))).apply(this,arguments)}function g(e){return x.apply(this,arguments)}function x(){return(x=n._asyncToGenerator((function*(e){const[{renderer:n,layer:t},i]=yield Promise.all([a(e),r.fetchMessageBundle("esri/smartMapping/t9n/smartMapping")]);return{primaryTemplate:{name:"dot-density",title:i.dotDensity,value:yield f(n,t)},secondaryTemplates:[yield y(n,t,i),yield m(n,t,i)]}}))).apply(this,arguments)}e.getTemplates=g,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
