<commit_before>import React from 'react';
import TopAppBar from './components/TopAppBar';
import ChildCard from './components/ChildCard';
import { translate } from 'react-i18next';
import i18n from './i18n';
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles';
import CenteredLoading from './components/CenteredLoading';
import jsonRPC from './components/jsonRPC';
import getRequestId from './components/getRequestId';
import Message from './components/Message';
import SuccessMessage from './components/SuccessMessage';
import Button from "@material-ui/core/Button";

const theme = createMuiTheme({
    palette: {
        primary: {
            main: '#0054A6'
        },
    },
    overrides: {
        // Name of the component ⚛️ / style sheet
        MuiTypography: {
            // Name of the rule
            headline: {
                color: '#555555'
            },
            title: {
                color: '#555555'
            }
        },
        MuiCardHeader: {
            title: {
                textAlign: 'center',
                fontSize: '30px',
                // textTransform: 'uppercase'
            }
        },
        MuiSnackbarContent: {
            root: {
                backgroundColor: "darkred"
            }
        }
    },
});

window.pageLoaded = false;
window.getChildTimeout = false;

class Main extends React.Component {
    state = {
        child: false,
        partner: false,
        success: false,
    };

    count_try = 0;

    parseResult = (res) => {
        let child;
        try {
            child = JSON.parse(res.responseText).result
        }
        catch(e) {
            child = false;
        }
        return child;
    };

    getChild = () => {
        let lang = i18n.languages[1];
        let requestId = getRequestId();
        if (!requestId) {
            return;
        }
        let url = "/sms_sponsorship/step1/" + requestId + "/get_child_data";
        jsonRPC(url, {lang: lang}, (res) => {
            let child = this.parseResult(res);
            let partner = (typeof(child.partner) === 'undefined') ? false:child.partner[0];
            this.setState({
                child: child,
                partner: partner,
            });
            // Set the language as the request
            i18n.changeLanguage(child.lang);
        });
    };

    changeChild = () => {
        let requestId = getRequestId();
        let lang = i18n.languages[1];
        let url = "/sms_sponsorship/step1/" + requestId + "/change_child";
        let form = document.forms.other_child_form;

        let data = {
            gender: form.gender.value,
            age: form.age.value,
            country: form.country.value,
            lang: lang,
        };

        this.setState({
            child: {
                'has_a_child': true,
                'loading_other_child': true
            },
            dialogOpen: False<commit_msg>FIX typo<commit_after>import React from 'react';
import TopAppBar from './components/TopAppBar';
import ChildCard from './components/ChildCard';
import { translate } from 'react-i18next';
import i18n from './i18n';
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles';
import CenteredLoading from './components/CenteredLoading';
import jsonRPC from './components/jsonRPC';
import getRequestId from './components/getRequestId';
import Message from './components/Message';
import SuccessMessage from './components/SuccessMessage';
import Button from "@material-ui/core/Button";

const theme = createMuiTheme({
    palette: {
        primary: {
            main: '#0054A6'
        },
    },
    overrides: {
        // Name of the component ⚛️ / style sheet
        MuiTypography: {
            // Name of the rule
            headline: {
                color: '#555555'
            },
            title: {
                color: '#555555'
            }
        },
        MuiCardHeader: {
            title: {
                textAlign: 'center',
                fontSize: '30px',
                // textTransform: 'uppercase'
            }
        },
        MuiSnackbarContent: {
            root: {
                backgroundColor: "darkred"
            }
        }
    },
});

window.pageLoaded = false;
window.getChildTimeout = false;

class Main extends React.Component {
    state = {
        child: false,
        partner: false,
        success: false,
    };

    count_try = 0;

    parseResult = (res) => {
        let child;
        try {
            child = JSON.parse(res.responseText).result
        }
        catch(e) {
            child = false;
        }
        return child;
    };

    getChild = () => {
        let lang = i18n.languages[1];
        let requestId = getRequestId();
        if (!requestId) {
            return;
        }
        let url = "/sms_sponsorship/step1/" + requestId + "/get_child_data";
        jsonRPC(url, {lang: lang}, (res) => {
            let child = this.parseResult(res);
            let partner = (typeof(child.partner) === 'undefined') ? false:child.partner[0];
            this.setState({
                child: child,
                partner: partner,
            });
            // Set the language as the request
            i18n.changeLanguage(child.lang);
        });
    };

    changeChild = () => {
        let requestId = getRequestId();
        let lang = i18n.languages[1];
        let url = "/sms_sponsorship/step1/" + requestId + "/change_child";
        let form = document.forms.other_child_form;

        let data = {
            gender: form.gender.value,
            age: form.age.value,
            country: form.country.value,
            lang: lang,
        };

        this.setState({
            child: {
                'has_a_child': true,
                'loading_other_child': true
            },
            dialogOpen: false
{'fraction_non_alphanumeric': 0.11872767477462154, 'fraction_numerical': 0.012587174689573056, 'mean_word_length': 1.61101243339254, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1863127', 'n_tokens_mistral': 1677, 'n_tokens_neox': 1616, 'n_words': 376}