<commit_before>// Rebase require directory
requirejs.config({
	baseUrl: "lib",
	paths: {
		activity: "../js"
	}
});

// Initial templates
const templates = [
	{name: "Colors", image:"colors.png", icons: [], colors: [-1], size: 80, blink: 1500,  message: {content: "", color: "#ff0000", size: 60, weight: "bold", style: "normal"}},
	{name: "Blue Moon", image:"bluemoon.png", icons: ["org.sugarlabs.Falabracman", "org.sugarlabs.moon"], colors: [124, 120, 122, 123, 121], size: 60, blink: 1000,  message: {content: "Blue Moon", color: "#00008b", size: 100, weight: "normal", style: "italic"}},
	{name: "Merry Christmas", image:"merrychristmas.png", icons: ["org.olpcfrance.XmasLights"], colors: [83, 82, 256, 23, 22, 256], size: 60, blink: 1000,  message: {content: "Merry\nChristmas", color: "#ff0000", size: 80, weight: "bold", style: "normal"}},
	{name: "Happy New Year", image:"happynewyear.png", icons: ["com.homegrownapps.xoeditor"], colors: [], size: 60, blink: 1000,  message: {content: "Happy\nNew Year!", color: "#000000", size: 80, weight: "normal", style: "normal"}}
];
const initTemplate = 0;
const initIcons = templates[initTemplate].icons;
const initColors = templates[initTemplate].colors;
const initSize = templates[initTemplate].size;
const initBlinkTime = templates[initTemplate].blink;
const initMessageContent = templates[initTemplate].message.content;
const initMessageColor = templates[initTemplate].message.color;
const initMessageSize = templates[initTemplate].message.size;
const initMessageWeight = templates[initTemplate].message.weight;
const initMessageStyle = templates[initTemplate].message.style;
const minSize = 30;
const maxSize = 90;
const viewGrid = 1;
const viewDetail = 2;
const displayDebug = false;

