import{d as p,b as v,r}from"./jwt-decode.esm-C2n6WQ0J.js";import{r as b}from"./router-DyRErWhl.js";import{O as m}from"./organization-Brtl8D5A.js";import{a as I}from"./project-BWts715N.js";import"./tables-Bfw_MTCm.js";import{F as w}from"./folder-mjOIyKW7.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="52b71b24-5be3-46e4-9655-7c293d037dff",t._sentryDebugIdIdentifier="sentry-dbid-52b71b24-5be3-46e4-9655-7c293d037dff")}catch{}})();const _=p("project",()=>{const t=v(()=>b.currentRoute.value.params.projectId),o=r(null),a=r(null),n=r(null),l=r(!1),d=r(null);async function f(u){if(!(o.value?.id===u&&a.value&&n.value)){l.value=!0,d.value=null;try{const e=await I.get(u),i=await m.get(e.organizationId);o.value={id:e.id,folderId:e.folderId,name:e.name,subdomain:e.subdomain,organizationId:e.organizationId},a.value={id:i.id,name:i.name,featureFlags:i.featureFlags,billingMetadata:i.billingMetadata};const s=(await new w().list(a.value.id)).find(g=>g.id===o.value.folderId);if(!s)throw new Error("Folder not found");n.value=s}catch(e){throw d.value=e instanceof Error?e.message:"Failed to load project",console.error("Failed to load project:",e),e}finally{l.value=!1}}}function c(){o.value=null,a.value=null,n.value=null,l.value=!1,d.value=null}return{projectId:t,project:o,organization:a,folder:n,loading:l,error:d,get organizationId(){return a.value?.id},get billingMetadata(){return a.value?.billingMetadata},loadProject:f,resetStore:c}});export{_ as u};
//# sourceMappingURL=projectStore-DxqJVC72.js.map
