import App from "./App.vue";

import router from "./router";
import store from './store'
import {
  getToken, removeToken
} from '@/utils/auth'
import VideoPlayer from 'vue-video-player'
require('vue-video-player/src/custom-theme.css')
require('video.js/dist/video-js.css')

const hls = require("videojs-contrib-hls")
import * as filters from './filters' // global filters
import Components from "./components";
Vue.use(Components);
// register global utility filters
// import {
//   InputNumber
// } from 'element-ui';
// import 'element-ui/lib/theme-chalk/index.css';
// Vue.component(InputNumber.name, InputNumber);
import {
  AddressList,
  Toast,
  Form,
  Field,
  Button,
  Icon,
  PullRefresh,
  List,
  Popup,
  ActionSheet,
  Tab,
  Tabs,
  Cell,
  CellGroup,
  Image as VanImage,
  RadioGroup,
  Radio,
  Picker,
  Calendar,
  Area,
  Uploader,
  Col,
  Row,
  NavBar,
  Lazyload,
  Skeleton,
  DatetimePicker,
  Dialog,
  Step,
  Steps,
  Tag,
  Checkbox,
  CheckboxGroup,
  Sticky,
  NumberKeyboard,
  PasswordInput,
  search,
  Swipe,
  SwipeItem,
  SubmitBar
} from "vant";
Vue.use(Toast)
  .use(Form)
  .use(Field)
  .use(Button)
  .use(Icon)
  .use(PullRefresh)
  .use(List)
  .use(Popup)
  .use(ActionSheet)
  .use(Tab)
  .use(Tabs)
  .use(Cell)
  .use(CellGroup)
  .use(VanImage)
  .use(RadioGroup)
  .use(Radio)
  .use(Picker)
  .use(Calendar)
  .use(Area)
  .use(Uploader)
  .use(Col)
  .use(Row)
  .use(NavBar)
  .use(Lazyload)
  .use(Skeleton)
  .use(DatetimePicker)
  .use(Dialog)
  .use(Step)
  .use(Steps)
  .use(Tag)
  .use(Checkbox)
  .use(CheckboxGroup)
  .use(Sticky)
  .use(NumberKeyboard)
  .use(PasswordInput)
  .use(search)
  .use(Swipe)
  .use(SwipeItem)
  .use(SubmitBar)
  .use(AddressList)
  .use(VideoPlayer)
  .use(hls)
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false;
window.vm = new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");


if (getToken() === null || getToken() === undefined || getToken() === '') {
  removeToken()

  if (window.vm.$route.path !== '/login' && window.vm.$route.path !== '/') {
    router.replace({ name: '/login' });
  }

}