Liferay.Loader.define("data-engine-taglib@3.3.50/data_layout_builder/js/utils/normalizers.es",["module","exports","require"],(function(e,t,a){window;{function ownKeys(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,o)}return a}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(a),!0).forEach((function(t){_defineProperty(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function _defineProperty(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function normalizeField(e,t,a=themeDisplay.getDefaultLanguageId()){const toArray=t=>e.reduce(((e,o)=>(e[o]=t[o]||t[a]||"",e)),{}),toString=t=>e.reduce(((e,o)=>(t[o]&&t[o].length?e[o]=t[o]:e[o]=t[a],e)),{}),{defaultValue:o,label:r,tip:n}=t,{options:i,placeholder:d,tooltip:l}=t.customProperties;return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({},t),o&&{defaultValue:Array.isArray(o[a])?toString(o):toArray(o)}),r&&{label:toArray(r)}),n&&{tip:toArray(n)}),{},{customProperties:_objectSpread(_objectSpread(_objectSpread(_objectSpread({},t.customProperties),i&&{options:toString(i)}),d&&{placeholder:toArray(d)}),l&&{tooltip:toArray(l)}),nestedDataDefinitionFields:t.nestedDataDefinitionFields.length?t.nestedDataDefinitionFields.map((t=>_objectSpread(_objectSpread({},t),normalizeField(e,t,a)))):[]})}Object.defineProperty(t,"__esModule",{value:!0}),t.normalizeDataDefinition=function normalizeDataDefinition(e,t=themeDisplay.getDefaultLanguageId(),a=!0){return _objectSpread(_objectSpread({},e),{},{dataDefinitionFields:e.dataDefinitionFields.map((o=>"fieldset"!==o.fieldType||a?normalizeField(e.availableLanguageIds,o,t):o)),name:e.availableLanguageIds.reduce(((a,o)=>(a[o]=e.name[o]||e.name[t]||"",a)),{})})},t.normalizeDataLayout=function normalizeDataLayout(e,t=themeDisplay.getDefaultLanguageId()){const{dataLayoutPages:a,dataRules:o,description:r}=e;return _objectSpread(_objectSpread({},e),{},{dataLayoutPages:a.map((e=>_objectSpread(_objectSpread({},e),{},{dataLayoutRows:(e.dataLayoutRows||[]).map((e=>_objectSpread(_objectSpread({},e),{},{dataLayoutColumns:(e.dataLayoutColumns||[]).map((e=>_objectSpread(_objectSpread({},e),{},{fieldNames:e.fieldNames||[]})))}))),description:_objectSpread(_objectSpread({},r),{},{[t]:e.description[t]||""}),title:_objectSpread(_objectSpread({},e.title),{},{[t]:e.title[t]||""})}))),dataRules:o.map((e=>(delete e.ruleEditedIndex,e)))})},t.normalizeDataLayoutRows=function normalizeDataLayoutRows(e){return e[0].dataLayoutRows.map((({dataLayoutColumns:e})=>({columns:e.map((({columnSize:e,fieldNames:t})=>({fields:t,size:e})))})))},t.normalizeRule=function normalizeRule(e){return _objectSpread(_objectSpread({},e),{},{name:{en_US:e.name}})}}}));
//# sourceMappingURL=normalizers.es.js.map