Liferay.Loader.define("knowledge-base-web@5.0.98/admin/js/utils/normalizeItems",["module","exports","require","../KBDropdownPropsTransformer"],(function(e,r,t){window;{Object.defineProperty(r,"__esModule",{value:!0}),r.default=function normalizeDropdownItems(e,r){if(e)return e.map((e=>_objectSpread(_objectSpread({},e),{},{actions:normalizeItems(e.actions,r),children:normalizeDropdownItems(e.children,r)})))};var o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(t("../KBDropdownPropsTransformer"));function _objectWithoutProperties(e,r){if(null==e)return{};var t,o,n=function _objectWithoutPropertiesLoose(e,r){if(null==e)return{};var t,o,n={},i=Object.keys(e);for(o=0;o<i.length;o++)t=i[o],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)t=i[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function addSeparators(e){if(e.length<2)return e;const r=[e[0]];for(let t=1;t<e.length;t++){const o=e[t];"group"===o.type&&o.separator&&r.push({type:"divider"}),r.push(o)}return r.map((e=>"group"===e.type?_objectSpread(_objectSpread({},e),{},{items:addSeparators(e.items)}):e))}function filterEmptyGroups(e){return e.filter((e=>"group"!==e.type||Array.isArray(e.items)&&e.items.length)).map((e=>"group"===e.type?_objectSpread(_objectSpread({},e),{},{items:filterEmptyGroups(e.items)}):e))}function normalizeItems(e=[],r){return addSeparators(filterEmptyGroups((0,o.default)({items:e.map((e=>{var r;return _objectSpread(_objectSpread({},e),{},{items:null===(r=e.items)||void 0===r?void 0:r.map((e=>{let{icon:r}=e;return _objectSpread(_objectSpread({},_objectWithoutProperties(e,["icon"])),{},{symbolLeft:r})}))})})),portletNamespace:r}).items))}}}));
//# sourceMappingURL=normalizeItems.js.map