<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="Cache-Control" content="max-age=0, no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover" />
    <meta name="theme-color" content="#1d0e09" />
    <meta name="description" content="B2cgamex - Best Betting Exchange In The World" />
    <meta property="og:description" content="B2cgamex - Best Betting Exchange In The World" />
    <meta property="og:image" content="https://www.B2cgamex.bet/pub-images/big-icon-black.png" />
    <meta property="og:title" content="B2cgamex - Best Betting Exchange In The World" />
    <link rel="apple-touch-icon" href="/apple-touch-icon-180x180.png" />
    <link rel="manifest" href="/manifest.json" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="default" />
    <title>B2cgamex - Best Betting &amp; Exchange In The World</title>
    <style>
      html, body, #root, * {
        font-family: "Helvetica Neue", Helvetica, Tahoma, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif !important;
      }
    </style>
    <script type="module" crossorigin src="/assets/index-DXM4gTm7.js"></script>
    <link rel="modulepreload" crossorigin href="/assets/router-Ddok-hwH.js">
    <link rel="modulepreload" crossorigin href="/assets/axios-pq11cPKX.js">
    <link rel="modulepreload" crossorigin href="/assets/cryptoJs-DCwvW4cq.js">
    <link rel="modulepreload" crossorigin href="/assets/reactIcons-DNHl4NhJ.js">
    <link rel="modulepreload" crossorigin href="/assets/reactSpinners-CCTzRy5V.js">
    <link rel="modulepreload" crossorigin href="/assets/swiper-0Bagd7M4.js">
    <link rel="modulepreload" crossorigin href="/assets/reactDayPicker-Cgf9s60U.js">
    <link rel="modulepreload" crossorigin href="/assets/reactUse-BABRPvv9.js">
    <link rel="modulepreload" crossorigin href="/assets/reactQrcodeLogo-Cp88rTNE.js">
    <link rel="stylesheet" crossorigin href="/assets/index-BgsO4o39.css">
  <link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
  <body class="betsbuzz365" id="body">
    <div id="root"></div>
    
     <!-- Health & Recovery Script -->
    <script type="text/javascript">
      ;(function () {
        // --- 1. Inactivity Reload (30 min) ---
        let timeout
        const resetInactivity = () => {
          clearTimeout(timeout)
          timeout = setTimeout(() => {
            console.log('Inactivity limit reached. Reloading...')
            window.location.reload()
          }, 1800000) // 30 minutes
        }

        const events = [
          'click',
          'mousemove',
          'keypress',
          'touchstart',
          'scroll',
        ]
        events.forEach((e) =>
          window.addEventListener(e, resetInactivity, { passive: true }),
        )
        resetInactivity()

        // --- 2. Error Recovery Logic ---
        const handleFailure = (error) => {
          const message = (error || '').toString().toLowerCase()

          // Only reload on genuine module/chunk loading failures
          const triggers = [
            'importing a module script failed',
            'failed to fetch dynamically imported module',
            'error loading dynamically imported module',
            'expected a javascript',
            'mime type',
            'load failed',
            'chunkloaderror'
          ]

          const shouldReload = triggers.some((t) => message.includes(t))

          if (shouldReload) {
            const MAX_AUTO_RELOADS = 2
            const attempts = parseInt(sessionStorage.getItem('recovery-reload-attempts') || '0', 10)

            // Hard cap on top of the time buffer so a persistent failure
            // (e.g. a genuinely broken deploy) surfaces as an error instead
            // of reloading forever.
            const lastReload = sessionStorage.getItem('last-recovery-reload')
            const now = Date.now()

            if (attempts < MAX_AUTO_RELOADS && (!lastReload || now - parseInt(lastReload) > 30000)) {
              sessionStorage.setItem('last-recovery-reload', now.toString())
              sessionStorage.setItem('recovery-reload-attempts', String(attempts + 1))

              // Cache-busting reload to bypass Cloudflare/browser aggressive caching
              const url = new URL(window.location.href)
              url.searchParams.set('recover', now.toString())
              window.location.href = url.toString()
            }
          }
        }

        // Clean up the recover parameter from the URL so it looks clean to the user
        if (window.location.search.includes('recover=')) {
          const cleanUrl = new URL(window.location.href)
          cleanUrl.searchParams.delete('recover')
          window.history.replaceState(null, '', cleanUrl.toString())
        }

        // Catch global errors (MIME, Network, Syntax)
        window.addEventListener(
          'error',
          (e) => {
            // Resource-loading failures (e.g. a <script> tag that 404s and
            // gets served index.html by the SPA rewrite, triggering a MIME
            // type mismatch) never populate e.message - the browser only
            // logs that reason to the console, not to script listeners.
            // e.target is a SCRIPT element in that case, so treat any
            // failed script load as a stale-build signal on its own,
            // instead of relying on message-text matching that can never
            // match a bare URL.
            if (e.target && e.target.tagName === 'SCRIPT') {
              handleFailure('chunkloaderror')
              return
            }
            handleFailure(e.message)
          },
          true,
        )

        // Catch Promise/Async errors
        window.addEventListener('unhandledrejection', (e) => {
          handleFailure((e.reason && e.reason.message) || e.reason)
        })
      })()
    </script>

    <script type="application/javascript">
      const domain = window.location.host;
      localStorage.removeItem(domain+".siteSettings");
      localStorage.openpages = Date.now();
    </script>
  </body>
</html>
