<commit_before>type CodeEditBehaviorScriptInstanceAdditions = ScriptEdit & {
	isScript: true;
};
type CodeEditBehaviorScriptInstance = CodeEditBehavior<CodeEditBehaviorScriptInstanceAdditions>;

type CodeEditBehaviorStylesheetInstanceAdditions = StylesheetEdit & {
	isScript: false;
};
type CodeEditBehaviorStylesheetInstance = CodeEditBehavior<CodeEditBehaviorStylesheetInstanceAdditions>;

type CodeEditBehaviorInstance = NodeEditBehaviorScriptInstance|
	NodeEditBehaviorStylesheetInstance;

class CEB {	
	static properties = {};

	/**
	 * An interval to save any work not discarder or saved (say if your browser/pc crashes)
	 */
	static savingInterval: number = 0;

	/**
	 * Whether this dialog is active
	 */
	static active: boolean = false;

	/**
	 * The editor
	 */
	static editorManager: MonacoEditor = null;

	/**
	 * The editor manager for the fullscreen editor
	 */
	static fullscreenEditorManager: MonacoEditor = null;

	/**
	 * Whether the vertical scrollbar is already shown
	 */
	static verticalVisible: boolean = false;

	/**
	 * Whether the horizontal scrollbar is already shown
	 */
	static horizontalVisible: boolean = false;

	/**
	 * The settings element on the top-right of the editor
	 */
	static settingsEl: HTMLElement = null;

	/**
	 * The container of the fullscreen and settings buttons
	 */
	static buttonsContainer: HTMLElement = null;

	/**
	 * The editor's starting height
	 */
	static editorHeight: number = 0;

	/**
	 * The editor's starting width
	 */
	static editorWidth: number = 0;

	/**
	 * Whether to show the trigger editing section
	 */
	static showTriggers: boolean = false;

	/**
	 * Whether to show the section that allows you to choose on which content to show this
	 */
	static showContentTypeChooser: boolean = false;

	/**
	 * Whether the options are shown
	 */
	static optionsShown: boolean = false;

	/**
	 * Whether the editor is in fullscreen mode
	 */
	static fullscreen: boolean = false;

	/**
	 * The editor's settings before going to the settings page
	 */
	static unchangedEditorSettings: CRM.EditorSettings;

	/**
	 * The editor's dimensions before it goes fullscreen
	 */
	static preFullscreenEditorDimensions: {
		width?: string;
		height?: string;
		marginTop?: string;
		marginLeft?: string;
	} = {};

	/**
	 * The mode the editor is in (main or background)
	 */
	static editorMode: 'main'|'background'|'options' = 'main';

	static editorPlaceHolderAnimation: Animation;

	static otherDoc: CodeMirrorDocInstance = null;

	static finishEditing(this: CodeEditBehaviorInstance) {
		if (window.app.storageLocal.recoverUnsavedData) {
			chrome.storage.local.set({
				editing: null
			});
		}
		window.useOptionsCompletions = false;
		this.hideCodeOptions();
		Array.prototype.slice.apply(this.$$('.editorTab')).forEach(
			function(tab: HTMLElement) {
				tab.classList.remove('active');
			});
		this.$$('.mainEditorTab').classList.add('active');
	};
	
	/**
	 * Inserts given snippet of code into the editor
	 */
	static insertSnippet(__this: CodeEditBehaviorInstance, snippet: string, noReplace: boolean = false) {
		const commands = __this.editorManager.editor.getSelections().map((selection) => {
			const content = noReplace ? snippet : snippet.replace(/%s/g, selection.toString());
			return window.monacoCommands.createReplaceCommand(selection.cloneRange(), content);
		});
		__this.editorManager.editor.executeCommands('snippet', commands);
	};

	
	/**
	 * Pops out only the tools ribbon
	 */
	static popOutToolsRibbon(this: CodeEditBehaviorInstance) {
		window.doc.editorToolsRibbonContainer.animate([
			{
				marginLeft: 0
			}, {
				marginLeft: '-200px'
			}
		], {
			duration: 800,
			easing: 'bez'
		}).onfinish = function (this: Animation) {
			window.doc.editorToolsRibbonContainer.style.marginLeft = '-200px';
			window.doc.editorToolsRibbonContainer.classList.remove('visible');
		};
	};

	/**
	 * Toggles fullscreen mode for the editor
	 */
	static toggleFullScreen(this: CodeEditBehaviorInstance) {
		(this.fullscreen ? this.exitFullScreen() : this.enterFullScreen());
		
	};

	/**
	 * Whether this instance is fullscreen
	 */
	static isFullscreen(this: CodeEditBehaviorInstance) {
		return this.fullscreen;
	}

	/**
	 * Toggles the editor's options
	 */
	static toggleOptions(this: CodeEditBehaviorInstance) {
		(this.optionsShown ? this.hideOptions() : this.showOptions());
	};

