<commit_before>/**
 * jQuery.spRequire - A require plugin for jQuery.
 *
 * This plugin requires: 
 *      1. jQuery ~2.0
 *
 * @author  <NAME> <<EMAIL>>
 * @license https://github.com/soloproyectos-js/jquery.sp-require/blob/master/LICENSE MIT License
 * @link    https://github.com/soloproyectos-js/jquery.sp-require
 */
(function ($) {
    /**
     * Library constructor.
     */
    $.spRequireLibrary = function () {
        this._isAsync = true;
        this._libraries = [];
        this._jsSources = [];
        this._cssSources = [];
        this._urlLoader = $.spRequireUrlLoader.getInstance();
    };
    
    /**
     * This variable solves the problem of the 'circular reference'.
     * @static
     * @var {Array.<$.spRequireLibrary>}
     */
    $.spRequireLibrary._circularLibraries = [];
    
    /**
     * URL loader.
     * @var {$.spRequireUrlLoader}
     */
    $.spRequireLibrary.prototype._urlLoader = null;
    
    /**
     * Is an asynchronous library?
     * When the library is 'synchronous', it loads the required libraries in first place. After that,
     * it loads the rest of JavaScript sources.
     */
    $.spRequireLibrary.prototype._isAsync = true;
    
    /**
     * Required libraries.
     * @var {Array.<$.spRequireLibrary>}
     */
    $.spRequireLibrary.prototype._libraries = null;
    
    /**
     * List of JavaScript sources.
     * @var {Array.<string>} URL
     */
    $.spRequireLibrary.prototype._jsSources = null;
    
    /**
     * List of CSS sources.
     * @var {Array.<string>} URL
     */
    $.spRequireLibrary.prototype._cssSources = null;
    
    /**
     * Is the library asynchronous?
     * 
     * An synchronous library loads the required libraries in first place.
     * 
     * @return {boolean}
     */
    $.spRequireLibrary.prototype.isAsync = function () {
        return this._isAsync;
    };
    
    /**
     * Sets the asynchronous state.
     * 
     * @param {boolean} value Is the library asynchronous?
     * 
     * @return {void}
     */
    $.spRequireLibrary.prototype.setAsync = function (value) {
        this._isAsync = value;
    };
    
    /**
     * Adds a JavaScript source.
     * 
     * @param {string} url Path to source
     * 
     * @return {void}
     */
    $.spRequireLibrary.prototype.addJs = function (url) {
        this._jsSources.push(url);
    };
    
    /**
     * Adds a CSS source.
     * 
     * @param {string} url Path to source
     * 
     * @return {void}
     */
    $.spRequireLibrary.prototype.addCss = function (url) {
        this._cssSources.push(url);
    };
    
    /**
     * Adds a required library.
     * 
     * @param {$.spRequireLibrary} lib Library
     * 
     * @return {void}
     */
    $.spRequireLibrary.prototype.addLibrary = function (lib) {
        this._libraries.push(lib);
    };
    
    /**
     * Loads resouces.
     * 
     * @return {$.Promise}
     */
    $.spRequireLibrary.prototype.load = function () {
        this._loadCssSources();
        
        // loads JavaScript sources
        var l = new $.spRequireLoader(this);
        l.addLoader($.proxy(this._loadLibraries, this));
        l.addLoader($.proxy(this._loadJsSources, this));
        return l[this._isAsync? 'load': 'syncLoad']();
    };
    
    /**
     * Loads required libraries.
     * 
     * @return {$.Promise}
     */
    $.spRequireLibrary.prototype._loadLibraries = function () {
        $.spRequireLibrary._circularLibraries.push(this);
        
        var l = new $.spRequireLoader(this);
        $.each(this._libraries, function () {
            if ($.inArray(this, $.spRequireLibrary._circularLibraries) < 0) {
                l.addLoader($.proxy(this.load, this));
            }
        });
        return l.load();
    };
    
    /**
     * Loads JavaScript sources.
     * 
     * @return {$.Promise}
     */
    $.spRequireLibrary.prototype._loadJsSources = function () {
        var self = this;
        var l = new $.spRequireLoader(this);
        $.each(this._jsSources, function (index, url) {
            l.addLoader(function () {
                return self._urlLoader.load(url, function () {
                    return $.ajax({
                        url: url,
                        dataType: "script",<commit_msg>codefix<commit_after>/**
 * jQuery.spRequire - A require plugin for jQuery.
 *
 * This plugin requires: 
 *      1. jQuery ~2.0
 *
 * @author  <NAME> <<EMAIL>>
 * @license https://github.com/soloproyectos-js/jquery.sp-require/blob/master/LICENSE MIT License
 * @link    https://github.com/soloproyectos-js/jquery.sp-require
 */
(function ($) {
    /**
     * Library constructor.
     */
    $.spRequireLibrary = function () {
        this._isAsync = true;
        this._libraries = [];
        this._jsSources = [];
        this._cssSources = [];
        this._urlLoader = $.spRequireUrlLoader.getInstance();
    };
    
    /**
     * This variable solves the problem of the 'circular reference'.
     * @static
     * @var {Array.<$.spRequireLibrary>}
     */
    $.spRequireLibrary._circularLibraries = [];
    
    /**
     * URL loader.
     * @var {$.spRequireUrlLoader}
     */
    $.spRequireLibrary.prototype._urlLoader = null;
    
    /**
     * Is an asynchronous library?
     * When the library is 'synchronous', it loads the required libraries in first place. After that,
     * it loads the rest of JavaScript sources.
     */
    $.spRequireLibrary.prototype._isAsync = true;
    
    /**
     * Required libraries.
     * @var {Array.<$.spRequireLibrary>}
     */
    $.spRequireLibrary.prototype._libraries = null;
    
    /**
     * List of JavaScript sources.
     * @var {Array.<string>} URL
     */
    $.spRequireLibrary.prototype._jsSources = null;
    
    /**
     * List of CSS sources.
     * @var {Array.<string>} URL
     */
    $.spRequireLibrary.prototype._cssSources = null;
    
    /**
     * Is the library asynchronous?
     * 
     * An synchronous library loads the required libraries in first place.
     * 
     * @return {boolean}
     */
    $.spRequireLibrary.prototype.isAsync = function () {
        return this._isAsync;
    };
    
    /**
     * Sets the asynchronous state.
     * 
     * @param {boolean} value Is the library asynchronous?
     * 
     * @return {void}
     */
    $.spRequireLibrary.prototype.setAsync = function (value) {
        this._isAsync = value;
    };
    
    /**
     * Adds a JavaScript source.
     * 
     * @param {string} url Path to source
     * 
     * @return {void}
     */
    $.spRequireLibrary.prototype.addJs = function (url) {
        this._jsSources.push(url);
    };
    
    /**
     * Adds a CSS source.
     * 
     * @param {string} url Path to source
     * 
     * @return {void}
     */
    $.spRequireLibrary.prototype.addCss = function (url) {
        this._cssSources.push(url);
    };
    
    /**
     * Adds a required library.
     * 
     * @param {$.spRequireLibrary} lib Library
     * 
     * @return {void}
     */
    $.spRequireLibrary.prototype.addLibrary = function (lib) {
        this._libraries.push(lib);
    };
    
    /**
     * Loads resouces.
     * 
     * @return {$.Promise}
     */
    $.spRequireLibrary.prototype.load = function () {
        this._loadCssSources();
        
        // loads JavaScript sources
        var l = new $.spRequireLoader();
        l.addLoader($.proxy(this._loadLibraries, this));
        l.addLoader($.proxy(this._loadJsSources, this));
        return l[this._isAsync? 'load': 'syncLoad']();
    };
    
    /**
     * Loads required libraries.
     * 
     * @return {$.Promise}
     */
    $.spRequireLibrary.prototype._loadLibraries = function () {
        var l = new $.spRequireLoader();
        $.spRequireLibrary._circularLibraries.push(this);
        $.each(this._libraries, function () {
            if ($.inArray(this, $.spRequireLibrary._circularLibraries) < 0) {
                l.addLoader($.proxy(this.load, this));
            }
        });
        return l.load();
    };
    
    /**
     * Loads JavaScript sources.
     * 
     * @return {$.Promise}
     */
    $.spRequireLibrary.prototype._loadJsSources = function () {
        var self = this;
        var l = new $.spRequireLoader();
        $.each(this._jsSources, function (index, url) {
            l.addLoader(function () {
                return self._urlLoader.load(url, function () {
                    return $.ajax({
                        url: url,
                        dataType: "script",
{'fraction_non_alphanumeric': 0.13810921902524956, 'fraction_numerical': 0.0009395184967704052, 'mean_word_length': 1.8367754830113259, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 4, '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': '1189289', 'n_tokens_mistral': 2540, 'n_tokens_neox': 2482, 'n_words': 521}