import type { RouterScrollBehavior } from 'vue-router'

const scrollBehavior: RouterScrollBehavior = (to, from, savedPosition) => {
  if (savedPosition) {
    return savedPosition
  }
  if (to.hash) {
    return { el: to.hash }
  }
  // Preserve current scroll position on navigation (no scroll-to-top)
  return false
}

export default {
  scrollBehavior
}
