{"size": 1438, "ext": "js", "max_stars_repo_path": "src/firebase/index.js", "max_stars_repo_name": "GeorgeSteel/okdoc", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/firebase/index.js", "max_issues_repo_name": "GeorgeSteel/okdoc", "max_issues_repo_issues_event_min_datetime": "2021-09-03T00:48:37.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-03T00:48:37.000Z", "max_forks_repo_path": "src/firebase/index.js", "max_forks_repo_name": "GeorgeSteel/okdoc", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 26.1454545455, "max_line_length": 65, "alphanum_fraction": 0.6216968011}
// import firebase from 'firebase/app'
// import 'firebase/auth'
// import 'firebase/firestore'
// import 'firebase/storage'
// import 'firebase/analytics'

import { fireConfig } from './config'

let app
// const getFirebaseInstance = async () => {
//   if (typeof window !== 'undefined') {
//     app = await import('firebase/app')

//     await import('firebase/auth')
//     await import('firebase/firestore')
//     await import('firebase/storage')
//     await import('firebase/analytics')

//     if (app.apps.length === 0) {
//       app.initializeApp(fireConfig)
//       uiConfig = {
//         // Popup signin flow rather than redirect flow.
//         signInFlow: 'popup',
//         // We will display Google and Email as auth providers.
//         signInOptions: [
//           app.auth.GoogleAuthProvider.PROVIDER_ID,
//           app.auth.EmailAuthProvider.PROVIDER_ID,
//         ],
//         signInSuccessUrl: '/app/perfil',
//       }
//     }
//   }
// }

// getFirebaseInstance()

export default async function getFirebase() {
  if (typeof window !== 'undefined') {
    app = await import('firebase/app')

    await import('firebase/auth')
    await import('firebase/firestore')
    await import('firebase/storage')
    await import('firebase/analytics')

    if (app) return app
    app.initializeApp(fireConfig)
    console.log(app)
    return await app
  }
  return null
}

// export { app as firebase, uiConfig }
