import{da as c}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 l="https://generativelanguage.googleapis.com/v1beta/",h=async e=>c({method:"GET",queryParams:{key:{encryption:"hmac_decrypt",value:e}},url:`${l}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 u=async e=>{e.setComponent("model-id",t=>{t.loading=!0});const o=await e.getConnection();if(!o)return;const{data:a,status:n}=await h(o.auth_details.value);if(n!=="success"){e.setComponent("model-id",t=>{e.util.isSelectComponent(t)&&(t.loading=!1,t.status=n,t.invalidMessage=a)}),console.error("Failed to fetch list");return}e.setComponent("model-id",t=>{e.util.isSelectComponent(t)&&(t.options=a==null?void 0:a.models.filter(s=>{var i;return(i=s.supportedGenerationMethods)==null?void 0:i.includes("generateContent")}).map(s=>({label:s.name,value:s.name})),t.loading=!1)})};export{u as f};
