import{r as e}from"./rolldown-runtime-DIIn1E2Q.js";import{l as t}from"./vendor-vue-core-IZuWV8u3.js";import{n}from"./vendor-i18n-NwyZMF0q.js";import{ri as r,t as i,wr as a}from"./dialogService-J-k0CeI4.js";function useWorkspaceSwitch(){let{t:e}=n(),o=a(),{activeWorkspace:s}=t(o),c=r(),l=i();function hasUnsavedChanges(){return c.modifiedWorkflows.length>0}async function switchWithConfirmation(t){if(s.value?.id===t)return!0;if(hasUnsavedChanges()&&!await l.confirm({title:e(`workspace.unsavedChanges.title`),message:e(`workspace.unsavedChanges.message`),type:`dirtyClose`}))return!1;try{return await o.switchWorkspace(t),!0}catch{return!1}}return{hasUnsavedChanges,switchWithConfirmation}}export{useWorkspaceSwitch as t};
//# sourceMappingURL=useWorkspaceSwitch-B2B6yBPV.js.map