(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{$ as u,Jc as h,Kc as v,_ as s,ba as c,ca as y,gc as S,q as f,qf as b,y as i}from"./chunk-XMRXO6YU.js";import"./chunk-ODCFEFOB.js";import"./chunk-24ZZP5UQ.js";import"./chunk-GQY3J744.js";import{p as l}from"./chunk-NWEJW7RD.js";import"./chunk-ASZMUWWE.js";import"./chunk-4XRFE7WB.js";import"./chunk-6I7EUWRH.js";import{g as d,n as g}from"./chunk-CLPINNGF.js";g();d();async function V(){let C=f("SettingsSync","orange"),E=S.registerHook("BEFORE_PLAY",async()=>{i("/user-settings/sync")}),a=async()=>{if(document.visibilityState==="visible"){let o=c.getCacheSync(),n=await i("/user-settings/get").then(async({voice:e,...t})=>({voice:await u(e),...t}));l(o,n)||(c.invalidateCache(),await s.emit("update",await y())),b();try{let{preference:e}=await i("/theme/get-preference"),t=h.getState().themePreference;e!==t&&v(e)}catch{}}},r=null,m=null,p=null,w=s.on("update",async o=>{let{voice:n,playbackSpeed:e}=o,t=o["extension.chat.voiceSpeed"];if(r!==n||m!==e||p!==t)try{await i("/sidepanel/settings-update",{voice:n??r,playbackSpeed:e,extensionChatVoiceSpeed:t}),n&&(r=n),e&&(m=e),t!==void 0&&(p=t)}catch(P){C.warn("❌ Failed to notify sidepanel (may not be open):",P)}});return document.addEventListener("visibilitychange",a),()=>{document.removeEventListener("visibilitychange",a),E(),w()}}export{V as default};
//# sourceMappingURL=init-BTENBKIM.js.map
