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 _7c7dbcee = () => interopDefault(import('../pages/category/index.vue' /* webpackChunkName: "pages/category/index" */))
const _aa3d22f2 = () => interopDefault(import('../pages/media.vue' /* webpackChunkName: "pages/media" */))
const _401b3855 = () => interopDefault(import('../pages/product/index.vue' /* webpackChunkName: "pages/product/index" */))
const _5af35f06 = () => interopDefault(import('../pages/setNewPassword.vue' /* webpackChunkName: "pages/setNewPassword" */))
const _69a8e4bc = () => interopDefault(import('../pages/category/searchResult/index.vue' /* webpackChunkName: "pages/category/searchResult/index" */))
const _96c656d2 = () => interopDefault(import('../pages/home/api.vue' /* webpackChunkName: "pages/home/api" */))
const _6fc9ddc6 = () => interopDefault(import('../pages/home/contact.vue' /* webpackChunkName: "pages/home/contact" */))
const _0f95dfe0 = () => interopDefault(import('../pages/home/contactPromoCollection.vue' /* webpackChunkName: "pages/home/contactPromoCollection" */))
const _7791253d = () => interopDefault(import('../pages/home/currentFlyer/index.vue' /* webpackChunkName: "pages/home/currentFlyer/index" */))
const _5f561110 = () => interopDefault(import('../pages/home/downloadCenter.vue' /* webpackChunkName: "pages/home/downloadCenter" */))
const _5b52961e = () => interopDefault(import('../pages/home/loyaltyProgram.vue' /* webpackChunkName: "pages/home/loyaltyProgram" */))
const _2c1031f3 = () => interopDefault(import('../pages/home/myDetail/index.vue' /* webpackChunkName: "pages/home/myDetail/index" */))
const _385ecf17 = () => interopDefault(import('../pages/home/privacyPolicy.vue' /* webpackChunkName: "pages/home/privacyPolicy" */))
const _702bda68 = () => interopDefault(import('../pages/home/refundReturns.vue' /* webpackChunkName: "pages/home/refundReturns" */))
const _51dd401c = () => interopDefault(import('../pages/home/termsConditions.vue' /* webpackChunkName: "pages/home/termsConditions" */))
const _423a5215 = () => interopDefault(import('../pages/home/myDetail/enquiryDetail.vue' /* webpackChunkName: "pages/home/myDetail/enquiryDetail" */))
const _1e9e4dc0 = () => interopDefault(import('../pages/home/myDetail/orderDetail.vue' /* webpackChunkName: "pages/home/myDetail/orderDetail" */))
const _3084c9f0 = () => interopDefault(import('../pages/home/myDetail/components/orderDetailPart.vue' /* webpackChunkName: "pages/home/myDetail/components/orderDetailPart" */))
const _09a9ff16 = () => interopDefault(import('../pages/index.vue' /* webpackChunkName: "pages/index" */))
const _f6c3813a = () => interopDefault(import('../pages/article/_type.vue' /* webpackChunkName: "pages/article/_type" */))
const _141c59b4 = () => interopDefault(import('../pages/category/_firstCategory/index.vue' /* webpackChunkName: "pages/category/_firstCategory/index" */))
const _c045b4e4 = () => interopDefault(import('../pages/news/_newsName.vue' /* webpackChunkName: "pages/news/_newsName" */))
const _5aa052d9 = () => interopDefault(import('../pages/product-record/_code.vue' /* webpackChunkName: "pages/product-record/_code" */))
const _41e5e94f = () => interopDefault(import('../pages/product/_code.vue' /* webpackChunkName: "pages/product/_code" */))
const _17b97aa6 = () => interopDefault(import('../pages/qrcode/_id.vue' /* webpackChunkName: "pages/qrcode/_id" */))
const _98d6d370 = () => interopDefault(import('../pages/category/_firstCategory/_secondCategory/index.vue' /* webpackChunkName: "pages/category/_firstCategory/_secondCategory/index" */))
const _36fded83 = () => interopDefault(import('../pages/category/_firstCategory/_secondCategory/_thirdCategory/index.vue' /* webpackChunkName: "pages/category/_firstCategory/_secondCategory/_thirdCategory/index" */))
const _88e82796 = () => interopDefault(import('../pages/orderShare/_uid/_aid/_id.vue' /* webpackChunkName: "pages/orderShare/_uid/_aid/_id" */))

const emptyFn = () => {}

Vue.use(Router)

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

  routes: [{
    path: "/category",
    component: _7c7dbcee,
    name: "category"
  }, {
    path: "/media",
    component: _aa3d22f2,
    name: "media"
  }, {
    path: "/product",
    component: _401b3855,
    name: "product"
  }, {
    path: "/setNewPassword",
    component: _5af35f06,
    name: "setNewPassword"
  }, {
    path: "/category/searchResult",
    component: _69a8e4bc,
    name: "category-searchResult"
  }, {
    path: "/home/api",
    component: _96c656d2,
    name: "home-api"
  }, {
    path: "/home/contact",
    component: _6fc9ddc6,
    name: "home-contact"
  }, {
    path: "/home/contactPromoCollection",
    component: _0f95dfe0,
    name: "home-contactPromoCollection"
  }, {
    path: "/home/currentFlyer",
    component: _7791253d,
    name: "home-currentFlyer"
  }, {
    path: "/home/downloadCenter",
    component: _5f561110,
    name: "home-downloadCenter"
  }, {
    path: "/home/loyaltyProgram",
    component: _5b52961e,
    name: "home-loyaltyProgram"
  }, {
    path: "/home/myDetail",
    component: _2c1031f3,
    name: "home-myDetail"
  }, {
    path: "/home/privacyPolicy",
    component: _385ecf17,
    name: "home-privacyPolicy"
  }, {
    path: "/home/refundReturns",
    component: _702bda68,
    name: "home-refundReturns"
  }, {
    path: "/home/termsConditions",
    component: _51dd401c,
    name: "home-termsConditions"
  }, {
    path: "/home/myDetail/enquiryDetail",
    component: _423a5215,
    name: "home-myDetail-enquiryDetail"
  }, {
    path: "/home/myDetail/orderDetail",
    component: _1e9e4dc0,
    name: "home-myDetail-orderDetail"
  }, {
    path: "/home/myDetail/components/orderDetailPart",
    component: _3084c9f0,
    name: "home-myDetail-components-orderDetailPart"
  }, {
    path: "/",
    component: _09a9ff16,
    name: "index"
  }, {
    path: "/article/:type?",
    component: _f6c3813a,
    name: "article-type"
  }, {
    path: "/category/:firstCategory",
    component: _141c59b4,
    name: "category-firstCategory"
  }, {
    path: "/news/:newsName?",
    component: _c045b4e4,
    name: "news-newsName"
  }, {
    path: "/product-record/:code",
    component: _5aa052d9,
    name: "product-record-code"
  }, {
    path: "/product/:code",
    component: _41e5e94f,
    name: "product-code"
  }, {
    path: "/qrcode/:id?",
    component: _17b97aa6,
    name: "qrcode-id"
  }, {
    path: "/category/:firstCategory/:secondCategory",
    component: _98d6d370,
    name: "category-firstCategory-secondCategory"
  }, {
    path: "/category/:firstCategory/:secondCategory/:thirdCategory",
    component: _36fded83,
    name: "category-firstCategory-secondCategory-thirdCategory"
  }, {
    path: "/orderShare/:uid?/:aid?/:id?",
    component: _88e82796,
    name: "orderShare-uid-aid-id"
  }],

  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
}
