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";var t=new URLSearchParams(location.search),n=t.get(`platform`),r=t.get(`position`)||`bottom-center`,i=Math.max(1500,parseInt(t.get(`duration`)||`6000`,10)||6e3),a=Math.max(1,parseInt(t.get(`max`)||`4`,10)||4),o=parseFloat(t.get(`scale`)||`1`)||1,s=Math.max(8,parseInt(t.get(`fontSize`)||t.get(`font`)||`15`,10)||15),c=[`1`,`true`,`yes`,`on`].includes((t.get(`shadow`)||``).toLowerCase()),l=Math.max(10,parseInt(t.get(`costSize`)||`26`,10)||26),u=t.get(`cost`)!==`0`,d=(t.get(`font`)||t.get(`fontFamily`)||`Inter`).replace(/['"]/g,``).trim()||`Inter`;{let e=document.createElement(`link`);e.rel=`stylesheet`,e.href=`https://fonts.googleapis.com/css2?family=${encodeURIComponent(d).replace(/%20/g,`+`)}:wght@400;600;700;800&display=swap`,document.head.appendChild(e)}var f={recharge:{icon:`🪙`,color:`#22c55e`},spend:{icon:`✅`,color:`#7c72e8`},transfer:{icon:`🔁`,color:`#38bdf8`},insufficient:{icon:`⚠️`,color:`#f59e0b`},balance:{icon:`💬`,color:`#7c72e8`}},[p,m]=r.split(`-`),h=document.createElement(`style`);h.textContent=`
  html, body { margin: 0; background: transparent; overflow: hidden; }
  #economy-overlay-root {
    position: fixed; inset: 0; pointer-events: none;
    display: flex; padding: 22px;
    align-items: ${p===`top`?`flex-start`:`flex-end`};
    justify-content: ${m===`left`?`flex-start`:m===`right`?`flex-end`:`center`};
    font-family: "${d}", system-ui, -apple-system, "Segoe UI", sans-serif;
  }
  .ec-stack {
    display: flex; flex-direction: ${p===`top`?`column`:`column-reverse`};
    gap: 8px; transform: scale(${o});
    transform-origin: ${p} ${m===`center`?`center`:m};
  }
  .ec-toast {
    display: flex; align-items: center; gap: 10px;
    max-width: 460px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(14, 12, 20, 0.92);
    border: 1px solid rgba(255,255,255,0.10);
    border-left: 4px solid var(--ec-accent, #7c72e8);
    box-shadow: 0 6px 22px rgba(0,0,0,0.45);
    color: #fff;
    line-height: 1.25;
    animation: ec-in .28s cubic-bezier(.2,1.2,.3,1) both;
  }
  .ec-toast.ec-out { animation: ec-out .3s ease-in both; }
  .ec-icon { font-size: 20px; line-height: 1; flex-shrink: 0; }
  .ec-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .ec-text { font-size: ${s}px; font-weight: 600;${c?` text-shadow: 0 1px 2px rgba(0,0,0,.8);`:``} word-break: break-word; }
  .ec-cost { font-size: ${l}px; font-weight: 800; line-height: 1.1; color: var(--ec-accent, #7c72e8);${c?` text-shadow: 0 1px 2px rgba(0,0,0,.8);`:``} }
  @keyframes ec-in  { from { opacity: 0; transform: translateY(${p===`top`?`-10px`:`10px`}) scale(.96); } to { opacity: 1; transform: none; } }
  @keyframes ec-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(${p===`top`?`-8px`:`8px`}) scale(.96); } }
`,document.head.appendChild(h);var g=document.getElementById(`economy-overlay-root`),_=document.createElement(`div`);_.className=`ec-stack`,g.appendChild(_);function v(e){let t=f[e.kind||``]??f.balance,n=document.createElement(`div`);n.className=`ec-toast`,n.style.setProperty(`--ec-accent`,t.color);let r=document.createElement(`span`);r.className=`ec-icon`,r.textContent=t.icon;let o=document.createElement(`div`);o.className=`ec-body`;let s=document.createElement(`span`);if(s.className=`ec-text`,s.textContent=e.text||``,o.appendChild(s),u&&e.amount){let t=document.createElement(`span`);t.className=`ec-cost`,t.textContent=e.amount,o.appendChild(t)}for(n.appendChild(r),n.appendChild(o),_.appendChild(n);_.childElementCount>a;)_.firstElementChild?.remove();window.setTimeout(()=>{n.classList.add(`ec-out`),window.setTimeout(()=>n.remove(),320)},i)}var y=null,b=1e3;function x(){let e=location.protocol===`https:`?`wss:`:`ws:`;y=new WebSocket(`${e}//${location.host}/ws`),y.onopen=()=>{b=1e3},y.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(t.type!==`economy_response`||!t.data)return;let r=t.data;n&&r.platform&&r.platform!==n||r.text&&v(r)},y.onclose=()=>{y=null,window.setTimeout(x,b),b=Math.min(b*2,15e3)},y.onerror=()=>{try{y?.close()}catch{}}}var S=t.get(`uid`);S?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:r})=>{if(!r())return;let{ref:i,onValue:a}=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])),o=null;a(i(t,`rooms/${S}/economyEvent`),e=>{let t=e.val();if(!t)return;let r=t.seq??0;if(o===null){o=r;return}r!==o&&(o=r,!(n&&t.platform&&t.platform!==n)&&t.text&&v(t))})}).catch(()=>{}):x();