import"./_virtual_wxt-html-plugins-D-Kpnm9T.js";/* empty css                */import{g as o,u as r,x as p}from"./_virtual_wxt-plugins-DQ05OeAp.js";var y;(y=document.getElementById("open-options"))==null||y.addEventListener("click",()=>{chrome.runtime.openOptionsPage()});const E={low:{blockAllAds:!1,blockTrackers:!1,blockCookieNotices:!1,blockPopups:!1,blockSocial:!1,blockUrlTracking:!1,aggressivePruning:!1},medium:{blockAllAds:!0,blockTrackers:!0,blockCookieNotices:!0,blockPopups:!0,blockSocial:!1,blockUrlTracking:!1,aggressivePruning:!1},high:{blockAllAds:!0,blockTrackers:!0,blockCookieNotices:!0,blockPopups:!0,blockSocial:!0,blockUrlTracking:!0,aggressivePruning:!0}},c=document.getElementById("diy-link"),k=document.getElementById("level-hint"),w=[...document.querySelectorAll(".level-card")];function B(e){return e.blockAllAds&&e.blockSocial&&e.aggressivePruning?"high":e.blockAllAds?"medium":"low"}function b(e){for(const t of w)t.classList.toggle("selected",t.dataset.level===e)}o().then(e=>b(B(e)));const q=()=>chrome.permissions.contains({origins:["*://*/*"]}).catch(()=>!1);for(const e of w)e.addEventListener("click",async()=>{const t=e.dataset.level;let n=!1;t!=="low"&&(n=!(await q()||await chrome.permissions.request({origins:["*://*/*"]}).catch(()=>!1))),await r(E[t]),b(t),k&&n&&(k.textContent="All-sites access was declined \u2014 request-level blocking is on, but hiding leftover frames on pages needs the grant. Pick the level again to retry, or grant it later from the popup.")});c==null||c.addEventListener("click",e=>{e.preventDefault(),chrome.runtime.openOptionsPage()});const v=document.getElementById("key-hint");function I(e){var g;const t=document.getElementById(e.rowId),n=document.getElementById(e.inputId),l=document.getElementById(e.savedId),d=()=>{var i,m,u;t&&(t.hidden=!0),l&&(l.hidden=!1),(i=document.getElementById("key-row"))!=null&&i.hidden&&((m=document.getElementById("groq-row"))!=null&&m.hidden)&&((u=document.getElementById("key-later"))==null||u.setAttribute("hidden",""))};return(g=document.getElementById(e.saveId))==null||g.addEventListener("click",async()=>{const i=n==null?void 0:n.value.trim();if(!i){n==null||n.focus();return}await chrome.permissions.request({origins:[e.origin]}).catch(()=>!1),await e.save(i),await p(!1),d()}),{markSaved:d}}const A=I({rowId:"key-row",inputId:"gemini-key",saveId:"save-key",savedId:"gemini-saved",origin:"https://generativelanguage.googleapis.com/*",save:async e=>{const t=await o();await r({llmProvider:"gemini",apiKeys:{...t.apiKeys,gemini:e}})}}),P=I({rowId:"groq-row",inputId:"groq-key",saveId:"save-groq",savedId:"groq-saved",origin:"https://api.groq.com/*",save:async e=>{const t=await o();await r({apiKeys:{...t.apiKeys,groq:e}})}});o().then(e=>{e.apiKeys.gemini&&A.markSaved(),e.apiKeys.groq&&P.markSaved()});var f;(f=document.getElementById("key-later"))==null||f.addEventListener("click",async()=>{var e,t;await p(!0),(e=document.getElementById("key-row"))==null||e.setAttribute("hidden",""),(t=document.getElementById("groq-row"))==null||t.setAttribute("hidden",""),v&&(v.textContent="No problem \u2014 a reminder will wait in the toolbar popup.")});const a=document.getElementById("aggressive-optin");a&&(o().then(e=>{a.checked=e.aggressivePruning}),a.addEventListener("change",()=>{r({aggressivePruning:a.checked})}));var h;(h=document.getElementById("close"))==null||h.addEventListener("click",()=>{window.close()});const s=document.getElementById("telemetry-optout");s&&(o().then(e=>{s.checked=e.telemetryEnabled}),s.addEventListener("change",()=>{r({telemetryEnabled:s.checked})}));
