<commit_before>import { h, Component } from 'preact';
import { bind } from '../../lib/util';
import * as style from './style.scss';
import Output from '../output';

import {MozJpegEncoder} from '../../lib/codec-wrappers/mozjpeg-enc';

type Props = {};

type State = {
  img?: ImageBitmap
};

export default class App extends Component<Props, State> {
  state: State = {};

  constructor() {
    super();
    // In development, persist application state across hot reloads:
    if (process.env.NODE_ENV === 'development') {
      this.setState(window.STATE);
      this.componentDidUpdate = () => {
        window.STATE = this.state;
      };
    }
  }

  private async getImageData(bitmap: ImageBitmap): Promise<ImageData> {
    // Make canvas same size as image
    const canvas = document.createElement('canvas');
    [canvas.width, canvas.height] = [bitmap.width, bitmap.height];
    // Draw image onto canvas
    const ctx = canvas.getContext('2d');
    if (!ctx) {
      throw new Error("Could not create canvas contex");
    }
    ctx.drawImage(bitmap, 0, 0);
    return ctx.getImageData(0, 0, bitmap.width, bitmap.height);
  }

  @bind
  async onFileChange(event: Event) {
    const fileInput = event.target as HTMLInputElement;<commit_msg>Style nitz<commit_after>import { h, Component } from 'preact';
import { bind } from '../../lib/util';
import * as style from './style.scss';
import Output from '../output';

import {MozJpegEncoder} from '../../lib/codec-wrappers/mozjpeg-enc';

type Props = {};

type State = {
  img?: ImageBitmap
};

export default class App extends Component<Props, State> {
  state: State = {};

  constructor() {
    super();
    // In development, persist application state across hot reloads:
    if (process.env.NODE_ENV === 'development') {
      this.setState(window.STATE);
      this.componentDidUpdate = () => {
        window.STATE = this.state;
      };
    }
  }

  private async getImageData(bitmap: ImageBitmap): Promise<ImageData> {
    // Make canvas same size as image
    const canvas = document.createElement('canvas');
    canvas.width = bitmap.width;
    canvas.height = bitmap.height;
    // Draw image onto canvas
    const ctx = canvas.getContext('2d');
    if (!ctx) {
      throw new Error("Could not create canvas context");
    }
    ctx.drawImage(bitmap, 0, 0);
    return ctx.getImageData(0, 0, bitmap.width, bitmap.height);
  }

  @bind
  async onFileChange(event: Event) {
    const fileInput = event.target as HTMLInputElement;
{'fraction_non_alphanumeric': 0.14199759326113118, 'fraction_numerical': 0.004011231448054553, 'mean_word_length': 3.1359867330016584, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7122584', 'n_tokens_mistral': 745, 'n_tokens_neox': 740, 'n_words': 210}