<commit_before>"use strict";

require("../vendor/FontLoader.js");

function buildFontFaceRule(family, urls) {
	var eot = urls["embedded-opentype"];
	var woff = urls.woff;
	var ttf = urls.truetype;
	var svg = urls.svg;

	var css = "\n";
	css += "@font-face {\n";
	css += "  font-family: '" + family + "';\n";
	css += "  src: url('" + eot + "');\n";
	css += "  src: url('" + eot + "?iefix') format('embedded-opentype'),\n";
	css += "       url('" + woff + "') format('woff'),\n";
	css += "       url('" + ttf + "') format('ttf'),\n";
	css += "       url('" + svg + "') format('svg');\n";
	css += "}\n";
	return css;
}

function createCssFontFaces(fontFamilies) {
	var style = document.createElement("style");
	style.setAttribute("type", "text/css");
	var css = "";
	for (var family in fontFamilies) {
		if (fontFamilies.hasOwnProperty(family)) {
			css += buildFontFaceRule(family, fontFamilies[family]);
		}
	}
	style.appendChild(document.createTextNode(css));
	document.head.appendChild(style);
}

function FontLoader() {
	this.totalFonts = 0;
	this.loadedFonts = 0;
}
FontLoader.prototype.load = function(fontFamilies) {
	createCssFontFaces(fontFamilies);

	var families = [];
	for (var family in fontFamilies) {
		if (families.hasOwnProperty(family)) {
			families.push(family);
		}
	}
	this.totalFonts += families.length;

	var that = this;
	var loader = new window.FontLoader(families, {
		"fontLoaded": function() {
			that.loadedFonts++;
		}
	});
	loader.loadFonts();
};
FontLoader.prototype.allLoaded = function() {
	return this.totalFonts === this.loadedFonts;
};

function EjectaFontLoader() {
}
EjectaFontLoader.prototype.load = function(fontFamilies) {
	for (var family in fontFamilies) {
		if (fontFamilies.hasOwnProperty(family)) {
			var fontPath = fontFamilies[family].truetype;
			if (fontPath) {
				window.ejecta.loadFont(fontPath);
			}
		}
	}
};
EjectaFontLoader.prototype.allLoaded = function() {
	return true;
};

if (window.ejecta) {<commit_msg>Add variables for loading bar in Eject version.<commit_after>"use strict";

require("../vendor/FontLoader.js");

function buildFontFaceRule(family, urls) {
	var eot = urls["embedded-opentype"];
	var woff = urls.woff;
	var ttf = urls.truetype;
	var svg = urls.svg;

	var css = "\n";
	css += "@font-face {\n";
	css += "  font-family: '" + family + "';\n";
	css += "  src: url('" + eot + "');\n";
	css += "  src: url('" + eot + "?iefix') format('embedded-opentype'),\n";
	css += "       url('" + woff + "') format('woff'),\n";
	css += "       url('" + ttf + "') format('ttf'),\n";
	css += "       url('" + svg + "') format('svg');\n";
	css += "}\n";
	return css;
}

function createCssFontFaces(fontFamilies) {
	var style = document.createElement("style");
	style.setAttribute("type", "text/css");
	var css = "";
	for (var family in fontFamilies) {
		if (fontFamilies.hasOwnProperty(family)) {
			css += buildFontFaceRule(family, fontFamilies[family]);
		}
	}
	style.appendChild(document.createTextNode(css));
	document.head.appendChild(style);
}

function FontLoader() {
	this.totalFonts = 0;
	this.loadedFonts = 0;
}
FontLoader.prototype.load = function(fontFamilies) {
	createCssFontFaces(fontFamilies);

	var families = [];
	for (var family in fontFamilies) {
		if (families.hasOwnProperty(family)) {
			families.push(family);
		}
	}
	this.totalFonts += families.length;

	var that = this;
	var loader = new window.FontLoader(families, {
		"fontLoaded": function() {
			that.loadedFonts++;
		}
	});
	loader.loadFonts();
};
FontLoader.prototype.allLoaded = function() {
	return this.totalFonts === this.loadedFonts;
};

function EjectaFontLoader() {
	this.totalFonts = 0;
	this.loadedFonts = 0;
}
EjectaFontLoader.prototype.load = function(fontFamilies) {
	for (var family in fontFamilies) {
		if (fontFamilies.hasOwnProperty(family)) {
			var fontPath = fontFamilies[family].truetype;
			if (fontPath) {
				window.ejecta.loadFont(fontPath);
			}
		}
	}
};
EjectaFontLoader.prototype.allLoaded = function() {
	return true;
};

if (window.ejecta) {
{'fraction_non_alphanumeric': 0.18057285180572852, 'fraction_numerical': 0.0014943960149439602, 'mean_word_length': 4.168597168597168, 'pattern_counts': {'":': 2, '<': 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': '3173087', 'n_tokens_mistral': 1557, 'n_tokens_neox': 1464, 'n_words': 283}