<commit_before>(function () {
	'use strict';
	
	const { ipcRenderer } = require('electron');
	
	document.addEventListener('DOMContentLoaded', () => {
		const undoManagers = [];
		
		window.negative = {
			frameController: new NegativeFrame(),
			tabsController: new NegativeTabs(),
			trafficLightsController: new NegativeTrafficLights(),
			
			get currentUndoManager() {
				return undoManagers[this.tabsController.tabIndex];
			},
			
			refreshMenu() {
				const {
					canUndo,
					canRedo,
					state
				} = this.currentUndoManager;
				
				const {
					canZoomIn,
					canZoomOut
				} = this.frameController;
				
				const isImageEmpty = (state.imageSrc === null);

				ipcRenderer.send('refresh-menu', {
					canUndo: canUndo,
					canRedo: canRedo,
					isImageEmpty: isImageEmpty,
					canZoomIn: !isImageEmpty && canZoomIn,
					canZoomOut: !isImageEmpty && canZoomOut
				});
			},
			
			addTabForUndoManager(undoManager) {
				const newUndoManager = new UndoManager();
				
				newUndoManager.history.stack = undoManager.history.stack;
				newUndoManager.history.position = undoManager.history.position;
				newUndoManager.state = undoManager.state;
				
				undoManagers.push(newUndoManager);
				this.tabsController.addTab(false);
			},
			
			getUndoManagerAt(index) {
				return undoManagers[index];
			},
			
			insertUndoManagerAt(index) {
				undoManagers.splice(index, 0, new UndoManager());
			},
			
			removeUndoManagerAt(index) {
				undoManagers.splice(index, 1);
			},
			
			moveUndoManager(fromIndex, toIndex) {
				undoManagers.splice(toIndex, 0, undoManagers.splice(fromIndex, 1)[0]);
			},
			
			saveForUndo(state) {
				this.currentUndoManager.save(state);
				this.refreshMenu();
			},
			
			undo() {
				this.currentUndoManager.undo();
				this.refreshMenu();
			},

			redo() {
				this.currentUndoManager.redo();
				this.refreshMenu();
			},
			
			sendUndoManagersToMain() {
				ipcRenderer.send('undo-managers-response', undoManagers);
			}
		};
	});
})();
<commit_msg>Remove `sendUndoManagersToMain` function. Use ipcRenderer listener instead.<commit_after>(function () {
	'use strict';
	
	const { ipcRenderer } = require('electron');
	const undoManagers = [];
	
	ipcRenderer.on('undo-managers-request', (evt) => {
		ipcRenderer.send('undo-managers-response', undoManagers);
	});
	
	document.addEventListener('DOMContentLoaded', () => {
		
		window.negative = {
			frameController: new NegativeFrame(),
			tabsController: new NegativeTabs(),
			trafficLightsController: new NegativeTrafficLights(),
			
			get currentUndoManager() {
				return undoManagers[this.tabsController.tabIndex];
			},
			
			refreshMenu() {
				const {
					canUndo,
					canRedo,
					state
				} = this.currentUndoManager;
				
				const {
					canZoomIn,
					canZoomOut
				} = this.frameController;
				
				const isImageEmpty = (state.imageSrc === null);

				ipcRenderer.send('refresh-menu', {
					canUndo: canUndo,
					canRedo: canRedo,
					isImageEmpty: isImageEmpty,
					canZoomIn: !isImageEmpty && canZoomIn,
					canZoomOut: !isImageEmpty && canZoomOut
				});
			},
			
			addTabForUndoManager(undoManager) {
				const newUndoManager = new UndoManager();
				
				newUndoManager.history.stack = undoManager.history.stack;
				newUndoManager.history.position = undoManager.history.position;
				newUndoManager.state = undoManager.state;
				
				undoManagers.push(newUndoManager);
				this.tabsController.addTab(false);
			},
			
			getUndoManagerAt(index) {
				return undoManagers[index];
			},
			
			insertUndoManagerAt(index) {
				undoManagers.splice(index, 0, new UndoManager());
			},
			
			removeUndoManagerAt(index) {
				undoManagers.splice(index, 1);
			},
			
			moveUndoManager(fromIndex, toIndex) {
				undoManagers.splice(toIndex, 0, undoManagers.splice(fromIndex, 1)[0]);
			},
			
			saveForUndo(state) {
				this.currentUndoManager.save(state);
				this.refreshMenu();
			},
			
			undo() {
				this.currentUndoManager.undo();
				this.refreshMenu();
			},

			redo() {
				this.currentUndoManager.redo();
				this.refreshMenu();
			}
		};
	});
})();

{'fraction_non_alphanumeric': 0.12791828793774318, 'fraction_numerical': 0.0024319066147859923, 'mean_word_length': 3.201225740551583, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5406754', 'n_tokens_mistral': 1790, 'n_tokens_neox': 1320, 'n_words': 191}