"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/asyncToGenerator"),l=require("@babel/runtime/regenerator"),s=require("react"),t=require("../../constants.js"),d=require("./useSaveResetDerivedState.js"),a=require("./usePerformSave.js"),n=require("./useCancelHandler.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=i(e),o=i(l);exports.useSaveReset=function(e){var l,i,c,u,f,W,S,v,I,b,p=d.useSaveResetDerivedState({externalOffsets:e.externalOffsets,selectedWells:e.selectedWells,selectedWellsCount:e.selectedWellsCount,selectedWellSection:e.selectedWellSection,subjectWellId:e.subjectWellId,rawWellsWithSubject:e.rawWellsWithSubject,maxOffsetSize:e.maxOffsetSize,companyProvider:e.companyProvider,isWDUser:e.isWDUser,isManualWellsEnabled:e.isManualWellsEnabled,hasValidAssetId:e.hasValidAssetId,isAllWellsLoaded:e.isAllWellsLoaded,filters:e.filters,idasWellIds:e.idasWellIds,owsWellIds:e.owsWellIds,wellhubWellIds:e.wellhubWellIds,savedIdasWellIds:null!==(l=null===(i=e.offsetSettings)||void 0===i?void 0:i.idasWellIds)&&void 0!==l?l:[],savedOwsWellIds:null!==(c=null===(u=e.offsetSettings)||void 0===u?void 0:u.owsWellIds)&&void 0!==c?c:[],savedWellhubWellIds:null!==(f=null===(W=e.offsetSettings)||void 0===W?void 0:W.wellhubWellIds)&&void 0!==f?f:[],savedHandpickedWellIds:null!==(S=null!==(v=null===(I=e.offsetSettings)||void 0===I?void 0:I.handpickedWellIds)&&void 0!==v?v:null===(b=e.offsetSettings)||void 0===b?void 0:b.manualWellIds)&&void 0!==S?S:[]}),h=p.isSynced,w=p.isXtoProvider,m=p.isXtoIdas,C=p.syncedOffsetLabel,L=p.savedOffsetLabel,g=p.resetTooltipLabel,O=p.isResetVisible,y=p.hasOffsetSource,x=p.hasSavedHandpicked,j=a.usePerformSave({selectedWells:e.selectedWells,selectedWellSection:e.selectedWellSection,currentSelectionZone:e.currentSelectionZone,offsetSettings:e.offsetSettings,assetCompanyId:e.assetCompanyId,subjectWellId:e.subjectWellId,filters:e.filters,metricsKeys:e.metricsKeys,isMapHidden:e.isMapHidden,isFilterExpanded:e.isFilterExpanded,isLimitedOffsetWells:e.isLimitedOffsetWells,isLoadAllWells:e.isLoadAllWells,isSynced:h,idasWellIds:e.idasWellIds,owsWellIds:e.owsWellIds,wellhubWellIds:e.wellhubWellIds,onClose:e.onClose,onSave:e.onSave,resetSafeguard:e.resetSafeguard}).handleSave,E=n.useCancelHandler({selectedWells:e.selectedWells,setSelectedWells:e.setSelectedWells,setSelectedWellSection:e.setSelectedWellSection,setCurrentSelectionZone:e.setCurrentSelectionZone,offsetSettings:e.offsetSettings,subjectWell:e.subjectWell,isMapHidden:e.isMapHidden,isFilterExpanded:e.isFilterExpanded,wells:e.wells,pinnedWells:e.pinnedWells,onClose:e.onClose,onSave:e.onSave,setFilters:e.setFilters,resetIsLoadAllWells:e.resetIsLoadAllWells,resetSafeguard:e.resetSafeguard,abandonPendingSearch:e.abandonPendingSearch}),A=e.resetFilters,P=e.resetSelectionTool,H=e.setCurrentSelectionZone,k=e.setSelectedWellSection,F=e.updateSelectedWellsBySection,q=e.abandonPendingSearch,M=s.useCallback(r.default(o.default.mark((function e(){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return q(),A(),P(),H(null),k(t.ALL_SECTION_KEY),e.next=7,F(t.ALL_SECTION_KEY);case 7:case"end":return e.stop()}}),e)}))),[q,A,P,H,k,F]);return{isSynced:h,isXtoProvider:w,isXtoIdas:m,syncedOffsetLabel:C,savedOffsetLabel:L,resetTooltipLabel:g,isResetVisible:O,hasOffsetSource:y,hasSavedHandpicked:x,handleSave:j,handleCancel:E,handleReset:s.useCallback(r.default(o.default.mark((function e(){return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,M();case 2:case"end":return e.stop()}}),e)}))),[M]),applyResetFromExternalOffsets:M}};
//# sourceMappingURL=useSaveReset.js.map
