Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.179/page_editor/app/components/undo/undoUpdateCollectionDisplayCollection",["module","exports","require","../../actions/updateCollectionDisplayCollection","../../services/LayoutService","../../utils/setIn"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.getDerivedStateForUndo=t.undoAction=void 0;var i=_interopRequireDefault(n("../../actions/updateCollectionDisplayCollection")),o=_interopRequireDefault(n("../../services/LayoutService")),a=n("../../utils/setIn");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const undoAction=({action:e,store:t})=>n=>o.default.restoreCollectionDisplayConfig({filterFragmentEntryLinks:e.filterFragmentEntryLinks.map((e=>({editableValues:e.editableValues,fragmentEntryLinkId:e.fragmentEntryLinkId}))),itemConfig:e.itemConfig,itemId:e.itemId,onNetworkStatus:n,segmentsExperienceId:t.segmentsExperienceId}).then((()=>{n((0,i.default)({fragmentEntryLinks:e.filterFragmentEntryLinks,itemId:e.itemId,layoutData:(0,a.setIn)(t.layoutData,["items",e.itemId,"config"],e.itemConfig),pageContents:e.pageContents}))}));t.undoAction=undoAction;const getDerivedStateForUndo=({action:e,state:t})=>({filterFragmentEntryLinks:e.fragmentEntryLinks.map((({fragmentEntryLinkId:e})=>{const n=t.fragmentEntryLinks[e];return{content:n.content,editableValues:n.editableValues,fragmentEntryLinkId:e}})),itemConfig:t.layoutData.items[e.itemId].config,itemId:e.itemId,pageContents:t.pageContents});t.getDerivedStateForUndo=getDerivedStateForUndo}}));
//# sourceMappingURL=undoUpdateCollectionDisplayCollection.js.map