import{r as e}from"./rolldown-runtime-DCMCV6zW.js";import{Et as t,X as n}from"./vendor-vue-core-D3IvUUeM.js";import{t as r}from"./types-0oh-UGWL.js";import{V as i,_n as a,br as o,t as s,wn as c}from"./dialogService-BC0EXJA5.js";function useSubscriptionActions(){let e=s(),l=c(),u=o(),d=i(),{fetchStatus:f}=a(),p=t(!1);n(()=>{handleRefresh()});let handleAddApiCredits=()=>{e.showTopUpCreditsDialog()},handleMessageSupport=async()=>{try{p.value=!0,r&&d?.trackHelpResourceClicked({resource_type:`help_feedback`,is_external:!0,source:`subscription`}),await u.execute(`Comfy.ContactSupport`)}catch(e){console.error(`[useSubscriptionActions] Error contacting support:`,e)}finally{p.value=!1}},handleRefresh=async()=>{try{await Promise.all([l.fetchBalance(),f()])}catch(e){console.error(`[useSubscriptionActions] Error refreshing data:`,e)}},handleLearnMoreClick=()=>{window.open(`https://docs.comfy.org/get_started/cloud`,`_blank`)};return{isLoadingSupport:p,handleAddApiCredits,handleMessageSupport,handleRefresh,handleLearnMoreClick}}export{useSubscriptionActions as t};
//# sourceMappingURL=useSubscriptionActions-BiIEnJXg.js.map