import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/regenerator";import{useCallback as t}from"react";import{ConfirmationModalType as s}from"../../types.js";import{getTemplateOverride as o,removeTemplateFromList as n}from"../utils.js";import{deleteAppSettingsTemplate as a}from"../../../../clients/jsonApi/index.js";import{useGet as i,useConfirmation as m}from"./sharedHooks.js";import{useSelectTemplate as p}from"./useSelectTemplate.js";import"../../../../utils/index.js";import{showSuccessNotification as c}from"../../../../utils/notificationToasts.js";var u=function(u){var f=i("get"),l=i("set"),d=p(),j=t(e(r.mark((function e(){var t,s;return r.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(t=o(f,u))&&(n(f,l,t),a(f().appKey,t.id)),e.next=4,d(f().currentTemplateId,!0);case 4:(s=e.sent)&&c('"'.concat(s.name,'" has been successfully reverted to its default state. All unsaved changes have been discarded.'));case 6:case"end":return e.stop()}}),e)}))),[f,l,d,u]);return m(s.Revert,j)};export{u as useRevertToOriginal};
//# sourceMappingURL=useRevertToOriginal.js.map
