// 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/supportClasses/templateJsonUtils/query/_SectionJsonCollector",[],function(){var c={},n={provideParentInfo:function(a,b,d,g,h,c){if(!b._measureInfo){var f={},e={},k;b.data.columns.forEach(function(a){k&&(e[k.field]=a);k=a;f[a.field]=a});b._measureInfo={columnsHash:f,nextColumnHash:e}}var f=b._measureInfo.columnsHash,e=b._measureInfo.nextColumnHash,m;a:{switch(c){case "floating":m=b.style.left;break a}m=0}a:{switch(c){case "floating":c=b.style.spaceBefore;
break a}c=0}a._parentBox={x:m,y:c,w:function(){function a(a,b){a.style.fields=a.style.fields||{};return(a.style.fields[b.field]=a.style.fields[b.field]||{}).width||b.style.width}var b=a(d,f[h]),g=d.columnSpans&&d.columnSpans[h]||1;if(1<g)for(var c,l=0;l<g-1;l++)c=e[c?c.field:h],b+=a(d,c);return b}(),h:function(){function a(a,b){a.style.fields=a.style.fields||{};return(a.style.fields[b]=a.style.fields[b]||{}).height||a.style.height}var c=a(d,h),e=d.rowSpans&&d.rowSpans[h]||1;if(1<e)for(var f,l=g+1,
k=0;k<e-1;k++)f=b.data.data[l++],c+=a(f,h);return c}()};a._parentStyle={backgroundColor:function(a,b){a.style.fields=a.style.fields||{};return(a.style.fields[b]=a.style.fields[b]||{}).backgroundColor}(d,h)}},sanitize:function(a){delete a._measureInfo}};c.collectSectionJsons=function(a,b){b=b||{};var d=[];if(!a)return[];if(a.sections)return a.sections;if(!a.sectionsTables)return[];a.sectionsTables.forEach(function(a){c._processTableJson(a,d,"page",b);!1!==b.backgroundForeground&&(a.backgroundSectionJson&&
d.push(a.backgroundSectionJson),a.foregroundSectionJson&&d.push(a.foregroundSectionJson));!1!==b.floatingTables&&a.floatingTablesSectionJson&&a.floatingTablesSectionJson.stack.forEach(function(a){"table"===a.id&&c._processTableJson(a,d,"floating",b)})});return d.filter(function(a){return!!a.stack})};c._processTableJson=function(a,b,c,g){a.data.data.forEach(function(d,p){d.fieldInfos&&Object.keys(d.fieldInfos).forEach(function(f){var e=d.fieldInfos[f];g.processFieldInfoFunc&&g.processFieldInfoFunc(e);
e&&e.sectionJson&&(!1!==g.saveParentInfo&&n.provideParentInfo(e.sectionJson,a,d,p,f,c),b.push(e.sectionJson))})});n.sanitize(a)};c.getParentBox=function(a){return a&&a._parentBox};c.getParentStyle=function(a){return a&&a._parentStyle};return c});