	/**
	 * Returns the value of a key binding
	 */
	static getKeyBindingValue(this: CodeEditBehaviorInstance, keyBinding: {
		name: string;<commit_msg>removed empty line<commit_after>type CodeEditBehaviorScriptInstanceAdditions = ScriptEdit & {
	isScript: true;
};
type CodeEditBehaviorScriptInstance = CodeEditBehavior<CodeEditBehaviorScriptInstanceAdditions>;

type CodeEditBehaviorStylesheetInstanceAdditions = StylesheetEdit & {
	isScript: false;
};
type CodeEditBehaviorStylesheetInstance = CodeEditBehavior<CodeEditBehaviorStylesheetInstanceAdditions>;

type CodeEditBehaviorInstance = NodeEditBehaviorScriptInstance|
	NodeEditBehaviorStylesheetInstance;

class CEB {	
	static properties = {};

	/**
	 * An interval to save any work not discarder or saved (say if your browser/pc crashes)
	 */
	static savingInterval: number = 0;

	/**
	 * Whether this dialog is active
	 */
	static active: boolean = false;

	/**
	 * The editor
	 */
	static editorManager: MonacoEditor = null;

	/**
	 * The editor manager for the fullscreen editor
	 */
	static fullscreenEditorManager: MonacoEditor = null;

	/**
	 * Whether the vertical scrollbar is already shown
	 */
	static verticalVisible: boolean = false;

	/**
	 * Whether the horizontal scrollbar is already shown
	 */
	static horizontalVisible: boolean = false;

	/**
	 * The settings element on the top-right of the editor
	 */
	static settingsEl: HTMLElement = null;

	/**
	 * The container of the fullscreen and settings buttons
	 */
	static buttonsContainer: HTMLElement = null;

	/**
	 * The editor's starting height
	 */
	static editorHeight: number = 0;

	/**
	 * The editor's starting width
	 */
	static editorWidth: number = 0;

	/**
	 * Whether to show the trigger editing section
	 */
	static showTriggers: boolean = false;

	/**
	 * Whether to show the section that allows you to choose on which content to show this
	 */
	static showContentTypeChooser: boolean = false;

	/**
	 * Whether the options are shown
	 */
	static optionsShown: boolean = false;

	/**
	 * Whether the editor is in fullscreen mode
	 */
	static fullscreen: boolean = false;

	/**
	 * The editor's settings before going to the settings page
	 */
	static unchangedEditorSettings: CRM.EditorSettings;

	/**
	 * The editor's dimensions before it goes fullscreen
	 */
	static preFullscreenEditorDimensions: {
		width?: string;
		height?: string;
		marginTop?: string;
		marginLeft?: string;
	} = {};

	/**
	 * The mode the editor is in (main or background)
	 */
	static editorMode: 'main'|'background'|'options' = 'main';

	static editorPlaceHolderAnimation: Animation;

	static otherDoc: CodeMirrorDocInstance = null;

	static finishEditing(this: CodeEditBehaviorInstance) {
		if (window.app.storageLocal.recoverUnsavedData) {
			chrome.storage.local.set({
				editing: null
			});
		}
		window.useOptionsCompletions = false;
		this.hideCodeOptions();
		Array.prototype.slice.apply(this.$$('.editorTab')).forEach(
			function(tab: HTMLElement) {
				tab.classList.remove('active');
			});
		this.$$('.mainEditorTab').classList.add('active');
	};
	
	/**
	 * Inserts given snippet of code into the editor
	 */
	static insertSnippet(__this: CodeEditBehaviorInstance, snippet: string, noReplace: boolean = false) {
		const commands = __this.editorManager.editor.getSelections().map((selection) => {
			const content = noReplace ? snippet : snippet.replace(/%s/g, selection.toString());
			return window.monacoCommands.createReplaceCommand(selection.cloneRange(), content);
		});
		__this.editorManager.editor.executeCommands('snippet', commands);
	};

	
	/**
	 * Pops out only the tools ribbon
	 */
	static popOutToolsRibbon(this: CodeEditBehaviorInstance) {
		window.doc.editorToolsRibbonContainer.animate([
			{
				marginLeft: 0
			}, {
				marginLeft: '-200px'
			}
		], {
			duration: 800,
			easing: 'bez'
		}).onfinish = function (this: Animation) {
			window.doc.editorToolsRibbonContainer.style.marginLeft = '-200px';
			window.doc.editorToolsRibbonContainer.classList.remove('visible');
		};
	};

	/**
	 * Toggles fullscreen mode for the editor
	 */
	static toggleFullScreen(this: CodeEditBehaviorInstance) {
		(this.fullscreen ? this.exitFullScreen() : this.enterFullScreen());
	};

	/**
	 * Whether this instance is fullscreen
	 */
	static isFullscreen(this: CodeEditBehaviorInstance) {
		return this.fullscreen;
	}

	/**
	 * Toggles the editor's options
	 */
	static toggleOptions(this: CodeEditBehaviorInstance) {
		(this.optionsShown ? this.hideOptions() : this.showOptions());
	};

	/**
	 * Returns the value of a key binding
	 */
	static getKeyBindingValue(this: CodeEditBehaviorInstance, keyBinding: {
		name: string;
{'fraction_non_alphanumeric': 0.11150520948791842, 'fraction_numerical': 0.002881844380403458, 'mean_word_length': 4.126704545454546, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '3313857', 'n_tokens_mistral': 2848, 'n_tokens_neox': 2543, 'n_words': 697}