import{a as u}from"./chunk-56NWWOIX.js";import"./chunk-EF43U47C.js";import{Na as c,Oa as l}from"./chunk-RISKGE32.js";import{ea as t}from"./chunk-6O6MLDWR.js";import"./chunk-F4AZU7R4.js";import"./chunk-GQY3J744.js";import{g as o,n as s}from"./chunk-CLPINNGF.js";s();o();var r=null,y=[];async function g(){let a=await m();return()=>a&&a()}var m=async()=>{let a=u();if(Object.keys(a).some(e=>y.includes(e)))return;if(!("wakeLock"in navigator)){t(new Error("Wake Lock API not supported"));return}let n=async()=>{if(r)try{await r.release(),r=null}catch(e){t(new Error(`Wake Lock release failed: ${e}`))}},k=c.registerHook("PLAYBACK_STATE_CHANGED",async({state:e})=>{if(e==="playing")try{r=await navigator.wakeLock.request("screen")}catch(f){t(new Error(`Wake Lock request failed: ${f}`))}else await n()}),i=async()=>{if(document.visibilityState==="visible")try{l.getPlayingState()==="playing"?r=await navigator.wakeLock.request("screen"):await n()}catch(e){t(new Error(`Wake Lock request failed: ${e}`))}};return document.addEventListener("visibilitychange",i),()=>{k(),document.removeEventListener("visibilitychange",i),r&&r.release().catch(e=>t(new Error(`Wake Lock release failed: ${e}`)))}};export{g as default};
//# sourceMappingURL=init-RZNTCAL5.js.map
