import Vue from 'vue'
import Router from 'vue-router'
import { normalizeURL, decode } from 'ufo'
import { interopDefault } from './utils'
import scrollBehavior from './router.scrollBehavior.js'

const _294a513f = () => interopDefault(import('..\\pages\\association\\index.vue' /* webpackChunkName: "pages/association/index" */))
const _110b9b8e = () => interopDefault(import('..\\pages\\classic\\index.vue' /* webpackChunkName: "pages/classic/index" */))
const _683e67b2 = () => interopDefault(import('..\\pages\\editor\\index.vue' /* webpackChunkName: "pages/editor/index" */))
const _6407bd6c = () => interopDefault(import('..\\pages\\joinus\\index.vue' /* webpackChunkName: "pages/joinus/index" */))
const _0819c62c = () => interopDefault(import('..\\pages\\word\\index.vue' /* webpackChunkName: "pages/word/index" */))
const _062accae = () => interopDefault(import('..\\pages\\info\\_id.vue' /* webpackChunkName: "pages/info/_id" */))
const _05c20866 = () => interopDefault(import('..\\pages\\searchInfo\\_id.vue' /* webpackChunkName: "pages/searchInfo/_id" */))
const _6fc9a934 = () => interopDefault(import('..\\pages\\index.vue' /* webpackChunkName: "pages/index" */))

const emptyFn = () => {}

Vue.use(Router)

export const routerOptions = {
  mode: 'history',
  base: '/',
  linkActiveClass: 'nuxt-link-active',
  linkExactActiveClass: 'nuxt-link-exact-active',
  scrollBehavior,

  routes: [{
    path: "/association",
    component: _294a513f,
    name: "association"
  }, {
    path: "/classic",
    component: _110b9b8e,
    name: "classic"
  }, {
    path: "/editor",
    component: _683e67b2,
    name: "editor"
  }, {
    path: "/joinus",
    component: _6407bd6c,
    name: "joinus"
  }, {
    path: "/word",
    component: _0819c62c,
    name: "word"
  }, {
    path: "/info/:id?",
    component: _062accae,
    name: "info-id"
  }, {
    path: "/searchInfo/:id?",
    component: _05c20866,
    name: "searchInfo-id"
  }, {
    path: "/",
    component: _6fc9a934,
    name: "index"
  }],

  fallback: false
}

export function createRouter (ssrContext, config) {
  const base = (config._app && config._app.basePath) || routerOptions.base
  const router = new Router({ ...routerOptions, base  })

  // TODO: remove in Nuxt 3
  const originalPush = router.push
  router.push = function push (location, onComplete = emptyFn, onAbort) {
    return originalPush.call(this, location, onComplete, onAbort)
  }

  const resolve = router.resolve.bind(router)
  router.resolve = (to, current, append) => {
    if (typeof to === 'string') {
      to = normalizeURL(to)
    }
    return resolve(to, current, append)
  }

  return router
}
