// 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/fieldInfo/FieldInfoRenderer",["./utils","./_FieldInfoPreviewRenderer","./_FieldInfoDataRenderer","../countryConfig","dojo/i18n!../../../../../../../nls/jsapi"],function(h,k,g,l,e){e=e.geoenrichment.dijit.ReportPlayer.ReportPlayer;var f={},m={renderPreview:function(a,b){return b.fieldData?g.getValueFromFieldData(a,b):k.getValuePreview(a,b)},tryGetConditionalStylePreview:function(a,b,c){"string"===typeof a&&c&&!c.previewValues&&
(b=k.getConditionalStylePreview(b,c))&&(a={label:a,conditionalStyle:c.previewConditionalStyle?b:!1});return a}},n={buildVariableLabel:function(a){function b(a,c){return!a||a.length<=c?a:a.substr(0,c-3)+"..."}function c(a,c){var b;switch(c){case "p":b=e.statePercent_short;break;case "a":b=e.stateAverage_short;break;case "i":b=e.stateIndex_short;break;case "r":b=e.stateReliability_short;break;default:return a}return a+" ("+b+")"}return"["+(a.isWebMap?b(a.webMapFieldName,15)+"(WebMap)":a.isSiteAttribute?
b(a.alias,15)+"(SiteAttribute)":a.isCustomDataCollection?b(a.alias,15)+"(CustomData)":c(a.variableID,a.statefulName&&a.statefulName.charAt(0).toLowerCase()))+"]"},buildScriptLabel:function(a){return"["+h.name.renderScriptName(a.name)+"]"}},p={renderRichTextFieldInfoInTableCell:function(a,b){return h.richText.createRichTextFromFieldInfo(a,function(a){return(a=f.renderFieldInfoInTableCell(a,b))&&a.label||a},function(a){return(a=f.renderFieldInfoInTableCell(a,b))&&a.label||a})}};f.renderFieldInfoInTableCell=
function(a,b){if(a.isRichText)return p.renderRichTextFieldInfoInTableCell(a,b);var c;c=a.isMissing?e.missingVariable:b&&b.previewValues?m.renderPreview(a,b):a.hasVariable?n.buildVariableLabel(a):a.script?n.buildScriptLabel(a.script):"["+a.alias+"]";c=m.tryGetConditionalStylePreview(c,a,b);var d=String(c&&c.label||c);if(a.hasVariable||a.script)a.showCurrency&&(d="-"===d.charAt(0)?"-"+l.getCurrencySymbol()+d.substr(1):l.getCurrencySymbol()+d),a.showPercent&&(d=b&&b.previewValues?d+"%":"%"+d);"object"===
typeof c?c.label=d:c=d;return c};f.renderRichTextFieldInfoInTableCell=p.renderRichTextFieldInfoInTableCell;f.getValueFromFieldData=g.getValueFromFieldData;f.getFieldDataValue=g.getFieldDataValue;return f});