import{da as l}from"./main-tangy-colts-beg.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,o){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,o),o)}};const h=async e=>l({headers:{Authorization:["Bearer ",{encryption:"hmac_decrypt",value:e}]},method:"GET",url:"https://api.groq.com/openai/v1/models"});globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,o){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,o),o)}};const d=async e=>{e.setComponent("model-id",a=>{e.util.isSelectComponent(a)&&(a.loading=!0)});const o=await e.getConnection();if(o)try{const{data:a,status:i}=await h(o.auth_details.value);if(i!=="success")throw new Error("Invalid response format");const s=e.thisNode.machineSlug,r=a.data.map(t=>({label:`${t.id}`,value:t.id})).filter(t=>{const n=t.value.toLowerCase().includes("vision"),c=t.value.toLowerCase().includes("whisper");return s==="analyzeImage"?n:s==="transcribeAudio"||s==="translateAudio"?c:!n&&!c});e.setComponent("model-id",t=>{e.util.isSelectComponent(t)&&(t.options=r,t.loading=!1)})}catch(a){e.setComponent("model-id",i=>{e.util.isSelectComponent(i)&&(i.loading=!1,i.status="error",i.invalidMessage=a.message)})}};export{d as f};
