<commit_before>import React, { PureComponent } from 'react'
import { Switch } from 'react-router'
import {
  StaticRouter,
  HashRouter,
  BrowserRouter,
  Route
} from 'react-router-dom'
import URL from 'url-parse'
import { Data } from 'react-chunky'
import { createSectionRoutes } from './Router'
import Cache from './Cache'

export default class App extends PureComponent {
  constructor(props) {
    super(props)
    this.state = { loading: true }
    this._menu = []
    this._sidebar = []
    this._cache = new Cache(props)
    this._userLogout = this.userLogout.bind(this)
    this._userLoggedIn = this.userLoggedIn.bind(this)
  }

  componentDidMount() {
    this.checkAuth()
    const ele = document.getElementById('ipl-progress-indicator')
    if (ele) {
      // fade out
      ele.classList.add('available')
      setTimeout(() => {
        // remove from DOM
        ele.outerHTML = ''
      }, 2000)
    }
    const { additionalScripts } = this.props
    if (additionalScripts) {
      for (let i = 0; i < additionalScripts.length; i++) {
        let { rel, href, integrity, crossOrigin } = additionalScripts[i]
        let link = document.createElement('link')
        link.rel = rel
        link.href = href
        link.integrity = integrity
        link.crossOrigin = crossOrigin
        document.head.appendChild(link)
      }
    }
  }

  checkAuth() {
    return new Promise((resolve, reject) => {
      Data.Cache.retrieveAuth()
        .then(account => {
          this._resolve(account)
          resolve()
        })
        .catch(e => {
          this._resolve()
          resolve()
        })
    })
  }<commit_msg>dinamycally import scirpts and styles based on chunky<commit_after>import React, { PureComponent } from 'react'
import { Switch } from 'react-router'
import {
  StaticRouter,
  HashRouter,
  BrowserRouter,
  Route
} from 'react-router-dom'
import URL from 'url-parse'
import { Data } from 'react-chunky'
import { createSectionRoutes } from './Router'
import Cache from './Cache'

export default class App extends PureComponent {
  constructor(props) {
    super(props)
    this.state = { loading: true }
    this._menu = []
    this._sidebar = []
    this._cache = new Cache(props)
    this._userLogout = this.userLogout.bind(this)
    this._userLoggedIn = this.userLoggedIn.bind(this)
  }

  componentDidMount() {
    this.checkAuth()
    const ele = document.getElementById('ipl-progress-indicator')
    if (ele) {
      // fade out
      ele.classList.add('available')
      setTimeout(() => {
        // remove from DOM
        ele.outerHTML = ''
      }, 2000)
    }
    const { additionalScripts } = this.props
    if (additionalScripts) {
      for (let i = 0; i < additionalScripts.length; i++) {
        let {
          rel,
          href,
          integrity,
          crossOrigin,
          type,
          src
        } = additionalScripts[i]
        if (type === 'style') {
          let link = document.createElement('link')
          link.rel = rel
          link.href = href
          link.integrity = integrity
          link.crossOrigin = crossOrigin
          document.head.appendChild(link)
        }
        if (type === 'text/javascript') {
          let script = document.createElement('script')
          script.src = src
          script.type = type
          document.body.appendChild(script)
        }
      }
    }
  }

  checkAuth() {
    return new Promise((resolve, reject) => {
      Data.Cache.retrieveAuth()
        .then(account => {
          this._resolve(account)
          resolve()
        })
        .catch(e => {
          this._resolve()
          resolve()
        })
    })
  }
{'fraction_non_alphanumeric': 0.12080719934551404, 'fraction_numerical': 0.002727024815925825, 'mean_word_length': 2.1323654995730146, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '6772922', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1060, 'n_words': 243}