import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/regenerator";import{useCallback as o}from"react";import{Action as n}from"../../types.js";import{isTemplate as a}from"../../utils.js";import{setBusy as i,updateTemplates as c}from"../utils.js";import{useGet as s}from"./sharedHooks.js";import{useCloseFolderMenu as p}from"./useCloseFolderMenu.js";import"../../../../utils/index.js";import{showSuccessNotification as u}from"../../../../utils/notificationToasts.js";function f(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 m(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?f(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):f(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var l=function(){var e=s("get"),f=s("set"),l=p();return o(function(){var o=r(t.mark((function r(o,s){var p,b;return t.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!o||!s){r.next=14;break}return l(),p=o.items.filter(a).map((function(e){return e.id})),b=i(f,o.id,n.UpdateName),r.prev=4,r.next=7,c(e,f,p,(function(e){return{metadata:m(m({},e.metadata),{},{folderPath:s})}}),n.UpdateMetadata);case 7:u('"'.concat(o.name,'" was renamed to "').concat(s,'"')),r.next=13;break;case 10:r.prev=10,r.t0=r.catch(4),console.error(r.t0);case 13:b();case 14:case"end":return r.stop()}}),r,null,[[4,10]])})));return function(e,r){return o.apply(this,arguments)}}(),[l,e,f])};export{l as useUpdateFolderName};
//# sourceMappingURL=useUpdateFolderName.js.map
