export const PUBLIC_PATHS = Object.freeze([
  '/',
  '/loading',
  '/about',
  '/apply',
  '/not_app',
  '/map',
  '/404',
  '/error',
  '/top-list',
  '/weekly-star',
  '/ranking',
  '/games-king',
  '/couple',
  '/cp-reward',
  '/invitation-to-register',
  '/invitation/invite-new-user',
  '/recharge-reward',
  '/login-reward',
  '/activities/poker-ace',
  '/daily-recharge',
  '/activities/games/the-greedy-king',
  '/activities/gulben-festival',
  '/activities/bounty-football',
  '/activities/world-cup',
  '/activities/world-cup/event-detail',
  '/activities/lucky-dollars-season5',
  '/activities/lucky-dollars-season4',
  '/activities/lesser-bairam',
  '/activities/lucky-dollars-season3',
  '/activities/spring-festival',
  '/recharge',
  '/recharge-pay-way',
  '/recharge-guide',
  '/recharge-agency-recruit',
  '/pay-result',
  '/search-payee',
  '/cash-withdraw',
  '/cash-out',
  '/cash-out-details',
  '/KYC',
  '/bank-card',
  '/good-ID',
])

export function normalizePath(path = '') {
  const normalizedPath = String(path || '/')
    .split('?')[0]
    .trim()

  if (!normalizedPath) {
    return '/'
  }

  return normalizedPath.startsWith('/') ? normalizedPath : `/${normalizedPath}`
}

export function isPublicPath(path = '') {
  return PUBLIC_PATHS.includes(normalizePath(path))
}

export function getCurrentHashPath() {
  const hashPath = window.location.hash.replace(/^#/, '')
  return normalizePath(hashPath || '/')
}
