import{d as s,r as o}from"./jwt-decode.esm-Dw_OlTCW.js";import"./router-DzczyMew.js";import{O as l}from"./organization-CyPzXZ9t.js";import"./tables-CkY-LQhC.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ecf7e953-5c76-40f2-9df0-503aa7be570f",e._sentryDebugIdIdentifier="sentry-dbid-ecf7e953-5c76-40f2-9df0-503aa7be570f")}catch{}})();const O=s("organizationSwitcher",()=>{const e=o([]),t=o(!1),n=async()=>{t.value=!0;try{e.value=await l.list()}finally{t.value=!1}};return{organizations:e,loading:t,fetchOrganizations:n,selectDefaultOrganization:async()=>{if(await n(),e.value.length===0)return{name:"onboarding"};const a=localStorage.getItem("lastSelectedOrganizationId"),i=a?e.value.find(r=>r.id===a):null;return i?{name:"organization",params:{organizationId:i.id}}:(a&&localStorage.removeItem("lastSelectedOrganizationId"),{name:"organization",params:{organizationId:e.value[0].id}})},selectOrganization:a=>{localStorage.setItem("lastSelectedOrganizationId",a),window.location.href=`/organizations/${a}`}}});export{O as u};
//# sourceMappingURL=organizationSwitcher-DaZJIspe.js.map
