<commit_before>//selection logic separated into another class for clarity, but included in this file for simplicity
var SelectionManager = L.Class.extend({

	initialize: function (map) {
		this._map = map;
	},
	
	getSelectedMarkers: function() {
		var markers = [];
		Object.keys(this._allSelectedMarkers).sort().forEach(function(markerId) { //sort is just so the order is predictable, makes debugging easier
			var marker = this._allSelectedMarkers[markerId];
			if (marker instanceof L.MarkerCluster) { //the actual cluster icon itself
				markers = markers.concat(marker.getAllChildMarkers());
			} else { // standard marker hopefully
				markers.push(marker);
			}
		}.bind(this));
		return markers;
	},
	
	enable: function() {
		this._clearExistingSelection();
	},
	
	_clearExistingSelection: function() {
		this._allSelectedMarkers = {};
		this._previouslySelectedMarkers = [];
		this._currentlySelectedMarkers = [];
	},
	
	disable: function() {
		for (key in this._allSelectedMarkers) {
			var marker = this._allSelectedMarkers[key];
			this._toggleSelection(marker, false);
		}
		this._clearExistingSelection();
	},
	<commit_msg> Fixing bug when marker cluster plugin not available<commit_after>//selection logic separated into another class for clarity, but included in this file for simplicity
var SelectionManager = L.Class.extend({

	initialize: function (map) {
		this._map = map;
	},
	
	getSelectedMarkers: function() {
		var markers = [];
		Object.keys(this._allSelectedMarkers).sort().forEach(function(markerId) { //sort is just so the order is predictable, makes debugging easier
			var marker = this._allSelectedMarkers[markerId];
			if (L.MarkerCluster != undefined && marker instanceof L.MarkerCluster) { //the actual cluster icon itself
				markers = markers.concat(marker.getAllChildMarkers());
			} else { // standard marker hopefully
				markers.push(marker);
			}
		}.bind(this));
		return markers;
	},
	
	enable: function() {
		this._clearExistingSelection();
	},
	
	_clearExistingSelection: function() {
		this._allSelectedMarkers = {};
		this._previouslySelectedMarkers = [];
		this._currentlySelectedMarkers = [];
	},
	
	disable: function() {
		for (key in this._allSelectedMarkers) {
			var marker = this._allSelectedMarkers[key];
			this._toggleSelection(marker, false);
		}
		this._clearExistingSelection();
	},
	
{'fraction_non_alphanumeric': 0.11812366737739873, 'fraction_numerical': 0.0, 'mean_word_length': 4.3807339449541285, 'pattern_counts': {'":': 0, '<': 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': '5648057', 'n_tokens_mistral': 748, 'n_tokens_neox': 656, 'n_words': 172}