<commit_before>"use strict";

import HtmlOutputData from "./HtmlOutputData";
import EmoteObject from "./EmoteObject";
import EmoteFlags from "./EmoteFlags";
import IEmoteDataEntry from './IEmoteDataEntry';

export default class EmoteEffectsModifier {
    applyFlagsFromObjectToHtmlOutputData(emoteData : IEmoteDataEntry, emoteObject: EmoteObject, emoteHtml: HtmlOutputData) {
        const animations: string[] = [];
        const wrapperAnimations: string[] = [];
        const transforms: string[] = [];
        let wrappedEmoteHeight: number;

        if (emoteObject.flagsString) {
          emoteHtml.titleForEmoteNode += ` effects: ${emoteObject.flagsString}`
        }

        if (emoteObject.spin) {
            animations.push(`${emoteObject.spin} 2s linear infinite`);
            if (emoteObject.spin == 'zspin' || emoteObject.spin == 'spin' || emoteObject.spin == '!zspin' || emoteObject.spin == '!spin') {
                const diag = Math.sqrt(emoteData.width * emoteData.width + emoteData.height * emoteData.height);
                wrappedEmoteHeight = Math.max(diag, wrappedEmoteHeight);
            }
        }
        if (emoteObject.slide) {
            const slideAnimations : string[] = [];
            const slideSpeed = EmoteFlags.getSpeedForDescription(emoteObject.speed) || '8s';

            slideAnimations.push(`slideleft ${slideSpeed} infinite ease`);
            if (!emoteObject.brody && !emoteObject.spin) {
                if (emoteObject.reverse) {
                    slideAnimations.push(`!slideflip ${slideSpeed} infinite ease`);
                } else {
                    slideAnimations.push(`slideflip ${slideSpeed} infinite ease`);
                }
            }
            if (emoteObject.spin === 'spin' || emoteObject.spin === 'zspin' || emoteObject.rotateDegrees || emoteObject.brody) {
                wrapperAnimations.push.apply(wrapperAnimations, slideAnimations);
            } else {
                animations.push.apply(animations, slideAnimations);
            }
        }
        if (emoteObject.rotateDegrees) {
            transforms.push(`rotate(${emoteObject.rotateDegrees}deg)`);
            const rotateHeight = emoteData.width *
                Math.abs(Math.sin(emoteObject.rotateDegrees * Math.PI / 180)) +
                emoteData.height *
                Math.abs(Math.cos(emoteObject.rotateDegrees * Math.PI / 180));
            wrappedEmoteHeight = rotateHeight;
        }
        if (emoteObject.xAxisTranspose) {
            emoteHtml.cssStylesForEmoteNode['left'] = emoteObject.xAxisTranspose.toString();
        }
        if (emoteObject.zAxisTranspose) {
            emoteHtml.cssStylesForEmoteNode['zIndex'] = emoteObject.zAxisTranspose.toString();
        }
        if (emoteObject.vibrate) {
            animations.unshift('vibrate 0.05s linear infinite');
        }
        if (emoteObject.brody) {
            animations.push('brody  1.27659s infinite ease');
            const brodyHeight = 1.01 * (emoteData.width * Math.sin(10 * Math.PI / 180) + emoteData.height * Math.cos(10 * Math.PI / 180));
            wrappedEmoteHeight = brodyHeight;
        }
        if (emoteObject.reverse) {
            transforms.push('scaleX(-1)');
        }
        if (emoteObject.hueRotate) {
          emoteHtml.cssClassesForEmoteNode.push('bem-hue-rotate');
        }
        if (emoteObject.invertColors) {
          emoteHtml.cssClassesForEmoteNode.push('bem-invert')
        }

        if (wrappedEmoteHeight) {
            emoteHtml.cssClassesForParentNode.push('rotation-wrapper');
            const offset = Math.floor((wrappedEmoteHeight - emoteData.height) / 2);
            emoteHtml.cssStylesForParentNode['height'] = `${Math.ceil(wrappedEmoteHeight - offset)}px`;
            emoteHtml.cssStylesForParentNode['display'] = 'inline-block';
            emoteHtml.cssStylesForParentNode['marginTop'] = `${offset}px`;
            emoteHtml.cssStylesForParentNode['position'] = 'relative';<commit_msg>x-axis shift requires being labeled with px<commit_after>"use strict";

import HtmlOutputData from "./HtmlOutputData";
import EmoteObject from "./EmoteObject";
import EmoteFlags from "./EmoteFlags";
import IEmoteDataEntry from './IEmoteDataEntry';

export default class EmoteEffectsModifier {
    applyFlagsFromObjectToHtmlOutputData(emoteData : IEmoteDataEntry, emoteObject: EmoteObject, emoteHtml: HtmlOutputData) {
        const animations: string[] = [];
        const wrapperAnimations: string[] = [];
        const transforms: string[] = [];
        let wrappedEmoteHeight: number;

        if (emoteObject.flagsString) {
          emoteHtml.titleForEmoteNode += ` effects: ${emoteObject.flagsString}`
        }

        if (emoteObject.spin) {
            animations.push(`${emoteObject.spin} 2s linear infinite`);
            if (emoteObject.spin == 'zspin' || emoteObject.spin == 'spin' || emoteObject.spin == '!zspin' || emoteObject.spin == '!spin') {
                const diag = Math.sqrt(emoteData.width * emoteData.width + emoteData.height * emoteData.height);
                wrappedEmoteHeight = Math.max(diag, wrappedEmoteHeight);
            }
        }
        if (emoteObject.slide) {
            const slideAnimations : string[] = [];
            const slideSpeed = EmoteFlags.getSpeedForDescription(emoteObject.speed) || '8s';

            slideAnimations.push(`slideleft ${slideSpeed} infinite ease`);
            if (!emoteObject.brody && !emoteObject.spin) {
                if (emoteObject.reverse) {
                    slideAnimations.push(`!slideflip ${slideSpeed} infinite ease`);
                } else {
                    slideAnimations.push(`slideflip ${slideSpeed} infinite ease`);
                }
            }
            if (emoteObject.spin === 'spin' || emoteObject.spin === 'zspin' || emoteObject.rotateDegrees || emoteObject.brody) {
                wrapperAnimations.push.apply(wrapperAnimations, slideAnimations);
            } else {
                animations.push.apply(animations, slideAnimations);
            }
        }
        if (emoteObject.rotateDegrees) {
            transforms.push(`rotate(${emoteObject.rotateDegrees}deg)`);
            const rotateHeight = emoteData.width *
                Math.abs(Math.sin(emoteObject.rotateDegrees * Math.PI / 180)) +
                emoteData.height *
                Math.abs(Math.cos(emoteObject.rotateDegrees * Math.PI / 180));
            wrappedEmoteHeight = rotateHeight;
        }
        if (emoteObject.xAxisTranspose) {
            emoteHtml.cssStylesForEmoteNode['left'] = emoteObject.xAxisTranspose.toString() + 'px';
        }
        if (emoteObject.zAxisTranspose) {
            emoteHtml.cssStylesForEmoteNode['zIndex'] = emoteObject.zAxisTranspose.toString();
        }
        if (emoteObject.vibrate) {
            animations.unshift('vibrate 0.05s linear infinite');
        }
        if (emoteObject.brody) {
            animations.push('brody  1.27659s infinite ease');
            const brodyHeight = 1.01 * (emoteData.width * Math.sin(10 * Math.PI / 180) + emoteData.height * Math.cos(10 * Math.PI / 180));
            wrappedEmoteHeight = brodyHeight;
        }
        if (emoteObject.reverse) {
            transforms.push('scaleX(-1)');
        }
        if (emoteObject.hueRotate) {
          emoteHtml.cssClassesForEmoteNode.push('bem-hue-rotate');
        }
        if (emoteObject.invertColors) {
          emoteHtml.cssClassesForEmoteNode.push('bem-invert')
        }

        if (wrappedEmoteHeight) {
            emoteHtml.cssClassesForParentNode.push('rotation-wrapper');
            const offset = Math.floor((wrappedEmoteHeight - emoteData.height) / 2);
            emoteHtml.cssStylesForParentNode['height'] = `${Math.ceil(wrappedEmoteHeight - offset)}px`;
            emoteHtml.cssStylesForParentNode['display'] = 'inline-block';
            emoteHtml.cssStylesForParentNode['marginTop'] = `${offset}px`;
            emoteHtml.cssStylesForParentNode['position'] = 'relative';
{'fraction_non_alphanumeric': 0.1200450168813305, 'fraction_numerical': 0.008003001125422033, 'mean_word_length': 2.417948717948718, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3219858', 'n_tokens_mistral': 2373, 'n_tokens_neox': 2309, 'n_words': 370}