<commit_before>(function(µ,SMOD,GMOD,HMOD,SC){

	SC=SC({
		TableConfig:"gui.TableConfig",
		arrayRemove:"array.remove",
		reporter:"EventReporterPatch",
		Event:"Event"
	});

	if(!µ.gui) µ.gui={};

	var Table=µ.gui.Table=µ.Class({
		constructor:function(tableConfig=new SC.TableConfig())
		{
			this.mega();

			this.tableConfig=tableConfig;
			this.tableElement=null;
			this.tableHeader=null;
			this.tableBody=null;
			this.dataDomMap=new WeakMap();
			this.data=[];

			new SC.reporter(this,[Table.AddEvent,Table.UpdateEvent,Table.RemoveEvent]);
		},
		getTable:function()
		{
			if(this.tableElement==null)
			{
				this.tableElement=this.tableConfig.getTable(this.data,null,(row,data)=>
				{
					this.dataDomMap.set(data,row);
					this.dataDomMap.set(row,data);
				});
				if(this.tableConfig.hasHeader())
				{
					this.tableHeader=this.tableElement.firstElementChild;
					this.tableBody=this.tableHeader.nextElementSibling;
				}
				else this.tableBody=this.tableElement.firstElementChild;
			}
			return this.tableElement;
		},
		remove:function(item)
		{
			if(item==null||!this.dataDomMap.has(item)) return false;
			if(item instanceof HTMLElement)
			{
				item=this.dataDomMap.get(item);
			}
			var row=this.dataDomMap.get(item);
			row.remove();
			this.dataDomMap.delete(item);
			this.dataDomMap.delete(row);
			SC.arrayRemove(this.data,item);

			this.reportEvent(new Table.RemoveEvent(item,row));
			return true;
		},
		add:function(rowData)
		{
			if(!Array.isArray(rowData)) rowData=[rowData];
			for(var entry of rowData)
			{
				this.data.push(entry);
				var row;
				if(this.tableElement!=null)
				{
					row=this.tableConfig.getRow(entry);

					this.dataDomMap.set(entry,row);
					this.dataDomMap.set(row,entry);
					this.tableBody.appendChild(row);
				}
				this.reportEvent(new Table.AddEvent(entry,row));
			}
		},
		update:function(item)
		{
			if(item==null)//update all
			{
				for(var entry of this.data) this.update(entry);
			}
			else
			{<commit_msg>clear()<commit_after>(function(µ,SMOD,GMOD,HMOD,SC){

	SC=SC({
		TableConfig:"gui.TableConfig",
		arrayRemove:"array.remove",
		reporter:"EventReporterPatch",
		Event:"Event"
	});

	if(!µ.gui) µ.gui={};

	var Table=µ.gui.Table=µ.Class({
		constructor:function(tableConfig=new SC.TableConfig())
		{
			this.mega();

			this.tableConfig=tableConfig;
			this.tableElement=null;
			this.tableHeader=null;
			this.tableBody=null;
			this.dataDomMap=new WeakMap();
			this.data=[];

			new SC.reporter(this,[Table.AddEvent,Table.UpdateEvent,Table.RemoveEvent]);
		},
		getTable:function()
		{
			if(this.tableElement==null)
			{
				this.tableElement=this.tableConfig.getTable(this.data,null,(row,data)=>
				{
					this.dataDomMap.set(data,row);
					this.dataDomMap.set(row,data);
				});
				if(this.tableConfig.hasHeader())
				{
					this.tableHeader=this.tableElement.firstElementChild;
					this.tableBody=this.tableHeader.nextElementSibling;
				}
				else this.tableBody=this.tableElement.firstElementChild;
			}
			return this.tableElement;
		},
		remove:function(item)
		{
			if(item==null||!this.dataDomMap.has(item)) return false;
			if(item instanceof HTMLElement)
			{
				item=this.dataDomMap.get(item);
			}
			var row=this.dataDomMap.get(item);
			row.remove();
			this.dataDomMap.delete(item);
			this.dataDomMap.delete(row);
			SC.arrayRemove(this.data,item);

			this.reportEvent(new Table.RemoveEvent(item,row));
			return true;
		},
		clear:function()
		{
			for(let entry of this.data.slice())
			{
				this.remove(entry);
			}
		},
		add:function(rowData)
		{
			if(!Array.isArray(rowData)) rowData=[rowData];
			for(var entry of rowData)
			{
				this.data.push(entry);
				var row;
				if(this.tableElement!=null)
				{
					row=this.tableConfig.getRow(entry);

					this.dataDomMap.set(entry,row);
					this.dataDomMap.set(row,entry);
					this.tableBody.appendChild(row);
				}
				this.reportEvent(new Table.AddEvent(entry,row));
			}
		},
		update:function(item)
		{
			if(item==null)//update all
			{
				for(var entry of this.data) this.update(entry);
			}
			else
			{
{'fraction_non_alphanumeric': 0.15718818647791066, 'fraction_numerical': 0.0, 'mean_word_length': 3.715765247410817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5164136', 'n_tokens_mistral': 1825, 'n_tokens_neox': 1478, 'n_words': 162}