const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/firebase-BylMgSsD.js","assets/chunk-DT4yxi9n.js","assets/index.esm-DKdodk42.js"])))=>i.map(i=>d[i]);
import"./modulepreload-polyfill-CkedBBHh.js";import{t as e}from"./preload-helper-CT1Z6Pdu.js";import{t}from"./musicPresets-gIjIkHVZ.js";import{n,r}from"./overlayStyle-BLOTt0xN.js";document.documentElement.style.cssText=`background:transparent;overflow:hidden`,document.body.style.cssText=`background:transparent;margin:0;overflow:hidden;height:100vh`;var i=new URLSearchParams(location.search),a=i.has(`demo`),o=i.get(`uid`),s=document.createElement(`style`);s.textContent=`
#music-response-overlay-root{position:fixed;inset:0;display:flex;padding:16px;box-sizing:border-box;pointer-events:none}
#music-response-overlay-root.pos-bottom{align-items:flex-end}
#music-response-overlay-root.pos-top{align-items:flex-start}
#music-response-overlay-root.al-left{justify-content:flex-start}
#music-response-overlay-root.al-center{justify-content:center}
#music-response-overlay-root.al-right{justify-content:flex-end}
.oi-mr-stack{display:flex;flex-direction:column;gap:8px;width:var(--oi-width,380px);max-width:calc(100vw - 32px)}
#music-response-overlay-root.pos-top .oi-mr-stack{flex-direction:column-reverse}
.oi-mr{display:flex;align-items:center;gap:10px;font-family:var(--oi-font,system-ui,sans-serif);
  background:var(--oi-bg,rgba(18,18,24,.85));border:var(--oi-border,none);border-radius:var(--oi-radius,14px);
  padding:var(--oi-pad,10px 13px);box-shadow:var(--oi-shadow,0 8px 26px -12px rgba(0,0,0,.6));backdrop-filter:var(--oi-blur,none);
  box-sizing:border-box;overflow:hidden;
  animation:oi-mr-in .34s cubic-bezier(.2,.9,.3,1.2) both}
.oi-mr.out{animation:oi-mr-out .3s ease forwards}
@keyframes oi-mr-in{from{opacity:0;transform:translateY(14px) scale(.96)}to{opacity:1;transform:none}}
@keyframes oi-mr-out{to{opacity:0;transform:translateY(-8px) scale(.98);margin-top:-6px;max-height:0;padding-top:0;padding-bottom:0}}
.oi-mr-icon{width:26px;height:26px;border-radius:50%;flex:0 0 auto;display:flex;align-items:center;justify-content:center;
  background:var(--oi-accent,#ff2d6f);color:#fff;font-size:14px;font-weight:800}
.oi-mr-text{color:var(--oi-fg,#fff);font-size:14px;font-weight:600;line-height:1.3;min-width:0;
  overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
`,document.head.appendChild(s);var c=document.getElementById(`music-response-overlay-root`),l=document.createElement(`div`);l.className=`oi-mr-stack`,c.appendChild(l);var u={durationMs:6e3,maxVisible:3,align:`center`,position:`bottom`};function d(e){return t.find(t=>t.id===e)??t.find(e=>e.id===`pro`)}function f(e){u={...u,...e},n(c,d(u.preset),u.vars),c.classList.toggle(`pos-top`,u.position===`top`),c.classList.toggle(`pos-bottom`,u.position!==`top`),c.classList.toggle(`al-left`,u.align===`left`),c.classList.toggle(`al-center`,u.align!==`left`&&u.align!==`right`),c.classList.toggle(`al-right`,u.align===`right`)}function p(e){let t=(e??``).trim();if(!t)return;let n=document.createElement(`div`);n.className=`oi-mr`;let r=document.createElement(`div`);r.className=`oi-mr-icon`,r.textContent=`♪`;let i=document.createElement(`div`);i.className=`oi-mr-text`,i.textContent=t,n.append(r,i),l.appendChild(n);let a=Math.max(1,u.maxVisible??3);for(;l.children.length>a;){let e=l.firstElementChild;if(!e)break;e.remove()}let o=Math.max(1500,u.durationMs??6e3);setTimeout(()=>m(n),o)}function m(e){!e||e.classList.contains(`out`)||(e.classList.add(`out`),setTimeout(()=>e.remove(),320))}if(o)f({preset:`pro`}),e(async()=>{let{firebaseDb:e,isFirebaseConfigured:t}=await import(`./firebase-BylMgSsD.js`).then(e=>e.n);return{firebaseDb:e,isFirebaseConfigured:t}},__vite__mapDeps([0,1,2])).then(async({firebaseDb:t,isFirebaseConfigured:n})=>{if(!n())return;let{ref:r,onValue:i}=await e(async()=>{let{ref:e,onValue:t}=await import(`./index.esm-DKdodk42.js`).then(e=>e.t);return{ref:e,onValue:t}},__vite__mapDeps([2,1]));i(r(t,`rooms/${o}/settings`),e=>{let t=e.val(),n=t?.global?.musicResponse??t?.tiktok?.musicResponse;n&&f(n)});let a=-1;i(r(t,`rooms/${o}/musicResponse`),e=>{let t=e.val();if(!t||typeof t.seq!=`number`||t.seq===a)return;let n=a===-1;a=t.seq,!n&&t.text&&p(t.text)})}).catch(()=>{});else if(a){f({preset:i.get(`preset`)??void 0,align:i.get(`align`)??`center`,position:i.get(`position`)??`bottom`,durationMs:8e3});let e=[`🎵 sofia_live: «Bad Bunny - Tití Me Preguntó» va en el puesto 3`,`⚠️ carlos_gg: esa canción ya está en la cola`,`⏭️ diego77 saltó la canción`],t=0,n=()=>{p(e[t%e.length]),t++,setTimeout(n,2600)};n()}else f({preset:`pro`}),r(e=>{if(e.type===`music_response`&&e.data){let t=e.data;t.text&&p(t.text)}else if(e.type===`settings`){let t=e.musicResponse;t&&typeof t==`object`&&f(t)}}),fetch(`/api/overlay/settings?platform=`+(i.get(`platform`)??`tiktok`)).then(e=>e.json()).then(e=>{e?.musicResponse&&f(e.musicResponse)}).catch(()=>{});