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