<commit_before>(function($window, $ember) {

    "use strict";

    /**
     * @property MultipleInput
     * @type {Object}
     */
    var MultipleInput = {

        /**
         * @property tagName
         * @type {String}
         * @default "input"
         */
        tagName: 'input',

        /**
         * @property classNames
         * @type {String}
         * @default "files"
         */
        classNames: 'files',

        /**
         * @property attributeBindings
         * @type {Array}
         */
        attributeBindings: ['name', 'type', 'multiple'],

        /**
         * @property file
         * @type {String}
         * @default "file"
         */
        type: 'file',

        /**
         * @property multiple
         * @type {String}
         * @default "multiple"
         */
        multiple: 'multiple',

        /**
         * Invoked when the content of the INPUT changes.
         *
         * @method change
         * @return {Boolean}
         */
        change: function() {
            var files = this.get('element').files;
            return this.get('parentView').traverseFiles(files);
        }

    };

    /**
     * @property SingleInput
     * @type {Object}
     */
    var SingleInput      = $ember.copy(MultipleInput);
    SingleInput.multiple = false;

    /**
     * @module App
     * @class DropletView
     * @type Ember.View
     * @extends Ember.View
     */
    $window.DropletView = $ember.View.extend({

        /**
         * @property classNames
         * @type {Array}
         * @default ['droppable']
         */
        classNames: ['droppable'],

        /**
         * @property ImagePreview
         * @type {Ember.View}
         */
        ImagePreview: $ember.View.extend({

            /**
             * @property tagName
             * @type {String}
             * @default "img"
             */
            tagName: 'img',

            /**
             * @property attributeBindings
             * @type {Array}
             * @default ['src']
             */
            attributeBindings: ['src'],

            /**
             * @property src
             * @type {String}
             * @default null
             */
            src: null,

            /**
             * @property image
             * @type {String}
             * @default null
             */
            image: null,

            /**
             * Invoked when the view is inserted into the DOM.
             *
             * @method didInsertElement
             * @return {void}
             */
            didInsertElement: function() {

                // Initialise the FileReader, and find the image that was passed into
                // the view when instantiating it.
                var reader  = new $window.FileReader(),
                    image   = $ember.get(this, 'image.file');

                // Ensure that the file we're dealing with is an image.
                if (!image.type.match(/^image\//i)) {

                    // If it isn't then we'll need to destroy the view immediately.
                    this.destroy();
                    return;

                }

                // Invoked when the image preview has been loaded.
                reader.onload = function (event) {

                    if (this.get('isDestroyed') === true) {
                        // If the view has already been destroyed, then we can't
                        // load in the image preview.
                        return;
                    }

                    // Otherwise we're free to set the SRC attribute to the image's data.
                    $ember.set(this, 'src', event.target.result);

                }.bind(this);

                // Begin the reading of the image.
                reader.readAsDataURL(image);

            }

        }),

        /**<commit_msg>Execute FileReader#onload within Ember run loop<commit_after>(function($window, $ember) {

    "use strict";

    /**
     * @property MultipleInput
     * @type {Object}
     */
    var MultipleInput = {

        /**
         * @property tagName
         * @type {String}
         * @default "input"
         */
        tagName: 'input',

        /**
         * @property classNames
         * @type {String}
         * @default "files"
         */
        classNames: 'files',

        /**
         * @property attributeBindings
         * @type {Array}
         */
        attributeBindings: ['name', 'type', 'multiple'],

        /**
         * @property file
         * @type {String}
         * @default "file"
         */
        type: 'file',

        /**
         * @property multiple
         * @type {String}
         * @default "multiple"
         */
        multiple: 'multiple',

        /**
         * Invoked when the content of the INPUT changes.
         *
         * @method change
         * @return {Boolean}
         */
        change: function() {
            var files = this.get('element').files;
            return this.get('parentView').traverseFiles(files);
        }

    };

    /**
     * @property SingleInput
     * @type {Object}
     */
    var SingleInput      = $ember.copy(MultipleInput);
    SingleInput.multiple = false;

    /**
     * @module App
     * @class DropletView
     * @type Ember.View
     * @extends Ember.View
     */
    $window.DropletView = $ember.View.extend({

        /**
         * @property classNames
         * @type {Array}
         * @default ['droppable']
         */
        classNames: ['droppable'],

        /**
         * @property ImagePreview
         * @type {Ember.View}
         */
        ImagePreview: $ember.View.extend({

            /**
             * @property tagName
             * @type {String}
             * @default "img"
             */
            tagName: 'img',

            /**
             * @property attributeBindings
             * @type {Array}
             * @default ['src']
             */
            attributeBindings: ['src'],

            /**
             * @property src
             * @type {String}
             * @default null
             */
            src: null,

            /**
             * @property image
             * @type {String}
             * @default null
             */
            image: null,

            /**
             * Invoked when the view is inserted into the DOM.
             *
             * @method didInsertElement
             * @return {void}
             */
            didInsertElement: function() {

                // Initialise the FileReader, and find the image that was passed into
                // the view when instantiating it.
                var reader  = new $window.FileReader(),
                    image   = $ember.get(this, 'image.file');

                // Ensure that the file we're dealing with is an image.
                if (!image.type.match(/^image\//i)) {

                    // If it isn't then we'll need to destroy the view immediately.
                    this.destroy();
                    return;

                }

                // Invoked when the image preview has been loaded.
                reader.onload = $ember.run.bind(this, function (event) {

                    if (this.get('isDestroyed') === true) {
                        // If the view has already been destroyed, then we can't
                        // load in the image preview.
                        return;
                    }

                    // Otherwise we're free to set the SRC attribute to the image's data.
                    $ember.set(this, 'src', event.target.result);

                });

                // Begin the reading of the image.
                reader.readAsDataURL(image);

            }

        }),

        /**
{'fraction_non_alphanumeric': 0.11634491634491634, 'fraction_numerical': 0.0, 'mean_word_length': 1.0980021598272138, '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': '4545256', 'n_tokens_mistral': 2023, 'n_tokens_neox': 1899, 'n_words': 505}