<commit_before>/*global enyo, setTimeout, clearTimeout */

enyo.kind({
	name: "Ares.DesignerFrame",
	classes: "enyo-fit",
	id: "aresApp",
	handlers: {
		ondragleave: "designerFrameDragleave",
		onWebkitTransitionEnd: "prerenderMoveComplete" // TODO
	},
	published: {
		containerItem: null,
		beforeItem: null,
		currentDropTarget: null,
		createPaletteItem: null,
		dragType: null
	},
	components: [
		{name: "client", classes:"enyo-fit"},
		{name: "cloneArea", style: "background:rgba(0,200,0,0.5); opacity: 0;", classes: "enyo-fit enyo-clip", showing: false},
		{name: "flightArea", classes: "enyo-fit", showing: false},
		{name: "serializer", kind: "Ares.Serializer"},
		{name: "communicator", kind: "RPCCommunicator", onMessage: "receiveMessage"},
		{name: "dropHighlight", classes: "designer-frame-highlight designer-frame-drop-highlight"},

		//* Resize handles
		{name: "topLeftResizeHandle", classes: "designer-frame-resize-handle", showing: false, sides: {top: true, left: true}, style: "top: 0px; left: 0px;"},
		{name: "topRightResizeHandle", classes: "designer-frame-resize-handle", showing: false, sides: {top: true, right: true}, style: "top: 0px; right: 0px;"},
		{name: "bottomLeftResizeHandle", classes: "designer-frame-resize-handle", showing: false, sides: {bottom: true, left: true}, style: "bottom: 0px; left: 0px;"},
		{name: "bottomRightResizeHandle", classes: "designer-frame-resize-handle", showing: false, sides: {bottom: true, right: true}, style: "bottom: 0px; right: 0px;"}
	],

	selection: null,
	parentInstance: null,
	containerData: null,
	aresComponents: [],
	prevX: null,
	prevY: null,
	dragoverTimeout: null,
	holdoverTimeout: null,
	moveControlSecs: 0.2,
	edgeThresholdPx: 10,
	debug: false,


	// designerFrame will complain if user's application loads en enyo older than:
	minEnyoVersion: "2.3.0-pre.9",

	create: function() {
		this.trace = (this.debug === true ? this.log : function(){});
		this.inherited(arguments);
		this.addHandlers();
		this.addDispatcherFeature();
		window.onerror = enyo.bind(this, this.raiseLoadError);
	},
	raiseLoadError: function(msg, url, linenumber) {
		// I'm a goner
		var file = url.replace(/.*\/services(?=\/)/,'');
		var errMsg = "user app load FAILED with error '" + msg + "' in " + file + " line " + linenumber  ;
		this.trace(errMsg);
		this.sendMessage({op: "reloadNeeded"});
		this.sendMessage({op: "error", val: {msg: errMsg}});
		return true;
	},
	rendered: function() {
		this.inherited(arguments);
		this.trace("called");
		var expVer = this.minEnyoVersion.split(/\D+/);
		var myVerStr = (enyo.version && enyo.version.enyo) || '0.0.0-pre.0';
		var myVer = myVerStr.split(/\D+/);
		var errMsg ;

		while (expVer.length) {
			// myVer and exptVer contain a string. Need to cast them
			// to Number before trying a numeric comparison. Otherwise
			// a lexicographic comparison is used.
			if (Number(myVer.shift()) < Number(expVer.shift())) {
				errMsg = "Enyo used by your application is too old ("
					+ myVerStr + "). Console log may show duplicated kind error "<commit_msg>ENYO-3622: compare pre and rc when checking enyo version<commit_after>/*global enyo, setTimeout, clearTimeout */

enyo.kind({
	name: "Ares.DesignerFrame",
	classes: "enyo-fit",
	id: "aresApp",
	handlers: {
		ondragleave: "designerFrameDragleave",
		onWebkitTransitionEnd: "prerenderMoveComplete" // TODO
	},
	published: {
		containerItem: null,
		beforeItem: null,
		currentDropTarget: null,
		createPaletteItem: null,
		dragType: null
	},
	components: [
		{name: "client", classes:"enyo-fit"},
		{name: "cloneArea", style: "background:rgba(0,200,0,0.5); opacity: 0;", classes: "enyo-fit enyo-clip", showing: false},
		{name: "flightArea", classes: "enyo-fit", showing: false},
		{name: "serializer", kind: "Ares.Serializer"},
		{name: "communicator", kind: "RPCCommunicator", onMessage: "receiveMessage"},
		{name: "dropHighlight", classes: "designer-frame-highlight designer-frame-drop-highlight"},

		//* Resize handles
		{name: "topLeftResizeHandle", classes: "designer-frame-resize-handle", showing: false, sides: {top: true, left: true}, style: "top: 0px; left: 0px;"},
		{name: "topRightResizeHandle", classes: "designer-frame-resize-handle", showing: false, sides: {top: true, right: true}, style: "top: 0px; right: 0px;"},
		{name: "bottomLeftResizeHandle", classes: "designer-frame-resize-handle", showing: false, sides: {bottom: true, left: true}, style: "bottom: 0px; left: 0px;"},
		{name: "bottomRightResizeHandle", classes: "designer-frame-resize-handle", showing: false, sides: {bottom: true, right: true}, style: "bottom: 0px; right: 0px;"}
	],

	selection: null,
	parentInstance: null,
	containerData: null,
	aresComponents: [],
	prevX: null,
	prevY: null,
	dragoverTimeout: null,
	holdoverTimeout: null,
	moveControlSecs: 0.2,
	edgeThresholdPx: 10,
	debug: false,


	// designerFrame will complain if user's application loads en enyo older than:
	minEnyoVersion: "2.3.0-pre.9",

	create: function() {
		this.trace = (this.debug === true ? this.log : function(){});
		this.inherited(arguments);
		this.addHandlers();
		this.addDispatcherFeature();
		window.onerror = enyo.bind(this, this.raiseLoadError);
	},
	raiseLoadError: function(msg, url, linenumber) {
		// I'm a goner
		var file = url.replace(/.*\/services(?=\/)/,'');
		var errMsg = "user app load FAILED with error '" + msg + "' in " + file + " line " + linenumber  ;
		this.trace(errMsg);
		this.sendMessage({op: "reloadNeeded"});
		this.sendMessage({op: "error", val: {msg: errMsg}});
		return true;
	},
	rendered: function() {
		this.inherited(arguments);
		this.trace("called");
		var splitRegExp = /[\.\-]+/ ;
		// version can be like 1.2.3-pre.4 or 1.2.3-rc.1
		// rc sorts after pre
		var expVer = this.minEnyoVersion.split(splitRegExp);
		var myVerStr = (enyo.version && enyo.version.enyo) || '0.0.0-pre.0';
		var myVer = myVerStr.split(splitRegExp);
		var errMsg, mysv, expsv ;

		while (expVer.length) {
			mysv  =  myVer.shift();
			expsv = expVer.shift();
			// myVer and exptVer contain a string. Need to cast them
			// to Number before trying a numeric comparison. Otherwise
			// a lexicographic comparison is used.
			if (/\d/.test(mysv) ? Number(mysv) < Number(expsv) : mysv < expsv) {
				errMsg = "Enyo used by your application is too old ("
					+ myVerStr + "). Console log may show duplicated kind error "
{'fraction_non_alphanumeric': 0.16551507537688442, 'fraction_numerical': 0.010678391959798994, 'mean_word_length': 4.471649484536083, 'pattern_counts': {'":': 0, '<': 6, '<?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': '6642385', 'n_tokens_mistral': 2365, 'n_tokens_neox': 2181, 'n_words': 574}