import{eT as M,gT as X}from"./cli-0.5.12-xg7a0dy4.mjs";import{H$ as K,N$ as L,W$ as W,_8 as B,h9 as V}from"./cli-0.5.12-g4wb8mj2.mjs";import{aoa as Q}from"./cli-0.5.12-xzeb7mtb.mjs";async function F(){let b=await M();if(b.length===0)return{availableEnvironments:[],selectedEnvironment:null,selectedEnvironmentSource:null};let z=L()?.remote?.defaultEnvironmentId,H=b.find((x)=>x.kind!=="bridge")??b[0],J=null;if(z){let x=b.find((q)=>q.environment_id===z);if(x){H=x;for(let q=B.length-1;q>=0;q--){let y=B[q];if(!y||y==="flagSettings")continue;if(K(y)?.remote?.defaultEnvironmentId===z){J=y;break}}}}return{availableEnvironments:b,selectedEnvironment:H,selectedEnvironmentSource:J}}var Y=Q(()=>{V();W();X()});
export{F as Mb,Y as Nb};
