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-queue-overlay-root{width:100vw;height:100vh;display:flex;align-items:center;padding:8px;box-sizing:border-box;overflow:hidden}
.oi-q{font-family:var(--oi-font,system-ui,sans-serif);background:var(--oi-bg,rgba(18,18,24,.82));
  border:var(--oi-border,none);border-radius:var(--oi-radius,14px);padding:var(--oi-pad,10px 12px);
  box-shadow:var(--oi-shadow,0 8px 26px -12px rgba(0,0,0,.6));backdrop-filter:var(--oi-blur,none);
  width:var(--oi-width,320px);max-width:calc(100vw - 16px);box-sizing:border-box;display:flex;flex-direction:column;gap:8px;
  transition:opacity .35s ease}
.oi-q.hidden{opacity:0;pointer-events:none}
.oi-q-title{display:flex;align-items:center;gap:7px;color:var(--oi-fg,#fff);font-weight:var(--oi-weight,700);font-size:13px;letter-spacing:.04em}
.oi-q-title .cnt{color:var(--oi-fg2,rgba(255,255,255,.6));font-weight:600;font-size:11px}
.oi-q-list{display:flex;flex-direction:column;gap:6px}
.oi-q-row{display:flex;align-items:center;gap:9px;min-width:0}
.oi-q-n{width:16px;text-align:center;color:var(--oi-fg2,rgba(255,255,255,.5));font-size:12px;font-weight:700;flex:0 0 auto;font-variant-numeric:tabular-nums}
.oi-q-th{width:38px;height:38px;border-radius:8px;object-fit:cover;flex:0 0 auto;background:rgba(0,0,0,.25)}
.oi-q-th.off{display:none}
.oi-q-info{min-width:0;flex:1 1 auto;display:flex;flex-direction:column;gap:1px}
.oi-q-name{color:var(--oi-fg,#fff);font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.oi-q-sub{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.oi-q-sub .by{color:var(--oi-accent,#ff2d6f);font-weight:700}
.oi-q-sub .pl{color:var(--oi-fg2,rgba(255,255,255,.5))}
.oi-q-sub .ar{color:var(--oi-fg2,rgba(255,255,255,.6))}
.oi-q-dur{color:var(--oi-fg2,rgba(255,255,255,.55));font-size:11px;flex:0 0 auto;font-variant-numeric:tabular-nums}
.oi-q-empty{color:var(--oi-fg2,rgba(255,255,255,.5));font-size:12px;padding:2px 2px 4px}
`,document.head.appendChild(s);var c=document.getElementById(`music-queue-overlay-root`);c.innerHTML=`<div class="oi-q hidden" id="card"><div class="oi-q-title" id="head"></div><div class="oi-q-list" id="list"></div></div>`;var l=document.getElementById(`card`),u=document.getElementById(`head`),d=document.getElementById(`list`),f={title:``,showThumb:!0,showIndex:!0,showRequester:!0,maxItems:5,hideWhenEmpty:!0,align:`center`},p=[];function m(e){return t.find(t=>t.id===e)??t.find(e=>e.id===`pro`)}function h(e){if(!isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,`0`)}`}function g(e){return e.replace(/[&<>"]/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`})[e])}function _(e){f={...f,...e},n(c,m(f.preset),f.vars),c.style.justifyContent=f.align===`center`?`center`:f.align===`right`?`flex-end`:`flex-start`,v()}function v(){let e=Math.max(1,Math.min(20,f.maxItems??5)),t=p.slice(0,e),n=t.length>0||f.hideWhenEmpty===!1;if(l.classList.toggle(`hidden`,!n),n){if(u.innerHTML=`<span>${g(f.title||`A continuación`)}</span>`+(p.length?`<span class="cnt">${p.length}</span>`:``),t.length===0){d.innerHTML=`<div class="oi-q-empty">La cola está vacía</div>`;return}d.innerHTML=t.map((e,t)=>{let n=f.showIndex===!1?``:`<span class="oi-q-n">${t+1}</span>`,r=f.showThumb===!1?``:`<img class="oi-q-th" src="${g(e.track.thumbnail||``)}" alt="" onerror="this.style.visibility='hidden'" />`,i;i=e.source===`playlist`?`<span class="pl">♪ Lista</span> · <span class="ar">${g(e.track.artist)}</span>`:f.showRequester!==!1&&e.requestedBy?`<span class="by">♪ ${g(e.requestedBy)}</span> · <span class="ar">${g(e.track.artist)}</span>`:`<span class="ar">${g(e.track.artist)}</span>`;let a=e.track.durationSec?`<span class="oi-q-dur">${h(e.track.durationSec)}</span>`:``;return`<div class="oi-q-row">${n}${r}<div class="oi-q-info"><span class="oi-q-name">${g(e.track.title)}</span><span class="oi-q-sub">${i}</span></div>${a}</div>`}).join(``)}}function y(e){Array.isArray(e.queue)&&(p=e.queue),v()}function b(e){if(e)try{return JSON.parse(decodeURIComponent(escape(atob(e))))}catch{return}}o?(_({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?.musicQueue??t?.tiktok?.musicQueue;n&&_(n)}),i(r(t,`rooms/${o}/musicState`),e=>{let t=e.val();t?.queue&&y(t)})}).catch(()=>{})):a?(_({preset:i.get(`preset`)??void 0,vars:b(i.get(`vars`)),title:i.get(`title`)??``,showThumb:i.get(`thumb`)!==`0`,showIndex:i.get(`idx`)!==`0`,showRequester:i.get(`req`)!==`0`,maxItems:Number(i.get(`max`)??`5`),hideWhenEmpty:!1,align:i.get(`align`)??`left`}),y({queue:[{track:{videoId:`1`,title:`Jey One - Fuego`,artist:`Jey One`,durationSec:146,thumbnail:`https://i.ytimg.com/vi/dQw4w9WgXcQ/mqdefault.jpg`},requestedBy:`dacreth`,source:`request`},{track:{videoId:`2`,title:`FARIANA - A Fuego`,artist:`FARIANA`,durationSec:195,thumbnail:``},requestedBy:`lizdaneth`,source:`request`},{track:{videoId:`3`,title:`Aventura - Los Infieles`,artist:`Aventura`,durationSec:279,thumbnail:``},source:`playlist`},{track:{videoId:`4`,title:`Don Omar - Danza Kuduro`,artist:`Don Omar`,durationSec:218,thumbnail:``},source:`playlist`}]})):(_({preset:`pro`}),r(e=>{if(e.type===`music_state`&&e.data)y(e.data);else if(e.type===`settings`){let t=e.musicQueue;t&&typeof t==`object`&&_(t)}}),fetch(`/api/music/state`).then(e=>e.json()).then(e=>{e?.queue&&y(e)}).catch(()=>{}),fetch(`/api/overlay/settings?platform=`+(i.get(`platform`)??`tiktok`)).then(e=>e.json()).then(e=>{e?.musicQueue&&_(e.musicQueue)}).catch(()=>{}));