Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.130/page_editor/app/reducers/fragmentsReducer",["module","exports","require","../actions/types","../config/constants/highlightedCollectionId"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t=[],r){switch(r.type){case n.ADD_FRAGMENT_COMPOSITION:{const e=r.fragmentComposition,n=t.find((t=>t.fragmentCollectionId===e.fragmentCollectionId)),o=n?a(a({},n),{},{fragmentEntries:[...n.fragmentEntries,e]}):{fragmentCollectionId:e.fragmentCollectionId,fragmentEntries:[e],name:e.fragmentCollectionName};return[...t.filter((e=>e.fragmentCollectionId!==o.fragmentCollectionId)),o]}case n.TOGGLE_FRAGMENT_HIGHLIGHTED:{const{fragmentEntryKey:n,groupId:i,highlighted:c,highlightedFragments:f}=r,g=[];return t.forEach((e=>{e.fragmentCollectionId!==o.HIGHLIGHTED_COLLECTION_ID&&g.push(a(a({},e),{},{fragmentEntries:e.fragmentEntries.map((e=>{const t=e.groupId||"0";return e.fragmentEntryKey!==n||t!==i?e:a(a({},e),{},{highlighted:c})}))}))})),f.length&&g.unshift(a(a({},e),{},{fragmentEntries:f})),g}case n.UPDATE_FRAGMENTS:return r.fragments||t;default:return t}};var n=r("../actions/types"),o=r("../config/constants/highlightedCollectionId");function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const e={fragmentCollectionId:o.HIGHLIGHTED_COLLECTION_ID,fragmentEntries:[],name:Liferay.Language.get("favorites")}}}));
//# sourceMappingURL=fragmentsReducer.js.map