<commit_before>(function () {
var Util = require('util');

Editor.registerPanel( 'console.panel', {
    is: 'editor-console',

    properties: {
        logs: {
            type: Object,
            notify: true,
            value: [],
        },

        _logs: {
            type: Object,
            notify: true,
        },

        option: {
            type: String,
            value: 'All',
            notify: true,
            observer: 'applyFilter'
        },

        filterText: {
            type: String,
            value: '',
            notify: true,
            observer: 'applyFilter'
        },

        useRegex: {
            type: Boolean,
            value: false,
            notify: true,
            observer: 'applyFilter'
        },
    },

    ready: function () {
        this.logs = [];
        this._logs = [];
        this.collapse = true;

        Editor.sendRequestToCore( 'console:query', function ( results ) {
            for ( var i = 0; i < results.length; ++i ) {
                var item = results[i];
                this.add( item.type, item.message );
            }
        }.bind(this));
    },

    _logsChanged: function () {
        this.applyFilter();
    },

    'console:log': function ( message ) {
        this.add( 'log', message );
    },

    'console:success': function ( message ) {
        this.add( 'success', message );
    },

    'console:failed': function ( message ) {
        this.add( 'failed', message );
    },

    'console:info': function ( message ) {
        this.add( 'info', message );
    },

    'console:warn': function ( message ) {
        this.add( 'warn', message );
    },

    'console:error': function ( message ) {
        this.add( 'error', message );
    },

    'console:clear': function () {
        this.clear();
    },

    add: function ( type, text ) {
        this.push('logs', {
            type: type,
            text: text,
            count: 0,
        });

        this.push('_logs', {
            type: type,
            text: text,
            count: 0,
        });

        // to make sure after layout and before render
        if ( !this._scrollTaskID ) {
            this._scrollTaskID = window.requestAnimationFrame ( function () {
                this._scrollTaskID = null;
                this.$.view.scrollTop = this.$.view.scrollHeight;
            }.bind(this) );
        }
    },

    clear: function () {
        this.logs = [];
        this._logs = [];
        Editor.sendToCore('console:clear');
    },

    _format: function ( args ) {
        var text = args.length > 0 ?  args[0] : '';
        if (args.length <= 1) {<commit_msg>fix filter type<commit_after>(function () {
var Util = require('util');

Editor.registerPanel( 'console.panel', {
    is: 'editor-console',

    properties: {
        logs: {
            type: Object,
            notify: true,
            value: [],
        },

        _logs: {
            type: Object,
            notify: true,
        },

        option: {
            type: String,
            value: 'All',
            notify: true,
            observer: 'applyFilter'
        },

        filterText: {
            type: String,
            value: '',
            notify: true,
            observer: 'applyFilter'
        },

        useRegex: {
            type: Boolean,
            value: false,
            notify: true,
            observer: 'applyFilter'
        },
    },

    ready: function () {
        this.logs = [];
        this._logs = [];
        this.collapse = true;

        Editor.sendRequestToCore( 'console:query', function ( results ) {
            for ( var i = 0; i < results.length; ++i ) {
                var item = results[i];
                this.add( item.type, item.message );
            }
        }.bind(this));
    },

    _logsChanged: function () {
        this.applyFilter();
    },

    'console:log': function ( message ) {
        this.add( 'log', message );
    },

    'console:success': function ( message ) {
        this.add( 'success', message );
    },

    'console:failed': function ( message ) {
        this.add( 'failed', message );
    },

    'console:info': function ( message ) {
        this.add( 'info', message );
    },

    'console:warn': function ( message ) {
        this.add( 'warn', message );
    },

    'console:error': function ( message ) {
        this.add( 'error', message );
    },

    'console:clear': function () {
        this.clear();
    },

    add: function ( type, text ) {
        this.push('logs', {
            type: type,
            text: text,
            count: 0,
        });

        this.push('_logs', {
            type: type,
            text: text,
            count: 0,
        });

        this.applyFilter();

        // to make sure after layout and before render
        if ( !this._scrollTaskID ) {
            this._scrollTaskID = window.requestAnimationFrame ( function () {
                this._scrollTaskID = null;
                this.$.view.scrollTop = this.$.view.scrollHeight;
            }.bind(this) );
        }
    },

    clear: function () {
        this.logs = [];
        this._logs = [];
        this.applyFilter();
        Editor.sendToCore('console:clear');
    },

    _format: function ( args ) {
        var text = args.length > 0 ?  args[0] : '';
        if (args.length <= 1) {
{'fraction_non_alphanumeric': 0.1435228331780056, 'fraction_numerical': 0.0022367194780987883, 'mean_word_length': 1.3976764968722073, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '3988610', 'n_tokens_mistral': 1530, 'n_tokens_neox': 1466, 'n_words': 332}