import{r as s,j as n,B as p,c as i}from"./chunks/button-ZGp1Hv_j.js";import{s as c}from"./background.js";import"./chunks/__vite-browser-external-YNdK408e.js";import"./chunks/config-Cj0OpXlx.js";async function l(r){const t=await c.reportKpi({event:r,eventSource:"extension"},!0);console.log("KPI report completed with result:",t)}const e={en:"Open WhatsApp Web with Kaption AI",es:"Abrir WhatsApp Web con Kaption AI",pt:"Abrir WhatsApp Web com Kaption AI",it:"Apri WhatsApp Web con Kaption AI",de:"WhatsApp Web mit Kaption AI öffnen",fr:"Ouvrir WhatsApp Web avec Kaption AI"},u=()=>{const[r,t]=s.useState(e.en);s.useEffect(()=>{try{const o=navigator.language?.split("-")[0]||"en";o in e?t(e[o]):t(e.en)}catch(o){console.error("Error setting button language:",o),t(e.en)}},[]);const a=()=>{l("popup-button-open"),chrome&&chrome.tabs?setTimeout(()=>{chrome.tabs.create({url:"https://web.whatsapp.com"})},1e3):(console.error("Chrome tabs API is not available. Cannot open WhatsApp."),window.open("https://web.whatsapp.com","_blank"))};return n.jsx(p,{onClick:a,children:r})},h=document.getElementById("app"),b=i.createRoot(h),m=()=>n.jsx("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",backgroundColor:"hsl(var(--kaption-background))"},children:n.jsx(u,{})});b.render(n.jsx(m,{}));
