<commit_before>AUI.add('io-stdmod', function(A) {

var L = A.Lang,
	isString = L.isString,

	BLANK = '',
	CFG = 'cfg',
	FORMATTER = 'formatter',
	HOST = 'host',
	ICON = 'icon',
	LOADING = 'loading',
	POST = 'POST',
	SECTION = 'section',
	URI = 'uri',

	getCN = A.ClassNameManager.getClassName,

	CSS_ICON_LOADING = getCN(ICON, LOADING);

var StdMod = A.WidgetStdMod;

/* Standard Module IO Plugin Constructor */
function StdModIOPlugin(config) {
	StdModIOPlugin.superclass.constructor.apply(this, arguments);
}

A.mix(StdModIOPlugin, {
	NAME: 'stdModIOPlugin',

	NS: 'io',

	ATTRS: {
		uri: {
			value: null
		},

		cfg: {
			value: {}
		},

		/*
		* The default formatter to use when formatting response data. The default
		* implementation simply passes back the response data passed in.
		*/
		formatter: {
			valueFn: function() {
				return this._defFormatter;
			}
		},

		/*
		* The Standard Module section to which the io plugin instance is bound.
		* Response data will be used to populate this section, after passing through
		* the configured formatter.
		*/
		section: {
			value: StdMod.BODY,
			validator: function(val) {
				return (!val || val == StdMod.BODY || val == StdMod.HEADER || val == StdMod.FOOTER);
			}
		},

		loading: {
			value: '<div class="' + CSS_ICON_LOADING + '"></div>'
		}
	}
});

A.extend(StdModIOPlugin, A.Plugin.Base, {
	initializer: function() {
		var instance = this;
		var bodyNode = instance.get(HOST).bodyNode;

		StdModIOPlugin.superclass.initializer.apply(this, arguments);

		if (bodyNode) {
			bodyNode.plug(A.Plugin.ParseContent);
		}
	},

	destructor: function() {
		if (this.isActive()) {
			A.io.abort(this._activeIO);
			this._activeIO = null;
		}
	},

	isActive: function() {
		return this._activeIO;
	},

	/*
	* IO Plugin specific method, use to initiate a new io request using the current
	* io configuration settings.<commit_msg>io-stdmod don't allow close the overlay while queue is running, prevent javascript errors on the still running queue<commit_after>AUI.add('io-stdmod', function(A) {

var L = A.Lang,
	isString = L.isString,

	BLANK = '',
	CFG = 'cfg',
	FORMATTER = 'formatter',
	HOST = 'host',
	ICON = 'icon',
	LOADING = 'loading',
	POST = 'POST',
	QUEUE = 'queue',
	SECTION = 'section',
	URI = 'uri',

	getCN = A.ClassNameManager.getClassName,

	CSS_ICON_LOADING = getCN(ICON, LOADING);

var StdMod = A.WidgetStdMod;

/* Standard Module IO Plugin Constructor */
function StdModIOPlugin(config) {
	StdModIOPlugin.superclass.constructor.apply(this, arguments);
}

A.mix(StdModIOPlugin, {
	NAME: 'stdModIOPlugin',

	NS: 'io',

	ATTRS: {
		uri: {
			value: null
		},

		cfg: {
			value: {}
		},

		/*
		* The default formatter to use when formatting response data. The default
		* implementation simply passes back the response data passed in.
		*/
		formatter: {
			valueFn: function() {
				return this._defFormatter;
			}
		},

		/*
		* The Standard Module section to which the io plugin instance is bound.
		* Response data will be used to populate this section, after passing through
		* the configured formatter.
		*/
		section: {
			value: StdMod.BODY,
			validator: function(val) {
				return (!val || val == StdMod.BODY || val == StdMod.HEADER || val == StdMod.FOOTER);
			}
		},

		loading: {
			value: '<div class="' + CSS_ICON_LOADING + '"></div>'
		}
	}
});

A.extend(StdModIOPlugin, A.Plugin.Base, {
	initializer: function() {
		var instance = this;
		var host = instance.get(HOST);
		var bodyNode = host.bodyNode;

		StdModIOPlugin.superclass.initializer.apply(this, arguments);

		if (bodyNode) {
			bodyNode.plug(A.Plugin.ParseContent);
		}

		var queue = bodyNode.ParseContent.get(QUEUE);

		if (queue) {
			// dont close the overlay while queue is running
			host.on('close', function(event) {
				if (queue.isRunning()) {
					event.halt();
				}
			});

			// stop the queue after the dialog is closed, just in case.
			host.after('close', function(event) {
				queue.stop();
			});
		}
	},

	destructor: function() {
		if (this.isActive()) {
			A.io.abort(this._activeIO);
			this._activeIO = null;
		}
	},

	isActive: function() {
		return this._activeIO;
	},

	/*
	* IO Plugin specific method, use to initiate a new io request using the current
	* io configuration settings.
{'fraction_non_alphanumeric': 0.1378986866791745, 'fraction_numerical': 0.0, 'mean_word_length': 3.369877049180328, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2945793', 'n_tokens_mistral': 1644, 'n_tokens_neox': 1474, 'n_words': 385}