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-overlay-root{width:100vw;height:100vh;display:flex;align-items:center;justify-content:flex-start;padding:8px;box-sizing:border-box;overflow:hidden}
/* Tarjeta COMPACTA con ancho acotado (no crece con el título): tamaño natural, sin
   auto-escalado (el escalado por transform se veía mal en las fuentes de LiveStudio).
   El streamer dimensiona la Browser Source como cualquier otra. */
.oi-music{display:flex;align-items:center;gap:12px;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,11px 14px);box-shadow:var(--oi-shadow,0 8px 26px -12px rgba(0,0,0,.6));backdrop-filter:var(--oi-blur,none);
  width:var(--oi-width,340px);max-width:calc(100vw - 16px);box-sizing:border-box;transition:opacity .35s ease}
.oi-music.hidden{opacity:0;pointer-events:none}
.oi-thumb{width:58px;height:58px;border-radius:calc(var(--oi-radius,14px) - 5px);object-fit:cover;flex:0 0 auto;background:rgba(0,0,0,.25)}
.oi-thumb.off{display:none}
.oi-info{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1 1 auto}
.oi-line{display:flex;align-items:center;gap:7px;min-width:0}
/* El título ocupa el ancho disponible de la tarjeta; si no cabe, se desplaza solo. */
.oi-title-wrap{overflow:hidden;white-space:nowrap;min-width:0;flex:1 1 auto;-webkit-mask-image:linear-gradient(90deg,#000 90%,transparent)}
.oi-title{display:inline-block;color:var(--oi-fg,#fff);font-weight:var(--oi-weight,700);font-size:16px;line-height:1.2;white-space:nowrap}
.oi-title.scroll{animation:oi-marquee var(--oi-scroll-dur,10s) linear infinite}
@keyframes oi-marquee{0%,12%{transform:translateX(0)}88%,100%{transform:translateX(var(--oi-scroll-x,0))}}
.oi-artist{color:var(--oi-fg2,rgba(255,255,255,.7));font-size:12.5px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.oi-req{color:var(--oi-accent,#ff2d6f);font-size:12px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.oi-bar{height:4px;border-radius:3px;background:rgba(255,255,255,.2);overflow:hidden;margin-top:3px}
.oi-bar.off{display:none}
.oi-bar>i{display:block;height:100%;width:0;background:var(--oi-accent,#ff2d6f);border-radius:3px;transition:width .25s linear}
/* Ecualizador: 3 barras que solo animan mientras suena (en pausa quedan quietas). */
.oi-eq{display:flex;align-items:flex-end;gap:2px;height:14px;flex:0 0 auto}
.oi-eq.off{display:none}
.oi-eq>span{width:3px;background:var(--oi-accent,#ff2d6f);border-radius:1px;height:4px}
.oi-music.playing .oi-eq>span{animation:oi-eq .9s ease-in-out infinite}
.oi-music.playing .oi-eq>span:nth-child(2){animation-delay:.15s}
.oi-music.playing .oi-eq>span:nth-child(3){animation-delay:.3s}
@keyframes oi-eq{0%,100%{height:4px}50%{height:14px}}
`,document.head.appendChild(s);var c=document.getElementById(`music-overlay-root`);c.innerHTML=`
  <div class="oi-music hidden" id="card">
    <img class="oi-thumb" id="thumb" alt="" />
    <div class="oi-info">
      <div class="oi-line">
        <div class="oi-eq" id="eq"><span></span><span></span><span></span></div>
        <div class="oi-title-wrap"><span class="oi-title" id="title"></span></div>
      </div>
      <div class="oi-artist" id="artist"></div>
      <div class="oi-req" id="req"></div>
      <div class="oi-bar" id="bar"><i id="fill"></i></div>
    </div>
  </div>`;var l=document.getElementById(`card`),u=document.getElementById(`thumb`),d=document.getElementById(`title`),f=document.getElementById(`artist`),p=document.getElementById(`req`),m=document.getElementById(`bar`),h=document.getElementById(`fill`),g=document.getElementById(`eq`),_={showThumb:!0,showProgress:!0,showRequester:!0,showEq:!0,hideWhenIdle:!0,align:`center`},v=null,y=!1,b=0,x=0,S=null,C=``;function w(e){return t.find(t=>t.id===e)??t.find(e=>e.id===`pro`)}function T(e){_={..._,...e},n(c,w(_.preset),_.vars),u.classList.toggle(`off`,_.showThumb===!1),m.classList.toggle(`off`,_.showProgress===!1),g.classList.toggle(`off`,_.showEq===!1),c.style.justifyContent=_.align===`center`?`center`:_.align===`right`?`flex-end`:`flex-start`,D()}function E(){d.classList.remove(`scroll`),d.style.removeProperty(`--oi-scroll-x`);let e=d.parentElement;setTimeout(()=>{let t=d.scrollWidth-e.clientWidth;t>4&&(d.style.setProperty(`--oi-scroll-x`,`-${t+8}px`),d.style.setProperty(`--oi-scroll-dur`,`${Math.max(8,(t+8)/22)}s`),d.classList.add(`scroll`))},0)}function D(){let e=!!v&&(!_.hideWhenIdle||y||b>0);if(l.classList.toggle(`hidden`,!e),l.classList.toggle(`playing`,y),!v)return;v.track.videoId!==C&&(C=v.track.videoId,d.textContent=v.track.title,f.textContent=v.track.artist,u.src=v.track.thumbnail||``,E());let t=_.showRequester===!1?``:v.requestedBy??``;p.textContent=t?`♪ ${t}`:``,p.style.display=t?`block`:`none`,O()}function O(){let e=v?.track.durationSec??0,t=y&&x?(Date.now()-x)/1e3:0,n=b+t;h.style.width=e>0?`${Math.min(100,n/e*100)}%`:`0%`}function k(){O(),S=y?requestAnimationFrame(k):null}function A(){y&&S==null?S=requestAnimationFrame(k):y||(S!=null&&cancelAnimationFrame(S),S=null,O())}function j(e){v=e.current??null,y=!!e.playing,b=e.positionSec??0,x=e.atUtc??Date.now(),v||(C=``),D(),A()}function M(e){if(e)try{return JSON.parse(decodeURIComponent(escape(atob(e))))}catch{return}}o?(T({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?.music??t?.tiktok?.music;n&&T(n)}),i(r(t,`rooms/${o}/musicState`),e=>{let t=e.val();t&&j(t)})}).catch(()=>{})):a?(T({preset:i.get(`preset`)??void 0,vars:M(i.get(`vars`)),showThumb:i.get(`thumb`)!==`0`,showProgress:i.get(`prog`)!==`0`,showRequester:i.get(`req`)!==`0`,showEq:i.get(`eq`)!==`0`,hideWhenIdle:!1,align:i.get(`align`)??`left`}),j({current:{track:{videoId:`demo`,title:`Wisin & Yandel - Abusadora (Official Video)`,artist:`Wisin & Yandel`,durationSec:205,thumbnail:`https://i.ytimg.com/vi/dQw4w9WgXcQ/mqdefault.jpg`},requestedBy:`sofia_live`},playing:!0,positionSec:42,atUtc:Date.now()})):(T({preset:`pro`}),r(e=>{if(e.type===`music_state`&&e.data)j(e.data);else if(e.type===`settings`){let t=e.music;t&&typeof t==`object`&&T(t)}}),fetch(`/api/music/state`).then(e=>e.json()).then(e=>{e&&j(e)}).catch(()=>{}),fetch(`/api/overlay/settings?platform=`+(i.get(`platform`)??`tiktok`)).then(e=>e.json()).then(e=>{e?.music&&T(e.music)}).catch(()=>{}));