text: // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  // See https://js.arcgis.com/3.38/esri/copyright.txt for details.
  //>>built
  define("esri/dijit/geoenrichment/ReportPlayer/core/charts/iconRendering/IconRenderer","dojo/_base/declare dojo/dom-construct dojo/dom-style dijit/Destroyable ../utils/ChartTypes ../utils/builder/ChartPlots ../utils/plots/supportClasses/GaugeLabelPlacements ../../supportClasses/templateJsonUtils/fieldInfo/FieldInfoBuilder ../../supportClasses/tableJson/TableJsonUtil ../../infographics/utils/InfographicThemeUtil esri/dijit/geoenrichment/ReportPlayer/core/sections/SectionTypes esri/dijit/geoenrichment/ReportPlayer/core/supportClasses/ViewModes esri/dijit/geoenrichment/utils/ColorUtil esri/dijit/geoenrichment/utils/DomUtil".split(" "),
  function(v,w,n,H,p,z,I,A,J,B,C,D,K,E){v=v(H,{renderIcons:function(a){this._destroyIcons();var b=this._getRenderFunction(a.chartType);b&&this[b](a);this._renderFloatingIcons(a)},_getRenderFunction:function(a){switch(a){case p.GAUGE:return"_renderDonutIcons";case p.DONUT:return"_renderDonutIcons";case p.RING:return"_renderRingIcons";case p.COLUMN:return"_renderColumnIcons";case p.BAR:return"_renderBarIcons"}return null},_renderDonutIcons:function(a){if(a.visualProperties.showChartIcons){var b=a.chart.getPlot(z.PRIMARY).getRenderResults();
  if(b){var e=w.create("div",{"class":"chartContainer_chartIcon"},a.iconNode),d=b.radiusInner,f=0,c=1;a.chartType===p.GAUGE&&(c=Math.max(.6,b.ryMultiplier),a.visualProperties.gaugeLabelPlacement===I.INSIDE&&(f=b.chartIconOffset,d=Math.min(d,b.maxIconSize)));f=(a.chartH/c-d+f)/2+(b.chartShiftY||0);f=Math.min(f,a.chartH-d-10);n.set(e,{width:d+"px",height:d+"px",left:(a.chartW-d)/2+(b.chartShiftX||0)+"px",top:f+"px"});this._createIconSection(a,a.visualProperties.chartIcons&&a.visualProperties.chartIcons[0]||
  this._getDefaultIcon(),d,e)}}},_renderRingIcons:function(a){if(a.visualProperties.showChartIcons){var b=a.chart.getPlot(z.PRIMARY).getRenderResults();if(b){b.slicePies.sort(function(q,k){return q.r-k.r});var e=b.slicePies[0],d=b.slicePies[b.slicePies.length-1],f=w.create("div",{"class":"chartContainer_chartIcon"},a.iconNode),c=0;b.labels?(c=Math.max(50,.8*Math.min(2*e.r,Math.min(b.maxLabelWidth,a.chartW-(d.cx+d.r)))),n.set(f,{width:c+"px",height:c+"px",left:Math.max(d.cx+d.r+15,d.cx+d.r+b.maxLabelWidth/
  2-c/2)+"px",top:d.cy-c/2+"px"})):(c=1.4*e.r,n.set(f,{width:c+"px",height:c+"px",left:e.cx-c/2+"px",top:e.cy-c/2+"px"}));this._createIconSection(a,a.visualProperties.chartIcons&&a.visualProperties.chartIcons[0]||this._getDefaultIcon(),c,f)}}},_renderColumnIcons:function(a){this._renderAxisIcons(a,!0)},_renderBarIcons:function(a){this._renderAxisIcons(a,!1)},_renderAxisIcons:function(a,b){if(a.visualProperties.showAxisIcons){var e=this,d=a.chart.calculateGeometry(),f=a.chart.getPlot(z.PRIMARY).getMainShapes();
  if(f&&f.length){var c={};f.forEach(function(g){(c[g.value.x]=c[g.value.x]||[]).push(g.rawNode)});f=Object.keys(c).map(function(g){return Number(g)});f.sort();var q=f.map(function(g){return E.getNodesBox(c[g],{ignoreTransformation:!0})}),k,t;d.series[0].data.forEach(function(g,m){g="number"===typeof g.originalIndex?g.originalIndex:g.unsortedIndex;void 0!==g&&(k=k||{},k[m]=g);t=t||{};var u;d.series.some(function(h){if((h=h.data[m])&&h.fill&&!K.isTransparent(h.fill))return u=h.fill,!0});t[m]=u});var F=
  E.noTransformPosition(a.iconNode);q.forEach(function(g,m){var u=k?k[m]:m,h=a.visualProperties.chartIcons&&a.visualProperties.chartIcons[u]||e._getDefaultIcon();if(h){var r=(h.imageJson||h.shapeJson).style.zoom||1,x=w.create("div",{"class":"chartContainer_chartIcon"},a.iconNode),l=Math.min(50,.7*(b?d.plotArea.width:d.plotArea.height)/q.length);r*=l;n.set(x,{width:r+"px",height:r+"px"});var G=a.visualProperties.xAxis.show?0:l/(b?2:3.5),y=-(r-l)/2;b?n.set(x,{left:g.x-F.x+(1*g.w-l)/2+y+"px",bottom:-l+
  G+y+"px"}):n.set(x,{top:g.y-F.y+(1*g.h-l)/2+y+"px",left:-l+G+y+"px"});e._createIconSection(a,h,r,x,u,t&&t[m],l)}})}}},_floatingIconsSection:null,_renderFloatingIcons:function(a){var b=a.visualProperties.floatingIcons;if(b&&b.length){b.forEach(function(d){d=d.rows[0].fieldInfos[d.columns[0].field].shapeJson;var f=a.viewModel.getChartDefaultStyles(a.theme);B.applyThemeSettingsToShapeJson(d,f)});var e={"class":"chartContainer_floatingIconSection"};e.initialWidth=a.chartW;e.initialHeight=a.chartH;e.json=
  {type:C.DETAILS,stack:b};e.viewModel=a.viewModel;e.theme=a.theme;e.tableClass="chartContainerFloatingIconTable";e.parentWidget=a.parentWidget;e.initialViewMode=this._viewMode||D.EDIT;this._provideParamsForFloatingIconSection(e,a);this._floatingIconsSection=a.viewModel.layoutBuilder.createElement("section",e,a.iconNode)}},_provideParamsForFloatingIconSection:function(a,b){},_getDefaultIcon:function(){},_iconSections:null,_createIconSection:function(a,b,e,d,f,c,q){if(b&&(b.imageJson||b.shapeJson)){if(b.shapeJson){var k=
  a.viewModel.getChartDefaultStyles(a.theme);B.applyThemeSettingsToShapeJson(b.shapeJson,k);b.shapeJson.themeStyle&&c&&(b.shapeJson.themeStyle.borderColor=c,b.shapeJson.themeStyle.fillColor=c)}b=J.createSingleCellTable({width:e,height:e,fieldInfo:b.imageJson?A.createFieldInfoFromImage(b.imageJson):A.createFieldInfoFromShape(b.shapeJson),cellStyle:{backgroundColor:"transparent"}});c={};c.initialWidth=e;c.initialHeight=e;c.json={type:C.DETAILS,stack:[b]};c.viewModel=a.viewModel;c.theme=a.theme;c.tableClass=
  "chartContainerIconTable";c.parentWidget=a.parentWidget;c.initialViewMode=this._viewMode||D.EDIT;this._provideParamsForIconSection(c,a);a=a.viewModel.layoutBuilder.createElement("section",c,d);a.__originalIndex=f;a.__noZoomIconSize=q;this._iconSections.push(a)}},_getSectionInitialSettings:function(a){return{originalIndex:a&&void 0!==a.__originalIndex?a.__originalIndex:-1,noZoomIconSize:a&&a.__noZoomIconSize}},_provideParamsForIconSection:function(a,b,e,d){},_viewMode:null,setViewMode:function(a){this._viewMode!==
  a&&(this._viewMode=a,this._iconSections&&this._iconSections.forEach(function(b){b.setViewMode(a)}),this._floatingIconsSection&&this._floatingIconsSection.setViewMode(a))},_destroyIcons:function(){this._iconSections=this._iconSections||[];this._iconSections.forEach(function(a){var b=a.domNode&&a.domNode.parentNode;a.destroy();b&&w.destroy(b)});this._iconSections.length=0;this._floatingIconsSection&&this._floatingIconsSection.destroy();this._floatingIconsSection=null},destroy:function(){this._destroyIcons();
  this.inherited(arguments)}});v.AXIS_ICON_MAX_SIZE=50;return v});