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 _5a0da5ee = () => interopDefault(import('../pages/about.vue' /* webpackChunkName: "pages/about" */))
const _c8db08aa = () => interopDefault(import('../pages/Admin.vue' /* webpackChunkName: "pages/Admin" */))
const _770c6145 = () => interopDefault(import('../pages/Authorize.vue' /* webpackChunkName: "pages/Authorize" */))
const _45ff9368 = () => interopDefault(import('../pages/export.vue' /* webpackChunkName: "pages/export" */))
const _33cacac5 = () => interopDefault(import('../pages/Login.vue' /* webpackChunkName: "pages/Login" */))
const _47303708 = () => interopDefault(import('../pages/my_events.vue' /* webpackChunkName: "pages/my_events" */))
const _4b18c812 = () => interopDefault(import('../pages/Register.vue' /* webpackChunkName: "pages/Register" */))
const _0f2ecb5c = () => interopDefault(import('../pages/search.vue' /* webpackChunkName: "pages/search" */))
const _564c1557 = () => interopDefault(import('../pages/settings.vue' /* webpackChunkName: "pages/settings" */))
const _195b1870 = () => interopDefault(import('../pages/embed/list.vue' /* webpackChunkName: "pages/embed/list" */))
const _1a9df064 = () => interopDefault(import('../pages/index.vue' /* webpackChunkName: "pages/index" */))
const _62977877 = () => interopDefault(import('../pages/add/_edit.vue' /* webpackChunkName: "pages/add/_edit" */))
const _7dd19ea6 = () => interopDefault(import('../pages/announcement/_id.vue' /* webpackChunkName: "pages/announcement/_id" */))
const _ef486400 = () => interopDefault(import('../pages/collection/_collection.vue' /* webpackChunkName: "pages/collection/_collection" */))
const _51166df6 = () => interopDefault(import('../pages/embed/_event_id.vue' /* webpackChunkName: "pages/embed/_event_id" */))
const _3ecdeb5e = () => interopDefault(import('../pages/event/_slug.vue' /* webpackChunkName: "pages/event/_slug" */))
const _75bed2b2 = () => interopDefault(import('../pages/p/_slug.vue' /* webpackChunkName: "pages/p/_slug" */))
const _3d8699dd = () => interopDefault(import('../pages/recover/_code.vue' /* webpackChunkName: "pages/recover/_code" */))
const _26e68b07 = () => interopDefault(import('../pages/setup/_db.vue' /* webpackChunkName: "pages/setup/_db" */))
const _601c8a38 = () => interopDefault(import('../pages/tag/_tag.vue' /* webpackChunkName: "pages/tag/_tag" */))
const _fee2b706 = () => interopDefault(import('../pages/user_confirm/_code.vue' /* webpackChunkName: "pages/user_confirm/_code" */))
const _7f7ac039 = () => interopDefault(import('../pages/place/_id/_place.vue' /* webpackChunkName: "pages/place/_id/_place" */))

const emptyFn = () => {}

Vue.use(Router)

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

  routes: [{
    path: "/about",
    component: _5a0da5ee,
    name: "about"
  }, {
    path: "/Admin",
    component: _c8db08aa,
    name: "Admin"
  }, {
    path: "/Authorize",
    component: _770c6145,
    name: "Authorize"
  }, {
    path: "/export",
    component: _45ff9368,
    name: "export"
  }, {
    path: "/Login",
    component: _33cacac5,
    name: "Login"
  }, {
    path: "/my_events",
    component: _47303708,
    name: "my_events"
  }, {
    path: "/Register",
    component: _4b18c812,
    name: "Register"
  }, {
    path: "/search",
    component: _0f2ecb5c,
    name: "search"
  }, {
    path: "/settings",
    component: _564c1557,
    name: "settings"
  }, {
    path: "/embed/list",
    component: _195b1870,
    name: "embed-list"
  }, {
    path: "/",
    component: _1a9df064,
    name: "index"
  }, {
    path: "/add/:edit?",
    component: _62977877,
    name: "add-edit"
  }, {
    path: "/announcement/:id?",
    component: _7dd19ea6,
    name: "announcement-id"
  }, {
    path: "/collection/:collection?",
    component: _ef486400,
    name: "collection-collection"
  }, {
    path: "/embed/:event_id?",
    component: _51166df6,
    name: "embed-event_id"
  }, {
    path: "/event/:slug?",
    component: _3ecdeb5e,
    name: "event-slug"
  }, {
    path: "/p/:slug?",
    component: _75bed2b2,
    name: "p-slug"
  }, {
    path: "/recover/:code?",
    component: _3d8699dd,
    name: "recover-code"
  }, {
    path: "/setup/:db?",
    component: _26e68b07,
    name: "setup-db"
  }, {
    path: "/tag/:tag?",
    component: _601c8a38,
    name: "tag-tag"
  }, {
    path: "/user_confirm/:code?",
    component: _fee2b706,
    name: "user_confirm-code"
  }, {
    path: "/place/:id?/:place?",
    component: _7f7ac039,
    name: "place-id-place"
  }],

  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
}
