<commit_before>import { Component } from '@angular/core';

import { ActionsService } from '../../model/actions/actions.service';
import { ModelTrackBPMChange } from '../../model/model';
import { showTime } from '../../time/audio-player-controls/audio-player-controls.component';
import { BPMService } from '../bpm/bpm.service';
import { SelectorService } from '../selector/selector.service';

@Component({
    selector: 'app-event-controls',
    templateUrl: './event-controls.component.html',
    styleUrls: ['./event-controls.component.css'],
})
export class EventControlsComponent {

    selected: boolean;
    id: number;
    time: number;
    formattedTime: string;
    type: string;
    bpm: number;

    constructor(
        private actionsService: ActionsService,
        private bpmService: BPMService,
        private selectorService: SelectorService,
    ) {
        this.selected = false;
        this.selectorService.selectedEvents.subscribe((event) => {
            if (!event) {
                this.selected = false;
                return;
            }
            this.selected = true;
            this.id = event.id;
            this.time = event.time;
            this.formattedTime = showTime(event.time);
            this.type = 'BPM Change';
            this.bpm = (event as ModelTrackBPMChange).bpm;
        });
    }

    bpmChanged(bpm: number) {
        if (bpm && bpm > 0) {
            this.bpmService.updateBPM(bpm);            
        }
    }

    delete() {
        this.actionsService.deleteSyncTrackEvent(this.id);
        this.selectorService.selectNearest();
    }
}<commit_msg>fix: Add a maximum bpm to prevent crashes<commit_after>import { Component } from '@angular/core';

import { ActionsService } from '../../model/actions/actions.service';
import { ModelTrackBPMChange } from '../../model/model';
import { showTime } from '../../time/audio-player-controls/audio-player-controls.component';
import { BPMService } from '../bpm/bpm.service';
import { SelectorService } from '../selector/selector.service';

@Component({
    selector: 'app-event-controls',
    templateUrl: './event-controls.component.html',
    styleUrls: ['./event-controls.component.css'],
})
export class EventControlsComponent {

    selected: boolean;
    id: number;
    time: number;
    formattedTime: string;
    type: string;
    bpm: number;

    constructor(
        private actionsService: ActionsService,
        private bpmService: BPMService,
        private selectorService: SelectorService,
    ) {
        this.selected = false;
        this.selectorService.selectedEvents.subscribe((event) => {
            if (!event) {
                this.selected = false;
                return;
            }
            this.selected = true;
            this.id = event.id;
            this.time = event.time;
            this.formattedTime = showTime(event.time);
            this.type = 'BPM Change';
            this.bpm = (event as ModelTrackBPMChange).bpm;
        });
    }

    bpmChanged(bpm: number) {
        if (bpm && bpm > 0 && bpm <= 10000) {
            this.bpmService.updateBPM(bpm);            
        }
    }

    delete() {
        this.actionsService.deleteSyncTrackEvent(this.id);
        this.selectorService.selectNearest();
    }
}
{'fraction_non_alphanumeric': 0.13156288156288157, 'fraction_numerical': 0.002136752136752137, 'mean_word_length': 2.219056974459725, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, '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': '373020', 'n_tokens_mistral': 933, 'n_tokens_neox': 915, 'n_words': 187}