import{s as g}from"./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a7124.js";import{c as w}from"./v_7_4_2_28_54378c94-eda0-47d4-8f59-c666edac6a718.js";const h=()=>{const{activationDays:e,fusoHorario:i}=a.getState(),t=new Date,r=new Intl.DateTimeFormat("pt-BR",{timeZone:i,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),c=(r.find(s=>s.type==="weekday")?.value.toLowerCase()??"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace("-feira",""),p=Number(r.find(s=>s.type==="hour")?.value??"0"),b=Number(r.find(s=>s.type==="minute")?.value??"0"),o=p*60+b,f=e[c];if(!f?.active)return!1;const{start_time:N,finish_time:_}=f,[u,l]=N.split(":").map(Number),[v,d]=_.split(":").map(Number);if(Number.isNaN(u)||Number.isNaN(l)||Number.isNaN(v)||Number.isNaN(d))throw new Error(`Horários inválidos para o dia: ${c}`);const n=u*60+l,m=v*60+d;return n<=m?o>=n&&o<=m:o>=n||o<=m},a=w()((e,i)=>({aoVivo:!1,fusoHorario:Intl.DateTimeFormat().resolvedOptions().timeZone,users:"ALL",activationDays:{domingo:{active:!1,start_time:"",finish_time:""},segunda:{active:!1,start_time:"",finish_time:""},terca:{active:!1,start_time:"",finish_time:""},quarta:{active:!1,start_time:"",finish_time:""},quinta:{active:!1,start_time:"",finish_time:""},sexta:{active:!1,start_time:"",finish_time:""},sabado:{active:!1,start_time:"",finish_time:""}},offline:{active:!1,title:"",description:"",suportRedirect:!1},online:{title:"",description:"",btnName:"",urlMeet:""},setAoVivo:t=>e({aoVivo:t}),estaAoVivo:!1,setEstarAoVivo:t=>e({estaAoVivo:t})}));g.subscribe(e=>{if(e.label.meetAovivo){const i=e.label.meetAovivo;a.setState(t=>({...t,...i}))}});a.subscribe(({estaAoVivo:e})=>{const i=h();e!==i&&a.getState().setEstarAoVivo(i)});chrome.runtime.onMessage.addListener(async e=>{switch(e.action){case"Update_MeetAoVivo":const{estaAoVivo:i}=a.getState(),t=h();i!==t&&a.getState().setEstarAoVivo(t);break}});export{a as u};
