content: /*
  Copyright 2017 Bitnami.
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  */
  import React from 'react'
  import ReactDOM from 'react-dom'
  import Store from 'store/Store'
  import AppContainer from 'components/AppContainer'
  import injectTapEventPlugin from 'react-tap-event-plugin'
  injectTapEventPlugin()
  
  // ========================================================
  // Render Setup
  // ========================================================
  const MOUNT_NODE = document.getElementById('root')
  
  let render = () => {
    const routes = require('./routes/index').default(Store)
  
    ReactDOM.render(
      <AppContainer store={Store} routes={routes} />,
      MOUNT_NODE
    )
  }
  
  // This code is excluded from production bundle
  if (__DEV__) {
    window.Store = Store
    if (module.hot) {
      // Development render functions
      const renderApp = render
      const renderError = (error) => {
        const RedBox = require('redbox-react').default
  
        ReactDOM.render(<RedBox error={error} />, MOUNT_NODE)
      }
  
      // Wrap render in try/catch
      render = () => {
        try {
          renderApp()
        } catch (error) {
          console.error(error)
          renderError(error)
        }
      }
  
      // Setup hot module replacement
      module.hot.accept('./routes/index', () =>
        setImmediate(() => {
          ReactDOM.unmountComponentAtNode(MOUNT_NODE)
          render()
        })
      )
    }
  }
  
  // ========================================================
  // Go!
  // ========================================================
  render()
  