import{useMemo as e}from"react";import{isOwnTemplate as o,isTemplateInFolder as t}from"../utils.js";import{storeApi as n}from"../Store/Store.js";import"../Store/utils.js";import{PublishTemplate as r}from"./PublishTemplate.js";import{MoveTemplateOutOfFolder as i}from"./MoveTemplateOutOfFolder.js";import{MoveTemplateToFolder as m}from"./MoveTemplateToFolder.js";import{RevertTemplate as l}from"./RevertTemplate.js";import{UnfollowTemplate as a}from"./UnfollowTemplate.js";import{CopyTemplate as s}from"./CopyTemplate.js";import{ShareTemplate as p}from"./ShareTemplate.js";import{ExportTemplate as u}from"./ExportTemplate.js";import{RemoveTemplate as d}from"./RemoveTemplate.js";import{TemplateControls as f}from"./TemplateControls.js";var h=[{id:"PublishTemplate",Component:r,isShown:function(e){var t=e.template,n=e.publishEnabled;return e.canPublish&&o(t)&&n}},{id:"MoveTemplateOutOfFolder",Component:i,isShown:function(e){var n=e.template;return e.foldersEnabled&&o(n)&&t(n)}},{id:"MoveTemplateToOtherFolder",Component:m,isShown:function(e){var n=e.template;return e.foldersEnabled&&o(n)&&t(n)}},{id:"RevertTemplate",Component:l,isShown:function(e){return!!e.hasUnsavedChanges},hasDividerBefore:!0},{id:"UnfollowTemplate",Component:a,isShown:function(e){return!!e.template.shared},hasDividerBefore:!0},{id:"CopyTemplate",Component:s,isShown:function(){return!0}},{id:"ShareTemplate",Component:p,isShown:function(e){var t=e.template;return o(t)}},{id:"ExportTemplate",Component:u,isShown:function(){return!0}},{id:"MoveTemplateToFolder",Component:m,isShown:function(e){var n=e.template;return e.foldersEnabled&&o(n)&&!t(n)},hasDividerBefore:!0},{id:"TemplateControls",Component:f,isShown:function(e){return!!e.controls}},{id:"RemoveTemplate",Component:d,isShown:function(e){var t=e.template,n=e.canPublish;return o(t)||!!t.published&&n},hasDividerBefore:!0}],v=function(o){var t=n.useCanPublish,r=n.usePublishEnabled,i=n.useFoldersEnabled,m=n.useHasUnsavedChanges,l=n.useTemplateControls,a=t(),s=r(),p=i(),u=!!m(null==o?void 0:o.id),d=l();return e((function(){return h.filter((function(e){return!!o&&e.isShown({hasUnsavedChanges:u,template:o,controls:d,canPublish:a,publishEnabled:s,foldersEnabled:p})})).map((function(e){return{Component:e.Component,hasDividerBefore:e.hasDividerBefore,id:e.id}}))}),[u,o,d,a,s,p])};export{v as useTemplateActions};
//# sourceMappingURL=index.js.map
