<commit_before>import { getInsertBetweenVals } from "ve-sequence-utils";
import { getRangeLength, invertRange, normalizeRange } from "ve-range-utils";
import React from "react";
import { Button } from "@blueprintjs/core";
import withEditorProps from "../withEditorProps";
import "./style.css";

export function StatusBar({
  selectionLayer = { start: -1, end: -1 },
  caretPosition = -1,
  sequenceLength = 0,
  readOnly,
  selectionLayerUpdate,
  caretPositionUpdate,
  showReadOnly = true
}) {
  let length = getRangeLength(selectionLayer, sequenceLength);
  let insertBetween = getInsertBetweenVals(
    caretPosition,
    selectionLayer,
    sequenceLength
  );
  let isSelecting = selectionLayer.start > -1;
  return (
    <div className={"veStatusBar"}>
      <StatusBarItem />
      {showReadOnly && (
        <StatusBarItem>{readOnly ? "Read Only" : "Editable"}</StatusBarItem>
      )}
      <div className={"spacer"} />
      {!readOnly && (
        <StatusBarItem>
          {`Insert between bases ${insertBetween[0]} and ${insertBetween[1]}`}
        </StatusBarItem>
      )}
      <div className={"spacer"} />
      {
        <StatusBarItem>
          Selecting {isSelecting ? length : 0} bps from{" "}
          {isSelecting ? selectionLayer.start + 1 : "-"} to{" "}
          {isSelecting ? selectionLayer.end + 1 : "-"}
          <Button
            disabled={sequenceLength <= 0}
            onClick={() => {
              if (sequenceLength <= 0) {
                return false;
              }
              if (selectionLayer.start > -1) {
                if (getRangeLength(selectionLayer) === sequenceLength) {
                  caretPositionUpdate(selectionLayer.start);
                } else {
                  selectionLayerUpdate(invertRange(selectionLayer));
                }
              } else {
                if (caretPosition > -1) {
                  selectionLayerUpdate(
                    normalizeRange(
                      {
                        start: caretPosition,
                        end: caretPosition - 1
                      },
                      sequenceLength
                    )<commit_msg>updating status bar text<commit_after>import { getInsertBetweenVals } from "ve-sequence-utils";
import { getRangeLength, invertRange, normalizeRange } from "ve-range-utils";
import React from "react";
import { Button } from "@blueprintjs/core";
import withEditorProps from "../withEditorProps";
import "./style.css";

export function StatusBar({
  selectionLayer = { start: -1, end: -1 },
  caretPosition = -1,
  sequenceLength = 0,
  readOnly,
  selectionLayerUpdate,
  caretPositionUpdate,
  showReadOnly = true
}) {
  let length = getRangeLength(selectionLayer, sequenceLength);
  let insertBetween = getInsertBetweenVals(
    caretPosition,
    selectionLayer,
    sequenceLength
  );
  let isSelecting = selectionLayer.start > -1;
  return (
    <div className={"veStatusBar"}>
      <StatusBarItem />
      {showReadOnly && (
        <StatusBarItem>{readOnly ? "Read Only" : "Editable"}</StatusBarItem>
      )}
      <div className={"spacer"} />
      {!readOnly && (
        <StatusBarItem>
          {`Insert between bases ${insertBetween[0]} and ${insertBetween[1]}`}
        </StatusBarItem>
      )}
      <div className={"spacer"} />
      {
        <StatusBarItem>
          {isSelecting
            ? `Selecting ${length} bps from ${selectionLayer.end +
                1} to ${selectionLayer.start + 1}`
            : caretPosition > -1
              ? `Caret Between Bases ${insertBetween[0]} and ${
                  insertBetween[1]
                }`
              : "No Selection"}
          <Button
            disabled={sequenceLength <= 0}
            onClick={() => {
              if (sequenceLength <= 0) {
                return false;
              }
              if (selectionLayer.start > -1) {
                if (getRangeLength(selectionLayer) === sequenceLength) {
                  caretPositionUpdate(selectionLayer.start);
                } else {
                  selectionLayerUpdate(invertRange(selectionLayer));
                }
              } else {
                if (caretPosition > -1) {
                  selectionLayerUpdate(
                    normalizeRange(
                      {
                        start: caretPosition,
                        end: caretPosition - 1
                      },
                      sequenceLength
                    )
{'fraction_non_alphanumeric': 0.1124273580688422, 'fraction_numerical': 0.007152436298614216, 'mean_word_length': 1.802128991859737, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 30, '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': '733933', 'n_tokens_mistral': 1211, 'n_tokens_neox': 1149, 'n_words': 252}