import{l as a}from"./main-few-lands-burn.js";const l="https://api.elevenlabs.io/v1",c=e=>a({headers:{"xi-api-key":{encryption:"hmac_decrypt",value:e}},method:"GET",url:`${l}/voices`}),u=e=>a({headers:{"xi-api-key":{encryption:"hmac_decrypt",value:e}},method:"GET",url:`${l}/models`}),r=async e=>{e.setComponent("voice-id",t=>{e.util.isSelectComponent(t)&&(t.loading=!0)});try{const t=await e.getConnection();if(!t)return;const{data:n,status:i}=await c(t.auth_details.value);if(i!=="success"){e.setComponent("voice-id",o=>{e.util.isSelectComponent(o)&&(o.status=i,o.invalidMessage=n)}),console.error("Failed to fetch voices list");return}e.setComponent("voice-id",o=>{e.util.isSelectComponent(o)&&(o.options=n?.voices?.map(s=>({label:s.name,value:s.voice_id}))||[])})}finally{e.setComponent("voice-id",t=>{e.util.isSelectComponent(t)&&(t.loading=!1)})}},m=async e=>{e.setComponent("model-id",t=>{e.util.isSelectComponent(t)&&(t.loading=!0)});try{const t=await e.getConnection();if(!t)return;const{data:n,status:i}=await u(t.auth_details.value);if(i!=="success"){e.setComponent("model-id",o=>{e.util.isSelectComponent(o)&&(o.status=i,o.invalidMessage=n)}),console.error("Failed to fetch models list");return}e.setComponent("model-id",o=>{e.util.isSelectComponent(o)&&(o.options=n?.map(s=>({label:s.name,value:s.model_id}))??[])})}finally{e.setComponent("model-id",t=>{e.util.isSelectComponent(t)&&(t.loading=!1)})}};export{r as a,m as f};
