window.addEventListener("load",(async function(){const dialogEl=document.querySelector(".loading-dialog");dialogEl.showModal(),dialogEl.addEventListener("cancel",(e=>e.preventDefault()));const permissionValue={origins:["<all_urls>"]},hasPermission=await browser.permissions.contains(permissionValue),isAllowedIncognitoAccess=!chrome.contextMenus||await browser.extension.isAllowedIncognitoAccess();hasPermission&&document.querySelector(".site-permissions-required").remove(),isAllowedIncognitoAccess&&document.querySelector(".incognito-access-required").remove(),dialogEl.remove(),document.body.style.opacity=""}),{once:!0});const btn=document.querySelector("#grant-permissions-btn");btn.onclick=async()=>{const permissionValue={origins:["<all_urls>"]},hasPermission=await browser.permissions.request(permissionValue),isAllowedIncognitoAccess=!chrome.contextMenus||await browser.extension.isAllowedIncognitoAccess();hasPermission&&document.querySelector(".site-permissions-required")?.remove(),isAllowedIncognitoAccess&&document.querySelector(".incognito-access-required")?.remove(),hasPermission&&isAllowedIncognitoAccess&&(location.href="index.html")};