// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/dijit/geoenrichment/ReportPlayer/core/charts/tableViewRendering/TableViewRenderer","dojo/_base/declare dojo/_base/lang dijit/Destroyable esri/dijit/geoenrichment/ReportPlayer/config ../../supportClasses/TableUtil esri/dijit/geoenrichment/ReportPlayer/core/supportClasses/ViewModes ../../sections/sectionUtils/SectionJsonUtil ../chartUtils/builder/_ChartDataUtil ../../grid/coreUtils/GridDataUtil dojo/i18n!../../../../../../nls/jsapi".split(" "),function(g,q,k,r,t,f,u,v,w,h){h=h.geoenrichment.dijit.ReportPlayer.ReportPlayer;
var x=/_P$/i,n={buildSectionJsonFromSeriesItems:function(a,b,g,k,f,n){function p(l,c,d){c=a[l-1].data[c-1];l=x.test(c.point.fieldInfo.name);if(c.isUnavailableData)return d?r.tables.showUnavailableData?h.unavailableDataShort:"":0;c=c[c.valueProp];return d?v.formatNumber(c,b,l,g):c}a=a.map(function(a){a=q.mixin({},a);a.data=a.data.slice();a.data.sort(function(a,b){return a.unsortedIndex-b.unsortedIndex});return a});var m=t.createTable({numColumns:a.length+1,numRows:a[0].data.length+1,width:f,height:n});
m.data.data.forEach(function(b,c){m.data.columns.forEach(function(d,e){if(0===c)b[d.field]=0===e?"":1===e?k?h.thisArea:1<a.length?a[e-1].name||"":"":a[e-1].name||"";else if(0===e){var g=d.field,f;f=0===c?void 0:a[0].data[c-1].name||"";b[g]=f}else w.setNumericDataValue(p(e,c,!1),b,d.field),b[d.field]=p(e,c,!0)})});return u.wrapInDetailsSectionJson(m)}};return g(k,{_tableSection:null,renderTableForChart:function(a){this._destroyTable();if(a.chartSeries&&a.chartSeries.length){var b={"class":"chartContainer_tableSection"};
b.initialWidth=a.width;b.json=n.buildSectionJsonFromSeriesItems(a.chartSeries,a.visualProperties,a.chartType,a.hasComparison,a.width,a.height);b.viewModel=a.viewModel;b.themeContext=a.themeContext;b.theme=a.theme;b.tableClass="chartContainerChartTable";b.hasFixedLayout=!1;b.parentWidget=a.parentWidget;this._provideParamsForTableSection(b,a);this._tableSection=a.viewModel.layoutBuilder.createElement("section",b,a.tableNode);this._tableSection.setResizedHeight(a.height);this._tableSection.setViewMode(this._viewMode||
f.PREVIEW_VALUES)}},_provideParamsForTableSection:function(a,b){},_viewMode:null,setViewMode:function(a){this._viewMode!==a&&(this._viewMode=a,this._tableSection&&this._tableSection.setViewMode(a))},destroyTable:function(){this._destroyTable()},_destroyTable:function(){this._tableSection&&this._tableSection.destroy();this._tableSection=null},destroy:function(){this._destroyTable();this.inherited(arguments)}})});