import r from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/regenerator";import{useCallback as e}from"react";import{findTemplate as o,setBusy as n,ensureTemplateSettings as s}from"../utils.js";import{Action as i}from"../../types.js";import{getTemplateExportData as a}from"../../utils.js";import{useGet as m}from"./sharedHooks.js";import"../../../../utils/index.js";import{downloadBlob as p}from"../../../../utils/downloadBlob.js";var c=function(c){var f=m("get"),l=m("set");return e(r(t.mark((function r(){var e,m,u,j,b,x;return t.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(e=o(f,c))){r.next=11;break}return m=n(l,c,i.Export),r.next=5,s(f,l,e);case 5:u=r.sent,j=a(u),b=e.name.replace(/[\W-]/g,"-"),x="".concat(b,"_template.json"),p(new Blob([JSON.stringify(j)],{type:"application/json"}),x),m();case 11:case"end":return r.stop()}}),r)}))),[f,l,c])};export{c as useExportTemplate};
//# sourceMappingURL=useExportTemplate.js.map
