import t from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/regenerator";import{useCallback as r}from"react";import{setBusy as o,getAllTemplates as n,addTemplate as a}from"../utils.js";import{Action as s}from"../../types.js";import{suggestName as i}from"../../utils.js";import{useGet as m}from"./sharedHooks.js";import{useSelectTemplate as c}from"./useSelectTemplate.js";import"../../../../utils/index.js";import{showSuccessNotification as p}from"../../../../utils/notificationToasts.js";var u=function(){var u=m("get"),f=m("set"),l=c();return r(function(){var r=t(e.mark((function t(r){var m,c,j;return e.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return m=o(f,0,s.Create),t.prev=1,c=i(r,n(u))||r,t.next=5,a(u,f,{name:c,settings:u().templateSettings||{},metadata:{}});case 5:return j=t.sent,t.next=8,l(j.id);case 8:p('"'.concat(j.name,'" was created')),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(1),console.error(t.t0);case 14:m();case 15:case"end":return t.stop()}}),t,null,[[1,11]])})));return function(t){return r.apply(this,arguments)}}(),[u,f,l])};export{u as useCreateTemplate};
//# sourceMappingURL=useCreateTemplate.js.map
