(function(){try{var g=typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};g["__faroBundleId_Speechify Chrome Extension"]="13.4.1"}catch(l){}})();
import{Cb as p,ca as y,mg as h}from"./chunk-XMRXO6YU.js";import{g as H}from"./chunk-ODCFEFOB.js";import"./chunk-24ZZP5UQ.js";import{g as F}from"./chunk-GQY3J744.js";import"./chunk-NWEJW7RD.js";import"./chunk-ASZMUWWE.js";import"./chunk-4XRFE7WB.js";import"./chunk-6I7EUWRH.js";import{d,g as l,i as s,j as a,k as u,m as M,n as c}from"./chunk-CLPINNGF.js";c();l();M();c();l();var g=d(F()),b=d(H());var E=e=>{let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)},f=e=>{if(!e&&!document.querySelector("[speechify-initial-font-family-modified]"))return;let t=document.body.querySelectorAll("*:not(#speechify-player)");for(let i of t){if(!E(i))continue;let n=i.getAttribute("speechify-initial-font-family"),o=i.getAttribute("speechify-initial-font-family-modified");e&&n?(i.style.fontFamily="Open-Dyslexic",i.setAttribute("speechify-initial-font-family-modified","true")):n&&o&&(i.style.fontFamily=n)}},m=e=>{if(e===1&&!document.querySelector("[speechify-initial-font-size-modified]"))return;let t=document.body.querySelectorAll("*:not(#speechify-player)");for(let i of t){if(!E(i))continue;let n=parseFloat(i.getAttribute("speechify-initial-font-size")),o=i.getAttribute("speechify-initial-font-size-modified");e>1?(i.setAttribute("speechify-initial-font-size-modified","true"),i.style.fontSize=`${n*e}px`):e===1&&o&&(i.style.fontSize=`${n*e}px`)}},r=(0,b.default)(async()=>{let{dyslexicFont:e,fontSize:t}=await y();(e||document.querySelector("[speechify-initial-font-family-modified]"))&&f(e),(t!==1||document.querySelector("[speechify-initial-font-size-modified]"))&&m(t)},600);function S(){let{dyslexicFont:e,fontSize:t}=p();return(0,g.useEffect)(()=>{if(e||t&&t!==1){let i=document.body.querySelectorAll("*:not(#speechify-player)");for(let o of i)if(!o.getAttribute("speechify-initial-font-initialized")){let z=window.getComputedStyle(o,null).getPropertyValue("font-family"),L=window.getComputedStyle(o,null).getPropertyValue("font-size");o.setAttribute("speechify-initial-font-family",z),o.setAttribute("speechify-initial-font-size",L),o.setAttribute("speechify-initial-font-initialized","true")}document.addEventListener("scroll",r);let n=new MutationObserver(r);return n.observe(document.body,{characterData:!0,attributes:!0,childList:!0,subtree:!1,characterDataOldValue:!0}),f(!!e),m(t),()=>{document.removeEventListener("scroll",r),n.disconnect()}}!e&&document.querySelector("[speechify-initial-font-family-modified]")&&f(!1),(!t||t&&t===1)&&document.querySelector("[speechify-initial-font-size-modified]")&&m(1)},[e,t]),s(a,null)}function w(){let e=["speechify.com","onboarding.speechify.com","calendar.google.com","sheets.google.com","youtube.com","www.google.com","mail.google.com","docs.google.com","read.amazon.in","read.amazon.com","linear.app","chat.openai.com","chatgpt.com"];h()||e.includes(window.location.hostname)||u(s(S,null),document.body)}export{w as default};
//# sourceMappingURL=init-7KIVLGAE.js.map
