import"../chunks/DsnmJJEf.js";import{iasse}from"../chunks/zNh6Oe5P.js";import{pasne,oasie,lasd,aasce,fasde,haspe,basue,casme,dasfe,gast,masl,$asge,jasye,qasM,uasF,kasC,saso,rashe,nasPe}from"../chunks/sWNKMed7.js";import{iasD,sasCe,aasve}from"../chunks/Ccl3fNd2.js";import{gasN}from"../chunks/t8NOL8UT.js";import{Pas$e}from"../chunks/sdr-JCKi.js";import{Casbe}from"../chunks/Csic5lDL.js";import{Uas_e}from"../chunks/DLiuxLBn.js";import{DasMe}from"../chunks/Dxyf9P7U.js";import{easDe,aasR}from"../chunks/UPGsoYWO.js";import{tasf}from"../chunks/BZUCTtPY.js";import{easv,hasEe}from"../chunks/Cbkm53HO.js";import{easG}from"../chunks/BZiHL9L3.js";import{DasTe,GasE,aaswe}from"../chunks/WvS03pW2.js";import{Easke}from"../chunks/CfvU88k5.js";import{EasAe}from"../chunks/CC0e8UY8.js";import{Sasxe}from"../chunks/C7WQ-JBG.js";import{PasIe}from"../chunks/MfZe8e4a.js";import"../chunks/BFThZs5w.js";varUe=de('<div class="space-y-6"><!> <!></div> <!> <!> <!>',1);functionZe(q,L){ne(L,!1);const[j,H]=Ce(),r=()=>ve(De,"$eagerCache",j),$=l(),i=l(),p=l(),T=l();letu=l([]),g=l(!0),w=l(""),y=l(""),s=l(1),c=l(25),h=l(!1),P=l(!1),m=l(!1),a=l(null);asyncfunctionV(){f.success("Pool Created","Pool has been created successfully."),o(h,!1)}asyncfunctionz(e){if(t(a))try{awaitN.updatePool(t(a).id,e),o(P,!1),f.add({type:"success",title:"Pool Updated",message:`Pool ${t(a).id.slice(0,8)}... has been updated successfully.`}),o(a,null)}catch(n){const_=G(n);throwf.add({type:"error",title:"Update Failed",message:_}),n}}asyncfunctionB(){if(!t(a))return;conste=`Pool ${t(a).id.slice(0,8)}...`;try{awaitN.deletePool(t(a).id),o(m,!1),f.add({type:"success",title:"Pool Deleted",message:`${e} has been deleted successfully.`}),o(a,null)}catch(n){const_=G(n);f.add({type:"error",title:"Delete Failed",message:_})}o(m,!1),o(a,null)}functionJ(){o(h,!0)}functionk(e){o(a,e),o(P,!0)}functionA(e){o(a,e),o(m,!0)}ie(async()=>{try{o(g,!0);conste=awaitR.getPools();e&&Array.isArray(e)&&o(u,e)}catch(e){console.error("Failed to load pools:",e),o(w,einstanceofError?e.message:"Failed to load pools")}finally{o(g,!1)}});asyncfunctionK(){try{awaitR.retryResource("pools")}catch(e){console.error("Retry failed:",e)}}constO=[{key:"id",title:"ID",flexible:!0,cellComponent:ke,cellProps:{entityType:"pool",showId:!0,fontMono:!0}},{key:"image",title:"Image",flexible:!0,cellComponent:E,cellProps:{field:"image",type:"code",showTitle:!0}},{key:"provider",title:"Provider",cellComponent:E,cellProps:{field:"provider_name"}},{key:"flavor",title:"Flavor",cellComponent:E,cellProps:{field:"flavor"}},{key:"entity",title:"Entity",cellComponent:Ie},{key:"endpoint",title:"Endpoint",cellComponent:Ae},{key:"status",title:"Status",cellComponent:xe,cellProps:{statusType:"enabled"}},{key:"actions",title:"Actions",align:"right",cellComponent:we}],Q={entityType:"pool",primaryText:{field:"id",isClickable:!0,href:"/pools/{id}",useId:!0,isMonospace:!0},secondaryText:{field:"entity_name",computedValue:e=>v(e,r())},badges:[{type:"custom",value:e=>({variant:e.enabled?"success":"error",text:e.enabled?"Enabled":"Disabled"})}],actions:[{type:"edit",handler:e=>k(e)},{type:"delete",handler:e=>A(e)}]};functionW(e){o(y,e.detail.term),o(s,1)}functionX(e){o(s,e.detail.page)}functionY(e){o(c,e.detail.perPage),o(s,1)}functionZ(e){k(e.detail.item)}functionee(e){A(e.detail.item)}d(()=>(t(u),r()),()=>{(!t(u).length||r().loaded.pools)&&o(u,r().pools)}),d(()=>r(),()=>{o(g,r().loading.pools)}),d(()=>r(),()=>{o($,r().errorMessages.pools)}),d(()=>(t(u),t(y),r()),()=>{o(i,Ee(t(u),t(y),e=>v(e,r())))}),d(()=>(t(i),t(c)),()=>{o(p,Math.ceil(t(i).length/t(c)))}),d(()=>(t(s),t(p)),()=>{t(s)>t(p)&&t(p)>0&&o(s,t(p))}),d(()=>(t(i),t(s),t(c)),()=>{o(T,t(i).slice((t(s)-1)*t(c),t(s)*t(c)))}),ce(),se();varx=Ue();pe(e=>{ge.title="Pools - GARM"});varb=ue(x),I=ye(b);$e(I,{title:"Pools",description:"Manage runner pools across all entities",actionLabel:"Add Pool",$$events:{action:J}});varte=C(I,2);{lete=M(()=>t($)||t(w)),n=M(()=>!!t($));Te(te,{getcolumns(){r