<commit_before>import { h } from 'snabbdom';
import { VNode } from 'snabbdom/vnode';
import { prop } from 'common';
import { storedProp, storedJsonProp } from 'common/storage';
import { bind, dataIcon } from '../util';
import { Game } from '../interfaces';
import { ExplorerDb, ExplorerSpeed, ExplorerConfigData, ExplorerConfigCtrl } from './interfaces';

const allSpeeds: ExplorerSpeed[] = ['bullet', 'blitz', 'rapid', 'classical'];
const allRatings = [1600, 1800, 2000, 2200, 2500];

export function controller(game: Game, onClose: () => void, trans: Trans, redraw: () => void): ExplorerConfigCtrl {
  const variant = game.variant.key === 'fromPosition' ? 'standard' : game.variant.key;

  const available: ExplorerDb[] = ['lichess'];
  if (variant === 'standard') available.unshift('masters');

  const data: ExplorerConfigData = {
    open: prop(false),
    db: {
      available,
      selected:
        available.length > 1
          ? storedProp('explorer.burned-db.' + variant, available[available.length - 1])
          : function () {
              return available[available.length - 1]; // revert to 0
            },<commit_msg>Revert "REVERT ME 2: fixup partial explorer hack"<commit_after>import { h } from 'snabbdom';
import { VNode } from 'snabbdom/vnode';
import { prop } from 'common';
import { storedProp, storedJsonProp } from 'common/storage';
import { bind, dataIcon } from '../util';
import { Game } from '../interfaces';
import { ExplorerDb, ExplorerSpeed, ExplorerConfigData, ExplorerConfigCtrl } from './interfaces';

const allSpeeds: ExplorerSpeed[] = ['bullet', 'blitz', 'rapid', 'classical'];
const allRatings = [1600, 1800, 2000, 2200, 2500];

export function controller(game: Game, onClose: () => void, trans: Trans, redraw: () => void): ExplorerConfigCtrl {
  const variant = game.variant.key === 'fromPosition' ? 'standard' : game.variant.key;

  const available: ExplorerDb[] = ['lichess'];
  if (variant === 'standard') available.unshift('masters');

  const data: ExplorerConfigData = {
    open: prop(false),
    db: {
      available,
      selected:
        available.length > 1
          ? storedProp('explorer.burned-db.' + variant, available[0])
          : function () {
              return available[available.length - 1]; // revert to 0
            },
{'fraction_non_alphanumeric': 0.15280801044841097, 'fraction_numerical': 0.02133217239878102, 'mean_word_length': 3.6897959183673468, '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': '7379816', 'n_tokens_mistral': 722, 'n_tokens_neox': 650, 'n_words': 192}