<commit_before>(function(){
	
	PushPin.Form = function(formJSON, classificationsJSON){
		
		this.feature = null;
		this.formJSON = formJSON;
		this.classificationsJSON = classificationsJSON;
		
		this.poiForm = $('#poi-form');
		
		this.classificationsBuilder = new PushPin.Classification.Builder(this.classificationsJSON);
		
		this.classificationsBuilder.build();
	};

	var prototype = PushPin.Form.prototype;
	
	prototype.loadForm = function(){

		var tmp = {name:this.name, brand:this.brand};
		
		var context = this;
		
		var form = this.formJSON.forms[0].elements;		

		var formTitle = function(obj){
			return '<a class="list-group-item active">' + obj.label + '</a>';
		};
	
		var formElement = function(obj, context){
			var item = null;
			
			var featureValue = context.feature.properties[obj.data_name];
			
			if(!PushPin.existsAndNotNull(featureValue)){
				featureValue = "";
			}else{
				featureValue = featureValue.value;
			}
			
			if(obj.type === 'TextField'){
				item = '<a id="name-link" class="list-group-item pushpin-attribute" pushpin-attribute-name="' 
					+ obj.data_name+ '" pushpin-attribute-type="TextField" pushpin-original-value="'
					+ featureValue + '">' +obj.label+'<img style="float: right; margin: -10px -15px;" src="resources/images/icon-info.png" class="img-circle"/><br>\
						<input value="'+ featureValue +'" id="form-'+obj.data_name+'" type="text"/></a>';	
			}
			else if(obj.type === 'ChoiceField' && PushPin.existsAndNotNull(obj.choices)){
				var choices = '<option value=""></option>';
				$.each(obj.choices, function(i, choice){
					if(featureValue === choice.value.split('=')[1]){
						choices = choices + '<option value="'+choice.value+'" selected>'+choice.label+'</option>';
					}
					else{
						choices = choices + '<option value="'+choice.value+'">'+choice.label+'</option>';
					}					
				});
				
				item = '<a id="name-link" class="list-group-item pushpin-attribute" pushpin-attribute-name="' 
					+ obj.data_name+ '" pushpin-original-value="' + featureValue + '" pushpin-attribute-type="ChoiceField">'+obj.label+'<img style="float: right; margin: -10px -15px;" src="resources/images/icon-info.png" class="img-circle"/><br>\
						<select>'+choices+'</select>';
			}else if(obj.type === 'ClassificationField'){
				
				var tag = context.classificationsBuilder.tagPresentForId(obj.classification_set_id, context.feature);
				
				var displayString = (tag !== false) ? tag.displayString : '';
				var originalValue = (tag !== false) ? tag.value : '';
				
				// Set the label of the field, the current value of the input, and set the form's id to the name of the field
				item = '<a id="name-link" class="list-group-item pushpin-classification pushpin-attribute" pushpin-attribute-name="' 
					+ obj.data_name+ '" pushpin-attribute-type="ClassificationField" pushpin-classification="' 
					+ obj.classification_set_id + '" pushpin-original-value="' + originalValue + '" pushpin-current-value="' + originalValue + '">'
					+obj.label+'<img style="float: right; margin: -10px -15px;" src="resources/images/icon-info.png" class="img-circle"/><br>\
				<span id="form-' + obj.data_name + '">' + displayString + '</span></a>';
				//<input value="'+context[obj.data_name.replace(':','_')]+'" id="form-'+obj.data_name+'" type="text" readonly/></a>';
			}
			
			return item;
		};
		
		var typeID = '50932f1fa93448390b0000ff';
		var type = this.classificationsBuilder.tagPresentForId(typeID,this.feature);
		
		var items = [];

		$.each(form,function(key, value){
			
			var title = formTitle(value);			
			
			items.push(title);
			
			$.each(value.elements, function(index, obj){
				
				if(obj.hasOwnProperty("visible_conditions")){

					if(context.checkVisibilityConditions(obj.visible_conditions, type.values)){						
						items.push(formElement(obj, context));
					}
					
				} else{					
					items.push(formElement(obj, context));	
				}
									
			});
		});

		context.poiForm.append(items.join(""));
		
		context.poiForm.find('.pushpin-classification').click(function(){
			var element = $(this);
			
			var classificationId = element.attr('pushpin-classification');
			
			var classification = context.getClassificationById(classificationId);
			
			var mainClassification = new PushPin.Classification.Main(classification, function(classificationValues){
				
				var displayString = '';
				<commit_msg>Added visibility conditions for Section Titles (if Section has no items, remove Section Title).<commit_after>(function(){
	
	PushPin.Form = function(formJSON, classificationsJSON){
		
		this.feature = null;
		this.formJSON = formJSON;
		this.classificationsJSON = classificationsJSON;
		
		this.poiForm = $('#poi-form');
		
		this.classificationsBuilder = new PushPin.Classification.Builder(this.classificationsJSON);
		
		this.classificationsBuilder.build();
	};

	var prototype = PushPin.Form.prototype;
	
	prototype.loadForm = function(){

		var tmp = {name:this.name, brand:this.brand};
		
		var context = this;
		
		var form = this.formJSON.forms[0].elements;		

		var formTitle = function(obj){
			return '<a class="list-group-item active">' + obj.label + '</a>';
		};
	
		var formElement = function(obj, context){
			var item = null;
			
			var featureValue = context.feature.properties[obj.data_name];
			
			if(!PushPin.existsAndNotNull(featureValue)){
				featureValue = "";
			}else{
				featureValue = featureValue.value;
			}
			
			if(obj.type === 'TextField'){
				item = '<a id="name-link" class="list-group-item pushpin-attribute" pushpin-attribute-name="' 
					+ obj.data_name+ '" pushpin-attribute-type="TextField" pushpin-original-value="'
					+ featureValue + '">' +obj.label+'<img style="float: right; margin: -10px -15px;" src="resources/images/icon-info.png" class="img-circle"/><br>\
						<input value="'+ featureValue +'" id="form-'+obj.data_name+'" type="text"/></a>';	
			}
			else if(obj.type === 'ChoiceField' && PushPin.existsAndNotNull(obj.choices)){
				var choices = '<option value=""></option>';
				$.each(obj.choices, function(i, choice){
					if(featureValue === choice.value.split('=')[1]){
						choices = choices + '<option value="'+choice.value+'" selected>'+choice.label+'</option>';
					}
					else{
						choices = choices + '<option value="'+choice.value+'">'+choice.label+'</option>';
					}					
				});
				
				item = '<a id="name-link" class="list-group-item pushpin-attribute" pushpin-attribute-name="' 
					+ obj.data_name+ '" pushpin-original-value="' + featureValue + '" pushpin-attribute-type="ChoiceField">'+obj.label+'<img style="float: right; margin: -10px -15px;" src="resources/images/icon-info.png" class="img-circle"/><br>\
						<select>'+choices+'</select>';
			}else if(obj.type === 'ClassificationField'){
				
				var tag = context.classificationsBuilder.tagPresentForId(obj.classification_set_id, context.feature);
				
				var displayString = (tag !== false) ? tag.displayString : '';
				var originalValue = (tag !== false) ? tag.value : '';
				
				// Set the label of the field, the current value of the input, and set the form's id to the name of the field
				item = '<a id="name-link" class="list-group-item pushpin-classification pushpin-attribute" pushpin-attribute-name="' 
					+ obj.data_name+ '" pushpin-attribute-type="ClassificationField" pushpin-classification="' 
					+ obj.classification_set_id + '" pushpin-original-value="' + originalValue + '" pushpin-current-value="' + originalValue + '">'
					+obj.label+'<img style="float: right; margin: -10px -15px;" src="resources/images/icon-info.png" class="img-circle"/><br>\
				<span id="form-' + obj.data_name + '">' + displayString + '</span></a>';
				//<input value="'+context[obj.data_name.replace(':','_')]+'" id="form-'+obj.data_name+'" type="text" readonly/></a>';
			}
			
			return item;
		};
		
		var typeID = '50932f1fa93448390b0000ff';
		var type = this.classificationsBuilder.tagPresentForId(typeID,this.feature);
		
		var items = [];

		$.each(form,function(key, value){
			
			var sectionItems = 0;
			
			var title = formTitle(value);			
			
			items.push(title);
			
			$.each(value.elements, function(index, obj){
				
				if(obj.hasOwnProperty("visible_conditions")){

					if(context.checkVisibilityConditions(obj.visible_conditions, type.values)){						
						items.push(formElement(obj, context));
						sectionItems++;
					}
					
				} else{					
					items.push(formElement(obj, context));
					sectionItems++;
				}
									
			});
			
			//If there are no items in the Section, remove Section Title
			if(sectionItems === 0){
				items.pop();
			}			
			
		});

		context.poiForm.append(items.join(""));
		
		context.poiForm.find('.pushpin-classification').click(function(){
			var element = $(this);
			
			var classificationId = element.attr('pushpin-classification');
			
			var classification = context.getClassificationById(classificationId);
			
			var mainClassification = new PushPin.Classification.Main(classification, function(classificationValues){
				
				var displayString = '';
				
{'fraction_non_alphanumeric': 0.16992165949464857, 'fraction_numerical': 0.007282356835484938, 'mean_word_length': 3.6842377260981913, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, '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': '6539117', 'n_tokens_mistral': 3475, 'n_tokens_neox': 2742, 'n_words': 510}