<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/letgostroke.png" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
    <meta name="theme-color" content="#080a14" />
    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Rajdhani:wght@500;600;700&display=swap" rel="stylesheet" />
    <title>LetGo HQ Hub</title>
    <meta name="description" content="Earn LGC, play games, and win rewards on LetGo HQ Hub." />
    <meta property="og:title" content="LetGo HQ Hub" />
    <meta property="og:description" content="Earn LGC, play games, and win rewards on LetGo HQ Hub." />
    <meta property="og:type" content="website" />
    <script type="module" crossorigin src="/assets/index-CNA_wJbo.js"></script>
    <link rel="stylesheet" crossorigin href="/assets/index-sHQV7eZV.css">
  </head>
  <body>
    <div id="root"></div>
    <div id="boot-fallback" style="display:none;position:fixed;inset:0;z-index:999;background:#080a14;color:#e6e9f2;font-family:Inter,system-ui,sans-serif;align-items:center;justify-content:center;padding:24px;text-align:center;">
      <div style="max-width:420px;">
        <div style="font-size:20px;font-weight:700;margin-bottom:8px;letter-spacing:-0.01em;">LetGo HQ Hub</div>
        <div style="font-size:14px;opacity:0.7;line-height:1.5;margin-bottom:20px;">We hit a snag loading the latest version. Tap below to refresh and pick up the newest build.</div>
        <button id="boot-fallback-btn" style="background:#22c55e;color:#0b0f1a;border:0;border-radius:10px;padding:12px 22px;font-weight:700;font-size:14px;cursor:pointer;">Reload app</button>
      </div>
    </div>
    <script>
      (function () {
        var FLAG = 'hub_stale_chunk_reload_at';
        var COOLDOWN_MS = 30000;
        var BOOT_WATCHDOG_MS = 10000;
        function isChunkError(msg, src) {
          var s = String(msg || '');
          if (/ChunkLoadError|Loading chunk|Failed to fetch dynamically imported module|Importing a module script failed|Expected a JavaScript-or-Wasm module script|MIME type|Unexpected token '<'|Unexpected token <|SyntaxError/i.test(s)) return true;
          if (src && /\/assets\//.test(String(src))) return true;
          return false;
        }
        function canRecover() {
          try {
            var last = parseInt(sessionStorage.getItem(FLAG) || '0', 10) || 0;
            if (Date.now() - last < COOLDOWN_MS) return false;
            sessionStorage.setItem(FLAG, String(Date.now()));
          } catch (_) {}
          return true;
        }
        function hardReload() {
          var done = false;
          function finish() {
            if (done) return;
            done = true;
            try { location.reload(); } catch (_) { location.href = location.href; }
          }
          var pending = [];
          try {
            if (window.caches && caches.keys) {
              pending.push(caches.keys().then(function (keys) {
                return Promise.all(keys.map(function (k) { return caches.delete(k); }));
              }).catch(function () {}));
            }
          } catch (_) {}
          try {
            if (navigator.serviceWorker && navigator.serviceWorker.getRegistrations) {
              pending.push(navigator.serviceWorker.getRegistrations().then(function (regs) {
                return Promise.all(regs.map(function (r) { return r.unregister().catch(function () {}); }));
              }).catch(function () {}));
            }
          } catch (_) {}
          setTimeout(finish, 1500);
          if (pending.length) {
            Promise.all(pending).then(finish).catch(finish);
          } else {
            finish();
          }
        }
        function recover(msg, src) {
          if (!isChunkError(msg, src)) return;
          if (!canRecover()) return;
          hardReload();
        }
        window.addEventListener('error', function (e) {
          var msg = (e && (e.message || (e.error && e.error.message))) || '';
          var src = (e && (e.filename || (e.target && (e.target.src || e.target.href)))) || '';
          recover(msg, src);
        }, true);
        window.addEventListener('unhandledrejection', function (e) {
          recover((e && e.reason && (e.reason.message || e.reason)) || '', '');
        });
        function showFallback() {
          try {
            var root = document.getElementById('root');
            if (root && root.children && root.children.length > 0) return;
            var fb = document.getElementById('boot-fallback');
            if (!fb) return;
            fb.style.display = 'flex';
            var btn = document.getElementById('boot-fallback-btn');
            if (btn) {
              btn.addEventListener('click', function () {
                try { sessionStorage.removeItem(FLAG); } catch (_) {}
                hardReload();
              });
            }
          } catch (_) {}
        }
        setTimeout(showFallback, BOOT_WATCHDOG_MS);
      })();
    </script>
  </body>
</html>
