(function(){const h="trialBanner",m="serpTrialBannerStyle",u="hidden";function g(){try{if(document.getElementById(m))return;const e=document.createElement("style");e.id=m,e.textContent=".trial-banner{margin:10px 0 0 0;padding:10px 12px;border:1px solid rgba(255,255,255,0.12);background:rgba(255,255,255,0.06);color:inherit;border-radius:6px;font-size:12px;line-height:1.35}.trial-banner strong{font-weight:700}.trial-banner.hidden{display:none !important}",document.head.appendChild(e)}catch{}}function p(){const e=document.getElementById(h);if(e)return e;try{const r=document.createElement("div");r.id=h,r.className="trial-banner "+u;const n=document.getElementById("bootSplash"),o=document.querySelector(".header"),i=document.querySelector(".container")||document.body;return n&&n.parentNode?n.insertAdjacentElement("afterend",r):o&&o.parentNode?o.insertAdjacentElement("afterend",r):i&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r}catch{return null}}function d(e){e&&(e.textContent="",e.classList.add(u))}function T(e,r){if(!e)return;const n=String(r),o=globalThis.SiteConfig&&globalThis.SiteConfig.PRODUCT_URL||"#";e.innerHTML='<span class="trial-banner-label"><span class="trial-banner-icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"/></svg></span>'+n+" download"+(n==="1"?"":"s")+' left</span><a class="trial-banner-upgrade" href="'+o+'" target="_blank" rel="noopener noreferrer">Upgrade &#8594;</a>',e.classList.remove(u)}async function S(e){const r=Date.now();for(;Date.now()-r<e;){if(globalThis.Auth&&typeof globalThis.Auth.checkActivationStatus=="function")return globalThis.Auth;await new Promise(n=>setTimeout(n,50))}return globalThis.Auth||null}async function f(){const e=p();if(!e)return;const r=await S(5e3);if(!r||typeof r.checkActivationStatus!="function"){d(e);return}try{const n=await r.checkActivationStatus();n&&n.mode==="trial"&&typeof n.remaining=="number"?T(e,n.remaining):d(e)}catch{d(e)}}function _(){try{let o=function(t){return!t||!t.length?null:typeof t[0]=="string"?t.length>=2&&typeof t[1]=="object"?t[1]:null:typeof t[0]=="object"?t[0]:null},i=function(t,c){try{return(t&&(t.action||t.type))!=="downloadVideo"?!1:!!(c&&c.success)}catch{return!1}};var e=o,r=i;if(!globalThis.chrome||!chrome.runtime||typeof chrome.runtime.sendMessage!="function"||globalThis.__serpTrialBannerPatched)return;globalThis.__serpTrialBannerPatched=!0;const n=chrome.runtime.sendMessage.bind(chrome.runtime);chrome.runtime.sendMessage=function(...t){const c=o(t),l=t.findIndex(a=>typeof a=="function");if(l>=0){const a=t[l];return t[l]=function(b){try{i(c,b)&&f()}catch{}return a(b)},n(...t)}const s=n(...t);try{if(s&&typeof s.then=="function")return s.then(a=>(i(c,a)&&f(),a))}catch{}return s}}catch{}}function y(){g(),p(),_(),f()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",y):y()})();
