var u=r=>{throw TypeError(r)};var d=(r,e,t)=>e.has(r)||u("Cannot "+t);var s=(r,e,t)=>(d(r,e,"read from private field"),t?t.call(r):e.get(r)),n=(r,e,t)=>e.has(r)?u("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t);import{s as h,k as g,g as p,d as c}from"./DhUiKsxN.js";import{p as i}from"./QNXDtpsh.js";var a,o,l;class w{constructor(){n(this,a,h(g([])));n(this,o,h(!1));n(this,l,h(null))}get profiles(){return p(s(this,a))}set profiles(e){c(s(this,a),e,!0)}get loading(){return p(s(this,o))}set loading(e){c(s(this,o),e,!0)}get error(){return p(s(this,l))}set error(e){c(s(this,l),e,!0)}async refresh(){this.loading=!0,this.error=null;try{this.profiles=await i.list()}catch(e){this.error=e instanceof Error?e.message:"Failed to fetch profiles"}finally{this.loading=!1}}async create(e){const t=await i.create(e);return await this.refresh(),t}async update(e,t){const f=await i.update(e,t);return await this.refresh(),f}async delete(e){await i.delete(e),await this.refresh()}async duplicate(e,t){const f=await i.duplicate(e,t);return await this.refresh(),f}async getNextPort(){return(await i.getNextPort()).port}getProfile(e){return this.profiles.find(t=>t.id===e)}}a=new WeakMap,o=new WeakMap,l=new WeakMap;const P=new w;export{P as p};
