<commit_before>/* @flow */

import type VueRouter from '../index'
import { cleanPath } from '../util/path'
import { History } from './base'

const genKey = () => String(Date.now())
let _key: string = genKey()

export class HTML5History extends History {
  constructor (router: VueRouter, base: ?string) {
    super(router, base)

    // possible redirect on start
    if (this.getLocation() !== this.current.fullPath) {
      replaceState(this.current.fullPath)
    }

    const expectScroll = router.options.scrollBehavior

    window.addEventListener('popstate', e => {<commit_msg>fix html5 mode initial redirect with base<commit_after>/* @flow */

import type VueRouter from '../index'
import { cleanPath } from '../util/path'
import { History } from './base'

const genKey = () => String(Date.now())
let _key: string = genKey()

export class HTML5History extends History {
  constructor (router: VueRouter, base: ?string) {
    super(router, base)

    // possible redirect on start
    const url = cleanPath(this.base + this.current.fullPath)
    if (this.getLocation() !== url) {
      replaceState(url)
    }

    const expectScroll = router.options.scrollBehavior

    window.addEventListener('popstate', e => {
{'fraction_non_alphanumeric': 0.13535684987694832, 'fraction_numerical': 0.002461033634126333, 'mean_word_length': 3.621212121212121, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4399855', 'n_tokens_mistral': 355, 'n_tokens_neox': 348, 'n_words': 104}