import{d as g,b,r as l}from"./jwt-decode.esm-CzNJpMna.js";import{r as m}from"./router-W58Zb32N.js";import{a as p}from"./project-CUN2uQd6.js";import"./tables-B14bH8Kr.js";import{u as v}from"./organizationSwitcher-CIDAicHA.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]="7740902d-147b-4c9b-bc83-3bcb6d30cfd8",o._sentryDebugIdIdentifier="sentry-dbid-7740902d-147b-4c9b-bc83-3bcb6d30cfd8")}catch{}})();const h=g("project",()=>{const o=b(()=>m.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 p.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-1e9Bdcb1.js.map
