<commit_before>import Vue from 'vue'

const state = {
  selected: null,
  inspectedInstance: {},
  inspectedInstanceId: null,
  loading: false,
  instances: [],
  instancesMap: {},
  expansionMap: {},
  events: [],
  scrollToExpanded: null
}

const getters = {
  totalCount: state => Object.keys(state.instancesMap).length
}

const mutations = {
  FLUSH (state, payload) {
    let start
    if (process.env.NODE_ENV !== 'production') {
      start = window.performance.now()
    }

    // Instance ID map
    // + add 'parent' properties
    const map = {}
    function walk (instance) {
      map[instance.id] = instance
      if (instance.children) {
        instance.children.forEach(child => {
          child.parent = instance
          walk(child)
        })
      }
    }
    payload.instances.forEach(walk)

    // Mutations
    state.instances = Object.freeze(payload.instances)
    state.inspectedInstance = Object.freeze(payload.inspectedInstance)
    state.instancesMap = Object.freeze(map)

    if (process.env.NODE_ENV !== 'production') {
      Vue.nextTick(() => {
        console.log(`devtools render took ${window.performance.now() - start}ms.`)
      })
    }

    state.loading = false
  },
  INSPECT_INSTANCE (state, instance) {
    state.inspectedInstanceId = instance.id
    state.loading = true
  },
  RECEIVE_INSTANCE_DETAILS (state, instance) {<commit_msg>chore(dev): inspect component time<commit_after>import Vue from 'vue'

const state = {
  selected: null,
  inspectedInstance: {},
  inspectedInstanceId: null,
  loading: false,
  instances: [],
  instancesMap: {},
  expansionMap: {},
  events: [],
  scrollToExpanded: null
}

const getters = {
  totalCount: state => Object.keys(state.instancesMap).length
}

let inspectTime = null

const mutations = {
  FLUSH (state, payload) {
    let start
    if (process.env.NODE_ENV !== 'production') {
      start = window.performance.now()
    }

    // Instance ID map
    // + add 'parent' properties
    const map = {}
    function walk (instance) {
      map[instance.id] = instance
      if (instance.children) {
        instance.children.forEach(child => {
          child.parent = instance
          walk(child)
        })
      }
    }
    payload.instances.forEach(walk)

    // Mutations
    state.instances = Object.freeze(payload.instances)
    state.inspectedInstance = Object.freeze(payload.inspectedInstance)
    state.instancesMap = Object.freeze(map)

    if (process.env.NODE_ENV !== 'production') {
      Vue.nextTick(() => {
        console.log(`devtools render took ${window.performance.now() - start}ms.`)
        if (inspectTime != null) {
          console.log(`inspect component took ${window.performance.now() - inspectTime}ms.`)
          inspectTime = null
        }
      })
    }

    state.loading = false
  },
  INSPECT_INSTANCE (state, instance) {
    state.inspectedInstanceId = instance.id
    state.loading = true

    if (process.env.NODE_ENV !== 'production') {
      inspectTime = window.performance.now()
    }
  },
  RECEIVE_INSTANCE_DETAILS (state, instance) {
{'fraction_non_alphanumeric': 0.12975609756097561, 'fraction_numerical': 0.0, 'mean_word_length': 2.755799755799756, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1200131', 'n_tokens_mistral': 952, 'n_tokens_neox': 944, 'n_words': 189}