import{d as g,b as m,r as l}from"./jwt-decode.esm-BYfS37aG.js";import{r as p}from"./router-D53qV9Zg.js";import{a as b}from"./project-C7QI6pXl.js";import"./tables-nYEEmE6H.js";import{u as v}from"./organizationSwitcher-DapMvF_6.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[a]="5ad59c92-89ed-41f9-a36d-334cbdf87217",o._sentryDebugIdIdentifier="sentry-dbid-5ad59c92-89ed-41f9-a36d-334cbdf87217")}catch{}})();const h=g("project",()=>{const o=m(()=>p.currentRoute.value.params.projectId),a=l(null),t=l(null),n=l(!1),i=l(null);async function s(u){if(!(a.value?.id===u&&t.value)){n.value=!0,i.value=null;try{const e=await b.get(u);a.value={id:e.id,folderId:e.folderId,name:e.name,subdomain:e.subdomain,organizationId:e.organizationId};const d=v();d.organizations.length===0&&await d.fetchOrganizations();const r=d.organizations.find(f=>f.id===e.organizationId);r&&(t.value={id:r.id,name:r.name,featureFlags:r.featureFlags,billingMetadata:r.billingMetadata})}catch(e){throw i.value=e instanceof Error?e.message:"Failed to load project",console.error("Failed to load project:",e),e}finally{n.value=!1}}}function c(){a.value=null,t.value=null,n.value=!1,i.value=null}return{projectId:o,project:a,organization:t,loading:n,error:i,get organizationId(){return t.value?.id},get billingMetadata(){return t.value?.billingMetadata},loadProject:s,resetStore:c}});export{h as u};
//# sourceMappingURL=projectStore-6bDmkbW0.js.map
