<commit_before>var TIP, vendorCss,

// .bind()/.on() namespace
TIPNS = '.qtip-tip',

// Common CSS strings
MARGIN = 'margin',
BORDER = 'border',
COLOR = 'color',
BG_COLOR = 'background-color',
TRANSPARENT = 'transparent',
IMPORTANT = ' !important',

// Check if the browser supports <canvas/> elements
HASCANVAS = !!document.createElement('canvas').getContext,

// Invalid colour values used in parseColours()
INVALID = /rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i;

// Camel-case method, taken from jQuery source
// http://code.jquery.com/jquery-1.8.0.js
function camel(s) { return s.charAt(0).toUpperCase() + s.slice(1); }

/*
 * This is only need for 1.7.x and below (check for 1.8 and
 * above using $.curCss, which was removed in 1.8)
 * 
 * Modified from Modernizr's testPropsAll()
 * http://modernizr.com/downloads/modernizr-latest.js
 */
if(!$.curCSS) {
	vendorCss = function(elem, prop) { return elem.css(prop); };
}
else {
	var cssProps = {}, cssPrefixes = ["Webkit", "O", "Moz", "ms"];
	vendorCss = function(elem, prop) {
		var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
			props = (prop + ' ' + cssPrefixes.join(ucProp + ' ') + ucProp).split(' '),
			cur, val, i;

		// If the property has already been mapped...
		if(cssProps[prop]) { return elem.css(cssProps[prop]); }

		for(i in props) {
			cur = props[i];
			if((val = elem.css(cur)) !== undefined) {
				return cssProps[prop] = cur, val;
			}
		}
	};
}

// Parse a given elements CSS property into an int
function intCss(elem, prop) {
	return parseInt(vendorCss(elem, prop), 10);
}

function calculateSize(size, corner, border) {
	var y = corner.precedance === Y,
		width = size [ y ? 0 : 1 ],
		height = size [ y ? 1 : 0 ],
		isCenter = corner.string().indexOf(CENTER) > -1,
		base = width * (isCenter ? 0.5 : 1),
		pow = Math.pow,
		round = Math.round,
		bigHyp, ratio, result,

	smallHyp = Math.sqrt( pow(base, 2) + pow(height, 2) ),
	
	hyp = [ (border / base) * smallHyp, (border / height) * smallHyp ];
	hyp[2] = Math.sqrt( pow(hyp[0], 2) - pow(border, 2) );
	hyp[3] = Math.sqrt( pow(hyp[1], 2) - pow(border, 2) );

	bigHyp = smallHyp + hyp[2] + hyp[3] + (isCenter ? 0 : hyp[0]);
	ratio = bigHyp / smallHyp;

	result = [ round(ratio * height), round(ratio * width) ];
	return y ? result : result.reverse();
}

// Tip coordinates calculator
function calculateTip(corner, width, height)
{	
	var width2 = Math.ceil(width / 2), height2 = Math.ceil(height / 2),

	// Define tip coordinates in terms of height and width values
	tips = {
		bottomright:	[[0,0],				[width,height],		[width,0]],
		bottomleft:		[[0,0],				[width,0],				[0,height]],
		topright:		[[0,height],		[width,0],				[width,height]],
		topleft:			[[0,0],				[0,height],				[width,height]],
		topcenter:		[[0,height],		[width2,0],				[width,height]],
		bottomcenter:	[[0,0],				[width,0],				[width2,height]],
		rightcenter:	[[0,0],				[width,height2],		[0,height]],
		leftcenter:		[[width,0],			[width,height],		[0,height2]]
	};<commit_msg>Fix calculateSize error that caused tips to have wrong dimensions<commit_after>var TIP, vendorCss,

// .bind()/.on() namespace
TIPNS = '.qtip-tip',

// Common CSS strings
MARGIN = 'margin',
BORDER = 'border',
COLOR = 'color',
BG_COLOR = 'background-color',
TRANSPARENT = 'transparent',
IMPORTANT = ' !important',

// Check if the browser supports <canvas/> elements
HASCANVAS = !!document.createElement('canvas').getContext,

// Invalid colour values used in parseColours()
INVALID = /rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i;

// Camel-case method, taken from jQuery source
// http://code.jquery.com/jquery-1.8.0.js
function camel(s) { return s.charAt(0).toUpperCase() + s.slice(1); }

/*
 * This is only need for 1.7.x and below (check for 1.8 and
 * above using $.curCss, which was removed in 1.8)
 * 
 * Modified from Modernizr's testPropsAll()
 * http://modernizr.com/downloads/modernizr-latest.js
 */
if(!$.curCSS) {
	vendorCss = function(elem, prop) { return elem.css(prop); };
}
else {
	var cssProps = {}, cssPrefixes = ["Webkit", "O", "Moz", "ms"];
	vendorCss = function(elem, prop) {
		var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
			props = (prop + ' ' + cssPrefixes.join(ucProp + ' ') + ucProp).split(' '),
			cur, val, i;

		// If the property has already been mapped...
		if(cssProps[prop]) { return elem.css(cssProps[prop]); }

		for(i in props) {
			cur = props[i];
			if((val = elem.css(cur)) !== undefined) {
				return cssProps[prop] = cur, val;
			}
		}
	};
}

// Parse a given elements CSS property into an int
function intCss(elem, prop) {
	return parseInt(vendorCss(elem, prop), 10);
}

function calculateSize(size, corner, border) {
	var y = corner.precedance === Y,
		width = size [ y ? 0 : 1 ],
		height = size [ y ? 1 : 0 ],
		isCenter = corner.string().indexOf(CENTER) > -1,
		base = width * (isCenter ? 0.5 : 1),
		pow = Math.pow,
		round = Math.round,
		bigHyp, ratio, result,

	smallHyp = Math.sqrt( pow(base, 2) + pow(height, 2) ),
	hyp = [ (border / base) * smallHyp, (border / height) * smallHyp ];
	
	hyp[2] = Math.sqrt( pow(hyp[0], 2) - pow(border, 2) );
	hyp[3] = Math.sqrt( pow(hyp[1], 2) - pow(border, 2) );

	bigHyp = smallHyp + hyp[2] + hyp[3] + (isCenter ? 0 : hyp[0]);
	ratio = bigHyp / smallHyp;

	result = [ round(ratio * width), round(ratio * height) ];
	return y ? result : result.reverse();
}

// Tip coordinates calculator
function calculateTip(corner, width, height)
{	
	var width2 = Math.ceil(width / 2), height2 = Math.ceil(height / 2),

	// Define tip coordinates in terms of height and width values
	tips = {
		bottomright:	[[0,0],				[width,height],		[width,0]],
		bottomleft:		[[0,0],				[width,0],				[0,height]],
		topright:		[[0,height],		[width,0],				[width,height]],
		topleft:			[[0,0],				[0,height],				[width,height]],
		topcenter:		[[0,height],		[width2,0],				[width,height]],
		bottomcenter:	[[0,0],				[width,0],				[width2,height]],
		rightcenter:	[[0,0],				[width,height2],		[0,height]],
		leftcenter:		[[width,0],			[width,height],		[0,height2]]
	};
{'fraction_non_alphanumeric': 0.1890547263681592, 'fraction_numerical': 0.025538971807628524, 'mean_word_length': 3.6535493827160495, 'pattern_counts': {'":': 0, '<': 5, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6390118', 'n_tokens_mistral': 2463, 'n_tokens_neox': 2238, 'n_words': 567}