// Vue main app
var app = new Vue({
	el: '#app',
	data: {
		currentView: viewGrid,
		activitiesIcons: [],
		randomIcon: null,
		gridContent: [],
		pattern: initIcons,
		colors: initColors,
		detailContent: {
			dropIcons: [],
			dragIcons: [],
			dropColors: [],
			dragColors: []
		},
		draggedItem: null,
		size: initSize,
		blinkTime: initBlinkTime,
		message: "",
		messageStyle: {
			color: initMessageColor,
			fontWeight: initMessageWeight,
			fontStyle: initMessageStyle,
			size: initMessageSize
		},
		interval: null,
		paused: false,
		SugarL10n: null,
		SugarPresence: null,
		l10n: {
			stringUnfullscreen: "",
			stringFullscreen: "",
			stringSettings: "",
			stringSpeed: "",
			stringZoom: "",
			stringTemplates: "",
			stringText: "",
			stringPlay: "",
			stringPause: "",
			stringEmptyIcon: "",
			stringEmptyColor: "",
			stringDragIcons: "",
			stringDragColors: ""
		}
	},

	mounted() {
		this.SugarL10n = this.$refs.SugarL10n;
		this.SugarPresence = this.$refs.SugarPresence;
	},

	created() {
		let vm = this;

		// Resize dynamically grid
		let message = document.getElementById("message");
		var computeHeight = function() {
			let available = (document.getElementById("body").offsetHeight-(vm.$refs.SugarToolbar&&vm.$refs.SugarToolbar.isHidden()?0:55));
			let grid = document.getElementById("grid");
			let detail = document.getElementById("detail");
			if (detail) { detail.style.height = available+"px"; }
			if (!grid) { return }
			grid.style.height = available+"px";
			if (Object.keys(vm.activitiesIcons).length > 0) {
				vm.generateGrid();
				vm.blink();
			}
		}
		computeHeight();
		window.addEventListener("resize", computeHeight);
	},

	methods: {
		// initialize
		initialize: function() {
			let vm = this;
			return new Promise(function(resolve, reject) {
				let content = [];

				// Load activities list
				_loadActivities().then(function(activities) {
					// Load an convert to pure SVG each icon
					activities.push({directory:"activities/XmasLights.activity",icon:"icons/color.svg",id:"color"});
					let len = activities.length;
					for (let i = 0 ; i < len ; i++) {
						let activity = activities[i];
						_loadIcon("../../"+activity.directory+"/"+activity.icon).then(function(svg) {
							content[activity.id] = svg;
							if (Object.keys(content).length == len) {
								let keys = [...Object.keys(content)];
								keys.sort();
								keys.forEach(function(id) {
									vm.activitiesIcons[id] = content[id];
									if (Object.keys(vm.activitiesIcons).length == len) {
										resolve();
									}
								});
							}
						});
					}
				});
				_loadIcon("../../activities/XmasLights.activity/icons/random.svg").then(function(svg) {
					vm.randomIcon = svg;
				});
			});
		},

		// Localize strings
		localized: function() {
			let vm = this;
			vm.SugarL10n.localize(vm.l10n);<commit_msg>Add icons from Sugarizer core<commit_after>// Rebase require directory
requirejs.config({
	baseUrl: "lib",
	paths: {
		activity: "../js"
	}
});

// Initial templates
const templates = [
	{name: "Colors", image:"colors.png", icons: [], colors: [-1], size: 80, blink: 1500,  message: {content: "", color: "#ff0000", size: 60, weight: "bold", style: "normal"}},
	{name: "Blue Moon", image:"bluemoon.png", icons: ["org.sugarlabs.Falabracman", "org.sugarlabs.moon"], colors: [124, 120, 122, 123, 121], size: 60, blink: 1000,  message: {content: "Blue Moon", color: "#00008b", size: 100, weight: "normal", style: "italic"}},
	{name: "<NAME>", image:"merrychristmas.png", icons: ["org.olpcfrance.XmasLights"], colors: [83, 82, 256, 23, 22, 256], size: 60, blink: 1000,  message: {content: "Merry\nChristmas", color: "#ff0000", size: 80, weight: "bold", style: "normal"}},
	{name: "Happy New Year", image:"happynewyear.png", icons: ["com.homegrownapps.xoeditor"], colors: [], size: 60, blink: 1000,  message: {content: "Happy\nNew Year!", color: "#000000", size: 80, weight: "normal", style: "normal"}}
];
const initTemplate = 0;
const initIcons = templates[initTemplate].icons;
const initColors = templates[initTemplate].colors;
const initSize = templates[initTemplate].size;
const initBlinkTime = templates[initTemplate].blink;
const initMessageContent = templates[initTemplate].message.content;
const initMessageColor = templates[initTemplate].message.color;
const initMessageSize = templates[initTemplate].message.size;
const initMessageWeight = templates[initTemplate].message.weight;
const initMessageStyle = templates[initTemplate].message.style;
const minSize = 30;
const maxSize = 90;
const viewGrid = 1;
const viewDetail = 2;
const displayDebug = false;

// Vue main app
var app = new Vue({
	el: '#app',
	data: {
		currentView: viewGrid,
		activitiesIcons: [],
		randomIcon: null,
		gridContent: [],
		pattern: initIcons,
		colors: initColors,
		detailContent: {
			dropIcons: [],
			dragIcons: [],
			dropColors: [],
			dragColors: []
		},
		draggedItem: null,
		size: initSize,
		blinkTime: initBlinkTime,
		message: "",
		messageStyle: {
			color: initMessageColor,
			fontWeight: initMessageWeight,
			fontStyle: initMessageStyle,
			size: initMessageSize
		},
		interval: null,
		paused: false,
		SugarL10n: null,
		SugarPresence: null,
		l10n: {
			stringUnfullscreen: "",
			stringFullscreen: "",
			stringSettings: "",
			stringSpeed: "",
			stringZoom: "",
			stringTemplates: "",
			stringText: "",
			stringPlay: "",
			stringPause: "",
			stringEmptyIcon: "",
			stringEmptyColor: "",
			stringDragIcons: "",
			stringDragColors: ""
		}
	},

	mounted() {
		this.SugarL10n = this.$refs.SugarL10n;
		this.SugarPresence = this.$refs.SugarPresence;
	},

	created() {
		let vm = this;

		// Resize dynamically grid
		let message = document.getElementById("message");
		var computeHeight = function() {
			let available = (document.getElementById("body").offsetHeight-(vm.$refs.SugarToolbar&&vm.$refs.SugarToolbar.isHidden()?0:55));
			let grid = document.getElementById("grid");
			let detail = document.getElementById("detail");
			if (detail) { detail.style.height = available+"px"; }
			if (!grid) { return }
			grid.style.height = available+"px";
			if (Object.keys(vm.activitiesIcons).length > 0) {
				vm.generateGrid();
				vm.blink();
			}
		}
		computeHeight();
		window.addEventListener("resize", computeHeight);
	},

	methods: {
		// initialize
		initialize: function() {
			let vm = this;
			return new Promise(function(resolve, reject) {
				let content = [];

				// Load activities list
				_loadActivities().then(function(activities) {
					// Load an convert to pure SVG each icon
					activities.push({directory:"activities/XmasLights.activity",icon:"icons/color.svg",id:"color"});
					activities.push({directory:"icons",icon:"/activity-journal.svg",id:"journal"});
					activities.push({directory:"icons",icon:"/emblem-favorite.svg",id:"favorite"});
					activities.push({directory:"icons",icon:"/network-wireless-connected-100.svg",id:"server"});
					activities.push({directory:"icons",icon:"/cloud-settings.svg",id:"cloud"});
					let len = activities.length;
					for (let i = 0 ; i < len ; i++) {
						let activity = activities[i];
						_loadIcon("../../"+activity.directory+"/"+activity.icon).then(function(svg) {
							content[activity.id] = svg;
							if (Object.keys(content).length == len) {
								let keys = [...Object.keys(content)];
								keys.sort();
								keys.forEach(function(id) {
									vm.activitiesIcons[id] = content[id];
									if (Object.keys(vm.activitiesIcons).length == len) {
										resolve();
									}
								});
							}
						});
					}
				});
				_loadIcon("../../activities/XmasLights.activity/icons/random.svg").then(function(svg) {
					vm.randomIcon = svg;
				});
			});
		},

		// Localize strings
		localized: function() {
			let vm = this;
			vm.SugarL10n.localize(vm.l10n);
{'fraction_non_alphanumeric': 0.16798997074801506, 'fraction_numerical': 0.022461345591307982, 'mean_word_length': 3.9549689440993787, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '3945027', 'n_tokens_mistral': 3797, 'n_tokens_neox': 3073, 'n_words': 674}