<commit_before>import * as firebase from "firebase/app"
import "firebase/auth"
import "firebase/database"
import { Observable } from "rxjs"

const config = {
  apiKey: "<KEY>",
  authDomain: "rxfiddle.firebaseapp.com",
  databaseURL: "https://rxfiddle.firebaseio.com",
  messagingSenderId: "412806914076",
  projectId: "rxfiddle",
  storageBucket: "rxfiddle.appspot.com",
}

export function init() {
  firebase.initializeApp(config)
}

/**
 * Sign in.
 * Any Error's contain .code and .message fields
 */
export function signin(): Observable<void> {
  return Observable.from(firebase.auth().signInAnonymously())
}

/**
 * Sign in.
 * Any Error's contain .code and .message fields
 */<commit_msg>Only create new account if user === null<commit_after>import * as firebase from "firebase/app"
import "firebase/auth"
import "firebase/database"
import { Observable } from "rxjs"

const config = {
  apiKey: "<KEY>",
  authDomain: "rxfiddle.firebaseapp.com",
  databaseURL: "https://rxfiddle.firebaseio.com",
  messagingSenderId: "412806914076",
  projectId: "rxfiddle",
  storageBucket: "rxfiddle.appspot.com",
}

export function init() {
  firebase.initializeApp(config)
}

/**
 * Sign in.
 * Any Error's contain .code and .message fields
 */
export function signin(): Observable<void> {
  return new Observable(o => firebase.auth().onAuthStateChanged(o.next.bind(o), o.error.bind(o), o.complete.bind(o)))
    .take(1)
    .flatMap(state => state === null ? Observable.from(firebase.auth().signInAnonymously()) : Observable.empty<void>())
}

/**
 * Sign in.
 * Any Error's contain .code and .message fields
 */
{'fraction_non_alphanumeric': 0.15255292652552926, 'fraction_numerical': 0.015566625155666251, 'mean_word_length': 4.579861111111111, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 2, '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': '7188088', 'n_tokens_mistral': 550, 'n_tokens_neox': 531, 'n_words': 126}