import{an as e,ao as s,ai as a,ap as r,aq as i}from"./main-79b6d9fd.js";async function u(u,o,n){const t=new e("updateLovelaceResources"),d=await s(u),l=`/hacsfiles/${o.full_name.split("/")[1]}`,c=a({repository:o,version:n}),p=d.find((e=>e.url.includes(l)));t.debug({namespace:l,url:c,exsisting:p}),p&&p.url!==c?(t.debug(`Updating exsusting resource for ${l}`),await r(u,{url:c,resource_id:p.id,res_type:p.type})):d.map((e=>e.url)).includes(c)||(t.debug(`Adding ${c} to Lovelace resources`),await i(u,{url:c,res_type:"module"}))}export{u};
