diff --git a/extras/chrome_extension/js/popup.js b/extras/chrome_extension/js/popup.js
index 44e0725a73..e323a9b12b 100644
--- a/extras/chrome_extension/js/popup.js
+++ b/extras/chrome_extension/js/popup.js
@@ -1,170 +1,183 @@
 var max_events;
 var bg;
-$(document).ready(function(){
-	max_events=localStorage["events"];
-	if(localStorage["events"]==undefined){
-		localStorage["events"]="20";
-	}
-	bg=chrome.extension.getBackgroundPage();
+$(document).ready(function() {
+  max_events = localStorage["events"];
+  if (localStorage["events"] == undefined) {
+    localStorage["events"] = "20";
+  }
+  bg = chrome.extension.getBackgroundPage();
 
-	// Display the information
-	if (bg.fetchEvents().length == 0) {
-		showError("Error in fetching data!! Check your internet connection");
-	} else {
-		showEvents();
-	}
+  // Display the information
+  if (bg.fetchEvents().length == 0) {
+    showError("No events");
+  } else {
+    showEvents();
+  }
 
-	// Adding buttons listeners
-	document.getElementById("m_refresh").addEventListener("click", mrefresh);
+  // Adding buttons listeners
+  document.getElementById("m_refresh").addEventListener("click", mrefresh);
 
-	// Added listener to background messages
-	chrome.runtime.onMessage.addListener(function(message,sender,sendResponse){
-		switch (message.text) {
-			case "FETCH_EVENTS":
-				setSpinner();
-				//$('div.b').hide();
-				break;
-			case "FETCH_EVENTS_SUCCESS":
-				unsetSpinner();
-				showEvents();
-				break;
-			case "FETCH_EVENTS_DATA_ERROR":
-				unsetSpinner();
-				showError("Error in fetching data!! Check your internet connection");
-				break;
-			case "FETCH_EVENTS_URL_ERROR":
-				unsetSpinner();
-				showError("Configure ip address,API password, user name and password with correct values");
-				break;
-			default:
-				console.log("Unrecognized message: ", message.text);
-				break;
-		}
-	});
+  // Added listener to background messages
+  chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
+    switch (message.text) {
+      case "FETCH_EVENTS":
+        setSpinner();
+        //$('div.b').hide();
+        break;
+      case "FETCH_EVENTS_SUCCESS":
+        unsetSpinner();
+        showEvents();
+        break;
+      case "FETCH_EVENTS_DATA_ERROR":
+        unsetSpinner();
+        showError("Error in fetching data!! Check your internet connection");
+        break;
+      case "FETCH_EVENTS_URL_ERROR":
+        unsetSpinner();
+        showError(
+          "Configure ip address,API password, user name and password with correct values"
+        );
+        break;
+      default:
+        console.log("Unrecognized message: ", message.text);
+        break;
+    }
+  });
 });
 
-function setSpinner () {
-	$('#refr_img_id').attr("src", "images/spinny.gif");
+function setSpinner() {
+  $("#refr_img_id").attr("src", "images/spinny.gif");
 }
 
 function unsetSpinner() {
-	$('#refr_img_id').attr("src", "images/refresh.png");
+  $("#refr_img_id").attr("src", "images/refresh.png");
 }
 
 function clearError() {
-	$('.error').hide();
-	$('.error a').text("");
-	$('.result').css('height', null);
+  $(".error").hide();
+  $(".error a").text("");
+  $(".result").css("height", null);
 }
 
-function showError(text){
-	$('.error a').text(text);
-	$('.error').show();
-	$('.result').height(420);
+function showError(text) {
+  $(".error a").text(text);
+  $(".error").show();
+  $(".result").height(420);
 }
 
-function showEvents(){
+function showEvents() {
+  clearError();
+  $("#events").empty();
+  var e_refr = document.getElementById("event_temp");
+  if (e_refr) {
+    wrapper.removeChild(e_refr);
+  }
+  var allEvents = bg.fetchEvents();
+  var notVisitedEvents = bg.fetchNotVisited();
+  var eve = document.createElement("div");
+  eve.id = "event_temp";
+  eve.setAttribute("class", "b");
 
-	clearError();
-	$('#events').empty();
-	var e_refr = document.getElementById('event_temp');
-	if(e_refr){
-			wrapper.removeChild(e_refr);
-	}
-	var allEvents = bg.fetchEvents();
-	var notVisitedEvents = bg.fetchNotVisited();
-	var eve=document.createElement('div');
-	eve.id="event_temp";
-	eve.setAttribute("class","b");
-	
-	var i=0;
-	if(allEvents.length>0){
-		while(i<max_events && i<allEvents.length){
-			var eve_title=document.createElement('div');
-			eve_title.id = 'e_' + i  + '_' + allEvents[i]['id'];
-			var img = document.createElement('img');
-			img.src = 'images/plus.png';
-			img.className ='pm';
-			img.id='i_' + i  + '_' + allEvents[i]['id'];
-			eve_title.appendChild(img);
-			var div_empty = document.createElement('img');
-			var a = document.createElement('a');
-			var temp_style;
-			
-			var agent_url = (allEvents[i]["agent"] == 0)
-				? localStorage["ip_address"]
-					+ "/index.php?sec=eventos&sec2=operation/events/events"
-				: localStorage["ip_address"]
-					+ "/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente="
-					+ allEvents[i]['agent'];
-			a.setAttribute("href",agent_url);
-			a.target = "_blank";
-			a.className = 'a_2_mo';
-			
-			
-			a.innerText = allEvents[i]['title'];			
-			eve_title.setAttribute("class","event sev-" + allEvents[i]['severity']);
+  var i = 0;
+  if (allEvents.length > 0) {
+    while (i < max_events && i < allEvents.length) {
+      var eve_title = document.createElement("div");
+      eve_title.id = "e_" + i + "_" + allEvents[i]["id"];
+      var img = document.createElement("img");
+      img.src = "images/plus.png";
+      img.className = "pm";
+      img.id = "i_" + i + "_" + allEvents[i]["id"];
+      eve_title.appendChild(img);
+      var div_empty = document.createElement("img");
+      var a = document.createElement("a");
+      var temp_style;
 
-			if (notVisitedEvents[allEvents[i]['id']] === true) {
-				eve_title.style.fontWeight = 600;
-			}
-			
-			eve_title.appendChild(a);
-			eve.appendChild(eve_title);
-			
-			var time=allEvents[i]['date'].split(" ");
-			var time_text = time[0]+" "+time[1];
-			
-			var p = document.createElement('p');
-			var id = (allEvents[i]['module']==0)
-				? "."
-				: " in the module with Id "+ allEvents[i]['module'] + ".";
-		   
-			p.innerText = allEvents[i]['type']+" : "+allEvents[i]['source']+". Event occured at "+ time_text+id;
-			p.id = 'p_' + i;
-			eve_title.appendChild(p);
-			i++;
-		}
-	
-		$('#events').append(eve);
+      var agent_url =
+        allEvents[i]["agent"] == 0
+          ? localStorage["ip_address"] +
+            "/index.php?sec=eventos&sec2=operation/events/events"
+          : localStorage["ip_address"] +
+            "/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" +
+            allEvents[i]["agent"];
+      a.setAttribute("href", agent_url);
+      a.target = "_blank";
+      a.className = "a_2_mo";
 
-		$('img.pm').click(showHide);
-		$('div.b').show();
-	} else {
-		showError("Error in fetching data!! Check your internet connection");
-	}
-	
-	localStorage["new_events"]=0;
-	bg.updateBadge();
+      a.innerText = allEvents[i]["title"];
+      eve_title.setAttribute("class", "event sev-" + allEvents[i]["severity"]);
+
+      if (notVisitedEvents[allEvents[i]["id"]] === true) {
+        eve_title.style.fontWeight = 600;
+      }
+
+      eve_title.appendChild(a);
+      eve.appendChild(eve_title);
+
+      var time = allEvents[i]["date"].split(" ");
+      var time_text = time[0] + " " + time[1];
+
+      var p = document.createElement("p");
+      var id =
+        allEvents[i]["module"] == 0
+          ? "."
+          : " in the module with Id " + allEvents[i]["module"] + ".";
+
+      p.innerText =
+        allEvents[i]["type"] +
+        " : " +
+        allEvents[i]["source"] +
+        ". Event occured at " +
+        time_text +
+        id;
+      p.id = "p_" + i;
+      eve_title.appendChild(p);
+      i++;
+    }
+
+    $("#events").append(eve);
+
+    $("img.pm").click(showHide);
+    $("div.b").show();
+  } else {
+    showError("No events");
+  }
+
+  localStorage["new_events"] = 0;
+  bg.updateBadge();
 }
 
 function showHide() {
-	var id = $(this).attr('id');
-	// Image id has the form i_<position>_<eventId>
-	var nums = id.split('_');
-	var pid = "p_" + nums[1];
+  var id = $(this).attr("id");
+  // Image id has the form i_<position>_<eventId>
+  var nums = id.split("_");
+  var pid = "p_" + nums[1];
 
-	// Mark as visited if visited
-	if($(this).parent().css('font-weight') == '600') {
-		bg.removeNotVisited(nums[2]);
-		$(this).parent().css('font-weight', '');
-	}
+  // Mark as visited if visited
+  if (
+    $(this)
+      .parent()
+      .css("font-weight") == "600"
+  ) {
+    bg.removeNotVisited(nums[2]);
+    $(this)
+      .parent()
+      .css("font-weight", "");
+  }
 
-	// Toggle information
-	if($('#' + pid).css('display') == 'none') {
-		$('#' + pid).slideDown();
-		$(this).attr({src: 'images/minus.png'});
-	}
-	else {
-		$('#' + pid).slideUp();
-		$(this).attr({src: 'images/plus.png'});
-	}
+  // Toggle information
+  if ($("#" + pid).css("display") == "none") {
+    $("#" + pid).slideDown();
+    $(this).attr({ src: "images/minus.png" });
+  } else {
+    $("#" + pid).slideUp();
+    $(this).attr({ src: "images/plus.png" });
+  }
 }
 
-function mrefresh(){
-	localStorage["new_events"]=0;
-	bg.updateBadge();
-	clearError();
-	bg.resetInterval();
-	bg.main();
+function mrefresh() {
+  localStorage["new_events"] = 0;
+  bg.updateBadge();
+  clearError();
+  bg.resetInterval();
+  bg.main();
 }
diff --git a/extras/chrome_extension/manifest.json b/extras/chrome_extension/manifest.json
index b591121309..bff5586f0c 100644
--- a/extras/chrome_extension/manifest.json
+++ b/extras/chrome_extension/manifest.json
@@ -1,30 +1,30 @@
 {
-    "name": "__MSG_name__",
-    "version": "2.1",
-    "manifest_version": 2,
-    "description": "Pandora FMS Event viewer Chrome extension",
-    "homepage_url": "http://pandorafms.com",
-    "browser_action": {
-        "default_title": "__MSG_default_title__",
-        "default_icon": "images/icon.png",
-        "default_popup": "popup.html"
-    },
-    "background": {
-        "page": "background.html"
-    },
-    "icons": {
-        "128": "images/icon128.png",
-        "16": "images/icon16.png",
-        "32": "images/icon32.png",
-        "48": "images/icon48.png"
-    },
-    "options_page": "options.html",
-    "permissions": [
-        "tabs",
-        "notifications",
-        "http://*/*",
-        "https://*/*",
-        "background"
-    ],
-    "default_locale": "en"
- }
+  "name": "__MSG_name__",
+  "version": "2.2",
+  "manifest_version": 2,
+  "description": "Pandora FMS Event viewer Chrome extension",
+  "homepage_url": "http://pandorafms.com",
+  "browser_action": {
+    "default_title": "__MSG_default_title__",
+    "default_icon": "images/icon.png",
+    "default_popup": "popup.html"
+  },
+  "background": {
+    "page": "background.html"
+  },
+  "icons": {
+    "128": "images/icon128.png",
+    "16": "images/icon16.png",
+    "32": "images/icon32.png",
+    "48": "images/icon48.png"
+  },
+  "options_page": "options.html",
+  "permissions": [
+    "tabs",
+    "notifications",
+    "http://*/*",
+    "https://*/*",
+    "background"
+  ],
+  "default_locale": "en"
+}
diff --git a/pandora_agents/Dockerfile b/pandora_agents/Dockerfile
new file mode 100644
index 0000000000..945a74b1c9
--- /dev/null
+++ b/pandora_agents/Dockerfile
@@ -0,0 +1,50 @@
+FROM centos:centos7
+MAINTAINER Pandora FMS Team <info@pandorafms.com>
+
+# Add Pandora FMS agent installer
+ADD unix /tmp/pandora_agent/unix
+
+# Install dependencies
+RUN yum -y install \
+	epel-release \
+	unzip \
+	perl \
+	sed \
+	"perl(Sys::Syslog)"
+
+# Install Pandora FMS agent
+RUN cd /tmp/pandora_agent/unix \
+	&& chmod +x pandora_agent_installer \
+	&& ./pandora_agent_installer --install
+
+# Set default variables
+ENV SERVER_IP '127.0.0.1'
+ENV REMOTE_CONFIG '0'
+ENV GROUP 'Servers'
+ENV DEBUG '0'
+ENV AGENT_NAME 'agent_docker'
+ENV AGENT_ALIAS 'agent_docker'
+ENV TIMEZONE 'UTC'
+ENV SECONDARY_GROUPS ''
+
+# Create the entrypoint script.
+RUN echo -e '#/bin/bash\n \
+sed -i "s/^server_ip.*$/server_ip $SERVER_IP/g" /etc/pandora/pandora_agent.conf\n \
+sed -i "s/^remote_config.*$/remote_config $REMOTE_CONFIG/g" /etc/pandora/pandora_agent.conf\n \
+sed -i "s/^group.*$/group $GROUP/g" /etc/pandora/pandora_agent.conf\n \
+sed -i "s/^debug.*$/debug $DEBUG/g" /etc/pandora/pandora_agent.conf\n \
+sed -i "s/^#agent_name.*$/agent_name $AGENT_NAME/g" /etc/pandora/pandora_agent.conf\n \
+sed -i "s/^#agent_alias.*$/agent_alias $AGENT_ALIAS/g" /etc/pandora/pandora_agent.conf\n \
+sed -i "s/^# secondary_groups.*$/secondary_groups $SECONDARY_GROUPS/g" /etc/pandora/pandora_agent.conf\n \
+if [ $TIMEZONE != "" ]; then\n \
+\tln -sfn /usr/share/zoneinfo/$TIMEZONE /etc/localtime\n \
+fi\n \
+/etc/init.d/pandora_agent_daemon start\n \
+rm -f $0\n \
+tail -f /var/log/pandora/pandora_agent.log' \
+>> /entrypoint.sh && \
+chmod +x /entrypoint.sh
+
+# Entrypoint + CMD
+ENTRYPOINT ["bash"]
+CMD ["/entrypoint.sh"]
\ No newline at end of file
diff --git a/pandora_agents/build_agent_docker.sh b/pandora_agents/build_agent_docker.sh
new file mode 100644
index 0000000000..0ebf8ac7a0
--- /dev/null
+++ b/pandora_agents/build_agent_docker.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+source /root/code/pandorafms/extras/build_vars.sh
+
+# Set tag for docker build
+if [ "$1" == "nightly" ]; then
+	LOCAL_VERSION="latest"
+else
+	LOCAL_VERSION=$VERSION
+fi
+
+# Build image with code
+docker build --rm=true --pull --no-cache -t pandorafms/pandorafms-agent:$LOCAL_VERSION -f $CODEHOME/pandora_agents/Dockerfile $CODEHOME/pandora_agents/
+
+# Push image
+docker push pandorafms/pandorafms-agent:$LOCAL_VERSION
+
+# Delete local image
+docker image rm -f pandorafms/pandorafms-agent:$LOCAL_VERSION
\ No newline at end of file
diff --git a/pandora_agents/pc/AIX/pandora_agent.conf b/pandora_agents/pc/AIX/pandora_agent.conf
index 0ff67a62d3..fbea6eb404 100644
--- a/pandora_agents/pc/AIX/pandora_agent.conf
+++ b/pandora_agents/pc/AIX/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, AIX version
+# Version 7.0NG.738, AIX version
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/pc/FreeBSD/pandora_agent.conf b/pandora_agents/pc/FreeBSD/pandora_agent.conf
index c7c6fdd493..ded3ec4b9c 100644
--- a/pandora_agents/pc/FreeBSD/pandora_agent.conf
+++ b/pandora_agents/pc/FreeBSD/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, FreeBSD Version
+# Version 7.0NG.738, FreeBSD Version
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/pc/HP-UX/pandora_agent.conf b/pandora_agents/pc/HP-UX/pandora_agent.conf
index 1a349583dc..0d3e20d05e 100644
--- a/pandora_agents/pc/HP-UX/pandora_agent.conf
+++ b/pandora_agents/pc/HP-UX/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, HP-UX Version
+# Version 7.0NG.738, HP-UX Version
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/pc/Linux/pandora_agent.conf b/pandora_agents/pc/Linux/pandora_agent.conf
index dc172b7e2f..5d951d984d 100644
--- a/pandora_agents/pc/Linux/pandora_agent.conf
+++ b/pandora_agents/pc/Linux/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, GNU/Linux
+# Version 7.0NG.738, GNU/Linux
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/pc/NT4/pandora_agent.conf b/pandora_agents/pc/NT4/pandora_agent.conf
index 3d76832397..1c73d12fc9 100644
--- a/pandora_agents/pc/NT4/pandora_agent.conf
+++ b/pandora_agents/pc/NT4/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, GNU/Linux
+# Version 7.0NG.738, GNU/Linux
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/pc/SunOS/pandora_agent.conf b/pandora_agents/pc/SunOS/pandora_agent.conf
index 9b088eae51..fc59e308e4 100644
--- a/pandora_agents/pc/SunOS/pandora_agent.conf
+++ b/pandora_agents/pc/SunOS/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, Solaris Version
+# Version 7.0NG.738, Solaris Version
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/pc/Win32/pandora_agent.conf b/pandora_agents/pc/Win32/pandora_agent.conf
index e2c442a520..f12cb5089c 100644
--- a/pandora_agents/pc/Win32/pandora_agent.conf
+++ b/pandora_agents/pc/Win32/pandora_agent.conf
@@ -1,6 +1,6 @@
 # Base config file for Pandora FMS Windows Agent
 # (c) 2006-2010 Artica Soluciones Tecnologicas 
-# Version 7.0NG.735
+# Version 7.0NG.738
 
 # This program is Free Software, you can redistribute it and/or modify it
 # under the terms of the GNU General Public Licence as published by the Free Software
diff --git a/pandora_agents/shellscript/aix/pandora_agent.conf b/pandora_agents/shellscript/aix/pandora_agent.conf
index fea0cb56db..863ab92907 100644
--- a/pandora_agents/shellscript/aix/pandora_agent.conf
+++ b/pandora_agents/shellscript/aix/pandora_agent.conf
@@ -1,6 +1,6 @@
 # Fichero de configuracion base de agentes de Pandora
 # Base config file for Pandora agents
-# Version 7.0NG.735, AIX version
+# Version 7.0NG.738, AIX version
 
 # General Parameters
 # ==================
diff --git a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf
index f0ce5b2519..f56402fbcc 100644
--- a/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf
+++ b/pandora_agents/shellscript/bsd-ipso/pandora_agent.conf
@@ -1,6 +1,6 @@
 # Fichero de configuracion base de agentes de Pandora
 # Base config file for Pandora agents
-# Version 7.0NG.735
+# Version 7.0NG.738
 # FreeBSD/IPSO version
 # Licenced under GPL licence, 2003-2007 Sancho Lerena
 
diff --git a/pandora_agents/shellscript/hp-ux/pandora_agent.conf b/pandora_agents/shellscript/hp-ux/pandora_agent.conf
index 20cdfeff99..55576e58fd 100644
--- a/pandora_agents/shellscript/hp-ux/pandora_agent.conf
+++ b/pandora_agents/shellscript/hp-ux/pandora_agent.conf
@@ -1,6 +1,6 @@
 # Fichero de configuracion base de agentes de Pandora
 # Base config file for Pandora agents
-# Version 7.0NG.735, HPUX Version
+# Version 7.0NG.738, HPUX Version
 
 # General Parameters
 # ==================
diff --git a/pandora_agents/shellscript/linux/pandora_agent.conf b/pandora_agents/shellscript/linux/pandora_agent.conf
index e8ba9653ce..a584a597cb 100644
--- a/pandora_agents/shellscript/linux/pandora_agent.conf
+++ b/pandora_agents/shellscript/linux/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735
+# Version 7.0NG.738
 # Licensed under GPL license v2,
 # (c) 2003-2010 Artica Soluciones Tecnologicas
 # please visit http://pandora.sourceforge.net
diff --git a/pandora_agents/shellscript/mac_osx/pandora_agent.conf b/pandora_agents/shellscript/mac_osx/pandora_agent.conf
index 29d13ff75c..18db7a174f 100644
--- a/pandora_agents/shellscript/mac_osx/pandora_agent.conf
+++ b/pandora_agents/shellscript/mac_osx/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735
+# Version 7.0NG.738
 # Licensed under GPL license v2,
 # (c) 2003-2009 Artica Soluciones Tecnologicas
 # please visit http://pandora.sourceforge.net
diff --git a/pandora_agents/shellscript/openWRT/pandora_agent.conf b/pandora_agents/shellscript/openWRT/pandora_agent.conf
index 8ef8a6fdc1..d3266f091d 100644
--- a/pandora_agents/shellscript/openWRT/pandora_agent.conf
+++ b/pandora_agents/shellscript/openWRT/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735
+# Version 7.0NG.738
 # Licensed under GPL license v2,
 # please visit http://pandora.sourceforge.net
 
diff --git a/pandora_agents/shellscript/solaris/pandora_agent.conf b/pandora_agents/shellscript/solaris/pandora_agent.conf
index 1ace947818..aa59a262c4 100644
--- a/pandora_agents/shellscript/solaris/pandora_agent.conf
+++ b/pandora_agents/shellscript/solaris/pandora_agent.conf
@@ -1,6 +1,6 @@
 # Fichero de configuracion base de agentes de Pandora
 # Base config file for Pandora agents
-# Version 7.0NG.735, Solaris version
+# Version 7.0NG.738, Solaris version
 
 # General Parameters
 # ==================
diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf
index c67f64d16c..dedf2c366f 100644
--- a/pandora_agents/unix/AIX/pandora_agent.conf
+++ b/pandora_agents/unix/AIX/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, AIX version
+# Version 7.0NG.738, AIX version
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index 84194913b7..79ec8e1e38 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-agent-unix
-Version: 7.0NG.735-190605
+Version: 7.0NG.738-190906
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh
index c5aa33342d..a1152c73bb 100644
--- a/pandora_agents/unix/DEBIAN/make_deb_package.sh
+++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="7.0NG.735-190605"
+pandora_version="7.0NG.738-190906"
 
 echo "Test if you has the tools for to make the packages."
 whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf
index d7ee481255..4624a5ceff 100644
--- a/pandora_agents/unix/Darwin/pandora_agent.conf
+++ b/pandora_agents/unix/Darwin/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, GNU/Linux
+# Version 7.0NG.738, GNU/Linux
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/unix/FreeBSD/pandora_agent.conf b/pandora_agents/unix/FreeBSD/pandora_agent.conf
index b02b379470..0895974d7b 100644
--- a/pandora_agents/unix/FreeBSD/pandora_agent.conf
+++ b/pandora_agents/unix/FreeBSD/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, FreeBSD Version
+# Version 7.0NG.738, FreeBSD Version
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/unix/HP-UX/pandora_agent.conf b/pandora_agents/unix/HP-UX/pandora_agent.conf
index 57e35c0a03..bfd0612672 100644
--- a/pandora_agents/unix/HP-UX/pandora_agent.conf
+++ b/pandora_agents/unix/HP-UX/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, HP-UX Version
+# Version 7.0NG.738, HP-UX Version
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf
index db07876f12..e1a83ed6e5 100644
--- a/pandora_agents/unix/Linux/pandora_agent.conf
+++ b/pandora_agents/unix/Linux/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, GNU/Linux
+# Version 7.0NG.738, GNU/Linux
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/unix/NT4/pandora_agent.conf b/pandora_agents/unix/NT4/pandora_agent.conf
index 8cda0f8fe0..b0841bd0f7 100644
--- a/pandora_agents/unix/NT4/pandora_agent.conf
+++ b/pandora_agents/unix/NT4/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, GNU/Linux
+# Version 7.0NG.738, GNU/Linux
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/unix/NetBSD/pandora_agent.conf b/pandora_agents/unix/NetBSD/pandora_agent.conf
index 629fe6a6fb..4d96ba223d 100644
--- a/pandora_agents/unix/NetBSD/pandora_agent.conf
+++ b/pandora_agents/unix/NetBSD/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, NetBSD Version
+# Version 7.0NG.738, NetBSD Version
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/unix/SunOS/pandora_agent.conf b/pandora_agents/unix/SunOS/pandora_agent.conf
index 8ff3c52de5..c4a4c578d9 100644
--- a/pandora_agents/unix/SunOS/pandora_agent.conf
+++ b/pandora_agents/unix/SunOS/pandora_agent.conf
@@ -1,5 +1,5 @@
 # Base config file for Pandora FMS agents
-# Version 7.0NG.735, Solaris Version
+# Version 7.0NG.738, Solaris Version
 # Licensed under GPL license v2,
 # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index 8fefec9ec8..80a2c23b12 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -41,8 +41,8 @@ my $Sem = undef;
 # Semaphore used to control the number of threads
 my $ThreadSem = undef;
 
-use constant AGENT_VERSION => '7.0NG.735';
-use constant AGENT_BUILD => '190605';
+use constant AGENT_VERSION => '7.0NG.738';
+use constant AGENT_BUILD => '190906';
 
 # Agent log default file size maximum and instances
 use constant DEFAULT_MAX_LOG_SIZE => 600000;
@@ -3038,10 +3038,10 @@ while (1) {
 			my @address_list;
 
 			if( -x "/bin/ip" || -x "/sbin/ip" || -x "/usr/sbin/ip" ) {
-				@address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`;
+				@address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/\\([0-9][0-9]*\\.\\)\\{3\\}[0-9][0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`;
 			}
 			else {
-				@address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`;
+				@address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/\\([0-9][0-9]*\\.\\)\\{3\\}[0-9][0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`;
 			}
 
 			for (my $i = 0; $i <= $#address_list; $i++) {		
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index 0ca9923632..13cc96d73e 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -2,8 +2,8 @@
 #Pandora FMS Linux Agent
 #
 %define name        pandorafms_agent_unix
-%define version     7.0NG.735
-%define release     190605
+%define version     7.0NG.738
+%define release     190906
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index a4fc651f2d..8b77150184 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -2,8 +2,8 @@
 #Pandora FMS Linux Agent
 #
 %define name        pandorafms_agent_unix
-%define version     7.0NG.735
-%define release     190605
+%define version     7.0NG.738
+%define release     190906
 
 Summary:            Pandora FMS Linux agent, PERL version
 Name:               %{name}
diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer
index ff2c1c7d80..54858a1d3e 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -9,8 +9,8 @@
 # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
 # **********************************************************************
 
-PI_VERSION="7.0NG.735"
-PI_BUILD="190605"
+PI_VERSION="7.0NG.738"
+PI_BUILD="190906"
 OS_NAME=`uname -s`
 
 FORCE=0
diff --git a/pandora_agents/unix/plugins/grep_log b/pandora_agents/unix/plugins/grep_log
index 2e17210a51..76661c5230 100755
--- a/pandora_agents/unix/plugins/grep_log
+++ b/pandora_agents/unix/plugins/grep_log
@@ -6,17 +6,17 @@
 #
 # grep_log	Perl script to search log files for a matching pattern. The last
 #           searched position is saved in an index file so that consecutive
-#           runs do not return the same results. The log file inode number is 
+#           runs do not return the same results. The log file inode number is
 #           also saved to detect log rotation.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; version 2 of the License.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.	
+# GNU General Public License for more details.
 #
 ###############################################################################
 use strict;
@@ -30,7 +30,7 @@ my $Output = 'module';
 my $Verbose = 0;
 
 # Index file storage directory, with a trailing '/'
-my $Idx_dir=($^O =~ /win/i)?'.\\':'/tmp/';
+my $Idx_dir=($^O =~ /win/i)?"$ENV{'TMP'}\\":"/tmp/";
 
 # Log file
 my $Log_file = '';
@@ -64,7 +64,7 @@ if ( (defined ($ENV{GREP_LOG_TMP})) && (-d $ENV{GREP_LOG_TMP}) ) {
 }
 
 ########################################################################################
-# Erase blank spaces before and after the string 
+# Erase blank spaces before and after the string
 ########################################################################################
 sub trim($){
 	my $string = shift;
@@ -226,7 +226,7 @@ sub parse_log (;$$) {
 	open(LOGFILE, $Log_file) || error_msg("Error opening file $Log_file: " .
 	                                     $!);
 
-	# Go to starting position. 
+	# Go to starting position.
 	seek(LOGFILE, $Idx_pos, 0);
 
 	# Parse log file
@@ -318,7 +318,7 @@ sub print_log ($) {
 		print_summary() if ($summary_flag == 1);
 		return;
 	}
-	
+
 	# Log module
 	if ($Output eq 'log_module') {
 		my $output = "<log_module>\n";
diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf
index 518cd3df0e..c74dadfff6 100644
--- a/pandora_agents/win32/bin/pandora_agent.conf
+++ b/pandora_agents/win32/bin/pandora_agent.conf
@@ -1,6 +1,6 @@
 # Base config file for Pandora FMS Windows Agent
 # (c) 2006-2017 Artica Soluciones Tecnologicas 
-# Version 7.0NG.735
+# Version 7.0NG.738
 
 # This program is Free Software, you can redistribute it and/or modify it
 # under the terms of the GNU General Public Licence as published by the Free Software
diff --git a/pandora_agents/win32/bin/util/grep_log.exe b/pandora_agents/win32/bin/util/grep_log.exe
index a21e080805..4e4029fb60 100644
Binary files a/pandora_agents/win32/bin/util/grep_log.exe and b/pandora_agents/win32/bin/util/grep_log.exe differ
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index a195ab96ee..daa57b099d 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -3,7 +3,7 @@ AllowLanguageSelection
 {Yes}
 
 AppName
-{Pandora FMS Windows Agent v7.0NG.735}
+{Pandora FMS Windows Agent v7.0NG.738}
 
 ApplicationID
 {17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@@ -186,7 +186,7 @@ UpgradeApplicationID
 {}
 
 Version
-{190605}
+{190906}
 
 ViewReadme
 {Yes}
diff --git a/pandora_agents/win32/modules/pandora_module_factory.cc b/pandora_agents/win32/modules/pandora_module_factory.cc
index a4d9553c20..4c84910ac5 100644
--- a/pandora_agents/win32/modules/pandora_module_factory.cc
+++ b/pandora_agents/win32/modules/pandora_module_factory.cc
@@ -1214,7 +1214,8 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
 						      module_source,
 						      module_eventtype,
 						      module_eventcode,
-						      module_pattern);
+						      module_pattern,
+						      module_application);
 	} else if (module_wmiquery != "") {
 		module = new Pandora_Module_WMIQuery (module_name,
 						      module_wmiquery, module_wmicolumn);
diff --git a/pandora_agents/win32/modules/pandora_module_logchannel.cc b/pandora_agents/win32/modules/pandora_module_logchannel.cc
index 4ec72df63c..3c1c4666dd 100755
--- a/pandora_agents/win32/modules/pandora_module_logchannel.cc
+++ b/pandora_agents/win32/modules/pandora_module_logchannel.cc
@@ -53,7 +53,7 @@ static EvtUpdateBookmarkT EvtUpdateBookmarkF = NULL;
  * @param name Module name.
  * @param service_name Service internal name to check.
  */
-Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern)
+Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern, string application)
 	: Pandora_Module (name) {
     int i;
 	vector<wstring> query;
@@ -93,6 +93,13 @@ Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source
 		query.push_back(ss.str());
 	}
 
+	// Set the application
+	if (application != "") {
+		wstringstream ss;
+		ss << L"*[System/Provider[@Name='" << application.c_str() << L"']]";
+		query.push_back(ss.str());
+	}
+
 	// Fill the filter
 	if (query.size() == 0) {
 		this->filter = L"*";
@@ -579,4 +586,4 @@ Pandora_Module_Logchannel::GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEv
 	}
 
 	return pBuffer;
-}
\ No newline at end of file
+}
diff --git a/pandora_agents/win32/modules/pandora_module_logchannel.h b/pandora_agents/win32/modules/pandora_module_logchannel.h
index 19cde78b93..c008c0aac1 100755
--- a/pandora_agents/win32/modules/pandora_module_logchannel.h
+++ b/pandora_agents/win32/modules/pandora_module_logchannel.h
@@ -75,7 +75,7 @@ namespace Pandora_Modules {
 		LPWSTR GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId);
 
 	public:
-		Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern);
+		Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern, string application);
 		void run ();
 	};
 }
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index 54994bfa82..9ef2d6ec82 100644
--- a/pandora_agents/win32/pandora.cc
+++ b/pandora_agents/win32/pandora.cc
@@ -30,7 +30,7 @@ using namespace Pandora;
 using namespace Pandora_Strutils;
 
 #define PATH_SIZE    _MAX_PATH+1
-#define PANDORA_VERSION ("7.0NG.735(Build 190605)")
+#define PANDORA_VERSION ("7.0NG.738(Build 190906)")
 
 string pandora_path;
 string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index fd912eae71..60ee89d3f1 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
       VALUE "LegalCopyright", "Artica ST"
       VALUE "OriginalFilename", "PandoraAgent.exe"
       VALUE "ProductName", "Pandora FMS Windows Agent"
-      VALUE "ProductVersion", "(7.0NG.735(Build 190605))"
+      VALUE "ProductVersion", "(7.0NG.738(Build 190906))"
       VALUE "FileVersion", "1.0.0.0"
     END
   END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index 00e162ac2f..305bc5d62d 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-console
-Version: 7.0NG.735-190605
+Version: 7.0NG.738-190906
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh
index 0e4d3c1331..b0d6e3e085 100644
--- a/pandora_console/DEBIAN/make_deb_package.sh
+++ b/pandora_console/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="7.0NG.735-190605"
+pandora_version="7.0NG.738-190906"
 
 package_pear=0
 package_pandora=1
diff --git a/pandora_console/ajax.php b/pandora_console/ajax.php
index 92f6c146bc..beb07e7752 100644
--- a/pandora_console/ajax.php
+++ b/pandora_console/ajax.php
@@ -1,17 +1,34 @@
 <?php
+/**
+ * Ajax handler.
+ *
+ * @category   Ajax handler.
+ * @package    Pandora FMS.
+ * @subpackage OpenSource.
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
+
+// Begin.
+define('AJAX', true);
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation; version 2
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-// Enable profiler for testing
 if (!defined('__PAN_XHPROF__')) {
     define('__PAN_XHPROF__', 0);
 }
@@ -56,7 +73,7 @@ if (isset($_GET['loginhash'])) {
 
 $public_hash = get_parameter('hash', false);
 
-// Check user
+// Check user.
 if ($public_hash == false) {
     check_login();
 } else {
@@ -68,9 +85,9 @@ if ($public_hash == false) {
     }
 }
 
-define('AJAX', true);
 
-// Enterprise support
+
+// Enterprise support.
 if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
     include_once ENTERPRISE_DIR.'/load_enterprise.php';
 }
@@ -86,11 +103,9 @@ if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
     $config['relative_path'] = enterprise_hook('skins_set_image_skin_path', [$config['id_user']]);
 }
 
-if (isset($config['metaconsole'])) {
-    // Not cool way of know if we are executing from metaconsole or normal console
-    if ($config['metaconsole']) {
-        define('METACONSOLE', true);
-    }
+if (is_metaconsole()) {
+    // Backward compatibility.
+    define('METACONSOLE', true);
 }
 
 if (file_exists($page)) {
diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php
index b5860068d8..97657f5189 100644
--- a/pandora_console/extensions/agents_modules.php
+++ b/pandora_console/extensions/agents_modules.php
@@ -1,23 +1,24 @@
 <?php
+/**
+ *  Pandora FMS - http://pandorafms.com
+ *  ==================================================
+ *  Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
+ *  Please see http://pandorafms.org for full contribution list
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; version 2
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ */
+
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; version 2
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-$refr = (int) get_parameter('refresh', 0);
-// By default 30 seconds
 function mainAgentsModules()
 {
     global $config;
 
-    // Load global vars
+    // Load global vars.
     include_once 'include/config.php';
     include_once 'include/functions_reporting.php';
     include_once $config['homedir'].'/include/functions_agents.php';
@@ -25,7 +26,7 @@ function mainAgentsModules()
     include_once $config['homedir'].'/include/functions_users.php';
 
     check_login();
-    // ACL Check
+    // ACL Check.
     if (! check_acl($config['id_user'], 0, 'AR')) {
         db_pandora_audit(
             'ACL Violation',
@@ -37,7 +38,7 @@ function mainAgentsModules()
 
     // Update network modules for this group
     // Check for Network FLAG change request
-    // Made it a subquery, much faster on both the database and server side
+    // Made it a subquery, much faster on both the database and server side.
     if (isset($_GET['update_netgroup'])) {
         $group = get_parameter_get('update_netgroup', 0);
         if (check_acl($config['id_user'], $group, 'AW')) {
@@ -62,7 +63,7 @@ function mainAgentsModules()
 
     $modulegroup = get_parameter('modulegroup', 0);
     $refr = (int) get_parameter('refresh', 0);
-    // By default 30 seconds
+    // By default 30 seconds.
     $recursion = get_parameter('recursion', 0);
     $group_id = (int) get_parameter('group_id', 0);
     $offset = (int) get_parameter('offset', 0);
@@ -79,7 +80,8 @@ function mainAgentsModules()
     $full_modules_selected = explode(';', get_parameter('full_modules_selected', 0));
     $full_agents_id = explode(';', get_parameter('full_agents_id', 0));
 
-    if ($save_serialize && $update_item == '') {
+    // In full screen there is no pagination neither filters.
+    if (( ($config['pure'] == 0 && $save_serialize) && $update_item == '' ) || ( ($config['pure'] == 1 && $save_serialize == 0) && $update_item == '' )) {
         $unserialize_modules_selected  = unserialize_in_temp($config['id_user'].'_agent_module', true, 1);
         $unserialize_agents_id         = unserialize_in_temp($config['id_user'].'_agents', true, 1);
         if ($unserialize_modules_selected) {
@@ -102,7 +104,6 @@ function mainAgentsModules()
         serialize_in_temp($agents_id, $config['id_user'].'_agents', 1);
     }
 
-    // if($agents_id != -1) $agents_id = null;
     if ($config['pure'] == 0) {
         if ($modules_selected[0] && $agents_id[0]) {
             $full_modules = urlencode(implode(';', $modules_selected));
@@ -124,13 +125,13 @@ function mainAgentsModules()
         }
     }
 
-    // groups
+    // Groups.
     $filter_groups_label = '<b>'.__('Group').'</b>';
     $filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;');
 
     $filter_recursion_label = '<b>'.__('Recursion').'</b>';
     $filter_recursion = html_print_checkbox('recursion', 1, 0, true);
-    // groups module
+    // Groups module.
     $filter_module_groups_label = '<b>'.__('Module group').'</b>';
     $filter_module_groups = html_print_select_from_sql(
         'SELECT * FROM tmodule_group ORDER BY name',
@@ -146,7 +147,7 @@ function mainAgentsModules()
         'width: auto;'
     );
 
-    // agent
+    // Agent.
     $agents = agents_get_group_agents($group_id);
     if ((empty($agents)) || $agents == -1) {
         $agents = [];
@@ -155,7 +156,7 @@ function mainAgentsModules()
     $filter_agents_label = '<b>'.__('Agents').'</b>';
     $filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, 'min-width: 180px; max-width: 200px;');
 
-    // type show
+    // Type show.
     $selection = [
         0 => __('Show common modules'),
         1 => __('Show all modules'),
@@ -163,12 +164,12 @@ function mainAgentsModules()
     $filter_type_show_label = '<b>'.__('Show common modules').'</b>';
     $filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', '', 0, true, false, true, '', false, 'min-width: 180px;');
 
-    // modules
+    // Modules.
     $all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false);
     $filter_modules_label = '<b>'.__('Module').'</b>';
     $filter_modules = html_print_select($all_modules, 'module[]', $modules_selected, '', '', 0, true, true, false, '', false, 'min-width: 180px; max-width: 200px;');
 
-    // update
+    // Update.
     $filter_update = html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"', true);
 
     $onheader = [
@@ -178,8 +179,11 @@ function mainAgentsModules()
         'combo_groups'        => $filter_groups,
     ];
 
-    // Old style table, we need a lot of special formatting,don't use table function
-    // Prepare old-style table
+    /*
+     * Old style table, we need a lot of special formatting,don't use table function.
+     * Prepare old-style table.
+     */
+
     if ($config['pure'] == 0) {
         // Header.
         ui_print_page_header(
@@ -200,38 +204,51 @@ function mainAgentsModules()
             $full_modules = urlencode(implode(';', $full_modules_selected));
             $full_agents = urlencode(implode(';', $full_agents_id));
 
-            $url = " index.php?sec=view&sec2=extensions/agents_modules&amp;pure=0&amp;offset=$offset
+            $url = 'index.php?sec=view&sec2=extensions/agents_modules&amp;pure=0&amp;offset=$offset
 			&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr&full_modules_selected=$full_modules
-			&full_agents_id=$full_agents&selection_agent_module=$selection_a_m";
+			&full_agents_id=$full_agents&selection_agent_module=$selection_a_m';
         } else {
-            $url = " index.php?sec=view&sec2=extensions/agents_modules&amp;pure=0&amp;offset=$offset&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr";
+            $url = 'index.php?sec=view&sec2=extensions/agents_modules&amp;pure=0&amp;offset=$offset&group_id=$group_id&modulegroup=$modulegroup&refresh=$refr';
         }
 
-        // Floating menu - Start
+        // Floating menu - Start.
         echo '<div id="vc-controls" style="z-index: 999">';
 
         echo '<div id="menu_tab">';
         echo '<ul class="mn">';
 
-        // Quit fullscreen
+        // Quit fullscreen.
         echo '<li class="nomn">';
         echo '<a target="_top" href="'.$url.'">';
         echo html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]);
         echo '</a>';
         echo '</li>';
 
-        // Countdown
+        // Countdown.
         echo '<li class="nomn">';
         echo '<div class="vc-refr">';
-        echo '<div class="vc-countdown"></div>';
+        echo '<div class="vc-countdown style="display: inline;"></div>';
         echo '<div id="vc-refr-form">';
         echo __('Refresh').':';
-        echo html_print_select(get_refresh_time_array(), 'refresh', $refr, '', '', 0, true, false, false);
+        echo html_print_select(
+            get_refresh_time_array(),
+            'refresh',
+            $refr,
+            '',
+            '',
+            0,
+            true,
+            false,
+            false,
+            '',
+            false,
+            'margin-top: 3px;'
+        );
         echo '</div>';
         echo '</div>';
         echo '</li>';
 
-        // Console name
+        // Console name.
         echo '<li class="nomn">';
         echo '<div class="vc-title">'.__('Agent/module view').'</div>';
         echo '</li>';
@@ -240,35 +257,35 @@ function mainAgentsModules()
         echo '</div>';
 
         echo '</div>';
-        // Floating menu - End
+        // Floating menu - End.
         ui_require_jquery_file('countdown');
     }
 
     if ($config['pure'] != 1) {
-        echo '<form method="post" action="'.ui_get_url_refresh(['offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup]).'">';
-
-        echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">';
-            echo '<tr>';
-                echo '<td>'.$filter_groups_label.'</td>';
-                echo '<td>'.$filter_groups.'&nbsp;&nbsp;&nbsp;'.$filter_recursion_label.$filter_recursion.'</td>';
-                echo '<td></td>';
-                echo '<td></td>';
-                echo '<td>'.$filter_module_groups_label.'</td>';
-                echo '<td>'.$filter_module_groups.'</td>';
-            echo '</tr>';
-            echo '<tr>';
-                echo '<td>'.$filter_agents_label.'</td>';
-                echo '<td>'.$filter_agents.'</td>';
-                echo '<td>'.$filter_type_show_label.'</td>';
-                echo '<td>'.$filter_type_show.'</td>';
-                echo '<td>'.$filter_modules_label.'</td>';
-                echo '<td>'.$filter_modules.'</td>';
-            echo '</tr>';
-            echo '<tr>';
-                echo "<td colspan=6 ><span style='float: right; padding-right: 20px;'>".$filter_update.'</sapn></td>';
-            echo '</tr>';
-        echo '</table>';
-        echo '</form>';
+        $show_filters = '<form method="post" action="'.ui_get_url_refresh(['offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup]).'" style="width:100%;">';
+        $show_filters .= '<table class="white_table" cellpadding="0" cellspacing="0" border="0" style="width:100%; border:none;">';
+            $show_filters .= '<tr>';
+                $show_filters .= '<td>'.$filter_groups_label.'</td>';
+                $show_filters .= '<td>'.$filter_groups.'&nbsp;&nbsp;&nbsp;'.$filter_recursion_label.$filter_recursion.'</td>';
+                $show_filters .= '<td></td>';
+                $show_filters .= '<td></td>';
+                $show_filters .= '<td>'.$filter_module_groups_label.'</td>';
+                $show_filters .= '<td>'.$filter_module_groups.'</td>';
+            $show_filters .= '</tr>';
+            $show_filters .= '<tr>';
+                $show_filters .= '<td>'.$filter_agents_label.'</td>';
+                $show_filters .= '<td>'.$filter_agents.'</td>';
+                $show_filters .= '<td>'.$filter_type_show_label.'</td>';
+                $show_filters .= '<td>'.$filter_type_show.'</td>';
+                $show_filters .= '<td>'.$filter_modules_label.'</td>';
+                $show_filters .= '<td>'.$filter_modules.'</td>';
+            $show_filters .= '</tr>';
+            $show_filters .= '<tr>';
+                $show_filters .= "<td colspan=6 ><span style='float: right; padding-right: 20px;'>".$filter_update.'</sapn></td>';
+            $show_filters .= '</tr>';
+        $show_filters .= '</table>';
+        $show_filters .= '</form>';
+        ui_toggle($show_filters, __('Filters'));
     }
 
     if ($agents_id[0] != -1) {
@@ -291,7 +308,7 @@ function mainAgentsModules()
 
     $count = 0;
     foreach ($agents as $agent) {
-        // TODO TAGS agents_get_modules
+        // TODO TAGS agents_get_modules.
         $module = agents_get_modules(
             $agent,
             false,
@@ -339,7 +356,7 @@ function mainAgentsModules()
                 }
             }
         } else {
-            // TODO TAGS agents_get_modules
+            // TODO TAGS agents_get_modules.
             $all_modules = agents_get_modules(
                 $agents,
                 false,
@@ -414,11 +431,11 @@ function mainAgentsModules()
 
     if ($hor_offset > 0) {
         $new_hor_offset = ($hor_offset - $block);
-        echo "<th width='20px' "."style='vertical-align:top; padding-top: 35px;' "."rowspan='".($nagents + 1)."'>"."<a href='index.php?".'extension_in_menu=estado&'.'sec=extensions&'.'sec2=extensions/agents_modules&'.'refr=0&'.'save_serialize=1&'.'selection_a_m='.$selection_a_m.'&'.'hor_offset='.$new_hor_offset.'&'.'offset='.$offset."'>".html_print_image(
-            'images/arrow_left.png',
+        echo "<th width='20px' style='vertical-align: middle; text-align: center;' rowspan='".($nagents + 1)."'><a href='index.php?".'extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&refr=0&save_serialize=1&selection_a_m='.$selection_a_m.'&hor_offset='.$new_hor_offset.'&offset='.$offset."'>".html_print_image(
+            'images/arrow_left_green.png',
             true,
             ['title' => __('Previous modules')]
-        ).'</a>'.'</th>';
+        ).'</a></th>';
     }
 
     $nmodules = 0;
@@ -440,11 +457,11 @@ function mainAgentsModules()
 
     if (($hor_offset + $block) < $nmodules) {
         $new_hor_offset = ($hor_offset + $block);
-        echo "<th width='20px' "."style='vertical-align:top; padding-top: 35px;' "."rowspan='".($nagents + 1)."'>"."<a href='index.php?".'extension_in_menu=estado&'.'sec=extensions&'.'sec2=extensions/agents_modules&'.'save_serialize=1&'.'selection_a_m='.$selection_a_m.'&'.'hor_offset='.$new_hor_offset.'&'.'offset='.$offset."'>".html_print_image(
-            'images/arrow.png',
+        echo "<th width='20px' style='vertical-align: middle; text-align: center;' rowspan='".($nagents + 1)."'><a href='index.php?".'extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&selection_a_m='.$selection_a_m.'&hor_offset='.$new_hor_offset.'&offset='.$offset."'>".html_print_image(
+            'images/arrow_right_green.png',
             true,
             ['title' => __('More modules')]
-        ).'</a>'.'</th>';
+        ).'</a></th>';
     }
 
     echo '</tr>';
@@ -457,12 +474,12 @@ function mainAgentsModules()
         $filter_agents['id_grupo'] = $group_id;
     }
 
-    // Prepare pagination
-    $url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&'.'hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m;
+    // Prepare pagination.
+    $url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m;
     ui_pagination($total_pagination, $url);
 
     foreach ($agents as $agent) {
-        // Get stats for this group
+        // Get stats for this group.
         $agent_status = agents_get_status($agent['id_agente']);
         $alias = db_get_row('tagente', 'id_agente', $agent['id_agente']);
         if (empty($alias['alias'])) {
@@ -471,29 +488,29 @@ function mainAgentsModules()
 
         switch ($agent_status) {
             case 4:
-                // Alert fired status
+                // Alert fired status.
                 $rowcolor = 'group_view_alrm';
             break;
 
             case 1:
-                // Critical status
+                // Critical status.
                 $rowcolor = 'group_view_crit';
             break;
 
             case 2:
-                // Warning status
+                // Warning status.
                 $rowcolor = 'group_view_warn';
             break;
 
             case 0:
-                // Normal status
+                // Normal status.
                 $rowcolor = 'group_view_ok';
             break;
 
             case 3:
             case -1:
             default:
-                // Unknown status
+                // Unknown status.
                 $rowcolor = 'group_view_unk';
             break;
         }
@@ -502,7 +519,7 @@ function mainAgentsModules()
 
         echo "<td class='$rowcolor'>
 			<a class='$rowcolor' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$agent['id_agente']."'>".$alias['alias'].'</a></td>';
-        // TODO TAGS agents_get_modules
+        // TODO TAGS agents_get_modules.
         $agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true);
 
         $nmodules = 0;
@@ -572,18 +589,23 @@ function mainAgentsModules()
 
     echo '</table>';
 
-    echo "<div class='legend_basic' style='width: 96%'>";
+    $show_legend = "<div class='legend_white'>";
+    $show_legend .= "<div style='display: flex;align-items: center;'>
+            <div class='legend_square_simple'><div style='background-color: ".COL_ALERTFIRED.";'></div></div>".__('Orange cell when the module has fired alerts').'</div>';
+    $show_legend .= "<div style='display: flex;align-items: center;'>
+            <div class='legend_square_simple'><div style='background-color: ".COL_CRITICAL.";'></div></div>".__('Red cell when the module has a critical status').'
+        </div>';
+    $show_legend .= "<div style='display: flex;align-items: center;'>
+        <div class='legend_square_simple'><div style='background-color: ".COL_WARNING.";'></div></div>".__('Yellow cell when the module has a warning status').'</div>';
+    $show_legend .= "<div style='display: flex;align-items: center;'>
+        <div class='legend_square_simple'><div style='background-color: ".COL_NORMAL.";'></div></div>".__('Green cell when the module has a normal status').'</div>';
+    $show_legend .= "<div style='display: flex;align-items: center;'>
+        <div class='legend_square_simple'><div style='background-color: ".COL_UNKNOWN.";'></div></div>".__('Grey cell when the module has an unknown status').'</div>';
+    $show_legend .= "<div style='display: flex;align-items: center;'>
+        <div class='legend_square_simple'><div style='background-color: ".COL_NOTINIT.";'></div></div>".__("Cell turns blue when the module is in 'not initialize' status").'</div>';
+    $show_legend .= '</div>';
+    ui_toggle($show_legend, __('Legend'));
 
-    echo '<table>';
-    echo "<tr><td colspan='2' style='padding-bottom: 10px;'><b>".__('Legend').'</b></td></tr>';
-    echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_ALERTFIRED.";'></div></td><td>".__('Orange cell when the module has fired alerts').'</td></tr>';
-    echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_CRITICAL.";'></div></td><td>".__('Red cell when the module has a critical status').'</td></tr>';
-    echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_WARNING.";'></div></td><td>".__('Yellow cell when the module has a warning status').'</td></tr>';
-    echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NORMAL.";'></div></td><td>".__('Green cell when the module has a normal status').'</td></tr>';
-    echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_UNKNOWN.";'></div></td><td>".__('Grey cell when the module has an unknown status').'</td></tr>';
-    echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NOTINIT.";'></div></td><td>".__("Cell turns blue when the module is in 'not initialize' status").'</td></tr>';
-    echo '</table>';
-    echo '</div>';
     $pure_var = $config['pure'];
     if ($pure_var) {
         $pure_var = 1;
@@ -627,16 +649,14 @@ $ignored_params['refresh'] = '';
         $.each($('.th_class_module_r'), function (i, elem) {
             id = $(elem).attr('id').replace('th_module_r_', '');
             $("#th_module_r_" + id).height(($("#div_module_r_" + id).width() + 10) + 'px');
-            
-            //$("#div_module_r_" + id).css('margin-top', (max_width - $("#div_module_r_" + id).width()) + 'px');
             $("#div_module_r_" + id).css('margin-top', (max_width - 20) + 'px');
             $("#div_module_r_" + id).show();
         });
 
-        var refr =" . $refr . ";
-        var pure =" . $pure_var . ";
-        var href ='" . ui_get_url_refresh ($ignored_params) . "';
-            
+        var refr = '<?php echo get_parameter('refresh', 0); ?>';
+        var pure = '<?php echo get_parameter('pure', 0); ?>';
+        var href =' <?php echo ui_get_url_refresh($ignored_params); ?>';
+
         if (pure) {
             var startCountDown = function (duration, cb) {
                 $('div.vc-countdown').countdown('destroy');
@@ -646,7 +666,7 @@ $ignored_params['refresh'] = '';
                 $('div.vc-countdown').countdown({
                     until: t,
                     format: 'MS',
-                    layout: '(%M%nn%M:%S%nn%S Until refresh)',
+                    layout: '(%M%nn%M:%S%nn%S <?php echo __('Until next'); ?>) ',
                     alwaysExpire: true,
                     onExpiry: function () {
                         $('div.vc-countdown').countdown('destroy');
@@ -655,8 +675,11 @@ $ignored_params['refresh'] = '';
                     }
                 });
             }
-            
-            startCountDown(refr, false);
+
+            if(refr>0){
+                startCountDown(refr, false);
+            }
+
             var controls = document.getElementById('vc-controls');
             autoHideElement(controls, 1000);
             
diff --git a/pandora_console/extensions/db_status.php b/pandora_console/extensions/db_status.php
index 2d8669f83f..5659ed6d9b 100755
--- a/pandora_console/extensions/db_status.php
+++ b/pandora_console/extensions/db_status.php
@@ -69,7 +69,7 @@ function extension_db_status()
 
     echo "<div style='text-align: right;'>";
     html_print_input_hidden('db_status_execute', 1);
-    html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub"');
+    html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub next"');
     echo '</div>';
 
     echo '</form>';
@@ -215,7 +215,7 @@ function extension_db_check_tables_differences(
     $diff_tables = array_diff($tables_test, $tables_system);
 
     ui_print_result_message(
-        !empty($diff_tables),
+        empty($diff_tables),
         __('Success! %s DB contains all tables', get_product_name()),
         __(
             '%s DB could not retrieve all tables. The missing tables are (%s)',
diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php
index 9e750be932..8b5075f77c 100644
--- a/pandora_console/extensions/module_groups.php
+++ b/pandora_console/extensions/module_groups.php
@@ -1,17 +1,32 @@
 <?php
+/**
+ * Module groups.
+ *
+ * @category   Extensions
+ * @package    Pandora FMS
+ * @subpackage Module groups view.
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; version 2
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-// Load global vars
+// Begin.
 global $config;
 
 check_login();
@@ -32,10 +47,12 @@ if (is_ajax()) {
 }
 
 
-/**
- * The main function of module groups and the enter point to
- * execute the code.
- */
+ /**
+  * The main function of module groups and the enter point to
+  * execute the code.
+  *
+  * @return void
+  */
 function mainModuleGroups()
 {
     global $config;
@@ -68,13 +85,20 @@ function mainModuleGroups()
     $info = array_filter(
         $info,
         function ($v, $k) use ($agent_group_search) {
-            return preg_match("/$agent_group_search/i", $v['name']);
+            return preg_match(
+                '/'.$agent_group_search.'/i',
+                $v['name']
+            );
         },
         ARRAY_FILTER_USE_BOTH
     );
 
     if (!empty($info)) {
-        $groups_view = $is_not_paginated ? $info : array_slice($info, $offset, $config['block_size']);
+        $groups_view = ($is_not_paginated) ? $info : array_slice(
+            $info,
+            $offset,
+            $config['block_size']
+        );
         $agents_counters = array_reduce(
             $groups_view,
             function ($carry, $item) {
@@ -113,7 +137,7 @@ function mainModuleGroups()
     $array_module_group = array_filter(
         $array_module_group,
         function ($v, $k) use ($module_group_search) {
-            return preg_match("/$module_group_search/i", $v);
+            return preg_match('/'.$module_group_search.'/i', $v);
         },
         ARRAY_FILTER_USE_BOTH
     );
@@ -125,66 +149,75 @@ function mainModuleGroups()
         $array_for_defect[$key]['data']['icon'] = $value['icon'];
     }
 
-    $sql = "SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count,
-		SUM(IF($condition_warning, 1, 0)) AS warning_module_count,
-		SUM(IF($condition_unknown, 1, 0)) AS unknown_module_count,
-		SUM(IF($condition_not_init, 1, 0)) AS notInit_module_count,
-		SUM(IF($condition_critical, 1, 0)) AS critical_module_count,
-		SUM(IF($condition_normal, 1, 0)) AS normal_module_count,
-		COUNT(tae.id_agente_modulo) AS total_count,
-		tmg.id_mg,
-		tmg.name as n,
-		tg.id_grupo
-	FROM (
-		SELECT tam.id_agente_modulo,
-			tam.id_module_group,
-			ta.id_grupo AS g,
-			tae.estado,
-			SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
-			FROM tagente_modulo tam
-			LEFT JOIN talert_template_modules tatm
-				ON tatm.id_agent_module = tam.id_agente_modulo
-				AND tatm.times_fired = 1
-			LEFT JOIN tagente_estado tae
-				ON tae.id_agente_modulo = tam.id_agente_modulo
-			INNER JOIN tagente ta
-				ON ta.id_agente = tam.id_agente
-			WHERE ta.disabled = 0
-				AND tam.disabled = 0
-				AND tam.delete_pending = 0
-				AND ta.id_grupo IN ($ids_group)
-			GROUP BY tam.id_agente_modulo
-		UNION ALL
-		SELECT tam.id_agente_modulo,
-			tam.id_module_group,
-			tasg.id_group AS g,
-			tae.estado,
-			SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
-			FROM tagente_modulo tam
-			LEFT JOIN talert_template_modules tatm
-				ON tatm.id_agent_module = tam.id_agente_modulo
-				AND tatm.times_fired = 1
-			LEFT JOIN tagente_estado tae
-				ON tae.id_agente_modulo = tam.id_agente_modulo
-			INNER JOIN tagente ta
-				ON ta.id_agente = tam.id_agente
-			INNER JOIN tagent_secondary_group tasg
-				ON ta.id_agente = tasg.id_agent
-			WHERE ta.disabled = 0
-				AND tam.disabled = 0
-				AND tam.delete_pending = 0
-				AND tasg.id_group IN ($ids_group)
-			GROUP BY tam.id_agente_modulo, tasg.id_group
-	) AS tae
-	RIGHT JOIN tgrupo tg
-		ON tg.id_grupo = tae.g
-	INNER JOIN (
-		SELECT * FROM tmodule_group
-		UNION ALL
-		SELECT 0 AS 'id_mg', 'Nothing' AS 'name'
-	) AS tmg
-		ON tae.id_module_group = tmg.id_mg
-	GROUP BY tae.g, tmg.id_mg";
+    $sql = sprintf(
+        "SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count,
+            SUM(IF(%s, 1, 0)) AS warning_module_count,
+            SUM(IF(%s, 1, 0)) AS unknown_module_count,
+            SUM(IF(%s, 1, 0)) AS notInit_module_count,
+            SUM(IF(%s, 1, 0)) AS critical_module_count,
+            SUM(IF(%s, 1, 0)) AS normal_module_count,
+            COUNT(tae.id_agente_modulo) AS total_count,
+            tmg.id_mg,
+            tmg.name as n,
+            tg.id_grupo
+        FROM (
+            SELECT tam.id_agente_modulo,
+                tam.id_module_group,
+                ta.id_grupo AS g,
+                tae.estado,
+                SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
+                FROM tagente_modulo tam
+                LEFT JOIN talert_template_modules tatm
+                    ON tatm.id_agent_module = tam.id_agente_modulo
+                    AND tatm.times_fired = 1
+                LEFT JOIN tagente_estado tae
+                    ON tae.id_agente_modulo = tam.id_agente_modulo
+                INNER JOIN tagente ta
+                    ON ta.id_agente = tam.id_agente
+                WHERE ta.disabled = 0
+                    AND tam.disabled = 0
+                    AND tam.delete_pending = 0
+                    AND ta.id_grupo IN (%s)
+                GROUP BY tam.id_agente_modulo
+            UNION ALL
+            SELECT tam.id_agente_modulo,
+                tam.id_module_group,
+                tasg.id_group AS g,
+                tae.estado,
+                SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
+                FROM tagente_modulo tam
+                LEFT JOIN talert_template_modules tatm
+                    ON tatm.id_agent_module = tam.id_agente_modulo
+                    AND tatm.times_fired = 1
+                LEFT JOIN tagente_estado tae
+                    ON tae.id_agente_modulo = tam.id_agente_modulo
+                INNER JOIN tagente ta
+                    ON ta.id_agente = tam.id_agente
+                INNER JOIN tagent_secondary_group tasg
+                    ON ta.id_agente = tasg.id_agent
+                WHERE ta.disabled = 0
+                    AND tam.disabled = 0
+                    AND tam.delete_pending = 0
+                    AND tasg.id_group IN (%s)
+                GROUP BY tam.id_agente_modulo, tasg.id_group
+        ) AS tae
+        RIGHT JOIN tgrupo tg
+            ON tg.id_grupo = tae.g
+        INNER JOIN (
+            SELECT * FROM tmodule_group
+            UNION ALL
+            SELECT 0 AS 'id_mg', 'Nothing' AS 'name'
+        ) AS tmg
+            ON tae.id_module_group = tmg.id_mg
+        GROUP BY tae.g, tmg.id_mg",
+        $condition_warning,
+        $condition_unknown,
+        $condition_not_init,
+        $condition_critical,
+        $condition_normal,
+        $ids_group,
+        $ids_group
+    );
 
     $array_data_prev = db_get_all_rows_sql($sql);
 
@@ -220,11 +253,29 @@ function mainModuleGroups()
     echo '<td>';
     echo '</tr></table>';
 
+    $cell_style = '
+        min-width: 60px;
+        width: 100%;
+        margin: 0;
+        overflow:hidden;
+        text-align: center;
+        padding: 5px;
+        padding-bottom:10px;
+        font-size: 18px;
+        text-align: center;
+    ';
+
     if (true) {
         $table = new StdClass();
-        $table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;';
+        $table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;';
         $table->width = '100%';
 
+        if ($config['style'] === 'pandora_black') {
+            $background_color = '#333';
+        } else {
+            $background_color = '#fff';
+        }
+
         $head[0] = __('Groups');
         $headstyle[0] = 'width: 20%;  font-weight: bolder;';
         foreach ($array_module_group as $key => $value) {
@@ -248,28 +299,28 @@ function mainModuleGroups()
                             $color = '#FFA631';
                             // Orange when the cell for this model group and agent has at least one alert fired.
                         } else if ($array_data[$key][$k]['critical_module_count'] != 0) {
-                            $color = '#FC4444';
+                            $color = '#e63c52';
                             // Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
                         } else if ($array_data[$key][$k]['warning_module_count'] != 0) {
-                            $color = '#FAD403';
+                            $color = '#f3b200';
                             // Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
                         } else if ($array_data[$key][$k]['unknown_module_count'] != 0) {
                             $color = '#B2B2B2 ';
                             // Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
                         } else if ($array_data[$key][$k]['normal_module_count'] != 0) {
-                            $color = '#80BA27';
+                            $color = '#82b92e';
                             // Green when the cell for this model group and agent has OK state all modules.
                         } else if ($array_data[$key][$k]['notInit_module_count'] != 0) {
                             $color = '#5BB6E5';
                             // Blue when the cell for this module group and all modules have not init value.
                         }
 
-                        $data[$i][$j] = "<div style='background:$color; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
+                        $data[$i][$j] = "<div style='".$cell_style.'background:'.$color.";'>";
                         $data[$i][$j] .= "<a class='info_cell' rel='$rel' href='$url' style='color:white;font-size: 18px;'>";
                         $data[$i][$j] .= $array_data[$key][$k]['total_count'];
                         $data[$i][$j] .= '</a></div>';
                     } else {
-                        $data[$i][$j] = "<div style='background:white; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
+                        $data[$i][$j] = "<div style='background:".$background_color.';'.$cell_style."'>";
                         $data[$i][$j] .= 0;
                         $data[$i][$j] .= '</div>';
                     }
@@ -278,7 +329,7 @@ function mainModuleGroups()
                 }
             } else {
                 foreach ($value['gm'] as $k => $v) {
-                    $data[$i][$j] = "<div style='background:white; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
+                    $data[$i][$j] = "<div style='background:".$background_color."; min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
                     $data[$i][$j] .= 0;
                     $data[$i][$j] .= '</div>';
                     $j++;
diff --git a/pandora_console/extensions/net_tools.php b/pandora_console/extensions/net_tools.php
index e6ec05977b..ba66cae68e 100644
--- a/pandora_console/extensions/net_tools.php
+++ b/pandora_console/extensions/net_tools.php
@@ -1,26 +1,60 @@
 <?php
+/**
+ * Net tools utils.
+ *
+ * @category   Extensions
+ * @package    Pandora FMS
+ * @subpackage NetTools
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; version 2
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// Begin.
+global $config;
+
+// Requires.
+require_once $config['homedir'].'/include/functions.php';
+
+// This extension is usefull only if the agent has associated IP.
 $id_agente = get_parameter('id_agente');
-
-// This extension is usefull only if the agent has associated IP
 $address = agents_get_address($id_agente);
 
 if (!empty($address) || empty($id_agente)) {
-    extensions_add_opemode_tab_agent('network_tools', 'Network Tools', 'extensions/net_tools/nettool.png', 'main_net_tools', 'v1r1', 'AW');
+    extensions_add_opemode_tab_agent(
+        'network_tools',
+        'Network Tools',
+        'extensions/net_tools/nettool.png',
+        'main_net_tools',
+        'v1r1',
+        'AW'
+    );
 }
 
 
+/**
+ * Searchs for command.
+ *
+ * @param string $command Command.
+ *
+ * @return string Path.
+ */
 function whereis_the_command($command)
 {
     global $config;
@@ -63,6 +97,9 @@ function whereis_the_command($command)
                     return $snmpget_path;
                 }
             break;
+
+            default:
+            return null;
         }
     }
 
@@ -87,85 +124,20 @@ function whereis_the_command($command)
 }
 
 
-function main_net_tools()
+/**
+ * Execute net tools action.
+ *
+ * @param integer $operation    Operation.
+ * @param string  $ip           Ip.
+ * @param string  $community    Community.
+ * @param string  $snmp_version SNMP version.
+ *
+ * @return void
+ */
+function net_tools_execute($operation, $ip, $community, $snmp_version)
 {
-    $id_agente = get_parameter('id_agente');
-    $principal_ip = db_get_sql("SELECT direccion FROM tagente WHERE id_agente = $id_agente");
-
-    $list_address = db_get_all_rows_sql('select id_a from taddress_agent where id_agent = '.$id_agente);
-    foreach ($list_address as $address) {
-        $ids[] = join(',', $address);
-    }
-
-    $ids_address = implode(',', $ids);
-    $ips = db_get_all_rows_sql('select ip from taddress where id_a in ('.$ids_address.')');
-
-    if ($ips == '') {
-        echo "<div class='error' style='margin-top:5px'>".__('The agent hasn\'t got IP').'</div>';
-        return;
-    }
-
-    echo "
-		<script type='text/javascript'>
-			function mostrarColumns(ValueSelect) {
-				value = ValueSelect.value;
-				if (value == 3) {
-					$('netToolTable').css('width','100%');
-					$('#snmpcolumn').show();
-				}
-				else {
-					$('netToolTable').css('width','100%');
-					$('#snmpcolumn').hide();
-				}
-			}
-		</script>";
-
-    echo '<div>';
-    echo "<form name='actionbox' method='post'>";
-    echo "<table class='databox filters' width=100% id=netToolTable>";
-    echo '<tr><td>';
-    echo __('Operation');
-    ui_print_help_tip(
-        __('You can set the command path in the menu Administration -&gt; Extensions -&gt; Config Network Tools')
-    );
-    echo '</td><td>';
-    echo "<select name='operation' onChange='mostrarColumns(this);'>";
-    echo "<option value='1'>".__('Traceroute');
-    echo "<option value='2'>".__('Ping host & Latency');
-    echo "<option value='3'>".__('SNMP Interface status');
-    echo "<option value='4'>".__('Basic TCP Port Scan');
-    echo "<option value='5'>".__('DiG/Whois Lookup');
-    echo '</select>';
-    echo '</td>';
-    echo '<td>';
-    echo __('IP address');
-    echo '</td><td>';
-    echo "<select name='select_ips'>";
-    foreach ($ips as $ip) {
-        if ($ip['ip'] == $principal_ip) {
-            echo "<option value='".$ip['ip']."' selected = 'selected'>".$ip['ip'];
-        } else {
-            echo "<option value='".$ip['ip']."'>".$ip['ip'];
-        }
-    }
-
-    echo '</select>';
-    echo '</td>';
-    echo "<td id='snmpcolumn' style=\"display:none;\">";
-    echo __('SNMP Community').'&nbsp;';
-    echo "<input name=community type=text value='public'>";
-    echo '</td><td>';
-    echo "<input style='margin:0px;' name=submit type=submit class='sub next' value='".__('Execute')."'>";
-    echo '</td>';
-    echo '</tr></table>';
-    echo '</form>';
-
-    $operation = get_parameter('operation', 0);
-    $community = get_parameter('community', 'public');
-    $ip = get_parameter('select_ips');
-
     if (!validate_address($ip)) {
-        ui_print_error_message(__('The ip or dns name entered cannot be resolved'));
+            ui_print_error_message(__('The ip or dns name entered cannot be resolved'));
     } else {
         switch ($operation) {
             case 1:
@@ -175,7 +147,7 @@ function main_net_tools()
                 } else {
                     echo '<h3>'.__('Traceroute to ').$ip.'</h3>';
                     echo '<pre>';
-                    echo system("$traceroute $ip");
+                    echo system($traceroute.' '.$ip);
                     echo '</pre>';
                 }
             break;
@@ -187,7 +159,7 @@ function main_net_tools()
                 } else {
                     echo '<h3>'.__('Ping to %s', $ip).'</h3>';
                     echo '<pre>';
-                    echo system("$ping -c 5 $ip");
+                    echo system($ping.' -c 5 '.$ip);
                     echo '</pre>';
                 }
             break;
@@ -199,7 +171,7 @@ function main_net_tools()
                 } else {
                     echo '<h3>'.__('Basic TCP Scan on ').$ip.'</h3>';
                     echo '<pre>';
-                    echo system("$nmap -F $ip");
+                    echo system($nmap.' -F '.$ip);
                     echo '</pre>';
                 }
             break;
@@ -212,7 +184,7 @@ function main_net_tools()
                     ui_print_error_message(__('Dig executable does not exist.'));
                 } else {
                     echo '<pre>';
-                    echo system("dig $ip");
+                    echo system('dig '.$ip);
                     echo '</pre>';
                 }
 
@@ -221,51 +193,227 @@ function main_net_tools()
                     ui_print_error_message(__('Whois executable does not exist.'));
                 } else {
                     echo '<pre>';
-                    echo system("whois $ip");
+                    echo system('whois '.$ip);
                     echo '</pre>';
                 }
             break;
 
             case 3:
+                $snmp_obj = [
+                    'ip_target'      => $ip,
+                    'snmp_version'   => $snmp_version,
+                    'snmp_community' => $community,
+                    'format'         => '-Oqn',
+                ];
+
+                $snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.3.0';
+                $result = get_h_snmpwalk($snmp_obj);
                 echo '<h3>'.__('SNMP information for ').$ip.'</h3>';
-
-                $snmpget = whereis_the_command('snmpget');
-                if (empty($snmpget)) {
-                    ui_print_error_message(__('SNMPget executable does not exist.'));
+                echo '<h4>'.__('Uptime').'</h4>';
+                echo '<pre>';
+                if (empty($result)) {
+                    ui_print_error_message(__('Target unreachable.'));
+                    break;
                 } else {
-                    echo '<h4>'.__('Uptime').'</h4>';
-                    echo '<pre>';
-                    echo exec("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.3.0 ");
-                    echo '</pre>';
-                    echo '<h4>'.__('Device info').'</h4>';
-                    echo '<pre>';
-
-                    echo system("$snmpget -Ounv -v1 -c $community $ip .1.3.6.1.2.1.1.1.0 ");
-                    echo '</pre>';
-
-                    echo '<h4>Interface Information</h4>';
-                    echo '<table class=databox>';
-                    echo '<tr><th>'.__('Interface');
-                    echo '<th>'.__('Status');
-
-                    $int_max = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.1.0 ");
-
-                    for ($ax = 0; $ax < $int_max; $ax++) {
-                        $interface = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.2.$ax ");
-                        $estado = exec("$snmpget -Oqunv -v1 -c $community $ip .1.3.6.1.2.1.2.2.1.8.$ax ");
-                        echo "<tr><td>$interface<td>$estado";
-                    }
-
-                    echo '</table>';
+                    echo array_pop($result);
                 }
+
+                echo '</pre>';
+                echo '<h4>'.__('Device info').'</h4>';
+                echo '<pre>';
+                $snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.1.0';
+                $result = get_h_snmpwalk($snmp_obj);
+                if (empty($result)) {
+                    ui_print_error_message(__('Target unreachable.'));
+                    break;
+                } else {
+                    echo array_pop($result);
+                }
+
+                echo '</pre>';
+
+                echo '<h4>Interface Information</h4>';
+
+                $table = new StdClass();
+                $table->class = 'databox';
+                $table->head = [];
+                $table->head[] = __('Interface');
+                $table->head[] = __('Status');
+
+                $i = 0;
+
+                $base_oid = '.1.3.6.1.2.1.2.2.1';
+                $idx_oids = '.1';
+                $names_oids = '.2';
+                $status_oids = '.8';
+
+                $snmp_obj['base_oid'] = $base_oid.$idx_oids;
+                $idx = get_h_snmpwalk($snmp_obj);
+
+                $snmp_obj['base_oid'] = $base_oid.$names_oids;
+                $names = get_h_snmpwalk($snmp_obj);
+
+                $snmp_obj['base_oid'] = $base_oid.$status_oids;
+                $statuses = get_h_snmpwalk($snmp_obj);
+
+                foreach ($idx as $k => $v) {
+                    $index = str_replace($base_oid.$idx_oids, '', $k);
+                    $name = $names[$base_oid.$names_oids.$index];
+
+                    $status = $statuses[$base_oid.$status_oids.$index];
+
+                    $table->data[$i][0] = $name;
+                    $table->data[$i++][1] = $status;
+                }
+
+                html_print_table($table);
+            break;
+
+            default:
+                // Ignore.
             break;
         }
     }
 
+}
+
+
+/**
+ * Main function.
+ *
+ * @return void
+ */
+function main_net_tools()
+{
+    $operation = get_parameter('operation', 0);
+    $community = get_parameter('community', 'public');
+    $ip = get_parameter('select_ips');
+    $snmp_version = get_parameter('select_version');
+
+    // Show form.
+    $id_agente = get_parameter('id_agente', 0);
+    $principal_ip = db_get_sql(
+        sprintf(
+            'SELECT direccion FROM tagente WHERE id_agente = %d',
+            $id_agente
+        )
+    );
+
+    $list_address = db_get_all_rows_sql(
+        sprintf(
+            'SELECT id_a FROM taddress_agent WHERE id_agent = %d',
+            $id_agente
+        )
+    );
+    foreach ($list_address as $address) {
+        $ids[] = join(',', $address);
+    }
+
+    $ips = db_get_all_rows_sql(
+        sprintf(
+            'SELECT ip FROM taddress WHERE id_a IN (%s)',
+            join($ids)
+        )
+    );
+
+    if ($ips == '') {
+        echo "<div class='error' style='margin-top:5px'>".__('The agent hasn\'t got IP').'</div>';
+        return;
+    }
+
+    // Javascript.
+    ?>
+<script type='text/javascript'>
+    $(document).ready(function(){
+        mostrarColumns($('#operation :selected').val());
+    });
+
+    function mostrarColumns(value) {
+        if (value == 3) {
+            $('.snmpcolumn').show();
+        }
+        else {
+            $('.snmpcolumn').hide();
+        }
+    }
+</script>
+    <?php
+    echo '<div>';
+    echo "<form name='actionbox' method='post'>";
+    echo "<table class='databox filters' width=100% id=netToolTable>";
+    echo '<tr><td>';
+    echo __('Operation');
+    ui_print_help_tip(
+        __('You can set the command path in the menu Administration -&gt; Extensions -&gt; Config Network Tools')
+    );
+    echo '</td><td>';
+
+    html_print_select(
+        [
+            1 => __('Traceroute'),
+            2 => __('Ping host & Latency'),
+            3 => __('SNMP Interface status'),
+            4 => __('Basic TCP Port Scan'),
+            5 => __('DiG/Whois Lookup'),
+        ],
+        'operation',
+        $operation,
+        'mostrarColumns(this.value)',
+        __('Please select')
+    );
+
+    echo '</td>';
+    echo '<td>';
+    echo __('IP address');
+    echo '</td><td>';
+
+    $ips_for_select = array_reduce(
+        $ips,
+        function ($carry, $item) {
+            $carry[$item['ip']] = $item['ip'];
+            return $carry;
+        }
+    );
+
+    html_print_select(
+        $ips_for_select,
+        'select_ips',
+        $principal_ip
+    );
+    echo '</td>';
+    echo "<td class='snmpcolumn'>";
+    echo __('SNMP Version');
+    html_print_select(
+        [
+            '1'  => 'v1',
+            '2c' => 'v2c',
+        ],
+        'select_version',
+        $snmp_version
+    );
+    echo '</td><td class="snmpcolumn">';
+    echo __('SNMP Community').'&nbsp;';
+    html_print_input_text('community', $community);
+    echo '</td><td>';
+    echo "<input style='margin:0px;' name=submit type=submit class='sub next' value='".__('Execute')."'>";
+    echo '</td>';
+    echo '</tr></table>';
+    echo '</form>';
+
+    if ($operation) {
+        // Execute form.
+        net_tools_execute($operation, $ip, $community, $snmp_version);
+    }
+
     echo '</div>';
 }
 
 
+/**
+ * Add option.
+ *
+ * @return void
+ */
 function godmode_net_tools()
 {
     global $config;
diff --git a/pandora_console/extensions/realtime_graphs.php b/pandora_console/extensions/realtime_graphs.php
index cea09fe4d5..e487d49ee5 100644
--- a/pandora_console/extensions/realtime_graphs.php
+++ b/pandora_console/extensions/realtime_graphs.php
@@ -173,7 +173,7 @@ function pandora_realtime_graphs()
         $table->colspan[2]['snmp_oid'] = 2;
 
         $data['snmp_ver'] = __('Version').'&nbsp;&nbsp;'.html_print_select($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true);
-        $data['snmp_ver'] .= '&nbsp;&nbsp;'.html_print_button(__('SNMP walk'), 'snmp_walk', false, 'javascript:realtimeGraphs.snmpBrowserWindow();', 'class="sub next"', true);
+        $data['snmp_ver'] .= '&nbsp;&nbsp;'.html_print_button(__('SNMP walk'), 'snmp_walk', false, 'javascript:snmpBrowserWindow();', 'class="sub next"', true);
         $table->colspan[2]['snmp_ver'] = 2;
 
         $table->data[] = $data;
diff --git a/pandora_console/extensions/realtime_graphs/realtime_graphs.css b/pandora_console/extensions/realtime_graphs/realtime_graphs.css
index ab6c94e238..2219c6152a 100644
--- a/pandora_console/extensions/realtime_graphs/realtime_graphs.css
+++ b/pandora_console/extensions/realtime_graphs/realtime_graphs.css
@@ -11,5 +11,5 @@
 
 #graph_container {
   width: 800px;
-  margin: 20px auto !important;
+  margin: 20px auto;
 }
diff --git a/pandora_console/extensions/realtime_graphs/realtime_graphs.js b/pandora_console/extensions/realtime_graphs/realtime_graphs.js
index 7140d245d4..b5d6c1eaa8 100644
--- a/pandora_console/extensions/realtime_graphs/realtime_graphs.js
+++ b/pandora_console/extensions/realtime_graphs/realtime_graphs.js
@@ -10,7 +10,9 @@
 
   var plot;
   var plotOptions = {
-    legend: { container: $("#chartLegend") },
+    legend: {
+      container: $("#chartLegend")
+    },
     xaxis: {
       tickFormatter: function(timestamp, axis) {
         var date = new Date(timestamp * 1000);
@@ -131,47 +133,6 @@
     resetDataPooling();
   }
 
-  // Set the form OID to the value selected in the SNMP browser
-  function setOID() {
-    if ($("#snmp_browser_version").val() == "3") {
-      $("#text-snmp_oid").val($("#table1-0-1").text());
-    } else {
-      $("#text-snmp_oid").val($("#snmp_selected_oid").text());
-    }
-
-    // Close the SNMP browser
-    $(".ui-dialog-titlebar-close").trigger("click");
-  }
-
-  // Show the SNMP browser window
-  function snmpBrowserWindow() {
-    // Keep elements in the form and the SNMP browser synced
-    $("#text-target_ip").val($("#text-ip_target").val());
-    $("#text-community").val($("#text-snmp_community").val());
-    $("#snmp_browser_version").val($("#snmp_version").val());
-    $("#snmp3_browser_auth_user").val($("#snmp3_auth_user").val());
-    $("#snmp3_browser_security_level").val($("#snmp3_security_level").val());
-    $("#snmp3_browser_auth_method").val($("#snmp3_auth_method").val());
-    $("#snmp3_browser_auth_pass").val($("#snmp3_auth_pass").val());
-    $("#snmp3_browser_privacy_method").val($("#snmp3_privacy_method").val());
-    $("#snmp3_browser_privacy_pass").val($("#snmp3_privacy_pass").val());
-
-    $("#snmp_browser_container")
-      .show()
-      .dialog({
-        title: "",
-        resizable: true,
-        draggable: true,
-        modal: true,
-        overlay: {
-          opacity: 0.5,
-          background: "black"
-        },
-        width: 920,
-        height: 500
-      });
-  }
-
   function shortNumber(number) {
     if (Math.round(number) != number) return number;
     number = Number.parseInt(number);
@@ -187,6 +148,7 @@
 
     return number + " " + shorts[pos];
   }
+
   function roundToTwo(num) {
     return +(Math.round(num + "e+2") + "e-2");
   }
diff --git a/pandora_console/extras/delete_files/delete_files.txt b/pandora_console/extras/delete_files/delete_files.txt
index 82ce1527aa..c0d8f0a9db 100644
--- a/pandora_console/extras/delete_files/delete_files.txt
+++ b/pandora_console/extras/delete_files/delete_files.txt
@@ -1,3 +1 @@
-/general/login_identification_wizard.php
-/general/login_required.php
-/godmode/update_manager/update_manager.messages.php
\ No newline at end of file
+operation/servers/recon_view.php
\ No newline at end of file
diff --git a/pandora_console/extras/mr/29.sql b/pandora_console/extras/mr/29.sql
new file mode 100644
index 0000000000..2bc8b9a8c9
--- /dev/null
+++ b/pandora_console/extras/mr/29.sql
@@ -0,0 +1,28 @@
+START TRANSACTION;
+
+ALTER TABLE `tmetaconsole_agent` ADD INDEX `id_tagente_idx` (`id_tagente`);
+
+DELETE FROM `ttipo_modulo` WHERE `nombre` LIKE 'log4x';
+
+CREATE TABLE IF NOT EXISTS `tcredential_store` (
+    `identifier` varchar(100) NOT NULL,
+    `id_group` mediumint(4) unsigned NOT NULL DEFAULT 0,
+    `product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE') default 'CUSTOM',
+    `username` text,
+    `password` text,
+    `extra_1` text,
+    `extra_2` text,
+    PRIMARY KEY (`identifier`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+
+INSERT INTO `tcredential_store` (`identifier`, `id_group`, `product`, `username`, `password`) VALUES ("imported_aws_account", 0, "AWS", (SELECT `value` FROM `tconfig` WHERE `token` = "aws_access_key_id" LIMIT 1), (SELECT `value` FROM `tconfig` WHERE `token` = "aws_secret_access_key" LIMIT 1));
+DELETE FROM `tcredential_store` WHERE `username` IS NULL AND `password` IS NULL;
+
+UPDATE `tagente` ta INNER JOIN `tagente` taa on ta.`id_parent` = taa.`id_agente` AND taa.`nombre` IN ("us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "ap-northeast-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-south-1", "sa-east-1") SET ta.nombre = md5(concat((SELECT `username` FROM `tcredential_store` WHERE `identifier` = "imported_aws_account" LIMIT 1), ta.`nombre`));
+
+UPDATE `tagente` SET `nombre` = md5(concat((SELECT `username` FROM `tcredential_store` WHERE `identifier` = "imported_aws_account" LIMIT 1), `nombre`)) WHERE `nombre` IN ("Aws", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "ap-northeast-1", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-south-1", "sa-east-1");
+
+UPDATE `trecon_task` SET `auth_strings` = "imported_aws_account" WHERE `type` IN (2,6,7);
+
+COMMIT;
diff --git a/pandora_console/extras/mr/30.sql b/pandora_console/extras/mr/30.sql
new file mode 100644
index 0000000000..84e5adfa3e
--- /dev/null
+++ b/pandora_console/extras/mr/30.sql
@@ -0,0 +1,51 @@
+START TRANSACTION;
+
+ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL;
+
+ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
+ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
+
+ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
+ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
+
+ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct';
+
+ALTER TABLE `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
+
+CREATE TABLE `tagent_repository` (
+  `id` SERIAL,
+  `id_os` INT(10) UNSIGNED DEFAULT 0,
+  `arch` ENUM('x64', 'x86') DEFAULT 'x64',
+  `version` VARCHAR(10) DEFAULT '',
+  `path` text,
+  `uploaded_by` VARCHAR(100) DEFAULT '',
+  `uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
+  `last_err` text,
+  PRIMARY KEY (`id`),
+  FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
+    ON UPDATE CASCADE ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `tdeployment_hosts` (
+  `id` SERIAL,
+  `id_cs` VARCHAR(100),
+  `ip` VARCHAR(100) NOT NULL UNIQUE,
+  `id_os` INT(10) UNSIGNED DEFAULT 0,
+  `os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
+  `arch` ENUM('x64', 'x86') DEFAULT 'x64',
+  `current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
+  `target_agent_version_id` BIGINT UNSIGNED,
+  `deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
+  `server_ip` varchar(100) default NULL COMMENT "Where to point target agent",
+  `last_err` text,
+  PRIMARY KEY (`id`),
+  FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
+    ON UPDATE CASCADE ON DELETE SET NULL,
+  FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
+    ON UPDATE CASCADE ON DELETE CASCADE,
+  FOREIGN KEY (`target_agent_version_id`) REFERENCES  `tagent_repository`(`id`)
+    ON UPDATE CASCADE ON DELETE SET NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+
+COMMIT;
diff --git a/pandora_console/extras/mr/31.sql b/pandora_console/extras/mr/31.sql
new file mode 100644
index 0000000000..3e527bff53
--- /dev/null
+++ b/pandora_console/extras/mr/31.sql
@@ -0,0 +1,12 @@
+START TRANSACTION;
+
+UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
+
+DELETE FROM `talert_commands` WHERE `id` = 11;
+
+DELETE FROM `tconfig` WHERE `token` LIKE 'integria_enabled';
+DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
+DELETE FROM `tconfig` WHERE `token` LIKE 'integria_inventory';
+DELETE FROM `tconfig` WHERE `token` LIKE 'integria_url';
+
+COMMIT;
\ No newline at end of file
diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php
index c5420c26bd..9258a3be42 100644
--- a/pandora_console/extras/pandora_diag.php
+++ b/pandora_console/extras/pandora_diag.php
@@ -139,8 +139,9 @@ function get_logs_size($file)
 function get_status_logs($path)
 {
     $status_server_log = '';
-    $size_server_log = get_logs_size($path);
-    if ($size_server_log <= 1048576) {
+    $size_server_log = number_format(get_logs_size($path));
+    $size_server_log = (0 + str_replace(',', '', $size_server_log));
+    if ($size_server_log <= 10485760) {
         $status_server_log = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>&nbsp&nbsp You have less than 10 MB of logs</a>";
     } else {
         $status_server_log = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>&nbsp&nbsp You have more than 10 MB of logs</a>";
@@ -361,7 +362,7 @@ if ($console_mode == 1) {
         true
     );
 
-    echo "<table width='1000px' border='0' style='border:0px;' class='databox data' cellpadding='4' cellspacing='4'>";
+    echo "<table id='diagnostic_info' width='1000px' border='0' style='border:0px;' class='databox data' cellpadding='4' cellspacing='4'>";
     echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Pandora status info').'</th></tr>';
 }
 
diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
index 2c9ff7e7de..704ab61d74 100644
--- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
+++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
@@ -724,7 +724,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
 	`type` varchar(30) default 'simple_graph',
 	`period` int(11) NOT NULL default 0,
 	`order` int (11) NOT NULL default 0,
-	`description` mediumtext, 
+	`description` mediumtext,
 	`text_agent` text,
 	`text` TEXT,
 	`external_source` Text,
@@ -796,6 +796,8 @@ ALTER TABLE `treport_content_template` ADD COLUMN `unknown_checks` TINYINT(1) DE
 ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
 ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
 ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
+ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
+ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
 
 -- -----------------------------------------------------
 -- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
@@ -1007,10 +1009,12 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
 	`agent_version` varchar(100) default '',
 	`ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00',
 	`disabled` tinyint(2) NOT NULL default '0',
+	`remote` tinyint(1) NOT NULL default '0',
 	`id_parent` int(10) unsigned default '0',
 	`custom_id` varchar(255) default '',
 	`server_name` varchar(100) default '',
 	`cascade_protection` tinyint(2) NOT NULL default '0',
+	`cascade_protection_module` int(10) unsigned default '0',
 	`timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'number of hours of diference with the server timezone' ,
 	`icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' ,
 	`update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' ,
@@ -1025,19 +1029,21 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
 	`fired_count` bigint(20) NOT NULL default '0',
 	`update_module_count` tinyint(1) NOT NULL default '0',
 	`update_alert_count` tinyint(1) NOT NULL default '0',
+	`update_secondary_groups` tinyint(1) NOT NULL default '0',
+	`transactional_agent` tinyint(1) NOT NULL default '0',
+	`alias` varchar(600) BINARY NOT NULL default '',
+	`alias_as_name` tinyint(2) NOT NULL default '0',
+	`safe_mode_module` int(10) unsigned NOT NULL default '0',
+	`cps` int NOT NULL default 0,
 	PRIMARY KEY  (`id_agente`),
 	KEY `nombre` (`nombre`(255)),
 	KEY `direccion` (`direccion`),
+	KEY `id_tagente_idx` (`id_tagente`),
 	KEY `disabled` (`disabled`),
 	KEY `id_grupo` (`id_grupo`),
 	FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE
 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
 
-ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0';
-ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0';
-ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
-ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
-
 -- ---------------------------------------------------------------------
 -- Table `ttransaction`
 -- ---------------------------------------------------------------------
@@ -1219,6 +1225,8 @@ ALTER TABLE `talert_commands` ADD COLUMN `fields_hidden` text;
 
 UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1;
 
+DELETE FROM `talert_commands` WHERE `id` = 11;
+
 -- ---------------------------------------------------------------------
 -- Table `tmap`
 -- ---------------------------------------------------------------------
@@ -1235,14 +1243,19 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
 INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
 INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
 INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
-INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 28);
+INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 31);
 INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
 INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
 INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
 UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
 DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
-INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '735');
+INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '737');
 INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
+UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
+DELETE FROM `tconfig` WHERE `token` LIKE 'integria_enabled';
+DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
+DELETE FROM `tconfig` WHERE `token` LIKE 'integria_inventory';
+DELETE FROM `tconfig` WHERE `token` LIKE 'integria_url';
 
 -- ---------------------------------------------------------------------
 -- Table `tconfig_os`
@@ -1438,11 +1451,15 @@ ALTER TABLE `treport_content` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1'
 ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
 ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
 ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
+ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
+ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
+ALTER table `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
 
 -- ---------------------------------------------------------------------
 -- Table `tmodule_relationship`
 -- ---------------------------------------------------------------------
 ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT '';
+ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover') DEFAULT 'direct';
 
 -- ---------------------------------------------------------------------
 -- Table `tpolicy_module`
@@ -2192,3 +2209,62 @@ CREATE TABLE `tvisual_console_elements_cache` (
         ON UPDATE CASCADE
 ) engine=InnoDB DEFAULT CHARSET=utf8;
 
+-- ---------------------------------------------------------------------
+-- Table `tcredential_store`
+-- ---------------------------------------------------------------------
+CREATE TABLE IF NOT EXISTS `tcredential_store` (
+	`identifier` varchar(100) NOT NULL,
+	`id_group` mediumint(4) unsigned NOT NULL DEFAULT 0,
+	`product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE') default 'CUSTOM',
+	`username` text,
+	`password` text,
+	`extra_1` text,
+	`extra_2` text,
+	PRIMARY KEY (`identifier`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ---------------------------------------------------------------------
+-- Table `treport_content_sla_combined`
+-- ---------------------------------------------------------------------
+ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL;
+
+-- ---------------------------------------------------------------------
+-- Table `tagent_repository`
+-- ---------------------------------------------------------------------
+CREATE TABLE `tagent_repository` (
+  `id` SERIAL,
+  `id_os` INT(10) UNSIGNED DEFAULT 0,
+  `arch` ENUM('x64', 'x86') DEFAULT 'x64',
+  `version` VARCHAR(10) DEFAULT '',
+  `path` text,
+  `uploaded_by` VARCHAR(100) DEFAULT '',
+  `uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
+  `last_err` text,
+  PRIMARY KEY (`id`),
+  FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
+    ON UPDATE CASCADE ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------------------------------------------------
+-- Table `tdeployment_hosts`
+-- ----------------------------------------------------------------------
+CREATE TABLE `tdeployment_hosts` (
+  `id` SERIAL,
+  `id_cs` VARCHAR(100),
+  `ip` VARCHAR(100) NOT NULL UNIQUE,
+  `id_os` INT(10) UNSIGNED DEFAULT 0,
+  `os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
+  `arch` ENUM('x64', 'x86') DEFAULT 'x64',
+  `current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
+  `target_agent_version_id` BIGINT UNSIGNED,
+  `deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
+  `server_ip` varchar(100) default NULL COMMENT "Where to point target agent",
+  `last_err` text,
+  PRIMARY KEY (`id`),
+  FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
+    ON UPDATE CASCADE ON DELETE SET NULL,
+  FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
+    ON UPDATE CASCADE ON DELETE CASCADE,
+  FOREIGN KEY (`target_agent_version_id`) REFERENCES  `tagent_repository`(`id`)
+    ON UPDATE CASCADE ON DELETE SET NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/pandora_console/general/firts_task/recon_view.php b/pandora_console/general/firts_task/recon_view.php
index 282a6b75be..8c59b23f64 100755
--- a/pandora_console/general/firts_task/recon_view.php
+++ b/pandora_console/general/firts_task/recon_view.php
@@ -35,6 +35,7 @@ ui_require_css_file('firts_task');
         </p>
         <form action="index.php?sec=gservers&sec2=godmode/servers/discovery" method="post">
             <input type="submit" class="button_task" value="<?php echo __('Discover'); ?>" />
+            <input type="hidden" name="discovery_hint" value="1"/>
         </form>
     </div>
 </div>
diff --git a/pandora_console/general/footer.php b/pandora_console/general/footer.php
index b35123b5d3..dcc894989b 100644
--- a/pandora_console/general/footer.php
+++ b/pandora_console/general/footer.php
@@ -20,6 +20,8 @@ if (isset($_SERVER['REQUEST_TIME'])) {
     $time = get_system_time();
 }
 
+ui_require_css_file('footer');
+
 $license_file = 'general/license/pandora_info_'.$config['language'].'.html';
 if (! file_exists($config['homedir'].$license_file)) {
     $license_file = 'general/license/pandora_info_en.html';
@@ -41,9 +43,17 @@ if ($current_package == 0) {
     $build_package_version = $current_package;
 }
 
-echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config['MR']));
+echo __(
+    '%s %s - Build %s - MR %s',
+    get_product_name(),
+    $pandora_version,
+    $build_package_version,
+    $config['MR']
+);
+echo '</a><br />';
+echo '<small><span>'.__('Page generated on %s', date('Y-m-d H:i:s')).'</span></small>';
+
 
-echo '</a> ';
 
 if (isset($config['debug'])) {
     $cache_info = [];
diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php
index a093596b2b..99bb38cc21 100644
--- a/pandora_console/general/header.php
+++ b/pandora_console/general/header.php
@@ -670,21 +670,49 @@ if ($config['menu_type'] == 'classic') {
 
         <?php
         if ($_GET['refr'] || $do_refresh === true) {
+            if ($_GET['sec2'] == 'operation/events/events') {
+                $autorefresh_draw = true;
+            }
             ?>
+
+            var autorefresh_draw = '<?php echo $autorefresh_draw; ?>';
             $("#header_autorefresh").css('padding-right', '5px');
-            var refr_time = <?php echo (int) get_parameter('refr', $config['refr']); ?>;
-            var t = new Date();
-            t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
-            $("#refrcounter").countdown ({
-                until: t, 
-                layout: '%M%nn%M:%S%nn%S',
-                labels: ['', '', '', '', '', '', ''],
-                onExpiry: function () {
+            if(autorefresh_draw == true) { 
+                var refresh_interval = parseInt('<?php echo ($config['refr'] * 1000); ?>');
+                var until_time='';
+
+                function events_refresh() {
+                    until_time = new Date();
+                    until_time.setTime (until_time.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
+
+                    $("#refrcounter").countdown ({
+                        until: until_time, 
+                        layout: '%M%nn%M:%S%nn%S',
+                        labels: ['', '', '', '', '', '', ''],
+                        onExpiry: function () {
+                            dt_events.draw(false);
+                        }
+                    });
+                }
+                // Start the countdown when page is loaded (first time).
+                events_refresh();
+                // Repeat countdown according to refresh_interval.
+                setInterval(events_refresh, refresh_interval);
+            } else {
+                var refr_time = <?php echo (int) get_parameter('refr', $config['refr']); ?>;
+                var t = new Date();
+                t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>)); 
+                $("#refrcounter").countdown ({
+                    until: t, 
+                    layout: '%M%nn%M:%S%nn%S',
+                    labels: ['', '', '', '', '', '', ''],
+                    onExpiry: function () {
                         href = $("a.autorefresh").attr ("href");
                         href = href + refr_time;
                         $(document).attr ("location", href);
                     }
                 });
+            }
             <?php
         }
         ?>
@@ -694,8 +722,38 @@ if ($config['menu_type'] == 'classic') {
             $("#combo_refr").toggle ();
             $("select#ref").change (function () {
                 href = $("a.autorefresh").attr ("href");
-                $(document).attr ("location", href + this.value);
-            });
+            
+                if(autorefresh_draw == true){
+                    inputs = $("#events_form :input");
+                    values = {};
+                    inputs.each(function() {
+                        values[this.name] = $(this).val();
+                    })
+
+                    var newValue = btoa(JSON.stringify(values));           
+                    <?php
+                    // Check if the url has the parameter fb64.
+                    if ($_GET['fb64']) {
+                        $fb64 = $_GET['fb64'];
+                        ?>
+                            var fb64 = '<?php echo $fb64; ?>';  
+                            // Check if the filters have changed.
+                            if(fb64 !== newValue){
+                                href = href.replace(fb64, newValue);
+                            } 
+
+                            $(document).attr("location", href+ '&refr=' + this.value);
+                        <?php
+                    } else {
+                        ?>
+                            $(document).attr("location", href+'&fb64=' + newValue + '&refr=' + this.value);
+                        <?php
+                    }
+                    ?>
+                } else {
+                    $(document).attr ("location", href + this.value);
+                }
+        });
             
             return false;
         });
diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php
index 86dccfa53a..5aecfcc92c 100755
--- a/pandora_console/general/login_page.php
+++ b/pandora_console/general/login_page.php
@@ -19,8 +19,8 @@ if (isset($config['homedir'])) {
 
 ui_require_css_file('login');
 
-require_once $homedir.'include/functions_ui.php';
-require_once $homedir.'include/functions.php';
+require_once __DIR__.'/../include/functions_ui.php';
+require_once __DIR__.'/../include/functions.php';
 require_once __DIR__.'/../include/functions_html.php';
 
 
@@ -376,6 +376,9 @@ if (isset($correct_reset_pass_process)) {
 }
 
 if (isset($login_failed)) {
+    $nick = get_parameter_post('nick');
+    $fails = db_get_value('failed_attempt', 'tusuario', 'id_user', $nick);
+    $attemps = ($config['number_attempts'] - $fails);
     echo '<div id="login_failed" title="'.__('Login failed').'">';
         echo '<div class="content_alert">';
             echo '<div class="icon_message_alert">';
@@ -386,6 +389,12 @@ if (isset($login_failed)) {
                     echo '<h1>'.__('ERROR').'</h1>';
                     echo '<p>'.$config['auth_error'].'</p>';
                 echo '</div>';
+    if ($config['enable_pass_policy']) {
+        echo '<div class="text_message_alert">';
+            echo '<p><strong>Remaining attempts: '.$attemps.'</strong></p>';
+        echo '</div>';
+    }
+
                 echo '<div class="button_message_alert">';
                     html_print_submit_button('Ok', 'hide-login-error', false);
                 echo '</div>';
@@ -518,6 +527,7 @@ if ($login_screen == 'error_authconfig' || $login_screen == 'error_emptyconfig'
 ui_require_css_file('dialog');
 ui_require_css_file('jquery-ui.min', 'include/styles/js/');
 ui_require_jquery_file('jquery-ui.min');
+ui_require_jquery_file('jquery-ui_custom');
 ?>
 
 <?php
@@ -679,5 +689,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
             $("#final_process_correct").dialog('close');
         });        
     });
+
     /* ]]> */
 </script>
diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php
index 649a2d2f68..cdbc09c9f9 100644
--- a/pandora_console/general/logon_ok.php
+++ b/pandora_console/general/logon_ok.php
@@ -103,199 +103,205 @@ if (!empty($all_data)) {
     $data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1);
 }
 
+ui_require_css_file('logon');
 
-?>
-<table border="0" width="100%" cellspacing="0" cellpadding="0">
-    <tr>
-        
-        <td width="25%" style="padding-right: 20px;" valign="top">
-            
-            
-            <?php
-            //
-            // Overview Table.
-            //
-            $table = new stdClass();
-            $table->class = 'databox';
-            $table->cellpadding = 4;
-            $table->cellspacing = 4;
-            $table->head = [];
-            $table->data = [];
-            $table->headstyle[0] = 'text-align:center;';
-            $table->width = '100%';
-            $table->head[0] = '<span>'.__('%s Overview', get_product_name()).'</span>';
-            $table->head_colspan[0] = 4;
+echo '<div id="welcome_panel">';
 
-            // Indicators.
-            $tdata = [];
-            $stats = reporting_get_stats_indicators($data, 120, 10, false);
-            $status = '<table class="status_tactical">';
-            foreach ($stats as $stat) {
-                $status .= '<tr><td><b>'.$stat['title'].'</b></td><td>'.$stat['graph'].'</td></tr>';
-            }
+//
+// Overview Table.
+//
+$table = new stdClass();
+$table->class = 'no-class';
+$table->cellpadding = 4;
+$table->cellspacing = 4;
+$table->head = [];
+$table->data = [];
+$table->headstyle[0] = 'text-align:center;';
+$table->width = '100%';
+$table->head_colspan[0] = 4;
 
-            $status .= '</table>';
-            $table->data[0][0] = $status;
-            $table->rowclass[] = '';
+// Indicators.
+$tdata = [];
+$stats = reporting_get_stats_indicators($data, 120, 10, false);
+$status = '<table class="status_tactical">';
+foreach ($stats as $stat) {
+    $status .= '<tr><td><b>'.$stat['title'].'</b></td><td>'.$stat['graph'].'</td></tr>';
+}
 
-            $table->data[] = $tdata;
+$status .= '</table>';
+$table->data[0][0] = $status;
+$table->rowclass[] = '';
 
-            // Alerts.
-            $tdata = [];
-            $tdata[0] = reporting_get_stats_alerts($data);
-            $table->rowclass[] = '';
-            $table->data[] = $tdata;
+$table->data[] = $tdata;
 
-            // Modules by status.
-            $tdata = [];
-            $tdata[0] = reporting_get_stats_modules_status($data, 180, 100);
-            $table->rowclass[] = '';
-            $table->data[] = $tdata;
+// Alerts.
+$tdata = [];
+$tdata[0] = reporting_get_stats_alerts($data);
+$table->rowclass[] = '';
+$table->data[] = $tdata;
 
-            // Total agents and modules.
-            $tdata = [];
-            $tdata[0] = reporting_get_stats_agents_monitors($data);
-            $table->rowclass[] = '';
-            $table->data[] = $tdata;
+// Modules by status.
+$tdata = [];
+$tdata[0] = reporting_get_stats_modules_status($data, 180, 100);
+$table->rowclass[] = '';
+$table->data[] = $tdata;
 
-            // Users.
-            if (users_is_admin()) {
-                $tdata = [];
-                $tdata[0] = reporting_get_stats_users($data);
-                $table->rowclass[] = '';
-                $table->data[] = $tdata;
-            }
+// Total agents and modules.
+$tdata = [];
+$tdata[0] = reporting_get_stats_agents_monitors($data);
+$table->rowclass[] = '';
+$table->data[] = $tdata;
 
-            html_print_table($table);
-            unset($table);
-            ?>
-            
-            
-        </td>
-        
-        <td width="75%" valign="top">
-            
-            
-            <?php
-            $options = [];
-            $options['id_user'] = $config['id_user'];
-            $options['modal'] = false;
-            $options['limit'] = 3;
-            $news = get_news($options);
+// Users.
+if (users_is_admin()) {
+    $tdata = [];
+    $tdata[0] = reporting_get_stats_users($data);
+    $table->rowclass[] = '';
+    $table->data[] = $tdata;
+}
+
+ui_toggle(
+    html_print_table($table, true),
+    __('%s Overview', get_product_name()),
+    '',
+    'overview',
+    false
+);
+unset($table);
+
+echo '<div id="right">';
+
+// News.
+require_once 'general/news_dialog.php';
+$options = [];
+$options['id_user'] = $config['id_user'];
+$options['modal'] = false;
+$options['limit'] = 3;
+$news = get_news($options);
 
 
-            if (!empty($news)) {
-                // NEWS BOARD.
-                echo '<div id="news_board">';
-
-                echo '<table cellpadding="0" width=100% cellspacing="0" class="databox filters">';
-                echo '<tr><th style="text-align:center;"><span >'.__('News board').'</span></th></tr>';
-                if ($config['prominent_time'] == 'timestamp') {
-                    $comparation_suffix = '';
-                } else {
-                    $comparation_suffix = __('ago');
-                }
-
-                foreach ($news as $article) {
-                    $image = false;
-                    if ($article['text'] == '&amp;lt;p&#x20;style=&quot;text-align:&#x20;center;&#x20;font-size:&#x20;13px;&quot;&amp;gt;Hello,&#x20;congratulations,&#x20;if&#x20;you&apos;ve&#x20;arrived&#x20;here&#x20;you&#x20;already&#x20;have&#x20;an&#x20;operational&#x20;monitoring&#x20;console.&#x20;Remember&#x20;that&#x20;our&#x20;forums&#x20;and&#x20;online&#x20;documentation&#x20;are&#x20;available&#x20;24x7&#x20;to&#x20;get&#x20;you&#x20;out&#x20;of&#x20;any&#x20;trouble.&#x20;You&#x20;can&#x20;replace&#x20;this&#x20;message&#x20;with&#x20;a&#x20;personalized&#x20;one&#x20;at&#x20;Admin&#x20;tools&#x20;-&amp;amp;gt;&#x20;Site&#x20;news.&amp;lt;/p&amp;gt;&#x20;') {
-                        $image = true;
-                    }
-
-                    $text_bbdd = io_safe_output($article['text']);
-                    $text = html_entity_decode($text_bbdd);
-                    echo '<tr><th class="green_title">'.$article['subject'].'</th></tr>';
-                    echo '<tr><td>'.__('by').' <b>'.$article['author'].'</b> <i>'.ui_print_timestamp($article['timestamp'], true).'</i> '.$comparation_suffix.'</td></tr>';
-                    echo '<tr><td class="datos">';
-                    if ($image) {
-                        echo '<center><img src="./images/welcome_image.png" alt="img colabora con nosotros - Support" width="191" height="207"></center>';
-                    }
-
-                    echo nl2br($text);
-                    echo '</td></tr>';
-                }
-
-                echo '</table>';
-                echo '</div>';
-                // News board.
-                echo '<br><br>';
-
-                // END OF NEWS BOARD.
-            }
-
-            // LAST ACTIVITY.
-            // Show last activity from this user.
-            echo '<div id="activity">';
-
-            $table = new stdClass();
-            $table->class = 'info_table';
-            $table->cellpadding = 0;
-            $table->cellspacing = 0;
-            $table->width = '100%';
-            // Don't specify px.
-            $table->data = [];
-            $table->size = [];
-            $table->size[0] = '5%';
-            $table->size[1] = '15%';
-            $table->size[2] = '15%';
-            $table->size[3] = '10%';
-            $table->size[4] = '25%';
-            $table->head = [];
-            $table->head[0] = __('User');
-            $table->head[1] = __('Action');
-            $table->head[2] = __('Date');
-            $table->head[3] = __('Source IP');
-            $table->head[4] = __('Comments');
-            $table->title = '<span>'.__('This is your last activity performed on the %s console', get_product_name()).'</span>';
-            $sql = sprintf(
-                'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
-						FROM tsesion
-						WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.") 
-							AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10",
-                $config['id_user']
-            );
+if (!empty($news)) {
+    ui_require_css_file('news');
+    // NEWS BOARD.
+    if ($config['prominent_time'] == 'timestamp') {
+        $comparation_suffix = '';
+    } else {
+        $comparation_suffix = __('ago');
+    }
 
 
-            $sessions = db_get_all_rows_sql($sql);
+    $output_news = '<div id="news_board" class="new">';
+    foreach ($news as $article) {
+        $image = false;
+        if ($article['text'] == '&amp;lt;p&#x20;style=&quot;text-align:&#x20;center;&#x20;font-size:&#x20;13px;&quot;&amp;gt;Hello,&#x20;congratulations,&#x20;if&#x20;you&apos;ve&#x20;arrived&#x20;here&#x20;you&#x20;already&#x20;have&#x20;an&#x20;operational&#x20;monitoring&#x20;console.&#x20;Remember&#x20;that&#x20;our&#x20;forums&#x20;and&#x20;online&#x20;documentation&#x20;are&#x20;available&#x20;24x7&#x20;to&#x20;get&#x20;you&#x20;out&#x20;of&#x20;any&#x20;trouble.&#x20;You&#x20;can&#x20;replace&#x20;this&#x20;message&#x20;with&#x20;a&#x20;personalized&#x20;one&#x20;at&#x20;Admin&#x20;tools&#x20;-&amp;amp;gt;&#x20;Site&#x20;news.&amp;lt;/p&amp;gt;&#x20;') {
+            $image = true;
+        }
 
-            if ($sessions === false) {
-                $sessions = [];
-            }
+        $text_bbdd = io_safe_output($article['text']);
+        $text = html_entity_decode($text_bbdd);
+        $output_news .= '<span class="green_title">'.$article['subject'].'</span>';
+        $output_news .= '<div class="new content">';
+        $output_news .= '<p>'.__('by').' <b>'.$article['author'].'</b> <i>'.ui_print_timestamp($article['timestamp'], true).'</i> '.$comparation_suffix.'</p>';
+        if ($image) {
+            $output_news .= '<center><img src="./images/welcome_image.png" alt="img colabora con nosotros - Support" width="191" height="207"></center>';
+        }
 
-            foreach ($sessions as $session) {
-                $data = [];
-                $session_id_usuario = $session['id_usuario'];
-                $session_ip_origen = $session['ip_origen'];
+        $output_news .= nl2br($text);
+        $output_news .= '</div>';
+    }
+
+    $output_news .= '</div>';
+
+    // News board.
+    ui_toggle(
+        $output_news,
+        __('News board'),
+        '',
+        'news',
+        false
+    );
+    // END OF NEWS BOARD.
+}
+
+// LAST ACTIVITY.
+// Show last activity from this user.
+$table = new stdClass();
+$table->class = 'no-td-padding info_table';
+$table->cellpadding = 0;
+$table->cellspacing = 0;
+$table->width = '100%';
+// Don't specify px.
+$table->data = [];
+$table->size = [];
+$table->headstyle = [];
+$table->size[0] = '5%';
+$table->size[1] = '15%';
+$table->headstyle[1] = 'min-width: 12em;';
+$table->size[2] = '5%';
+$table->headstyle[2] = 'min-width: 65px;';
+$table->size[3] = '10%';
+$table->size[4] = '25%';
+$table->head = [];
+$table->head[0] = __('User');
+$table->head[1] = __('Action');
+$table->head[2] = __('Date');
+$table->head[3] = __('Source IP');
+$table->head[4] = __('Comments');
+$table->align[4] = 'left';
+$sql = sprintf(
+    'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
+            FROM tsesion
+            WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.") 
+                AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10",
+    $config['id_user']
+);
 
 
+$sessions = db_get_all_rows_sql($sql);
 
-                $data[0] = '<strong>'.$session_id_usuario.'</strong>';
-                $data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion'];
-                $data[2] = ui_print_help_tip(
-                    date($config['date_format'], $session['utimestamp']),
-                    true
-                ).human_time_comparation($session['utimestamp'], 'tiny');
-                $data[3] = $session_ip_origen;
-                $description = str_replace([',', ', '], ', ', $session['descripcion']);
-                if (strlen($description) > 100) {
-                    $data[4] = '<div >'.io_safe_output(substr($description, 0, 150).'...').'</div>';
-                } else {
-                    $data[4] = '<div >'.io_safe_output($description).'</div>';
-                }
+if ($sessions === false) {
+    $sessions = [];
+}
 
-                array_push($table->data, $data);
-            }
+foreach ($sessions as $session) {
+    $data = [];
+    $session_id_usuario = $session['id_usuario'];
+    $session_ip_origen = $session['ip_origen'];
 
-            echo "<div style='width:100%; overflow-x:auto;'>";
-            html_print_table($table);
-            unset($table);
-            echo '</div>';
-            echo '</div>';
-            // END OF LAST ACTIVIYY.
-            ?>
-            
-            
-        </td>
-        
-    </tr>
-</table>
+
+    $data[0] = '<strong>'.$session_id_usuario.'</strong>';
+    $data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion'];
+    $data[2] = ui_print_help_tip(
+        date($config['date_format'], $session['utimestamp']),
+        true
+    ).human_time_comparation($session['utimestamp'], 'tiny');
+    $data[3] = $session_ip_origen;
+    $description = str_replace([',', ', '], ', ', $session['descripcion']);
+    if (strlen($description) > 100) {
+        $data[4] = '<div >'.io_safe_output(substr($description, 0, 150).'...').'</div>';
+    } else {
+        $data[4] = '<div >'.io_safe_output($description).'</div>';
+    }
+
+    array_push($table->data, $data);
+}
+
+$activity .= html_print_table($table, true);
+unset($table);
+
+ui_toggle(
+    $activity,
+    __('Latest activity'),
+    '',
+    'activity',
+    false,
+    false,
+    '',
+    'white-box-content padded'
+);
+// END OF LAST ACTIVIYY.
+// Close right panel.
+echo '</div>';
+
+// Close welcome panel.
+echo '</div>';
diff --git a/pandora_console/general/main_menu.php b/pandora_console/general/main_menu.php
index 877f171090..ca6c0fd473 100644
--- a/pandora_console/general/main_menu.php
+++ b/pandora_console/general/main_menu.php
@@ -30,12 +30,6 @@ $(document).ready(function(){
     }
 });
 
-
-// Set the height of the menu.
-$(window).on('load', function (){   
-    $("#menu_full").height($("#container").height());
-});
-
 </script>
 <?php
 $autohidden_menu = 0;
diff --git a/pandora_console/general/noaccesssaml.php b/pandora_console/general/noaccesssaml.php
new file mode 100644
index 0000000000..e357e040dc
--- /dev/null
+++ b/pandora_console/general/noaccesssaml.php
@@ -0,0 +1,164 @@
+<html>
+<head>
+    
+<style>
+
+#alert_messages_na{
+    z-index:2;
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    transform: translate(-50%, -50%);
+    -webkit-transform: translate(-50%, -50%);   
+    width:650px;
+    height: 400px;
+    background:white;
+    background-image:url('images/imagen-no-acceso.jpg');
+    background-repeat:no-repeat;
+    justify-content: center;
+    display: flex;
+    flex-direction: column;
+    box-shadow:4px 5px 10px 3px rgba(0, 0, 0, 0.4);
+}
+
+.modalheade{
+    text-align:center;
+    width:100%;
+    position:absolute;
+    top:0;
+}
+.modalheadertex{
+    color:#000;
+    font-family:Nunito;
+    line-height: 40px;
+    font-size: 23pt;
+    margin-bottom:30px;
+}
+.modalclose{
+    cursor:pointer;
+    display:inline;
+    float:right;
+    margin-right:10px;
+    margin-top:10px;
+}
+.modalconten{
+    color:black;
+    width:300px;
+    margin-left: 30px;
+}
+.modalcontenttex{
+    text-align:left;
+    color:black;
+    font-size: 11pt;
+    line-height:13pt;
+    margin-bottom:30px;
+}
+.modalokbutto{
+    cursor:pointer;
+    text-align:center;
+    display: inline-block;
+    padding: 6px 45px;
+    -moz-border-radius: 3px;
+    -webkit-border-radius: 3px;
+    border-radius: 3px;
+    background-color:white;
+    border: 1px solid #82b92e;
+}
+.modalokbuttontex{
+    color:#82b92e;
+    font-family:Nunito;
+    font-size:13pt;
+}
+.modalgobutto{
+    cursor:pointer;
+    text-align:center;
+    -moz-border-radius: 3px;
+    -webkit-border-radius: 3px;
+    border-radius: 3px;
+    background-color:white;
+    border: 1px solid #82b92e;
+}
+.modalgobuttontex{
+color:#82b92e;
+font-family:Nunito;
+font-size:10pt;
+}
+
+
+#opacidad{
+    position:fixed;
+    background:black;
+    opacity:0.6;
+    z-index:-1;
+    left:0px;
+    top:0px;
+    width:100%;
+    height:100%;
+}
+/*
+.textodialog{
+    margin-left: 0px;
+    color:#333;
+    padding:20px;
+    font-size:9pt;
+}
+
+.cargatextodialog{
+    max-width:58.5%;
+    width:58.5%;
+    min-width:58.5%;
+    float:left;
+    margin-left: 0px;
+    font-size:18pt;
+    padding:20px;
+    text-align:center;
+}
+
+.cargatextodialog p, .cargatextodialog b, .cargatextodialog a{
+    font-size:18pt; 
+}
+*/
+</style>
+</head>
+<body>
+    
+    <div id="alert_messages_na">
+        
+        <div class='modalheade'>
+            <img class='modalclose cerrar' src='<?php echo $config['homeurl']; ?>images/input_cross.png'>  
+        </div>
+
+        <div class='modalconten'>
+            <div class='modalheadertex'>
+                <?php echo __("You don't have access to this page"); ?>
+            </div>
+
+            <div class='modalcontenttex'>
+                <?php
+                echo __('Access to this page is restricted to authorized users SAML only, please contact system administrator if you need assistance.');
+                    echo '<br/> <br/>';
+                    echo __('Please make sure you have SAML authentication properly configured. For more information the error to access this page are recorded in security logs of %s System Database', get_product_name());
+                ?>
+                      
+            </div>
+
+            <div class='modalokbutto cerrar'>
+                <span class='modalokbuttontex'>OK</span>
+            </div>
+        </div>
+    </div>
+        
+    <div id="opacidad"></div>
+    
+</body>
+</html>
+
+<script>
+
+    $(".cerrar").click(function(){
+    window.location=".";
+    });
+
+    $('div#page').css('background-color','#d3d3d3');
+
+</script>
diff --git a/pandora_console/general/register.php b/pandora_console/general/register.php
index e6a26bb250..b1d58aada4 100644
--- a/pandora_console/general/register.php
+++ b/pandora_console/general/register.php
@@ -122,7 +122,6 @@ if (is_ajax()) {
     exit();
 }
 
-
 ui_require_css_file('register');
 
 $initial = isset($config['initial_wizard']) !== true
@@ -150,26 +149,27 @@ if ($initial && users_is_admin()) {
     );
 }
 
-if ($registration && users_is_admin()) {
-    // Prepare registration wizard, not launch. leave control to flow.
-    registration_wiz_modal(
-        false,
-        // Launch only if not being launch from 'initial'.
-        !$initial,
-        (($show_newsletter === true) ? 'force_run_newsletter()' : null)
-    );
-} else {
-    if ($show_newsletter) {
-        // Show newsletter wizard for current user.
-        newsletter_wiz_modal(
+if (!$config['disabled_newsletter']) {
+    if ($registration && users_is_admin()) {
+        // Prepare registration wizard, not launch. leave control to flow.
+        registration_wiz_modal(
             false,
-            // Launch only if not being call from 'registration'.
-            !$registration && !$initial
+            // Launch only if not being launch from 'initial'.
+            !$initial,
+            (($show_newsletter === true) ? 'force_run_newsletter()' : null)
         );
+    } else {
+        if ($show_newsletter) {
+            // Show newsletter wizard for current user.
+            newsletter_wiz_modal(
+                false,
+                // Launch only if not being call from 'registration'.
+                !$registration && !$initial
+            );
+        }
     }
 }
 
-
 $newsletter = null;
 
 ?>
diff --git a/pandora_console/godmode/admin_access_logs.php b/pandora_console/godmode/admin_access_logs.php
index 67a933d8cb..112a45754f 100644
--- a/pandora_console/godmode/admin_access_logs.php
+++ b/pandora_console/godmode/admin_access_logs.php
@@ -94,7 +94,7 @@ $table->data[1] = $data;
 $form = '<form name="query_sel" method="post" action="index.php?sec=glog&sec2=godmode/admin_access_logs">';
 $form .= html_print_table($table, true);
 $form .= '</form>';
-ui_toggle($form, __('Filter'), '', false);
+ui_toggle($form, __('Filter'), '', '', false);
 
 $filter = '1=1';
 
diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php
index dfdd7390c3..6ee2343fc0 100644
--- a/pandora_console/godmode/agentes/agent_manager.php
+++ b/pandora_console/godmode/agentes/agent_manager.php
@@ -77,6 +77,7 @@ if (is_ajax()) {
     }
 
     $get_modules_json_for_multiple_snmp = (bool) get_parameter('get_modules_json_for_multiple_snmp', 0);
+    $get_common_modules = (bool) get_parameter('get_common_modules', 1);
     if ($get_modules_json_for_multiple_snmp) {
         include_once 'include/graphs/functions_utils.php';
 
@@ -100,7 +101,16 @@ if (is_ajax()) {
             if ($out === false) {
                 $out = $oid_snmp;
             } else {
-                $out = array_intersect($out, $oid_snmp);
+                $commons = array_intersect($out, $oid_snmp);
+                if ($get_common_modules) {
+                    // Common modules is selected (default)
+                    $out = $commons;
+                } else {
+                    // All modules is selected
+                    $array1 = array_diff($out, $oid_snmp);
+                    $array2 = array_diff($oid_snmp, $out);
+                    $out = array_merge($commons, $array1, $array2);
+                }
             }
 
             $oid_snmp = [];
@@ -176,7 +186,7 @@ if ($disk_conf_delete) {
     @unlink($filename['conf']);
 }
 
-echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
+echo '<form autocomplete="new-password" name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
 
 // Custom ID.
 $custom_id_div = '<div class="label_select">';
@@ -201,7 +211,7 @@ if (!$new_agent && $alias != '') {
     $table_agent_name .= '<div class="label_select_child_right agent_options_agent_name" style="width: 40%;">';
 
     if ($id_agente) {
-        $table_agent_name .= '<label>'.__('ID').'</label><input style="width: 50%;" type="text" disabled="true" value="'.$id_agente.'" />';
+        $table_agent_name .= '<label>'.__('ID').'</label><input style="width: 50%;" type="text" readonly value="'.$id_agente.'" />';
         $table_agent_name .= '<a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
         $table_agent_name .= html_print_image(
             'images/zoom.png',
@@ -245,7 +255,7 @@ if (!$new_agent && $alias != '') {
     $table_agent_name .= '</div></div></div>';
 
     // QR code div.
-    $table_qr_code = '<div class="agent_qr white_box">';
+    $table_qr_code = '<div class="box-shadow agent_qr white_box">';
     $table_qr_code .= '<p class="input_label">'.__('QR Code Agent view').': </p>';
     $table_qr_code .= '<div id="qr_container_image"></div>';
     if ($id_agente) {
@@ -372,13 +382,13 @@ $table_server = '<div class="label_select"><p class="input_label">'.__('Server')
 $table_server .= '<div class="label_select_parent">';
 if ($new_agent) {
     // Set first server by default.
-    $servers_get_names = servers_get_names();
+    $servers_get_names = $servers;
     $array_keys_servers_get_names = array_keys($servers_get_names);
     $server_name = reset($array_keys_servers_get_names);
 }
 
 $table_server .= html_print_select(
-    servers_get_names(),
+    $servers,
     'server_name',
     $server_name,
     '',
@@ -401,7 +411,7 @@ $table_description .= html_print_textarea(
 
 // QR code.
 echo '<div class="first_row">
-        <div class="agent_options '.$agent_options_update.' white_box">
+        <div class="box-shadow agent_options '.$agent_options_update.' white_box">
             <div class="agent_options_column_left">'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'</div>
             <div class="agent_options_column_right">'.$table_interval.$table_os.$table_server.$table_description.'</div>
         </div>';
@@ -413,8 +423,8 @@ echo '</div>';
 
 if (enterprise_installed()) {
     $secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
-    $table_adv_secondary_groups = '<div class="label_select"><p class="input_label">'.__('Secondary groups').': </p></div>';
-    $table_adv_secondary_groups_left = html_print_select_groups(
+    $adv_secondary_groups_label = '<div class="label_select"><p class="input_label">'.__('Secondary groups').': </p></div>';
+    $adv_secondary_groups_left = html_print_select_groups(
         false,
         // Use the current user to select the groups.
         'AR',
@@ -441,7 +451,7 @@ if (enterprise_installed()) {
         // CSS classnames (default).
         false,
         // Not disabled (default).
-        'width:50%; min-width:170px;',
+        'min-width:170px;',
         // Inline styles (default).
         false,
         // Option style select (default).
@@ -455,7 +465,7 @@ if (enterprise_installed()) {
         // Do not show the primary group in this selection.
     );
 
-    $table_adv_secondary_groups_arrows = html_print_input_image(
+    $adv_secondary_groups_arrows = html_print_input_image(
         'add_secondary',
         'images/darrowright_green.png',
         1,
@@ -479,7 +489,7 @@ if (enterprise_installed()) {
         ]
     );
 
-    $table_adv_secondary_groups_right .= html_print_select(
+    $adv_secondary_groups_right .= html_print_select(
         $secondary_groups_selected['for_select'],
         // Values.
         'secondary_groups_selected',
@@ -502,7 +512,7 @@ if (enterprise_installed()) {
         // Class.
         false,
         // Disabled.
-        'width:50%; min-width:170px;'
+        'min-width:170px;'
         // Style.
     );
 
@@ -514,8 +524,10 @@ if (enterprise_installed()) {
         );
         $safe_mode_modules = [];
         $safe_mode_modules[0] = __('Any');
-        foreach ($sql_modules as $m) {
-            $safe_mode_modules[$m['id_module']] = $m['name'];
+        if (is_array($sql_modules)) {
+            foreach ($sql_modules as $m) {
+                $safe_mode_modules[$m['id_module']] = $m['name'];
+            }
         }
 
         $table_adv_safe = '<div class="label_select_simple label_simple_items"><p class="input_label input_label_simple">'.__('Safe operation mode').': '.ui_print_help_tip(
@@ -579,7 +591,7 @@ if (enterprise_installed()) {
 }
 
 
-$table_adv_parent = '<div class="label_select"><p class="input_label">'.__('Parent').': </p>';
+$table_adv_parent = '<div class="label_select"><label class="input_label">'.__('Parent').': </label>';
 $params = [];
 $params['return'] = true;
 $params['show_helptip'] = true;
@@ -648,13 +660,15 @@ $table_adv_module_mode .= html_print_radio_button_extended(
 $table_adv_module_mode .= '</div></div>';
 
 // Status (Disabled / Enabled).
-$table_adv_status = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'</p>';
+$table_adv_status = '<div class="label_select_simple label_simple_one_item">';
 $table_adv_status .= html_print_checkbox_switch(
     'disabled',
     1,
     $disabled,
     true
-).'</div>';
+);
+$table_adv_status .= '<p class="input_label input_label_simple">'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'</p>';
+$table_adv_status .= '</div>';
 
 // Url address.
 if (enterprise_installed()) {
@@ -665,7 +679,14 @@ if (enterprise_installed()) {
         '',
         45,
         255,
-        true
+        true,
+        false,
+        false,
+        '',
+        '',
+        '',
+        // Autocomplete.
+        'new-password'
     ).'</div>';
 } else {
     $table_adv_url = '<div class="label_select"><p class="input_label">'.__('Url address').': </p></div>';
@@ -679,9 +700,11 @@ if (enterprise_installed()) {
     ).'</div>';
 }
 
-$table_adv_quiet = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Quiet').': ';
+$table_adv_quiet = '<div class="label_select_simple label_simple_one_item">';
+$table_adv_quiet .= html_print_checkbox_switch('quiet', 1, $quiet, true);
+$table_adv_quiet .= '<p class="input_label input_label_simple">'.__('Quiet').': ';
 $table_adv_quiet .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true).'</p>';
-$table_adv_quiet .= html_print_checkbox_switch('quiet', 1, $quiet, true).'</div>';
+$table_adv_quiet .= '</div>';
 
 $listIcons = gis_get_array_list_icons();
 
@@ -753,33 +776,48 @@ if ($config['activate_gis']) {
 
 
 // General display distribution.
-$table_adv_options = $table_adv_secondary_groups.'<div class="secondary_groups_select" style="margin-bottom:30px;">
-        <div class="secondary_groups_list_left">
-            '.$table_adv_secondary_groups_left.'
+$table_adv_options = '
+        <div class="secondary_groups_list">
+           '.$adv_secondary_groups_label.'
+            <div class="sg_source">
+                '.$adv_secondary_groups_left.'
+            </div>
+            <div class="secondary_group_arrows">
+                '.$adv_secondary_groups_arrows.'
+            </div>
+            <div class="sg_target">      
+                '.$adv_secondary_groups_right.'
+            </div>
         </div>
-        <div class="secondary_groups_select_arrows">
-            '.$table_adv_secondary_groups_arrows.'
-        </div>    
-        <div class="secondary_groups_list_right">      
-            '.$table_adv_secondary_groups_right.'
-        </div>
-    </div>
-    <div class="agent_options agent_options_adv">
-        <div class="agent_options_column_left" >'.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade;
+<div class="agent_av_opt_right" >
+        '.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade;
 
 if ($new_agent) {
     // If agent is new, show custom id as old style format.
     $table_adv_options .= $custom_id_div;
 }
 
-$table_adv_options .= $table_adv_gis.'</div>
-        <div class="agent_options_column_right" >'.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'</div>
-    </div>';
+$table_adv_options .= '</div>';
 
-echo '<div class="ui_toggle">';
-        ui_toggle($table_adv_options, __('Advanced options'), '', true, false, 'white_box white_box_opened');
-echo '</div>';
+$table_adv_options .= '
+        <div class="agent_av_opt_left" >
+        '.$table_adv_gis.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'
+        </div>';
 
+if (enterprise_installed()) {
+    echo '<div class="ui_toggle">';
+    ui_toggle(
+        $table_adv_options,
+        __('Advanced options'),
+        '',
+        '',
+        true,
+        false,
+        'white_box white_box_opened',
+        'no-border flex'
+    );
+    echo '</div>';
+}
 
 $table = new stdClass();
 $table->width = '100%';
@@ -787,7 +825,7 @@ $table->class = 'custom_fields_table';
 
 $table->head = [
     0 => __('Click to display').ui_print_help_tip(
-        __('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'),
+        __('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url] or [url]\'url to navigate\'[/url] ').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url] or [url]www.goole.com[/url]'),
         true
     ),
 ];
@@ -831,7 +869,7 @@ foreach ($fields as $field) {
         $custom_value = '';
     }
 
-    $table->rowstyle[$i] = 'cursor: pointer;';
+    $table->rowstyle[$i] = 'cursor: pointer;user-select: none;';
     if (!empty($custom_value)) {
         $table->rowstyle[($i + 1)] = 'display: table-row;';
     } else {
@@ -893,16 +931,48 @@ foreach ($fields as $field) {
     $i += 2;
 }
 
-if (!empty($fields)) {
+if (enterprise_installed()) {
+    if (!empty($fields)) {
+        echo '<div class="ui_toggle">';
+        ui_toggle(
+            html_print_table($table, true),
+            __('Custom fields'),
+            '',
+            '',
+            true,
+            false,
+            'white_box white_box_opened',
+            'no-border'
+        );
+        echo '</div>';
+    }
+} else {
     echo '<div class="ui_toggle">';
-            ui_toggle(
-                html_print_table($table, true),
-                __('Custom fields'),
-                '',
-                true,
-                false,
-                'white_box white_box_opened'
-            );
+    ui_toggle(
+        $table_adv_options,
+        __('Advanced options'),
+        '',
+        '',
+        true,
+        false,
+        'white_box white_box_opened',
+        'no-border flex'
+    );
+    if (!empty($fields)) {
+        ui_toggle(
+            html_print_table($table, true),
+            __('Custom fields'),
+            '',
+            '',
+            true,
+            false,
+            'white_box white_box_opened',
+            'no-border'
+        );
+    }
+
+    echo '<div class="action-buttons" style="display: flex; justify-content: flex-end; align-items: center; width: '.$table->width.'">';
+
     echo '</div>';
 }
 
@@ -1134,6 +1204,19 @@ ui_require_jquery_file('bgiframe');
     }
 
     $(document).ready (function() {
+
+        var previous_primary_group_select;
+        $("#grupo").on('focus', function () {
+            previous_primary_group_select = this.value;
+        }).change(function() {
+            if ($("#secondary_groups_selected option[value="+$("#grupo").val()+"]").length) {
+                alert("<?php echo __('Secondary group cannot be primary too.'); ?>");
+                $("#grupo").val(previous_primary_group_select);
+            } else {
+                previous_primary_group_select = this.value;
+            }
+        });
+
         $("select#id_os").pandoraSelectOS ();
 
         var checked = $("#checkbox-cascade_protection").is(":checked");
@@ -1182,7 +1265,7 @@ ui_require_jquery_file('bgiframe');
             128,
             128
         );
-        $("#text-agente").prop('disabled', true);
+        $("#text-agente").prop('readonly', true);
 
     });
 </script>
diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php
index 5730fea501..3eb404340e 100644
--- a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php
+++ b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php
@@ -1,16 +1,32 @@
 <?php
+/**
+ * Extension to manage a list of gateways and the node address where they should
+ * point to.
+ *
+ * @category   SNMP interfaces.
+ * @package    Pandora FMS
+ * @subpackage Community
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; version 2
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
 global $config;
 require_once $config['homedir'].'/include/functions_agents.php';
 require_once 'include/functions_modules.php';
@@ -23,7 +39,6 @@ $idAgent = (int) get_parameter('id_agente', 0);
 $ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
 
 check_login();
-
 $ip_target = (string) get_parameter('ip_target', $ipAgent);
 $use_agent = get_parameter('use_agent');
 $snmp_community = (string) get_parameter('snmp_community', 'public');
@@ -37,10 +52,10 @@ $snmp3_privacy_method = get_parameter('snmp3_privacy_method');
 $snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_privacy_pass'));
 $tcp_port = (string) get_parameter('tcp_port');
 
-// See if id_agente is set (either POST or GET, otherwise -1
+// See if id_agente is set (either POST or GET, otherwise -1.
 $id_agent = $idAgent;
 
-// Get passed variables
+// Get passed variables.
 $snmpwalk = (int) get_parameter('snmpwalk', 0);
 $create_modules = (int) get_parameter('create_modules', 0);
 
@@ -48,7 +63,7 @@ $interfaces = [];
 $interfaces_ip = [];
 
 if ($snmpwalk) {
-    // OID Used is for SNMP MIB-2 Interfaces
+    // OID Used is for SNMP MIB-2 Interfaces.
     $snmpis = get_snmpwalk(
         $ip_target,
         $snmp_version,
@@ -64,7 +79,7 @@ if ($snmpwalk) {
         $tcp_port,
         $server_to_exec
     );
-    // ifXTable is also used
+    // IfXTable is also used.
     $ifxitems = get_snmpwalk(
         $ip_target,
         $snmp_version,
@@ -81,7 +96,7 @@ if ($snmpwalk) {
         $server_to_exec
     );
 
-    // Get the interfaces IPV4/IPV6
+    // Get the interfaces IPV4/IPV6.
     $snmp_int_ip = get_snmpwalk(
         $ip_target,
         $snmp_version,
@@ -98,12 +113,12 @@ if ($snmpwalk) {
         $server_to_exec
     );
 
-    // Build a [<interface id>] => [<interface ip>] array
+    // Build a [<interface id>] => [<interface ip>] array.
     if (!empty($snmp_int_ip)) {
         foreach ($snmp_int_ip as $key => $value) {
-            // The key is something like IP-MIB::ipAddressIfIndex.ipv4."<ip>"
-            // or IP-MIB::ipAddressIfIndex.ipv6."<ip>"
-            // The value is something like INTEGER: <interface id>
+            // The key is something like IP-MIB::ipAddressIfIndex.ipv4."<ip>".
+            // or IP-MIB::ipAddressIfIndex.ipv6."<ip>".
+            // The value is something like INTEGER: <interface id>.
             $data = explode(': ', $value);
             $interface_id = !empty($data) && isset($data[1]) ? $data[1] : false;
 
@@ -111,7 +126,7 @@ if ($snmpwalk) {
                 $interface_ip = $matches[1];
             }
 
-            // Get the first ip
+            // Get the first ip.
             if ($interface_id !== false && !empty($interface_ip) && !isset($interfaces_ip[$interface_id])) {
                 $interfaces_ip[$interface_id] = $interface_ip;
             }
@@ -120,17 +135,17 @@ if ($snmpwalk) {
         unset($snmp_int_ip);
     }
 
-    $snmpis = array_merge(($snmpis === false ? [] : $snmpis), ($ifxitems === false ? [] : $ifxitems));
+    $snmpis = array_merge((($snmpis === false) ? [] : $snmpis), (($ifxitems === false) ? [] : $ifxitems));
 
     $interfaces = [];
 
-    // We get here only the interface part of the MIB, not full mib
+    // We get here only the interface part of the MIB, not full mib.
     foreach ($snmpis as $key => $snmp) {
         $data = explode(': ', $snmp, 2);
         $keydata = explode('::', $key);
         $keydata2 = explode('.', $keydata[1]);
 
-        // Avoid results without index and interfaces without name
+        // Avoid results without index and interfaces without name.
         if (!isset($keydata2[1]) || !isset($data[1])) {
             continue;
         }
@@ -240,24 +255,22 @@ if ($create_modules) {
             $oid_array[(count($oid_array) - 1)] = $id;
             $oid = implode('.', $oid_array);
 
-            // Get the name
+            // Get the name.
             $name_array = explode('::', $oid_array[0]);
             $name = $ifname.'_'.$name_array[1];
 
-            // Clean the name
+            // Clean the name.
             $name = str_replace('"', '', $name);
 
-            // Proc moduletypes
+            // Proc moduletypes.
             if (preg_match('/Status/', $name_array[1])) {
                 $module_type = 18;
             } else if (preg_match('/Present/', $name_array[1])) {
                 $module_type = 18;
             } else if (preg_match('/PromiscuousMode/', $name_array[1])) {
                 $module_type = 18;
-            }
-
-            // String moduletypes
-            else if (preg_match('/Alias/', $name_array[1])) {
+            } else if (preg_match('/Alias/', $name_array[1])) {
+                // String moduletypes.
                 $module_type = 17;
             } else if (preg_match('/Address/', $name_array[1])) {
                 $module_type = 17;
@@ -267,15 +280,11 @@ if ($create_modules) {
                 $module_type = 17;
             } else if (preg_match('/Descr/', $name_array[1])) {
                 $module_type = 17;
-            }
-
-            // Specific counters (ends in s)
-            else if (preg_match('/s$/', $name_array[1])) {
+            } else if (preg_match('/s$/', $name_array[1])) {
+                // Specific counters (ends in s).
                 $module_type = 16;
-            }
-
-            // Otherwise, numeric
-            else {
+            } else {
+                // Otherwise, numeric.
                 $module_type = 15;
             }
 
@@ -322,7 +331,7 @@ if ($create_modules) {
                     } else if (preg_match('/ifAdminStatus/', $name_array[1])) {
                         $module_type = 2;
                     } else if (preg_match('/ifOperStatus/', $name_array[1])) {
-                        $module_type = 18;
+                        $module_type = 2;
                     } else {
                         $module_type = 4;
                     }
@@ -331,7 +340,7 @@ if ($create_modules) {
 
                     $output_oid = '';
 
-                    exec('ssh pandora_exec_proxy@'.$row['ip_address'].' snmptranslate -On '.$oid, $output_oid, $rc);
+                    exec('snmptranslate -On '.$oid, $output_oid, $rc);
 
                     $conf_oid = $output_oid[0];
                     $oid = $conf_oid;
@@ -398,7 +407,9 @@ if ($create_modules) {
     }
 
     if ($done > 0) {
-        ui_print_success_message(__('Successfully modules created')." ($done)");
+        ui_print_success_message(
+            __('Successfully modules created').' ('.$done.')'
+        );
     }
 
     if (!empty($errors)) {
@@ -408,17 +419,17 @@ if ($create_modules) {
         foreach ($errors as $code => $number) {
             switch ($code) {
                 case ERR_EXIST:
-                    $msg .= '<br>'.__('Another module already exists with the same name')." ($number)";
+                    $msg .= '<br>'.__('Another module already exists with the same name').' ('.$number.')';
                 break;
 
                 case ERR_INCOMPLETE:
-                    $msg .= '<br>'.__('Some required fields are missed').': ('.__('name').') '." ($number)";
+                    $msg .= '<br>'.__('Some required fields are missed').': ('.__('name').') ('.$number.')';
                 break;
 
                 case ERR_DB:
                 case ERR_GENERIC:
                 default:
-                    $msg .= '<br>'.__('Processing error')." ($number)";
+                    $msg .= '<br>'.__('Processing error').' ('.$number.')';
                 break;
             }
         }
@@ -427,10 +438,10 @@ if ($create_modules) {
     }
 }
 
-// Create the interface list for the interface
+// Create the interface list for the interface.
 $interfaces_list = [];
 foreach ($interfaces as $interface) {
-    // Get the interface name, removing " " characters and avoid "blank" interfaces
+    // Get the interface name, removing " " characters and avoid "blank" interfaces.
     if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != '') {
         $ifname = $interface['ifDescr']['value'];
     } else if (isset($interface['ifName']) && $interface['ifName']['value'] != '') {
@@ -443,7 +454,7 @@ foreach ($interfaces as $interface) {
 }
 
 echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
-echo "<form method='post' id='walk_form' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=$id_agent'>";
+echo "<form method='post' id='walk_form' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=".$id_agent."'>";
 
 $table->width = '100%';
 $table->cellpadding = 0;
@@ -465,10 +476,15 @@ if (enterprise_installed()) {
     enterprise_include_once('include/functions_satellite.php');
 
     $rows = get_proxy_servers();
+
+    // Check if satellite server has remote configuration enabled.
+    $satellite_remote = config_agents_has_remote_configuration($id_agent);
+
     foreach ($rows as $row) {
         if ($row['server_type'] != 13) {
             $s_type = ' (Standard)';
         } else {
+            $id_satellite = $row['id_server'];
             $s_type = ' (Satellite)';
         }
 
@@ -477,7 +493,16 @@ if (enterprise_installed()) {
 }
 
 $table->data[1][2] = '<b>'.__('Server to execute command').'</b>';
-$table->data[1][3] = html_print_select($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', true);
+$table->data[1][2] .= '<span id=satellite_remote_tip>'.ui_print_help_tip(__('In order to use remote executions you need to enable remote execution in satellite server'), true, 'images/tip_help.png', false, 'display:').'</span>';
+$table->data[1][4] = html_print_select(
+    $servers_to_exec,
+    'server_to_exec',
+    $server_to_exec,
+    'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')',
+    '',
+    '',
+    true
+);
 
 $snmp_versions['1'] = 'v. 1';
 $snmp_versions['2'] = 'v. 2';
@@ -497,7 +522,7 @@ html_print_table($table);
 
 unset($table);
 
-// SNMP3 OPTIONS
+// SNMP3 OPTIONS.
 $table->width = '100%';
 
 $table->data[2][1] = '<b>'.__('Auth user').'</b>';
@@ -552,7 +577,7 @@ echo '</form>';
 
 if (!empty($interfaces_list)) {
     echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
-    echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=$id_agent'>";
+    echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=".$id_agent."'>";
     echo '<span id="form_interfaces">';
 
     $id_snmp_serialize = serialize_in_temp($interfaces, $config['id_user'].'_snmp');
@@ -577,13 +602,30 @@ if (!empty($interfaces_list)) {
 
     $table->width = '100%';
 
-    // Agent selector
+    // Agent selector.
     $table->data[0][0] = '<b>'.__('Interfaces').'</b>';
     $table->data[0][1] = '';
     $table->data[0][2] = '<b>'.__('Modules').'</b>';
 
     $table->data[1][0] = html_print_select($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;');
-    $table->data[1][1] = html_print_image('images/darrowright.png', true);
+
+    $table->data[1][1] = __('When selecting interfaces');
+    $table->data[1][1] .= '<br>';
+    $table->data[1][1] .= html_print_select(
+        [
+            1 => __('Show common modules'),
+            0 => __('Show all modules'),
+        ],
+        'modules_selection_mode',
+        1,
+        false,
+        '',
+        '',
+        true,
+        false,
+        false
+    );
+
     $table->data[1][2] = html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
     $table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
 
@@ -608,11 +650,13 @@ ui_require_jquery_file('bgiframe');
 
 $(document).ready (function () {
     var inputActive = true;
-    
+
+    $('#server_to_exec option').trigger('change');
+
     $(document).data('text_for_module', $("#none_text").html());
-    
+
     $("#id_snmp").change(snmp_changed_by_multiple_snmp);
-    
+
     $("#snmp_version").change(function () {
         if (this.value == "3") {
             $("#snmp3_options").css("display", "");
@@ -621,28 +665,36 @@ $(document).ready (function () {
             $("#snmp3_options").css("display", "none");
         }
     });
-    
+
     $("#walk_form").submit(function() {
         $("#submit-snmp_walk").disable ();
         $("#oid_loading").show ();
         $("#no_snmp").hide ();
         $("#form_interfaces").hide ();
     });
+
+    // When select interfaces changes
+    $("#modules_selection_mode").change (function() {
+        $("#id_snmp").trigger('change');
+    });
+
 });
 
 function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
     var idSNMP = Array();
-    
+    var get_common_modules = $("#modules_selection_mode option:selected").val();
+
     jQuery.each ($("#id_snmp option:selected"), function (i, val) {
         idSNMP.push($(val).val());
     });
     $('#module').attr ('disabled', 1);
     $('#module').empty ();
     $('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
-    
-    jQuery.post ('ajax.php', 
+
+    jQuery.post ('ajax.php',
         {"page" : "godmode/agentes/agent_manager",
             "get_modules_json_for_multiple_snmp": 1,
+            "get_common_modules" : get_common_modules,
             "id_snmp[]": idSNMP,
             "id_snmp_serialize": $("#hidden-id_snmp_serialize").val()
         },
@@ -655,7 +707,7 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
                 $('#module').fadeIn ('normal');
                 c++;
                 });
-            
+
             if (c == 0) {
                 if (typeof($(document).data('text_for_module')) != 'undefined') {
                     $('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).prop('selected', true));
@@ -666,11 +718,11 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
                     }
                     else {
                         var anyText = $("#any_text").html(); //Trick for catch the translate text.
-                        
+
                         if (anyText == null) {
                             anyText = 'Any';
                         }
-                        
+
                         $('#module').append ($('<option></option>').html (anyText).attr ("value", 0).prop('selected', true));
                     }
                 }
@@ -682,6 +734,20 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
         "json");
 }
 
+
+function satellite_remote_warn(id_satellite, remote)
+{
+    if(!remote)
+    {
+        $('#server_to_exec option[value='+id_satellite+']').prop('disabled', true);
+        $('#satellite_remote_tip').removeAttr("style").show();
+    }
+    else
+    {
+        $('#satellite_remote_tip').removeAttr("style").hide();
+    }
+
+}
+
 /* ]]> */
 </script>
-
diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php
index 22410b0e23..22a3d46eaa 100644
--- a/pandora_console/godmode/agentes/configurar_agente.php
+++ b/pandora_console/godmode/agentes/configurar_agente.php
@@ -1213,7 +1213,7 @@ if ($update_module || $create_module) {
 
     $max_timeout = (int) get_parameter('max_timeout');
     $max_retries = (int) get_parameter('max_retries');
-    $min = (int) get_parameter_post('min');
+    $min = (int) get_parameter('min');
     $max = (int) get_parameter('max');
     $interval = (int) get_parameter('module_interval', $intervalo);
     $ff_interval = (int) get_parameter('module_ff_interval');
@@ -1276,18 +1276,10 @@ if ($update_module || $create_module) {
                 $m_hide = $m['hide'];
             }
 
-            if ($update_module) {
-                if ($m_hide == '1') {
-                    $macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
-                } else {
-                    $macros[$k]['value'] = get_parameter($m['macro'], '');
-                }
+            if ($m_hide == '1') {
+                $macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
             } else {
-                if ($m_hide == '1') {
-                    $macros[$k]['value'] = io_input_password($macros_names[$k]);
-                } else {
-                    $macros[$k]['value'] = $macros_names[$k];
-                }
+                $macros[$k]['value'] = get_parameter($m['macro'], '');
             }
         }
 
@@ -1366,7 +1358,11 @@ if ($update_module || $create_module) {
 
     $parent_module_id = (int) get_parameter('parent_module_id');
     $ip_target = (string) get_parameter('ip_target');
-    if ($ip_target == '') {
+    // No autofill if the module is a webserver module.
+    if ($ip_target == ''
+        && $id_module_type < MODULE_WEBSERVER_CHECK_LATENCY
+        && $id_module_type > MODULE_WEBSERVER_RETRIEVE_STRING_DATA
+    ) {
         $ip_target = 'auto';
     }
 
@@ -1567,8 +1563,14 @@ if ($update_module) {
 
         foreach ($plugin_parameter_split as $key => $value) {
             if ($key == 1) {
-                $values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
-                $values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
+                if ($http_user) {
+                    $values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
+                }
+
+                if ($http_pass) {
+                    $values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
+                }
+
                 $values['plugin_parameter'] .= $value.'&#x0a;';
             } else {
                 $values['plugin_parameter'] .= $value.'&#x0a;';
@@ -1765,8 +1767,14 @@ if ($create_module) {
 
         foreach ($plugin_parameter_split as $key => $value) {
             if ($key == 1) {
-                $values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
-                $values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
+                if ($http_user) {
+                    $values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
+                }
+
+                if ($http_pass) {
+                    $values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
+                }
+
                 $values['plugin_parameter'] .= $value.'&#x0a;';
             } else {
                 $values['plugin_parameter'] .= $value.'&#x0a;';
@@ -2103,8 +2111,7 @@ if ($delete_module) {
     }
 }
 
-// MODULE DUPLICATION
-// ==================.
+// MODULE DUPLICATION.
 if (!empty($duplicate_module)) {
     // DUPLICATE agent module !
     $id_duplicate_module = $duplicate_module;
@@ -2150,8 +2157,46 @@ if (!empty($duplicate_module)) {
     }
 }
 
-// UPDATE GIS
-// ==========.
+// MODULE ENABLE/DISABLE.
+if ($enable_module) {
+    $result = modules_change_disabled($enable_module, 0);
+    $modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$enable_module.'');
+    $modulo_nombre = $modulo_nombre['nombre'];
+
+    if ($result === NOERR) {
+        enterprise_hook('config_agents_enable_module_conf', [$id_agente, $enable_module]);
+        db_pandora_audit('Module management', 'Enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
+    } else {
+        db_pandora_audit('Module management', 'Fail to enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
+    }
+
+    ui_print_result_message(
+        $result,
+        __('Successfully enabled'),
+        __('Could not be enabled')
+    );
+}
+
+if ($disable_module) {
+    $result = modules_change_disabled($disable_module, 1);
+    $modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$disable_module.'');
+    $modulo_nombre = $modulo_nombre['nombre'];
+
+    if ($result === NOERR) {
+        enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);
+        db_pandora_audit('Module management', 'Disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
+    } else {
+        db_pandora_audit('Module management', 'Fail to disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
+    }
+
+    ui_print_result_message(
+        $result,
+        __('Successfully disabled'),
+        __('Could not be disabled')
+    );
+}
+
+// UPDATE GIS.
 $updateGIS = get_parameter('update_gis', 0);
 if ($updateGIS) {
     $updateGisData = get_parameter('update_gis_data');
@@ -2239,8 +2284,11 @@ switch ($tab) {
     break;
 
     case 'alert':
-        // Because $id_agente is set, it will show only agent alerts.
-        // This var is for not display create button on alert list.
+        /*
+         * Because $id_agente is set, it will show only agent alerts
+         * This var is for not display create button on alert list
+         */
+
         $dont_display_alert_create_bttn = true;
         include 'godmode/alerts/alert_list.php';
     break;
diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php
index 0e08a3728f..a383de35c4 100644
--- a/pandora_console/godmode/agentes/modificar_agente.php
+++ b/pandora_console/godmode/agentes/modificar_agente.php
@@ -163,7 +163,7 @@ echo '<td>';
 
 echo __('Group').'&nbsp;';
 $own_info = get_user_info($config['id_user']);
-if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
+if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) {
     $return_all_group = false;
 } else {
     $return_all_group = true;
@@ -443,6 +443,14 @@ ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modific
 
 if ($agents !== false) {
     // Urls to sort the table.
+    // Agent name size and description for Chinese and Japanese languages ​​are adjusted
+    $agent_font_size = '7';
+    $description_font_size = '6.5';
+    if ($config['language'] == 'ja' || $config['language'] == 'zh_CN' || $own_info['language'] == 'ja' || $own_info['language'] == 'zh_CN') {
+        $agent_font_size = '15';
+        $description_font_size = '11';
+    }
+
     $url_up_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled';
     $url_down_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled';
     $url_up_remote = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled';
@@ -529,7 +537,7 @@ if ($agents !== false) {
         } else {
             echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
 			sec2=godmode/agentes/configurar_agente&tab=$main_tab&
-			id_agente=".$agent['id_agente']."'>".'<span style="font-size: 7pt" title="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
+			id_agente=".$agent['id_agente']."'>".'<span style="font-size: '.$agent_font_size.'pt" title="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
         }
 
         echo '</strong>';
@@ -629,7 +637,7 @@ if ($agents !== false) {
         // Group icon and name
         echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>';
         // Description
-        echo "<td class='".$tdcolor."f9'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]', 'font-size: 6.5pt;').'</td>';
+        echo "<td class='".$tdcolor."f9'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]', 'font-size: '.$description_font_size.'pt;').'</td>';
         // Action
         // When there is only one element in page it's necesary go back page.
         if ((count($agents) == 1) && ($offset >= $config['block_size'])) {
@@ -680,7 +688,7 @@ if ($agents !== false) {
     }
 
     echo '</table>';
-    ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset, 0, false, 'offset', true, 'pagination-bottom');
+    ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
     echo "<table width='100%'><tr><td align='right'>";
 } else {
     ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]);
diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php
index cee4825faa..13c313892a 100644
--- a/pandora_console/godmode/agentes/module_manager_editor.php
+++ b/pandora_console/godmode/agentes/module_manager_editor.php
@@ -267,10 +267,10 @@ if ($id_agent_module) {
     $cron_interval = explode(' ', $module['cron_interval']);
     if (isset($cron_interval[4])) {
         $minute_from = $cron_interval[0];
-        $min = explode('-', $minute_from);
-        $minute_from = $min[0];
-        if (isset($min[1])) {
-            $minute_to = $min[1];
+        $minute = explode('-', $minute_from);
+        $minute_from = $minute[0];
+        if (isset($minute[1])) {
+            $minute_to = $minute[1];
         }
 
         $hour_from = $cron_interval[1];
@@ -583,7 +583,13 @@ echo '<h3 id="message" class="error invisible"></h3>';
 // TODO: Change to the ui_print_error system
 echo '<form method="post" id="module_form">';
 
-html_print_table($table_simple);
+ui_toggle(
+    html_print_table($table_simple, true),
+    __('Base options'),
+    '',
+    '',
+    false
+);
 
 ui_toggle(
     html_print_table($table_advanced, true),
diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php
index cb2f071e1c..ac110b0d6f 100644
--- a/pandora_console/godmode/agentes/module_manager_editor_common.php
+++ b/pandora_console/godmode/agentes/module_manager_editor_common.php
@@ -78,6 +78,13 @@ function push_table_advanced($row, $id=false)
 function add_component_selection($id_network_component_type)
 {
     global $table_simple;
+    global $config;
+
+    if ($config['style'] === 'pandora_black') {
+        $background_row = 'background-color: #444';
+    } else {
+        $background_row = 'background-color: #cfcfcf';
+    }
 
     $data = [];
     $data[0] = __('Using module component').' ';
@@ -116,7 +123,7 @@ function add_component_selection($id_network_component_type)
     $data[1] .= '</span>';
 
     $table_simple->colspan['module_component'][1] = 3;
-    $table_simple->rowstyle['module_component'] = 'background-color: #cfcfcf';
+    $table_simple->rowstyle['module_component'] = $background_row;
 
     prepend_table_simple($data, 'module_component');
 }
@@ -134,7 +141,9 @@ $largeClassDisabledBecauseInPolicy = '';
 
 $page = get_parameter('page', '');
 
-if (strstr($page, 'policy_modules') === false && $id_agent_module) {
+$in_policies_page = strstr($page, 'policy_modules');
+
+if ($in_policies_page === false && $id_agent_module) {
     if ($config['enterprise_installed']) {
         if (policies_is_module_linked($id_agent_module) == 1) {
             $disabledBecauseInPolicy = 1;
@@ -162,7 +171,7 @@ $edit_module = (bool) get_parameter_get('edit_module');
 $table_simple = new stdClass();
 $table_simple->id = 'simple';
 $table_simple->width = '100%';
-$table_simple->class = 'databox';
+$table_simple->class = 'no-class';
 $table_simple->data = [];
 $table_simple->style = [];
 $table_simple->style[0] = 'font-weight: bold; width: 25%;';
@@ -243,6 +252,12 @@ $table_simple->data[0][3] .= html_print_select_from_sql(
     $disabledBecauseInPolicy
 );
 
+if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) {
+    $edit = false;
+} else {
+    $edit = true;
+}
+
 $in_policy = strstr($page, 'policy_modules');
 if (!$in_policy) {
     // Cannot select the current module to be itself parent
@@ -273,17 +288,6 @@ if (!$in_policy) {
 $table_simple->data[2][0] = __('Type').' '.ui_print_help_icon($help_type, true, '', 'images/help_green.png', '', 'module_type_help');
 $table_simple->data[2][0] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true);
 
-if (isset($id_agent_module)) {
-    if ($id_agent_module) {
-        $edit = false;
-    } else {
-        $edit = true;
-    }
-} else {
-    // Run into a policy
-    $edit = true;
-}
-
 if (!$edit) {
     $sql = sprintf(
         'SELECT id_tipo, nombre
@@ -637,7 +641,7 @@ if ($disabledBecauseInPolicy) {
 $table_advanced = new stdClass();
 $table_advanced->id = 'advanced';
 $table_advanced->width = '100%';
-$table_advanced->class = 'databox filters';
+$table_advanced->class = 'no-class';
 $table_advanced->data = [];
 $table_advanced->style = [];
 $table_advanced->style[0] = $table_advanced->style[3] = $table_advanced->style[5] = 'font-weight: bold;';
@@ -1066,7 +1070,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
 $table_macros = new stdClass();
 $table_macros->id = 'module_macros';
 $table_macros->width = '100%';
-$table_macros->class = 'databox filters';
+$table_macros->class = 'no-class';
 $table_macros->data = [];
 $table_macros->style = [];
 $table_macros->style[0] = 'font-weight: bold;';
@@ -1101,20 +1105,20 @@ $macro_count++;
 
 html_print_input_hidden('module_macro_count', $macro_count);
 
-/*
-    Advanced form part */
-// Add relationships
+// Advanced form part.
+// Add relationships.
 $table_new_relations = new stdClass();
 $table_new_relations->id = 'module_new_relations';
 $table_new_relations->width = '100%';
-$table_new_relations->class = 'databox filters';
+$table_new_relations->class = 'no-class';
 $table_new_relations->data = [];
 $table_new_relations->style = [];
 $table_new_relations->style[0] = 'width: 10%; font-weight: bold;';
 $table_new_relations->style[1] = 'width: 25%; text-align: center;';
 $table_new_relations->style[2] = 'width: 10%; font-weight: bold;';
 $table_new_relations->style[3] = 'width: 25%; text-align: center;';
-$table_new_relations->style[4] = 'width: 30%; text-align: center;';
+$table_new_relations->style[4] = 'width: 10%; font-weight: bold;';
+$table_new_relations->style[5] = 'width: 25%; text-align: center;';
 
 $table_new_relations->data[0][0] = __('Agent');
 $params = [];
@@ -1128,10 +1132,35 @@ $params['javascript_function_action_after_select_js_call'] = 'change_modules_aut
 $table_new_relations->data[0][1] = ui_print_agent_autocomplete_input($params);
 $table_new_relations->data[0][2] = __('Module');
 $table_new_relations->data[0][3] = "<div id='module_autocomplete'></div>";
-$table_new_relations->data[0][4] = html_print_button(__('Add relationship'), 'add_relation', false, 'javascript: add_new_relation();', 'class="sub add"', true);
-$table_new_relations->data[0][4] .= "&nbsp;&nbsp;<div id='add_relation_status' style='display: inline;'></div>";
 
-// Relationship list
+$array_rel_type = [];
+$array_rel_type['direct'] = __('Direct');
+$array_rel_type['failover'] = __('Failover');
+$table_new_relations->data[0][4] = __('Rel. type');
+$table_new_relations->data[0][5] = html_print_select(
+    $array_rel_type,
+    'relation_type',
+    '',
+    '',
+    '',
+    0,
+    true,
+    false,
+    true,
+    ''
+);
+
+$table_new_relations->data[0][6] = html_print_button(
+    __('Add relationship'),
+    'add_relation',
+    false,
+    'javascript: add_new_relation();',
+    'class="sub add"',
+    true
+);
+$table_new_relations->data[0][6] .= "&nbsp;&nbsp;<div id='add_relation_status' style='display: inline;'></div>";
+
+// Relationship list.
 $table_relations = new stdClass();
 $table_relations->id = 'module_relations';
 $table_relations->width = '100%';
@@ -1141,19 +1170,26 @@ $table_relations->data = [];
 $table_relations->rowstyle = [];
 $table_relations->rowstyle[-1] = 'display: none;';
 $table_relations->style = [];
-$table_relations->style[2] = 'width: 10%; text-align: center;';
 $table_relations->style[3] = 'width: 10%; text-align: center;';
+$table_relations->style[4] = 'width: 10%; text-align: center;';
 
 $table_relations->head[0] = __('Agent');
 $table_relations->head[1] = __('Module');
-$table_relations->head[2] = __('Changes').ui_print_help_tip(__('Activate this to prevent the relation from being updated or deleted'), true);
-$table_relations->head[3] = __('Delete');
+$table_relations->head[2] = __('Type');
+$table_relations->head[3] = __('Changes').ui_print_help_tip(
+    __('Activate this to prevent the relation from being updated or deleted'),
+    true
+);
+$table_relations->head[4] = __('Delete');
 
-// Create an invisible row to use their html to add new rows
+// Create an invisible row to use their html to add new rows.
 $table_relations->data[-1][0] = '';
 $table_relations->data[-1][1] = '';
-$table_relations->data[-1][2] = '<a id="disable_updates_button" class="alpha50" href="">'.html_print_image('images/lock.png', true).'</a>';
-$table_relations->data[-1][3] = '<a id="delete_relation_button" href="">'.html_print_image('images/cross.png', true).'</a>';
+$table_relations->data[-1][2] = '';
+$table_relations->data[-1][3] = '<a id="disable_updates_button" class="alpha50" href="">';
+$table_relations->data[-1][3] .= html_print_image('images/lock.png', true).'</a>';
+$table_relations->data[-1][4] = '<a id="delete_relation_button" href="">';
+$table_relations->data[-1][4] .= html_print_image('images/cross.png', true).'</a>';
 
 $module_relations = modules_get_relations(['id_module' => $id_agent_module]);
 if (!$module_relations) {
@@ -1164,10 +1200,14 @@ $relations_count = 0;
 foreach ($module_relations as $key => $module_relation) {
     if ($module_relation['module_a'] == $id_agent_module) {
         $module_id = $module_relation['module_b'];
-        $agent_id = modules_give_agent_id_from_module_id($module_relation['module_b']);
+        $agent_id = modules_give_agent_id_from_module_id(
+            $module_relation['module_b']
+        );
     } else {
         $module_id = $module_relation['module_a'];
-        $agent_id = modules_give_agent_id_from_module_id($module_relation['module_a']);
+        $agent_id = modules_give_agent_id_from_module_id(
+            $module_relation['module_a']
+        );
     }
 
     $agent_name = ui_print_agent_name($agent_id, true);
@@ -1183,14 +1223,16 @@ foreach ($module_relations as $key => $module_relation) {
         $disabled_update_class = 'alpha50';
     }
 
-    // Agent name
+    // Agent name.
     $table_relations->data[$relations_count][0] = $agent_name;
-    // Module name
+    // Module name.
     $table_relations->data[$relations_count][1] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$agent_id.'&tab=module&edit_module=1&id_agent_module='.$module_id."'>".ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[&hellip;]').'</a>';
-    // Lock relationship updates
-    $table_relations->data[$relations_count][2] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>';
-    // Delete relationship
-    $table_relations->data[$relations_count][3] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>';
+    // Type.
+    $table_relations->data[$relations_count][2] = ($module_relation['type'] === 'direct') ? __('Direct') : __('Failover');
+    // Lock relationship updates.
+    $table_relations->data[$relations_count][3] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>';
+    // Delete relationship.
+    $table_relations->data[$relations_count][4] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>';
     $relations_count++;
 }
 
@@ -1198,7 +1240,6 @@ html_print_input_hidden('module_relations_count', $relations_count);
 
 ui_require_jquery_file('json');
 
-
 ?>
 
 <script type="text/javascript">
@@ -1343,8 +1384,6 @@ $(document).ready (function () {
                      'width=800,height=600'
                      );
                    }
-              
-                
             }
             if(type_name_selected == 'web_data' ||
              type_name_selected == 'web_proc' ||
@@ -1365,8 +1404,6 @@ $(document).ready (function () {
                      'width=800,height=600'
                      );
                    }
-              
-                
             }
         }
 
@@ -1386,7 +1423,7 @@ $(document).ready (function () {
             $('#minmax_warning').hide();
             $('#svg_dinamic').hide();
         }
-        
+
         if (type_name_selected.match(/async/) == null) {
             $('#ff_timeout').hide();
             $('#ff_timeout_disable').show();
@@ -1396,16 +1433,16 @@ $(document).ready (function () {
             $('#ff_timeout_disable').hide();
         }
     });
-    
+
     $("#id_module_type").trigger('change');
-    
+
     // Prevent the form submission when the user hits the enter button from the relationship autocomplete inputs
     $("#text-autocomplete_agent_name").keydown(function(event) {
         if(event.keyCode == 13) { // key code 13 is the enter button
             event.preventDefault();
         }
     });
-    
+
     //validate post_process. Change ',' by '.'
     $("#submit-updbutton").click (function () {
         validate_post_process();
@@ -1512,7 +1549,6 @@ function advanced_option_dynamic() {
 
     } else {
         $('.hide_dinamic').show();
-        
     }
 }
 
@@ -1524,11 +1560,9 @@ function change_modules_autocomplete_input () {
     var module_autocomplete = $("#module_autocomplete");
     var load_icon = '<?php html_print_image('images/spinner.gif', false); ?>';
     var error_icon = '<?php html_print_image('images/error_red.png', false); ?>';
-    
     if (!module_autocomplete.hasClass('working')) {
         module_autocomplete.addClass('working');
         module_autocomplete.html(load_icon);
-        
         $.ajax({
             type: "POST",
             url: "ajax.php",
@@ -1563,22 +1597,26 @@ function change_modules_autocomplete_input () {
 
 // Add a new relation
 function add_new_relation () {
-    var module_a_id = parseInt($("#hidden-id_agent_module").val());
-    var module_b_id = parseInt($("#hidden-autocomplete_module_name_hidden").val());
+    var module_a_id = parseInt(
+        $("#hidden-id_agent_module").val()
+    );
+    var module_b_id = parseInt(
+        $("#hidden-autocomplete_module_name_hidden").val()
+    );
     var module_b_name = $("#text-autocomplete_module_name").val();
     var agent_b_name = $("#text-autocomplete_agent_name").val();
+    var relation_type = $("#relation_type").val();
     var hiddenRow = $("#module_relations--1");
     var button = $("#button-add_relation");
     var iconPlaceholder = $("#add_relation_status");
     var load_icon = '<?php html_print_image('images/spinner.gif', false, ['style' => 'vertical-align:middle;']); ?>';
     var suc_icon = '<?php html_print_image('images/ok.png', false, ['style' => 'vertical-align:middle;']); ?>';
     var error_icon = '<?php html_print_image('images/error_red.png', false, ['style' => 'vertical-align:middle;']); ?>';
-    
-    
+
     if (!button.hasClass('working')) {
         button.addClass('working');
         iconPlaceholder.html(load_icon);
-        
+
         $.ajax({
             type: "POST",
             url: "ajax.php",
@@ -1588,7 +1626,8 @@ function add_new_relation () {
                 add_module_relation: true,
                 id_module_a: module_a_id,
                 id_module_b: module_b_id,
-                name_module_b: module_b_name
+                name_module_b: module_b_name,
+                relation_type: relation_type
             },
             success: function (data) {
                 button.removeClass('working');
@@ -1599,29 +1638,30 @@ function add_new_relation () {
                 else {
                     iconPlaceholder.html(suc_icon);
                     setTimeout( function() { iconPlaceholder.html(''); }, 2000);
-                    
+
                     // Add the new row
                     var relationsCount = parseInt($("#hidden-module_relations_count").val());
-                    
+
                     var rowClass = "datos";
                     if (relationsCount % 2 != 0) {
                         rowClass = "datos2";
                     }
-                    
+
                     var rowHTML = '<tr id="module_relations-' + relationsCount + '" class="' + rowClass + '">' +
-                                        '<td id="module_relations-' + relationsCount + '-0"><b>' + agent_b_name + '</b></td>' +
-                                        '<td id="module_relations-' + relationsCount + '-1">' + module_b_name + '</td>' +
-                                        '<td id="module_relations-' + relationsCount + '-2" style="width: 10%; text-align: center;">' +
-                                            '<a id="disable_updates_button" class="alpha50" href="javascript: change_lock_relation(' + relationsCount + ', ' + data + ');">' +
-                                                '<?php echo html_print_image('images/lock.png', true); ?>' +
-                                            '</a>' +
-                                        '</td>' +
-                                        '<td id="module_relations-' + relationsCount + '-3" style="width: 10%; text-align: center;">' +
-                                            '<a id="delete_relation_button" href="javascript: delete_relation(' + relationsCount + ', ' + data +  ');">' +
-                                                '<?php echo html_print_image('images/cross.png', true); ?>' +
-                                            '</a>' +
-                                        '</td>' +
-                                    '</tr>';
+                                    '<td id="module_relations-' + relationsCount + '-0"><b>' + agent_b_name + '</b></td>' +
+                                    '<td id="module_relations-' + relationsCount + '-1">' + module_b_name + '</td>' +
+                                    '<td id="module_relations-' + relationsCount + '-2">' + relation_type + '</td>' +
+                                    '<td id="module_relations-' + relationsCount + '-3" style="width: 10%; text-align: center;">' +
+                                        '<a id="disable_updates_button" class="alpha50" href="javascript: change_lock_relation(' + relationsCount + ', ' + data + ');">' +
+                                            '<?php echo html_print_image('images/lock.png', true); ?>' +
+                                        '</a>' +
+                                    '</td>' +
+                                    '<td id="module_relations-' + relationsCount + '-4" style="width: 10%; text-align: center;">' +
+                                        '<a id="delete_relation_button" href="javascript: delete_relation(' + relationsCount + ', ' + data +  ');">' +
+                                            '<?php echo html_print_image('images/cross.png', true); ?>' +
+                                        '</a>' +
+                                    '</td>' +
+                                '</tr>';
                     $("#module_relations").find("tbody").append(rowHTML);
 
                     $("#hidden-module_relations_count").val(relationsCount + 1);
diff --git a/pandora_console/godmode/agentes/module_manager_editor_network.php b/pandora_console/godmode/agentes/module_manager_editor_network.php
index 306e5f9804..c0a6181a8e 100644
--- a/pandora_console/godmode/agentes/module_manager_editor_network.php
+++ b/pandora_console/godmode/agentes/module_manager_editor_network.php
@@ -506,45 +506,5 @@ $(document).ready (function () {
     });
 });
 
-// Show the SNMP browser window
-function snmpBrowserWindow () {
-    
-    // Keep elements in the form and the SNMP browser synced
-    $('#text-target_ip').val($('#text-ip_target').val());
-    $('#text-community').val($('#text-snmp_community').val());
-    $('#snmp_browser_version').val($('#snmp_version').val());
-    $('#text-snmp3_browser_auth_user').val($('#text-snmp3_auth_user').val());
-    $('#snmp3_browser_security_level').val($('#snmp3_security_level').val());
-    $('#snmp3_browser_auth_method').val($('#snmp3_auth_method').val());
-    $('#password-snmp3_browser_auth_pass').val($('#password-snmp3_auth_pass').val());
-    $('#snmp3_browser_privacy_method').val($('#snmp3_privacy_method').val());
-    $('#password-snmp3_browser_privacy_pass').val($('#password-snmp3_privacy_pass').val());
-    
-    $("#snmp_browser_container").show().dialog ({
-        title: '',
-        resizable: true,
-        draggable: true,
-        modal: true,
-        overlay: {
-            opacity: 0.5,
-            background: "black"
-        },
-        width: 920,
-        height: 500
-    });
-}
-
-// Set the form OID to the value selected in the SNMP browser
-function setOID () {
-    
-    if($('#snmp_browser_version').val() == '3'){
-        $('#text-snmp_oid').val($('#table1-0-1').text());
-    } else {
-        $('#text-snmp_oid').val($('#snmp_selected_oid').text());
-    }
-    
-    // Close the SNMP browser
-    $('.ui-dialog-titlebar-close').trigger('click');
-}
 
 </script>
diff --git a/pandora_console/godmode/agentes/module_manager_editor_wmi.php b/pandora_console/godmode/agentes/module_manager_editor_wmi.php
index 6ad7311179..09501c358b 100644
--- a/pandora_console/godmode/agentes/module_manager_editor_wmi.php
+++ b/pandora_console/godmode/agentes/module_manager_editor_wmi.php
@@ -83,8 +83,8 @@ $data[3] = html_print_input_password(
     true,
     $disabledBecauseInPolicy,
     false,
-    '',
-    $classdisabledBecauseInPolicy
+    $classdisabledBecauseInPolicy,
+    'new-password'
 );
 
 push_table_simple($data, 'user_pass');
diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php
index 961ea1f7d0..49a72f125d 100755
--- a/pandora_console/godmode/agentes/planned_downtime.list.php
+++ b/pandora_console/godmode/agentes/planned_downtime.list.php
@@ -52,7 +52,7 @@ if ($migrate_malformed) {
 
 // Header.
 ui_print_page_header(
-    __('Planned Downtime'),
+    __('Scheduled Downtime'),
     'images/gm_monitoring.png',
     false,
     'planned_downtime',
@@ -136,9 +136,6 @@ $table_form = new StdClass();
 $table_form->class = 'databox filters';
 $table_form->width = '100%';
 $table_form->rowstyle = [];
-$table_form->rowstyle[0] = 'background-color: #f9faf9;';
-$table_form->rowstyle[1] = 'background-color: #f9faf9;';
-$table_form->rowstyle[2] = 'background-color: #f9faf9;';
 $table_form->data = [];
 
 $row = [];
diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php
index ca3a099bf3..c97fe2feff 100644
--- a/pandora_console/godmode/alerts/alert_list.builder.php
+++ b/pandora_console/godmode/alerts/alert_list.builder.php
@@ -37,14 +37,10 @@ $table->head = [];
 $table->data = [];
 $table->size = [];
 $table->size = [];
-$table->size[0] = '5%';
-$table->size[1] = '25%';
-$table->size[2] = '5%';
-$table->size[3] = '20%';
-$table->style[0] = 'font-weight: bold; ';
-$table->style[1] = 'font-weight: bold; ';
-$table->style[2] = 'font-weight: bold; ';
-$table->style[3] = 'font-weight: bold; ';
+$table->style[0] = 'font-weight: bold;';
+$table->style[1] = 'font-weight: bold;display: flex;align-items: baseline;';
+$table->style[2] = 'font-weight: bold;';
+$table->style[3] = 'font-weight: bold;';
 
 // This is because if this view is reused after list alert view then
 // styles in the previous view can affect this table.
@@ -89,7 +85,7 @@ $table->data[0][1] = html_print_select(
     true,
     '',
     ($id_agente == 0),
-    'width: 250px;'
+    'min-width: 250px;margin-right: 0.5em;'
 );
 $table->data[0][1] .= ' <span id="latest_value" class="invisible">'.__('Latest value').': ';
 $table->data[0][1] .= '<span id="value">&nbsp;</span></span>';
@@ -117,7 +113,7 @@ $table->data[1][1] = html_print_select(
     true,
     '',
     false,
-    'width: 250px;'
+    'min-width: 250px;'
 );
 $table->data[1][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>';
 $table->data[1][1] .= __('Number of alerts match from').' ';
@@ -127,9 +123,9 @@ $table->data[1][1] .= html_print_input_text('fires_max', '', '', 4, 10, true);
 
 $table->data[1][1] .= '</span>';
 if (check_acl($config['id_user'], 0, 'LM')) {
-    $table->data[1][1] .= '<a style="margin-left:5px;" href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
+    $table->data[1][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
     $table->data[1][1] .= html_print_image('images/add.png', true);
-    $table->data[1][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Action').'</span>';
+    $table->data[1][1] .= '<span style="margin-left:0.5em;">'.__('Create Action').'</span>';
     $table->data[1][1] .= '</a>';
 }
 
@@ -162,13 +158,13 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
     if (check_acl($config['id_user'], 0, 'LM')) {
         $table->data[2][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
         $table->data[2][1] .= html_print_image('images/add.png', true);
-        $table->data[2][1] .= '<span style="margin-left:5px;vertical-align:middle;">'.__('Create Template').'</span>';
+        $table->data[2][1] .= '<span style="margin-left:0.5em;">'.__('Create Template').'</span>';
         $table->data[2][1] .= '</a>';
     }
 
     $table->data[3][0] = __('Threshold');
     $table->data[3][1] = html_print_input_text('module_action_threshold', '0', '', 5, 7, true);
-    $table->data[3][1] .= ' '.__('seconds');
+    $table->data[3][1] .= '<span style="margin-left:0.5em;">'.__('seconds').'</span>';
 
     if (!isset($step)) {
         echo '<form class="add_alert_form" method="post">';
diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php
index 4b3a3395cf..f830f47dbd 100644
--- a/pandora_console/godmode/alerts/alert_list.list.php
+++ b/pandora_console/godmode/alerts/alert_list.list.php
@@ -438,11 +438,11 @@ if (! $id_agente) {
     $table->style = [];
     $table->style[0] = 'font-weight: bold;';
     $table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
-    $table->size[0] = '4%';
-    $table->size[1] = '8%';
-    $table->size[2] = '8%';
-    $table->size[3] = '4%';
-    $table->size[4] = '4%';
+    $table->headstyle[0] = 'width: 100%; min-width: 12em;';
+    $table->headstyle[1] = 'min-width: 15em;';
+    $table->headstyle[2] = 'min-width: 20em;';
+    $table->headstyle[3] = 'min-width: 1em;';
+    $table->headstyle[4] = 'min-width: 15em;';
 
     /*
         if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
@@ -450,16 +450,11 @@ if (! $id_agente) {
     }*/
 } else {
     $table->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
-    // Different sizes or the layout screws up
-    $table->size[0] = '0%';
-    $table->size[1] = '10%';
-    $table->size[2] = '30%';
-    /*
-        if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
-        $table->size[4] = '25%';
-    }  */
-    $table->size[3] = '1%';
-    $table->size[4] = '1%';
+    $table->headstyle[0] = 'width: 100%; min-width: 15em;';
+    $table->headstyle[1] = 'min-width: 15em;';
+    $table->headstyle[2] = 'min-width: 20em;';
+    $table->headstyle[3] = 'min-width: 1em;';
+    $table->headstyle[4] = 'min-width: 15em;';
 }
 
 $table->head[1] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php
index 3b7b5a947d..8ea292445b 100644
--- a/pandora_console/godmode/alerts/configure_alert_action.php
+++ b/pandora_console/godmode/alerts/configure_alert_action.php
@@ -317,9 +317,9 @@ $(document).ready (function () {
         jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
             values,
             function (data, status) {
-                original_command = js_html_entity_decode (data["command"]);
+                original_command = data["command"];
                 render_command_preview (original_command);
-                command_description = js_html_entity_decode (data["description"]);
+                command_description = data["description"];
                 render_command_description(command_description);
                 
                 var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
diff --git a/pandora_console/godmode/events/custom_events.php b/pandora_console/godmode/events/custom_events.php
index 0bf3b223e2..fb4b6f9ab1 100644
--- a/pandora_console/godmode/events/custom_events.php
+++ b/pandora_console/godmode/events/custom_events.php
@@ -60,96 +60,12 @@ $fields_selected = explode(',', $config['event_fields']);
 
 $result_selected = [];
 
-// show list of fields selected.
+// Show list of fields selected.
 if ($fields_selected[0] != '') {
     foreach ($fields_selected as $field_selected) {
-        switch ($field_selected) {
-            case 'id_evento':
-                $result = __('Event Id');
-            break;
-
-            case 'evento':
-                $result = __('Event Name');
-            break;
-
-            case 'id_agente':
-                $result = __('Agent Name');
-            break;
-
-            case 'id_usuario':
-                $result = __('User');
-            break;
-
-            case 'id_grupo':
-                $result = __('Group');
-            break;
-
-            case 'estado':
-                $result = __('Status');
-            break;
-
-            case 'timestamp':
-                $result = __('Timestamp');
-            break;
-
-            case 'event_type':
-                $result = __('Event Type');
-            break;
-
-            case 'id_agentmodule':
-                $result = __('Module Name');
-            break;
-
-            case 'id_alert_am':
-                $result = __('Alert');
-            break;
-
-            case 'criticity':
-                $result = __('Severity');
-            break;
-
-            case 'user_comment':
-                $result = __('Comment');
-            break;
-
-            case 'tags':
-                $result = __('Tags');
-            break;
-
-            case 'source':
-                $result = __('Source');
-            break;
-
-            case 'id_extra':
-                $result = __('Extra Id');
-            break;
-
-            case 'owner_user':
-                $result = __('Owner');
-            break;
-
-            case 'ack_utimestamp':
-                $result = __('ACK Timestamp');
-            break;
-
-            case 'instructions':
-                $result = __('Instructions');
-            break;
-
-            case 'server_name':
-                $result = __('Server Name');
-            break;
-
-            case 'data':
-                $result = __('Data');
-            break;
-
-            case 'module_status':
-                $result = __('Module Status');
-            break;
-        }
-
-        $result_selected[$field_selected] = $result;
+        $result_selected[$field_selected] = events_get_column_name(
+            $field_selected
+        );
     }
 }
 
@@ -177,7 +93,8 @@ $fields_available = [];
 
 $fields_available['id_evento'] = __('Event Id');
 $fields_available['evento'] = __('Event Name');
-$fields_available['id_agente'] = __('Agent Name');
+$fields_available['id_agente'] = __('Agent ID');
+$fields_available['agent_name'] = __('Agent Name');
 $fields_available['id_usuario'] = __('User');
 $fields_available['id_grupo'] = __('Group');
 $fields_available['estado'] = __('Status');
@@ -196,20 +113,20 @@ $fields_available['instructions'] = __('Instructions');
 $fields_available['server_name'] = __('Server Name');
 $fields_available['data'] = __('Data');
 $fields_available['module_status'] = __('Module Status');
+$fields_available['mini_severity'] = __('Severity mini');
 
-// remove fields already selected
+
+// Remove fields already selected.
 foreach ($fields_available as $key => $available) {
-    foreach ($result_selected as $selected) {
-        if ($selected == $available) {
-            unset($fields_available[$key]);
-        }
+    if (isset($result_selected[$key])) {
+        unset($fields_available[$key]);
     }
 }
 
 $table->data[0][0] = '<b>'.__('Fields available').'</b>';
 $table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
 $table->data[1][1] = '<a href="javascript:">'.html_print_image(
-    'images/darrowright.png',
+    'images/darrowright_green.png',
     true,
     [
         'id'    => 'right',
@@ -217,7 +134,7 @@ $table->data[1][1] = '<a href="javascript:">'.html_print_image(
     ]
 ).'</a>';
 $table->data[1][1] .= '<br><br><br><br><a href="javascript:">'.html_print_image(
-    'images/darrowleft.png',
+    'images/darrowleft_green.png',
     true,
     [
         'id'    => 'left',
diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php
index b2b9763d56..e66e1d30b4 100644
--- a/pandora_console/godmode/events/event_edit_filter.php
+++ b/pandora_console/godmode/events/event_edit_filter.php
@@ -232,10 +232,17 @@ $table->data[0][0] = '<b>'.__('Filter name').'</b>';
 $table->data[0][1] = html_print_input_text('id_name', $id_name, false, 20, 80, true);
 
 $table->data[1][0] = '<b>'.__('Save in group').'</b>'.ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true);
+
+$returnAllGroup = users_can_manage_group_all();
+// If the user can't manage All group but the filter is for All group, the user should see All group in the select.
+if ($returnAllGroup === false && $id_group_filter == 0) {
+    $returnAllGroup = true;
+}
+
 $table->data[1][1] = html_print_select_groups(
     $config['id_user'],
     $access,
-    users_can_manage_group_all(),
+    $returnAllGroup,
     'id_group_filter',
     $id_group_filter,
     '',
diff --git a/pandora_console/godmode/events/event_filter.php b/pandora_console/godmode/events/event_filter.php
index 60ba973996..c9c3f7f226 100644
--- a/pandora_console/godmode/events/event_filter.php
+++ b/pandora_console/godmode/events/event_filter.php
@@ -93,10 +93,11 @@ if ($strict_acl) {
         users_can_manage_group_all()
     );
 } else {
+    // All users should see the filters with the All group.
     $groups_user = users_get_groups(
         $config['id_user'],
         $access,
-        users_can_manage_group_all(),
+        true,
         true
     );
 }
diff --git a/pandora_console/godmode/events/event_responses.editor.php b/pandora_console/godmode/events/event_responses.editor.php
index 1705605744..c514ded346 100644
--- a/pandora_console/godmode/events/event_responses.editor.php
+++ b/pandora_console/godmode/events/event_responses.editor.php
@@ -143,12 +143,12 @@ $table->data[3] = $data;
 
 $data = [];
 $data[0] = '<span id="command_label" class="labels">'.__('Command').'</span><span id="url_label" style="display:none;" class="labels">'.__('URL').'</span>'.ui_print_help_icon('response_macros', true);
-$data[1] = html_print_input_text(
+$data[1] = html_print_textarea(
     'target',
+    3,
+    1,
     $event_response['target'],
-    '',
-    100,
-    255,
+    'style="min-height:initial;"',
     true
 );
 
diff --git a/pandora_console/godmode/events/events.php b/pandora_console/godmode/events/events.php
index c937ad281c..72ae001fe1 100644
--- a/pandora_console/godmode/events/events.php
+++ b/pandora_console/godmode/events/events.php
@@ -50,17 +50,10 @@ if (check_acl($config['id_user'], 0, 'PM')) {
         'text'   => '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=responses&amp;pure='.$config['pure'].'">'.html_print_image('images/event_responses.png', true, ['title' => __('Event responses')]).'</a>',
     ];
 
-    if (!is_metaconsole()) {
-        $buttons['fields'] = [
-            'active' => false,
-            'text'   => '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=fields&amp;pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
-        ];
-    } else {
-        $buttons['fields'] = [
-            'active' => false,
-            'text'   => '<a href="index.php?sec=eventos&sec2=event/custom_events&amp;section=fields&amp;pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
-        ];
-    }
+    $buttons['fields'] = [
+        'active' => false,
+        'text'   => '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=fields&amp;pure='.$config['pure'].'">'.html_print_image('images/custom_columns.png', true, ['title' => __('Custom fields')]).'</a>',
+    ];
 }
 
 switch ($section) {
diff --git a/pandora_console/godmode/gis_maps/configure_gis_map.php b/pandora_console/godmode/gis_maps/configure_gis_map.php
index 0e632380ce..8277463e18 100644
--- a/pandora_console/godmode/gis_maps/configure_gis_map.php
+++ b/pandora_console/godmode/gis_maps/configure_gis_map.php
@@ -357,8 +357,8 @@ function addConnectionMap() {
     for (var index in connectionMaps) {
         if (isInt(index)) {
             if (connectionMaps[index] == idConnectionMap) {
-                alert("<?php echo __('The connection'); ?> "' + connectionMapName + '" <?php echo __('just added previously.'); ?>");
-                
+                alert("<?php echo __('The connection'); ?> " + connectionMapName + " <?php echo __('just added previously.'); ?>");
+
                 return;
             }
         }
diff --git a/pandora_console/godmode/groups/credential_store.php b/pandora_console/godmode/groups/credential_store.php
new file mode 100644
index 0000000000..3273e1c038
--- /dev/null
+++ b/pandora_console/godmode/groups/credential_store.php
@@ -0,0 +1,627 @@
+<?php
+/**
+ * Credentials management view.
+ *
+ * @category   Credentials management
+ * @package    Pandora FMS
+ * @subpackage Opensource
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
+
+// Begin.
+global $config;
+
+// Check access.
+check_login();
+
+if (! check_acl($config['id_user'], 0, 'PM')) {
+    db_pandora_audit(
+        'ACL Violation',
+        'Trying to access event viewer'
+    );
+
+    if (is_ajax()) {
+        return ['error' => 'noaccess'];
+    }
+
+    include 'general/noaccess.php';
+    return;
+}
+
+// Required files.
+ui_require_css_file('credential_store');
+require_once $config['homedir'].'/include/functions_credential_store.php';
+require_once $config['homedir'].'/include/functions_io.php';
+
+if (is_ajax()) {
+    $draw = get_parameter('draw', 0);
+    $filter = get_parameter('filter', []);
+    $get_key = get_parameter('get_key', 0);
+    $new_form = get_parameter('new_form', 0);
+    $new_key = get_parameter('new_key', 0);
+    $update_key = get_parameter('update_key', 0);
+    $delete_key = get_parameter('delete_key', 0);
+
+    if ($new_form) {
+        echo print_inputs();
+        exit;
+    }
+
+    if ($delete_key) {
+        $identifier = get_parameter('identifier', null);
+
+        if (empty($identifier)) {
+            ajax_msg('error', __('identifier cannot be empty'));
+        }
+
+        if (db_process_sql_delete(
+            'tcredential_store',
+            ['identifier' => $identifier]
+        ) === false
+        ) {
+            ajax_msg('error', $config['dbconnection']->error, true);
+        } else {
+            ajax_msg('result', $identifier, true);
+        }
+    }
+
+    if ($update_key) {
+        $data = get_parameter('values', null);
+
+        if ($data === null || !is_array($data)) {
+            echo json_encode(['error' => __('Invalid parameters, please retry')]);
+            exit;
+        }
+
+        $values = [];
+        foreach ($data as $key => $value) {
+            if ($key == 'identifier') {
+                $identifier = base64_decode($value);
+            } else if ($key == 'product') {
+                $product = base64_decode($value);
+            } else {
+                $values[$key] = base64_decode($value);
+            }
+        }
+
+        if (empty($identifier)) {
+            ajax_msg('error', __('identifier cannot be empty'));
+        }
+
+        if (empty($product)) {
+            ajax_msg('error', __('product cannot be empty'));
+        }
+
+        if (db_process_sql_update(
+            'tcredential_store',
+            $values,
+            ['identifier' => $identifier]
+        ) === false
+        ) {
+            ajax_msg('error', $config['dbconnection']->error);
+        } else {
+            ajax_msg('result', $identifier);
+        }
+
+        exit;
+    }
+
+    if ($new_key) {
+        $data = get_parameter('values', null);
+
+        if ($data === null || !is_array($data)) {
+            echo json_encode(['error' => __('Invalid parameters, please retry')]);
+            exit;
+        }
+
+        $values = [];
+        foreach ($data as $key => $value) {
+            $values[$key] = base64_decode($value);
+            if ($key == 'identifier') {
+                $values[$key] = preg_replace('/\s+/', '-', trim($values[$key]));
+            }
+        }
+
+        $identifier = $values['identifier'];
+
+        if (empty($identifier)) {
+            ajax_msg('error', __('identifier cannot be empty'));
+        }
+
+        if (empty($values['product'])) {
+            ajax_msg('error', __('product cannot be empty'));
+        }
+
+        if (db_process_sql_insert('tcredential_store', $values) === false) {
+            ajax_msg('error', $config['dbconnection']->error);
+        } else {
+            ajax_msg('result', $identifier);
+        }
+
+        exit;
+    }
+
+    if ($get_key) {
+        $identifier = get_parameter('identifier', null);
+
+        $key = get_key($identifier);
+        echo print_inputs($key);
+
+        exit;
+    }
+
+    if ($draw) {
+        // Datatables offset, limit and order.
+        $start = get_parameter('start', 0);
+        $length = get_parameter('length', $config['block_size']);
+        $order = get_datatable_order(true);
+        try {
+            ob_start();
+
+            $fields = [
+                'cs.*',
+                'tg.nombre as `group`',
+            ];
+
+            // Retrieve data.
+            $data = credentials_get_all(
+                // Fields.
+                $fields,
+                // Filter.
+                $filter,
+                // Offset.
+                $start,
+                // Limit.
+                $length,
+                // Order.
+                $order['direction'],
+                // Sort field.
+                $order['field']
+            );
+
+            // Retrieve counter.
+            $count = credentials_get_all(
+                'count',
+                $filter
+            );
+
+            if ($data) {
+                $data = array_reduce(
+                    $data,
+                    function ($carry, $item) {
+                        // Transforms array of arrays $data into an array
+                        // of objects, making a post-process of certain fields.
+                        $tmp = (object) $item;
+                        $tmp->username = io_safe_output($tmp->username);
+
+                        if (empty($tmp->group)) {
+                            $tmp->group = __('All');
+                        } else {
+                            $tmp->group = io_safe_output($tmp->group);
+                        }
+
+                        $carry[] = $tmp;
+                        return $carry;
+                    }
+                );
+            }
+
+            // Datatables format: RecordsTotal && recordsfiltered.
+            echo json_encode(
+                [
+                    'data'            => $data,
+                    'recordsTotal'    => $count,
+                    'recordsFiltered' => $count,
+                ]
+            );
+            // Capture output.
+            $response = ob_get_clean();
+        } catch (Exception $e) {
+            return json_encode(['error' => $e->getMessage()]);
+        }
+
+        // If not valid, show error with issue.
+        json_decode($response);
+        if (json_last_error() == JSON_ERROR_NONE) {
+            // If valid dump.
+            echo $response;
+        } else {
+            echo json_encode(
+                ['error' => $response]
+            );
+        }
+
+
+        exit;
+    }
+
+    exit;
+}
+
+// Datatables list.
+try {
+    $columns = [
+        'group',
+        'identifier',
+        'product',
+        'username',
+        'options',
+    ];
+
+    $column_names = [
+        __('Group'),
+        __('Identifier'),
+        __('Product'),
+        __('User'),
+        [
+            'text'  => __('Options'),
+            'class' => 'action_buttons',
+        ],
+    ];
+
+    $table_id = 'keystore';
+    // Load datatables user interface.
+    ui_print_datatable(
+        [
+            'id'                  => $table_id,
+            'class'               => 'info_table',
+            'style'               => 'width: 100%',
+            'columns'             => $columns,
+            'column_names'        => $column_names,
+            'ajax_url'            => 'godmode/groups/credential_store',
+            'ajax_postprocess'    => 'process_datatables_item(item)',
+            'no_sortable_columns' => [-1],
+            'order'               => [
+                'field'     => 'identifier',
+                'direction' => 'asc',
+            ],
+            'search_button_class' => 'sub filter float-right',
+            'form'                => [
+                'inputs' => [
+                    [
+                        'label'   => __('Group'),
+                        'type'    => 'select',
+                        'id'      => 'filter_id_group',
+                        'name'    => 'filter_id_group',
+                        'options' => users_get_groups_for_select(
+                            $config['id_user'],
+                            'AR',
+                            true,
+                            true,
+                            false
+                        ),
+                    ],
+                    [
+                        'label' => __('Free search'),
+                        'type'  => 'text',
+                        'class' => 'mw250px',
+                        'id'    => 'free_search',
+                        'name'  => 'free_search',
+                    ],
+                ],
+            ],
+        ]
+    );
+} catch (Exception $e) {
+    echo $e->getMessage();
+}
+
+// Auxiliar div.
+$new = '<div id="new_key" style="display: none"><form id="form_new">';
+$new .= '</form></div>';
+$details = '<div id="info_key" style="display: none"><form id="form_update">';
+$details .= '</form></div>';
+$aux = '<div id="aux" style="display: none"></div>';
+
+
+echo $new.$details.$aux;
+
+// Create button.
+echo '<div class="w100p flex-content-right">';
+html_print_submit_button(
+    __('Add key'),
+    'create',
+    false,
+    'class="sub next"'
+);
+echo '</div>';
+
+?>
+
+<script type="text/javascript">
+    function process_datatables_item(item) {
+        item.options = '<a href="javascript:" onclick="display_key(\'';
+        item.options += item.identifier;
+        item.options += '\')" ><?php echo html_print_image('images/eye.png', true, ['title' => __('Show')]); ?></a>';
+
+        item.options += '<a href="javascript:" onclick="delete_key(\'';
+        item.options += item.identifier;
+        item.options += '\')" ><?php echo html_print_image('images/cross.png', true, ['title' => __('Delete')]); ?></a>';
+    }
+
+    function handle_response(data) {
+        var title = "<?php echo __('Success'); ?>";
+        var text = '';
+        var failed = 0;
+        try {
+            data = JSON.parse(data);
+            text = data['result'];
+        } catch (err) {
+            title =  "<?php echo __('Failed'); ?>";
+            text = err.message;
+            failed = 1;
+        }
+        if (!failed && data['error'] != undefined) {
+            title =  "<?php echo __('Failed'); ?>";
+            text = data['error'];
+            failed = 1;
+        }
+
+        $('#aux').empty();
+        $('#aux').html(text);
+        $('#aux').dialog({
+            width: 450,
+            position: {
+                my: 'center',
+                at: 'center',
+                of: window,
+                collision: 'fit'
+            },
+            title: title,
+            buttons: [
+                {
+                    text: 'OK',
+                    click: function(e) {
+                        if (!failed) {
+                            dt_<?php echo $table_id; ?>.draw(0);
+                            $(".ui-dialog-content").dialog("close");
+                            cleanupDOM();
+                        } else {
+                            $(this).dialog('close');
+                        }
+                    }
+                }
+            ]
+        });
+    }
+    
+    function delete_key(id) {
+        $('#aux').empty();
+        $('#aux').text('<?php echo __('Are you sure?'); ?>');
+        $('#aux').dialog({
+            title: '<?php echo __('Delete'); ?> ' + id,
+            buttons: [
+                {
+                    class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
+                    text: '<?php echo __('Cancel'); ?>',
+                    click: function(e) {
+                        $(this).dialog('close');
+                        cleanupDOM();
+
+                    }
+                },
+                {
+                    text: 'Delete',
+                    class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
+                    click: function(e) {
+                        $.ajax({
+                            method: 'post',
+                            url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
+                            data: {
+                                page: 'godmode/groups/credential_store',
+                                delete_key: 1,
+                                identifier: id
+                            },
+                            datatype: "json",
+                            success: function (data) {
+                                handle_response(data);
+                            },
+                            error: function(e) {
+                                handle_response(e);
+                            }
+                        });
+                    }
+                }
+            ]
+        });
+    }
+
+    function display_key(id) {
+        $('#form_update').empty();
+        $('#form_update').html('Loading...');
+        $.ajax({
+            method: 'post',
+            url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
+            data: {
+                page: 'godmode/groups/credential_store',
+                get_key: 1,
+                identifier: id
+            },
+            success: function (data) {
+                $('#info_key').dialog({
+                    width: 580,
+                    height: 400,
+                    position: {
+                        my: 'center',
+                        at: 'center',
+                        of: window,
+                        collision: 'fit'
+                    },
+                    title: id,
+                    buttons: [
+                        {
+                            class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
+                            text: '<?php echo __('Cancel'); ?>',
+                            click: function(e) {
+                                $(this).dialog('close');
+                                cleanupDOM();
+                            }
+                        },
+                        {
+                            text: 'Update',
+                            class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
+                            click: function(e) {
+                                var values = {};
+
+                                $('#form_update :input').each(function() {
+                                    values[this.name] = btoa($(this).val());
+                                });
+
+                                $.ajax({
+                                    method: 'post',
+                                    url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
+                                    data: {
+                                        page: 'godmode/groups/credential_store',
+                                        update_key: 1,
+                                        values: values
+                                    },
+                                    datatype: "json",
+                                    success: function (data) {
+                                        handle_response(data);
+                                    },
+                                    error: function(e) {
+                                        handle_response(e);
+                                    }
+                                });
+                            }
+                        }
+                    ]
+                });
+                $('#form_update').html(data);
+            }
+
+        })
+    }
+
+    function cleanupDOM() {
+        $('#div-identifier').empty();
+        $('#div-product').empty();
+        $('#div-username').empty();
+        $('#div-password').empty();
+        $('#div-extra_1').empty();
+        $('#div-extra_2').empty();
+    }
+
+    function calculate_inputs() {
+        if ($('#product :selected').val() == "CUSTOM") {
+            $('#div-username label').text('<?php echo __('User'); ?>');
+            $('#div-password label').text('<?php echo __('Password'); ?>');
+            $('#div-extra_1').hide();
+            $('#div-extra_2').hide();
+        } else if ($('#product :selected').val() == "AWS") {
+            $('#div-username label').text('<?php echo __('Access key ID'); ?>');
+            $('#div-password label').text('<?php echo __('Secret access key'); ?>');
+            $('#div-extra_1').hide();
+            $('#div-extra_2').hide();
+        } else if ($('#product :selected').val() == "AZURE") {
+            $('#div-username label').text('<?php echo __('Client ID'); ?>');
+            $('#div-password label').text('<?php echo __('Application secret'); ?>');
+            $('#div-extra_1 label').text('<?php echo __('Tenant or domain name'); ?>');
+            $('#div-extra_2 label').text('<?php echo __('Subscription id'); ?>');
+            $('#div-extra_1').show();
+            $('#div-extra_2').show();
+        } 
+    }
+
+    function add_key() {
+        // Clear form.
+        $('#form_update').empty();
+        $('#form_update').html('Loading...');
+        $.ajax({
+            method: 'post',
+            url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
+            data: {
+                page: 'godmode/groups/credential_store',
+                new_form: 1
+            },
+            success: function(data) {
+                $('#form_new').html(data);
+                $('#id_group').val(0);
+                // By default CUSTOM.
+                $('#product').val('CUSTOM');
+                calculate_inputs();
+
+                $('#product').on('change', function() {
+                    calculate_inputs()
+                });
+
+                // Show form.
+                $('#new_key').dialog({
+                    width: 580,
+                    height: 400,
+                    position: {
+                        my: 'center',
+                        at: 'center',
+                        of: window,
+                        collision: 'fit'
+                    },
+                    title: "<?php echo __('Register new key into keystore'); ?>",
+                    buttons: [
+                        {
+                            class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
+                            text: "<?php echo __('Cancel'); ?>",
+                            click: function(e) {
+                                $(this).dialog('close');
+                                cleanupDOM();
+                            }
+                        },
+                        {
+                            class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
+                            text: 'OK',
+                            click: function(e) {
+                                var values = {};
+                                $('#form_new :input').each(function() {
+                                    values[this.name] = btoa($(this).val());
+                                });
+
+                                $.ajax({
+                                    method: 'post',
+                                    url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
+                                    data: {
+                                        page: 'godmode/groups/credential_store',
+                                        new_key: 1,
+                                        values: values
+                                    },
+                                    datatype: "json",
+                                    success: function (data) {
+                                        handle_response(data);
+                                    },
+                                    error: function(e) {
+                                        handle_response(e);
+                                    }
+                                });
+                            }
+                        },
+                    ]
+                });
+            }
+        })
+
+
+    }
+    $(document).ready(function(){
+
+        $("#submit-create").on('click', function(){
+            add_key();
+        });
+    });
+
+</script>
diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php
index ee61cdaf79..8cb3c106c1 100644
--- a/pandora_console/godmode/groups/group_list.php
+++ b/pandora_console/godmode/groups/group_list.php
@@ -1,20 +1,36 @@
 <?php
+/**
+ * Group management view.
+ *
+ * @category   Group View
+ * @package    Pandora FMS
+ * @subpackage Opensource
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation for version 2.
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
+// Begin.
 ui_require_css_file('tree');
 ui_require_css_file('fixed-bottom-box');
 
-// Load global vars
+// Load global vars.
 global $config;
 
 check_login();
@@ -76,15 +92,17 @@ if (is_ajax()) {
         $recursion = (int) get_parameter('recursion', 0);
         $privilege = (string) get_parameter('privilege', '');
         $all_agents = (int) get_parameter('all_agents', 0);
-        // Is is possible add keys prefix to avoid auto sorting in js object conversion
+        // Is is possible add keys prefix to avoid auto sorting in
+        // js object conversion.
         $keys_prefix = (string) get_parameter('keys_prefix', '');
-        // This attr is for the operation "bulk alert accions add", it controls the query that take the agents
-        // from db
+        // This attr is for the operation "bulk alert accions add", it controls
+        // the query that take the agents from db.
         $add_alert_bulk_op = get_parameter('add_alert_bulk_op', false);
-        // Ids of agents to be include in the SQL clause as id_agent IN ()
+        // Ids of agents to be include in the SQL clause as id_agent IN ().
         $filter_agents_json = (string) get_parameter('filter_agents_json', '');
         $status_agents = (int) get_parameter('status_agents', AGENT_STATUS_ALL);
-        // Juanma (22/05/2014) Fix: If setted remove void agents from result (by default and for compatibility show void agents)
+        // Juanma (22/05/2014) Fix: If setted remove void agents from result
+        // (by default and for compatibility show void agents).
         $show_void_agents = (int) get_parameter('show_void_agents', 1);
         $serialized = (bool) get_parameter('serialized', false);
         $serialized_separator = (string) get_parameter('serialized_separator', '|');
@@ -121,7 +139,7 @@ if (is_ajax()) {
             $filter['status'] = $status_agents;
         }
 
-        // Juanma (22/05/2014) Fix: If remove void agents setted
+        // Juanma (22/05/2014) Fix: If remove void agents set.
         $_sql_post = ' 1=1 ';
         if ($show_void_agents == 0) {
             $_sql_post .= ' AND id_agente IN (SELECT a.id_agente FROM tagente a, tagente_modulo b WHERE a.id_agente=b.id_agente AND b.delete_pending=0) AND \'1\'';
@@ -131,8 +149,9 @@ if (is_ajax()) {
         $id_groups_get_agents = $id_group;
         if ($id_group == 0 && $privilege != '') {
             $groups = users_get_groups($config['id_user'], $privilege, false);
-            // if group ID doesn't matter and $privilege is specified (like 'AW'),
-            // retruns all agents that current user has $privilege privilege for.
+            // If group ID doesn't matter and $privilege is specified
+            // (like 'AW'), retruns all agents that current user has $privilege
+            // privilege for.
             $id_groups_get_agents = array_keys($groups);
         }
 
@@ -149,13 +168,13 @@ if (is_ajax()) {
         );
 
         $agents_disabled = [];
-        // Add keys prefix
+        // Add keys prefix.
         if ($keys_prefix !== '') {
             foreach ($agents as $k => $v) {
                 $agents[$keys_prefix.$k] = $v;
                 unset($agents[$k]);
                 if ($all_agents) {
-                    // Unserialize to get the status
+                    // Unserialize to get the status.
                     if ($serialized && is_metaconsole()) {
                         $agent_info = explode($serialized_separator, $k);
                         $agent_disabled = db_get_value_filter(
@@ -174,7 +193,8 @@ if (is_ajax()) {
                             ['id_agente' => $agent_info[1]]
                         );
                     } else if (!$serialized && is_metaconsole()) {
-                        // Cannot retrieve the disabled status. Mark all as not disabled
+                        // Cannot retrieve the disabled status.
+                        // Mark all as not disabled.
                         $agent_disabled = 0;
                     } else {
                         $agent_disabled = db_get_value_filter(
@@ -226,11 +246,13 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
 }
 
 $sec = defined('METACONSOLE') ? 'advanced' : 'gagente';
-$url_tree  = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=tree";
-$url_groups = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=groups";
+$url_credbox  = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=credbox';
+$url_tree  = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=tree';
+$url_groups = 'index.php?sec='.$sec.'&sec2=godmode/groups/group_list&tab=groups';
+
 $buttons['tree'] = [
     'active' => false,
-    'text'   => "<a href='$url_tree'>".html_print_image(
+    'text'   => '<a href="'.$url_tree.'">'.html_print_image(
         'images/gm_massive_operations.png',
         true,
         [
@@ -241,7 +263,7 @@ $buttons['tree'] = [
 
 $buttons['groups'] = [
     'active' => false,
-    'text'   => "<a href='$url_groups'>".html_print_image(
+    'text'   => '<a href="'.$url_groups.'">'.html_print_image(
         'images/group.png',
         true,
         [
@@ -250,21 +272,38 @@ $buttons['groups'] = [
     ).'</a>',
 ];
 
+$buttons['credbox'] = [
+    'active' => false,
+    'text'   => '<a href="'.$url_credbox.'">'.html_print_image(
+        'images/key.png',
+        true,
+        [
+            'title' => __('Credential Store'),
+        ]
+    ).'</a>',
+];
+
 $tab = (string) get_parameter('tab', 'groups');
 
-// Marks correct tab
+$title = __('Groups defined in %s', get_product_name());
+// Marks correct tab.
 switch ($tab) {
     case 'tree':
         $buttons['tree']['active'] = true;
     break;
 
+    case 'credbox':
+        $buttons['credbox']['active'] = true;
+        $title = __('Credential store');
+    break;
+
     case 'groups':
     default:
         $buttons['groups']['active'] = true;
     break;
 }
 
-// Header
+// Header.
 if (defined('METACONSOLE')) {
     agents_meta_print_header();
     echo '<div class="notify">';
@@ -272,7 +311,7 @@ if (defined('METACONSOLE')) {
     echo '</div>';
 } else {
     ui_print_page_header(
-        __('Groups defined in %s', get_product_name()),
+        $title,
         'images/group.png',
         false,
         'group_list_tab',
@@ -281,12 +320,19 @@ if (defined('METACONSOLE')) {
     );
 }
 
+// Load credential store view before parse list-tree forms.
+if ($tab == 'credbox') {
+    include_once __DIR__.'/credential_store.php';
+    // Stop script.
+    return;
+}
+
 $create_group = (bool) get_parameter('create_group');
 $update_group = (bool) get_parameter('update_group');
 $delete_group = (bool) get_parameter('delete_group');
 $pure = get_parameter('pure', 0);
 
-// Create group
+// Create group.
 if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
     $name = (string) get_parameter('name');
     $icon = (string) get_parameter('icon');
@@ -301,7 +347,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
     $check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
     $propagate = (bool) get_parameter('propagate');
 
-    // Check if name field is empty
+    // Check if name field is empty.
     if ($name != '') {
         if (!$check) {
             $values = [
@@ -328,12 +374,11 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
             ui_print_error_message(__('Each group must have a different name'));
         }
     } else {
-        // $result = false;
         ui_print_error_message(__('Group must have a name'));
     }
 }
 
-// Update group
+// Update group.
 if ($update_group) {
     $id_group = (int) get_parameter('id_group');
     $name = (string) get_parameter('name');
@@ -349,49 +394,35 @@ if ($update_group) {
     $contact = (string) get_parameter('contact');
     $other = (string) get_parameter('other');
 
-    // Check if name field is empty
+    // Check if name field is empty.
     if ($name != '') {
-        switch ($config['dbtype']) {
-            case 'mysql':
-                $sql = sprintf(
-                    'UPDATE tgrupo  SET nombre = "%s",
-					icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s", contact = "%s", other = "%s", password = "%s"
-					WHERE id_grupo = %d',
-                    $name,
-                    empty($icon) ? '' : substr($icon, 0, -4),
-                    !$alerts_enabled,
-                    $id_parent,
-                    $custom_id,
-                    $propagate,
-                    $skin,
-                    $description,
-                    $contact,
-                    $other,
-                    $group_pass,
-                    $id_group
-                );
-            break;
-
-            case 'postgresql':
-            case 'oracle':
-                $sql = sprintf(
-                    'UPDATE tgrupo  SET nombre = \'%s\',
-					icon = \'%s\', disabled = %d, parent = %d, custom_id = \'%s\', propagate = %d, id_skin = %d, description = \'%s\', contact = \'%s\', other = \'%s\'
-					WHERE id_grupo = %d',
-                    $name,
-                    substr($icon, 0, -4),
-                    !$alerts_enabled,
-                    $id_parent,
-                    $custom_id,
-                    $propagate,
-                    $skin,
-                    $description,
-                    $contact,
-                    $other,
-                    $id_group
-                );
-            break;
-        }
+        $sql = sprintf(
+            'UPDATE tgrupo
+             SET nombre = "%s",
+                icon = "%s",
+                disabled = %d,
+                parent = %d,
+                custom_id = "%s",
+                propagate = %d,
+                id_skin = %d,
+                description = "%s",
+                contact = "%s",
+                other = "%s",
+                password = "%s"
+            WHERE id_grupo = %d',
+            $name,
+            empty($icon) ? '' : substr($icon, 0, -4),
+            !$alerts_enabled,
+            $id_parent,
+            $custom_id,
+            $propagate,
+            $skin,
+            $description,
+            $contact,
+            $other,
+            $group_pass,
+            $id_group
+        );
 
         $result = db_process_sql($sql);
     } else {
@@ -405,7 +436,7 @@ if ($update_group) {
     }
 }
 
-// Delete group
+// Delete group.
 if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
     $id_group = (int) get_parameter('id_group');
 
@@ -445,7 +476,14 @@ if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
     }
 }
 
+
+// Credential store is loaded previously in this document to avoid
+// process group tree - list forms.
 if ($tab == 'tree') {
+    /*
+     * Group tree view.
+     */
+
     echo html_print_image(
         'images/spinner.gif',
         true,
@@ -456,6 +494,10 @@ if ($tab == 'tree') {
     );
     echo "<div id='tree-controller-recipient'></div>";
 } else {
+    /*
+     * Group list view.
+     */
+
     $acl = '';
     $search_name = '';
     $offset = (int) get_parameter('offset', 0);
@@ -463,17 +505,22 @@ if ($tab == 'tree') {
     $block_size = $config['block_size'];
 
     if (!empty($search)) {
-        $search_name = "AND t.nombre LIKE '%$search%'";
+        $search_name = 'AND t.nombre LIKE "%'.$search.'%"';
     }
 
     if (!users_can_manage_group_all('AR')) {
         $user_groups_acl = users_get_groups(false, 'AR');
         $groups_acl = implode(',', $user_groups_ACL);
         if (empty($groups_acl)) {
-            return ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups') ]);
+            return ui_print_info_message(
+                [
+                    'no_close' => true,
+                    'message'  => __('There are no defined groups'),
+                ]
+            );
         }
 
-        $acl = "AND t.id_grupo IN ($groups_acl)";
+        $acl = 'AND t.id_grupo IN ('.$groups_acl.')';
     }
 
     $form = "<form method='post' action=''>";
@@ -488,29 +535,37 @@ if ($tab == 'tree') {
 
     echo $form;
 
-    $groups_sql = "SELECT t.*,
+    $groups_sql = sprintf(
+        'SELECT t.*,
 			p.nombre  AS parent_name,
 			IF(t.parent=p.id_grupo, 1, 0) AS has_child
-		FROM tgrupo t
-		LEFT JOIN tgrupo p
+		 FROM tgrupo t
+		 LEFT JOIN tgrupo p
 			ON t.parent=p.id_grupo
-		WHERE 1=1
-		$acl
-		$search_name
+		 WHERE 1=1
+		 %s
+         %s
 		ORDER BY nombre
-		LIMIT $offset, $block_size
-	";
+        LIMIT %d, %d',
+        $acl,
+        $search_name,
+        $offset,
+        $block_size
+    );
 
     $groups = db_get_all_rows_sql($groups_sql);
 
     if (!empty($groups)) {
-        // Count all groups for pagination only saw user and filters
-        $groups_sql_count = "SELECT count(*)
+        // Count all groups for pagination only saw user and filters.
+        $groups_sql_count = sprintf(
+            'SELECT count(*)
 			FROM tgrupo t
 			WHERE 1=1
-			$acl
-			$search_name
-		";
+            %s
+            %s',
+            $acl,
+            $search_name
+        );
         $groups_count = db_get_value_sql($groups_sql_count);
 
         $table = new StdClass();
@@ -545,7 +600,7 @@ if ($tab == 'tree') {
             $url = 'index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'];
             $url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'];
             $table->data[$key][0] = $group['id_grupo'];
-            $table->data[$key][1] = "<a href='$url'>".$group['nombre'].'</a>';
+            $table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>';
             if ($group['icon'] != '') {
                 $table->data[$key][2] = html_print_image(
                     'images/groups_small/'.$group['icon'].'.png',
@@ -553,22 +608,25 @@ if ($tab == 'tree') {
                     [
                         'style' => '',
                         'class' => 'bot',
-                        'alt' => $group['nombre'],
+                        'alt'   => $group['nombre'],
                         'title' => $group['nombre'],
-                        false, false, false, true
-                    ]
+                    ],
+                    false,
+                    false,
+                    false,
+                    true
                 );
             } else {
                 $table->data[$key][2] = '';
             }
 
 
-            // reporting_get_group_stats
-            $table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled');
+            // Reporting_get_group_stats.
+            $table->data[$key][3] = ($group['disabled']) ? __('Disabled') : __('Enabled');
             $table->data[$key][4] = $group['parent_name'];
             $table->data[$key][5] = $group['description'];
             $table->cellclass[$key][6] = 'action_buttons';
-            $table->data[$key][6] = "<a href='$url'>".html_print_image(
+            $table->data[$key][6] = '<a href="'.$url.'">'.html_print_image(
                 'images/config.png',
                 true,
                 [
diff --git a/pandora_console/godmode/massive/massive_add_profiles.php b/pandora_console/godmode/massive/massive_add_profiles.php
index 6000dbe9a6..e337c09f81 100644
--- a/pandora_console/godmode/massive/massive_add_profiles.php
+++ b/pandora_console/godmode/massive/massive_add_profiles.php
@@ -84,7 +84,9 @@ if ($create_profiles) {
     );
 }
 
-html_print_table($table);
+if ($table !== null) {
+    html_print_table($table);
+}
 
 unset($table);
 
diff --git a/pandora_console/godmode/massive/massive_copy_modules.php b/pandora_console/godmode/massive/massive_copy_modules.php
index b79a64460e..36ab0c310c 100755
--- a/pandora_console/godmode/massive/massive_copy_modules.php
+++ b/pandora_console/godmode/massive/massive_copy_modules.php
@@ -177,6 +177,9 @@ $table->data['operations'][1] .= html_print_checkbox('copy_alerts', 1, true, tru
 $table->data['operations'][1] .= html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true);
 $table->data['operations'][1] .= '</span>';
 
+$table->data['form_modules_filter'][0] = __('Filter Modules');
+$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
+
 $table->data[1][0] = __('Modules');
 $table->data[1][1] = '<span class="with_modules'.(empty($modules) ? ' invisible' : '').'">';
 $table->data[1][1] .= html_print_select(
@@ -270,6 +273,9 @@ $table->data[1][1] = html_print_select(
     true
 );
 
+$table->data['form_agents_filter'][0] = __('Filter Agents');
+$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
+
 $table->data[2][0] = __('Agent');
 $table->data[2][0] .= '<span id="destiny_agent_loading" class="invisible">';
 $table->data[2][0] .= html_print_image('images/spinner.png', true);
@@ -302,6 +308,8 @@ echo '<h3 class="error invisible" id="message">&nbsp;</h3>';
 ui_require_jquery_file('form');
 ui_require_jquery_file('pandora.controls');
 ?>
+
+<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
 <script type="text/javascript">
 /* <![CDATA[ */
 var module_alerts;
@@ -349,6 +357,11 @@ $(document).ready (function () {
             /* Hide source agent */
             var selected_agent = $("#source_id_agent").val();
             $("#destiny_id_agent option[value='" + selected_agent + "']").remove();
+        },
+        callbackAfter:function() {
+            //Filter agents. Call the function when the select is fully loaded.
+            var textNoData = "<?php echo __('None'); ?>";
+            filterByText($('#destiny_id_agent'), $("#text-filter_agents"), textNoData);
         }
     });
     
@@ -450,13 +463,14 @@ $(document).ready (function () {
                             $("#fieldset_destiny").hide ();
                             
                             $("span.without_modules, span.without_alerts").show ();
-                            $("span.with_modules, span.with_alerts, #target_table-operations").hide ();
+                            $("span.with_modules, span.with_alerts, #target_table-operations, #target_table-form_modules_filter").hide ();
                         }
                         else {
                             if (no_modules) {
                                 $("span.without_modules").show ();
                                 $("span.with_modules").hide ();
                                 $("#checkbox-copy_modules").uncheck ();
+                                $("#target_table-form_modules_filter").hide ();
                             }
                             else {
                                 $("span.without_modules").hide ();
@@ -474,10 +488,13 @@ $(document).ready (function () {
                                 $("span.with_alerts").show ();
                                 $("#checkbox-copy_alerts").check ();
                             }
-                            $("#fieldset_destiny, #target_table-operations").show ();
+                            $("#fieldset_destiny, #target_table-operations, #target_table-form_modules_filter").show ();
                         }
                         $("#fieldset_targets").show ();
                         $("#target_modules, #target_alerts").enable ();
+                        //Filter modules. Call the function when the select is fully loaded.
+                        var textNoData = "<?php echo __('None'); ?>";
+                        filterByText($('#target_modules'), $("#text-filter_modules"), textNoData);
                     },
                     "json"
                 );
diff --git a/pandora_console/godmode/massive/massive_delete_alerts.php b/pandora_console/godmode/massive/massive_delete_alerts.php
index 862d54bbbc..d7f316fd4d 100755
--- a/pandora_console/godmode/massive/massive_delete_alerts.php
+++ b/pandora_console/godmode/massive/massive_delete_alerts.php
@@ -31,6 +31,7 @@ require_once $config['homedir'].'/include/functions_users.php';
 if (is_ajax()) {
     $get_agents = (bool) get_parameter('get_agents');
     $recursion = (int) get_parameter('recursion');
+    $disabled_modules = (int) get_parameter('disabled_modules');
 
     if ($get_agents) {
         $id_group = (int) get_parameter('id_group');
@@ -44,12 +45,18 @@ if (is_ajax()) {
             $groups = [$id_group];
         }
 
+        if ($disabled_modules == 0) {
+            $filter['tagente_modulo.disabled'] = '<> 1';
+        } else {
+            unset($filter['tagente_modulo.disabled']);
+        }
+
         $agents_alerts = [];
         foreach ($groups as $group) {
             $agents_alerts_one_group = alerts_get_agents_with_alert_template(
                 $id_alert_template,
                 $group,
-                false,
+                $filter,
                 [
                     'tagente.alias',
                     'tagente.id_agente',
@@ -253,6 +260,11 @@ $table->data[1][1] = html_print_select_groups(
     '',
     $id_alert_template == 0
 );
+
+$table->data[0][2] = __('Show alerts on disabled modules');
+$table->data[0][3] = html_print_checkbox('disabled_modules', 1, false, true, false);
+
+
 $table->data[1][2] = __('Group recursion');
 $table->data[1][3] = html_print_checkbox('recursion', 1, false, true, false);
 
@@ -360,6 +372,7 @@ $(document).ready (function () {
             "get_agents" : 1,
             "id_group" : this.value,
             "recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0,
+            "disabled_modules" : $("#checkbox-disabled_modules").is(":checked") ? 1 : 0,
             "id_alert_template" : $("#id_alert_template").val(),
             // Add a key prefix to avoid auto sorting in js object conversion
             "keys_prefix" : "_"
@@ -387,6 +400,10 @@ $(document).ready (function () {
     $("#modules_selection_mode").change (function() {
         $("#id_agents").trigger('change');
     });
+
+    $("#checkbox-disabled_modules").click(function () {
+        $("#id_group").trigger("change");
+    });
 });
 /* ]]> */
 </script>
diff --git a/pandora_console/godmode/massive/massive_delete_modules.php b/pandora_console/godmode/massive/massive_delete_modules.php
index 334669c2bf..7d8d64141a 100755
--- a/pandora_console/godmode/massive/massive_delete_modules.php
+++ b/pandora_console/godmode/massive/massive_delete_modules.php
@@ -429,6 +429,11 @@ $table->data['form_modules_3'][1] = html_print_select(
 );
 $table->data['form_modules_3'][3] = '';
 
+$table->rowstyle['form_modules_filter'] = 'vertical-align: top;';
+$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2';
+$table->data['form_modules_filter'][0] = __('Filter Modules');
+$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
+
 $table->rowstyle['form_modules_2'] = 'vertical-align: top;';
 $table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
 $table->data['form_modules_2'][0] = __('Modules');
@@ -496,6 +501,11 @@ $table->data['form_agents_4'][1] = html_print_select(
     true
 );
 
+$table->rowstyle['form_agents_filter'] = 'vertical-align: top;';
+$table->rowclass['form_agents_filter'] = 'select_agents_row select_agents_row_2';
+$table->data['form_agents_filter'][0] = __('Filter Agents');
+$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
+
 $table->rowstyle['form_agents_3'] = 'vertical-align: top;';
 $table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
 $table->data['form_agents_3'][0] = __('Agents');
@@ -571,6 +581,7 @@ if ($selection_mode == 'modules') {
 }
 ?>
 
+<script type="text/javascript" src="include/javascript/pandora_modules.js"></script>
 <script type="text/javascript">
 /* <![CDATA[ */
 
@@ -650,6 +661,9 @@ $(document).ready (function () {
                 });
                 $("#module_loading").hide();
                 $("#module_name").removeAttr ("disabled");
+                //Filter modules. Call the function when the select is fully loaded.
+                var textNoData = "<?php echo __('None'); ?>";
+                filterByText($('#module_name'), $("#text-filter_modules"), textNoData);
             },
             "json"
         );
@@ -754,6 +768,9 @@ $(document).ready (function () {
                             .html (value["alias"]);
                         $("#id_agents").append (option);
                     });
+                    //Filter agents. Call the function when the select is fully loaded.
+                    var textNoData = "<?php echo __('None'); ?>";
+                    filterByText($('#id_agents'), $("#text-filter_agents"), textNoData);
                 },
                 "json"
             );
diff --git a/pandora_console/godmode/massive/massive_delete_profiles.php b/pandora_console/godmode/massive/massive_delete_profiles.php
index 068f9ee02d..776e72616d 100644
--- a/pandora_console/godmode/massive/massive_delete_profiles.php
+++ b/pandora_console/godmode/massive/massive_delete_profiles.php
@@ -92,7 +92,9 @@ if ($delete_profiles) {
     );
 }
 
-html_print_table($table);
+if ($table !== null) {
+    html_print_table($table);
+}
 
 unset($table);
 
diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php
index da1a0887b5..9a43c661ce 100755
--- a/pandora_console/godmode/massive/massive_edit_agents.php
+++ b/pandora_console/godmode/massive/massive_edit_agents.php
@@ -170,6 +170,8 @@ if ($update_agents) {
     $n_edited = 0;
     $result = false;
     foreach ($id_agents as $id_agent) {
+        $old_interval_value = db_get_value_filter('intervalo', 'tagente', ['id_agente' => $id_agent]);
+
         if (!empty($values)) {
             $group_old = false;
             $disabled_old = false;
@@ -196,6 +198,18 @@ if ($update_agents) {
                 $result_metaconsole = agent_update_from_cache($id_agent, $values, $server_name);
             }
 
+            // Update the configuration files.
+            if ($result && ($old_interval_value != $values['intervalo'])) {
+                enterprise_hook(
+                    'config_agents_update_config_token',
+                    [
+                        $id_agent,
+                        'interval',
+                        $values['intervalo'],
+                    ]
+                );
+            }
+
             if ($disabled_old !== false && $disabled_old != $values['disabled']) {
                 enterprise_hook(
                     'config_agents_update_config_token',
@@ -686,7 +700,7 @@ if ($fields === false) {
 foreach ($fields as $field) {
     $data[0] = '<b>'.$field['name'].'</b>';
     $data[0] .= ui_print_help_tip(
-        __('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'),
+        __('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url] or [url]\'url to navigate\'[/url] ').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url] or [url]www.goole.com[/url]'),
         true
     );
     $combo = [];
diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php
index a803fa4725..f52707cb2a 100755
--- a/pandora_console/godmode/massive/massive_edit_modules.php
+++ b/pandora_console/godmode/massive/massive_edit_modules.php
@@ -388,6 +388,11 @@ $table->data['form_modules_4'][1] = html_print_select(
     true
 );
 
+$table->rowstyle['form_modules_filter'] = 'vertical-align: top;';
+$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2';
+$table->data['form_modules_filter'][0] = __('Filter Modules');
+$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true);
+
 $table->rowstyle['form_modules_2'] = 'vertical-align: top;';
 $table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2';
 $table->data['form_modules_2'][0] = __('Modules');
@@ -468,6 +473,11 @@ $table->data['form_agents_4'][1] = html_print_select(
     true
 );
 
+$table->rowstyle['form_agents_filter'] = 'vertical-align: top;';
+$table->rowclass['form_agents_filter'] = 'select_agents_row select_agents_row_2';
+$table->data['form_agents_filter'][0] = __('Filter agents');
+$table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true);
+
 $table->rowstyle['form_agents_3'] = 'vertical-align: top;';
 $table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2';
 $table->data['form_agents_3'][0] = __('Agents');
@@ -1247,6 +1257,9 @@ $(document).ready (function () {
                 });
                 $("#module_loading").hide ();
                 $("#module_name").removeAttr ("disabled");
+                //Filter modules. Call the function when the select is fully loaded.
+                var textNoData = "<?php echo __('None'); ?>";
+                filterByText($('#module_name'), $("#text-filter_modules"), textNoData);
             },
             "json"
         );
@@ -1630,6 +1643,9 @@ $(document).ready (function () {
                             .html(value["alias"]);
                         $("#id_agents").append (option);
                     });
+                    //Filter agents. Call the function when the select is fully loaded.
+                    var textNoData = "<?php echo __('None'); ?>";
+                    filterByText($('#id_agents'), $("#text-filter_agents"), textNoData);
                 },
                 "json"
             );
diff --git a/pandora_console/godmode/massive/massive_edit_plugins.php b/pandora_console/godmode/massive/massive_edit_plugins.php
index 48688ded8d..7513c99eb9 100644
--- a/pandora_console/godmode/massive/massive_edit_plugins.php
+++ b/pandora_console/godmode/massive/massive_edit_plugins.php
@@ -725,7 +725,6 @@ echo '</form>';
             }
         });
         
-        $modulesSelect.change();
     }
     
     var processGet = function (params, callback) {
diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php
index eaf33df640..000a105257 100644
--- a/pandora_console/godmode/menu.php
+++ b/pandora_console/godmode/menu.php
@@ -24,9 +24,24 @@ $menu_godmode['class'] = 'godmode';
 
 if (check_acl($config['id_user'], 0, 'PM')) {
     $sub = [];
-    $sub['godmode/servers/discovery']['text'] = __('Discovery');
-    $sub['godmode/servers/discovery']['id'] = 'Discovery';
-    $sub['godmode/servers/discovery']['subsecs'] = ['godmode/servers/discovery'];
+    $sub['godmode/servers/discovery&wiz=main']['text'] = __('Main');
+    $sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery';
+
+    $sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
+    $sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
+
+    $sub2 = [];
+    $sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
+    enterprise_hook('hostdevices_submenu');
+    $sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
+    $sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
+    $sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
+    $sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
+    $sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
+
+    enterprise_hook('applications_menu');
+    enterprise_hook('cloud_menu');
+    enterprise_hook('console_task_menu');
 
     // Add to menu.
     $menu_godmode['discovery']['text'] = __('Discovery');
@@ -114,6 +129,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
     $sub['godmode/modules/manage_network_templates']['id'] = 'Module templates';
     enterprise_hook('inventory_submenu');
     enterprise_hook('autoconfiguration_menu');
+    enterprise_hook('agent_repository_menu');
 }
 
 if (check_acl($config['id_user'], 0, 'AW')) {
@@ -208,7 +224,7 @@ if (!empty($sub)) {
 }
 
 
-if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, 'RR')) {
+if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'PM')) {
     // Servers
     $menu_godmode['gservers']['text'] = __('Servers');
     $menu_godmode['gservers']['sec2'] = 'godmode/servers/modificar_server';
@@ -418,9 +434,11 @@ if (is_array($config['extensions'])) {
     $sub['godmode/extensions']['type'] = 'direct';
     $sub['godmode/extensions']['subtype'] = 'nolink';
 
-    $submenu = array_merge($menu_godmode['gextensions']['sub'], $sub);
-    if ($menu_godmode['gextensions']['sub'] != null) {
-        $menu_godmode['gextensions']['sub'] = $submenu;
+    if (is_array($menu_godmode['gextensions']['sub'])) {
+        $submenu = array_merge($menu_godmode['gextensions']['sub'], $sub);
+        if ($menu_godmode['gextensions']['sub'] != null) {
+            $menu_godmode['gextensions']['sub'] = $submenu;
+        }
     }
 }
 
diff --git a/pandora_console/godmode/modules/manage_nc_groups.php b/pandora_console/godmode/modules/manage_nc_groups.php
index d53de32ce1..41c82435b1 100644
--- a/pandora_console/godmode/modules/manage_nc_groups.php
+++ b/pandora_console/godmode/modules/manage_nc_groups.php
@@ -277,7 +277,7 @@ if (isset($data)) {
 }
 
 
-echo '<form method="post">';
+echo '<form method="post" action='.$url.'>';
 echo '<div class="" style="float:right;">';
 html_print_input_hidden('new', 1);
 html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php
index 82cd02d771..60d39d26d9 100644
--- a/pandora_console/godmode/modules/manage_network_components.php
+++ b/pandora_console/godmode/modules/manage_network_components.php
@@ -36,6 +36,9 @@ require_once $config['homedir'].'/include/functions_component_groups.php';
 if (defined('METACONSOLE')) {
     components_meta_print_header();
     $sec = 'advanced';
+
+    $id_modulo = (int) get_parameter('id_component_type');
+    $new_component = (bool) get_parameter('new_component');
 } else {
     /*
         Hello there! :)
diff --git a/pandora_console/godmode/modules/manage_network_components_form_plugin.php b/pandora_console/godmode/modules/manage_network_components_form_plugin.php
index 19d3c45e8f..94ce00892e 100755
--- a/pandora_console/godmode/modules/manage_network_components_form_plugin.php
+++ b/pandora_console/godmode/modules/manage_network_components_form_plugin.php
@@ -1,17 +1,32 @@
 <?php
+/**
+ * Extension to manage a list of gateways and the node address where they should
+ * point to.
+ *
+ * @category   Network components Plugins
+ * @package    Pandora FMS
+ * @subpackage Community
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation for version 2.
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// Load global variables
 global $config;
 
 check_login();
@@ -29,7 +44,7 @@ $data[1] = html_print_select_from_sql(
     false,
     false
 );
-// Store the macros in base64 into a hidden control to move between pages
+// Store the macros in base64 into a hidden control to move between pages.
 $data[1] .= html_print_input_hidden('macros', base64_encode($macros), true);
 $data[2] = __('Post process');
 $data[3] = html_print_extended_select_for_post_process(
@@ -46,7 +61,7 @@ $data[3] = html_print_extended_select_for_post_process(
 
 push_table_row($data, 'plugin_1');
 
-// A hidden "model row" to clone it from javascript to add fields dynamicly
+// A hidden "model row" to clone it from javascript to add fields dynamicly.
 $data = [];
 $data[0] = 'macro_desc';
 $data[0] .= ui_print_help_tip('macro_help', true);
@@ -56,7 +71,7 @@ $table->rowstyle['macro_field'] = 'display:none';
 
 push_table_row($data, 'macro_field');
 
-// If there are $macros, we create the form fields
+// If there are $macros, we create the form fields.
 if (!empty($macros)) {
     $macros = json_decode($macros, true);
 
@@ -68,9 +83,23 @@ if (!empty($macros)) {
         }
 
         if ($m['hide'] == 1) {
-            $data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 1024, true);
+            $data[1] = html_print_input_text(
+                $m['macro'],
+                io_output_password($m['value']),
+                '',
+                100,
+                1024,
+                true
+            );
         } else {
-            $data[1] = html_print_input_text($m['macro'], io_output_password($m['value']), '', 100, 1024, true);
+            $data[1] = html_print_input_text(
+                $m['macro'],
+                $m['value'],
+                '',
+                100,
+                1024,
+                true
+            );
         }
 
         $table->colspan['macro'.$m['macro']][1] = 3;
diff --git a/pandora_console/godmode/reporting/create_container.php b/pandora_console/godmode/reporting/create_container.php
index b0566d7867..3c2e144178 100644
--- a/pandora_console/godmode/reporting/create_container.php
+++ b/pandora_console/godmode/reporting/create_container.php
@@ -414,7 +414,7 @@ if ($edit_container) {
     echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
         echo '<tr>';
             echo '<td>';
-                echo ui_toggle($single_table, 'Simple module graph', '', true, true);
+                echo ui_toggle($single_table, 'Simple module graph', '', '', true);
             echo '</td>';
         echo '</tr>';
     echo '</table>';
@@ -466,7 +466,7 @@ if ($edit_container) {
     echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
         echo '<tr>';
             echo '<td>';
-                echo ui_toggle(html_print_table($table, true), 'Custom graph', '', true, true);
+                echo ui_toggle(html_print_table($table, true), 'Custom graph', '', '', true);
             echo '</td>';
         echo '</tr>';
     echo '</table>';
@@ -561,7 +561,7 @@ if ($edit_container) {
     echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
         echo '<tr>';
             echo '<td>';
-                echo ui_toggle(html_print_table($table, true), 'Dynamic rules for simple module graph', '', true, true);
+                echo ui_toggle(html_print_table($table, true), 'Dynamic rules for simple module graph', '', '', true);
             echo '</td>';
         echo '</tr>';
     echo '</table>';
diff --git a/pandora_console/godmode/reporting/graph_builder.graph_editor.php b/pandora_console/godmode/reporting/graph_builder.graph_editor.php
index a03a67737f..33cacc9bab 100644
--- a/pandora_console/godmode/reporting/graph_builder.graph_editor.php
+++ b/pandora_console/godmode/reporting/graph_builder.graph_editor.php
@@ -356,9 +356,35 @@ echo "<td style='vertical-align: top;'>".__('Agents').'</td>';
 echo '<td></td>';
 echo "<td style='vertical-align: top;'>".__('Modules').'</td>';
 echo '</tr><tr>';
-echo '<td>'.html_print_select(agents_get_group_agents(), 'id_agents[]', 0, false, '', '', true, true, true, '', false, '').'</td>';
-echo "<td style='vertical-align: center; text-align: center;'>".html_print_image('images/darrowright.png', true).'</td>';
-echo '<td>'.html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, '').'</td>';
+echo '<td style="width: 50%;">'.html_print_select(
+    agents_get_group_agents(),
+    'id_agents[]',
+    0,
+    false,
+    '',
+    '',
+    true,
+    true,
+    true,
+    'w100p',
+    false,
+    ''
+).'</td>';
+echo "<td style='width: 3em;vertical-align: center; text-align: center;'>".html_print_image('images/darrowright.png', true).'</td>';
+echo '<td style="width: 50%;">'.html_print_select(
+    [],
+    'module[]',
+    0,
+    false,
+    '',
+    0,
+    true,
+    true,
+    true,
+    'w100p',
+    false,
+    ''
+).'</td>';
 echo '</tr><tr>';
 echo "<td colspan='3'>";
 echo "<table cellpadding='4'><tr>";
diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php
index 8ce970262d..8f5774b3a9 100644
--- a/pandora_console/godmode/reporting/map_builder.php
+++ b/pandora_console/godmode/reporting/map_builder.php
@@ -61,7 +61,7 @@ $buttons['visual_console_favorite'] = [
     'text'   => '<a href="'.$url_visual_console_favorite.'">'.html_print_image('images/list.png', true, ['title' => __('Visual Favourite Console')]).'</a>',
 ];
 
-if ($is_enterprise && $vconsoles_manage) {
+if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
     $buttons['visual_console_template'] = [
         'active' => false,
         'text'   => '<a href="'.$url_visual_console_template.'">'.html_print_image('images/templates.png', true, ['title' => __('Visual Console Template')]).'</a>',
diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
index 93806138cb..798d03707d 100755
--- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php
+++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
@@ -165,6 +165,8 @@ switch ($action) {
         $show_in_landscape = 0;
         $hide_notinit_agents = 0;
         $priority_mode = REPORT_PRIORITY_MODE_OK;
+        $failover_mode = 0;
+        $failover_type = REPORT_FAILOVER_TYPE_NORMAL;
         $server_name = '';
         $server_id = 0;
         $dyn_height = 230;
@@ -221,7 +223,7 @@ switch ($action) {
             $server_name = $item['server_name'];
 
             // Metaconsole db connection.
-            if ($meta && $server_name != '') {
+            if ($meta && !empty($server_name)) {
                 $connection = metaconsole_get_connection($server_name);
                 if (metaconsole_load_external_db($connection) != NOERR) {
                     continue;
@@ -314,6 +316,8 @@ switch ($action) {
                     $sla_sorted_by = $item['top_n'];
                     $period = $item['period'];
                     $current_month = $item['current_month'];
+                    $failover_mode = $item['failover_mode'];
+                    $failover_type = $item['failover_type'];
                 break;
 
                 case 'module_histogram_graph':
@@ -547,8 +551,45 @@ switch ($action) {
                 break;
 
                 case 'event_report_agent':
-                case 'event_report_group':
+                    $description = $item['description'];
+                    $period = $item['period'];
+                    $group = $item['id_group'];
                     $recursion = $item['recursion'];
+                    $idAgent = $item['id_agent'];
+                    $idAgentModule = $item['id_agent_module'];
+
+
+                    $show_summary_group    = $style['show_summary_group'];
+                    $filter_event_severity = json_decode($style['filter_event_severity'], true);
+                    $filter_event_status   = json_decode($style['filter_event_status'], true);
+                    $filter_event_type     = json_decode($style['filter_event_type'], true);
+
+                    $event_graph_by_user_validator = $style['event_graph_by_user_validator'];
+                    $event_graph_by_criticity = $style['event_graph_by_criticity'];
+                    $event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
+                    $include_extended_events = $item['show_extended_events'];
+
+                    $filter_search = $style['event_filter_search'];
+                break;
+
+                case 'event_report_group':
+                    $description = $item['description'];
+                    $period = $item['period'];
+                    $group = $item['id_group'];
+                    $recursion = $item['recursion'];
+
+                    $event_graph_by_agent = $style['event_graph_by_agent'];
+                    $event_graph_by_user_validator = $style['event_graph_by_user_validator'];
+                    $event_graph_by_criticity = $style['event_graph_by_criticity'];
+                    $event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
+
+                    $filter_search = $style['event_filter_search'];
+
+                    $filter_event_severity = json_decode($style['filter_event_severity'], true);
+                    $filter_event_status   = json_decode($style['filter_event_status'], true);
+                    $filter_event_type     = json_decode($style['filter_event_type'], true);
+
+
                     $include_extended_events = $item['show_extended_events'];
                 break;
 
@@ -812,7 +853,10 @@ $class = 'databox filters';
                 }
                 ?>
                 <?php
-                $text = __('This type of report brings a lot of data loading, it is recommended to use it for scheduled reports and not for real-time view.');
+                if (!isset($text)) {
+                    $text = __('This type of report brings a lot of data loading, it is recommended to use it for scheduled reports and not for real-time view.');
+                }
+
                     echo '<a id="log_help_tip" style="visibility: hidden;" href="javascript:" class="tip" >'.html_print_image('images/tip.png', true, ['title' => $text]).'</a>';
                 ?>
             </td>
@@ -824,7 +868,18 @@ $class = 'databox filters';
             </td>
             <td style="">
                 <?php
-                html_print_input_text('name', $name, '', 80, 100);
+                html_print_input_text(
+                    'name',
+                    $name,
+                    '',
+                    80,
+                    100,
+                    false,
+                    false,
+                    false,
+                    '',
+                    'fullwidth'
+                );
                 ?>
             </td>
         </tr>
@@ -882,7 +937,18 @@ $class = 'databox filters';
             </td>
             <td style="">
                 <?php
-                echo html_print_input_text('label', $label, '', 50, 255, true);
+                echo html_print_input_text(
+                    'label',
+                    $label,
+                    '',
+                    50,
+                    255,
+                    true,
+                    false,
+                    false,
+                    '',
+                    'fullwidth'
+                );
                 ?>
             </td>
         </tr>
@@ -1251,7 +1317,7 @@ $class = 'databox filters';
 
                     if (metaconsole_load_external_db($connection) == NOERR) {
                         $agent_name = db_get_value_filter(
-                            'nombre',
+                            'alias',
                             'tagente',
                             ['id_agente' => $idAgent]
                         );
@@ -2200,6 +2266,7 @@ $class = 'databox filters';
                 ?>
             </td>
         </tr>
+
         <tr id="row_select_fields2" style="" class="datos">
         <td style="font-weight:bold;margin-right:150px;">
             <?php
@@ -2571,6 +2638,59 @@ $class = 'databox filters';
             </td>
         </tr>
 
+        <tr id="row_failover_mode" style="" class="datos">
+            <td style="font-weight:bold;">
+            <?php
+            echo __('Failover mode').ui_print_help_tip(
+                __('SLA calculation must be performed taking into account the failover modules assigned to the primary module'),
+                true
+            );
+            ?>
+            </td>
+            <td>
+                <?php
+                html_print_checkbox_switch(
+                    'failover_mode',
+                    1,
+                    $failover_mode
+                );
+                ?>
+            </td>
+        </tr>
+
+        <tr id="row_failover_type" style="" class="datos">
+            <td style="font-weight:bold;">
+            <?php
+            echo __('Failover type');
+            ?>
+            </td>
+            <td>
+                <?php
+                echo __('Failover normal');
+                echo '<span style="margin-left:5px;"></span>';
+                html_print_radio_button(
+                    'failover_type',
+                    REPORT_FAILOVER_TYPE_NORMAL,
+                    '',
+                    $failover_type == REPORT_FAILOVER_TYPE_NORMAL,
+                    ''
+                );
+
+                echo '<span style="margin:30px;"></span>';
+
+                echo __('Failover simple');
+                echo '<span style="margin-left:5px;"></span>';
+                html_print_radio_button(
+                    'failover_type',
+                    REPORT_FAILOVER_TYPE_SIMPLE,
+                    '',
+                    $failover_type == REPORT_FAILOVER_TYPE_SIMPLE,
+                    ''
+                );
+                ?>
+            </td>
+        </tr>
+
         <tr id="row_filter_search" style="" class="datos">
             <td style="font-weight:bold;"><?php echo __('Free search'); ?></td>
             <td>
@@ -2734,6 +2854,13 @@ function print_SLA_list($width, $action, $idItem=null)
         'id_rc',
         $idItem
     );
+
+    $failover_mode = db_get_value(
+        'failover_mode',
+        'treport_content',
+        'id_rc',
+        $idItem
+    );
     ?>
     <table class="databox data" id="sla_list" border="0" cellpadding="4" cellspacing="4" width="100%">
         <thead>
@@ -2746,8 +2873,23 @@ function print_SLA_list($width, $action, $idItem=null)
                 <th class="header sla_list_module_col" scope="col">
                 <?php
                 echo __('Module');
-                ?>
+                if ($report_item_type == 'availability_graph'
+                    && $failover_mode
+                ) {
+                    ?>
+                <th class="header sla_list_agent_failover" scope="col">
+                    <?php
+                    echo __('Agent Failover');
+                    ?>
                 </th>
+                <th class="header sla_list_module_failover" scope="col">
+                    <?php
+                    echo __('Module Failover');
+                    ?>
+                </th>
+                    <?php
+                }
+                ?>
                 <th class="header sla_list_service_col" scope="col">
                 <?php
                 echo __('Service');
@@ -2793,6 +2935,7 @@ function print_SLA_list($width, $action, $idItem=null)
                 case 'update':
                 case 'edit':
                     echo '<tbody id="list_sla">';
+
                     $itemsSLA = db_get_all_rows_filter(
                         'treport_content_sla_combined',
                         ['id_report_content' => $idItem]
@@ -2805,7 +2948,7 @@ function print_SLA_list($width, $action, $idItem=null)
                     foreach ($itemsSLA as $item) {
                         $server_name = $item['server_name'];
                         // Metaconsole db connection.
-                        if ($meta && $server_name != '') {
+                        if ($meta && !empty($server_name)) {
                             $connection = metaconsole_get_connection(
                                 $server_name
                             );
@@ -2827,6 +2970,25 @@ function print_SLA_list($width, $action, $idItem=null)
                             ['id_agente_modulo' => $item['id_agent_module']]
                         );
 
+                        if (isset($item['id_agent_module_failover']) === true
+                            && $item['id_agent_module_failover'] !== 0
+                        ) {
+                            $idAgentFailover = db_get_value_filter(
+                                'id_agente',
+                                'tagente_modulo',
+                                ['id_agente_modulo' => $item['id_agent_module_failover']]
+                            );
+                            $nameAgentFailover = agents_get_alias(
+                                $idAgentFailover
+                            );
+
+                            $nameModuleFailover = db_get_value_filter(
+                                'nombre',
+                                'tagente_modulo',
+                                ['id_agente_modulo' => $item['id_agent_module_failover']]
+                            );
+                        }
+
                         $server_name_element = '';
                         if ($meta && $server_name != '') {
                             $server_name_element .= ' ('.$server_name.')';
@@ -2840,6 +3002,17 @@ function print_SLA_list($width, $action, $idItem=null)
                         echo printSmallFont($nameModule);
                         echo '</td>';
 
+                        if ($report_item_type == 'availability_graph'
+                            && $failover_mode
+                        ) {
+                            echo '<td class="sla_list_agent_failover">';
+                            echo printSmallFont($nameAgentFailover).$server_name_element;
+                            echo '</td>';
+                            echo '<td class="sla_list_module_failover">';
+                            echo printSmallFont($nameModuleFailover);
+                            echo '</td>';
+                        }
+
                         if (enterprise_installed()
                             && $report_item_type == 'SLA_services'
                         ) {
@@ -2888,6 +3061,15 @@ function print_SLA_list($width, $action, $idItem=null)
                             <td class="sla_list_agent_col agent_name"></td>
                             <td class="sla_list_module_col module_name"></td>
                             <?php
+                            if ($report_item_type == 'availability_graph'
+                                && $failover_mode
+                            ) {
+                                ?>
+                            <td class="sla_list_agent_failover agent_name_failover"></td>
+                            <td class="sla_list_module_failover module_name_failover"></td>
+                                <?php
+                            }
+
                             if (enterprise_installed()
                                 && $report_item_type == 'SLA_services'
                             ) {
@@ -2944,6 +3126,44 @@ function print_SLA_list($width, $action, $idItem=null)
                                 </select>
                             </td>
                             <?php
+                            if ($report_item_type == 'availability_graph'
+                                && $failover_mode
+                            ) {
+                                ?>
+                                <td class="sla_list_agent_failover_col">
+                                    <input id="hidden-id_agent_failover" name="id_agent_failover" value="" type="hidden">
+                                    <input id="hidden-server_name_failover" name="server_name_failover" value="" type="hidden">
+                                    <?php
+                                    $params = [];
+                                    $params['show_helptip'] = true;
+                                    $params['input_name'] = 'agent_failover';
+                                    $params['value'] = '';
+                                    $params['use_hidden_input_idagent'] = true;
+                                    $params['hidden_input_idagent_id'] = 'hidden-id_agent_failover';
+                                    $params['javascript_is_function_select'] = true;
+                                    $params['selectbox_id'] = 'id_agent_module_failover';
+                                    $params['add_none_module'] = false;
+                                    if ($meta) {
+                                        $params['use_input_id_server'] = true;
+                                        $params['input_id_server_id'] = 'hidden-id_server';
+                                        $params['disabled_javascript_on_blur_function'] = true;
+                                    }
+
+                                    ui_print_agent_autocomplete_input($params);
+                                    ?>
+                                </td>
+                                <td class="sla_list_module_failover_col">
+                                    <select id="id_agent_module_failover" name="id_agent_module_failover" disabled="disabled" style="max-width: 180px">
+                                        <option value="0">
+                                            <?php
+                                            echo __('Select an Agent first');
+                                            ?>
+                                        </option>
+                                    </select>
+                                </td>
+                                <?php
+                            }
+
                             if (enterprise_installed()
                                 && $report_item_type == 'SLA_services'
                             ) {
@@ -2964,23 +3184,23 @@ function print_SLA_list($width, $action, $idItem=null)
                                         ],
                                     ]
                                 );
-                                if (!empty($services_tmp)
-                                    && $services_tmp != ENTERPRISE_NOT_HOOK
+                        if (!empty($services_tmp)
+                            && $services_tmp != ENTERPRISE_NOT_HOOK
+                        ) {
+                            foreach ($services_tmp as $service) {
+                                $check_module_sla = modules_check_agentmodule_exists(
+                                    $service['sla_id_module']
+                                );
+                                $check_module_sla_value = modules_check_agentmodule_exists(
+                                    $service['sla_value_id_module']
+                                );
+                                if ($check_module_sla
+                                    && $check_module_sla_value
                                 ) {
-                                    foreach ($services_tmp as $service) {
-                                        $check_module_sla = modules_check_agentmodule_exists(
-                                            $service['sla_id_module']
-                                        );
-                                        $check_module_sla_value = modules_check_agentmodule_exists(
-                                            $service['sla_value_id_module']
-                                        );
-                                        if ($check_module_sla
-                                            && $check_module_sla_value
-                                        ) {
-                                            $services[$service['id']] = $service['name'];
-                                        }
-                                    }
+                                    $services[$service['id']] = $service['name'];
                                 }
+                            }
+                        }
 
                                 echo '<td class="sla_list_service_col">';
                                 echo html_print_select(
@@ -3133,7 +3353,7 @@ function print_General_list($width, $action, $idItem=null, $type='general')
                     foreach ($itemsGeneral as $item) {
                         $server_name = $item['server_name'];
                         // Metaconsole db connection.
-                        if ($meta && $server_name != '') {
+                        if ($meta && !empty($server_name)) {
                             $connection = metaconsole_get_connection(
                                 $server_name
                             );
@@ -3491,6 +3711,7 @@ $(document).ready (function () {
 
     $("#submit-create_item").click(function () {
         var type = $('#type').val();
+        var name = $('#text-name').val();
         switch (type){
             case 'alert_report_module':
             case 'alert_report_agent':
@@ -3521,6 +3742,13 @@ $(document).ready (function () {
             default:
                 break;
         }
+
+        if($('#text-name').val() == ''){
+            alert( <?php echo "'".__('Please insert a name')."'"; ?> );
+                return false;
+        }
+
+
     });
 
     $("#submit-edit_item").click(function () {
@@ -3571,11 +3799,18 @@ $(document).ready (function () {
     $("#checkbox-checkbox_show_resume").change(function(){
         if($(this).is(":checked")){
             $("#row_select_fields2").show();
-            $("#row_select_fields3").show();
         }
         else{
             $("#row_select_fields2").hide();
-            $("#row_select_fields3").hide();
+        }
+    });
+
+    $("#checkbox-failover_mode").change(function(){
+        if($(this).is(":checked")){
+            $("#row_failover_type").show();
+        }
+        else{
+            $("#row_failover_type").hide();
         }
     });
 });
@@ -3869,10 +4104,13 @@ function deleteGeneralRow(id_row) {
 
 function addSLARow() {
     var nameAgent = $("input[name=agent_sla]").val();
+    var nameAgentFailover = $("input[name=agent_failover]").val();
     var idAgent = $("input[name=id_agent_sla]").val();
     var serverId = $("input[name=id_server]").val();
     var idModule = $("#id_agent_module_sla").val();
+    var idModuleFailover = $("#id_agent_module_failover").val();
     var nameModule = $("#id_agent_module_sla :selected").text();
+    var nameModuleFailover = $("#id_agent_module_failover :selected").text();
     var slaMin = $("input[name=sla_min]").val();
     var slaMax = $("input[name=sla_max]").val();
     var slaLimit = $("input[name=sla_limit]").val();
@@ -3933,10 +4171,63 @@ function addSLARow() {
                 });
             }
 
+            if (nameAgentFailover != '') {
+                //Truncate nameAgentFailover
+                var params = [];
+                params.push("truncate_text=1");
+                params.push("text=" + nameAgentFailover);
+                params.push("page=include/ajax/reporting.ajax");
+                jQuery.ajax ({
+                    data: params.join ("&"),
+                    type: 'POST',
+                    url: action=
+                    <?php
+                    echo '"'.ui_get_full_url(
+                        false,
+                        false,
+                        false,
+                        false
+                    ).'"';
+                    ?>
+                    + "/ajax.php",
+                    async: false,
+                    timeout: 10000,
+                    success: function (data) {
+                        nameAgentFailover = data;
+                    }
+                });
+
+                //Truncate nameModuleFailover
+                var params = [];
+                params.push("truncate_text=1");
+                params.push("text=" + nameModuleFailover);
+                params.push("page=include/ajax/reporting.ajax");
+                jQuery.ajax ({
+                    data: params.join ("&"),
+                    type: 'POST',
+                    url: action=
+                    <?php
+                    echo '"'.ui_get_full_url(
+                        false,
+                        false,
+                        false,
+                        false
+                    ).'"';
+                    ?>
+                    + "/ajax.php",
+                    async: false,
+                    timeout: 10000,
+                    success: function (data) {
+                        nameModuleFailover = data;
+                    }
+                });
+            }
+
             var params = [];
             params.push("add_sla=1");
             params.push("id=" + $("input[name=id_item]").val());
             params.push("id_module=" + idModule);
+            params.push("id_module_failover=" + idModuleFailover);
             params.push("sla_min=" + slaMin);
             params.push("sla_max=" + slaMax);
             params.push("sla_limit=" + slaLimit);
@@ -3969,6 +4260,8 @@ function addSLARow() {
                         $("#row", row).attr('id', 'sla_' + data['id']);
                         $(".agent_name", row).html(nameAgent);
                         $(".module_name", row).html(nameModule);
+                        $(".agent_name_failover", row).html(nameAgentFailover);
+                        $(".module_name_failover", row).html(nameModuleFailover);
                         $(".service_name", row).html(serviceName);
                         $(".sla_min", row).html(slaMin);
                         $(".sla_max", row).html(slaMax);
@@ -3979,14 +4272,22 @@ function addSLARow() {
                         );
                         $("#list_sla").append($(row).html());
                         $("input[name=id_agent_sla]").val('');
+                        $("input[name=id_agent_failover]").val('');
                         $("input[name=id_server]").val('');
                         $("input[name=agent_sla]").val('');
+                        $("input[name=agent_failover]").val('');
                         $("#id_agent_module_sla").empty();
                         $("#id_agent_module_sla").attr('disabled', 'true');
                         $("#id_agent_module_sla").append(
                             $("<option></option>")
                             .attr ("value", 0)
                             .html ($("#module_sla_text").html()));
+                        $("#id_agent_module_failover").empty();
+                        $("#id_agent_module_failover").attr('disabled', 'true');
+                        $("#id_agent_module_failover").append(
+                            $("<option></option>")
+                            .attr ("value", 0)
+                            .html ($("#module_sla_text").html()));
                         $("input[name=sla_min]").val('');
                         $("input[name=sla_max]").val('');
                         $("input[name=sla_limit]").val('');
@@ -4115,7 +4416,6 @@ function addGeneralRow() {
             success: function (data) {
                 if (data['correct']) {
                     row = $("#general_template").clone();
-
                     $("#row", row).show();
                     $("#row", row).attr('id', 'general_' + data['id']);
                     $(".agent_name", row).html(nameAgent);
@@ -4165,6 +4465,8 @@ function chooseType() {
     $("#row_custom_example").hide();
     $("#row_group").hide();
     $("#row_current_month").hide();
+    $("#row_failover_mode").hide();
+    $("#row_failover_type").hide();
     $("#row_working_time").hide();
     $("#row_only_display_wrong").hide();
     $("#row_combo_module").hide();
@@ -4243,6 +4545,8 @@ function chooseType() {
             $("#row_event_filter").show();
             $("#row_event_graphs").show();
 
+
+
             $("#row_event_graph_by_agent").show();
             $("#row_event_graph_by_user").show();
             $("#row_event_graph_by_criticity").show();
@@ -4250,6 +4554,11 @@ function chooseType() {
             $("#row_extended_events").show();
 
             $("#row_filter_search").show();
+
+            $("#row_event_severity").show();
+            $("#row_event_status").show();
+            $("#row_event_type").show();
+            
             $("#row_historical_db_check").hide();
             break;
 
@@ -4331,6 +4640,11 @@ function chooseType() {
             $("#row_working_time").show();
             $("#row_historical_db_check").hide();
             $("#row_priority_mode").show();
+            $("#row_failover_mode").show();
+            var failover_checked = $("input[name='failover_mode']").prop("checked");
+            if(failover_checked){
+                $("#row_failover_type").show();
+            }
             break;
 
         case 'module_histogram_graph':
diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php
index b2a206a40a..00c6fa245a 100755
--- a/pandora_console/godmode/reporting/reporting_builder.list_items.php
+++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php
@@ -267,7 +267,7 @@ if ($moduleFilter != 0) {
 
 // Filter report items created from metaconsole in normal console list and the opposite
 if (defined('METACONSOLE') and $config['metaconsole'] == 1) {
-    $where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'availability_graph\', \'top_n\',\'SLA_monthly\',\'SLA_weekly\',\'SLA_hourly\'))';
+    $where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'availability_graph\', \'top_n\',\'SLA_monthly\',\'SLA_weekly\',\'SLA_hourly\',\'text\'))';
 } else {
     $where .= ' AND ((server_name IS NULL OR length(server_name) = 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'top_n\'))';
 }
@@ -342,7 +342,7 @@ if ($items) {
     $table->size[0] = '5px';
     $table->size[1] = '15%';
     $table->size[4] = '8%';
-    $table->size[6] = '90px';
+    $table->size[6] = '120px';
     $table->size[7] = '30px';
 
     $table->head[0] = '<span title="'.__('Position').'">'.__('P.').'</span>';
diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php
index 44e616977d..aa89496ef7 100755
--- a/pandora_console/godmode/reporting/reporting_builder.php
+++ b/pandora_console/godmode/reporting/reporting_builder.php
@@ -1,4 +1,22 @@
 <script type="text/javascript">
+
+function dialog_message(message_id) {
+  $(message_id)
+    .css("display", "inline")
+    .dialog({
+      modal: true,
+      show: "blind",
+      hide: "blind",
+      width: "400px",
+      buttons: {
+        Close: function() {
+          $(this).dialog("close");
+        }
+      }
+    });
+}
+
+
     function check_all_checkboxes() {
         if ($("input[name=all_delete]").prop("checked")) {
             $(".check_delete").prop("checked", true);
@@ -45,6 +63,9 @@
                     .parent()
                     .addClass('checkselected');
                 $(".check_delete").prop("checked", true);
+                $('.check_delete').each(function(){
+                    $('#hidden-id_report_'+$(this).val()).prop("disabled", false);    
+                });
             }
             else{
                 $('[id^=checkbox-massive_report_check]')
@@ -575,7 +596,7 @@ switch ($action) {
                 break;
             }
 
-            if (! $delete) {
+            if (! $delete && !empty($type_access_selected)) {
                 db_pandora_audit(
                     'ACL Violation',
                     'Trying to access report builder deletion'
@@ -771,34 +792,32 @@ switch ($action) {
             $table->head[1] = __('Description');
             $table->head[2] = __('HTML');
             $table->head[3] = __('XML');
-            $table->size[0] = '20%';
-            $table->size[1] = '30%';
+            $table->size[0] = '50%';
+            $table->size[1] = '20%';
             $table->size[2] = '2%';
-            $table->headstyle[2] = 'min-width: 35px;';
+            $table->headstyle[2] = 'min-width: 35px;text-align: left;';
             $table->size[3] = '2%';
-            $table->headstyle[3] = 'min-width: 35px;';
+            $table->headstyle[3] = 'min-width: 35px;text-align: left;';
             $table->size[4] = '2%';
-            $table->headstyle[4] = 'min-width: 35px;';
-            $table->size[5] = '2%';
-            $table->headstyle[5] = 'min-width: 35px;';
-            $table->size[6] = '2%';
-            $table->headstyle[6] = 'min-width: 35px;';
-            $table->size[7] = '5%';
-            $table->headstyle['csv'] = 'min-width: 65px;';
-            $table->style[7] = 'text-align: center;';
-
-            $table->headstyle[9] = 'min-width: 100px;';
-            $table->style[9] = 'text-align: center;';
+            $table->headstyle[4] = 'min-width: 35px;text-align: left;';
 
             $next = 4;
             // Calculate dinamically the number of the column.
-            if (enterprise_hook('load_custom_reporting_1') !== ENTERPRISE_NOT_HOOK) {
+            if (enterprise_hook('load_custom_reporting_1', [$table]) !== ENTERPRISE_NOT_HOOK) {
                 $next = 7;
             }
 
+            $table->size[$next] = '2%';
+            $table->style[$next] = 'text-align: left;';
+
+            $table->headstyle[($next + 2)] = 'min-width: 130px; text-align:right;';
+            $table->style[($next + 2)] = 'text-align: right;';
+
+
             // Admin options only for RM flag.
             if (check_acl($config['id_user'], 0, 'RM')) {
                 $table->head[$next] = __('Private');
+                $table->headstyle[$next] = 'min-width: 40px;text-align: left;';
                 $table->size[$next] = '2%';
                 if (defined('METACONSOLE')) {
                     $table->align[$next] = '';
@@ -808,7 +827,9 @@ switch ($action) {
 
                 $next++;
                 $table->head[$next] = __('Group');
-                $table->size[$next] = '15%';
+                $table->headstyle[$next] = 'min-width: 40px;text-align: left;';
+                $table->size[$next] = '2%';
+                $table->align[$next] = 'left';
 
                 $next++;
                 $op_column = false;
@@ -826,7 +847,7 @@ switch ($action) {
 
                 // $table->size = array ();
                 $table->size[$next] = '10%';
-                $table->align[$next] = 'left';
+                $table->align[$next] = 'right';
             }
 
             $columnview = false;
@@ -1341,20 +1362,54 @@ switch ($action) {
                 switch ($action) {
                     case 'update':
                         $values = [];
+                        $server_name = get_parameter('server_id');
+                        if (is_metaconsole() && $server_name != '') {
+                            $id_meta = metaconsole_get_id_server($server_name);
+                            $connection = metaconsole_get_connection_by_id(
+                                $id_meta
+                            );
+                            metaconsole_connect($connection);
+                            $values['server_name'] = $connection['server_name'];
+                        }
+
                         $values['id_report'] = $idReport;
                         $values['description'] = get_parameter('description');
                         $values['type'] = get_parameter('type', null);
                         $values['recursion'] = get_parameter('recursion', null);
+                        $values['show_extended_events'] = get_parameter('include_extended_events', null);
+
                         $label = get_parameter('label', '');
 
+                        $id_agent = get_parameter('id_agent');
+                        $id_agent_module = get_parameter('id_agent_module');
+
                         // Add macros name.
-                        $items_label = [];
-                        $items_label['type'] = get_parameter('type');
-                        $items_label['id_agent'] = get_parameter('id_agent');
-                        $items_label['id_agent_module'] = get_parameter(
-                            'id_agent_module'
-                        );
                         $name_it = (string) get_parameter('name');
+
+                        $agent_description = agents_get_description($id_agent);
+                        $agent_group = agents_get_agent_group($id_agent);
+                        $agent_address = agents_get_address($id_agent);
+                        $agent_alias = agents_get_alias($id_agent);
+                        $module_name = modules_get_agentmodule_name(
+                            $id_agent_module
+                        );
+
+                        $module_description = modules_get_agentmodule_descripcion(
+                            $id_agent_module
+                        );
+
+                        $items_label = [
+                            'type'               => get_parameter('type'),
+                            'id_agent'           => $id_agent,
+                            'id_agent_module'    => $id_agent_module,
+                            'agent_description'  => $agent_description,
+                            'agent_group'        => $agent_group,
+                            'agent_address'      => $agent_address,
+                            'agent_alias'        => $agent_alias,
+                            'module_name'        => $module_name,
+                            'module_description' => $module_description,
+                        ];
+
                         $values['name'] = reporting_label_macro(
                             $items_label,
                             $name_it
@@ -1439,6 +1494,14 @@ switch ($action) {
                                 $values['show_graph'] = get_parameter(
                                     'combo_graph_options'
                                 );
+                                $values['failover_mode'] = get_parameter(
+                                    'failover_mode',
+                                    0
+                                );
+                                $values['failover_type'] = get_parameter(
+                                    'failover_type',
+                                    REPORT_FAILOVER_TYPE_NORMAL
+                                );
 
                                 $good_format = true;
                             break;
@@ -1702,13 +1765,6 @@ switch ($action) {
                         );
                         $values['id_group'] = get_parameter('combo_group');
                         $values['server_name'] = get_parameter('server_name');
-                        $server_id = (int) get_parameter('server_id');
-                        if ($server_id != 0) {
-                            $connection = metaconsole_get_connection_by_id(
-                                $server_id
-                            );
-                            $values['server_name'] = $connection['server_name'];
-                        }
 
                         if ($values['server_name'] == '') {
                             $values['server_name'] = get_parameter(
@@ -1900,8 +1956,8 @@ switch ($action) {
                                 $style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
                                 $style['event_graph_by_criticity'] = $event_graph_by_criticity;
                                 $style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
-
                                 $style['event_filter_search'] = $event_filter_search;
+
                                 if ($label != '') {
                                     $style['label'] = $label;
                                 } else {
@@ -1965,22 +2021,11 @@ switch ($action) {
 
                         $values['style'] = io_safe_input(json_encode($style));
 
+                        if (is_metaconsole()) {
+                            metaconsole_restore_db();
+                        }
+
                         if ($good_format) {
-                            switch ($config['dbtype']) {
-                                case 'oracle':
-                                    if (isset($values['type'])) {
-                                        $values[db_escape_key_identifier(
-                                            'type'
-                                        )] = $values['type'];
-                                        unset($values['type']);
-                                    }
-                                break;
-
-                                default:
-                                    // Default.
-                                break;
-                            }
-
                             $resultOperationDB = db_process_sql_update(
                                 'treport_content',
                                 $values,
@@ -1993,20 +2038,62 @@ switch ($action) {
 
                     case 'save':
                         $values = [];
+
+                        $values['server_name'] = get_parameter('server_name');
+                        $server_id = (int) get_parameter('server_id');
+                        if ($server_id != 0) {
+                            $connection = metaconsole_get_connection_by_id(
+                                $server_id
+                            );
+                            metaconsole_connect($connection);
+                            $values['server_name'] = $connection['server_name'];
+                        }
+
                         $values['id_report'] = $idReport;
                         $values['type'] = get_parameter('type', null);
                         $values['description'] = get_parameter('description');
                         $label = get_parameter('label', '');
 
-                        // Add macros name.
-                        $items_label = [];
-                        $items_label['type'] = get_parameter('type');
-                        $items_label['id_agent'] = get_parameter('id_agent');
-                        $items_label['id_agent_module'] = get_parameter(
-                            'id_agent_module'
-                        );
-                        $name_it = (string) get_parameter('name');
                         $values['recursion'] = get_parameter('recursion', null);
+                        $values['show_extended_events'] = get_parameter(
+                            'include_extended_events',
+                            null
+                        );
+
+                        $id_agent = get_parameter('id_agent');
+                        $id_agent_module = get_parameter('id_agent_module');
+
+                        // Add macros name.
+                        $name_it = (string) get_parameter('name');
+
+                        $agent_description = agents_get_description($id_agent);
+                        $agent_group = agents_get_agent_group($id_agent);
+                        $agent_address = agents_get_address($id_agent);
+                        $agent_alias = agents_get_alias($id_agent);
+                        $module_name = modules_get_agentmodule_name(
+                            $id_agent_module
+                        );
+
+                        $module_description = modules_get_agentmodule_descripcion(
+                            $id_agent_module
+                        );
+
+                        if (is_metaconsole()) {
+                            metaconsole_restore_db();
+                        }
+
+                        $items_label = [
+                            'type'               => get_parameter('type'),
+                            'id_agent'           => $id_agent,
+                            'id_agent_module'    => $id_agent_module,
+                            'agent_description'  => $agent_description,
+                            'agent_group'        => $agent_group,
+                            'agent_address'      => $agent_address,
+                            'agent_alias'        => $agent_alias,
+                            'module_name'        => $module_name,
+                            'module_description' => $module_description,
+                        ];
+
                         $values['name'] = reporting_label_macro(
                             $items_label,
                             $name_it
@@ -2211,18 +2298,6 @@ switch ($action) {
                             break;
                         }
 
-
-
-                        $values['server_name'] = get_parameter('server_name');
-                        $server_id = (int) get_parameter('server_id');
-                        if ($server_id != 0) {
-                            $connection = metaconsole_get_connection_by_id(
-                                $server_id
-                            );
-
-                            $values['server_name'] = $connection['server_name'];
-                        }
-
                         if ($values['server_name'] == '') {
                             $values['server_name'] = get_parameter(
                                 'combo_server'
@@ -2395,6 +2470,16 @@ switch ($action) {
 
                         $values['current_month'] = get_parameter('current_month');
 
+                        $values['failover_mode'] = get_parameter(
+                            'failover_mode',
+                            0
+                        );
+
+                        $values['failover_type'] = get_parameter(
+                            'failover_type',
+                            REPORT_FAILOVER_TYPE_NORMAL
+                        );
+
                         $style = [];
                         $style['show_in_same_row'] = get_parameter(
                             'show_in_same_row',
@@ -2418,6 +2503,7 @@ switch ($action) {
                             case 'event_report_agent':
                             case 'event_report_group':
                             case 'event_report_module':
+
                                 $show_summary_group = get_parameter(
                                     'show_summary_group',
                                     0
@@ -2473,22 +2559,11 @@ switch ($action) {
                                 $style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
                                 $style['event_graph_by_criticity'] = $event_graph_by_criticity;
                                 $style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
-
-
-                                switch ($values['type']) {
-                                    case 'event_report_group':
-                                    case 'event_report_agent':
-                                        $style['event_filter_search'] = $event_filter_search;
-                                        if ($label != '') {
-                                            $style['label'] = $label;
-                                        } else {
-                                            $style['label'] = '';
-                                        }
-                                    break;
-
-                                    default:
-                                        // Default.
-                                    break;
+                                $style['event_filter_search'] = $event_filter_search;
+                                if ($label != '') {
+                                    $style['label'] = $label;
+                                } else {
+                                    $style['label'] = '';
                                 }
                             break;
 
diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js
index cb72ce58ce..a4c18d3737 100755
--- a/pandora_console/godmode/reporting/visual_console_builder.editor.js
+++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js
@@ -254,7 +254,14 @@ function update_button_palette_callback() {
   var values = {};
 
   values = readFields();
-
+  if (selectedItem == "static_graph") {
+    if (values["map_linked"] == 0) {
+      if (values["agent"] == "" || values["agent"] == "none") {
+        dialog_message("#message_alert_no_agent");
+        return false;
+      }
+    }
+  }
   // TODO VALIDATE DATA
   switch (selectedItem) {
     case "background":
@@ -1260,6 +1267,7 @@ function create_button_palette_callback() {
         dialog_message("#message_alert_max_height");
         validate = false;
       }
+
       break;
     case "group_item":
       if (values["height"] == "") {
@@ -1323,6 +1331,12 @@ function create_button_palette_callback() {
         dialog_message("#message_alert_no_image");
         validate = false;
       }
+      if (values["map_linked"] == 0) {
+        if (values["agent"] == "" || values["agent"] == "none") {
+          dialog_message("#message_alert_no_agent");
+          validate = false;
+        }
+      }
 
       break;
     case "auto_sla_graph":
diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.php b/pandora_console/godmode/reporting/visual_console_builder.editor.php
index 9ba8c56716..9b6697533f 100755
--- a/pandora_console/godmode/reporting/visual_console_builder.editor.php
+++ b/pandora_console/godmode/reporting/visual_console_builder.editor.php
@@ -25,6 +25,8 @@ if (empty($visualConsole)) {
     exit;
 }
 
+ui_require_css_file('visual_maps');
+
 // ACL for the existing visual console
 // if (!isset($vconsole_read))
 // $vconsole_read = check_acl ($config['id_user'], $visualConsole['id_group'], "VR");
@@ -170,6 +172,7 @@ echo "<div id='delete_in_progress_dialog' style='display: none; text-align: cent
 // CSS
 ui_require_css_file('color-picker', 'include/styles/js/');
 ui_require_css_file('jquery-ui.min', 'include/styles/js/');
+ui_require_jquery_file('jquery-ui_custom');
 
 // Javascript
 ui_require_jquery_file('colorpicker');
diff --git a/pandora_console/godmode/reporting/visual_console_builder.elements.php b/pandora_console/godmode/reporting/visual_console_builder.elements.php
index d2849ce5e0..720bb57a1c 100755
--- a/pandora_console/godmode/reporting/visual_console_builder.elements.php
+++ b/pandora_console/godmode/reporting/visual_console_builder.elements.php
@@ -171,7 +171,7 @@ foreach ($layoutDatas as $layoutData) {
             $table->data[($i + 1)]['icon'] = html_print_image(
                 'images/camera.png',
                 true,
-                ['title' => __('Static Graph')]
+                ['title' => __('Static Image')]
             );
         break;
 
diff --git a/pandora_console/godmode/reporting/visual_console_favorite.php b/pandora_console/godmode/reporting/visual_console_favorite.php
index d1cd7ce2ef..5c5c5adfa1 100644
--- a/pandora_console/godmode/reporting/visual_console_favorite.php
+++ b/pandora_console/godmode/reporting/visual_console_favorite.php
@@ -54,7 +54,7 @@ $buttons['visual_console_favorite'] = [
     'text'   => '<a href="'.$url_visual_console_favorite.'">'.html_print_image('images/list.png', true, ['title' => __('Visual Favourite Console')]).'</a>',
 ];
 
-if ($is_enterprise && $vconsoles_manage) {
+if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
     $buttons['visual_console_template'] = [
         'active' => false,
         'text'   => '<a href="'.$url_visual_console_template.'">'.html_print_image('images/templates.png', true, ['title' => __('Visual Console Template')]).'</a>',
diff --git a/pandora_console/godmode/servers/discovery.php b/pandora_console/godmode/servers/discovery.php
index d9e19abdff..3f2166bb39 100755
--- a/pandora_console/godmode/servers/discovery.php
+++ b/pandora_console/godmode/servers/discovery.php
@@ -42,7 +42,19 @@ function get_wiz_class($str)
         return 'ConsoleTasks';
 
         default:
-            // Ignore.
+            // Main, show header.
+            ui_print_page_header(
+                __('Discovery'),
+                '',
+                false,
+                '',
+                true,
+                '',
+                false,
+                '',
+                GENERIC_SIZE_TEXT,
+                ''
+            );
         return null;
     }
 }
@@ -81,7 +93,7 @@ function cl_load_cmp($a, $b)
 $classes = glob($config['homedir'].'/godmode/wizards/*.class.php');
 if (enterprise_installed()) {
     $ent_classes = glob(
-        $config['homedir'].'/enterprise/godmode/wizards/*.class.php'
+        $config['homedir'].'/'.ENTERPRISE_DIR.'/godmode/wizards/*.class.php'
     );
     if ($ent_classes === false) {
         $ent_classes = [];
@@ -130,5 +142,11 @@ if ($classname_selected === null) {
         }
     }
 
+    // Show hints if there is no task.
+    if (get_parameter('discovery_hint', 0)) {
+        ui_require_css_file('discovery-hint');
+        ui_print_info_message(__('You must create a task first'));
+    }
+
     Wizard::printBigButtonsList($wiz_data);
 }
diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php
index 57fa1a1e67..3eb385332c 100644
--- a/pandora_console/godmode/servers/plugin.php
+++ b/pandora_console/godmode/servers/plugin.php
@@ -70,7 +70,7 @@ if (is_ajax()) {
         $table->head[0] = __('Agent');
         $table->head[1] = __('Module');
         foreach ($modules as $mod) {
-            $agent_name = '<a href="'.$config['homeurl'].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$mod['id_agente'].'">'.modules_get_agentmodule_agent_name(
+            $agent_name = '<a href="'.ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$mod['id_agente']).'">'.modules_get_agentmodule_agent_alias(
                 $mod['id_agente_modulo']
             ).'</a>';
 
@@ -280,7 +280,7 @@ if (($create != '') || ($view != '')) {
     } else {
         if ($create != '') {
             ui_print_page_header(
-                __('Plugin creation'),
+                __('Plugin registration'),
                 'images/gm_servers.png',
                 false,
                 'plugin_definition',
@@ -1215,4 +1215,3 @@ ui_require_javascript_file('pandora_modules');
     
     
 </script>
-
diff --git a/pandora_console/godmode/servers/servers.build_table.php b/pandora_console/godmode/servers/servers.build_table.php
index 1b5486b570..f0e2a4ad08 100644
--- a/pandora_console/godmode/servers/servers.build_table.php
+++ b/pandora_console/godmode/servers/servers.build_table.php
@@ -51,11 +51,11 @@ $table->style[0] = 'font-weight: bold';
 $table->align = [];
 $table->align[1] = 'center';
 $table->align[3] = 'center';
-$table->align[8] = 'center';
+$table->align[8] = 'right';
 
 $table->headstyle[1] = 'text-align:center';
 $table->headstyle[3] = 'text-align:center';
-$table->headstyle[8] = 'text-align:center';
+$table->headstyle[8] = 'text-align:right;width: 120px;';
 
 // $table->title = __('Tactical server information');
 $table->titleclass = 'tabletitle';
@@ -152,12 +152,12 @@ foreach ($servers as $server) {
          $data[8] = '';
 
         if ($server['type'] == 'recon') {
-            $data[8] .= '<a href="index.php?sec=gservers&sec2=operation/servers/recon_view">';
+            $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'">';
             $data[8] .= html_print_image(
                 'images/firts_task/icono_grande_reconserver.png',
                 true,
                 [
-                    'title' => __('Manage recon tasks'),
+                    'title' => __('Manage Discovery tasks'),
                     'style' => 'width:21px;height:21px;',
                 ]
             );
@@ -165,7 +165,7 @@ foreach ($servers as $server) {
         }
 
         if ($server['type'] == 'data') {
-            $data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server'].'">';
+            $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server']).'">';
             $data[8] .= html_print_image(
                 'images/target.png',
                 true,
@@ -173,7 +173,7 @@ foreach ($servers as $server) {
             );
             $data[8] .= '</a>';
         } else if ($server['type'] == 'enterprise snmp') {
-            $data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server'].'">';
+            $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server']).'">';
             $data[8] .= html_print_image(
                 'images/target.png',
                 true,
@@ -182,7 +182,7 @@ foreach ($servers as $server) {
             $data[8] .= '</a>';
         }
 
-        $data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server'].'">';
+        $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server']).'">';
         $data[8] .= html_print_image(
             'images/config.png',
             true,
@@ -191,7 +191,7 @@ foreach ($servers as $server) {
         $data[8] .= '</a>';
 
         if (($names_servers[$safe_server_name] === true) && ($server['type'] == 'data' || $server['type'] == 'enterprise satellite')) {
-            $data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'">';
+            $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">';
             $data[8] .= html_print_image(
                 'images/remote_configuration.png',
                 true,
@@ -201,7 +201,7 @@ foreach ($servers as $server) {
             $names_servers[$safe_server_name] = false;
         }
 
-        $data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1">';
+        $data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1').'">';
         $data[8] .= html_print_image(
             'images/cross.png',
             true,
@@ -234,7 +234,8 @@ if ($tiny) {
     ui_toggle(
         html_print_table($table, true),
         __('Tactical server information'),
-        false,
+        '',
+        '',
         $hidden_toggle
     );
 } else {
diff --git a/pandora_console/godmode/setup/license.php b/pandora_console/godmode/setup/license.php
index f03d32ef0a..06d7d2e7e3 100644
--- a/pandora_console/godmode/setup/license.php
+++ b/pandora_console/godmode/setup/license.php
@@ -135,7 +135,9 @@ $table->data[9][0] = '<strong>'.__('Licensed to').'</strong>';
 $table->data[9][1] = html_print_input_text('licensed_to', $license['licensed_to'], '', 64, 255, true, true);
 
 html_print_table($table);
-if (enterprise_installed()) {
+
+// If DESTDIR is defined the enterprise license is expired.
+if (enterprise_installed() || defined('DESTDIR')) {
     echo '<div class="action-buttons" style="width: '.$table->width.'">';
     html_print_input_hidden('update_settings', 1);
     html_print_submit_button(__('Validate'), 'update_button', false, 'class="sub upd"');
diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php
index f5bfc8c635..c32f128ddd 100644
--- a/pandora_console/godmode/setup/setup.php
+++ b/pandora_console/godmode/setup/setup.php
@@ -86,7 +86,7 @@ $buttons = [];
 // Draws header.
 $buttons['general'] = [
     'active' => false,
-    'text'   => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general">'.html_print_image('images/gm_setup.png', true, ['title' => __('General')]).'</a>',
+    'text'   => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general').'">'.html_print_image('images/gm_setup.png', true, ['title' => __('General')]).'</a>',
 ];
 
 if (enterprise_installed()) {
@@ -95,37 +95,37 @@ if (enterprise_installed()) {
 
 $buttons['auth'] = [
     'active' => false,
-    'text'   => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=auth">'.html_print_image('images/key.png', true, ['title' => __('Authentication')]).'</a>',
+    'text'   => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=auth').'">'.html_print_image('images/key.png', true, ['title' => __('Authentication')]).'</a>',
 ];
 
 $buttons['perf'] = [
     'active' => false,
-    'text'   => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=perf">'.html_print_image('images/performance.png', true, ['title' => __('Performance')]).'</a>',
+    'text'   => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=perf').'">'.html_print_image('images/performance.png', true, ['title' => __('Performance')]).'</a>',
 ];
 
 $buttons['vis'] = [
     'active' => false,
-    'text'   => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=vis">'.html_print_image('images/chart.png', true, ['title' => __('Visual styles')]).'</a>',
+    'text'   => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=vis').'">'.html_print_image('images/chart.png', true, ['title' => __('Visual styles')]).'</a>',
 ];
 
 if (check_acl($config['id_user'], 0, 'AW')) {
     if ($config['activate_netflow']) {
         $buttons['net'] = [
             'active' => false,
-            'text'   => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=net">'.html_print_image('images/op_netflow.png', true, ['title' => __('Netflow')]).'</a>',
+            'text'   => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=net').'">'.html_print_image('images/op_netflow.png', true, ['title' => __('Netflow')]).'</a>',
         ];
     }
 }
 
 $buttons['ehorus'] = [
     'active' => false,
-    'text'   => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&section=ehorus">'.html_print_image('images/ehorus/ehorus.png', true, ['title' => __('eHorus')]).'</a>',
+    'text'   => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=ehorus').'">'.html_print_image('images/ehorus/ehorus.png', true, ['title' => __('eHorus')]).'</a>',
 ];
 
 // FIXME: Not definitive icon
 $buttons['notifications'] = [
     'active' => false,
-    'text'   => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&section=notifications">'.html_print_image('images/alerts_template.png', true, ['title' => __('Notifications')]).'</a>',
+    'text'   => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=notifications').'">'.html_print_image('images/alerts_template.png', true, ['title' => __('Notifications')]).'</a>',
 ];
 
 $help_header = '';
diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php
index eb37a608ea..8d9636e438 100644
--- a/pandora_console/godmode/setup/setup_general.php
+++ b/pandora_console/godmode/setup/setup_general.php
@@ -1,5 +1,13 @@
 <?php
 /**
+ * General setup.
+ *
+ * @category   Setup
+ * @package    Pandora FMS
+ * @subpackage Opensource
+ * @version    1.0.0
+ * @license    See below
+ *
  *    ______                 ___                    _______ _______ ________
  *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
  *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
@@ -18,8 +26,36 @@
  * ============================================================================
  */
 
+// File begin.
+
+
+/**
+ * Return sounds path.
+ *
+ * @return string Path.
+ */
+function get_sounds()
+{
+    global $config;
+
+    $return = [];
+
+    $files = scandir($config['homedir'].'/include/sounds');
+
+    foreach ($files as $file) {
+        if (strstr($file, 'wav') !== false) {
+            $return['include/sounds/'.$file] = $file;
+        }
+    }
+
+    return $return;
+}
+
+
+// Begin.
 global $config;
 
+
 check_login();
 
 $table = new StdClass();
@@ -39,35 +75,18 @@ $table_mail_conf->data = [];
 $table_mail_conf->style[0] = 'font-weight: bold';
 
 // Current config["language"] could be set by user, not taken from global setup !
-switch ($config['dbtype']) {
-    case 'mysql':
-        $current_system_lang = db_get_sql(
-            'SELECT `value`
-			FROM tconfig WHERE `token` = "language"'
-        );
-    break;
-
-    case 'postgresql':
-        $current_system_lang = db_get_sql(
-            'SELECT "value"
-			FROM tconfig WHERE "token" = \'language\''
-        );
-    break;
-
-    case 'oracle':
-        $current_system_lang = db_get_sql(
-            'SELECT value
-			FROM tconfig WHERE token = \'language\''
-        );
-    break;
-}
+$current_system_lang = db_get_sql(
+    'SELECT `value` FROM tconfig WHERE `token` = "language"'
+);
 
 if ($current_system_lang == '') {
     $current_system_lang = 'en';
 }
 
-$table->data[0][0] = __('Language code');
-$table->data[0][1] = html_print_select_from_sql(
+$i = 0;
+
+$table->data[$i][0] = __('Language code');
+$table->data[$i++][1] = html_print_select_from_sql(
     'SELECT id_language, name FROM tlanguage',
     'language',
     $current_system_lang,
@@ -77,68 +96,67 @@ $table->data[0][1] = html_print_select_from_sql(
     true
 );
 
-$table->data[1][0] = __('Remote config directory').ui_print_help_tip(__('Directory where agent remote configuration is stored.'), true);
+$table->data[$i][0] = __('Remote config directory').ui_print_help_tip(__('Directory where agent remote configuration is stored.'), true);
+$table->data[$i++][1] = html_print_input_text('remote_config', io_safe_output($config['remote_config']), '', 30, 100, true);
 
-$table->data[1][1] = html_print_input_text('remote_config', io_safe_output($config['remote_config']), '', 30, 100, true);
+$table->data[$i][0] = __('Phantomjs bin directory').ui_print_help_tip(__('Directory where phantomjs binary file exists and has execution grants.'), true);
+$table->data[$i++][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true);
 
-$table->data[2][0] = __('Phantomjs bin directory').ui_print_help_tip(__('Directory where phantomjs binary file exists and has execution grants.'), true);
+$table->data[$i][0] = __('Auto login (hash) password');
+$table->data[$i++][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
 
-$table->data[2][1] = html_print_input_text('phantomjs_bin', io_safe_output($config['phantomjs_bin']), '', 30, 100, true);
-
-$table->data[6][0] = __('Auto login (hash) password');
-$table->data[6][1] = html_print_input_password('loginhash_pwd', io_output_password($config['loginhash_pwd']), '', 15, 15, true);
-
-$table->data[9][0] = __('Time source');
+$table->data[$i][0] = __('Time source');
 $sources['system'] = __('System');
 $sources['sql'] = __('Database');
-$table->data[9][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true);
+$table->data[$i++][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true);
 
-$table->data[10][0] = __('Automatic check for updates');
-$table->data[10][1] = html_print_checkbox_switch('autoupdate', 1, $config['autoupdate'], true);
+$table->data[$i][0] = __('Automatic check for updates');
+$table->data[$i++][1] = html_print_checkbox_switch('autoupdate', 1, $config['autoupdate'], true);
 
 echo "<div id='dialog' title='".__('Enforce https Information')."' style='display:none;'>";
 echo "<p style='text-align: center;'>".__('If SSL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
 echo '</div>';
 
-$table->data[11][0] = __('Enforce https');
-$table->data[11][1] = html_print_checkbox_switch_extended('https', 1, $config['https'], false, '', '', true);
+$table->data[$i][0] = __('Enforce https');
+$table->data[$i++][1] = html_print_checkbox_switch_extended('https', 1, $config['https'], false, '', '', true);
 
-$table->data[12][0] = __('Use cert of SSL');
-$table->data[12][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
+$table->data[$i][0] = __('Use cert of SSL');
+$table->data[$i++][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
 
-$table->rowstyle[13] = 'display: none;';
-$table->data[13][0] = __('Path of SSL Cert.').ui_print_help_tip(__('Path where you put your cert and name of this cert. Remember your cert only in .pem extension.'), true);
-$table->data[13][1] = html_print_input_text('cert_path', io_safe_output($config['cert_path']), '', 50, 255, true);
+$table->rowstyle[$i] = 'display: none;';
+$table->rowid[$i] = 'ssl-path-tr';
+$table->data[$i][0] = __('Path of SSL Cert.').ui_print_help_tip(__('Path where you put your cert and name of this cert. Remember your cert only in .pem extension.'), true);
+$table->data[$i++][1] = html_print_input_text('cert_path', io_safe_output($config['cert_path']), '', 50, 255, true);
 
-$table->data[14][0] = __('Attachment store').ui_print_help_tip(__('Directory where temporary data is stored.'), true);
-$table->data[14][1] = html_print_input_text('attachment_store', io_safe_output($config['attachment_store']), '', 50, 255, true);
+$table->data[$i][0] = __('Attachment store').ui_print_help_tip(__('Directory where temporary data is stored.'), true);
+$table->data[$i++][1] = html_print_input_text('attachment_store', io_safe_output($config['attachment_store']), '', 50, 255, true);
 
-$table->data[15][0] = __('IP list with API access');
+$table->data[$i][0] = __('IP list with API access');
 if (isset($_POST['list_ACL_IPs_for_API'])) {
     $list_ACL_IPs_for_API = get_parameter_post('list_ACL_IPs_for_API');
 } else {
     $list_ACL_IPs_for_API = get_parameter_get('list_ACL_IPs_for_API', implode("\n", $config['list_ACL_IPs_for_API']));
 }
 
-$table->data[15][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true);
+$table->data[$i++][1] = html_print_textarea('list_ACL_IPs_for_API', 2, 25, $list_ACL_IPs_for_API, 'style="height: 50px; width: 300px"', true);
 
-$table->data[16][0] = __('API password').ui_print_help_tip(__('Please be careful if you put a password put https access.'), true);
-$table->data[16][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
+$table->data[$i][0] = __('API password').ui_print_help_tip(__('Please be careful if you put a password put https access.'), true);
+$table->data[$i++][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
 
-$table->data[17][0] = __('Enable GIS features');
-$table->data[17][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
+$table->data[$i][0] = __('Enable GIS features');
+$table->data[$i++][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
 
-$table->data[19][0] = __('Enable Netflow');
+$table->data[$i][0] = __('Enable Netflow');
 $rbt_disabled = false;
 if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
     $rbt_disabled = true;
-    $table->data[19][0] .= ui_print_help_tip(__('Not supported in Windows systems'), true);
+    $table->data[$i][0] .= ui_print_help_tip(__('Not supported in Windows systems'), true);
 }
 
-$table->data[19][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true);
+$table->data[$i++][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true);
 
-$table->data[21][0] = __('Enable Network Traffic Analyzer');
-$table->data[21][1] = html_print_switch(
+$table->data[$i][0] = __('Enable Network Traffic Analyzer');
+$table->data[$i++][1] = html_print_switch(
     [
         'name'  => 'activate_nta',
         'value' => $config['activate_nta'],
@@ -177,11 +195,11 @@ foreach ($timezones as $timezone) {
     }
 }
 
-$table->data[23][0] = __('Timezone setup').' '.ui_print_help_tip(
+$table->data[$i][0] = __('Timezone setup').' '.ui_print_help_tip(
     __('Must have the same time zone as the system or database to avoid mismatches of time.'),
     true
 );
-$table->data[23][1] = html_print_input_text_extended(
+$table->data[$i][1] = html_print_input_text_extended(
     'timezone_text',
     $config['timezone'],
     'text-timezone_text',
@@ -193,47 +211,63 @@ $table->data[23][1] = html_print_input_text_extended(
     'readonly',
     true
 );
-$table->data[23][1] .= '<a id="change_timezone">'.html_print_image('images/pencil.png', true, ['title' => __('Change timezone')]).'</a>';
-$table->data[23][1] .= '&nbsp;&nbsp;'.html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone();', '', '', true);
-$table->data[23][1] .= '&nbsp;&nbsp;'.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true);
+$table->data[$i][1] .= '<a id="change_timezone">'.html_print_image('images/pencil.png', true, ['title' => __('Change timezone')]).'</a>';
+$table->data[$i][1] .= '&nbsp;&nbsp;'.html_print_select($zone_name, 'zone', $zone_selected, 'show_timezone();', '', '', true);
+$table->data[$i++][1] .= '&nbsp;&nbsp;'.html_print_select($timezone_n, 'timezone', $config['timezone'], '', '', '', true);
 
 $sounds = get_sounds();
-$table->data[24][0] = __('Sound for Alert fired');
-$table->data[24][1] = html_print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true);
-$table->data[24][1] .= ' <a href="javascript: toggleButton(\'alert\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_alert', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
-$table->data[24][1] .= '<div id="layer_sound_alert"></div>';
+$table->data[$i][0] = __('Sound for Alert fired');
+$table->data[$i][1] = html_print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true);
+$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'alert\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_alert', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
+$table->data[$i++][1] .= '<div id="layer_sound_alert"></div>';
 
-$table->data[25][0] = __('Sound for Monitor critical');
-$table->data[25][1] = html_print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true);
-$table->data[25][1] .= ' <a href="javascript: toggleButton(\'critical\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_critical', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
-$table->data[25][1] .= '<div id="layer_sound_critical"></div>';
+$table->data[$i][0] = __('Sound for Monitor critical');
+$table->data[$i][1] = html_print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true);
+$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'critical\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_critical', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
+$table->data[$i++][1] .= '<div id="layer_sound_critical"></div>';
 
-$table->data[26][0] = __('Sound for Monitor warning');
-$table->data[26][1] = html_print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true);
-$table->data[26][1] .= ' <a href="javascript: toggleButton(\'warning\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_warning', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
-$table->data[26][1] .= '<div id="layer_sound_warning"></div>';
+$table->data[$i][0] = __('Sound for Monitor warning');
+$table->data[$i][1] = html_print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true);
+$table->data[$i][1] .= ' <a href="javascript: toggleButton(\'warning\');">'.html_print_image('images/control_play_col.png', true, ['id' => 'button_sound_warning', 'style' => 'vertical-align: middle;', 'width' => '16', 'title' => __('Play sound')]).'</a>';
+$table->data[$i++][1] .= '<div id="layer_sound_warning"></div>';
 
-$table->data[28][0] = __('Public URL');
-$table->data[28][0] .= ui_print_help_tip(
+$table->data[$i][0] = __('Public URL');
+$table->data[$i][0] .= ui_print_help_tip(
     __('Set this value when your %s across inverse proxy or for example with mod_proxy of Apache.', get_product_name()).' '.__('Without the index.php such as http://domain/console_url/'),
     true
 );
-$table->data[28][1] = html_print_input_text('public_url', $config['public_url'], '', 40, 255, true);
+$table->data[$i++][1] = html_print_input_text('public_url', $config['public_url'], '', 40, 255, true);
 
-$table->data[29][0] = __('Referer security');
-$table->data[29][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true);
-$table->data[29][1] = html_print_checkbox_switch('referer_security', 1, $config['referer_security'], true);
+$table->data[$i][0] = __('Force use Public URL');
+$table->data[$i][0] .= ui_print_help_tip(__('Force using defined public URL).', get_product_name()), true);
+$table->data[$i++][1] = html_print_switch(
+    [
+        'name'  => 'force_public_url',
+        'value' => $config['force_public_url'],
+    ]
+);
 
-$table->data[30][0] = __('Event storm protection');
-$table->data[30][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true);
-$table->data[30][1] = html_print_checkbox_switch('event_storm_protection', 1, $config['event_storm_protection'], true);
+echo "<div id='force_public_url_dialog' title='".__('Enforce public URL usage information')."' style='display:none;'>";
+echo "<p style='text-align: center;'>".__('If public URL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
+echo '</div>';
+
+$table->data[$i][0] = __('Public URL host exclusions');
+$table->data[$i++][1] = html_print_textarea('public_url_exclusions', 2, 25, $config['public_url_exclusions'], 'style="height: 50px; width: 300px"', true);
+
+$table->data[$i][0] = __('Referer security');
+$table->data[$i][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true);
+$table->data[$i++][1] = html_print_checkbox_switch('referer_security', 1, $config['referer_security'], true);
+
+$table->data[$i][0] = __('Event storm protection');
+$table->data[$i][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true);
+$table->data[$i++][1] = html_print_checkbox_switch('event_storm_protection', 1, $config['event_storm_protection'], true);
 
 
-$table->data[31][0] = __('Command Snapshot').ui_print_help_tip(__('The string modules with several lines show as command output'), true);
-$table->data[31][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
+$table->data[$i][0] = __('Command Snapshot').ui_print_help_tip(__('The string modules with several lines show as command output'), true);
+$table->data[$i++][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
 
-$table->data[32][0] = __('Server logs directory').ui_print_help_tip(__('Directory where the server logs are stored.'), true);
-$table->data[32][1] = html_print_input_text(
+$table->data[$i][0] = __('Server logs directory').ui_print_help_tip(__('Directory where the server logs are stored.'), true);
+$table->data[$i++][1] = html_print_input_text(
     'server_log_dir',
     $config['server_log_dir'],
     '',
@@ -242,8 +276,8 @@ $table->data[32][1] = html_print_input_text(
     true
 );
 
-$table->data[33][0] = __('Log size limit in system logs viewer extension').ui_print_help_tip(__('Max size (in bytes) for the logs to be shown.'), true);
-$table->data[33][1] = html_print_input_text(
+$table->data[$i][0] = __('Log size limit in system logs viewer extension').ui_print_help_tip(__('Max size (in bytes) for the logs to be shown.'), true);
+$table->data[$i++][1] = html_print_input_text(
     'max_log_size',
     $config['max_log_size'],
     '',
@@ -257,8 +291,8 @@ $modes_tutorial = [
     'on_demand' => __('On demand'),
     'expert'    => __('Expert'),
 ];
-$table->data['tutorial_mode'][0] = __('Tutorial mode').ui_print_help_tip(__("Configuration of our clippy, 'full mode' show the icon in the header and the contextual helps and it is noise, 'on demand' it is equal to full but it is not noise and 'expert' the icons in the header and the context is not."), true);
-$table->data['tutorial_mode'][1] = html_print_select(
+$table->data[$i][0] = __('Tutorial mode').ui_print_help_tip(__("Configuration of our clippy, 'full mode' show the icon in the header and the contextual helps and it is noise, 'on demand' it is equal to full but it is not noise and 'expert' the icons in the header and the context is not."), true);
+$table->data[$i++][1] = html_print_select(
     $modes_tutorial,
     'tutorial_mode',
     $config['tutorial_mode'],
@@ -269,11 +303,11 @@ $table->data['tutorial_mode'][1] = html_print_select(
 );
 
 $config['past_planned_downtimes'] = isset($config['past_planned_downtimes']) ? $config['past_planned_downtimes'] : 1;
-$table->data[34][0] = __('Allow create planned downtimes in the past').ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true);
-$table->data[34][1] = html_print_checkbox_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true);
+$table->data[$i][0] = __('Allow create planned downtimes in the past').ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true);
+$table->data[$i++][1] = html_print_checkbox_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true);
 
-$table->data[35][0] = __('Limit for bulk operations').ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get('max_input_vars')), true);
-$table->data[35][1] = html_print_input_text(
+$table->data[$i][0] = __('Limit for bulk operations').ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get('max_input_vars')), true);
+$table->data[$i++][1] = html_print_input_text(
     'limit_parameters_massive',
     $config['limit_parameters_massive'],
     '',
@@ -282,17 +316,17 @@ $table->data[35][1] = html_print_input_text(
     true
 );
 
-$table->data[36][0] = __('Include agents manually disabled');
-$table->data[36][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true);
+$table->data[$i][0] = __('Include agents manually disabled');
+$table->data[$i++][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true);
 
-$table->data[37][0] = __('Audit log directory').ui_print_help_tip(__('Directory where audit log is stored.'), true);
-$table->data[37][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true);
+$table->data[$i][0] = __('Audit log directory').ui_print_help_tip(__('Directory where audit log is stored.'), true);
+$table->data[$i++][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true);
 
-$table->data[38][0] = __('Set alias as name by default in agent creation');
-$table->data[38][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
+$table->data[$i][0] = __('Set alias as name by default in agent creation');
+$table->data[$i++][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
 
-$table->data[39][0] = __('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true);
-$table->data[39][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
+$table->data[$i][0] = __('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true);
+$table->data[$i++][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
 
 echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';
 
@@ -394,44 +428,50 @@ $(document).ready (function () {
     });
 
     if ($("input[name=use_cert]").is(':checked')) {
-        $('#setup_general-13').show();
+        $('#ssl-path-tr').show();
     }
 
     $("input[name=use_cert]").change(function () {
         if( $(this).is(":checked") )
-                $('#setup_general-13').show();
+                $('#ssl-path-tr').show();
             else
-                $('#setup_general-13').hide();
+                $('#ssl-path-tr').hide();
         
     });
     $("input[name=https]").change(function (){
         if($("input[name=https]").prop('checked')) {
-            $("#dialog").css({'display': 'inline', 'font-weight': 'bold'}).dialog({
+            $("#dialog").dialog({
             modal: true,
-            buttons:{
-                "<?php echo __('Close'); ?>": function(){
-                    $(this).dialog("close");
+            width: 500,
+            buttons:[
+                {
+                    class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-next',
+                    text: "<?php echo __('OK'); ?>",
+                    click: function(){
+                        $(this).dialog("close");
+                    }
                 }
-            }
+            ]
+        });
+        }
+    })
+
+    $("input[name=force_public_url]").change(function (){
+        if($("input[name=force_public_url]").prop('checked')) {
+            $("#force_public_url_dialog").dialog({
+            modal: true,
+            width: 500,
+            buttons: [
+                {
+                    class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-next',
+                    text: "<?php echo __('OK'); ?>",
+                    click: function(){
+                        $(this).dialog("close");
+                    }
+                }
+            ]
         });
         }
     })
 });
 </script>
-<?php
-function get_sounds()
-{
-    global $config;
-
-    $return = [];
-
-    $files = scandir($config['homedir'].'/include/sounds');
-
-    foreach ($files as $file) {
-        if (strstr($file, 'wav') !== false) {
-            $return['include/sounds/'.$file] = $file;
-        }
-    }
-
-    return $return;
-}
diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php
index bcaff54d95..0e7e41e7d6 100755
--- a/pandora_console/godmode/setup/setup_visuals.php
+++ b/pandora_console/godmode/setup/setup_visuals.php
@@ -159,6 +159,16 @@ $table_styles->data[$row][1] = html_print_select(
 $table_styles->data[$row][1] .= '&nbsp;'.html_print_button(__('View'), 'status_set_preview', false, '', 'class="sub camera logo_preview"', true);
 $row++;
 
+// Divs to show icon status Colours (Default)
+$icon_unknown_ball = ui_print_status_image(STATUS_AGENT_UNKNOWN_BALL, '', true);
+$icon_unknown = ui_print_status_image(STATUS_AGENT_UNKNOWN, '', true);
+$icon_ok_ball = ui_print_status_image(STATUS_AGENT_OK_BALL, '', true);
+$icon_ok = ui_print_status_image(STATUS_AGENT_OK, '', true);
+$icon_warning_ball = ui_print_status_image(STATUS_AGENT_WARNING_BALL, '', true);
+$icon_warning = ui_print_status_image(STATUS_AGENT_WARNING, '', true);
+$icon_bad_ball = ui_print_status_image(STATUS_AGENT_CRITICAL_BALL, '', true);
+$icon_bad = ui_print_status_image(STATUS_AGENT_CRITICAL, '', true);
+// End - Divs to show icon status Colours (Default)
 $table_styles->data[$row][0] = __('Login background').ui_print_help_tip(__('You can place your custom images into the folder images/backgrounds/'), true);
 $backgrounds_list_jpg = list_files('images/backgrounds', 'jpg', 1, 0);
 $backgrounds_list_gif = list_files('images/backgrounds', 'gif', 1, 0);
@@ -1113,15 +1123,6 @@ $row++;
 
 
 
-    $table_other->data[$row][0] = __('Show QR Code icon in the header');
-    $table_other->data[$row][1] = html_print_checkbox_switch(
-        'show_qr_code_header',
-        1,
-        $config['show_qr_code_header'],
-        true
-    );
-    $row++;
-
     $table_other->data[$row][0] = __('Custom graphviz directory').ui_print_help_tip(__('Custom directory where the graphviz binaries are stored.'), true);
     $table_other->data[$row][1] = html_print_input_text(
         'graphviz_bin_dir',
@@ -1504,7 +1505,7 @@ $(document).ready (function () {
             .prop('checked');
         display_custom_report_front(custom_report,$(this).parent().parent().parent().parent().parent().attr('id'));
     });
-    $(".databox.filters").css('margin-bottom','-10px');
+    $(".databox.filters").css('margin-bottom','0px');
 });
 
 // Change the favicon preview when is changed
@@ -1644,6 +1645,17 @@ $("#button-status_set_preview").click (function (e) {
     $icon_bad_ball = $("<img src=\"" + icon_path + "agent_critical_ball.png\">");
     $icon_bad = $("<img src=\"" + icon_path + "agent_critical.png\">");
 
+    if(icon_dir == 'default'){
+        $icon_unknown_ball = '<?php echo $icon_unknown_ball; ?>';
+        $icon_unknown = '<?php echo $icon_unknown; ?>';
+        $icon_ok_ball = '<?php echo $icon_ok_ball; ?>';
+        $icon_ok = '<?php echo $icon_ok; ?>';
+        $icon_warning_ball = '<?php echo $icon_warning_ball; ?>';
+        $icon_warning = '<?php echo $icon_warning; ?>';
+        $icon_bad_ball = '<?php echo $icon_bad_ball; ?>';
+        $icon_bad = '<?php echo $icon_bad; ?>';
+    }
+
     try {
         $dialog
             .hide()
diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php
index a2a1b8b811..66651d6522 100755
--- a/pandora_console/godmode/snmpconsole/snmp_alert.php
+++ b/pandora_console/godmode/snmpconsole/snmp_alert.php
@@ -1275,7 +1275,7 @@ if ($create_alert || $update_alert) {
     $table->align[7] = 'left';
 
     $table->head[8] = __('Action');
-    $table->size[8] = '90px';
+    $table->size[8] = '120px';
     $table->align[8] = 'left';
 
     $table->head[9] = html_print_checkbox('all_delete_box', '1', false, true);
diff --git a/pandora_console/godmode/snmpconsole/snmp_filters.php b/pandora_console/godmode/snmpconsole/snmp_filters.php
index 0d8e1e9480..252373b15a 100644
--- a/pandora_console/godmode/snmpconsole/snmp_filters.php
+++ b/pandora_console/godmode/snmpconsole/snmp_filters.php
@@ -100,7 +100,15 @@ if ($update_filter > -2) {
                 'filter'             => $filter,
                 'unified_filters_id' => $new_unified_id,
             ];
+            if ($values['description'] == '') {
+                $result = false;
+                $msg = __('Description is empty');
+            } else if ($values['filter'] == '') {
+                $result = false;
+                $msg = __('Filter is empty');
+            } else {
                 $result = db_process_sql_insert('tsnmp_filter', $values);
+            }
         } else {
             for ($i = 0; $i < $index_post; $i++) {
                 $filter = get_parameter('filter_'.$i);
@@ -109,12 +117,28 @@ if ($update_filter > -2) {
                     'filter'             => $filter,
                     'unified_filters_id' => $new_unified_id,
                 ];
-                $result = db_process_sql_insert('tsnmp_filter', $values);
+                if ($values['filter'] != '' && $values['description'] != '') {
+                    $result = db_process_sql_insert('tsnmp_filter', $values);
+                }
+            }
+
+            if ($result === null) {
+                if ($values['description'] != '') {
+                    $result = false;
+                    $msg = __('Filters are empty');
+                } else {
+                    $result = false;
+                    $msg = __('Description is empty');
+                }
             }
         }
 
         if ($result === false) {
-            ui_print_error_message(__('There was a problem creating the filter'));
+            if (!isset($msg)) {
+                $msg = __('There was a problem creating the filter');
+            }
+
+            ui_print_error_message($msg);
         } else {
             ui_print_success_message(__('Successfully created'));
         }
@@ -215,8 +239,10 @@ if ($edit_filter > -2) {
     $result_unified = db_get_all_rows_sql('SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id ASC');
 
     $aglomerate_result = [];
-    foreach ($result_unified as $res) {
-        $aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql('SELECT * FROM tsnmp_filter WHERE unified_filters_id = '.$res['unified_filters_id'].' ORDER BY id_snmp_filter ASC');
+    if (is_array($result_unified) === true) {
+        foreach ($result_unified as $res) {
+            $aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql('SELECT * FROM tsnmp_filter WHERE unified_filters_id = '.$res['unified_filters_id'].' ORDER BY id_snmp_filter ASC');
+        }
     }
 
     $table = new stdClass();
@@ -282,7 +308,8 @@ if ($edit_filter > -2) {
 ?>
 
 <script type="text/javascript">
-    var id = "<?php echo $index; ?>";
+    // +1 because there is already a defined 'filter' field.
+    var id = parseInt("<?php echo $index; ?>")+1; 
     var homeurl = "<?php echo $config['homeurl']; ?>";
 
     $(document).ready (function () {
diff --git a/pandora_console/godmode/tag/tag.php b/pandora_console/godmode/tag/tag.php
index 8a8ddc8887..680d0b7a45 100644
--- a/pandora_console/godmode/tag/tag.php
+++ b/pandora_console/godmode/tag/tag.php
@@ -31,6 +31,10 @@ $delete = (int) get_parameter('delete_tag', 0);
 $tag_name = (string) get_parameter('tag_name', '');
 $tab = (string) get_parameter('tab', 'list');
 
+if ($delete != 0 && is_metaconsole()) {
+    open_meta_frame();
+}
+
 // Metaconsole nodes
 $servers = false;
 if (is_metaconsole()) {
@@ -316,6 +320,9 @@ echo '<table border=0 cellpadding=0 cellspacing=0 width=100%>';
     echo '</tr>';
 echo '</table>';
 
+if ($delete != 0 && is_metaconsole()) {
+    close_meta_frame();
+}
 
 // ~ enterprise_hook('close_meta_frame');
 ?>
diff --git a/pandora_console/godmode/update_manager/update_manager.css b/pandora_console/godmode/update_manager/update_manager.css
index 168c6fcf7a..1d3fdc2c12 100644
--- a/pandora_console/godmode/update_manager/update_manager.css
+++ b/pandora_console/godmode/update_manager/update_manager.css
@@ -34,7 +34,7 @@
   float: none;
 }
 #drop_file a {
-  background-color: #80ba27;
+  background-color: #82b92e;
   border-radius: 2px;
   color: #ffffff;
   cursor: pointer;
@@ -101,7 +101,7 @@
   width: 15px;
 }
 .fileupload_form ul li div {
-  display: block !important;
+  display: block;
 }
 .fileupload_form ul li.working span {
   background-position: 0 -12px;
@@ -183,39 +183,22 @@ div#box_online * {
 
 .update_text a {
   font-size: 11pt;
-  color: #82b92e !important;
+  color: #82b92e;
 }
 
 .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
-  float: left !important;
+  float: left;
   padding-left: 19px;
   padding-bottom: 5px;
 }
 
-.ui-dialog-buttonset > button.ui-button.ui-corner-all.ui-widget {
-  background-color: #cecece !important;
-  border: none !important;
-  border-radius: 2px !important;
-  text-transform: uppercase !important;
-  font-weight: bold !important;
-}
-
-.ui-dialog-buttonset > button.success_button.ui-button.ui-corner-all.ui-widget,
-.update_manager_button {
-  background-color: #82b92e !important;
-  color: #fff !important;
-  border-radius: 2px !important;
-  text-transform: uppercase !important;
-  font-weight: bold !important;
-}
-
 a.update_manager_button {
   padding: 10px 12px;
   margin-top: 10px;
   display: inline-flex;
   align-items: center;
-  font-size: 16px !important;
-  border-radius: 4px !important;
+  font-size: 16px;
+  border-radius: 4px;
   text-decoration: none;
   font-family: "Open Sans", sans-serif;
 }
@@ -231,7 +214,7 @@ a.update_manager_button:after {
 
 .ui-draggable,
 .ui-draggable .ui-dialog-titlebar {
-  cursor: default !important;
+  cursor: default;
 }
 
 #box_online #pkg_version {
@@ -242,10 +225,10 @@ a.update_manager_button:after {
 
 /* METACONSOLE */
 .box_online_meta {
-  background: none !important;
-  min-height: 400px !important;
+  background: none;
+  min-height: 400px;
   text-align: center;
-  border: none !important;
+  border: none;
 }
 
 div#box_online.box_online_meta * {
@@ -277,7 +260,7 @@ div#box_online.box_online_meta * {
 }
 
 .update_manager_warning p {
-  font-size: 10pt !important;
+  font-size: 10pt;
 }
 
 .update_manager_warning img {
@@ -287,8 +270,8 @@ div#box_online.box_online_meta * {
 
 a.update_manager_button_open {
   padding: 5px 10px;
-  font-size: 16px !important;
-  border-radius: 4px !important;
+  font-size: 16px;
+  border-radius: 4px;
   text-decoration: none;
   border: 1px solid #82b92e;
   color: #82b92e;
diff --git a/pandora_console/godmode/update_manager/update_manager.offline.php b/pandora_console/godmode/update_manager/update_manager.offline.php
index 24da1a341f..8eff08d996 100644
--- a/pandora_console/godmode/update_manager/update_manager.offline.php
+++ b/pandora_console/godmode/update_manager/update_manager.offline.php
@@ -31,6 +31,11 @@ global $config;
 
 check_login();
 
+if (!enterprise_installed()) {
+    include 'general/noaccess.php';
+    exit;
+}
+
 if (! check_acl($config['id_user'], 0, 'PM')
     && ! is_user_admin($config['id_user'])
 ) {
diff --git a/pandora_console/godmode/update_manager/update_manager.php b/pandora_console/godmode/update_manager/update_manager.php
index 7954fd0ada..6b5d6f3cdd 100644
--- a/pandora_console/godmode/update_manager/update_manager.php
+++ b/pandora_console/godmode/update_manager/update_manager.php
@@ -30,19 +30,21 @@ if ($php_version_array[0] < 7) {
 
 $tab = get_parameter('tab', 'online');
 
-$buttons = [
-    'setup'   => [
-        'active' => ($tab == 'setup') ? true : false,
-        'text'   => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=setup">'.html_print_image('images/gm_setup.png', true, ['title' => __('Options')]).'</a>',
-    ],
-    'offline' => [
+$buttons['setup'] = [
+    'active' => ($tab == 'setup') ? true : false,
+    'text'   => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=setup">'.html_print_image('images/gm_setup.png', true, ['title' => __('Options')]).'</a>',
+];
+
+if (enterprise_installed()) {
+    $buttons['offline'] = [
         'active' => ($tab == 'offline') ? true : false,
         'text'   => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offline">'.html_print_image('images/box.png', true, ['title' => __('Offline update manager')]).'</a>',
-    ],
-    'online'  => [
-        'active' => ($tab == 'online') ? true : false,
-        'text'   => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online">'.html_print_image('images/op_gis.png', true, ['title' => __('Online update manager')]).'</a>',
-    ],
+    ];
+}
+
+$buttons['online'] = [
+    'active' => ($tab == 'online') ? true : false,
+    'text'   => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online">'.html_print_image('images/op_gis.png', true, ['title' => __('Online update manager')]).'</a>',
 ];
 
 
diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php
index 47788284fe..07e9942880 100644
--- a/pandora_console/godmode/users/configure_user.php
+++ b/pandora_console/godmode/users/configure_user.php
@@ -137,6 +137,8 @@ if ($new_user && $config['admin_can_add_user']) {
     $user_info['not_login'] = false;
     $user_info['strict_acl'] = false;
     $user_info['session_time'] = 0;
+    $user_info['middlename'] = 0;
+
     if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
         $user_info['id_skin'] = '';
     }
@@ -218,6 +220,7 @@ if ($create_user) {
     }
 
     $values['not_login'] = (bool) get_parameter('not_login', false);
+    $values['middlename'] = get_parameter('middlename', 0);
     $values['strict_acl'] = (bool) get_parameter('strict_acl', false);
     $values['session_time'] = (int) get_parameter('session_time', 0);
 
@@ -253,6 +256,52 @@ if ($create_user) {
         $password_confirm = '';
         $new_user = true;
     } else {
+        $have_number = false;
+        $have_simbols = false;
+        if ($config['enable_pass_policy']) {
+            if ($config['pass_needs_numbers']) {
+                $nums = preg_match('/([[:alpha:]])*(\d)+(\w)*/', $password_confirm);
+                if ($nums == 0) {
+                    ui_print_error_message(__('Password must contain numbers'));
+                    $user_info = $values;
+                    $password_new = '';
+                    $password_confirm = '';
+                    $new_user = true;
+                } else {
+                    $have_number = true;
+                }
+            }
+
+            if ($config['pass_needs_symbols']) {
+                $symbols = preg_match('/(\w)*(\W)+(\w)*/', $password_confirm);
+                if ($symbols == 0) {
+                    ui_print_error_message(__('Password must contain symbols'));
+                    $user_info = $values;
+                    $password_new = '';
+                    $password_confirm = '';
+                    $new_user = true;
+                } else {
+                    $have_simbols = true;
+                }
+            }
+
+            if ($config['pass_needs_symbols'] && $config['pass_needs_numbers']) {
+                if ($have_number && $have_simbols) {
+                    $result = create_user($id, $password_new, $values);
+                }
+            } else if ($config['pass_needs_symbols'] && !$config['pass_needs_numbers']) {
+                if ($have_simbols) {
+                    $result = create_user($id, $password_new, $values);
+                }
+            } else if (!$config['pass_needs_symbols'] && $config['pass_needs_numbers']) {
+                if ($have_number) {
+                    $result = create_user($id, $password_new, $values);
+                }
+            }
+        } else {
+            $result = create_user($id, $password_new, $values);
+        }
+
         $info = '{"Id_user":"'.$values['id_user'].'","FullName":"'.$values['fullname'].'","Firstname":"'.$values['firstname'].'","Lastname":"'.$values['lastname'].'","Email":"'.$values['email'].'","Phone":"'.$values['phone'].'","Comments":"'.$values['comments'].'","Is_admin":"'.$values['is_admin'].'","Language":"'.$values['language'].'","Timezone":"'.$values['timezone'].'","Block size":"'.$values['block_size'].'"';
 
         if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
@@ -261,7 +310,10 @@ if ($create_user) {
             $info .= '}';
         }
 
-        $result = create_user($id, $password_new, $values);
+        $can_create = false;
+
+
+
         if ($result) {
             $res = save_pass_history($id, $password_new);
         }
@@ -317,12 +369,13 @@ if ($update_user) {
     $values['timezone'] = (string) get_parameter('timezone');
     $values['default_event_filter'] = (int) get_parameter('default_event_filter');
     $values['default_custom_view'] = (int) get_parameter('default_custom_view');
-    // eHorus user level conf
+
+    // eHorus user level conf.
     $values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false);
     $values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user');
     $values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass');
 
-
+    $values['middlename'] = get_parameter('middlename', 0);
 
     $dashboard = get_parameter('dashboard', '');
     $visual_console = get_parameter('visual_console', '');
@@ -571,6 +624,10 @@ if ($delete_profile) {
     );
 }
 
+if ($values) {
+    $user_info = $values;
+}
+
 $table = new stdClass();
 $table->id = 'user_configuration_table';
 $table->width = '100%';
@@ -869,13 +926,27 @@ foreach ($event_filter_data as $filter) {
 $table->data[16][0] = __('Default event filter');
 $table->data[16][1] = html_print_select($event_filter, 'default_event_filter', $user_info['default_event_filter'], '', '', __('None'), true, false, false);
 
+$table->data[17][0] = __('Disabled newsletter');
+if ($user_info['middlename'] >= 0) {
+    $middlename = false;
+} else {
+    $middlename = true;
+}
+
+$table->data[17][1] = html_print_checkbox(
+    'middlename',
+    -1,
+    $middlename,
+    true
+);
+
 if ($config['ehorus_user_level_conf']) {
-    $table->data[17][0] = __('eHorus user acces enabled');
-    $table->data[17][1] = html_print_checkbox('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true);
-    $table->data[18][0] = __('eHorus user');
-    $table->data[19][0] = __('eHorus password');
-    $table->data[18][1] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 15, 45, true);
-    $table->data[19][1] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true);
+    $table->data[18][0] = __('eHorus user acces enabled');
+    $table->data[18][1] = html_print_checkbox('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true);
+    $table->data[19][0] = __('eHorus user');
+    $table->data[20][0] = __('eHorus password');
+    $table->data[19][1] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 15, 45, true);
+    $table->data[20][1] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true);
 }
 
 
diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php
index 63caad6d3f..4e8cfbb2c1 100644
--- a/pandora_console/godmode/users/user_list.php
+++ b/pandora_console/godmode/users/user_list.php
@@ -297,7 +297,14 @@ if (defined('METACONSOLE')) {
     $form_filter = "<form method='post'>";
     $form_filter .= html_print_table($table, true);
     $form_filter .= '</form>';
-    ui_toggle($form_filter, __('Users control filter'), __('Toggle filter(s)'), !$search);
+    ui_toggle(
+        $form_filter,
+        __('Users control filter'),
+        __('Toggle filter(s)'),
+        '',
+        '',
+        !$search
+    );
 }
 
 // Urls to sort the table.
diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php
index 9392d03ad4..ed7e1f3b10 100644
--- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php
+++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php
@@ -418,6 +418,7 @@ class DiscoveryTaskList extends Wizard
             $table->align[9] = 'left';
 
             foreach ($recon_tasks as $task) {
+                $no_operations = false;
                 $data = [];
                 $server_name = servers_get_name($task['id_recon_server']);
 
@@ -501,41 +502,71 @@ class DiscoveryTaskList extends Wizard
                     $data[5] = __('Pending');
                 }
 
-                if ($task['id_recon_script'] == 0) {
-                    // Internal discovery task.
-                    switch ($task['type']) {
-                        case DISCOVERY_CLOUD_AWS_RDS:
-                            // Discovery Applications MySQL.
-                            $data[6] = html_print_image(
-                                'images/network.png',
-                                true,
-                                ['title' => __('Discovery Cloud RDS')]
-                            ).'&nbsp;&nbsp;';
-                            $data[6] .= __('Discovery.Cloud.Aws.RDS');
-                        break;
+                switch ($task['type']) {
+                    case DISCOVERY_CLOUD_AZURE_COMPUTE:
+                        // Discovery Applications MySQL.
+                        $data[6] = html_print_image(
+                            'images/plugin.png',
+                            true,
+                            ['title' => __('Discovery Cloud Azure Compute')]
+                        ).'&nbsp;&nbsp;';
+                        $data[6] .= __('Cloud.Azure.Compute');
+                    break;
 
-                        case DISCOVERY_APP_MYSQL:
-                            // Discovery Applications MySQL.
-                            $data[6] = html_print_image(
-                                'images/network.png',
-                                true,
-                                ['title' => __('Discovery Applications MySQL')]
-                            ).'&nbsp;&nbsp;';
-                            $data[6] .= __('Discovery.App.MySQL');
-                        break;
+                    case DISCOVERY_CLOUD_AWS_EC2:
+                        // Discovery Applications MySQL.
+                        $data[6] = html_print_image(
+                            'images/plugin.png',
+                            true,
+                            ['title' => __('Discovery Cloud AWS EC2')]
+                        ).'&nbsp;&nbsp;';
+                        $data[6] .= __('Cloud.AWS.EC2');
+                    break;
 
-                        case DISCOVERY_APP_ORACLE:
-                            // Discovery Applications Oracle.
-                            $data[6] = html_print_image(
-                                'images/network.png',
-                                true,
-                                ['title' => __('Discovery Applications Oracle')]
-                            ).'&nbsp;&nbsp;';
-                            $data[6] .= __('Discovery.App.Oracle');
-                        break;
+                    case DISCOVERY_CLOUD_AWS_RDS:
+                        // Discovery Cloud RDS.
+                        $data[6] = html_print_image(
+                            'images/network.png',
+                            true,
+                            ['title' => __('Discovery Cloud RDS')]
+                        ).'&nbsp;&nbsp;';
+                        $data[6] .= __('Discovery.Cloud.Aws.RDS');
+                    break;
 
-                        case DISCOVERY_HOSTDEVICES:
-                        default:
+                    case DISCOVERY_APP_MYSQL:
+                        // Discovery Applications MySQL.
+                        $data[6] = html_print_image(
+                            'images/network.png',
+                            true,
+                            ['title' => __('Discovery Applications MySQL')]
+                        ).'&nbsp;&nbsp;';
+                        $data[6] .= __('Discovery.App.MySQL');
+                    break;
+
+                    case DISCOVERY_APP_ORACLE:
+                        // Discovery Applications Oracle.
+                        $data[6] = html_print_image(
+                            'images/network.png',
+                            true,
+                            ['title' => __('Discovery Applications Oracle')]
+                        ).'&nbsp;&nbsp;';
+                        $data[6] .= __('Discovery.App.Oracle');
+                    break;
+
+                    case DISCOVERY_DEPLOY_AGENTS:
+                        // Internal deployment task.
+                        $no_operations = true;
+                        $data[6] = html_print_image(
+                            'images/deploy.png',
+                            true,
+                            ['title' => __('Agent deployment')]
+                        ).'&nbsp;&nbsp;';
+                        $data[6] .= __('Discovery.Agent.Deployment');
+                    break;
+
+                    case DISCOVERY_HOSTDEVICES:
+                    default:
+                        if ($task['id_recon_script'] == 0) {
                             // Discovery NetScan.
                             $data[6] = html_print_image(
                                 'images/network.png',
@@ -550,15 +581,15 @@ class DiscoveryTaskList extends Wizard
                             } else {
                                 $data[6] .= __('Discovery.NetScan');
                             }
-                        break;
-                    }
-                } else {
-                    // APP recon task.
-                    $data[6] = html_print_image(
-                        'images/plugin.png',
-                        true
-                    ).'&nbsp;&nbsp;';
-                    $data[6] .= $recon_script_name;
+                        } else {
+                            // APP or external script recon task.
+                            $data[6] = html_print_image(
+                                'images/plugin.png',
+                                true
+                            ).'&nbsp;&nbsp;';
+                            $data[6] .= $recon_script_name;
+                        }
+                    break;
                 }
 
                 if ($task['status'] <= 0 || $task['status'] > 100) {
@@ -576,71 +607,75 @@ class DiscoveryTaskList extends Wizard
                     $data[8] = __('Not executed yet');
                 }
 
-                if ($task['disabled'] != 2) {
-                    $data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
-                    $data[9] .= html_print_image(
-                        'images/eye.png',
-                        true
-                    );
-                    $data[9] .= '</a>';
-                }
-
-                if ($task['disabled'] != 2 && $task['utimestamp'] > 0
-                    && $task['type'] != DISCOVERY_APP_MYSQL
-                    && $task['type'] != DISCOVERY_APP_ORACLE
-                    && $task['type'] != DISCOVERY_CLOUD_AWS_RDS
-                ) {
-                    $data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
-                    $data[9] .= html_print_image(
-                        'images/dynamic_network_icon.png',
-                        true
-                    );
-                    $data[9] .= '</a>';
-                }
-
-                if (check_acl(
-                    $config['id_user'],
-                    $task['id_group'],
-                    'PM'
-                )
-                ) {
-                    if ($ipam === true) {
-                        $data[9] .= '<a href="'.ui_get_full_url(
-                            sprintf(
-                                'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=%d',
-                                $tipam_task_id
-                            )
-                        ).'">'.html_print_image(
-                            'images/config.png',
+                if (!$no_operations) {
+                    if ($task['disabled'] != 2) {
+                        $data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
+                        $data[9] .= html_print_image(
+                            'images/eye.png',
                             true
-                        ).'</a>';
-                        $data[9] .= '<a href="'.ui_get_full_url(
-                            'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=delete&id='.$tipam_task_id
-                        ).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
-                            'images/cross.png',
+                        );
+                        $data[9] .= '</a>';
+                    }
+
+                    if ($task['disabled'] != 2 && $task['utimestamp'] > 0
+                        && $task['type'] != DISCOVERY_APP_MYSQL
+                        && $task['type'] != DISCOVERY_APP_ORACLE
+                        && $task['type'] != DISCOVERY_CLOUD_AWS_RDS
+                    ) {
+                        $data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
+                        $data[9] .= html_print_image(
+                            'images/dynamic_network_icon.png',
                             true
-                        ).'</a>';
+                        );
+                        $data[9] .= '</a>';
+                    }
+
+                    if (check_acl(
+                        $config['id_user'],
+                        $task['id_group'],
+                        'PM'
+                    )
+                    ) {
+                        if ($ipam === true) {
+                            $data[9] .= '<a href="'.ui_get_full_url(
+                                sprintf(
+                                    'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=%d',
+                                    $tipam_task_id
+                                )
+                            ).'">'.html_print_image(
+                                'images/config.png',
+                                true
+                            ).'</a>';
+                            $data[9] .= '<a href="'.ui_get_full_url(
+                                'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=delete&id='.$tipam_task_id
+                            ).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
+                                'images/cross.png',
+                                true
+                            ).'</a>';
+                        } else {
+                            // Check if is a H&D, Cloud or Application or IPAM.
+                            $data[9] .= '<a href="'.ui_get_full_url(
+                                sprintf(
+                                    'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
+                                    $this->getTargetWiz($task, $recon_script_data),
+                                    $task['id_rt']
+                                )
+                            ).'">'.html_print_image(
+                                'images/config.png',
+                                true
+                            ).'</a>';
+                            $data[9] .= '<a href="'.ui_get_full_url(
+                                'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
+                            ).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
+                                'images/cross.png',
+                                true
+                            ).'</a>';
+                        }
                     } else {
-                        // Check if is a H&D, Cloud or Application or IPAM.
-                        $data[9] .= '<a href="'.ui_get_full_url(
-                            sprintf(
-                                'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
-                                $this->getTargetWiz($task, $recon_script_data),
-                                $task['id_rt']
-                            )
-                        ).'">'.html_print_image(
-                            'images/config.png',
-                            true
-                        ).'</a>';
-                        $data[9] .= '<a href="'.ui_get_full_url(
-                            'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
-                        ).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
-                            'images/cross.png',
-                            true
-                        ).'</a>';
+                        $data[9] = '';
                     }
                 } else {
-                    $data[9] = '';
+                    $data[9] = '-';
                 }
 
                 $table->cellclass[][9] = 'action_buttons';
@@ -651,20 +686,24 @@ class DiscoveryTaskList extends Wizard
                 array_push($table->data, $data);
             }
 
-                echo '<h2>'.__('Server tasks').'</h2>';
             if (empty($table->data)) {
-                echo '<div class="nf">'.__('Server').' '.$server_name.' '.__('has no discovery tasks assigned').'</div>';
-                return false;
+                $content = '<div class="nf">'.__('Server').' '.$server_name.' '.__('has no discovery tasks assigned').'</div>';
+                $return = false;
             } else {
-                html_print_table($table);
+                $content = html_print_table($table, true);
+                $return = true;
             }
 
+            ui_toggle($content, __('Server Tasks'), '', '', false);
+
             // Div neccesary for modal map task.
             echo '<div id="map_task" style="display:none"></div>';
 
             unset($table);
 
             ui_require_javascript_file('pandora_taskList');
+
+            return $return;
         }
 
         return true;
@@ -695,7 +734,16 @@ class DiscoveryTaskList extends Wizard
         if ($script !== false) {
             switch ($script['type']) {
                 case DISCOVERY_SCRIPT_CLOUD_AWS:
-                return 'wiz=cloud&mode=amazonws&page=1';
+                    switch ($task['type']) {
+                        case DISCOVERY_CLOUD_AWS_EC2:
+                        return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1';
+
+                        case DISCOVERY_CLOUD_AZURE_COMPUTE:
+                        return 'wiz=cloud&mode=azure&ki='.$task['auth_strings'].'&sub=compute&page=0';
+
+                        default:
+                        return 'wiz=cloud';
+                    }
 
                 case DISCOVERY_SCRIPT_APP_VMWARE:
                 return 'wiz=app&mode=vmware&page=0';
@@ -718,10 +766,10 @@ class DiscoveryTaskList extends Wizard
 
             case DISCOVERY_CLOUD_AWS:
             case DISCOVERY_CLOUD_AWS_EC2:
-            return 'wiz=cloud&mode=amazonws&page=1';
+            return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&page=1';
 
             case DISCOVERY_CLOUD_AWS_RDS:
-            return 'wiz=cloud&mode=amazonws&sub=rds&page=0';
+            return 'wiz=cloud&mode=amazonws&ki='.$task['auth_strings'].'&sub=rds&page=0';
 
             default:
                 if ($task['description'] == 'console_task') {
diff --git a/pandora_console/godmode/wizards/HostDevices.class.php b/pandora_console/godmode/wizards/HostDevices.class.php
index 3cc2e3f71d..fb9fba2cdd 100755
--- a/pandora_console/godmode/wizards/HostDevices.class.php
+++ b/pandora_console/godmode/wizards/HostDevices.class.php
@@ -32,6 +32,7 @@ require_once $config['homedir'].'/include/class/CustomNetScan.class.php';
 require_once $config['homedir'].'/include/class/ManageNetScanScripts.class.php';
 
 enterprise_include_once('include/class/CSVImportAgents.class.php');
+enterprise_include_once('include/class/DeploymentCenter.class.php');
 enterprise_include_once('include/functions_hostdevices.php');
 
 /**
@@ -127,6 +128,12 @@ class HostDevices extends Wizard
                     'icon'  => ENTERPRISE_DIR.'/images/wizard/csv.png',
                     'label' => __('Import CSV'),
                 ];
+
+                $buttons[] = [
+                    'url'   => $this->url.'&mode=deploy',
+                    'icon'  => ENTERPRISE_DIR.'/images/wizard/deployment.png',
+                    'label' => __('Agent deployment'),
+                ];
             }
 
             $buttons[] = [
@@ -149,11 +156,30 @@ class HostDevices extends Wizard
                         ),
                         'label' => __('Discovery'),
                     ],
+                    [
+                        'link'     => ui_get_full_url(
+                            'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
+                        ),
+                        'label'    => __('Host & Devices'),
+                        'selected' => true,
+                    ],
                 ],
                 true
             );
 
-            ui_print_page_header(__('Host & devices'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
+            ui_print_page_header(
+                __('Host & devices'),
+                '',
+                false,
+                '',
+                true,
+                '',
+                false,
+                '',
+                GENERIC_SIZE_TEXT,
+                '',
+                $this->printHeader(true)
+            );
 
             $this->printBigButtonsList($buttons);
             return;
@@ -167,6 +193,14 @@ class HostDevices extends Wizard
                 );
                 return $csv_importer->runCSV();
             }
+
+            if ($mode === 'deploy') {
+                $deployObject = new DeploymentCenter(
+                    $this->page,
+                    $this->breadcrum
+                );
+                return $deployObject->run();
+            }
         }
 
         if ($mode === 'customnetscan') {
@@ -785,6 +819,7 @@ class HostDevices extends Wizard
                     }).change();';
 
                 $this->printFormAsGrid($form);
+                $this->printGoBackButton($this->url.'&page='.($this->page - 1));
             }
         }
 
@@ -877,6 +912,7 @@ class HostDevices extends Wizard
             ];
 
             $this->printFormAsList($form);
+            $this->printGoBackButton($this->url.'&mode=netscan&task='.$this->task['id_rt'].'&page='.($this->page - 1));
         }
 
         if ($this->page == 2) {
diff --git a/pandora_console/godmode/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php
index f76678ffb6..3a65560285 100644
--- a/pandora_console/godmode/wizards/Wizard.main.php
+++ b/pandora_console/godmode/wizards/Wizard.main.php
@@ -296,241 +296,20 @@ class Wizard
      */
     public function printInput($data)
     {
+        global $config;
+
+        include_once $config['homedir'].'/include/functions_html.php';
+
         if (is_array($data) === false) {
             return '';
         }
 
-        switch ($data['type']) {
-            case 'text':
-            return html_print_input_text(
-                $data['name'],
-                $data['value'],
-                ((isset($data['alt']) === true) ? $data['alt'] : ''),
-                ((isset($data['size']) === true) ? $data['size'] : 50),
-                ((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
-                ((isset($data['return']) === true) ? $data['return'] : true),
-                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
-                ((isset($data['required']) === true) ? $data['required'] : false),
-                ((isset($data['function']) === true) ? $data['function'] : ''),
-                ((isset($data['class']) === true) ? $data['class'] : ''),
-                ((isset($data['onChange']) === true) ? $data['onChange'] : ''),
-                ((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '')
-            );
-
-            case 'image':
-            return html_print_input_image(
-                $data['name'],
-                $data['src'],
-                $data['value'],
-                ((isset($data['style']) === true) ? $data['style'] : ''),
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['options']) === true) ? $data['options'] : false)
-            );
-
-            case 'text_extended':
-            return html_print_input_text_extended(
-                $data['name'],
-                $data['value'],
-                $data['id'],
-                $data['alt'],
-                $data['size'],
-                $data['maxlength'],
-                $data['disabled'],
-                $data['script'],
-                $data['attributes'],
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['password']) === true) ? $data['password'] : false),
-                ((isset($data['function']) === true) ? $data['function'] : '')
-            );
-
-            case 'password':
-            return html_print_input_password(
-                $data['name'],
-                $data['value'],
-                ((isset($data['alt']) === true) ? $data['alt'] : ''),
-                ((isset($data['size']) === true) ? $data['size'] : 50),
-                ((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
-                ((isset($data['required']) === true) ? $data['required'] : false),
-                ((isset($data['class']) === true) ? $data['class'] : '')
-            );
-
-            case 'text':
-            return html_print_input_text(
-                $data['name'],
-                $data['value'],
-                ((isset($data['alt']) === true) ? $data['alt'] : ''),
-                ((isset($data['size']) === true) ? $data['size'] : 50),
-                ((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
-                ((isset($data['required']) === true) ? $data['required'] : false),
-                ((isset($data['function']) === true) ? $data['function'] : ''),
-                ((isset($data['class']) === true) ? $data['class'] : ''),
-                ((isset($data['onChange']) === true) ? $data['onChange'] : ''),
-                ((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '')
-            );
-
-            case 'image':
-            return html_print_input_image(
-                $data['name'],
-                $data['src'],
-                $data['value'],
-                ((isset($data['style']) === true) ? $data['style'] : ''),
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['options']) === true) ? $data['options'] : false)
-            );
-
-            case 'hidden':
-            return html_print_input_hidden(
-                $data['name'],
-                $data['value'],
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['class']) === true) ? $data['class'] : false)
-            );
-
-            case 'hidden_extended':
-            return html_print_input_hidden_extended(
-                $data['name'],
-                $data['value'],
-                $data['id'],
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['class']) === true) ? $data['class'] : false)
-            );
-
-            case 'color':
-            return html_print_input_color(
-                $data['name'],
-                $data['value'],
-                ((isset($data['class']) === true) ? $data['class'] : false),
-                ((isset($data['return']) === true) ? $data['return'] : false)
-            );
-
-            case 'file':
-            return html_print_input_file(
-                $data['name'],
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['options']) === true) ? $data['options'] : false)
-            );
-
-            case 'select':
-            return html_print_select(
-                $data['fields'],
-                $data['name'],
-                ((isset($data['selected']) === true) ? $data['selected'] : ''),
-                ((isset($data['script']) === true) ? $data['script'] : ''),
-                ((isset($data['nothing']) === true) ? $data['nothing'] : ''),
-                ((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['multiple']) === true) ? $data['multiple'] : false),
-                ((isset($data['sort']) === true) ? $data['sort'] : true),
-                ((isset($data['class']) === true) ? $data['class'] : ''),
-                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
-                ((isset($data['style']) === true) ? $data['style'] : false),
-                ((isset($data['option_style']) === true) ? $data['option_style'] : false),
-                ((isset($data['size']) === true) ? $data['size'] : false),
-                ((isset($data['modal']) === true) ? $data['modal'] : false),
-                ((isset($data['message']) === true) ? $data['message'] : ''),
-                ((isset($data['select_all']) === true) ? $data['select_all'] : false)
-            );
-
-            case 'select_from_sql':
-            return html_print_select_from_sql(
-                $data['sql'],
-                $data['name'],
-                ((isset($data['selected']) === true) ? $data['selected'] : ''),
-                ((isset($data['script']) === true) ? $data['script'] : ''),
-                ((isset($data['nothing']) === true) ? $data['nothing'] : ''),
-                ((isset($data['nothing_value']) === true) ? $data['nothing_value'] : '0'),
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['multiple']) === true) ? $data['multiple'] : false),
-                ((isset($data['sort']) === true) ? $data['sort'] : true),
-                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
-                ((isset($data['style']) === true) ? $data['style'] : false),
-                ((isset($data['size']) === true) ? $data['size'] : false),
-                ((isset($data['trucate_size']) === true) ? $data['trucate_size'] : GENERIC_SIZE_TEXT)
-            );
-
-            case 'select_groups':
-            return html_print_select_groups(
-                ((isset($data['id_user']) === true) ? $data['id_user'] : false),
-                ((isset($data['privilege']) === true) ? $data['privilege'] : 'AR'),
-                ((isset($data['returnAllGroup']) === true) ? $data['returnAllGroup'] : true),
-                $data['name'],
-                ((isset($data['selected']) === true) ? $data['selected'] : ''),
-                ((isset($data['script']) === true) ? $data['script'] : ''),
-                ((isset($data['nothing']) === true) ? $data['nothing'] : ''),
-                ((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['multiple']) === true) ? $data['multiple'] : false),
-                ((isset($data['sort']) === true) ? $data['sort'] : true),
-                ((isset($data['class']) === true) ? $data['class'] : ''),
-                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
-                ((isset($data['style']) === true) ? $data['style'] : false),
-                ((isset($data['option_style']) === true) ? $data['option_style'] : false),
-                ((isset($data['id_group']) === true) ? $data['id_group'] : false),
-                ((isset($data['keys_field']) === true) ? $data['keys_field'] : 'id_grupo'),
-                ((isset($data['strict_user']) === true) ? $data['strict_user'] : false),
-                ((isset($data['delete_groups']) === true) ? $data['delete_groups'] : false),
-                ((isset($data['include_groups']) === true) ? $data['include_groups'] : false),
-                ((isset($data['size']) === true) ? $data['size'] : false),
-                ((isset($data['simple_multiple_options']) === true) ? $data['simple_multiple_options'] : false)
-            );
-
-            case 'submit':
-            return '<div class="action-buttons" style="width: 100%">'.html_print_submit_button(
-                ((isset($data['label']) === true) ? $data['label'] : 'OK'),
-                ((isset($data['name']) === true) ? $data['name'] : ''),
-                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
-                ((isset($data['attributes']) === true) ? $data['attributes'] : ''),
-                ((isset($data['return']) === true) ? $data['return'] : false)
-            ).'</div>';
-
-            case 'checkbox':
-            return html_print_checkbox(
-                $data['name'],
-                $data['value'],
-                ((isset($data['checked']) === true) ? $data['checked'] : false),
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
-                ((isset($data['script']) === true) ? $data['script'] : ''),
-                ((isset($data['disabled_hidden']) === true) ? $data['disabled_hidden'] : false)
-            );
-
-            case 'switch':
-            return html_print_switch($data);
-
-            case 'interval':
-            return html_print_extended_select_for_time(
-                $data['name'],
-                $data['value'],
-                ((isset($data['script']) === true) ? $data['script'] : ''),
-                ((isset($data['nothing']) === true) ? $data['nothing'] : ''),
-                ((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
-                ((isset($data['size']) === true) ? $data['size'] : false),
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['style']) === true) ? $data['selected'] : false),
-                ((isset($data['unique']) === true) ? $data['unique'] : false)
-            );
-
-            case 'textarea':
-            return html_print_textarea(
-                $data['name'],
-                $data['rows'],
-                $data['columns'],
-                ((isset($data['value']) === true) ? $data['value'] : ''),
-                ((isset($data['attributes']) === true) ? $data['attributes'] : ''),
-                ((isset($data['return']) === true) ? $data['return'] : false),
-                ((isset($data['class']) === true) ? $data['class'] : '')
-            );
-
-            default:
-                // Ignore.
-            break;
+        $input = html_print_input(($data + ['return' => true]), 'div', true);
+        if ($input === false) {
+            return '';
         }
 
-        return '';
+        return $input;
     }
 
 
@@ -556,6 +335,7 @@ class Wizard
             ],
             'inputs' => [
                 [
+                    'class'     => 'w100p',
                     'arguments' => [
                         'name'       => 'submit',
                         'label'      => __('Go back'),
@@ -594,13 +374,24 @@ class Wizard
 
         if (is_array($input['block_content']) === true) {
             // Print independent block of inputs.
-            $output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
-            $output .= '<ul class="wizard">';
+            if ($input['wrapper']) {
+                $output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
+                $output .= '<'.$input['wrapper'].' id="'.$input['block_id'].'" class="'.$class.'">';
+            } else {
+                $output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
+            }
+
+            $output .= '<ul class="wizard '.$input['block_class'].'">';
             foreach ($input['block_content'] as $input) {
                 $output .= $this->printBlock($input, $return);
             }
 
-            $output .= '</ul></li>';
+            // Close block.
+            if ($input['wrapper']) {
+                $output .= '</ul></'.$input['wrapper'].'>';
+            } else {
+                $output .= '</ul></li>';
+            }
         } else {
             if ($input['arguments']['type'] != 'hidden') {
                 $output .= '<li id="'.$input['id'].'" class="'.$class.'">';
@@ -648,7 +439,7 @@ class Wizard
         if (is_array($input['block_content']) === true) {
             // Print independent block of inputs.
             $output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
-            $output .= '<ul class="wizard">';
+            $output .= '<ul class="wizard '.$input['block_class'].'">';
             foreach ($input['block_content'] as $input) {
                 $output .= $this->printBlockAsGrid($input, $return);
             }
@@ -659,18 +450,18 @@ class Wizard
                 if ($input['arguments']['inline'] != 'true') {
                     $output .= '<div class="edit_discovery_input">';
                 } else {
-                    $output .= '<div style="display: flex; margin-bottom: 25px;">';
+                    $output .= '<div style="display: flex; margin-bottom: 25px; flex-wrap: wrap;">';
                     if (!isset($input['extra'])) {
                         $output .= '<div style="width: 50%;">';
                     }
 
                     if (isset($input['extra'])) {
-                        $output .= '<div style="width: 50%; display: flex;">';
+                        $output .= '<div style="display: flex; margin-right:10px;">';
                     }
                 }
 
                 if ($input['arguments']['inline'] == 'true' && isset($input['extra'])) {
-                    $output .= '<div style="width: 50%">';
+                    $output .= '<div style="margin-right:10px;">';
                 }
 
                 $output .= '<div class="label_select">';
@@ -690,11 +481,11 @@ class Wizard
                     $output .= $this->printInput($input['arguments']);
                     $output .= '</div>';
                 } else if ($input['arguments']['inline'] == 'true') {
-                    $output .= '<div style="width: 50%;">';
-
                     if (isset($input['extra'])) {
-                        $output .= '<div style="float: center;">';
+                        $output .= '<div style="">';
+                        $output .= '<div style="float: left;">';
                     } else {
+                        $output .= '<div style="width:50%;">';
                         $output .= '<div style="float: right;">';
                     }
 
@@ -751,7 +542,7 @@ class Wizard
         if (is_array($input['block_content']) === true) {
             // Print independent block of inputs.
             $output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
-            $output .= '<ul class="wizard">';
+            $output .= '<ul class="wizard '.$input['block_class'].'">';
             foreach ($input['block_content'] as $input) {
                 $output .= $this->printBlockAsList($input, $return);
             }
@@ -797,10 +588,11 @@ class Wizard
         $form = $data['form'];
         $inputs = $data['inputs'];
         $js = $data['js'];
+        $rawjs = $data['js_block'];
         $cb_function = $data['cb_function'];
         $cb_args = $data['cb_args'];
 
-        $output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
+        $output_head = '<form id="'.$form['id'].'" class="discovery '.$form['class'].'" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
         $output_head .= '" '.$form['extra'].'>';
 
         if ($return === false) {
@@ -844,6 +636,9 @@ class Wizard
         $output .= '<ul class="wizard">'.$output_submit.'</ul>';
         $output .= '</form>';
         $output .= '<script>'.$js.'</script>';
+        if ($rawjs) {
+            $output .= $rawjs;
+        }
 
         if ($return === false) {
             echo $output;
@@ -869,10 +664,11 @@ class Wizard
         $rows = $data['rows'];
 
         $js = $data['js'];
+        $rawjs = $data['js_block'];
         $cb_function = $data['cb_function'];
         $cb_args = $data['cb_args'];
 
-        $output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
+        $output_head = '<form class="discovery" onsubmit="'.$form['onsubmit'].'"  enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
         $output_head .= '" '.$form['extra'].'>';
 
         if ($return === false) {
@@ -895,45 +691,47 @@ class Wizard
 
         $first_block_printed = false;
 
-        foreach ($rows as $row) {
-            if ($row['new_form_block'] == true) {
-                if ($first_block_printed === true) {
-                    // If first form block has been placed, then close it before starting a new one.
-                    $output .= '</div>';
-                    $output .= '<div class="white_box" style="margin-top: 30px;">';
-                } else {
-                    $output .= '<div class="white_box">';
+        if (is_array($rows)) {
+            foreach ($rows as $row) {
+                if ($row['new_form_block'] == true) {
+                    if ($first_block_printed === true) {
+                        // If first form block has been placed, then close it before starting a new one.
+                        $output .= '</div>';
+                        $output .= '<div class="white_box" style="margin-top: 30px;">';
+                    } else {
+                        $output .= '<div class="white_box">';
+                    }
+
+                    $first_block_printed = true;
                 }
 
-                $first_block_printed = true;
-            }
+                $output .= '<div class="edit_discovery_info" style="'.$row['style'].'">';
 
-            $output .= '<div class="edit_discovery_info" style="'.$row['style'].'">';
+                foreach ($row['columns'] as $column) {
+                    $width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;';
+                    $padding_left = isset($column['padding-left']) ? 'padding-left: '.$column['padding-left'].';' : 'padding-left: 0;';
+                    $padding_right = isset($column['padding-right']) ? 'padding-right: '.$column['padding-right'].';' : 'padding-right: 0;';
+                    $extra_styles = isset($column['style']) ? $column['style'] : '';
 
-            foreach ($row['columns'] as $column) {
-                $width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;';
-                $padding_left = isset($column['padding-left']) ? 'padding-left: '.$column['padding-left'].';' : 'padding-left: 0;';
-                $padding_right = isset($column['padding-right']) ? 'padding-right: '.$column['padding-right'].';' : 'padding-right: 0;';
-                $extra_styles = isset($column['style']) ? $column['style'] : '';
+                    $output .= '<div style="'.$width.$padding_left.$padding_right.$extra_styles.'">';
 
-                $output .= '<div style="'.$width.$padding_left.$padding_right.$extra_styles.'">';
-
-                foreach ($column['inputs'] as $input) {
-                    if (is_array($input)) {
-                        if ($input['arguments']['type'] != 'submit') {
-                            $output .= $this->printBlockAsGrid($input, true);
+                    foreach ($column['inputs'] as $input) {
+                        if (is_array($input)) {
+                            if ($input['arguments']['type'] != 'submit') {
+                                $output .= $this->printBlockAsGrid($input, true);
+                            } else {
+                                $output_submit .= $this->printBlockAsGrid($input, true);
+                            }
                         } else {
-                            $output_submit .= $this->printBlockAsGrid($input, true);
+                            $output .= $input;
                         }
-                    } else {
-                        $output .= $input;
                     }
+
+                    $output .= '</div>';
                 }
 
                 $output .= '</div>';
             }
-
-            $output .= '</div>';
         }
 
         $output .= '</div>';
@@ -941,6 +739,9 @@ class Wizard
         $output .= '<ul class="wizard">'.$output_submit.'</ul>';
         $output .= '</form>';
         $output .= '<script>'.$js.'</script>';
+        if ($rawjs) {
+            $output .= $rawjs;
+        }
 
         if ($return === false) {
             echo $output;
@@ -964,10 +765,11 @@ class Wizard
         $form = $data['form'];
         $inputs = $data['inputs'];
         $js = $data['js'];
+        $rawjs = $data['js_block'];
         $cb_function = $data['cb_function'];
         $cb_args = $data['cb_args'];
 
-        $output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
+        $output_head = '<form class="discovery" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
         $output_head .= '" '.$form['extra'].'>';
 
         if ($return === false) {
@@ -1001,6 +803,9 @@ class Wizard
         $output .= '<ul class="wizard">'.$output_submit.'</ul>';
         $output .= '</form>';
         $output .= '<script>'.$js.'</script>';
+        if ($rawjs) {
+            $output .= $rawjs;
+        }
 
         if ($return === false) {
             echo $output;
@@ -1048,7 +853,7 @@ class Wizard
      */
     public static function printBigButtonsList($list_data)
     {
-        echo '<ul>';
+        echo '<ul class="bigbuttonlist">';
         array_map('self::printBigButtonElement', $list_data);
         echo '</ul>';
     }
diff --git a/pandora_console/images/arrow_left_green.png b/pandora_console/images/arrow_left_green.png
new file mode 100644
index 0000000000..b6aadc9639
Binary files /dev/null and b/pandora_console/images/arrow_left_green.png differ
diff --git a/pandora_console/images/console/background/fondo.jpg b/pandora_console/images/console/background/fondo.jpg
new file mode 100644
index 0000000000..817ab9d050
Binary files /dev/null and b/pandora_console/images/console/background/fondo.jpg differ
diff --git a/pandora_console/images/console/icons/rack_double_server.png b/pandora_console/images/console/icons/rack_double_server.png
new file mode 100644
index 0000000000..7ce45ab718
Binary files /dev/null and b/pandora_console/images/console/icons/rack_double_server.png differ
diff --git a/pandora_console/images/console/icons/rack_double_server_bad.png b/pandora_console/images/console/icons/rack_double_server_bad.png
new file mode 100644
index 0000000000..94ada7ad16
Binary files /dev/null and b/pandora_console/images/console/icons/rack_double_server_bad.png differ
diff --git a/pandora_console/images/console/icons/rack_double_server_ok.png b/pandora_console/images/console/icons/rack_double_server_ok.png
new file mode 100644
index 0000000000..8a06465a3c
Binary files /dev/null and b/pandora_console/images/console/icons/rack_double_server_ok.png differ
diff --git a/pandora_console/images/console/icons/rack_double_server_warning.png b/pandora_console/images/console/icons/rack_double_server_warning.png
new file mode 100644
index 0000000000..2639b16afd
Binary files /dev/null and b/pandora_console/images/console/icons/rack_double_server_warning.png differ
diff --git a/pandora_console/images/console/icons/rack_firewall.png b/pandora_console/images/console/icons/rack_firewall.png
new file mode 100644
index 0000000000..7635fd6d57
Binary files /dev/null and b/pandora_console/images/console/icons/rack_firewall.png differ
diff --git a/pandora_console/images/console/icons/rack_firewall_bad.png b/pandora_console/images/console/icons/rack_firewall_bad.png
new file mode 100644
index 0000000000..5c6ea2e2b0
Binary files /dev/null and b/pandora_console/images/console/icons/rack_firewall_bad.png differ
diff --git a/pandora_console/images/console/icons/rack_firewall_ok.png b/pandora_console/images/console/icons/rack_firewall_ok.png
new file mode 100644
index 0000000000..bb245983a1
Binary files /dev/null and b/pandora_console/images/console/icons/rack_firewall_ok.png differ
diff --git a/pandora_console/images/console/icons/rack_firewall_warning.png b/pandora_console/images/console/icons/rack_firewall_warning.png
new file mode 100644
index 0000000000..0b2a3150fa
Binary files /dev/null and b/pandora_console/images/console/icons/rack_firewall_warning.png differ
diff --git a/pandora_console/images/console/icons/rack_frame.png b/pandora_console/images/console/icons/rack_frame.png
new file mode 100644
index 0000000000..91baaa7c8a
Binary files /dev/null and b/pandora_console/images/console/icons/rack_frame.png differ
diff --git a/pandora_console/images/console/icons/rack_frame_bad.png b/pandora_console/images/console/icons/rack_frame_bad.png
new file mode 100644
index 0000000000..c6ed4cff03
Binary files /dev/null and b/pandora_console/images/console/icons/rack_frame_bad.png differ
diff --git a/pandora_console/images/console/icons/rack_frame_ok.png b/pandora_console/images/console/icons/rack_frame_ok.png
new file mode 100644
index 0000000000..4743ff5d88
Binary files /dev/null and b/pandora_console/images/console/icons/rack_frame_ok.png differ
diff --git a/pandora_console/images/console/icons/rack_frame_warning.png b/pandora_console/images/console/icons/rack_frame_warning.png
new file mode 100644
index 0000000000..a30b937218
Binary files /dev/null and b/pandora_console/images/console/icons/rack_frame_warning.png differ
diff --git a/pandora_console/images/console/icons/rack_hard_disk.png b/pandora_console/images/console/icons/rack_hard_disk.png
new file mode 100644
index 0000000000..f445bd2d62
Binary files /dev/null and b/pandora_console/images/console/icons/rack_hard_disk.png differ
diff --git a/pandora_console/images/console/icons/rack_hard_disk_2.png b/pandora_console/images/console/icons/rack_hard_disk_2.png
new file mode 100644
index 0000000000..26f646b2bb
Binary files /dev/null and b/pandora_console/images/console/icons/rack_hard_disk_2.png differ
diff --git a/pandora_console/images/console/icons/rack_hard_disk_2_bad.png b/pandora_console/images/console/icons/rack_hard_disk_2_bad.png
new file mode 100644
index 0000000000..f41143f2bd
Binary files /dev/null and b/pandora_console/images/console/icons/rack_hard_disk_2_bad.png differ
diff --git a/pandora_console/images/console/icons/rack_hard_disk_2_ok.png b/pandora_console/images/console/icons/rack_hard_disk_2_ok.png
new file mode 100644
index 0000000000..2db4df0236
Binary files /dev/null and b/pandora_console/images/console/icons/rack_hard_disk_2_ok.png differ
diff --git a/pandora_console/images/console/icons/rack_hard_disk_2_warning.png b/pandora_console/images/console/icons/rack_hard_disk_2_warning.png
new file mode 100644
index 0000000000..f0d3c4d28d
Binary files /dev/null and b/pandora_console/images/console/icons/rack_hard_disk_2_warning.png differ
diff --git a/pandora_console/images/console/icons/rack_hard_disk_bad.png b/pandora_console/images/console/icons/rack_hard_disk_bad.png
new file mode 100644
index 0000000000..d1a9d1ac3f
Binary files /dev/null and b/pandora_console/images/console/icons/rack_hard_disk_bad.png differ
diff --git a/pandora_console/images/console/icons/rack_hard_disk_ok.png b/pandora_console/images/console/icons/rack_hard_disk_ok.png
new file mode 100644
index 0000000000..49b7f42aec
Binary files /dev/null and b/pandora_console/images/console/icons/rack_hard_disk_ok.png differ
diff --git a/pandora_console/images/console/icons/rack_hard_disk_warning.png b/pandora_console/images/console/icons/rack_hard_disk_warning.png
new file mode 100644
index 0000000000..4be91d1054
Binary files /dev/null and b/pandora_console/images/console/icons/rack_hard_disk_warning.png differ
diff --git a/pandora_console/images/console/icons/rack_pdu.png b/pandora_console/images/console/icons/rack_pdu.png
new file mode 100644
index 0000000000..4cdefdaae9
Binary files /dev/null and b/pandora_console/images/console/icons/rack_pdu.png differ
diff --git a/pandora_console/images/console/icons/rack_pdu_bad.png b/pandora_console/images/console/icons/rack_pdu_bad.png
new file mode 100644
index 0000000000..7017cd43ec
Binary files /dev/null and b/pandora_console/images/console/icons/rack_pdu_bad.png differ
diff --git a/pandora_console/images/console/icons/rack_pdu_ok.png b/pandora_console/images/console/icons/rack_pdu_ok.png
new file mode 100644
index 0000000000..2490ad2bc5
Binary files /dev/null and b/pandora_console/images/console/icons/rack_pdu_ok.png differ
diff --git a/pandora_console/images/console/icons/rack_pdu_warning.png b/pandora_console/images/console/icons/rack_pdu_warning.png
new file mode 100644
index 0000000000..a825c8adfc
Binary files /dev/null and b/pandora_console/images/console/icons/rack_pdu_warning.png differ
diff --git a/pandora_console/images/console/icons/rack_psa.png b/pandora_console/images/console/icons/rack_psa.png
new file mode 100644
index 0000000000..28681104e4
Binary files /dev/null and b/pandora_console/images/console/icons/rack_psa.png differ
diff --git a/pandora_console/images/console/icons/rack_psa_bad.png b/pandora_console/images/console/icons/rack_psa_bad.png
new file mode 100644
index 0000000000..c777b83b73
Binary files /dev/null and b/pandora_console/images/console/icons/rack_psa_bad.png differ
diff --git a/pandora_console/images/console/icons/rack_psa_ok.png b/pandora_console/images/console/icons/rack_psa_ok.png
new file mode 100644
index 0000000000..3b66174ab8
Binary files /dev/null and b/pandora_console/images/console/icons/rack_psa_ok.png differ
diff --git a/pandora_console/images/console/icons/rack_psa_warning.png b/pandora_console/images/console/icons/rack_psa_warning.png
new file mode 100644
index 0000000000..ed4fa00355
Binary files /dev/null and b/pandora_console/images/console/icons/rack_psa_warning.png differ
diff --git a/pandora_console/images/console/icons/rack_router.png b/pandora_console/images/console/icons/rack_router.png
new file mode 100644
index 0000000000..905d4cf5b3
Binary files /dev/null and b/pandora_console/images/console/icons/rack_router.png differ
diff --git a/pandora_console/images/console/icons/rack_router_bad.png b/pandora_console/images/console/icons/rack_router_bad.png
new file mode 100644
index 0000000000..2d44cc62af
Binary files /dev/null and b/pandora_console/images/console/icons/rack_router_bad.png differ
diff --git a/pandora_console/images/console/icons/rack_router_ok.png b/pandora_console/images/console/icons/rack_router_ok.png
new file mode 100644
index 0000000000..404ba7d854
Binary files /dev/null and b/pandora_console/images/console/icons/rack_router_ok.png differ
diff --git a/pandora_console/images/console/icons/rack_router_warning.png b/pandora_console/images/console/icons/rack_router_warning.png
new file mode 100644
index 0000000000..11fe7ebcc8
Binary files /dev/null and b/pandora_console/images/console/icons/rack_router_warning.png differ
diff --git a/pandora_console/images/console/icons/rack_server.png b/pandora_console/images/console/icons/rack_server.png
new file mode 100644
index 0000000000..007a801146
Binary files /dev/null and b/pandora_console/images/console/icons/rack_server.png differ
diff --git a/pandora_console/images/console/icons/rack_server_bad.png b/pandora_console/images/console/icons/rack_server_bad.png
new file mode 100644
index 0000000000..afd8e3ba93
Binary files /dev/null and b/pandora_console/images/console/icons/rack_server_bad.png differ
diff --git a/pandora_console/images/console/icons/rack_server_ok.png b/pandora_console/images/console/icons/rack_server_ok.png
new file mode 100644
index 0000000000..1ef4b9e1c2
Binary files /dev/null and b/pandora_console/images/console/icons/rack_server_ok.png differ
diff --git a/pandora_console/images/console/icons/rack_server_rack.png b/pandora_console/images/console/icons/rack_server_rack.png
new file mode 100644
index 0000000000..884b42e668
Binary files /dev/null and b/pandora_console/images/console/icons/rack_server_rack.png differ
diff --git a/pandora_console/images/console/icons/rack_server_rack_bad.png b/pandora_console/images/console/icons/rack_server_rack_bad.png
new file mode 100644
index 0000000000..29e5e4b4ef
Binary files /dev/null and b/pandora_console/images/console/icons/rack_server_rack_bad.png differ
diff --git a/pandora_console/images/console/icons/rack_server_rack_ok.png b/pandora_console/images/console/icons/rack_server_rack_ok.png
new file mode 100644
index 0000000000..2f346bb2d1
Binary files /dev/null and b/pandora_console/images/console/icons/rack_server_rack_ok.png differ
diff --git a/pandora_console/images/console/icons/rack_server_rack_warning.png b/pandora_console/images/console/icons/rack_server_rack_warning.png
new file mode 100644
index 0000000000..a30d308a52
Binary files /dev/null and b/pandora_console/images/console/icons/rack_server_rack_warning.png differ
diff --git a/pandora_console/images/console/icons/rack_server_warning.png b/pandora_console/images/console/icons/rack_server_warning.png
new file mode 100644
index 0000000000..08faef378b
Binary files /dev/null and b/pandora_console/images/console/icons/rack_server_warning.png differ
diff --git a/pandora_console/images/console/icons/rack_switch.png b/pandora_console/images/console/icons/rack_switch.png
new file mode 100644
index 0000000000..9ac9e73b63
Binary files /dev/null and b/pandora_console/images/console/icons/rack_switch.png differ
diff --git a/pandora_console/images/console/icons/rack_switch_bad.png b/pandora_console/images/console/icons/rack_switch_bad.png
new file mode 100644
index 0000000000..73c5da7956
Binary files /dev/null and b/pandora_console/images/console/icons/rack_switch_bad.png differ
diff --git a/pandora_console/images/console/icons/rack_switch_ok.png b/pandora_console/images/console/icons/rack_switch_ok.png
new file mode 100644
index 0000000000..c5177785a4
Binary files /dev/null and b/pandora_console/images/console/icons/rack_switch_ok.png differ
diff --git a/pandora_console/images/console/icons/rack_switch_warning.png b/pandora_console/images/console/icons/rack_switch_warning.png
new file mode 100644
index 0000000000..188a82ca88
Binary files /dev/null and b/pandora_console/images/console/icons/rack_switch_warning.png differ
diff --git a/pandora_console/images/deploy.png b/pandora_console/images/deploy.png
new file mode 100644
index 0000000000..1cb28a44fb
Binary files /dev/null and b/pandora_console/images/deploy.png differ
diff --git a/pandora_console/images/groups_small_white/application_osx.png b/pandora_console/images/groups_small_white/application_osx.png
new file mode 100644
index 0000000000..409d9742d2
Binary files /dev/null and b/pandora_console/images/groups_small_white/application_osx.png differ
diff --git a/pandora_console/images/groups_small_white/application_osx_terminal.png b/pandora_console/images/groups_small_white/application_osx_terminal.png
new file mode 100644
index 0000000000..3deb76aa34
Binary files /dev/null and b/pandora_console/images/groups_small_white/application_osx_terminal.png differ
diff --git a/pandora_console/images/groups_small_white/applications.png b/pandora_console/images/groups_small_white/applications.png
new file mode 100644
index 0000000000..362ed8b98d
Binary files /dev/null and b/pandora_console/images/groups_small_white/applications.png differ
diff --git a/pandora_console/images/groups_small_white/bricks.png b/pandora_console/images/groups_small_white/bricks.png
new file mode 100644
index 0000000000..b68255b88b
Binary files /dev/null and b/pandora_console/images/groups_small_white/bricks.png differ
diff --git a/pandora_console/images/groups_small_white/chart_organisation.png b/pandora_console/images/groups_small_white/chart_organisation.png
new file mode 100644
index 0000000000..d80fc4f65f
Binary files /dev/null and b/pandora_console/images/groups_small_white/chart_organisation.png differ
diff --git a/pandora_console/images/groups_small_white/clock.png b/pandora_console/images/groups_small_white/clock.png
new file mode 100644
index 0000000000..dc16f55773
Binary files /dev/null and b/pandora_console/images/groups_small_white/clock.png differ
diff --git a/pandora_console/images/groups_small_white/computer.png b/pandora_console/images/groups_small_white/computer.png
new file mode 100644
index 0000000000..5eab00e255
Binary files /dev/null and b/pandora_console/images/groups_small_white/computer.png differ
diff --git a/pandora_console/images/groups_small_white/database.png b/pandora_console/images/groups_small_white/database.png
new file mode 100644
index 0000000000..397f3fa5d3
Binary files /dev/null and b/pandora_console/images/groups_small_white/database.png differ
diff --git a/pandora_console/images/groups_small_white/database_gear.png b/pandora_console/images/groups_small_white/database_gear.png
new file mode 100644
index 0000000000..72a6b63d0f
Binary files /dev/null and b/pandora_console/images/groups_small_white/database_gear.png differ
diff --git a/pandora_console/images/groups_small_white/drive_network.png b/pandora_console/images/groups_small_white/drive_network.png
new file mode 100644
index 0000000000..4e1cd615c6
Binary files /dev/null and b/pandora_console/images/groups_small_white/drive_network.png differ
diff --git a/pandora_console/images/groups_small_white/email.png b/pandora_console/images/groups_small_white/email.png
new file mode 100644
index 0000000000..496991da88
Binary files /dev/null and b/pandora_console/images/groups_small_white/email.png differ
diff --git a/pandora_console/images/groups_small_white/eye.png b/pandora_console/images/groups_small_white/eye.png
new file mode 100644
index 0000000000..f5c8a4e940
Binary files /dev/null and b/pandora_console/images/groups_small_white/eye.png differ
diff --git a/pandora_console/images/groups_small_white/firewall.png b/pandora_console/images/groups_small_white/firewall.png
new file mode 100644
index 0000000000..261adbcb1e
Binary files /dev/null and b/pandora_console/images/groups_small_white/firewall.png differ
diff --git a/pandora_console/images/groups_small_white/heart.png b/pandora_console/images/groups_small_white/heart.png
new file mode 100644
index 0000000000..6bfec0298a
Binary files /dev/null and b/pandora_console/images/groups_small_white/heart.png differ
diff --git a/pandora_console/images/groups_small_white/house.png b/pandora_console/images/groups_small_white/house.png
new file mode 100644
index 0000000000..72ab42dd35
Binary files /dev/null and b/pandora_console/images/groups_small_white/house.png differ
diff --git a/pandora_console/images/groups_small_white/images.png b/pandora_console/images/groups_small_white/images.png
new file mode 100644
index 0000000000..195c7e222b
Binary files /dev/null and b/pandora_console/images/groups_small_white/images.png differ
diff --git a/pandora_console/images/groups_small_white/lightning.png b/pandora_console/images/groups_small_white/lightning.png
new file mode 100644
index 0000000000..31a0670a68
Binary files /dev/null and b/pandora_console/images/groups_small_white/lightning.png differ
diff --git a/pandora_console/images/groups_small_white/lock.png b/pandora_console/images/groups_small_white/lock.png
new file mode 100644
index 0000000000..522ff71bd6
Binary files /dev/null and b/pandora_console/images/groups_small_white/lock.png differ
diff --git a/pandora_console/images/groups_small_white/network.png b/pandora_console/images/groups_small_white/network.png
new file mode 100644
index 0000000000..1a8573a729
Binary files /dev/null and b/pandora_console/images/groups_small_white/network.png differ
diff --git a/pandora_console/images/groups_small_white/plugin.png b/pandora_console/images/groups_small_white/plugin.png
new file mode 100644
index 0000000000..051ec05d6b
Binary files /dev/null and b/pandora_console/images/groups_small_white/plugin.png differ
diff --git a/pandora_console/images/groups_small_white/printer.png b/pandora_console/images/groups_small_white/printer.png
new file mode 100644
index 0000000000..4187e87a00
Binary files /dev/null and b/pandora_console/images/groups_small_white/printer.png differ
diff --git a/pandora_console/images/groups_small_white/server_database.png b/pandora_console/images/groups_small_white/server_database.png
new file mode 100644
index 0000000000..864e3cb7cb
Binary files /dev/null and b/pandora_console/images/groups_small_white/server_database.png differ
diff --git a/pandora_console/images/groups_small_white/transmit.png b/pandora_console/images/groups_small_white/transmit.png
new file mode 100644
index 0000000000..d27f5c377d
Binary files /dev/null and b/pandora_console/images/groups_small_white/transmit.png differ
diff --git a/pandora_console/images/groups_small_white/without_group.png b/pandora_console/images/groups_small_white/without_group.png
new file mode 100644
index 0000000000..30915bd101
Binary files /dev/null and b/pandora_console/images/groups_small_white/without_group.png differ
diff --git a/pandora_console/images/groups_small_white/world.png b/pandora_console/images/groups_small_white/world.png
new file mode 100644
index 0000000000..dcfd04139b
Binary files /dev/null and b/pandora_console/images/groups_small_white/world.png differ
diff --git a/pandora_console/images/heartbeat_green.gif b/pandora_console/images/heartbeat_green.gif
new file mode 100644
index 0000000000..a985013064
Binary files /dev/null and b/pandora_console/images/heartbeat_green.gif differ
diff --git a/pandora_console/images/heartbeat_green_black.gif b/pandora_console/images/heartbeat_green_black.gif
new file mode 100644
index 0000000000..b365cade3f
Binary files /dev/null and b/pandora_console/images/heartbeat_green_black.gif differ
diff --git a/pandora_console/images/heartbeat_red.gif b/pandora_console/images/heartbeat_red.gif
new file mode 100644
index 0000000000..abc8d83832
Binary files /dev/null and b/pandora_console/images/heartbeat_red.gif differ
diff --git a/pandora_console/images/heartbeat_red_black.gif b/pandora_console/images/heartbeat_red_black.gif
new file mode 100644
index 0000000000..90fed812db
Binary files /dev/null and b/pandora_console/images/heartbeat_red_black.gif differ
diff --git a/pandora_console/images/input_deploy.png b/pandora_console/images/input_deploy.png
new file mode 100644
index 0000000000..c66f4ddd56
Binary files /dev/null and b/pandora_console/images/input_deploy.png differ
diff --git a/pandora_console/images/status_sets/default/module_alertsfired_rounded.png b/pandora_console/images/status_sets/default/module_alertsfired_rounded.png
deleted file mode 100644
index 7a9b5ae0cd..0000000000
Binary files a/pandora_console/images/status_sets/default/module_alertsfired_rounded.png and /dev/null differ
diff --git a/pandora_console/images/status_sets/default/module_critical_rounded.png b/pandora_console/images/status_sets/default/module_critical_rounded.png
deleted file mode 100644
index 7fceda18da..0000000000
Binary files a/pandora_console/images/status_sets/default/module_critical_rounded.png and /dev/null differ
diff --git a/pandora_console/images/status_sets/default/module_no_data_rounded.png b/pandora_console/images/status_sets/default/module_no_data_rounded.png
deleted file mode 100644
index fd5e433ece..0000000000
Binary files a/pandora_console/images/status_sets/default/module_no_data_rounded.png and /dev/null differ
diff --git a/pandora_console/images/status_sets/default/module_ok_rounded.png b/pandora_console/images/status_sets/default/module_ok_rounded.png
deleted file mode 100644
index d47f2ef4ff..0000000000
Binary files a/pandora_console/images/status_sets/default/module_ok_rounded.png and /dev/null differ
diff --git a/pandora_console/images/status_sets/default/module_unknown_rounded.png b/pandora_console/images/status_sets/default/module_unknown_rounded.png
deleted file mode 100644
index 2ec6d98f39..0000000000
Binary files a/pandora_console/images/status_sets/default/module_unknown_rounded.png and /dev/null differ
diff --git a/pandora_console/images/status_sets/default/module_warning_rounded.png b/pandora_console/images/status_sets/default/module_warning_rounded.png
deleted file mode 100644
index c28924178d..0000000000
Binary files a/pandora_console/images/status_sets/default/module_warning_rounded.png and /dev/null differ
diff --git a/pandora_console/images/user_email.png b/pandora_console/images/user_email.png
index 095b012a5c..446c90f760 100644
Binary files a/pandora_console/images/user_email.png and b/pandora_console/images/user_email.png differ
diff --git a/pandora_console/images/wizard/customnetscan.png b/pandora_console/images/wizard/customnetscan.png
index edc036fa39..5ef82eb7d5 100644
Binary files a/pandora_console/images/wizard/customnetscan.png and b/pandora_console/images/wizard/customnetscan.png differ
diff --git a/pandora_console/images/wizard/netscan.png b/pandora_console/images/wizard/netscan.png
index c90f4ddc5d..66894fb446 100644
Binary files a/pandora_console/images/wizard/netscan.png and b/pandora_console/images/wizard/netscan.png differ
diff --git a/pandora_console/images/wizard/netscan_green.png b/pandora_console/images/wizard/netscan_green.png
index faeae9b042..c602e96ac5 100644
Binary files a/pandora_console/images/wizard/netscan_green.png and b/pandora_console/images/wizard/netscan_green.png differ
diff --git a/pandora_console/images/wizard/tasklist.png b/pandora_console/images/wizard/tasklist.png
index 3250311b69..0875145b8a 100644
Binary files a/pandora_console/images/wizard/tasklist.png and b/pandora_console/images/wizard/tasklist.png differ
diff --git a/pandora_console/include/ajax/agent.php b/pandora_console/include/ajax/agent.php
index 50fe7dc992..698ab7df9b 100644
--- a/pandora_console/include/ajax/agent.php
+++ b/pandora_console/include/ajax/agent.php
@@ -63,6 +63,7 @@ if ($get_agents_group) {
 if ($search_agents && (!is_metaconsole() || $force_local)) {
     $id_agent = (int) get_parameter('id_agent');
     $string = (string) get_parameter('q');
+    $string = strtoupper($string);
     // q is what autocomplete plugin gives
     $id_group = (int) get_parameter('id_group', -1);
     $addedItems = html_entity_decode((string) get_parameter('add'));
@@ -98,11 +99,11 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
     $filter_alias = $filter;
     switch ($config['dbtype']) {
         case 'mysql':
-            $filter_alias[] = '(alias LIKE "%'.$string.'%")';
+            $filter_alias[] = '(UPPER(alias) LIKE "%'.$string.'%")';
         break;
 
         case 'postgresql':
-            $filter_alias[] = '(alias LIKE \'%'.$string.'%\')';
+            $filter_alias[] = '(UPPER(alias) LIKE \'%'.$string.'%\')';
         break;
 
         case 'oracle':
@@ -127,11 +128,11 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
     $filter_agents = $filter;
     switch ($config['dbtype']) {
         case 'mysql':
-            $filter_agents[] = '(alias NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci LIKE "%'.$string.'%")';
+            $filter_agents[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) COLLATE utf8_general_ci LIKE "%'.$string.'%")';
         break;
 
         case 'postgresql':
-            $filter_agents[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre LIKE \'%'.$string.'%\')';
+            $filter_agents[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) LIKE \'%'.$string.'%\')';
         break;
 
         case 'oracle':
@@ -156,11 +157,11 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
     $filter_address = $filter;
     switch ($config['dbtype']) {
         case 'mysql':
-            $filter_address[] = '(alias NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion LIKE "%'.$string.'%")';
+            $filter_address[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND UPPER(direccion) LIKE "%'.$string.'%")';
         break;
 
         case 'postgresql':
-            $filter_address[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion LIKE \'%'.$string.'%\')';
+            $filter_address[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) NOT LIKE \'%'.$string.'%\' AND UPPER(direccion) LIKE \'%'.$string.'%\')';
         break;
 
         case 'oracle':
@@ -185,11 +186,11 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
     $filter_description = $filter;
     switch ($config['dbtype']) {
         case 'mysql':
-            $filter_description[] = '(alias NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios LIKE "%'.$string.'%")';
+            $filter_description[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND UPPER(direccion) NOT LIKE "%'.$string.'%" AND UPPER(comentarios) LIKE "%'.$string.'%")';
         break;
 
         case 'postgresql':
-            $filter_description[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion NOT LIKE \'%'.$string.'%\' AND comentarios LIKE \'%'.$string.'%\')';
+            $filter_description[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) NOT LIKE \'%'.$string.'%\' AND UPPER(direccion) NOT LIKE \'%'.$string.'%\' AND UPPER(comentarios) LIKE \'%'.$string.'%\')';
         break;
 
         case 'oracle':
diff --git a/pandora_console/include/ajax/alert_list.ajax.php b/pandora_console/include/ajax/alert_list.ajax.php
index b8c3705046..3f724b4e58 100644
--- a/pandora_console/include/ajax/alert_list.ajax.php
+++ b/pandora_console/include/ajax/alert_list.ajax.php
@@ -159,10 +159,10 @@ if ($show_update_action_menu) {
     $id_action = (int) get_parameter('id_action');
 
     $actions = alerts_get_alert_agent_module_actions($id_alert);
-    $action_opction = db_get_row(
+    $action_option = db_get_row(
         'talert_template_module_actions',
-        'id_alert_template_module',
-        $id_alert
+        'id',
+        $id_action
     );
 
     $data .= '<form id="update_action-'.$alert['id'].'" method="post">';
@@ -242,7 +242,7 @@ if ($show_update_action_menu) {
             $data .= '<td class="datos">';
                 $data .= html_print_input_text(
                     'fires_min_ajax',
-                    $action_opction['fires_min'],
+                    $action_option['fires_min'],
                     '',
                     4,
                     10,
@@ -251,7 +251,7 @@ if ($show_update_action_menu) {
                 $data .= ' '.__('to').' ';
                 $data .= html_print_input_text(
                     'fires_max_ajax',
-                    $action_opction['fires_max'],
+                    $action_option['fires_max'],
                     '',
                     4,
                     10,
@@ -266,7 +266,7 @@ if ($show_update_action_menu) {
             $data .= '<td class="datos2">';
                 $data .= html_print_input_text(
                     'module_action_threshold_ajax',
-                    $action_opction['module_action_threshold'],
+                    $action_option['module_action_threshold'],
                     '',
                     4,
                     10,
diff --git a/pandora_console/include/ajax/custom_fields.php b/pandora_console/include/ajax/custom_fields.php
index 9baacdcdc2..85066675a1 100644
--- a/pandora_console/include/ajax/custom_fields.php
+++ b/pandora_console/include/ajax/custom_fields.php
@@ -279,7 +279,7 @@ if (check_login()) {
                 'agent_small',
                 false,
                 true,
-                false,
+                true,
                 '[&hellip;]',
                 'font-size:7.5pt;'
             );
@@ -292,13 +292,14 @@ if (check_login()) {
 
             $data[] = [
                 'ref'               => $referencia,
-                'data_custom_field' => $values['name_custom_fields'],
+                'data_custom_field' => ui_bbcode_to_html($values['name_custom_fields']),
                 'server'            => $values['server_name'],
                 'agent'             => $agent,
                 'IP'                => $values['direccion'],
                 'status'            => "<div id='reload_status_agent_".$values['id_tmetaconsole_setup'].'_'.$values['id_tagente']."'>".$image_status.'</div>',
                 'id_agent'          => $values['id_tagente'],
                 'id_server'         => $values['id_tmetaconsole_setup'],
+                'status_value'      => $values['status'],
             ];
         }
 
diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php
index b58a3c2386..ad9d59a748 100644
--- a/pandora_console/include/ajax/events.php
+++ b/pandora_console/include/ajax/events.php
@@ -26,6 +26,9 @@
  * ============================================================================
  */
 
+// Begin.
+global $config;
+
 require_once 'include/functions_events.php';
 require_once 'include/functions_agents.php';
 require_once 'include/functions_ui.php';
@@ -35,6 +38,21 @@ require_once 'include/functions.php';
 enterprise_include_once('meta/include/functions_events_meta.php');
 enterprise_include_once('include/functions_metaconsole.php');
 
+// Check access.
+check_login();
+
+if (! check_acl($config['id_user'], 0, 'ER')
+    && ! check_acl($config['id_user'], 0, 'EW')
+    && ! check_acl($config['id_user'], 0, 'EM')
+) {
+    db_pandora_audit(
+        'ACL Violation',
+        'Trying to access event viewer'
+    );
+    include 'general/noaccess.php';
+    return;
+}
+
 $get_events_details = (bool) get_parameter('get_events_details');
 $get_list_events_agents = (bool) get_parameter('get_list_events_agents');
 $get_extended_event = (bool) get_parameter('get_extended_event');
@@ -55,6 +73,752 @@ $total_events = (bool) get_parameter('total_events');
 $total_event_graph = (bool) get_parameter('total_event_graph');
 $graphic_event_group = (bool) get_parameter('graphic_event_group');
 $get_table_response_command = (bool) get_parameter('get_table_response_command');
+$save_filter_modal = get_parameter('save_filter_modal', 0);
+$load_filter_modal = get_parameter('load_filter_modal', 0);
+$get_filter_values = get_parameter('get_filter_values', 0);
+$update_event_filter = get_parameter('update_event_filter', 0);
+$save_event_filter = get_parameter('save_event_filter', 0);
+$in_process_event = get_parameter('in_process_event', 0);
+$validate_event = get_parameter('validate_event', 0);
+$delete_event = get_parameter('delete_event', 0);
+$get_event_filters = get_parameter('get_event_filters', 0);
+$get_comments = get_parameter('get_comments', 0);
+$get_events_fired = (bool) get_parameter('get_events_fired');
+
+if ($get_comments) {
+    $event = get_parameter('event', false);
+    $filter = get_parameter('filter', false);
+
+    if ($event === false) {
+        return __('Failed to retrieve comments');
+    }
+
+    if ($filter['group_rep'] == 1) {
+        $events = events_get_all(
+            ['te.*'],
+            // Filter.
+            $filter,
+            // Offset.
+            null,
+            // Limit.
+            null,
+            // Order.
+            null,
+            // Sort_field.
+            null,
+            // History.
+            $filter['history'],
+            // Return_sql.
+            false,
+            // Having.
+            sprintf(
+                ' HAVING max_id_evento = %d',
+                $event['id_evento']
+            )
+        );
+        if ($events !== false) {
+            $event = $events[0];
+        }
+    } else {
+        $events = events_get_event(
+            $event['id_evento'],
+            false,
+            $meta,
+            $history
+        );
+
+        if ($events !== false) {
+            $event = $events[0];
+        }
+    }
+
+    echo events_page_comments($event, true);
+
+    return;
+}
+
+if ($get_event_filters) {
+    $event_filter = events_get_event_filter_select();
+
+    echo io_json_mb_encode($event_filter);
+    return;
+}
+
+// Delete event (filtered or not).
+if ($delete_event) {
+    $filter = get_parameter('filter', []);
+    $id_evento = get_parameter('id_evento', 0);
+    $event_rep = get_parameter('event_rep', 0);
+
+    if ($event_rep === 0) {
+        // Disable group by when there're result is unique.
+        $filter['group_rep'] = 0;
+    }
+
+    // Check acl.
+    if (! check_acl($config['id_user'], 0, 'EM')) {
+        echo 'unauthorized';
+        return;
+    }
+
+    $r = events_delete($id_evento, $filter);
+    if ($r === false) {
+        echo 'Failed';
+    } else {
+        echo $r;
+    }
+
+    return;
+}
+
+// Validates an event (filtered or not).
+if ($validate_event) {
+    $filter = get_parameter('filter', []);
+    $id_evento = get_parameter('id_evento', 0);
+    $event_rep = get_parameter('event_rep', 0);
+
+    if ($event_rep === 0) {
+        // Disable group by when there're result is unique.
+        $filter['group_rep'] = 0;
+    }
+
+    // Check acl.
+    if (! check_acl($config['id_user'], 0, 'EW')) {
+        echo 'unauthorized';
+        return;
+    }
+
+    $r = events_update_status($id_evento, EVENT_VALIDATE, $filter);
+    if ($r === false) {
+        echo 'Failed';
+    } else {
+        echo $r;
+    }
+
+    return;
+}
+
+// Sets status to in progress.
+if ($in_process_event) {
+    $filter = get_parameter('filter', []);
+    $id_evento = get_parameter('id_evento', 0);
+    $event_rep = get_parameter('event_rep', 0);
+
+    if ($event_rep === 0) {
+        // Disable group by when there're result is unique.
+        $filter['group_rep'] = 0;
+    }
+
+    // Check acl.
+    if (! check_acl($config['id_user'], 0, 'EW')) {
+        echo 'unauthorized';
+        return;
+    }
+
+    $r = events_update_status($id_evento, EVENT_PROCESS, $filter);
+    if ($r === false) {
+        echo 'Failed';
+    } else {
+        echo $r;
+    }
+
+    return;
+}
+
+// Saves an event filter.
+if ($save_event_filter) {
+    $values = [];
+    $values['id_name'] = get_parameter('id_name');
+    $values['id_group'] = get_parameter('id_group');
+    $values['event_type'] = get_parameter('event_type');
+    $values['severity'] = get_parameter('severity');
+    $values['status'] = get_parameter('status');
+    $values['search'] = get_parameter('search');
+    $values['text_agent'] = get_parameter('text_agent');
+    $values['id_agent'] = get_parameter('id_agent');
+    $values['id_agent_module'] = get_parameter('id_agent_module');
+    $values['pagination'] = get_parameter('pagination');
+    $values['event_view_hr'] = get_parameter('event_view_hr');
+    $values['id_user_ack'] = get_parameter('id_user_ack');
+    $values['group_rep'] = get_parameter('group_rep');
+    $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([]));
+    $values['tag_without'] = get_parameter(
+        'tag_without',
+        io_json_mb_encode([])
+    );
+    $values['filter_only_alert'] = get_parameter('filter_only_alert');
+    $values['id_group_filter'] = get_parameter('id_group_filter');
+    $values['date_from'] = get_parameter('date_from');
+    $values['date_to'] = get_parameter('date_to');
+    $values['source'] = get_parameter('source');
+    $values['id_extra'] = get_parameter('id_extra');
+    $values['user_comment'] = get_parameter('user_comment');
+
+    $exists = (bool) db_get_value_filter(
+        'id_filter',
+        'tevent_filter',
+        $values
+    );
+
+    if ($exists) {
+        echo 'duplicate';
+    } else {
+        $result = db_process_sql_insert('tevent_filter', $values);
+
+        if ($result === false) {
+            echo 'error';
+        } else {
+            echo $result;
+        }
+    }
+}
+
+if ($update_event_filter) {
+    $values = [];
+    $id = get_parameter('id');
+    $values['id_group'] = get_parameter('id_group');
+    $values['event_type'] = get_parameter('event_type');
+    $values['severity'] = get_parameter('severity');
+    $values['status'] = get_parameter('status');
+    $values['search'] = get_parameter('search');
+    $values['text_agent'] = get_parameter('text_agent');
+    $values['id_agent'] = get_parameter('id_agent');
+    $values['id_agent_module'] = get_parameter('id_agent_module');
+    $values['pagination'] = get_parameter('pagination');
+    $values['event_view_hr'] = get_parameter('event_view_hr');
+    $values['id_user_ack'] = get_parameter('id_user_ack');
+    $values['group_rep'] = get_parameter('group_rep');
+    $values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([]));
+    $values['tag_without'] = get_parameter(
+        'tag_without',
+        io_json_mb_encode([])
+    );
+    $values['filter_only_alert'] = get_parameter('filter_only_alert');
+    $values['id_group_filter'] = get_parameter('id_group_filter');
+    $values['date_from'] = get_parameter('date_from');
+    $values['date_to'] = get_parameter('date_to');
+    $values['source'] = get_parameter('source');
+    $values['id_extra'] = get_parameter('id_extra');
+    $values['user_comment'] = get_parameter('user_comment');
+
+    if (io_safe_output($values['tag_with']) == '["0"]') {
+        $values['tag_with'] = '[]';
+    }
+
+    if (io_safe_output($values['tag_without']) == '["0"]') {
+        $values['tag_without'] = '[]';
+    }
+
+    $result = db_process_sql_update(
+        'tevent_filter',
+        $values,
+        ['id_filter' => $id]
+    );
+
+    if ($result === false) {
+        echo 'error';
+    } else {
+        echo 'ok';
+    }
+}
+
+// Get db values of a single filter.
+if ($get_filter_values) {
+    $id_filter = get_parameter('id');
+
+    $event_filter = events_get_event_filter($id_filter);
+
+    if ($event_filter === false) {
+        $event_filter = [
+            'status'        => EVENT_NO_VALIDATED,
+            'event_view_hr' => $config['event_view_hr'],
+            'group_rep'     => 1,
+            'tag_with'      => [],
+            'tag_without'   => [],
+            'history'       => false,
+        ];
+    }
+
+    $event_filter['search'] = io_safe_output($event_filter['search']);
+    $event_filter['id_name'] = io_safe_output($event_filter['id_name']);
+    $event_filter['tag_with'] = base64_encode(
+        io_safe_output($event_filter['tag_with'])
+    );
+    $event_filter['tag_without'] = base64_encode(
+        io_safe_output($event_filter['tag_without'])
+    );
+
+    echo io_json_mb_encode($event_filter);
+}
+
+if ($load_filter_modal) {
+    $current = get_parameter('current_filter', '');
+    $filters = events_get_event_filter_select();
+    $user_groups_array = users_get_groups_for_select(
+        $config['id_user'],
+        $access,
+        true,
+        true,
+        false
+    );
+
+    echo '<div id="load-filter-select" class="load-filter-modal">';
+    $table = new StdClass;
+    $table->id = 'load_filter_form';
+    $table->width = '100%';
+    $table->cellspacing = 4;
+    $table->cellpadding = 4;
+    $table->class = 'databox';
+    if (is_metaconsole()) {
+        $table->cellspacing = 0;
+        $table->cellpadding = 0;
+        $table->class = 'databox filters';
+    }
+
+    $table->styleTable = 'font-weight: bold; color: #555; text-align:left;';
+    if (!is_metaconsole()) {
+        $table->style[0] = 'width: 50%; width:50%;';
+    }
+
+    $data = [];
+    $table->rowid[3] = 'update_filter_row1';
+    $data[0] = __('Load filter').$jump;
+    $data[0] .= html_print_select(
+        $filters,
+        'filter_id',
+        $current,
+        '',
+        __('None'),
+        0,
+        true
+    );
+    $data[1] = html_print_submit_button(
+        __('Load filter'),
+        'load_filter',
+        false,
+        'class="sub upd" onclick="load_form_filter();"',
+        true
+    );
+    $table->data[] = $data;
+    $table->rowclass[] = '';
+
+    html_print_table($table);
+    echo '</div>';
+    ?>
+<script type="text/javascript">
+function show_filter() {
+    $("#load-filter-select").dialog({
+        resizable: true,
+        draggable: true,
+        modal: false,
+        closeOnEscape: true
+    });
+}
+
+function load_form_filter() {
+    jQuery.post (
+        "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
+        {
+            "page" : "include/ajax/events",
+            "get_filter_values" : 1,
+            "id" : $('#filter_id').val()
+        },
+        function (data) {
+            jQuery.each (data, function (i, val) {
+                if (i == 'id_name')
+                    $("#hidden-id_name").val(val);
+                if (i == 'id_group')
+                    $("#id_group").val(val);
+                if (i == 'event_type')
+                    $("#event_type").val(val);
+                if (i == 'severity')
+                    $("#severity").val(val);
+                if (i == 'status')
+                    $("#status").val(val);
+                if (i == 'search')
+                    $("#text-search").val(val);
+                if (i == 'text_agent')
+                    $("#text_id_agent").val(val);
+                if (i == 'id_agent')
+                    $('input:hidden[name=id_agent]').val(val);
+                if (i == 'id_agent_module')
+                    $('input:hidden[name=module_search_hidden]').val(val);
+                if (i == 'pagination')
+                    $("#pagination").val(val);
+                if (i == 'event_view_hr')
+                    $("#text-event_view_hr").val(val);
+                if (i == 'id_user_ack')
+                    $("#id_user_ack").val(val);
+                if (i == 'group_rep')
+                    $("#group_rep").val(val);
+                if (i == 'tag_with')
+                    $("#hidden-tag_with").val(val);
+                if (i == 'tag_without')
+                    $("#hidden-tag_without").val(val);
+                if (i == 'filter_only_alert')
+                    $("#filter_only_alert").val(val);
+                if (i == 'id_group_filter')
+                    $("#id_group_filter").val(val);
+                if (i == 'source')
+                    $("#text-source").val(val);
+                if (i == 'id_extra')
+                    $("#text-id_extra").val(val);
+                if (i == 'user_comment')
+                    $("#text-user_comment").val(val);
+            });
+            reorder_tags_inputs();
+            // Update the info with the loaded filter
+            $('#filterid').val($('#filter_id').val());
+            $('#filter_loaded_span').html($('#filter_loaded_text').html() + ': ' + $("#hidden-id_name").val());
+
+        },
+        "json"
+    );
+
+    // Close dialog.
+    $("#load-filter-select").dialog('close');
+
+    // Update indicator.
+    $("#current_filter").text($('#filter_id option:selected').text());
+
+    // Search.
+    dt_events.draw(false);
+}
+
+$(document).ready (function() {
+    show_filter();
+})
+
+</script>
+    <?php
+    return;
+}
+
+
+if ($save_filter_modal) {
+    echo '<div id="save-filter-select">';
+    if (check_acl($config['id_user'], 0, 'EW')
+        || check_acl($config['id_user'], 0, 'EM')
+    ) {
+        echo '<div id="#info_box"></div>';
+        $table = new StdClass;
+        $table->id = 'save_filter_form';
+        $table->width = '100%';
+        $table->cellspacing = 4;
+        $table->cellpadding = 4;
+        $table->class = 'databox';
+        if (is_metaconsole()) {
+            $table->class = 'databox filters';
+            $table->cellspacing = 0;
+            $table->cellpadding = 0;
+        }
+
+        $table->styleTable = 'font-weight: bold; text-align:left;';
+        if (!is_metaconsole()) {
+            $table->style[0] = 'width: 50%; width:50%;';
+        }
+
+        $data = [];
+        $table->rowid[0] = 'update_save_selector';
+        $data[0] = html_print_radio_button(
+            'filter_mode',
+            'new',
+            '',
+            true,
+            true
+        ).__('New filter').'';
+
+        $data[1] = html_print_radio_button(
+            'filter_mode',
+            'update',
+            '',
+            false,
+            true
+        ).__('Update filter').'';
+
+        $table->data[] = $data;
+        $table->rowclass[] = '';
+
+        $data = [];
+        $table->rowid[1] = 'save_filter_row1';
+        $data[0] = __('Filter name').$jump;
+        $data[0] .= html_print_input_text('id_name', '', '', 15, 255, true);
+        if (is_metaconsole()) {
+            $data[1] = __('Save in Group').$jump;
+        } else {
+            $data[1] = __('Filter group').$jump;
+        }
+
+        $user_groups_array = users_get_groups_for_select(
+            $config['id_user'],
+            'EW',
+            users_can_manage_group_all(),
+            true
+        );
+
+        $data[1] .= html_print_select(
+            $user_groups_array,
+            'id_group_filter',
+            $id_group_filter,
+            '',
+            '',
+            0,
+            true,
+            false,
+            false,
+            'w130'
+        );
+
+        $table->data[] = $data;
+        $table->rowclass[] = '';
+
+        $data = [];
+        $table->rowid[2] = 'save_filter_row2';
+
+        $table->data[] = $data;
+        $table->rowclass[] = '';
+
+        $data = [];
+        $table->rowid[3] = 'update_filter_row1';
+        $data[0] = __('Overwrite filter').$jump;
+        // Fix  : Only admin user can see filters of group ALL for update.
+        $_filters_update = events_get_event_filter_select(false);
+
+        $data[0] .= html_print_select(
+            $_filters_update,
+            'overwrite_filter',
+            '',
+            '',
+            '',
+            0,
+            true
+        );
+        $data[1] = html_print_submit_button(
+            __('Update filter'),
+            'update_filter',
+            false,
+            'class="sub upd" onclick="save_update_filter();"',
+            true
+        );
+
+        $table->data[] = $data;
+        $table->rowclass[] = '';
+
+        html_print_table($table);
+        echo '<div>';
+            echo html_print_submit_button(
+                __('Save filter'),
+                'save_filter',
+                false,
+                'class="sub upd" style="float:right;" onclick="save_new_filter();"',
+                true
+            );
+        echo '</div>';
+    } else {
+        include 'general/noaccess.php';
+    }
+
+    echo '</div>';
+    ?>
+<script type="text/javascript">
+function show_save_filter() {
+    $('#save_filter_row1').show();
+    $('#save_filter_row2').show();
+    $('#update_filter_row1').hide();
+    // Filter save mode selector
+    $("[name='filter_mode']").click(function() {
+        if ($(this).val() == 'new') {
+            $('#save_filter_row1').show();
+            $('#save_filter_row2').show();
+            $('#submit-save_filter').show();
+            $('#update_filter_row1').hide();
+        }
+        else {
+            $('#save_filter_row1').hide();
+            $('#save_filter_row2').hide();
+            $('#update_filter_row1').show();
+            $('#submit-save_filter').hide();
+        }
+    });
+    $("#save-filter-select").dialog({
+        resizable: true,
+        draggable: true,
+        modal: false,
+        closeOnEscape: true
+    });
+}
+
+function save_new_filter() {
+    // If the filter name is blank show error
+    if ($('#text-id_name').val() == '') {
+        $('#show_filter_error').html("<h3 class='error'><?php echo __('Filter name cannot be left blank'); ?></h3>");
+        
+        // Close dialog
+        $('.ui-dialog-titlebar-close').trigger('click');
+        return false;
+    }
+    
+    var id_filter_save;
+    
+    jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
+        {
+            "page" : "include/ajax/events",
+            "save_event_filter" : 1,
+            "id_name" : $("#text-id_name").val(),
+            "id_group" : $("select#id_group").val(),
+            "event_type" : $("#event_type").val(),
+            "severity" : $("#severity").val(),
+            "status" : $("#status").val(),
+            "search" : $("#text-search").val(),
+            "text_agent" : $("#text_id_agent").val(),
+            "id_agent" : $('input:hidden[name=id_agent]').val(),
+            "id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
+            "pagination" : $("#pagination").val(),
+            "event_view_hr" : $("#text-event_view_hr").val(),
+            "id_user_ack" : $("#id_user_ack").val(),
+            "group_rep" : $("#group_rep").val(),
+            "tag_with": Base64.decode($("#hidden-tag_with").val()),
+            "tag_without": Base64.decode($("#hidden-tag_without").val()),
+            "filter_only_alert" : $("#filter_only_alert").val(),
+            "id_group_filter": $("#id_group_filter").val(),
+            "date_from": $("#text-date_from").val(),
+            "date_to": $("#text-date_to").val(),
+            "source": $("#text-source").val(),
+            "id_extra": $("#text-id_extra").val(),
+            "user_comment": $("#text-user_comment").val()
+        },
+        function (data) {
+            $("#info_box").hide();
+            if (data == 'error') {
+                $("#info_box").filter(function(i, item) {
+                    if ($(item).data('type_info_box') == "error_create_filter") {
+                        return true;
+                    }
+                    else
+                        return false;
+                }).show();
+            }
+            else  if (data == 'duplicate') {
+                $("#info_box").filter(function(i, item) {
+                    if ($(item).data('type_info_box') == "duplicate_create_filter") {
+                        return true;
+                    }
+                    else
+                        return false;
+                }).show();
+            }
+            else {
+                id_filter_save = data;
+                
+                $("#info_box").filter(function(i, item) {
+                    if ($(item).data('type_info_box') == "success_create_filter") {
+                        return true;
+                    }
+                    else
+                        return false;
+                }).show();
+            }
+
+            // Close dialog.
+            $("#save-filter-select").dialog('close');
+        }
+    );
+}
+
+// This updates an event filter
+function save_update_filter() {
+    var id_filter_update =  $("#overwrite_filter").val();
+    var name_filter_update = $("#overwrite_filter option[value='"+id_filter_update+"']").text();
+    
+    jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
+        {"page" : "include/ajax/events",
+        "update_event_filter" : 1,
+        "id" : $("#overwrite_filter").val(),
+        "id_group" : $("select#id_group").val(),
+        "event_type" : $("#event_type").val(),
+        "severity" : $("#severity").val(),
+        "status" : $("#status").val(),
+        "search" : $("#text-search").val(),
+        "text_agent" : $("#text_id_agent").val(),
+        "id_agent" : $('input:hidden[name=id_agent]').val(),
+        "id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
+        "pagination" : $("#pagination").val(),
+        "event_view_hr" : $("#text-event_view_hr").val(),
+        "id_user_ack" : $("#id_user_ack").val(),
+        "group_rep" : $("#group_rep").val(),
+        "tag_with" : Base64.decode($("#hidden-tag_with").val()),
+        "tag_without" : Base64.decode($("#hidden-tag_without").val()),
+        "filter_only_alert" : $("#filter_only_alert").val(),
+        "id_group_filter": $("#id_group_filter").val(),
+        "date_from": $("#text-date_from").val(),
+        "date_to": $("#text-date_to").val(),
+        "source": $("#text-source").val(),
+        "id_extra": $("#text-id_extra").val(),
+        "user_comment": $("#text-user_comment").val()
+        },
+        function (data) {
+            $(".info_box").hide();
+            if (data == 'ok') {
+                $(".info_box").filter(function(i, item) {
+                    if ($(item).data('type_info_box') == "success_update_filter") {
+                        return true;
+                    }
+                    else
+                        return false;
+                }).show();
+            }
+            else {
+                $(".info_box").filter(function(i, item) {
+                    if ($(item).data('type_info_box') == "error_create_filter") {
+                        return true;
+                    }
+                    else
+                        return false;
+                }).show();
+            }
+        });
+        
+        // First remove all options of filters select
+        $('#filter_id').find('option').remove().end();
+        // Add 'none' option the first
+        $('#filter_id').append ($('<option></option>').html ( <?php echo "'".__('none')."'"; ?> ).attr ("value", 0));    
+        // Reload filters select
+        jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
+            {"page" : "include/ajax/events",
+                "get_event_filters" : 1
+            },
+            function (data) {
+                jQuery.each (data, function (i, val) {
+                    s = js_html_entity_decode(val);
+                    if (i == id_filter_update) {
+                        $('#filter_id').append ($('<option selected="selected"></option>').html (s).attr ("value", i));
+                    }
+                    else {
+                        $('#filter_id').append ($('<option></option>').html (s).attr ("value", i));
+                    }
+                });
+            },
+            "json"
+            );
+            
+        // Close dialog
+        $('.ui-dialog-titlebar-close').trigger('click');
+        
+        // Update the info with the loaded filter
+        $("#hidden-id_name").val($('#text-id_name').val());
+        $('#filter_loaded_span').html($('#filter_loaded_text').html() + ': ' + name_filter_update);
+        return false;
+}
+    
+
+$(document).ready(function (){
+    show_save_filter();
+});
+</script>
+    <?php
+    return;
+}
+
 
 if ($get_event_name) {
     $event_id = get_parameter('event_id');
@@ -342,26 +1106,27 @@ if ($change_owner) {
     return;
 }
 
+
+// Generate a modal window with extended information of given event.
 if ($get_extended_event) {
     global $config;
 
-    $event_id = get_parameter('event_id', false);
-    $childrens_ids = get_parameter('childrens_ids');
-    $childrens_ids = json_decode($childrens_ids);
+    $event = get_parameter('event', false);
+    $filter = get_parameter('filter', false);
 
-    if ($meta) {
-        $event = events_meta_get_event($event_id, false, $history, 'ER');
-    } else {
-        $event = events_get_event($event_id);
+    if ($event === false) {
+        return;
     }
 
+    $event_id = $event['id_evento'];
+
     $readonly = false;
     if (!$meta
         && isset($config['event_replication'])
         && $config['event_replication'] == 1
         && $config['show_events_in_local'] == 1
     ) {
-            $readonly = true;
+        $readonly = true;
     }
 
     // Clean url from events and store in array.
@@ -374,42 +1139,53 @@ if ($get_extended_event) {
     }
 
     $dialog_page = get_parameter('dialog_page', 'general');
+    $filter = get_parameter('filter', []);
     $similar_ids = get_parameter('similar_ids', $event_id);
-    $group_rep = get_parameter('group_rep', false);
-    $event_rep = get_parameter('event_rep', 1);
-    $timestamp_first = get_parameter('timestamp_first', $event['utimestamp']);
-    $timestamp_last = get_parameter('timestamp_last', $event['utimestamp']);
-    $server_id = get_parameter('server_id', 0);
+    $group_rep = $filter['group_rep'];
+    $event_rep = $event['event_rep'];
+    $timestamp_first = $event['min_timestamp'];
+    $timestamp_last = $event['max_timestamp'];
+    $server_id = $event['server_id'];
+    $comments = $event['comments'];
 
     $event['similar_ids'] = $similar_ids;
-    $event['timestamp_first'] = $timestamp_first;
-    $event['timestamp_last'] = $timestamp_last;
-    $event['event_rep'] = $event_rep;
+
+    if (!isset($comments)) {
+        $comments = $event['user_comment'];
+    }
 
     // Check ACLs.
+    $access = false;
     if (is_user_admin($config['id_user'])) {
         // Do nothing if you're admin, you get full access.
-        $__ignored_line = 0;
+        $access = true;
     } else if ($config['id_user'] == $event['owner_user']) {
         // Do nothing if you're the owner user, you get access.
-        $__ignored_line = 0;
+        $access = true;
     } else if ($event['id_grupo'] == 0) {
         // If the event has access to all groups, you get access.
-        $__ignored_line = 0;
+        $access = true;
     } else {
         // Get your groups.
         $groups = users_get_groups($config['id_user'], 'ER');
 
         if (in_array($event['id_grupo'], array_keys($groups))) {
             // If event group is among the groups of the user, you get access.
-            $__ignored_line = 0;
-        } else {
-            // If all the access types fail, abort.
-            echo 'Access denied';
-            return false;
+            $access = true;
+        } else if ($event['id_agente']
+            && agents_check_access_agent($event['id_agente'], 'ER')
+        ) {
+            // Secondary group, indirect access.
+            $access = true;
         }
     }
 
+    if (!$access) {
+        // If all the access types fail, abort.
+        echo 'Access denied';
+        return false;
+    }
+
     // Print group_rep in a hidden field to recover it from javascript.
     html_print_input_hidden('group_rep', (int) $group_rep);
 
@@ -418,7 +1194,7 @@ if ($get_extended_event) {
     }
 
     // Tabs.
-    $tabs = "<ul class='events_tabs'>";
+    $tabs = "<ul class=''>";
     $tabs .= "<li><a href='#extended_event_general_page' id='link_general'>".html_print_image('images/lightning_go.png', true).'<span>'.__('General').'</span></a></li>';
     if (events_has_extended_info($event['id_evento']) === true) {
         $tabs .= "<li><a href='#extended_event_related_page' id='link_related'>".html_print_image('images/zoom.png', true).'<span>'.__('Related').'</span></a></li>';
@@ -443,11 +1219,11 @@ if ($get_extended_event) {
             $childrens_ids
         )))
     ) {
-        $tabs .= "<li><a href='#extended_event_responses_page' id='link_responses'>".html_print_image('images/event_responses_col.png', true)."<span style='position:relative;top:-6px;left:3px;margin-right:10px;'>".__('Responses').'</span></a></li>';
+        $tabs .= "<li><a href='#extended_event_responses_page' id='link_responses'>".html_print_image('images/event_responses_col.png', true).'<span>'.__('Responses').'</span></a></li>';
     }
 
     if ($event['custom_data'] != '') {
-        $tabs .= "<li><a href='#extended_event_custom_data_page' id='link_custom_data'>".html_print_image('images/custom_field_col.png', true)."<span style='position:relative;top:-6px;left:3px;margin-right:10px;'>".__('Custom data').'</span></a></li>';
+        $tabs .= "<li><a href='#extended_event_custom_data_page' id='link_custom_data'>".html_print_image('images/custom_field_col.png', true).'<span>'.__('Custom data').'</span></a></li>';
     }
 
     $tabs .= '</ul>';
@@ -498,7 +1274,7 @@ if ($get_extended_event) {
             $childrens_ids
         )))
     ) {
-        $responses = events_page_responses($event, $childrens_ids);
+        $responses = events_page_responses($event);
     } else {
         $responses = '';
     }
@@ -514,12 +1290,14 @@ if ($get_extended_event) {
 
     $details = events_page_details($event, $server);
 
+    if ($meta) {
+        metaconsole_restore_db();
+    }
+
     if (events_has_extended_info($event['id_evento']) === true) {
         $related = events_page_related($event, $server);
     }
 
-    // Juanma (09/05/2014) Fix: Needs to reconnect to node, in previous funct
-    // node connection was lost.
     if ($meta) {
         $server = metaconsole_get_connection_by_id($server_id);
             metaconsole_connect($server);
@@ -535,7 +1313,7 @@ if ($get_extended_event) {
 
     $general = events_page_general($event);
 
-    $comments = events_page_comments($event, $childrens_ids);
+    $comments = '<div id="extended_event_comments_page" class="extended_event_pages"></div>';
 
     $notifications = '<div id="notification_comment_error" style="display:none">'.ui_print_error_message(__('Error adding comment'), '', true).'</div>';
     $notifications .= '<div id="notification_comment_success" style="display:none">'.ui_print_success_message(__('Comment added successfully'), '', true).'</div>';
@@ -546,6 +1324,18 @@ if ($get_extended_event) {
 
     $loading = '<div id="response_loading" style="display:none">'.html_print_image('images/spinner.gif', true).'</div>';
 
+    $i = 0;
+    $tab['general'] = $i++;
+    $tab['details'] = $i++;
+    if (!empty($related)) {
+        $tab['related'] = $i++;
+    }
+
+    $tab['custom_fields'] = $i++;
+    $tab['comments'] = $i++;
+    $tab['responses'] = $i++;
+    $tab['custom_data'] = $i++;
+
     $out = '<div id="tabs">'.$tabs.$notifications.$loading.$general.$details.$related.$custom_fields.$comments.$responses.$custom_data.html_print_input_hidden('id_event', $event['id_evento']).'</div>';
 
     $js = '<script>
@@ -557,31 +1347,31 @@ if ($get_extended_event) {
     // Load the required tab.
     switch ($dialog_page) {
         case 'general':
-            $js .= '$tabs.tabs( "option", "active", 0);';
+            $js .= '$tabs.tabs( "option", "active", '.$tab['general'].');';
         break;
 
         case 'details':
-            $js .= '$tabs.tabs( "option", "active", 1);';
+            $js .= '$tabs.tabs( "option", "active", '.$tab['details'].');';
         break;
 
         case 'related':
-            $js .= '$tabs.tabs( "option", "active", 2);';
+            $js .= '$tabs.tabs( "option", "active", '.$tab['related'].');';
         break;
 
         case 'custom_fields':
-            $js .= '$tabs.tabs( "option", "active", 3);';
+            $js .= '$tabs.tabs( "option", "active", '.$tab['custom_fields'].');';
         break;
 
         case 'comments':
-            $js .= '$tabs.tabs( "option", "active", 4);';
+            $js .= '$tabs.tabs( "option", "active", '.$tab['comments'].');';
         break;
 
         case 'responses':
-            $js .= '$tabs.tabs( "option", "active", 5);';
+            $js .= '$tabs.tabs( "option", "active", '.$tab['responses'].');';
         break;
 
         case 'custom_data':
-            $js .= '$tabs.tabs( "option", "active", 6);';
+            $js .= '$tabs.tabs( "option", "active", '.$tab['custom_data'].');';
         break;
 
         default:
@@ -591,6 +1381,24 @@ if ($get_extended_event) {
 
     $js .= '});';
 
+    $js .= '
+        $("#link_comments").click(function (){
+          $.post ({
+                url : "ajax.php",
+                data : {
+                    page: "include/ajax/events",
+                    get_comments: 1,
+                    event: '.json_encode($event).',
+                    filter: '.json_encode($filter).'
+                },
+                dataType : "html",
+                success: function (data) {
+                    $("#extended_event_comments_page").empty();
+                    $("#extended_event_comments_page").html(data);
+                }
+            });
+        });';
+
     if (events_has_extended_info($event['id_evento']) === true) {
         $js .= '
         $("#link_related").click(function (){
@@ -718,7 +1526,7 @@ if ($table_events) {
         'AND'
     );
     echo '<div style="display: flex;" id="div_all_events_24h">';
-        echo '<label style="margin-right: 1em;"><b>'.__('Show all Events 24h').'</b></label>';
+        echo '<label style="margin: 0 1em 0 2em;"><b>'.__('Show all Events 24h').'</b></label>';
         echo html_print_switch(
             [
                 'name'  => 'all_events_24h',
@@ -768,7 +1576,6 @@ if ($get_list_events_agents) {
     $date_from = get_parameter('date_from');
     $date_to = get_parameter('date_to');
     $id_user = $config['id_user'];
-    $server_id = get_parameter('server_id');
 
     $returned_sql = events_sql_events_grouped_agents(
         $id_agent,
@@ -890,3 +1697,117 @@ if ($get_table_response_command) {
 
     return;
 }
+
+if ($get_events_fired) {
+    $id = get_parameter('id_row');
+    $idGroup = get_parameter('id_group');
+    $agents = get_parameter('agents', null);
+
+    $query = ' AND id_evento > '.$id;
+
+    $type = [];
+    $alert = get_parameter('alert_fired');
+    if ($alert == 'true') {
+        $resultAlert = alerts_get_event_status_group(
+            $idGroup,
+            [
+                'alert_fired',
+                'alert_ceased',
+            ],
+            $query,
+            $agents
+        );
+    }
+
+    $critical = get_parameter('critical');
+    if ($critical == 'true') {
+        $resultCritical = alerts_get_event_status_group(
+            $idGroup,
+            'going_up_critical',
+            $query,
+            $agents
+        );
+    }
+
+    $warning = get_parameter('warning');
+    if ($warning == 'true') {
+        $resultWarning = alerts_get_event_status_group(
+            $idGroup,
+            'going_up_warning',
+            $query,
+            $agents
+        );
+    }
+
+    $unknown = get_parameter('unknown');
+    if ($unknown == 'true') {
+        $resultUnknown = alerts_get_event_status_group(
+            $idGroup,
+            'going_unknown',
+            $query,
+            $agents
+        );
+    }
+
+    if ($resultAlert) {
+        $return = [
+            'fired' => $resultAlert,
+            'sound' => $config['sound_alert'],
+        ];
+        $event = events_get_event($resultAlert);
+
+        $module_name = modules_get_agentmodule_name($event['id_agentmodule']);
+        $agent_name = agents_get_alias($event['id_agente']);
+
+        $return['message'] = io_safe_output($agent_name).' - ';
+        $return['message'] .= __('Alert fired in module ');
+        $return['message'] .= io_safe_output($module_name).' - ';
+        $return['message'] .= $event['timestamp'];
+    } else if ($resultCritical) {
+        $return = [
+            'fired' => $resultCritical,
+            'sound' => $config['sound_critical'],
+        ];
+        $event = events_get_event($resultCritical);
+
+        $module_name = modules_get_agentmodule_name($event['id_agentmodule']);
+        $agent_name = agents_get_alias($event['id_agente']);
+
+        $return['message'] = io_safe_output($agent_name).' - ';
+        $return['message'] .= __('Module ').io_safe_output($module_name);
+        $return['message'] .= __(' is going to critical').' - ';
+        $return['message'] .= $event['timestamp'];
+    } else if ($resultWarning) {
+        $return = [
+            'fired' => $resultWarning,
+            'sound' => $config['sound_warning'],
+        ];
+        $event = events_get_event($resultWarning);
+
+        $module_name = modules_get_agentmodule_name($event['id_agentmodule']);
+        $agent_name = agents_get_alias($event['id_agente']);
+
+        $return['message'] = io_safe_output($agent_name).' - ';
+        $return['message'] .= __('Module ').io_safe_output($module_name);
+        $return['message'] .= __(' is going to warning').' - ';
+        $return['message'] .= $event['timestamp'];
+    } else if ($resultUnknown) {
+        $return = [
+            'fired' => $resultUnknown,
+            'sound' => $config['sound_alert'],
+        ];
+        $event = events_get_event($resultUnknown);
+
+        $module_name = modules_get_agentmodule_name($event['id_agentmodule']);
+        $agent_name = agents_get_alias($event['id_agente']);
+
+        $return['message'] = io_safe_output($agent_name).' - ';
+        $return['message'] .= __('Module ').io_safe_output($module_name);
+        $return['message'] .= __(' is going to unknown').' - ';
+        $return['message'] .= $event['timestamp'];
+    } else {
+        $return = ['fired' => 0];
+    }
+
+    echo io_json_mb_encode($return);
+}
diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php
index 76dc24e145..e34d287da5 100755
--- a/pandora_console/include/ajax/module.php
+++ b/pandora_console/include/ajax/module.php
@@ -392,11 +392,16 @@ if (check_login()) {
                         switch ($row['module_type']) {
                             case 15:
                                 $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module_id);
+                                // System Uptime:
+                                // In case of System Uptime module, shows data in format "Days hours minutes seconds" if and only if
+                                // selected module unit is "_timeticks_"
+                                // Take notice that selected unit may not be postrocess unit
                                 if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
-                                    if ($post_process > 0) {
-                                        $data[] = human_milliseconds_to_string(($row['data'] / $post_process));
+                                        $data_macro = modules_get_unit_macro($row[$attr[0]], $unit);
+                                    if ($data_macro) {
+                                        $data[] = $data_macro;
                                     } else {
-                                        $data[] = human_milliseconds_to_string($row['data']);
+                                        $data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
                                     }
                                 } else {
                                     $data[] = remove_right_zeros(number_format($row[$attr[0]], $config['graph_precision']));
@@ -467,11 +472,17 @@ if (check_login()) {
         $result = false;
         $id_module_a = (int) get_parameter('id_module_a');
         $id_module_b = (int) get_parameter('id_module_b');
+        $type = (string) get_parameter('relation_type');
 
         if ($id_module_a < 1) {
             $name_module_a = get_parameter('name_module_a', '');
             if ($name_module_a) {
-                $id_module_a = (int) db_get_value('id_agente_modulo', 'tagente_modulo', 'nombre', $name_module_a);
+                $id_module_a = (int) db_get_value(
+                    'id_agente_modulo',
+                    'tagente_modulo',
+                    'nombre',
+                    $name_module_a
+                );
             } else {
                 echo json_encode($result);
                 return;
@@ -481,7 +492,12 @@ if (check_login()) {
         if ($id_module_b < 1) {
             $name_module_b = get_parameter('name_module_b', '');
             if ($name_module_b) {
-                $id_module_b = (int) db_get_value('id_agente_modulo', 'tagente_modulo', 'nombre', $name_module_b);
+                $id_module_b = (int) db_get_value(
+                    'id_agente_modulo',
+                    'tagente_modulo',
+                    'nombre',
+                    $name_module_b
+                );
             } else {
                 echo json_encode($result);
                 return;
@@ -489,7 +505,7 @@ if (check_login()) {
         }
 
         if ($id_module_a > 0 && $id_module_b > 0) {
-            $result = modules_add_relation($id_module_a, $id_module_b);
+            $result = modules_add_relation($id_module_a, $id_module_b, $type);
         }
 
         echo json_encode($result);
@@ -824,23 +840,28 @@ if (check_login()) {
         $table->head[7] = __('Data');
         $table->head[8] = __('Graph');
         $table->head[9] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastContactUp, $selectLastContactDown);
-        $table->align = [
-            'left',
-            'left',
-            'left',
-            'left',
-            'left',
-            'left',
-            'left',
-            'left',
-            'left',
-        ];
+        $table->align = [];
+        $table->align[0] = 'center';
+        $table->align[1] = 'left';
+        $table->align[2] = 'left';
+        $table->align[3] = 'left';
+        $table->align[4] = 'left';
+        $table->align[5] = 'left';
+        $table->align[6] = 'center';
+        $table->align[7] = 'left';
+        $table->align[8] = 'center';
+        $table->align[9] = 'right';
 
-        $table->headstyle[2] = 'min-width: 60px';
-        $table->headstyle[3] = 'min-width: 100px';
-        $table->headstyle[5] = 'min-width: 60px';
-        $table->headstyle[8] = 'min-width: 85px';
-        $table->headstyle[9] = 'min-width: 100px';
+        $table->headstyle[2] = 'min-width: 85px';
+        $table->headstyle[3] = 'min-width: 130px';
+        $table->size[3] = '30%';
+        $table->style[3] = 'max-width: 28em;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;';
+        $table->size[4] = '30%';
+        $table->headstyle[5] = 'min-width: 85px';
+        $table->headstyle[6] = 'min-width: 125px; text-align: center;';
+        $table->headstyle[7] = 'min-width: 125px;';
+        $table->headstyle[8] = 'min-width: 100px; text-align: center;';
+        $table->headstyle[9] = 'min-width: 120px; text-align: right;';
 
         $last_modulegroup = 0;
         $rowIndex = 0;
@@ -879,14 +900,14 @@ if (check_login()) {
                     $last_modulegroup = $module['id_module_group'];
                 }
 
-                // End of title of group
+                // End of title of group.
             }
 
             $data = [];
             if (($module['id_modulo'] != 1) && ($module['id_tipo_modulo'] != 100)) {
                 if ($agent_w) {
                     if ($module['flag'] == 0) {
-                        $data[0] = '<a href="index.php?'.'sec=estado&amp;'.'sec2=operation/agentes/ver_agente&amp;'.'id_agente='.$id_agente.'&amp;'.'id_agente_modulo='.$module['id_agente_modulo'].'&amp;'.'flag=1&amp;'.'refr=60">'.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force')]).'</a>';
+                        $data[0] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'&amp;id_agente_modulo='.$module['id_agente_modulo'].'&amp;flag=1&amp;refr=60">'.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force')]).'</a>';
                     } else {
                         $data[0] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'&amp;id_agente_modulo='.$module['id_agente_modulo'].'&amp;refr=60">'.html_print_image('images/refresh.png', true, ['border' => '0', 'title' => __('Refresh')]).'</a>';
                     }
@@ -1001,7 +1022,7 @@ if (check_login()) {
                 $title
             );
 
-            $data[5] = ui_print_module_status($module['estado'], $title, true, false, true);
+            $data[5] = ui_print_status_image($status, $title, true);
             if (!$show_context_help_first_time) {
                 $show_context_help_first_time = true;
 
@@ -1074,7 +1095,7 @@ if (check_login()) {
                     if ($data_macro) {
                         $salida = $data_macro;
                     } else {
-                        $salida .= '&nbsp;'.'<i>'.io_safe_output($module['unit']).'</i>';
+                        $salida .= '&nbsp;<i>'.io_safe_output($module['unit']).'</i>';
                     }
                 }
             } else {
@@ -1120,17 +1141,22 @@ if (check_login()) {
                     $draw_events = 0;
                 }
 
-                $link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&amp;".'period='.SECONDS_1DAY.'&amp;'.'id='.$module['id_agente_modulo'].'&amp;'.'label='.rawurlencode(
+                $link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&amp;".'period='.SECONDS_1DAY.'&amp;id='.$module['id_agente_modulo'].'&amp;label='.rawurlencode(
                     urlencode(
                         base64_encode($module['nombre'])
                     )
-                ).'&amp;'.'refresh='.SECONDS_10MINUTES.'&amp;'."draw_events=$draw_events', 'day_".$win_handle."', 1000, 650)";
+                ).'&amp;refresh='.SECONDS_10MINUTES.'&amp;'."draw_events=$draw_events', 'day_".$win_handle."', 1000, 700)";
                 if (!is_snapshot_data($module['datos'])) {
                     $data[8] .= '<a href="javascript:'.$link.'">'.html_print_image('images/chart_curve.png', true, ['border' => '0', 'alt' => '']).'</a> &nbsp;&nbsp;';
                 }
 
                 $server_name = '';
-                $data[8] .= "<a href='javascript: ".'show_module_detail_dialog('.$module['id_agente_modulo'].', '.$id_agente.', '.'"'.$server_name.'", '.(0).', '.SECONDS_1DAY.', " '.modules_get_agentmodule_name($module['id_agente_modulo'])."\")'>".html_print_image('images/binary.png', true, ['border' => '0', 'alt' => '']).'</a>';
+
+                $modules_get_agentmodule_name = modules_get_agentmodule_name($module['id_agente_modulo']);
+                // Escape the double quotes that may have the name of the module.
+                $modules_get_agentmodule_name = str_replace('&quot;', '\"', $modules_get_agentmodule_name);
+
+                $data[8] .= "<a href='javascript: ".'show_module_detail_dialog('.$module['id_agente_modulo'].', '.$id_agente.', "'.$server_name.'", '.(0).', '.SECONDS_1DAY.', " '.$modules_get_agentmodule_name."\")'>".html_print_image('images/binary.png', true, ['border' => '0', 'alt' => '']).'</a>';
             }
 
             if ($module['estado'] == 3) {
@@ -1177,7 +1203,7 @@ if (check_login()) {
                 ui_print_info_message([ 'no_close' => true, 'message' => __('This agent doesn\'t have any active monitors.') ]);
             }
         } else {
-            $url = 'index.php?'.'sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$id_agente.'&'.'refr=&filter_monitors=1&'.'status_filter_monitor='.$status_filter_monitor.'&'.'status_text_monitor='.$status_text_monitor.'&'.'status_module_group='.$status_module_group;
+            $url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.'&status_text_monitor='.$status_text_monitor.'&status_module_group='.$status_module_group;
 
             if ($paginate_module) {
                 ui_pagination(
diff --git a/pandora_console/include/ajax/reporting.ajax.php b/pandora_console/include/ajax/reporting.ajax.php
index 55ed7dd216..dec331b6ef 100755
--- a/pandora_console/include/ajax/reporting.ajax.php
+++ b/pandora_console/include/ajax/reporting.ajax.php
@@ -65,6 +65,7 @@ if ($add_sla) {
     $sla_max = get_parameter('sla_max', 0);
     $sla_min = get_parameter('sla_min', 0);
     $server_id = (int) get_parameter('server_id', 0);
+    $id_module_failover = (int) get_parameter('id_module_failover', 0);
 
     $id_service = (int) get_parameter('id_service');
     if (empty($id_module) && !empty($id_service)) {
@@ -85,12 +86,13 @@ if ($add_sla) {
     $result = db_process_sql_insert(
         'treport_content_sla_combined',
         [
-            'id_report_content' => $id,
-            'id_agent_module'   => $id_module,
-            'sla_max'           => $sla_max,
-            'sla_min'           => $sla_min,
-            'sla_limit'         => $sla_limit,
-            'server_name'       => $connection['server_name'],
+            'id_report_content'        => $id,
+            'id_agent_module'          => $id_module,
+            'id_agent_module_failover' => $id_module_failover,
+            'sla_max'                  => $sla_max,
+            'sla_min'                  => $sla_min,
+            'sla_limit'                => $sla_limit,
+            'server_name'              => $connection['server_name'],
         ]
     );
 
diff --git a/pandora_console/include/ajax/tree.ajax.php b/pandora_console/include/ajax/tree.ajax.php
index 9ea0a86e8e..24074e8327 100644
--- a/pandora_console/include/ajax/tree.ajax.php
+++ b/pandora_console/include/ajax/tree.ajax.php
@@ -151,6 +151,10 @@ if (is_ajax()) {
 
         ob_clean();
 
+        echo '<style type="text/css">';
+        include_once __DIR__.'/../styles/progress.css';
+        echo '</style>';
+
         echo '<div class="left_align">';
         if (!empty($id) && !empty($type)) {
             switch ($type) {
diff --git a/pandora_console/include/ajax/update_manager.ajax.php b/pandora_console/include/ajax/update_manager.ajax.php
index 7a7cefc82b..9c964536b1 100644
--- a/pandora_console/include/ajax/update_manager.ajax.php
+++ b/pandora_console/include/ajax/update_manager.ajax.php
@@ -163,6 +163,7 @@ if ($install_package) {
             unlink($files_copied);
         }
 
+
         if (file_exists($package)) {
             if ($files_h = fopen($files_total, 'r')) {
                 while ($line = stream_get_line($files_h, 65535, "\n")) {
diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php
index 51ea636659..2d37092078 100755
--- a/pandora_console/include/ajax/visual_console_builder.ajax.php
+++ b/pandora_console/include/ajax/visual_console_builder.ajax.php
@@ -1206,6 +1206,8 @@ switch ($action) {
                 switch ($type) {
                     case 'auto_sla_graph':
                         $elementFields['event_max_time_row'] = $elementFields['period'];
+                    break;
+
                     case 'percentile_item':
                     case 'percentile_bar':
                         $elementFields['width_percentile'] = $elementFields['width'];
diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php
index b9a5ede1e5..ed5e56782a 100644
--- a/pandora_console/include/auth/mysql.php
+++ b/pandora_console/include/auth/mysql.php
@@ -1257,11 +1257,8 @@ function fill_permissions_ldap($sr)
     global $config;
     $permissions = [];
     $permissions_profile = [];
-    if (defined('METACONSOLE')) {
-        $meta = true;
-    }
 
-    if ($meta && (bool) $config['ldap_save_profile'] === false && $config['ldap_advanced_config'] == 0) {
+    if ((bool) $config['ldap_save_profile'] === false && ($config['ldap_advanced_config'] == 0 || $config['ldap_advanced_config'] == '')) {
         $result = 0;
         $result = db_get_all_rows_filter(
             'tusuario_perfil',
@@ -1287,43 +1284,9 @@ function fill_permissions_ldap($sr)
         return $permissions_profile;
     }
 
-    if ((bool) $config['ldap_save_profile'] === false && $config['ldap_advanced_config'] == '') {
-        $result = db_get_all_rows_filter(
-            'tusuario_perfil',
-            ['id_usuario' => $sr['uid'][0]]
-        );
-        if ($result == false) {
-            $permissions[0]['profile'] = $config['default_remote_profile'];
-            $permissions[0]['groups'][] = $config['default_remote_group'];
-            $permissions[0]['tags'] = $config['default_assign_tags'];
-            $permissions[0]['no_hierarchy'] = $config['default_no_hierarchy'];
-            return $permissions;
-        }
-
-        foreach ($result as $perms) {
-               $permissions_profile[] = [
-                   'profile'      => $perms['id_perfil'],
-                   'groups'       => [$perms['id_grupo']],
-                   'tags'         => $perms['tags'],
-                   'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0,
-               ];
-        }
-
-        return $permissions_profile;
-    }
-
     if ($config['ldap_advanced_config'] == 1 && $config['ldap_save_profile'] == 1) {
         $ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
-        foreach ($ldap_adv_perms as $ldap_adv_perm) {
-            $permissions[] = [
-                'profile'      => $ldap_adv_perm['profile'],
-                'groups'       => $ldap_adv_perm['group'],
-                'tags'         => implode(',', $ldap_adv_perm['tags']),
-                'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
-            ];
-        }
-
-        return $permissions;
+        return get_advanced_permissions($ldap_adv_perms, $sr);
     }
 
     if ($config['ldap_advanced_config'] == 1 && $config['ldap_save_profile'] == 0) {
@@ -1333,25 +1296,16 @@ function fill_permissions_ldap($sr)
         );
         if ($result == false) {
             $ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
-            foreach ($ldap_adv_perms as $ldap_adv_perm) {
-                $permissions[] = [
-                    'profile'      => $ldap_adv_perm['profile'],
-                    'groups'       => $ldap_adv_perm['group'],
-                    'tags'         => implode(',', $ldap_adv_perm['tags']),
-                    'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
-                ];
-            }
-
-            return $permissions;
+            return get_advanced_permissions($ldap_adv_perms, $sr);
         }
 
         foreach ($result as $perms) {
-               $permissions_profile[] = [
-                   'profile'      => $perms['id_perfil'],
-                   'groups'       => [$perms['id_grupo']],
-                   'tags'         => $perms['tags'],
-                   'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0,
-               ];
+            $permissions_profile[] = [
+                'profile'      => $perms['id_perfil'],
+                'groups'       => [$perms['id_grupo']],
+                'tags'         => $perms['tags'],
+                'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0,
+            ];
         };
 
         return $permissions_profile;
@@ -1365,22 +1319,43 @@ function fill_permissions_ldap($sr)
         return $permissions;
     }
 
-    // Decode permissions in advanced mode
-    $ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
+    return $permissions;
+}
+
+
+/**
+ * Get permissions in advanced mode.
+ *
+ * @param array ldap_adv_perms
+ *
+ * @return array
+ */
+function get_advanced_permissions($ldap_adv_perms, $sr)
+{
+    $permissions = [];
     foreach ($ldap_adv_perms as $ldap_adv_perm) {
         $attributes = $ldap_adv_perm['groups_ldap'];
-        foreach ($attributes as $attr) {
-            $attr = explode('=', $attr, 2);
-            foreach ($sr[$attr[0]] as $s_attr) {
-                if (preg_match('/'.$attr[1].'/', $s_attr)) {
-                    $permissions[] = [
-                        'profile'      => $ldap_adv_perm['profile'],
-                        'groups'       => $ldap_adv_perm['group'],
-                        'tags'         => implode(',', $ldap_adv_perm['tags']),
-                        'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
-                    ];
+        if (!empty($attributes[0])) {
+            foreach ($attributes as $attr) {
+                $attr = explode('=', $attr, 2);
+                foreach ($sr[$attr[0]] as $s_attr) {
+                    if (preg_match('/'.$attr[1].'/', $s_attr)) {
+                        $permissions[] = [
+                            'profile'      => $ldap_adv_perm['profile'],
+                            'groups'       => $ldap_adv_perm['group'],
+                            'tags'         => implode(',', $ldap_adv_perm['tags']),
+                            'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
+                        ];
+                    }
                 }
             }
+        } else {
+            $permissions[] = [
+                'profile'      => $ldap_adv_perm['profile'],
+                'groups'       => $ldap_adv_perm['group'],
+                'tags'         => implode(',', $ldap_adv_perm['tags']),
+                'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0,
+            ];
         }
     }
 
@@ -1472,7 +1447,10 @@ function local_ldap_search($ldap_host, $ldap_port=389, $ldap_version=3, $dn, $ac
         $tls = ' -ZZ ';
     }
 
-    if (stripos($ldap_host, 'ldap') !== false) {
+    if (stripos($ldap_host, 'ldap://') !== false
+        || stripos($ldap_host, 'ldaps://') !== false
+        || stripos($ldap_host, 'ldapi://') !== false
+    ) {
         $ldap_host = ' -H '.$ldap_host.':'.$ldap_port;
     } else {
         $ldap_host = ' -h '.$ldap_host.' -p '.$ldap_port;
diff --git a/pandora_console/include/chart_generator.php b/pandora_console/include/chart_generator.php
index e7133fd79e..2ae768d4fe 100644
--- a/pandora_console/include/chart_generator.php
+++ b/pandora_console/include/chart_generator.php
@@ -62,6 +62,7 @@ if (file_exists('languages/'.$user_language.'.mo')) {
         <link rel="stylesheet" href="styles/pandora.css" type="text/css" />
         <link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
         <link rel="stylesheet" href="styles/js/jquery-ui.min.css" type="text/css" />
+        <link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" />
         <script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
         <script language="javascript" type='text/javascript' src='javascript/jquery-3.3.1.min.js'></script>
         <script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js'></script>
diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php
index 1b5a114287..07cd4f492e 100644
--- a/pandora_console/include/class/ConsoleSupervisor.php
+++ b/pandora_console/include/class/ConsoleSupervisor.php
@@ -32,6 +32,7 @@ require_once $config['homedir'].'/include/functions_db.php';
 require_once $config['homedir'].'/include/functions_io.php';
 require_once $config['homedir'].'/include/functions_notifications.php';
 require_once $config['homedir'].'/include/functions_servers.php';
+require_once $config['homedir'].'/include/functions_update_manager.php';
 
 // Enterprise includes.
 enterprise_include_once('include/functions_metaconsole.php');
@@ -1262,6 +1263,7 @@ class ConsoleSupervisor
         $PHPdisable_functions = ini_get('disable_functions');
         $PHPupload_max_filesize_min = config_return_in_bytes('800M');
         $PHPmemory_limit_min = config_return_in_bytes('500M');
+        $PHPSerialize_precision = ini_get('serialize_precision');
 
         // PhantomJS status.
         $result_ejecution = exec($config['phantomjs_bin'].'/phantomjs --version');
@@ -1437,6 +1439,30 @@ class ConsoleSupervisor
         } else {
             $this->cleanNotifications('NOTIF.PHP.VERSION');
         }
+
+        if ($PHPSerialize_precision != -1) {
+            $url = 'https://www.php.net/manual/en/ini.core.php#ini.serialize-precision';
+            if ($config['language'] == 'es') {
+                $url = 'https://www.php.net/manual/es/ini.core.php#ini.serialize-precision';
+            }
+
+            $this->notify(
+                [
+                    'type'    => 'NOTIF.PHP.SERIALIZE_PRECISION',
+                    'title'   => sprintf(
+                        __("Not recommended '%s' value in PHP configuration"),
+                        'serialze_precision'
+                    ),                    'message' => sprintf(
+                        __('Recommended value is: %s'),
+                        sprintf('-1')
+                    ).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
+                    'url'     => $url,
+                ]
+            );
+        } else {
+            $this->cleanNotifications('NOTIF.PHP.SERIALIZE_PRECISION');
+        }
+
     }
 
 
@@ -1940,6 +1966,7 @@ class ConsoleSupervisor
     public function checkUpdateManagerRegistration()
     {
         global $config;
+        include_once $config['homedir'].'/include/functions_update_manager.php';
         $login = get_parameter('login', false);
 
         if (update_manager_verify_registration() === false) {
@@ -1974,7 +2001,7 @@ class ConsoleSupervisor
             'id_user',
             $config['id_user']
         );
-        if (license_free() === true
+        if (!$config['disabled_newsletter']
             && $newsletter != 1
             && $login === false
         ) {
@@ -2244,6 +2271,7 @@ class ConsoleSupervisor
     public function getUMMessages()
     {
         global $config;
+        include_once $config['homedir'].'/include/functions_update_manager.php';
 
         if (update_manager_verify_registration() === false) {
             // Console not subscribed.
@@ -2261,8 +2289,6 @@ class ConsoleSupervisor
         $future = (time() + 2 * SECONDS_1HOUR);
         config_update_value('last_um_check', $future);
 
-        include_once $config['homedir'].'/include/functions_update_manager.php';
-
         $params = [
             'pandora_uid' => $config['pandora_uid'],
             'timezone'    => $config['timezone'],
diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php
index 7bf232e068..0011167308 100644
--- a/pandora_console/include/class/NetworkMap.class.php
+++ b/pandora_console/include/class/NetworkMap.class.php
@@ -2845,6 +2845,7 @@ class NetworkMap
             html_print_table($table, true),
             __('Node Details'),
             __('Node Details'),
+            '',
             false,
             true
         );
@@ -2897,6 +2898,7 @@ class NetworkMap
             html_print_table($table, true),
             __('Node Details'),
             __('Node Details'),
+            '',
             false,
             true
         );
@@ -2922,6 +2924,7 @@ class NetworkMap
             html_print_table($table, true),
             __('Interface Information (SNMP)'),
             __('Interface Information (SNMP)'),
+            '',
             true,
             true
         );
@@ -2996,6 +2999,7 @@ class NetworkMap
             html_print_table($table, true),
             __('Node options'),
             __('Node options'),
+            '',
             true,
             true
         );
@@ -3056,6 +3060,7 @@ class NetworkMap
             html_print_table($table, true),
             __('Relations'),
             __('Relations'),
+            '',
             true,
             true
         );
@@ -3165,6 +3170,7 @@ class NetworkMap
             $add_agent_node_html,
             __('Add agent node'),
             __('Add agent node'),
+            '',
             false,
             true
         );
@@ -3216,6 +3222,7 @@ class NetworkMap
             $add_agent_node_html,
             __('Add agent node (filter by group)'),
             __('Add agent node'),
+            '',
             true,
             true
         );
@@ -3256,6 +3263,7 @@ class NetworkMap
             $add_agent_node_html,
             __('Add fictional point'),
             __('Add agent node'),
+            '',
             true,
             true
         );
diff --git a/pandora_console/include/class/TreeService.class.php b/pandora_console/include/class/TreeService.class.php
index eaf3c55fea..251fde0d73 100644
--- a/pandora_console/include/class/TreeService.class.php
+++ b/pandora_console/include/class/TreeService.class.php
@@ -72,6 +72,8 @@ class TreeService extends Tree
 
     protected function getFirstLevel()
     {
+        global $config;
+
         $processed_items = $this->getProcessedServices();
         $ids = array_keys($processed_items);
 
@@ -212,26 +214,37 @@ class TreeService extends Tree
             foreach ($data_modules as $key => $module) {
                 switch ($module['estado']) {
                     case '0':
-                        $data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_ok_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="NORMAL status." />';
+                        $module_status = 'ok';
+                        $module_title = 'NORMAL';
                     break;
 
                     case '1':
-                        $data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_critical_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="CRITICAL status." />';
+                        $module_status = 'critical';
+                        $module_title = 'CRITICAL';
                     break;
 
                     case '2':
-                        $data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_warning_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
+                        $module_status = 'warning';
+                        $module_title = 'WARNING';
+                    break;
+
+                    case '3':
+                        $module_status = 'down';
+                        $module_title = 'UNKNOWN';
                     break;
 
                     case '4':
-                        $data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_no_data_ball.png" data-title="NORMAL status." data-use_title_for_force_title="1" class="forced_title" alt="UNKNOWN status." />';
+                        $module_status = 'no_data';
+                        $module_title = 'NOT INITIALIZED';
                     break;
 
                     default:
-                        // code...
+                        $module_status = 'down';
+                        $module_title = 'UNKNOWN';
                     break;
                 }
 
+                $data_modules[$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_'.$module_status.'_ball.png" data-title="'.$module_title.' status." data-use_title_for_force_title="1" class="forced_title" alt="'.$module_title.' status." />';
                 $data_modules[$key]['showEventsBtn'] = 1;
                 $data_modules[$key]['eventModule'] = $module['id_agente_modulo'];
             }
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 3bbde1736a..9deb7fa7b7 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -20,8 +20,8 @@
 /**
  * Pandora build version and version
  */
-$build_version = 'PC190605';
-$pandora_version = 'v7.0NG.735';
+$build_version = 'PC190906';
+$pandora_version = 'v7.0NG.738';
 
 // Do not overwrite default timezone set if defined.
 $script_tz = @date_default_timezone_get();
diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php
index 7266e9eff4..c512c33c8f 100644
--- a/pandora_console/include/constants.php
+++ b/pandora_console/include/constants.php
@@ -39,10 +39,11 @@ define('TIME_FORMAT', 'H:i:s');
 define('TIME_FORMAT_JS', 'HH:mm:ss');
 
 // Events state constants.
+define('EVENT_ALL', -1);
 define('EVENT_NEW', 0);
 define('EVENT_VALIDATE', 1);
 define('EVENT_PROCESS', 2);
-
+define('EVENT_NO_VALIDATED', 3);
 
 
 // Agents disabled status.
@@ -65,7 +66,7 @@ define('ERR_NODATA', -70000);
 define('ERR_CONNECTION', -80000);
 define('ERR_DISABLED', -90000);
 define('ERR_WRONG', -100000);
-define('ERR_WRONG_NAME', -100001);
+define('ERR_WRONG_MR', -100001);
 define('ERR_WRONG_PARAMETERS', -100002);
 define('ERR_ACL', -110000);
 define('ERR_AUTH', -120000);
@@ -137,19 +138,19 @@ switch ($config['dbtype']) {
 
 
 // Color constants.
-define('COL_CRITICAL', '#FC4444');
-define('COL_WARNING', '#FAD403');
+define('COL_CRITICAL', '#e63c52');
+define('COL_WARNING', '#f3b200');
 define('COL_WARNING_DARK', '#FFB900');
-define('COL_NORMAL', '#80BA27');
-define('COL_NOTINIT', '#3BA0FF');
+define('COL_NORMAL', '#82b92e');
+define('COL_NOTINIT', '#4a83f3');
 define('COL_UNKNOWN', '#B2B2B2');
 define('COL_DOWNTIME', '#976DB1');
 define('COL_IGNORED', '#DDD');
-define('COL_ALERTFIRED', '#FFA631');
-define('COL_MINOR', '#F099A2');
+define('COL_ALERTFIRED', '#F36201');
+define('COL_MINOR', '#B2B2B2');
 define('COL_MAJOR', '#C97A4A');
 define('COL_INFORMATIONAL', '#E4E4E4');
-define('COL_MAINTENANCE', '#3BA0FF');
+define('COL_MAINTENANCE', '#4a83f3');
 
 define('COL_GRAPH1', '#C397F2');
 define('COL_GRAPH2', '#FFE66C');
@@ -354,6 +355,12 @@ define('MODULE_PREDICTION_CLUSTER', 5);
 define('MODULE_PREDICTION_CLUSTER_AA', 6);
 define('MODULE_PREDICTION_CLUSTER_AP', 7);
 
+// Type of Webserver Modules.
+define('MODULE_WEBSERVER_CHECK_LATENCY', 30);
+define('MODULE_WEBSERVER_CHECK_SERVER_RESPONSE', 31);
+define('MODULE_WEBSERVER_RETRIEVE_NUMERIC_DATA', 32);
+define('MODULE_WEBSERVER_RETRIEVE_STRING_DATA', 33);
+
 // SNMP CONSTANTS.
 define('SNMP_DIR_MIBS', 'attachment/mibs');
 
@@ -526,14 +533,6 @@ define('NODE_MODULE', 1);
 define('NODE_PANDORA', 2);
 define('NODE_GENERIC', 3);
 
-// SAML attributes constants.
-define('SAML_ROLE_AND_TAG', 'eduPersonEntitlement');
-define('SAML_USER_DESC', 'commonName');
-define('SAML_ID_USER_IN_PANDORA', 'eduPersonTargetedId');
-define('SAML_GROUP_IN_PANDORA', 'schacHomeOrganization');
-define('SAML_MAIL_IN_PANDORA', 'mail');
-define('SAML_DEFAULT_PROFILES_AND_TAGS_FORM', 'urn:mace:rediris.es:entitlement:monitoring:');
-
 // Other constants.
 define('STATUS_OK', 0);
 define('STATUS_ERROR', 1);
@@ -589,6 +588,8 @@ define('DISCOVERY_APP_MYSQL', 4);
 define('DISCOVERY_APP_ORACLE', 5);
 define('DISCOVERY_CLOUD_AWS_EC2', 6);
 define('DISCOVERY_CLOUD_AWS_RDS', 7);
+define('DISCOVERY_CLOUD_AZURE_COMPUTE', 8);
+define('DISCOVERY_DEPLOY_AGENTS', 9);
 
 
 // Discovery types matching definition.
@@ -601,6 +602,7 @@ define('DISCOVERY_SCRIPT_IPAM_RECON', 3);
 define('DISCOVERY_SCRIPT_IPMI_RECON', 4);
 
 // Discovery task descriptions.
+define('CLOUDWIZARD_AZURE_DESCRIPTION', 'Discovery.Cloud.Azure.Compute');
 define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
 define('CLOUDWIZARD_VMWARE_DESCRIPTION', 'Discovery.App.VMware');
 
diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php
index f299153da6..b1027bc4af 100644
--- a/pandora_console/include/functions.php
+++ b/pandora_console/include/functions.php
@@ -902,6 +902,47 @@ function set_cookie($name, $value)
 }
 
 
+/**
+ * Returns database ORDER clause from datatables AJAX call.
+ *
+ * @param boolean $as_array Return as array or as string.
+ *
+ * @return string Order or empty.
+ */
+function get_datatable_order($as_array=false)
+{
+    $order = get_parameter('order');
+
+    if (is_array($order)) {
+        $column = $order[0]['column'];
+        $direction = $order[0]['dir'];
+    }
+
+    if (!isset($column) || !isset($direction)) {
+        return '';
+    }
+
+    $columns = get_parameter('columns');
+
+    if (is_array($columns)) {
+        $column_name = $columns[$column]['data'];
+    }
+
+    if (!isset($column_name)) {
+        return '';
+    }
+
+    if ($as_array) {
+        return [
+            'direction' => $direction,
+            'field'     => $column_name,
+        ];
+    }
+
+    return $column_name.' '.$direction;
+}
+
+
 /**
  * Get a parameter from a request.
  *
@@ -1392,6 +1433,11 @@ function enterprise_installed()
 {
     $return = false;
 
+    // Load enterprise extensions.
+    if (defined('DESTDIR')) {
+        return $return;
+    }
+
     if (defined('PANDORA_ENTERPRISE')) {
         if (PANDORA_ENTERPRISE) {
             $return = true;
@@ -1444,7 +1490,7 @@ function enterprise_include($filename)
 {
     global $config;
 
-    // Load enterprise extensions
+    // Load enterprise extensions.
     if (defined('DESTDIR')) {
         $destdir = DESTDIR;
     } else {
@@ -1470,11 +1516,24 @@ function enterprise_include($filename)
 }
 
 
+/**
+ * Includes a file from enterprise section.
+ *
+ * @param string $filename Target file.
+ *
+ * @return mixed Result code.
+ */
 function enterprise_include_once($filename)
 {
     global $config;
 
-    // Load enterprise extensions
+    // Load enterprise extensions.
+    if (defined('DESTDIR')) {
+        $destdir = DESTDIR;
+    } else {
+        $destdir = '';
+    }
+
     $filepath = realpath($config['homedir'].'/'.ENTERPRISE_DIR.'/'.$filename);
 
     if ($filepath === false) {
@@ -1574,6 +1633,11 @@ function safe_sql_string($string)
 }
 
 
+/**
+ * Verifies if current Pandora FMS installation is a Metaconsole.
+ *
+ * @return boolean True metaconsole installation, false if not.
+ */
 function is_metaconsole()
 {
     global $config;
@@ -1581,6 +1645,18 @@ function is_metaconsole()
 }
 
 
+/**
+ * Check if current Pandora FMS installation has joined a Metaconsole env.
+ *
+ * @return boolean True joined, false if not.
+ */
+function has_metaconsole()
+{
+    global $config;
+    return (bool) $config['node_metaconsole'] && (bool) $config['metaconsole_node_id'];
+}
+
+
 /**
  * @brief Check if there is management operations are allowed in current context
  * (node // meta)
@@ -1760,6 +1836,52 @@ function array_key_to_offset($array, $key)
 }
 
 
+/**
+ * Undocumented function
+ *
+ * @param array $arguments Following format:
+ *  [
+ *   'ip_target'
+ *   'snmp_version'
+ *   'snmp_community'
+ *   'snmp3_auth_user'
+ *   'snmp3_security_level'
+ *   'snmp3_auth_method'
+ *   'snmp3_auth_pass'
+ *   'snmp3_privacy_method'
+ *   'snmp3_privacy_pass'
+ *   'quick_print'
+ *   'base_oid'
+ *   'snmp_port'
+ *   'server_to_exec'
+ *   'extra_arguments'
+ *   'format'
+ *  ]
+ *
+ * @return array SNMP result.
+ */
+function get_h_snmpwalk(array $arguments)
+{
+    return get_snmpwalk(
+        $arguments['ip_target'],
+        $arguments['snmp_version'],
+        isset($arguments['snmp_community']) ? $arguments['snmp_community'] : '',
+        isset($arguments['snmp3_auth_user']) ? $arguments['snmp3_auth_user'] : '',
+        isset($arguments['snmp3_security_level']) ? $arguments['snmp3_security_level'] : '',
+        isset($arguments['snmp3_auth_method']) ? $arguments['snmp3_auth_method'] : '',
+        isset($arguments['snmp3_auth_pass']) ? $arguments['snmp3_auth_pass'] : '',
+        isset($arguments['snmp3_privacy_method']) ? $arguments['snmp3_privacy_method'] : '',
+        isset($arguments['snmp3_privacy_pass']) ? $arguments['snmp3_privacy_pass'] : '',
+        isset($arguments['quick_print']) ? $arguments['quick_print'] : 0,
+        isset($arguments['base_oid']) ? $arguments['base_oid'] : '',
+        isset($arguments['snmp_port']) ? $arguments['snmp_port'] : '',
+        isset($arguments['server_to_exec']) ? $arguments['server_to_exec'] : 0,
+        isset($arguments['extra_arguments']) ? $arguments['extra_arguments'] : '',
+        isset($arguments['format']) ? $arguments['format'] : '-Oa'
+    );
+}
+
+
 /**
  * Make a snmpwalk and return it.
  *
@@ -1880,11 +2002,16 @@ function get_snmpwalk(
         exec($command_str, $output, $rc);
     }
 
-    // Parse the output of snmpwalk
+    // Parse the output of snmpwalk.
     $snmpwalk = [];
     foreach ($output as $line) {
-        // Separate the OID from the value
-        $full_oid = explode(' = ', $line);
+        // Separate the OID from the value.
+        if (strpos($format, 'q') === false) {
+            $full_oid = explode(' = ', $line, 2);
+        } else {
+            $full_oid = explode(' ', $line, 2);
+        }
+
         if (isset($full_oid[1])) {
             $snmpwalk[$full_oid[0]] = $full_oid[1];
         }
@@ -2557,7 +2684,7 @@ function can_user_access_node()
 
     $userinfo = get_user_info($config['id_user']);
 
-    if (defined('METACONSOLE')) {
+    if (is_metaconsole()) {
         return $userinfo['is_admin'] == 1 ? 1 : $userinfo['metaconsole_access_node'];
     } else {
         return 1;
@@ -2725,6 +2852,8 @@ function print_audit_csv($data)
     global $config;
     global $graphic_type;
 
+    $divider = html_entity_decode($config['csv_divider']);
+
     if (!$data) {
         echo __('No data found to export');
         return 0;
@@ -2742,9 +2871,9 @@ function print_audit_csv($data)
     // BOM
     print pack('C*', 0xEF, 0xBB, 0xBF);
 
-    echo __('User').';'.__('Action').';'.__('Date').';'.__('Source IP').';'.__('Comments')."\n";
+    echo __('User').$divider.__('Action').$divider.__('Date').$divider.__('Source IP').$divider.__('Comments')."\n";
     foreach ($data as $line) {
-        echo io_safe_output($line['id_usuario']).';'.io_safe_output($line['accion']).';'.date($config['date_format'], $line['utimestamp']).';'.$line['ip_origen'].';'.io_safe_output($line['descripcion'])."\n";
+        echo io_safe_output($line['id_usuario']).$divider.io_safe_output($line['accion']).$divider.io_safe_output(date($config['date_format'], $line['utimestamp'])).$divider.$line['ip_origen'].$divider.io_safe_output($line['descripcion'])."\n";
     }
 
     exit;
@@ -5286,3 +5415,27 @@ function get_help_info($section_name)
     // hd($result);
     return $result;
 }
+
+
+if (!function_exists('getallheaders')) {
+
+
+    /**
+     * Fix for php-fpm
+     *
+     * @return array
+     */
+    function getallheaders()
+    {
+        $headers = [];
+        foreach ($_SERVER as $name => $value) {
+            if (substr($name, 0, 5) == 'HTTP_') {
+                $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
+            }
+        }
+
+        return $headers;
+    }
+
+
+}
diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php
index fd5e922e32..fdcce4457a 100644
--- a/pandora_console/include/functions_agents.php
+++ b/pandora_console/include/functions_agents.php
@@ -1513,29 +1513,30 @@ function agents_get_name($id_agent, $case='none')
  * Get alias of an agent (cached function).
  *
  * @param integer $id_agent Agent id.
- * @param string  $case     Case (upper, lower, none)
+ * @param string  $case     Case (upper, lower, none).
  *
  * @return string Alias of the given agent.
  */
 function agents_get_alias($id_agent, $case='none')
 {
     global $config;
-    // Prepare cache
+    // Prepare cache.
     static $cache = [];
     if (empty($case)) {
         $case = 'none';
     }
 
-    // Check cache
+    // Check cache.
     if (isset($cache[$case][$id_agent])) {
         return $cache[$case][$id_agent];
     }
 
-    if ($config['dbconnection_cache'] == null && is_metaconsole()) {
-        $alias = (string) db_get_value('alias', 'tmetaconsole_agent', 'id_tagente', (int) $id_agent);
-    } else {
-        $alias = (string) db_get_value('alias', 'tagente', 'id_agente', (int) $id_agent);
-    }
+    $alias = (string) db_get_value(
+        'alias',
+        'tagente',
+        'id_agente',
+        (int) $id_agent
+    );
 
     switch ($case) {
         case 'upper':
@@ -1545,6 +1546,10 @@ function agents_get_alias($id_agent, $case='none')
         case 'lower':
             $alias = mb_strtolower($alias, 'UTF-8');
         break;
+
+        default:
+            // Not posible.
+        break;
     }
 
     $cache[$case][$id_agent] = $alias;
@@ -1554,7 +1559,13 @@ function agents_get_alias($id_agent, $case='none')
 
 function agents_get_alias_by_name($name, $case='none')
 {
-    $alias = (string) db_get_value('alias', 'tagente', 'nombre', $name);
+    if (is_metaconsole()) {
+        $table = 'tmetaconsole_agent';
+    } else {
+        $table = 'tagente';
+    }
+
+    $alias = (string) db_get_value('alias', $table, 'nombre', $name);
 
     switch ($case) {
         case 'upper':
@@ -1614,9 +1625,9 @@ function agents_get_interval($id_agent)
  *
  * @param Agent object.
  *
- * @return The interval value and status of last contact
+ * @return The interval value and status of last contact or True /False
  */
-function agents_get_interval_status($agent)
+function agents_get_interval_status($agent, $return_html=true)
 {
     $return = '';
     $last_time = time_w_fixed_tz($agent['ultimo_contacto']);
@@ -1624,9 +1635,18 @@ function agents_get_interval_status($agent)
     $diferencia = ($now - $last_time);
     $time = ui_print_timestamp($last_time, true, ['style' => 'font-size:6.5pt']);
     $min_interval = modules_get_agentmodule_mininterval_no_async($agent['id_agente']);
-    $return = $time;
+    if ($return_html) {
+        $return = $time;
+    } else {
+        $return = true;
+    }
+
     if ($diferencia > ($min_interval['min_interval'] * 2) && $min_interval['num_interval'] > 0) {
-        $return = '<b><span style="color: #ff0000;">'.$time.'</span></b>';
+        if ($return_html) {
+            $return = '<b><span style="color: #ff0000;">'.$time.'</span></b>';
+        } else {
+            $return = false;
+        }
     }
 
     return $return;
@@ -3367,3 +3387,46 @@ function agents_get_image_status($status)
 
     return $image_status;
 }
+
+
+/**
+ * Animation GIF to show agent's status.
+ *
+ * @return string HTML code with heartbeat image.
+ */
+function agents_get_status_animation($up=true)
+{
+    global $config;
+
+    // Gif with black background or white background
+    if ($config['style'] === 'pandora_black') {
+        $heartbeat_green = 'images/heartbeat_green_black.gif';
+        $heartbeat_red = 'images/heartbeat_red_black.gif';
+    } else {
+        $heartbeat_green = 'images/heartbeat_green.gif';
+        $heartbeat_red = 'images/heartbeat_red.gif';
+    }
+
+    switch ($up) {
+        case true:
+        default:
+        return html_print_image(
+            $heartbeat_green,
+            true,
+            [
+                'width'  => '170',
+                'height' => '40',
+            ]
+        );
+
+        case false:
+        return html_print_image(
+            $heartbeat_red,
+            true,
+            [
+                'width'  => '170',
+                'height' => '40',
+            ]
+        );
+    }
+}
diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php
index 011acafae9..cc449b3445 100644
--- a/pandora_console/include/functions_alerts.php
+++ b/pandora_console/include/functions_alerts.php
@@ -1783,12 +1783,14 @@ function alerts_validate_alert_agent_module($id_alert_agent_module, $noACLs=fals
             ['id' => $id]
         );
 
+        $template_name = io_safe_output(db_get_value('name', 'talert_templates', 'id', $alert['id_alert_template']));
+        $module_name = io_safe_output(db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $alert['id_agent_module']));
         if ($result > 0) {
             // Update fired alert count on the agent
             db_process_sql(sprintf('UPDATE tagente SET update_alert_count=1 WHERE id_agente = %d', $agent_id));
 
             events_create_event(
-                'Manual validation of alert for '.alerts_get_alert_template_description($alert['id_alert_template']),
+                'Manual validation of alert '.$template_name.' assigned to '.$module_name.'',
                 $group_id,
                 $agent_id,
                 1,
@@ -1914,7 +1916,6 @@ function alerts_get_agents_with_alert_template($id_alert_template, $id_group, $f
     $filter[] = 'tagente_modulo.id_agente_modulo = talert_template_modules.id_agent_module';
     $filter[] = 'tagente_modulo.id_agente = tagente.id_agente';
     $filter['id_alert_template'] = $id_alert_template;
-    $filter['tagente_modulo.disabled'] = '<> 1';
     $filter['delete_pending'] = '<> 1';
 
     if (empty($id_agents)) {
@@ -2491,7 +2492,7 @@ function alerts_get_action_escalation($action)
         $escalation[$action['fires_max']] = 1;
     } else if ($action['fires_min'] < $action['fires_max']) {
         for ($i = 1; $i <= $action['fires_max']; $i++) {
-            if ($i <= $action['fires_min']) {
+            if ($i < $action['fires_min']) {
                 $escalation[$i] = 0;
             } else {
                 $escalation[$i] = 1;
diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index 3c6cdbf595..899add9ec0 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -7494,63 +7494,62 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3)
 
 
 /**
- * Remove an agent from a policy.
+ * Remove an agent from a policy by agent id.
  *
  * @param $id Id of the policy
- * @param $id2 Id of the agent policy
- * @param $trash1
- * @param $trash2
+ * @param $thrash1 Don't use.
+ * @param $other
+ * @param $thrash2 Don't use.
  *
  * Example:
  * api.php?op=set&op2=remove_agent_from_policy&apipass=1234&user=admin&pass=pandora&id=11&id2=2
  */
-function api_set_remove_agent_from_policy($id, $id2, $thrash2, $thrash3)
+function api_set_remove_agent_from_policy_by_id($id, $thrash1, $other, $thrash2)
 {
-    global $config;
-
-    if (!check_acl($config['id_user'], 0, 'AW')) {
-        returnError('forbidden', 'string');
-        return;
-    }
-
     if ($id == '' || !$id) {
         returnError('error_parameter', __('Error deleting agent from policy. Policy cannot be left blank.'));
         return;
     }
 
-    if ($id2 == '' || !$id2) {
+    if ($other['data'][0] == '' || !$other['data'][0]) {
         returnError('error_parameter', __('Error deleting agent from policy. Agent cannot be left blank.'));
         return;
     }
 
-    $policy = policies_get_policy($id, false, false);
-    $agent = db_get_row_filter('tagente', ['id_agente' => $id2]);
-    $policy_agent = db_get_row_filter('tpolicy_agents', ['id_policy' => $id, 'id_agent' => $id2]);
-
-    if (empty($policy)) {
-        returnError('error_policy', __('This policy does not exist.'));
+    // Require node id if is metaconsole
+    if (is_metaconsole() && $other['data'][1] == '') {
+        returnError('error_add_agent_policy', __('Error deleting agent from policy. Node ID cannot be left blank.'));
         return;
     }
 
-    if (empty($agent)) {
-        returnError('error_agent', __('This agent does not exist.'));
+    return remove_agent_from_policy($id, false, [$other['data'][0], $other['data'][1]]);
+}
+
+
+/**
+ * Remove an agent from a policy by agent name.
+ *
+ * @param $id Id of the policy
+ * @param $thrash1 Don't use.
+ * @param $other
+ * @param $thrash2 Don't use.
+ *
+ * Example:
+ * api.php?op=set&op2=remove_agent_from_policy&apipass=1234&user=admin&pass=pandora&id=11&id2=2
+ */
+function api_set_remove_agent_from_policy_by_name($id, $thrash1, $other, $thrash2)
+{
+    if ($id == '' || !$id) {
+        returnError('error_parameter', __('Error deleting agent from policy. Policy cannot be left blank.'));
         return;
     }
 
-    if (empty($policy_agent)) {
-        returnError('error_policy_agent', __('This agent does not exist in this policy.'));
+    if ($other['data'][0] == '' || !$other['data'][0]) {
+        returnError('error_add_agent_policy', __('Error adding agent to policy. Agent name cannot be left blank.'));
         return;
     }
 
-    $return = policies_change_delete_pending_agent($policy_agent['id']);
-    $data = __('Successfully added to delete pending id agent %d to id policy %d.', $id2, $id);
-
-    if ($return === false) {
-        returnError('error_delete_policy_agent', 'Could not be deleted id agent %d from id policy %d', $id2, $id);
-    } else {
-        returnData('string', ['type' => 'string', 'data' => $data]);
-    }
-
+    return remove_agent_from_policy($id, true, [$other['data'][0]]);
 }
 
 
@@ -11519,7 +11518,7 @@ function api_set_create_event($id, $trash1, $other, $returnType)
 
         if ($other['data'][18] != '') {
             $values['id_extra'] = $other['data'][18];
-            $sql_validation = 'SELECT id_evento FROM tevento where estado=0 and id_extra ="'.$other['data'][18].'";';
+            $sql_validation = 'SELECT id_evento FROM tevento where estado IN (0,2) and id_extra ="'.$other['data'][18].'";';
             $validation = db_get_all_rows_sql($sql_validation);
             if ($validation) {
                 foreach ($validation as $val) {
@@ -14209,28 +14208,6 @@ function api_get_all_event_filters($thrash1, $thrash2, $other, $thrash3)
 }
 
 
-//
-// AUX FUNCTIONS
-//
-function util_api_check_agent_and_print_error($id_agent, $returnType, $access='AR', $force_meta=false)
-{
-    global $config;
-
-    $check_agent = agents_check_access_agent($id_agent, $access, $force_meta);
-    if ($check_agent === true) {
-        return true;
-    }
-
-    if ($check_agent === false || !check_acl($config['id_user'], 0, $access)) {
-        returnError('forbidden', $returnType);
-    } else if ($check_agent === null) {
-        returnError('id_not_found', $returnType);
-    }
-
-    return false;
-}
-
-
 function api_get_user_info($thrash1, $thrash2, $other, $returnType)
 {
     $separator = ';';
@@ -15047,3 +15024,95 @@ function api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $retur
      returnData($returnType, $data, ';');
 
 }
+
+
+// AUXILIARY FUNCTIONS
+
+
+/**
+ * Auxiliary function to remove an agent from a policy. Used from API methods api_set_remove_agent_from_policy_by_id and api_set_remove_agent_from_policy_by_name.
+ *
+ * @param int ID of targeted policy.
+ * @param boolean If true it will look for the agent we are targeting at based on its agent name, otherwise by agent id.
+ * @param array Array containing agent's name or agent's id (and node id in case we are on metaconsole).
+ */
+function remove_agent_from_policy($id_policy, $use_agent_name, $params)
+{
+    global $config;
+
+    if (!check_acl($config['id_user'], 0, 'AW')) {
+        returnError('forbidden', 'string');
+        return;
+    }
+
+    $id_node = 0;
+    $agent_table = 'tagente';
+
+    if ($use_agent_name === false) {
+        $id_agent = $params[0];
+    } else {
+        $id_agent = db_get_value_filter('id_agente', 'tagente', ['nombre' => $params[0]]);
+    }
+
+    $agent = db_get_row_filter('tagente', ['id_agente' => $id_agent]);
+
+    if (is_metaconsole()) {
+        if ($use_agent_name === false) {
+            $id_node = $params[1];
+            $id_agent = $params[0];
+        } else {
+            $id_node = db_get_value_filter('id_tmetaconsole_setup', 'tmetaconsole_agent', ['nombre' => $params[0]]);
+            $id_agent = db_get_value_filter('id_tagente', 'tmetaconsole_agent', ['nombre' => $params[0]]);
+        }
+
+        $agent = db_get_row_filter('tmetaconsole_agent', ['id_tagente' => $id_agent, 'id_tmetaconsole_setup' => $id_node]);
+    }
+
+    $policy = policies_get_policy($id_policy, false, false);
+
+    $policy_agent = (is_metaconsole()) ? db_get_row_filter('tpolicy_agents', ['id_policy' => $id_policy, 'id_agent' => $id_agent, 'id_node' => $id_node]) : db_get_row_filter('tpolicy_agents', ['id_policy' => $id_policy, 'id_agent' => $id_agent]);
+
+    if (empty($policy)) {
+        returnError('error_policy', __('This policy does not exist.'));
+        return;
+    }
+
+    if (empty($agent)) {
+        returnError('error_agent', __('This agent does not exist.'));
+        return;
+    }
+
+    if (empty($policy_agent)) {
+        returnError('error_policy_agent', __('This agent does not exist in this policy.'));
+        return;
+    }
+
+    $return = policies_change_delete_pending_agent($policy_agent['id']);
+    $data = __('Successfully added to delete pending id agent %d to id policy %d.', $id_agent, $id_policy);
+
+    if ($return === false) {
+        returnError('error_delete_policy_agent', 'Could not be deleted id agent %d from id policy %d', $id_agent, $id_policy);
+    } else {
+        returnData('string', ['type' => 'string', 'data' => $data]);
+    }
+
+}
+
+
+function util_api_check_agent_and_print_error($id_agent, $returnType, $access='AR', $force_meta=false)
+{
+    global $config;
+
+    $check_agent = agents_check_access_agent($id_agent, $access, $force_meta);
+    if ($check_agent === true) {
+        return true;
+    }
+
+    if ($check_agent === false || !check_acl($config['id_user'], 0, $access)) {
+        returnError('forbidden', $returnType);
+    } else if ($check_agent === null) {
+        returnError('id_not_found', $returnType);
+    }
+
+    return false;
+}
diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php
index 1b5af44a21..bc5e64190d 100644
--- a/pandora_console/include/functions_config.php
+++ b/pandora_console/include/functions_config.php
@@ -180,7 +180,7 @@ function config_update_config()
                         $error_update[] = __('Automatic check for updates');
                     }
 
-                    if (!config_update_value('cert_path', (bool) get_parameter('cert_path'))) {
+                    if (!config_update_value('cert_path', get_parameter('cert_path'))) {
                         $error_update[] = __('SSL cert path');
                     }
 
@@ -266,6 +266,14 @@ function config_update_config()
                         $error_update[] = __('Public URL');
                     }
 
+                    if (!config_update_value('force_public_url', get_parameter_switch('force_public_url'))) {
+                        $error_update[] = __('Force use Public URL');
+                    }
+
+                    if (!config_update_value('public_url_exclusions', get_parameter('public_url_exclusions'))) {
+                        $error_update[] = __('Public URL host exclusions');
+                    }
+
                     if (!config_update_value('referer_security', get_parameter('referer_security'))) {
                         $error_update[] = __('Referer security');
                     }
@@ -423,6 +431,10 @@ function config_update_config()
                             $error_update[] = __('Enable Update Manager');
                         }
 
+                        if (!config_update_value('disabled_newsletter', get_parameter('disabled_newsletter'))) {
+                            $error_update[] = __('Disabled newsletter');
+                        }
+
                         if (!config_update_value('ipam_ocuppied_critical_treshold', get_parameter('ipam_ocuppied_critical_treshold'))) {
                             $error_update[] = __('Ipam Ocuppied Manager Critical');
                         }
@@ -652,6 +664,42 @@ function config_update_config()
                         $error_update[] = __('Saml path');
                     }
 
+                    if (!config_update_value('saml_source', get_parameter('saml_source'))) {
+                        $error_update[] = __('Saml source');
+                    }
+
+                    if (!config_update_value('saml_user_id', get_parameter('saml_user_id'))) {
+                        $error_update[] = __('Saml user id parameter');
+                    }
+
+                    if (!config_update_value('saml_mail', get_parameter('saml_mail'))) {
+                        $error_update[] = __('Saml mail parameter');
+                    }
+
+                    if (!config_update_value('saml_group_name', get_parameter('saml_group_name'))) {
+                        $error_update[] = __('Saml group name parameter');
+                    }
+
+                    if (!config_update_value('saml_attr_type', (bool) get_parameter('saml_attr_type'))) {
+                        $error_update[] = __('Saml attr type parameter');
+                    }
+
+                    if (!config_update_value('saml_profiles_and_tags', get_parameter('saml_profiles_and_tags'))) {
+                        $error_update[] = __('Saml profiles and tags parameter');
+                    }
+
+                    if (!config_update_value('saml_profile', get_parameter('saml_profile'))) {
+                        $error_update[] = __('Saml profile parameters');
+                    }
+
+                    if (!config_update_value('saml_tag', get_parameter('saml_tag'))) {
+                        $error_update[] = __('Saml tag parameter');
+                    }
+
+                    if (!config_update_value('saml_profile_tag_separator', get_parameter('saml_profile_tag_separator'))) {
+                        $error_update[] = __('Saml profile and tag separator');
+                    }
+
                     if (!config_update_value('double_auth_enabled', get_parameter('double_auth_enabled'))) {
                         $error_update[] = __('Double authentication');
                     }
@@ -1687,6 +1735,10 @@ function config_process_config()
         config_update_value('enable_update_manager', 1);
     }
 
+    if (!isset($config['disabled_newsletter'])) {
+        config_update_value('disabled_newsletter', 0);
+    }
+
     if (!isset($config['ipam_ocuppied_critical_treshold'])) {
         config_update_value('ipam_ocuppied_critical_treshold', 90);
     }
@@ -2167,9 +2219,9 @@ function config_process_config()
     if (!isset($config['ad_adv_perms'])) {
         config_update_value('ad_adv_perms', '');
     } else {
+        $temp_ad_adv_perms = [];
         if (!json_decode(io_safe_output($config['ad_adv_perms']))) {
-            $temp_ad_adv_perms = [];
-            if (!isset($config['ad_adv_perms']) && $config['ad_adv_perms'] != '') {
+            if ($config['ad_adv_perms'] != '') {
                 $perms = explode(';', io_safe_output($config['ad_adv_perms']));
                 foreach ($perms as $ad_adv_perm) {
                     if (preg_match('/[\[\]]/', $ad_adv_perm)) {
@@ -2232,22 +2284,26 @@ function config_process_config()
                 if (!empty($new_ad_adv_perms)) {
                     $temp_ad_adv_perms = json_encode($new_ad_adv_perms);
                 }
+            } else {
+                $temp_ad_adv_perms = '';
             }
-
-            config_update_value('ad_adv_perms', $temp_ad_adv_perms);
+        } else {
+            $temp_ad_adv_perms = $config['ad_adv_perms'];
         }
+
+          config_update_value('ad_adv_perms', $temp_ad_adv_perms);
     }
 
     if (!isset($config['ldap_adv_perms'])) {
         config_update_value('ldap_adv_perms', '');
     } else {
+        $temp_ldap_adv_perms = [];
         if (!json_decode(io_safe_output($config['ldap_adv_perms']))) {
-            $temp_ldap_adv_perms = [];
-            if (!isset($config['ad_adv_perms']) && $config['ldap_adv_perms'] != '') {
+            if ($config['ldap_adv_perms'] != '') {
                 $perms = explode(';', io_safe_output($config['ldap_adv_perms']));
-                foreach ($perms as $ad_adv_perm) {
-                    if (preg_match('/[\[\]]/', $ad_adv_perm)) {
-                        $all_data = explode(',', io_safe_output($ad_adv_perm));
+                foreach ($perms as $ldap_adv_perm) {
+                    if (preg_match('/[\[\]]/', $ldap_adv_perm)) {
+                        $all_data = explode(',', io_safe_output($ldap_adv_perm));
                         $profile = $all_data[0];
                         $group_pnd = $all_data[1];
                         $groups_ad = str_replace(['[', ']'], '', $all_data[2]);
@@ -2277,7 +2333,7 @@ function config_process_config()
                             'groups_ldap' => $groups_ldap,
                         ];
                     } else {
-                        $all_data = explode(',', io_safe_output($ad_adv_perm));
+                        $all_data = explode(',', io_safe_output($ldap_adv_perm));
                         $profile = $all_data[0];
                         $group_pnd = $all_data[1];
                         $groups_ad = $all_data[2];
@@ -2306,10 +2362,14 @@ function config_process_config()
                 if (!empty($new_ldap_adv_perms)) {
                     $temp_ldap_adv_perms = json_encode($new_ldap_adv_perms);
                 }
+            } else {
+                $temp_ldap_adv_perms = '';
             }
-
-            config_update_value('ldap_adv_perms', $temp_ldap_adv_perms);
+        } else {
+            $temp_ldap_adv_perms = $config['ldap_adv_perms'];
         }
+
+        config_update_value('ldap_adv_perms', $temp_ldap_adv_perms);
     }
 
     if (!isset($config['rpandora_server'])) {
@@ -2356,6 +2416,42 @@ function config_process_config()
         config_update_value('saml_path', '/opt/');
     }
 
+    if (!isset($config['saml_source'])) {
+        config_update_value('saml_source', '');
+    }
+
+    if (!isset($config['saml_user_id'])) {
+        config_update_value('saml_user_id', '');
+    }
+
+    if (!isset($config['saml_mail'])) {
+        config_update_value('saml_mail', '');
+    }
+
+    if (!isset($config['saml_group_name'])) {
+        config_update_value('saml_group_name', '');
+    }
+
+    if (!isset($config['saml_attr_type'])) {
+        config_update_value('saml_attr_type', false);
+    }
+
+    if (!isset($config['saml_profiles_and_tags'])) {
+        config_update_value('saml_profiles_and_tags', '');
+    }
+
+    if (!isset($config['saml_profile'])) {
+        config_update_value('saml_profile', '');
+    }
+
+    if (!isset($config['saml_tag'])) {
+        config_update_value('saml_tag', '');
+    }
+
+    if (!isset($config['saml_profile_tag_separator'])) {
+        config_update_value('saml_profile_tag_separator', '');
+    }
+
     if (!isset($config['autoupdate'])) {
         config_update_value('autoupdate', 1);
     }
@@ -2871,7 +2967,17 @@ function config_prepare_session()
 
     // Reset the expiration time upon page load //session_name() is default name of session PHPSESSID.
     if (isset($_COOKIE[session_name()])) {
-        setcookie(session_name(), $_COOKIE[session_name()], (time() + $sessionCookieExpireTime), '/');
+        $update_cookie = true;
+        if (is_ajax()) {
+            // Avoid session upadte while processing ajax responses - notifications.
+            if (get_parameter('check_new_notifications', false)) {
+                $update_cookie = false;
+            }
+        }
+
+        if ($update_cookie === true) {
+            setcookie(session_name(), $_COOKIE[session_name()], (time() + $sessionCookieExpireTime), '/');
+        }
     }
 
     ini_set('post_max_size', $config['max_file_size']);
diff --git a/pandora_console/include/functions_credential_store.php b/pandora_console/include/functions_credential_store.php
new file mode 100644
index 0000000000..1b64bba116
--- /dev/null
+++ b/pandora_console/include/functions_credential_store.php
@@ -0,0 +1,445 @@
+<?php
+/**
+ * Credentials management auxiliary functions.
+ *
+ * @category   Credentials management library.
+ * @package    Pandora FMS
+ * @subpackage Opensource
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
+
+// Begin.
+
+
+/**
+ * Returns an array with all the credentials matching filter and ACL.
+ *
+ * @param array   $fields     Fields array or 'count' keyword to retrieve count.
+ * @param array   $filter     Filters to be applied.
+ * @param integer $offset     Offset (pagination).
+ * @param integer $limit      Limit (pagination).
+ * @param string  $order      Sort order.
+ * @param string  $sort_field Sort field.
+ *
+ * @return array With all results or false if error.
+ * @throws Exception On error.
+ */
+function credentials_get_all(
+    $fields,
+    array $filter,
+    $offset=null,
+    $limit=null,
+    $order=null,
+    $sort_field=null
+) {
+    $sql_filters = [];
+    $order_by = '';
+    $pagination = '';
+
+    global $config;
+
+    if (!is_array($filter)) {
+        error_log('[credential_get_all] Filter must be an array.');
+        throw new Exception('[credential_get_all] Filter must be an array.');
+    }
+
+    $count = false;
+    if (!is_array($fields) && $fields == 'count') {
+        $fields = ['cs.*'];
+        $count = true;
+    } else if (!is_array($fields)) {
+        error_log('[credential_get_all] Fields must be an array or "count".');
+        throw new Exception('[credential_get_all] Fields must be an array or "count".');
+    }
+
+    if (isset($filter['product']) && !empty($filter['product'])) {
+        $sql_filters[] = sprintf(' AND cs.product = "%s"', $filter['product']);
+    }
+
+    if (isset($filter['free_search']) && !empty($filter['free_search'])) {
+        $sql_filters[] = vsprintf(
+            ' AND (lower(cs.username) like lower("%%%s%%")
+                OR cs.identifier like "%%%s%%"
+                OR lower(cs.product) like lower("%%%s%%"))',
+            array_fill(0, 3, $filter['free_search'])
+        );
+    }
+
+    if (isset($filter['filter_id_group']) && $filter['filter_id_group'] > 0) {
+        $propagate = db_get_value(
+            'propagate',
+            'tgrupo',
+            'id_grupo',
+            $filter['filter_id_group']
+        );
+
+        if (!$propagate) {
+            $sql_filters[] = sprintf(
+                ' AND cs.id_group = %d ',
+                $filter['filter_id_group']
+            );
+        } else {
+            $groups = [ $filter['filter_id_group'] ];
+            $childrens = groups_get_childrens($id_group, null, true);
+            if (!empty($childrens)) {
+                foreach ($childrens as $child) {
+                    $groups[] = (int) $child['id_grupo'];
+                }
+            }
+
+            $filter['filter_id_group'] = $groups;
+            $sql_filters[] = sprintf(
+                ' AND cs.id_group IN (%s) ',
+                join(',', $filter['filter_id_group'])
+            );
+        }
+    }
+
+    if (isset($filter['group_list']) && is_array($filter['group_list'])) {
+        $sql_filters[] = sprintf(
+            ' AND cs.id_group IN (%s) ',
+            join(',', $filter['group_list'])
+        );
+    }
+
+    if (isset($order)) {
+        $dir = 'asc';
+        if ($order == 'desc') {
+            $dir = 'desc';
+        };
+
+        if (in_array(
+            $sort_field,
+            [
+                'group',
+                'identifier',
+                'product',
+                'username',
+                'options',
+            ]
+        )
+        ) {
+            $order_by = sprintf(
+                'ORDER BY `%s` %s',
+                $sort_field,
+                $dir
+            );
+        }
+    }
+
+    if (isset($limit) && $limit > 0
+        && isset($offset) && $offset >= 0
+    ) {
+        $pagination = sprintf(
+            ' LIMIT %d OFFSET %d ',
+            $limit,
+            $offset
+        );
+    }
+
+    $sql = sprintf(
+        'SELECT %s
+         FROM tcredential_store cs
+         LEFT JOIN tgrupo tg
+            ON tg.id_grupo = cs.id_group
+         WHERE 1=1
+         %s
+         %s
+         %s',
+        join(',', $fields),
+        join(' ', $sql_filters),
+        $order_by,
+        $pagination
+    );
+
+    if ($count) {
+        $sql = sprintf('SELECT count(*) as n FROM ( %s ) tt', $sql);
+
+        return db_get_value_sql($sql);
+    }
+
+    return db_get_all_rows_sql($sql);
+}
+
+
+/**
+ * Retrieves target key from keystore or false in case of error.
+ *
+ * @param string $identifier Key identifier.
+ *
+ * @return array Key or false if error.
+ */
+function get_key($identifier)
+{
+    return db_get_row_filter(
+        'tcredential_store',
+        [ 'identifier' => $identifier ]
+    );
+}
+
+
+/**
+ * Minor function to dump json message as ajax response.
+ *
+ * @param string  $type   Type: result || error.
+ * @param string  $msg    Message.
+ * @param boolean $delete Deletion messages.
+ *
+ * @return void
+ */
+function ajax_msg($type, $msg, $delete=false)
+{
+    $msg_err = 'Failed while saving: %s';
+    $msg_ok = 'Successfully saved into keystore ';
+
+    if ($delete) {
+        $msg_err = 'Failed while removing: %s';
+        $msg_ok = 'Successfully deleted ';
+    }
+
+    if ($type == 'error') {
+        echo json_encode(
+            [
+                $type => ui_print_error_message(
+                    __(
+                        $msg_err,
+                        $msg
+                    ),
+                    '',
+                    true
+                ),
+            ]
+        );
+    } else {
+        echo json_encode(
+            [
+                $type => ui_print_success_message(
+                    __(
+                        $msg_ok,
+                        $msg
+                    ),
+                    '',
+                    true
+                ),
+            ]
+        );
+    }
+
+    exit;
+}
+
+
+/**
+ * Generates inputs for new/update forms.
+ *
+ * @param array $values Values or null.
+ *
+ * @return string Inputs.
+ */
+function print_inputs($values=null)
+{
+    if (!is_array($values)) {
+        $values = [];
+    }
+
+    $return = '';
+    $return .= html_print_input(
+        [
+            'label'       => __('Identifier'),
+            'name'        => 'identifier',
+            'input_class' => 'flex-row',
+            'type'        => 'text',
+            'value'       => $values['identifier'],
+            'disabled'    => (bool) $values['identifier'],
+            'return'      => true,
+            'script'      => 'alert(\'puta\')',
+        ]
+    );
+    $return .= html_print_input(
+        [
+            'label'       => __('Group'),
+            'name'        => 'id_group',
+            'id'          => 'id_group',
+            'input_class' => 'flex-row',
+            'type'        => 'select_groups',
+            'selected'    => $values['id_group'],
+            'return'      => true,
+            'class'       => 'w50p',
+        ]
+    );
+    $return .= html_print_input(
+        [
+            'label'       => __('Product'),
+            'name'        => 'product',
+            'input_class' => 'flex-row',
+            'type'        => 'select',
+            'script'      => 'calculate_inputs()',
+            'fields'      => [
+                'CUSTOM' => __('Custom'),
+                'AWS'    => __('Aws'),
+                'AZURE'  => __('Azure'),
+                // 'GOOGLE' => __('Google'),
+            ],
+            'selected'    => $values['product'],
+            'disabled'    => (bool) $values['product'],
+            'return'      => true,
+        ]
+    );
+    $user_label = __('Username');
+    $pass_label = __('Password');
+    $extra_1_label = __('Extra');
+    $extra_2_label = __('Extra (2)');
+    $extra1 = true;
+    $extra2 = true;
+
+    // Remember to update credential_store.php also.
+    switch ($values['product']) {
+        case 'AWS':
+            $user_label = __('Access key ID');
+            $pass_label = __('Secret access key');
+            $extra1 = false;
+            $extra2 = false;
+        break;
+
+        case 'AZURE':
+            $user_label = __('Account ID');
+            $pass_label = __('Application secret');
+            $extra_1_label = __('Tenant or domain name');
+            $extra_2_label = __('Subscription id');
+        break;
+
+        case 'GOOGLE':
+            // Need further investigation.
+        case 'CUSTOM':
+            $user_label = __('Account ID');
+            $pass_label = __('Password');
+            $extra1 = false;
+            $extra2 = false;
+        default:
+            // Use defaults.
+        break;
+    }
+
+    $return .= html_print_input(
+        [
+            'label'       => $user_label,
+            'name'        => 'username',
+            'input_class' => 'flex-row',
+            'type'        => 'text',
+            'value'       => $values['username'],
+            'return'      => true,
+        ]
+    );
+    $return .= html_print_input(
+        [
+            'label'       => $pass_label,
+            'name'        => 'password',
+            'input_class' => 'flex-row',
+            'type'        => 'password',
+            'value'       => $values['password'],
+            'return'      => true,
+        ]
+    );
+    if ($extra1) {
+        $return .= html_print_input(
+            [
+                'label'       => $extra_1_label,
+                'name'        => 'extra_1',
+                'input_class' => 'flex-row',
+                'type'        => 'text',
+                'value'       => $values['extra_1'],
+                'return'      => true,
+            ]
+        );
+    }
+
+    if ($extra2) {
+        $return .= html_print_input(
+            [
+                'label'       => $extra_2_label,
+                'name'        => 'extra_2',
+                'input_class' => 'flex-row',
+                'type'        => 'text',
+                'value'       => $values['extra_2'],
+                'return'      => true,
+                'display'     => $extra2,
+            ]
+        );
+    }
+
+    return $return;
+}
+
+
+/**
+ * Retrieve all identifiers available for current user.
+ *
+ * @param string $product Target product.
+ *
+ * @return array Of account identifiers.
+ */
+function credentials_list_accounts($product)
+{
+    global $config;
+
+    check_login();
+
+    include_once $config['homedir'].'/include/functions_users.php';
+
+    static $user_groups;
+
+    if (!isset($user_groups)) {
+        $user_groups = users_get_groups(
+            $config['id_user'],
+            'AR'
+        );
+
+        // Always add group 'ALL' because 'ALL' group credentials
+        // must be available for all users.
+        if (is_array($user_groups)) {
+            $user_groups = ([0] + array_keys($user_groups));
+        } else {
+            $user_groups = [0];
+        }
+    }
+
+    $creds = credentials_get_all(
+        ['identifier'],
+        [
+            'product'    => $product,
+            'group_list' => $user_groups,
+        ]
+    );
+
+    if ($creds === false) {
+        return [];
+    }
+
+    $ret = array_reduce(
+        $creds,
+        function ($carry, $item) {
+            $carry[$item['identifier']] = $item['identifier'];
+            return $carry;
+        }
+    );
+
+    return $ret;
+}
diff --git a/pandora_console/include/functions_custom_fields.php b/pandora_console/include/functions_custom_fields.php
index 9570098766..d1f661e874 100644
--- a/pandora_console/include/functions_custom_fields.php
+++ b/pandora_console/include/functions_custom_fields.php
@@ -188,10 +188,16 @@ function get_custom_fields_data($custom_field_name)
             }
 
             $array_result = [];
-            if (isset($result_meta) && is_array($result_meta)) {
+            if (isset($result_meta) === true
+                && is_array($result_meta) === true
+            ) {
                 foreach ($result_meta as $result) {
-                    foreach ($result as $k => $v) {
-                        $array_result[$v['description']] = $v['description'];
+                    if (isset($result) === true
+                        && is_array($result) === true
+                    ) {
+                        foreach ($result as $k => $v) {
+                            $array_result[$v['description']] = $v['description'];
+                        }
                     }
                 }
             }
@@ -385,9 +391,13 @@ function agent_counters_custom_fields($filters)
 
     // Filter custom data.
     $custom_data_and = '';
-    if (!in_array(-1, $filters['id_custom_fields_data'])) {
-        $custom_data_array = implode("', '", $filters['id_custom_fields_data']);
-        $custom_data_and = "AND tcd.description IN ('".$custom_data_array."')";
+    if (isset($filters['id_custom_fields_data']) === true
+        && is_array($filters['id_custom_fields_data']) === true
+    ) {
+        if (!in_array(-1, $filters['id_custom_fields_data'])) {
+            $custom_data_array = implode("', '", $filters['id_custom_fields_data']);
+            $custom_data_and = "AND tcd.description IN ('".$custom_data_array."')";
+        }
     }
 
     // Filter custom name.
@@ -693,3 +703,123 @@ function print_counters_cfv(
     $html_result .= '</form>';
     return $html_result;
 }
+
+
+/**
+ * Function for export a csv file from Custom Fields View
+ *
+ * @param array $filters       Status counters for agents and modules.
+ * @param array $id_status     Agent status.
+ * @param array $module_status Module status.
+ *
+ * @return array Returns the data that will be saved in the csv file
+ */
+function export_custom_fields_csv($filters, $id_status, $module_status)
+{
+    $data = agent_counters_custom_fields($filters);
+    $indexed_descriptions = $data['indexed_descriptions'];
+
+    // Table temporary for save array in table
+    // by order and search custom_field data.
+    $table_temporary = 'CREATE TEMPORARY TABLE temp_custom_fields (
+        id_server int(10),
+        id_agent int(10),
+        name_custom_fields varchar(2048),
+        critical_count int,
+        warning_count int,
+        unknown_count int,
+        notinit_count int,
+        normal_count int,
+        total_count int,
+        `status` int(2),
+        KEY `data_index_temp_1` (`id_server`, `id_agent`)
+    )';
+    db_process_sql($table_temporary);
+
+    // Insert values array in table temporary.
+    $values_insert = [];
+    foreach ($indexed_descriptions as $key => $value) {
+        $values_insert[] = '('.$value['id_server'].', '.$value['id_agente'].", '".$value['description']."', '".$value['critical_count']."', '".$value['warning_count']."', '".$value['unknown_count']."', '".$value['notinit_count']."', '".$value['normal_count']."', '".$value['total_count']."', ".$value['status'].')';
+    }
+
+    $values_insert_implode = implode(',', $values_insert);
+    $query_insert = 'INSERT INTO temp_custom_fields VALUES '.$values_insert_implode;
+    db_process_sql($query_insert);
+
+    // Search for status module.
+    $status_agent_search = '';
+    if (isset($id_status) === true && is_array($id_status) === true) {
+        if (in_array(-1, $id_status) === false) {
+            if (in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $id_status) === false) {
+                $status_agent_search = ' AND temp.status IN ('.implode(',', $id_status).')';
+            } else {
+                // Not normal statuses.
+                $status_agent_search = ' AND temp.status IN (1,2,3,4,5)';
+            }
+        }
+    }
+
+    // Search for status module.
+    $status_module_search = '';
+    if (isset($module_status) === true && is_array($module_status) === true) {
+        if (in_array(-1, $module_status) === false) {
+            if (in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $module_status) === false) {
+                if (count($module_status) > 0) {
+                    $status_module_search = ' AND ( ';
+                    foreach ($module_status as $key => $value) {
+                        $status_module_search .= ($key != 0) ? ' OR (' : ' (';
+                        switch ($value) {
+                            default:
+                            case AGENT_STATUS_NORMAL:
+                                $status_module_search .= ' temp.normal_count > 0) ';
+                            break;
+                            case AGENT_STATUS_CRITICAL:
+                                $status_module_search .= ' temp.critical_count > 0) ';
+                            break;
+
+                            case AGENT_STATUS_WARNING:
+                                $status_module_search .= ' temp.warning_count > 0) ';
+                            break;
+
+                            case AGENT_STATUS_UNKNOWN:
+                                $status_module_search .= ' temp.unknown_count > 0) ';
+                            break;
+
+                            case AGENT_STATUS_NOT_INIT:
+                                $status_module_search .= ' temp.notinit_count > 0) ';
+                            break;
+                        }
+                    }
+
+                    $status_module_search .= ' ) ';
+                }
+            } else {
+                // Not normal.
+                $status_module_search = ' AND ( temp.critical_count > 0 OR temp.warning_count > 0 OR temp.unknown_count > 0 AND temp.notinit_count > 0 )';
+            }
+        }
+    }
+
+    // Query all fields result.
+    $query = sprintf(
+        'SELECT
+        temp.name_custom_fields,
+        tma.alias,
+        tma.direccion,
+        tma.server_name,
+        temp.status
+    FROM tmetaconsole_agent tma
+    INNER JOIN temp_custom_fields temp
+        ON temp.id_agent = tma.id_tagente
+        AND temp.id_server = tma.id_tmetaconsole_setup
+    WHERE tma.disabled = 0
+    %s
+    %s
+    ',
+        $status_agent_search,
+        $status_module_search
+    );
+
+    $result = db_get_all_rows_sql($query);
+    return $result;
+}
diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php
index f98084f808..4a1c5df11c 100644
--- a/pandora_console/include/functions_custom_graphs.php
+++ b/pandora_console/include/functions_custom_graphs.php
@@ -184,7 +184,7 @@ function custom_graphs_search($id_group, $search)
                         FROM tgraph_source
                         WHERE id_graph = '.$graph['id_graph'].''
         );
-
+        $graphs[$graph['id_graph']]['id_graph'] = $graph['id_graph'];
         $graphs[$graph['id_graph']]['graphs_count'] = $graphsCount;
         $graphs[$graph['id_graph']]['name'] = $graph['name'];
         $graphs[$graph['id_graph']]['description'] = $graph['description'];
diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php
index 2061ab215c..3efbf59628 100644
--- a/pandora_console/include/functions_db.php
+++ b/pandora_console/include/functions_db.php
@@ -2023,3 +2023,58 @@ function db_check_minor_relase_available_to_um($package, $ent, $offline)
         return false;
     }
 }
+
+
+/**
+ * Tries to get a lock with current name.
+ *
+ * @param string  $lockname        Lock name.
+ * @param integer $expiration_time Expiration time.
+ *
+ * @return integer 1 - lock OK, able to continue executing
+ *                 0 - already locked by another process.
+ *                 NULL: something really bad happened
+ */
+function db_get_lock($lockname, $expiration_time=86400)
+{
+    $lock_status = db_get_value_sql(
+        sprintf(
+            'SELECT IS_FREE_LOCK("%s")',
+            $lockname
+        )
+    );
+
+    if ($lock_status == 1) {
+        $lock_status = db_get_value_sql(
+            sprintf(
+                'SELECT GET_LOCK("%s", %d)',
+                $lockname,
+                $expiration_time
+            )
+        );
+
+        return $lock_status;
+    }
+
+    return 0;
+}
+
+
+/**
+ * Release a previously defined lock.
+ *
+ * @param string $lockname Lock name.
+ *
+ * @return integer 1 Lock released.
+ *                 0 cannot release (not owned).
+ *                 NULL lock does not exist.
+ */
+function db_release_lock($lockname)
+{
+    return db_get_value_sql(
+        sprintf(
+            'SELECT RELEASE_LOCK("%s")',
+            $lockname
+        )
+    );
+}
diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php
index 3feceb847b..ffb36aa3ae 100644
--- a/pandora_console/include/functions_events.php
+++ b/pandora_console/include/functions_events.php
@@ -25,13 +25,154 @@
  * GNU General Public License for more details.
  * ============================================================================
  */
+global $config;
 
 require_once $config['homedir'].'/include/functions_ui.php';
 require_once $config['homedir'].'/include/functions_tags.php';
 require_once $config['homedir'].'/include/functions.php';
+require_once $config['homedir'].'/include/functions_reporting.php';
+enterprise_include_once('include/functions_metaconsole.php');
 enterprise_include_once('meta/include/functions_events_meta.php');
 enterprise_include_once('meta/include/functions_agents_meta.php');
 enterprise_include_once('meta/include/functions_modules_meta.php');
+enterprise_include_once('meta/include/functions_events_meta.php');
+
+
+/**
+ * Translates a numeric value module_status into descriptive text.
+ *
+ * @param integer $status Module status.
+ *
+ * @return string Descriptive text.
+ */
+function events_translate_module_status($status)
+{
+    switch ($status) {
+        case AGENT_MODULE_STATUS_NORMAL:
+        return __('NORMAL');
+
+        case AGENT_MODULE_STATUS_CRITICAL_BAD:
+        return __('CRITICAL');
+
+        case AGENT_MODULE_STATUS_NO_DATA:
+        return __('NOT INIT');
+
+        case AGENT_MODULE_STATUS_CRITICAL_ALERT:
+        case AGENT_MODULE_STATUS_NORMAL_ALERT:
+        case AGENT_MODULE_STATUS_WARNING_ALERT:
+        return __('ALERT');
+
+        case AGENT_MODULE_STATUS_WARNING:
+        return __('WARNING');
+
+        default:
+        return __('UNKNOWN');
+    }
+}
+
+
+/**
+ * Translates a numeric value event_type into descriptive text.
+ *
+ * @param integer $event_type Event type.
+ *
+ * @return string Descriptive text.
+ */
+function events_translate_event_type($event_type)
+{
+    // Event type prepared.
+    switch ($event_type) {
+        case EVENTS_ALERT_FIRED:
+        case EVENTS_ALERT_RECOVERED:
+        case EVENTS_ALERT_CEASED:
+        case EVENTS_ALERT_MANUAL_VALIDATION:
+        return __('ALERT');
+
+        case EVENTS_RECON_HOST_DETECTED:
+        case EVENTS_SYSTEM:
+        case EVENTS_ERROR:
+        case EVENTS_NEW_AGENT:
+        case EVENTS_CONFIGURATION_CHANGE:
+        return __('SYSTEM');
+
+        case EVENTS_GOING_UP_WARNING:
+        case EVENTS_GOING_DOWN_WARNING:
+        return __('WARNING');
+
+        case EVENTS_GOING_DOWN_NORMAL:
+        case EVENTS_GOING_UP_NORMAL:
+        return __('NORMAL');
+
+        case EVENTS_GOING_DOWN_CRITICAL:
+        case EVENTS_GOING_UP_CRITICAL:
+        return __('CRITICAL');
+
+        case EVENTS_UNKNOWN:
+        case EVENTS_GOING_UNKNOWN:
+        default:
+        return __('UNKNOWN');
+    }
+}
+
+
+/**
+ * Translates a numeric value event_status into descriptive text.
+ *
+ * @param integer $status Event status.
+ *
+ * @return string Descriptive text.
+ */
+function events_translate_event_status($status)
+{
+    switch ($status) {
+        case EVENT_STATUS_NEW:
+        default:
+        return __('NEW');
+
+        case EVENT_STATUS_INPROCESS:
+        return __('IN PROCESS');
+
+        case EVENT_STATUS_VALIDATED:
+        return __('VALIDATED');
+    }
+}
+
+
+/**
+ * Translates a numeric value criticity into descriptive text.
+ *
+ * @param integer $criticity Event criticity.
+ *
+ * @return string Descriptive text.
+ */
+function events_translate_event_criticity($criticity)
+{
+    switch ($criticity) {
+        case EVENT_CRIT_CRITICAL:
+        return __('CRITICAL');
+
+        case EVENT_CRIT_MAINTENANCE:
+        return __('MAINTENANCE');
+
+        case EVENT_CRIT_INFORMATIONAL:
+        return __('INFORMATIONAL');
+
+        case EVENT_CRIT_MAJOR:
+        return __('MAJOR');
+
+        case EVENT_CRIT_MINOR:
+        return __('MINOR');
+
+        case EVENT_CRIT_NORMAL:
+        return __('NORMAL');
+
+        case EVENT_CRIT_WARNING:
+        return __('WARNING');
+
+        default:
+        return __('UNKNOWN');
+    }
+}
 
 
 /**
@@ -69,6 +210,1133 @@ function events_get_all_fields()
 }
 
 
+/**
+ * Same as events_get_column_names but retrieving only one result.
+ *
+ * @param string $field Raw field name.
+ *
+ * @return string Traduction.
+ */
+function events_get_column_name($field, $table_alias=false)
+{
+    switch ($field) {
+        case 'id_evento':
+        return __('Event Id');
+
+        case 'evento':
+        return __('Event Name');
+
+        case 'id_agente':
+        return __('Agent ID');
+
+        case 'agent_name':
+        return __('Agent name');
+
+        case 'agent_alias':
+        return __('Agent alias');
+
+        case 'id_usuario':
+        return __('User');
+
+        case 'id_grupo':
+        return __('Group');
+
+        case 'estado':
+        return __('Status');
+
+        case 'timestamp':
+        return __('Timestamp');
+
+        case 'event_type':
+        return __('Event Type');
+
+        case 'id_agentmodule':
+        return __('Module Name');
+
+        case 'id_alert_am':
+        return __('Alert');
+
+        case 'criticity':
+        return __('Severity');
+
+        case 'user_comment':
+        return __('Comment');
+
+        case 'tags':
+        return __('Tags');
+
+        case 'source':
+        return __('Source');
+
+        case 'id_extra':
+        return __('Extra Id');
+
+        case 'owner_user':
+        return __('Owner');
+
+        case 'ack_utimestamp':
+        return __('ACK Timestamp');
+
+        case 'instructions':
+        return __('Instructions');
+
+        case 'server_name':
+        return __('Server Name');
+
+        case 'data':
+        return __('Data');
+
+        case 'module_status':
+        return __('Module Status');
+
+        case 'options':
+        return __('Options');
+
+        case 'mini_severity':
+            if ($table_alias === true) {
+                return 'S';
+            } else {
+                return __('Severity mini');
+            }
+
+        default:
+        return __($field);
+    }
+}
+
+
+/**
+ * Return column names from fields selected.
+ *
+ * @param array $fields Array of fields.
+ *
+ * @return array Names array.
+ */
+function events_get_column_names($fields, $table_alias=false)
+{
+    if (!isset($fields) || !is_array($fields)) {
+        return [];
+    }
+
+    $names = [];
+    foreach ($fields as $f) {
+        if (is_array($f)) {
+            $name = [];
+            $name['text'] = events_get_column_name($f['text'], $table_alias);
+            $name['class'] = $f['class'];
+            $name['style'] = $f['style'];
+            $name['extra'] = $f['extra'];
+            $name['id'] = $f['id'];
+            $names[] = $name;
+        } else {
+            $names[] = events_get_column_name($f, $table_alias);
+        }
+    }
+
+    return $names;
+
+}
+
+
+/**
+ * Validates all events matching target filter.
+ *
+ * @param integer $id_evento Master event.
+ * @param array   $filter    Optional. Filter options.
+ * @param boolean $history   Apply on historical table.
+ *
+ * @return integer Events validated or false if error.
+ */
+function events_delete($id_evento, $filter=null, $history=false)
+{
+    if (!isset($id_evento) || $id_evento <= 0) {
+        return false;
+    }
+
+    if (!isset($filter) || !is_array($filter)) {
+        $filter = ['group_rep' => 0];
+    }
+
+    $table = events_get_events_table(is_metaconsole(), $history);
+
+    switch ($filter['group_rep']) {
+        case '0':
+        case '2':
+        default:
+            // No groups option direct update.
+            $delete_sql = sprintf(
+                'DELETE FROM %s
+                 WHERE id_evento = %d',
+                $table,
+                $id_evento
+            );
+        break;
+
+        case '1':
+            // Group by events.
+            $sql = events_get_all(
+                ['te.*'],
+                $filter,
+                // Offset.
+                null,
+                // Limit.
+                null,
+                // Order.
+                null,
+                // Sort_field.
+                null,
+                // Historical table.
+                $history,
+                // Return_sql.
+                true
+            );
+
+            $target_ids = db_get_all_rows_sql(
+                sprintf(
+                    'SELECT tu.id_evento FROM %s tu INNER JOIN ( %s ) tf
+                    ON tu.estado = tf.estado
+                    AND tu.evento = tf.evento
+                    AND tu.id_agente = tf.id_agente
+                    AND tu.id_agentmodule = tf.id_agentmodule
+                    AND tf.max_id_evento = %d',
+                    $table,
+                    $sql,
+                    $id_evento
+                )
+            );
+
+            // Try to avoid deadlock while updating full set.
+            if ($target_ids !== false && count($target_ids) > 0) {
+                $target_ids = array_reduce(
+                    $target_ids,
+                    function ($carry, $item) {
+                        $carry[] = $item['id_evento'];
+                        return $carry;
+                    }
+                );
+
+                $delete_sql = sprintf(
+                    'DELETE FROM %s WHERE id_evento IN (%s)',
+                    $table,
+                    join(', ', $target_ids)
+                );
+            }
+        break;
+    }
+
+    return db_process_sql($delete_sql);
+}
+
+
+/**
+ * Retrieves all events related to matching one.
+ *
+ * @param integer $id_evento Master event (max_id_evento).
+ * @param array   $filter    Filters.
+ * @param boolean $count     Count results or get results.
+ * @param boolean $history   Apply on historical table.
+ *
+ * @return array Events or false in case of error.
+ */
+function events_get_related_events(
+    $id_evento,
+    $filter=null,
+    $count=false,
+    $history=false
+) {
+    global $config;
+
+    if (!isset($id_evento) || $id_evento <= 0) {
+        return false;
+    }
+
+    if (!isset($filter) || !is_array($filter)) {
+        $filter = ['group_rep' => 0];
+    }
+
+    $table = events_get_events_table(is_metaconsole(), $history);
+    $select = '*';
+    if ($count === true) {
+        $select = 'count(*) as n';
+    };
+
+    switch ($filter['group_rep']) {
+        case '0':
+        case '2':
+        default:
+            // No groups option direct update.
+            $related_sql = sprintf(
+                'SELECT %s FROM %s
+                 WHERE id_evento = %d',
+                $select,
+                $table,
+                $id_evento
+            );
+        break;
+
+        case '1':
+            // Group by events.
+            $sql = events_get_all(
+                ['te.*'],
+                $filter,
+                // Offset.
+                null,
+                // Limit.
+                null,
+                // Order.
+                null,
+                // Sort_field.
+                null,
+                // Historical table.
+                $history,
+                // Return_sql.
+                true
+            );
+            $related_sql = sprintf(
+                'SELECT %s FROM %s tu INNER JOIN ( %s ) tf
+                WHERE tu.estado = tf.estado
+                AND tu.evento = tf.evento
+                AND tu.id_agente = tf.id_agente
+                AND tu.id_agentmodule = tf.id_agentmodule
+                AND tf.max_id_evento = %d',
+                $select,
+                $table,
+                $sql,
+                $id_evento
+            );
+        break;
+    }
+
+    if ($count === true) {
+        $r = db_get_all_rows_sql($related_sql);
+
+        return $r[0]['n'];
+    }
+
+    return db_get_all_rows_sql($related_sql);
+
+}
+
+
+/**
+ * Validates all events matching target filter.
+ *
+ * @param integer $id_evento Master event.
+ * @param integer $status    Target status.
+ * @param array   $filter    Optional. Filter options.
+ * @param boolean $history   Apply on historical table.
+ *
+ * @return integer Events validated or false if error.
+ */
+function events_update_status($id_evento, $status, $filter=null, $history=false)
+{
+    global $config;
+
+    if (!$status) {
+        error_log('No hay estado');
+        return false;
+    }
+
+    if (!isset($id_evento) || $id_evento <= 0) {
+        error_log('No hay id_evento');
+        return false;
+    }
+
+    if (!isset($filter) || !is_array($filter)) {
+        $filter = ['group_rep' => 0];
+    }
+
+    $table = events_get_events_table(is_metaconsole(), $history);
+
+    switch ($filter['group_rep']) {
+        case '0':
+        case '2':
+        default:
+            // No groups option direct update.
+            $update_sql = sprintf(
+                'UPDATE %s
+                 SET estado = %d
+                 WHERE id_evento = %d',
+                $table,
+                $status,
+                $id_evento
+            );
+        break;
+
+        case '1':
+            // Group by events.
+            $sql = events_get_all(
+                ['te.*'],
+                $filter,
+                // Offset.
+                null,
+                // Limit.
+                null,
+                // Order.
+                null,
+                // Sort_field.
+                null,
+                // Historical table.
+                $history,
+                // Return_sql.
+                true
+            );
+
+            $target_ids = db_get_all_rows_sql(
+                sprintf(
+                    'SELECT tu.id_evento FROM %s tu INNER JOIN ( %s ) tf
+                    ON tu.estado = tf.estado
+                    AND tu.evento = tf.evento
+                    AND tu.id_agente = tf.id_agente
+                    AND tu.id_agentmodule = tf.id_agentmodule
+                    AND tf.max_id_evento = %d',
+                    $table,
+                    $sql,
+                    $id_evento
+                )
+            );
+
+            // Try to avoid deadlock while updating full set.
+            if ($target_ids !== false && count($target_ids) > 0) {
+                $target_ids = array_reduce(
+                    $target_ids,
+                    function ($carry, $item) {
+                        $carry[] = $item['id_evento'];
+                        return $carry;
+                    }
+                );
+
+                $update_sql = sprintf(
+                    'UPDATE %s
+                    SET estado = %d,
+                        ack_utimestamp = %d,
+                        id_usuario = "%s"
+                    WHERE id_evento IN (%s)',
+                    $table,
+                    $status,
+                    time(),
+                    $config['id_user'],
+                    join(',', $target_ids)
+                );
+            }
+        break;
+    }
+
+    return db_process_sql($update_sql);
+}
+
+
+/**
+ * Retrieve all events filtered.
+ *
+ * @param array   $fields     Fields to retrieve.
+ * @param array   $filter     Filters to be applied.
+ * @param integer $offset     Offset (pagination).
+ * @param integer $limit      Limit (pagination).
+ * @param string  $order      Sort order.
+ * @param string  $sort_field Sort field.
+ * @param boolean $history    Apply on historical table.
+ * @param boolean $return_sql Return SQL (true) or execute it (false).
+ * @param string  $having     Having filter.
+ *
+ * @return array Events.
+ * @throws Exception On error.
+ */
+function events_get_all(
+    $fields,
+    array $filter,
+    $offset=null,
+    $limit=null,
+    $order=null,
+    $sort_field=null,
+    $history=false,
+    $return_sql=false,
+    $having=''
+) {
+    global $config;
+
+    $user_is_admin = users_is_admin();
+
+    if (!is_array($filter)) {
+        error_log('[events_get_all] Filter must be an array.');
+        throw new Exception('[events_get_all] Filter must be an array.');
+    }
+
+    $count = false;
+    if (!is_array($fields) && $fields == 'count') {
+        $fields = ['te.*'];
+        $count = true;
+    } else if (!is_array($fields)) {
+        error_log('[events_get_all] Fields must be an array or "count".');
+        throw new Exception('[events_get_all] Fields must be an array or "count".');
+    }
+
+    if (isset($filter['date_from'])
+        && !empty($filter['date_from'])
+        && $filter['date_from'] != '0000-00-00'
+    ) {
+        $date_from = $filter['date_from'];
+    }
+
+    if (isset($filter['time_from'])) {
+        $time_from = $filter['time_from'];
+    }
+
+    if (isset($date_from)) {
+        if (!isset($time_from)) {
+            $time_from = '00:00:00';
+        }
+
+        $from = $date_from.' '.$time_from;
+        $sql_filters[] = sprintf(
+            ' AND te.utimestamp >= %d',
+            strtotime($from)
+        );
+    }
+
+    if (isset($filter['date_to'])
+        && !empty($filter['date_to'])
+        && $filter['date_to'] != '0000-00-00'
+    ) {
+        $date_to = $filter['date_to'];
+    }
+
+    if (isset($filter['time_to'])) {
+        $time_to = $filter['time_to'];
+    }
+
+    if (isset($date_to)) {
+        if (!isset($time_to)) {
+            $time_to = '23:59:59';
+        }
+
+        $to = $date_to.' '.$time_to;
+        $sql_filters[] = sprintf(
+            ' AND te.utimestamp <= %d',
+            strtotime($to)
+        );
+    }
+
+    if (!isset($from)) {
+        if (isset($filter['event_view_hr']) && ($filter['event_view_hr'] > 0)) {
+            $sql_filters[] = sprintf(
+                ' AND utimestamp > UNIX_TIMESTAMP(now() - INTERVAL %d HOUR) ',
+                $filter['event_view_hr']
+            );
+        }
+    }
+
+    if (isset($filter['id_agent']) && $filter['id_agent'] > 0) {
+        $sql_filters[] = sprintf(
+            ' AND te.id_agente = %d ',
+            $filter['id_agent']
+        );
+    }
+
+    if (!empty($filter['event_type']) && $filter['event_type'] != 'all') {
+        if ($filter['event_type'] == 'warning'
+            || $filter['event_type'] == 'critical'
+            || $filter['event_type'] == 'normal'
+        ) {
+            $sql_filters[] = ' AND event_type LIKE "%'.$filter['event_type'].'%"';
+        } else if ($filter['event_type'] == 'not_normal') {
+            $sql_filters[] = ' AND (event_type LIKE "%warning%"
+              OR event_type LIKE "%critical%"
+              OR event_type LIKE "%unknown%")';
+        } else {
+            $sql_filters[] = ' AND event_type = "'.$filter['event_type'].'"';
+        }
+    }
+
+    if (isset($filter['severity']) && $filter['severity'] > 0) {
+        switch ($filter['severity']) {
+            case EVENT_CRIT_MAINTENANCE:
+            case EVENT_CRIT_INFORMATIONAL:
+            case EVENT_CRIT_NORMAL:
+            case EVENT_CRIT_MINOR:
+            case EVENT_CRIT_WARNING:
+            case EVENT_CRIT_MAJOR:
+            case EVENT_CRIT_CRITICAL:
+            default:
+                $sql_filters[] = sprintf(
+                    ' AND criticity = %d ',
+                    $filter['severity']
+                );
+            break;
+
+            case EVENT_CRIT_WARNING_OR_CRITICAL:
+                $sql_filters[] = sprintf(
+                    ' AND (criticity = %d OR criticity = %d)',
+                    EVENT_CRIT_WARNING,
+                    EVENT_CRIT_CRITICAL
+                );
+            break;
+
+            case EVENT_CRIT_NOT_NORMAL:
+                $sql_filters[] = sprintf(
+                    ' AND criticity != %d',
+                    EVENT_CRIT_NORMAL
+                );
+            break;
+
+            case EVENT_CRIT_OR_NORMAL:
+                $sql_filters[] = sprintf(
+                    ' AND (criticity = %d OR criticity = %d)',
+                    EVENT_CRIT_NORMAL,
+                    EVENT_CRIT_CRITICAL
+                );
+            break;
+        }
+    }
+
+    $groups = $filter['id_group_filter'];
+    if (isset($groups) && $groups > 0) {
+        $propagate = db_get_value(
+            'propagate',
+            'tgrupo',
+            'id_grupo',
+            $groups
+        );
+
+        if (!$propagate) {
+            $sql_filters[] = sprintf(
+                ' AND (te.id_grupo = %d OR tasg.id_group = %d)',
+                $groups
+            );
+        } else {
+            $children = groups_get_children($groups);
+            $_groups = [ $groups ];
+            if (!empty($children)) {
+                foreach ($children as $child) {
+                    $_groups[] = (int) $child['id_grupo'];
+                }
+            }
+
+            $groups = $_groups;
+
+            $sql_filters[] = sprintf(
+                ' AND (te.id_grupo IN (%s) OR tasg.id_group IN (%s))',
+                join(',', $groups),
+                join(',', $groups)
+            );
+        }
+    }
+
+    // Skip system messages if user is not PM.
+    if (!check_acl($config['id_user'], 0, 'PM')) {
+        $sql_filters[] = ' AND te.id_grupo != 0 ';
+    }
+
+    if (isset($filter['status'])) {
+        switch ($filter['status']) {
+            case EVENT_ALL:
+            default:
+                // Do not filter.
+            break;
+
+            case EVENT_NEW:
+            case EVENT_VALIDATE:
+            case EVENT_PROCESS:
+                $sql_filters[] = sprintf(
+                    ' AND estado = %d',
+                    $filter['status']
+                );
+            break;
+
+            case EVENT_NO_VALIDATED:
+                $sql_filters[] = sprintf(
+                    ' AND (estado = %d OR estado = %d)',
+                    EVENT_NEW,
+                    EVENT_PROCESS
+                );
+            break;
+        }
+    }
+
+    if (!$user_is_admin) {
+        $ER_groups = users_get_groups($config['id_user'], 'ER', false);
+        $EM_groups = users_get_groups($config['id_user'], 'EM', false, true);
+        $EW_groups = users_get_groups($config['id_user'], 'EW', false, true);
+    }
+
+    if (!$user_is_admin && !users_can_manage_group_all('ER')) {
+        // Get groups where user have ER grants.
+        $sql_filters[] = sprintf(
+            ' AND (te.id_grupo IN ( %s ) OR tasg.id_group IN (%s))',
+            join(', ', array_keys($ER_groups)),
+            join(', ', array_keys($ER_groups))
+        );
+    }
+
+    $table = events_get_events_table(is_metaconsole(), $history);
+    $tevento = sprintf(
+        ' %s te',
+        $table
+    );
+
+    // Prepare agent join sql filters.
+    $agent_join_filters = [];
+    $tagente_table = 'tagente';
+    $tagente_field = 'id_agente';
+    $conditionMetaconsole = '';
+    if (is_metaconsole()) {
+        $tagente_table = 'tmetaconsole_agent';
+        $tagente_field = 'id_tagente';
+        $conditionMetaconsole = ' AND ta.id_tmetaconsole_setup = te.server_id ';
+    }
+
+    // Agent alias.
+    if (!empty($filter['agent_alias'])) {
+        $agent_join_filters[] = sprintf(
+            ' AND ta.alias = "%s" ',
+            $filter['agent_alias']
+        );
+    }
+
+    // Free search.
+    if (!empty($filter['search'])) {
+        if (isset($config['dbconnection']->server_version)
+            && $config['dbconnection']->server_version > 50600
+        ) {
+            // Use "from_base64" requires mysql 5.6 or greater.
+            $custom_data_search = 'from_base64(te.custom_data)';
+        } else {
+            // Custom data is JSON encoded base64, if 5.6 or lower,
+            // user is condemned to use plain search.
+            $custom_data_search = 'te.custom_data';
+        }
+
+        $sql_filters[] = vsprintf(
+            ' AND (lower(ta.alias) like lower("%%%s%%")
+                OR te.id_evento like "%%%s%%"
+                OR lower(te.evento) like lower("%%%s%%")
+                OR lower(te.user_comment) like lower("%%%s%%")
+                OR lower(te.id_extra) like lower("%%%s%%")
+                OR lower(te.source) like lower("%%%s%%") 
+                OR lower('.$custom_data_search.') like lower("%%%s%%") )',
+            array_fill(0, 7, $filter['search'])
+        );
+    }
+
+    // Id extra.
+    if (!empty($filter['id_extra'])) {
+        $sql_filters[] = sprintf(
+            ' AND lower(te.id_extra) like lower("%%%s%%") ',
+            $filter['id_extra']
+        );
+    }
+
+    // User comment.
+    if (!empty($filter['user_comment'])) {
+        $sql_filters[] = sprintf(
+            ' AND lower(te.user_comment) like lower("%%%s%%") ',
+            $filter['user_comment']
+        );
+    }
+
+    // Source.
+    if (!empty($filter['source'])) {
+        $sql_filters[] = sprintf(
+            ' AND lower(te.source) like lower("%%%s%%") ',
+            $filter['source']
+        );
+    }
+
+    // Validated or in process by.
+    if (!empty($filter['id_user_ack'])) {
+        $sql_filters[] = sprintf(
+            ' AND te.id_usuario like lower("%%%s%%") ',
+            $filter['id_user_ack']
+        );
+    }
+
+    $tag_names = [];
+    // With following tags.
+    if (!empty($filter['tag_with'])) {
+        $tag_with = base64_decode($filter['tag_with']);
+        $tags = json_decode($tag_with, true);
+        if (is_array($tags) && !in_array('0', $tags)) {
+            if (!$user_is_admin) {
+                $user_tags = array_flip(tags_get_tags_for_module_search());
+                if ($user_tags != null) {
+                    foreach ($tags as $id_tag) {
+                        // User cannot filter with those tags.
+                        if (!array_search($id_tag, $user_tags)) {
+                            return false;
+                        }
+                    }
+                }
+            }
+
+            foreach ($tags as $id_tag) {
+                if (!isset($tags_names[$id_tag])) {
+                    $tags_names[$id_tag] = tags_get_name($id_tag);
+                }
+
+                $_tmp .= ' AND ( ';
+                $_tmp .= sprintf(
+                    ' tags LIKE "%s" OR',
+                    $tags_names[$id_tag]
+                );
+
+                $_tmp .= sprintf(
+                    ' tags LIKE "%s,%%" OR',
+                    $tags_names[$id_tag]
+                );
+
+                $_tmp .= sprintf(
+                    ' tags LIKE "%%,%s" OR',
+                    $tags_names[$id_tag]
+                );
+
+                $_tmp .= sprintf(
+                    ' tags LIKE "%%,%s,%%" ',
+                    $tags_names[$id_tag]
+                );
+
+                $_tmp .= ') ';
+            }
+
+            $sql_filters[] = $_tmp;
+        }
+    }
+
+    // Without following tags.
+    if (!empty($filter['tag_without'])) {
+        $tag_without = base64_decode($filter['tag_without']);
+        $tags = json_decode($tag_without, true);
+        if (is_array($tags) && !in_array('0', $tags)) {
+            foreach ($tags as $id_tag) {
+                if (!isset($tags_names[$id_tag])) {
+                    $tags_names[$id_tag] = tags_get_name($id_tag);
+                }
+
+                $_tmp .= sprintf(
+                    ' AND tags NOT LIKE "%s" ',
+                    $tags_names[$id_tag]
+                );
+                $_tmp .= sprintf(
+                    ' AND tags NOT LIKE "%s,%%" ',
+                    $tags_names[$id_tag]
+                );
+                $_tmp .= sprintf(
+                    ' AND tags NOT LIKE "%%,%s" ',
+                    $tags_names[$id_tag]
+                );
+                $_tmp .= sprintf(
+                    ' AND tags NOT LIKE "%%,%s,%%" ',
+                    $tags_names[$id_tag]
+                );
+            }
+
+            $sql_filters[] = $_tmp;
+        }
+    }
+
+    // Filter/ Only alerts.
+    if (isset($filter['filter_only_alert'])) {
+        if ($filter['filter_only_alert'] == 0) {
+            $sql_filters[] = ' AND event_type NOT LIKE "%alert%"';
+        } else if ($filter['filter_only_alert'] == 1) {
+            $sql_filters[] = ' AND event_type LIKE "%alert%"';
+        }
+    }
+
+    // TAgs ACLS.
+    if (check_acl($config['id_user'], 0, 'ER')) {
+        $tags_acls_condition = tags_get_acl_tags(
+            // Id_user.
+            $config['id_user'],
+            // Id_group.
+            $ER_groups,
+            // Access.
+            'ER',
+            // Return_mode.
+            'event_condition',
+            // Query_prefix.
+            'AND',
+            // Query_table.
+            '',
+            // Meta.
+            is_metaconsole(),
+            // Childrens_ids.
+            [],
+            // Force_group_and_tag.
+            true,
+            // Table tag for id_grupo.
+            'te.',
+            // Alt table tag for id_grupo.
+            'tasg.'
+        );
+        // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
+    } else if (check_acl($config['id_user'], 0, 'EW')) {
+        $tags_acls_condition = tags_get_acl_tags(
+            // Id_user.
+            $config['id_user'],
+            // Id_group.
+            $EW_groups,
+            // Access.
+            'EW',
+            // Return_mode.
+            'event_condition',
+            // Query_prefix.
+            'AND',
+            // Query_table.
+            '',
+            // Meta.
+            is_metaconsole(),
+            // Childrens_ids.
+            [],
+            // Force_group_and_tag.
+            true,
+            // Table tag for id_grupo.
+            'te.',
+            // Alt table tag for id_grupo.
+            'tasg.'
+        );
+        // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
+    } else if (check_acl($config['id_user'], 0, 'EM')) {
+        $tags_acls_condition = tags_get_acl_tags(
+            // Id_user.
+            $config['id_user'],
+            // Id_group.
+            $EM_groups,
+            // Access.
+            'EM',
+            // Return_mode.
+            'event_condition',
+            // Query_prefix.
+            'AND',
+            // Query_table.
+            '',
+            // Meta.
+            is_metaconsole(),
+            // Childrens_ids.
+            [],
+            // Force_group_and_tag.
+            true,
+            // Table tag for id_grupo.
+            'te.',
+            // Alt table tag for id_grupo.
+            'tasg.'
+        );
+        // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
+    }
+
+    if (($tags_acls_condition != ERR_WRONG_PARAMETERS)
+        && ($tags_acls_condition != ERR_ACL)
+    ) {
+        $sql_filters[] = $tags_acls_condition;
+    }
+
+    // Module search.
+    $agentmodule_join = 'LEFT JOIN tagente_modulo am ON te.id_agentmodule = am.id_agente_modulo';
+    if (is_metaconsole()) {
+        $agentmodule_join = '';
+    } else if (!empty($filter['module_search'])) {
+        $agentmodule_join = 'INNER JOIN tagente_modulo am ON te.id_agentmodule = am.id_agente_modulo';
+        $sql_filters[] = sprintf(
+            ' AND am.nombre = "%s" ',
+            $filter['module_search']
+        );
+    }
+
+    // Order.
+    $order_by = '';
+    if (isset($order, $sort_field)) {
+        $order_by = events_get_sql_order($sort_field, $order);
+    }
+
+    // Pagination.
+    $pagination = '';
+    if (isset($limit, $offset) && $limit > 0) {
+        $pagination = sprintf(' LIMIT %d OFFSET %d', $limit, $offset);
+    }
+
+    $extra = '';
+    if (is_metaconsole()) {
+        $extra = ', server_id';
+    }
+
+    // Group by.
+    $group_by = 'GROUP BY ';
+    $tagente_join = 'LEFT';
+    switch ($filter['group_rep']) {
+        case '0':
+        default:
+            // All events.
+            $group_by = '';
+        break;
+
+        case '1':
+            // Group by events.
+            $group_by .= 'te.estado, te.evento, te.id_agente, te.id_agentmodule';
+            $group_by .= $extra;
+        break;
+
+        case '2':
+            // Group by agents.
+            $tagente_join = 'INNER';
+            // $group_by .= 'te.id_agente, te.event_type';
+            // $group_by .= $extra;
+            $group_by = '';
+            $order_by = events_get_sql_order('id_agente', 'asc');
+            if (isset($order, $sort_field)) {
+                $order_by .= ','.events_get_sql_order(
+                    $sort_field,
+                    $order,
+                    0,
+                    true
+                );
+            }
+        break;
+    }
+
+    $tgrupo_join = 'LEFT';
+    $tgrupo_join_filters = [];
+    if (isset($groups)
+        && (is_array($groups)
+        || $groups > 0)
+    ) {
+        $tgrupo_join = 'INNER';
+        if (is_array($groups)) {
+            $tgrupo_join_filters[] = sprintf(
+                ' AND (tg.id_grupo IN (%s) OR tasg.id_group IN (%s))',
+                join(', ', $groups),
+                join(', ', $groups)
+            );
+        } else {
+            $tgrupo_join_filters[] = sprintf(
+                ' AND (tg.id_grupo = %s OR tasg.id_group = %s)',
+                $groups,
+                $groups
+            );
+        }
+    }
+
+    $server_join = '';
+    if (is_metaconsole()) {
+        $server_join = ' LEFT JOIN tmetaconsole_setup ts
+            ON ts.id = te.server_id';
+        if (!empty($filter['server_id'])) {
+            $server_join = sprintf(
+                ' INNER JOIN tmetaconsole_setup ts
+                  ON ts.id = te.server_id AND ts.id= %d',
+                $filter['server_id']
+            );
+        }
+    }
+
+    // Secondary groups.
+    db_process_sql('SET group_concat_max_len = 9999999');
+    $event_lj = events_get_secondary_groups_left_join($table);
+
+    $group_selects = '';
+    if ($group_by != '') {
+        $group_selects = ',COUNT(id_evento) AS event_rep
+        ,GROUP_CONCAT(DISTINCT user_comment SEPARATOR "<br>") AS comments,
+        MAX(utimestamp) as timestamp_last,
+        MIN(utimestamp) as timestamp_first,
+        MAX(id_evento) as max_id_evento';
+
+        if ($count === false) {
+            $idx = array_search('te.user_comment', $fields);
+            if ($idx !== false) {
+                unset($fields[$idx]);
+            }
+        }
+    }
+
+    $sql = sprintf(
+        'SELECT %s
+            %s
+         FROM %s
+         %s
+         %s
+         %s JOIN %s ta
+           ON ta.%s = te.id_agente
+           %s
+           %s
+         %s JOIN tgrupo tg
+           ON te.id_grupo = tg.id_grupo
+           %s
+         %s
+         WHERE 1=1
+         %s
+         %s
+         %s
+         %s
+         %s
+         ',
+        join(',', $fields),
+        $group_selects,
+        $tevento,
+        $event_lj,
+        $agentmodule_join,
+        $tagente_join,
+        $tagente_table,
+        $tagente_field,
+        $conditionMetaconsole,
+        join(' ', $agent_join_filters),
+        $tgrupo_join,
+        join(' ', $tgrupo_join_filters),
+        $server_join,
+        join(' ', $sql_filters),
+        $group_by,
+        $order_by,
+        $pagination,
+        $having
+    );
+
+    if (!$user_is_admin) {
+        // XXX: Confirm there's no extra grants unhandled!.
+        $can_manage = '0 as user_can_manage';
+        if (!empty($EM_groups)) {
+            $can_manage = sprintf(
+                '(tbase.id_grupo IN (%s)) as user_can_manage',
+                join(', ', array_keys($EM_groups))
+            );
+        }
+
+        $can_write = '0 as user_can_write';
+        if (!empty($EW_groups)) {
+            $can_write = sprintf(
+                '(tbase.id_grupo IN (%s)) as user_can_write',
+                join(', ', array_keys($EW_groups))
+            );
+        }
+
+        $sql = sprintf(
+            'SELECT
+                tbase.*,
+                %s,
+                %s
+            FROM
+                (',
+            $can_manage,
+            $can_write
+        ).$sql.') tbase';
+    } else {
+        $sql = 'SELECT
+                tbase.*,
+                1 as user_can_manage,
+                1 as user_can_write
+            FROM
+                ('.$sql.') tbase';
+    }
+
+    if ($count) {
+        $sql = 'SELECT count(*) as nitems FROM ('.$sql.') tt';
+    }
+
+    if ($return_sql) {
+        return $sql;
+    }
+
+    return db_get_all_rows_sql($sql);
+}
+
+
 /**
  * Get all rows of events from the database, that
  * pass the filter, and can get only some fields.
@@ -192,7 +1460,7 @@ function events_get_events_no_grouped(
 /**
  * Return all events matching sql_post grouped.
  *
- * @param [type]  $sql_post   Sql_post.
+ * @param string  $sql_post   Sql_post.
  * @param integer $offset     Offset.
  * @param integer $pagination Pagination.
  * @param boolean $meta       Meta.
@@ -213,7 +1481,7 @@ function events_get_events_grouped(
     $total=false,
     $history_db=false,
     $order='down',
-    $sort_field='timestamp'
+    $sort_field='utimestamp'
 ) {
     global $config;
 
@@ -431,7 +1699,7 @@ function events_change_status(
         $ack_user = $config['id_user'];
     } else {
         $acl_utimestamp = 0;
-        $ack_user = '';
+        $ack_user = $config['id_user'];
     }
 
     switch ($new_status) {
@@ -1034,7 +2302,7 @@ function events_print_event_table(
         }
 
         $table->head[$i] = __('Timestamp');
-        $table->headstyle[$i] = 'width: 120px;';
+        $table->headstyle[$i] = 'width: 150px;';
         $table->style[$i++] = 'word-break: break-word;';
 
         $table->head[$i] = __('Status');
@@ -1130,10 +2398,10 @@ function events_print_event_table(
         }
 
         $events_table = html_print_table($table, true);
-        $out = '<table width="100%"><tr><td style="width: 90%; vertical-align: top; padding-top: 0px;">';
-        $out .= $events_table;
+        $out = $events_table;
 
         if (!$tactical_view) {
+            $out .= '<table width="100%"><tr><td style="width: 90%; vertical-align: top; padding-top: 0px;">';
             if ($agent_id != 0) {
                 $out .= '</td><td style="width: 200px; vertical-align: top;">';
                 $out .= '<table cellpadding=0 cellspacing=0 class="databox"><tr><td>';
@@ -1149,9 +2417,9 @@ function events_print_event_table(
 						<legend>'.__('Event graph by agent').'</legend>'.grafico_eventos_grupo(180, 60).'</fieldset>';
                 $out .= '</td></tr></table>';
             }
-        }
 
-        $out .= '</td></tr></table>';
+            $out .= '</td></tr></table>';
+        }
 
         unset($table);
 
@@ -1901,7 +3169,7 @@ function events_get_event_filter_select($manage=true)
     } else {
         $user_groups = users_get_groups(
             $config['id_user'],
-            'EW',
+            'ER',
             users_can_manage_group_all(),
             true
         );
@@ -1914,7 +3182,7 @@ function events_get_event_filter_select($manage=true)
     $sql = '
 		SELECT id_filter, id_name
 		FROM tevent_filter
-		WHERE id_group_filter IN ('.implode(',', array_keys($user_groups)).')';
+		WHERE id_group_filter IN (0, '.implode(',', array_keys($user_groups)).')';
 
     $event_filters = db_get_all_rows_sql($sql);
 
@@ -1946,6 +3214,7 @@ function events_page_responses($event, $childrens_ids=[])
     //
     // Responses.
     //
+    $table_responses = new StdClass();
     $table_responses->cellspacing = 2;
     $table_responses->cellpadding = 2;
     $table_responses->id = 'responses_table';
@@ -2618,7 +3887,7 @@ function events_page_details($event, $server='')
     global $config;
 
     // If server is provided, get the hash parameters.
-    if (!empty($server) && defined('METACONSOLE')) {
+    if (!empty($server) && is_metaconsole()) {
         $hashdata = metaconsole_get_server_hashdata($server);
         $hashstring = '&amp;loginhash=auto&loginhash_data='.$hashdata.'&loginhash_user='.str_rot13($config['id_user']);
         $serverstring = $server['server_url'].'/';
@@ -2895,7 +4164,7 @@ function events_page_details($event, $server='')
 
     $data = [];
     $data[0] = __('Instructions');
-    $data[1] = events_display_instructions($event['event_type'], $event, true);
+    $data[1] = html_entity_decode(events_display_instructions($event['event_type'], $event, true));
     $table_details->data[] = $data;
 
     $data = [];
@@ -2920,10 +4189,6 @@ function events_page_details($event, $server='')
 
     $details = '<div id="extended_event_details_page" class="extended_event_pages">'.html_print_table($table_details, true).'</div>';
 
-    if (!empty($server) && defined('METACONSOLE')) {
-        metaconsole_restore_db();
-    }
-
     return $details;
 }
 
@@ -3141,6 +4406,8 @@ function events_page_general($event)
         $data[1] = $user_owner;
     }
 
+    $table_general->cellclass[3][1] = 'general_owner';
+
     $table_general->data[] = $data;
 
     $data = [];
@@ -3208,6 +4475,8 @@ function events_page_general($event)
         $data[1] = '<i>'.__('N/A').'</i>';
     }
 
+    $table_general->cellclass[7][1] = 'general_status';
+
     $table_general->data[] = $data;
 
     $data = [];
@@ -3255,10 +4524,14 @@ function events_page_general($event)
     $table_general->data[] = $data;
 
     $table_data = $table_general->data;
-    $table_data_total = count($table_data);
+    if (is_array($table_data)) {
+        $table_data_total = count($table_data);
+    } else {
+        $table_data_total = -1;
+    }
 
     for ($i = 0; $i <= $table_data_total; $i++) {
-        if (count($table_data[$i]) == 2) {
+        if (is_array($table_data[$i]) && count($table_data[$i]) == 2) {
             $table_general->colspan[$i][1] = 2;
             $table_general->style[2] = 'text-align:center; width:10%;';
         }
@@ -3273,109 +4546,126 @@ function events_page_general($event)
 /**
  * Generate 'comments' page for event viewer.
  *
- * @param array $event         Event.
- * @param array $childrens_ids Children ids.
+ * @param array $event Event.
  *
  * @return string HTML.
  */
-function events_page_comments($event, $childrens_ids=[])
+function events_page_comments($event, $ajax=false)
 {
     // Comments.
     global $config;
 
+    $comments = '';
+
+    $comments = $event['user_comment'];
+    if (isset($event['comments'])) {
+        $comments = explode('<br>', $event['comments']);
+    }
+
     $table_comments = new stdClass;
     $table_comments->width = '100%';
     $table_comments->data = [];
     $table_comments->head = [];
     $table_comments->class = 'table_modal_alternate';
 
-    $event_comments = $event['user_comment'];
-    $event_comments = str_replace(["\n", '&#x0a;'], '<br>', $event_comments);
+    $comments = str_replace(["\n", '&#x0a;'], '<br>', $comments);
 
-    // If comments are not stored in json, the format is old.
-    $event_comments_array = json_decode($event_comments, true);
+    if (is_array($comments)) {
+        foreach ($comments as $comm) {
+            if (empty($comm)) {
+                continue;
+            }
 
-    // Show the comments more recent first.
-    if (is_array($event_comments_array)) {
-        $event_comments_array = array_reverse($event_comments_array);
-    }
-
-    if (empty($event_comments_array)) {
-        $comments_format = 'old';
+            $comments_array[] = json_decode(io_safe_output($comm), true);
+        }
     } else {
-        $comments_format = 'new';
+        // If comments are not stored in json, the format is old.
+        $comments_array = json_decode(io_safe_output($comments), true);
     }
 
-    switch ($comments_format) {
-        case 'new':
-            if (empty($event_comments_array)) {
-                $table_comments->style[0] = 'text-align:center;';
-                $table_comments->colspan[0][0] = 2;
-                $data = [];
-                $data[0] = __('There are no comments');
-                $table_comments->data[] = $data;
-            }
+    foreach ($comments_array as $comm) {
+        // Show the comments more recent first.
+        if (is_array($comm)) {
+            $comm = array_reverse($comm);
+        }
 
-            if (isset($event_comments_array) === true
-                && is_array($event_comments_array) === true
-            ) {
-                foreach ($event_comments_array as $c) {
-                    $data[0] = '<b>'.$c['action'].' by '.$c['id_user'].'</b>';
-                    $data[0] .= '<br><br><i>'.date($config['date_format'], $c['utimestamp']).'</i>';
-                    $data[1] = $c['comment'];
-                    $table_comments->data[] = $data;
-                }
-            }
-        break;
+        if (empty($comm)) {
+            $comments_format = 'old';
+        } else {
+            $comments_format = 'new';
+        }
 
-        case 'old':
-            $comments_array = explode('<br>', $event_comments);
-
-            // Split comments and put in table.
-            $col = 0;
-            $data = [];
-
-            foreach ($comments_array as $c) {
-                switch ($col) {
-                    case 0:
-                        $row_text = preg_replace('/\s*--\s*/', '', $c);
-                        $row_text = preg_replace('/\<\/b\>/', '</i>', $row_text);
-                        $row_text = preg_replace('/\[/', '</b><br><br><i>[', $row_text);
-                        $row_text = preg_replace('/[\[|\]]/', '', $row_text);
-                    break;
-
-                    case 1:
-                        $row_text = preg_replace("/[\r\n|\r|\n]/", '<br>', io_safe_output(strip_tags($c)));
-                    break;
-
-                    default:
-                        // Ignore.
-                    break;
-                }
-
-                $data[$col] = $row_text;
-
-                $col++;
-
-                if ($col == 2) {
-                    $col = 0;
-                    $table_comments->data[] = $data;
+        switch ($comments_format) {
+            case 'new':
+                if (empty($comm)) {
+                    $table_comments->style[0] = 'text-align:center;';
+                    $table_comments->colspan[0][0] = 2;
                     $data = [];
+                    $data[0] = __('There are no comments');
+                    $table_comments->data[] = $data;
                 }
-            }
 
-            if (count($comments_array) == 1 && $comments_array[0] == '') {
-                $table_comments->style[0] = 'text-align:center;';
-                $table_comments->colspan[0][0] = 2;
+                if (isset($comm) === true
+                    && is_array($comm) === true
+                ) {
+                    foreach ($comm as $c) {
+                        $data[0] = '<b>'.$c['action'].' by '.$c['id_user'].'</b>';
+                        $data[0] .= '<br><br><i>'.date($config['date_format'], $c['utimestamp']).'</i>';
+                        $data[1] = $c['comment'];
+                        $table_comments->data[] = $data;
+                    }
+                }
+            break;
+
+            case 'old':
+                $comm = explode('<br>', $comments);
+
+                // Split comments and put in table.
+                $col = 0;
                 $data = [];
-                $data[0] = __('There are no comments');
-                $table_comments->data[] = $data;
-            }
-        break;
 
-        default:
-            // Ignore.
-        break;
+                foreach ($comm as $c) {
+                    switch ($col) {
+                        case 0:
+                            $row_text = preg_replace('/\s*--\s*/', '', $c);
+                            $row_text = preg_replace('/\<\/b\>/', '</i>', $row_text);
+                            $row_text = preg_replace('/\[/', '</b><br><br><i>[', $row_text);
+                            $row_text = preg_replace('/[\[|\]]/', '', $row_text);
+                        break;
+
+                        case 1:
+                            $row_text = preg_replace("/[\r\n|\r|\n]/", '<br>', io_safe_output(strip_tags($c)));
+                        break;
+
+                        default:
+                            // Ignore.
+                        break;
+                    }
+
+                    $data[$col] = $row_text;
+
+                    $col++;
+
+                    if ($col == 2) {
+                        $col = 0;
+                        $table_comments->data[] = $data;
+                        $data = [];
+                    }
+                }
+
+                if (count($comm) == 1 && $comm[0] == '') {
+                    $table_comments->style[0] = 'text-align:center;';
+                    $table_comments->colspan[0][0] = 2;
+                    $data = [];
+                    $data[0] = __('There are no comments');
+                    $table_comments->data[] = $data;
+                }
+            break;
+
+            default:
+                // Ignore.
+            break;
+        }
     }
 
     if (((tags_checks_event_acl(
@@ -3392,18 +4682,37 @@ function events_page_comments($event, $childrens_ids=[])
         $childrens_ids
     ))) && $config['show_events_in_local'] == false || $config['event_replication'] == false
     ) {
-        $comments_form = '<br><div id="comments_form" style="width:98%;">'.html_print_textarea('comment', 3, 10, '', 'style="min-height: 15px; padding:0; width: 100%; disabled"', true);
+        $comments_form = '<br><div id="comments_form" style="width:98%;">';
+        $comments_form .= html_print_textarea(
+            'comment',
+            3,
+            10,
+            '',
+            'style="min-height: 15px; padding:0; width: 100%; disabled"',
+            true
+        );
 
-        $comments_form .= '<br><div style="text-align:right; margin-top:10px;">'.html_print_button(__('Add comment'), 'comment_button', false, 'event_comment();', 'class="sub next"', true).'</div><br></div>';
+        $comments_form .= '<br><div style="text-align:right; margin-top:10px;">';
+        $comments_form .= html_print_button(
+            __('Add comment'),
+            'comment_button',
+            false,
+            'event_comment();',
+            'class="sub next"',
+            true
+        );
+        $comments_form .= '</div><br></div>';
     } else {
         $comments_form = ui_print_message(
             __('If event replication is ongoing, it won\'t be possible to enter comments here. This option is only to allow local pandora users to see comments, but not to operate with them. The operation, when event replication is enabled, must be done only in the Metaconsole.')
         );
     }
 
-    $comments = '<div id="extended_event_comments_page" class="extended_event_pages">'.$comments_form.html_print_table($table_comments, true).'</div>';
+    if ($ajax) {
+        return $comments_form.html_print_table($table_comments, true);
+    }
 
-    return $comments;
+    return '<div id="extended_event_comments_page" class="extended_event_pages">'.$comments_form.html_print_table($table_comments, true).'</div>';
 }
 
 
@@ -3551,10 +4860,6 @@ function events_get_count_events_by_agent(
 
     $tagente = 'tagente';
     $tevento = 'tevento';
-    if ($dbmeta) {
-        $tagente = 'tmetaconsole_agent';
-        $tevento = 'tmetaconsole_event';
-    }
 
     $sql = sprintf(
         'SELECT id_agente,
@@ -3564,7 +4869,7 @@ function events_get_count_events_by_agent(
 		COUNT(*) AS count
 		FROM %s t3
 		WHERE utimestamp > %d AND utimestamp <= %d
-			AND id_grupo IN (%s) %s 
+			AND id_grupo IN (%s) 
 		GROUP BY id_agente',
         $tagente,
         $tevento,
@@ -3731,9 +5036,6 @@ function events_get_count_events_validated_by_user(
     }
 
     $tevento = 'tevento';
-    if ($dbmeta) {
-        $tevento = 'tmetaconsole_event';
-    }
 
     $sql = sprintf(
         'SELECT id_usuario,
@@ -3909,9 +5211,6 @@ function events_get_count_events_by_criticity(
     }
 
     $tevento = 'tevento';
-    if ($dbmeta) {
-        $tevento = 'tmetaconsole_event';
-    }
 
     $sql = sprintf(
         'SELECT criticity,
@@ -4117,9 +5416,6 @@ function events_get_count_events_validated(
     }
 
     $tevento = 'tevento';
-    if ($dbmeta) {
-        $tevento = 'tmetaconsole_event';
-    }
 
     $sql = sprintf('SELECT estado, COUNT(*) AS count FROM %s WHERE %s %s GROUP BY estado', $tevento, $sql_filter, $sql_where);
 
@@ -4551,7 +5847,7 @@ function events_list_events_grouped_agents($sql)
     $sql = sprintf(
         'SELECT * FROM %s 
 	    LEFT JOIN tagent_secondary_group 
-	       ON tagent_secondary_group.id_agent = tevento.id_agente
+	       ON tagent_secondary_group.id_agent = id_agente
         WHERE %s',
         $table,
         $sql
@@ -5248,13 +6544,14 @@ function events_list_events_grouped_agents($sql)
 /**
  * Retrieves SQL for custom order.
  *
- * @param string  $sort_field Field.
- * @param string  $sort       Order.
- * @param integer $group_rep  Group field.
+ * @param string  $sort_field  Field.
+ * @param string  $sort        Order.
+ * @param integer $group_rep   Group field.
+ * @param boolean $only-fields Return only fields.
  *
  * @return string SQL.
  */
-function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep=0)
+function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep=0, $only_fields=false)
 {
     $sort_field_translated = $sort_field;
     switch ($sort_field) {
@@ -5303,11 +6600,19 @@ function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep=
         break;
 
         default:
-            // Ignore.
+            $sort_field_translated = $sort_field;
         break;
     }
 
-    $dir = ($sort == 'up') ? 'ASC' : 'DESC';
+    if (strtolower($sort) != 'asc' && strtolower($sort) != 'desc') {
+        $dir = ($sort == 'up') ? 'ASC' : 'DESC';
+    } else {
+        $dir = $sort;
+    }
+
+    if ($only_fields) {
+        return $sort_field_translated.' '.$dir;
+    }
 
     return 'ORDER BY '.$sort_field_translated.' '.$dir;
 }
@@ -5322,10 +6627,6 @@ function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep=
  */
 function events_get_secondary_groups_left_join($table)
 {
-    if (users_is_admin()) {
-        return '';
-    }
-
     if ($table == 'tevento') {
         return 'LEFT JOIN tagent_secondary_group tasg ON te.id_agente = tasg.id_agent';
     }
diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php
index cde59c52bb..d0e844c3bf 100644
--- a/pandora_console/include/functions_graph.php
+++ b/pandora_console/include/functions_graph.php
@@ -1277,12 +1277,34 @@ function graphic_combined_module(
                 array_push($modules, $source['id_agent_module']);
                 array_push($weights, $source['weight']);
                 if ($source['label'] != '' || $params_combined['labels']) {
-                    $item['type'] = 'custom_graph';
-                    $item['id_agent'] = agents_get_module_id(
+                    $id_agent = agents_get_module_id(
                         $source['id_agent_module']
                     );
-                    $item['id_agent_module'] = $source['id_agent_module'];
-                    $labels[$source['id_agent_module']] = ($source['label'] != '') ? reporting_label_macro($item, $source['label']) : reporting_label_macro($item, $params_combined['labels']);
+                    $agent_description = agents_get_description($id_agent);
+                    $agent_group = agents_get_agent_group($id_agent);
+                    $agent_address = agents_get_address($id_agent);
+                    $agent_alias = agents_get_alias($id_agent);
+                    $module_name = modules_get_agentmodule_name(
+                        $source['id_agent_module']
+                    );
+
+                    $module_description = modules_get_agentmodule_descripcion(
+                        $source['id_agent_module']
+                    );
+
+                    $items_label = [
+                        'type'               => 'custom_graph',
+                        'id_agent'           => $id_agent,
+                        'id_agent_module'    => $source['id_agent_module'],
+                        'agent_description'  => $agent_description,
+                        'agent_group'        => $agent_group,
+                        'agent_address'      => $agent_address,
+                        'agent_alias'        => $agent_alias,
+                        'module_name'        => $module_name,
+                        'module_description' => $module_description,
+                    ];
+
+                    $labels[$source['id_agent_module']] = ($source['label'] != '') ? reporting_label_macro($items_label, $source['label']) : reporting_label_macro($item, $params_combined['labels']);
                 }
             }
         }
@@ -2161,7 +2183,7 @@ function graphic_combined_module(
             $graph_values = $temp;
 
             if (!$params['vconsole']) {
-                $width  = 1024;
+                $width  = $width;
                 $height = 500;
             }
 
@@ -2286,6 +2308,7 @@ function combined_graph_summatory_average(
                 }
 
                 $count++;
+                $count_data_array_reverse--;
             }
 
             if ($summatory && isset($array_sum_reverse)
@@ -2343,14 +2366,21 @@ function graphic_agentaccess(
     $date = get_system_time();
     $datelimit = ($date - $period);
     $data_array = [];
+    $interval = agents_get_interval($id_agent);
 
     $data = db_get_all_rows_sql(
-        "SELECT count(*) as data, min(utimestamp) as utimestamp
-        FROM tagent_access
-        WHERE id_agent = $id_agent
-        AND utimestamp > $datelimit
-        AND utimestamp < $date
-        GROUP by ROUND(utimestamp / 1800)"
+        sprintf(
+            'SELECT utimestamp, count(*) as data
+             FROM tagent_access
+             WHERE id_agent = %d
+             AND utimestamp > %d
+             AND utimestamp < %d
+             GROUP BY ROUND(utimestamp/%d)',
+            $id_agent,
+            $datelimit,
+            $date,
+            $interval
+        )
     );
 
     if (isset($data) && is_array($data)) {
@@ -2532,13 +2562,13 @@ function graph_agent_status($id_agent=false, $width=300, $height=200, $return=fa
     }
 
     // $colors = array(COL_CRITICAL, COL_WARNING, COL_NORMAL, COL_UNKNOWN);
-    $colors[__('Critical')] = COL_CRITICAL;
-    $colors[__('Warning')] = COL_WARNING;
-    $colors[__('Normal')] = COL_NORMAL;
-    $colors[__('Unknown')] = COL_UNKNOWN;
+    $colors['Critical'] = COL_CRITICAL;
+    $colors['Warning'] = COL_WARNING;
+    $colors['Normal'] = COL_NORMAL;
+    $colors['Unknown'] = COL_UNKNOWN;
 
     if ($show_not_init) {
-        $colors[__('Not init')] = COL_NOTINIT;
+        $colors['Not init'] = COL_NOTINIT;
     }
 
     if (array_sum($data) == 0) {
@@ -3222,7 +3252,7 @@ function graph_events_validated($width=300, $height=200, $extra_filters=[], $met
         $config['fontpath'],
         $config['font_size'],
         1,
-        false,
+        'bottom',
         $colors
     );
 }
@@ -3523,7 +3553,9 @@ function grafico_eventos_usuario($width, $height)
         '',
         $water_mark,
         $config['fontpath'],
-        $config['font_size']
+        $config['font_size'],
+        1,
+        'bottom'
     );
 }
 
diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php
index 8fe37c0e48..a1448e37f2 100644
--- a/pandora_console/include/functions_groups.php
+++ b/pandora_console/include/functions_groups.php
@@ -298,6 +298,52 @@ function groups_get_childrens_ids($parent, $groups=null)
 
 
 /**
+ * Return a array of id_group of children of given parent.
+ *
+ * @param integer $parent          The id_grupo parent to search its children.
+ * @param array   $ignorePropagate Ignore propagate.
+ */
+function groups_get_children($parent, $ignorePropagate=false)
+{
+    static $groups;
+
+    if (empty($groups)) {
+        $groups = db_get_all_rows_in_table('tgrupo');
+        $groups = array_reduce(
+            $groups,
+            function ($carry, $item) {
+                $carry[$item['id_grupo']] = $item;
+                return $carry;
+            }
+        );
+    }
+
+    $return = [];
+    foreach ($groups as $key => $g) {
+        if ($g['id_grupo'] == 0) {
+            continue;
+        }
+
+        if ($ignorePropagate || $parent == 0 || $groups[$parent]['propagate']) {
+            if ($g['parent'] == $parent) {
+                $return += [$g['id_grupo'] => $g];
+                if ($g['propagate'] || $ignorePropagate) {
+                    $return += groups_get_children(
+                        $g['id_grupo'],
+                        $ignorePropagate
+                    );
+                }
+            }
+        }
+    }
+
+    return $return;
+}
+
+
+/**
+ * XXX: This is not working. Expects 'propagate' on CHILD not on PARENT!!!
+ *
  * Return a array of id_group of childrens (to branches down)
  *
  * @param integer $parent The id_group parent to search the childrens.
diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php
index 010845caf6..08d60dbb6e 100644
--- a/pandora_console/include/functions_html.php
+++ b/pandora_console/include/functions_html.php
@@ -77,8 +77,7 @@ function html_debug_print($var, $file='', $oneline=false)
         fprintf($f, '%s', $output);
         fclose($f);
     } else {
-        echo '<pre>'.date('Y/m/d H:i:s').' ('.gettype($var).') '.$more_info.'</pre>';
-        echo '<pre>';
+        echo '<pre style="z-index: 10000; background: #fff; padding: 1em;">'.date('Y/m/d H:i:s').' ('.gettype($var).') '.$more_info."\n";
         print_r($var);
         echo '</pre>';
     }
@@ -1233,7 +1232,7 @@ function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*',
  *
  * @return string HTML code if return parameter is true.
  */
-function html_print_input_text_extended($name, $value, $id, $alt, $size, $maxlength, $disabled, $script, $attributes, $return=false, $password=false, $function='')
+function html_print_input_text_extended($name, $value, $id, $alt, $size, $maxlength, $disabled, $script, $attributes, $return=false, $password=false, $function='', $autocomplete='off')
 {
     static $idcounter = 0;
 
@@ -1241,7 +1240,9 @@ function html_print_input_text_extended($name, $value, $id, $alt, $size, $maxlen
         $maxlength = 255;
     }
 
-    if ($size == 0) {
+    if ($size === false) {
+        $size = '';
+    } else if ($size == 0) {
         $size = 10;
     }
 
@@ -1283,7 +1284,7 @@ function html_print_input_text_extended($name, $value, $id, $alt, $size, $maxlen
         'autocomplete',
     ];
 
-    $output = '<input '.($password ? 'type="password" autocomplete="off" ' : 'type="text" ');
+    $output = '<input '.($password ? 'type="password" autocomplete="'.$autocomplete.'" ' : 'type="text" ');
 
     if ($disabled && (!is_array($attributes) || !array_key_exists('disabled', $attributes))) {
         $output .= 'readonly="readonly" ';
@@ -1435,13 +1436,16 @@ function html_print_input_password(
     $return=false,
     $disabled=false,
     $required=false,
-    $class=''
+    $class='',
+    $autocomplete='off'
 ) {
     if ($maxlength == 0) {
         $maxlength = 255;
     }
 
-    if ($size == 0) {
+    if ($size === false) {
+        $size = false;
+    } else if ($size == 0) {
         $size = 10;
     }
 
@@ -1454,7 +1458,7 @@ function html_print_input_password(
         $attr['class'] = $class;
     }
 
-    return html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true);
+    return html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete);
 }
 
 
@@ -1479,7 +1483,9 @@ function html_print_input_text($name, $value, $alt='', $size=50, $maxlength=255,
         $maxlength = 255;
     }
 
-    if ($size == 0) {
+    if ($size === false) {
+        $size = false;
+    } else if ($size == 0) {
         $size = 10;
     }
 
@@ -2465,7 +2471,7 @@ function html_print_image(
 
                 if (!is_readable($working_dir.'/enterprise/meta'.$src)) {
                     if ($isExternalLink) {
-                        $src = ui_get_full_url($src);
+                        $src = ui_get_full_url($src, false, false, false);
                     } else {
                         $src = ui_get_full_url('../..'.$src);
                     }
@@ -2730,20 +2736,22 @@ function html_html2rgb($htmlcolor)
 /**
  * Print a magic-ajax control to select the module.
  *
- * @param string  $name         The name of ajax control, by default is "module".
- * @param string  $default      The default value to show in the ajax control.
- * @param array   $id_agents    The array list of id agents as array(1,2,3), by default is false and the function use all agents (if the ACL desactive).
- * @param boolean $ACL          Filter the agents by the ACL list of user.
- * @param string  $scriptResult The source code of script to call, by default is
- *  empty. And the example is:
- *          function (e, data, formatted) {
- *             ...
- *         }
+ * @param string  $name            The name of ajax control, by default is "module".
+ * @param string  $default         The default value to show in the ajax control.
+ * @param array   $id_agents       The array list of id agents as array(1,2,3), by default is false and the function use all agents (if the ACL desactive).
+ * @param boolean $ACL             Filter the agents by the ACL list of user.
+ * @param string  $scriptResult    The source code of script to call, by default is
+ *     empty. And the example is:
+ *             function (e, data, formatted) {
+ *                ...
+ *            }
  *
- *          And the formatted is the select item as string.
+ *             And the formatted is the select item as string.
  *
- * @param array   $filter       Other filter of modules.
- * @param boolean $return       If it is true return a string with the output instead to echo the output.
+ * @param array   $filter          Other filter of modules.
+ * @param boolean $return          If it is true return a string with the output instead to echo the output.
+ * @param integer $id_agent_module Id agent module.
+ * @param string  $size            Size.
  *
  * @return mixed If the $return is true, return the output as string.
  */
@@ -2755,7 +2763,8 @@ function html_print_autocomplete_modules(
     $scriptResult='',
     $filter=[],
     $return=false,
-    $id_agent_module=0
+    $id_agent_module=0,
+    $size='30'
 ) {
     global $config;
 
@@ -2796,7 +2805,7 @@ function html_print_autocomplete_modules(
         $default,
         'text-'.$name,
         '',
-        30,
+        $size,
         100,
         false,
         '',
@@ -2932,7 +2941,10 @@ function html_print_sort_arrows($params, $order_tag, $up='up', $down='down')
     $url_down = 'index.php?'.http_build_query($params, '', '&amp;');
 
     // Build the links
-    return '&nbsp;'.'<a href="'.$url_up.'">'.html_print_image('images/sort_up.png', true).'</a>'.'<a href="'.$url_down.'">'.html_print_image('images/sort_down.png', true).'</a>';
+    $out = '&nbsp;<a href="'.$url_up.'">';
+    $out .= html_print_image('images/sort_up_black.png', true);
+    $out .= '</a><a href="'.$url_down.'">';
+    $out .= html_print_image('images/sort_down_black.png', true).'</a>';
 }
 
 
@@ -3052,4 +3064,295 @@ function html_print_link_with_params($text, $params=[], $type='text', $style='')
     $html .= '</form>';
 
     return $html;
-}
\ No newline at end of file
+}
+
+
+/**
+ * Print input using functions html lib.
+ *
+ * @param array   $data       Input definition.
+ * @param string  $wrapper    Wrapper 'div' or 'li'.
+ * @param boolean $input_only Return or print only input or also label.
+ *
+ * @return string HTML code for desired input.
+ */
+function html_print_input($data, $wrapper='div', $input_only=false)
+{
+    if (is_array($data) === false) {
+        return '';
+    }
+
+    $output = '';
+
+    if ($data['label'] && $input_only === false) {
+        $output = '<'.$wrapper.' id="'.$wrapper.'-'.$data['name'].'" ';
+        $output .= ' class="'.$data['input_class'].'">';
+        $output .= '<label class="'.$data['label_class'].'">';
+        $output .= $data['label'];
+        $output .= '</label>';
+
+        if (!$data['return']) {
+            echo $output;
+        }
+    }
+
+    switch ($data['type']) {
+        case 'text':
+            $output .= html_print_input_text(
+                $data['name'],
+                $data['value'],
+                ((isset($data['alt']) === true) ? $data['alt'] : ''),
+                ((isset($data['size']) === true) ? $data['size'] : 50),
+                ((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
+                ((isset($data['return']) === true) ? $data['return'] : true),
+                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
+                ((isset($data['required']) === true) ? $data['required'] : false),
+                ((isset($data['function']) === true) ? $data['function'] : ''),
+                ((isset($data['class']) === true) ? $data['class'] : ''),
+                ((isset($data['onChange']) === true) ? $data['onChange'] : ''),
+                ((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '')
+            );
+        break;
+
+        case 'image':
+            $output .= html_print_input_image(
+                $data['name'],
+                $data['src'],
+                $data['value'],
+                ((isset($data['style']) === true) ? $data['style'] : ''),
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['options']) === true) ? $data['options'] : false)
+            );
+        break;
+
+        case 'text_extended':
+            $output .= html_print_input_text_extended(
+                $data['name'],
+                $data['value'],
+                $data['id'],
+                $data['alt'],
+                $data['size'],
+                $data['maxlength'],
+                $data['disabled'],
+                $data['script'],
+                $data['attributes'],
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['password']) === true) ? $data['password'] : false),
+                ((isset($data['function']) === true) ? $data['function'] : '')
+            );
+        break;
+
+        case 'password':
+            $output .= html_print_input_password(
+                $data['name'],
+                $data['value'],
+                ((isset($data['alt']) === true) ? $data['alt'] : ''),
+                ((isset($data['size']) === true) ? $data['size'] : 50),
+                ((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
+                ((isset($data['required']) === true) ? $data['required'] : false),
+                ((isset($data['class']) === true) ? $data['class'] : '')
+            );
+        break;
+
+        case 'text':
+            $output .= html_print_input_text(
+                $data['name'],
+                $data['value'],
+                ((isset($data['alt']) === true) ? $data['alt'] : ''),
+                ((isset($data['size']) === true) ? $data['size'] : 50),
+                ((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
+                ((isset($data['required']) === true) ? $data['required'] : false),
+                ((isset($data['function']) === true) ? $data['function'] : ''),
+                ((isset($data['class']) === true) ? $data['class'] : ''),
+                ((isset($data['onChange']) === true) ? $data['onChange'] : ''),
+                ((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '')
+            );
+        break;
+
+        case 'hidden':
+            $output .= html_print_input_hidden(
+                $data['name'],
+                $data['value'],
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['class']) === true) ? $data['class'] : false)
+            );
+        break;
+
+        case 'hidden_extended':
+            $output .= html_print_input_hidden_extended(
+                $data['name'],
+                $data['value'],
+                $data['id'],
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['class']) === true) ? $data['class'] : false)
+            );
+        break;
+
+        case 'color':
+            $output .= html_print_input_color(
+                $data['name'],
+                $data['value'],
+                ((isset($data['class']) === true) ? $data['class'] : false),
+                ((isset($data['return']) === true) ? $data['return'] : false)
+            );
+        break;
+
+        case 'file':
+            $output .= html_print_input_file(
+                $data['name'],
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['options']) === true) ? $data['options'] : false)
+            );
+        break;
+
+        case 'select':
+            $output .= html_print_select(
+                $data['fields'],
+                $data['name'],
+                ((isset($data['selected']) === true) ? $data['selected'] : ''),
+                ((isset($data['script']) === true) ? $data['script'] : ''),
+                ((isset($data['nothing']) === true) ? $data['nothing'] : ''),
+                ((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['multiple']) === true) ? $data['multiple'] : false),
+                ((isset($data['sort']) === true) ? $data['sort'] : true),
+                ((isset($data['class']) === true) ? $data['class'] : ''),
+                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
+                ((isset($data['style']) === true) ? $data['style'] : false),
+                ((isset($data['option_style']) === true) ? $data['option_style'] : false),
+                ((isset($data['size']) === true) ? $data['size'] : false),
+                ((isset($data['modal']) === true) ? $data['modal'] : false),
+                ((isset($data['message']) === true) ? $data['message'] : ''),
+                ((isset($data['select_all']) === true) ? $data['select_all'] : false)
+            );
+        break;
+
+        case 'select_from_sql':
+            $output .= html_print_select_from_sql(
+                $data['sql'],
+                $data['name'],
+                ((isset($data['selected']) === true) ? $data['selected'] : ''),
+                ((isset($data['script']) === true) ? $data['script'] : ''),
+                ((isset($data['nothing']) === true) ? $data['nothing'] : ''),
+                ((isset($data['nothing_value']) === true) ? $data['nothing_value'] : '0'),
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['multiple']) === true) ? $data['multiple'] : false),
+                ((isset($data['sort']) === true) ? $data['sort'] : true),
+                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
+                ((isset($data['style']) === true) ? $data['style'] : false),
+                ((isset($data['size']) === true) ? $data['size'] : false),
+                ((isset($data['trucate_size']) === true) ? $data['trucate_size'] : GENERIC_SIZE_TEXT)
+            );
+        break;
+
+        case 'select_groups':
+            $output .= html_print_select_groups(
+                ((isset($data['id_user']) === true) ? $data['id_user'] : false),
+                ((isset($data['privilege']) === true) ? $data['privilege'] : 'AR'),
+                ((isset($data['returnAllGroup']) === true) ? $data['returnAllGroup'] : true),
+                $data['name'],
+                ((isset($data['selected']) === true) ? $data['selected'] : ''),
+                ((isset($data['script']) === true) ? $data['script'] : ''),
+                ((isset($data['nothing']) === true) ? $data['nothing'] : ''),
+                ((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['multiple']) === true) ? $data['multiple'] : false),
+                ((isset($data['sort']) === true) ? $data['sort'] : true),
+                ((isset($data['class']) === true) ? $data['class'] : ''),
+                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
+                ((isset($data['style']) === true) ? $data['style'] : false),
+                ((isset($data['option_style']) === true) ? $data['option_style'] : false),
+                ((isset($data['id_group']) === true) ? $data['id_group'] : false),
+                ((isset($data['keys_field']) === true) ? $data['keys_field'] : 'id_grupo'),
+                ((isset($data['strict_user']) === true) ? $data['strict_user'] : false),
+                ((isset($data['delete_groups']) === true) ? $data['delete_groups'] : false),
+                ((isset($data['include_groups']) === true) ? $data['include_groups'] : false),
+                ((isset($data['size']) === true) ? $data['size'] : false),
+                ((isset($data['simple_multiple_options']) === true) ? $data['simple_multiple_options'] : false)
+            );
+        break;
+
+        case 'submit':
+            $output .= '<'.$wrapper.' class="action-buttons" style="width: 100%">'.html_print_submit_button(
+                ((isset($data['label']) === true) ? $data['label'] : 'OK'),
+                ((isset($data['name']) === true) ? $data['name'] : ''),
+                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
+                ((isset($data['attributes']) === true) ? $data['attributes'] : ''),
+                ((isset($data['return']) === true) ? $data['return'] : false)
+            ).'</'.$wrapper.'>';
+        break;
+
+        case 'checkbox':
+            $output .= html_print_checkbox(
+                $data['name'],
+                $data['value'],
+                ((isset($data['checked']) === true) ? $data['checked'] : false),
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
+                ((isset($data['script']) === true) ? $data['script'] : ''),
+                ((isset($data['disabled_hidden']) === true) ? $data['disabled_hidden'] : false)
+            );
+        break;
+
+        case 'switch':
+            $output .= html_print_switch($data);
+        break;
+
+        case 'interval':
+            $output .= html_print_extended_select_for_time(
+                $data['name'],
+                $data['value'],
+                ((isset($data['script']) === true) ? $data['script'] : ''),
+                ((isset($data['nothing']) === true) ? $data['nothing'] : ''),
+                ((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
+                ((isset($data['size']) === true) ? $data['size'] : false),
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['style']) === true) ? $data['selected'] : false),
+                ((isset($data['unique']) === true) ? $data['unique'] : false)
+            );
+        break;
+
+        case 'textarea':
+            $output .= html_print_textarea(
+                $data['name'],
+                $data['rows'],
+                $data['columns'],
+                ((isset($data['value']) === true) ? $data['value'] : ''),
+                ((isset($data['attributes']) === true) ? $data['attributes'] : ''),
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['class']) === true) ? $data['class'] : '')
+            );
+        break;
+
+        case 'button':
+            $output .= html_print_button(
+                ((isset($data['label']) === true) ? $data['label'] : 'OK'),
+                ((isset($data['name']) === true) ? $data['name'] : ''),
+                ((isset($data['disabled']) === true) ? $data['disabled'] : false),
+                ((isset($data['script']) === true) ? $data['script'] : ''),
+                ((isset($data['attributes']) === true) ? $data['attributes'] : ''),
+                ((isset($data['return']) === true) ? $data['return'] : false),
+                ((isset($data['imageButton']) === true) ? $data['imageButton'] : false),
+                ((isset($data['modal']) === true) ? $data['modal'] : false),
+                ((isset($data['message']) === true) ? $data['message'] : '')
+            );
+        break;
+
+        default:
+            // Ignore.
+        break;
+    }
+
+    if ($data['label'] && $input_only === false) {
+        $output .= '</'.$wrapper.'>';
+        if (!$data['return']) {
+            echo '</'.$wrapper.'>';
+        }
+    }
+
+    return $output;
+}
diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php
index 0dbe1049bc..98191d231f 100644
--- a/pandora_console/include/functions_menu.php
+++ b/pandora_console/include/functions_menu.php
@@ -50,6 +50,15 @@ function menu_print_menu(&$menu)
 
     $sec = (string) get_parameter('sec');
     $sec2 = (string) get_parameter('sec2');
+    if ($sec2 == 'operation/agentes/ver_agente') {
+        $sec2 = 'godmode/agentes/configurar_agente';
+    } else if ($sec2 == 'godmode/servers/discovery') {
+        $wiz = (string) get_parameter('wiz');
+        $sec2 = 'godmode/servers/discovery&wiz='.$wiz;
+    } else {
+        $sec2 = (string) get_parameter('sec2');
+    }
+
     $menu_selected = false;
 
     $allsec2 = explode('sec2=', $_SERVER['REQUEST_URI']);
@@ -87,7 +96,7 @@ function menu_print_menu(&$menu)
         // ~ if (enterprise_hook ('enterprise_acl', array ($config['id_user'], $mainsec)) == false)
             // ~ continue;
         if (! isset($main['id'])) {
-            $id = 'menu_'.++$idcounter;
+            $id = 'menu_'.(++$idcounter);
         } else {
             $id = $main['id'];
         }
@@ -405,9 +414,9 @@ function menu_print_menu(&$menu)
         $padding_top = ( $length >= 18) ? 6 : 12;
 
         if ($config['menu_type'] == 'classic') {
-            $output .= '<div id="title_menu" class="title_menu_classic" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>';
+            $output .= '<div id="title_menu" class="title_menu_classic">'.$main['text'].'</div>';
         } else {
-            $output .= '<div id="title_menu" class="title_menu_collapsed" style="padding-top:'.$padding_top.'px; display:none;">'.$main['text'].'</div>';
+            $output .= '<div id="title_menu" class="title_menu_collapsed">'.$main['text'].'</div>';
         }
 
         // Add the notification ball if defined
diff --git a/pandora_console/include/functions_messages.php b/pandora_console/include/functions_messages.php
index 1bc54c9c89..e0212a9478 100644
--- a/pandora_console/include/functions_messages.php
+++ b/pandora_console/include/functions_messages.php
@@ -383,7 +383,7 @@ function messages_get_count(
     }
 
     $sql = sprintf(
-        'SELECT count(*) as "n" FROM (
+        'SELECT count(distinct id_mensaje) as "n" FROM (
             SELECT
                 tm.*,
                 utimestamp_read > 0 as "read"
diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php
index b9ed8e41d5..fbee2a5331 100755
--- a/pandora_console/include/functions_modules.php
+++ b/pandora_console/include/functions_modules.php
@@ -566,11 +566,11 @@ function modules_update_agent_module(
 /**
  * Creates a module in an agent.
  *
- * @param int Agent id.
- * @param int Module name id.
- * @param array Extra values for the module.
- * @param bool Disable the ACL checking, for default false.
- * @param mixed Array with tag's ids or false.
+ * @param integer $id_agent   Agent id.
+ * @param integer $name       Module name id.
+ * @param array   $values     Extra values for the module.
+ * @param boolean $disableACL Disable the ACL checking, for default false.
+ * @param mixed   $tags       Array with tag's ids or false.
  *
  * @return New module id if the module was created. False if not.
  */
@@ -584,7 +584,9 @@ function modules_create_agent_module(
     global $config;
 
     if (!$disableACL) {
-        if (!users_is_admin() && (empty($id_agent) || ! users_access_to_agent($id_agent, 'AW'))) {
+        if (!users_is_admin() && (empty($id_agent)
+            || !users_access_to_agent($id_agent, 'AW'))
+        ) {
             return false;
         }
     }
@@ -593,7 +595,7 @@ function modules_create_agent_module(
         return ERR_INCOMPLETE;
     }
 
-    // Check for non valid characters in module name
+    // Check for non valid characters in module name.
     if (mb_ereg_match('[\xc2\xa1\xc2\xbf\xc3\xb7\xc2\xba\xc2\xaa]', io_safe_output($name)) !== false) {
         return ERR_GENERIC;
     }
@@ -605,23 +607,33 @@ function modules_create_agent_module(
     $values['nombre'] = $name;
     $values['id_agente'] = (int) $id_agent;
 
-    $exists = (bool) db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['nombre' => $name, 'id_agente' => (int) $id_agent]);
+    $exists = (bool) db_get_value_filter(
+        'id_agente_modulo',
+        'tagente_modulo',
+        [
+            'nombre'    => $name,
+            'id_agente' => (int) $id_agent,
+        ]
+    );
 
     if ($exists) {
         return ERR_EXIST;
     }
 
-    // Encrypt passwords
+    // Encrypt passwords.
     if (isset($values['plugin_pass'])) {
         $values['plugin_pass'] = io_input_password($values['plugin_pass']);
     }
 
-    // Encrypt SNMPv3 passwords
-    if (isset($values['id_tipo_modulo']) && ($values['id_tipo_modulo'] >= 15 && $values['id_tipo_modulo'] <= 18)
+    // Encrypt SNMPv3 passwords.
+    if (isset($values['id_tipo_modulo']) && ($values['id_tipo_modulo'] >= 15
+        && $values['id_tipo_modulo'] <= 18)
         && isset($values['tcp_send']) && ($values['tcp_send'] == 3)
         && isset($values['custom_string_2'])
     ) {
-        $values['custom_string_2'] = io_input_password($values['custom_string_2']);
+        $values['custom_string_2'] = io_input_password(
+            $values['custom_string_2']
+        );
     }
 
     $id_agent_module = db_process_sql_insert('tagente_modulo', $values);
@@ -645,25 +657,33 @@ function modules_create_agent_module(
     }
 
     if (isset($values['id_tipo_modulo'])
-        && ($values['id_tipo_modulo'] == 21 || $values['id_tipo_modulo'] == 22 || $values['id_tipo_modulo'] == 23)
+        && ($values['id_tipo_modulo'] == 21
+        || $values['id_tipo_modulo'] == 22
+        || $values['id_tipo_modulo'] == 23)
     ) {
-        // Async modules start in normal status
+        // Async modules start in normal status.
         $status = AGENT_MODULE_STATUS_NORMAL;
     } else {
-        // Sync modules start in unknown status
+        // Sync modules start in unknown status.
         $status = AGENT_MODULE_STATUS_NO_DATA;
     }
 
+    // Condition for cron modules. Don't touch.
+    $time = 0;
+    if (empty($values['interval']) === false) {
+        $time = (time() - (int) $values['interval']);
+    }
+
     $result = db_process_sql_insert(
         'tagente_estado',
         [
             'id_agente_modulo'  => $id_agent_module,
-            'datos'             => 0,
+            'datos'             => '',
             'timestamp'         => '01-01-1970 00:00:00',
             'estado'            => $status,
             'known_status'      => $status,
             'id_agente'         => (int) $id_agent,
-            'utimestamp'        => (time() - (int) $values['interval']),
+            'utimestamp'        => $time,
             'status_changes'    => 0,
             'last_status'       => $status,
             'last_known_status' => $status,
@@ -680,12 +700,20 @@ function modules_create_agent_module(
         return ERR_DB;
     }
 
-    // Update module status count if the module is not created disabled
+    // Update module status count if the module is not created disabled.
     if (!isset($values['disabled']) || $values['disabled'] == 0) {
         if ($status == 0) {
-            db_process_sql('UPDATE tagente SET total_count=total_count+1, normal_count=normal_count+1 WHERE id_agente='.(int) $id_agent);
+            db_process_sql(
+                'UPDATE tagente
+                SET total_count=total_count+1, normal_count=normal_count+1
+                WHERE id_agente='.(int) $id_agent
+            );
         } else {
-            db_process_sql('UPDATE tagente SET total_count=total_count+1, notinit_count=notinit_count+1 WHERE id_agente='.(int) $id_agent);
+            db_process_sql(
+                'UPDATE tagente
+                SET total_count=total_count+1, notinit_count=notinit_count+1
+                WHERE id_agente='.(int) $id_agent
+            );
         }
     }
 
@@ -2230,6 +2258,7 @@ function modules_get_agentmodule_data(
                 'module_name' => $values[$key]['module_name'],
                 'agent_id'    => $values[$key]['agent_id'],
                 'agent_name'  => $values[$key]['agent_name'],
+                'module_type' => $values[$key]['module_type'],
             ];
         }
 
@@ -2307,32 +2336,67 @@ function modules_get_color_status($status)
         return COL_UNKNOWN;
     }
 
-    switch ($status) {
-        case AGENT_MODULE_STATUS_NORMAL:
-        case AGENT_STATUS_NORMAL:
+    switch ((string) $status) {
+        case (string) AGENT_MODULE_STATUS_NORMAL:
+        case (string) AGENT_STATUS_NORMAL:
+        case STATUS_MODULE_OK:
+        case STATUS_AGENT_OK:
+        case STATUS_ALERT_NOT_FIRED:
+        case STATUS_SERVER_OK:
+        case STATUS_MODULE_OK_BALL:
+        case STATUS_AGENT_OK_BALL:
+        case STATUS_ALERT_NOT_FIRED_BALL:
         return COL_NORMAL;
 
         case AGENT_MODULE_STATUS_NOT_INIT:
         case AGENT_STATUS_NOT_INIT:
+        case STATUS_MODULE_NO_DATA:
+        case STATUS_AGENT_NOT_INIT:
+        case STATUS_AGENT_NO_DATA:
+        case STATUS_MODULE_NO_DATA_BALL:
+        case STATUS_AGENT_NO_DATA_BALL:
+        case STATUS_AGENT_NO_MONITORS_BALL:
         return COL_NOTINIT;
 
         case AGENT_MODULE_STATUS_CRITICAL_BAD:
         case AGENT_STATUS_CRITICAL:
+        case STATUS_MODULE_CRITICAL:
+        case STATUS_AGENT_CRITICAL:
+        case STATUS_MODULE_CRITICAL_BALL:
+        case STATUS_AGENT_CRITICAL_BALL:
         return COL_CRITICAL;
 
         case AGENT_MODULE_STATUS_WARNING:
         case AGENT_STATUS_WARNING:
+        case STATUS_MODULE_WARNING:
+        case STATUS_AGENT_WARNING:
+        case STATUS_MODULE_WARNING_BALL:
+        case STATUS_AGENT_WARNING_BALL:
         return COL_WARNING;
 
         case AGENT_MODULE_STATUS_CRITICAL_ALERT:
         case AGENT_MODULE_STATUS_WARNING_ALERT:
         case AGENT_STATUS_ALERT_FIRED:
+        case STATUS_ALERT_FIRED:
+        case STATUS_ALERT_FIRED_BALL:
         return COL_ALERTFIRED;
 
         case AGENT_MODULE_STATUS_UNKNOWN:
         case AGENT_STATUS_UNKNOWN:
+        case STATUS_MODULE_UNKNOWN:
+        case STATUS_AGENT_UNKNOWN:
+        case STATUS_AGENT_DOWN:
+        case STATUS_ALERT_DISABLED:
+        case STATUS_MODULE_UNKNOWN_BALL:
+        case STATUS_AGENT_UNKNOWN_BALL:
+        case STATUS_AGENT_DOWN_BALL:
+        case STATUS_ALERT_DISABLED_BALL:
         return COL_UNKNOWN;
 
+        case STATUS_SERVER_DOWN:
+        case STATUS_SERVER_DOWN_BALL:
+        return '#444';
+
         default:
             // Ignored.
         break;
@@ -2595,7 +2659,7 @@ function modules_get_relations($params=[])
     }
 
     $sql = 'SELECT DISTINCT tmr.id, tmr.module_a, tmr.module_b,
-				tmr.disable_update
+				tmr.disable_update, tmr.type
 			FROM tmodule_relationship tmr,
 				tagente_modulo tam,
 				tagente ta,
@@ -2698,11 +2762,13 @@ function modules_relation_exists($id_module, $id_module_other=false)
 /**
  * Change the 'disabled_update' value of a relation row.
  *
- * @param int Relation id.
+ * @param integer $id_module_a Id agent module a.
+ * @param integer $id_module_b Id agent module b.
+ * @param string  $type        Type direct or failover.
  *
  * @return boolean True if the 'disabled_update' changes to 1, false otherwise.
  */
-function modules_add_relation($id_module_a, $id_module_b)
+function modules_add_relation($id_module_a, $id_module_b, $type='direct')
 {
     $result = false;
 
@@ -2710,6 +2776,7 @@ function modules_add_relation($id_module_a, $id_module_b)
         $values = [
             'module_a' => $id_module_a,
             'module_b' => $id_module_b,
+            'type'     => $type,
         ];
         $result = db_process_sql_insert('tmodule_relationship', $values);
     }
diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php
index 69aa0a1608..f1febb5c41 100644
--- a/pandora_console/include/functions_netflow.php
+++ b/pandora_console/include/functions_netflow.php
@@ -35,8 +35,8 @@ define('NETFLOW_RES_LOWD', 6);
 define('NETFLOW_RES_MEDD', 12);
 define('NETFLOW_RES_HID', 24);
 define('NETFLOW_RES_ULTRAD', 30);
-define('NETFLOW_RES_HOURLY', 'hourly');
-define('NETFLOW_RES_DAILY', 'daily');
+define('NETFLOW_RES_HOURLY', -1);
+define('NETFLOW_RES_DAILY', -2);
 
 define('NETFLOW_MAX_DATA_CIRCULAR_MESH', 10000);
 
@@ -473,7 +473,7 @@ function netflow_get_data(
 
     // Put all points into an array.
     $intervals = [($start_date - $multiplier_time)];
-    while ((end($intervals) < $end_date) === true) {
+    while (($next = (end($intervals) + $multiplier_time) < $end_date) === true) {
         $intervals[] = (end($intervals) + $multiplier_time);
     }
 
diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php
index af11deb541..e4fb19e814 100644
--- a/pandora_console/include/functions_networkmap.php
+++ b/pandora_console/include/functions_networkmap.php
@@ -450,14 +450,26 @@ function networkmap_generate_dot(
                         $nodes[$node_count] = $module;
                 }
             } else {
-                $have_relations_a = db_get_value('id', 'tmodule_relationship', 'module_a', $module['id_agente_modulo']);
-                $have_relations_b = db_get_value('id', 'tmodule_relationship', 'module_b', $module['id_agente_modulo']);
+                $sql_a = sprintf(
+                    'SELECT id
+                    FROM tmodule_relationship
+                    WHERE module_a = %d AND type = "direct"',
+                    $module['id_agente_modulo']
+                );
+                $sql_b = sprintf(
+                    'SELECT id
+                    FROM tmodule_relationship
+                    WHERE module_b = %d AND type = "direct"',
+                    $module['id_agente_modulo']
+                );
+                $have_relations_a = db_get_value_sql($sql_a);
+                $have_relations_b = db_get_value_sql($sql_b);
 
                 if ($have_relations_a || $have_relations_b) {
-                    // Save node parent information to define edges later
+                    // Save node parent information to define edges later.
                     $parents[$node_count] = $module['parent'] = $agent['id_node'];
 
-                    // Add node
+                    // Add node.
                     $nodes[$node_count] = $module;
                 }
             }
@@ -1807,9 +1819,9 @@ function networkmap_links_to_js_links(
 
         if (($relation['parent_type'] == NODE_MODULE) && ($relation['child_type'] == NODE_MODULE)) {
             if (($item['status_start'] == AGENT_MODULE_STATUS_CRITICAL_BAD) || ($item['status_end'] == AGENT_MODULE_STATUS_CRITICAL_BAD)) {
-                $item['link_color'] = '#FC4444';
+                $item['link_color'] = '#e63c52';
             } else if (($item['status_start'] == AGENT_MODULE_STATUS_WARNING) || ($item['status_end'] == AGENT_MODULE_STATUS_WARNING)) {
-                $item['link_color'] = '#FAD403';
+                $item['link_color'] = '#f3b200';
             }
 
             $agent = agents_get_agent_id_by_module_id(
@@ -1837,9 +1849,9 @@ function networkmap_links_to_js_links(
             }
         } else if ($relation['child_type'] == NODE_MODULE) {
             if ($item['status_start'] == AGENT_MODULE_STATUS_CRITICAL_BAD) {
-                $item['link_color'] = '#FC4444';
+                $item['link_color'] = '#e63c52';
             } else if ($item['status_start'] == AGENT_MODULE_STATUS_WARNING) {
-                $item['link_color'] = '#FAD403';
+                $item['link_color'] = '#f3b200';
             }
 
             $agent2 = agents_get_agent_id_by_module_id(
@@ -1864,9 +1876,9 @@ function networkmap_links_to_js_links(
             }
         } else if ($relation['parent_type'] == NODE_MODULE) {
             if ($item['status_end'] == AGENT_MODULE_STATUS_CRITICAL_BAD) {
-                $item['link_color'] = '#FC4444';
+                $item['link_color'] = '#e63c52';
             } else if ($item['status_end'] == AGENT_MODULE_STATUS_WARNING) {
-                $item['link_color'] = '#FAD403';
+                $item['link_color'] = '#f3b200';
             }
 
             $agent = agents_get_agent_id_by_module_id(
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index fba9d87a02..4abf5152c1 100755
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -1,20 +1,30 @@
 <?php
-
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation; version 2
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
 /**
- * @package    Include
- * @subpackage Reporting
+ * Extension to manage a list of gateways and the node address where they should
+ * point to.
+ *
+ * @category   Reporting
+ * @package    Pandora FMS
+ * @subpackage Community
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
  */
 
 /**
@@ -38,13 +48,15 @@ require_once $config['homedir'].'/include/functions_netflow.php';
 require_once $config['homedir'].'/include/functions_os.php';
 require_once $config['homedir'].'/include/functions_network.php';
 
-//
-// CONSTANTS DEFINITIONS                //
-//
+// CONSTANTS DEFINITIONS.
 // Priority modes.
 define('REPORT_PRIORITY_MODE_OK', 1);
 define('REPORT_PRIORITY_MODE_UNKNOWN', 2);
 
+// Failover type.
+define('REPORT_FAILOVER_TYPE_NORMAL', 1);
+define('REPORT_FAILOVER_TYPE_SIMPLE', 2);
+
 // Status.
 define('REPORT_STATUS_ERR', 0);
 define('REPORT_STATUS_OK', 1);
@@ -151,11 +163,13 @@ function reporting_make_reporting_data(
         $contents = $report['contents'];
     } else {
         $report = io_safe_output(db_get_row('treport', 'id_report', $id_report));
-        $contents = db_get_all_rows_field_filter(
-            'treport_content',
-            'id_report',
-            $id_report,
-            db_escape_key_identifier('order')
+        $contents = io_safe_output(
+            db_get_all_rows_field_filter(
+                'treport_content',
+                'id_report',
+                $id_report,
+                db_escape_key_identifier('order')
+            )
         );
     }
 
@@ -188,13 +202,13 @@ function reporting_make_reporting_data(
             );
 
             $sql_tags_join = 'INNER JOIN tagente ON tagente.id_agente = t1.id_agente
-				INNER JOIN ttag_module ON ttag_module.id_agente_modulo = t1.id_agente_modulo
-				LEFT JOIN tagent_secondary_group tasg ON tagente.id_agente = tasg.id_agent';
+                INNER JOIN ttag_module ON ttag_module.id_agente_modulo = t1.id_agente_modulo
+                LEFT JOIN tagent_secondary_group tasg ON tagente.id_agente = tasg.id_agent';
 
             $sql = sprintf(
                 'SELECT count(*) FROM tagente_modulo t1
-				%s WHERE t1.delete_pending = 0 AND t1.id_agente_modulo = '.$content['id_agent_module'].'
-				AND t1.id_agente = '.$content['id_agent'].' %s',
+                %s WHERE t1.delete_pending = 0 AND t1.id_agente_modulo = '.$content['id_agent_module'].'
+                AND t1.id_agente = '.$content['id_agent'].' %s',
                 $sql_tags_join,
                 $where_tags
             );
@@ -237,12 +251,16 @@ function reporting_make_reporting_data(
                     if ($metaconsole_on && $server_name != '') {
                         $connection = metaconsole_get_connection($server_name);
                         if (!metaconsole_load_external_db($connection)) {
-                            // ui_print_error_message ("Error connecting to ".$server_name);
                             continue;
                         }
                     }
 
-                    array_push($agents_to_macro, modules_get_agentmodule_agent($graph_item['id_agent_module']));
+                    array_push(
+                        $agents_to_macro,
+                        modules_get_agentmodule_agent(
+                            $graph_item['id_agent_module']
+                        )
+                    );
                     if ($metaconsole_on) {
                         // Restore db connection.
                         metaconsole_restore_db();
@@ -284,20 +302,63 @@ function reporting_make_reporting_data(
                 }
             }
 
-            if (is_array($content['id_agent']) && count($content['id_agent']) != 1) {
-                $content['style']['name_label'] = str_replace('_agent_', count($content['id_agent']).__(' agents'), $content['style']['name_label']);
+            $items_label['agent_description'] = agents_get_description(
+                $content['id_agent']
+            );
+            $items_label['agent_group'] = agents_get_agent_group(
+                $content['id_agent']
+            );
+            $items_label['agent_address'] = agents_get_address(
+                $content['id_agent']
+            );
+            $items_label['agent_alias'] = agents_get_alias(
+                $content['id_agent']
+            );
+
+            $modules = agents_get_modules(
+                $agent_value,
+                [
+                    'id_agente_modulo',
+                    'nombre',
+                    'descripcion',
+                ],
+                [
+                    'id_agente_modulo' => $content['id_agent_module'],
+                ]
+            );
+
+            $items_label['module_name'] = $modules[$content['id_agent_module']]['nombre'];
+            $items_label['module_description'] = $modules[$content['id_agent_module']]['descripcion'];
+
+            if (is_array($content['id_agent'])
+                && count($content['id_agent']) != 1
+            ) {
+                $content['style']['name_label'] = str_replace(
+                    '_agent_',
+                    count($content['id_agent']).__(' agents'),
+                    $content['style']['name_label']
+                );
             }
 
-            if (is_array($content['id_agent_module']) && count($content['id_agent_module']) != 1) {
-                $content['style']['name_label'] = str_replace('_module_', count($content['id_agent_module']).__(' modules'), $content['style']['name_label']);
+            if (is_array($content['id_agent_module'])
+                && count($content['id_agent_module']) != 1
+            ) {
+                $content['style']['name_label'] = str_replace(
+                    '_module_',
+                    count($content['id_agent_module']).__(' modules'),
+                    $content['style']['name_label']
+                );
             }
 
-            $content['name'] = reporting_label_macro($items_label, $content['style']['name_label']);
-
             if ($metaconsole_on) {
                 // Restore db connection.
                 metaconsole_restore_db();
             }
+
+            $content['name'] = reporting_label_macro(
+                $items_label,
+                $content['style']['name_label']
+            );
         }
 
         switch (reporting_get_type($content)) {
@@ -326,26 +387,32 @@ function reporting_make_reporting_data(
             break;
 
             case 'general':
-                $report['contents'][] = reporting_general(
-                    $report,
-                    $content
+                $report['contents'][] = io_safe_output(
+                    reporting_general(
+                        $report,
+                        $content
+                    )
                 );
             break;
 
             case 'availability':
-                $report['contents'][] = reporting_availability(
-                    $report,
-                    $content,
-                    $date,
-                    $time
+                $report['contents'][] = io_safe_output(
+                    reporting_availability(
+                        $report,
+                        $content,
+                        $date,
+                        $time
+                    )
                 );
             break;
 
             case 'availability_graph':
-                $report['contents'][] = reporting_availability_graph(
-                    $report,
-                    $content,
-                    $pdf
+                $report['contents'][] = io_safe_output(
+                    reporting_availability_graph(
+                        $report,
+                        $content,
+                        $pdf
+                    )
                 );
             break;
 
@@ -475,9 +542,11 @@ function reporting_make_reporting_data(
             break;
 
             case 'agent_configuration':
-                $report['contents'][] = reporting_agent_configuration(
-                    $report,
-                    $content
+                $report['contents'][] = io_safe_output(
+                    reporting_agent_configuration(
+                        $report,
+                        $content
+                    )
                 );
             break;
 
@@ -673,12 +742,14 @@ function reporting_make_reporting_data(
 
             case 'agent_detailed_event':
             case 'event_report_agent':
-                $report_control = reporting_event_report_agent(
-                    $report,
-                    $content,
-                    $type,
-                    $force_width_chart,
-                    $force_height_chart
+                $report_control = io_safe_output(
+                    reporting_event_report_agent(
+                        $report,
+                        $content,
+                        $type,
+                        $force_width_chart,
+                        $force_height_chart
+                    )
                 );
                 if ($report_control['total_events'] == 0 && $content['hide_no_data'] == 1) {
                     continue;
@@ -1347,8 +1418,8 @@ function reporting_event_top_n(
         // Get all the related data.
         $sql = sprintf(
             'SELECT id_agent_module, server_name
-			FROM treport_content_item
-			WHERE id_report_content = %d',
+            FROM treport_content_item
+            WHERE id_report_content = %d',
             $content['id_rc']
         );
 
@@ -1383,7 +1454,7 @@ function reporting_event_top_n(
         foreach ($tops as $key => $row) {
             // Metaconsole connection.
             $server_name = $row['server_name'];
-            if (($config['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
+            if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
                 $connection = metaconsole_get_connection($server_name);
                 if (metaconsole_load_external_db($connection) != NOERR) {
                     // ui_print_error_message ("Error connecting to ".$server_name);
@@ -1426,7 +1497,7 @@ function reporting_event_top_n(
             }
 
             // Restore dbconnection.
-            if (($config['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
+            if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
                 metaconsole_restore_db();
             }
         }
@@ -1883,6 +1954,18 @@ function reporting_event_report_group(
 }
 
 
+/**
+ * Events for module reports.
+ *
+ * @param array   $report             Report info.
+ * @param array   $content            Content info.
+ * @param string  $type               Type retun report.
+ * @param integer $force_width_chart  Width chart.
+ * @param integer $force_height_chart Height chart.
+ * @param integer $pdf                If pdf report.
+ *
+ * @return array
+ */
 function reporting_event_report_module(
     $report,
     $content,
@@ -1911,12 +1994,42 @@ function reporting_event_report_module(
         metaconsole_connect(null, $id_server);
     }
 
-    $return['title'] = $content['name'];
-    $return['subtitle'] = agents_get_alias($content['id_agent']).' - '.io_safe_output(modules_get_agentmodule_name($content['id_agent_module']));
+    $id_agent = agents_get_module_id(
+        $content['id_agent_module']
+    );
+    $id_agent_module = $content['id_agent_module'];
+    $agent_description = agents_get_description($id_agent);
+    $agent_group = agents_get_agent_group($id_agent);
+    $agent_address = agents_get_address($id_agent);
+    $agent_alias = agents_get_alias($id_agent);
+    $module_name = modules_get_agentmodule_name(
+        $id_agent_module
+    );
+    $module_description = modules_get_agentmodule_descripcion(
+        $id_agent_module
+    );
 
+    $items_label = [
+        'type'               => $content['type'],
+        'id_agent'           => $id_agent,
+        'id_agent_module'    => $id_agent_module,
+        'agent_description'  => $agent_description,
+        'agent_group'        => $agent_group,
+        'agent_address'      => $agent_address,
+        'agent_alias'        => $agent_alias,
+        'module_name'        => $module_name,
+        'module_description' => $module_description,
+    ];
+
+    $return['title'] = $content['name'];
+    $return['subtitle'] = $agent_alias.' - '.io_safe_output($module_name);
     $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
+
     if ($return['label'] != '') {
-        $return['label'] = reporting_label_macro($content, $return['label']);
+        $return['label'] = reporting_label_macro(
+            $items_label,
+            $return['label']
+        );
     }
 
     if (is_metaconsole()) {
@@ -1930,15 +2043,24 @@ function reporting_event_report_module(
     $event_filter = $content['style'];
     $return['show_summary_group'] = $event_filter['show_summary_group'];
     // Filter.
-    $show_summary_group         = $event_filter['show_summary_group'];
-    $filter_event_severity      = json_decode($event_filter['filter_event_severity'], true);
-    $filter_event_type          = json_decode($event_filter['filter_event_type'], true);
-    $filter_event_status        = json_decode($event_filter['filter_event_status'], true);
+    $show_summary_group = $event_filter['show_summary_group'];
+    $filter_event_severity = json_decode(
+        $event_filter['filter_event_severity'],
+        true
+    );
+    $filter_event_type = json_decode(
+        $event_filter['filter_event_type'],
+        true
+    );
+    $filter_event_status = json_decode(
+        $event_filter['filter_event_status'],
+        true
+    );
     $filter_event_filter_search = $event_filter['event_filter_search'];
 
     // Graphs.
-    $event_graph_by_user_validator        = $event_filter['event_graph_by_user_validator'];
-    $event_graph_by_criticity             = $event_filter['event_graph_by_criticity'];
+    $event_graph_by_user_validator = $event_filter['event_graph_by_user_validator'];
+    $event_graph_by_criticity = $event_filter['event_graph_by_criticity'];
     $event_graph_validated_vs_unvalidated = $event_filter['event_graph_validated_vs_unvalidated'];
 
     $server_name = $content['server_name'];
@@ -2176,7 +2298,7 @@ function reporting_agent_module($report, $content)
         foreach ($agents as $agent) {
             $row = [];
             $row['agent_status'][$agent] = agents_get_status($agent);
-            $row['agent_name'] = agents_get_alias($agent);
+            $row['agent_name'] = io_safe_output(agents_get_alias($agent));
             $agent_modules = agents_get_modules($agent);
 
             $row['modules'] = [];
@@ -2311,9 +2433,9 @@ function reporting_exception(
         // Get all the related data.
         $sql = sprintf(
             '
-			SELECT id_agent_module, server_name, operation
-			FROM treport_content_item
-			WHERE id_report_content = %d',
+            SELECT id_agent_module, server_name, operation
+            FROM treport_content_item
+            WHERE id_report_content = %d',
             $content['id_rc']
         );
 
@@ -2330,7 +2452,7 @@ function reporting_exception(
         do {
             // Metaconsole connection.
             $server_name = $exceptions[$i]['server_name'];
-            if (($config['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
+            if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
                 $connection = metaconsole_get_connection($server_name);
                 if (metaconsole_load_external_db($connection) != NOERR) {
                     // ui_print_error_message ("Error connecting to ".$server_name);
@@ -2372,7 +2494,7 @@ function reporting_exception(
             $i++;
 
             // Restore dbconnection.
-            if (($config['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
+            if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
                 metaconsole_restore_db();
             }
         } while ($min === false && $i < count($exceptions));
@@ -2385,7 +2507,7 @@ function reporting_exception(
         foreach ($exceptions as $exc) {
             // Metaconsole connection.
             $server_name = $exc['server_name'];
-            if (($config['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
+            if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
                 $connection = metaconsole_get_connection($server_name);
                 if (metaconsole_load_external_db($connection) != NOERR) {
                     // ui_print_error_message ("Error connecting to ".$server_name);
@@ -2499,7 +2621,7 @@ function reporting_exception(
             }
 
             // Restore dbconnection
-            if (($config['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
+            if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
                 metaconsole_restore_db();
             }
         }
@@ -2693,7 +2815,7 @@ function reporting_group_report($report, $content)
 {
     global $config;
 
-    $metaconsole_on = ($config['metaconsole'] == 1) && defined('METACONSOLE');
+    $metaconsole_on = ($config['metaconsole'] == 1) && is_metaconsole();
 
     $return['type'] = 'group_report';
 
@@ -2776,8 +2898,42 @@ function reporting_event_report_agent(
         $history = true;
     }
 
+    $id_server = false;
+    if (is_metaconsole()) {
+        $id_server = metaconsole_get_id_server($content['server_name']);
+        metaconsole_connect(null, $id_server);
+    }
+
+    $id_agent = $content['id_agent'];
+    $agent_description = agents_get_description($id_agent);
+    $agent_group = agents_get_agent_group($id_agent);
+    $agent_address = agents_get_address($id_agent);
+    $agent_alias = agents_get_alias($id_agent);
+
+    $items_label = [
+        'type'              => $return['type'],
+        'id_agent'          => $id_agent,
+        'agent_description' => $agent_description,
+        'agent_group'       => $agent_group,
+        'agent_address'     => $agent_address,
+        'agent_alias'       => $agent_alias,
+    ];
+
+    if ($config['metaconsole']) {
+        metaconsole_restore_db();
+    }
+
+    $label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
+    if ($label != '') {
+        $label = reporting_label_macro(
+            $items_label,
+            $label
+        );
+    }
+
+    $return['label'] = $label;
     $return['title'] = $content['name'];
-    $return['subtitle'] = agents_get_alias($content['id_agent']);
+    $return['subtitle'] = io_safe_output($agent_alias);
     $return['description'] = $content['description'];
     $return['date'] = reporting_get_date_text($report, $content);
 
@@ -2840,13 +2996,6 @@ function reporting_event_report_agent(
         $metaconsole_dbtable = false;
     }
 
-    $label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
-    if ($label != '') {
-        $label = reporting_label_macro($content, $label);
-    }
-
-    $return['label'] = $label;
-
     if ($event_graph_by_user_validator) {
         $data_graph = events_get_count_events_validated_by_user(
             ['id_agent' => $content['id_agent']],
@@ -2926,10 +3075,6 @@ function reporting_event_report_agent(
         );
     }
 
-    if ($config['metaconsole']) {
-        metaconsole_restore_db();
-    }
-
     // Total events.
     if ($return['data'] != '') {
         $return['total_events'] = count($return['data']);
@@ -2941,32 +3086,65 @@ function reporting_event_report_agent(
 }
 
 
+/**
+ * Show historical data.
+ *
+ * @param array $report  Data report.
+ * @param array $content Content report.
+ *
+ * @return array
+ */
 function reporting_historical_data($report, $content)
 {
     global $config;
 
     $return['type'] = 'historical_data';
     $period = $content['period'];
-    $date_limit = (time() - $period);
+    $date_limit = ($report['datetime'] - $period);
     if (empty($content['name'])) {
         $content['name'] = __('Historical data');
     }
 
-    $module_name = io_safe_output(
-        modules_get_agentmodule_name($content['id_agent_module'])
+    $id_agent = agents_get_module_id(
+        $content['id_agent_module']
     );
-    $agent_name = io_safe_output(
-        modules_get_agentmodule_agent_alias($content['id_agent_module'])
+    $id_agent_module = $content['id_agent_module'];
+    $agent_description = agents_get_description($id_agent);
+    $agent_group = agents_get_agent_group($id_agent);
+    $agent_address = agents_get_address($id_agent);
+    $agent_alias = io_safe_output(agents_get_alias($id_agent));
+    $module_name = io_safe_output(
+        modules_get_agentmodule_name(
+            $id_agent_module
+        )
+    );
+    $module_description = modules_get_agentmodule_descripcion(
+        $id_agent_module
     );
 
+    $items_label = [
+        'type'               => $return['type'],
+        'id_agent'           => $id_agent,
+        'id_agent_module'    => $id_agent_module,
+        'agent_description'  => $agent_description,
+        'agent_group'        => $agent_group,
+        'agent_address'      => $agent_address,
+        'agent_alias'        => $agent_alias,
+        'module_name'        => $module_name,
+        'module_description' => $module_description,
+    ];
+
     $return['title'] = $content['name'];
-    $return['subtitle'] = $agent_name.' - '.$module_name;
+    $return['subtitle'] = $agent_alias.' - '.$module_name;
     $return['description'] = $content['description'];
     $return['date'] = reporting_get_date_text($report, $content);
 
     $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
     if ($return['label'] != '') {
-        $return['label'] = reporting_label_macro($content, $return['label']);
+        $return['label'] = reporting_label_macro(
+            $items_label,
+            $return['label']
+        );
     }
 
     $return['keys'] = [
@@ -2991,7 +3169,7 @@ function reporting_historical_data($report, $content)
                 FROM tagente_datos_string
                 WHERE id_agente_modulo ='.$content['id_agent_module'].'
                     AND utimestamp >'.$date_limit.'
-                    AND utimestamp <='.time(),
+                    AND utimestamp <='.$report['datetime'],
                 true
             );
         break;
@@ -3002,7 +3180,7 @@ function reporting_historical_data($report, $content)
                 FROM tagente_datos
                 WHERE id_agente_modulo ='.$content['id_agent_module'].'
                     AND utimestamp >'.$date_limit.'
-                    AND utimestamp <='.time(),
+                    AND utimestamp <='.$report['datetime'],
                 true
             );
         break;
@@ -3022,6 +3200,14 @@ function reporting_historical_data($report, $content)
 }
 
 
+/**
+ * Show data serialized.
+ *
+ * @param array $report  Data report.
+ * @param array $content Content report.
+ *
+ * @return array
+ */
 function reporting_database_serialized($report, $content)
 {
     global $config;
@@ -3032,15 +3218,43 @@ function reporting_database_serialized($report, $content)
         $content['name'] = __('Database Serialized');
     }
 
-    $module_name = io_safe_output(
-        modules_get_agentmodule_name($content['id_agent_module'])
-    );
-    $agent_name = io_safe_output(
-        modules_get_agentmodule_agent_alias($content['id_agent_module'])
+    if (is_metaconsole()) {
+        $id_meta = metaconsole_get_id_server($content['server_name']);
+        $server = metaconsole_get_connection_by_id($id_meta);
+        metaconsole_connect($server);
+    }
+
+    $id_agent = agents_get_module_id(
+        $content['id_agent_module']
     );
 
+    $id_agent_module = $content['id_agent_module'];
+    $agent_description = agents_get_description($id_agent);
+    $agent_group = agents_get_agent_group($id_agent);
+    $agent_address = agents_get_address($id_agent);
+    $agent_alias = agents_get_alias($id_agent);
+    $module_name = modules_get_agentmodule_name(
+        $id_agent_module
+    );
+
+    $module_description = modules_get_agentmodule_descripcion(
+        $id_agent_module
+    );
+
+    $items_label = [
+        'type'               => $return['type'],
+        'id_agent'           => $id_agent,
+        'id_agent_module'    => $id_agent_module,
+        'agent_description'  => $agent_description,
+        'agent_group'        => $agent_group,
+        'agent_address'      => $agent_address,
+        'agent_alias'        => $agent_alias,
+        'module_name'        => $module_name,
+        'module_description' => $module_description,
+    ];
+
     $return['title'] = $content['name'];
-    $return['subtitle'] = $agent_name.' - '.$module_name;
+    $return['subtitle'] = $agent_alias.' - '.$module_name;
     $return['description'] = $content['description'];
     $return['date'] = reporting_get_date_text($report, $content);
 
@@ -3050,51 +3264,39 @@ function reporting_database_serialized($report, $content)
     }
 
     $return['keys'] = $keys;
-
-    $module_name = io_safe_output(
-        modules_get_agentmodule_name($content['id_agent_module'])
-    );
-    $agent_name = io_safe_output(
-        modules_get_agentmodule_agent_name($content['id_agent_module'])
-    );
-
-    $return['agent_name'] = $agent_name;
+    $return['agent_name'] = $agent_alias;
     $return['module_name'] = $module_name;
 
-    if ($config['metaconsole']) {
-        $id_meta = metaconsole_get_id_server($content['server_name']);
-
-        $server = metaconsole_get_connection_by_id($id_meta);
-        metaconsole_connect($server);
-    }
-
     $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
     if ($return['label'] != '') {
-        $return['label'] = reporting_label_macro($content, $return['label']);
+        $return['label'] = reporting_label_macro(
+            $items_label,
+            $return['label']
+        );
     }
 
     $datelimit = ($report['datetime'] - $content['period']);
     $search_in_history_db = db_search_in_history_db($datelimit);
 
-    // This query gets information from the default and the historic database
+    // This query gets information from the default and the historic database.
     $result = db_get_all_rows_sql(
         'SELECT *
-		FROM tagente_datos
-		WHERE id_agente_modulo = '.$content['id_agent_module'].'
-			AND utimestamp > '.$datelimit.'
-			AND utimestamp <= '.$report['datetime'],
+        FROM tagente_datos
+        WHERE id_agente_modulo = '.$content['id_agent_module'].'
+            AND utimestamp > '.$datelimit.'
+            AND utimestamp <= '.$report['datetime'],
         $search_in_history_db
     );
 
-    // Adds string data if there is no numeric data
-    if ((count($result) < 0) or (!$result)) {
-        // This query gets information from the default and the historic database
+    // Adds string data if there is no numeric data.
+    if ((count($result) < 0) || (!$result)) {
+        // This query gets information from the default and the historic database.
         $result = db_get_all_rows_sql(
             'SELECT *
-			FROM tagente_datos_string
-			WHERE id_agente_modulo = '.$content['id_agent_module'].'
-				AND utimestamp > '.$datelimit.'
-				AND utimestamp <= '.$report['datetime'],
+            FROM tagente_datos_string
+            WHERE id_agente_modulo = '.$content['id_agent_module'].'
+                AND utimestamp > '.$datelimit.'
+                AND utimestamp <= '.$report['datetime'],
             $search_in_history_db
         );
     }
@@ -3108,13 +3310,16 @@ function reporting_database_serialized($report, $content)
         $date = date($config['date_format'], $row['utimestamp']);
         $serialized_data = $row['datos'];
 
-        // Cut line by line
+        // Cut line by line.
         if (empty($content['line_separator'])
             || empty($serialized_data)
         ) {
             $rowsUnserialize = [$row['datos']];
         } else {
-            $rowsUnserialize = explode($content['line_separator'], $serialized_data);
+            $rowsUnserialize = explode(
+                $content['line_separator'],
+                $serialized_data
+            );
         }
 
         foreach ($rowsUnserialize as $rowUnser) {
@@ -3130,7 +3335,10 @@ function reporting_database_serialized($report, $content)
                     $row['data'][][$keys[0]] = $rowUnser;
                 }
             } else {
-                $columnsUnserialize = explode($content['column_separator'], $rowUnser);
+                $columnsUnserialize = explode(
+                    $content['column_separator'],
+                    $rowUnser
+                );
 
                 $i = 0;
                 $temp_row = [];
@@ -3199,9 +3407,9 @@ function reporting_group_configuration($report, $content)
         }
     } else {
         $sql = '
-			SELECT *
-			FROM tagente
-			WHERE id_grupo='.$content['id_group'];
+            SELECT *
+            FROM tagente
+            WHERE id_grupo='.$content['id_group'];
     }
 
     $agents_list = db_get_all_rows_sql($sql);
@@ -3460,25 +3668,25 @@ function reporting_alert_report_group($report, $content)
     if ($content['id_group'] == 0) {
         $agent_modules = db_get_all_rows_sql(
             '
-			SELECT distinct(id_agent_module)
-			FROM talert_template_modules
-			WHERE disabled = 0
-				AND id_agent_module IN (
-					SELECT id_agente_modulo
-					FROM tagente_modulo)'
+            SELECT distinct(id_agent_module)
+            FROM talert_template_modules
+            WHERE disabled = 0
+                AND id_agent_module IN (
+                    SELECT id_agente_modulo
+                    FROM tagente_modulo)'
         );
     } else {
         $agent_modules = db_get_all_rows_sql(
             '
-			SELECT distinct(id_agent_module)
-			FROM talert_template_modules
-			WHERE disabled = 0
-				AND id_agent_module IN (
-					SELECT id_agente_modulo
-					FROM tagente_modulo
-					WHERE id_agente IN (
-						SELECT id_agente
-						FROM tagente WHERE id_grupo = '.$content['id_group'].'))'
+            SELECT distinct(id_agent_module)
+            FROM talert_template_modules
+            WHERE disabled = 0
+                AND id_agent_module IN (
+                    SELECT id_agente_modulo
+                    FROM tagente_modulo
+                    WHERE id_agente IN (
+                        SELECT id_agente
+                        FROM tagente WHERE id_grupo = '.$content['id_group'].'))'
         );
     }
 
@@ -3596,6 +3804,14 @@ function reporting_alert_report_group($report, $content)
 }
 
 
+/**
+ * Report alert agent.
+ *
+ * @param array $report  Info report.
+ * @param array $content Content report.
+ *
+ * @return array
+ */
 function reporting_alert_report_agent($report, $content)
 {
     global $config;
@@ -3613,16 +3829,33 @@ function reporting_alert_report_agent($report, $content)
         metaconsole_connect($server);
     }
 
-    $agent_name = agents_get_alias($content['id_agent']);
+    $id_agent = $content['id_agent'];
+    $agent_description = agents_get_description($id_agent);
+    $agent_group = agents_get_agent_group($id_agent);
+    $agent_address = agents_get_address($id_agent);
+    $agent_alias = agents_get_alias($id_agent);
+
+    $items_label = [
+        'type'              => $return['type'],
+        'id_agent'          => $id_agent,
+        'id_agent_module'   => $id_agent_module,
+        'agent_description' => $agent_description,
+        'agent_group'       => $agent_group,
+        'agent_address'     => $agent_address,
+        'agent_alias'       => $agent_alias,
+    ];
 
     $return['title'] = $content['name'];
-    $return['subtitle'] = $agent_name;
+    $return['subtitle'] = $agent_alias;
     $return['description'] = $content['description'];
     $return['date'] = reporting_get_date_text($report, $content);
 
     $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
     if ($return['label'] != '') {
-        $return['label'] = reporting_label_macro($content, $return['label']);
+        $return['label'] = reporting_label_macro(
+            $items_label,
+            $return['label']
+        );
     }
 
     $module_list = agents_get_modules($content['id_agent']);
@@ -3630,10 +3863,10 @@ function reporting_alert_report_agent($report, $content)
     $data = [];
     foreach ($module_list as $id => $module_name) {
         $data_row = [];
-        $data_row['agent']  = $agent_name;
+        $data_row['agent']  = $agent_alias;
         $data_row['module'] = $module_name;
 
-        // Alerts over $id_agent_module
+        // Alerts over $id_agent_module.
         $alerts = alerts_get_effective_alert_actions($id);
 
         if ($alerts === false) {
@@ -3727,6 +3960,14 @@ function reporting_alert_report_agent($report, $content)
 }
 
 
+/**
+ * Alert report module.
+ *
+ * @param array $report  Info report.
+ * @param array $content Content report.
+ *
+ * @return array
+ */
 function reporting_alert_report_module($report, $content)
 {
     global $config;
@@ -3744,36 +3985,56 @@ function reporting_alert_report_module($report, $content)
         metaconsole_connect($server);
     }
 
-    $module_name = io_safe_output(
-        modules_get_agentmodule_name($content['id_agent_module'])
+    $id_agent = agents_get_module_id(
+        $content['id_agent_module']
     );
-    $agent_name = io_safe_output(
-        modules_get_agentmodule_agent_alias($content['id_agent_module'])
+    $id_agent_module = $content['id_agent_module'];
+    $agent_description = agents_get_description($id_agent);
+    $agent_group = agents_get_agent_group($id_agent);
+    $agent_address = agents_get_address($id_agent);
+    $agent_alias = agents_get_alias($id_agent);
+    $module_name = modules_get_agentmodule_name(
+        $id_agent_module
     );
 
+    $module_description = modules_get_agentmodule_descripcion(
+        $id_agent_module
+    );
+
+    $items_label = [
+        'type'               => $return['type'],
+        'id_agent'           => $id_agent,
+        'id_agent_module'    => $id_agent_module,
+        'agent_description'  => $agent_description,
+        'agent_group'        => $agent_group,
+        'agent_address'      => $agent_address,
+        'agent_alias'        => $agent_alias,
+        'module_name'        => $module_name,
+        'module_description' => $module_description,
+    ];
+
     $return['title'] = $content['name'];
-    $return['subtitle'] = $agent_name.' - '.$module_name;
+    $return['subtitle'] = $agent_alias.' - '.$module_name;
     $return['description'] = $content['description'];
     $return['date'] = reporting_get_date_text($report, $content);
     $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
     if ($return['label'] != '') {
-        $return['label'] = reporting_label_macro($content, $return['label']);
+        $return['label'] = reporting_label_macro(
+            $items_label,
+            $return['label']
+        );
     }
 
     $data_row = [];
 
-    $data_row['agent'] = io_safe_output(
-        agents_get_alias(
-            agents_get_agent_id_by_module_id($content['id_agent_module'])
-        )
-    );
+    $data_row['agent'] = io_safe_output($agent_alias);
     $data_row['module'] = db_get_value_filter(
         'nombre',
         'tagente_modulo',
         ['id_agente_modulo' => $content['id_agent_module']]
     );
 
-    // Alerts over $id_agent_module
+    // Alerts over $id_agent_module.
     $alerts = alerts_get_effective_alert_actions($content['id_agent_module']);
 
     $ntemplates = 0;
@@ -3902,7 +4163,7 @@ function reporting_sql_graph(
         }
     }
 
-    // Get chart
+    // Get chart.
     reporting_set_conf_charts($width, $height, $only_image, $type, $content, $ttl);
 
     if (!empty($force_width_chart)) {
@@ -3940,6 +4201,14 @@ function reporting_sql_graph(
 }
 
 
+/**
+ * Monitor report module.
+ *
+ * @param array $report  Info report.
+ * @param array $content Content report.
+ *
+ * @return array
+ */
 function reporting_monitor_report($report, $content)
 {
     global $config;
@@ -3950,48 +4219,67 @@ function reporting_monitor_report($report, $content)
         $content['name'] = __('Monitor Report');
     }
 
-    $module_name = io_safe_output(
-        modules_get_agentmodule_name($content['id_agent_module'])
-    );
-    $agent_name = io_safe_output(
-        modules_get_agentmodule_agent_alias($content['id_agent_module'])
-    );
-
-    $return['title'] = $content['name'];
-    $return['subtitle'] = $agent_name.' - '.$module_name;
-    $return['description'] = $content['description'];
-    $return['date'] = reporting_get_date_text($report, $content);
-
-    if ($config['metaconsole']) {
+    if (is_metaconsole()) {
         $id_meta = metaconsole_get_id_server($content['server_name']);
 
         $server = metaconsole_get_connection_by_id($id_meta);
         metaconsole_connect($server);
     }
 
+    $id_agent = agents_get_module_id(
+        $content['id_agent_module']
+    );
+    $id_agent_module = $content['id_agent_module'];
+    $agent_description = agents_get_description($id_agent);
+    $agent_group = agents_get_agent_group($id_agent);
+    $agent_address = agents_get_address($id_agent);
+    $agent_alias = agents_get_alias($id_agent);
+    $module_name = modules_get_agentmodule_name(
+        $id_agent_module
+    );
+
+    $module_description = modules_get_agentmodule_descripcion(
+        $id_agent_module
+    );
+
+    $items_label = [
+        'type'               => $return['type'],
+        'id_agent'           => $id_agent,
+        'id_agent_module'    => $id_agent_module,
+        'agent_description'  => $agent_description,
+        'agent_group'        => $agent_group,
+        'agent_address'      => $agent_address,
+        'agent_alias'        => $agent_alias,
+        'module_name'        => $module_name,
+        'module_description' => $module_description,
+    ];
+
+    $return['title'] = $content['name'];
+    $return['subtitle'] = $agent_alias.' - '.$module_name;
+    $return['description'] = $content['description'];
+    $return['date'] = reporting_get_date_text($report, $content);
+
     $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
     if ($return['label'] != '') {
-        $return['label'] = reporting_label_macro($content, $return['label']);
+        $return['label'] = reporting_label_macro(
+            $items_label,
+            $return['label']
+        );
     }
 
-    $module_name = io_safe_output(
-        modules_get_agentmodule_name($content['id_agent_module'])
-    );
-    $agent_name = io_safe_output(
-        modules_get_agentmodule_agent_name($content['id_agent_module'])
-    );
-
-    $return['agent_name'] = $agent_name;
+    $return['agent_name'] = $agent_alias;
     $return['module_name'] = $module_name;
 
-    // All values (except id module and report time) by default
+    // All values (except id module and report time) by default.
     $report = reporting_advanced_sla(
         $content['id_agent_module'],
         ($report['datetime'] - $content['period']),
         $report['datetime']
     );
 
-    if ($report['time_total'] === $report['time_unknown'] || empty($content['id_agent_module'])) {
+    if ($report['time_total'] === $report['time_unknown']
+        || empty($content['id_agent_module'])
+    ) {
         $return['data']['unknown'] = 1;
     } else {
         $return['data']['ok']['value'] = $report['SLA'];
@@ -4097,8 +4385,8 @@ function reporting_netflow(
     // Get item filters.
     $filter = db_get_row_sql(
         "SELECT *
-		FROM tnetflow_filter
-		WHERE id_sg = '".(int) $content['text']."'",
+        FROM tnetflow_filter
+        WHERE id_sg = '".(int) $content['text']."'",
         false,
         true
     );
@@ -4282,9 +4570,9 @@ function reporting_agent_configuration($report, $content)
     }
 
     $sql = '
-		SELECT *
-		FROM tagente
-		WHERE id_agente='.$content['id_agent'];
+        SELECT *
+        FROM tagente
+        WHERE id_agente='.$content['id_agent'];
     $agent_data = db_get_row_sql($sql);
 
     $agent_configuration = [];
@@ -4304,9 +4592,9 @@ function reporting_agent_configuration($report, $content)
     if (!empty($modules)) {
         foreach ($modules as $id_agent_module => $module) {
             $sql = "
-				SELECT *
-				FROM tagente_modulo
-				WHERE id_agente_modulo = $id_agent_module";
+                SELECT *
+                FROM tagente_modulo
+                WHERE id_agente_modulo = $id_agent_module";
             $module_db = db_get_row_sql($sql);
 
             $data_module = [];
@@ -4352,12 +4640,12 @@ function reporting_agent_configuration($report, $content)
             $data_module['status_icon'] = ui_print_status_image($status, $title, true);
             $data_module['status'] = $title;
             $sql_tag = "
-				SELECT name
-				FROM ttag
-				WHERE id_tag IN (
-					SELECT id_tag
-					FROM ttag_module
-					WHERE id_agente_modulo = $id_agent_module)";
+                SELECT name
+                FROM ttag
+                WHERE id_tag IN (
+                    SELECT id_tag
+                    FROM ttag_module
+                    WHERE id_agente_modulo = $id_agent_module)";
             $tags = db_get_all_rows_sql($sql_tag);
             if ($tags === false) {
                 $data_module['tags'] = [];
@@ -4525,41 +4813,41 @@ function reporting_value($report, $content, $type, $pdf=false)
                 }
             } else {
                 $value = '
-				<table border="0" style="margin:0 auto;text-align:center;">
-					<tr>
-						<td width="400px;" height="20%;">';
+                <table border="0" style="margin:0 auto;text-align:center;">
+                    <tr>
+                        <td width="400px;" height="20%;">';
                 if ($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3) {
                     $value .= '
-							<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
-								<tr>
-									<th style="padding:5px;background-color:#82b92e;">
-										'.__('Agent').'
-									</th>
-									<th style="padding:5px;background-color:#82b92e;">
-										'.__('Module').'
-									</th>
-									<th style="padding:5px;background-color:#82b92e;">
-										'.__('Maximum').'
-									</th>
-								<tr>
-									<td style="padding:5px;">
-										'.$agent_name.'
-									</td>
-									<td style="padding:5px;">
-										'.$module_name.'
-									</td>
-									<td style="padding:5px;">
-										'.format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit.'
-									</td>
-								</tr>
-							</table>';
+                            <table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
+                                <tr>
+                                    <th style="padding:5px;background-color:#82b92e;">
+                                        '.__('Agent').'
+                                    </th>
+                                    <th style="padding:5px;background-color:#82b92e;">
+                                        '.__('Module').'
+                                    </th>
+                                    <th style="padding:5px;background-color:#82b92e;">
+                                        '.__('Maximum').'
+                                    </th>
+                                <tr>
+                                    <td style="padding:5px;">
+                                        '.$agent_name.'
+                                    </td>
+                                    <td style="padding:5px;">
+                                        '.$module_name.'
+                                    </td>
+                                    <td style="padding:5px;">
+                                        '.format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit.'
+                                    </td>
+                                </tr>
+                            </table>';
                 }
 
                 $value .= '
-					</td>
-					<td rowspan="2" width="150px">
-					</td>
-					<td rowspan="2">';
+                    </td>
+                    <td rowspan="2" width="150px">
+                    </td>
+                    <td rowspan="2">';
 
                 if ($content['visual_format'] == 2 || $content['visual_format'] == 3) {
                     $params['force_interval'] = 'max_only';
@@ -4568,23 +4856,23 @@ function reporting_value($report, $content, $type, $pdf=false)
 
                 $value .= '
 
-					</td>
-				</tr>
-				<tr>
-					<td>';
+                    </td>
+                </tr>
+                <tr>
+                    <td>';
 
                 if ($content['visual_format'] == 1 || $content['visual_format'] == 3) {
                     $value .= '
-						<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
-							<tr>
-								<th style="padding:5px;background-color:#82b92e;">
-									'.__('Lapse').'
-								</th>
-								<th style="padding:5px;background-color:#82b92e;">
-									'.__('Maximum').'
-								</th>
-							</tr>
-							<tr>';
+                        <table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
+                            <tr>
+                                <th style="padding:5px;background-color:#82b92e;">
+                                    '.__('Lapse').'
+                                </th>
+                                <th style="padding:5px;background-color:#82b92e;">
+                                    '.__('Maximum').'
+                                </th>
+                            </tr>
+                            <tr>';
                             $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module'], true);
                             $date_reference = getdate();
 
@@ -4658,16 +4946,16 @@ function reporting_value($report, $content, $type, $pdf=false)
                                 </td>
                                 <td style="padding:5px;">
                                     '.format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit.'
-									</td>
-								</tr>
-							</table>';
+                                    </td>
+                                </tr>
+                            </table>';
                 }
 
                         $value .= '
-					</td>
-					<td rowspan="2" width="150px">
-					</td>
-					<td rowspan="2">';
+                    </td>
+                    <td rowspan="2" width="150px">
+                    </td>
+                    <td rowspan="2">';
 
                 if ($content['visual_format'] == 2 || $content['visual_format'] == 3) {
                     $params['force_interval'] = 'min_only';
@@ -4682,16 +4970,16 @@ function reporting_value($report, $content, $type, $pdf=false)
 
                 if ($content['visual_format'] == 1 || $content['visual_format'] == 3) {
                     $value .= '
-						<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
-							<tr>
-								<th style="padding:5px;background-color:#82b92e;">
-									'.__('Lapse').'
-								</th>
-								<th style="padding:5px;background-color:#82b92e;">
-									'.__('Minimum').'
-								</th>
-							</tr>
-							<tr>';
+                        <table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
+                            <tr>
+                                <th style="padding:5px;background-color:#82b92e;">
+                                    '.__('Lapse').'
+                                </th>
+                                <th style="padding:5px;background-color:#82b92e;">
+                                    '.__('Minimum').'
+                                </th>
+                            </tr>
+                            <tr>';
                             $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
                             $date_reference = getdate();
 
@@ -4716,7 +5004,7 @@ function reporting_value($report, $content, $type, $pdf=false)
                 }
 
                 $value .= '
-						
+                        
                             </td>
                         </tr>
                     </table>';
@@ -4745,60 +5033,60 @@ function reporting_value($report, $content, $type, $pdf=false)
 
                 if ($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3) {
                     $value .= '
-							<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
-								<tr>
-									<th style="padding:5px;background-color:#82b92e;">
-										'.__('Agent').'
-									</th>
-									<th style="padding:5px;background-color:#82b92e;">
-										'.__('Module').'
-									</th>
-									<th style="padding:5px;background-color:#82b92e;">
-										'.__('Average').'
-									</th>
-								<tr>
-									<td style="padding:5px;">
-										'.$agent_name.'
-									</td>
-									<td style="padding:5px;">
-										'.$module_name.'
-									</td>
-									<td style="padding:5px;">
-										'.format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit.'
-									</td>
-								</tr>
-							</table>';
+                            <table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
+                                <tr>
+                                    <th style="padding:5px;background-color:#82b92e;">
+                                        '.__('Agent').'
+                                    </th>
+                                    <th style="padding:5px;background-color:#82b92e;">
+                                        '.__('Module').'
+                                    </th>
+                                    <th style="padding:5px;background-color:#82b92e;">
+                                        '.__('Average').'
+                                    </th>
+                                <tr>
+                                    <td style="padding:5px;">
+                                        '.$agent_name.'
+                                    </td>
+                                    <td style="padding:5px;">
+                                        '.$module_name.'
+                                    </td>
+                                    <td style="padding:5px;">
+                                        '.format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit.'
+                                    </td>
+                                </tr>
+                            </table>';
                 }
 
                         $value .= '
-					</td>
-					<td rowspan="2" width="150px">
-					</td>
-					<td rowspan="2">';
+                    </td>
+                    <td rowspan="2" width="150px">
+                    </td>
+                    <td rowspan="2">';
                 if ($content['visual_format'] == 2 || $content['visual_format'] == 3) {
                     $params['force_interval'] = 'avg_only';
                     $value .= grafico_modulo_sparse($params);
                 }
 
                 $value .= '
-					
-					</td>				
-				</tr>
-				<tr>
-					<td>';
+                    
+                    </td>               
+                </tr>
+                <tr>
+                    <td>';
 
                 if ($content['visual_format'] == 1 || $content['visual_format'] == 3) {
                     $value .= '
-						<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
-							<tr>
-								<th style="padding:5px;background-color:#82b92e;">
-									'.__('Lapse').'
-								</th>
-								<th style="padding:5px;background-color:#82b92e;">
-									'.__('Average').'
-								</th>
-							</tr>
-							<tr>';
+                        <table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
+                            <tr>
+                                <th style="padding:5px;background-color:#82b92e;">
+                                    '.__('Lapse').'
+                                </th>
+                                <th style="padding:5px;background-color:#82b92e;">
+                                    '.__('Average').'
+                                </th>
+                            </tr>
+                            <tr>';
                     $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
                     $date_reference = getdate();
 
@@ -4823,7 +5111,7 @@ function reporting_value($report, $content, $type, $pdf=false)
                 }
 
                 $value .= '
-						
+                        
                             </td>
                         </tr>
                     </table>';
@@ -5021,6 +5309,9 @@ function reporting_sql($report, $content)
         $sql = io_safe_output($content['external_source']);
     }
 
+    // Check if exist sql macro
+    $sql = reporting_sql_macro($report, $sql);
+
     // Do a security check on SQL coming from the user.
     $sql = check_sql($sql);
 
@@ -6073,7 +6364,7 @@ function reporting_advanced_sla(
 
         // SLA.
         $return['SLA'] = reporting_sla_get_compliance_from_array($return);
-        $return['SLA_fixed'] = sla_truncate(
+        $return['sla_fixed'] = sla_truncate(
             $return['SLA'],
             $config['graph_precision']
         );
@@ -6134,10 +6425,10 @@ function reporting_availability($report, $content, $date=false, $time=false)
     if (empty($content['subitems'])) {
         $sql = sprintf(
             '
-			SELECT id_agent_module,
-				server_name, operation
-			FROM treport_content_item
-			WHERE id_report_content = %d',
+            SELECT id_agent_module,
+                server_name, operation
+            FROM treport_content_item
+            WHERE id_report_content = %d',
             $content['id_rc']
         );
 
@@ -6173,7 +6464,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
         foreach ($items as $item) {
             // aaMetaconsole connection
             $server_name = $item['server_name'];
-            if (($config['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
+            if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
                 $connection = metaconsole_get_connection($server_name);
                 if (metaconsole_load_external_db($connection) != NOERR) {
                     // ui_print_error_message ("Error connecting to ".$server_name);
@@ -6185,7 +6476,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
                 || modules_is_not_init($item['id_agent_module'])
             ) {
                 // Restore dbconnection
-                if (($config['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
+                if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
                     metaconsole_restore_db();
                 }
 
@@ -6242,7 +6533,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
             $text = $row['data']['agent'].' ('.$text.')';
 
             // Restore dbconnection
-            if (($config['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
+            if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
                 metaconsole_restore_db();
             }
 
@@ -6358,11 +6649,15 @@ function reporting_availability($report, $content, $date=false, $time=false)
 }
 
 
-/**
- * reporting_availability_graph
- *
- *  Generates a structure the report.
- */
+ /**
+  * Reporting_availability_graph.
+  *
+  * @param array   $report  Info report.
+  * @param array   $content Content data.
+  * @param boolean $pdf     Output type PDF.
+  *
+  * @return array Generates a structure the report.
+  */
 function reporting_availability_graph($report, $content, $pdf=false)
 {
     global $config;
@@ -6379,9 +6674,10 @@ function reporting_availability_graph($report, $content, $pdf=false)
 
     $return['title'] = $content['name'];
     $return['description'] = $content['description'];
+    $return['failover_type'] = $content['failover_type'];
     $return['date'] = reporting_get_date_text($report, $content);
 
-    // Get chart
+    // Get chart.
     reporting_set_conf_charts(
         $width,
         $height,
@@ -6396,10 +6692,12 @@ function reporting_availability_graph($report, $content, $pdf=false)
     $edge_interval = 10;
 
     if (empty($content['subitems'])) {
-        $slas = db_get_all_rows_field_filter(
-            'treport_content_sla_combined',
-            'id_report_content',
-            $content['id_rc']
+        $slas = io_safe_output(
+            db_get_all_rows_field_filter(
+                'treport_content_sla_combined',
+                'id_report_content',
+                $content['id_rc']
+            )
         );
     } else {
         $slas = $content['subitems'];
@@ -6423,83 +6721,8 @@ function reporting_availability_graph($report, $content, $pdf=false)
 
         foreach ($slas as $sla) {
             $server_name = $sla['server_name'];
-            // Metaconsole connection
-            if ($metaconsole_on && $server_name != '') {
-                $connection = metaconsole_get_connection($server_name);
-                if (!metaconsole_load_external_db($connection)) {
-                    // ui_print_error_message ("Error connecting to ".$server_name);
-                    continue;
-                }
-            }
 
-            if (modules_is_disable_agent($sla['id_agent_module'])
-                || modules_is_not_init($sla['id_agent_module'])
-            ) {
-                if ($metaconsole_on) {
-                    // Restore db connection
-                    metaconsole_restore_db();
-                }
-
-                continue;
-            }
-
-            // controller min and max == 0 then dinamic min and max critical
-            $dinamic_text = 0;
-            if ($sla['sla_min'] == 0 && $sla['sla_max'] == 0) {
-                $sla['sla_min'] = null;
-                $sla['sla_max'] = null;
-                $dinamic_text = __('Dynamic');
-            }
-
-            // controller inverse interval
-            $inverse_interval = 0;
-            if ((isset($sla['sla_max'])) && (isset($sla['sla_min']))) {
-                if ($sla['sla_max'] < $sla['sla_min']) {
-                    $content_sla_max  = $sla['sla_max'];
-                    $sla['sla_max']   = $sla['sla_min'];
-                    $sla['sla_min']   = $content_sla_max;
-                    $inverse_interval = 1;
-                    $dinamic_text = __('Inverse');
-                }
-            }
-
-            // for graph slice for module-interval, if not slice=0;
-            $module_interval = modules_get_interval($sla['id_agent_module']);
-            $slice = ($content['period'] / $module_interval);
-
-            // call functions sla
-            $sla_array = [];
-            $sla_array = reporting_advanced_sla(
-                $sla['id_agent_module'],
-                ($report['datetime'] - $content['period']),
-                $report['datetime'],
-                $sla['sla_min'],
-                // min_value -> dynamic
-                $sla['sla_max'],
-                // max_value -> dynamic
-                $inverse_interval,
-                // inverse_interval -> dynamic
-                [
-                    '1' => $content['sunday'],
-                    '2' => $content['monday'],
-                    '3' => $content['tuesday'],
-                    '4' => $content['wednesday'],
-                    '5' => $content['thursday'],
-                    '6' => $content['friday'],
-                    '7' => $content['saturday'],
-                ],
-                $content['time_from'],
-                $content['time_to'],
-                $slice
-            );
-
-            if ($metaconsole_on) {
-                // Restore db connection
-                metaconsole_restore_db();
-            }
-
-            $server_name = $sla['server_name'];
-            // Metaconsole connection
+            // Metaconsole connection.
             if ($metaconsole_on && $server_name != '') {
                 $connection = metaconsole_get_connection($server_name);
                 if (metaconsole_connect($connection) != NOERR) {
@@ -6507,199 +6730,149 @@ function reporting_availability_graph($report, $content, $pdf=false)
                 }
             }
 
-            $planned_downtimes = reporting_get_planned_downtimes_intervals($sla['id_agent_module'], ($report['datetime'] - $content['period']), $report['datetime']);
-
-            if ((is_array($planned_downtimes)) && (count($planned_downtimes) > 0)) {
-                // Sort retrieved planned downtimes
-                usort(
-                    $planned_downtimes,
-                    function ($a, $b) {
-                        $a = intval($a['date_from']);
-                        $b = intval($b['date_from']);
-                        if ($a == $b) {
-                            return 0;
+            if ($content['failover_mode']) {
+                $sla_failover = [];
+                $sla_failover['primary'] = $sla;
+                if (isset($sla['id_agent_module_failover']) === true
+                    && $sla['id_agent_module_failover'] != 0
+                ) {
+                    $sla_failover['failover'] = $sla;
+                    $sla_failover['failover']['id_agent_module'] = $sla['id_agent_module_failover'];
+                } else {
+                    $sql_relations = sprintf(
+                        'SELECT module_b
+                        FROM tmodule_relationship
+                        WHERE module_a = %d
+                        AND type = "failover"',
+                        $sla['id_agent_module']
+                    );
+                    $relations = db_get_all_rows_sql($sql_relations);
+                    if (isset($relations) === true
+                        && is_array($relations) === true
+                    ) {
+                        foreach ($relations as $key => $value) {
+                            $sla_failover['failover_'.$key] = $sla;
+                            $sla_failover['failover_'.$key]['id_agent_module'] = $value['module_b'];
                         }
-
-                        return ($a < $b) ? -1 : 1;
                     }
+                }
+
+                // For graph slice for module-interval, if not slice=0.
+                $module_interval = modules_get_interval($sla['id_agent_module']);
+                $slice = ($content['period'] / $module_interval);
+                $data_combined = [];
+
+                foreach ($sla_failover as $k_sla => $v_sla) {
+                    $sla_array = data_db_uncompress_module(
+                        $v_sla,
+                        $content,
+                        $report['datetime'],
+                        $slice
+                    );
+
+                    if ($content['failover_type'] == REPORT_FAILOVER_TYPE_NORMAL) {
+                        $return = prepare_data_for_paint(
+                            $v_sla,
+                            $sla_array,
+                            $content,
+                            $report['datetime'],
+                            $return,
+                            $k_sla,
+                            $pdf
+                        );
+                    }
+
+                    $data_combined[] = $sla_array;
+                }
+
+                if (isset($data_combined) === true
+                    && is_array($data_combined) === true
+                    && count($data_combined) > 0
+                ) {
+                    $count_failover = count($data_combined);
+
+                    $data_a = $data_combined[0];
+                    for ($i = 1; $count_failover > $i; $i++) {
+                        $data_a = array_map(
+                            function ($primary, $failover) {
+                                $return_map = [];
+                                if ($primary['date_from'] === $failover['date_from']
+                                    && $primary['date_to'] === $failover['date_to']
+                                ) {
+                                    if ($primary['time_ok'] < $failover['time_ok']) {
+                                        $primary['time_total'] = $failover['time_total'];
+                                        $primary['time_ok'] = $failover['time_ok'];
+                                        $primary['time_error'] = $failover['time_error'];
+                                        $primary['time_unknown'] = $failover['time_unknown'];
+                                        $primary['time_not_init'] = $failover['time_not_init'];
+                                        $primary['time_downtime'] = $failover['time_downtime'];
+                                        $primary['time_out'] = $failover['time_out'];
+                                        $primary['checks_total'] = $failover['checks_total'];
+                                        $primary['checks_ok'] = $failover['checks_ok'];
+                                        $primary['checks_error'] = $failover['checks_error'];
+                                        $primary['checks_unknown'] = $failover['checks_unknown'];
+                                        $primary['checks_not_init'] = $failover['checks_not_init'];
+                                        $primary['SLA'] = $failover['SLA'];
+                                        $primary['sla_fixed'] = $failover['sla_fixed'];
+                                    }
+
+                                    $return_map = $primary;
+                                }
+
+                                return $return_map;
+                            },
+                            $data_a,
+                            $data_combined[($i)]
+                        );
+                    }
+
+                    $return = prepare_data_for_paint(
+                        $sla,
+                        $data_a,
+                        $content,
+                        $report['datetime'],
+                        $return,
+                        'result',
+                        $pdf
+                    );
+                }
+            } else {
+                $sla_array = data_db_uncompress_module(
+                    $sla,
+                    $content,
+                    $report['datetime']
                 );
 
-                // Compress (overlapped) planned downtimes
-                $npd = count($planned_downtimes);
-                for ($i = 0; $i < $npd; $i++) {
-                    if (isset($planned_downtimes[($i + 1)])) {
-                        if ($planned_downtimes[$i]['date_to'] >= $planned_downtimes[($i + 1)]['date_from']) {
-                            // merge
-                            $planned_downtimes[$i]['date_to'] = $planned_downtimes[($i + 1)]['date_to'];
-                            array_splice($planned_downtimes, ($i + 1), 1);
-                            $npd--;
-                        }
-                    }
-                }
-            } else {
-                $planned_downtimes = null;
+                $return = prepare_data_for_paint(
+                    $sla,
+                    $sla_array,
+                    $content,
+                    $report['datetime'],
+                    $return,
+                    '',
+                    $pdf
+                );
             }
 
-            $data = [];
-            $data['agent']        = modules_get_agentmodule_agent_alias($sla['id_agent_module']);
-            $data['module']       = modules_get_agentmodule_name($sla['id_agent_module']);
-            $data['max']          = $sla['sla_max'];
-            $data['min']          = $sla['sla_min'];
-            $data['sla_limit']    = $sla['sla_limit'];
-            $data['dinamic_text'] = $dinamic_text;
-
-            if (isset($sla_array[0])) {
-                $data['time_total']      = 0;
-                $data['time_ok']         = 0;
-                $data['time_error']      = 0;
-                $data['time_unknown']    = 0;
-                $data['time_not_init']   = 0;
-                $data['time_downtime']   = 0;
-                $data['checks_total']    = 0;
-                $data['checks_ok']       = 0;
-                $data['checks_error']    = 0;
-                $data['checks_unknown']  = 0;
-                $data['checks_not_init'] = 0;
-
-                $raw_graph = [];
-                $i = 0;
-                foreach ($sla_array as $value_sla) {
-                    $data['time_total']      += $value_sla['time_total'];
-                    $data['time_ok']         += $value_sla['time_ok'];
-                    $data['time_error']      += $value_sla['time_error'];
-                    $data['time_unknown']    += $value_sla['time_unknown'];
-                    $data['time_downtime']   += $value_sla['time_downtime'];
-                    $data['time_not_init']   += $value_sla['time_not_init'];
-                    $data['checks_total']    += $value_sla['checks_total'];
-                    $data['checks_ok']       += $value_sla['checks_ok'];
-                    $data['checks_error']    += $value_sla['checks_error'];
-                    $data['checks_unknown']  += $value_sla['checks_unknown'];
-                    $data['checks_not_init'] += $value_sla['checks_not_init'];
-
-                    // generate raw data for graph
-                    $period = reporting_sla_get_status_period($value_sla, $priority_mode);
-                    $raw_graph[$i]['data'] = reporting_translate_sla_status_for_graph($period);
-                    $raw_graph[$i]['utimestamp'] = ($value_sla['date_to'] - $value_sla['date_from']);
-                    $i++;
-                }
-
-                $data['sla_value'] = reporting_sla_get_compliance_from_array($data);
-                $data['sla_fixed'] = sla_truncate($data['sla_value'], $config['graph_precision']);
-            } else {
-                // Show only table not divider in slice for defect slice=1
-                $data['time_total']      = $sla_array['time_total'];
-                $data['time_ok']         = $sla_array['time_ok'];
-                $data['time_error']      = $sla_array['time_error'];
-                $data['time_unknown']    = $sla_array['time_unknown'];
-                $data['time_downtime']   = $sla_array['time_downtime'];
-                $data['time_not_init']   = $sla_array['time_not_init'];
-                $data['checks_total']    = $sla_array['checks_total'];
-                $data['checks_ok']       = $sla_array['checks_ok'];
-                $data['checks_error']    = $sla_array['checks_error'];
-                $data['checks_unknown']  = $sla_array['checks_unknown'];
-                $data['checks_not_init'] = $sla_array['checks_not_init'];
-                $data['sla_value']       = $sla_array['SLA'];
-            }
-
-            // checks whether or not it meets the SLA
-            if ($data['sla_value'] >= $sla['sla_limit']) {
-                $data['sla_status'] = 1;
-                $sla_failed = false;
-            } else {
-                $sla_failed = true;
-                $data['sla_status'] = 0;
-            }
-
-            // Do not show right modules if 'only_display_wrong' is active
-            if ($content['only_display_wrong'] && $sla_failed == false) {
-                continue;
-            }
-
-            // find order
-            $data['order'] = $data['sla_value'];
-            $return['data'][] = $data;
-
-            $data_init = -1;
-            $acum = 0;
-            $sum = 0;
-            $array_result = [];
-            $i = 0;
-            foreach ($raw_graph as $key => $value) {
-                if ($data_init == -1) {
-                    $data_init = $value['data'];
-                    $acum      = $value['utimestamp'];
-                    $sum       = $value['data'];
-                } else {
-                    if ($data_init == $value['data']) {
-                        $acum = ($acum + $value['utimestamp']);
-                        $sum  = ($sum + $value['real_data']);
-                    } else {
-                        $array_result[$i]['data'] = $data_init;
-                        $array_result[$i]['utimestamp'] = $acum;
-                        $array_result[$i]['real_data'] = $sum;
-                        $i++;
-                        $data_init = $value['data'];
-                        $acum = $value['utimestamp'];
-                        $sum = $value['real_data'];
-                    }
-                }
-            }
-
-            $array_result[$i]['data'] = $data_init;
-            $array_result[$i]['utimestamp'] = $acum;
-            $array_result[$i]['real_data'] = $sum;
-
-            // Slice graphs calculation
-            $dataslice = [];
-            $dataslice['agent']        = modules_get_agentmodule_agent_alias($sla['id_agent_module']);
-            $dataslice['module']       = modules_get_agentmodule_name($sla['id_agent_module']);
-            $dataslice['order']        = $data['sla_value'];
-            $dataslice['checks_total'] = $data['checks_total'];
-            $dataslice['checks_ok']    = $data['checks_ok'];
-            $dataslice['time_total']   = $data['time_total'];
-            $dataslice['time_not_init'] = $data['time_not_init'];
-            $dataslice['sla_status']   = $data['sla_status'];
-            $dataslice['sla_value']    = $data['sla_value'];
-
-            $dataslice['chart'] = graph_sla_slicebar(
-                $sla['id_agent_module'],
-                $content['period'],
-                $sla['sla_min'],
-                $sla['sla_max'],
-                $report['datetime'],
-                $content,
-                $content['time_from'],
-                $content['time_to'],
-                100,
-                70,
-                $urlImage,
-                $ttl,
-                $array_result,
-                false
-            );
-
-            $return['charts'][] = $dataslice;
-
             if ($metaconsole_on) {
-                // Restore db connection
+                // Restore db connection.
                 metaconsole_restore_db();
             }
         }
 
-        // SLA items sorted descending ()
+        // SLA items sorted descending.
         if ($content['top_n'] == 2) {
             arsort($return['data']['']);
-        }
-        // SLA items sorted ascending
-        else if ($content['top_n'] == 1) {
+        } else if ($content['top_n'] == 1) {
+            // SLA items sorted ascending.
             asort($sla_showed_values);
         }
 
-        // order data for ascending or descending
+        // Order data for ascending or descending.
         if ($content['top_n'] != 0) {
             switch ($content['top_n']) {
                 case 1:
-                    // order tables
+                    // Order tables.
                     $temp = [];
                     foreach ($return['data'] as $row) {
                         $i = 0;
@@ -6716,7 +6889,7 @@ function reporting_availability_graph($report, $content, $pdf=false)
 
                     $return['data'] = $temp;
 
-                    // order graphs
+                    // Order graphs.
                     $temp = [];
                     foreach ($return['charts'] as $row) {
                         $i = 0;
@@ -6732,11 +6905,10 @@ function reporting_availability_graph($report, $content, $pdf=false)
                     }
 
                     $return['charts'] = $temp;
-
                 break;
 
                 case 2:
-                    // order tables
+                    // Order tables.
                     $temp = [];
                     foreach ($return['data'] as $row) {
                         $i = 0;
@@ -6753,7 +6925,7 @@ function reporting_availability_graph($report, $content, $pdf=false)
 
                     $return['data'] = $temp;
 
-                    // order graph
+                    // Order graph.
                     $temp = [];
                     foreach ($return['charts'] as $row) {
                         $i = 0;
@@ -6769,7 +6941,10 @@ function reporting_availability_graph($report, $content, $pdf=false)
                     }
 
                     $return['charts'] = $temp;
+                break;
 
+                default:
+                    // If not posible.
                 break;
             }
         }
@@ -6779,6 +6954,313 @@ function reporting_availability_graph($report, $content, $pdf=false)
 }
 
 
+/**
+ * Return data db uncompress for module.
+ *
+ * @param array   $sla      Data neccesary for db_uncompress.
+ * @param array   $content  Conetent report.
+ * @param array   $datetime Date.
+ * @param integer $slice    Defined slice.
+ *
+ * @return array
+ */
+function data_db_uncompress_module($sla, $content, $datetime, $slice=0)
+{
+    // Controller min and max == 0 then dinamic min and max critical.
+    $dinamic_text = 0;
+    if ($sla['sla_min'] == 0 && $sla['sla_max'] == 0) {
+        $sla['sla_min'] = null;
+        $sla['sla_max'] = null;
+        $dinamic_text = __('Dynamic');
+    }
+
+    // Controller inverse interval.
+    $inverse_interval = 0;
+    if ((isset($sla['sla_max'])) && (isset($sla['sla_min']))) {
+        if ($sla['sla_max'] < $sla['sla_min']) {
+            $content_sla_max  = $sla['sla_max'];
+            $sla['sla_max']   = $sla['sla_min'];
+            $sla['sla_min']   = $content_sla_max;
+            $inverse_interval = 1;
+            $dinamic_text = __('Inverse');
+        }
+    }
+
+    if ($slice === 0) {
+        // For graph slice for module-interval, if not slice=0.
+        $module_interval = modules_get_interval($sla['id_agent_module']);
+        $slice = ($content['period'] / $module_interval);
+    }
+
+    // Call functions sla.
+    $sla_array = [];
+    $sla_array = reporting_advanced_sla(
+        $sla['id_agent_module'],
+        ($datetime - $content['period']),
+        $datetime,
+        $sla['sla_min'],
+        $sla['sla_max'],
+        $inverse_interval,
+        [
+            '1' => $content['sunday'],
+            '2' => $content['monday'],
+            '3' => $content['tuesday'],
+            '4' => $content['wednesday'],
+            '5' => $content['thursday'],
+            '6' => $content['friday'],
+            '7' => $content['saturday'],
+        ],
+        $content['time_from'],
+        $content['time_to'],
+        $slice
+    );
+
+    return $sla_array;
+}
+
+
+/**
+ * Return array planned downtimes.
+ *
+ * @param integer $id_agent_module Id module.
+ * @param integer $datetime        Date utimestamp.
+ * @param integer $period          Period utimestamp.
+ *
+ * @return array
+ */
+function reporting_get_planned_downtimes_sla($id_agent_module, $datetime, $period)
+{
+    $planned_downtimes = reporting_get_planned_downtimes_intervals(
+        $id_agent_module,
+        ($datetime - $period),
+        $datetime
+    );
+
+    if ((is_array($planned_downtimes))
+        && (count($planned_downtimes) > 0)
+    ) {
+        // Sort retrieved planned downtimes.
+        usort(
+            $planned_downtimes,
+            function ($a, $b) {
+                $a = intval($a['date_from']);
+                $b = intval($b['date_from']);
+                if ($a == $b) {
+                    return 0;
+                }
+
+                return ($a < $b) ? (-1) : 1;
+            }
+        );
+
+        // Compress (overlapped) planned downtimes.
+        $npd = count($planned_downtimes);
+        for ($i = 0; $i < $npd; $i++) {
+            if (isset($planned_downtimes[($i + 1)])) {
+                if ($planned_downtimes[$i]['date_to'] >= $planned_downtimes[($i + 1)]['date_from']) {
+                    // Merge.
+                    $planned_downtimes[$i]['date_to'] = $planned_downtimes[($i + 1)]['date_to'];
+                    array_splice($planned_downtimes, ($i + 1), 1);
+                    $npd--;
+                }
+            }
+        }
+    } else {
+        $planned_downtimes = [];
+    }
+
+    return $planned_downtimes;
+}
+
+
+/**
+ * Prepare data for Paint in report.
+ *
+ * @param array   $sla       Data Module to sla.
+ * @param array   $sla_array Data uncompressed.
+ * @param array   $content   Content report data.
+ * @param integer $datetime  Date.
+ * @param array   $return    Array return.
+ * @param string  $failover  Type primary, failover, Result.
+ * @param boolean $pdf       Chart pdf mode.
+ *
+ * @return array Return modify.
+ */
+function prepare_data_for_paint(
+    $sla,
+    $sla_array,
+    $content,
+    $datetime,
+    $return,
+    $failover='',
+    $pdf=false
+) {
+    $data = [];
+    $alias_agent = modules_get_agentmodule_agent_alias(
+        $sla['id_agent_module']
+    );
+    $name_module = modules_get_agentmodule_name(
+        $sla['id_agent_module']
+    );
+
+    $data['agent'] = $alias_agent;
+    $data['module'] = $name_module;
+    $data['max'] = $sla['sla_max'];
+    $data['min'] = $sla['sla_min'];
+    $data['sla_limit'] = $sla['sla_limit'];
+    $data['dinamic_text'] = $dinamic_text;
+    $data['failover'] = $failover;
+    if (isset($sla_array[0])) {
+        $data['time_total']      = 0;
+        $data['time_ok']         = 0;
+        $data['time_error']      = 0;
+        $data['time_unknown']    = 0;
+        $data['time_not_init']   = 0;
+        $data['time_downtime']   = 0;
+        $data['checks_total']    = 0;
+        $data['checks_ok']       = 0;
+        $data['checks_error']    = 0;
+        $data['checks_unknown']  = 0;
+        $data['checks_not_init'] = 0;
+
+        $raw_graph = [];
+        $i = 0;
+        foreach ($sla_array as $value_sla) {
+            $data['time_total']      += $value_sla['time_total'];
+            $data['time_ok']         += $value_sla['time_ok'];
+            $data['time_error']      += $value_sla['time_error'];
+            $data['time_unknown']    += $value_sla['time_unknown'];
+            $data['time_downtime']   += $value_sla['time_downtime'];
+            $data['time_not_init']   += $value_sla['time_not_init'];
+            $data['checks_total']    += $value_sla['checks_total'];
+            $data['checks_ok']       += $value_sla['checks_ok'];
+            $data['checks_error']    += $value_sla['checks_error'];
+            $data['checks_unknown']  += $value_sla['checks_unknown'];
+            $data['checks_not_init'] += $value_sla['checks_not_init'];
+
+            // Generate raw data for graph.
+            $period = reporting_sla_get_status_period(
+                $value_sla,
+                $priority_mode
+            );
+            $raw_graph[$i]['data'] = reporting_translate_sla_status_for_graph(
+                $period
+            );
+            $raw_graph[$i]['utimestamp'] = ($value_sla['date_to'] - $value_sla['date_from']);
+            $i++;
+        }
+
+        $data['sla_value'] = reporting_sla_get_compliance_from_array(
+            $data
+        );
+        $data['sla_fixed'] = sla_truncate(
+            $data['sla_value'],
+            $config['graph_precision']
+        );
+    } else {
+        // Show only table not divider in slice for defect slice=1.
+        $data['time_total']      = $sla_array['time_total'];
+        $data['time_ok']         = $sla_array['time_ok'];
+        $data['time_error']      = $sla_array['time_error'];
+        $data['time_unknown']    = $sla_array['time_unknown'];
+        $data['time_downtime']   = $sla_array['time_downtime'];
+        $data['time_not_init']   = $sla_array['time_not_init'];
+        $data['checks_total']    = $sla_array['checks_total'];
+        $data['checks_ok']       = $sla_array['checks_ok'];
+        $data['checks_error']    = $sla_array['checks_error'];
+        $data['checks_unknown']  = $sla_array['checks_unknown'];
+        $data['checks_not_init'] = $sla_array['checks_not_init'];
+        $data['sla_value']       = $sla_array['SLA'];
+    }
+
+    // Checks whether or not it meets the SLA.
+    if ($data['sla_value'] >= $sla['sla_limit']) {
+        $data['sla_status'] = 1;
+        $sla_failed = false;
+    } else {
+        $sla_failed = true;
+        $data['sla_status'] = 0;
+    }
+
+    // Do not show right modules if 'only_display_wrong' is active.
+    if ($content['only_display_wrong'] && $sla_failed == false) {
+        return $return;
+    }
+
+    // Find order.
+    $data['order'] = $data['sla_value'];
+    $return['data'][] = $data;
+
+    $data_init = -1;
+    $acum = 0;
+    $sum = 0;
+    $array_result = [];
+    $i = 0;
+    foreach ($raw_graph as $key => $value) {
+        if ($data_init == -1) {
+            $data_init = $value['data'];
+            $acum      = $value['utimestamp'];
+            $sum       = $value['data'];
+        } else {
+            if ($data_init == $value['data']) {
+                $acum = ($acum + $value['utimestamp']);
+                $sum  = ($sum + $value['real_data']);
+            } else {
+                $array_result[$i]['data'] = $data_init;
+                $array_result[$i]['utimestamp'] = $acum;
+                $array_result[$i]['real_data'] = $sum;
+                $i++;
+                $data_init = $value['data'];
+                $acum = $value['utimestamp'];
+                $sum = $value['real_data'];
+            }
+        }
+    }
+
+    $array_result[$i]['data'] = $data_init;
+    $array_result[$i]['utimestamp'] = $acum;
+    $array_result[$i]['real_data'] = $sum;
+
+    // Slice graphs calculation.
+    $dataslice = [];
+    $dataslice['agent'] = $alias_agent;
+    $dataslice['module'] = $name_module;
+    $dataslice['order'] = $data['sla_value'];
+    $dataslice['checks_total'] = $data['checks_total'];
+    $dataslice['checks_ok'] = $data['checks_ok'];
+    $dataslice['time_total'] = $data['time_total'];
+    $dataslice['time_not_init'] = $data['time_not_init'];
+    $dataslice['sla_status'] = $data['sla_status'];
+    $dataslice['sla_value'] = $data['sla_value'];
+
+    $height = 80;
+    if ($failover !== '' && $failover !== 'result') {
+        $height = 50;
+    }
+
+    $dataslice['chart'] = graph_sla_slicebar(
+        $sla['id_agent_module'],
+        $content['period'],
+        $sla['sla_min'],
+        $sla['sla_max'],
+        $datetime,
+        $content,
+        $content['time_from'],
+        $content['time_to'],
+        100,
+        $height,
+        $urlImage,
+        ($pdf) ? 2 : 0,
+        $array_result,
+        false
+    );
+
+    $return['charts'][] = $dataslice;
+
+    return $return;
+}
+
+
 /**
  * reporting_increment
  *
@@ -6807,15 +7289,15 @@ function reporting_increment($report, $content)
 
     $return['data'] = [];
 
-    if (defined('METACONSOLE')) {
+    if (is_metaconsole()) {
         $sql1 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' 
-									 AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC';
+                                     AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC';
         $sql2 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC';
 
         $servers = db_get_all_rows_sql(
             'SELECT *
-		FROM tmetaconsole_setup
-		WHERE disabled = 0'
+        FROM tmetaconsole_setup
+        WHERE disabled = 0'
         );
 
         if ($servers === false) {
@@ -6839,13 +7321,13 @@ function reporting_increment($report, $content)
     } else {
         $old_data = db_get_value_sql(
             'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' 
-									 AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC'
+                                     AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC'
         );
 
         $last_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC');
     }
 
-    if (!defined('METACONSOLE')) {
+    if (!is_metaconsole()) {
     }
 
     if ($old_data === false || $last_data === false) {
@@ -6934,7 +7416,7 @@ function reporting_general($report, $content)
     foreach ($generals as $row) {
         // Metaconsole connection
         $server_name = $row['server_name'];
-        if (($config['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
+        if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
             $connection = metaconsole_get_connection($server_name);
             if (metaconsole_load_external_db($connection) != NOERR) {
                 // ui_print_error_message ("Error connecting to ".$server_name);
@@ -6955,6 +7437,7 @@ function reporting_general($report, $content)
 
         $mod_name = modules_get_agentmodule_name($row['id_agent_module']);
         $ag_name = modules_get_agentmodule_agent_alias($row['id_agent_module']);
+        $name_agent = modules_get_agentmodule_agent_name($row['id_agent_module']);
         $type_mod = modules_get_last_value($row['id_agent_module']);
         $is_string[$index] = modules_is_string($row['id_agent_module']);
         $unit = db_get_value(
@@ -7029,12 +7512,12 @@ function reporting_general($report, $content)
                 }
 
                 if ($data_res[$index] === false) {
-                    $return['data'][$ag_name][$mod_name] = null;
+                    $return['data'][$name_agent][$mod_name] = null;
                 } else {
                     if (!is_numeric($data_res[$index])) {
-                        $return['data'][$ag_name][$mod_name] = $data_res[$index];
+                        $return['data'][$name_agent][$mod_name] = $data_res[$index];
                     } else {
-                        $return['data'][$ag_name][$mod_name] = format_for_graph($data_res[$index], 2).' '.$unit;
+                        $return['data'][$name_agent][$mod_name] = format_for_graph($data_res[$index], 2).' '.$unit;
                     }
                 }
             break;
@@ -7085,7 +7568,7 @@ function reporting_general($report, $content)
         $i++;
 
         // Restore dbconnection
-        if (($config['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
+        if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
             metaconsole_restore_db();
         }
     }
@@ -7262,8 +7745,8 @@ function reporting_custom_graph(
         if (is_metaconsole()) {
             $module_source = db_get_all_rows_sql(
                 'SELECT id_agent_module, id_server
-			FROM tgraph_source
-			WHERE id_graph = '.$content['id_gs']
+            FROM tgraph_source
+            WHERE id_graph = '.$content['id_gs']
             );
 
             if (isset($module_source) && is_array($module_source)) {
@@ -7337,6 +7820,17 @@ function reporting_custom_graph(
 }
 
 
+/**
+ * Simple graph report.
+ *
+ * @param array   $report             Info report.
+ * @param array   $content            Content report.
+ * @param string  $type               Type report.
+ * @param integer $force_width_chart  Width chart.
+ * @param integer $force_height_chart Height chart.
+ *
+ * @return array
+ */
 function reporting_simple_graph(
     $report,
     $content,
@@ -7346,13 +7840,6 @@ function reporting_simple_graph(
 ) {
     global $config;
 
-    if ($config['metaconsole']) {
-        $id_meta = metaconsole_get_id_server($content['server_name']);
-
-        $server = metaconsole_get_connection_by_id($id_meta);
-        metaconsole_connect($server);
-    }
-
     $return = [];
     $return['type'] = 'simple_graph';
 
@@ -7360,16 +7847,52 @@ function reporting_simple_graph(
         $content['name'] = __('Simple graph');
     }
 
-    $module_name = io_safe_output(
-        modules_get_agentmodule_name($content['id_agent_module'])
+    if ($config['metaconsole']) {
+        $id_meta = metaconsole_get_id_server($content['server_name']);
+
+        $server = metaconsole_get_connection_by_id($id_meta);
+        metaconsole_connect($server);
+    }
+
+    $id_agent = agents_get_module_id(
+        $content['id_agent_module']
     );
-    $agent_name = io_safe_output(
-        modules_get_agentmodule_agent_alias($content['id_agent_module'])
+    $id_agent_module = $content['id_agent_module'];
+    $agent_description = agents_get_description($id_agent);
+    $agent_group = agents_get_agent_group($id_agent);
+    $agent_address = agents_get_address($id_agent);
+    $agent_alias = agents_get_alias($id_agent);
+    $module_name = modules_get_agentmodule_name(
+        $id_agent_module
     );
 
+    $module_description = modules_get_agentmodule_descripcion(
+        $id_agent_module
+    );
+
+    $items_label = [
+        'type'               => $return['type'],
+        'id_agent'           => $id_agent,
+        'id_agent_module'    => $id_agent_module,
+        'agent_description'  => $agent_description,
+        'agent_group'        => $agent_group,
+        'agent_address'      => $agent_address,
+        'agent_alias'        => $agent_alias,
+        'module_name'        => $module_name,
+        'module_description' => $module_description,
+    ];
+
+    $label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
+    if ($label != '') {
+        $label = reporting_label_macro(
+            $items_label,
+            $label
+        );
+    }
+
     $return['title'] = $content['name'];
-    $return['subtitle'] = $agent_name.' - '.$module_name;
-    $return['agent_name'] = $agent_name;
+    $return['subtitle'] = $agent_alias.' - '.$module_name;
+    $return['agent_name'] = $agent_alias;
     $return['module_name'] = $module_name;
     $return['description'] = $content['description'];
     $return['date'] = reporting_get_date_text(
@@ -7377,11 +7900,6 @@ function reporting_simple_graph(
         $content
     );
 
-    $label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
-    if ($label != '') {
-        $label = reporting_label_macro($content, $label);
-    }
-
     if (isset($content['style']['fullscale'])) {
         $fullscale = (bool) $content['style']['fullscale'];
     }
@@ -7389,7 +7907,14 @@ function reporting_simple_graph(
     $return['chart'] = '';
 
     // Get chart.
-    reporting_set_conf_charts($width, $height, $only_image, $type, $content, $ttl);
+    reporting_set_conf_charts(
+        $width,
+        $height,
+        $only_image,
+        $type,
+        $content,
+        $ttl
+    );
 
     if (!empty($force_width_chart)) {
         $width = $force_width_chart;
@@ -7415,7 +7940,12 @@ function reporting_simple_graph(
                 'pure'            => false,
                 'date'            => $report['datetime'],
                 'only_image'      => $only_image,
-                'homeurl'         => ui_get_full_url(false, false, false, false),
+                'homeurl'         => ui_get_full_url(
+                    false,
+                    false,
+                    false,
+                    false
+                ),
                 'ttl'             => $ttl,
                 'compare'         => $time_compare_overlapped,
                 'show_unknown'    => true,
@@ -7426,7 +7956,6 @@ function reporting_simple_graph(
             ];
 
             $return['chart'] = grafico_modulo_sparse($params);
-
         break;
 
         case 'data':
@@ -7440,6 +7969,10 @@ function reporting_simple_graph(
                 $return['chart'][$d['utimestamp']] = $d['data'];
             }
         break;
+
+        default:
+            // Not Possible.
+        break;
     }
 
     if ($config['metaconsole']) {
@@ -8001,10 +8534,10 @@ function reporting_get_group_stats($id_group=0, $access='AR')
         foreach ($id_group as $group) {
             $group_stat = db_get_all_rows_sql(
                 "SELECT *
-				FROM tgroup_stat, tgrupo
-				WHERE tgrupo.id_grupo = tgroup_stat.id_group
-					AND tgroup_stat.id_group = $group
-				ORDER BY nombre"
+                FROM tgroup_stat, tgrupo
+                WHERE tgrupo.id_grupo = tgroup_stat.id_group
+                    AND tgroup_stat.id_group = $group
+                ORDER BY nombre"
             );
 
             $data['monitor_checks'] += $group_stat[0]['modules'];
@@ -8232,10 +8765,10 @@ function reporting_get_group_stats_resume($id_group=0, $access='AR')
         foreach ($id_group as $group) {
             $group_stat = db_get_all_rows_sql(
                 "SELECT *
-				FROM tgroup_stat, tgrupo
-				WHERE tgrupo.id_grupo = tgroup_stat.id_group
-					AND tgroup_stat.id_group = $group
-				ORDER BY nombre"
+                FROM tgroup_stat, tgrupo
+                WHERE tgrupo.id_grupo = tgroup_stat.id_group
+                    AND tgroup_stat.id_group = $group
+                ORDER BY nombre"
             );
 
             $data['monitor_checks'] += $group_stat[0]['modules'];
@@ -8270,8 +8803,8 @@ function reporting_get_group_stats_resume($id_group=0, $access='AR')
             $tags = db_get_value('tags', 'tusuario_perfil', 'id_usuario', $config['id_user']);
             if ($tags) {
                 $tags_sql = " AND tae.id_agente_modulo IN ( SELECT id_agente_modulo 
-				                                           FROM ttag_module 
-				                                           WHERE id_tag IN ($tags) ) ";
+                                                           FROM ttag_module 
+                                                           WHERE id_tag IN ($tags) ) ";
             } else {
                 $tags_sql = '';
             }
@@ -8282,27 +8815,27 @@ function reporting_get_group_stats_resume($id_group=0, $access='AR')
 
             // for stats modules
             $sql = "SELECT tg.id_grupo as id, tg.nombre as name, 
-    				SUM(tae.estado=0) as monitor_ok,
-    				SUM(tae.estado=1) as monitor_critical,
-    				SUM(tae.estado=2) as monitor_warning,
-    				SUM(tae.estado=3) as monitor_unknown,
-    				SUM(tae.estado=4) as monitor_not_init,
-    				COUNT(tae.estado) as monitor_total
+                    SUM(tae.estado=0) as monitor_ok,
+                    SUM(tae.estado=1) as monitor_critical,
+                    SUM(tae.estado=2) as monitor_warning,
+                    SUM(tae.estado=3) as monitor_unknown,
+                    SUM(tae.estado=4) as monitor_not_init,
+                    COUNT(tae.estado) as monitor_total
 
-					FROM
-    					tagente_estado tae,
-    					tagente        ta,
-    					tagente_modulo tam,
-    					tgrupo         tg
+                    FROM
+                        tagente_estado tae,
+                        tagente        ta,
+                        tagente_modulo tam,
+                        tgrupo         tg
     
-					WHERE 1=1
-    					AND tae.id_agente = ta.id_agente
-       					AND tae.id_agente_modulo = tam.id_agente_modulo
-    					AND ta.id_grupo = tg.id_grupo
-    					AND tam.disabled = 0
-    					AND ta.disabled = 0
-    					AND ta.id_grupo IN ($id_group) $tags_sql 
-					GROUP BY tg.id_grupo;";
+                    WHERE 1=1
+                        AND tae.id_agente = ta.id_agente
+                        AND tae.id_agente_modulo = tam.id_agente_modulo
+                        AND ta.id_grupo = tg.id_grupo
+                        AND tam.disabled = 0
+                        AND ta.disabled = 0
+                        AND ta.id_grupo IN ($id_group) $tags_sql 
+                    GROUP BY tg.id_grupo;";
             $data_array = db_get_all_rows_sql($sql);
 
             $data = $data_array[0];
@@ -8315,27 +8848,27 @@ function reporting_get_group_stats_resume($id_group=0, $access='AR')
 
             // for stats agents
             $sql = "SELECT tae.id_agente id_agente, tg.id_grupo id_grupo,
-    				SUM(tae.estado=0) as monitor_agent_ok,
-    				SUM(tae.estado=1) as monitor_agent_critical,
-    				SUM(tae.estado=2) as monitor_agent_warning,
-				    SUM(tae.estado=3) as monitor_agent_unknown,
-				    SUM(tae.estado=4) as monitor_agent_not_init,
-				    COUNT(tae.estado) as monitor_agent_total
+                    SUM(tae.estado=0) as monitor_agent_ok,
+                    SUM(tae.estado=1) as monitor_agent_critical,
+                    SUM(tae.estado=2) as monitor_agent_warning,
+                    SUM(tae.estado=3) as monitor_agent_unknown,
+                    SUM(tae.estado=4) as monitor_agent_not_init,
+                    COUNT(tae.estado) as monitor_agent_total
 
-				FROM
-				    tagente_estado tae,
-				    tagente        ta,
-				    tagente_modulo tam,
-				    tgrupo         tg
-				    
-				WHERE 1=1
-				    AND tae.id_agente = ta.id_agente
-				    AND tae.id_agente_modulo = tam.id_agente_modulo
-				    AND ta.id_grupo = tg.id_grupo
-				    AND tam.disabled = 0
-				    AND ta.disabled = 0
-				    AND ta.id_grupo IN ($id_group) $tags_sql
-				GROUP BY tae.id_agente;";
+                FROM
+                    tagente_estado tae,
+                    tagente        ta,
+                    tagente_modulo tam,
+                    tgrupo         tg
+                    
+                WHERE 1=1
+                    AND tae.id_agente = ta.id_agente
+                    AND tae.id_agente_modulo = tam.id_agente_modulo
+                    AND ta.id_grupo = tg.id_grupo
+                    AND tam.disabled = 0
+                    AND ta.disabled = 0
+                    AND ta.id_grupo IN ($id_group) $tags_sql
+                GROUP BY tae.id_agente;";
             $data_array_2 = db_get_all_rows_sql($sql);
 
             if (is_array($data_array_2) || is_object($data_array_2)) {
@@ -8446,22 +8979,22 @@ function reporting_get_stats_indicators($data, $width=280, $height=20, $html=tru
 
     if ($html) {
         $tdata[0] = '<fieldset class="databox tactical_set">
-						<legend>'.__('Server health').ui_print_help_tip(sprintf(__('%d Downed servers'), $servers['down']), true).'</legend>'.progress_bar($servers['health'], $width, $height, '', 0).'</fieldset>';
+                        <legend>'.__('Server health').ui_print_help_tip(sprintf(__('%d Downed servers'), $servers['down']), true).'</legend>'.progress_bar($servers['health'], $width, $height, '', 0).'</fieldset>';
         $table_ind->rowclass[] = '';
         $table_ind->data[] = $tdata;
 
         $tdata[0] = '<fieldset class="databox tactical_set">
-						<legend>'.__('Monitor health').ui_print_help_tip(sprintf(__('%d Not Normal monitors'), $data['monitor_not_normal']), true).'</legend>'.progress_bar($data['monitor_health'], $width, $height, $data['monitor_health'].'% '.__('of monitors up'), 0).'</fieldset>';
+                        <legend>'.__('Monitor health').ui_print_help_tip(sprintf(__('%d Not Normal monitors'), $data['monitor_not_normal']), true).'</legend>'.progress_bar($data['monitor_health'], $width, $height, $data['monitor_health'].'% '.__('of monitors up'), 0).'</fieldset>';
         $table_ind->rowclass[] = '';
         $table_ind->data[] = $tdata;
 
         $tdata[0] = '<fieldset class="databox tactical_set">
-						<legend>'.__('Module sanity').ui_print_help_tip(sprintf(__('%d Not inited monitors'), $data['monitor_not_init']), true).'</legend>'.progress_bar($data['module_sanity'], $width, $height, $data['module_sanity'].'% '.__('of total modules inited'), 0).'</fieldset>';
+                        <legend>'.__('Module sanity').ui_print_help_tip(sprintf(__('%d Not inited monitors'), $data['monitor_not_init']), true).'</legend>'.progress_bar($data['module_sanity'], $width, $height, $data['module_sanity'].'% '.__('of total modules inited'), 0).'</fieldset>';
         $table_ind->rowclass[] = '';
         $table_ind->data[] = $tdata;
 
         $tdata[0] = '<fieldset class="databox tactical_set">
-						<legend>'.__('Alert level').ui_print_help_tip(sprintf(__('%d Fired alerts'), $data['monitor_alerts_fired']), true).'</legend>'.progress_bar($data['alert_level'], $width, $height, $data['alert_level'].'% '.__('of defined alerts not fired'), 0).'</fieldset>';
+                        <legend>'.__('Alert level').ui_print_help_tip(sprintf(__('%d Fired alerts'), $data['monitor_alerts_fired']), true).'</legend>'.progress_bar($data['alert_level'], $width, $height, $data['alert_level'].'% '.__('of defined alerts not fired'), 0).'</fieldset>';
         $table_ind->rowclass[] = '';
         $table_ind->data[] = $tdata;
 
@@ -8544,7 +9077,7 @@ function reporting_get_stats_alerts($data, $links=false)
 
     if (!is_metaconsole()) {
         $output = '<fieldset class="databox tactical_set">
-					<legend>'.__('Defined and fired alerts').'</legend>'.html_print_table($table_al, true).'</fieldset>';
+                    <legend>'.__('Defined and fired alerts').'</legend>'.html_print_table($table_al, true).'</fieldset>';
     } else {
         // Remove the defined alerts cause with the new cache table is difficult to retrieve them
         unset($table_al->data[0][0], $table_al->data[0][1]);
@@ -8552,7 +9085,7 @@ function reporting_get_stats_alerts($data, $links=false)
         $table_al->class = 'tactical_view';
         $table_al->style = [];
         $output = '<fieldset class="tactical_set">
-					<legend>'.__('Fired alerts').'</legend>'.html_print_table($table_al, true).'</fieldset>';
+                    <legend>'.__('Fired alerts').'</legend>'.html_print_table($table_al, true).'</fieldset>';
     }
 
     return $output;
@@ -8628,14 +9161,14 @@ function reporting_get_stats_modules_status($data, $graph_width=250, $graph_heig
 
     if (!is_metaconsole()) {
         $output = '
-			<fieldset class="databox tactical_set">
-				<legend>'.__('Monitors by status').'</legend>'.html_print_table($table_mbs, true).'</fieldset>';
+            <fieldset class="databox tactical_set">
+                <legend>'.__('Monitors by status').'</legend>'.html_print_table($table_mbs, true).'</fieldset>';
     } else {
         $table_mbs->class = 'tactical_view';
         $table_mbs->style = [];
         $output = '
-			<fieldset class="tactical_set">
-				<legend>'.__('Monitors by status').'</legend>'.html_print_table($table_mbs, true).'</fieldset>';
+            <fieldset class="tactical_set">
+                <legend>'.__('Monitors by status').'</legend>'.html_print_table($table_mbs, true).'</fieldset>';
     }
 
     return $output;
@@ -8701,7 +9234,7 @@ function reporting_get_stats_agents_monitors($data)
     $table_am->data[] = $tdata;
 
     $output = '<fieldset class="databox tactical_set">
-				<legend>'.__('Total agents and monitors').'</legend>'.html_print_table($table_am, true).'</fieldset>';
+                <legend>'.__('Total agents and monitors').'</legend>'.html_print_table($table_am, true).'</fieldset>';
 
     return $output;
 }
@@ -8732,7 +9265,7 @@ function reporting_get_stats_users($data)
     $table_us->data[] = $tdata;
 
     $output = '<fieldset class="databox tactical_set">
-				<legend>'.__('Users').'</legend>'.html_print_table($table_us, true).'</fieldset>';
+                <legend>'.__('Users').'</legend>'.html_print_table($table_us, true).'</fieldset>';
 
     return $output;
 }
@@ -8767,8 +9300,8 @@ function reporting_get_agentmodule_data_average($id_agent_module, $period=0, $da
     // Get module data
     $interval_data = db_get_all_rows_sql(
         'SELECT *
-		FROM tagente_datos 
-		WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
+        FROM tagente_datos 
+        WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
         $search_in_history_db
     );
     if ($interval_data === false) {
@@ -8893,8 +9426,8 @@ function reporting_get_agentmodule_mttr($id_agent_module, $period=0, $date=0)
 
     $module = db_get_row_sql(
         'SELECT max_critical, min_critical, id_tipo_modulo
-		FROM tagente_modulo
-		WHERE id_agente_modulo = '.(int) $id_agent_module
+        FROM tagente_modulo
+        WHERE id_agente_modulo = '.(int) $id_agent_module
     );
     if ($module === false) {
         return false;
@@ -8915,7 +9448,7 @@ function reporting_get_agentmodule_mttr($id_agent_module, $period=0, $date=0)
     // Get module data
     $interval_data = db_get_all_rows_sql(
         'SELECT * FROM tagente_datos 
-		WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
+        WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
         $search_in_history_db
     );
     if ($interval_data === false) {
@@ -9039,8 +9572,8 @@ function reporting_get_agentmodule_mtbf($id_agent_module, $period=0, $date=0)
 
     $module = db_get_row_sql(
         'SELECT max_critical, min_critical, id_tipo_modulo
-		FROM tagente_modulo
-		WHERE id_agente_modulo = '.(int) $id_agent_module
+        FROM tagente_modulo
+        WHERE id_agente_modulo = '.(int) $id_agent_module
     );
     if ($module === false) {
         return false;
@@ -9061,7 +9594,7 @@ function reporting_get_agentmodule_mtbf($id_agent_module, $period=0, $date=0)
     // Get module data
     $interval_data = db_get_all_rows_sql(
         'SELECT * FROM tagente_datos 
-		WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
+        WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
         $search_in_history_db
     );
     if ($interval_data === false) {
@@ -9181,8 +9714,8 @@ function reporting_get_agentmodule_tto($id_agent_module, $period=0, $date=0)
 
     $module = db_get_row_sql(
         'SELECT max_critical, min_critical, id_tipo_modulo
-		FROM tagente_modulo
-		WHERE id_agente_modulo = '.(int) $id_agent_module
+        FROM tagente_modulo
+        WHERE id_agente_modulo = '.(int) $id_agent_module
     );
     if ($module === false) {
         return false;
@@ -9203,7 +9736,7 @@ function reporting_get_agentmodule_tto($id_agent_module, $period=0, $date=0)
     // Get module data
     $interval_data = db_get_all_rows_sql(
         'SELECT * FROM tagente_datos 
-		WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
+        WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
         $search_in_history_db
     );
     if ($interval_data === false) {
@@ -9290,8 +9823,8 @@ function reporting_get_agentmodule_ttr($id_agent_module, $period=0, $date=0)
 
     $module = db_get_row_sql(
         'SELECT max_critical, min_critical, id_tipo_modulo
-		FROM tagente_modulo
-		WHERE id_agente_modulo = '.(int) $id_agent_module
+        FROM tagente_modulo
+        WHERE id_agente_modulo = '.(int) $id_agent_module
     );
     if ($module === false) {
         return false;
@@ -9312,7 +9845,7 @@ function reporting_get_agentmodule_ttr($id_agent_module, $period=0, $date=0)
     // Get module data
     $interval_data = db_get_all_rows_sql(
         'SELECT * FROM tagente_datos 
-		WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
+        WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
         $search_in_history_db
     );
     if ($interval_data === false) {
@@ -9761,9 +10294,9 @@ function reporting_get_agentmodule_sla(
         // Get interval data
         $sql = sprintf(
             'SELECT *
-			FROM tagente_datos
-			WHERE id_agente_modulo = %d
-				AND utimestamp > %d AND utimestamp <= %d',
+            FROM tagente_datos
+            WHERE id_agente_modulo = %d
+                AND utimestamp > %d AND utimestamp <= %d',
             $id_agent_module,
             $datelimit,
             $date
@@ -9982,43 +10515,43 @@ function reporting_get_planned_downtimes_intervals($id_agent_module, $start_date
     }
 
     $sql_downtime = '
-		SELECT DISTINCT(tpdr.id),
-				tpdr.name,
-				'.$tpdr_description.",
-				tpdr.date_from,
-				tpdr.date_to,
-				tpdr.executed,
-				tpdr.id_group,
-				tpdr.only_alerts,
-				tpdr.monday,
-				tpdr.tuesday,
-				tpdr.wednesday,
-				tpdr.thursday,
-				tpdr.friday,
-				tpdr.saturday,
-				tpdr.sunday,
-				tpdr.periodically_time_from,
-				tpdr.periodically_time_to,
-				tpdr.periodically_day_from,
-				tpdr.periodically_day_to,
-				tpdr.type_downtime,
-				tpdr.type_execution,
-				tpdr.type_periodicity,
-				tpdr.id_user
-		FROM (
-				SELECT tpd.*
-				FROM tplanned_downtime tpd, tplanned_downtime_agents tpda, tagente_modulo tam
-				WHERE tpd.id = tpda.id_downtime
-					AND tpda.all_modules = 1
-					AND tpda.id_agent = tam.id_agente
-					AND tam.id_agente_modulo = $id_agent_module
-			UNION ALL
-				SELECT tpd.*
-				FROM tplanned_downtime tpd, tplanned_downtime_modules tpdm
-				WHERE tpd.id = tpdm.id_downtime
-					AND tpdm.id_agent_module = $id_agent_module
-		) tpdr
-		ORDER BY tpdr.id";
+        SELECT DISTINCT(tpdr.id),
+                tpdr.name,
+                '.$tpdr_description.",
+                tpdr.date_from,
+                tpdr.date_to,
+                tpdr.executed,
+                tpdr.id_group,
+                tpdr.only_alerts,
+                tpdr.monday,
+                tpdr.tuesday,
+                tpdr.wednesday,
+                tpdr.thursday,
+                tpdr.friday,
+                tpdr.saturday,
+                tpdr.sunday,
+                tpdr.periodically_time_from,
+                tpdr.periodically_time_to,
+                tpdr.periodically_day_from,
+                tpdr.periodically_day_to,
+                tpdr.type_downtime,
+                tpdr.type_execution,
+                tpdr.type_periodicity,
+                tpdr.id_user
+        FROM (
+                SELECT tpd.*
+                FROM tplanned_downtime tpd, tplanned_downtime_agents tpda, tagente_modulo tam
+                WHERE tpd.id = tpda.id_downtime
+                    AND tpda.all_modules = 1
+                    AND tpda.id_agent = tam.id_agente
+                    AND tam.id_agente_modulo = $id_agent_module
+            UNION ALL
+                SELECT tpd.*
+                FROM tplanned_downtime tpd, tplanned_downtime_modules tpdm
+                WHERE tpd.id = tpdm.id_downtime
+                    AND tpdm.id_agent_module = $id_agent_module
+        ) tpdr
+        ORDER BY tpdr.id";
 
     $downtimes = db_get_all_rows_sql($sql_downtime);
 
@@ -10227,8 +10760,8 @@ function reporting_get_agentmodule_data_max($id_agent_module, $period=0, $date=0
     // Get module data
     $interval_data = db_get_all_rows_sql(
         'SELECT *
-		FROM tagente_datos 
-		WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
+        FROM tagente_datos 
+        WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
         $search_in_history_db
     );
 
@@ -10333,8 +10866,8 @@ function reporting_get_agentmodule_data_min($id_agent_module, $period=0, $date=0
     // Get module data
     $interval_data = db_get_all_rows_sql(
         'SELECT *
-		FROM tagente_datos 
-		WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
+        FROM tagente_datos 
+        WHERE id_agente_modulo = '.(int) $id_agent_module.' AND utimestamp > '.(int) $datelimit.' AND utimestamp < '.(int) $date.' ORDER BY utimestamp ASC',
         $search_in_history_db
     );
     if ($interval_data === false) {
@@ -10459,11 +10992,11 @@ function reporting_get_agentmodule_data_sum(
         // Get module data
         $interval_data = db_get_all_rows_sql(
             '
-			SELECT * FROM tagente_datos 
-			WHERE id_agente_modulo = '.(int) $id_agent_module.'
-				AND utimestamp > '.(int) $datelimit.'
-				AND utimestamp < '.(int) $date.'
-			ORDER BY utimestamp ASC',
+            SELECT * FROM tagente_datos 
+            WHERE id_agente_modulo = '.(int) $id_agent_module.'
+                AND utimestamp > '.(int) $datelimit.'
+                AND utimestamp < '.(int) $date.'
+            ORDER BY utimestamp ASC',
             $search_in_history_db
         );
     } else {
@@ -10558,24 +11091,24 @@ function reporting_get_planned_downtimes($start_date, $end_date, $id_agent_modul
         // is inside the planned downtime execution.
         // The start and end time is very important.
         $periodically_monthly_w = "type_periodicity = 'monthly'
-									AND (((periodically_day_from > '$start_day'
-												OR (periodically_day_from = '$start_day'
-													AND periodically_time_from >= '$start_time'))
-											AND (periodically_day_to < '$end_day'
-												OR (periodically_day_to = '$end_day'
-													AND periodically_time_to <= '$end_time')))
-										OR ((periodically_day_from < '$start_day' 
-												OR (periodically_day_from = '$start_day'
-													AND periodically_time_from <= '$start_time'))
-											AND (periodically_day_to > '$start_day'
-												OR (periodically_day_to = '$start_day'
-													AND periodically_time_to >= '$start_time')))
-										OR ((periodically_day_from < '$end_day' 
-												OR (periodically_day_from = '$end_day'
-													AND periodically_time_from <= '$end_time'))
-											AND (periodically_day_to > '$end_day'
-												OR (periodically_day_to = '$end_day'
-													AND periodically_time_to >= '$end_time'))))";
+                                    AND (((periodically_day_from > '$start_day'
+                                                OR (periodically_day_from = '$start_day'
+                                                    AND periodically_time_from >= '$start_time'))
+                                            AND (periodically_day_to < '$end_day'
+                                                OR (periodically_day_to = '$end_day'
+                                                    AND periodically_time_to <= '$end_time')))
+                                        OR ((periodically_day_from < '$start_day' 
+                                                OR (periodically_day_from = '$start_day'
+                                                    AND periodically_time_from <= '$start_time'))
+                                            AND (periodically_day_to > '$start_day'
+                                                OR (periodically_day_to = '$start_day'
+                                                    AND periodically_time_to >= '$start_time')))
+                                        OR ((periodically_day_from < '$end_day' 
+                                                OR (periodically_day_from = '$end_day'
+                                                    AND periodically_time_from <= '$end_time'))
+                                            AND (periodically_day_to > '$end_day'
+                                                OR (periodically_day_to = '$end_day'
+                                                    AND periodically_time_to >= '$end_time'))))";
     }
 
     $periodically_weekly_days = [];
@@ -10595,13 +11128,13 @@ function reporting_get_planned_downtimes($start_date, $end_date, $id_agent_modul
         // the start or end time of the date range.
         $weekday_actual = strtolower(date('l', $start_date));
         $periodically_weekly_days[] = "($weekday_actual = 1
-			AND ((periodically_time_from > '$start_time' AND periodically_time_to < '$end_time')
-				OR (periodically_time_from = '$start_time'
-					OR (periodically_time_from < '$start_time'
-						AND periodically_time_to >= '$start_time'))
-				OR (periodically_time_from = '$end_time'
-					OR (periodically_time_from < '$end_time'
-						AND periodically_time_to >= '$end_time'))))";
+            AND ((periodically_time_from > '$start_time' AND periodically_time_to < '$end_time')
+                OR (periodically_time_from = '$start_time'
+                    OR (periodically_time_from < '$start_time'
+                        AND periodically_time_to >= '$start_time'))
+                OR (periodically_time_from = '$end_time'
+                    OR (periodically_time_from < '$end_time'
+                        AND periodically_time_to >= '$end_time'))))";
     } else {
         while ($date_aux <= $end_date && $i < 7) {
             $weekday_actual = strtolower(date('l', $date_aux));
@@ -10646,68 +11179,68 @@ function reporting_get_planned_downtimes($start_date, $end_date, $id_agent_modul
         }
 
         $sql_downtime = '
-			SELECT
-				DISTINCT(tpdr.id),
-				tpdr.name,
-				'.$tpdr_description.",
-				tpdr.date_from,
-				tpdr.date_to,
-				tpdr.executed,
-				tpdr.id_group,
-				tpdr.only_alerts,
-				tpdr.monday,
-				tpdr.tuesday,
-				tpdr.wednesday,
-				tpdr.thursday,
-				tpdr.friday,
-				tpdr.saturday,
-				tpdr.sunday,
-				tpdr.periodically_time_from,
-				tpdr.periodically_time_to,
-				tpdr.periodically_day_from,
-				tpdr.periodically_day_to,
-				tpdr.type_downtime,
-				tpdr.type_execution,
-				tpdr.type_periodicity,
-				tpdr.id_user
-			FROM (
-					SELECT tpd.*
-					FROM tplanned_downtime tpd, tplanned_downtime_agents tpda, tagente_modulo tam
-					WHERE (tpd.id = tpda.id_downtime
-							AND tpda.all_modules = 1
-							AND tpda.id_agent = tam.id_agente
-							AND tam.id_agente_modulo IN ($id_agent_modules_str))
-						AND ((type_execution = 'periodically'
-								AND $periodically_condition)
-							OR (type_execution = 'once'
-								AND ((date_from >= '$start_date' AND date_to <= '$end_date')
-									OR (date_from <= '$start_date' AND date_to >= '$end_date')
-									OR (date_from <= '$start_date' AND date_to >= '$start_date')
-									OR (date_from <= '$end_date' AND date_to >= '$end_date'))))
-				UNION ALL
-					SELECT tpd.*
-					FROM tplanned_downtime tpd, tplanned_downtime_modules tpdm
-					WHERE (tpd.id = tpdm.id_downtime
-							AND tpdm.id_agent_module IN ($id_agent_modules_str))
-						AND ((type_execution = 'periodically'
-								AND $periodically_condition)
-							OR (type_execution = 'once'
-								AND ((date_from >= '$start_date' AND date_to <= '$end_date')
-									OR (date_from <= '$start_date' AND date_to >= '$end_date')
-									OR (date_from <= '$start_date' AND date_to >= '$start_date')
-									OR (date_from <= '$end_date' AND date_to >= '$end_date'))))
-			) tpdr
-			ORDER BY tpdr.id";
+            SELECT
+                DISTINCT(tpdr.id),
+                tpdr.name,
+                '.$tpdr_description.",
+                tpdr.date_from,
+                tpdr.date_to,
+                tpdr.executed,
+                tpdr.id_group,
+                tpdr.only_alerts,
+                tpdr.monday,
+                tpdr.tuesday,
+                tpdr.wednesday,
+                tpdr.thursday,
+                tpdr.friday,
+                tpdr.saturday,
+                tpdr.sunday,
+                tpdr.periodically_time_from,
+                tpdr.periodically_time_to,
+                tpdr.periodically_day_from,
+                tpdr.periodically_day_to,
+                tpdr.type_downtime,
+                tpdr.type_execution,
+                tpdr.type_periodicity,
+                tpdr.id_user
+            FROM (
+                    SELECT tpd.*
+                    FROM tplanned_downtime tpd, tplanned_downtime_agents tpda, tagente_modulo tam
+                    WHERE (tpd.id = tpda.id_downtime
+                            AND tpda.all_modules = 1
+                            AND tpda.id_agent = tam.id_agente
+                            AND tam.id_agente_modulo IN ($id_agent_modules_str))
+                        AND ((type_execution = 'periodically'
+                                AND $periodically_condition)
+                            OR (type_execution = 'once'
+                                AND ((date_from >= '$start_date' AND date_to <= '$end_date')
+                                    OR (date_from <= '$start_date' AND date_to >= '$end_date')
+                                    OR (date_from <= '$start_date' AND date_to >= '$start_date')
+                                    OR (date_from <= '$end_date' AND date_to >= '$end_date'))))
+                UNION ALL
+                    SELECT tpd.*
+                    FROM tplanned_downtime tpd, tplanned_downtime_modules tpdm
+                    WHERE (tpd.id = tpdm.id_downtime
+                            AND tpdm.id_agent_module IN ($id_agent_modules_str))
+                        AND ((type_execution = 'periodically'
+                                AND $periodically_condition)
+                            OR (type_execution = 'once'
+                                AND ((date_from >= '$start_date' AND date_to <= '$end_date')
+                                    OR (date_from <= '$start_date' AND date_to >= '$end_date')
+                                    OR (date_from <= '$start_date' AND date_to >= '$start_date')
+                                    OR (date_from <= '$end_date' AND date_to >= '$end_date'))))
+            ) tpdr
+            ORDER BY tpdr.id";
     } else {
         $sql_downtime = "SELECT *
-						FROM tplanned_downtime tpd, tplanned_downtime_modules tpdm
-						WHERE (type_execution = 'periodically'
-									AND $periodically_condition)
-								OR (type_execution = 'once'
-									AND ((date_from >= '$start_date' AND date_to <= '$end_date')
-										OR (date_from <= '$start_date' AND date_to >= '$end_date')
-										OR (date_from <= '$start_date' AND date_to >= '$start_date')
-										OR (date_from <= '$end_date' AND date_to >= '$end_date')))";
+                        FROM tplanned_downtime tpd, tplanned_downtime_modules tpdm
+                        WHERE (type_execution = 'periodically'
+                                    AND $periodically_condition)
+                                OR (type_execution = 'once'
+                                    AND ((date_from >= '$start_date' AND date_to <= '$end_date')
+                                        OR (date_from <= '$start_date' AND date_to >= '$end_date')
+                                        OR (date_from <= '$start_date' AND date_to >= '$start_date')
+                                        OR (date_from <= '$end_date' AND date_to >= '$end_date')))";
     }
 
     $downtimes = db_get_all_rows_sql($sql_downtime);
@@ -10775,10 +11308,10 @@ function reporting_get_agentmodule_sla_day($id_agent_module, $period=0, $min_val
     // Get interval data
     $sql = sprintf(
         'SELECT *
-		FROM tagente_datos
-		WHERE id_agente_modulo = %d
-			AND utimestamp > %d
-			AND utimestamp <= %d',
+        FROM tagente_datos
+        WHERE id_agente_modulo = %d
+            AND utimestamp > %d
+            AND utimestamp <= %d',
         $id_agent_module,
         $datelimit,
         $date
@@ -10980,10 +11513,10 @@ function reporting_get_stats_servers()
 
     $tdata = [];
     '<span class="big_data">'.format_numeric($server_performance['total_local_modules']).'</span>';
-    $tdata[0] = html_print_image('images/module.png', true, ['title' => __('Total running modules'), 'width' => '25px']);
+    $tdata[0] = html_print_image('images/module.png', true, ['title' => __('Total running modules')]);
     $tdata[1] = '<span class="big_data">'.format_numeric($server_performance['total_modules']).'</span>';
     $tdata[2] = '<span class="med_data">'.format_numeric($server_performance['total_modules_rate'], 2).'</span>';
-    $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'width' => '16px']).'/sec </span>';
+    $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second')]).'/sec </span>';
 
     $table_srv->rowclass[] = '';
     $table_srv->data[] = $tdata;
@@ -10995,22 +11528,22 @@ function reporting_get_stats_servers()
     $table_srv->data[] = $tdata;
 
     $tdata = [];
-    $tdata[0] = html_print_image('images/database.png', true, ['title' => __('Local modules'), 'width' => '25px']);
+    $tdata[0] = html_print_image('images/database.png', true, ['title' => __('Local modules')]);
     $tdata[1] = '<span class="big_data">'.format_numeric($server_performance['total_local_modules']).'</span>';
     $tdata[2] = '<span class="med_data">'.format_numeric($server_performance['local_modules_rate'], 2).'</span>';
-    $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'width' => '16px']).'/sec </span>';
+    $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second')]).'/sec </span>';
 
     $table_srv->rowclass[] = '';
     $table_srv->data[] = $tdata;
 
     if (isset($server_performance['total_network_modules'])) {
         $tdata = [];
-        $tdata[0] = html_print_image('images/network.png', true, ['title' => __('Network modules'), 'width' => '25px']);
+        $tdata[0] = html_print_image('images/network.png', true, ['title' => __('Network modules')]);
         $tdata[1] = '<span class="big_data">'.format_numeric($server_performance['total_network_modules']).'</span>';
 
         $tdata[2] = '<span class="med_data">'.format_numeric($server_performance['network_modules_rate'], 2).'</span>';
 
-        $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'width' => '16px']).'/sec </span>';
+        $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second')]).'/sec </span>';
 
         if ($server_performance['total_remote_modules'] > 10000 && !enterprise_installed()) {
             $tdata[4] = "<div id='remotemodulesmodal' class='publienterprise' title='Community version' style='text-align:left;'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
@@ -11024,11 +11557,11 @@ function reporting_get_stats_servers()
 
     if (isset($server_performance['total_plugin_modules'])) {
         $tdata = [];
-        $tdata[0] = html_print_image('images/plugin.png', true, ['title' => __('Plugin modules'), 'width' => '25px']);
+        $tdata[0] = html_print_image('images/plugin.png', true, ['title' => __('Plugin modules')]);
         $tdata[1] = '<span class="big_data">'.format_numeric($server_performance['total_plugin_modules']).'</span>';
 
         $tdata[2] = '<span class="med_data">'.format_numeric($server_performance['plugin_modules_rate'], 2).'</span>';
-        $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'width' => '16px']).'/sec </span>';
+        $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second')]).'/sec </span>';
 
         $table_srv->rowclass[] = '';
         $table_srv->data[] = $tdata;
@@ -11036,11 +11569,11 @@ function reporting_get_stats_servers()
 
     if (isset($server_performance['total_prediction_modules'])) {
         $tdata = [];
-        $tdata[0] = html_print_image('images/chart_bar.png', true, ['title' => __('Prediction modules'), 'width' => '25px']);
+        $tdata[0] = html_print_image('images/chart_bar.png', true, ['title' => __('Prediction modules')]);
         $tdata[1] = '<span class="big_data">'.format_numeric($server_performance['total_prediction_modules']).'</span>';
 
         $tdata[2] = '<span class="med_data">'.format_numeric($server_performance['prediction_modules_rate'], 2).'</span>';
-        $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'width' => '16px']).'/sec </span>';
+        $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second')]).'/sec </span>';
 
         $table_srv->rowclass[] = '';
         $table_srv->data[] = $tdata;
@@ -11048,11 +11581,11 @@ function reporting_get_stats_servers()
 
     if (isset($server_performance['total_wmi_modules'])) {
         $tdata = [];
-        $tdata[0] = html_print_image('images/wmi.png', true, ['title' => __('WMI modules'), 'width' => '25px']);
+        $tdata[0] = html_print_image('images/wmi.png', true, ['title' => __('WMI modules')]);
         $tdata[1] = '<span class="big_data">'.format_numeric($server_performance['total_wmi_modules']).'</span>';
 
         $tdata[2] = '<span class="med_data">'.format_numeric($server_performance['wmi_modules_rate'], 2).'</span>';
-        $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'width' => '16px']).'/sec </span>';
+        $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second')]).'/sec </span>';
 
         $table_srv->rowclass[] = '';
         $table_srv->data[] = $tdata;
@@ -11060,11 +11593,11 @@ function reporting_get_stats_servers()
 
     if (isset($server_performance['total_web_modules'])) {
         $tdata = [];
-        $tdata[0] = html_print_image('images/world.png', true, ['title' => __('Web modules'), 'width' => '25px']);
+        $tdata[0] = html_print_image('images/world.png', true, ['title' => __('Web modules')]);
         $tdata[1] = '<span class="big_data">'.format_numeric($server_performance['total_web_modules']).'</span>';
 
         $tdata[2] = '<span class="med_data">'.format_numeric($server_performance['web_modules_rate'], 2).'</span>';
-        $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'width' => '16px']).'/sec </span>';
+        $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second')]).'/sec </span>';
 
         $table_srv->rowclass[] = '';
         $table_srv->data[] = $tdata;
@@ -11082,7 +11615,6 @@ function reporting_get_stats_servers()
         true,
         [
             'title' => __('Total events'),
-            'width' => '25px',
         ]
     );
     $tdata[1] = '<span class="big_data" id="total_events">'.html_print_image('images/spinner.gif', true).'</span>';
@@ -11104,23 +11636,40 @@ function reporting_get_stats_servers()
     $table_srv->data[] = $tdata;
 
     $output = '<fieldset class="databox tactical_set">
-				<legend>'.__('Server performance').'</legend>'.html_print_table($table_srv, true).'</fieldset>';
+                <legend>'.__('Server performance').'</legend>'.html_print_table($table_srv, true).'</fieldset>';
 
-    $output .= '<script type="text/javascript">';
-        $output .= '$(document).ready(function () {';
-            $output .= 'var parameters = {};';
-            $output .= 'parameters["page"] = "include/ajax/events";';
-            $output .= 'parameters["total_events"] = 1;';
+    $public_hash = get_parameter('hash', false);
+    if ($public_hash === false) {
+        $output .= '<script type="text/javascript">';
+            $output .= '$(document).ready(function () {';
+                $output .= 'var parameters = {};';
+                $output .= 'parameters["page"] = "include/ajax/events";';
+                $output .= 'parameters["total_events"] = 1;';
 
-            $output .= '$.ajax({type: "GET",url: "/pandora_console/ajax.php",data: parameters,';
-                $output .= 'success: function(data) {';
-                    $output .= '$("#total_events").text(data);';
-                $output .= '}';
+                $output .= '$.ajax({type: "GET",url: "/pandora_console/ajax.php",data: parameters,';
+                    $output .= 'success: function(data) {';
+                        $output .= '$("#total_events").text(data);';
+                    $output .= '}';
+                $output .= '});';
             $output .= '});';
-        $output .= '});';
-    $output .= '</script>';
+        $output .= '</script>';
+    } else {
+        // This is for public link on the dashboard
+        $sql_count_event = 'SELECT SQL_NO_CACHE COUNT(id_evento) FROM tevento  ';
+        if ($config['event_view_hr']) {
+            $sql_count_event .= 'WHERE utimestamp > (UNIX_TIMESTAMP(NOW()) - '.($config['event_view_hr'] * SECONDS_1HOUR).')';
+        }
 
-    return $output;
+        $system_events = db_get_value_sql($sql_count_event);
+
+        $output .= '<script type="text/javascript">';
+            $output .= '$(document).ready(function () {';
+                $output .= '$("#total_events").text("'.$system_events.'");';
+            $output .= '});';
+        $output .= '</script>';
+    }
+
+        return $output;
 }
 
 
@@ -11462,120 +12011,100 @@ function reporting_get_agentmodule_sla_working_timestamp($period, $date_end, $wt
 }
 
 
+/**
+ * Convert macros for value.
+ * Item content:
+ *      type
+ *      id_agent
+ *      id_agent_module
+ *      agent_description
+ *      agent_group
+ *      agent_address
+ *      agent_alias
+ *      module_name
+ *      module_description.
+ *
+ * @param array  $item  Data to replace in the macros.
+ * @param string $label String check macros.
+ *
+ * @return string
+ */
 function reporting_label_macro($item, $label)
 {
-    switch ($item['type']) {
-        case 'event_report_agent':
-        case 'alert_report_agent':
-        case 'agent_configuration':
-        case 'event_report_log':
-            if (preg_match('/_agent_/', $label)) {
-                $agent_name = agents_get_alias($item['id_agent']);
-                $label = str_replace('_agent_', $agent_name, $label);
-            }
+    if (preg_match('/_agent_/', $label)) {
+        $label = str_replace(
+            '_agent_',
+            $item['agent_alias'],
+            $label
+        );
+    }
 
-            if (preg_match('/_agentdescription_/', $label)) {
-                $agent_name = agents_get_description($item['id_agent']);
-                $label = str_replace('_agentdescription_', $agent_name, $label);
-            }
+    if (preg_match('/_agentdescription_/', $label)) {
+        $label = str_replace(
+            '_agentdescription_',
+            $item['agent_description'],
+            $label
+        );
+    }
 
-            if (preg_match('/_agentgroup_/', $label)) {
-                $agent_name = groups_get_name(agents_get_agent_group($item['id_agent']), true);
-                $label = str_replace('_agentgroup_', $agent_name, $label);
-            }
+    if (preg_match('/_agentgroup_/', $label)) {
+        $label = str_replace(
+            '_agentgroup_',
+            $item['agent_group'],
+            $label
+        );
+    }
 
-            if (preg_match('/_address_/', $label)) {
-                $agent_name = agents_get_address($item['id_agent']);
-                $label = str_replace('_address_', $agent_name, $label);
-            }
-        break;
+    if (preg_match('/_address_/', $label)) {
+        $label = str_replace(
+            '_address_',
+            $item['agent_address'],
+            $label
+        );
+    }
 
-        case 'simple_graph':
-        case 'module_histogram_graph':
-        case 'custom_graph':
-        case 'simple_baseline_graph':
-        case 'event_report_module':
-        case 'alert_report_module':
-        case 'historical_data':
-        case 'sumatory':
-        case 'database_serialized':
-        case 'monitor_report':
-        case 'min_value':
-        case 'max_value':
-        case 'avg_value':
-        case 'projection_graph':
-        case 'prediction_date':
-        case 'TTRT':
-        case 'TTO':
-        case 'MTBF':
-        case 'MTTR':
-        case 'automatic_graph':
-            if (preg_match('/_agent_/', $label)) {
-                if (isset($item['agents']) && count($item['agents']) > 1) {
-                    $agent_name = count($item['agents']).__(' agents');
-                } else {
-                    $agent_name = agents_get_alias($item['id_agent']);
-                }
+    if (preg_match('/_module_/', $label)) {
+        $label = str_replace(
+            '_module_',
+            $item['module_name'],
+            $label
+        );
+    }
 
-                $label = str_replace('_agent_', $agent_name, $label);
-            }
-
-            if (preg_match('/_agentdescription_/', $label)) {
-                if (count($item['agents']) > 1) {
-                    $agent_name = '';
-                } else {
-                    $agent_name = agents_get_description($item['id_agent']);
-                }
-
-                $label = str_replace('_agentdescription_', $agent_name, $label);
-            }
-
-            if (preg_match('/_agentgroup_/', $label)) {
-                if (count($item['agents']) > 1) {
-                    $agent_name = '';
-                } else {
-                    $agent_name = groups_get_name(agents_get_agent_group($item['id_agent']), true);
-                }
-
-                $label = str_replace('_agentgroup_', $agent_name, $label);
-            }
-
-            if (preg_match('/_address_/', $label)) {
-                if (count($item['agents']) > 1) {
-                    $agent_name = '';
-                } else {
-                    $agent_name = agents_get_address($item['id_agent']);
-                }
-
-                $label = str_replace('_address_', $agent_name, $label);
-            }
-
-            if (preg_match('/_module_/', $label)) {
-                if ($item['modules'] > 1) {
-                    $module_name = $item['modules'].__(' modules');
-                } else {
-                    $module_name = modules_get_agentmodule_name($item['id_agent_module']);
-                }
-
-                $label = str_replace('_module_', $module_name, $label);
-            }
-
-            if (preg_match('/_moduledescription_/', $label)) {
-                if ($item['modules'] > 1) {
-                    $module_description = '';
-                } else {
-                    $module_description = modules_get_agentmodule_descripcion($item['id_agent_module']);
-                }
-
-                $label = str_replace('_moduledescription_', $module_description, $label);
-            }
-        break;
+    if (preg_match('/_moduledescription_/', $label)) {
+        $label = str_replace(
+            '_moduledescription_',
+            $item['module_description'],
+            $label
+        );
     }
 
     return $label;
 }
 
 
+/**
+ * Convert macro in sql string to value
+ *
+ * @param array  $report
+ * @param string $sql
+ *
+ * @return string
+ */
+function reporting_sql_macro(array $report, string $sql): string
+{
+    if (preg_match('/_timefrom_/', $sql)) {
+        $sql = str_replace(
+            '_timefrom_',
+            $report['datetime'],
+            $sql
+        );
+    }
+
+    return $sql;
+}
+
+
 /**
  * @brief Calculates the SLA compliance value given an sla array
  *
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index 10bef8631f..6a7d60c620 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -107,9 +107,15 @@ function html_do_report_info($report)
 {
     global $config;
 
+    if ($config['style'] === 'pandora_black') {
+        $background_color = '#222';
+    } else {
+        $background_color = '#f5f5f5';
+    }
+
     $date_today = date($config['date_format']);
 
-    $html = '<div style="border: 1px dashed #999; padding: 10px 15px; background: #f5f5f5;margin-top:20px;margin-bottom:20px;"><table>
+    $html = '<div style="border: 1px dashed #999; padding: 10px 15px; background: '.$background_color.';margin-top:20px;margin-bottom:20px;"><table>
             <tr>
                 <td><b>'.__('Generated').': </b></td><td>'.$date_today.'</td>
             </tr>
@@ -135,6 +141,15 @@ function html_do_report_info($report)
 }
 
 
+/**
+ * Print html report.
+ *
+ * @param array   $report      Info.
+ * @param boolean $mini        Type.
+ * @param integer $report_info Show info.
+ *
+ * @return array
+ */
 function reporting_html_print_report($report, $mini=false, $report_info=1)
 {
     if ($report_info == 1) {
@@ -155,7 +170,38 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
         $table->rowstyle = [];
 
         if (isset($item['label']) && $item['label'] != '') {
-            $label = reporting_label_macro($item, $item['label']);
+            $id_agent = $item['id_agent'];
+            $id_agent_module = $item['id_agent_module'];
+
+            // Add macros name.
+            $agent_description = agents_get_description($id_agent);
+            $agent_group = agents_get_agent_group($id_agent);
+            $agent_address = agents_get_address($id_agent);
+            $agent_alias = agents_get_alias($id_agent);
+            $module_name = modules_get_agentmodule_name(
+                $id_agent_module
+            );
+
+            $module_description = modules_get_agentmodule_descripcion(
+                $id_agent_module
+            );
+
+            $items_label = [
+                'type'               => $item['type'],
+                'id_agent'           => $id_agent,
+                'id_agent_module'    => $id_agent_module,
+                'agent_description'  => $agent_description,
+                'agent_group'        => $agent_group,
+                'agent_address'      => $agent_address,
+                'agent_alias'        => $agent_alias,
+                'module_name'        => $module_name,
+                'module_description' => $module_description,
+            ];
+
+            $label = reporting_label_macro(
+                $items_label,
+                $item['label']
+            );
         } else {
             $label = '';
         }
@@ -174,7 +220,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
 
         $table->data['description_row']['description'] = $item['description'];
 
-        if ($item['type'] == 'event_report_agent' || $item['type'] == 'event_report_group' || $item['type'] == 'event_report_module') {
+        if ($item['type'] == 'event_report_agent'
+            || $item['type'] == 'event_report_group'
+            || $item['type'] == 'event_report_module'
+        ) {
             $table->data['count_row']['count'] = 'Total events: '.$item['total_events'];
         }
 
@@ -753,7 +802,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
             $table1->size[10] = '2%';
             $table1->data[0][10] = '<img src ="'.$src.'images/square_light_gray.png">';
             $table1->size[11] = '15%';
-            $table1->data[0][11] = '<span>'.__('Ignore time').'</span>';
+            $table1->data[0][11] = '<span>'.__('Planned Downtime').'</span>';
 
             if ($pdf === 0) {
                 $table->colspan['legend']['cell'] = 2;
@@ -3252,53 +3301,111 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
 
     $tables_chart = '';
 
-    $table1 = new stdClass();
-    $table1->width = '99%';
-    $table1->data = [];
-    $table1->size = [];
-    $table1->size[0] = '10%';
-    $table1->size[1] = '80%';
-    $table1->size[2] = '5%';
-    $table1->size[3] = '5%';
-    foreach ($item['charts'] as $chart) {
-        $checks_resume = '';
-        $sla_value = '';
-        if (reporting_sla_is_not_init_from_array($chart)) {
-            $color = COL_NOTINIT;
-            $sla_value = __('Not init');
-        } else if (reporting_sla_is_ignored_from_array($chart)) {
-            $color = COL_IGNORED;
-            $sla_value = __('No data');
-        } else {
-            switch ($chart['sla_status']) {
-                case REPORT_STATUS_ERR:
-                    $color = COL_CRITICAL;
-                break;
+    if (isset($item['failed']) === true && empty($item['failed']) === false) {
+        $tables_chart .= $item['failed'];
+    } else {
+        foreach ($item['charts'] as $k_chart => $chart) {
+            $checks_resume = '';
+            $sla_value = '';
+            if (reporting_sla_is_not_init_from_array($chart)) {
+                $color = COL_NOTINIT;
+                $sla_value = __('Not init');
+            } else if (reporting_sla_is_ignored_from_array($chart)) {
+                $color = COL_IGNORED;
+                $sla_value = __('No data');
+            } else {
+                switch ($chart['sla_status']) {
+                    case REPORT_STATUS_ERR:
+                        $color = COL_CRITICAL;
+                    break;
 
-                case REPORT_STATUS_OK:
-                    $color = COL_NORMAL;
-                break;
+                    case REPORT_STATUS_OK:
+                        $color = COL_NORMAL;
+                    break;
 
-                default:
-                    $color = COL_UNKNOWN;
-                break;
+                    default:
+                        $color = COL_UNKNOWN;
+                    break;
+                }
+
+                $sla_value = sla_truncate(
+                    $chart['sla_value'],
+                    $config['graph_precision']
+                ).'%';
+                $checks_resume = '('.$chart['checks_ok'].'/'.$chart['checks_total'].')';
             }
 
-            $sla_value = sla_truncate(
-                $chart['sla_value'],
-                $config['graph_precision']
-            ).'%';
-            $checks_resume = '('.$chart['checks_ok'].'/'.$chart['checks_total'].')';
-        }
+            // Check failover availability report.
+            if ($item['data'][$k_chart]['failover'] === '') {
+                $table1 = new stdClass();
+                $table1->width = '99%';
+                $table1->data = [];
+                $table1->size = [];
+                $table1->size[0] = '10%';
+                $table1->size[1] = '80%';
+                $table1->size[2] = '5%';
+                $table1->size[3] = '5%';
+                $table1->data[0][0] = $chart['agent'].'<br />'.$chart['module'];
+                $table1->data[0][1] = $chart['chart'];
+                $table1->data[0][2] = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
+                $table1->data[0][3] = $checks_resume;
+                $tables_chart .= html_print_table(
+                    $table1,
+                    true
+                );
+            } else {
+                if ($item['data'][$k_chart]['failover'] === 'primary'
+                    || $item['failover_type'] == REPORT_FAILOVER_TYPE_SIMPLE
+                ) {
+                    $table1 = new stdClass();
+                    $table1->width = '99%';
+                    $table1->data = [];
+                    $table1->size = [];
+                    $table1->size[0] = '10%';
+                    $table1->size[1] = '80%';
+                    $table1->size[2] = '5%';
+                    $table1->size[3] = '5%';
+                }
 
-        $table1->data[0][0] = $chart['agent'].'<br />'.$chart['module'];
-        $table1->data[0][1] = $chart['chart'];
-        $table1->data[0][2] = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
-        $table1->data[0][3] = $checks_resume;
-        $tables_chart .= html_print_table(
-            $table1,
-            true
-        );
+                $title = '';
+                $checks_resume_text = $checks_resume;
+                $sla_value_text = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
+                switch ($item['data'][$k_chart]['failover']) {
+                    case 'primary':
+                        $title = '<b>'.__('Primary').'</b>';
+                        $title .= '<br />'.$chart['agent'];
+                        $title .= '<br />'.$chart['module'];
+                    break;
+
+                    case (preg_match('/failover.*/', $item['data'][$k_chart]['failover']) ? true : false):
+                        $title = '<b>'.__('Failover').'</b>';
+                        $title .= '<br />'.$chart['agent'];
+                        $title .= '<br />'.$chart['module'];
+                    break;
+
+                    case 'result':
+                    default:
+                        $title = '<b>'.__('Result').'</b>';
+                        $sla_value_text = "<span style = 'font: bold 3em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
+                        $checks_resume_text = '<span style = "font-size: 12pt;">';
+                        $checks_resume_text .= $checks_resume;
+                        $checks_resume_text .= '</span>';
+                    break;
+                }
+
+                $table1->data[$item['data'][$k_chart]['failover']][0] = $title;
+                $table1->data[$item['data'][$k_chart]['failover']][1] = $chart['chart'];
+                $table1->data[$item['data'][$k_chart]['failover']][2] = $sla_value_text;
+                $table1->data[$item['data'][$k_chart]['failover']][3] = $checks_resume_text;
+
+                if ($item['data'][$k_chart]['failover'] === 'result') {
+                    $tables_chart .= html_print_table(
+                        $table1,
+                        true
+                    );
+                }
+            }
+        }
     }
 
     if ($item['type'] == 'availability_graph') {
@@ -3335,7 +3442,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
         $table2->size[10] = '2%';
         $table2->data[0][10] = '<img src ="'.$src.$hack_metaconsole.'images/square_light_gray.png">';
         $table2->size[11] = '15%';
-        $table2->data[0][11] = '<span>'.__('Ignore time').'</span>';
+        $table2->data[0][11] = '<span>'.__('Planned Downtime').'</span>';
     }
 
     if ($pdf !== 0) {
@@ -3496,7 +3603,8 @@ function reporting_html_general($table, $item, $pdf=0)
                 $table1->head = array_merge([__('Agent')], $list_modules);
                 foreach ($item['data'] as $agent => $modules) {
                     $row = [];
-                    $row['agent'] = $agent;
+                    $alias = agents_get_alias_by_name($agent);
+                    $row['agent'] = $alias;
                     $table1->style['agent'] = 'text-align: center;';
                     foreach ($list_modules as $name) {
                         $table1->style[$name] = 'text-align: center;';
@@ -4270,16 +4378,16 @@ function reporting_get_agents_by_status($data, $graph_width=250, $graph_height=1
 
     $agent_data = [];
     $agent_data[0] = html_print_image('images/agent_critical.png', true, ['title' => __('Agents critical')]);
-    $agent_data[1] = "<a style='color: ".COL_CRITICAL.";' href='".$links['agents_critical']."'><b><span style='font-size: 12pt; font-weight: bold; color: #FC4444;'>".format_numeric($data['agent_critical']).'</span></b></a>';
+    $agent_data[1] = "<a style='color: ".COL_CRITICAL.";' href='".$links['agents_critical']."'><b><span style='font-size: 12pt; font-weight: bold; color: #e63c52;'>".format_numeric($data['agent_critical']).'</span></b></a>';
 
     $agent_data[2] = html_print_image('images/agent_warning.png', true, ['title' => __('Agents warning')]);
-    $agent_data[3] = "<a style='color: ".COL_WARNING.";' href='".$links['agents_warning']."'><b><span style='font-size: 12pt; font-weight: bold; color: #FAD403;'>".format_numeric($data['agent_warning']).'</span></b></a>';
+    $agent_data[3] = "<a style='color: ".COL_WARNING.";' href='".$links['agents_warning']."'><b><span style='font-size: 12pt; font-weight: bold; color: #f3b200;'>".format_numeric($data['agent_warning']).'</span></b></a>';
 
     $table_agent->data[] = $agent_data;
 
     $agent_data = [];
     $agent_data[0] = html_print_image('images/agent_ok.png', true, ['title' => __('Agents ok')]);
-    $agent_data[1] = "<a style='color: ".COL_NORMAL.";' href='".$links['agents_ok']."'><b><span style='font-size: 12pt; font-weight: bold; color: #80BA27;'>".format_numeric($data['agent_ok']).'</span></b></a>';
+    $agent_data[1] = "<a style='color: ".COL_NORMAL.";' href='".$links['agents_ok']."'><b><span style='font-size: 12pt; font-weight: bold; color: #82b92e;'>".format_numeric($data['agent_ok']).'</span></b></a>';
 
     $agent_data[2] = html_print_image('images/agent_unknown.png', true, ['title' => __('Agents unknown')]);
     $agent_data[3] = "<a style='color: ".COL_UNKNOWN.";' href='".$links['agents_unknown']."'><b><span style='font-size: 12pt; font-weight: bold; color: #B2B2B2;'>".format_numeric($data['agent_unknown']).'</span></b></a>';
@@ -4367,13 +4475,13 @@ function reporting_get_events($data, $links=false)
     }
 
     if (defined('METACONSOLE')) {
-        $table_events->style[0] = 'background-color:#FC4444';
+        $table_events->style[0] = 'background-color:#e63c52';
         $table_events->data[0][0] = html_print_image('images/module_event_critical.png', true, ['title' => __('Critical events')]);
         $table_events->data[0][0] .= '&nbsp;&nbsp;&nbsp;'."<a style='color:#FFF; font-size: 12pt; font-weight: bold;".$style."' href='".$links['critical']."'>".format_numeric($data['critical']).'</a>';
-        $table_events->style[1] = 'background-color:#FAD403';
+        $table_events->style[1] = 'background-color:#f3b200';
         $table_events->data[0][1] = html_print_image('images/module_event_warning.png', true, ['title' => __('Warning events')]);
         $table_events->data[0][1] .= '&nbsp;&nbsp;&nbsp;'."<a style='color:#FFF; font-size: 12pt; font-weight: bold;".$style."' href='".$links['warning']."'>".format_numeric($data['warning']).'</a>';
-        $table_events->style[2] = 'background-color:#80BA27';
+        $table_events->style[2] = 'background-color:#82b92e';
         $table_events->data[0][2] = html_print_image('images/module_event_ok.png', true, ['title' => __('OK events')]);
         $table_events->data[0][2] .= '&nbsp;&nbsp;&nbsp;'."<a style='color:#FFF; font-size: 12pt; font-weight: bold;".$style."' href='".$links['normal']."'>".format_numeric($data['normal']).'</a>';
         $table_events->style[3] = 'background-color:#B2B2B2';
@@ -4381,11 +4489,11 @@ function reporting_get_events($data, $links=false)
         $table_events->data[0][3] .= '&nbsp;&nbsp;&nbsp;'."<a style='color:#FFF; font-size: 12pt; font-weight: bold;".$style."' href='".$links['unknown']."'>".format_numeric($data['unknown']).'</a>';
     } else {
         $table_events->data[0][0] = html_print_image('images/module_critical.png', true, ['title' => __('Critical events')]);
-        $table_events->data[0][0] .= '&nbsp;&nbsp;&nbsp;'."<a style='color: #FC4444;".$style."' href='".$links['critical']."'><b><span style='font-size: 12pt; font-weight: bold; color: #FC4444;'>".format_numeric($data['critical']).'</span></b></a>';
+        $table_events->data[0][0] .= '&nbsp;&nbsp;&nbsp;'."<a style='color: #e63c52;".$style."' href='".$links['critical']."'><b><span style='font-size: 12pt; font-weight: bold; color: #e63c52;'>".format_numeric($data['critical']).'</span></b></a>';
         $table_events->data[0][1] = html_print_image('images/module_warning.png', true, ['title' => __('Warning events')]);
-        $table_events->data[0][1] .= '&nbsp;&nbsp;&nbsp;'."<a style='color: #FAD403;".$style."' href='".$links['warning']."'><b><span style='font-size: 12pt; font-weight: bold; color: #FAD403;'>".format_numeric($data['warning']).'</span></b></a>';
+        $table_events->data[0][1] .= '&nbsp;&nbsp;&nbsp;'."<a style='color: #f3b200;".$style."' href='".$links['warning']."'><b><span style='font-size: 12pt; font-weight: bold; color: #f3b200;'>".format_numeric($data['warning']).'</span></b></a>';
         $table_events->data[0][2] = html_print_image('images/module_ok.png', true, ['title' => __('OK events')]);
-        $table_events->data[0][2] .= '&nbsp;&nbsp;&nbsp;'."<a style='color: #80BA27;".$style."' href='".$links['normal']."'><b style='font-size: 12pt; font-weight: bold; color: #80BA27;'>".format_numeric($data['normal']).'</b></a>';
+        $table_events->data[0][2] .= '&nbsp;&nbsp;&nbsp;'."<a style='color: #82b92e;".$style."' href='".$links['normal']."'><b style='font-size: 12pt; font-weight: bold; color: #82b92e;'>".format_numeric($data['normal']).'</b></a>';
         $table_events->data[0][3] = html_print_image('images/module_unknown.png', true, ['title' => __('Unknown events')]);
         $table_events->data[0][3] .= '&nbsp;&nbsp;&nbsp;'."<a style='color: #B2B2B2;".$style."' href='".$links['unknown']."'><b><span style='font-size: 12pt; font-weight: bold; color: #B2B2B2;'>".format_numeric($data['unknown']).'</span></b></a>';
     }
diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php
index 0850dcbfac..4049df62c9 100644
--- a/pandora_console/include/functions_servers.php
+++ b/pandora_console/include/functions_servers.php
@@ -32,9 +32,9 @@ require_once __DIR__.'/constants.php';
 /**
  * Get a server.
  *
- * @param int Server id to get.
- * @param array Extra filter.
- * @param array Fields to get.
+ * @param integer $id_server Server id to get.
+ * @param array   $filter    Extra filter.
+ * @param array   $fields    Fields to get.
  *
  * @return Server with the given id. False if not available.
  */
@@ -61,7 +61,12 @@ function servers_get_server($id_server, $filter=false, $fields=false)
  */
 function servers_get_names()
 {
-    $all_servers = @db_get_all_rows_filter('tserver', false, ['DISTINCT(name) as name']);
+    $all_servers = db_get_all_rows_sql(
+        'SELECT DISTINCT(`name`) as name
+        FROM tserver
+        WHERE server_type <> 13'
+    );
+
     if ($all_servers === false) {
         return [];
     }
@@ -76,7 +81,11 @@ function servers_get_names()
 
 
 /**
- * This function forces a recon task to be queued by the server asap
+ * This function forces a recon task to be queued by the server asap.
+ *
+ * @param integer $id_recon_task Id.
+ *
+ * @return void
  */
 function servers_force_recon_task($id_recon_task)
 {
@@ -141,9 +150,10 @@ function servers_get_total_modules()
 
 
 /**
- * This function will get several metrics from the database to get info about server performance
+ * This function will get several metrics from the database
+ * to get info about server performance.
  *
- * @return array with several data
+ * @return array with several data.
  */
 function servers_get_performance()
 {
@@ -161,18 +171,20 @@ function servers_get_performance()
 
     if ($config['realtimestats'] == 1) {
         $counts = db_get_all_rows_sql(
-            '
-			SELECT tagente_modulo.id_modulo,
+            'SELECT tagente_modulo.id_modulo,
 				COUNT(tagente_modulo.id_agente_modulo) modules
 			FROM tagente_modulo, tagente_estado, tagente
 			WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
 				AND tagente.id_agente = tagente_estado.id_agente
-				
 				AND tagente_modulo.disabled = 0
 				AND delete_pending = 0
-				AND (utimestamp > 0 OR (id_tipo_modulo = 100 OR (id_tipo_modulo > 21 AND id_tipo_modulo < 23)))
+				AND (utimestamp > 0
+                    OR (id_tipo_modulo = 100
+                        OR (id_tipo_modulo > 21
+                        AND id_tipo_modulo < 23)
+                    )
+                )
 				AND tagente.disabled = 0
-				
 			GROUP BY tagente_modulo.id_modulo'
         );
 
@@ -205,6 +217,10 @@ function servers_get_performance()
                 case MODULE_WEB:
                     $data['total_web_modules'] = $c['modules'];
                 break;
+
+                default:
+                    // Not possible.
+                break;
             }
 
             if ($c['id_modulo'] != MODULE_DATA) {
@@ -259,6 +275,8 @@ function servers_get_performance()
                 case SERVER_TYPE_EVENT:
                 case SERVER_TYPE_DISCOVERY:
                 case SERVER_TYPE_SYSLOG:
+                default:
+                    // Nothing.
                 break;
             }
 
@@ -272,17 +290,22 @@ function servers_get_performance()
 
     $interval_avgs = [];
 
-    // Avg of modules interval when modules have module_interval > 0
+    // Avg of modules interval when modules have module_interval > 0.
     $interval_avgs_modules = db_get_all_rows_sql(
-        '
-		SELECT count(tagente_modulo.id_modulo) modules ,
+        'SELECT count(tagente_modulo.id_modulo) modules ,
 			tagente_modulo.id_modulo,
 			AVG(tagente_modulo.module_interval) avg_interval
 		FROM tagente_modulo, tagente_estado, tagente
 		WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
 			AND tagente_modulo.disabled = 0
 			AND module_interval > 0
-			AND (utimestamp > 0 OR (id_tipo_modulo = 100 OR (id_tipo_modulo > 21 AND id_tipo_modulo < 23)))
+			AND (utimestamp > 0 OR (
+                    id_tipo_modulo = 100
+                    OR (id_tipo_modulo > 21
+                        AND id_tipo_modulo < 23
+                    )
+                )
+            )
 			AND delete_pending = 0
 			AND tagente.disabled = 0
 			AND tagente.id_agente = tagente_estado.id_agente
@@ -293,16 +316,15 @@ function servers_get_performance()
         $interval_avgs_modules = [];
     }
 
-    // Transform into a easily format
+    // Transform into a easily format.
     foreach ($interval_avgs_modules as $iamodules) {
         $interval_avgs[$iamodules['id_modulo']]['avg_interval'] = $iamodules['avg_interval'];
         $interval_avgs[$iamodules['id_modulo']]['modules'] = $iamodules['modules'];
     }
 
-    // Avg of agents interval when modules have module_interval == 0
+    // Avg of agents interval when modules have module_interval == 0.
     $interval_avgs_agents = db_get_all_rows_sql(
-        '
-		SELECT count(tagente_modulo.id_modulo) modules ,
+        'SELECT count(tagente_modulo.id_modulo) modules ,
 			tagente_modulo.id_modulo, AVG(tagente.intervalo) avg_interval
 		FROM tagente_modulo, tagente_estado, tagente
 		WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
@@ -319,50 +341,89 @@ function servers_get_performance()
         $interval_avgs_agents = [];
     }
 
-    // Merge with the previous calculated array
+    // Merge with the previous calculated array.
     foreach ($interval_avgs_agents as $iaagents) {
         if (!isset($interval_avgs[$iaagents['id_modulo']]['modules'])) {
             $interval_avgs[$iaagents['id_modulo']]['avg_interval'] = $iaagents['avg_interval'];
             $interval_avgs[$iaagents['id_modulo']]['modules'] = $iaagents['modules'];
         } else {
-            $interval_avgs[$iaagents['id_modulo']]['avg_interval'] = servers_get_avg_interval($interval_avgs[$iaagents['id_modulo']], $iaagents);
+            $interval_avgs[$iaagents['id_modulo']]['avg_interval'] = servers_get_avg_interval(
+                $interval_avgs[$iaagents['id_modulo']],
+                $iaagents
+            );
             $interval_avgs[$iaagents['id_modulo']]['modules'] += $iaagents['modules'];
         }
     }
 
+    $info_servers = array_reduce(
+        servers_get_info(),
+        function ($carry, $item) {
+            $carry[$item['server_type']] = $item;
+            return $carry;
+        }
+    );
     foreach ($interval_avgs as $id_modulo => $ia) {
+        $module_lag = 0;
         switch ($id_modulo) {
             case MODULE_DATA:
+                $module_lag = $info_servers[SERVER_TYPE_DATA]['module_lag'];
                 $data['avg_interval_local_modules'] = $ia['avg_interval'];
-                $data['local_modules_rate'] = servers_get_rate($data['avg_interval_local_modules'], $data['total_local_modules']);
+                $data['local_modules_rate'] = servers_get_rate(
+                    $data['avg_interval_local_modules'],
+                    ($data['total_local_modules'] - $module_lag)
+                );
             break;
 
             case MODULE_NETWORK:
+                $module_lag = $info_servers[SERVER_TYPE_NETWORK]['module_lag'];
+                $module_lag += $info_servers[SERVER_TYPE_SNMP]['module_lag'];
+                $module_lag += $info_servers[SERVER_TYPE_ENTERPRISE_ICMP]['module_lag'];
+                $module_lag += $info_servers[SERVER_TYPE_ENTERPRISE_SNMP]['module_lag'];
                 $data['avg_interval_network_modules'] = $ia['avg_interval'];
                 $data['network_modules_rate'] = servers_get_rate(
                     $data['avg_interval_network_modules'],
-                    $data['total_network_modules']
+                    ($data['total_network_modules'] - $module_lag)
                 );
             break;
 
             case MODULE_PLUGIN:
+                $module_lag = $info_servers[SERVER_TYPE_PLUGIN]['module_lag'];
                 $data['avg_interval_plugin_modules'] = $ia['avg_interval'];
-                $data['plugin_modules_rate'] = servers_get_rate($data['avg_interval_plugin_modules'], $data['total_plugin_modules']);
+                $data['plugin_modules_rate'] = servers_get_rate(
+                    $data['avg_interval_plugin_modules'],
+                    ($data['total_plugin_modules'] - $module_lag)
+                );
             break;
 
             case MODULE_PREDICTION:
+                $module_lag = $info_servers[SERVER_TYPE_PREDICTION]['module_lag'];
                 $data['avg_interval_prediction_modules'] = $ia['avg_interval'];
-                $data['prediction_modules_rate'] = servers_get_rate($data['avg_interval_prediction_modules'], $data['total_prediction_modules']);
+                $data['prediction_modules_rate'] = servers_get_rate(
+                    $data['avg_interval_prediction_modules'],
+                    ($data['total_prediction_modules'] - $module_lag)
+                );
             break;
 
             case MODULE_WMI:
+                $module_lag = $info_servers[SERVER_TYPE_WMI]['module_lag'];
                 $data['avg_interval_wmi_modules'] = $ia['avg_interval'];
-                $data['wmi_modules_rate'] = servers_get_rate($data['avg_interval_wmi_modules'], $data['total_wmi_modules']);
+                $data['wmi_modules_rate'] = servers_get_rate(
+                    $data['avg_interval_wmi_modules'],
+                    ($data['total_wmi_modules'] - $module_lag)
+                );
             break;
 
             case MODULE_WEB:
+                $module_lag = $info_servers[SERVER_TYPE_WEB]['module_lag'];
                 $data['avg_interval_web_modules'] = $ia['avg_interval'];
-                $data['web_modules_rate'] = servers_get_rate($data['avg_interval_web_modules'], $data['total_web_modules']);
+                $data['web_modules_rate'] = servers_get_rate(
+                    $data['avg_interval_web_modules'],
+                    ($data['total_web_modules'] - $module_lag)
+                );
+            break;
+
+            default:
+                // Not possible.
             break;
         }
 
@@ -385,25 +446,55 @@ function servers_get_performance()
         $data['avg_interval_total_modules'] = (array_sum($data['avg_interval_total_modules']) / count($data['avg_interval_total_modules']));
     }
 
-    $data['remote_modules_rate'] = servers_get_rate($data['avg_interval_remote_modules'], $data['total_remote_modules']);
-    $data['total_modules_rate'] = servers_get_rate($data['avg_interval_total_modules'], $data['total_modules']);
+    $total_modules_lag = 0;
+    foreach ($info_servers as $key => $value) {
+        switch ($key) {
+            case SERVER_TYPE_DATA:
+            case SERVER_TYPE_NETWORK:
+            case SERVER_TYPE_SNMP:
+            case SERVER_TYPE_ENTERPRISE_ICMP:
+            case SERVER_TYPE_ENTERPRISE_SNMP:
+            case SERVER_TYPE_PLUGIN:
+            case SERVER_TYPE_PREDICTION:
+            case SERVER_TYPE_WMI:
+            case SERVER_TYPE_WEB:
+                $total_modules_lag += $value['module_lag'];
+            break;
+
+            default:
+                // Not possible.
+            break;
+        }
+    }
+
+    $data['remote_modules_rate'] = servers_get_rate(
+        $data['avg_interval_remote_modules'],
+        $data['total_remote_modules']
+    );
+
+    $data['total_modules_rate'] = servers_get_rate(
+        $data['avg_interval_total_modules'],
+        ($data['total_modules'] - $total_modules_lag)
+    );
 
     return ($data);
 }
 
 
 /**
- * Get avg interval
+ * Get avg interval.
  *
- * @param mixed Array with avg and count data of first part
- * @param mixed Array with avg and count data of second part
+ * @param array $modules_avg_interval1 Array with avg and count
+ * data of first part.
+ * @param array $modules_avg_interval2 Array with avg and count
+ * data of second part.
  *
- * @return float number of avg modules between two parts
+ * @return float number of avg modules between two parts.
  */
-
-
-function servers_get_avg_interval($modules_avg_interval1, $modules_avg_interval2)
-{
+function servers_get_avg_interval(
+    $modules_avg_interval1,
+    $modules_avg_interval2
+) {
     $total_modules = ($modules_avg_interval1['modules'] + $modules_avg_interval2['modules']);
 
     $parcial1 = ($modules_avg_interval1['avg_interval'] * $modules_avg_interval1['modules']);
@@ -416,21 +507,23 @@ function servers_get_avg_interval($modules_avg_interval1, $modules_avg_interval2
 /**
  * Get server rate
  *
- * @param float avg of interval of these modules
- * @param int number of modules
+ * @param float   $avg_interval Avg of interval of these modules.
+ * @param integer $num_modules  Number of modules.
  *
  * @return float number of modules processed by second
  */
 function servers_get_rate($avg_interval, $num_modules)
 {
-    return $avg_interval > 0 ? ($num_modules / $avg_interval) : 0;
+    return ($avg_interval > 0) ? ($num_modules / $avg_interval) : 0;
 }
 
 
 /**
- * This function will get all the server information in an array or a specific server
+ * This function will get all the server information in an array
+ * or a specific server.
  *
- * @param mixed An optional integer or array of integers to select specific servers
+ * @param integer $id_server An optional integer or array of integers
+ * to select specific servers.
  *
  * @return mixed False in case the server doesn't exist or an array with info.
  */
@@ -461,127 +554,211 @@ function servers_get_info($id_server=-1)
     foreach ($result as $server) {
         switch ($server['server_type']) {
             case SERVER_TYPE_DATA:
-                $server['img'] = html_print_image('images/data.png', true, ['title' => __('Data server')]);
+                $server['img'] = html_print_image(
+                    'images/data.png',
+                    true,
+                    ['title' => __('Data server')]
+                );
                 $server['type'] = 'data';
                 $id_modulo = 1;
             break;
 
             case SERVER_TYPE_NETWORK:
-                $server['img'] = html_print_image('images/network.png', true, ['title' => __('Network server')]);
+                $server['img'] = html_print_image(
+                    'images/network.png',
+                    true,
+                    ['title' => __('Network server')]
+                );
                 $server['type'] = 'network';
                 $id_modulo = 2;
             break;
 
             case SERVER_TYPE_SNMP:
-                $server['img'] = html_print_image('images/snmp.png', true, ['title' => __('SNMP Trap server')]);
+                $server['img'] = html_print_image(
+                    'images/snmp.png',
+                    true,
+                    ['title' => __('SNMP Trap server')]
+                );
                 $server['type'] = 'snmp';
                 $id_modulo = 0;
             break;
 
             case SERVER_TYPE_DISCOVERY:
-                $server['img'] = html_print_image('images/recon.png', true, ['title' => __('Discovery server')]);
+                $server['img'] = html_print_image(
+                    'images/recon.png',
+                    true,
+                    ['title' => __('Discovery server')]
+                );
                 $server['type'] = 'recon';
                 $id_modulo = 0;
             break;
 
             case SERVER_TYPE_PLUGIN:
-                $server['img'] = html_print_image('images/plugin.png', true, ['title' => __('Plugin server')]);
+                $server['img'] = html_print_image(
+                    'images/plugin.png',
+                    true,
+                    ['title' => __('Plugin server')]
+                );
                 $server['type'] = 'plugin';
                 $id_modulo = 4;
             break;
 
             case SERVER_TYPE_PREDICTION:
-                $server['img'] = html_print_image('images/chart_bar.png', true, ['title' => __('Prediction server')]);
+                $server['img'] = html_print_image(
+                    'images/chart_bar.png',
+                    true,
+                    ['title' => __('Prediction server')]
+                );
                 $server['type'] = 'prediction';
                 $id_modulo = 5;
             break;
 
             case SERVER_TYPE_WMI:
-                $server['img'] = html_print_image('images/wmi.png', true, ['title' => __('WMI server')]);
+                $server['img'] = html_print_image(
+                    'images/wmi.png',
+                    true,
+                    ['title' => __('WMI server')]
+                );
                 $server['type'] = 'wmi';
                 $id_modulo = 6;
             break;
 
             case SERVER_TYPE_EXPORT:
-                $server['img'] = html_print_image('images/server_export.png', true, ['title' => __('Export server')]);
+                $server['img'] = html_print_image(
+                    'images/server_export.png',
+                    true,
+                    ['title' => __('Export server')]
+                );
                 $server['type'] = 'export';
                 $id_modulo = 0;
             break;
 
             case SERVER_TYPE_INVENTORY:
-                $server['img'] = html_print_image('images/page_white_text.png', true, ['title' => __('Inventory server')]);
+                $server['img'] = html_print_image(
+                    'images/page_white_text.png',
+                    true,
+                    ['title' => __('Inventory server')]
+                );
                 $server['type'] = 'inventory';
                 $id_modulo = 0;
             break;
 
             case SERVER_TYPE_WEB:
-                $server['img'] = html_print_image('images/world.png', true, ['title' => __('Web server')]);
+                $server['img'] = html_print_image(
+                    'images/world.png',
+                    true,
+                    ['title' => __('Web server')]
+                );
                 $server['type'] = 'web';
                 $id_modulo = 0;
             break;
 
             case SERVER_TYPE_EVENT:
-                $server['img'] = html_print_image('images/lightning_go.png', true, ['title' => __('Event server')]);
+                $server['img'] = html_print_image(
+                    'images/lightning_go.png',
+                    true,
+                    ['title' => __('Event server')]
+                );
                 $server['type'] = 'event';
                 $id_modulo = 2;
             break;
 
             case SERVER_TYPE_ENTERPRISE_ICMP:
-                $server['img'] = html_print_image('images/network.png', true, ['title' => __('Enterprise ICMP server')]);
+                $server['img'] = html_print_image(
+                    'images/network.png',
+                    true,
+                    ['title' => __('Enterprise ICMP server')]
+                );
                 $server['type'] = 'enterprise icmp';
                 $id_modulo = 2;
             break;
 
             case SERVER_TYPE_ENTERPRISE_SNMP:
-                $server['img'] = html_print_image('images/network.png', true, ['title' => __('Enterprise SNMP server')]);
+                $server['img'] = html_print_image(
+                    'images/network.png',
+                    true,
+                    ['title' => __('Enterprise SNMP server')]
+                );
                 $server['type'] = 'enterprise snmp';
                 $id_modulo = 2;
             break;
 
             case SERVER_TYPE_ENTERPRISE_SATELLITE:
-                $server['img'] = html_print_image('images/satellite.png', true, ['title' => __('Enterprise Satellite server')]);
+                $server['img'] = html_print_image(
+                    'images/satellite.png',
+                    true,
+                    ['title' => __('Enterprise Satellite server')]
+                );
                 $server['type'] = 'enterprise satellite';
                 $id_modulo = 0;
             break;
 
             case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL:
-                $server['img'] = html_print_image('images/transactional_map.png', true, ['title' => __('Enterprise Transactional server')]);
+                $server['img'] = html_print_image(
+                    'images/transactional_map.png',
+                    true,
+                    ['title' => __('Enterprise Transactional server')]
+                );
                 $server['type'] = 'enterprise transactional';
                 $id_modulo = 0;
             break;
 
             case SERVER_TYPE_MAINFRAME:
-                $server['img'] = html_print_image('images/mainframe.png', true, ['title' => __('Mainframe server')]);
+                $server['img'] = html_print_image(
+                    'images/mainframe.png',
+                    true,
+                    ['title' => __('Mainframe server')]
+                );
                 $server['type'] = 'mainframe';
                 $id_modulo = 0;
             break;
 
             case SERVER_TYPE_SYNC:
-                $server['img'] = html_print_image('images/sync.png', true, ['title' => __('Sync server')]);
+                $server['img'] = html_print_image(
+                    'images/sync.png',
+                    true,
+                    ['title' => __('Sync server')]
+                );
                 $server['type'] = 'sync';
                 $id_modulo = 0;
             break;
 
             case SERVER_TYPE_WUX:
-                $server['img'] = html_print_image('images/icono-wux.png', true, ['title' => __('Wux server')]);
+                $server['img'] = html_print_image(
+                    'images/icono-wux.png',
+                    true,
+                    ['title' => __('Wux server')]
+                );
                 $server['type'] = 'wux';
                 $id_modulo = 0;
             break;
 
             case SERVER_TYPE_SYSLOG:
-                $server['img'] = html_print_image('images/syslog.png', true, ['title' => __('Syslog server')]);
+                $server['img'] = html_print_image(
+                    'images/syslog.png',
+                    true,
+                    ['title' => __('Log server')]
+                );
                 $server['type'] = 'syslog';
                 $id_modulo = 0;
             break;
 
             case SERVER_TYPE_AUTOPROVISION:
-                $server['img'] = html_print_image('images/autoprovision.png', true, ['title' => __('Autoprovision server')]);
+                $server['img'] = html_print_image(
+                    'images/autoprovision.png',
+                    true,
+                    ['title' => __('Autoprovision server')]
+                );
                 $server['type'] = 'autoprovision';
                 $id_modulo = 0;
             break;
 
             case SERVER_TYPE_MIGRATION:
-                $server['img'] = html_print_image('images/migration.png', true, ['title' => __('Migration server')]);
+                $server['img'] = html_print_image(
+                    'images/migration.png',
+                    true,
+                    ['title' => __('Migration server')]
+                );
                 $server['type'] = 'migration';
                 $id_modulo = 0;
             break;
@@ -594,31 +771,54 @@ function servers_get_info($id_server=-1)
         }
 
         if ($config['realtimestats'] == 0) {
-            // ---------------------------------------------------------------
-            // Take data from database if not realtime stats
-            // ---------------------------------------------------------------
-            $server['lag'] = db_get_sql('SELECT lag_time FROM tserver WHERE id_server = '.$server['id_server']);
-            $server['module_lag'] = db_get_sql('SELECT lag_modules FROM tserver WHERE id_server = '.$server['id_server']);
-            $server['modules'] = db_get_sql('SELECT my_modules FROM tserver WHERE id_server = '.$server['id_server']);
-            $server['modules_total'] = db_get_sql('SELECT total_modules_running FROM tserver WHERE id_server = '.$server['id_server']);
+            // Take data from database if not realtime stats.
+            $server['lag'] = db_get_sql(
+                'SELECT lag_time
+                FROM tserver
+                WHERE id_server = '.$server['id_server']
+            );
+            $server['module_lag'] = db_get_sql(
+                'SELECT lag_modules
+                FROM tserver
+                WHERE id_server = '.$server['id_server']
+            );
+            $server['modules'] = db_get_sql(
+                'SELECT my_modules
+                FROM tserver
+                WHERE id_server = '.$server['id_server']
+            );
+            $server['modules_total'] = db_get_sql(
+                'SELECT total_modules_running
+                FROM tserver
+                WHERE id_server = '.$server['id_server']
+            );
         } else {
-            // ---------------------------------------------------------------
-            // Take data in realtime
-            // ---------------------------------------------------------------
+            // Take data in realtime.
             $server['module_lag'] = 0;
             $server['lag'] = 0;
 
-            // Inventory server
+            // Inventory server.
             if ($server['server_type'] == SERVER_TYPE_INVENTORY) {
-                // Get modules exported by this server
-                $server['modules'] = db_get_sql("SELECT COUNT(tagent_module_inventory.id_agent_module_inventory) FROM tagente, tagent_module_inventory WHERE tagente.disabled=0 AND tagent_module_inventory.id_agente = tagente.id_agente AND tagente.server_name = '".$server['name']."'");
+                // Get modules exported by this server.
+                $server['modules'] = db_get_sql(
+                    "SELECT COUNT(tagent_module_inventory.id_agent_module_inventory)
+                    FROM tagente, tagent_module_inventory
+                    WHERE tagente.disabled=0
+                        AND tagent_module_inventory.id_agente = tagente.id_agente
+                        AND tagente.server_name = '".$server['name']."'"
+                );
 
-                // Get total exported modules
-                $server['modules_total'] = db_get_sql('SELECT COUNT(tagent_module_inventory.id_agent_module_inventory) FROM tagente, tagent_module_inventory WHERE tagente.disabled=0 AND tagent_module_inventory.id_agente = tagente.id_agente');
+                // Get total exported modules.
+                $server['modules_total'] = db_get_sql(
+                    'SELECT COUNT(tagent_module_inventory.id_agent_module_inventory)
+                    FROM tagente, tagent_module_inventory
+                    WHERE tagente.disabled=0
+                    AND tagent_module_inventory.id_agente = tagente.id_agente'
+                );
 
                 $interval_esc = db_escape_key_identifier('interval');
 
-                // Get the module lag
+                // Get the module lag.
                 $server['module_lag'] = db_get_sql(
                     'SELECT COUNT(tagent_module_inventory.id_agent_module_inventory) AS module_lag
 					FROM tagente, tagent_module_inventory
@@ -630,7 +830,7 @@ function servers_get_info($id_server=-1)
 					AND (UNIX_TIMESTAMP() - utimestamp) > tagent_module_inventory.'.$interval_esc
                 );
 
-                // Get the lag
+                // Get the lag.
                 $server['lag'] = db_get_sql(
                     'SELECT AVG(UNIX_TIMESTAMP() - utimestamp - tagent_module_inventory.'.$interval_esc.')
 					FROM tagente, tagent_module_inventory
@@ -641,162 +841,119 @@ function servers_get_info($id_server=-1)
 					AND (UNIX_TIMESTAMP() - utimestamp) < (tagent_module_inventory.".$interval_esc.' * 10)
 					AND (UNIX_TIMESTAMP() - utimestamp) > tagent_module_inventory.'.$interval_esc
                 );
-                // Export server
+                // Export server.
             } else if ($server['server_type'] == SERVER_TYPE_EXPORT) {
-                // Get modules exported by this server
-                $server['modules'] = db_get_sql('SELECT COUNT(tagente_modulo.id_agente_modulo) FROM tagente, tagente_modulo, tserver_export WHERE tagente.disabled=0 AND tagente_modulo.id_agente = tagente.id_agente AND tagente_modulo.id_export = tserver_export.id AND tserver_export.id_export_server = '.$server['id_server']);
+                // Get modules exported by this server.
+                $server['modules'] = db_get_sql(
+                    'SELECT COUNT(tagente_modulo.id_agente_modulo)
+                    FROM tagente, tagente_modulo, tserver_export
+                    WHERE tagente.disabled=0
+                        AND tagente_modulo.id_agente = tagente.id_agente
+                        AND tagente_modulo.id_export = tserver_export.id
+                        AND tserver_export.id_export_server = '.$server['id_server']
+                );
 
-                // Get total exported modules
-                $server['modules_total'] = db_get_sql('SELECT COUNT(tagente_modulo.id_agente_modulo) FROM tagente, tagente_modulo WHERE tagente.disabled=0 AND tagente_modulo.id_agente = tagente.id_agente AND tagente_modulo.id_export != 0');
+                // Get total exported modules.
+                $server['modules_total'] = db_get_sql(
+                    'SELECT COUNT(tagente_modulo.id_agente_modulo)
+                    FROM tagente, tagente_modulo
+                    WHERE tagente.disabled=0
+                        AND tagente_modulo.id_agente = tagente.id_agente
+                        AND tagente_modulo.id_export != 0'
+                );
 
                 $server['lag'] = 0;
                 $server['module_lag'] = 0;
-            }
-            // Discovery server
-            else if ($server['server_type'] == SERVER_TYPE_DISCOVERY) {
+            } else if ($server['server_type'] == SERVER_TYPE_DISCOVERY) {
+                // Discovery server.
                 $server['name'] = '<a href="index.php?sec=estado&amp;sec2=operation/servers/recon_view&amp;server_id='.$server['id_server'].'">'.$server['name'].'</a>';
 
-                // Total jobs running on this Discovery server
+                // Total jobs running on this Discovery server.
                 $server['modules'] = db_get_sql(
                     'SELECT COUNT(id_rt)
 					FROM trecon_task
 					WHERE id_recon_server = '.$server['id_server']
                 );
 
-                // Total recon jobs (all servers)
-                $server['modules_total'] = db_get_sql('SELECT COUNT(status) FROM trecon_task');
+                // Total recon jobs (all servers).
+                $server['modules_total'] = db_get_sql(
+                    'SELECT COUNT(status) FROM trecon_task'
+                );
 
-                // Lag (take average active time of all active tasks)
+                // Lag (take average active time of all active tasks).
                 $server['module_lag'] = 0;
-
-                switch ($config['dbtype']) {
-                    case 'mysql':
-                        $server['lag'] = db_get_sql('SELECT UNIX_TIMESTAMP() - utimestamp from trecon_task WHERE UNIX_TIMESTAMP()  > (utimestamp + interval_sweep) AND id_recon_server = '.$server['id_server']);
-
-                        $server['module_lag'] = db_get_sql('SELECT COUNT(id_rt) FROM trecon_task WHERE UNIX_TIMESTAMP()  > (utimestamp + interval_sweep) AND id_recon_server = '.$server['id_server']);
-                    break;
-
-                    case 'postgresql':
-                        $server['lag'] = db_get_sql("SELECT ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp from trecon_task WHERE ceil(date_part('epoch', CURRENT_TIMESTAMP))  > (utimestamp + interval_sweep) AND id_recon_server = ".$server['id_server']);
-
-                        $server['module_lag'] = db_get_sql("SELECT COUNT(id_rt) FROM trecon_task WHERE ceil(date_part('epoch', CURRENT_TIMESTAMP))  > (utimestamp + interval_sweep) AND id_recon_server = ".$server['id_server']);
-                    break;
-
-                    case 'oracle':
-                        $server['lag'] = db_get_sql("SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.")) - utimestamp from trecon_task WHERE ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.'))  > (utimestamp + interval_sweep) AND id_recon_server = '.$server['id_server']);
-
-                        $server['module_lag'] = db_get_sql("SELECT COUNT(id_rt) FROM trecon_task WHERE ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.'))  > (utimestamp + interval_sweep) AND id_recon_server = '.$server['id_server']);
-                    break;
-                }
+                $server['lag'] = db_get_sql(
+                    'SELECT UNIX_TIMESTAMP() - utimestamp
+                    FROM trecon_task
+                    WHERE UNIX_TIMESTAMP()  > (utimestamp + interval_sweep)
+                    AND id_recon_server = '.$server['id_server']
+                );
+                $server['module_lag'] = db_get_sql(
+                    'SELECT COUNT(id_rt)
+                    FROM trecon_task
+                    WHERE UNIX_TIMESTAMP()  > (utimestamp + interval_sweep)
+                    AND id_recon_server = '.$server['id_server']
+                );
             } else {
-                // ---------------------------------------------------------------
-                // Data, Plugin, WMI, Network and Others
-                $server['modules'] = db_get_sql('SELECT count(tagente_estado.id_agente_modulo) FROM tagente_estado, tagente_modulo, tagente WHERE tagente.disabled=0 AND tagente_modulo.id_agente = tagente.id_agente AND tagente_modulo.disabled = 0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_estado.running_by = '.$server['id_server']);
+                // Data, Plugin, WMI, Network and Others.
+                $server['modules'] = db_get_sql(
+                    'SELECT count(tagente_estado.id_agente_modulo)
+                    FROM tagente_estado, tagente_modulo, tagente
+                    WHERE tagente.disabled=0
+                        AND tagente_modulo.id_agente = tagente.id_agente
+                        AND tagente_modulo.disabled = 0
+                        AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
+                        AND tagente_estado.running_by = '.$server['id_server']
+                );
 
-                $server['modules_total'] = db_get_sql('SELECT count(tagente_estado.id_agente_modulo) FROM tserver, tagente_estado, tagente_modulo, tagente WHERE tagente.disabled=0 AND tagente_modulo.id_agente = tagente.id_agente AND tagente_modulo.disabled = 0 AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_estado.running_by = tserver.id_server AND tserver.server_type = '.$server['server_type']);
+                $server['modules_total'] = db_get_sql(
+                    'SELECT count(tagente_estado.id_agente_modulo)
+                    FROM tserver, tagente_estado, tagente_modulo, tagente
+                    WHERE tagente.disabled=0
+                    AND tagente_modulo.id_agente = tagente.id_agente
+                    AND tagente_modulo.disabled = 0
+                    AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
+                    AND tagente_estado.running_by = tserver.id_server
+                    AND tserver.server_type = '.$server['server_type']
+                );
 
-                // Remote servers LAG Calculation (server_type != 0)
+                // Remote servers LAG Calculation (server_type != 0).
                 if ($server['server_type'] != 0) {
-                    switch ($config['dbtype']) {
-                        case 'mysql':
-                            $result = db_get_row_sql(
-                                'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
-								WHERE utimestamp > 0
-								AND tagente.disabled = 0
-								AND tagente.id_agente = tagente_estado.id_agente
-								AND tagente_modulo.disabled = 0
-								AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
-								AND current_interval > 0
-								AND running_by = '.$server['id_server'].'
-								AND (UNIX_TIMESTAMP() - utimestamp) < ( current_interval * 10)
-								AND (UNIX_TIMESTAMP() - utimestamp) > current_interval'
-                            );
-                        break;
-
-                        case 'postgresql':
-                            $result = db_get_row_sql(
-                                "SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
-								WHERE utimestamp > 0
-								AND tagente.disabled = 0
-								AND tagente.id_agente = tagente_estado.id_agente
-								AND tagente_modulo.disabled = 0
-								AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
-								AND current_interval > 0
-								AND running_by = ".$server['id_server']."
-								AND (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp) < ( current_interval * 10)
-								AND (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp) > current_interval"
-                            );
-                        break;
-
-                        case 'oracle':
-                            $result = db_get_row_sql(
-                                "SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
-								WHERE utimestamp > 0
-								AND tagente.disabled = 0
-								AND tagente.id_agente = tagente_estado.id_agente
-								AND tagente_modulo.disabled = 0
-								AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
-								AND current_interval > 0
-								AND running_by = '.$server['id_server']."
-								AND (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.")) - utimestamp) < ( current_interval * 10)
-								AND (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) - utimestamp) * (".SECONDS_1DAY.')) > current_interval'
-                            );
-                        break;
-                    }
+                    $result = db_get_row_sql(
+                        'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag,
+                            AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag
+                        FROM tagente_estado, tagente_modulo, tagente
+                        WHERE utimestamp > 0
+                            AND tagente.disabled = 0
+                            AND tagente.id_agente = tagente_estado.id_agente
+                            AND tagente_modulo.disabled = 0
+                            AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
+                            AND current_interval > 0
+                            AND running_by = '.$server['id_server'].'
+                            AND (UNIX_TIMESTAMP() - utimestamp) < ( current_interval * 10)
+                            AND (UNIX_TIMESTAMP() - utimestamp) > current_interval'
+                    );
                 } else {
-                    // Local/Dataserver server LAG calculation:
-                    switch ($config['dbtype']) {
-                        case 'mysql':
-                            $result = db_get_row_sql(
-                                'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
-								WHERE utimestamp > 0
-								AND tagente.disabled = 0
-								AND tagente.id_agente = tagente_estado.id_agente
-								AND tagente_modulo.disabled = 0
-								AND tagente_modulo.id_tipo_modulo < 5
-								AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
-								AND current_interval > 0
-								AND (UNIX_TIMESTAMP() - utimestamp) < ( current_interval * 10)
-								AND running_by = '.$server['id_server'].'
-								AND (UNIX_TIMESTAMP() - utimestamp) > (current_interval * 1.1)'
-                            );
-                        break;
-
-                        case 'postgresql':
-                            $result = db_get_row_sql(
-                                "SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
-								WHERE utimestamp > 0
-								AND tagente.disabled = 0
-								AND tagente.id_agente = tagente_estado.id_agente
-								AND tagente_modulo.disabled = 0
-								AND tagente_modulo.id_tipo_modulo < 5 
-								AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
-								AND current_interval > 0
-								AND (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp) < ( current_interval * 10)
-								AND running_by = ".$server['id_server']."
-								AND (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - utimestamp) > (current_interval * 1.1)"
-                            );
-                        break;
-
-                        case 'oracle':
-                            $result = db_get_row_sql(
-                                "SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.")) - utimestamp - current_interval) AS lag FROM tagente_estado, tagente_modulo, tagente
-								WHERE utimestamp > 0
-								AND tagente.disabled = 0
-								AND tagente.id_agente = tagente_estado.id_agente
-								AND tagente_modulo.disabled = 0
-								AND tagente_modulo.id_tipo_modulo < 5 
-								AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
-								AND current_interval > 0
-								AND (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - utimestamp) < ( current_interval * 10)
-								AND running_by = '.$server['id_server']."
-								AND (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - utimestamp) > (current_interval * 1.1)'
-                            );
-                        break;
-                    }
+                    // Local/Dataserver server LAG calculation.
+                    $result = db_get_row_sql(
+                        'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag,
+                            AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag
+                        FROM tagente_estado, tagente_modulo, tagente
+                        WHERE utimestamp > 0
+                            AND tagente.disabled = 0
+                            AND tagente.id_agente = tagente_estado.id_agente
+                            AND tagente_modulo.disabled = 0
+                            AND tagente_modulo.id_tipo_modulo < 5
+                            AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
+                            AND current_interval > 0
+                            AND (UNIX_TIMESTAMP() - utimestamp) < ( current_interval * 10)
+                            AND running_by = '.$server['id_server'].'
+                            AND (UNIX_TIMESTAMP() - utimestamp) > (current_interval * 1.1)'
+                    );
                 }
 
-                // Lag over current_interval * 2 is not lag, it's a timed out module
+                // Lag over current_interval * 2 is not lag,
+                // it's a timed out module.
                 if (!empty($result['lag'])) {
                     $server['lag'] = $result['lag'];
                 }
@@ -805,28 +962,37 @@ function servers_get_info($id_server=-1)
                     $server['module_lag'] = $result['module_lag'];
                 }
             }
-        } //end if
+        }
 
         if (isset($server['module_lag'])) {
-            $server['lag_txt'] = ($server['lag'] == 0 ? '-' : human_time_description_raw($server['lag'])).' / '.$server['module_lag'];
+            $server['lag_txt'] = (($server['lag'] == 0) ? '-' : human_time_description_raw($server['lag'])).' / '.$server['module_lag'];
         } else {
             $server['lag_txt'] = '';
         }
 
         if ($server['modules_total'] > 0) {
-            $server['load'] = round(($server['modules'] / $server['modules_total'] * 100));
+            $server['load'] = round(
+                ($server['modules'] / $server['modules_total'] * 100)
+            );
         } else {
             $server['load'] = 0;
         }
 
-        // Push the raw data on the return stack
+        // Push the raw data on the return stack.
         $return[$server['id_server']] = $server;
-    } //end foreach
+    }
 
     return $return;
 }
 
 
+/**
+ * Get server type
+ *
+ * @param integer $type Type.
+ *
+ * @return array Result.
+ */
 function servers_get_servers_type($type)
 {
     return db_get_all_rows_filter('tserver', ['server_type' => $type]);
@@ -836,25 +1002,28 @@ function servers_get_servers_type($type)
 /**
  * Get the server name.
  *
- * @param int Server id.
+ * @param integer $id_server Server id.
  *
  * @return string Name of the given server
  */
 function servers_get_name($id_server)
 {
-    return (string) db_get_value('name', 'tserver', 'id_server', (int) $id_server);
+    return (string) db_get_value(
+        'name',
+        'tserver',
+        'id_server',
+        (int) $id_server
+    );
 }
 
 
 /**
- * Get the presence of .conf and .md5 into remote_config dir
+ * Get the presence of .conf and .md5 into remote_config dir.
  *
- * @param string Agent name
+ * @param string $server_name Agent name.
  *
- * @return true if files exist and are writable
+ * @return true If files exist and are writable.
  */
-
-
 function servers_check_remote_config($server_name)
 {
     global $config;
@@ -862,8 +1031,12 @@ function servers_check_remote_config($server_name)
     $server_md5 = md5($server_name, false);
 
     $filenames = [];
-    $filenames['md5'] = io_safe_output($config['remote_config']).'/md5/'.$server_md5.'.srv.md5';
-    $filenames['conf'] = io_safe_output($config['remote_config']).'/conf/'.$server_md5.'.srv.conf';
+    $filenames['md5'] = io_safe_output(
+        $config['remote_config']
+    ).'/md5/'.$server_md5.'.srv.md5';
+    $filenames['conf'] = io_safe_output(
+        $config['remote_config']
+    ).'/conf/'.$server_md5.'.srv.conf';
 
     if (! isset($filenames['conf'])) {
         return false;
@@ -881,14 +1054,15 @@ function servers_check_remote_config($server_name)
 
 
 /**
- * Return a string containing image tag for a given target id (server)
- * TODO: Make this print_servertype_icon and move to functions_ui.php. Make XHTML compatible. Make string translatable
+ * Return a string containing image tag for a given target id (server).
+ * TODO: Make this print_servertype_icon and move to functions_ui.php.
+ *      Make XHTML compatible. Make string translatable.
  *
- * @deprecated Use print_servertype_icon instead
+ * @param integer $id Server type id.
  *
- * @param int Server type id
+ * @deprecated Use print_servertype_icon instead.
  *
- * @return string Fully formatted IMG HTML tag with icon
+ * @return string Fully formatted IMG HTML tag with icon.
  */
 function servers_show_type($id)
 {
@@ -896,37 +1070,67 @@ function servers_show_type($id)
 
     switch ($id) {
         case 1:
-        return html_print_image('images/database.png', true, ['title' => get_product_name().' Data server']);
+            $return = html_print_image(
+                'images/database.png',
+                true,
+                ['title' => get_product_name().' Data server']
+            );
+        break;
 
-            break;
         case 2:
-        return html_print_image('images/network.png', true, ['title' => get_product_name().' Network server']);
+            $return = html_print_image(
+                'images/network.png',
+                true,
+                ['title' => get_product_name().' Network server']
+            );
+        break;
 
-            break;
         case 4:
-        return html_print_image('images/plugin.png', true, ['title' => get_product_name().' Plugin server']);
+            $return = html_print_image(
+                'images/plugin.png',
+                true,
+                ['title' => get_product_name().' Plugin server']
+            );
+        break;
 
-            break;
         case 5:
-        return html_print_image('images/chart_bar.png', true, ['title' => get_product_name().' Prediction server']);
+            $return = html_print_image(
+                'images/chart_bar.png',
+                true,
+                ['title' => get_product_name().' Prediction server']
+            );
+        break;
 
-            break;
         case 6:
-        return html_print_image('images/wmi.png', true, ['title' => get_product_name().' WMI server']);
+            $return = html_print_image(
+                'images/wmi.png',
+                true,
+                ['title' => get_product_name().' WMI server']
+            );
+        break;
 
-            break;
         case 7:
-        return html_print_image('images/server_web.png', true, ['title' => get_product_name().' WEB server']);
+            $return = html_print_image(
+                'images/server_web.png',
+                true,
+                ['title' => get_product_name().' WEB server']
+            );
+        break;
 
-            break;
         case 8:
-        return html_print_image('images/module-wux.png', true, ['title' => get_product_name().' WUX server']);
+            $return = html_print_image(
+                'images/module-wux.png',
+                true,
+                ['title' => get_product_name().' WUX server']
+            );
+        break;
 
-            break;
         default:
-        return '--';
-            break;
+            $return = '--';
+        break;
     }
+
+    return $return;
 }
 
 
@@ -941,28 +1145,10 @@ function servers_check_status()
 {
     global $config;
 
-    switch ($config['dbtype']) {
-        case 'mysql':
-            $sql = 'SELECT COUNT(id_server)
-				FROM tserver
-				WHERE status = 1
-					AND keepalive > NOW() - INTERVAL server_keepalive*2 SECOND';
-        break;
-
-        case 'postgresql':
-            $sql = "SELECT COUNT(id_server)
-				FROM tserver
-				WHERE status = 1
-					AND keepalive > NOW() - INTERVAL 'server_keepalive*2 SECOND'";
-        break;
-
-        case 'oracle':
-            $sql = "SELECT COUNT(id_server)
-				FROM tserver
-				WHERE status = 1
-					AND keepalive > systimestamp - INTERVAL 'server_keepalive*2' SECOND";
-        break;
-    }
+    $sql = 'SELECT COUNT(id_server)
+        FROM tserver
+        WHERE status = 1
+            AND keepalive > NOW() - INTERVAL server_keepalive*2 SECOND';
 
     $status = (int) db_get_sql($sql);
     // Cast as int will assure a number value
@@ -972,10 +1158,9 @@ function servers_check_status()
 
 
 /**
- * @deprecated use servers_get_info instead
  * Get statistical information for a given server
  *
- * @param int Server id to get status.
+ * @param integer $id_server Server id to get status.
  *
  * @return array Server info array
  */
@@ -1036,7 +1221,7 @@ function servers_get_server_string_name(int $server)
         return __('Discovery server');
 
         case SERVER_TYPE_SYSLOG:
-        return __('Syslog server');
+        return __('Log server');
 
         case SERVER_TYPE_WUX:
         return __('WUX server');
diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php
index ca2b2d055b..dc423481f2 100644
--- a/pandora_console/include/functions_snmp_browser.php
+++ b/pandora_console/include/functions_snmp_browser.php
@@ -96,7 +96,6 @@ function snmp_browser_get_html_tree(
     foreach ($tree['__LEAVES__'] as $level => $sub_level) {
         // Id used to expand leafs.
         $sub_id = time().rand(0, getrandmax());
-
         // Display the branch.
         $output .= '<li id="li_'.$sub_id.'" style="margin: 0; padding: 0;">';
 
@@ -174,7 +173,6 @@ function snmp_browser_get_html_tree(
             $last_array,
             $sufix,
             $checked,
-            $return,
             $descriptive_ids,
             $previous_id
         );
@@ -225,7 +223,6 @@ function snmp_browser_print_tree(
         $last_array,
         $sufix,
         $checked,
-        $return,
         $descriptive_ids,
         $previous_id
     );
@@ -597,7 +594,7 @@ function snmp_browser_print_oid(
  *
  * @return string The container div.
  */
-function snmp_browser_print_container($return=false, $width='100%', $height='500px', $display='')
+function snmp_browser_print_container($return=false, $width='100%', $height='60%', $display='')
 {
     // Target selection
     $table = new stdClass();
@@ -756,10 +753,10 @@ function snmp_browser_print_container($return=false, $width='100%', $height='500
         $output .= '<div id="snmp3_browser_options" style="display: none;">';
     }
 
-    $output .= ui_toggle(html_print_table($table3, true), __('SNMP v3 options'), '', true, true);
+    $output .= ui_toggle(html_print_table($table3, true), __('SNMP v3 options'), '', '', true, true);
     $output .= '</div>';
     $output .= '<div style="width: 100%; padding-top: 10px;">';
-    $output .= ui_toggle(html_print_table($table2, true), __('Search options'), '', true, true);
+    $output .= ui_toggle(html_print_table($table2, true), __('Search options'), '', '', true, true);
     $output .= '</div>';
 
     // SNMP tree container
@@ -773,7 +770,7 @@ function snmp_browser_print_container($return=false, $width='100%', $height='500
 
     $output .= '<div id="search_results" style="display: none; padding: 5px; background-color: #EAEAEA; border: 1px solid #E2E2E2; border-radius: 4px;"></div>';
     $output .= '<div id="spinner" style="position: absolute; top:0; left:0px; display:none; padding: 5px;">'.html_print_image('images/spinner.gif', true).'</div>';
-    $output .= '<div id="snmp_browser" style="height: 100%; overflow: auto; background-color: #F4F5F4; border: 1px solid #E2E2E2; border-radius: 4px; padding: 5px;"></div>';
+    $output .= '<div id="snmp_browser" style="height: 100%; min-height:100px; overflow: auto; background-color: #F4F5F4; border: 1px solid #E2E2E2; border-radius: 4px; padding: 5px;"></div>';
     $output .= '<div class="databox" id="snmp_data" style="margin: 5px;"></div>';
     $output .= '</div>';
     $output .= '</div>';
diff --git a/pandora_console/include/functions_tactical.php b/pandora_console/include/functions_tactical.php
index c10f194386..39f44a9beb 100644
--- a/pandora_console/include/functions_tactical.php
+++ b/pandora_console/include/functions_tactical.php
@@ -444,7 +444,7 @@ function tactical_monitor_fired_alerts($group_array, $strict_user=false, $id_gro
 		WHERE tagente.id_grupo IN $group_clause_strict AND tagente_modulo.id_agente = tagente.id_agente
 			AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
 			AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo 
-			AND times_fired > 0 ";
+			AND times_fired > 0 AND talert_template_modules.disabled = 0";
 
         $count = db_get_sql($sql);
         return $count;
@@ -456,7 +456,7 @@ function tactical_monitor_fired_alerts($group_array, $strict_user=false, $id_gro
 			WHERE tagente.id_grupo IN $group_clause AND tagente_modulo.id_agente = tagente.id_agente
 				AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
 				AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo 
-				AND times_fired > 0"
+				AND times_fired > 0 AND talert_template_modules.disabled = 0"
         );
     }
 
diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php
index 952677ce66..aad6d78efd 100644
--- a/pandora_console/include/functions_tags.php
+++ b/pandora_console/include/functions_tags.php
@@ -744,7 +744,9 @@ function tags_get_acl_tags(
     $query_table='',
     $meta=false,
     $childrens_ids=[],
-    $force_group_and_tag=false
+    $force_group_and_tag=false,
+    $id_grupo_table_pretag='',
+    $alt_id_grupo_table_pretag=''
 ) {
     global $config;
 
@@ -814,7 +816,14 @@ function tags_get_acl_tags(
 
         case 'event_condition':
             // Return the condition of the tags for tevento table.
-            $condition = tags_get_acl_tags_event_condition($acltags, $meta, $force_group_and_tag);
+            $condition = tags_get_acl_tags_event_condition(
+                $acltags,
+                $meta,
+                $force_group_and_tag,
+                false,
+                $id_grupo_table_pretag,
+                $alt_id_grupo_table_pretag
+            );
 
             if (!empty($condition)) {
                 return " $query_prefix ".'('.$condition.')';
@@ -905,8 +914,14 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table='', $force_
  */
 
 
-function tags_get_acl_tags_event_condition($acltags, $meta=false, $force_group_and_tag=false, $force_equal=false)
-{
+function tags_get_acl_tags_event_condition(
+    $acltags,
+    $meta=false,
+    $force_group_and_tag=false,
+    $force_equal=false,
+    $id_grupo_table_pretag='',
+    $alt_id_grupo_table_pretag=''
+) {
     global $config;
     $condition = [];
 
@@ -923,7 +938,7 @@ function tags_get_acl_tags_event_condition($acltags, $meta=false, $force_group_a
 
         // Group condition (The module belongs to an agent of the group X)
         // $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_id_recursive($group_id, true))));.
-        $group_condition = "(id_grupo = $group_id OR id_group = $group_id)";
+        $group_condition = '('.$id_grupo_table_pretag.'id_grupo = '.$group_id.' OR '.$alt_id_grupo_table_pretag.'id_group = '.$group_id.')';
 
         // Tags condition (The module has at least one of the restricted tags).
         $tags_condition = '';
@@ -959,7 +974,7 @@ function tags_get_acl_tags_event_condition($acltags, $meta=false, $force_group_a
         }
 
         $in_group = implode(',', $without_tags);
-        $condition .= sprintf('(id_grupo IN (%s) OR id_group IN (%s))', $in_group, $in_group);
+        $condition .= sprintf('('.$id_grupo_table_pretag.'id_grupo IN (%s) OR '.$alt_id_grupo_table_pretag.'id_group IN (%s))', $in_group, $in_group);
     }
 
     $condition = !empty($condition) ? "($condition)" : '';
@@ -1097,6 +1112,12 @@ function tags_get_user_tags($id_user=false, $access='AR', $return_tag_any=false)
         if (empty($user_tags_id)) {
             $user_tags_id = $t;
         } else {
+            if (empty($t)) {
+                // Empty is 'all of them'.
+                // TODO: Review this...
+                $t = [];
+            }
+
             $user_tags_id = array_unique(array_merge($t, $user_tags_id));
         }
     }
diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php
index 5341424efa..c8b893c091 100755
--- a/pandora_console/include/functions_treeview.php
+++ b/pandora_console/include/functions_treeview.php
@@ -327,7 +327,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
 
     if ($user_access_node && check_acl($config['id_user'], $id_group, 'AW')) {
         // Actions table
-        echo '<div style="width:100%; text-align: right; min-width: 300px;">';
+        echo '<div style="width:100%; text-align: right; min-width: 300px;padding-right: 1em;">';
         echo '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].$url_hash.'">';
             html_print_submit_button(__('Go to module edition'), 'upd_button', false, 'class="sub config"');
         echo '</a>';
@@ -637,7 +637,13 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
 
     $row = [];
     $row['title'] = __('Next agent contact');
-    $row['data'] = progress_bar($progress, 150, 20);
+    $row['data'] = ui_progress(
+        $progress,
+        '100%',
+        '1.5',
+        '#82b92e',
+        true
+    );
     $table->data['next_contact'] = $row;
 
     // End of table
@@ -664,7 +670,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
     $agent_table .= '<br>';
 
     // print agent data toggle
-    ui_toggle($agent_table, __('Agent data'), '', false);
+    ui_toggle($agent_table, __('Agent data'), '', '', false);
 
     // Advanced data
     $table = new StdClass();
diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php
index c81148b9c9..008c05b8d7 100755
--- a/pandora_console/include/functions_ui.php
+++ b/pandora_console/include/functions_ui.php
@@ -48,15 +48,16 @@ if (isset($config['homedir'])) {
  */
 function ui_bbcode_to_html($text, $allowed_tags=['[url]'])
 {
-    $return = $text;
-
     if (array_search('[url]', $allowed_tags) !== false) {
-        $return = preg_replace(
-            '/\[url=([^\]]*)\]/',
-            '<a target="_blank" rel="noopener noreferrer" href="$1">',
-            $return
-        );
-        $return = str_replace('[/url]', '</a>', $return);
+        // If link hasn't http, add it.
+        if (preg_match('/https?:\/\//', $text)) {
+            $html_bbcode = '<a target="_blank" rel="noopener noreferrer" href="$1">$2</a>';
+        } else {
+            $html_bbcode = '<a target="_blank" rel="noopener noreferrer" href="http://$1">$2</a>';
+        }
+
+        // Replace bbcode format [url=www.example.org] String [/url] with or without http and slashes
+        $return = preg_replace('/\[url(?|](((?:https?:\/\/)?[^[]+))|(?:=[\'"]?((?:https?:\/\/)?[^]]+?)[\'"]?)](.+?))\[\/url]/', $html_bbcode, $text);
     }
 
     return $return;
@@ -760,6 +761,12 @@ function ui_print_os_icon(
         $subfolder .= '/so_big_icons';
     }
 
+    if (is_metaconsole()) {
+        $no_in_meta = true;
+    } else {
+        $no_in_meta = false;
+    }
+
     $icon = (string) db_get_value('icon_name', 'tconfig_os', 'id_os', (int) $id_os);
     $os_name = get_os_name($id_os);
     if (empty($icon)) {
@@ -770,7 +777,7 @@ function ui_print_os_icon(
                 $options,
                 true,
                 $relative,
-                false,
+                $no_in_meta,
                 true
             );
         } else {
@@ -778,13 +785,13 @@ function ui_print_os_icon(
         }
     } else if ($apply_skin) {
         if ($only_src) {
-            $output = html_print_image('images/'.$subfolder.'/'.$icon, true, $options, true, $relative, false, true);
+            $output = html_print_image('images/'.$subfolder.'/'.$icon, true, $options, true, $relative, $no_in_meta, true);
         } else {
             if (!isset($options['title'])) {
                 $options['title'] = $os_name;
             }
 
-            $output = html_print_image('images/'.$subfolder.'/'.$icon, true, $options, false, $relative, false, true);
+            $output = html_print_image('images/'.$subfolder.'/'.$icon, true, $options, false, $relative, $no_in_meta, true);
         }
     } else {
         // $output = "<img src='images/os_icons/" . $icon . "' alt='" . $os_name . "' title='" . $os_name . "'>";
@@ -1441,11 +1448,16 @@ function ui_require_css_file($name, $path='include/styles/')
 
     if (! file_exists($filename)
         && ! file_exists($config['homedir'].'/'.$filename)
+        && ! file_exists($config['homedir'].'/'.ENTERPRISE_DIR.'/'.$filename)
     ) {
         return false;
     }
 
-    $config['css'][$name] = $filename;
+    if (is_metaconsole()) {
+        $config['css'][$name] = '/../../'.$filename;
+    } else {
+        $config['css'][$name] = $filename;
+    }
 
     return true;
 }
@@ -1476,7 +1488,7 @@ function ui_require_javascript_file($name, $path='include/javascript/', $echo_ta
     $filename = $path.$name.'.js';
 
     if ($echo_tag) {
-        echo '<script type="text/javascript" src="'.ui_get_full_url(false, false, false, false).$filename.'"></script>';
+        echo '<script type="text/javascript" src="'.ui_get_full_url($filename, false, false, false).'"></script>';
         return null;
     }
 
@@ -1493,7 +1505,7 @@ function ui_require_javascript_file($name, $path='include/javascript/', $echo_ta
         return false;
     }
 
-    if (defined('METACONSOLE')) {
+    if (is_metaconsole()) {
         $config['js'][$name] = '../../'.$filename;
     } else {
         $config['js'][$name] = $filename;
@@ -1738,11 +1750,18 @@ function ui_process_page_head($string, $bitfield)
 
     // Add the jquery UI styles CSS.
     $config['css']['jquery-UI'] = 'include/styles/js/jquery-ui.min.css';
+    $config['css']['jquery-UI-custom'] = 'include/styles/js/jquery-ui_custom.css';
     // Add the dialog styles CSS.
     $config['css']['dialog'] = 'include/styles/dialog.css';
     // Add the dialog styles CSS.
     $config['css']['dialog'] = 'include/styles/js/introjs.css';
 
+    // If the theme is the default, we don't load it twice.
+    if ($config['style'] !== 'pandora') {
+        // It loads the last of all.
+        $config['css']['theme'] = 'include/styles/'.$config['style'].'.css';
+    }
+
     // If skin's css files exists then add them.
     if ($exists_css) {
         foreach ($skin_styles as $filename => $name) {
@@ -1754,9 +1773,10 @@ function ui_process_page_head($string, $bitfield)
         // User style should go last so it can rewrite common styles.
         $config['css'] = array_merge(
             [
-                'common'         => 'include/styles/common.css',
-                'menu'           => 'include/styles/menu.css',
-                $config['style'] => 'include/styles/'.$config['style'].'.css',
+                'common'  => 'include/styles/common.css',
+                'menu'    => 'include/styles/menu.css',
+                'tables'  => 'include/styles/tables.css',
+                'general' => 'include/styles/pandora.css',
             ],
             $config['css']
         );
@@ -1775,7 +1795,7 @@ function ui_process_page_head($string, $bitfield)
 
         array_push($loaded, $name);
 
-        $url_css = ui_get_full_url($filename);
+        $url_css = ui_get_full_url($filename, false, false, false);
         $output .= '<link rel="stylesheet" href="'.$url_css.'" type="text/css" />'."\n\t";
     }
 
@@ -1783,47 +1803,6 @@ function ui_process_page_head($string, $bitfield)
      * End load CSS
      */
 
-    /*
-     * Load JS
-     */
-
-    if (empty($config['js'])) {
-        $config['js'] = [];
-        // If it's empty, false or not init set array to empty just in case.
-    }
-
-    // Pandora specific JavaScript should go first.
-    $config['js'] = array_merge(['pandora' => 'include/javascript/pandora.js'], $config['js']);
-    // Load base64 javascript library.
-    $config['js']['base64'] = 'include/javascript/encode_decode_base64.js';
-    // Load webchat javascript library.
-    $config['js']['webchat'] = 'include/javascript/webchat.js';
-    // Load qrcode library.
-    $config['js']['qrcode'] = 'include/javascript/qrcode.js';
-    // Load intro.js library (for bubbles and clippy).
-    $config['js']['intro'] = 'include/javascript/intro.js';
-    $config['js']['clippy'] = 'include/javascript/clippy.js';
-    // Load Underscore.js library.
-    $config['js']['underscore'] = 'include/javascript/underscore-min.js';
-
-    // Load other javascript.
-    // We can't load empty.
-    $loaded = [''];
-    foreach ($config['js'] as $name => $filename) {
-        if (in_array($name, $loaded)) {
-            continue;
-        }
-
-        array_push($loaded, $name);
-
-        $url_js = ui_get_full_url($filename);
-        $output .= '<script type="text/javascript" src="'.$url_js.'"></script>'."\n\t";
-    }
-
-    /*
-     * End load JS
-     */
-
     /*
      * Load jQuery
      */
@@ -1873,7 +1852,7 @@ function ui_process_page_head($string, $bitfield)
 
         array_push($loaded, $name);
 
-        $url_js = ui_get_full_url($filename);
+        $url_js = ui_get_full_url($filename, false, false, false);
         $output .= '<script type="text/javascript" src="'.$url_js.'"></script>'."\n\t";
     }
 
@@ -1881,6 +1860,47 @@ function ui_process_page_head($string, $bitfield)
      * End load JQuery
      */
 
+    /*
+     * Load JS
+     */
+
+    if (empty($config['js'])) {
+        $config['js'] = [];
+        // If it's empty, false or not init set array to empty just in case.
+    }
+
+    // Pandora specific JavaScript should go first.
+    $config['js'] = array_merge(['pandora' => 'include/javascript/pandora.js'], $config['js']);
+    // Load base64 javascript library.
+    $config['js']['base64'] = 'include/javascript/encode_decode_base64.js';
+    // Load webchat javascript library.
+    $config['js']['webchat'] = 'include/javascript/webchat.js';
+    // Load qrcode library.
+    $config['js']['qrcode'] = 'include/javascript/qrcode.js';
+    // Load intro.js library (for bubbles and clippy).
+    $config['js']['intro'] = 'include/javascript/intro.js';
+    $config['js']['clippy'] = 'include/javascript/clippy.js';
+    // Load Underscore.js library.
+    $config['js']['underscore'] = 'include/javascript/underscore-min.js';
+
+    // Load other javascript.
+    // We can't load empty.
+    $loaded = [''];
+    foreach ($config['js'] as $name => $filename) {
+        if (in_array($name, $loaded)) {
+            continue;
+        }
+
+        array_push($loaded, $name);
+
+        $url_js = ui_get_full_url($filename, false, false, false);
+        $output .= '<script type="text/javascript" src="'.$url_js.'"></script>'."\n\t";
+    }
+
+    /*
+     * End load JS
+     */
+
     include_once __DIR__.'/graphs/functions_flot.php';
     $output .= include_javascript_dependencies_flot_graph(true);
 
@@ -2036,7 +2056,7 @@ function ui_pagination(
     $actual_page = floor($offset / $pagination);
     $ini_page = (floor($actual_page / $block_limit) * $block_limit);
     $end_page = ($ini_page + $block_limit - 1);
-    if ($end_page > $number_of_pages) {
+    if ($end_page >= $number_of_pages) {
         $end_page = ($number_of_pages - 1);
     }
 
@@ -2585,12 +2605,12 @@ function ui_get_status_images_path()
 /**
  * Prints an image representing a status.
  *
- * @param string  $type          Type.
- * @param string  $title         Title.
- * @param boolean $return        Whether to return an output string or echo now (optional, echo by default).
- * @param array   $options       Options to set image attributes: I.E.: style.
- * @param string  $path          Path of the image, if not provided use the status path.
- * @param boolean $rounded_image Round.
+ * @param string  $type           Type.
+ * @param string  $title          Title.
+ * @param boolean $return         Whether to return an output string or echo now (optional, echo by default).
+ * @param array   $options        Options to set image attributes: I.E.: style.
+ * @param string  $path           Path of the image, if not provided use the status path.
+ * @param boolean $image_with_css Don't use an image. Draw an image with css styles.
  *
  * @return string HTML code if return parameter is true.
  */
@@ -2600,37 +2620,8 @@ function ui_print_status_image(
     $return=false,
     $options=false,
     $path=false,
-    $rounded_image=false
+    $image_with_css=false
 ) {
-    // This is for the List of Modules in Agent View.
-    if ($rounded_image === true) {
-        switch ($type) {
-            case 'module_ok.png':
-                $type = 'module_ok_rounded.png';
-            break;
-
-            case 'module_critical.png':
-                $type = 'module_critical_rounded.png';
-            break;
-
-            case 'module_warning.png':
-                $type = 'module_warning_rounded.png';
-            break;
-
-            case 'module_no_data.png':
-                $type = 'module_no_data_rounded.png';
-            break;
-
-            case 'module_unknown.png':
-                $type = 'module_unknown_rounded.png';
-            break;
-
-            default:
-                $type = $type;
-            break;
-        }
-    }
-
     if ($path === false) {
         $imagepath_array = ui_get_status_images_path();
         $imagepath = $imagepath_array[0];
@@ -2638,35 +2629,112 @@ function ui_print_status_image(
         $imagepath = $path;
     }
 
-    $imagepath .= '/'.$type;
-
-    if ($options === false) {
-        $options = [];
+    if ($imagepath == 'images/status_sets/default') {
+        $image_with_css = true;
     }
 
-    $options['title'] = $title;
+    $imagepath .= '/'.$type;
 
-    return html_print_image($imagepath, $return, $options, false, false, false, true);
+    if ($image_with_css === true) {
+        $shape_status = get_shape_status_set($type);
+        return ui_print_status_sets($type, $title, $return, $shape_status);
+    } else {
+        if ($options === false) {
+            $options = [];
+        }
+
+        $options['title'] = $title;
+
+        return html_print_image($imagepath, $return, $options, false, false, false, true);
+    }
+}
+
+
+/**
+ * Get the shape of an image by assigning it a CSS class. Prints an image with CSS representing a status.
+ *
+ * @param string $type Module/Agent/Alert status.
+ *
+ * @return array With CSS class.
+ */
+function get_shape_status_set($type)
+{
+    switch ($type) {
+        // Small rectangles.
+        case STATUS_ALERT_NOT_FIRED:
+        case STATUS_ALERT_FIRED:
+        case STATUS_ALERT_DISABLED:
+            $return = ['class' => 'status_small_rectangles'];
+        break;
+
+        // Rounded rectangles.
+        case STATUS_MODULE_OK:
+        case STATUS_AGENT_OK:
+        case STATUS_MODULE_NO_DATA:
+        case STATUS_AGENT_NO_DATA:
+        case STATUS_MODULE_CRITICAL:
+        case STATUS_AGENT_CRITICAL:
+        case STATUS_MODULE_WARNING:
+        case STATUS_AGENT_WARNING:
+        case STATUS_MODULE_UNKNOWN:
+        case STATUS_AGENT_UNKNOWN:
+        case STATUS_AGENT_DOWN:
+            $return = ['class' => 'status_rounded_rectangles'];
+        break;
+
+        // Small squares.
+        case STATUS_SERVER_OK:
+        case STATUS_SERVER_DOWN:
+            $return = ['class' => 'status_small_squares'];
+        break;
+
+        // Balls.
+        case STATUS_AGENT_CRITICAL_BALL:
+        case STATUS_AGENT_WARNING_BALL:
+        case STATUS_AGENT_DOWN_BALL:
+        case STATUS_AGENT_UNKNOWN_BALL:
+        case STATUS_AGENT_OK_BALL:
+        case STATUS_AGENT_NO_DATA_BALL:
+        case STATUS_AGENT_NO_MONITORS_BALL:
+            $return = ['class' => 'status_balls'];
+        break;
+
+        // Small Balls.
+        case STATUS_MODULE_OK_BALL:
+        case STATUS_MODULE_CRITICAL_BALL:
+        case STATUS_MODULE_WARNING_BALL:
+        case STATUS_MODULE_NO_DATA_BALL:
+        case STATUS_MODULE_UNKNOWN_BALL:
+        case STATUS_ALERT_FIRED_BALL:
+        case STATUS_ALERT_NOT_FIRED_BALL:
+        case STATUS_ALERT_DISABLED_BALL:
+            $return = ['class' => 'status_small_balls'];
+        break;
+
+        default:
+            // Ignored.
+        break;
+    }
+
+    return $return;
 }
 
 
 /**
  * Prints an image representing a status.
  *
- * @param string  $status        Module status.
- * @param string  $title         Title.
- * @param boolean $return        Whether to return an output string or echo now (optional, echo by default).
- * @param array   $options       Options to set image attributes: I.E.: style.
- * @param boolean $rounded_image Round.
+ * @param string  $status  Module status.
+ * @param string  $title   Title.
+ * @param boolean $return  Whether to return an output string or echo now (optional, echo by default).
+ * @param array   $options Options to set image attributes: I.E.: style.
  *
  * @return string HTML.
  */
-function ui_print_module_status(
+function ui_print_status_sets(
     $status,
     $title='',
     $return=false,
-    $options=false,
-    $rounded_image=false
+    $options=false
 ) {
     global $config;
 
@@ -2674,21 +2742,26 @@ function ui_print_module_status(
         $options = [];
     }
 
-    $options['style'] .= 'width: 50px;';
-    $options['style'] .= 'height: 2em;';
-    $options['style'] .= 'display: inline-block;';
-
-    include_once __DIR__.'/functions_modules.php';
-    $options['style'] .= 'background: '.modules_get_color_status($status).';';
-
-    if ($rounded_image === true) {
-        $options['style'] .= 'border-radius: 5px;';
+    if (isset($options['style'])) {
+        $options['style'] .= ' background: '.modules_get_color_status($status).'; display: inline-block;';
+    } else {
+        $options['style'] = 'background: '.modules_get_color_status($status).'; display: inline-block;';
     }
 
-    $options['title'] = $title;
-    $options['data-title'] = $title;
-    $options['data-use_title_for_force_title'] = 1;
-    $options['class'] = 'forced_title';
+    if (isset($options['class'])) {
+        $options['class'] = $options['class'];
+    }
+
+    if ($title != '') {
+        $options['title'] = $title;
+        $options['data-title'] = $title;
+        $options['data-use_title_for_force_title'] = 1;
+        if (isset($options['class'])) {
+            $options['class'] .= ' forced_title';
+        } else {
+            $options['class'] = 'forced_title';
+        }
+    }
 
     $output = '<div ';
     foreach ($options as $k => $v) {
@@ -2717,6 +2790,15 @@ function ui_print_module_status(
  * @param string  $color    Color.
  * @param boolean $return   Return or paint (if false).
  * @param boolean $text     Text to be displayed,by default progress %.
+ * @param array   $ajax     Ajax: [ 'page' => 'page', 'data' => 'data' ] Sample:
+ *   [
+ *       'page'     => 'operation/agentes/ver_agente', Target page.
+ *       'interval' => 100 / $agent["intervalo"], Ask every interval seconds.
+ *       'data'     => [ Data to be sent to target page.
+ *           'id_agente'       => $id_agente,
+ *           'refresh_contact' => 1,
+ *       ],
+ *   ].
  *
  * @return string HTML code.
  */
@@ -2724,9 +2806,10 @@ function ui_progress(
     $progress,
     $width='100%',
     $height='2.5',
-    $color='#80ba27',
+    $color='#82b92e',
     $return=true,
-    $text=''
+    $text='',
+    $ajax=false
 ) {
     if (!$progress) {
         $progress = 0;
@@ -2745,10 +2828,56 @@ function ui_progress(
     }
 
     ui_require_css_file('progress');
-    $output .= '<div class="progress_main" style="width: '.$width.'; height: '.$height.'em; border: 1px solid '.$color.'">';
-    $output .= '<span class="progress_text" style="font-size:'.($height - 0.5).'em;">'.$text.'</span>';
-    $output .= '<div class="progress" style="width: '.$progress.'%; background: '.$color.'"></div>';
-    $output .= '</div>';
+    $output .= '<span class="progress_main" data-label="'.$text;
+    $output .= '" style="width: '.$width.'; height: '.$height.'em; border: 1px solid '.$color.'">';
+    $output .= '<span class="progress" style="width: '.$progress.'%; background: '.$color.'"></span>';
+    $output .= '</span>';
+
+    if ($ajax !== false && is_array($ajax)) {
+        $output .= '<script type="text/javascript">
+    $(document).ready(function() {
+        setInterval(() => {
+                last = $(".progress_main").attr("data-label").split(" ")[0]*1;
+                width = $(".progress").width() / $(".progress").parent().width() * 100;
+                width_interval = '.$ajax['interval'].';
+                if (last % 10 == 0) {
+                    $.post({
+                        url: "'.ui_get_full_url('ajax.php', false, false, false).'",
+                        data: {';
+        if (is_array($ajax['data'])) {
+            foreach ($ajax['data'] as $token => $value) {
+                $output .= '
+                            '.$token.':"'.$value.'",';
+            }
+        }
+
+        $output .= '
+                            page: "'.$ajax['page'].'"
+                        },
+                        success: function(data) {
+                            try {
+                                val = JSON.parse(data);
+                                $(".progress_main").attr("data-label", val["last_contact"]+" s");
+                                $(".progress").width(val["progress"]+"%");
+                            } catch (e) {
+                                console.error(e);
+                                $(".progress_text").attr("data-label", (last -1) + " s");
+                                if (width < 100) {
+                                    $(".progress").width((width+width_interval) + "%");
+                                }
+                            }
+                        }
+                    });
+                } else {
+                    $(".progress_main").attr("data-label", (last -1) + " s");
+                    if (width < 100) {
+                        $(".progress").width((width+width_interval) + "%");
+                    }
+                }
+            }, 1000);
+    });
+    </script>';
+    }
 
     if (!$return) {
         echo $output;
@@ -2758,6 +2887,441 @@ function ui_progress(
 }
 
 
+/**
+ * Generate needed code to print a datatables jquery plugin.
+ *
+ * @param array $parameters All desired data using following format:
+ * [
+ *   'print' => true (by default printed)
+ *   'id' => datatable id.
+ *   'class' => datatable class.
+ *   'style' => datatable style.
+ *   'order' => [
+ *      'field' => column name
+ *      'direction' => asc or desc
+ *    ],
+ *   'default_pagination' => integer, default pagination is set to block_size
+ *   'ajax_url' => 'include/ajax.php'  ajax_url.
+ *   'ajax_data' => [ operation => 1 ] extra info to be sent.
+ *   'ajax_postprocess' => a javscript function to postprocess data received
+ *                         by ajax call. It is applied foreach row and must
+ *                         use following format:
+ * * [code]
+ * * function (item) {
+ * *       // Process received item, for instance, name:
+ * *       tmp = '<span class=label>' + item.name + '</span>';
+ * *       item.name = tmp;
+ * *   }
+ * * [/code]
+ *   'columns_names' => [
+ *      'column1'  :: Used as th text. Direct text entry. It could be array:
+ *      OR
+ *      [
+ *        'id' => th id.
+ *        'class' => th class.
+ *        'style' => th style.
+ *        'text' => 'column1'.
+ *      ]
+ *   ],
+ *   'columns' => [
+ *      'column1',
+ *      'column2',
+ *      ...
+ *   ],
+ *   'no_sortable_columns' => [ indexes ] 1,2... -1 etc. Avoid sorting.
+ *   'form' => [
+ *      'html' => 'html code' a directly defined inputs in HTML.
+ *      'extra_buttons' => [
+ *          [
+ *              'id' => button id,
+ *              'class' => button class,
+ *              'style' => button style,
+ *              'text' => button text,
+ *              'onclick' => button onclick,
+ *          ]
+ *      ],
+ *      'search_button_class' => search button class.
+ *      'class' => form class.
+ *      'id' => form id.
+ *      'style' => form style.
+ *      'js' => optional extra actions onsubmit.
+ *      'inputs' => [
+ *          'label' => Input label.
+ *          'type' => Input type.
+ *          'value' => Input value.
+ *          'name' => Input name.
+ *          'id' => Input id.
+ *          'options' => [
+ *             'option1'
+ *             'option2'
+ *             ...
+ *          ]
+ *      ]
+ *   ],
+ *   'extra_html' => HTML content to be placed after 'filter' section.
+ *   'drawCallback' => function to be called after draw. Sample in:
+ *            https://datatables.net/examples/advanced_init/row_grouping.html
+ * ]
+ * End.
+ *
+ * @return string HTML code with datatable.
+ * @throws Exception On error.
+ */
+function ui_print_datatable(array $parameters)
+{
+    global $config;
+
+    if (isset($parameters['id'])) {
+        $table_id = $parameters['id'];
+        $form_id = 'form_'.$parameters['id'];
+    } else {
+        $table_id = uniqid('datatable_');
+        $form_id = uniqid('datatable_filter_');
+    }
+
+    if (!isset($parameters['columns']) || !is_array($parameters['columns'])) {
+        throw new Exception('[ui_print_datatable]: You must define columns for datatable');
+    }
+
+    if (!isset($parameters['ajax_url'])) {
+        throw new Exception('[ui_print_datatable]: Parameter ajax_url is required');
+    }
+
+    if (!isset($parameters['default_pagination'])) {
+        $parameters['default_pagination'] = $config['block_size'];
+    }
+
+    $no_sortable_columns = [];
+    if (isset($parameters['no_sortable_columns'])) {
+        $no_sortable_columns = json_encode($parameters['no_sortable_columns']);
+    }
+
+    if (!is_array($parameters['order'])) {
+        $order = '0, "asc"';
+    } else {
+        if (!isset($parameters['order']['direction'])) {
+            $direction = 'asc';
+        }
+
+        if (!isset($parameters['order']['field'])) {
+            $order = 0;
+        } else {
+            $order = array_search(
+                $parameters['order']['field'],
+                $parameters['columns']
+            );
+
+            if ($order === false) {
+                $order = 0;
+            }
+        }
+
+        $order .= ', "'.$parameters['order']['direction'].'"';
+    }
+
+    if (!isset($parameters['ajax_data'])) {
+        $parameters['ajax_data'] = '';
+    }
+
+    $search_button_class = 'sub filter';
+    if (isset($parameters['search_button_class'])) {
+        $search_button_class = $parameters['search_button_class'];
+    }
+
+    if (isset($parameters['pagination_options'])) {
+        $pagination_options = $parameters['pagination_options'];
+    } else {
+        $pagination_options = [
+            [
+                $parameters['default_pagination'],
+                10,
+                25,
+                100,
+                200,
+                500,
+                1000,
+                -1,
+            ],
+            [
+                $parameters['default_pagination'],
+                10,
+                25,
+                100,
+                200,
+                500,
+                1000,
+                'All',
+            ],
+        ];
+    }
+
+    if (!is_array($parameters['datacolumns'])) {
+        $parameters['datacolumns'] = $parameters['columns'];
+    }
+
+    // Datatable filter.
+    if (isset($parameters['form']) && is_array($parameters['form'])) {
+        if (isset($parameters['form']['id'])) {
+            $form_id = $parameters['form']['id'];
+        }
+
+        if (isset($parameters['form']['class'])) {
+            $form_class = $parameters['form']['class'];
+        } else {
+            $form_class = '';
+        }
+
+        if (isset($parameters['form']['style'])) {
+            $form_style = $parameters['form']['style'];
+        } else {
+            $form_style = '';
+        }
+
+        if (isset($parameters['form']['js'])) {
+            $form_js = $parameters['form']['js'];
+        } else {
+            $form_js = '';
+        }
+
+        $filter = '<form class="'.$form_class.'" ';
+        $filter .= ' id="'.$form_id.'" ';
+        $filter .= ' style="'.$form_style.'" ';
+        $filter .= ' onsubmit="'.$form_js.';return false;">';
+
+        if (isset($parameters['form']['html'])) {
+            $filter .= $parameters['form']['html'];
+        }
+
+        $filter .= '<ul class="datatable_filter content">';
+
+        foreach ($parameters['form']['inputs'] as $input) {
+            $filter .= html_print_input(($input + ['return' => true]), 'li');
+        }
+
+        $filter .= '<li>';
+        // Search button.
+        $filter .= '<input type="submit" class="'.$search_button_class.'" ';
+        $filter .= ' id="'.$form_id.'_search_bt" value="'.__('Filter').'"/>';
+
+        // Extra buttons.
+        if (is_array($parameters['form']['extra_buttons'])) {
+            foreach ($parameters['form']['extra_buttons'] as $button) {
+                $filter .= '<button id="'.$button['id'].'" ';
+                $filter .= ' class="'.$button['class'].'" ';
+                $filter .= ' style="'.$button['style'].'" ';
+                $filter .= ' onclick="'.$button['onclick'].'" >';
+                $filter .= $button['text'];
+                $filter .= '</button>';
+            }
+        }
+
+        $filter .= '</li>';
+
+        $filter .= '</ul><div style="clear:both"></div></form>';
+        $filter = ui_toggle(
+            $filter,
+            __('Filter'),
+            '',
+            '',
+            true,
+            false,
+            'white_box white_box_opened',
+            'no-border'
+        );
+    } else if (isset($parameters['form_html'])) {
+        $filter = ui_toggle(
+            $parameters['form_html'],
+            __('Filter'),
+            '',
+            '',
+            true,
+            false,
+            'white_box white_box_opened',
+            'no-border'
+        );
+    }
+
+    // Extra html.
+    $extra = '';
+    if (isset($parameters['extra_html']) && !empty($parameters['extra_html'])) {
+        $extra = $parameters['extra_html'];
+    }
+
+    // Base table.
+    $table = '<table id="'.$table_id.'" ';
+    $table .= 'class="'.$parameters['class'].'"';
+    $table .= 'style="'.$parameters['style'].'">';
+    $table .= '<thead><tr>';
+
+    if (isset($parameters['column_names'])
+        && is_array($parameters['column_names'])
+    ) {
+        $names = $parameters['column_names'];
+    } else {
+        $names = $parameters['columns'];
+    }
+
+    foreach ($names as $column) {
+        if (is_array($column)) {
+            $table .= '<th id="'.$column['id'].'" class="'.$column['class'].'" ';
+            $table .= ' style="'.$column['style'].'">'.__($column['text']);
+            $table .= $column['extra'];
+            $table .= '</th>';
+        } else {
+            $table .= '<th>'.__($column).'</th>';
+        }
+    }
+
+    $table .= '</tr></thead>';
+    $table .= '</table>';
+
+    $pagination_class = 'pandora_pagination';
+    if (!empty($parameters['pagination_class'])) {
+        $pagination_class = $parameters['pagination_class'];
+    }
+
+    // Javascript controller.
+    $js = '<script type="text/javascript">
+    $(document).ready(function(){
+        $.fn.dataTable.ext.errMode = "none";
+        $.fn.dataTable.ext.classes.sPageButton = "'.$pagination_class.'";
+        dt_'.$table_id.' = $("#'.$table_id.'").DataTable({
+            ';
+    if (isset($parameters['drawCallback'])) {
+        $js .= 'drawCallback: function(settings) {
+                    '.$parameters['drawCallback'].'
+                },';
+    }
+
+    $js .= '
+            processing: true,
+            serverSide: true,
+            paging: true,
+            pageLength: '.$parameters['default_pagination'].',
+            searching: false,
+            responsive: true,
+            dom: "plfrtiBp",
+            buttons: [
+                {
+                    extend: "csv",
+                    text : "'.__('Export current page to CSV').'",
+                    exportOptions : {
+                        modifier : {
+                            // DataTables core
+                            order : "current",
+                            page : "All",
+                            search : "applied"
+                        }
+                    }
+                }
+            ],
+            lengthMenu: '.json_encode($pagination_options).',
+            ajax: {
+                url: "'.ui_get_full_url('ajax.php', false, false, false).'",
+                type: "POST",
+                dataSrc: function (json) {
+                    if (json.error) {
+                        console.log(json.error);
+                        $("#error-'.$table_id.'").html(json.error);
+                        $("#error-'.$table_id.'").dialog({
+                            title: "Filter failed",
+                            width: 630,
+                            resizable: true,
+                            draggable: true,
+                            modal: false,
+                            closeOnEscape: true,
+                            buttons: {
+                                "Ok" : function () {
+                                    $(this).dialog("close");
+                                }
+                            }
+                        }).parent().addClass("ui-state-error");
+                    } else {';
+    if (isset($parameters['ajax_postprocess'])) {
+        $js .= '
+                    if (json.data) {
+                        json.data.forEach(function(item) {
+                            '.$parameters['ajax_postprocess'].'
+                        });
+                    } else {
+                        json.data = {};
+                    }';
+    }
+
+    $js .= '
+                        return json.data;
+                    }
+                },
+                data: function (data) {
+                    inputs = $("#'.$form_id.' :input");
+
+                    values = {};
+                    inputs.each(function() {
+                        values[this.name] = $(this).val();
+                    })
+
+                    $.extend(data, {
+                        filter: values,'."\n";
+
+    if (is_array($parameters['ajax_data'])) {
+        foreach ($parameters['ajax_data'] as $k => $v) {
+            $js .= $k.':'.json_encode($v).",\n";
+        }
+    }
+
+    $js .= 'page: "'.$parameters['ajax_url'].'"
+                    });
+
+                    return data;
+                }
+            },
+            "columnDefs": [
+                { className: "no-class", targets: "_all" },
+                { bSortable: false, targets: '.$no_sortable_columns.' }
+            ],
+            columns: [';
+
+    foreach ($parameters['datacolumns'] as $data) {
+        if (is_array($data)) {
+            $js .= '{data : "'.$data['text'].'",className: "'.$data['class'].'"},';
+        } else {
+            $js .= '{data : "'.$data.'",className: "no-class"},';
+        }
+    }
+
+            $js .= '
+            ],
+            order: [[ '.$order.' ]]
+        });
+
+        $("#'.$form_id.'_search_bt").click(function (){
+            dt_'.$table_id.'.draw().page(0)
+        });
+    });
+</script>';
+
+    // Order.
+    $err_msg = '<div id="error-'.$table_id.'"></div>';
+    $output = $err_msg.$filter.$extra.$table.$js;
+
+    ui_require_css_file('datatables.min', 'include/styles/js/');
+    ui_require_javascript_file('datatables.min');
+    ui_require_javascript_file('buttons.dataTables.min');
+    ui_require_javascript_file('dataTables.buttons.min');
+    ui_require_javascript_file('buttons.html5.min');
+    ui_require_javascript_file('buttons.print.min');
+
+    $output = $include.$output;
+
+    // Print datatable if needed.
+    if (!(isset($parameters['print']) && $parameters['print'] === false)) {
+        echo $output;
+    }
+
+    return $output;
+}
+
+
 /**
  * Returns a div wich represents the type received.
  *
@@ -2919,12 +3483,15 @@ function ui_print_event_priority(
 /**
  * Print a code into a DIV and enable a toggle to show and hide it.
  *
- * @param string  $code           Html code.
- * @param string  $name           Name of the link.
- * @param string  $title          Title of the link.
- * @param boolean $hidden_default If the div will be hidden by default (default: true).
- * @param boolean $return         Whether to return an output string or echo now (default: true).
- * @param string  $toggle_class   Toggle class.
+ * @param string  $code            Html code.
+ * @param string  $name            Name of the link.
+ * @param string  $title           Title of the link.
+ * @param string  $id              Block id.
+ * @param boolean $hidden_default  If the div will be hidden by default (default: true).
+ * @param boolean $return          Whether to return an output string or echo now (default: true).
+ * @param string  $toggle_class    Toggle class.
+ * @param string  $container_class Container class.
+ * @param string  $main_class      Main object class.
  *
  * @return string HTML.
  */
@@ -2932,10 +3499,12 @@ function ui_toggle(
     $code,
     $name,
     $title='',
+    $id='',
     $hidden_default=true,
     $return=false,
     $toggle_class='',
-    $container_class='white-box-content'
+    $container_class='white-box-content',
+    $main_class='box-shadow white_table_graph'
 ) {
     // Generate unique Id.
     $uniqid = uniqid('');
@@ -2952,7 +3521,7 @@ function ui_toggle(
     }
 
     // Link to toggle.
-    $output = '<div class="box-shadow white_table_graph">';
+    $output = '<div class="'.$main_class.'" id="'.$id.'">';
     $output .= '<div class="white_table_graph_header" style="cursor: pointer;" id="tgl_ctrl_'.$uniqid.'">'.html_print_image(
         $original,
         true,
@@ -3124,13 +3693,31 @@ function ui_get_url_refresh($params=false, $relative=true, $add_post=true)
     $url = htmlspecialchars($url);
 
     if (! $relative) {
-        return ui_get_full_url($url);
+        return ui_get_full_url($url, false, false, false);
     }
 
     return $url;
 }
 
 
+/**
+ * Checks if public_url usage is being forced to target 'visitor'.
+ *
+ * @return boolean
+ */
+function ui_forced_public_url()
+{
+    global $config;
+    $exclusions = preg_split("/[\n\s,]+/", io_safe_output($config['public_url_exclusions']));
+
+    if (in_array($_SERVER['REMOTE_ADDR'], $exclusions)) {
+        return false;
+    }
+
+    return (bool) $config['force_public_url'];
+}
+
+
 /**
  * Returns a full URL in Pandora. (with the port and https in some systems)
  *
@@ -3177,13 +3764,27 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
     }
 
     if (!$no_proxy) {
-        // Check if the PandoraFMS runs across the proxy like as
-        // mod_proxy of Apache
-        // and check if public_url is set.
-        if (!empty($config['public_url'])
+        // Check proxy.
+        $proxy = false;
+        if (ui_forced_public_url()) {
+            $proxy = true;
+            $fullurl = $config['public_url'];
+            if (substr($fullurl, -1) != '/') {
+                $fullurl .= '/';
+            }
+
+            if ($url == 'index.php' && is_metaconsole()) {
+                $fullurl .= ENTERPRISE_DIR.'/meta';
+            }
+        } else if (!empty($config['public_url'])
             && (!empty($_SERVER['HTTP_X_FORWARDED_HOST']))
         ) {
+            // Forced to use public url when being forwarder by a reverse proxy.
             $fullurl = $config['public_url'];
+            if (substr($fullurl, -1) != '/') {
+                $fullurl .= '/';
+            }
+
             $proxy = true;
         } else {
             $fullurl = $protocol.'://'.$_SERVER['SERVER_NAME'];
@@ -3214,7 +3815,7 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
             $url = $config['homeurl_static'].'/';
         }
 
-        if (defined('METACONSOLE') && $metaconsole_root) {
+        if (is_metaconsole() && $metaconsole_root) {
             $url .= 'enterprise/meta/';
         }
     } else if (!strstr($url, '.php')) {
@@ -3224,7 +3825,7 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
             $fullurl .= $config['homeurl_static'].'/';
         }
 
-        if (defined('METACONSOLE') && $metaconsole_root) {
+        if (is_metaconsole() && $metaconsole_root) {
             $fullurl .= 'enterprise/meta/';
         }
     } else {
@@ -3236,7 +3837,7 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
             } else {
                 $fullurl .= $config['homeurl_static'].'/';
 
-                if (defined('METACONSOLE') && $metaconsole_root) {
+                if (is_metaconsole() && $metaconsole_root) {
                     $fullurl .= 'enterprise/meta/';
                 }
             }
@@ -3295,11 +3896,11 @@ function ui_print_page_header(
 
     if ($godmode == true) {
         $type = 'view';
-        $type2 = (empty($breadcrumbs)) ? 'menu_tab_frame_view' : 'menu_tab_frame_view_bc';
+        $type2 = 'menu_tab_frame_view';
         $separator_class = 'separator';
     } else {
         $type = 'view';
-        $type2 = (empty($breadcrumbs)) ? 'menu_tab_frame_view' : 'menu_tab_frame_view_bc';
+        $type2 = 'menu_tab_frame_view';
         $separator_class = 'separator_view';
     }
 
@@ -3844,6 +4445,10 @@ function ui_print_agent_autocomplete_input($parameters)
         $get_only_string_modules = true;
     }
 
+    if (isset($parameters['no_disabled_modules'])) {
+        $no_disabled_modules = $parameters['no_disabled_modules'];
+    }
+
     $spinner_image = html_print_image('images/spinner.gif', true, false, true);
     if (isset($parameters['spinner_image'])) {
         $spinner_image = $parameters['spinner_image'];
@@ -3851,7 +4456,7 @@ function ui_print_agent_autocomplete_input($parameters)
 
     // Javascript configurations
     // ------------------------------------------------------------------.
-    $javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false, false);
+    $javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false);
     // Default value.
     if (isset($parameters['javascript_ajax_page'])) {
         $javascript_ajax_page = $parameters['javascript_ajax_page'];
@@ -3991,7 +4596,11 @@ function ui_print_agent_autocomplete_input($parameters)
 			if ('.((int) $get_only_string_modules).') {
 				inputs.push ("get_only_string_modules=1");
 			}
-			
+
+            if ('.((int) $no_disabled_modules).') {
+                inputs.push ("disabled=0");
+            }
+
 			if ('.((int) $metaconsole_enabled).') {
 				if (('.((int) $use_input_server).')
 						|| ('.((int) $print_input_server).')) {
diff --git a/pandora_console/include/functions_update_manager.php b/pandora_console/include/functions_update_manager.php
index cc148be7b9..73a654a50d 100755
--- a/pandora_console/include/functions_update_manager.php
+++ b/pandora_console/include/functions_update_manager.php
@@ -468,7 +468,7 @@ function registration_wiz_modal(
         __('Cancel'),
         'cancel_registration',
         false,
-        'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel" style="color: red; width:100px;"',
+        'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel"',
         true
     );
     $output .= '</div>';
diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php
index 2a29155228..97d97c7273 100755
--- a/pandora_console/include/functions_users.php
+++ b/pandora_console/include/functions_users.php
@@ -249,13 +249,13 @@ function groups_combine_acl($acl_group_a, $acl_group_b)
 /**
  * Get all the groups a user has reading privileges.
  *
- * @param string User id
- * @param string The privilege to evaluate, and it is false then no check ACL.
- * @param boolean                                                             $returnAllGroup   Flag the return group, by default true.
- * @param boolean                                                             $returnAllColumns Flag to return all columns of groups.
- * @param array                                                               $id_groups        The list of group to scan to bottom child. By default null.
- * @param string                                                              $keys_field       The field of the group used in the array keys. By default ID
- * @param boolean                                                             $cache            Set it to false to not use cache
+ * @param string  $id_user          User id
+ * @param string  $privilege        The privilege to evaluate, and it is false then no check ACL.
+ * @param boolean $returnAllGroup   Flag the return group, by default true.
+ * @param boolean $returnAllColumns Flag to return all columns of groups.
+ * @param array   $id_groups        The list of group to scan to bottom child. By default null.
+ * @param string  $keys_field       The field of the group used in the array keys. By default ID
+ * @param boolean $cache            Set it to false to not use cache
  *
  * @return array A list of the groups the user has certain privileges.
  */
@@ -293,7 +293,7 @@ function users_get_groups(
         }
         // Per-group permissions.
         else {
-            $query  = 'SELECT * FROM tgrupo ORDER BY parent,id_grupo DESC';
+            $query  = 'SELECT * FROM tgrupo ORDER BY nombre';
             $raw_groups = db_get_all_rows_sql($query);
 
             $query = sprintf(
@@ -617,16 +617,21 @@ function users_save_login()
 
     $user_list = json_decode($user_list_json, true);
     if (empty($user_list)) {
-        $user_list = [];
-    }
-
-    if (isset($user_list[$config['id_user']])) {
-        $user_list[$config['id_user']]['count']++;
-    } else {
         $user_list[$config['id_user']] = [
             'name'  => $user['fullname'],
             'count' => 1,
         ];
+    } else if (isset($user_list[$config['id_user']])) {
+        $user_list[$config['id_user']] = [
+            'name'  => $user['fullname'],
+            'count' => $user_list[$config['id_user']]['count'],
+        ];
+    } else {
+        $users_count = count($user_list);
+        $user_list[$config['id_user']] = [
+            'name'  => $user['fullname'],
+            'count' => ++$users_count,
+        ];
     }
 
     // Clean the file
@@ -704,17 +709,7 @@ function users_save_logout($user=false, $delete=false)
         $user_list = [];
     }
 
-    if ($delete) {
-        unset($user_list[$user['id_user']]);
-    } else {
-        if (isset($user_list[$config['id_user']])) {
-            $user_list[$config['id_user']]['count']--;
-        }
-
-        if ($user_list[$config['id_user']]['count'] <= 0) {
-            unset($user_list[$user['id_user']]);
-        }
-    }
+    unset($user_list[$user['id_user']]);
 
     // Clean the file
     ftruncate($fp_user_list, 0);
@@ -1052,6 +1047,13 @@ function users_check_users()
         'users'   => '',
     ];
 
+    $users_with_session = db_get_all_rows_sql('SELECT tsessions_php.data FROM pandora.tsessions_php;');
+    $users_logged_now = [];
+    foreach ($users_with_session as $user_with_session) {
+        $tmp_id_user = explode('"', $user_with_session['data']);
+        array_push($users_logged_now, $tmp_id_user[1]);
+    }
+
     $file_global_user_list = $config['attachment_store'].'/pandora_chat.user_list.json.txt';
 
     // First lock the file
@@ -1082,13 +1084,32 @@ function users_check_users()
         $user_list = [];
     }
 
-    fclose($fp_user_list);
-
+    // Compare both user list. Meanwhile the user from chat file have an active
+    // session, his continue in the list of active chat users
     $user_name_list = [];
-    foreach ($user_list as $user) {
-        $user_name_list[] = $user['name'];
+    foreach ($user_list as $key => $user) {
+        if (in_array($key, $users_logged_now)) {
+            array_push($user_name_list, $user['name']);
+        } else {
+            unset($user_list[$key]);
+        }
     }
 
+    // Clean the file
+    ftruncate($fp_user_list, 0);
+
+    // Update the file with the correct list of users
+    $status = fwrite($fp_user_list, json_encode($user_list));
+
+    /*
+        if ($status === false) {
+        fclose($fp_user_list);
+
+        return;
+    } */
+    // Closing the resource
+    fclose($fp_user_list);
+
     $return['correct'] = true;
     $return['users'] = implode('<br />', $user_name_list);
     echo json_encode($return);
diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php
index 680d6e3ce9..1c6afb9eed 100755
--- a/pandora_console/include/functions_visual_map.php
+++ b/pandora_console/include/functions_visual_map.php
@@ -1966,7 +1966,7 @@ function visual_map_print_item(
                             echo '</tr>';
                             echo "<tr style='background-color:whitesmoke;height:90%;'>";
                                 echo '<td>';
-                                    echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#FC4444;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>".remove_right_zeros(number_format($stat_agent_cr, 2)).'%</div>';
+                                    echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#e63c52;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>".remove_right_zeros(number_format($stat_agent_cr, 2)).'%</div>';
                                     echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Critical</div>";
                                     echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#f8db3f;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>".remove_right_zeros(number_format($stat_agent_wa, 2)).'%</div>';
                                     echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Warning</div>";
@@ -3611,11 +3611,6 @@ function visual_map_print_visual_map(
 
     global $config;
 
-    $metaconsole_hack = '/';
-    if (defined('METACONSOLE')) {
-        $metaconsole_hack = '../../';
-    }
-
     enterprise_include_once('meta/include/functions_ui_meta.php');
 
     include_once $config['homedir'].'/include/functions_custom_graphs.php';
@@ -3681,11 +3676,11 @@ function visual_map_print_visual_map(
         $mapHeight = $layout['height'];
         $backgroundImage = '';
         if ($layout['background'] != 'None.png') {
-            $backgroundImage = $metaconsole_hack.'images/console/background/'.$layout['background'];
+            $backgroundImage = 'images/console/background/'.$layout['background'];
         }
     }
 
-    if (defined('METACONSOLE')) {
+    if (is_metaconsole()) {
         echo "<div style='width: 100%; overflow:auto; margin: 0 auto; padding:5px;'>";
     }
 
@@ -3698,7 +3693,7 @@ function visual_map_print_visual_map(
                 background-color:'.$layout['background_color'].';">';
 
     if ($layout['background'] != 'None.png') {
-        echo "<img src='".ui_get_full_url($backgroundImage)."' width='100%' height='100%' />";
+        echo "<img src='".ui_get_full_url($backgroundImage, false, false, false)."' width='100%' height='100%' />";
     }
 
     $layout_datas = db_get_all_rows_field_filter(
@@ -3776,7 +3771,7 @@ function visual_map_print_visual_map(
     // End main div
     echo '</div></div>';
 
-    if (defined('METACONSOLE')) {
+    if (is_metaconsole()) {
         echo '</div>';
     }
 }
@@ -4271,7 +4266,7 @@ function visual_map_create_internal_name_item($label=null, $type, $image, $agent
 
             case 'static_graph':
             case STATIC_GRAPH:
-                $text = __('Static graph').' - '.$image;
+                $text = __('Static Image').' - '.$image;
             break;
 
             case 'simple_value':
diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php
index 7e7cffeca4..0e678c6111 100755
--- a/pandora_console/include/functions_visual_map_editor.php
+++ b/pandora_console/include/functions_visual_map_editor.php
@@ -1294,7 +1294,7 @@ function visual_map_editor_print_toolbox()
     }
 
     echo '<div id="toolbox">';
-        visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true);
+        visual_map_print_button_editor('static_graph', __('Static Image'), 'left', false, 'camera_min', true);
         visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true);
         visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true);
         visual_map_print_button_editor('donut_graph', __('Serialized pie graph'), 'left', false, 'donut_graph_min', true);
diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php
index 9fabfeef64..d8012c15dd 100644
--- a/pandora_console/include/graphs/fgraph.php
+++ b/pandora_console/include/graphs/fgraph.php
@@ -21,6 +21,7 @@ if (empty($config['homedir'])) {
 }
 
 require_once $config['homedir'].'/include/functions.php';
+require_once $config['homedir'].'/include/graphs/functions_flot.php';
 
 $ttl = get_parameter('ttl', 1);
 $graph_type = get_parameter('graph_type', '');
diff --git a/pandora_console/include/graphs/flot/jquery.flot.pie.js b/pandora_console/include/graphs/flot/jquery.flot.pie.js
index 9c19db998b..37a8135e08 100644
--- a/pandora_console/include/graphs/flot/jquery.flot.pie.js
+++ b/pandora_console/include/graphs/flot/jquery.flot.pie.js
@@ -56,765 +56,897 @@ More detail and specific examples can be found in the included HTML file.
 */
 
 (function($) {
+  // Maximum redraw attempts when fitting labels within the plot
 
-	// Maximum redraw attempts when fitting labels within the plot
+  var REDRAW_ATTEMPTS = 10;
 
-	var REDRAW_ATTEMPTS = 10;
+  // Factor by which to shrink the pie when fitting labels within the plot
 
-	// Factor by which to shrink the pie when fitting labels within the plot
+  var REDRAW_SHRINK = 0.95;
 
-	var REDRAW_SHRINK = 0.95;
+  function init(plot) {
+    var canvas = null,
+      target = null,
+      options = null,
+      maxRadius = null,
+      centerLeft = null,
+      centerTop = null,
+      processed = false,
+      ctx = null;
 
-	function init(plot) {
+    // interactive variables
 
-		var canvas = null,
-			target = null,
-			options = null,
-			maxRadius = null,
-			centerLeft = null,
-			centerTop = null,
-			processed = false,
-			ctx = null;
+    var highlights = [];
 
-		// interactive variables
+    // add hook to determine if pie plugin in enabled, and then perform necessary operations
 
-		var highlights = [];
+    plot.hooks.processOptions.push(function(plot, options) {
+      if (options.series.pie.show) {
+        options.grid.show = false;
 
-		// add hook to determine if pie plugin in enabled, and then perform necessary operations
+        // set labels.show
 
-		plot.hooks.processOptions.push(function(plot, options) {
-			if (options.series.pie.show) {
+        if (options.series.pie.label.show == "auto") {
+          if (options.legend.show) {
+            options.series.pie.label.show = false;
+          } else {
+            options.series.pie.label.show = true;
+          }
+        }
 
-				options.grid.show = false;
+        // set radius
 
-				// set labels.show
+        if (options.series.pie.radius == "auto") {
+          if (options.series.pie.label.show) {
+            options.series.pie.radius = 3 / 4;
+          } else {
+            options.series.pie.radius = 1;
+          }
+        }
 
-				if (options.series.pie.label.show == "auto") {
-					if (options.legend.show) {
-						options.series.pie.label.show = false;
-					} else {
-						options.series.pie.label.show = true;
-					}
-				}
+        // ensure sane tilt
 
-				// set radius
+        if (options.series.pie.tilt > 1) {
+          options.series.pie.tilt = 1;
+        } else if (options.series.pie.tilt < 0) {
+          options.series.pie.tilt = 0;
+        }
+      }
+    });
 
-				if (options.series.pie.radius == "auto") {
-					if (options.series.pie.label.show) {
-						options.series.pie.radius = 3/4;
-					} else {
-						options.series.pie.radius = 1;
-					}
-				}
+    plot.hooks.bindEvents.push(function(plot, eventHolder) {
+      var options = plot.getOptions();
+      if (options.series.pie.show) {
+        if (options.grid.hoverable) {
+          eventHolder.unbind("mousemove").mousemove(onMouseMove);
+        }
+        if (options.grid.clickable) {
+          eventHolder.unbind("click").click(onClick);
+        }
+      }
+    });
 
-				// ensure sane tilt
+    plot.hooks.processDatapoints.push(function(plot, series, data, datapoints) {
+      var options = plot.getOptions();
+      if (options.series.pie.show) {
+        processDatapoints(plot, series, data, datapoints);
+      }
+    });
 
-				if (options.series.pie.tilt > 1) {
-					options.series.pie.tilt = 1;
-				} else if (options.series.pie.tilt < 0) {
-					options.series.pie.tilt = 0;
-				}
-			}
-		});
+    plot.hooks.drawOverlay.push(function(plot, octx) {
+      var options = plot.getOptions();
+      if (options.series.pie.show) {
+        drawOverlay(plot, octx);
+      }
+    });
 
-		plot.hooks.bindEvents.push(function(plot, eventHolder) {
-			var options = plot.getOptions();
-			if (options.series.pie.show) {
-				if (options.grid.hoverable) {
-					eventHolder.unbind("mousemove").mousemove(onMouseMove);
-				}
-				if (options.grid.clickable) {
-					eventHolder.unbind("click").click(onClick);
-				}
-			}
-		});
+    plot.hooks.draw.push(function(plot, newCtx) {
+      var options = plot.getOptions();
+      if (options.series.pie.show) {
+        draw(plot, newCtx);
+      }
+    });
 
-		plot.hooks.processDatapoints.push(function(plot, series, data, datapoints) {
-			var options = plot.getOptions();
-			if (options.series.pie.show) {
-				processDatapoints(plot, series, data, datapoints);
-			}
-		});
+    function processDatapoints(plot) {
+      if (!processed) {
+        processed = true;
+        canvas = plot.getCanvas();
+        target = $(canvas).parent();
+        options = plot.getOptions();
+        plot.setData(combine(plot.getData()));
+      }
+    }
 
-		plot.hooks.drawOverlay.push(function(plot, octx) {
-			var options = plot.getOptions();
-			if (options.series.pie.show) {
-				drawOverlay(plot, octx);
-			}
-		});
+    function combine(data) {
+      var total = 0,
+        combined = 0,
+        numCombined = 0,
+        color = options.series.pie.combine.color,
+        newdata = [];
 
-		plot.hooks.draw.push(function(plot, newCtx) {
-			var options = plot.getOptions();
-			if (options.series.pie.show) {
-				draw(plot, newCtx);
-			}
-		});
+      // Fix up the raw data from Flot, ensuring the data is numeric
 
-		function processDatapoints(plot, series, datapoints) {
-			if (!processed)	{
-				processed = true;
-				canvas = plot.getCanvas();
-				target = $(canvas).parent();
-				options = plot.getOptions();
-				plot.setData(combine(plot.getData()));
-			}
-		}
+      for (var i = 0; i < data.length; ++i) {
+        var value = data[i].data;
 
-		function combine(data) {
+        // If the data is an array, we'll assume that it's a standard
+        // Flot x-y pair, and are concerned only with the second value.
 
-			var total = 0,
-				combined = 0,
-				numCombined = 0,
-				color = options.series.pie.combine.color,
-				newdata = [];
+        // Note how we use the original array, rather than creating a
+        // new one; this is more efficient and preserves any extra data
+        // that the user may have stored in higher indexes.
 
-			// Fix up the raw data from Flot, ensuring the data is numeric
+        if ($.isArray(value) && value.length == 1) {
+          value = value[0];
+        }
 
-			for (var i = 0; i < data.length; ++i) {
+        if ($.isArray(value)) {
+          // Equivalent to $.isNumeric() but compatible with jQuery < 1.7
+          if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) {
+            value[1] = +value[1];
+          } else {
+            value[1] = 0;
+          }
+        } else if (!isNaN(parseFloat(value)) && isFinite(value)) {
+          value = [1, +value];
+        } else {
+          value = [1, 0];
+        }
 
-				var value = data[i].data;
+        data[i].data = [value];
+      }
 
-				// If the data is an array, we'll assume that it's a standard
-				// Flot x-y pair, and are concerned only with the second value.
+      // Sum up all the slices, so we can calculate percentages for each
 
-				// Note how we use the original array, rather than creating a
-				// new one; this is more efficient and preserves any extra data
-				// that the user may have stored in higher indexes.
+      for (var i = 0; i < data.length; ++i) {
+        total += data[i].data[0][1];
+      }
 
-				if ($.isArray(value) && value.length == 1) {
-    				value = value[0];
-				}
+      // Count the number of slices with percentages below the combine
+      // threshold; if it turns out to be just one, we won't combine.
 
-				if ($.isArray(value)) {
-					// Equivalent to $.isNumeric() but compatible with jQuery < 1.7
-					if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) {
-						value[1] = +value[1];
-					} else {
-						value[1] = 0;
-					}
-				} else if (!isNaN(parseFloat(value)) && isFinite(value)) {
-					value = [1, +value];
-				} else {
-					value = [1, 0];
-				}
+      for (var i = 0; i < data.length; ++i) {
+        var value = data[i].data[0][1];
+        if (value / total <= options.series.pie.combine.threshold) {
+          combined += value;
+          numCombined++;
+          if (!color) {
+            color = data[i].color;
+          }
+        }
+      }
 
-				data[i].data = [value];
-			}
-
-			// Sum up all the slices, so we can calculate percentages for each
-
-			for (var i = 0; i < data.length; ++i) {
-				total += data[i].data[0][1];
-			}
-
-			// Count the number of slices with percentages below the combine
-			// threshold; if it turns out to be just one, we won't combine.
-
-			for (var i = 0; i < data.length; ++i) {
-				var value = data[i].data[0][1];
-				if (value / total <= options.series.pie.combine.threshold) {
-					combined += value;
-					numCombined++;
-					if (!color) {
-						color = data[i].color;
-					}
-				}
-			}
-
-			for (var i = 0; i < data.length; ++i) {
-				var value = data[i].data[0][1];
-				if (numCombined < 2 || value / total > options.series.pie.combine.threshold) {
-					newdata.push(
-						$.extend(data[i], {     /* extend to allow keeping all other original data values
+      for (var i = 0; i < data.length; ++i) {
+        var value = data[i].data[0][1];
+        if (
+          numCombined < 2 ||
+          value / total > options.series.pie.combine.threshold
+        ) {
+          newdata.push(
+            $.extend(data[i], {
+              /* extend to allow keeping all other original data values
 						                           and using them e.g. in labelFormatter. */
-							data: [[1, value]],
-							color: data[i].color,
-							label: data[i].label,
-							angle: value * Math.PI * 2 / total,
-							percent: value / (total / 100)
-						})
-					);
-				}
-			}
-
-			if (numCombined > 1) {
-				newdata.push({
-					data: [[1, combined]],
-					color: color,
-					label: options.series.pie.combine.label,
-					angle: combined * Math.PI * 2 / total,
-					percent: combined / (total / 100)
-				});
-			}
-
-			return newdata;
-		}
-
-		function draw(plot, newCtx) {
-
-			if (!target) {
-				return; // if no series were passed
-			}
-
-			var canvasWidth = plot.getPlaceholder().width(),
-				canvasHeight = plot.getPlaceholder().height(),
-				legendWidth = target.children().filter(".legend").children().width() || 0;
-
-			ctx = newCtx;
-
-			// WARNING: HACK! REWRITE THIS CODE AS SOON AS POSSIBLE!
-
-			// When combining smaller slices into an 'other' slice, we need to
-			// add a new series.  Since Flot gives plugins no way to modify the
-			// list of series, the pie plugin uses a hack where the first call
-			// to processDatapoints results in a call to setData with the new
-			// list of series, then subsequent processDatapoints do nothing.
-
-			// The plugin-global 'processed' flag is used to control this hack;
-			// it starts out false, and is set to true after the first call to
-			// processDatapoints.
-
-			// Unfortunately this turns future setData calls into no-ops; they
-			// call processDatapoints, the flag is true, and nothing happens.
-
-			// To fix this we'll set the flag back to false here in draw, when
-			// all series have been processed, so the next sequence of calls to
-			// processDatapoints once again starts out with a slice-combine.
-			// This is really a hack; in 0.9 we need to give plugins a proper
-			// way to modify series before any processing begins.
-
-			processed = false;
-
-			// calculate maximum radius and center point
-
-			maxRadius =  Math.min(canvasWidth, canvasHeight / options.series.pie.tilt) / 2;
-			centerTop = canvasHeight / 2 + options.series.pie.offset.top;
-			centerLeft = canvasWidth / 2;
-
-			if (options.series.pie.offset.left == "auto") {
-				if (options.legend.position.match("w")) {
-					centerLeft += legendWidth / 2;
-				} else {
-					centerLeft -= legendWidth / 2;
-				}
-				if (centerLeft < maxRadius) {
-					centerLeft = maxRadius;
-				} else if (centerLeft > canvasWidth - maxRadius) {
-					centerLeft = canvasWidth - maxRadius;
-				}
-			} else {
-				centerLeft += options.series.pie.offset.left;
-			}
-
-			var slices = plot.getData(),
-				attempts = 0;
-
-			// Keep shrinking the pie's radius until drawPie returns true,
-			// indicating that all the labels fit, or we try too many times.
-
-			do {
-				if (attempts > 0) {
-					maxRadius *= REDRAW_SHRINK;
-				}
-				attempts += 1;
-				clear();
-				if (options.series.pie.tilt <= 0.8) {
-					drawShadow();
-				}
-			} while (!drawPie() && attempts < REDRAW_ATTEMPTS)
-
-			if (attempts >= REDRAW_ATTEMPTS) {
-				clear();
-				target.prepend("<div class='error'>Could not draw pie with labels contained inside canvas</div>");
-			}
-
-			if (plot.setSeries && plot.insertLegend) {
-				plot.setSeries(slices);
-				plot.insertLegend();
-			}
-
-			// we're actually done at this point, just defining internal functions at this point
-
-			function clear() {
-				ctx.clearRect(0, 0, canvasWidth, canvasHeight);
-				target.children().filter(".pieLabel, .pieLabelBackground").remove();
-			}
-
-			function drawShadow() {
-
-				var shadowLeft = options.series.pie.shadow.left;
-				var shadowTop = options.series.pie.shadow.top;
-				var edge = 10;
-				var alpha = options.series.pie.shadow.alpha;
-				var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
-
-				if (radius >= canvasWidth / 2 - shadowLeft || radius * options.series.pie.tilt >= canvasHeight / 2 - shadowTop || radius <= edge) {
-					return;	// shadow would be outside canvas, so don't draw it
-				}
-
-				ctx.save();
-				ctx.translate(shadowLeft,shadowTop);
-				ctx.globalAlpha = alpha;
-				ctx.fillStyle = "#000";
-
-				// center and rotate to starting position
-
-				ctx.translate(centerLeft,centerTop);
-				ctx.scale(1, options.series.pie.tilt);
-
-				//radius -= edge;
-
-				for (var i = 1; i <= edge; i++) {
-					ctx.beginPath();
-					ctx.arc(0, 0, radius, 0, Math.PI * 2, false);
-					ctx.fill();
-					radius -= i;
-				}
-
-				ctx.restore();
-			}
-
-			function drawPie() {
-
-				var startAngle = Math.PI * options.series.pie.startAngle;
-				var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
-
-				// center and rotate to starting position
-
-				ctx.save();
-				ctx.translate(centerLeft,centerTop);
-				ctx.scale(1, options.series.pie.tilt);
-				//ctx.rotate(startAngle); // start at top; -- This doesn't work properly in Opera
-
-				// draw slices
-
-				ctx.save();
-				var currentAngle = startAngle;
-				for (var i = 0; i < slices.length; ++i) {
-					slices[i].startAngle = currentAngle;
-					drawSlice(slices[i].angle, slices[i].color, true);
-				}
-				ctx.restore();
-
-				// draw slice outlines
-
-				if (options.series.pie.stroke.width > 0) {
-					ctx.save();
-					ctx.lineWidth = options.series.pie.stroke.width;
-					currentAngle = startAngle;
-					for (var i = 0; i < slices.length; ++i) {
-						drawSlice(slices[i].angle, options.series.pie.stroke.color, false);
-					}
-					ctx.restore();
-				}
-
-				// draw donut hole
-
-				drawDonutHole(ctx);
-
-				ctx.restore();
-
-				// Draw the labels, returning true if they fit within the plot
-
-				if (options.series.pie.label.show) {
-					return drawLabels();
-				} else return true;
-
-				function drawSlice(angle, color, fill) {
-
-					if (angle <= 0 || isNaN(angle)) {
-						return;
-					}
-
-					if (fill) {
-						ctx.fillStyle = color;
-					} else {
-						ctx.strokeStyle = color;
-						ctx.lineJoin = "round";
-					}
-
-					ctx.beginPath();
-					if (Math.abs(angle - Math.PI * 2) > 0.000000001) {
-						ctx.moveTo(0, 0); // Center of the pie
-					}
-
-					//ctx.arc(0, 0, radius, 0, angle, false); // This doesn't work properly in Opera
-					ctx.arc(0, 0, radius,currentAngle, currentAngle + angle / 2, false);
-					ctx.arc(0, 0, radius,currentAngle + angle / 2, currentAngle + angle, false);
-					ctx.closePath();
-					//ctx.rotate(angle); // This doesn't work properly in Opera
-					currentAngle += angle;
-
-					if (fill) {
-						ctx.fill();
-					} else {
-						ctx.stroke();
-					}
-				}
-
-				function drawLabels() {
-
-					var currentAngle = startAngle;
-					var radius = options.series.pie.label.radius > 1 ? options.series.pie.label.radius : maxRadius * options.series.pie.label.radius;
-
-					for (var i = 0; i < slices.length; ++i) {
-						if (slices[i].percent >= options.series.pie.label.threshold * 100) {
-							if (!drawLabel(slices[i], currentAngle, i)) {
-								return false;
-							}
-						}
-						currentAngle += slices[i].angle;
-					}
-
-					return true;
-
-					function drawLabel(slice, startAngle, index) {
-
-						if (slice.data[0][1] == 0) {
-							return true;
-						}
-
-						// format label text
-
-						var lf = options.legend.labelFormatter, text, plf = options.series.pie.label.formatter;
-
-						if (lf) {
-							text = lf(slice.label, slice);
-						} else {
-							text = slice.label;
-						}
-
-						if (plf) {
-							text = plf(text, slice);
-						}
-
-						var halfAngle = ((startAngle + slice.angle) + startAngle) / 2;
-						var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);
-						var y = centerTop + Math.round(Math.sin(halfAngle) * radius) * options.series.pie.tilt;
-
-						var html = "<span class='pieLabel' id='pieLabel" + index + "' style='position:absolute;top:" + y + "px;left:" + x + "px;'>" + text + "</span>";
-						target.append(html);
-
-						var label = target.children("#pieLabel" + index);
-						var labelTop = (y - label.height() / 2);
-						var labelLeft = (x - label.width() / 2);
-
-						label.css("top", labelTop);
-						label.css("left", labelLeft);
-
-						// check to make sure that the label is not outside the canvas
-
-						if (0 - labelTop > 0 || 0 - labelLeft > 0 || canvasHeight - (labelTop + label.height()) < 0 || canvasWidth - (labelLeft + label.width()) < 0) {
-							return false;
-						}
-
-						if (options.series.pie.label.background.opacity != 0) {
-
-							// put in the transparent background separately to avoid blended labels and label boxes
-
-							var c = options.series.pie.label.background.color;
-
-							if (c == null) {
-								c = slice.color;
-							}
-
-							var pos = "top:" + labelTop + "px;left:" + labelLeft + "px;";
-							$("<div class='pieLabelBackground' style='position:absolute;width:" + label.width() + "px;height:" + label.height() + "px;" + pos + "background-color:" + c + ";'></div>")
-								.css("opacity", options.series.pie.label.background.opacity)
-								.insertBefore(label);
-						}
-
-						return true;
-					} // end individual label function
-				} // end drawLabels function
-			} // end drawPie function
-		} // end draw function
-
-		// Placed here because it needs to be accessed from multiple locations
-
-		function drawDonutHole(layer) {
-			if (options.series.pie.innerRadius > 0) {
-
-				// subtract the center
-
-				layer.save();
-				var innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;
-				layer.globalCompositeOperation = "destination-out"; // this does not work with excanvas, but it will fall back to using the stroke color
-				layer.beginPath();
-				layer.fillStyle = options.series.pie.stroke.color;
-				layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
-				layer.fill();
-				layer.closePath();
-				layer.restore();
-
-				// add inner stroke
-
-				layer.save();
-				layer.beginPath();
-				layer.strokeStyle = options.series.pie.stroke.color;
-				layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
-				layer.stroke();
-				layer.closePath();
-				layer.restore();
-
-				// TODO: add extra shadow inside hole (with a mask) if the pie is tilted.
-			}
-		}
-
-		//-- Additional Interactive related functions --
-
-		function isPointInPoly(poly, pt) {
-			for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
-				((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || (poly[j][1] <= pt[1] && pt[1]< poly[i][1]))
-				&& (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0])
-				&& (c = !c);
-			return c;
-		}
-
-		function findNearbySlice(mouseX, mouseY) {
-
-			var slices = plot.getData(),
-				options = plot.getOptions(),
-				radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius,
-				x, y;
-
-			for (var i = 0; i < slices.length; ++i) {
-
-				var s = slices[i];
-
-				if (s.pie.show) {
-
-					ctx.save();
-					ctx.beginPath();
-					ctx.moveTo(0, 0); // Center of the pie
-					//ctx.scale(1, options.series.pie.tilt);	// this actually seems to break everything when here.
-					ctx.arc(0, 0, radius, s.startAngle, s.startAngle + s.angle / 2, false);
-					ctx.arc(0, 0, radius, s.startAngle + s.angle / 2, s.startAngle + s.angle, false);
-					ctx.closePath();
-					x = mouseX - centerLeft;
-					y = mouseY - centerTop;
-
-					if (ctx.isPointInPath) {
-						if (ctx.isPointInPath(mouseX - centerLeft, mouseY - centerTop)) {
-							ctx.restore();
-							return {
-								datapoint: [s.percent, s.data],
-								dataIndex: 0,
-								series: s,
-								seriesIndex: i
-							};
-						}
-					} else {
-
-						// excanvas for IE doesn;t support isPointInPath, this is a workaround.
-
-						var p1X = radius * Math.cos(s.startAngle),
-							p1Y = radius * Math.sin(s.startAngle),
-							p2X = radius * Math.cos(s.startAngle + s.angle / 4),
-							p2Y = radius * Math.sin(s.startAngle + s.angle / 4),
-							p3X = radius * Math.cos(s.startAngle + s.angle / 2),
-							p3Y = radius * Math.sin(s.startAngle + s.angle / 2),
-							p4X = radius * Math.cos(s.startAngle + s.angle / 1.5),
-							p4Y = radius * Math.sin(s.startAngle + s.angle / 1.5),
-							p5X = radius * Math.cos(s.startAngle + s.angle),
-							p5Y = radius * Math.sin(s.startAngle + s.angle),
-							arrPoly = [[0, 0], [p1X, p1Y], [p2X, p2Y], [p3X, p3Y], [p4X, p4Y], [p5X, p5Y]],
-							arrPoint = [x, y];
-
-						// TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?
-
-						if (isPointInPoly(arrPoly, arrPoint)) {
-							ctx.restore();
-							return {
-								datapoint: [s.percent, s.data],
-								dataIndex: 0,
-								series: s,
-								seriesIndex: i
-							};
-						}
-					}
-
-					ctx.restore();
-				}
-			}
-
-			return null;
-		}
-
-		function onMouseMove(e) {
-			triggerClickHoverEvent("plothover", e);
-		}
-
-		function onClick(e) {
-			triggerClickHoverEvent("plotclick", e);
-		}
-
-		// trigger click or hover event (they send the same parameters so we share their code)
-
-		function triggerClickHoverEvent(eventname, e) {
-
-			var offset = plot.offset();
-			var canvasX = parseInt(e.pageX - offset.left);
-			var canvasY =  parseInt(e.pageY - offset.top);
-			var item = findNearbySlice(canvasX, canvasY);
-
-			if (options.grid.autoHighlight) {
-
-				// clear auto-highlights
-
-				for (var i = 0; i < highlights.length; ++i) {
-					var h = highlights[i];
-					if (h.auto == eventname && !(item && h.series == item.series)) {
-						unhighlight(h.series);
-					}
-				}
-			}
-
-			// highlight the slice
-
-			if (item) {
-				highlight(item.series, eventname);
-			}
-
-			// trigger any hover bind events
-
-			var pos = { pageX: e.pageX, pageY: e.pageY };
-			target.trigger(eventname, [pos, item]);
-		}
-
-		function highlight(s, auto) {
-			//if (typeof s == "number") {
-			//	s = series[s];
-			//}
-
-			var i = indexOfHighlight(s);
-
-			if (i == -1) {
-				highlights.push({ series: s, auto: auto });
-				plot.triggerRedrawOverlay();
-			} else if (!auto) {
-				highlights[i].auto = false;
-			}
-		}
-
-		function unhighlight(s) {
-			if (s == null) {
-				highlights = [];
-				plot.triggerRedrawOverlay();
-			}
-
-			//if (typeof s == "number") {
-			//	s = series[s];
-			//}
-
-			var i = indexOfHighlight(s);
-
-			if (i != -1) {
-				highlights.splice(i, 1);
-				plot.triggerRedrawOverlay();
-			}
-		}
-
-		function indexOfHighlight(s) {
-			for (var i = 0; i < highlights.length; ++i) {
-				var h = highlights[i];
-				if (h.series == s)
-					return i;
-			}
-			return -1;
-		}
-
-		function drawOverlay(plot, octx) {
-
-			var options = plot.getOptions();
-
-			var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
-
-			octx.save();
-			octx.translate(centerLeft, centerTop);
-			octx.scale(1, options.series.pie.tilt);
-
-			for (var i = 0; i < highlights.length; ++i) {
-				drawHighlight(highlights[i].series);
-			}
-
-			drawDonutHole(octx);
-
-			octx.restore();
-
-			function drawHighlight(series) {
-
-				if (series.angle <= 0 || isNaN(series.angle)) {
-					return;
-				}
-
-				//octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();
-				octx.fillStyle = "rgba(255, 255, 255, " + options.series.pie.highlight.opacity + ")"; // this is temporary until we have access to parseColor
-				octx.beginPath();
-				if (Math.abs(series.angle - Math.PI * 2) > 0.000000001) {
-					octx.moveTo(0, 0); // Center of the pie
-				}
-				octx.arc(0, 0, radius, series.startAngle, series.startAngle + series.angle / 2, false);
-				octx.arc(0, 0, radius, series.startAngle + series.angle / 2, series.startAngle + series.angle, false);
-				octx.closePath();
-				octx.fill();
-			}
-		}
-	} // end init (plugin body)
-
-	// define pie specific options and their default values
-
-	var options = {
-		series: {
-			pie: {
-				show: false,
-				radius: "auto",	// actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)
-				innerRadius: 0, /* for donut */
-				startAngle: 3/2,
-				tilt: 1,
-				shadow: {
-					left: 5,	// shadow left offset
-					top: 15,	// shadow top offset
-					alpha: 0.02	// shadow alpha
-				},
-				offset: {
-					top: 0,
-					left: "auto"
-				},
-				stroke: {
-					color: "#fff",
-					width: 1
-				},
-				label: {
-					show: "auto",
-					formatter: function(label, slice) {
-						return "<div style='font-size:x-small;text-align:center;padding:2px;color:" + slice.color + ";'>" + label + "<br/>" + Math.round(slice.percent) + "%</div>";
-					},	// formatter function
-					radius: 1,	// radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)
-					background: {
-						color: null,
-						opacity: 0
-					},
-					threshold: 0	// percentage at which to hide the label (i.e. the slice is too narrow)
-				},
-				combine: {
-					threshold: -1,	// percentage at which to combine little slices into one larger slice
-					color: null,	// color to give the new slice (auto-generated if null)
-					label: "Other"	// label to give the new slice
-				},
-				highlight: {
-					//color: "#fff",		// will add this functionality once parseColor is available
-					opacity: 0.5
-				}
-			}
-		}
-	};
-
-	$.plot.plugins.push({
-		init: init,
-		options: options,
-		name: "pie",
-		version: "1.1"
-	});
-
+              data: [[1, value]],
+              color: data[i].color,
+              label: data[i].label,
+              angle: (value * Math.PI * 2) / total,
+              percent: value / (total / 100)
+            })
+          );
+        }
+      }
+
+      if (numCombined > 1) {
+        newdata.push({
+          data: [[1, combined]],
+          color: color,
+          label: options.series.pie.combine.label,
+          angle: (combined * Math.PI * 2) / total,
+          percent: combined / (total / 100)
+        });
+      }
+
+      return newdata;
+    }
+
+    function draw(plot, newCtx) {
+      if (!target) {
+        return; // if no series were passed
+      }
+
+      var canvasWidth = plot.getPlaceholder().width(),
+        canvasHeight = plot.getPlaceholder().height(),
+        legendWidth =
+          target
+            .children()
+            .filter(".legend")
+            .children()
+            .width() || 0;
+
+      ctx = newCtx;
+
+      // WARNING: HACK! REWRITE THIS CODE AS SOON AS POSSIBLE!
+
+      // When combining smaller slices into an 'other' slice, we need to
+      // add a new series.  Since Flot gives plugins no way to modify the
+      // list of series, the pie plugin uses a hack where the first call
+      // to processDatapoints results in a call to setData with the new
+      // list of series, then subsequent processDatapoints do nothing.
+
+      // The plugin-global 'processed' flag is used to control this hack;
+      // it starts out false, and is set to true after the first call to
+      // processDatapoints.
+
+      // Unfortunately this turns future setData calls into no-ops; they
+      // call processDatapoints, the flag is true, and nothing happens.
+
+      // To fix this we'll set the flag back to false here in draw, when
+      // all series have been processed, so the next sequence of calls to
+      // processDatapoints once again starts out with a slice-combine.
+      // This is really a hack; in 0.9 we need to give plugins a proper
+      // way to modify series before any processing begins.
+
+      processed = false;
+
+      // calculate maximum radius and center point
+
+      maxRadius =
+        Math.min(canvasWidth, canvasHeight / options.series.pie.tilt) / 2;
+      centerTop = canvasHeight / 2 + options.series.pie.offset.top;
+      centerLeft = canvasWidth / 2;
+
+      if (options.series.pie.offset.left == "auto") {
+        if (options.legend.position.match("w")) {
+          centerLeft += legendWidth / 2;
+        } else {
+          centerLeft -= legendWidth / 2;
+        }
+        if (centerLeft < maxRadius) {
+          centerLeft = maxRadius;
+        } else if (centerLeft > canvasWidth - maxRadius) {
+          centerLeft = canvasWidth - maxRadius;
+        }
+      } else {
+        centerLeft += options.series.pie.offset.left;
+      }
+
+      var slices = plot.getData(),
+        attempts = 0;
+
+      // Keep shrinking the pie's radius until drawPie returns true,
+      // indicating that all the labels fit, or we try too many times.
+
+      do {
+        if (attempts > 0) {
+          maxRadius *= REDRAW_SHRINK;
+        }
+        attempts += 1;
+        clear();
+        if (options.series.pie.tilt <= 0.8) {
+          drawShadow();
+        }
+      } while (!drawPie() && attempts < REDRAW_ATTEMPTS);
+
+      if (attempts >= REDRAW_ATTEMPTS) {
+        clear();
+        target.prepend(
+          "<div class='error'>Could not draw pie with labels contained inside canvas</div>"
+        );
+      }
+
+      if (plot.setSeries && plot.insertLegend) {
+        plot.setSeries(slices);
+        plot.insertLegend();
+      }
+
+      // we're actually done at this point, just defining internal functions at this point
+
+      function clear() {
+        ctx.clearRect(0, 0, canvasWidth, canvasHeight);
+        target
+          .children()
+          .filter(".pieLabel, .pieLabelBackground")
+          .remove();
+      }
+
+      function drawShadow() {
+        var shadowLeft = options.series.pie.shadow.left;
+        var shadowTop = options.series.pie.shadow.top;
+        var edge = 10;
+        var alpha = options.series.pie.shadow.alpha;
+        var radius =
+          options.series.pie.radius > 1
+            ? options.series.pie.radius
+            : maxRadius * options.series.pie.radius;
+
+        if (
+          radius >= canvasWidth / 2 - shadowLeft ||
+          radius * options.series.pie.tilt >= canvasHeight / 2 - shadowTop ||
+          radius <= edge
+        ) {
+          return; // shadow would be outside canvas, so don't draw it
+        }
+
+        ctx.save();
+        ctx.translate(shadowLeft, shadowTop);
+        ctx.globalAlpha = alpha;
+        ctx.fillStyle = "#000";
+
+        // center and rotate to starting position
+
+        ctx.translate(centerLeft, centerTop);
+        ctx.scale(1, options.series.pie.tilt);
+
+        //radius -= edge;
+
+        for (var i = 1; i <= edge; i++) {
+          ctx.beginPath();
+          ctx.arc(0, 0, radius, 0, Math.PI * 2, false);
+          ctx.fill();
+          radius -= i;
+        }
+
+        ctx.restore();
+      }
+
+      function drawPie() {
+        var startAngle = Math.PI * options.series.pie.startAngle;
+        var radius =
+          options.series.pie.radius > 1
+            ? options.series.pie.radius
+            : maxRadius * options.series.pie.radius;
+
+        // center and rotate to starting position
+
+        ctx.save();
+        ctx.translate(centerLeft, centerTop);
+        ctx.scale(1, options.series.pie.tilt);
+        //ctx.rotate(startAngle); // start at top; -- This doesn't work properly in Opera
+
+        // draw slices
+
+        ctx.save();
+        var currentAngle = startAngle;
+        for (var i = 0; i < slices.length; ++i) {
+          slices[i].startAngle = currentAngle;
+          drawSlice(slices[i].angle, slices[i].color, true);
+        }
+        ctx.restore();
+
+        // draw slice outlines
+
+        if (options.series.pie.stroke.width > 0) {
+          ctx.save();
+          ctx.lineWidth = options.series.pie.stroke.width;
+          currentAngle = startAngle;
+          for (var i = 0; i < slices.length; ++i) {
+            drawSlice(slices[i].angle, options.series.pie.stroke.color, false);
+          }
+          ctx.restore();
+        }
+
+        // draw donut hole
+
+        drawDonutHole(ctx);
+
+        ctx.restore();
+
+        // Draw the labels, returning true if they fit within the plot
+
+        if (options.series.pie.label.show) {
+          return drawLabels();
+        } else return true;
+
+        function drawSlice(angle, color, fill) {
+          if (angle <= 0 || isNaN(angle)) {
+            return;
+          }
+
+          if (fill) {
+            ctx.fillStyle = color;
+          } else {
+            ctx.strokeStyle = color;
+            ctx.lineJoin = "round";
+          }
+
+          ctx.beginPath();
+          if (Math.abs(angle - Math.PI * 2) > 0.000000001) {
+            ctx.moveTo(0, 0); // Center of the pie
+          }
+
+          //ctx.arc(0, 0, radius, 0, angle, false); // This doesn't work properly in Opera
+          ctx.arc(0, 0, radius, currentAngle, currentAngle + angle / 2, false);
+          ctx.arc(
+            0,
+            0,
+            radius,
+            currentAngle + angle / 2,
+            currentAngle + angle,
+            false
+          );
+          ctx.closePath();
+          //ctx.rotate(angle); // This doesn't work properly in Opera
+          currentAngle += angle;
+
+          if (fill) {
+            ctx.fill();
+          } else {
+            ctx.stroke();
+          }
+        }
+
+        function drawLabels() {
+          var labels = [];
+          var currentAngle = startAngle;
+          var radius =
+            options.series.pie.label.radius > 1
+              ? options.series.pie.label.radius
+              : maxRadius * options.series.pie.label.radius;
+
+          for (var i = 0; i < slices.length; ++i) {
+            if (slices[i].percent >= options.series.pie.label.threshold * 100) {
+              if (!drawLabel(slices[i], currentAngle, i)) {
+                return false;
+              }
+            }
+            currentAngle += slices[i].angle;
+          }
+
+          return true;
+
+          function drawLabel(slice, startAngle, index) {
+            if (slice.data[0][1] == 0) {
+              return true;
+            }
+
+            // format label text
+
+            var lf = options.legend.labelFormatter,
+              text,
+              plf = options.series.pie.label.formatter;
+
+            if (lf) {
+              text = lf(slice.label, slice);
+            } else {
+              text = slice.label;
+            }
+
+            if (plf) {
+              text = plf(text, slice);
+            }
+
+            var halfAngle = (startAngle + slice.angle + startAngle) / 2;
+            var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);
+            var y =
+              centerTop +
+              Math.round(Math.sin(halfAngle) * radius) *
+                options.series.pie.tilt;
+
+            var html =
+              "<span class='pieLabel' id='pieLabel" +
+              index +
+              "' style='position:absolute;top:" +
+              y +
+              "px;left:" +
+              x +
+              "px;'>" +
+              text +
+              "</span>";
+            target.append(html);
+
+            var label = target.children("#pieLabel" + index);
+            var labelTop = y - label.height() / 2;
+            var labelLeft = x - label.width() / 2;
+
+            label.css("top", labelTop);
+            label.css("left", labelLeft);
+
+            // check to make sure that the label doesn't overlap one of the other labels
+            var label_pos = getPositions(label);
+            for (var j = 0; j < labels.length; j++) {
+              var tmpPos = getPositions(labels[j]);
+              var horizontalMatch = comparePositions(label_pos[0], tmpPos[0]);
+              var verticalMatch = comparePositions(label_pos[1], tmpPos[1]);
+              var match = horizontalMatch && verticalMatch;
+              if (match) {
+                var newTop = tmpPos[1][0] - (label.height() + 1);
+                label.css("top", newTop);
+                labelTop = newTop;
+              }
+            }
+
+            function getPositions(box) {
+              var $box = $(box);
+              var pos = $box.position();
+              var width = $box.width();
+              var height = $box.height();
+              return [
+                [pos.left, pos.left + width],
+                [pos.top, pos.top + height]
+              ];
+            }
+
+            function comparePositions(p1, p2) {
+              var x1 = p1[0] < p2[0] ? p1 : p2;
+              var x2 = p1[0] < p2[0] ? p2 : p1;
+              return x1[1] > x2[0] || x1[0] === x2[0] ? true : false;
+            }
+            labels.push(label);
+
+            // check to make sure that the label is not outside the canvas
+
+            if (
+              0 - labelTop > 0 ||
+              0 - labelLeft > 0 ||
+              canvasHeight - (labelTop + label.height()) < 0 ||
+              canvasWidth - (labelLeft + label.width()) < 0
+            ) {
+              return false;
+            }
+
+            if (options.series.pie.label.background.opacity != 0) {
+              // put in the transparent background separately to avoid blended labels and label boxes
+
+              var c = options.series.pie.label.background.color;
+
+              if (c == null) {
+                c = slice.color;
+              }
+
+              var pos = "top:" + labelTop + "px;left:" + labelLeft + "px;";
+              $(
+                "<div class='pieLabelBackground' style='position:absolute;width:" +
+                  label.width() +
+                  "px;height:" +
+                  label.height() +
+                  "px;" +
+                  pos +
+                  "background-color:" +
+                  c +
+                  ";'></div>"
+              )
+                .css("opacity", options.series.pie.label.background.opacity)
+                .insertBefore(label);
+            }
+
+            return true;
+          } // end individual label function
+        } // end drawLabels function
+      } // end drawPie function
+    } // end draw function
+
+    // Placed here because it needs to be accessed from multiple locations
+
+    function drawDonutHole(layer) {
+      if (options.series.pie.innerRadius > 0) {
+        // subtract the center
+
+        layer.save();
+        var innerRadius =
+          options.series.pie.innerRadius > 1
+            ? options.series.pie.innerRadius
+            : maxRadius * options.series.pie.innerRadius;
+        layer.globalCompositeOperation = "destination-out"; // this does not work with excanvas, but it will fall back to using the stroke color
+        layer.beginPath();
+        layer.fillStyle = options.series.pie.stroke.color;
+        layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
+        layer.fill();
+        layer.closePath();
+        layer.restore();
+
+        // add inner stroke
+
+        layer.save();
+        layer.beginPath();
+        layer.strokeStyle = options.series.pie.stroke.color;
+        layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
+        layer.stroke();
+        layer.closePath();
+        layer.restore();
+
+        // TODO: add extra shadow inside hole (with a mask) if the pie is tilted.
+      }
+    }
+
+    //-- Additional Interactive related functions --
+
+    function isPointInPoly(poly, pt) {
+      for (var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
+        ((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) ||
+          (poly[j][1] <= pt[1] && pt[1] < poly[i][1])) &&
+          pt[0] <
+            ((poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1])) /
+              (poly[j][1] - poly[i][1]) +
+              poly[i][0] &&
+          (c = !c);
+      return c;
+    }
+
+    function findNearbySlice(mouseX, mouseY) {
+      var slices = plot.getData(),
+        options = plot.getOptions(),
+        radius =
+          options.series.pie.radius > 1
+            ? options.series.pie.radius
+            : maxRadius * options.series.pie.radius,
+        x,
+        y;
+
+      for (var i = 0; i < slices.length; ++i) {
+        var s = slices[i];
+
+        if (s.pie.show) {
+          ctx.save();
+          ctx.beginPath();
+          ctx.moveTo(0, 0); // Center of the pie
+          //ctx.scale(1, options.series.pie.tilt);	// this actually seems to break everything when here.
+          ctx.arc(
+            0,
+            0,
+            radius,
+            s.startAngle,
+            s.startAngle + s.angle / 2,
+            false
+          );
+          ctx.arc(
+            0,
+            0,
+            radius,
+            s.startAngle + s.angle / 2,
+            s.startAngle + s.angle,
+            false
+          );
+          ctx.closePath();
+          x = mouseX - centerLeft;
+          y = mouseY - centerTop;
+
+          if (ctx.isPointInPath) {
+            if (ctx.isPointInPath(mouseX - centerLeft, mouseY - centerTop)) {
+              ctx.restore();
+              return {
+                datapoint: [s.percent, s.data],
+                dataIndex: 0,
+                series: s,
+                seriesIndex: i
+              };
+            }
+          } else {
+            // excanvas for IE doesn;t support isPointInPath, this is a workaround.
+
+            var p1X = radius * Math.cos(s.startAngle),
+              p1Y = radius * Math.sin(s.startAngle),
+              p2X = radius * Math.cos(s.startAngle + s.angle / 4),
+              p2Y = radius * Math.sin(s.startAngle + s.angle / 4),
+              p3X = radius * Math.cos(s.startAngle + s.angle / 2),
+              p3Y = radius * Math.sin(s.startAngle + s.angle / 2),
+              p4X = radius * Math.cos(s.startAngle + s.angle / 1.5),
+              p4Y = radius * Math.sin(s.startAngle + s.angle / 1.5),
+              p5X = radius * Math.cos(s.startAngle + s.angle),
+              p5Y = radius * Math.sin(s.startAngle + s.angle),
+              arrPoly = [
+                [0, 0],
+                [p1X, p1Y],
+                [p2X, p2Y],
+                [p3X, p3Y],
+                [p4X, p4Y],
+                [p5X, p5Y]
+              ],
+              arrPoint = [x, y];
+
+            // TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?
+
+            if (isPointInPoly(arrPoly, arrPoint)) {
+              ctx.restore();
+              return {
+                datapoint: [s.percent, s.data],
+                dataIndex: 0,
+                series: s,
+                seriesIndex: i
+              };
+            }
+          }
+
+          ctx.restore();
+        }
+      }
+
+      return null;
+    }
+
+    function onMouseMove(e) {
+      triggerClickHoverEvent("plothover", e);
+    }
+
+    function onClick(e) {
+      triggerClickHoverEvent("plotclick", e);
+    }
+
+    // trigger click or hover event (they send the same parameters so we share their code)
+
+    function triggerClickHoverEvent(eventname, e) {
+      var offset = plot.offset();
+      var canvasX = parseInt(e.pageX - offset.left);
+      var canvasY = parseInt(e.pageY - offset.top);
+      var item = findNearbySlice(canvasX, canvasY);
+
+      if (options.grid.autoHighlight) {
+        // clear auto-highlights
+
+        for (var i = 0; i < highlights.length; ++i) {
+          var h = highlights[i];
+          if (h.auto == eventname && !(item && h.series == item.series)) {
+            unhighlight(h.series);
+          }
+        }
+      }
+
+      // highlight the slice
+
+      if (item) {
+        highlight(item.series, eventname);
+      }
+
+      // trigger any hover bind events
+
+      var pos = { pageX: e.pageX, pageY: e.pageY };
+      target.trigger(eventname, [pos, item]);
+    }
+
+    function highlight(s, auto) {
+      //if (typeof s == "number") {
+      //	s = series[s];
+      //}
+
+      var i = indexOfHighlight(s);
+
+      if (i == -1) {
+        highlights.push({ series: s, auto: auto });
+        plot.triggerRedrawOverlay();
+      } else if (!auto) {
+        highlights[i].auto = false;
+      }
+    }
+
+    function unhighlight(s) {
+      if (s == null) {
+        highlights = [];
+        plot.triggerRedrawOverlay();
+      }
+
+      //if (typeof s == "number") {
+      //	s = series[s];
+      //}
+
+      var i = indexOfHighlight(s);
+
+      if (i != -1) {
+        highlights.splice(i, 1);
+        plot.triggerRedrawOverlay();
+      }
+    }
+
+    function indexOfHighlight(s) {
+      for (var i = 0; i < highlights.length; ++i) {
+        var h = highlights[i];
+        if (h.series == s) return i;
+      }
+      return -1;
+    }
+
+    function drawOverlay(plot, octx) {
+      var options = plot.getOptions();
+
+      var radius =
+        options.series.pie.radius > 1
+          ? options.series.pie.radius
+          : maxRadius * options.series.pie.radius;
+
+      octx.save();
+      octx.translate(centerLeft, centerTop);
+      octx.scale(1, options.series.pie.tilt);
+
+      for (var i = 0; i < highlights.length; ++i) {
+        drawHighlight(highlights[i].series);
+      }
+
+      drawDonutHole(octx);
+
+      octx.restore();
+
+      function drawHighlight(series) {
+        if (series.angle <= 0 || isNaN(series.angle)) {
+          return;
+        }
+
+        //octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();
+        octx.fillStyle =
+          "rgba(255, 255, 255, " + options.series.pie.highlight.opacity + ")"; // this is temporary until we have access to parseColor
+        octx.beginPath();
+        if (Math.abs(series.angle - Math.PI * 2) > 0.000000001) {
+          octx.moveTo(0, 0); // Center of the pie
+        }
+        octx.arc(
+          0,
+          0,
+          radius,
+          series.startAngle,
+          series.startAngle + series.angle / 2,
+          false
+        );
+        octx.arc(
+          0,
+          0,
+          radius,
+          series.startAngle + series.angle / 2,
+          series.startAngle + series.angle,
+          false
+        );
+        octx.closePath();
+        octx.fill();
+      }
+    }
+  } // end init (plugin body)
+
+  // define pie specific options and their default values
+
+  var options = {
+    series: {
+      pie: {
+        show: false,
+        radius: "auto", // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)
+        innerRadius: 0 /* for donut */,
+        startAngle: 3 / 2,
+        tilt: 1,
+        shadow: {
+          left: 5, // shadow left offset
+          top: 15, // shadow top offset
+          alpha: 0.02 // shadow alpha
+        },
+        offset: {
+          top: 0,
+          left: "auto"
+        },
+        stroke: {
+          color: "#fff",
+          width: 1
+        },
+        label: {
+          show: "auto",
+          formatter: function(label, slice) {
+            return (
+              "<div style='font-size:x-small;text-align:center;padding:2px;color:" +
+              slice.color +
+              ";'>" +
+              label +
+              "<br/>" +
+              Math.round(slice.percent) +
+              "%</div>"
+            );
+          }, // formatter function
+          radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)
+          background: {
+            color: null,
+            opacity: 0
+          },
+          threshold: 0 // percentage at which to hide the label (i.e. the slice is too narrow)
+        },
+        combine: {
+          threshold: -1, // percentage at which to combine little slices into one larger slice
+          color: null, // color to give the new slice (auto-generated if null)
+          label: "Other" // label to give the new slice
+        },
+        highlight: {
+          //color: "#fff",		// will add this functionality once parseColor is available
+          opacity: 0.5
+        }
+      }
+    }
+  };
+
+  $.plot.plugins.push({
+    init: init,
+    options: options,
+    name: "pie",
+    version: "1.1"
+  });
 })(jQuery);
diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js
index 55cc748261..c62614ccd3 100644
--- a/pandora_console/include/graphs/flot/pandora.flot.js
+++ b/pandora_console/include/graphs/flot/pandora.flot.js
@@ -1,4 +1,5 @@
 /* global $ */
+/* exported pandoraFlotPie, pandoraFlotPieCustom */
 
 function pandoraFlotPie(
   graph_id,
@@ -14,7 +15,7 @@ function pandoraFlotPie(
   colors,
   hide_labels
 ) {
-  var labels = labels.split(separator);
+  labels = labels.split(separator);
   var data = values.split(separator);
 
   if (colors != "") {
@@ -92,7 +93,7 @@ function pandoraFlotPie(
   function pieHover(event, pos, obj) {
     if (!obj) return;
 
-    index = obj.seriesIndex;
+    var index = obj.seriesIndex;
     legends.css("color", "#3F3F3D");
     legends.eq(index).css("color", "");
   }
@@ -144,21 +145,14 @@ function pandoraFlotPieCustom(
     .pop()
     .split(".")
     .shift();
-  var labels = labels.split(separator);
-  var legend = legend.split(separator);
+  labels = labels.split(separator);
+  legend = legend.split(separator);
   var data = values.split(separator);
   var no_data = 0;
   if (colors != "") {
     colors = colors.split(separator);
   }
-  var colors_data = [
-    "#FC4444",
-    "#FFA631",
-    "#FAD403",
-    "#5BB6E5",
-    "#F2919D",
-    "#80BA27"
-  ];
+
   var color = null;
   for (var i = 0; i < data.length; i++) {
     if (colors != "") {
@@ -174,28 +168,31 @@ function pandoraFlotPieCustom(
 
   if (width <= 450) {
     show_legend = false;
-    label_conf = {
-      show: false
-    };
-  } else {
     label_conf = {
       show: true,
-      radius: 0.75,
+      radius: 5 / 8,
       formatter: function(label, series) {
+        console.log(series);
         return (
           '<div style="font-size:' +
           font_size +
-          "pt;" +
-          'text-align:center;padding:2px;color:white;">' +
-          series.percent.toFixed(2) +
-          "%</div>"
+          "pt; font-weight:bolder;" +
+          "text-align:center;padding:2px;color:rgb(63, 63, 61)" +
+          '">' +
+          label +
+          ":<br>" +
+          series.data[0][1] +
+          "</div>"
         );
       },
       background: {
-        opacity: 0.5,
-        color: ""
+        opacity: 0.5
       }
     };
+  } else {
+    label_conf = {
+      show: false
+    };
   }
 
   var conf_pie = {
@@ -203,8 +200,8 @@ function pandoraFlotPieCustom(
       pie: {
         show: true,
         radius: 3 / 4,
-        innerRadius: 0.4
-        //label: label_conf
+        innerRadius: 0.4,
+        label: label_conf
       }
     },
     legend: {
@@ -234,7 +231,7 @@ function pandoraFlotPieCustom(
   var legends = $("#" + graph_id + " .legendLabel");
   var j = 0;
   legends.each(function() {
-    //$(this).css('width', $(this).width());
+    //$(this).css("width", $(this).width());
     $(this).css("font-size", font_size + "pt");
     $(this).removeClass("legendLabel");
     $(this).addClass(font);
@@ -264,19 +261,6 @@ function pandoraFlotPieCustom(
     return false;
   });
 
-  var pielegends = $("#" + graph_id + " .pieLabelBackground");
-  pielegends.each(function() {
-    $(this)
-      .css("transform", "rotate(-35deg)")
-      .css("color", "black");
-  });
-  var labelpielegends = $("#" + graph_id + " .pieLabel");
-  labelpielegends.each(function() {
-    $(this)
-      .css("transform", "rotate(-35deg)")
-      .css("color", "black");
-  });
-
   // Events
   $("#" + graph_id).bind("plothover", pieHover);
   $("#" + graph_id).bind("plotclick", Clickpie);
@@ -287,16 +271,17 @@ function pandoraFlotPieCustom(
   function pieHover(event, pos, obj) {
     if (!obj) return;
 
-    index = obj.seriesIndex;
+    var index = obj.seriesIndex;
     legends.css("color", "#3F3F3D");
     legends.eq(index).css("color", "");
   }
 
   function Clickpie(event, pos, obj) {
     if (!obj) return;
-    percent = parseFloat(obj.series.percent).toFixed(2);
-    valor = parseFloat(obj.series.data[0][1]);
+    var percent = parseFloat(obj.series.percent).toFixed(2);
+    var valor = parseFloat(obj.series.data[0][1]);
 
+    var value = "";
     if (valor > 1000000) {
       value = Math.round((valor / 1000000) * 100) / 100;
       value = value + "M";
@@ -325,42 +310,6 @@ function pandoraFlotPieCustom(
       $("#watermark_image_" + graph_id).attr("src")
     );
   }
-  /*
-	window.onresize = function(event) {
-        $.plot($('#' + graph_id), data, conf_pie);
-        if (no_data == data.length) {
-			$('#'+graph_id+' .overlay').remove();
-			$('#'+graph_id+' .base').remove();
-			$('#'+graph_id).prepend("<img style='width:50%;' src='images/no_data_toshow.png' />");
-		}
-		var legends = $('#'+graph_id+' .legendLabel');
-		var j = 0;
-		legends.each(function () {
-			//$(this).css('width', $(this).width());
-			$(this).css('font-size', font_size+'pt');
-			$(this).removeClass("legendLabel");
-			$(this).addClass(font);
-			$(this).text(legend[j]);
-			j++;
-		});
-
-		if ($('input[name="custom_graph"]').val()) {
-			$('.legend>div').css('right',($('.legend>div').height()*-1));
-			$('.legend>table').css('right',($('.legend>div').height()*-1));
-		}
-		//$('.legend>table').css('border',"1px solid #E2E2E2");
-		$('.legend>table').css('background-color',"transparent");
-
-		var pielegends = $('#'+graph_id+' .pieLabelBackground');
-		pielegends.each(function () {
-			$(this).css('transform', "rotate(-35deg)").css('color', 'black');
-		});
-		var labelpielegends = $('#'+graph_id+' .pieLabel');
-		labelpielegends.each(function () {
-			$(this).css('transform', "rotate(-35deg)").css('color', 'black');
-		});
-    }
-*/
 }
 
 function pandoraFlotHBars(
@@ -380,12 +329,12 @@ function pandoraFlotHBars(
   max
 ) {
   var colors_data = [
-    "#FC4444",
+    "#e63c52",
     "#FFA631",
-    "#FAD403",
+    "#f3b200",
     "#5BB6E5",
     "#F2919D",
-    "#80BA27"
+    "#82b92e"
   ];
   values = values.split(separator2);
   font = font
@@ -639,7 +588,7 @@ function pandoraFlotVBars(
   var colors_data =
     colors.length > 0
       ? colors
-      : ["#FFA631", "#FC4444", "#FAD403", "#5BB6E5", "#F2919D", "#80BA27"];
+      : ["#FFA631", "#e63c52", "#f3b200", "#5BB6E5", "#F2919D", "#82b92e"];
   var datas = new Array();
 
   for (i = 0; i < values.length; i++) {
@@ -869,7 +818,7 @@ function pandoraFlotSlicebar(
 
   var datas = new Array();
 
-  for (i = 0; i < values.length; i++) {
+  for (var i = 0; i < values.length; i++) {
     var serie = values[i].split(separator);
 
     var aux = new Array();
@@ -1938,6 +1887,8 @@ function pandoraFlotArea(
   switch (type) {
     case "line":
     case 2:
+      stacked = null;
+      filled_s = false;
       break;
     case 3:
       stacked = "stack";
@@ -2681,13 +2632,13 @@ function pandoraFlotArea(
         if (events_data.event_type.search("alert") >= 0) {
           extra_color = "#FFA631";
         } else if (events_data.event_type.search("critical") >= 0) {
-          extra_color = "#FC4444";
+          extra_color = "#e63c52";
         } else if (events_data.event_type.search("warning") >= 0) {
-          extra_color = "#FAD403";
+          extra_color = "#f3b200";
         } else if (events_data.event_type.search("unknown") >= 0) {
-          extra_color = "#3BA0FF";
+          extra_color = "#4a83f3";
         } else if (events_data.event_type.search("normal") >= 0) {
-          extra_color = "#80BA27";
+          extra_color = "#82b92e";
         } else {
           extra_color = "#ffffff";
         }
@@ -2789,14 +2740,16 @@ function pandoraFlotArea(
     if (short_data) {
       formatted = number_format(v, force_integer, "", short_data);
     } else {
-      // It is an integer
+      // It is an integer.
       if (v - Math.floor(v) == 0) {
         formatted = number_format(v, force_integer, "", 2);
       }
     }
 
-    // Get only two decimals
-    formatted = round_with_decimals(formatted, 100);
+    // Get only two decimals.
+    if (typeof formatted != "string") {
+      formatted = Math.round(formatted * 100) / 100;
+    }
     return formatted;
   }
 
diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php
index 129baaa54e..fea1273015 100644
--- a/pandora_console/include/graphs/functions_d3.php
+++ b/pandora_console/include/graphs/functions_d3.php
@@ -190,8 +190,8 @@ function d3_bullet_chart(
 			}
 			
 			.bullet { font: 7px sans-serif; }
-			.bullet .marker.s0 { stroke: #FC4444; stroke-width: 2px; }
-			.bullet .marker.s1 { stroke: #FAD403; stroke-width: 2px; }
+			.bullet .marker.s0 { stroke: #e63c52; stroke-width: 2px; }
+			.bullet .marker.s1 { stroke: #f3b200; stroke-width: 2px; }
 			.bullet .marker.s2 { stroke: steelblue; stroke-width: 2px; }
 			.bullet .tick line { stroke: #666; stroke-width: .5px; }
 			.bullet .range.s0 { fill: #ddd; }
@@ -740,6 +740,8 @@ function print_donut_narrow_graph(
     array $data,
     $data_total
 ) {
+    global $config;
+
     if (empty($data)) {
         return graph_nodata_image($width, $height, 'pie');
     }
@@ -754,10 +756,31 @@ function print_donut_narrow_graph(
 
     $graph_id = uniqid('graph_');
 
+    // This is for "Style template" in visual styles.
+    switch ($config['style']) {
+        case 'pandora':
+            $textColor = '#000';
+            $strokeColor = '#fff';
+        break;
+
+        case 'pandora_black':
+            $textColor = '#fff';
+            $strokeColor = '#222';
+        break;
+
+        default:
+            $textColor = '#000';
+            $strokeColor = '#fff';
+        break;
+    }
+
+    $textColor = json_encode($textColor);
+    $strokeColor = json_encode($strokeColor);
+
     $out = "<div id='$graph_id'></div>";
     $out .= include_javascript_d3(true);
     $out .= "<script type='text/javascript'>
-						donutNarrowGraph($colors, $width, $height, $data_total)
+						donutNarrowGraph($colors, $width, $height, $data_total, $textColor, $strokeColor)
 						.donutbody(d3.select($graph_id))
 						.data($data)
 						.render();	
diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php
index 4492da7834..309ddf364b 100644
--- a/pandora_console/include/graphs/functions_flot.php
+++ b/pandora_console/include/graphs/functions_flot.php
@@ -24,7 +24,7 @@ function include_javascript_dependencies_flot_graph($return=false)
         $is_include_javascript = true;
 
         $metaconsole_hack = '';
-        if (defined('METACONSOLE')) {
+        if (is_metaconsole()) {
             $metaconsole_hack = '../../';
         }
 
@@ -279,6 +279,12 @@ function flot_area_graph(
     // Trick to get translated string from javascript.
     $return .= html_print_input_hidden('unknown_text', __('Unknown'), true);
 
+    // To use the js document ready event or not. Default true.
+    $document_ready = true;
+    if (isset($params['document_ready']) === true) {
+        $document_ready = $params['document_ready'];
+    }
+
     $values = json_encode($array_data);
 
     $legend              = json_encode($legend);
@@ -295,9 +301,28 @@ function flot_area_graph(
     }
 
     $return .= "<script type='text/javascript'>";
-    $return .= '$(document).ready( function () {';
-    $return .= 'pandoraFlotArea('."'$graph_id', \n"."JSON.parse('$values'), \n"."JSON.parse('$legend'), \n"."JSON.parse('$series_type'), \n"."JSON.parse('$color'), \n"."'$watermark', \n"."JSON.parse('$date_array'), \n"."JSON.parse('$data_module_graph'), \n"."JSON.parse('$params'), \n"."JSON.parse('$array_events_alerts')".');';
-    $return .= '});';
+
+    if ($document_ready === true) {
+        $return .= '$(document).ready( function () {';
+    }
+
+    $return .= "pandoraFlotArea(\n";
+    $return .= "'".$graph_id."', \n";
+    $return .= $values.", \n";
+    $return .= $legend.", \n";
+    $return .= $series_type.", \n";
+    $return .= $color.", \n";
+    $return .= $watermark.", \n";
+    $return .= $date_array.", \n";
+    $return .= $data_module_graph.", \n";
+    $return .= $params.", \n";
+    $return .= $array_events_alerts."\n";
+    $return .= ');';
+
+    if ($document_ready === true) {
+        $return .= '});';
+    }
+
     $return .= '</script>';
 
     // Parent layer.
@@ -428,11 +453,9 @@ function flot_pie_chart(
     include_javascript_dependencies_flot_graph();
 
     $return .= "<script type='text/javascript'>";
-    $return .= '$(document).ready( function () {';
     $return .= "pandoraFlotPie('$graph_id', '$values', '$labels',
 		'$series', '$width', $font_size, $water_mark, '$separator',
 		'$legend_position', '$height', '$colors', ".json_encode($hide_labels).')';
-    $return .= '});';
     $return .= '</script>';
 
     return $return;
@@ -508,11 +531,9 @@ function flot_custom_pie_chart(
     $colors = implode($separator, $temp_colors);
 
     $return .= "<script type='text/javascript'>";
-    $return .= '$(document).ready( function () {';
     $return .= "pandoraFlotPieCustom('$graph_id', '$values', '$labels',
 			'$width', $font_size, '$fontpath', $water_mark,
 			'$separator', '$legend_position', '$height', '$colors','$legend','$background_color')";
-    $return .= '});';
     $return .= '</script>';
 
     return $return;
@@ -608,10 +629,8 @@ function flot_hcolumn_chart($graph_data, $width, $height, $water_mark, $font='',
 
     // Javascript code
     $return .= "<script type='text/javascript'>";
-    $return .= '$(document).ready( function () {';
     $return .= "pandoraFlotHBars('$graph_id', '$values', '$labels',
 		false, $max, '$water_mark', '$separator', '$separator2', '$font', $font_size, '$background_color', '$tick_color', $val_min, $val_max)";
-    $return .= '});';
     $return .= '</script>';
 
     return $return;
@@ -701,7 +720,6 @@ function flot_vcolumn_chart($graph_data, $width, $height, $color, $legend, $long
 
     // Javascript code
     $return .= "<script type='text/javascript'>";
-    $return .= '$(document).ready( function () {';
     if ($from_ux) {
         if ($from_wux) {
             $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, true, '$background_color', '$tick_color')";
@@ -712,7 +730,6 @@ function flot_vcolumn_chart($graph_data, $width, $height, $color, $legend, $long
         $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, false, false, '$background_color', '$tick_color')";
     }
 
-    $return .= '});';
     $return .= '</script>';
 
     return $return;
@@ -887,9 +904,7 @@ function flot_slicesbar_graph(
     // Javascript code
     $return .= "<script type='text/javascript'>";
     $return .= "//<![CDATA[\n";
-    $return .= '$(document).ready( function () {';
     $return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$labels','$legend','$acumulate_data',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive, '$show')";
-    $return .= '});';
     $return .= "\n//]]>";
     $return .= '</script>';
 
diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js
index 427de827e3..a334a85357 100644
--- a/pandora_console/include/graphs/pandora.d3.js
+++ b/pandora_console/include/graphs/pandora.d3.js
@@ -1614,9 +1614,9 @@ function print_phases_donut(recipient, phases) {
       .insert("path")
       .style("fill", function(d) {
         if (d.data.value == 0) {
-          return "#80BA27";
+          return "#82b92e";
         } else {
-          return "#FC4444";
+          return "#e63c52";
         }
       })
       .attr("class", "slice");
@@ -2762,7 +2762,14 @@ function valueToBytes(value) {
   return value.toFixed(2) + shorts[pos] + "B";
 }
 
-function donutNarrowGraph(colores, width, height, total) {
+function donutNarrowGraph(
+  colores,
+  width,
+  height,
+  total,
+  textColor,
+  strokeColor
+) {
   // Default settings
   var donutbody = d3.select("body");
   var data = {};
@@ -2848,8 +2855,7 @@ function donutNarrowGraph(colores, width, height, total) {
           this._current = d;
         })
         .attr("d", arc)
-        .attr("stroke", "white")
-        .style("stroke-width", 2)
+        .attr("stroke", strokeColor)
         .style("fill", function(d) {
           return color(d.data.key);
         });
@@ -2873,9 +2879,7 @@ function donutNarrowGraph(colores, width, height, total) {
         .attr("y", 0 + radius / 10)
         .attr("class", "text-tooltip")
         .style("text-anchor", "middle")
-        .attr("font-weight", "bold")
-        .style("font-family", "Arial, Verdana")
-        //.attr("fill", "#82b92e")
+        .attr("fill", textColor)
         .style("font-size", function(d) {
           if (normal_status) {
             percentage_normal = (normal_status * 100) / total;
@@ -2905,6 +2909,7 @@ function donutNarrowGraph(colores, width, height, total) {
           /* .attr("fill", function(d) {
             return color(obj.data.key);
           })*/
+          .attr("fill", textColor)
           .style("font-size", function(d) {
             percentage = (d[obj.data.key] * 100) / total;
             if (Number.isInteger(percentage)) {
diff --git a/pandora_console/include/help/clippy/module_unknow.php b/pandora_console/include/help/clippy/module_unknow.php
index 28656c9ba2..d3a6245032 100644
--- a/pandora_console/include/help/clippy/module_unknow.php
+++ b/pandora_console/include/help/clippy/module_unknow.php
@@ -32,7 +32,7 @@ function clippy_module_unknow()
     $return_tours['tours']['module_unknow']['steps'] = [];
     $return_tours['tours']['module_unknow']['steps'][] = [
         'init_step_context' => true,
-        'intro'             => '<table>'.'<tr>'.'<td class="context_help_title">'.__('You have unknown modules in this agent.').'</td>'.'</tr>'.'<tr>'.'<td class="context_help_body">'.__('Unknown modules are modules which receive data normally at least in one occassion, but at this time are not receving data. Please check our troubleshoot help page to help you determine why you have unknown modules.').ui_print_help_icon('context_module_unknow', true, '', 'images/help.png').'</td>'.'</tr>'.'</table>',
+        'intro'             => '<table>'.'<tr>'.'<td class="context_help_title">'.__('You have unknown modules in this agent.').'</td>'.'</tr>'.'<tr>'.'<td class="context_help_body">'.__('Unknown modules are modules which receive data normally at least in one occassion, but at this time are not receving data. Please check our troubleshoot help page to help you determine why you have unknown modules.').'</td>'.'</tr>'.'</table>',
     ];
     $return_tours['tours']['module_unknow']['conf'] = [];
     $return_tours['tours']['module_unknow']['conf']['autostart'] = false;
diff --git a/pandora_console/include/javascript/buttons.dataTables.min.js b/pandora_console/include/javascript/buttons.dataTables.min.js
new file mode 100644
index 0000000000..90389767ac
--- /dev/null
+++ b/pandora_console/include/javascript/buttons.dataTables.min.js
@@ -0,0 +1,5 @@
+/*!
+ DataTables styling wrapper for Buttons
+ ©2018 SpryMedia Ltd - datatables.net/license
+*/
+(function(c){"function"===typeof define&&define.amd?define(["jquery","datatables.net-dt","datatables.net-buttons"],function(a){return c(a,window,document)}):"object"===typeof exports?module.exports=function(a,b){a||(a=window);b&&b.fn.dataTable||(b=require("datatables.net-dt")(a,b).$);b.fn.dataTable.Buttons||require("datatables.net-buttons")(a,b);return c(b,a,a.document)}:c(jQuery,window,document)})(function(c,a,b,d){return c.fn.dataTable});
diff --git a/pandora_console/include/javascript/buttons.html5.min.js b/pandora_console/include/javascript/buttons.html5.min.js
new file mode 100644
index 0000000000..deee7fee68
--- /dev/null
+++ b/pandora_console/include/javascript/buttons.html5.min.js
@@ -0,0 +1,35 @@
+/*!
+ HTML5 export buttons for Buttons and DataTables.
+ 2016 SpryMedia Ltd - datatables.net/license
+
+ FileSaver.js (1.3.3) - MIT license
+ Copyright © 2016 Eli Grey - http://eligrey.com
+*/
+(function(f){"function"===typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(g){return f(g,window,document)}):"object"===typeof exports?module.exports=function(g,p,z,t){g||(g=window);p&&p.fn.dataTable||(p=require("datatables.net")(g,p).$);p.fn.dataTable.Buttons||require("datatables.net-buttons")(g,p);return f(p,g,g.document,z,t)}:f(jQuery,window,document)})(function(f,g,p,z,t,w){function A(a){for(var b="";0<=a;)b=String.fromCharCode(a%26+65)+b,a=Math.floor(a/
+26)-1;return b}function E(a,b){y===w&&(y=-1===C.serializeToString(f.parseXML(F["xl/worksheets/sheet1.xml"])).indexOf("xmlns:r"));f.each(b,function(b,c){if(f.isPlainObject(c))b=a.folder(b),E(b,c);else{if(y){var d=c.childNodes[0],e,h=[];for(e=d.attributes.length-1;0<=e;e--){var m=d.attributes[e].nodeName;var k=d.attributes[e].nodeValue;-1!==m.indexOf(":")&&(h.push({name:m,value:k}),d.removeAttribute(m))}e=0;for(m=h.length;e<m;e++)k=c.createAttribute(h[e].name.replace(":","_dt_b_namespace_token_")),
+k.value=h[e].value,d.setAttributeNode(k)}c=C.serializeToString(c);y&&(-1===c.indexOf("<?xml")&&(c='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+c),c=c.replace(/_dt_b_namespace_token_/g,":"),c=c.replace(/xmlns:NS[\d]+="" NS[\d]+:/g,""));c=c.replace(/<([^<>]*?) xmlns=""([^<>]*?)>/g,"<$1 $2>");a.file(b,c)}})}function r(a,b,d){var c=a.createElement(b);d&&(d.attr&&f(c).attr(d.attr),d.children&&f.each(d.children,function(a,b){c.appendChild(b)}),null!==d.text&&d.text!==w&&c.appendChild(a.createTextNode(d.text)));
+return c}function L(a,b){var d=a.header[b].length;a.footer&&a.footer[b].length>d&&(d=a.footer[b].length);for(var c=0,f=a.body.length;c<f;c++){var e=a.body[c][b];e=null!==e&&e!==w?e.toString():"";-1!==e.indexOf("\n")?(e=e.split("\n"),e.sort(function(a,c){return c.length-a.length}),e=e[0].length):e=e.length;e>d&&(d=e);if(40<d)return 54}d*=1.35;return 6<d?d:6}var v=f.fn.dataTable;v.Buttons.pdfMake=function(a){if(!a)return t||g.pdfMake;t=m_ake};v.Buttons.jszip=function(a){if(!a)return z||g.JSZip;z=a};
+var B=function(a){if(!("undefined"===typeof a||"undefined"!==typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var b=a.document.createElementNS("http://www.w3.org/1999/xhtml","a"),d="download"in b,c=/constructor/i.test(a.HTMLElement)||a.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent),e=function(c){(a.setImmediate||a.setTimeout)(function(){throw c;},0)},h=function(c){setTimeout(function(){"string"===typeof c?(a.URL||a.webkitURL||a).revokeObjectURL(c):c.remove()},4E4)},m=function(a){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?
+new Blob([String.fromCharCode(65279),a],{type:a.type}):a},k=function(k,q,n){n||(k=m(k));var l=this,g="application/octet-stream"===k.type,D=function(){var a=["writestart","progress","write","writeend"];a=[].concat(a);for(var c=a.length;c--;){var b=l["on"+a[c]];if("function"===typeof b)try{b.call(l,l)}catch(M){e(M)}}};l.readyState=l.INIT;if(d){var u=(a.URL||a.webkitURL||a).createObjectURL(k);setTimeout(function(){b.href=u;b.download=q;var a=new MouseEvent("click");b.dispatchEvent(a);D();h(u);l.readyState=
+l.DONE})}else(function(){if((f||g&&c)&&a.FileReader){var b=new FileReader;b.onloadend=function(){var c=f?b.result:b.result.replace(/^data:[^;]*;/,"data:attachment/file;");a.open(c,"_blank")||(a.location.href=c);l.readyState=l.DONE;D()};b.readAsDataURL(k);l.readyState=l.INIT}else u||(u=(a.URL||a.webkitURL||a).createObjectURL(k)),g?a.location.href=u:a.open(u,"_blank")||(a.location.href=u),l.readyState=l.DONE,D(),h(u)})()},n=k.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a,
+c,b){c=c||a.name||"download";b||(a=m(a));return navigator.msSaveOrOpenBlob(a,c)};n.abort=function(){};n.readyState=n.INIT=0;n.WRITING=1;n.DONE=2;n.error=n.onwritestart=n.onprogress=n.onwrite=n.onabort=n.onerror=n.onwriteend=null;return function(a,c,b){return new k(a,c||a.name||"download",b)}}}("undefined"!==typeof self&&self||"undefined"!==typeof g&&g||this.content);v.fileSave=B;var G=function(a){var b="Sheet1";a.sheetName&&(b=a.sheetName.replace(/[\[\]\*\/\\\?:]/g,""));return b},H=function(a){return a.newline?
+a.newline:navigator.userAgent.match(/Windows/)?"\r\n":"\n"},I=function(a,b){var d=H(b);a=a.buttons.exportData(b.exportOptions);var c=b.fieldBoundary,f=b.fieldSeparator,e=new RegExp(c,"g"),h=b.escapeChar!==w?b.escapeChar:"\\",m=function(a){for(var b="",d=0,m=a.length;d<m;d++)0<d&&(b+=f),b+=c?c+(""+a[d]).replace(e,h+c)+c:a[d];return b},k=b.header?m(a.header)+d:"";b=b.footer&&a.footer?d+m(a.footer):"";for(var n=[],g=0,q=a.body.length;g<q;g++)n.push(m(a.body[g]));return{str:k+n.join(d)+b,rows:n.length}},
+J=function(){if(-1===navigator.userAgent.indexOf("Safari")||-1!==navigator.userAgent.indexOf("Chrome")||-1!==navigator.userAgent.indexOf("Opera"))return!1;var a=navigator.userAgent.match(/AppleWebKit\/(\d+\.\d+)/);return a&&1<a.length&&603.1>1*a[1]?!0:!1};try{var C=new XMLSerializer,y}catch(a){}var F={"_rels/.rels":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>',
+"xl/_rels/workbook.xml.rels":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>',"[Content_Types].xml":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="xml" ContentType="application/xml" /><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /><Default Extension="jpeg" ContentType="image/jpeg" /><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" /><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" /><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml" /></Types>',
+"xl/workbook.xml":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><fileVersion appName="xl" lastEdited="5" lowestEdited="5" rupBuild="24816"/><workbookPr showInkAnnotation="0" autoCompressPictures="0"/><bookViews><workbookView xWindow="0" yWindow="0" windowWidth="25600" windowHeight="19020" tabRatio="500"/></bookViews><sheets><sheet name="Sheet1" sheetId="1" r:id="rId1"/></sheets><definedNames/></workbook>',
+"xl/worksheets/sheet1.xml":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"><sheetData/><mergeCells count="0"/></worksheet>',"xl/styles.xml":'<?xml version="1.0" encoding="UTF-8"?><styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"><numFmts count="6"><numFmt numFmtId="164" formatCode="#,##0.00_- [$$-45C]"/><numFmt numFmtId="165" formatCode="&quot;£&quot;#,##0.00"/><numFmt numFmtId="166" formatCode="[$€-2] #,##0.00"/><numFmt numFmtId="167" formatCode="0.0%"/><numFmt numFmtId="168" formatCode="#,##0;(#,##0)"/><numFmt numFmtId="169" formatCode="#,##0.00;(#,##0.00)"/></numFmts><fonts count="5" x14ac:knownFonts="1"><font><sz val="11" /><name val="Calibri" /></font><font><sz val="11" /><name val="Calibri" /><color rgb="FFFFFFFF" /></font><font><sz val="11" /><name val="Calibri" /><b /></font><font><sz val="11" /><name val="Calibri" /><i /></font><font><sz val="11" /><name val="Calibri" /><u /></font></fonts><fills count="6"><fill><patternFill patternType="none" /></fill><fill><patternFill patternType="none" /></fill><fill><patternFill patternType="solid"><fgColor rgb="FFD9D9D9" /><bgColor indexed="64" /></patternFill></fill><fill><patternFill patternType="solid"><fgColor rgb="FFD99795" /><bgColor indexed="64" /></patternFill></fill><fill><patternFill patternType="solid"><fgColor rgb="ffc6efce" /><bgColor indexed="64" /></patternFill></fill><fill><patternFill patternType="solid"><fgColor rgb="ffc6cfef" /><bgColor indexed="64" /></patternFill></fill></fills><borders count="2"><border><left /><right /><top /><bottom /><diagonal /></border><border diagonalUp="false" diagonalDown="false"><left style="thin"><color auto="1" /></left><right style="thin"><color auto="1" /></right><top style="thin"><color auto="1" /></top><bottom style="thin"><color auto="1" /></bottom><diagonal /></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" /></cellStyleXfs><cellXfs count="67"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment horizontal="left"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment horizontal="center"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment horizontal="right"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment horizontal="fill"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment textRotation="90"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment wrapText="1"/></xf><xf numFmtId="9"   fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="164" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="165" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="166" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="167" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="168" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="169" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="3" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="4" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="1" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="2" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0" /></cellStyles><dxfs count="0" /><tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4" /></styleSheet>'},
+K=[{match:/^\-?\d+\.\d%$/,style:60,fmt:function(a){return a/100}},{match:/^\-?\d+\.?\d*%$/,style:56,fmt:function(a){return a/100}},{match:/^\-?\$[\d,]+.?\d*$/,style:57},{match:/^\-?£[\d,]+.?\d*$/,style:58},{match:/^\-?€[\d,]+.?\d*$/,style:59},{match:/^\-?\d+$/,style:65},{match:/^\-?\d+\.\d{2}$/,style:66},{match:/^\([\d,]+\)$/,style:61,fmt:function(a){return-1*a.replace(/[\(\)]/g,"")}},{match:/^\([\d,]+\.\d{2}\)$/,style:62,fmt:function(a){return-1*a.replace(/[\(\)]/g,"")}},{match:/^\-?[\d,]+$/,style:63},
+{match:/^\-?[\d,]+\.\d{2}$/,style:64}];v.ext.buttons.copyHtml5={className:"buttons-copy buttons-html5",text:function(a){return a.i18n("buttons.copy","Copy")},action:function(a,b,d,c){this.processing(!0);var g=this;a=I(b,c);var e=b.buttons.exportInfo(c),h=H(c),m=a.str;d=f("<div/>").css({height:1,width:1,overflow:"hidden",position:"fixed",top:0,left:0});e.title&&(m=e.title+h+h+m);e.messageTop&&(m=e.messageTop+h+h+m);e.messageBottom&&(m=m+h+h+e.messageBottom);c.customize&&(m=c.customize(m,c,b));c=f("<textarea readonly/>").val(m).appendTo(d);
+if(p.queryCommandSupported("copy")){d.appendTo(b.table().container());c[0].focus();c[0].select();try{var k=p.execCommand("copy");d.remove();if(k){b.buttons.info(b.i18n("buttons.copyTitle","Copy to clipboard"),b.i18n("buttons.copySuccess",{1:"Copied one row to clipboard",_:"Copied %d rows to clipboard"},a.rows),2E3);this.processing(!1);return}}catch(q){}}k=f("<span>"+b.i18n("buttons.copyKeys","Press <i>ctrl</i> or <i>⌘</i> + <i>C</i> to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape.")+
+"</span>").append(d);b.buttons.info(b.i18n("buttons.copyTitle","Copy to clipboard"),k,0);c[0].focus();c[0].select();var n=f(k).closest(".dt-button-info"),r=function(){n.off("click.buttons-copy");f(p).off(".buttons-copy");b.buttons.info(!1)};n.on("click.buttons-copy",r);f(p).on("keydown.buttons-copy",function(a){27===a.keyCode&&(r(),g.processing(!1))}).on("copy.buttons-copy cut.buttons-copy",function(){r();g.processing(!1)})},exportOptions:{},fieldSeparator:"\t",fieldBoundary:"",header:!0,footer:!1,
+title:"*",messageTop:"*",messageBottom:"*"};v.ext.buttons.csvHtml5={bom:!1,className:"buttons-csv buttons-html5",available:function(){return g.FileReader!==w&&g.Blob},text:function(a){return a.i18n("buttons.csv","CSV")},action:function(a,b,d,c){this.processing(!0);a=I(b,c).str;d=b.buttons.exportInfo(c);var f=c.charset;c.customize&&(a=c.customize(a,c,b));!1!==f?(f||(f=p.characterSet||p.charset),f&&(f=";charset="+f)):f="";c.bom&&(a=""+a);B(new Blob([a],{type:"text/csv"+f}),d.filename,!0);this.processing(!1)},
+filename:"*",extension:".csv",exportOptions:{},fieldSeparator:",",fieldBoundary:'"',escapeChar:'"',charset:null,header:!0,footer:!1};v.ext.buttons.excelHtml5={className:"buttons-excel buttons-html5",available:function(){return g.FileReader!==w&&(z||g.JSZip)!==w&&!J()&&C},text:function(a){return a.i18n("buttons.excel","Excel")},action:function(a,b,d,c){this.processing(!0);var p=this,e=0;a=function(a){return f.parseXML(F[a])};var h=a("xl/worksheets/sheet1.xml"),m=h.getElementsByTagName("sheetData")[0];
+a={_rels:{".rels":a("_rels/.rels")},xl:{_rels:{"workbook.xml.rels":a("xl/_rels/workbook.xml.rels")},"workbook.xml":a("xl/workbook.xml"),"styles.xml":a("xl/styles.xml"),worksheets:{"sheet1.xml":h}},"[Content_Types].xml":a("[Content_Types].xml")};var k=b.buttons.exportData(c.exportOptions),n,v,q=function(a){n=e+1;v=r(h,"row",{attr:{r:n}});for(var b=0,d=a.length;b<d;b++){var k=A(b)+""+n,g=null;if(null===a[b]||a[b]===w||""===a[b])if(!0===c.createEmptyCells)a[b]="";else continue;var l=a[b];a[b]=f.trim(a[b]);
+for(var q=0,p=K.length;q<p;q++){var u=K[q];if(a[b].match&&!a[b].match(/^0\d+/)&&a[b].match(u.match)){g=a[b].replace(/[^\d\.\-]/g,"");u.fmt&&(g=u.fmt(g));g=r(h,"c",{attr:{r:k,s:u.style},children:[r(h,"v",{text:g})]});break}}g||("number"===typeof a[b]||a[b].match&&a[b].match(/^-?\d+(\.\d+)?$/)&&!a[b].match(/^0\d+/)?g=r(h,"c",{attr:{t:"n",r:k},children:[r(h,"v",{text:a[b]})]}):(l=l.replace?l.replace(/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F-\x9F]/g,""):l,g=r(h,"c",{attr:{t:"inlineStr",r:k},children:{row:r(h,
+"is",{children:{row:r(h,"t",{text:l,attr:{"xml:space":"preserve"}})}})}})));v.appendChild(g)}m.appendChild(v);e++};c.customizeData&&c.customizeData(k);var x=function(a,b){var c=f("mergeCells",h);c[0].appendChild(r(h,"mergeCell",{attr:{ref:"A"+a+":"+A(b)+a}}));c.attr("count",parseFloat(c.attr("count"))+1);f("row:eq("+(a-1)+") c",h).attr("s","51")},l=b.buttons.exportInfo(c);l.title&&(q([l.title],e),x(e,k.header.length-1));l.messageTop&&(q([l.messageTop],e),x(e,k.header.length-1));c.header&&(q(k.header,
+e),f("row:last c",h).attr("s","2"));d=e;var t=0;for(var y=k.body.length;t<y;t++)q(k.body[t],e);t=e;c.footer&&k.footer&&(q(k.footer,e),f("row:last c",h).attr("s","2"));l.messageBottom&&(q([l.messageBottom],e),x(e,k.header.length-1));q=r(h,"cols");f("worksheet",h).prepend(q);x=0;for(y=k.header.length;x<y;x++)q.appendChild(r(h,"col",{attr:{min:x+1,max:x+1,width:L(k,x),customWidth:1}}));q=a.xl["workbook.xml"];f("sheets sheet",q).attr("name",G(c));c.autoFilter&&(f("mergeCells",h).before(r(h,"autoFilter",
+{attr:{ref:"A"+d+":"+A(k.header.length-1)+t}})),f("definedNames",q).append(r(q,"definedName",{attr:{name:"_xlnm._FilterDatabase",localSheetId:"0",hidden:1},text:G(c)+"!$A$"+d+":"+A(k.header.length-1)+t})));c.customize&&c.customize(a,c,b);0===f("mergeCells",h).children().length&&f("mergeCells",h).remove();b=new (z||g.JSZip);d={type:"blob",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};E(b,a);b.generateAsync?b.generateAsync(d).then(function(a){B(a,l.filename);p.processing(!1)}):
+(B(b.generate(d),l.filename),this.processing(!1))},filename:"*",extension:".xlsx",exportOptions:{},header:!0,footer:!1,title:"*",messageTop:"*",messageBottom:"*",createEmptyCells:!1,autoFilter:!1,sheetName:""};v.ext.buttons.pdfHtml5={className:"buttons-pdf buttons-html5",available:function(){return g.FileReader!==w&&(t||g.pdfMake)},text:function(a){return a.i18n("buttons.pdf","PDF")},action:function(a,b,d,c){this.processing(!0);d=b.buttons.exportData(c.exportOptions);a=b.buttons.exportInfo(c);var p=
+[];c.header&&p.push(f.map(d.header,function(a){return{text:"string"===typeof a?a:a+"",style:"tableHeader"}}));for(var e=0,h=d.body.length;e<h;e++)p.push(f.map(d.body[e],function(a){if(null===a||a===w)a="";return{text:"string"===typeof a?a:a+"",style:e%2?"tableBodyEven":"tableBodyOdd"}}));c.footer&&d.footer&&p.push(f.map(d.footer,function(a){return{text:"string"===typeof a?a:a+"",style:"tableFooter"}}));d={pageSize:c.pageSize,pageOrientation:c.orientation,content:[{table:{headerRows:1,body:p},layout:"noBorders"}],
+styles:{tableHeader:{bold:!0,fontSize:11,color:"white",fillColor:"#2d4154",alignment:"center"},tableBodyEven:{},tableBodyOdd:{fillColor:"#f3f3f3"},tableFooter:{bold:!0,fontSize:11,color:"white",fillColor:"#2d4154"},title:{alignment:"center",fontSize:15},message:{}},defaultStyle:{fontSize:10}};a.messageTop&&d.content.unshift({text:a.messageTop,style:"message",margin:[0,0,0,12]});a.messageBottom&&d.content.push({text:a.messageBottom,style:"message",margin:[0,0,0,12]});a.title&&d.content.unshift({text:a.title,
+style:"title",margin:[0,0,0,12]});c.customize&&c.customize(d,c,b);b=(t||g.pdfMake).createPdf(d);"open"!==c.download||J()?b.download(a.filename):b.open();this.processing(!1)},title:"*",filename:"*",extension:".pdf",exportOptions:{},orientation:"portrait",pageSize:"A4",header:!0,footer:!1,messageTop:"*",messageBottom:"*",customize:null,download:"download"};return v.Buttons});
diff --git a/pandora_console/include/javascript/buttons.print.min.js b/pandora_console/include/javascript/buttons.print.min.js
new file mode 100644
index 0000000000..373295a00e
--- /dev/null
+++ b/pandora_console/include/javascript/buttons.print.min.js
@@ -0,0 +1,9 @@
+/*!
+ Print button for Buttons and DataTables.
+ 2016 SpryMedia Ltd - datatables.net/license
+*/
+(function(c){"function"===typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(e){return c(e,window,document)}):"object"===typeof exports?module.exports=function(e,a){e||(e=window);a&&a.fn.dataTable||(a=require("datatables.net")(e,a).$);a.fn.dataTable.Buttons||require("datatables.net-buttons")(e,a);return c(a,e,e.document)}:c(jQuery,window,document)})(function(c,e,a,q){var k=c.fn.dataTable,d=a.createElement("a"),p=function(b){d.href=b;b=d.host;-1===b.indexOf("/")&&
+0!==d.pathname.indexOf("/")&&(b+="/");return d.protocol+"//"+b+d.pathname+d.search};k.ext.buttons.print={className:"buttons-print",text:function(b){return b.i18n("buttons.print","Print")},action:function(b,a,d,g){b=a.buttons.exportData(c.extend({decodeEntities:!1},g.exportOptions));d=a.buttons.exportInfo(g);var k=a.columns(g.exportOptions.columns).flatten().map(function(b){return a.settings()[0].aoColumns[a.column(b).index()].sClass}).toArray(),m=function(b,a){for(var d="<tr>",c=0,e=b.length;c<e;c++)d+=
+"<"+a+" "+(k[c]?'class="'+k[c]+'"':"")+">"+(null===b[c]||b[c]===q?"":b[c])+"</"+a+">";return d+"</tr>"},h='<table class="'+a.table().node().className+'">';g.header&&(h+="<thead>"+m(b.header,"th")+"</thead>");h+="<tbody>";for(var n=0,r=b.body.length;n<r;n++)h+=m(b.body[n],"td");h+="</tbody>";g.footer&&b.footer&&(h+="<tfoot>"+m(b.footer,"th")+"</tfoot>");h+="</table>";var f=e.open("","");f.document.close();var l="<title>"+d.title+"</title>";c("style, link").each(function(){var b=l,a=c(this).clone()[0];
+"link"===a.nodeName.toLowerCase()&&(a.href=p(a.href));l=b+a.outerHTML});try{f.document.head.innerHTML=l}catch(t){c(f.document.head).html(l)}f.document.body.innerHTML="<h1>"+d.title+"</h1><div>"+(d.messageTop||"")+"</div>"+h+"<div>"+(d.messageBottom||"")+"</div>";c(f.document.body).addClass("dt-print-view");c("img",f.document.body).each(function(b,a){a.setAttribute("src",p(a.getAttribute("src")))});g.customize&&g.customize(f,g,a);b=function(){g.autoPrint&&(f.print(),f.close())};navigator.userAgent.match(/Trident\/\d.\d/)?
+b():f.setTimeout(b,1E3)},title:"*",messageTop:"*",messageBottom:"*",exportOptions:{},header:!0,footer:!1,autoPrint:!0,customize:null};return k.Buttons});
diff --git a/pandora_console/include/javascript/dataTables.buttons.min.js b/pandora_console/include/javascript/dataTables.buttons.min.js
new file mode 100644
index 0000000000..5b37c7ff0a
--- /dev/null
+++ b/pandora_console/include/javascript/dataTables.buttons.min.js
@@ -0,0 +1,45 @@
+/*!
+ Buttons for DataTables 1.5.6
+ ©2016-2019 SpryMedia Ltd - datatables.net/license
+*/
+var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(d,q,n){d instanceof String&&(d=String(d));for(var l=d.length,u=0;u<l;u++){var p=d[u];if(q.call(n,p,u,d))return{i:u,v:p}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
+$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(d,q,n){d!=Array.prototype&&d!=Object.prototype&&(d[q]=n.value)};$jscomp.getGlobal=function(d){return"undefined"!=typeof window&&window===d?d:"undefined"!=typeof global&&null!=global?global:d};$jscomp.global=$jscomp.getGlobal(this);
+$jscomp.polyfill=function(d,q,n,l){if(q){n=$jscomp.global;d=d.split(".");for(l=0;l<d.length-1;l++){var u=d[l];u in n||(n[u]={});n=n[u]}d=d[d.length-1];l=n[d];q=q(l);q!=l&&null!=q&&$jscomp.defineProperty(n,d,{configurable:!0,writable:!0,value:q})}};$jscomp.polyfill("Array.prototype.find",function(d){return d?d:function(d,n){return $jscomp.findInternal(this,d,n).v}},"es6","es3");
+(function(d){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(q){return d(q,window,document)}):"object"===typeof exports?module.exports=function(q,n){q||(q=window);n&&n.fn.dataTable||(n=require("datatables.net")(q,n).$);return d(n,q,q.document)}:d(jQuery,window,document)})(function(d,q,n,l){function u(a){a=new p.Api(a);var b=a.init().buttons||p.defaults.buttons;return(new t(a,b)).container()}var p=d.fn.dataTable,B=0,C=0,r=p.ext.buttons,t=function(a,b){if(!(this instanceof
+t))return function(b){return(new t(b,a)).container()};"undefined"===typeof b&&(b={});!0===b&&(b={});d.isArray(b)&&(b={buttons:b});this.c=d.extend(!0,{},t.defaults,b);b.buttons&&(this.c.buttons=b.buttons);this.s={dt:new p.Api(a),buttons:[],listenKeys:"",namespace:"dtb"+B++};this.dom={container:d("<"+this.c.dom.container.tag+"/>").addClass(this.c.dom.container.className)};this._constructor()};d.extend(t.prototype,{action:function(a,b){a=this._nodeToButton(a);if(b===l)return a.conf.action;a.conf.action=
+b;return this},active:function(a,b){var c=this._nodeToButton(a);a=this.c.dom.button.active;c=d(c.node);if(b===l)return c.hasClass(a);c.toggleClass(a,b===l?!0:b);return this},add:function(a,b){var c=this.s.buttons;if("string"===typeof b){b=b.split("-");c=this.s;for(var d=0,f=b.length-1;d<f;d++)c=c.buttons[1*b[d]];c=c.buttons;b=1*b[b.length-1]}this._expandButton(c,a,!1,b);this._draw();return this},container:function(){return this.dom.container},disable:function(a){a=this._nodeToButton(a);d(a.node).addClass(this.c.dom.button.disabled);
+return this},destroy:function(){d("body").off("keyup."+this.s.namespace);var a=this.s.buttons.slice(),b;var c=0;for(b=a.length;c<b;c++)this.remove(a[c].node);this.dom.container.remove();a=this.s.dt.settings()[0];c=0;for(b=a.length;c<b;c++)if(a.inst===this){a.splice(c,1);break}return this},enable:function(a,b){if(!1===b)return this.disable(a);a=this._nodeToButton(a);d(a.node).removeClass(this.c.dom.button.disabled);return this},name:function(){return this.c.name},node:function(a){if(!a)return this.dom.container;
+a=this._nodeToButton(a);return d(a.node)},processing:function(a,b){a=this._nodeToButton(a);if(b===l)return d(a.node).hasClass("processing");d(a.node).toggleClass("processing",b);return this},remove:function(a){var b=this._nodeToButton(a),c=this._nodeToHost(a),e=this.s.dt;if(b.buttons.length)for(var f=b.buttons.length-1;0<=f;f--)this.remove(b.buttons[f].node);b.conf.destroy&&b.conf.destroy.call(e.button(a),e,d(a),b.conf);this._removeKey(b.conf);d(b.node).remove();a=d.inArray(b,c);c.splice(a,1);return this},
+text:function(a,b){var c=this._nodeToButton(a);a=this.c.dom.collection.buttonLiner;a=c.inCollection&&a&&a.tag?a.tag:this.c.dom.buttonLiner.tag;var e=this.s.dt,f=d(c.node),g=function(a){return"function"===typeof a?a(e,f,c.conf):a};if(b===l)return g(c.conf.text);c.conf.text=b;a?f.children(a).html(g(b)):f.html(g(b));return this},_constructor:function(){var a=this,b=this.s.dt,c=b.settings()[0],e=this.c.buttons;c._buttons||(c._buttons=[]);c._buttons.push({inst:this,name:this.c.name});for(var f=0,g=e.length;f<
+g;f++)this.add(e[f]);b.on("destroy",function(b,d){d===c&&a.destroy()});d("body").on("keyup."+this.s.namespace,function(b){if(!n.activeElement||n.activeElement===n.body){var c=String.fromCharCode(b.keyCode).toLowerCase();-1!==a.s.listenKeys.toLowerCase().indexOf(c)&&a._keypress(c,b)}})},_addKey:function(a){a.key&&(this.s.listenKeys+=d.isPlainObject(a.key)?a.key.key:a.key)},_draw:function(a,b){a||(a=this.dom.container,b=this.s.buttons);a.children().detach();for(var c=0,d=b.length;c<d;c++)a.append(b[c].inserter),
+a.append(" "),b[c].buttons&&b[c].buttons.length&&this._draw(b[c].collection,b[c].buttons)},_expandButton:function(a,b,c,e){var f=this.s.dt,g=0;b=d.isArray(b)?b:[b];for(var h=0,k=b.length;h<k;h++){var v=this._resolveExtends(b[h]);if(v)if(d.isArray(v))this._expandButton(a,v,c,e);else{var m=this._buildButton(v,c);if(m){e!==l?(a.splice(e,0,m),e++):a.push(m);if(m.conf.buttons){var y=this.c.dom.collection;m.collection=d("<"+y.tag+"/>").addClass(y.className).attr("role","menu");m.conf._collection=m.collection;
+this._expandButton(m.buttons,m.conf.buttons,!0,e)}v.init&&v.init.call(f.button(m.node),f,d(m.node),v);g++}}}},_buildButton:function(a,b){var c=this.c.dom.button,e=this.c.dom.buttonLiner,f=this.c.dom.collection,g=this.s.dt,h=function(b){return"function"===typeof b?b(g,m,a):b};b&&f.button&&(c=f.button);b&&f.buttonLiner&&(e=f.buttonLiner);if(a.available&&!a.available(g,a))return!1;var k=function(a,b,c,e){e.action.call(b.button(c),a,b,c,e);d(b.table().node()).triggerHandler("buttons-action.dt",[b.button(c),
+b,c,e])};f=a.tag||c.tag;var v=a.clickBlurs===l?!0:a.clickBlurs,m=d("<"+f+"/>").addClass(c.className).attr("tabindex",this.s.dt.settings()[0].iTabIndex).attr("aria-controls",this.s.dt.table().node().id).on("click.dtb",function(b){b.preventDefault();!m.hasClass(c.disabled)&&a.action&&k(b,g,m,a);v&&m.blur()}).on("keyup.dtb",function(b){13===b.keyCode&&!m.hasClass(c.disabled)&&a.action&&k(b,g,m,a)});"a"===f.toLowerCase()&&m.attr("href","#");"button"===f.toLowerCase()&&m.attr("type","button");e.tag?(f=
+d("<"+e.tag+"/>").html(h(a.text)).addClass(e.className),"a"===e.tag.toLowerCase()&&f.attr("href","#"),m.append(f)):m.html(h(a.text));!1===a.enabled&&m.addClass(c.disabled);a.className&&m.addClass(a.className);a.titleAttr&&m.attr("title",h(a.titleAttr));a.attr&&m.attr(a.attr);a.namespace||(a.namespace=".dt-button-"+C++);e=(e=this.c.dom.buttonContainer)&&e.tag?d("<"+e.tag+"/>").addClass(e.className).append(m):m;this._addKey(a);this.c.buttonCreated&&(e=this.c.buttonCreated(a,e));return{conf:a,node:m.get(0),
+inserter:e,buttons:[],inCollection:b,collection:null}},_nodeToButton:function(a,b){b||(b=this.s.buttons);for(var c=0,d=b.length;c<d;c++){if(b[c].node===a)return b[c];if(b[c].buttons.length){var f=this._nodeToButton(a,b[c].buttons);if(f)return f}}},_nodeToHost:function(a,b){b||(b=this.s.buttons);for(var c=0,d=b.length;c<d;c++){if(b[c].node===a)return b;if(b[c].buttons.length){var f=this._nodeToHost(a,b[c].buttons);if(f)return f}}},_keypress:function(a,b){if(!b._buttonsHandled){var c=function(e){for(var f=
+0,g=e.length;f<g;f++){var h=e[f].conf,k=e[f].node;h.key&&(h.key===a?(b._buttonsHandled=!0,d(k).click()):!d.isPlainObject(h.key)||h.key.key!==a||h.key.shiftKey&&!b.shiftKey||h.key.altKey&&!b.altKey||h.key.ctrlKey&&!b.ctrlKey||h.key.metaKey&&!b.metaKey||(b._buttonsHandled=!0,d(k).click()));e[f].buttons.length&&c(e[f].buttons)}};c(this.s.buttons)}},_removeKey:function(a){if(a.key){var b=d.isPlainObject(a.key)?a.key.key:a.key;a=this.s.listenKeys.split("");b=d.inArray(b,a);a.splice(b,1);this.s.listenKeys=
+a.join("")}},_resolveExtends:function(a){var b=this.s.dt,c,e=function(c){for(var e=0;!d.isPlainObject(c)&&!d.isArray(c);){if(c===l)return;if("function"===typeof c){if(c=c(b,a),!c)return!1}else if("string"===typeof c){if(!r[c])throw"Unknown button type: "+c;c=r[c]}e++;if(30<e)throw"Buttons: Too many iterations";}return d.isArray(c)?c:d.extend({},c)};for(a=e(a);a&&a.extend;){if(!r[a.extend])throw"Cannot extend unknown button type: "+a.extend;var f=e(r[a.extend]);if(d.isArray(f))return f;if(!f)return!1;
+var g=f.className;a=d.extend({},f,a);g&&a.className!==g&&(a.className=g+" "+a.className);var h=a.postfixButtons;if(h){a.buttons||(a.buttons=[]);g=0;for(c=h.length;g<c;g++)a.buttons.push(h[g]);a.postfixButtons=null}if(h=a.prefixButtons){a.buttons||(a.buttons=[]);g=0;for(c=h.length;g<c;g++)a.buttons.splice(g,0,h[g]);a.prefixButtons=null}a.extend=f.extend}return a}});t.background=function(a,b,c,e){c===l&&(c=400);e||(e=n.body);a?d("<div/>").addClass(b).css("display","none").insertAfter(e).stop().fadeIn(c):
+d("div."+b).stop().fadeOut(c,function(){d(this).removeClass(b).remove()})};t.instanceSelector=function(a,b){if(!a)return d.map(b,function(a){return a.inst});var c=[],e=d.map(b,function(a){return a.name}),f=function(a){if(d.isArray(a))for(var g=0,k=a.length;g<k;g++)f(a[g]);else"string"===typeof a?-1!==a.indexOf(",")?f(a.split(",")):(a=d.inArray(d.trim(a),e),-1!==a&&c.push(b[a].inst)):"number"===typeof a&&c.push(b[a].inst)};f(a);return c};t.buttonSelector=function(a,b){for(var c=[],e=function(a,b,c){for(var d,
+f,g=0,k=b.length;g<k;g++)if(d=b[g])f=c!==l?c+g:g+"",a.push({node:d.node,name:d.conf.name,idx:f}),d.buttons&&e(a,d.buttons,f+"-")},f=function(a,b){var g,h=[];e(h,b.s.buttons);var k=d.map(h,function(a){return a.node});if(d.isArray(a)||a instanceof d)for(k=0,g=a.length;k<g;k++)f(a[k],b);else if(null===a||a===l||"*"===a)for(k=0,g=h.length;k<g;k++)c.push({inst:b,node:h[k].node});else if("number"===typeof a)c.push({inst:b,node:b.s.buttons[a].node});else if("string"===typeof a)if(-1!==a.indexOf(","))for(h=
+a.split(","),k=0,g=h.length;k<g;k++)f(d.trim(h[k]),b);else if(a.match(/^\d+(\-\d+)*$/))k=d.map(h,function(a){return a.idx}),c.push({inst:b,node:h[d.inArray(a,k)].node});else if(-1!==a.indexOf(":name"))for(a=a.replace(":name",""),k=0,g=h.length;k<g;k++)h[k].name===a&&c.push({inst:b,node:h[k].node});else d(k).filter(a).each(function(){c.push({inst:b,node:this})});else"object"===typeof a&&a.nodeName&&(h=d.inArray(a,k),-1!==h&&c.push({inst:b,node:k[h]}))},g=0,h=a.length;g<h;g++)f(b,a[g]);return c};t.defaults=
+{buttons:["copy","excel","csv","pdf","print"],name:"main",tabIndex:0,dom:{container:{tag:"div",className:"dt-buttons"},collection:{tag:"div",className:"dt-button-collection"},button:{tag:"ActiveXObject"in q?"a":"button",className:"dt-button",active:"active",disabled:"disabled"},buttonLiner:{tag:"span",className:""}}};t.version="1.5.6";d.extend(r,{collection:{text:function(a){return a.i18n("buttons.collection","Collection")},className:"buttons-collection",init:function(a,b,c){b.attr("aria-expanded",
+!1)},action:function(a,b,c,e){var f=function(){b.buttons('[aria-haspopup="true"][aria-expanded="true"]').nodes().each(function(){var a=d(this).siblings(".dt-button-collection");a.length&&a.stop().fadeOut(e.fade,function(){a.detach()});d(this).attr("aria-expanded","false")});d("div.dt-button-background").off("click.dtb-collection");t.background(!1,e.backgroundClassName,e.fade,l);d("body").off(".dtb-collection");b.off("buttons-action.b-internal")};a="true"===c.attr("aria-expanded");f();if(!a){var g=
+d(c).parents("div.dt-button-collection");a=c.position();var h=d(b.table().container()),k=!1,l=c;c.attr("aria-expanded","true");g.length&&(k=d(".dt-button-collection").position(),l=g,d("body").trigger("click.dtb-collection"));l.parents("body")[0]!==n.body&&(l=n.body.lastChild);e._collection.find(".dt-button-collection-title").remove();e._collection.prepend('<div class="dt-button-collection-title">'+e.collectionTitle+"</div>");e._collection.addClass(e.collectionLayout).css("display","none").insertAfter(l).stop().fadeIn(e.fade);
+g=e._collection.css("position");if(k&&"absolute"===g)e._collection.css({top:k.top,left:k.left});else if("absolute"===g){e._collection.css({top:a.top+c.outerHeight(),left:a.left});k=h.offset().top+h.height();k=a.top+c.outerHeight()+e._collection.outerHeight()-k;g=a.top-e._collection.outerHeight();var m=h.offset().top;(k>m-g||e.dropup)&&e._collection.css("top",a.top-e._collection.outerHeight()-5);e._collection.hasClass(e.rightAlignClassName)&&e._collection.css("left",a.left+c.outerWidth()-e._collection.outerWidth());
+k=a.left+e._collection.outerWidth();h=h.offset().left+h.width();k>h&&e._collection.css("left",a.left-(k-h));c=c.offset().left+e._collection.outerWidth();c>d(q).width()&&e._collection.css("left",a.left-(c-d(q).width()))}else c=e._collection.height()/2,c>d(q).height()/2&&(c=d(q).height()/2),e._collection.css("marginTop",-1*c);e.background&&t.background(!0,e.backgroundClassName,e.fade,l);setTimeout(function(){d("div.dt-button-background").on("click.dtb-collection",function(){});d("body").on("click.dtb-collection",
+function(a){var b=d.fn.addBack?"addBack":"andSelf";d(a.target).parents()[b]().filter(e._collection).length||f()}).on("keyup.dtb-collection",function(a){27===a.keyCode&&f()});if(e.autoClose)b.on("buttons-action.b-internal",function(){f()})},10)}},background:!0,collectionLayout:"",collectionTitle:"",backgroundClassName:"dt-button-background",rightAlignClassName:"dt-button-right",autoClose:!1,fade:400,attr:{"aria-haspopup":!0}},copy:function(a,b){if(r.copyHtml5)return"copyHtml5";if(r.copyFlash&&r.copyFlash.available(a,
+b))return"copyFlash"},csv:function(a,b){if(r.csvHtml5&&r.csvHtml5.available(a,b))return"csvHtml5";if(r.csvFlash&&r.csvFlash.available(a,b))return"csvFlash"},excel:function(a,b){if(r.excelHtml5&&r.excelHtml5.available(a,b))return"excelHtml5";if(r.excelFlash&&r.excelFlash.available(a,b))return"excelFlash"},pdf:function(a,b){if(r.pdfHtml5&&r.pdfHtml5.available(a,b))return"pdfHtml5";if(r.pdfFlash&&r.pdfFlash.available(a,b))return"pdfFlash"},pageLength:function(a){a=a.settings()[0].aLengthMenu;var b=d.isArray(a[0])?
+a[0]:a,c=d.isArray(a[0])?a[1]:a;return{extend:"collection",text:function(a){return a.i18n("buttons.pageLength",{"-1":"Show all rows",_:"Show %d rows"},a.page.len())},className:"buttons-page-length",autoClose:!0,buttons:d.map(b,function(a,b){return{text:c[b],className:"button-page-length",action:function(b,c){c.page.len(a).draw()},init:function(b,c,d){var e=this;c=function(){e.active(b.page.len()===a)};b.on("length.dt"+d.namespace,c);c()},destroy:function(a,b,c){a.off("length.dt"+c.namespace)}}}),
+init:function(a,b,c){var d=this;a.on("length.dt"+c.namespace,function(){d.text(c.text)})},destroy:function(a,b,c){a.off("length.dt"+c.namespace)}}}});p.Api.register("buttons()",function(a,b){b===l&&(b=a,a=l);this.selector.buttonGroup=a;var c=this.iterator(!0,"table",function(c){if(c._buttons)return t.buttonSelector(t.instanceSelector(a,c._buttons),b)},!0);c._groupSelector=a;return c});p.Api.register("button()",function(a,b){a=this.buttons(a,b);1<a.length&&a.splice(1,a.length);return a});p.Api.registerPlural("buttons().active()",
+"button().active()",function(a){return a===l?this.map(function(a){return a.inst.active(a.node)}):this.each(function(b){b.inst.active(b.node,a)})});p.Api.registerPlural("buttons().action()","button().action()",function(a){return a===l?this.map(function(a){return a.inst.action(a.node)}):this.each(function(b){b.inst.action(b.node,a)})});p.Api.register(["buttons().enable()","button().enable()"],function(a){return this.each(function(b){b.inst.enable(b.node,a)})});p.Api.register(["buttons().disable()",
+"button().disable()"],function(){return this.each(function(a){a.inst.disable(a.node)})});p.Api.registerPlural("buttons().nodes()","button().node()",function(){var a=d();d(this.each(function(b){a=a.add(b.inst.node(b.node))}));return a});p.Api.registerPlural("buttons().processing()","button().processing()",function(a){return a===l?this.map(function(a){return a.inst.processing(a.node)}):this.each(function(b){b.inst.processing(b.node,a)})});p.Api.registerPlural("buttons().text()","button().text()",function(a){return a===
+l?this.map(function(a){return a.inst.text(a.node)}):this.each(function(b){b.inst.text(b.node,a)})});p.Api.registerPlural("buttons().trigger()","button().trigger()",function(){return this.each(function(a){a.inst.node(a.node).trigger("click")})});p.Api.registerPlural("buttons().containers()","buttons().container()",function(){var a=d(),b=this._groupSelector;this.iterator(!0,"table",function(c){if(c._buttons){c=t.instanceSelector(b,c._buttons);for(var d=0,f=c.length;d<f;d++)a=a.add(c[d].container())}});
+return a});p.Api.register("button().add()",function(a,b){var c=this.context;c.length&&(c=t.instanceSelector(this._groupSelector,c[0]._buttons),c.length&&c[0].add(b,a));return this.button(this._groupSelector,a)});p.Api.register("buttons().destroy()",function(){this.pluck("inst").unique().each(function(a){a.destroy()});return this});p.Api.registerPlural("buttons().remove()","buttons().remove()",function(){this.each(function(a){a.inst.remove(a.node)});return this});var w;p.Api.register("buttons.info()",
+function(a,b,c){var e=this;if(!1===a)return d("#datatables_buttons_info").fadeOut(function(){d(this).remove()}),clearTimeout(w),w=null,this;w&&clearTimeout(w);d("#datatables_buttons_info").length&&d("#datatables_buttons_info").remove();a=a?"<h2>"+a+"</h2>":"";d('<div id="datatables_buttons_info" class="dt-button-info"/>').html(a).append(d("<div/>")["string"===typeof b?"html":"append"](b)).css("display","none").appendTo("body").fadeIn();c!==l&&0!==c&&(w=setTimeout(function(){e.buttons.info(!1)},c));
+return this});p.Api.register("buttons.exportData()",function(a){if(this.context.length)return D(new p.Api(this.context[0]),a)});p.Api.register("buttons.exportInfo()",function(a){a||(a={});var b=a;var c="*"===b.filename&&"*"!==b.title&&b.title!==l&&null!==b.title&&""!==b.title?b.title:b.filename;"function"===typeof c&&(c=c());c===l||null===c?c=null:(-1!==c.indexOf("*")&&(c=d.trim(c.replace("*",d("head > title").text()))),c=c.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""),(b=x(b.extension))||
+(b=""),c+=b);b=x(a.title);b=null===b?null:-1!==b.indexOf("*")?b.replace("*",d("head > title").text()||"Exported data"):b;return{filename:c,title:b,messageTop:z(this,a.message||a.messageTop,"top"),messageBottom:z(this,a.messageBottom,"bottom")}});var x=function(a){return null===a||a===l?null:"function"===typeof a?a():a},z=function(a,b,c){b=x(b);if(null===b)return null;a=d("caption",a.table().container()).eq(0);return"*"===b?a.css("caption-side")!==c?null:a.length?a.text():"":b},A=d("<textarea/>")[0],
+D=function(a,b){var c=d.extend(!0,{},{rows:null,columns:"",modifier:{search:"applied",order:"applied"},orthogonal:"display",stripHtml:!0,stripNewlines:!0,decodeEntities:!0,trim:!0,format:{header:function(a){return e(a)},footer:function(a){return e(a)},body:function(a){return e(a)}},customizeData:null},b),e=function(a){if("string"!==typeof a)return a;a=a.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");a=a.replace(/<!\-\-.*?\-\->/g,"");c.stripHtml&&(a=a.replace(/<[^>]*>/g,""));c.trim&&
+(a=a.replace(/^\s+|\s+$/g,""));c.stripNewlines&&(a=a.replace(/\n/g," "));c.decodeEntities&&(A.innerHTML=a,a=A.value);return a};b=a.columns(c.columns).indexes().map(function(b){var d=a.column(b).header();return c.format.header(d.innerHTML,b,d)}).toArray();var f=a.table().footer()?a.columns(c.columns).indexes().map(function(b){var d=a.column(b).footer();return c.format.footer(d?d.innerHTML:"",b,d)}).toArray():null,g=d.extend({},c.modifier);a.select&&"function"===typeof a.select.info&&g.selected===l&&
+a.rows(c.rows,d.extend({selected:!0},g)).any()&&d.extend(g,{selected:!0});g=a.rows(c.rows,g).indexes().toArray();var h=a.cells(g,c.columns);g=h.render(c.orthogonal).toArray();h=h.nodes().toArray();for(var k=b.length,p=[],m=0,n=0,q=0<k?g.length/k:0;n<q;n++){for(var t=[k],r=0;r<k;r++)t[r]=c.format.body(g[m],n,r,h[m]),m++;p[n]=t}b={header:b,footer:f,body:p};c.customizeData&&c.customizeData(b);return b};d.fn.dataTable.Buttons=t;d.fn.DataTable.Buttons=t;d(n).on("init.dt plugin-init.dt",function(a,b){"dt"===
+a.namespace&&(a=b.oInit.buttons||p.defaults.buttons)&&!b._buttons&&(new t(b,a)).container()});p.ext.feature.push({fnInit:u,cFeature:"B"});p.ext.features&&p.ext.features.register("buttons",u);return t});
diff --git a/pandora_console/include/javascript/datatables.min.js b/pandora_console/include/javascript/datatables.min.js
index ce584c1da6..7587a5921d 100644
--- a/pandora_console/include/javascript/datatables.min.js
+++ b/pandora_console/include/javascript/datatables.min.js
@@ -4,30 +4,12 @@
  *
  * To rebuild or modify this file with the latest versions of the included
  * software please visit:
- *   https://datatables.net/download/#ju-1.12.1/jq-3.3.1/dt-1.10.18
+ *   https://datatables.net/download/#dt/dt-1.10.18
  *
  * Included libraries:
- *   jQuery UI 1.12.1, jQuery 3 3.3.1, DataTables 1.10.18
+ *   DataTables 1.10.18
  */
 
-/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
-!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function ye(){}ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=oe.tokenize=function(e,t){var n,i,o,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=r.preFilter;while(s){n&&!(i=F.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),n=!1,(i=_.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(B," ")}),s=s.slice(n.length));for(a in r.filter)!(i=V[a].exec(s))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)};function ve(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,p=[T,s];if(u){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[b]||(t[b]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===T&&l[1]===s)return p[2]=l[2];if(c[o]=p,p[2]=e(t,n,u))return!0}return!1}}function xe(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Te(e,t,n,r,i,o){return r&&!r[b]&&(r=Te(r)),i&&!i[b]&&(i=Te(i,o)),se(function(o,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=o||be(t||"*",s.nodeType?[s]:s,[]),y=!e||!o&&t?g:we(g,p,e,s,u),v=n?i||(o?e:h||r)?[]:a:y;if(n&&n(y,v,s,u),r){l=we(v,d),r(l,[],s,u),c=l.length;while(c--)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f))}if(o){if(i||e){if(i){l=[],c=v.length;while(c--)(f=v[c])&&l.push(y[c]=f);i(null,v=[],l,u)}c=v.length;while(c--)(f=v[c])&&(l=i?O(o,f):p[c])>-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u<o;u++)if(n=r.relative[e[u].type])p=[me(xe(p),n)];else{if((n=r.filter[e[u].type].apply(null,e[u].matches))[b]){for(i=++u;i<o;i++)if(r.relative[e[i].type])break;return Te(u>1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u<i&&Ce(e.slice(u,i)),i<o&&Ce(e=e.slice(i)),i<o&&ve(e))}p.push(n)}return xe(p)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!D.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s<o.length)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==x(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,I,i),a(o,n,W,i)):(o++,l.call(e,a(o,n,I,i),a(o,n,W,i),a(o,n,I,n.notifyWith))):(r!==I&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},X=/^-ms-/,U=/-([a-z])/g;function V(e,t){return t.toUpperCase()}function G(e){return e.replace(X,"ms-").replace(U,V)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Q(){this.expando=w.expando+Q.uid++}Q.uid=1,Q.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(G):(t=G(t))in r?[t]:t.match(M)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!w.isEmptyObject(t)}};var J=new Q,K=new Q,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}K.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return K.hasData(e)||J.hasData(e)},data:function(e,t,n){return K.access(e,t,n)},removeData:function(e,t){K.remove(e,t)},_data:function(e,t,n){return J.access(e,t,n)},_removeData:function(e,t){J.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=K.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),ne(o,r,i[r]));J.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){K.set(this,e)}):z(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=K.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){K.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=J.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},se=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function ue(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return w.css(e,t,"")},u=s(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+u)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,w.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=J.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",J.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)J.set(e[n],"globalEval",!t||J.get(t[n],"globalEval"))}var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))w.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n<arguments.length;n++)u[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){s=w.event.handlers.call(this,t,l),n=0;while((o=s[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Se()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Se()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&N(this,"input"))return this.click(),!1},_default:function(e){return N(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:ke,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:ke,isPropagationStopped:ke,isImmediatePropagationStopped:ke,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Te.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return De(this,e,t,n,r)},one:function(e,t,n,r){return De(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=ke),this.each(function(){w.event.remove(this,e,n,t)})}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/<script|<style|<link/i,je=/checked\s*(?:[^=]|=\s*.checked.)/i,qe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}K.hasData(e)&&(s=K.access(e),u=w.extend({},s),K.set(t,u))}}function Me(e,t){var n=t.nodeName.toLowerCase();"input"===n&&pe.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,s,u,l,c,f=0,p=e.length,d=p-1,y=t[0],v=g(y);if(v||p>1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f<p;f++)l=i,f!==d&&(l=w.clone(l,!0,!0),u&&w.merge(s,ye(l,"script"))),n.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,w.map(s,Oe),f=0;f<u;f++)l=s[f],he.test(l.type||"")&&!J.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(qe,""),c,l))}return e}function Ie(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ye(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(Ne,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r<i;r++)Me(o[r],a[r]);if(t)if(n)for(o=o||ye(e),a=a||ye(s),r=0,i=o.length;r<i;r++)Pe(o[r],a[r]);else Pe(e,s);return(a=ye(s,"script")).length>0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ye(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),s.apply(r,n.get());return this.pushStack(r)}});var We=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),$e=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Be=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",be.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",s=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",be.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,s,u,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,s=e.style;return(n=n||$e(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&We.test(a)&&Be.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var ze=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Qe(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Ge.length;while(n--)if((e=Ge[n]+t)in Ye)return e}function Je(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Qe(e)||e),t}function Ke(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(u-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(u-=w.css(e,"border"+oe[a]+"Width",!0,i))):(u+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?u+=w.css(e,"border"+oe[a]+"Width",!0,i):s+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ct(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),y=J.get(e,"fxshow");n.queue||(null==(a=w._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,w.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(i=t[r],it.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||w.style(e,r)}if((u=!w.isEmptyObject(t))||!w.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=J.get(e,"display")),"none"===(c=w.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=w.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===w.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in d)u||(y?"hidden"in y&&(g=y.hidden):y=J.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&fe([e],!0),p.done(function(){g||fe([e]),J.remove(e,"fxshow");for(r in d)w.style(e,r,d[r])})),u=lt(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}}function ft(e,t){var n,r,i,o,a;for(n in e)if(r=G(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=w.cssHooks[r])&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function pt(e,t,n){var r,i,o=0,a=pt.prefilters.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=nt||st(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),r<1&&a?n:(a||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{},easing:w.easing._default},n),originalProperties:t,originalOptions:n,startTime:nt||st(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(ft(c,l.opts.specialEasing);o<a;o++)if(r=pt.prefilters[o].call(l,e,c,l.opts))return g(r.stop)&&(w._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r;return w.map(c,lt,l),g(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}w.Animation=w.extend(pt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return ue(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){g(e)?(t=e,e=["*"]):e=e.match(M);for(var n,r=0,i=e.length;r<i;r++)n=e[r],pt.tweeners[n]=pt.tweeners[n]||[],pt.tweeners[n].unshift(t)},prefilters:[ct],prefilter:function(e,t){t?pt.prefilters.unshift(e):pt.prefilters.push(e)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||g(e)&&e,duration:e,easing:n&&t||t&&!g(t)&&t};return w.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in w.fx.speeds?r.duration=w.fx.speeds[r.duration]:r.duration=w.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){g(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=pt(this,w.extend({},e),o);(i||J.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=w.timers,a=J.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&ot.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||w.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=J.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}}),w.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.timers=[],w.fx.tick=function(){var e,t=0,n=w.timers;for(nt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||w.fx.stop(),nt=void 0},w.fx.timer=function(e){w.timers.push(e),w.fx.start()},w.fx.interval=13,w.fx.start=function(){rt||(rt=!0,at())},w.fx.stop=function(){rt=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var dt,ht=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return z(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!N(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),r.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Yt=[],Qt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||w.expando+"_"+Et++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Qt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Qt,"$1"+i):!1!==t.jsonp&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?w(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Yt.push(i)),a&&g(o)&&o(a[0]),a=o=void 0}),"script"}),h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=A.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=xe([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),g(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&w.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?w("<div>").append(w.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length},w.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=w.css(e,"position"),f=w(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=w.css(e,"top"),u=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),g(t)&&(t=t.call(e,n,w.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||be})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return z(this,function(e,r,i){var o;if(y(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=_e(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),We.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return z(this,function(t,n,i){var o;return y(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,s):w.style(t,n,i,s)},t,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=N,w.isFunction=g,w.isWindow=y,w.camelCase=G,w.type=x,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var Jt=e.jQuery,Kt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=Kt),t&&e.jQuery===w&&(e.jQuery=Jt),w},t||(e.jQuery=e.$=w),w});
-
-
-/*! jQuery UI - v1.12.1 - 2016-09-14
-* http://jqueryui.com
-* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
-* Copyright jQuery Foundation and other contributors; Licensed MIT */
-
-(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}function i(t){for(var e,i;t.length&&t[0]!==document;){if(e=t.css("position"),("absolute"===e||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}function s(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.regional.en=t.extend(!0,{},this.regional[""]),this.regional["en-US"]=t.extend(!0,{},this.regional.en),this.dpDiv=n(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function n(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.on("mouseout",i,function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",i,o)}function o(){t.datepicker._isDisabledDatepicker(m.inline?m.dpDiv.parent()[0]:m.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))}function a(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}function r(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.ui=t.ui||{},t.ui.version="1.12.1";var h=0,l=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},h=e.split(".")[0];e=e.split(".")[1];var l=h+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][l.toLowerCase()]=function(e){return!!t.data(e,l)},t[h]=t[h]||{},n=t[h][e],o=t[h][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:h,widgetName:e,widgetFullName:l}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,s,n=l.call(arguments,1),o=0,a=n.length;a>o;o++)for(i in n[o])s=n[o][i],n[o].hasOwnProperty(i)&&void 0!==s&&(e[i]=t.isPlainObject(s)?t.isPlainObject(e[i])?t.widget.extend({},e[i],s):t.widget.extend({},s):s);return e},t.widget.bridge=function(e,i){var s=i.prototype.widgetFullName||e;t.fn[e]=function(n){var o="string"==typeof n,a=l.call(arguments,1),r=this;return o?this.length||"instance"!==n?this.each(function(){var i,o=t.data(this,s);return"instance"===n?(r=o,!1):o?t.isFunction(o[n])&&"_"!==n.charAt(0)?(i=o[n].apply(o,a),i!==o&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+n+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+n+"'")}):r=void 0:(a.length&&(n=t.widget.extend.apply(null,[n].concat(a))),this.each(function(){var e=t.data(this,s);e?(e.option(n||{}),e._init&&e._init()):t.data(this,s,new i(n,this))})),r}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,i){i=t(i||this.defaultElement||this)[0],this.element=t(i),this.uuid=h++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},i!==this&&(t.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===i&&this.destroy()}}),this.document=t(i.style?i.ownerDocument:i.document||i),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType,o=!s&&!n;return{element:i,isWindow:s,isDocument:n,offset:o?t(e).offset():{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.outerWidth(),height:i.outerHeight()}}},t.fn.position=function(n){if(!n||!n.of)return d.apply(this,arguments);n=t.extend({},n);var u,p,f,g,m,_,v=t(n.of),b=t.position.getWithinInfo(n.within),y=t.position.getScrollInfo(b),w=(n.collision||"flip").split(" "),k={};return _=s(v),v[0].preventDefault&&(n.at="left top"),p=_.width,f=_.height,g=_.offset,m=t.extend({},g),t.each(["my","at"],function(){var t,e,i=(n[this]||"").split(" ");1===i.length&&(i=r.test(i[0])?i.concat(["center"]):h.test(i[0])?["center"].concat(i):["center","center"]),i[0]=r.test(i[0])?i[0]:"center",i[1]=h.test(i[1])?i[1]:"center",t=l.exec(i[0]),e=l.exec(i[1]),k[this]=[t?t[0]:0,e?e[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===n.at[0]?m.left+=p:"center"===n.at[0]&&(m.left+=p/2),"bottom"===n.at[1]?m.top+=f:"center"===n.at[1]&&(m.top+=f/2),u=e(k.at,p,f),m.left+=u[0],m.top+=u[1],this.each(function(){var s,r,h=t(this),l=h.outerWidth(),c=h.outerHeight(),d=i(this,"marginLeft"),_=i(this,"marginTop"),x=l+d+i(this,"marginRight")+y.width,C=c+_+i(this,"marginBottom")+y.height,D=t.extend({},m),I=e(k.my,h.outerWidth(),h.outerHeight());"right"===n.my[0]?D.left-=l:"center"===n.my[0]&&(D.left-=l/2),"bottom"===n.my[1]?D.top-=c:"center"===n.my[1]&&(D.top-=c/2),D.left+=I[0],D.top+=I[1],s={marginLeft:d,marginTop:_},t.each(["left","top"],function(e,i){t.ui.position[w[e]]&&t.ui.position[w[e]][i](D,{targetWidth:p,targetHeight:f,elemWidth:l,elemHeight:c,collisionPosition:s,collisionWidth:x,collisionHeight:C,offset:[u[0]+I[0],u[1]+I[1]],my:n.my,at:n.at,within:b,elem:h})}),n.using&&(r=function(t){var e=g.left-D.left,i=e+p-l,s=g.top-D.top,r=s+f-c,u={target:{element:v,left:g.left,top:g.top,width:p,height:f},element:{element:h,left:D.left,top:D.top,width:l,height:c},horizontal:0>i?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-h,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}});var c="ui-effects-",u="ui-effects-style",d="ui-effects-animated",p=t;t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(t,o){var a,r=o.re.exec(i),h=r&&o.parse(r),l=o.space||"rgba";return h?(a=s[l](h),s[c[l].cache]=a[c[l].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=t("<p>")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),l.fn=t.extend(l.prototype,{parse:function(n,a,r,h){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,h],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof l?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=l(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=l(t),n=s._space(),o=c[n],a=0===this.alpha()?l("transparent"):this,r=a[o.cache]||o.to(a._rgba),h=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],l=s[o],c=u[n.type]||{};null!==l&&(null===a?h[o]=l:(c.mod&&(l-a>c.mod/2?a+=c.mod:a-l>c.mod/2&&(a-=c.mod)),h[o]=i((l-a)*e+a,n)))}),this[n](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(e)._rgba;return l(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),h=Math.min(s,n,o),l=r-h,c=r+h,u=.5*c;return e=h===r?0:s===r?60*(n-o)/l+360:n===r?60*(o-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=u?l/c:l/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,h=n.to,c=n.from;l.fn[s]=function(s){if(h&&!this[a]&&(this[a]=h(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=l(c(d)),n[a]=d,n):l(d)},f(o,function(e,i){l.fn[e]||(l.fn[e]=function(n){var o,a=t.type(n),h="alpha"===e?this._hsla?"hsla":"rgba":s,l=this[h](),c=l[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=l(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=l(e.elem,i),e.end=l(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},l.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(p),function(){function e(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function i(e,i){var s,o,a={};for(s in i)o=i[s],e[s]!==o&&(n[s]||(t.fx.step[s]||!isNaN(parseFloat(o)))&&(a[s]=o));return a}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(p.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(n,o,a,r){var h=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",l=h.children?a.find("*").addBack():a;l=l.map(function(){var i=t(this);return{el:i,start:e(this)}}),o=function(){t.each(s,function(t,e){n[e]&&a[e+"Class"](n[e])})},o(),l=l.map(function(){return this.end=e(this.el[0]),this.diff=i(this.start,this.end),this}),a.attr("class",r),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(e){return function(i,s,n,o,a){return"boolean"==typeof s||void 0===s?n?t.effects.animateClass.call(this,s?{add:i}:{remove:i},n,o,a):e.apply(this,arguments):t.effects.animateClass.call(this,{toggle:i},s,n,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function e(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function i(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}function s(t,e){var i=e.outerWidth(),s=e.outerHeight(),n=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,o=n.exec(t)||["",0,i,s,0];return{top:parseFloat(o[1])||0,right:"auto"===o[2]?i:parseFloat(o[2]),bottom:"auto"===o[3]?s:parseFloat(o[3]),left:parseFloat(o[4])||0}}t.expr&&t.expr.filters&&t.expr.filters.animated&&(t.expr.filters.animated=function(e){return function(i){return!!t(i).data(d)||e(i)}}(t.expr.filters.animated)),t.uiBackCompat!==!1&&t.extend(t.effects,{save:function(t,e){for(var i=0,s=e.length;s>i;i++)null!==e[i]&&t.data(c+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;n>s;s++)null!==e[s]&&(i=t.data(c+e[s]),t.css(e[s],i))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).trigger("focus"),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).trigger("focus")),e}}),t.extend(t.effects,{version:"1.12.1",define:function(e,i,s){return s||(s=i,i="effect"),t.effects.effect[e]=s,t.effects.effect[e].mode=i,s},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,n="vertical"!==i?(e||100)/100:1;return{height:t.height()*n,width:t.width()*s,outerHeight:t.outerHeight()*n,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();e>1&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(u,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(u)||"",t.removeData(u)},mode:function(t,e){var i=t.is(":hidden");return"toggle"===e&&(e=i?"show":"hide"),(i?"hide"===e:"show"===e)&&(e="none"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(e){var i,s=e.css("position"),n=e.position();return e.css({marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()),/^(static|relative)/.test(s)&&(s="absolute",i=t("<"+e[0].nodeName+">").insertAfter(e).css({display:/^(inline|ruby)/.test(e.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight"),"float":e.css("float")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).addClass("ui-effects-placeholder"),e.data(c+"placeholder",i)),e.css({position:s,left:n.left,top:n.top}),i},removePlaceholder:function(t){var e=c+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(e){t.effects.restoreStyle(e),t.effects.removePlaceholder(e)},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function i(e){function i(){r.removeData(d),t.effects.cleanUp(r),"hide"===s.mode&&r.hide(),a()}function a(){t.isFunction(h)&&h.call(r[0]),t.isFunction(e)&&e()}var r=t(this);s.mode=c.shift(),t.uiBackCompat===!1||o?"none"===s.mode?(r[l](),a()):n.call(r[0],s,i):(r.is(":hidden")?"hide"===l:"show"===l)?(r[l](),a()):n.call(r[0],s,a)}var s=e.apply(this,arguments),n=t.effects.effect[s.effect],o=n.mode,a=s.queue,r=a||"fx",h=s.complete,l=s.mode,c=[],u=function(e){var i=t(this),s=t.effects.mode(i,l)||o;i.data(d,!0),c.push(s),o&&("show"===s||s===o&&"hide"===s)&&i.show(),o&&"none"===s||t.effects.saveStyle(i),t.isFunction(e)&&e()};return t.fx.off||!n?l?this[l](s.duration,h):this.each(function(){h&&h.call(this)}):a===!1?this.each(u).each(i):this.queue(r,u).queue(r,i)},show:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="show",this.effect.call(this,n)
-}}(t.fn.show),hide:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(t.fn.hide),toggle:function(t){return function(s){if(i(s)||"boolean"==typeof s)return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):s(this.css("clip"),this)},transfer:function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,h=o?a.scrollLeft():0,l=n.offset(),c={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("<div class='ui-effects-transfer'></div>").appendTo("body").addClass(e.className).css({top:u.top-r,left:u.left-h,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),t.isFunction(i)&&i()})}}),t.fx.step.clip=function(e){e.clipInit||(e.start=t(e.elem).cssClip(),"string"==typeof e.end&&(e.end=s(e.end,e.elem)),e.clipInit=!0),t(e.elem).cssClip({top:e.pos*(e.end.top-e.start.top)+e.start.top,right:e.pos*(e.end.right-e.start.right)+e.start.right,bottom:e.pos*(e.end.bottom-e.start.bottom)+e.start.bottom,left:e.pos*(e.end.left-e.start.left)+e.start.left})}}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}();var f=t.effects;t.effects.define("blind","hide",function(e,i){var s={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},n=t(this),o=e.direction||"up",a=n.cssClip(),r={clip:t.extend({},a)},h=t.effects.createPlaceholder(n);r.clip[s[o][0]]=r.clip[s[o][1]],"show"===e.mode&&(n.cssClip(r.clip),h&&h.css(t.effects.clipToBox(r)),r.clip=a),h&&h.animate(t.effects.clipToBox(r),e.duration,e.easing),n.animate(r,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("bounce",function(e,i){var s,n,o,a=t(this),r=e.mode,h="hide"===r,l="show"===r,c=e.direction||"up",u=e.distance,d=e.times||5,p=2*d+(l||h?1:0),f=e.duration/p,g=e.easing,m="up"===c||"down"===c?"top":"left",_="up"===c||"left"===c,v=0,b=a.queue().length;for(t.effects.createPlaceholder(a),o=a.css(m),u||(u=a["top"===m?"outerHeight":"outerWidth"]()/3),l&&(n={opacity:1},n[m]=o,a.css("opacity",0).css(m,_?2*-u:2*u).animate(n,f,g)),h&&(u/=Math.pow(2,d-1)),n={},n[m]=o;d>v;v++)s={},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g).animate(n,f,g),u=h?2*u:u/2;h&&(s={opacity:0},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g)),a.queue(i),t.effects.unshift(a,b,p+1)}),t.effects.define("clip","hide",function(e,i){var s,n={},o=t(this),a=e.direction||"vertical",r="both"===a,h=r||"horizontal"===a,l=r||"vertical"===a;s=o.cssClip(),n.clip={top:l?(s.bottom-s.top)/2:s.top,right:h?(s.right-s.left)/2:s.right,bottom:l?(s.bottom-s.top)/2:s.bottom,left:h?(s.right-s.left)/2:s.left},t.effects.createPlaceholder(o),"show"===e.mode&&(o.cssClip(n.clip),n.clip=s),o.animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("drop","hide",function(e,i){var s,n=t(this),o=e.mode,a="show"===o,r=e.direction||"left",h="up"===r||"down"===r?"top":"left",l="up"===r||"left"===r?"-=":"+=",c="+="===l?"-=":"+=",u={opacity:0};t.effects.createPlaceholder(n),s=e.distance||n["top"===h?"outerHeight":"outerWidth"](!0)/2,u[h]=l+s,a&&(n.css(u),u[h]=c+s,u.opacity=1),n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("explode","hide",function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),i()}var o,a,r,h,l,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=e.mode,g="show"===f,m=p.show().css("visibility","hidden").offset(),_=Math.ceil(p.outerWidth()/d),v=Math.ceil(p.outerHeight()/u),b=[];for(o=0;u>o;o++)for(h=m.top+o*v,c=o-(u-1)/2,a=0;d>a;a++)r=m.left+a*_,l=a-(d-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-a*_,top:-o*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:_,height:v,left:r+(g?l*_:0),top:h+(g?c*v:0),opacity:g?0:1}).animate({left:r+(g?0:l*_),top:h+(g?0:c*v),opacity:g?1:0},e.duration||500,e.easing,s)}),t.effects.define("fade","toggle",function(e,i){var s="show"===e.mode;t(this).css("opacity",s?0:1).animate({opacity:s?1:0},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("fold","hide",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=e.size||15,h=/([0-9]+)%/.exec(r),l=!!e.horizFirst,c=l?["right","bottom"]:["bottom","right"],u=e.duration/2,d=t.effects.createPlaceholder(s),p=s.cssClip(),f={clip:t.extend({},p)},g={clip:t.extend({},p)},m=[p[c[0]],p[c[1]]],_=s.queue().length;h&&(r=parseInt(h[1],10)/100*m[a?0:1]),f.clip[c[0]]=r,g.clip[c[0]]=r,g.clip[c[1]]=0,o&&(s.cssClip(g.clip),d&&d.css(t.effects.clipToBox(g)),g.clip=p),s.queue(function(i){d&&d.animate(t.effects.clipToBox(f),u,e.easing).animate(t.effects.clipToBox(g),u,e.easing),i()}).animate(f,u,e.easing).animate(g,u,e.easing).queue(i),t.effects.unshift(s,_,4)}),t.effects.define("highlight","show",function(e,i){var s=t(this),n={backgroundColor:s.css("backgroundColor")};"hide"===e.mode&&(n.opacity=0),t.effects.saveStyle(s),s.css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("size",function(e,i){var s,n,o,a=t(this),r=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],l=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=e.mode,u="effect"!==c,d=e.scale||"both",p=e.origin||["middle","center"],f=a.css("position"),g=a.position(),m=t.effects.scaledDimensions(a),_=e.from||m,v=e.to||t.effects.scaledDimensions(a,0);t.effects.createPlaceholder(a),"show"===c&&(o=_,_=v,v=o),n={from:{y:_.height/m.height,x:_.width/m.width},to:{y:v.height/m.height,x:v.width/m.width}},("box"===d||"both"===d)&&(n.from.y!==n.to.y&&(_=t.effects.setTransition(a,h,n.from.y,_),v=t.effects.setTransition(a,h,n.to.y,v)),n.from.x!==n.to.x&&(_=t.effects.setTransition(a,l,n.from.x,_),v=t.effects.setTransition(a,l,n.to.x,v))),("content"===d||"both"===d)&&n.from.y!==n.to.y&&(_=t.effects.setTransition(a,r,n.from.y,_),v=t.effects.setTransition(a,r,n.to.y,v)),p&&(s=t.effects.getBaseline(p,m),_.top=(m.outerHeight-_.outerHeight)*s.y+g.top,_.left=(m.outerWidth-_.outerWidth)*s.x+g.left,v.top=(m.outerHeight-v.outerHeight)*s.y+g.top,v.left=(m.outerWidth-v.outerWidth)*s.x+g.left),a.css(_),("content"===d||"both"===d)&&(h=h.concat(["marginTop","marginBottom"]).concat(r),l=l.concat(["marginLeft","marginRight"]),a.find("*[width]").each(function(){var i=t(this),s=t.effects.scaledDimensions(i),o={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x},a={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x};n.from.y!==n.to.y&&(o=t.effects.setTransition(i,h,n.from.y,o),a=t.effects.setTransition(i,h,n.to.y,a)),n.from.x!==n.to.x&&(o=t.effects.setTransition(i,l,n.from.x,o),a=t.effects.setTransition(i,l,n.to.x,a)),u&&t.effects.saveStyle(i),i.css(o),i.animate(a,e.duration,e.easing,function(){u&&t.effects.restoreStyle(i)})})),a.animate(v,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){var e=a.offset();0===v.opacity&&a.css("opacity",_.opacity),u||(a.css("position","static"===f?"relative":f).offset(e),t.effects.saveStyle(a)),i()}})}),t.effects.define("scale",function(e,i){var s=t(this),n=e.mode,o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"effect"!==n?0:100),a=t.extend(!0,{from:t.effects.scaledDimensions(s),to:t.effects.scaledDimensions(s,o,e.direction||"both"),origin:e.origin||["middle","center"]},e);e.fade&&(a.from.opacity=1,a.to.opacity=0),t.effects.effect.size.call(this,a,i)}),t.effects.define("puff","hide",function(e,i){var s=t.extend(!0,{},e,{fade:!0,percent:parseInt(e.percent,10)||150});t.effects.effect.scale.call(this,s,i)}),t.effects.define("pulsate","show",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=o||a,h=2*(e.times||5)+(r?1:0),l=e.duration/h,c=0,u=1,d=s.queue().length;for((o||!s.is(":visible"))&&(s.css("opacity",0).show(),c=1);h>u;u++)s.animate({opacity:c},l,e.easing),c=1-c;s.animate({opacity:c},l,e.easing),s.queue(i),t.effects.unshift(s,d,h+1)}),t.effects.define("shake",function(e,i){var s=1,n=t(this),o=e.direction||"left",a=e.distance||20,r=e.times||3,h=2*r+1,l=Math.round(e.duration/h),c="up"===o||"down"===o?"top":"left",u="up"===o||"left"===o,d={},p={},f={},g=n.queue().length;for(t.effects.createPlaceholder(n),d[c]=(u?"-=":"+=")+a,p[c]=(u?"+=":"-=")+2*a,f[c]=(u?"-=":"+=")+2*a,n.animate(d,l,e.easing);r>s;s++)n.animate(p,l,e.easing).animate(f,l,e.easing);n.animate(p,l,e.easing).animate(d,l/2,e.easing).queue(i),t.effects.unshift(n,g,h+1)}),t.effects.define("slide","show",function(e,i){var s,n,o=t(this),a={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},r=e.mode,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h,u=e.distance||o["top"===l?"outerHeight":"outerWidth"](!0),d={};t.effects.createPlaceholder(o),s=o.cssClip(),n=o.position()[l],d[l]=(c?-1:1)*u+n,d.clip=o.cssClip(),d.clip[a[h][1]]=d.clip[a[h][0]],"show"===r&&(o.cssClip(d.clip),o.css(l,d[l]),d.clip=s,d[l]=n),o.animate(d,{queue:!1,duration:e.duration,easing:e.easing,complete:i})});var f;t.uiBackCompat!==!1&&(f=t.effects.define("transfer",function(e,i){t(this).transfer(e,i)})),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e,i,s=this.options.icons;s&&(e=t("<span>"),this._addClass(e,"ui-accordion-header-icon","ui-icon "+s.header),e.prependTo(this.headers),i=this.active.children(".ui-accordion-header-icon"),this._removeClass(i,s.header)._addClass(i,null,s.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),void 0)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),t(o).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=t(this),i=e.uniqueId().attr("id"),s=e.next(),n=s.uniqueId().attr("id");e.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(e=n.height(),this.element.siblings(":visible").each(function(){var i=t(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(e-=i.outerHeight(!0))}),this.headers.each(function(){e-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===s&&(e=0,this.headers.next().each(function(){var i=t(this).is(":visible");i||t(this).show(),e=Math.max(e,t(this).css("height","").height()),i||t(this).hide()}).height(e))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i,s,n=this.options,o=this.active,a=t(e.currentTarget),r=a[0]===o[0],h=r&&n.collapsible,l=h?t():a.next(),c=o.next(),u={oldHeader:o,oldPanel:c,newHeader:h?t():a,newPanel:l};e.preventDefault(),r&&!n.collapsible||this._trigger("beforeActivate",e,u)===!1||(n.active=h?!1:this.headers.index(a),this.active=r?t():a,this._toggle(u),this._removeClass(o,"ui-accordion-header-active","ui-state-active"),n.icons&&(i=o.children(".ui-accordion-header-icon"),this._removeClass(i,null,n.icons.activeHeader)._addClass(i,null,n.icons.header)),r||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),n.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,n.icons.header)._addClass(s,null,n.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(t(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,e,i){var s,n,o,a=this,r=0,h=t.css("box-sizing"),l=t.length&&(!e.length||t.index()<e.index()),c=this.options.animate||{},u=l&&c.down||c,d=function(){a._toggleComplete(i)};return"number"==typeof u&&(o=u),"string"==typeof u&&(n=u),n=n||u.easing||c.easing,o=o||u.duration||c.duration,e.length?t.length?(s=t.show().outerHeight(),e.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),t.hide().animate(this.showProps,{duration:o,easing:n,complete:d,step:function(t,i){i.now=Math.round(t),"height"!==i.prop?"content-box"===h&&(r+=i.now):"content"!==a.options.heightStyle&&(i.now=Math.round(s-e.outerHeight()-r),r=0)}}),void 0):e.animate(this.hideProps,o,n,d):t.animate(this.showProps,o,n,d)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.widget("ui.menu",{version:"1.12.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,h=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=h.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("<span>").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=h.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)},_filterMenuItems:function(e){var i=e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(t.trim(t(this).children(".ui-menu-item-wrapper").text()))})}}),t.widget("ui.autocomplete",{version:"1.12.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;
-this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return t.proxy(function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")},this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({},e,{label:e.label||e.value,value:e.value||e.label})})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<div>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("<div>").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete;var g=/ui-corner-([a-z]){2,6}/g;t.widget("ui.controlgroup",{version:"1.12.1",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var e=this,i=[];t.each(this.options.items,function(s,n){var o,a={};return n?"controlgroupLabel"===s?(o=e.element.find(n),o.each(function(){var e=t(this);e.children(".ui-controlgroup-label-contents").length||e.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),e._addClass(o,null,"ui-widget ui-widget-content ui-state-default"),i=i.concat(o.get()),void 0):(t.fn[s]&&(a=e["_"+s+"Options"]?e["_"+s+"Options"]("middle"):{classes:{}},e.element.find(n).each(function(){var n=t(this),o=n[s]("instance"),r=t.widget.extend({},a);if("button"!==s||!n.parent(".ui-spinner").length){o||(o=n[s]()[s]("instance")),o&&(r.classes=e._resolveClassesValues(r.classes,o)),n[s](r);var h=n[s]("widget");t.data(h[0],"ui-controlgroup-data",o?o:n[s]("instance")),i.push(h[0])}})),void 0):void 0}),this.childWidgets=t(t.unique(i)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var i=t(this),s=i.data("ui-controlgroup-data");s&&s[e]&&s[e]()})},_updateCornerClass:function(t,e){var i="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all",s=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,i),this._addClass(t,null,s)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){var e=this._buildSimpleOptions(t,"ui-spinner");return e.classes["ui-spinner-up"]="",e.classes["ui-spinner-down"]="",e},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e?"auto":!1,classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(e,i){var s={};return t.each(e,function(n){var o=i.options.classes[n]||"";o=t.trim(o.replace(g,"")),s[n]=(o+" "+e[n]).replace(/\s+/g," ")}),s},_setOption:function(t,e){return"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"===t?(this._callChildMethod(e?"disable":"enable"),void 0):(this.refresh(),void 0)},refresh:function(){var e,i=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),e=this.childWidgets,this.options.onlyVisible&&(e=e.filter(":visible")),e.length&&(t.each(["first","last"],function(t,s){var n=e[s]().data("ui-controlgroup-data");if(n&&i["_"+n.widgetName+"Options"]){var o=i["_"+n.widgetName+"Options"](1===e.length?"only":s);o.classes=i._resolveClassesValues(o.classes,n),n.element[n.widgetName](o)}else i._updateCornerClass(e[s](),s)}),this._callChildMethod("refresh"))}}),t.widget("ui.checkboxradio",[t.ui.formResetMixin,{version:"1.12.1",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var e,i,s=this,n=this._super()||{};return this._readType(),i=this.element.labels(),this.label=t(i[i.length-1]),this.label.length||t.error("No label found for checkboxradio widget"),this.originalLabel="",this.label.contents().not(this.element[0]).each(function(){s.originalLabel+=3===this.nodeType?t(this).text():this.outerHTML}),this.originalLabel&&(n.label=this.originalLabel),e=this.element[0].disabled,null!=e&&(n.disabled=e),n},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&(this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this.icon&&this._addClass(this.icon,null,"ui-state-hover")),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var e=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===e&&/radio|checkbox/.test(this.type)||t.error("Can't create checkboxradio on element.nodeName="+e+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var e,i=this.element[0].name,s="input[name='"+t.ui.escapeSelector(i)+"']";return i?(e=this.form.length?t(this.form[0].elements).filter(s):t(s).filter(function(){return 0===t(this).form().length}),e.not(this.element)):t([])},_toggleClasses:function(){var e=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",e)._toggleClass(this.icon,null,"ui-icon-blank",!e),"radio"===this.type&&this._getRadioGroup().each(function(){var e=t(this).checkboxradio("instance");e&&e._removeClass(e.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){return"label"!==t||e?(this._super(t,e),"disabled"===t?(this._toggleClass(this.label,null,"ui-state-disabled",e),this.element[0].disabled=e,void 0):(this.refresh(),void 0)):void 0},_updateIcon:function(e){var i="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=t("<span>"),this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(i+=e?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,e?"ui-icon-blank":"ui-icon-check")):i+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",i),e||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),this.iconSpace&&(t=t.not(this.iconSpace[0])),t.remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]),t.ui.checkboxradio,t.widget("ui.button",{version:"1.12.1",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),t=this.element[0].disabled,null!=t&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(e){e.keyCode===t.ui.keyCode.SPACE&&(e.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(e,i){var s="iconPosition"!==e,n=s?this.options.iconPosition:i,o="top"===n||"bottom"===n;this.icon?s&&this._removeClass(this.icon,null,this.options.icon):(this.icon=t("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),s&&this._addClass(this.icon,null,i),this._attachIcon(n),o?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(n))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=void 0===t.showLabel?this.options.showLabel:t.showLabel,i=void 0===t.icon?this.options.icon:t.icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),this.element[0].disabled=e,e&&this.element.blur())},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),t.uiBackCompat!==!1&&(t.widget("ui.button",t.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,e){return"text"===t?(this._super("showLabel",e),void 0):("showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments),void 0)}}),t.fn.button=function(e){return function(){return!this.length||this.length&&"INPUT"!==this[0].tagName||this.length&&"INPUT"===this[0].tagName&&"checkbox"!==this.attr("type")&&"radio"!==this.attr("type")?e.apply(this,arguments):(t.ui.checkboxradio||t.error("Checkboxradio widget missing"),0===arguments.length?this.checkboxradio({icon:!1}):this.checkboxradio.apply(this,arguments))}}(t.fn.button),t.fn.buttonset=function(){return t.ui.controlgroup||t.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))}),t.ui.button,t.extend(t.ui,{datepicker:{version:"1.12.1"}});var m;t.extend(s.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return a(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),o=this._newInst(t(e),n),o.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){var s=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?n(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(i),t.data(e,"datepicker",i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t("<span class='"+this._appendClass+"'>"+a+"</span>"),e[r?"before":"after"](i.append)),e.off("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.on("focus",this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):t("<button type='button'></button>").addClass(this._triggerClass).html(o?t("<img/>").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.on("click",function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,n,o){var r,h,l,c,u,d=this._dialogInst;return d||(this.uuid+=1,r="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+r+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),t("body").append(this._dialogInput),d=this._dialogInst=this._newInst(this._dialogInput,!1),d.settings={},t.data(this._dialogInput[0],"datepicker",d)),a(d.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(d,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,c=document.documentElement.scrollLeft||document.body.scrollLeft,u=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+c,l/2-150+u]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),d.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],"datepicker",d),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,"datepicker");s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),m===n&&(m=null))},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,i,s){var n,o,r,h,l=this._getInst(e);return 2===arguments.length&&"string"==typeof i?"defaults"===i?t.extend({},t.datepicker._defaults):l?"all"===i?t.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),o=this._getDateDatepicker(e,!0),r=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),a(l.settings,n),null!==r&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,r)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(e):this._enableDatepicker(e)),this._attachments(t(e),l),this._autoSize(l),this._setDate(l,o),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var i,s,n=t.datepicker._getInst(e.target);return t.datepicker._get(n,"constrainInput")?(i=t.datepicker._possibleChars(t.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),e.ctrlKey||e.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var s,n,o,r,h,l,c;s=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==s&&(t.datepicker._curInst.dpDiv.stop(!0,!0),s&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),n=t.datepicker._get(s,"beforeShow"),o=n?n.apply(e,[e,s]):{},o!==!1&&(a(s.settings,o),s.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(s),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),r=!1,t(e).parents().each(function(){return r|="fixed"===t(this).css("position"),!r}),h={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,s.dpDiv.empty(),s.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(s),h=t.datepicker._checkOffset(s,h,r),s.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":r?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),s.inline||(l=t.datepicker._get(s,"showAnim"),c=t.datepicker._get(s,"duration"),s.dpDiv.css("z-index",i(t(e))+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[l]?s.dpDiv.show(l,t.datepicker._get(s,"showOptions"),c):s.dpDiv[l||"show"](l?c:null),t.datepicker._shouldFocusInput(s)&&s.input.trigger("focus"),t.datepicker._curInst=s))
-}},_updateDatepicker:function(e){this.maxRows=4,m=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var i,s=this._getNumberOfMonths(e),n=s[1],a=17,r=e.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.trigger("focus"),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+o>l&&l>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,a=this._curInst;!a||e&&a!==t.data(e,"datepicker")||this._datepickerShowing&&(i=this._get(a,"showAnim"),s=this._get(a,"duration"),n=function(){t.datepicker._tidyDialog(a)},t.effects&&(t.effects.effect[i]||t.effects[i])?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),s,n):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(a,"onClose"),o&&o.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).val(n))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(e,i,s){if(null==e||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,o,a,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),u=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,d=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,m=-1,_=-1,v=-1,b=!1,y=function(t){var i=e.length>n+1&&e.charAt(n+1)===t;return i&&n++,i},w=function(t){var e=y(t),s="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n="y"===t?s:1,o=RegExp("^\\d{"+n+","+s+"}"),a=i.substring(h).match(o);if(!a)throw"Missing number at position "+h;return h+=a[0].length,parseInt(a[0],10)},k=function(e,s,n){var o=-1,a=t.map(y(e)?n:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,e){var s=e[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(o=e[0],h+=s.length,!1):void 0}),-1!==o)return o+1;throw"Unknown name at position "+h},x=function(){if(i.charAt(h)!==e.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;e.length>n;n++)if(b)"'"!==e.charAt(n)||y("'")?x():b=!1;else switch(e.charAt(n)){case"d":_=w("d");break;case"D":k("D",u,d);break;case"o":v=w("o");break;case"m":m=w("m");break;case"M":m=k("M",p,f);break;case"y":g=w("y");break;case"@":r=new Date(w("@")),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"!":r=new Date((w("!")-this._ticksTo1970)/1e4),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"'":y("'")?x():b=!0;break;default:x()}if(i.length>h&&(a=i.substr(h),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c>=g?0:-100)),v>-1)for(m=1,_=v;;){if(o=this._getDaysInMonth(g,m-1),o>=_)break;m++,_-=o}if(r=this._daylightSavingAdjust(new Date(g,m-1,_)),r.getFullYear()!==g||r.getMonth()+1!==m||r.getDate()!==_)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||h("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=l("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=l("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=h("y")?e.getFullYear():(10>e.getFullYear()%100?"0":"")+e.getFullYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":a+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}l=h.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).on(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,h,l,c,u,d,p,f,g,m,_,v,b,y,w,k,x,C,D,I,T,P,M,S,H,z,O,A,N,W,E,F,L,R=new Date,B=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),Y=this._get(t,"isRTL"),j=this._get(t,"showButtonPanel"),q=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),V=this._get(t,"showCurrentAtPos"),$=this._get(t,"stepMonths"),X=1!==U[0]||1!==U[1],G=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),Q=this._getMinMaxDate(t,"min"),J=this._getMinMaxDate(t,"max"),Z=t.drawMonth-V,te=t.drawYear;if(0>Z&&(Z+=12,te--),J)for(e=this._daylightSavingAdjust(new Date(J.getFullYear(),J.getMonth()-U[0]*U[1]+1,J.getDate())),e=Q&&Q>e?Q:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-$,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":q?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+$,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":q?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?G:B,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,h=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",l=j?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(t,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+a+"</button>":"")+(Y?"":h)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),_=this._get(t,"showOtherMonths"),v=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;U[0]>k;k++){for(x="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),I=" ui-corner-all",T="",X){if(T+="<div class='ui-datepicker-group",U[1]>1)switch(C){case 0:T+=" ui-datepicker-group-first",I=" ui-corner-"+(Y?"right":"left");break;case U[1]-1:T+=" ui-datepicker-group-last",I=" ui-corner-"+(Y?"left":"right");break;default:T+=" ui-datepicker-group-middle",I=""}T+="'>"}for(T+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+I+"'>"+(/all|left/.test(I)&&0===k?Y?o:s:"")+(/all|right/.test(I)&&0===k?Y?s:o:"")+this._generateMonthYearHeader(t,Z,te,Q,J,k>0||C>0,f,g)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",P=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)M=(w+c)%7,P+="<th scope='col'"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[M]+"'>"+p[M]+"</span></th>";for(T+=P+"</tr></thead><tbody>",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),H=(this._getFirstDayOfMonth(te,Z)-c+7)%7,z=Math.ceil((H+S)/7),O=X?this.maxRows>z?this.maxRows:z:z,this.maxRows=O,A=this._daylightSavingAdjust(new Date(te,Z,1-H)),N=0;O>N;N++){for(T+="<tr>",W=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(A)+"</td>":"",w=0;7>w;w++)E=m?m.apply(t.input?t.input[0]:null,[A]):[!0,""],F=A.getMonth()!==Z,L=F&&!v||!E[0]||Q&&Q>A||J&&A>J,W+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(A.getTime()===D.getTime()&&Z===t.selectedMonth&&t._keyEvent||b.getTime()===A.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!_?"":" "+E[1]+(A.getTime()===G.getTime()?" "+this._currentClass:"")+(A.getTime()===B.getTime()?" ui-datepicker-today":""))+"'"+(F&&!_||!E[2]?"":" title='"+E[2].replace(/'/g,"&#39;")+"'")+(L?"":" data-handler='selectDay' data-event='click' data-month='"+A.getMonth()+"' data-year='"+A.getFullYear()+"'")+">"+(F&&!_?"&#xa0;":L?"<span class='ui-state-default'>"+A.getDate()+"</span>":"<a class='ui-state-default"+(A.getTime()===B.getTime()?" ui-state-highlight":"")+(A.getTime()===G.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+A.getDate()+"</a>")+"</td>",A.setDate(A.getDate()+1),A=this._daylightSavingAdjust(A);T+=W+"</tr>"}Z++,Z>11&&(Z=0,te++),T+="</tbody></table>"+(X?"</div>"+(U[0]>0&&C===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=T}y+=x}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var h,l,c,u,d,p,f,g,m=this._get(t,"changeMonth"),_=this._get(t,"changeYear"),v=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(o||!m)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!h||c>=s.getMonth())&&(!l||n.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(v||(b+=y+(!o&&m&&_?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",o||!_)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";g>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),v&&(b+=(!o&&m&&_?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,h=this._get(t,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).on("mousedown",t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new s,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.12.1",t.datepicker,t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var _=!1;t(document).on("mouseup",function(){_=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!_){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),_=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,_=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blurActiveElement(e),this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("<div>").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}
-},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),h=t.pageX,l=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,h=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(h=this.originalPageX),"x"===a.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY<n.scrollSensitivity?a.scrollTop=o=a.scrollTop+n.scrollSpeed:e.pageY-s.overflowOffset.top<n.scrollSensitivity&&(a.scrollTop=o=a.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+a.offsetWidth-e.pageX<n.scrollSensitivity?a.scrollLeft=o=a.scrollLeft+n.scrollSpeed:e.pageX-s.overflowOffset.left<n.scrollSensitivity&&(a.scrollLeft=o=a.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(e.pageY-t(r).scrollTop()<n.scrollSensitivity?o=t(r).scrollTop(t(r).scrollTop()-n.scrollSpeed):t(window).height()-(e.pageY-t(r).scrollTop())<n.scrollSensitivity&&(o=t(r).scrollTop(t(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(e.pageX-t(r).scrollLeft()<n.scrollSensitivity?o=t(r).scrollLeft(t(r).scrollLeft()-n.scrollSpeed):t(window).width()-(e.pageX-t(r).scrollLeft())<n.scrollSensitivity&&(o=t(r).scrollLeft(t(r).scrollLeft()+n.scrollSpeed)))),o!==!1&&t.ui.ddmanager&&!n.dropBehaviour&&t.ui.ddmanager.prepareOffsets(s,e)}}),t.ui.plugin.add("draggable","snap",{start:function(e,i,s){var n=s.options;s.snapElements=[],t(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var e=t(this),i=e.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:i.top,left:i.left})})},drag:function(e,i,s){var n,o,a,r,h,l,c,u,d,p,f=s.options,g=f.snapTolerance,m=i.offset.left,_=m+s.helperProportions.width,v=i.offset.top,b=v+s.helperProportions.height;for(d=s.snapElements.length-1;d>=0;d--)h=s.snapElements[d].left-s.margins.left,l=h+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,h-g>_||m>l+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(h-_),r=g>=Math.abs(l-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(h-m),r=g>=Math.abs(l-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("<div>"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,n=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<div style='overflow:hidden;'></div>"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),g&&(p-=l),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.dialog",{version:"1.12.1",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(e){var i=t(this).css(e).offset().top;0>i&&t(this).css("top",e.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&t.fn.draggable&&this._makeDraggable(),this.options.resizable&&t.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var e=this.options.appendTo;return e&&(e.jquery||e.nodeType)?t(e):this.document.find(e||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),t=e.parent.children().eq(e.index),t.length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog
-},disable:t.noop,enable:t.noop,close:function(e){var i=this;this._isOpen&&this._trigger("beforeClose",e)!==!1&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||t.ui.safeBlur(t.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",e)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+t(this).css("z-index")}).get(),o=Math.max.apply(null,n);return o>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",o+1),s=!0),s&&!i&&this._trigger("focus",e),s},open:function(){var e=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=t(t.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){e._focusTabbable(),e._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var t=this._focusedElement;t||(t=this.element.find("[autofocus]")),t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).trigger("focus")},_keepFocus:function(e){function i(){var e=t.ui.safeActiveElement(this.document[0]),i=this.uiDialog[0]===e||t.contains(this.uiDialog[0],e);i||this._focusTabbable()}e.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=t("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(e){if(this.options.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===t.ui.keyCode.ESCAPE)return e.preventDefault(),this.close(e),void 0;if(e.keyCode===t.ui.keyCode.TAB&&!e.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");e.target!==n[0]&&e.target!==this.uiDialog[0]||e.shiftKey?e.target!==s[0]&&e.target!==this.uiDialog[0]||!e.shiftKey||(this._delay(function(){n.trigger("focus")}),e.preventDefault()):(this._delay(function(){s.trigger("focus")}),e.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var e;this.uiDialogTitlebar=t("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(e){t(e.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=t("<button type='button'></button>").button({label:t("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),e=t("<span>").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(e,"ui-dialog-title"),this._title(e),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":e.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html("&#160;")},_createButtonPane:function(){this.uiDialogButtonPane=t("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=t("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var e=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),t.isEmptyObject(i)||t.isArray(i)&&!i.length?(this._removeClass(this.uiDialog,"ui-dialog-buttons"),void 0):(t.each(i,function(i,s){var n,o;s=t.isFunction(s)?{click:s,text:i}:s,s=t.extend({type:"button"},s),n=s.click,o={icon:s.icon,iconPosition:s.iconPosition,showLabel:s.showLabel,icons:s.icons,text:s.text},delete s.click,delete s.icon,delete s.iconPosition,delete s.showLabel,delete s.icons,"boolean"==typeof s.text&&delete s.text,t("<button></button>",s).button(o).appendTo(e.uiButtonSet).on("click",function(){n.apply(e.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function e(t){return{position:t.position,offset:t.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){i._addClass(t(this),"ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,e(n))},drag:function(t,s){i._trigger("drag",t,e(s))},stop:function(n,o){var a=o.offset.left-i.document.scrollLeft(),r=o.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(a>=0?"+":"")+a+" "+"top"+(r>=0?"+":"")+r,of:i.window},i._removeClass(t(this),"ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,e(o))}})},_makeResizable:function(){function e(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}var i=this,s=this.options,n=s.resizable,o=this.uiDialog.css("position"),a="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:a,start:function(s,n){i._addClass(t(this),"ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,e(n))},resize:function(t,s){i._trigger("resize",t,e(s))},stop:function(n,o){var a=i.uiDialog.offset(),r=a.left-i.document.scrollLeft(),h=a.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},i._removeClass(t(this),"ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,e(o))}}).css("position",o)},_trackFocus:function(){this._on(this.widget(),{focusin:function(e){this._makeFocusTarget(),this._focusedElement=t(e.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var e=this._trackingInstances(),i=t.inArray(this,e);-1!==i&&e.splice(i,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||(t=[],this.document.data("ui-dialog-instances",t)),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(e){var i=this,s=!1,n={};t.each(e,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,i){var s,n,o=this.uiDialog;"disabled"!==e&&(this._super(e,i),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:t("<a>").text(""+this.options.closeText).html()}),"draggable"===e&&(s=o.is(":data(ui-draggable)"),s&&!i&&o.draggable("destroy"),!s&&i&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(n=o.is(":data(ui-resizable)"),n&&!i&&o.resizable("destroy"),n&&"string"==typeof i&&o.resizable("option","handles",i),n||i===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var e=t(this);return t("<div>").css({position:"absolute",width:e.outerWidth(),height:e.outerHeight()}).appendTo(e.parent()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(e){return t(e.target).closest(".ui-dialog").length?!0:!!t(e.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=!0;this._delay(function(){e=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(t){e||this._allowInteraction(t)||(t.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=t("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var t=this.document.data("ui-dialog-overlays")-1;t?this.document.data("ui-dialog-overlays",t):(this._off(this.document,"focusin"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null}}}),t.uiBackCompat!==!1&&t.widget("ui.dialog",t.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}}),t.ui.dialog,t.widget("ui.droppable",{version:"1.12.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(s)?s:function(t){return t.is(s)},this.proportions=function(){return arguments.length?(e=arguments[0],void 0):e?e:e={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this._addClass("ui-droppable")},_addToManager:function(e){t.ui.ddmanager.droppables[e]=t.ui.ddmanager.droppables[e]||[],t.ui.ddmanager.droppables[e].push(this)},_splice:function(t){for(var e=0;t.length>e;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var e=t.ui.ddmanager.droppables[this.options.scope];this._splice(e)},_setOption:function(e,i){if("accept"===e)this.accept=t.isFunction(i)?i:function(t){return t.is(i)};else if("scope"===e){var s=t.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(e,i)},_activate:function(e){var i=t.ui.ddmanager.current;this._addActiveClass(),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this._removeActiveClass(),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._addHoverClass(),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeHoverClass(),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=t(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&v(s,t.extend(i,{offset:i.element.offset()}),i.options.tolerance,e)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(s)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}});var v=t.ui.intersect=function(){function t(t,e,i){return t>=e&&e+i>t}return function(e,i,s,n){if(!i.offset)return!1;var o=(e.positionAbs||e.position.absolute).left+e.margins.left,a=(e.positionAbs||e.position.absolute).top+e.margins.top,r=o+e.helperProportions.width,h=a+e.helperProportions.height,l=i.offset.left,c=i.offset.top,u=l+i.proportions().width,d=c+i.proportions().height;switch(s){case"fit":return o>=l&&u>=r&&a>=c&&d>=h;case"intersect":return o+e.helperProportions.width/2>l&&u>r-e.helperProportions.width/2&&a+e.helperProportions.height/2>c&&d>h-e.helperProportions.height/2;case"pointer":return t(n.pageY,c,i.proportions().height)&&t(n.pageX,l,i.proportions().width);case"touch":return(a>=c&&d>=a||h>=c&&d>=h||c>a&&h>d)&&(o>=l&&u>=o||r>=l&&u>=r||l>o&&r>u);default:return!1}}}();t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],a=i?i.type:null,r=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;o.length>s;s++)if(!(o[s].options.disabled||e&&!o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;r.length>n;n++)if(r[n]===o[s].element[0]){o[s].proportions().height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===a&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions({width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight}))}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&v(e,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").on("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,o,a=v(e,this,this.options.tolerance,i),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return t(this).droppable("instance").options.scope===n}),o.length&&(s=t(o[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").off("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}},t.uiBackCompat!==!1&&t.widget("ui.droppable",t.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}}),t.ui.droppable,t.widget("ui.progressbar",{version:"1.12.1",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=t("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){return void 0===t?this.options.value:(this.options.value=this._constrainedValue(t),this._refreshValue(),void 0)},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=t===!1,"number"!=typeof t&&(t=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).width(i.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,e===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}}),t.widget("ui.selectable",t.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e.elementPos=t(e.element[0]).offset(),e.selectees=t(e.options.filter,e.element[0]),e._addClass(e.selectees,"ui-selectee"),e.selectees.each(function(){var i=t(this),s=i.offset(),n={left:s.left-e.elementPos.left,top:s.top-e.elementPos.top};t.data(this,"selectable-item",{element:this,$element:i,left:n.left,top:n.top,right:n.left+i.outerWidth(),bottom:n.top+i.outerHeight(),startselected:!1,selected:i.hasClass("ui-selected"),selecting:i.hasClass("ui-selecting"),unselecting:i.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=t("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.elementPos=t(this.element[0]).offset(),this.options.disabled||(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(i._removeClass(s.$element,"ui-selected"),s.selected=!1,i._addClass(s.$element,"ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");return n?(s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),i._removeClass(n.$element,s?"ui-unselecting":"ui-selected")._addClass(n.$element,s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=e.pageX,h=e.pageY;return o>r&&(i=r,r=o,o=i),a>h&&(i=h,h=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:h-a}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),l=!1,c={};i&&i.element!==s.element[0]&&(c.left=i.left+s.elementPos.left,c.right=i.right+s.elementPos.left,c.top=i.top+s.elementPos.top,c.bottom=i.bottom+s.elementPos.top,"touch"===n.tolerance?l=!(c.left>r||o>c.right||c.top>h||a>c.bottom):"fit"===n.tolerance&&(l=c.left>o&&r>c.right&&c.top>a&&h>c.bottom),l?(i.selected&&(s._removeClass(i.$element,"ui-selected"),i.selected=!1),i.unselecting&&(s._removeClass(i.$element,"ui-unselecting"),i.unselecting=!1),i.selecting||(s._addClass(i.$element,"ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,s._addClass(i.$element,"ui-selected"),i.selected=!0):(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,i.startselected&&(s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(s._removeClass(i.$element,"ui-selected"),i.selected=!1,s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-selecting")._addClass(s.$element,"ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),t.widget("ui.selectmenu",[t.ui.formResetMixin,{version:"1.12.1",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=t()},_drawButton:function(){var e,i=this,s=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.focus(),t.preventDefault()}}),this.element.hide(),this.button=t("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),e=t("<span>").appendTo(this.button),this._addClass(e,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(s).appendTo(this.button),this.options.width!==!1&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){i._rendered||i._refreshMenu()})},_drawMenu:function(){var e=this;this.menu=t("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=t("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,i){t.preventDefault(),e._setSelection(),e._select(i.item.data("ui-selectmenu-item"),t)},focus:function(t,i){var s=i.item.data("ui-selectmenu-item");null!=e.focusIndex&&s.index!==e.focusIndex&&(e._trigger("focus",t,{item:s}),e.isOpen||e._select(s,t)),e.focusIndex=s.index,e.button.attr("aria-activedescendant",e.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t,e=this.element.find("option");this.menu.empty(),this._parseOptions(e),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,e.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t)))},_position:function(){this.menuWrap.position(t.extend({of:this.button},this.options.position))},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(e){var i=t("<span>");return this._setText(i,e.label),this._addClass(i,"ui-selectmenu-text"),i},_renderMenu:function(e,i){var s=this,n="";t.each(i,function(i,o){var a;o.optgroup!==n&&(a=t("<li>",{text:o.optgroup}),s._addClass(a,"ui-selectmenu-optgroup","ui-menu-divider"+(o.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),a.appendTo(e),n=o.optgroup),s._renderItemData(e,o)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(e,i){var s=t("<li>"),n=t("<div>",{title:i.element.attr("title")});return i.disabled&&this._addClass(s,null,"ui-state-disabled"),this._setText(n,i.label),s.append(n).appendTo(e)},_setText:function(t,e){e?t.text(e):t.html("&#160;")},_move:function(t,e){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),n+=":not(.ui-state-disabled)"),s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](n).eq(-1):i[t+"All"](n).eq(0),s.length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&(window.getSelection?(t=window.getSelection(),t.removeAllRanges(),t.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(e){this.isOpen&&(t(e.target).closest(".ui-selectmenu-menu, #"+t.ui.escapeSelector(this.ids.button)).length||this.close(e))}},_buttonEvents:{mousedown:function(){var t;window.getSelection?(t=window.getSelection(),t.rangeCount&&(this.range=t.getRangeAt(0))):this.range=document.selection.createRange()},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(e){var i=!0;switch(e.keyCode){case t.ui.keyCode.TAB:case t.ui.keyCode.ESCAPE:this.close(e),i=!1;break;case t.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(e);break;case t.ui.keyCode.UP:e.altKey?this._toggle(e):this._move("prev",e);break;case t.ui.keyCode.DOWN:e.altKey?this._toggle(e):this._move("next",e);break;case t.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(e):this._toggle(e);break;case t.ui.keyCode.LEFT:this._move("prev",e);break;case t.ui.keyCode.RIGHT:this._move("next",e);break;case t.ui.keyCode.HOME:case t.ui.keyCode.PAGE_UP:this._move("first",e);break;case t.ui.keyCode.END:case t.ui.keyCode.PAGE_DOWN:this._move("last",e);break;default:this.menu.trigger(e),i=!1}i&&e.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){var e=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":e,"aria-activedescendant":e}),this.menu.attr("aria-activedescendant",e)},_setOption:function(t,e){if("icons"===t){var i=this.button.find("span.ui-icon");this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)}this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;return t===!1?(this.button.css("width",""),void 0):(null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t),void 0)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(e){var i=this,s=[];e.each(function(e,n){s.push(i._parseOption(t(n),e))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),t.widget("ui.slider",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1
-},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle"),o="<span tabindex='0'></span>",a=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)a.push(o);this.handles=n.add(t(a.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=t("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),("min"===e.range||"max"===e.range)&&this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,o,a,r,h,l,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-c.values(e));(n>i||n===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(n=i,o=t(this),a=e)}),r=this._start(e,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,this._addClass(o,null,"ui-state-active"),o.trigger("focus"),h=o.offset(),l=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:e.pageX-h.left-o.width()/2,top:e.pageY-h.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n,o=this.value(),a=this.values();this._hasMultipleValues()&&(n=this.values(e?0:1),o=this.values(e),2===this.options.values.length&&this.options.range===!0&&(i=0===e?Math.min(n,i):Math.max(n,i)),a[e]=i),i!==o&&(s=this._trigger("slide",t,this._uiHash(e,i,a)),s!==!1&&(this._hasMultipleValues()?this.values(e,i):this.value(i)))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(e,i){var s,n,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),void 0;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this._hasMultipleValues()?this._values(e):this.value();for(s=this.options.values,n=arguments[0],o=0;s.length>o;o+=1)s[o]=this._trimAlignValue(n[o]),this._change(null,o);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),this._super(e,i),e){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(i),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=n-1;s>=0;s--)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this._hasMultipleValues()){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step,s=Math.round((t-e)/i)*i;t=s+e,t>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,c={};this._hasMultipleValues()?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),c["horizontal"===h.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[l?"animate":"css"](c,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),o=this._valueMax(),i=o!==n?100*((s-n)/(o-n)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:100-i+"%"},r.animate),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:100-i+"%"},r.animate))},_handleEvents:{keydown:function(e){var i,s,n,o,a=t(e.target).data("ui-slider-handle-index");switch(e.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(e.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(t(e.target),null,"ui-state-active"),i=this._start(e,a),i===!1))return}switch(o=this.options.step,s=n=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case t.ui.keyCode.HOME:n=this._valueMin();break;case t.ui.keyCode.END:n=this._valueMax();break;case t.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-o)}this._slide(e,a,n)},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),this._removeClass(t(e.target),null,"ui-state-active"))}}}),t.widget("ui.sortable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void 0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+a.scrollSpeed:e.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-a.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+a.scrollSpeed:e.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-a.scrollSpeed)):(e.pageY-this.document.scrollTop()<a.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop()-a.scrollSpeed):this.window.height()-(e.pageY-this.document.scrollTop())<a.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop()+a.scrollSpeed)),e.pageX-this.document.scrollLeft()<a.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft()-a.scrollSpeed):this.window.width()-(e.pageX-this.document.scrollLeft())<a.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft()+a.scrollSpeed))),r!==!1&&t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp(new t.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],h=[],l=this._connectWith();if(l&&e)for(s=l.length-1;s>=0;s--)for(o=t(l[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&h.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(h.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",a),c.push({item:h,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("<tr>",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t("<td>&#160;</td>",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,h,l,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[a],l=!1,e[u]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(e[u]-h)&&(n=Math.abs(e[u]-h),o=this.items[s],this.direction=l?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;
-this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}}),t.widget("ui.spinner",{version:"1.12.1",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e=this._super(),i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);null!=n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var e=this.element[0]===t.ui.safeActiveElement(this.document[0]);e||(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===t.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&this.uiSpinner.height()>0&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_start:function(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i,s,n;return"culture"===t||"numberFormat"===t?(i=this._parse(this.element.val()),this.options[t]=e,this.element.val(this._format(i)),void 0):(("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(s=this.buttons.first().find(".ui-icon"),this._removeClass(s,null,this.options.icons.up),this._addClass(s,null,e.up),n=this.buttons.last().find(".ui-icon"),this._removeClass(n,null,this.options.icons.down),this._addClass(n,null,e.down)),this._super(t,e),void 0)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:r(function(t){this._super(t)}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null===t?!1:t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:r(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:r(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:r(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:r(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(r(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),t.uiBackCompat!==!1&&t.widget("ui.spinner",t.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}}),t.ui.spinner,t.widget("ui.tabs",{version:"1.12.1",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var t=/#.*$/;return function(e){var i,s;i=e.href.replace(t,""),s=location.href.replace(t,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return e.hash.length>1&&i===s}}(),_create:function(){var e=this,i=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,i.collapsible),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var e=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===e&&(s&&this.tabs.each(function(i,n){return t(n).attr("aria-controls")===s?(e=i,!1):void 0}),null===e&&(e=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===e||-1===e)&&(e=this.tabs.length?0:!1)),e!==!1&&(e=this.tabs.index(this.tabs.eq(e)),-1===e&&(e=i?!1:0)),!i&&e===!1&&this.anchors.length&&(e=0),e},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(e){var i=t(t.ui.safeActiveElement(this.document[0])).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(e)){switch(e.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:s++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:n=!1,s--;break;case t.ui.keyCode.END:s=this.anchors.length-1;break;case t.ui.keyCode.HOME:s=0;break;case t.ui.keyCode.SPACE:return e.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case t.ui.keyCode.ENTER:return e.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}e.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),e.ctrlKey||e.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(e){return e.altKey&&e.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):e.altKey&&e.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e),void 0)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).attr({role:"presentation",tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=t(),this.anchors.each(function(i,s){var n,o,a,r=t(s).uniqueId().attr("id"),h=t(s).closest("li"),l=h.attr("aria-controls");e._isLocal(s)?(n=s.hash,a=n.substring(1),o=e.element.find(e._sanitizeSelector(n))):(a=h.attr("aria-controls")||t({}).uniqueId()[0].id,n="#"+a,o=e.element.find(n),o.length||(o=e._createPanel(a),o.insertAfter(e.panels[i-1]||e.tablist)),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":a,"aria-labelledby":r}),o.attr("aria-labelledby",r)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(e){return t("<div>").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var i,s,n;for(t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),e===!0||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,e===!0)},_setupEvents:function(e){var i={};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,h=r?t():this._getPanelForTab(o),l=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:l,newTab:r?t():o,newPanel:h};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),l.length||h.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){o._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){o._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n()}):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+t.ui.escapeSelector(e)+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var i=this.options.disabled;i!==!1&&(void 0===e?i=!1:(e=this._getIndex(e),i=t.isArray(i)?t.map(i,function(t){return t!==e?t:null}):t.map(this.tabs,function(t,i){return i!==e?i:null})),this._setOptionDisabled(i))},disable:function(e){var i=this.options.disabled;if(i!==!0){if(void 0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=t.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},h=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete s.xhr};this._isLocal(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,n){setTimeout(function(){a.html(t),s._trigger("load",i,r),h(n,e)},1)}).fail(function(t,e){setTimeout(function(){h(t,e)},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href").replace(/#.*$/,""),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),t.uiBackCompat!==!1&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs,t.widget("ui.tooltip",{version:"1.12.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var e=t(this).attr("title")||"";return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))},_removeDescribedBy:function(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=t("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=t([])},_setOption:function(e,i){var s=this;this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s.element[0],e.close(n,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var e=t(this);return e.is("[title]")?e.data("ui-tooltip-title",e.attr("title")).removeAttr("title"):void 0}))},_enable:function(){this.disabledTitles.each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))}),this.disabledTitles=t([])},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(e,s),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;return"string"==typeof s||s.nodeType||s.jquery?this._open(e,t,s):(i=s.call(t[0],function(i){n._delay(function(){t.data("ui-tooltip-open")&&(e&&(e.type=o),this._open(e,t,i))})}),i&&this._open(e,t,i),void 0)},_open:function(e,i,s){function n(t){l.of=t,a.is(":hidden")||a.position(l)}var o,a,r,h,l=t.extend({},this.options.position);if(s){if(o=this._find(i))return o.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(e&&"mouseover"===e.type?i.attr("title",""):i.removeAttr("title")),o=this._tooltip(i),a=o.tooltip,this._addDescribedBy(i,a.attr("id")),a.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),h=t("<div>").html(a.find(".ui-tooltip-content").html()),h.removeAttr("name").find("[name]").removeAttr("name"),h.removeAttr("id").find("[id]").removeAttr("id"),h.appendTo(this.liveRegion),this.options.track&&e&&/^mouse/.test(e.type)?(this._on(this.document,{mousemove:n}),n(e)):a.position(t.extend({of:i},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){a.is(":visible")&&(n(l.of),clearInterval(r))},t.fx.interval)),this._trigger("open",e,{tooltip:a})}},_registerCloseHandlers:function(e,i){var s={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var s=t.Event(e);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),e&&"mouseover"!==e.type||(s.mouseleave="close"),e&&"focusin"!==e.type||(s.focusout="close"),this._on(!0,i,s)},close:function(e){var i,s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);return o?(i=o.tooltip,o.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),o.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),o.closing=!0,this._trigger("close",e,{tooltip:i}),o.hiding||(o.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(e){var i=t("<div>").attr("role","tooltip"),s=t("<div>").appendTo(i),n=i.uniqueId().attr("id");return this._addClass(s,"ui-tooltip-content"),this._addClass(i,"ui-tooltip","ui-widget ui-widget-content"),i.appendTo(this._appendTo(e)),this.tooltips[n]={element:e,tooltip:i}},_find:function(t){var e=t.data("ui-tooltip-id");return e?this.tooltips[e]:null},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){var e=t.closest(".ui-front, dialog");return e.length||(e=this.document[0].body),e},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur"),o=s.element;n.target=n.currentTarget=o[0],e.close(n,!0),t("#"+i).remove(),o.data("ui-tooltip-title")&&(o.attr("title")||o.attr("title",o.data("ui-tooltip-title")),o.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),t.uiBackCompat!==!1&&t.widget("ui.tooltip",t.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}}),t.ui.tooltip});
-
 /*!
  DataTables 1.10.18
  ©2008-2018 SpryMedia Ltd - datatables.net/license
@@ -178,7 +160,7 @@ Z(n.defaults.column);n.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender
 aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",
 iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:k,oAjaxData:k,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==y(this)?1*this._iRecordsTotal:
 this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==y(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var a=this._iDisplayLength,b=this._iDisplayStart,c=b+a,d=this.aiDisplay.length,e=this.oFeatures,f=e.bPaginate;return e.bServerSide?!1===f||-1===a?b+d:Math.min(b+a,this._iRecordsDisplay):!f||c>d||-1===a?d:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{},rowIdFn:null,rowId:null};n.ext=x={buttons:{},
-classes:{},build:"ju-1.12.1/jq-3.3.1/dt-1.10.18",errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:n.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:n.version};h.extend(x,{afnFiltering:x.search,aTypes:x.type.detect,ofnSearch:x.type.search,oSort:x.type.order,afnSortData:x.order,aoFeatures:x.feature,oApi:x.internal,oStdClasses:x.classes,oPagination:x.pager});
+classes:{},build:"dt/dt-1.10.18",errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:n.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:n.version};h.extend(x,{afnFiltering:x.search,aTypes:x.type.detect,ofnSearch:x.type.search,oSort:x.type.order,afnSortData:x.order,aoFeatures:x.feature,oApi:x.internal,oStdClasses:x.classes,oPagination:x.pager});
 h.extend(n.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",
 sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",
 sJUIHeader:"",sJUIFooter:""});var Kb=n.ext.pager;h.extend(Kb,{simple:function(){return["previous","next"]},full:function(){return["first","previous","next","last"]},numbers:function(a,b){return[ia(a,b)]},simple_numbers:function(a,b){return["previous",ia(a,b),"next"]},full_numbers:function(a,b){return["first","previous",ia(a,b),"next","last"]},first_last_numbers:function(a,b){return["first",ia(a,b),"last"]},_numbers:ia,numbers_length:7});h.extend(!0,n.ext.renderer,{pageButton:{_:function(a,b,c,d,e,
@@ -196,14 +178,3 @@ _fnSortFlatten:X,_fnSort:mb,_fnSortAria:Ib,_fnSortListener:Va,_fnSortAttachListe
 h.each(n,function(a,b){h.fn.DataTable[a]=b});return h.fn.dataTable});
 
 
-/*!
- DataTables jQuery UI integration
- ©2011-2014 SpryMedia Ltd - datatables.net/license
-*/
-(function(a){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(b){return a(b,window,document)}):"object"===typeof exports?module.exports=function(b,d){b||(b=window);if(!d||!d.fn.dataTable)d=require("datatables.net")(b,d).$;return a(d,b,b.document)}:a(jQuery,window,document)})(function(a){var b=a.fn.dataTable;a.extend(!0,b.defaults,{dom:'<"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-tl ui-corner-tr"lfr>t<"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-bl ui-corner-br"ip>',
-renderer:"jqueryui"});a.extend(b.ext.classes,{sWrapper:"dataTables_wrapper dt-jqueryui",sPageButton:"fg-button ui-button ui-state-default",sPageButtonActive:"ui-state-disabled",sPageButtonDisabled:"ui-state-disabled",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sSortAsc:"ui-state-default sorting_asc",sSortDesc:"ui-state-default sorting_desc",sSortable:"ui-state-default sorting",sSortableAsc:"ui-state-default sorting_asc_disabled",sSortableDesc:"ui-state-default sorting_desc_disabled",
-sSortableNone:"ui-state-default sorting_disabled",sSortIcon:"DataTables_sort_icon",sScrollHead:"dataTables_scrollHead ui-state-default",sScrollFoot:"dataTables_scrollFoot ui-state-default",sHeaderTH:"ui-state-default",sFooterTH:"ui-state-default"});b.ext.renderer.header.jqueryui=function(b,h,e,c){var f="css_right ui-icon ui-icon-caret-2-n-s",g=-1!==a.inArray("asc",e.asSorting),i=-1!==a.inArray("desc",e.asSorting);!e.bSortable||!g&&!i?f="":g&&!i?f="css_right ui-icon ui-icon-caret-1-n":!g&&i&&(f="css_right ui-icon ui-icon-caret-1-s");
-a("<div/>").addClass("DataTables_sort_wrapper").append(h.contents()).append(a("<span/>").addClass(c.sSortIcon+" "+f)).appendTo(h);a(b.nTable).on("order.dt",function(a,g,i,j){b===g&&(a=e.idx,h.removeClass(c.sSortAsc+" "+c.sSortDesc).addClass("asc"==j[a]?c.sSortAsc:"desc"==j[a]?c.sSortDesc:e.sSortingClass),h.find("span."+c.sSortIcon).removeClass("css_right ui-icon ui-icon-triangle-1-n css_right ui-icon ui-icon-triangle-1-s css_right ui-icon ui-icon-caret-2-n-s css_right ui-icon ui-icon-caret-1-n css_right ui-icon ui-icon-caret-1-s").addClass("asc"==
-j[a]?"css_right ui-icon ui-icon-triangle-1-n":"desc"==j[a]?"css_right ui-icon ui-icon-triangle-1-s":f))})};b.TableTools&&a.extend(!0,b.TableTools.classes,{container:"DTTT_container ui-buttonset ui-buttonset-multi",buttons:{normal:"DTTT_button ui-button ui-state-default"},collection:{container:"DTTT_collection ui-buttonset ui-buttonset-multi"}});return b});
-
-
diff --git a/pandora_console/include/javascript/fulldatatables.min.js b/pandora_console/include/javascript/fulldatatables.min.js
new file mode 100644
index 0000000000..ce584c1da6
--- /dev/null
+++ b/pandora_console/include/javascript/fulldatatables.min.js
@@ -0,0 +1,209 @@
+/*
+ * This combined file was created by the DataTables downloader builder:
+ *   https://datatables.net/download
+ *
+ * To rebuild or modify this file with the latest versions of the included
+ * software please visit:
+ *   https://datatables.net/download/#ju-1.12.1/jq-3.3.1/dt-1.10.18
+ *
+ * Included libraries:
+ *   jQuery UI 1.12.1, jQuery 3 3.3.1, DataTables 1.10.18
+ */
+
+/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */
+!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function ye(){}ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=oe.tokenize=function(e,t){var n,i,o,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=r.preFilter;while(s){n&&!(i=F.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),n=!1,(i=_.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(B," ")}),s=s.slice(n.length));for(a in r.filter)!(i=V[a].exec(s))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)};function ve(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,p=[T,s];if(u){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[b]||(t[b]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===T&&l[1]===s)return p[2]=l[2];if(c[o]=p,p[2]=e(t,n,u))return!0}return!1}}function xe(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Te(e,t,n,r,i,o){return r&&!r[b]&&(r=Te(r)),i&&!i[b]&&(i=Te(i,o)),se(function(o,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=o||be(t||"*",s.nodeType?[s]:s,[]),y=!e||!o&&t?g:we(g,p,e,s,u),v=n?i||(o?e:h||r)?[]:a:y;if(n&&n(y,v,s,u),r){l=we(v,d),r(l,[],s,u),c=l.length;while(c--)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f))}if(o){if(i||e){if(i){l=[],c=v.length;while(c--)(f=v[c])&&l.push(y[c]=f);i(null,v=[],l,u)}c=v.length;while(c--)(f=v[c])&&(l=i?O(o,f):p[c])>-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u<o;u++)if(n=r.relative[e[u].type])p=[me(xe(p),n)];else{if((n=r.filter[e[u].type].apply(null,e[u].matches))[b]){for(i=++u;i<o;i++)if(r.relative[e[i].type])break;return Te(u>1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u<i&&Ce(e.slice(u,i)),i<o&&Ce(e=e.slice(i)),i<o&&ve(e))}p.push(n)}return xe(p)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!D.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s<o.length)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==x(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,I,i),a(o,n,W,i)):(o++,l.call(e,a(o,n,I,i),a(o,n,W,i),a(o,n,I,n.notifyWith))):(r!==I&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},X=/^-ms-/,U=/-([a-z])/g;function V(e,t){return t.toUpperCase()}function G(e){return e.replace(X,"ms-").replace(U,V)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Q(){this.expando=w.expando+Q.uid++}Q.uid=1,Q.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(G):(t=G(t))in r?[t]:t.match(M)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!w.isEmptyObject(t)}};var J=new Q,K=new Q,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}K.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return K.hasData(e)||J.hasData(e)},data:function(e,t,n){return K.access(e,t,n)},removeData:function(e,t){K.remove(e,t)},_data:function(e,t,n){return J.access(e,t,n)},_removeData:function(e,t){J.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=K.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),ne(o,r,i[r]));J.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){K.set(this,e)}):z(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=K.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){K.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=J.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},se=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function ue(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return w.css(e,t,"")},u=s(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+u)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,w.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=J.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",J.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)J.set(e[n],"globalEval",!t||J.get(t[n],"globalEval"))}var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))w.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n<arguments.length;n++)u[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){s=w.event.handlers.call(this,t,l),n=0;while((o=s[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Se()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Se()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&N(this,"input"))return this.click(),!1},_default:function(e){return N(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:ke,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:ke,isPropagationStopped:ke,isImmediatePropagationStopped:ke,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Te.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return De(this,e,t,n,r)},one:function(e,t,n,r){return De(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=ke),this.each(function(){w.event.remove(this,e,n,t)})}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/<script|<style|<link/i,je=/checked\s*(?:[^=]|=\s*.checked.)/i,qe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}K.hasData(e)&&(s=K.access(e),u=w.extend({},s),K.set(t,u))}}function Me(e,t){var n=t.nodeName.toLowerCase();"input"===n&&pe.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,s,u,l,c,f=0,p=e.length,d=p-1,y=t[0],v=g(y);if(v||p>1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f<p;f++)l=i,f!==d&&(l=w.clone(l,!0,!0),u&&w.merge(s,ye(l,"script"))),n.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,w.map(s,Oe),f=0;f<u;f++)l=s[f],he.test(l.type||"")&&!J.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(qe,""),c,l))}return e}function Ie(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ye(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(Ne,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r<i;r++)Me(o[r],a[r]);if(t)if(n)for(o=o||ye(e),a=a||ye(s),r=0,i=o.length;r<i;r++)Pe(o[r],a[r]);else Pe(e,s);return(a=ye(s,"script")).length>0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ye(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),s.apply(r,n.get());return this.pushStack(r)}});var We=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),$e=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Be=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",be.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",s=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",be.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,s,u,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,s=e.style;return(n=n||$e(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&We.test(a)&&Be.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var ze=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Qe(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Ge.length;while(n--)if((e=Ge[n]+t)in Ye)return e}function Je(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Qe(e)||e),t}function Ke(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(u-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(u-=w.css(e,"border"+oe[a]+"Width",!0,i))):(u+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?u+=w.css(e,"border"+oe[a]+"Width",!0,i):s+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ct(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),y=J.get(e,"fxshow");n.queue||(null==(a=w._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,w.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(i=t[r],it.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||w.style(e,r)}if((u=!w.isEmptyObject(t))||!w.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=J.get(e,"display")),"none"===(c=w.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=w.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===w.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in d)u||(y?"hidden"in y&&(g=y.hidden):y=J.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&fe([e],!0),p.done(function(){g||fe([e]),J.remove(e,"fxshow");for(r in d)w.style(e,r,d[r])})),u=lt(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}}function ft(e,t){var n,r,i,o,a;for(n in e)if(r=G(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=w.cssHooks[r])&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function pt(e,t,n){var r,i,o=0,a=pt.prefilters.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=nt||st(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),r<1&&a?n:(a||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{},easing:w.easing._default},n),originalProperties:t,originalOptions:n,startTime:nt||st(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(ft(c,l.opts.specialEasing);o<a;o++)if(r=pt.prefilters[o].call(l,e,c,l.opts))return g(r.stop)&&(w._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r;return w.map(c,lt,l),g(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}w.Animation=w.extend(pt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return ue(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){g(e)?(t=e,e=["*"]):e=e.match(M);for(var n,r=0,i=e.length;r<i;r++)n=e[r],pt.tweeners[n]=pt.tweeners[n]||[],pt.tweeners[n].unshift(t)},prefilters:[ct],prefilter:function(e,t){t?pt.prefilters.unshift(e):pt.prefilters.push(e)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||g(e)&&e,duration:e,easing:n&&t||t&&!g(t)&&t};return w.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in w.fx.speeds?r.duration=w.fx.speeds[r.duration]:r.duration=w.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){g(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=pt(this,w.extend({},e),o);(i||J.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=w.timers,a=J.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&ot.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||w.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=J.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}}),w.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.timers=[],w.fx.tick=function(){var e,t=0,n=w.timers;for(nt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||w.fx.stop(),nt=void 0},w.fx.timer=function(e){w.timers.push(e),w.fx.start()},w.fx.interval=13,w.fx.start=function(){rt||(rt=!0,at())},w.fx.stop=function(){rt=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var dt,ht=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return z(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!N(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),r.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Yt=[],Qt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||w.expando+"_"+Et++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Qt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Qt,"$1"+i):!1!==t.jsonp&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?w(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Yt.push(i)),a&&g(o)&&o(a[0]),a=o=void 0}),"script"}),h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=A.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=xe([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),g(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&w.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?w("<div>").append(w.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length},w.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=w.css(e,"position"),f=w(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=w.css(e,"top"),u=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),g(t)&&(t=t.call(e,n,w.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||be})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return z(this,function(e,r,i){var o;if(y(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=_e(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),We.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return z(this,function(t,n,i){var o;return y(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,s):w.style(t,n,i,s)},t,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=N,w.isFunction=g,w.isWindow=y,w.camelCase=G,w.type=x,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var Jt=e.jQuery,Kt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=Kt),t&&e.jQuery===w&&(e.jQuery=Jt),w},t||(e.jQuery=e.$=w),w});
+
+
+/*! jQuery UI - v1.12.1 - 2016-09-14
+* http://jqueryui.com
+* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
+* Copyright jQuery Foundation and other contributors; Licensed MIT */
+
+(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}function i(t){for(var e,i;t.length&&t[0]!==document;){if(e=t.css("position"),("absolute"===e||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}function s(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.regional.en=t.extend(!0,{},this.regional[""]),this.regional["en-US"]=t.extend(!0,{},this.regional.en),this.dpDiv=n(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function n(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.on("mouseout",i,function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",i,o)}function o(){t.datepicker._isDisabledDatepicker(m.inline?m.dpDiv.parent()[0]:m.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))}function a(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}function r(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.ui=t.ui||{},t.ui.version="1.12.1";var h=0,l=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},h=e.split(".")[0];e=e.split(".")[1];var l=h+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][l.toLowerCase()]=function(e){return!!t.data(e,l)},t[h]=t[h]||{},n=t[h][e],o=t[h][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:h,widgetName:e,widgetFullName:l}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,s,n=l.call(arguments,1),o=0,a=n.length;a>o;o++)for(i in n[o])s=n[o][i],n[o].hasOwnProperty(i)&&void 0!==s&&(e[i]=t.isPlainObject(s)?t.isPlainObject(e[i])?t.widget.extend({},e[i],s):t.widget.extend({},s):s);return e},t.widget.bridge=function(e,i){var s=i.prototype.widgetFullName||e;t.fn[e]=function(n){var o="string"==typeof n,a=l.call(arguments,1),r=this;return o?this.length||"instance"!==n?this.each(function(){var i,o=t.data(this,s);return"instance"===n?(r=o,!1):o?t.isFunction(o[n])&&"_"!==n.charAt(0)?(i=o[n].apply(o,a),i!==o&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+n+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+n+"'")}):r=void 0:(a.length&&(n=t.widget.extend.apply(null,[n].concat(a))),this.each(function(){var e=t.data(this,s);e?(e.option(n||{}),e._init&&e._init()):t.data(this,s,new i(n,this))})),r}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,i){i=t(i||this.defaultElement||this)[0],this.element=t(i),this.uuid=h++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},i!==this&&(t.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===i&&this.destroy()}}),this.document=t(i.style?i.ownerDocument:i.document||i),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType,o=!s&&!n;return{element:i,isWindow:s,isDocument:n,offset:o?t(e).offset():{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.outerWidth(),height:i.outerHeight()}}},t.fn.position=function(n){if(!n||!n.of)return d.apply(this,arguments);n=t.extend({},n);var u,p,f,g,m,_,v=t(n.of),b=t.position.getWithinInfo(n.within),y=t.position.getScrollInfo(b),w=(n.collision||"flip").split(" "),k={};return _=s(v),v[0].preventDefault&&(n.at="left top"),p=_.width,f=_.height,g=_.offset,m=t.extend({},g),t.each(["my","at"],function(){var t,e,i=(n[this]||"").split(" ");1===i.length&&(i=r.test(i[0])?i.concat(["center"]):h.test(i[0])?["center"].concat(i):["center","center"]),i[0]=r.test(i[0])?i[0]:"center",i[1]=h.test(i[1])?i[1]:"center",t=l.exec(i[0]),e=l.exec(i[1]),k[this]=[t?t[0]:0,e?e[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===n.at[0]?m.left+=p:"center"===n.at[0]&&(m.left+=p/2),"bottom"===n.at[1]?m.top+=f:"center"===n.at[1]&&(m.top+=f/2),u=e(k.at,p,f),m.left+=u[0],m.top+=u[1],this.each(function(){var s,r,h=t(this),l=h.outerWidth(),c=h.outerHeight(),d=i(this,"marginLeft"),_=i(this,"marginTop"),x=l+d+i(this,"marginRight")+y.width,C=c+_+i(this,"marginBottom")+y.height,D=t.extend({},m),I=e(k.my,h.outerWidth(),h.outerHeight());"right"===n.my[0]?D.left-=l:"center"===n.my[0]&&(D.left-=l/2),"bottom"===n.my[1]?D.top-=c:"center"===n.my[1]&&(D.top-=c/2),D.left+=I[0],D.top+=I[1],s={marginLeft:d,marginTop:_},t.each(["left","top"],function(e,i){t.ui.position[w[e]]&&t.ui.position[w[e]][i](D,{targetWidth:p,targetHeight:f,elemWidth:l,elemHeight:c,collisionPosition:s,collisionWidth:x,collisionHeight:C,offset:[u[0]+I[0],u[1]+I[1]],my:n.my,at:n.at,within:b,elem:h})}),n.using&&(r=function(t){var e=g.left-D.left,i=e+p-l,s=g.top-D.top,r=s+f-c,u={target:{element:v,left:g.left,top:g.top,width:p,height:f},element:{element:h,left:D.left,top:D.top,width:l,height:c},horizontal:0>i?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-h,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}});var c="ui-effects-",u="ui-effects-style",d="ui-effects-animated",p=t;t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(t,o){var a,r=o.re.exec(i),h=r&&o.parse(r),l=o.space||"rgba";return h?(a=s[l](h),s[c[l].cache]=a[c[l].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=t("<p>")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),l.fn=t.extend(l.prototype,{parse:function(n,a,r,h){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,h],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof l?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=l(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=l(t),n=s._space(),o=c[n],a=0===this.alpha()?l("transparent"):this,r=a[o.cache]||o.to(a._rgba),h=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],l=s[o],c=u[n.type]||{};null!==l&&(null===a?h[o]=l:(c.mod&&(l-a>c.mod/2?a+=c.mod:a-l>c.mod/2&&(a-=c.mod)),h[o]=i((l-a)*e+a,n)))}),this[n](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(e)._rgba;return l(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),h=Math.min(s,n,o),l=r-h,c=r+h,u=.5*c;return e=h===r?0:s===r?60*(n-o)/l+360:n===r?60*(o-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=u?l/c:l/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,h=n.to,c=n.from;l.fn[s]=function(s){if(h&&!this[a]&&(this[a]=h(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=l(c(d)),n[a]=d,n):l(d)},f(o,function(e,i){l.fn[e]||(l.fn[e]=function(n){var o,a=t.type(n),h="alpha"===e?this._hsla?"hsla":"rgba":s,l=this[h](),c=l[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=l(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=l(e.elem,i),e.end=l(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},l.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(p),function(){function e(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function i(e,i){var s,o,a={};for(s in i)o=i[s],e[s]!==o&&(n[s]||(t.fx.step[s]||!isNaN(parseFloat(o)))&&(a[s]=o));return a}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(p.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(n,o,a,r){var h=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",l=h.children?a.find("*").addBack():a;l=l.map(function(){var i=t(this);return{el:i,start:e(this)}}),o=function(){t.each(s,function(t,e){n[e]&&a[e+"Class"](n[e])})},o(),l=l.map(function(){return this.end=e(this.el[0]),this.diff=i(this.start,this.end),this}),a.attr("class",r),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(e){return function(i,s,n,o,a){return"boolean"==typeof s||void 0===s?n?t.effects.animateClass.call(this,s?{add:i}:{remove:i},n,o,a):e.apply(this,arguments):t.effects.animateClass.call(this,{toggle:i},s,n,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function e(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function i(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}function s(t,e){var i=e.outerWidth(),s=e.outerHeight(),n=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,o=n.exec(t)||["",0,i,s,0];return{top:parseFloat(o[1])||0,right:"auto"===o[2]?i:parseFloat(o[2]),bottom:"auto"===o[3]?s:parseFloat(o[3]),left:parseFloat(o[4])||0}}t.expr&&t.expr.filters&&t.expr.filters.animated&&(t.expr.filters.animated=function(e){return function(i){return!!t(i).data(d)||e(i)}}(t.expr.filters.animated)),t.uiBackCompat!==!1&&t.extend(t.effects,{save:function(t,e){for(var i=0,s=e.length;s>i;i++)null!==e[i]&&t.data(c+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;n>s;s++)null!==e[s]&&(i=t.data(c+e[s]),t.css(e[s],i))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).trigger("focus"),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).trigger("focus")),e}}),t.extend(t.effects,{version:"1.12.1",define:function(e,i,s){return s||(s=i,i="effect"),t.effects.effect[e]=s,t.effects.effect[e].mode=i,s},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,n="vertical"!==i?(e||100)/100:1;return{height:t.height()*n,width:t.width()*s,outerHeight:t.outerHeight()*n,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();e>1&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(u,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(u)||"",t.removeData(u)},mode:function(t,e){var i=t.is(":hidden");return"toggle"===e&&(e=i?"show":"hide"),(i?"hide"===e:"show"===e)&&(e="none"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(e){var i,s=e.css("position"),n=e.position();return e.css({marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()),/^(static|relative)/.test(s)&&(s="absolute",i=t("<"+e[0].nodeName+">").insertAfter(e).css({display:/^(inline|ruby)/.test(e.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight"),"float":e.css("float")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).addClass("ui-effects-placeholder"),e.data(c+"placeholder",i)),e.css({position:s,left:n.left,top:n.top}),i},removePlaceholder:function(t){var e=c+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(e){t.effects.restoreStyle(e),t.effects.removePlaceholder(e)},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function i(e){function i(){r.removeData(d),t.effects.cleanUp(r),"hide"===s.mode&&r.hide(),a()}function a(){t.isFunction(h)&&h.call(r[0]),t.isFunction(e)&&e()}var r=t(this);s.mode=c.shift(),t.uiBackCompat===!1||o?"none"===s.mode?(r[l](),a()):n.call(r[0],s,i):(r.is(":hidden")?"hide"===l:"show"===l)?(r[l](),a()):n.call(r[0],s,a)}var s=e.apply(this,arguments),n=t.effects.effect[s.effect],o=n.mode,a=s.queue,r=a||"fx",h=s.complete,l=s.mode,c=[],u=function(e){var i=t(this),s=t.effects.mode(i,l)||o;i.data(d,!0),c.push(s),o&&("show"===s||s===o&&"hide"===s)&&i.show(),o&&"none"===s||t.effects.saveStyle(i),t.isFunction(e)&&e()};return t.fx.off||!n?l?this[l](s.duration,h):this.each(function(){h&&h.call(this)}):a===!1?this.each(u).each(i):this.queue(r,u).queue(r,i)},show:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="show",this.effect.call(this,n)
+}}(t.fn.show),hide:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(t.fn.hide),toggle:function(t){return function(s){if(i(s)||"boolean"==typeof s)return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):s(this.css("clip"),this)},transfer:function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,h=o?a.scrollLeft():0,l=n.offset(),c={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("<div class='ui-effects-transfer'></div>").appendTo("body").addClass(e.className).css({top:u.top-r,left:u.left-h,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),t.isFunction(i)&&i()})}}),t.fx.step.clip=function(e){e.clipInit||(e.start=t(e.elem).cssClip(),"string"==typeof e.end&&(e.end=s(e.end,e.elem)),e.clipInit=!0),t(e.elem).cssClip({top:e.pos*(e.end.top-e.start.top)+e.start.top,right:e.pos*(e.end.right-e.start.right)+e.start.right,bottom:e.pos*(e.end.bottom-e.start.bottom)+e.start.bottom,left:e.pos*(e.end.left-e.start.left)+e.start.left})}}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}();var f=t.effects;t.effects.define("blind","hide",function(e,i){var s={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},n=t(this),o=e.direction||"up",a=n.cssClip(),r={clip:t.extend({},a)},h=t.effects.createPlaceholder(n);r.clip[s[o][0]]=r.clip[s[o][1]],"show"===e.mode&&(n.cssClip(r.clip),h&&h.css(t.effects.clipToBox(r)),r.clip=a),h&&h.animate(t.effects.clipToBox(r),e.duration,e.easing),n.animate(r,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("bounce",function(e,i){var s,n,o,a=t(this),r=e.mode,h="hide"===r,l="show"===r,c=e.direction||"up",u=e.distance,d=e.times||5,p=2*d+(l||h?1:0),f=e.duration/p,g=e.easing,m="up"===c||"down"===c?"top":"left",_="up"===c||"left"===c,v=0,b=a.queue().length;for(t.effects.createPlaceholder(a),o=a.css(m),u||(u=a["top"===m?"outerHeight":"outerWidth"]()/3),l&&(n={opacity:1},n[m]=o,a.css("opacity",0).css(m,_?2*-u:2*u).animate(n,f,g)),h&&(u/=Math.pow(2,d-1)),n={},n[m]=o;d>v;v++)s={},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g).animate(n,f,g),u=h?2*u:u/2;h&&(s={opacity:0},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g)),a.queue(i),t.effects.unshift(a,b,p+1)}),t.effects.define("clip","hide",function(e,i){var s,n={},o=t(this),a=e.direction||"vertical",r="both"===a,h=r||"horizontal"===a,l=r||"vertical"===a;s=o.cssClip(),n.clip={top:l?(s.bottom-s.top)/2:s.top,right:h?(s.right-s.left)/2:s.right,bottom:l?(s.bottom-s.top)/2:s.bottom,left:h?(s.right-s.left)/2:s.left},t.effects.createPlaceholder(o),"show"===e.mode&&(o.cssClip(n.clip),n.clip=s),o.animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("drop","hide",function(e,i){var s,n=t(this),o=e.mode,a="show"===o,r=e.direction||"left",h="up"===r||"down"===r?"top":"left",l="up"===r||"left"===r?"-=":"+=",c="+="===l?"-=":"+=",u={opacity:0};t.effects.createPlaceholder(n),s=e.distance||n["top"===h?"outerHeight":"outerWidth"](!0)/2,u[h]=l+s,a&&(n.css(u),u[h]=c+s,u.opacity=1),n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("explode","hide",function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),i()}var o,a,r,h,l,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=e.mode,g="show"===f,m=p.show().css("visibility","hidden").offset(),_=Math.ceil(p.outerWidth()/d),v=Math.ceil(p.outerHeight()/u),b=[];for(o=0;u>o;o++)for(h=m.top+o*v,c=o-(u-1)/2,a=0;d>a;a++)r=m.left+a*_,l=a-(d-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-a*_,top:-o*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:_,height:v,left:r+(g?l*_:0),top:h+(g?c*v:0),opacity:g?0:1}).animate({left:r+(g?0:l*_),top:h+(g?0:c*v),opacity:g?1:0},e.duration||500,e.easing,s)}),t.effects.define("fade","toggle",function(e,i){var s="show"===e.mode;t(this).css("opacity",s?0:1).animate({opacity:s?1:0},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("fold","hide",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=e.size||15,h=/([0-9]+)%/.exec(r),l=!!e.horizFirst,c=l?["right","bottom"]:["bottom","right"],u=e.duration/2,d=t.effects.createPlaceholder(s),p=s.cssClip(),f={clip:t.extend({},p)},g={clip:t.extend({},p)},m=[p[c[0]],p[c[1]]],_=s.queue().length;h&&(r=parseInt(h[1],10)/100*m[a?0:1]),f.clip[c[0]]=r,g.clip[c[0]]=r,g.clip[c[1]]=0,o&&(s.cssClip(g.clip),d&&d.css(t.effects.clipToBox(g)),g.clip=p),s.queue(function(i){d&&d.animate(t.effects.clipToBox(f),u,e.easing).animate(t.effects.clipToBox(g),u,e.easing),i()}).animate(f,u,e.easing).animate(g,u,e.easing).queue(i),t.effects.unshift(s,_,4)}),t.effects.define("highlight","show",function(e,i){var s=t(this),n={backgroundColor:s.css("backgroundColor")};"hide"===e.mode&&(n.opacity=0),t.effects.saveStyle(s),s.css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("size",function(e,i){var s,n,o,a=t(this),r=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],l=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=e.mode,u="effect"!==c,d=e.scale||"both",p=e.origin||["middle","center"],f=a.css("position"),g=a.position(),m=t.effects.scaledDimensions(a),_=e.from||m,v=e.to||t.effects.scaledDimensions(a,0);t.effects.createPlaceholder(a),"show"===c&&(o=_,_=v,v=o),n={from:{y:_.height/m.height,x:_.width/m.width},to:{y:v.height/m.height,x:v.width/m.width}},("box"===d||"both"===d)&&(n.from.y!==n.to.y&&(_=t.effects.setTransition(a,h,n.from.y,_),v=t.effects.setTransition(a,h,n.to.y,v)),n.from.x!==n.to.x&&(_=t.effects.setTransition(a,l,n.from.x,_),v=t.effects.setTransition(a,l,n.to.x,v))),("content"===d||"both"===d)&&n.from.y!==n.to.y&&(_=t.effects.setTransition(a,r,n.from.y,_),v=t.effects.setTransition(a,r,n.to.y,v)),p&&(s=t.effects.getBaseline(p,m),_.top=(m.outerHeight-_.outerHeight)*s.y+g.top,_.left=(m.outerWidth-_.outerWidth)*s.x+g.left,v.top=(m.outerHeight-v.outerHeight)*s.y+g.top,v.left=(m.outerWidth-v.outerWidth)*s.x+g.left),a.css(_),("content"===d||"both"===d)&&(h=h.concat(["marginTop","marginBottom"]).concat(r),l=l.concat(["marginLeft","marginRight"]),a.find("*[width]").each(function(){var i=t(this),s=t.effects.scaledDimensions(i),o={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x},a={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x};n.from.y!==n.to.y&&(o=t.effects.setTransition(i,h,n.from.y,o),a=t.effects.setTransition(i,h,n.to.y,a)),n.from.x!==n.to.x&&(o=t.effects.setTransition(i,l,n.from.x,o),a=t.effects.setTransition(i,l,n.to.x,a)),u&&t.effects.saveStyle(i),i.css(o),i.animate(a,e.duration,e.easing,function(){u&&t.effects.restoreStyle(i)})})),a.animate(v,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){var e=a.offset();0===v.opacity&&a.css("opacity",_.opacity),u||(a.css("position","static"===f?"relative":f).offset(e),t.effects.saveStyle(a)),i()}})}),t.effects.define("scale",function(e,i){var s=t(this),n=e.mode,o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"effect"!==n?0:100),a=t.extend(!0,{from:t.effects.scaledDimensions(s),to:t.effects.scaledDimensions(s,o,e.direction||"both"),origin:e.origin||["middle","center"]},e);e.fade&&(a.from.opacity=1,a.to.opacity=0),t.effects.effect.size.call(this,a,i)}),t.effects.define("puff","hide",function(e,i){var s=t.extend(!0,{},e,{fade:!0,percent:parseInt(e.percent,10)||150});t.effects.effect.scale.call(this,s,i)}),t.effects.define("pulsate","show",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=o||a,h=2*(e.times||5)+(r?1:0),l=e.duration/h,c=0,u=1,d=s.queue().length;for((o||!s.is(":visible"))&&(s.css("opacity",0).show(),c=1);h>u;u++)s.animate({opacity:c},l,e.easing),c=1-c;s.animate({opacity:c},l,e.easing),s.queue(i),t.effects.unshift(s,d,h+1)}),t.effects.define("shake",function(e,i){var s=1,n=t(this),o=e.direction||"left",a=e.distance||20,r=e.times||3,h=2*r+1,l=Math.round(e.duration/h),c="up"===o||"down"===o?"top":"left",u="up"===o||"left"===o,d={},p={},f={},g=n.queue().length;for(t.effects.createPlaceholder(n),d[c]=(u?"-=":"+=")+a,p[c]=(u?"+=":"-=")+2*a,f[c]=(u?"-=":"+=")+2*a,n.animate(d,l,e.easing);r>s;s++)n.animate(p,l,e.easing).animate(f,l,e.easing);n.animate(p,l,e.easing).animate(d,l/2,e.easing).queue(i),t.effects.unshift(n,g,h+1)}),t.effects.define("slide","show",function(e,i){var s,n,o=t(this),a={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},r=e.mode,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h,u=e.distance||o["top"===l?"outerHeight":"outerWidth"](!0),d={};t.effects.createPlaceholder(o),s=o.cssClip(),n=o.position()[l],d[l]=(c?-1:1)*u+n,d.clip=o.cssClip(),d.clip[a[h][1]]=d.clip[a[h][0]],"show"===r&&(o.cssClip(d.clip),o.css(l,d[l]),d.clip=s,d[l]=n),o.animate(d,{queue:!1,duration:e.duration,easing:e.easing,complete:i})});var f;t.uiBackCompat!==!1&&(f=t.effects.define("transfer",function(e,i){t(this).transfer(e,i)})),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e,i,s=this.options.icons;s&&(e=t("<span>"),this._addClass(e,"ui-accordion-header-icon","ui-icon "+s.header),e.prependTo(this.headers),i=this.active.children(".ui-accordion-header-icon"),this._removeClass(i,s.header)._addClass(i,null,s.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),void 0)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),t(o).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=t(this),i=e.uniqueId().attr("id"),s=e.next(),n=s.uniqueId().attr("id");e.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(e=n.height(),this.element.siblings(":visible").each(function(){var i=t(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(e-=i.outerHeight(!0))}),this.headers.each(function(){e-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===s&&(e=0,this.headers.next().each(function(){var i=t(this).is(":visible");i||t(this).show(),e=Math.max(e,t(this).css("height","").height()),i||t(this).hide()}).height(e))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i,s,n=this.options,o=this.active,a=t(e.currentTarget),r=a[0]===o[0],h=r&&n.collapsible,l=h?t():a.next(),c=o.next(),u={oldHeader:o,oldPanel:c,newHeader:h?t():a,newPanel:l};e.preventDefault(),r&&!n.collapsible||this._trigger("beforeActivate",e,u)===!1||(n.active=h?!1:this.headers.index(a),this.active=r?t():a,this._toggle(u),this._removeClass(o,"ui-accordion-header-active","ui-state-active"),n.icons&&(i=o.children(".ui-accordion-header-icon"),this._removeClass(i,null,n.icons.activeHeader)._addClass(i,null,n.icons.header)),r||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),n.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,n.icons.header)._addClass(s,null,n.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(t(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,e,i){var s,n,o,a=this,r=0,h=t.css("box-sizing"),l=t.length&&(!e.length||t.index()<e.index()),c=this.options.animate||{},u=l&&c.down||c,d=function(){a._toggleComplete(i)};return"number"==typeof u&&(o=u),"string"==typeof u&&(n=u),n=n||u.easing||c.easing,o=o||u.duration||c.duration,e.length?t.length?(s=t.show().outerHeight(),e.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),t.hide().animate(this.showProps,{duration:o,easing:n,complete:d,step:function(t,i){i.now=Math.round(t),"height"!==i.prop?"content-box"===h&&(r+=i.now):"content"!==a.options.heightStyle&&(i.now=Math.round(s-e.outerHeight()-r),r=0)}}),void 0):e.animate(this.hideProps,o,n,d):t.animate(this.showProps,o,n,d)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.widget("ui.menu",{version:"1.12.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,h=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=h.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("<span>").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=h.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)},_filterMenuItems:function(e){var i=e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(t.trim(t(this).children(".ui-menu-item-wrapper").text()))})}}),t.widget("ui.autocomplete",{version:"1.12.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;
+this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return t.proxy(function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")},this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({},e,{label:e.label||e.value,value:e.value||e.label})})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<div>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("<div>").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete;var g=/ui-corner-([a-z]){2,6}/g;t.widget("ui.controlgroup",{version:"1.12.1",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var e=this,i=[];t.each(this.options.items,function(s,n){var o,a={};return n?"controlgroupLabel"===s?(o=e.element.find(n),o.each(function(){var e=t(this);e.children(".ui-controlgroup-label-contents").length||e.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),e._addClass(o,null,"ui-widget ui-widget-content ui-state-default"),i=i.concat(o.get()),void 0):(t.fn[s]&&(a=e["_"+s+"Options"]?e["_"+s+"Options"]("middle"):{classes:{}},e.element.find(n).each(function(){var n=t(this),o=n[s]("instance"),r=t.widget.extend({},a);if("button"!==s||!n.parent(".ui-spinner").length){o||(o=n[s]()[s]("instance")),o&&(r.classes=e._resolveClassesValues(r.classes,o)),n[s](r);var h=n[s]("widget");t.data(h[0],"ui-controlgroup-data",o?o:n[s]("instance")),i.push(h[0])}})),void 0):void 0}),this.childWidgets=t(t.unique(i)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var i=t(this),s=i.data("ui-controlgroup-data");s&&s[e]&&s[e]()})},_updateCornerClass:function(t,e){var i="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all",s=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,i),this._addClass(t,null,s)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){var e=this._buildSimpleOptions(t,"ui-spinner");return e.classes["ui-spinner-up"]="",e.classes["ui-spinner-down"]="",e},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e?"auto":!1,classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(e,i){var s={};return t.each(e,function(n){var o=i.options.classes[n]||"";o=t.trim(o.replace(g,"")),s[n]=(o+" "+e[n]).replace(/\s+/g," ")}),s},_setOption:function(t,e){return"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"===t?(this._callChildMethod(e?"disable":"enable"),void 0):(this.refresh(),void 0)},refresh:function(){var e,i=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),e=this.childWidgets,this.options.onlyVisible&&(e=e.filter(":visible")),e.length&&(t.each(["first","last"],function(t,s){var n=e[s]().data("ui-controlgroup-data");if(n&&i["_"+n.widgetName+"Options"]){var o=i["_"+n.widgetName+"Options"](1===e.length?"only":s);o.classes=i._resolveClassesValues(o.classes,n),n.element[n.widgetName](o)}else i._updateCornerClass(e[s](),s)}),this._callChildMethod("refresh"))}}),t.widget("ui.checkboxradio",[t.ui.formResetMixin,{version:"1.12.1",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var e,i,s=this,n=this._super()||{};return this._readType(),i=this.element.labels(),this.label=t(i[i.length-1]),this.label.length||t.error("No label found for checkboxradio widget"),this.originalLabel="",this.label.contents().not(this.element[0]).each(function(){s.originalLabel+=3===this.nodeType?t(this).text():this.outerHTML}),this.originalLabel&&(n.label=this.originalLabel),e=this.element[0].disabled,null!=e&&(n.disabled=e),n},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&(this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this.icon&&this._addClass(this.icon,null,"ui-state-hover")),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var e=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===e&&/radio|checkbox/.test(this.type)||t.error("Can't create checkboxradio on element.nodeName="+e+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var e,i=this.element[0].name,s="input[name='"+t.ui.escapeSelector(i)+"']";return i?(e=this.form.length?t(this.form[0].elements).filter(s):t(s).filter(function(){return 0===t(this).form().length}),e.not(this.element)):t([])},_toggleClasses:function(){var e=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",e)._toggleClass(this.icon,null,"ui-icon-blank",!e),"radio"===this.type&&this._getRadioGroup().each(function(){var e=t(this).checkboxradio("instance");e&&e._removeClass(e.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){return"label"!==t||e?(this._super(t,e),"disabled"===t?(this._toggleClass(this.label,null,"ui-state-disabled",e),this.element[0].disabled=e,void 0):(this.refresh(),void 0)):void 0},_updateIcon:function(e){var i="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=t("<span>"),this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(i+=e?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,e?"ui-icon-blank":"ui-icon-check")):i+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",i),e||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),this.iconSpace&&(t=t.not(this.iconSpace[0])),t.remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]),t.ui.checkboxradio,t.widget("ui.button",{version:"1.12.1",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),t=this.element[0].disabled,null!=t&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(e){e.keyCode===t.ui.keyCode.SPACE&&(e.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(e,i){var s="iconPosition"!==e,n=s?this.options.iconPosition:i,o="top"===n||"bottom"===n;this.icon?s&&this._removeClass(this.icon,null,this.options.icon):(this.icon=t("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),s&&this._addClass(this.icon,null,i),this._attachIcon(n),o?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(n))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=void 0===t.showLabel?this.options.showLabel:t.showLabel,i=void 0===t.icon?this.options.icon:t.icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),this.element[0].disabled=e,e&&this.element.blur())},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),t.uiBackCompat!==!1&&(t.widget("ui.button",t.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,e){return"text"===t?(this._super("showLabel",e),void 0):("showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments),void 0)}}),t.fn.button=function(e){return function(){return!this.length||this.length&&"INPUT"!==this[0].tagName||this.length&&"INPUT"===this[0].tagName&&"checkbox"!==this.attr("type")&&"radio"!==this.attr("type")?e.apply(this,arguments):(t.ui.checkboxradio||t.error("Checkboxradio widget missing"),0===arguments.length?this.checkboxradio({icon:!1}):this.checkboxradio.apply(this,arguments))}}(t.fn.button),t.fn.buttonset=function(){return t.ui.controlgroup||t.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))}),t.ui.button,t.extend(t.ui,{datepicker:{version:"1.12.1"}});var m;t.extend(s.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return a(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),o=this._newInst(t(e),n),o.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){var s=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?n(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(i),t.data(e,"datepicker",i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t("<span class='"+this._appendClass+"'>"+a+"</span>"),e[r?"before":"after"](i.append)),e.off("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.on("focus",this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):t("<button type='button'></button>").addClass(this._triggerClass).html(o?t("<img/>").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.on("click",function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,n,o){var r,h,l,c,u,d=this._dialogInst;return d||(this.uuid+=1,r="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+r+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),t("body").append(this._dialogInput),d=this._dialogInst=this._newInst(this._dialogInput,!1),d.settings={},t.data(this._dialogInput[0],"datepicker",d)),a(d.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(d,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,c=document.documentElement.scrollLeft||document.body.scrollLeft,u=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+c,l/2-150+u]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),d.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],"datepicker",d),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,"datepicker");s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),m===n&&(m=null))},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,i,s){var n,o,r,h,l=this._getInst(e);return 2===arguments.length&&"string"==typeof i?"defaults"===i?t.extend({},t.datepicker._defaults):l?"all"===i?t.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),o=this._getDateDatepicker(e,!0),r=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),a(l.settings,n),null!==r&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,r)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(e):this._enableDatepicker(e)),this._attachments(t(e),l),this._autoSize(l),this._setDate(l,o),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var i,s,n=t.datepicker._getInst(e.target);return t.datepicker._get(n,"constrainInput")?(i=t.datepicker._possibleChars(t.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),e.ctrlKey||e.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var s,n,o,r,h,l,c;s=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==s&&(t.datepicker._curInst.dpDiv.stop(!0,!0),s&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),n=t.datepicker._get(s,"beforeShow"),o=n?n.apply(e,[e,s]):{},o!==!1&&(a(s.settings,o),s.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(s),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),r=!1,t(e).parents().each(function(){return r|="fixed"===t(this).css("position"),!r}),h={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,s.dpDiv.empty(),s.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(s),h=t.datepicker._checkOffset(s,h,r),s.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":r?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),s.inline||(l=t.datepicker._get(s,"showAnim"),c=t.datepicker._get(s,"duration"),s.dpDiv.css("z-index",i(t(e))+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[l]?s.dpDiv.show(l,t.datepicker._get(s,"showOptions"),c):s.dpDiv[l||"show"](l?c:null),t.datepicker._shouldFocusInput(s)&&s.input.trigger("focus"),t.datepicker._curInst=s))
+}},_updateDatepicker:function(e){this.maxRows=4,m=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var i,s=this._getNumberOfMonths(e),n=s[1],a=17,r=e.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.trigger("focus"),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+o>l&&l>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,a=this._curInst;!a||e&&a!==t.data(e,"datepicker")||this._datepickerShowing&&(i=this._get(a,"showAnim"),s=this._get(a,"duration"),n=function(){t.datepicker._tidyDialog(a)},t.effects&&(t.effects.effect[i]||t.effects[i])?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),s,n):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(a,"onClose"),o&&o.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).val(n))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(e,i,s){if(null==e||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,o,a,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),u=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,d=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,m=-1,_=-1,v=-1,b=!1,y=function(t){var i=e.length>n+1&&e.charAt(n+1)===t;return i&&n++,i},w=function(t){var e=y(t),s="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n="y"===t?s:1,o=RegExp("^\\d{"+n+","+s+"}"),a=i.substring(h).match(o);if(!a)throw"Missing number at position "+h;return h+=a[0].length,parseInt(a[0],10)},k=function(e,s,n){var o=-1,a=t.map(y(e)?n:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,e){var s=e[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(o=e[0],h+=s.length,!1):void 0}),-1!==o)return o+1;throw"Unknown name at position "+h},x=function(){if(i.charAt(h)!==e.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;e.length>n;n++)if(b)"'"!==e.charAt(n)||y("'")?x():b=!1;else switch(e.charAt(n)){case"d":_=w("d");break;case"D":k("D",u,d);break;case"o":v=w("o");break;case"m":m=w("m");break;case"M":m=k("M",p,f);break;case"y":g=w("y");break;case"@":r=new Date(w("@")),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"!":r=new Date((w("!")-this._ticksTo1970)/1e4),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"'":y("'")?x():b=!0;break;default:x()}if(i.length>h&&(a=i.substr(h),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c>=g?0:-100)),v>-1)for(m=1,_=v;;){if(o=this._getDaysInMonth(g,m-1),o>=_)break;m++,_-=o}if(r=this._daylightSavingAdjust(new Date(g,m-1,_)),r.getFullYear()!==g||r.getMonth()+1!==m||r.getDate()!==_)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||h("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=l("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=l("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=h("y")?e.getFullYear():(10>e.getFullYear()%100?"0":"")+e.getFullYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":a+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}l=h.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).on(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,h,l,c,u,d,p,f,g,m,_,v,b,y,w,k,x,C,D,I,T,P,M,S,H,z,O,A,N,W,E,F,L,R=new Date,B=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),Y=this._get(t,"isRTL"),j=this._get(t,"showButtonPanel"),q=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),V=this._get(t,"showCurrentAtPos"),$=this._get(t,"stepMonths"),X=1!==U[0]||1!==U[1],G=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),Q=this._getMinMaxDate(t,"min"),J=this._getMinMaxDate(t,"max"),Z=t.drawMonth-V,te=t.drawYear;if(0>Z&&(Z+=12,te--),J)for(e=this._daylightSavingAdjust(new Date(J.getFullYear(),J.getMonth()-U[0]*U[1]+1,J.getDate())),e=Q&&Q>e?Q:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-$,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":q?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+$,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":q?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?G:B,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,h=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",l=j?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(t,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+a+"</button>":"")+(Y?"":h)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),_=this._get(t,"showOtherMonths"),v=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;U[0]>k;k++){for(x="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),I=" ui-corner-all",T="",X){if(T+="<div class='ui-datepicker-group",U[1]>1)switch(C){case 0:T+=" ui-datepicker-group-first",I=" ui-corner-"+(Y?"right":"left");break;case U[1]-1:T+=" ui-datepicker-group-last",I=" ui-corner-"+(Y?"left":"right");break;default:T+=" ui-datepicker-group-middle",I=""}T+="'>"}for(T+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+I+"'>"+(/all|left/.test(I)&&0===k?Y?o:s:"")+(/all|right/.test(I)&&0===k?Y?s:o:"")+this._generateMonthYearHeader(t,Z,te,Q,J,k>0||C>0,f,g)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",P=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)M=(w+c)%7,P+="<th scope='col'"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[M]+"'>"+p[M]+"</span></th>";for(T+=P+"</tr></thead><tbody>",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),H=(this._getFirstDayOfMonth(te,Z)-c+7)%7,z=Math.ceil((H+S)/7),O=X?this.maxRows>z?this.maxRows:z:z,this.maxRows=O,A=this._daylightSavingAdjust(new Date(te,Z,1-H)),N=0;O>N;N++){for(T+="<tr>",W=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(A)+"</td>":"",w=0;7>w;w++)E=m?m.apply(t.input?t.input[0]:null,[A]):[!0,""],F=A.getMonth()!==Z,L=F&&!v||!E[0]||Q&&Q>A||J&&A>J,W+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(A.getTime()===D.getTime()&&Z===t.selectedMonth&&t._keyEvent||b.getTime()===A.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!_?"":" "+E[1]+(A.getTime()===G.getTime()?" "+this._currentClass:"")+(A.getTime()===B.getTime()?" ui-datepicker-today":""))+"'"+(F&&!_||!E[2]?"":" title='"+E[2].replace(/'/g,"&#39;")+"'")+(L?"":" data-handler='selectDay' data-event='click' data-month='"+A.getMonth()+"' data-year='"+A.getFullYear()+"'")+">"+(F&&!_?"&#xa0;":L?"<span class='ui-state-default'>"+A.getDate()+"</span>":"<a class='ui-state-default"+(A.getTime()===B.getTime()?" ui-state-highlight":"")+(A.getTime()===G.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+A.getDate()+"</a>")+"</td>",A.setDate(A.getDate()+1),A=this._daylightSavingAdjust(A);T+=W+"</tr>"}Z++,Z>11&&(Z=0,te++),T+="</tbody></table>"+(X?"</div>"+(U[0]>0&&C===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=T}y+=x}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var h,l,c,u,d,p,f,g,m=this._get(t,"changeMonth"),_=this._get(t,"changeYear"),v=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(o||!m)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!h||c>=s.getMonth())&&(!l||n.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(v||(b+=y+(!o&&m&&_?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",o||!_)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";g>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),v&&(b+=(!o&&m&&_?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,h=this._get(t,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).on("mousedown",t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new s,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.12.1",t.datepicker,t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var _=!1;t(document).on("mouseup",function(){_=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!_){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),_=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,_=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blurActiveElement(e),this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("<div>").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}
+},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),h=t.pageX,l=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,h=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(h=this.originalPageX),"x"===a.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY<n.scrollSensitivity?a.scrollTop=o=a.scrollTop+n.scrollSpeed:e.pageY-s.overflowOffset.top<n.scrollSensitivity&&(a.scrollTop=o=a.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+a.offsetWidth-e.pageX<n.scrollSensitivity?a.scrollLeft=o=a.scrollLeft+n.scrollSpeed:e.pageX-s.overflowOffset.left<n.scrollSensitivity&&(a.scrollLeft=o=a.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(e.pageY-t(r).scrollTop()<n.scrollSensitivity?o=t(r).scrollTop(t(r).scrollTop()-n.scrollSpeed):t(window).height()-(e.pageY-t(r).scrollTop())<n.scrollSensitivity&&(o=t(r).scrollTop(t(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(e.pageX-t(r).scrollLeft()<n.scrollSensitivity?o=t(r).scrollLeft(t(r).scrollLeft()-n.scrollSpeed):t(window).width()-(e.pageX-t(r).scrollLeft())<n.scrollSensitivity&&(o=t(r).scrollLeft(t(r).scrollLeft()+n.scrollSpeed)))),o!==!1&&t.ui.ddmanager&&!n.dropBehaviour&&t.ui.ddmanager.prepareOffsets(s,e)}}),t.ui.plugin.add("draggable","snap",{start:function(e,i,s){var n=s.options;s.snapElements=[],t(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var e=t(this),i=e.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:i.top,left:i.left})})},drag:function(e,i,s){var n,o,a,r,h,l,c,u,d,p,f=s.options,g=f.snapTolerance,m=i.offset.left,_=m+s.helperProportions.width,v=i.offset.top,b=v+s.helperProportions.height;for(d=s.snapElements.length-1;d>=0;d--)h=s.snapElements[d].left-s.margins.left,l=h+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,h-g>_||m>l+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(h-_),r=g>=Math.abs(l-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(h-m),r=g>=Math.abs(l-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("<div>"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,n=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<div style='overflow:hidden;'></div>"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),g&&(p-=l),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.dialog",{version:"1.12.1",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(e){var i=t(this).css(e).offset().top;0>i&&t(this).css("top",e.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&t.fn.draggable&&this._makeDraggable(),this.options.resizable&&t.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var e=this.options.appendTo;return e&&(e.jquery||e.nodeType)?t(e):this.document.find(e||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),t=e.parent.children().eq(e.index),t.length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog
+},disable:t.noop,enable:t.noop,close:function(e){var i=this;this._isOpen&&this._trigger("beforeClose",e)!==!1&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||t.ui.safeBlur(t.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",e)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+t(this).css("z-index")}).get(),o=Math.max.apply(null,n);return o>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",o+1),s=!0),s&&!i&&this._trigger("focus",e),s},open:function(){var e=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=t(t.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){e._focusTabbable(),e._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var t=this._focusedElement;t||(t=this.element.find("[autofocus]")),t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).trigger("focus")},_keepFocus:function(e){function i(){var e=t.ui.safeActiveElement(this.document[0]),i=this.uiDialog[0]===e||t.contains(this.uiDialog[0],e);i||this._focusTabbable()}e.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=t("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(e){if(this.options.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===t.ui.keyCode.ESCAPE)return e.preventDefault(),this.close(e),void 0;if(e.keyCode===t.ui.keyCode.TAB&&!e.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");e.target!==n[0]&&e.target!==this.uiDialog[0]||e.shiftKey?e.target!==s[0]&&e.target!==this.uiDialog[0]||!e.shiftKey||(this._delay(function(){n.trigger("focus")}),e.preventDefault()):(this._delay(function(){s.trigger("focus")}),e.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var e;this.uiDialogTitlebar=t("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(e){t(e.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=t("<button type='button'></button>").button({label:t("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),e=t("<span>").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(e,"ui-dialog-title"),this._title(e),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":e.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html("&#160;")},_createButtonPane:function(){this.uiDialogButtonPane=t("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=t("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var e=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),t.isEmptyObject(i)||t.isArray(i)&&!i.length?(this._removeClass(this.uiDialog,"ui-dialog-buttons"),void 0):(t.each(i,function(i,s){var n,o;s=t.isFunction(s)?{click:s,text:i}:s,s=t.extend({type:"button"},s),n=s.click,o={icon:s.icon,iconPosition:s.iconPosition,showLabel:s.showLabel,icons:s.icons,text:s.text},delete s.click,delete s.icon,delete s.iconPosition,delete s.showLabel,delete s.icons,"boolean"==typeof s.text&&delete s.text,t("<button></button>",s).button(o).appendTo(e.uiButtonSet).on("click",function(){n.apply(e.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function e(t){return{position:t.position,offset:t.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){i._addClass(t(this),"ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,e(n))},drag:function(t,s){i._trigger("drag",t,e(s))},stop:function(n,o){var a=o.offset.left-i.document.scrollLeft(),r=o.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(a>=0?"+":"")+a+" "+"top"+(r>=0?"+":"")+r,of:i.window},i._removeClass(t(this),"ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,e(o))}})},_makeResizable:function(){function e(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}var i=this,s=this.options,n=s.resizable,o=this.uiDialog.css("position"),a="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:a,start:function(s,n){i._addClass(t(this),"ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,e(n))},resize:function(t,s){i._trigger("resize",t,e(s))},stop:function(n,o){var a=i.uiDialog.offset(),r=a.left-i.document.scrollLeft(),h=a.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},i._removeClass(t(this),"ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,e(o))}}).css("position",o)},_trackFocus:function(){this._on(this.widget(),{focusin:function(e){this._makeFocusTarget(),this._focusedElement=t(e.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var e=this._trackingInstances(),i=t.inArray(this,e);-1!==i&&e.splice(i,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||(t=[],this.document.data("ui-dialog-instances",t)),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(e){var i=this,s=!1,n={};t.each(e,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,i){var s,n,o=this.uiDialog;"disabled"!==e&&(this._super(e,i),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:t("<a>").text(""+this.options.closeText).html()}),"draggable"===e&&(s=o.is(":data(ui-draggable)"),s&&!i&&o.draggable("destroy"),!s&&i&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(n=o.is(":data(ui-resizable)"),n&&!i&&o.resizable("destroy"),n&&"string"==typeof i&&o.resizable("option","handles",i),n||i===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var e=t(this);return t("<div>").css({position:"absolute",width:e.outerWidth(),height:e.outerHeight()}).appendTo(e.parent()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(e){return t(e.target).closest(".ui-dialog").length?!0:!!t(e.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=!0;this._delay(function(){e=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(t){e||this._allowInteraction(t)||(t.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=t("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var t=this.document.data("ui-dialog-overlays")-1;t?this.document.data("ui-dialog-overlays",t):(this._off(this.document,"focusin"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null}}}),t.uiBackCompat!==!1&&t.widget("ui.dialog",t.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}}),t.ui.dialog,t.widget("ui.droppable",{version:"1.12.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(s)?s:function(t){return t.is(s)},this.proportions=function(){return arguments.length?(e=arguments[0],void 0):e?e:e={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this._addClass("ui-droppable")},_addToManager:function(e){t.ui.ddmanager.droppables[e]=t.ui.ddmanager.droppables[e]||[],t.ui.ddmanager.droppables[e].push(this)},_splice:function(t){for(var e=0;t.length>e;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var e=t.ui.ddmanager.droppables[this.options.scope];this._splice(e)},_setOption:function(e,i){if("accept"===e)this.accept=t.isFunction(i)?i:function(t){return t.is(i)};else if("scope"===e){var s=t.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(e,i)},_activate:function(e){var i=t.ui.ddmanager.current;this._addActiveClass(),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this._removeActiveClass(),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._addHoverClass(),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeHoverClass(),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=t(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&v(s,t.extend(i,{offset:i.element.offset()}),i.options.tolerance,e)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(s)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}});var v=t.ui.intersect=function(){function t(t,e,i){return t>=e&&e+i>t}return function(e,i,s,n){if(!i.offset)return!1;var o=(e.positionAbs||e.position.absolute).left+e.margins.left,a=(e.positionAbs||e.position.absolute).top+e.margins.top,r=o+e.helperProportions.width,h=a+e.helperProportions.height,l=i.offset.left,c=i.offset.top,u=l+i.proportions().width,d=c+i.proportions().height;switch(s){case"fit":return o>=l&&u>=r&&a>=c&&d>=h;case"intersect":return o+e.helperProportions.width/2>l&&u>r-e.helperProportions.width/2&&a+e.helperProportions.height/2>c&&d>h-e.helperProportions.height/2;case"pointer":return t(n.pageY,c,i.proportions().height)&&t(n.pageX,l,i.proportions().width);case"touch":return(a>=c&&d>=a||h>=c&&d>=h||c>a&&h>d)&&(o>=l&&u>=o||r>=l&&u>=r||l>o&&r>u);default:return!1}}}();t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],a=i?i.type:null,r=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;o.length>s;s++)if(!(o[s].options.disabled||e&&!o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;r.length>n;n++)if(r[n]===o[s].element[0]){o[s].proportions().height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===a&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions({width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight}))}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&v(e,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").on("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,o,a=v(e,this,this.options.tolerance,i),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return t(this).droppable("instance").options.scope===n}),o.length&&(s=t(o[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").off("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}},t.uiBackCompat!==!1&&t.widget("ui.droppable",t.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}}),t.ui.droppable,t.widget("ui.progressbar",{version:"1.12.1",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=t("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){return void 0===t?this.options.value:(this.options.value=this._constrainedValue(t),this._refreshValue(),void 0)},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=t===!1,"number"!=typeof t&&(t=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).width(i.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,e===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}}),t.widget("ui.selectable",t.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e.elementPos=t(e.element[0]).offset(),e.selectees=t(e.options.filter,e.element[0]),e._addClass(e.selectees,"ui-selectee"),e.selectees.each(function(){var i=t(this),s=i.offset(),n={left:s.left-e.elementPos.left,top:s.top-e.elementPos.top};t.data(this,"selectable-item",{element:this,$element:i,left:n.left,top:n.top,right:n.left+i.outerWidth(),bottom:n.top+i.outerHeight(),startselected:!1,selected:i.hasClass("ui-selected"),selecting:i.hasClass("ui-selecting"),unselecting:i.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=t("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.elementPos=t(this.element[0]).offset(),this.options.disabled||(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(i._removeClass(s.$element,"ui-selected"),s.selected=!1,i._addClass(s.$element,"ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");return n?(s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),i._removeClass(n.$element,s?"ui-unselecting":"ui-selected")._addClass(n.$element,s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=e.pageX,h=e.pageY;return o>r&&(i=r,r=o,o=i),a>h&&(i=h,h=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:h-a}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),l=!1,c={};i&&i.element!==s.element[0]&&(c.left=i.left+s.elementPos.left,c.right=i.right+s.elementPos.left,c.top=i.top+s.elementPos.top,c.bottom=i.bottom+s.elementPos.top,"touch"===n.tolerance?l=!(c.left>r||o>c.right||c.top>h||a>c.bottom):"fit"===n.tolerance&&(l=c.left>o&&r>c.right&&c.top>a&&h>c.bottom),l?(i.selected&&(s._removeClass(i.$element,"ui-selected"),i.selected=!1),i.unselecting&&(s._removeClass(i.$element,"ui-unselecting"),i.unselecting=!1),i.selecting||(s._addClass(i.$element,"ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,s._addClass(i.$element,"ui-selected"),i.selected=!0):(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,i.startselected&&(s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(s._removeClass(i.$element,"ui-selected"),i.selected=!1,s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-selecting")._addClass(s.$element,"ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),t.widget("ui.selectmenu",[t.ui.formResetMixin,{version:"1.12.1",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=t()},_drawButton:function(){var e,i=this,s=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.focus(),t.preventDefault()}}),this.element.hide(),this.button=t("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),e=t("<span>").appendTo(this.button),this._addClass(e,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(s).appendTo(this.button),this.options.width!==!1&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){i._rendered||i._refreshMenu()})},_drawMenu:function(){var e=this;this.menu=t("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=t("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,i){t.preventDefault(),e._setSelection(),e._select(i.item.data("ui-selectmenu-item"),t)},focus:function(t,i){var s=i.item.data("ui-selectmenu-item");null!=e.focusIndex&&s.index!==e.focusIndex&&(e._trigger("focus",t,{item:s}),e.isOpen||e._select(s,t)),e.focusIndex=s.index,e.button.attr("aria-activedescendant",e.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t,e=this.element.find("option");this.menu.empty(),this._parseOptions(e),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,e.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t)))},_position:function(){this.menuWrap.position(t.extend({of:this.button},this.options.position))},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(e){var i=t("<span>");return this._setText(i,e.label),this._addClass(i,"ui-selectmenu-text"),i},_renderMenu:function(e,i){var s=this,n="";t.each(i,function(i,o){var a;o.optgroup!==n&&(a=t("<li>",{text:o.optgroup}),s._addClass(a,"ui-selectmenu-optgroup","ui-menu-divider"+(o.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),a.appendTo(e),n=o.optgroup),s._renderItemData(e,o)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(e,i){var s=t("<li>"),n=t("<div>",{title:i.element.attr("title")});return i.disabled&&this._addClass(s,null,"ui-state-disabled"),this._setText(n,i.label),s.append(n).appendTo(e)},_setText:function(t,e){e?t.text(e):t.html("&#160;")},_move:function(t,e){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),n+=":not(.ui-state-disabled)"),s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](n).eq(-1):i[t+"All"](n).eq(0),s.length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&(window.getSelection?(t=window.getSelection(),t.removeAllRanges(),t.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(e){this.isOpen&&(t(e.target).closest(".ui-selectmenu-menu, #"+t.ui.escapeSelector(this.ids.button)).length||this.close(e))}},_buttonEvents:{mousedown:function(){var t;window.getSelection?(t=window.getSelection(),t.rangeCount&&(this.range=t.getRangeAt(0))):this.range=document.selection.createRange()},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(e){var i=!0;switch(e.keyCode){case t.ui.keyCode.TAB:case t.ui.keyCode.ESCAPE:this.close(e),i=!1;break;case t.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(e);break;case t.ui.keyCode.UP:e.altKey?this._toggle(e):this._move("prev",e);break;case t.ui.keyCode.DOWN:e.altKey?this._toggle(e):this._move("next",e);break;case t.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(e):this._toggle(e);break;case t.ui.keyCode.LEFT:this._move("prev",e);break;case t.ui.keyCode.RIGHT:this._move("next",e);break;case t.ui.keyCode.HOME:case t.ui.keyCode.PAGE_UP:this._move("first",e);break;case t.ui.keyCode.END:case t.ui.keyCode.PAGE_DOWN:this._move("last",e);break;default:this.menu.trigger(e),i=!1}i&&e.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){var e=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":e,"aria-activedescendant":e}),this.menu.attr("aria-activedescendant",e)},_setOption:function(t,e){if("icons"===t){var i=this.button.find("span.ui-icon");this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)}this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;return t===!1?(this.button.css("width",""),void 0):(null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t),void 0)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(e){var i=this,s=[];e.each(function(e,n){s.push(i._parseOption(t(n),e))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),t.widget("ui.slider",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1
+},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle"),o="<span tabindex='0'></span>",a=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)a.push(o);this.handles=n.add(t(a.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=t("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),("min"===e.range||"max"===e.range)&&this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,o,a,r,h,l,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-c.values(e));(n>i||n===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(n=i,o=t(this),a=e)}),r=this._start(e,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,this._addClass(o,null,"ui-state-active"),o.trigger("focus"),h=o.offset(),l=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:e.pageX-h.left-o.width()/2,top:e.pageY-h.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n,o=this.value(),a=this.values();this._hasMultipleValues()&&(n=this.values(e?0:1),o=this.values(e),2===this.options.values.length&&this.options.range===!0&&(i=0===e?Math.min(n,i):Math.max(n,i)),a[e]=i),i!==o&&(s=this._trigger("slide",t,this._uiHash(e,i,a)),s!==!1&&(this._hasMultipleValues()?this.values(e,i):this.value(i)))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(e,i){var s,n,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),void 0;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this._hasMultipleValues()?this._values(e):this.value();for(s=this.options.values,n=arguments[0],o=0;s.length>o;o+=1)s[o]=this._trimAlignValue(n[o]),this._change(null,o);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),this._super(e,i),e){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(i),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=n-1;s>=0;s--)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this._hasMultipleValues()){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step,s=Math.round((t-e)/i)*i;t=s+e,t>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,c={};this._hasMultipleValues()?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),c["horizontal"===h.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[l?"animate":"css"](c,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),o=this._valueMax(),i=o!==n?100*((s-n)/(o-n)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:100-i+"%"},r.animate),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:100-i+"%"},r.animate))},_handleEvents:{keydown:function(e){var i,s,n,o,a=t(e.target).data("ui-slider-handle-index");switch(e.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(e.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(t(e.target),null,"ui-state-active"),i=this._start(e,a),i===!1))return}switch(o=this.options.step,s=n=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case t.ui.keyCode.HOME:n=this._valueMin();break;case t.ui.keyCode.END:n=this._valueMax();break;case t.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-o)}this._slide(e,a,n)},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),this._removeClass(t(e.target),null,"ui-state-active"))}}}),t.widget("ui.sortable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void 0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+a.scrollSpeed:e.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-a.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+a.scrollSpeed:e.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-a.scrollSpeed)):(e.pageY-this.document.scrollTop()<a.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop()-a.scrollSpeed):this.window.height()-(e.pageY-this.document.scrollTop())<a.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop()+a.scrollSpeed)),e.pageX-this.document.scrollLeft()<a.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft()-a.scrollSpeed):this.window.width()-(e.pageX-this.document.scrollLeft())<a.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft()+a.scrollSpeed))),r!==!1&&t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp(new t.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],h=[],l=this._connectWith();if(l&&e)for(s=l.length-1;s>=0;s--)for(o=t(l[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&h.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(h.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",a),c.push({item:h,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("<tr>",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t("<td>&#160;</td>",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,h,l,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[a],l=!1,e[u]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(e[u]-h)&&(n=Math.abs(e[u]-h),o=this.items[s],this.direction=l?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;
+this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}}),t.widget("ui.spinner",{version:"1.12.1",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e=this._super(),i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);null!=n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var e=this.element[0]===t.ui.safeActiveElement(this.document[0]);e||(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===t.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&this.uiSpinner.height()>0&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_start:function(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i,s,n;return"culture"===t||"numberFormat"===t?(i=this._parse(this.element.val()),this.options[t]=e,this.element.val(this._format(i)),void 0):(("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(s=this.buttons.first().find(".ui-icon"),this._removeClass(s,null,this.options.icons.up),this._addClass(s,null,e.up),n=this.buttons.last().find(".ui-icon"),this._removeClass(n,null,this.options.icons.down),this._addClass(n,null,e.down)),this._super(t,e),void 0)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:r(function(t){this._super(t)}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null===t?!1:t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:r(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:r(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:r(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:r(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(r(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),t.uiBackCompat!==!1&&t.widget("ui.spinner",t.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}}),t.ui.spinner,t.widget("ui.tabs",{version:"1.12.1",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var t=/#.*$/;return function(e){var i,s;i=e.href.replace(t,""),s=location.href.replace(t,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return e.hash.length>1&&i===s}}(),_create:function(){var e=this,i=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,i.collapsible),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var e=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===e&&(s&&this.tabs.each(function(i,n){return t(n).attr("aria-controls")===s?(e=i,!1):void 0}),null===e&&(e=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===e||-1===e)&&(e=this.tabs.length?0:!1)),e!==!1&&(e=this.tabs.index(this.tabs.eq(e)),-1===e&&(e=i?!1:0)),!i&&e===!1&&this.anchors.length&&(e=0),e},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(e){var i=t(t.ui.safeActiveElement(this.document[0])).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(e)){switch(e.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:s++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:n=!1,s--;break;case t.ui.keyCode.END:s=this.anchors.length-1;break;case t.ui.keyCode.HOME:s=0;break;case t.ui.keyCode.SPACE:return e.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case t.ui.keyCode.ENTER:return e.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}e.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),e.ctrlKey||e.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(e){return e.altKey&&e.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):e.altKey&&e.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e),void 0)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).attr({role:"presentation",tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=t(),this.anchors.each(function(i,s){var n,o,a,r=t(s).uniqueId().attr("id"),h=t(s).closest("li"),l=h.attr("aria-controls");e._isLocal(s)?(n=s.hash,a=n.substring(1),o=e.element.find(e._sanitizeSelector(n))):(a=h.attr("aria-controls")||t({}).uniqueId()[0].id,n="#"+a,o=e.element.find(n),o.length||(o=e._createPanel(a),o.insertAfter(e.panels[i-1]||e.tablist)),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":a,"aria-labelledby":r}),o.attr("aria-labelledby",r)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(e){return t("<div>").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var i,s,n;for(t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),e===!0||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,e===!0)},_setupEvents:function(e){var i={};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,h=r?t():this._getPanelForTab(o),l=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:l,newTab:r?t():o,newPanel:h};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),l.length||h.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){o._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){o._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n()}):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+t.ui.escapeSelector(e)+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var i=this.options.disabled;i!==!1&&(void 0===e?i=!1:(e=this._getIndex(e),i=t.isArray(i)?t.map(i,function(t){return t!==e?t:null}):t.map(this.tabs,function(t,i){return i!==e?i:null})),this._setOptionDisabled(i))},disable:function(e){var i=this.options.disabled;if(i!==!0){if(void 0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=t.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},h=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete s.xhr};this._isLocal(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,n){setTimeout(function(){a.html(t),s._trigger("load",i,r),h(n,e)},1)}).fail(function(t,e){setTimeout(function(){h(t,e)},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href").replace(/#.*$/,""),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),t.uiBackCompat!==!1&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs,t.widget("ui.tooltip",{version:"1.12.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var e=t(this).attr("title")||"";return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))},_removeDescribedBy:function(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=t("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=t([])},_setOption:function(e,i){var s=this;this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s.element[0],e.close(n,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var e=t(this);return e.is("[title]")?e.data("ui-tooltip-title",e.attr("title")).removeAttr("title"):void 0}))},_enable:function(){this.disabledTitles.each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))}),this.disabledTitles=t([])},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(e,s),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;return"string"==typeof s||s.nodeType||s.jquery?this._open(e,t,s):(i=s.call(t[0],function(i){n._delay(function(){t.data("ui-tooltip-open")&&(e&&(e.type=o),this._open(e,t,i))})}),i&&this._open(e,t,i),void 0)},_open:function(e,i,s){function n(t){l.of=t,a.is(":hidden")||a.position(l)}var o,a,r,h,l=t.extend({},this.options.position);if(s){if(o=this._find(i))return o.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(e&&"mouseover"===e.type?i.attr("title",""):i.removeAttr("title")),o=this._tooltip(i),a=o.tooltip,this._addDescribedBy(i,a.attr("id")),a.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),h=t("<div>").html(a.find(".ui-tooltip-content").html()),h.removeAttr("name").find("[name]").removeAttr("name"),h.removeAttr("id").find("[id]").removeAttr("id"),h.appendTo(this.liveRegion),this.options.track&&e&&/^mouse/.test(e.type)?(this._on(this.document,{mousemove:n}),n(e)):a.position(t.extend({of:i},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){a.is(":visible")&&(n(l.of),clearInterval(r))},t.fx.interval)),this._trigger("open",e,{tooltip:a})}},_registerCloseHandlers:function(e,i){var s={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var s=t.Event(e);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),e&&"mouseover"!==e.type||(s.mouseleave="close"),e&&"focusin"!==e.type||(s.focusout="close"),this._on(!0,i,s)},close:function(e){var i,s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);return o?(i=o.tooltip,o.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),o.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),o.closing=!0,this._trigger("close",e,{tooltip:i}),o.hiding||(o.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(e){var i=t("<div>").attr("role","tooltip"),s=t("<div>").appendTo(i),n=i.uniqueId().attr("id");return this._addClass(s,"ui-tooltip-content"),this._addClass(i,"ui-tooltip","ui-widget ui-widget-content"),i.appendTo(this._appendTo(e)),this.tooltips[n]={element:e,tooltip:i}},_find:function(t){var e=t.data("ui-tooltip-id");return e?this.tooltips[e]:null},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){var e=t.closest(".ui-front, dialog");return e.length||(e=this.document[0].body),e},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur"),o=s.element;n.target=n.currentTarget=o[0],e.close(n,!0),t("#"+i).remove(),o.data("ui-tooltip-title")&&(o.attr("title")||o.attr("title",o.data("ui-tooltip-title")),o.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),t.uiBackCompat!==!1&&t.widget("ui.tooltip",t.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}}),t.ui.tooltip});
+
+/*!
+ DataTables 1.10.18
+ ©2008-2018 SpryMedia Ltd - datatables.net/license
+*/
+(function(h){"function"===typeof define&&define.amd?define(["jquery"],function(E){return h(E,window,document)}):"object"===typeof exports?module.exports=function(E,H){E||(E=window);H||(H="undefined"!==typeof window?require("jquery"):require("jquery")(E));return h(H,E,E.document)}:h(jQuery,window,document)})(function(h,E,H,k){function Z(a){var b,c,d={};h.each(a,function(e){if((b=e.match(/^([^A-Z]+?)([A-Z])/))&&-1!=="a aa ai ao as b fn i m o s ".indexOf(b[1]+" "))c=e.replace(b[0],b[2].toLowerCase()),
+d[c]=e,"o"===b[1]&&Z(a[e])});a._hungarianMap=d}function J(a,b,c){a._hungarianMap||Z(a);var d;h.each(b,function(e){d=a._hungarianMap[e];if(d!==k&&(c||b[d]===k))"o"===d.charAt(0)?(b[d]||(b[d]={}),h.extend(!0,b[d],b[e]),J(a[d],b[d],c)):b[d]=b[e]})}function Ca(a){var b=n.defaults.oLanguage,c=b.sDecimal;c&&Da(c);if(a){var d=a.sZeroRecords;!a.sEmptyTable&&(d&&"No data available in table"===b.sEmptyTable)&&F(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&(d&&"Loading..."===b.sLoadingRecords)&&F(a,
+a,"sZeroRecords","sLoadingRecords");a.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&c!==a&&Da(a)}}function eb(a){A(a,"ordering","bSort");A(a,"orderMulti","bSortMulti");A(a,"orderClasses","bSortClasses");A(a,"orderCellsTop","bSortCellsTop");A(a,"order","aaSorting");A(a,"orderFixed","aaSortingFixed");A(a,"paging","bPaginate");A(a,"pagingType","sPaginationType");A(a,"pageLength","iDisplayLength");A(a,"searching","bFilter");"boolean"===typeof a.sScrollX&&(a.sScrollX=a.sScrollX?"100%":
+"");"boolean"===typeof a.scrollX&&(a.scrollX=a.scrollX?"100%":"");if(a=a.aoSearchCols)for(var b=0,c=a.length;b<c;b++)a[b]&&J(n.models.oSearch,a[b])}function fb(a){A(a,"orderable","bSortable");A(a,"orderData","aDataSort");A(a,"orderSequence","asSorting");A(a,"orderDataType","sortDataType");var b=a.aDataSort;"number"===typeof b&&!h.isArray(b)&&(a.aDataSort=[b])}function gb(a){if(!n.__browser){var b={};n.__browser=b;var c=h("<div/>").css({position:"fixed",top:0,left:-1*h(E).scrollLeft(),height:1,width:1,
+overflow:"hidden"}).append(h("<div/>").css({position:"absolute",top:1,left:1,width:100,overflow:"scroll"}).append(h("<div/>").css({width:"100%",height:10}))).appendTo("body"),d=c.children(),e=d.children();b.barWidth=d[0].offsetWidth-d[0].clientWidth;b.bScrollOversize=100===e[0].offsetWidth&&100!==d[0].clientWidth;b.bScrollbarLeft=1!==Math.round(e.offset().left);b.bBounding=c[0].getBoundingClientRect().width?!0:!1;c.remove()}h.extend(a.oBrowser,n.__browser);a.oScroll.iBarWidth=n.__browser.barWidth}
+function hb(a,b,c,d,e,f){var g,j=!1;c!==k&&(g=c,j=!0);for(;d!==e;)a.hasOwnProperty(d)&&(g=j?b(g,a[d],d,a):a[d],j=!0,d+=f);return g}function Ea(a,b){var c=n.defaults.column,d=a.aoColumns.length,c=h.extend({},n.models.oColumn,c,{nTh:b?b:H.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.mData:d,idx:d});a.aoColumns.push(c);c=a.aoPreSearchCols;c[d]=h.extend({},n.models.oSearch,c[d]);ka(a,d,h(b).data())}function ka(a,b,c){var b=a.aoColumns[b],
+d=a.oClasses,e=h(b.nTh);if(!b.sWidthOrig){b.sWidthOrig=e.attr("width")||null;var f=(e.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);f&&(b.sWidthOrig=f[1])}c!==k&&null!==c&&(fb(c),J(n.defaults.column,c),c.mDataProp!==k&&!c.mData&&(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),c.className&&!c.sClass&&(c.sClass=c.className),c.sClass&&e.addClass(c.sClass),h.extend(b,c),F(b,c,"sWidth","sWidthOrig"),c.iDataSort!==k&&(b.aDataSort=[c.iDataSort]),F(b,c,"aDataSort"));var g=b.mData,j=S(g),i=b.mRender?
+S(b.mRender):null,c=function(a){return"string"===typeof a&&-1!==a.indexOf("@")};b._bAttrSrc=h.isPlainObject(g)&&(c(g.sort)||c(g.type)||c(g.filter));b._setter=null;b.fnGetData=function(a,b,c){var d=j(a,b,k,c);return i&&b?i(d,b,a,c):d};b.fnSetData=function(a,b,c){return N(g)(a,b,c)};"number"!==typeof g&&(a._rowReadObject=!0);a.oFeatures.bSort||(b.bSortable=!1,e.addClass(d.sSortableNone));a=-1!==h.inArray("asc",b.asSorting);c=-1!==h.inArray("desc",b.asSorting);!b.bSortable||!a&&!c?(b.sSortingClass=d.sSortableNone,
+b.sSortingClassJUI=""):a&&!c?(b.sSortingClass=d.sSortableAsc,b.sSortingClassJUI=d.sSortJUIAscAllowed):!a&&c?(b.sSortingClass=d.sSortableDesc,b.sSortingClassJUI=d.sSortJUIDescAllowed):(b.sSortingClass=d.sSortable,b.sSortingClassJUI=d.sSortJUI)}function $(a){if(!1!==a.oFeatures.bAutoWidth){var b=a.aoColumns;Fa(a);for(var c=0,d=b.length;c<d;c++)b[c].nTh.style.width=b[c].sWidth}b=a.oScroll;(""!==b.sY||""!==b.sX)&&la(a);r(a,null,"column-sizing",[a])}function aa(a,b){var c=ma(a,"bVisible");return"number"===
+typeof c[b]?c[b]:null}function ba(a,b){var c=ma(a,"bVisible"),c=h.inArray(b,c);return-1!==c?c:null}function V(a){var b=0;h.each(a.aoColumns,function(a,d){d.bVisible&&"none"!==h(d.nTh).css("display")&&b++});return b}function ma(a,b){var c=[];h.map(a.aoColumns,function(a,e){a[b]&&c.push(e)});return c}function Ga(a){var b=a.aoColumns,c=a.aoData,d=n.ext.type.detect,e,f,g,j,i,h,l,q,t;e=0;for(f=b.length;e<f;e++)if(l=b[e],t=[],!l.sType&&l._sManualType)l.sType=l._sManualType;else if(!l.sType){g=0;for(j=d.length;g<
+j;g++){i=0;for(h=c.length;i<h;i++){t[i]===k&&(t[i]=B(a,i,e,"type"));q=d[g](t[i],a);if(!q&&g!==d.length-1)break;if("html"===q)break}if(q){l.sType=q;break}}l.sType||(l.sType="string")}}function ib(a,b,c,d){var e,f,g,j,i,m,l=a.aoColumns;if(b)for(e=b.length-1;0<=e;e--){m=b[e];var q=m.targets!==k?m.targets:m.aTargets;h.isArray(q)||(q=[q]);f=0;for(g=q.length;f<g;f++)if("number"===typeof q[f]&&0<=q[f]){for(;l.length<=q[f];)Ea(a);d(q[f],m)}else if("number"===typeof q[f]&&0>q[f])d(l.length+q[f],m);else if("string"===
+typeof q[f]){j=0;for(i=l.length;j<i;j++)("_all"==q[f]||h(l[j].nTh).hasClass(q[f]))&&d(j,m)}}if(c){e=0;for(a=c.length;e<a;e++)d(e,c[e])}}function O(a,b,c,d){var e=a.aoData.length,f=h.extend(!0,{},n.models.oRow,{src:c?"dom":"data",idx:e});f._aData=b;a.aoData.push(f);for(var g=a.aoColumns,j=0,i=g.length;j<i;j++)g[j].sType=null;a.aiDisplayMaster.push(e);b=a.rowIdFn(b);b!==k&&(a.aIds[b]=f);(c||!a.oFeatures.bDeferRender)&&Ha(a,e,c,d);return e}function na(a,b){var c;b instanceof h||(b=h(b));return b.map(function(b,
+e){c=Ia(a,e);return O(a,c.data,e,c.cells)})}function B(a,b,c,d){var e=a.iDraw,f=a.aoColumns[c],g=a.aoData[b]._aData,j=f.sDefaultContent,i=f.fnGetData(g,d,{settings:a,row:b,col:c});if(i===k)return a.iDrawError!=e&&null===j&&(K(a,0,"Requested unknown parameter "+("function"==typeof f.mData?"{function}":"'"+f.mData+"'")+" for row "+b+", column "+c,4),a.iDrawError=e),j;if((i===g||null===i)&&null!==j&&d!==k)i=j;else if("function"===typeof i)return i.call(g);return null===i&&"display"==d?"":i}function jb(a,
+b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d,{settings:a,row:b,col:c})}function Ja(a){return h.map(a.match(/(\\.|[^\.])+/g)||[""],function(a){return a.replace(/\\\./g,".")})}function S(a){if(h.isPlainObject(a)){var b={};h.each(a,function(a,c){c&&(b[a]=S(c))});return function(a,c,f,g){var j=b[c]||b._;return j!==k?j(a,c,f,g):a}}if(null===a)return function(a){return a};if("function"===typeof a)return function(b,c,f,g){return a(b,c,f,g)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||
+-1!==a.indexOf("("))){var c=function(a,b,f){var g,j;if(""!==f){j=Ja(f);for(var i=0,m=j.length;i<m;i++){f=j[i].match(ca);g=j[i].match(W);if(f){j[i]=j[i].replace(ca,"");""!==j[i]&&(a=a[j[i]]);g=[];j.splice(0,i+1);j=j.join(".");if(h.isArray(a)){i=0;for(m=a.length;i<m;i++)g.push(c(a[i],b,j))}a=f[0].substring(1,f[0].length-1);a=""===a?g:g.join(a);break}else if(g){j[i]=j[i].replace(W,"");a=a[j[i]]();continue}if(null===a||a[j[i]]===k)return k;a=a[j[i]]}}return a};return function(b,e){return c(b,e,a)}}return function(b){return b[a]}}
+function N(a){if(h.isPlainObject(a))return N(a._);if(null===a)return function(){};if("function"===typeof a)return function(b,d,e){a(b,"set",d,e)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var b=function(a,d,e){var e=Ja(e),f;f=e[e.length-1];for(var g,j,i=0,m=e.length-1;i<m;i++){g=e[i].match(ca);j=e[i].match(W);if(g){e[i]=e[i].replace(ca,"");a[e[i]]=[];f=e.slice();f.splice(0,i+1);g=f.join(".");if(h.isArray(d)){j=0;for(m=d.length;j<m;j++)f={},b(f,d[j],g),
+a[e[i]].push(f)}else a[e[i]]=d;return}j&&(e[i]=e[i].replace(W,""),a=a[e[i]](d));if(null===a[e[i]]||a[e[i]]===k)a[e[i]]={};a=a[e[i]]}if(f.match(W))a[f.replace(W,"")](d);else a[f.replace(ca,"")]=d};return function(c,d){return b(c,d,a)}}return function(b,d){b[a]=d}}function Ka(a){return D(a.aoData,"_aData")}function oa(a){a.aoData.length=0;a.aiDisplayMaster.length=0;a.aiDisplay.length=0;a.aIds={}}function pa(a,b,c){for(var d=-1,e=0,f=a.length;e<f;e++)a[e]==b?d=e:a[e]>b&&a[e]--; -1!=d&&c===k&&a.splice(d,
+1)}function da(a,b,c,d){var e=a.aoData[b],f,g=function(c,d){for(;c.childNodes.length;)c.removeChild(c.firstChild);c.innerHTML=B(a,b,d,"display")};if("dom"===c||(!c||"auto"===c)&&"dom"===e.src)e._aData=Ia(a,e,d,d===k?k:e._aData).data;else{var j=e.anCells;if(j)if(d!==k)g(j[d],d);else{c=0;for(f=j.length;c<f;c++)g(j[c],c)}}e._aSortData=null;e._aFilterData=null;g=a.aoColumns;if(d!==k)g[d].sType=null;else{c=0;for(f=g.length;c<f;c++)g[c].sType=null;La(a,e)}}function Ia(a,b,c,d){var e=[],f=b.firstChild,g,
+j,i=0,m,l=a.aoColumns,q=a._rowReadObject,d=d!==k?d:q?{}:[],t=function(a,b){if("string"===typeof a){var c=a.indexOf("@");-1!==c&&(c=a.substring(c+1),N(a)(d,b.getAttribute(c)))}},G=function(a){if(c===k||c===i)j=l[i],m=h.trim(a.innerHTML),j&&j._bAttrSrc?(N(j.mData._)(d,m),t(j.mData.sort,a),t(j.mData.type,a),t(j.mData.filter,a)):q?(j._setter||(j._setter=N(j.mData)),j._setter(d,m)):d[i]=m;i++};if(f)for(;f;){g=f.nodeName.toUpperCase();if("TD"==g||"TH"==g)G(f),e.push(f);f=f.nextSibling}else{e=b.anCells;
+f=0;for(g=e.length;f<g;f++)G(e[f])}if(b=b.firstChild?b:b.nTr)(b=b.getAttribute("id"))&&N(a.rowId)(d,b);return{data:d,cells:e}}function Ha(a,b,c,d){var e=a.aoData[b],f=e._aData,g=[],j,i,m,l,q;if(null===e.nTr){j=c||H.createElement("tr");e.nTr=j;e.anCells=g;j._DT_RowIndex=b;La(a,e);l=0;for(q=a.aoColumns.length;l<q;l++){m=a.aoColumns[l];i=c?d[l]:H.createElement(m.sCellType);i._DT_CellIndex={row:b,column:l};g.push(i);if((!c||m.mRender||m.mData!==l)&&(!h.isPlainObject(m.mData)||m.mData._!==l+".display"))i.innerHTML=
+B(a,b,l,"display");m.sClass&&(i.className+=" "+m.sClass);m.bVisible&&!c?j.appendChild(i):!m.bVisible&&c&&i.parentNode.removeChild(i);m.fnCreatedCell&&m.fnCreatedCell.call(a.oInstance,i,B(a,b,l),f,b,l)}r(a,"aoRowCreatedCallback",null,[j,f,b,g])}e.nTr.setAttribute("role","row")}function La(a,b){var c=b.nTr,d=b._aData;if(c){var e=a.rowIdFn(d);e&&(c.id=e);d.DT_RowClass&&(e=d.DT_RowClass.split(" "),b.__rowc=b.__rowc?qa(b.__rowc.concat(e)):e,h(c).removeClass(b.__rowc.join(" ")).addClass(d.DT_RowClass));
+d.DT_RowAttr&&h(c).attr(d.DT_RowAttr);d.DT_RowData&&h(c).data(d.DT_RowData)}}function kb(a){var b,c,d,e,f,g=a.nTHead,j=a.nTFoot,i=0===h("th, td",g).length,m=a.oClasses,l=a.aoColumns;i&&(e=h("<tr/>").appendTo(g));b=0;for(c=l.length;b<c;b++)f=l[b],d=h(f.nTh).addClass(f.sClass),i&&d.appendTo(e),a.oFeatures.bSort&&(d.addClass(f.sSortingClass),!1!==f.bSortable&&(d.attr("tabindex",a.iTabIndex).attr("aria-controls",a.sTableId),Ma(a,f.nTh,b))),f.sTitle!=d[0].innerHTML&&d.html(f.sTitle),Na(a,"header")(a,d,
+f,m);i&&ea(a.aoHeader,g);h(g).find(">tr").attr("role","row");h(g).find(">tr>th, >tr>td").addClass(m.sHeaderTH);h(j).find(">tr>th, >tr>td").addClass(m.sFooterTH);if(null!==j){a=a.aoFooter[0];b=0;for(c=a.length;b<c;b++)f=l[b],f.nTf=a[b].cell,f.sClass&&h(f.nTf).addClass(f.sClass)}}function fa(a,b,c){var d,e,f,g=[],j=[],i=a.aoColumns.length,m;if(b){c===k&&(c=!1);d=0;for(e=b.length;d<e;d++){g[d]=b[d].slice();g[d].nTr=b[d].nTr;for(f=i-1;0<=f;f--)!a.aoColumns[f].bVisible&&!c&&g[d].splice(f,1);j.push([])}d=
+0;for(e=g.length;d<e;d++){if(a=g[d].nTr)for(;f=a.firstChild;)a.removeChild(f);f=0;for(b=g[d].length;f<b;f++)if(m=i=1,j[d][f]===k){a.appendChild(g[d][f].cell);for(j[d][f]=1;g[d+i]!==k&&g[d][f].cell==g[d+i][f].cell;)j[d+i][f]=1,i++;for(;g[d][f+m]!==k&&g[d][f].cell==g[d][f+m].cell;){for(c=0;c<i;c++)j[d+c][f+m]=1;m++}h(g[d][f].cell).attr("rowspan",i).attr("colspan",m)}}}}function P(a){var b=r(a,"aoPreDrawCallback","preDraw",[a]);if(-1!==h.inArray(!1,b))C(a,!1);else{var b=[],c=0,d=a.asStripeClasses,e=
+d.length,f=a.oLanguage,g=a.iInitDisplayStart,j="ssp"==y(a),i=a.aiDisplay;a.bDrawing=!0;g!==k&&-1!==g&&(a._iDisplayStart=j?g:g>=a.fnRecordsDisplay()?0:g,a.iInitDisplayStart=-1);var g=a._iDisplayStart,m=a.fnDisplayEnd();if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++,C(a,!1);else if(j){if(!a.bDestroying&&!lb(a))return}else a.iDraw++;if(0!==i.length){f=j?a.aoData.length:m;for(j=j?0:g;j<f;j++){var l=i[j],q=a.aoData[l];null===q.nTr&&Ha(a,l);var t=q.nTr;if(0!==e){var G=d[c%e];q._sRowStripe!=G&&(h(t).removeClass(q._sRowStripe).addClass(G),
+q._sRowStripe=G)}r(a,"aoRowCallback",null,[t,q._aData,c,j,l]);b.push(t);c++}}else c=f.sZeroRecords,1==a.iDraw&&"ajax"==y(a)?c=f.sLoadingRecords:f.sEmptyTable&&0===a.fnRecordsTotal()&&(c=f.sEmptyTable),b[0]=h("<tr/>",{"class":e?d[0]:""}).append(h("<td />",{valign:"top",colSpan:V(a),"class":a.oClasses.sRowEmpty}).html(c))[0];r(a,"aoHeaderCallback","header",[h(a.nTHead).children("tr")[0],Ka(a),g,m,i]);r(a,"aoFooterCallback","footer",[h(a.nTFoot).children("tr")[0],Ka(a),g,m,i]);d=h(a.nTBody);d.children().detach();
+d.append(h(b));r(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=!1}}function T(a,b){var c=a.oFeatures,d=c.bFilter;c.bSort&&mb(a);d?ga(a,a.oPreviousSearch):a.aiDisplay=a.aiDisplayMaster.slice();!0!==b&&(a._iDisplayStart=0);a._drawHold=b;P(a);a._drawHold=!1}function nb(a){var b=a.oClasses,c=h(a.nTable),c=h("<div/>").insertBefore(c),d=a.oFeatures,e=h("<div/>",{id:a.sTableId+"_wrapper","class":b.sWrapper+(a.nTFoot?"":" "+b.sNoFooter)});a.nHolding=c[0];a.nTableWrapper=e[0];a.nTableReinsertBefore=
+a.nTable.nextSibling;for(var f=a.sDom.split(""),g,j,i,m,l,q,k=0;k<f.length;k++){g=null;j=f[k];if("<"==j){i=h("<div/>")[0];m=f[k+1];if("'"==m||'"'==m){l="";for(q=2;f[k+q]!=m;)l+=f[k+q],q++;"H"==l?l=b.sJUIHeader:"F"==l&&(l=b.sJUIFooter);-1!=l.indexOf(".")?(m=l.split("."),i.id=m[0].substr(1,m[0].length-1),i.className=m[1]):"#"==l.charAt(0)?i.id=l.substr(1,l.length-1):i.className=l;k+=q}e.append(i);e=h(i)}else if(">"==j)e=e.parent();else if("l"==j&&d.bPaginate&&d.bLengthChange)g=ob(a);else if("f"==j&&
+d.bFilter)g=pb(a);else if("r"==j&&d.bProcessing)g=qb(a);else if("t"==j)g=rb(a);else if("i"==j&&d.bInfo)g=sb(a);else if("p"==j&&d.bPaginate)g=tb(a);else if(0!==n.ext.feature.length){i=n.ext.feature;q=0;for(m=i.length;q<m;q++)if(j==i[q].cFeature){g=i[q].fnInit(a);break}}g&&(i=a.aanFeatures,i[j]||(i[j]=[]),i[j].push(g),e.append(g))}c.replaceWith(e);a.nHolding=null}function ea(a,b){var c=h(b).children("tr"),d,e,f,g,j,i,m,l,q,k;a.splice(0,a.length);f=0;for(i=c.length;f<i;f++)a.push([]);f=0;for(i=c.length;f<
+i;f++){d=c[f];for(e=d.firstChild;e;){if("TD"==e.nodeName.toUpperCase()||"TH"==e.nodeName.toUpperCase()){l=1*e.getAttribute("colspan");q=1*e.getAttribute("rowspan");l=!l||0===l||1===l?1:l;q=!q||0===q||1===q?1:q;g=0;for(j=a[f];j[g];)g++;m=g;k=1===l?!0:!1;for(j=0;j<l;j++)for(g=0;g<q;g++)a[f+g][m+j]={cell:e,unique:k},a[f+g].nTr=d}e=e.nextSibling}}}function ra(a,b,c){var d=[];c||(c=a.aoHeader,b&&(c=[],ea(c,b)));for(var b=0,e=c.length;b<e;b++)for(var f=0,g=c[b].length;f<g;f++)if(c[b][f].unique&&(!d[f]||
+!a.bSortCellsTop))d[f]=c[b][f].cell;return d}function sa(a,b,c){r(a,"aoServerParams","serverParams",[b]);if(b&&h.isArray(b)){var d={},e=/(.*?)\[\]$/;h.each(b,function(a,b){var c=b.name.match(e);c?(c=c[0],d[c]||(d[c]=[]),d[c].push(b.value)):d[b.name]=b.value});b=d}var f,g=a.ajax,j=a.oInstance,i=function(b){r(a,null,"xhr",[a,b,a.jqXHR]);c(b)};if(h.isPlainObject(g)&&g.data){f=g.data;var m="function"===typeof f?f(b,a):f,b="function"===typeof f&&m?m:h.extend(!0,b,m);delete g.data}m={data:b,success:function(b){var c=
+b.error||b.sError;c&&K(a,0,c);a.json=b;i(b)},dataType:"json",cache:!1,type:a.sServerMethod,error:function(b,c){var d=r(a,null,"xhr",[a,null,a.jqXHR]);-1===h.inArray(!0,d)&&("parsererror"==c?K(a,0,"Invalid JSON response",1):4===b.readyState&&K(a,0,"Ajax error",7));C(a,!1)}};a.oAjaxData=b;r(a,null,"preXhr",[a,b]);a.fnServerData?a.fnServerData.call(j,a.sAjaxSource,h.map(b,function(a,b){return{name:b,value:a}}),i,a):a.sAjaxSource||"string"===typeof g?a.jqXHR=h.ajax(h.extend(m,{url:g||a.sAjaxSource})):
+"function"===typeof g?a.jqXHR=g.call(j,b,i,a):(a.jqXHR=h.ajax(h.extend(m,g)),g.data=f)}function lb(a){return a.bAjaxDataGet?(a.iDraw++,C(a,!0),sa(a,ub(a),function(b){vb(a,b)}),!1):!0}function ub(a){var b=a.aoColumns,c=b.length,d=a.oFeatures,e=a.oPreviousSearch,f=a.aoPreSearchCols,g,j=[],i,m,l,k=X(a);g=a._iDisplayStart;i=!1!==d.bPaginate?a._iDisplayLength:-1;var t=function(a,b){j.push({name:a,value:b})};t("sEcho",a.iDraw);t("iColumns",c);t("sColumns",D(b,"sName").join(","));t("iDisplayStart",g);t("iDisplayLength",
+i);var G={draw:a.iDraw,columns:[],order:[],start:g,length:i,search:{value:e.sSearch,regex:e.bRegex}};for(g=0;g<c;g++)m=b[g],l=f[g],i="function"==typeof m.mData?"function":m.mData,G.columns.push({data:i,name:m.sName,searchable:m.bSearchable,orderable:m.bSortable,search:{value:l.sSearch,regex:l.bRegex}}),t("mDataProp_"+g,i),d.bFilter&&(t("sSearch_"+g,l.sSearch),t("bRegex_"+g,l.bRegex),t("bSearchable_"+g,m.bSearchable)),d.bSort&&t("bSortable_"+g,m.bSortable);d.bFilter&&(t("sSearch",e.sSearch),t("bRegex",
+e.bRegex));d.bSort&&(h.each(k,function(a,b){G.order.push({column:b.col,dir:b.dir});t("iSortCol_"+a,b.col);t("sSortDir_"+a,b.dir)}),t("iSortingCols",k.length));b=n.ext.legacy.ajax;return null===b?a.sAjaxSource?j:G:b?j:G}function vb(a,b){var c=ta(a,b),d=b.sEcho!==k?b.sEcho:b.draw,e=b.iTotalRecords!==k?b.iTotalRecords:b.recordsTotal,f=b.iTotalDisplayRecords!==k?b.iTotalDisplayRecords:b.recordsFiltered;if(d){if(1*d<a.iDraw)return;a.iDraw=1*d}oa(a);a._iRecordsTotal=parseInt(e,10);a._iRecordsDisplay=parseInt(f,
+10);d=0;for(e=c.length;d<e;d++)O(a,c[d]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=!1;P(a);a._bInitComplete||ua(a,b);a.bAjaxDataGet=!0;C(a,!1)}function ta(a,b){var c=h.isPlainObject(a.ajax)&&a.ajax.dataSrc!==k?a.ajax.dataSrc:a.sAjaxDataProp;return"data"===c?b.aaData||b[c]:""!==c?S(c)(b):b}function pb(a){var b=a.oClasses,c=a.sTableId,d=a.oLanguage,e=a.oPreviousSearch,f=a.aanFeatures,g='<input type="search" class="'+b.sFilterInput+'"/>',j=d.sSearch,j=j.match(/_INPUT_/)?j.replace("_INPUT_",
+g):j+g,b=h("<div/>",{id:!f.f?c+"_filter":null,"class":b.sFilter}).append(h("<label/>").append(j)),f=function(){var b=!this.value?"":this.value;b!=e.sSearch&&(ga(a,{sSearch:b,bRegex:e.bRegex,bSmart:e.bSmart,bCaseInsensitive:e.bCaseInsensitive}),a._iDisplayStart=0,P(a))},g=null!==a.searchDelay?a.searchDelay:"ssp"===y(a)?400:0,i=h("input",b).val(e.sSearch).attr("placeholder",d.sSearchPlaceholder).on("keyup.DT search.DT input.DT paste.DT cut.DT",g?Oa(f,g):f).on("keypress.DT",function(a){if(13==a.keyCode)return!1}).attr("aria-controls",
+c);h(a.nTable).on("search.dt.DT",function(b,c){if(a===c)try{i[0]!==H.activeElement&&i.val(e.sSearch)}catch(d){}});return b[0]}function ga(a,b,c){var d=a.oPreviousSearch,e=a.aoPreSearchCols,f=function(a){d.sSearch=a.sSearch;d.bRegex=a.bRegex;d.bSmart=a.bSmart;d.bCaseInsensitive=a.bCaseInsensitive};Ga(a);if("ssp"!=y(a)){wb(a,b.sSearch,c,b.bEscapeRegex!==k?!b.bEscapeRegex:b.bRegex,b.bSmart,b.bCaseInsensitive);f(b);for(b=0;b<e.length;b++)xb(a,e[b].sSearch,b,e[b].bEscapeRegex!==k?!e[b].bEscapeRegex:e[b].bRegex,
+e[b].bSmart,e[b].bCaseInsensitive);yb(a)}else f(b);a.bFiltered=!0;r(a,null,"search",[a])}function yb(a){for(var b=n.ext.search,c=a.aiDisplay,d,e,f=0,g=b.length;f<g;f++){for(var j=[],i=0,m=c.length;i<m;i++)e=c[i],d=a.aoData[e],b[f](a,d._aFilterData,e,d._aData,i)&&j.push(e);c.length=0;h.merge(c,j)}}function xb(a,b,c,d,e,f){if(""!==b){for(var g=[],j=a.aiDisplay,d=Pa(b,d,e,f),e=0;e<j.length;e++)b=a.aoData[j[e]]._aFilterData[c],d.test(b)&&g.push(j[e]);a.aiDisplay=g}}function wb(a,b,c,d,e,f){var d=Pa(b,
+d,e,f),f=a.oPreviousSearch.sSearch,g=a.aiDisplayMaster,j,e=[];0!==n.ext.search.length&&(c=!0);j=zb(a);if(0>=b.length)a.aiDisplay=g.slice();else{if(j||c||f.length>b.length||0!==b.indexOf(f)||a.bSorted)a.aiDisplay=g.slice();b=a.aiDisplay;for(c=0;c<b.length;c++)d.test(a.aoData[b[c]]._sFilterRow)&&e.push(b[c]);a.aiDisplay=e}}function Pa(a,b,c,d){a=b?a:Qa(a);c&&(a="^(?=.*?"+h.map(a.match(/"[^"]+"|[^ ]+/g)||[""],function(a){if('"'===a.charAt(0))var b=a.match(/^"(.*)"$/),a=b?b[1]:a;return a.replace('"',
+"")}).join(")(?=.*?")+").*$");return RegExp(a,d?"i":"")}function zb(a){var b=a.aoColumns,c,d,e,f,g,j,i,h,l=n.ext.type.search;c=!1;d=0;for(f=a.aoData.length;d<f;d++)if(h=a.aoData[d],!h._aFilterData){j=[];e=0;for(g=b.length;e<g;e++)c=b[e],c.bSearchable?(i=B(a,d,e,"filter"),l[c.sType]&&(i=l[c.sType](i)),null===i&&(i=""),"string"!==typeof i&&i.toString&&(i=i.toString())):i="",i.indexOf&&-1!==i.indexOf("&")&&(va.innerHTML=i,i=Wb?va.textContent:va.innerText),i.replace&&(i=i.replace(/[\r\n]/g,"")),j.push(i);
+h._aFilterData=j;h._sFilterRow=j.join("  ");c=!0}return c}function Ab(a){return{search:a.sSearch,smart:a.bSmart,regex:a.bRegex,caseInsensitive:a.bCaseInsensitive}}function Bb(a){return{sSearch:a.search,bSmart:a.smart,bRegex:a.regex,bCaseInsensitive:a.caseInsensitive}}function sb(a){var b=a.sTableId,c=a.aanFeatures.i,d=h("<div/>",{"class":a.oClasses.sInfo,id:!c?b+"_info":null});c||(a.aoDrawCallback.push({fn:Cb,sName:"information"}),d.attr("role","status").attr("aria-live","polite"),h(a.nTable).attr("aria-describedby",
+b+"_info"));return d[0]}function Cb(a){var b=a.aanFeatures.i;if(0!==b.length){var c=a.oLanguage,d=a._iDisplayStart+1,e=a.fnDisplayEnd(),f=a.fnRecordsTotal(),g=a.fnRecordsDisplay(),j=g?c.sInfo:c.sInfoEmpty;g!==f&&(j+=" "+c.sInfoFiltered);j+=c.sInfoPostFix;j=Db(a,j);c=c.fnInfoCallback;null!==c&&(j=c.call(a.oInstance,a,d,e,f,g,j));h(b).html(j)}}function Db(a,b){var c=a.fnFormatNumber,d=a._iDisplayStart+1,e=a._iDisplayLength,f=a.fnRecordsDisplay(),g=-1===e;return b.replace(/_START_/g,c.call(a,d)).replace(/_END_/g,
+c.call(a,a.fnDisplayEnd())).replace(/_MAX_/g,c.call(a,a.fnRecordsTotal())).replace(/_TOTAL_/g,c.call(a,f)).replace(/_PAGE_/g,c.call(a,g?1:Math.ceil(d/e))).replace(/_PAGES_/g,c.call(a,g?1:Math.ceil(f/e)))}function ha(a){var b,c,d=a.iInitDisplayStart,e=a.aoColumns,f;c=a.oFeatures;var g=a.bDeferLoading;if(a.bInitialised){nb(a);kb(a);fa(a,a.aoHeader);fa(a,a.aoFooter);C(a,!0);c.bAutoWidth&&Fa(a);b=0;for(c=e.length;b<c;b++)f=e[b],f.sWidth&&(f.nTh.style.width=v(f.sWidth));r(a,null,"preInit",[a]);T(a);e=
+y(a);if("ssp"!=e||g)"ajax"==e?sa(a,[],function(c){var f=ta(a,c);for(b=0;b<f.length;b++)O(a,f[b]);a.iInitDisplayStart=d;T(a);C(a,!1);ua(a,c)},a):(C(a,!1),ua(a))}else setTimeout(function(){ha(a)},200)}function ua(a,b){a._bInitComplete=!0;(b||a.oInit.aaData)&&$(a);r(a,null,"plugin-init",[a,b]);r(a,"aoInitComplete","init",[a,b])}function Ra(a,b){var c=parseInt(b,10);a._iDisplayLength=c;Sa(a);r(a,null,"length",[a,c])}function ob(a){for(var b=a.oClasses,c=a.sTableId,d=a.aLengthMenu,e=h.isArray(d[0]),f=
+e?d[0]:d,d=e?d[1]:d,e=h("<select/>",{name:c+"_length","aria-controls":c,"class":b.sLengthSelect}),g=0,j=f.length;g<j;g++)e[0][g]=new Option("number"===typeof d[g]?a.fnFormatNumber(d[g]):d[g],f[g]);var i=h("<div><label/></div>").addClass(b.sLength);a.aanFeatures.l||(i[0].id=c+"_length");i.children().append(a.oLanguage.sLengthMenu.replace("_MENU_",e[0].outerHTML));h("select",i).val(a._iDisplayLength).on("change.DT",function(){Ra(a,h(this).val());P(a)});h(a.nTable).on("length.dt.DT",function(b,c,d){a===
+c&&h("select",i).val(d)});return i[0]}function tb(a){var b=a.sPaginationType,c=n.ext.pager[b],d="function"===typeof c,e=function(a){P(a)},b=h("<div/>").addClass(a.oClasses.sPaging+b)[0],f=a.aanFeatures;d||c.fnInit(a,b,e);f.p||(b.id=a.sTableId+"_paginate",a.aoDrawCallback.push({fn:function(a){if(d){var b=a._iDisplayStart,i=a._iDisplayLength,h=a.fnRecordsDisplay(),l=-1===i,b=l?0:Math.ceil(b/i),i=l?1:Math.ceil(h/i),h=c(b,i),k,l=0;for(k=f.p.length;l<k;l++)Na(a,"pageButton")(a,f.p[l],l,h,b,i)}else c.fnUpdate(a,
+e)},sName:"pagination"}));return b}function Ta(a,b,c){var d=a._iDisplayStart,e=a._iDisplayLength,f=a.fnRecordsDisplay();0===f||-1===e?d=0:"number"===typeof b?(d=b*e,d>f&&(d=0)):"first"==b?d=0:"previous"==b?(d=0<=e?d-e:0,0>d&&(d=0)):"next"==b?d+e<f&&(d+=e):"last"==b?d=Math.floor((f-1)/e)*e:K(a,0,"Unknown paging action: "+b,5);b=a._iDisplayStart!==d;a._iDisplayStart=d;b&&(r(a,null,"page",[a]),c&&P(a));return b}function qb(a){return h("<div/>",{id:!a.aanFeatures.r?a.sTableId+"_processing":null,"class":a.oClasses.sProcessing}).html(a.oLanguage.sProcessing).insertBefore(a.nTable)[0]}
+function C(a,b){a.oFeatures.bProcessing&&h(a.aanFeatures.r).css("display",b?"block":"none");r(a,null,"processing",[a,b])}function rb(a){var b=h(a.nTable);b.attr("role","grid");var c=a.oScroll;if(""===c.sX&&""===c.sY)return a.nTable;var d=c.sX,e=c.sY,f=a.oClasses,g=b.children("caption"),j=g.length?g[0]._captionSide:null,i=h(b[0].cloneNode(!1)),m=h(b[0].cloneNode(!1)),l=b.children("tfoot");l.length||(l=null);i=h("<div/>",{"class":f.sScrollWrapper}).append(h("<div/>",{"class":f.sScrollHead}).css({overflow:"hidden",
+position:"relative",border:0,width:d?!d?null:v(d):"100%"}).append(h("<div/>",{"class":f.sScrollHeadInner}).css({"box-sizing":"content-box",width:c.sXInner||"100%"}).append(i.removeAttr("id").css("margin-left",0).append("top"===j?g:null).append(b.children("thead"))))).append(h("<div/>",{"class":f.sScrollBody}).css({position:"relative",overflow:"auto",width:!d?null:v(d)}).append(b));l&&i.append(h("<div/>",{"class":f.sScrollFoot}).css({overflow:"hidden",border:0,width:d?!d?null:v(d):"100%"}).append(h("<div/>",
+{"class":f.sScrollFootInner}).append(m.removeAttr("id").css("margin-left",0).append("bottom"===j?g:null).append(b.children("tfoot")))));var b=i.children(),k=b[0],f=b[1],t=l?b[2]:null;if(d)h(f).on("scroll.DT",function(){var a=this.scrollLeft;k.scrollLeft=a;l&&(t.scrollLeft=a)});h(f).css(e&&c.bCollapse?"max-height":"height",e);a.nScrollHead=k;a.nScrollBody=f;a.nScrollFoot=t;a.aoDrawCallback.push({fn:la,sName:"scrolling"});return i[0]}function la(a){var b=a.oScroll,c=b.sX,d=b.sXInner,e=b.sY,b=b.iBarWidth,
+f=h(a.nScrollHead),g=f[0].style,j=f.children("div"),i=j[0].style,m=j.children("table"),j=a.nScrollBody,l=h(j),q=j.style,t=h(a.nScrollFoot).children("div"),n=t.children("table"),o=h(a.nTHead),p=h(a.nTable),s=p[0],r=s.style,u=a.nTFoot?h(a.nTFoot):null,x=a.oBrowser,U=x.bScrollOversize,Xb=D(a.aoColumns,"nTh"),Q,L,R,w,Ua=[],y=[],z=[],A=[],B,C=function(a){a=a.style;a.paddingTop="0";a.paddingBottom="0";a.borderTopWidth="0";a.borderBottomWidth="0";a.height=0};L=j.scrollHeight>j.clientHeight;if(a.scrollBarVis!==
+L&&a.scrollBarVis!==k)a.scrollBarVis=L,$(a);else{a.scrollBarVis=L;p.children("thead, tfoot").remove();u&&(R=u.clone().prependTo(p),Q=u.find("tr"),R=R.find("tr"));w=o.clone().prependTo(p);o=o.find("tr");L=w.find("tr");w.find("th, td").removeAttr("tabindex");c||(q.width="100%",f[0].style.width="100%");h.each(ra(a,w),function(b,c){B=aa(a,b);c.style.width=a.aoColumns[B].sWidth});u&&I(function(a){a.style.width=""},R);f=p.outerWidth();if(""===c){r.width="100%";if(U&&(p.find("tbody").height()>j.offsetHeight||
+"scroll"==l.css("overflow-y")))r.width=v(p.outerWidth()-b);f=p.outerWidth()}else""!==d&&(r.width=v(d),f=p.outerWidth());I(C,L);I(function(a){z.push(a.innerHTML);Ua.push(v(h(a).css("width")))},L);I(function(a,b){if(h.inArray(a,Xb)!==-1)a.style.width=Ua[b]},o);h(L).height(0);u&&(I(C,R),I(function(a){A.push(a.innerHTML);y.push(v(h(a).css("width")))},R),I(function(a,b){a.style.width=y[b]},Q),h(R).height(0));I(function(a,b){a.innerHTML='<div class="dataTables_sizing">'+z[b]+"</div>";a.childNodes[0].style.height=
+"0";a.childNodes[0].style.overflow="hidden";a.style.width=Ua[b]},L);u&&I(function(a,b){a.innerHTML='<div class="dataTables_sizing">'+A[b]+"</div>";a.childNodes[0].style.height="0";a.childNodes[0].style.overflow="hidden";a.style.width=y[b]},R);if(p.outerWidth()<f){Q=j.scrollHeight>j.offsetHeight||"scroll"==l.css("overflow-y")?f+b:f;if(U&&(j.scrollHeight>j.offsetHeight||"scroll"==l.css("overflow-y")))r.width=v(Q-b);(""===c||""!==d)&&K(a,1,"Possible column misalignment",6)}else Q="100%";q.width=v(Q);
+g.width=v(Q);u&&(a.nScrollFoot.style.width=v(Q));!e&&U&&(q.height=v(s.offsetHeight+b));c=p.outerWidth();m[0].style.width=v(c);i.width=v(c);d=p.height()>j.clientHeight||"scroll"==l.css("overflow-y");e="padding"+(x.bScrollbarLeft?"Left":"Right");i[e]=d?b+"px":"0px";u&&(n[0].style.width=v(c),t[0].style.width=v(c),t[0].style[e]=d?b+"px":"0px");p.children("colgroup").insertBefore(p.children("thead"));l.scroll();if((a.bSorted||a.bFiltered)&&!a._drawHold)j.scrollTop=0}}function I(a,b,c){for(var d=0,e=0,
+f=b.length,g,j;e<f;){g=b[e].firstChild;for(j=c?c[e].firstChild:null;g;)1===g.nodeType&&(c?a(g,j,d):a(g,d),d++),g=g.nextSibling,j=c?j.nextSibling:null;e++}}function Fa(a){var b=a.nTable,c=a.aoColumns,d=a.oScroll,e=d.sY,f=d.sX,g=d.sXInner,j=c.length,i=ma(a,"bVisible"),m=h("th",a.nTHead),l=b.getAttribute("width"),k=b.parentNode,t=!1,n,o,p=a.oBrowser,d=p.bScrollOversize;(n=b.style.width)&&-1!==n.indexOf("%")&&(l=n);for(n=0;n<i.length;n++)o=c[i[n]],null!==o.sWidth&&(o.sWidth=Eb(o.sWidthOrig,k),t=!0);if(d||
+!t&&!f&&!e&&j==V(a)&&j==m.length)for(n=0;n<j;n++)i=aa(a,n),null!==i&&(c[i].sWidth=v(m.eq(n).width()));else{j=h(b).clone().css("visibility","hidden").removeAttr("id");j.find("tbody tr").remove();var s=h("<tr/>").appendTo(j.find("tbody"));j.find("thead, tfoot").remove();j.append(h(a.nTHead).clone()).append(h(a.nTFoot).clone());j.find("tfoot th, tfoot td").css("width","");m=ra(a,j.find("thead")[0]);for(n=0;n<i.length;n++)o=c[i[n]],m[n].style.width=null!==o.sWidthOrig&&""!==o.sWidthOrig?v(o.sWidthOrig):
+"",o.sWidthOrig&&f&&h(m[n]).append(h("<div/>").css({width:o.sWidthOrig,margin:0,padding:0,border:0,height:1}));if(a.aoData.length)for(n=0;n<i.length;n++)t=i[n],o=c[t],h(Fb(a,t)).clone(!1).append(o.sContentPadding).appendTo(s);h("[name]",j).removeAttr("name");o=h("<div/>").css(f||e?{position:"absolute",top:0,left:0,height:1,right:0,overflow:"hidden"}:{}).append(j).appendTo(k);f&&g?j.width(g):f?(j.css("width","auto"),j.removeAttr("width"),j.width()<k.clientWidth&&l&&j.width(k.clientWidth)):e?j.width(k.clientWidth):
+l&&j.width(l);for(n=e=0;n<i.length;n++)k=h(m[n]),g=k.outerWidth()-k.width(),k=p.bBounding?Math.ceil(m[n].getBoundingClientRect().width):k.outerWidth(),e+=k,c[i[n]].sWidth=v(k-g);b.style.width=v(e);o.remove()}l&&(b.style.width=v(l));if((l||f)&&!a._reszEvt)b=function(){h(E).on("resize.DT-"+a.sInstance,Oa(function(){$(a)}))},d?setTimeout(b,1E3):b(),a._reszEvt=!0}function Eb(a,b){if(!a)return 0;var c=h("<div/>").css("width",v(a)).appendTo(b||H.body),d=c[0].offsetWidth;c.remove();return d}function Fb(a,
+b){var c=Gb(a,b);if(0>c)return null;var d=a.aoData[c];return!d.nTr?h("<td/>").html(B(a,c,b,"display"))[0]:d.anCells[b]}function Gb(a,b){for(var c,d=-1,e=-1,f=0,g=a.aoData.length;f<g;f++)c=B(a,f,b,"display")+"",c=c.replace(Yb,""),c=c.replace(/&nbsp;/g," "),c.length>d&&(d=c.length,e=f);return e}function v(a){return null===a?"0px":"number"==typeof a?0>a?"0px":a+"px":a.match(/\d$/)?a+"px":a}function X(a){var b,c,d=[],e=a.aoColumns,f,g,j,i;b=a.aaSortingFixed;c=h.isPlainObject(b);var m=[];f=function(a){a.length&&
+!h.isArray(a[0])?m.push(a):h.merge(m,a)};h.isArray(b)&&f(b);c&&b.pre&&f(b.pre);f(a.aaSorting);c&&b.post&&f(b.post);for(a=0;a<m.length;a++){i=m[a][0];f=e[i].aDataSort;b=0;for(c=f.length;b<c;b++)g=f[b],j=e[g].sType||"string",m[a]._idx===k&&(m[a]._idx=h.inArray(m[a][1],e[g].asSorting)),d.push({src:i,col:g,dir:m[a][1],index:m[a]._idx,type:j,formatter:n.ext.type.order[j+"-pre"]})}return d}function mb(a){var b,c,d=[],e=n.ext.type.order,f=a.aoData,g=0,j,i=a.aiDisplayMaster,h;Ga(a);h=X(a);b=0;for(c=h.length;b<
+c;b++)j=h[b],j.formatter&&g++,Hb(a,j.col);if("ssp"!=y(a)&&0!==h.length){b=0;for(c=i.length;b<c;b++)d[i[b]]=b;g===h.length?i.sort(function(a,b){var c,e,g,j,i=h.length,k=f[a]._aSortData,n=f[b]._aSortData;for(g=0;g<i;g++)if(j=h[g],c=k[j.col],e=n[j.col],c=c<e?-1:c>e?1:0,0!==c)return"asc"===j.dir?c:-c;c=d[a];e=d[b];return c<e?-1:c>e?1:0}):i.sort(function(a,b){var c,g,j,i,k=h.length,n=f[a]._aSortData,o=f[b]._aSortData;for(j=0;j<k;j++)if(i=h[j],c=n[i.col],g=o[i.col],i=e[i.type+"-"+i.dir]||e["string-"+i.dir],
+c=i(c,g),0!==c)return c;c=d[a];g=d[b];return c<g?-1:c>g?1:0})}a.bSorted=!0}function Ib(a){for(var b,c,d=a.aoColumns,e=X(a),a=a.oLanguage.oAria,f=0,g=d.length;f<g;f++){c=d[f];var j=c.asSorting;b=c.sTitle.replace(/<.*?>/g,"");var i=c.nTh;i.removeAttribute("aria-sort");c.bSortable&&(0<e.length&&e[0].col==f?(i.setAttribute("aria-sort","asc"==e[0].dir?"ascending":"descending"),c=j[e[0].index+1]||j[0]):c=j[0],b+="asc"===c?a.sSortAscending:a.sSortDescending);i.setAttribute("aria-label",b)}}function Va(a,
+b,c,d){var e=a.aaSorting,f=a.aoColumns[b].asSorting,g=function(a,b){var c=a._idx;c===k&&(c=h.inArray(a[1],f));return c+1<f.length?c+1:b?null:0};"number"===typeof e[0]&&(e=a.aaSorting=[e]);c&&a.oFeatures.bSortMulti?(c=h.inArray(b,D(e,"0")),-1!==c?(b=g(e[c],!0),null===b&&1===e.length&&(b=0),null===b?e.splice(c,1):(e[c][1]=f[b],e[c]._idx=b)):(e.push([b,f[0],0]),e[e.length-1]._idx=0)):e.length&&e[0][0]==b?(b=g(e[0]),e.length=1,e[0][1]=f[b],e[0]._idx=b):(e.length=0,e.push([b,f[0]]),e[0]._idx=0);T(a);"function"==
+typeof d&&d(a)}function Ma(a,b,c,d){var e=a.aoColumns[c];Wa(b,{},function(b){!1!==e.bSortable&&(a.oFeatures.bProcessing?(C(a,!0),setTimeout(function(){Va(a,c,b.shiftKey,d);"ssp"!==y(a)&&C(a,!1)},0)):Va(a,c,b.shiftKey,d))})}function wa(a){var b=a.aLastSort,c=a.oClasses.sSortColumn,d=X(a),e=a.oFeatures,f,g;if(e.bSort&&e.bSortClasses){e=0;for(f=b.length;e<f;e++)g=b[e].src,h(D(a.aoData,"anCells",g)).removeClass(c+(2>e?e+1:3));e=0;for(f=d.length;e<f;e++)g=d[e].src,h(D(a.aoData,"anCells",g)).addClass(c+
+(2>e?e+1:3))}a.aLastSort=d}function Hb(a,b){var c=a.aoColumns[b],d=n.ext.order[c.sSortDataType],e;d&&(e=d.call(a.oInstance,a,b,ba(a,b)));for(var f,g=n.ext.type.order[c.sType+"-pre"],j=0,i=a.aoData.length;j<i;j++)if(c=a.aoData[j],c._aSortData||(c._aSortData=[]),!c._aSortData[b]||d)f=d?e[j]:B(a,j,b,"sort"),c._aSortData[b]=g?g(f):f}function xa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),search:Ab(a.oPreviousSearch),
+columns:h.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:Ab(a.aoPreSearchCols[d])}})};r(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,b)}}function Jb(a,b,c){var d,e,f=a.aoColumns,b=function(b){if(b&&b.time){var g=r(a,"aoStateLoadParams","stateLoadParams",[a,b]);if(-1===h.inArray(!1,g)&&(g=a.iStateDuration,!(0<g&&b.time<+new Date-1E3*g)&&!(b.columns&&f.length!==b.columns.length))){a.oLoadedState=h.extend(!0,{},b);b.start!==k&&
+(a._iDisplayStart=b.start,a.iInitDisplayStart=b.start);b.length!==k&&(a._iDisplayLength=b.length);b.order!==k&&(a.aaSorting=[],h.each(b.order,function(b,c){a.aaSorting.push(c[0]>=f.length?[0,c[1]]:c)}));b.search!==k&&h.extend(a.oPreviousSearch,Bb(b.search));if(b.columns){d=0;for(e=b.columns.length;d<e;d++)g=b.columns[d],g.visible!==k&&(f[d].bVisible=g.visible),g.search!==k&&h.extend(a.aoPreSearchCols[d],Bb(g.search))}r(a,"aoStateLoaded","stateLoaded",[a,b])}}c()};if(a.oFeatures.bStateSave){var g=
+a.fnStateLoadCallback.call(a.oInstance,a,b);g!==k&&b(g)}else c()}function ya(a){var b=n.settings,a=h.inArray(a,D(b,"nTable"));return-1!==a?b[a]:null}function K(a,b,c,d){c="DataTables warning: "+(a?"table id="+a.sTableId+" - ":"")+c;d&&(c+=". For more information about this error, please see http://datatables.net/tn/"+d);if(b)E.console&&console.log&&console.log(c);else if(b=n.ext,b=b.sErrMode||b.errMode,a&&r(a,null,"error",[a,d,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==
+typeof b&&b(a,d,c)}}function F(a,b,c,d){h.isArray(c)?h.each(c,function(c,d){h.isArray(d)?F(a,b,d[0],d[1]):F(a,b,d)}):(d===k&&(d=c),b[c]!==k&&(a[d]=b[c]))}function Xa(a,b,c){var d,e;for(e in b)b.hasOwnProperty(e)&&(d=b[e],h.isPlainObject(d)?(h.isPlainObject(a[e])||(a[e]={}),h.extend(!0,a[e],d)):a[e]=c&&"data"!==e&&"aaData"!==e&&h.isArray(d)?d.slice():d);return a}function Wa(a,b,c){h(a).on("click.DT",b,function(b){h(a).blur();c(b)}).on("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).on("selectstart.DT",
+function(){return!1})}function z(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function r(a,b,c,d){var e=[];b&&(e=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=h.Event(c+".dt"),h(a.nTable).trigger(b,d),e.push(b.result));return e}function Sa(a){var b=a._iDisplayStart,c=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Na(a,b){var c=a.renderer,d=n.ext.renderer[b];return h.isPlainObject(c)&&c[b]?d[c[b]]||d._:"string"===
+typeof c?d[c]||d._:d._}function y(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function ia(a,b){var c=[],c=Kb.numbers_length,d=Math.floor(c/2);b<=c?c=Y(0,b):a<=d?(c=Y(0,c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-d?c=Y(b-(c-2),b):(c=Y(a-d+2,a+d-1),c.push("ellipsis"),c.push(b-1)),c.splice(0,0,"ellipsis"),c.splice(0,0,0));c.DT_el="span";return c}function Da(a){h.each({num:function(b){return za(b,a)},"num-fmt":function(b){return za(b,a,Ya)},"html-num":function(b){return za(b,
+a,Aa)},"html-num-fmt":function(b){return za(b,a,Aa,Ya)}},function(b,c){x.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(x.type.search[b+a]=x.type.search.html)})}function Lb(a){return function(){var b=[ya(this[n.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return n.ext.internal[a].apply(this,b)}}var n=function(a){this.$=function(a,b){return this.api(!0).$(a,b)};this._=function(a,b){return this.api(!0).rows(a,b).data()};this.api=function(a){return a?new s(ya(this[x.iApiIndex])):new s(this)};
+this.fnAddData=function(a,b){var c=this.api(!0),d=h.isArray(a)&&(h.isArray(a[0])||h.isPlainObject(a[0]))?c.rows.add(a):c.row.add(a);(b===k||b)&&c.draw();return d.flatten().toArray()};this.fnAdjustColumnSizing=function(a){var b=this.api(!0).columns.adjust(),c=b.settings()[0],d=c.oScroll;a===k||a?b.draw(!1):(""!==d.sX||""!==d.sY)&&la(c)};this.fnClearTable=function(a){var b=this.api(!0).clear();(a===k||a)&&b.draw()};this.fnClose=function(a){this.api(!0).row(a).child.hide()};this.fnDeleteRow=function(a,
+b,c){var d=this.api(!0),a=d.rows(a),e=a.settings()[0],h=e.aoData[a[0][0]];a.remove();b&&b.call(this,e,h);(c===k||c)&&d.draw();return h};this.fnDestroy=function(a){this.api(!0).destroy(a)};this.fnDraw=function(a){this.api(!0).draw(a)};this.fnFilter=function(a,b,c,d,e,h){e=this.api(!0);null===b||b===k?e.search(a,c,d,h):e.column(b).search(a,c,d,h);e.draw()};this.fnGetData=function(a,b){var c=this.api(!0);if(a!==k){var d=a.nodeName?a.nodeName.toLowerCase():"";return b!==k||"td"==d||"th"==d?c.cell(a,b).data():
+c.row(a).data()||null}return c.data().toArray()};this.fnGetNodes=function(a){var b=this.api(!0);return a!==k?b.row(a).node():b.rows().nodes().flatten().toArray()};this.fnGetPosition=function(a){var b=this.api(!0),c=a.nodeName.toUpperCase();return"TR"==c?b.row(a).index():"TD"==c||"TH"==c?(a=b.cell(a).index(),[a.row,a.columnVisible,a.column]):null};this.fnIsOpen=function(a){return this.api(!0).row(a).child.isShown()};this.fnOpen=function(a,b,c){return this.api(!0).row(a).child(b,c).show().child()[0]};
+this.fnPageChange=function(a,b){var c=this.api(!0).page(a);(b===k||b)&&c.draw(!1)};this.fnSetColumnVis=function(a,b,c){a=this.api(!0).column(a).visible(b);(c===k||c)&&a.columns.adjust().draw()};this.fnSettings=function(){return ya(this[x.iApiIndex])};this.fnSort=function(a){this.api(!0).order(a).draw()};this.fnSortListener=function(a,b,c){this.api(!0).order.listener(a,b,c)};this.fnUpdate=function(a,b,c,d,e){var h=this.api(!0);c===k||null===c?h.row(b).data(a):h.cell(b,c).data(a);(e===k||e)&&h.columns.adjust();
+(d===k||d)&&h.draw();return 0};this.fnVersionCheck=x.fnVersionCheck;var b=this,c=a===k,d=this.length;c&&(a={});this.oApi=this.internal=x.internal;for(var e in n.ext.internal)e&&(this[e]=Lb(e));this.each(function(){var e={},g=1<d?Xa(e,a,!0):a,j=0,i,e=this.getAttribute("id"),m=!1,l=n.defaults,q=h(this);if("table"!=this.nodeName.toLowerCase())K(null,0,"Non-table node initialisation ("+this.nodeName+")",2);else{eb(l);fb(l.column);J(l,l,!0);J(l.column,l.column,!0);J(l,h.extend(g,q.data()));var t=n.settings,
+j=0;for(i=t.length;j<i;j++){var o=t[j];if(o.nTable==this||o.nTHead&&o.nTHead.parentNode==this||o.nTFoot&&o.nTFoot.parentNode==this){var s=g.bRetrieve!==k?g.bRetrieve:l.bRetrieve;if(c||s)return o.oInstance;if(g.bDestroy!==k?g.bDestroy:l.bDestroy){o.oInstance.fnDestroy();break}else{K(o,0,"Cannot reinitialise DataTable",3);return}}if(o.sTableId==this.id){t.splice(j,1);break}}if(null===e||""===e)this.id=e="DataTables_Table_"+n.ext._unique++;var p=h.extend(!0,{},n.models.oSettings,{sDestroyWidth:q[0].style.width,
+sInstance:e,sTableId:e});p.nTable=this;p.oApi=b.internal;p.oInit=g;t.push(p);p.oInstance=1===b.length?b:q.dataTable();eb(g);Ca(g.oLanguage);g.aLengthMenu&&!g.iDisplayLength&&(g.iDisplayLength=h.isArray(g.aLengthMenu[0])?g.aLengthMenu[0][0]:g.aLengthMenu[0]);g=Xa(h.extend(!0,{},l),g);F(p.oFeatures,g,"bPaginate bLengthChange bFilter bSort bSortMulti bInfo bProcessing bAutoWidth bSortClasses bServerSide bDeferRender".split(" "));F(p,g,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod",
+"aaSorting","aaSortingFixed","aLengthMenu","sPaginationType","sAjaxSource","sAjaxDataProp","iStateDuration","sDom","bSortCellsTop","iTabIndex","fnStateLoadCallback","fnStateSaveCallback","renderer","searchDelay","rowId",["iCookieDuration","iStateDuration"],["oSearch","oPreviousSearch"],["aoSearchCols","aoPreSearchCols"],["iDisplayLength","_iDisplayLength"]]);F(p.oScroll,g,[["sScrollX","sX"],["sScrollXInner","sXInner"],["sScrollY","sY"],["bScrollCollapse","bCollapse"]]);F(p.oLanguage,g,"fnInfoCallback");
+z(p,"aoDrawCallback",g.fnDrawCallback,"user");z(p,"aoServerParams",g.fnServerParams,"user");z(p,"aoStateSaveParams",g.fnStateSaveParams,"user");z(p,"aoStateLoadParams",g.fnStateLoadParams,"user");z(p,"aoStateLoaded",g.fnStateLoaded,"user");z(p,"aoRowCallback",g.fnRowCallback,"user");z(p,"aoRowCreatedCallback",g.fnCreatedRow,"user");z(p,"aoHeaderCallback",g.fnHeaderCallback,"user");z(p,"aoFooterCallback",g.fnFooterCallback,"user");z(p,"aoInitComplete",g.fnInitComplete,"user");z(p,"aoPreDrawCallback",
+g.fnPreDrawCallback,"user");p.rowIdFn=S(g.rowId);gb(p);var u=p.oClasses;h.extend(u,n.ext.classes,g.oClasses);q.addClass(u.sTable);p.iInitDisplayStart===k&&(p.iInitDisplayStart=g.iDisplayStart,p._iDisplayStart=g.iDisplayStart);null!==g.iDeferLoading&&(p.bDeferLoading=!0,e=h.isArray(g.iDeferLoading),p._iRecordsDisplay=e?g.iDeferLoading[0]:g.iDeferLoading,p._iRecordsTotal=e?g.iDeferLoading[1]:g.iDeferLoading);var v=p.oLanguage;h.extend(!0,v,g.oLanguage);v.sUrl&&(h.ajax({dataType:"json",url:v.sUrl,success:function(a){Ca(a);
+J(l.oLanguage,a);h.extend(true,v,a);ha(p)},error:function(){ha(p)}}),m=!0);null===g.asStripeClasses&&(p.asStripeClasses=[u.sStripeOdd,u.sStripeEven]);var e=p.asStripeClasses,x=q.children("tbody").find("tr").eq(0);-1!==h.inArray(!0,h.map(e,function(a){return x.hasClass(a)}))&&(h("tbody tr",this).removeClass(e.join(" ")),p.asDestroyStripes=e.slice());e=[];t=this.getElementsByTagName("thead");0!==t.length&&(ea(p.aoHeader,t[0]),e=ra(p));if(null===g.aoColumns){t=[];j=0;for(i=e.length;j<i;j++)t.push(null)}else t=
+g.aoColumns;j=0;for(i=t.length;j<i;j++)Ea(p,e?e[j]:null);ib(p,g.aoColumnDefs,t,function(a,b){ka(p,a,b)});if(x.length){var w=function(a,b){return a.getAttribute("data-"+b)!==null?b:null};h(x[0]).children("th, td").each(function(a,b){var c=p.aoColumns[a];if(c.mData===a){var d=w(b,"sort")||w(b,"order"),e=w(b,"filter")||w(b,"search");if(d!==null||e!==null){c.mData={_:a+".display",sort:d!==null?a+".@data-"+d:k,type:d!==null?a+".@data-"+d:k,filter:e!==null?a+".@data-"+e:k};ka(p,a)}}})}var U=p.oFeatures,
+e=function(){if(g.aaSorting===k){var a=p.aaSorting;j=0;for(i=a.length;j<i;j++)a[j][1]=p.aoColumns[j].asSorting[0]}wa(p);U.bSort&&z(p,"aoDrawCallback",function(){if(p.bSorted){var a=X(p),b={};h.each(a,function(a,c){b[c.src]=c.dir});r(p,null,"order",[p,a,b]);Ib(p)}});z(p,"aoDrawCallback",function(){(p.bSorted||y(p)==="ssp"||U.bDeferRender)&&wa(p)},"sc");var a=q.children("caption").each(function(){this._captionSide=h(this).css("caption-side")}),b=q.children("thead");b.length===0&&(b=h("<thead/>").appendTo(q));
+p.nTHead=b[0];b=q.children("tbody");b.length===0&&(b=h("<tbody/>").appendTo(q));p.nTBody=b[0];b=q.children("tfoot");if(b.length===0&&a.length>0&&(p.oScroll.sX!==""||p.oScroll.sY!==""))b=h("<tfoot/>").appendTo(q);if(b.length===0||b.children().length===0)q.addClass(u.sNoFooter);else if(b.length>0){p.nTFoot=b[0];ea(p.aoFooter,p.nTFoot)}if(g.aaData)for(j=0;j<g.aaData.length;j++)O(p,g.aaData[j]);else(p.bDeferLoading||y(p)=="dom")&&na(p,h(p.nTBody).children("tr"));p.aiDisplay=p.aiDisplayMaster.slice();
+p.bInitialised=true;m===false&&ha(p)};g.bStateSave?(U.bStateSave=!0,z(p,"aoDrawCallback",xa,"state_save"),Jb(p,g,e)):e()}});b=null;return this},x,s,o,u,Za={},Mb=/[\r\n]/g,Aa=/<.*?>/g,Zb=/^\d{2,4}[\.\/\-]\d{1,2}[\.\/\-]\d{1,2}([T ]{1}\d{1,2}[:\.]\d{2}([\.:]\d{2})?)?$/,$b=RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^|\\-)","g"),Ya=/[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi,M=function(a){return!a||!0===a||"-"===a?!0:!1},Nb=function(a){var b=parseInt(a,10);return!isNaN(b)&&
+isFinite(a)?b:null},Ob=function(a,b){Za[b]||(Za[b]=RegExp(Qa(b),"g"));return"string"===typeof a&&"."!==b?a.replace(/\./g,"").replace(Za[b],"."):a},$a=function(a,b,c){var d="string"===typeof a;if(M(a))return!0;b&&d&&(a=Ob(a,b));c&&d&&(a=a.replace(Ya,""));return!isNaN(parseFloat(a))&&isFinite(a)},Pb=function(a,b,c){return M(a)?!0:!(M(a)||"string"===typeof a)?null:$a(a.replace(Aa,""),b,c)?!0:null},D=function(a,b,c){var d=[],e=0,f=a.length;if(c!==k)for(;e<f;e++)a[e]&&a[e][b]&&d.push(a[e][b][c]);else for(;e<
+f;e++)a[e]&&d.push(a[e][b]);return d},ja=function(a,b,c,d){var e=[],f=0,g=b.length;if(d!==k)for(;f<g;f++)a[b[f]][c]&&e.push(a[b[f]][c][d]);else for(;f<g;f++)e.push(a[b[f]][c]);return e},Y=function(a,b){var c=[],d;b===k?(b=0,d=a):(d=b,b=a);for(var e=b;e<d;e++)c.push(e);return c},Qb=function(a){for(var b=[],c=0,d=a.length;c<d;c++)a[c]&&b.push(a[c]);return b},qa=function(a){var b;a:{if(!(2>a.length)){b=a.slice().sort();for(var c=b[0],d=1,e=b.length;d<e;d++){if(b[d]===c){b=!1;break a}c=b[d]}}b=!0}if(b)return a.slice();
+b=[];var e=a.length,f,g=0,d=0;a:for(;d<e;d++){c=a[d];for(f=0;f<g;f++)if(b[f]===c)continue a;b.push(c);g++}return b};n.util={throttle:function(a,b){var c=b!==k?b:200,d,e;return function(){var b=this,g=+new Date,j=arguments;d&&g<d+c?(clearTimeout(e),e=setTimeout(function(){d=k;a.apply(b,j)},c)):(d=g,a.apply(b,j))}},escapeRegex:function(a){return a.replace($b,"\\$1")}};var A=function(a,b,c){a[b]!==k&&(a[c]=a[b])},ca=/\[.*?\]$/,W=/\(\)$/,Qa=n.util.escapeRegex,va=h("<div>")[0],Wb=va.textContent!==k,Yb=
+/<.*?>/g,Oa=n.util.throttle,Rb=[],w=Array.prototype,ac=function(a){var b,c,d=n.settings,e=h.map(d,function(a){return a.nTable});if(a){if(a.nTable&&a.oApi)return[a];if(a.nodeName&&"table"===a.nodeName.toLowerCase())return b=h.inArray(a,e),-1!==b?[d[b]]:null;if(a&&"function"===typeof a.settings)return a.settings().toArray();"string"===typeof a?c=h(a):a instanceof h&&(c=a)}else return[];if(c)return c.map(function(){b=h.inArray(this,e);return-1!==b?d[b]:null}).toArray()};s=function(a,b){if(!(this instanceof
+s))return new s(a,b);var c=[],d=function(a){(a=ac(a))&&(c=c.concat(a))};if(h.isArray(a))for(var e=0,f=a.length;e<f;e++)d(a[e]);else d(a);this.context=qa(c);b&&h.merge(this,b);this.selector={rows:null,cols:null,opts:null};s.extend(this,this,Rb)};n.Api=s;h.extend(s.prototype,{any:function(){return 0!==this.count()},concat:w.concat,context:[],count:function(){return this.flatten().length},each:function(a){for(var b=0,c=this.length;b<c;b++)a.call(this,this[b],b,this);return this},eq:function(a){var b=
+this.context;return b.length>a?new s(b[a],this[a]):null},filter:function(a){var b=[];if(w.filter)b=w.filter.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)a.call(this,this[c],c,this)&&b.push(this[c]);return new s(this.context,b)},flatten:function(){var a=[];return new s(this.context,a.concat.apply(a,this.toArray()))},join:w.join,indexOf:w.indexOf||function(a,b){for(var c=b||0,d=this.length;c<d;c++)if(this[c]===a)return c;return-1},iterator:function(a,b,c,d){var e=[],f,g,j,h,m,l=this.context,
+n,o,u=this.selector;"string"===typeof a&&(d=c,c=b,b=a,a=!1);g=0;for(j=l.length;g<j;g++){var r=new s(l[g]);if("table"===b)f=c.call(r,l[g],g),f!==k&&e.push(f);else if("columns"===b||"rows"===b)f=c.call(r,l[g],this[g],g),f!==k&&e.push(f);else if("column"===b||"column-rows"===b||"row"===b||"cell"===b){o=this[g];"column-rows"===b&&(n=Ba(l[g],u.opts));h=0;for(m=o.length;h<m;h++)f=o[h],f="cell"===b?c.call(r,l[g],f.row,f.column,g,h):c.call(r,l[g],f,g,h,n),f!==k&&e.push(f)}}return e.length||d?(a=new s(l,a?
+e.concat.apply([],e):e),b=a.selector,b.rows=u.rows,b.cols=u.cols,b.opts=u.opts,a):this},lastIndexOf:w.lastIndexOf||function(a,b){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(a){var b=[];if(w.map)b=w.map.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)b.push(a.call(this,this[c],c));return new s(this.context,b)},pluck:function(a){return this.map(function(b){return b[a]})},pop:w.pop,push:w.push,reduce:w.reduce||function(a,b){return hb(this,a,b,0,this.length,
+1)},reduceRight:w.reduceRight||function(a,b){return hb(this,a,b,this.length-1,-1,-1)},reverse:w.reverse,selector:null,shift:w.shift,slice:function(){return new s(this.context,this)},sort:w.sort,splice:w.splice,toArray:function(){return w.slice.call(this)},to$:function(){return h(this)},toJQuery:function(){return h(this)},unique:function(){return new s(this.context,qa(this))},unshift:w.unshift});s.extend=function(a,b,c){if(c.length&&b&&(b instanceof s||b.__dt_wrapper)){var d,e,f,g=function(a,b,c){return function(){var d=
+b.apply(a,arguments);s.extend(d,d,c.methodExt);return d}};d=0;for(e=c.length;d<e;d++)f=c[d],b[f.name]="function"===typeof f.val?g(a,f.val,f):h.isPlainObject(f.val)?{}:f.val,b[f.name].__dt_wrapper=!0,s.extend(a,b[f.name],f.propExt)}};s.register=o=function(a,b){if(h.isArray(a))for(var c=0,d=a.length;c<d;c++)s.register(a[c],b);else for(var e=a.split("."),f=Rb,g,j,c=0,d=e.length;c<d;c++){g=(j=-1!==e[c].indexOf("()"))?e[c].replace("()",""):e[c];var i;a:{i=0;for(var m=f.length;i<m;i++)if(f[i].name===g){i=
+f[i];break a}i=null}i||(i={name:g,val:{},methodExt:[],propExt:[]},f.push(i));c===d-1?i.val=b:f=j?i.methodExt:i.propExt}};s.registerPlural=u=function(a,b,c){s.register(a,c);s.register(b,function(){var a=c.apply(this,arguments);return a===this?this:a instanceof s?a.length?h.isArray(a[0])?new s(a.context,a[0]):a[0]:k:a})};o("tables()",function(a){var b;if(a){b=s;var c=this.context;if("number"===typeof a)a=[c[a]];else var d=h.map(c,function(a){return a.nTable}),a=h(d).filter(a).map(function(){var a=h.inArray(this,
+d);return c[a]}).toArray();b=new b(a)}else b=this;return b});o("table()",function(a){var a=this.tables(a),b=a.context;return b.length?new s(b[0]):a});u("tables().nodes()","table().node()",function(){return this.iterator("table",function(a){return a.nTable},1)});u("tables().body()","table().body()",function(){return this.iterator("table",function(a){return a.nTBody},1)});u("tables().header()","table().header()",function(){return this.iterator("table",function(a){return a.nTHead},1)});u("tables().footer()",
+"table().footer()",function(){return this.iterator("table",function(a){return a.nTFoot},1)});u("tables().containers()","table().container()",function(){return this.iterator("table",function(a){return a.nTableWrapper},1)});o("draw()",function(a){return this.iterator("table",function(b){"page"===a?P(b):("string"===typeof a&&(a="full-hold"===a?!1:!0),T(b,!1===a))})});o("page()",function(a){return a===k?this.page.info().page:this.iterator("table",function(b){Ta(b,a)})});o("page.info()",function(){if(0===
+this.context.length)return k;var a=this.context[0],b=a._iDisplayStart,c=a.oFeatures.bPaginate?a._iDisplayLength:-1,d=a.fnRecordsDisplay(),e=-1===c;return{page:e?0:Math.floor(b/c),pages:e?1:Math.ceil(d/c),start:b,end:a.fnDisplayEnd(),length:c,recordsTotal:a.fnRecordsTotal(),recordsDisplay:d,serverSide:"ssp"===y(a)}});o("page.len()",function(a){return a===k?0!==this.context.length?this.context[0]._iDisplayLength:k:this.iterator("table",function(b){Ra(b,a)})});var Sb=function(a,b,c){if(c){var d=new s(a);
+d.one("draw",function(){c(d.ajax.json())})}if("ssp"==y(a))T(a,b);else{C(a,!0);var e=a.jqXHR;e&&4!==e.readyState&&e.abort();sa(a,[],function(c){oa(a);for(var c=ta(a,c),d=0,e=c.length;d<e;d++)O(a,c[d]);T(a,b);C(a,!1)})}};o("ajax.json()",function(){var a=this.context;if(0<a.length)return a[0].json});o("ajax.params()",function(){var a=this.context;if(0<a.length)return a[0].oAjaxData});o("ajax.reload()",function(a,b){return this.iterator("table",function(c){Sb(c,!1===b,a)})});o("ajax.url()",function(a){var b=
+this.context;if(a===k){if(0===b.length)return k;b=b[0];return b.ajax?h.isPlainObject(b.ajax)?b.ajax.url:b.ajax:b.sAjaxSource}return this.iterator("table",function(b){h.isPlainObject(b.ajax)?b.ajax.url=a:b.ajax=a})});o("ajax.url().load()",function(a,b){return this.iterator("table",function(c){Sb(c,!1===b,a)})});var ab=function(a,b,c,d,e){var f=[],g,j,i,m,l,n;i=typeof b;if(!b||"string"===i||"function"===i||b.length===k)b=[b];i=0;for(m=b.length;i<m;i++){j=b[i]&&b[i].split&&!b[i].match(/[\[\(:]/)?b[i].split(","):
+[b[i]];l=0;for(n=j.length;l<n;l++)(g=c("string"===typeof j[l]?h.trim(j[l]):j[l]))&&g.length&&(f=f.concat(g))}a=x.selector[a];if(a.length){i=0;for(m=a.length;i<m;i++)f=a[i](d,e,f)}return qa(f)},bb=function(a){a||(a={});a.filter&&a.search===k&&(a.search=a.filter);return h.extend({search:"none",order:"current",page:"all"},a)},cb=function(a){for(var b=0,c=a.length;b<c;b++)if(0<a[b].length)return a[0]=a[b],a[0].length=1,a.length=1,a.context=[a.context[b]],a;a.length=0;return a},Ba=function(a,b){var c,
+d,e,f=[],g=a.aiDisplay;e=a.aiDisplayMaster;var j=b.search;c=b.order;d=b.page;if("ssp"==y(a))return"removed"===j?[]:Y(0,e.length);if("current"==d){c=a._iDisplayStart;for(d=a.fnDisplayEnd();c<d;c++)f.push(g[c])}else if("current"==c||"applied"==c)if("none"==j)f=e.slice();else if("applied"==j)f=g.slice();else{if("removed"==j){var i={};c=0;for(d=g.length;c<d;c++)i[g[c]]=null;f=h.map(e,function(a){return!i.hasOwnProperty(a)?a:null})}}else if("index"==c||"original"==c){c=0;for(d=a.aoData.length;c<d;c++)"none"==
+j?f.push(c):(e=h.inArray(c,g),(-1===e&&"removed"==j||0<=e&&"applied"==j)&&f.push(c))}return f};o("rows()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=bb(b),c=this.iterator("table",function(c){var e=b,f;return ab("row",a,function(a){var b=Nb(a),i=c.aoData;if(b!==null&&!e)return[b];f||(f=Ba(c,e));if(b!==null&&h.inArray(b,f)!==-1)return[b];if(a===null||a===k||a==="")return f;if(typeof a==="function")return h.map(f,function(b){var c=i[b];return a(b,c._aData,c.nTr)?b:null});if(a.nodeName){var b=
+a._DT_RowIndex,m=a._DT_CellIndex;if(b!==k)return i[b]&&i[b].nTr===a?[b]:[];if(m)return i[m.row]&&i[m.row].nTr===a?[m.row]:[];b=h(a).closest("*[data-dt-row]");return b.length?[b.data("dt-row")]:[]}if(typeof a==="string"&&a.charAt(0)==="#"){b=c.aIds[a.replace(/^#/,"")];if(b!==k)return[b.idx]}b=Qb(ja(c.aoData,f,"nTr"));return h(b).filter(a).map(function(){return this._DT_RowIndex}).toArray()},c,e)},1);c.selector.rows=a;c.selector.opts=b;return c});o("rows().nodes()",function(){return this.iterator("row",
+function(a,b){return a.aoData[b].nTr||k},1)});o("rows().data()",function(){return this.iterator(!0,"rows",function(a,b){return ja(a.aoData,b,"_aData")},1)});u("rows().cache()","row().cache()",function(a){return this.iterator("row",function(b,c){var d=b.aoData[c];return"search"===a?d._aFilterData:d._aSortData},1)});u("rows().invalidate()","row().invalidate()",function(a){return this.iterator("row",function(b,c){da(b,c,a)})});u("rows().indexes()","row().index()",function(){return this.iterator("row",
+function(a,b){return b},1)});u("rows().ids()","row().id()",function(a){for(var b=[],c=this.context,d=0,e=c.length;d<e;d++)for(var f=0,g=this[d].length;f<g;f++){var h=c[d].rowIdFn(c[d].aoData[this[d][f]]._aData);b.push((!0===a?"#":"")+h)}return new s(c,b)});u("rows().remove()","row().remove()",function(){var a=this;this.iterator("row",function(b,c,d){var e=b.aoData,f=e[c],g,h,i,m,l;e.splice(c,1);g=0;for(h=e.length;g<h;g++)if(i=e[g],l=i.anCells,null!==i.nTr&&(i.nTr._DT_RowIndex=g),null!==l){i=0;for(m=
+l.length;i<m;i++)l[i]._DT_CellIndex.row=g}pa(b.aiDisplayMaster,c);pa(b.aiDisplay,c);pa(a[d],c,!1);0<b._iRecordsDisplay&&b._iRecordsDisplay--;Sa(b);c=b.rowIdFn(f._aData);c!==k&&delete b.aIds[c]});this.iterator("table",function(a){for(var c=0,d=a.aoData.length;c<d;c++)a.aoData[c].idx=c});return this});o("rows.add()",function(a){var b=this.iterator("table",function(b){var c,f,g,h=[];f=0;for(g=a.length;f<g;f++)c=a[f],c.nodeName&&"TR"===c.nodeName.toUpperCase()?h.push(na(b,c)[0]):h.push(O(b,c));return h},
+1),c=this.rows(-1);c.pop();h.merge(c,b);return c});o("row()",function(a,b){return cb(this.rows(a,b))});o("row().data()",function(a){var b=this.context;if(a===k)return b.length&&this.length?b[0].aoData[this[0]]._aData:k;var c=b[0].aoData[this[0]];c._aData=a;h.isArray(a)&&c.nTr.id&&N(b[0].rowId)(a,c.nTr.id);da(b[0],this[0],"data");return this});o("row().node()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]].nTr||null:null});o("row.add()",function(a){a instanceof h&&
+a.length&&(a=a[0]);var b=this.iterator("table",function(b){return a.nodeName&&"TR"===a.nodeName.toUpperCase()?na(b,a)[0]:O(b,a)});return this.row(b[0])});var db=function(a,b){var c=a.context;if(c.length&&(c=c[0].aoData[b!==k?b:a[0]])&&c._details)c._details.remove(),c._detailsShow=k,c._details=k},Tb=function(a,b){var c=a.context;if(c.length&&a.length){var d=c[0].aoData[a[0]];if(d._details){(d._detailsShow=b)?d._details.insertAfter(d.nTr):d._details.detach();var e=c[0],f=new s(e),g=e.aoData;f.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details");
+0<D(g,"_details").length&&(f.on("draw.dt.DT_details",function(a,b){e===b&&f.rows({page:"current"}).eq(0).each(function(a){a=g[a];a._detailsShow&&a._details.insertAfter(a.nTr)})}),f.on("column-visibility.dt.DT_details",function(a,b){if(e===b)for(var c,d=V(b),f=0,h=g.length;f<h;f++)c=g[f],c._details&&c._details.children("td[colspan]").attr("colspan",d)}),f.on("destroy.dt.DT_details",function(a,b){if(e===b)for(var c=0,d=g.length;c<d;c++)g[c]._details&&db(f,c)}))}}};o("row().child()",function(a,b){var c=
+this.context;if(a===k)return c.length&&this.length?c[0].aoData[this[0]]._details:k;if(!0===a)this.child.show();else if(!1===a)db(this);else if(c.length&&this.length){var d=c[0],c=c[0].aoData[this[0]],e=[],f=function(a,b){if(h.isArray(a)||a instanceof h)for(var c=0,k=a.length;c<k;c++)f(a[c],b);else a.nodeName&&"tr"===a.nodeName.toLowerCase()?e.push(a):(c=h("<tr><td/></tr>").addClass(b),h("td",c).addClass(b).html(a)[0].colSpan=V(d),e.push(c[0]))};f(a,b);c._details&&c._details.detach();c._details=h(e);
+c._detailsShow&&c._details.insertAfter(c.nTr)}return this});o(["row().child.show()","row().child().show()"],function(){Tb(this,!0);return this});o(["row().child.hide()","row().child().hide()"],function(){Tb(this,!1);return this});o(["row().child.remove()","row().child().remove()"],function(){db(this);return this});o("row().child.isShown()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]]._detailsShow||!1:!1});var bc=/^([^:]+):(name|visIdx|visible)$/,Ub=function(a,b,
+c,d,e){for(var c=[],d=0,f=e.length;d<f;d++)c.push(B(a,e[d],b));return c};o("columns()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=bb(b),c=this.iterator("table",function(c){var e=a,f=b,g=c.aoColumns,j=D(g,"sName"),i=D(g,"nTh");return ab("column",e,function(a){var b=Nb(a);if(a==="")return Y(g.length);if(b!==null)return[b>=0?b:g.length+b];if(typeof a==="function"){var e=Ba(c,f);return h.map(g,function(b,f){return a(f,Ub(c,f,0,0,e),i[f])?f:null})}var k=typeof a==="string"?a.match(bc):
+"";if(k)switch(k[2]){case "visIdx":case "visible":b=parseInt(k[1],10);if(b<0){var n=h.map(g,function(a,b){return a.bVisible?b:null});return[n[n.length+b]]}return[aa(c,b)];case "name":return h.map(j,function(a,b){return a===k[1]?b:null});default:return[]}if(a.nodeName&&a._DT_CellIndex)return[a._DT_CellIndex.column];b=h(i).filter(a).map(function(){return h.inArray(this,i)}).toArray();if(b.length||!a.nodeName)return b;b=h(a).closest("*[data-dt-column]");return b.length?[b.data("dt-column")]:[]},c,f)},
+1);c.selector.cols=a;c.selector.opts=b;return c});u("columns().header()","column().header()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTh},1)});u("columns().footer()","column().footer()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTf},1)});u("columns().data()","column().data()",function(){return this.iterator("column-rows",Ub,1)});u("columns().dataSrc()","column().dataSrc()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].mData},
+1)});u("columns().cache()","column().cache()",function(a){return this.iterator("column-rows",function(b,c,d,e,f){return ja(b.aoData,f,"search"===a?"_aFilterData":"_aSortData",c)},1)});u("columns().nodes()","column().nodes()",function(){return this.iterator("column-rows",function(a,b,c,d,e){return ja(a.aoData,e,"anCells",b)},1)});u("columns().visible()","column().visible()",function(a,b){var c=this.iterator("column",function(b,c){if(a===k)return b.aoColumns[c].bVisible;var f=b.aoColumns,g=f[c],j=b.aoData,
+i,m,l;if(a!==k&&g.bVisible!==a){if(a){var n=h.inArray(!0,D(f,"bVisible"),c+1);i=0;for(m=j.length;i<m;i++)l=j[i].nTr,f=j[i].anCells,l&&l.insertBefore(f[c],f[n]||null)}else h(D(b.aoData,"anCells",c)).detach();g.bVisible=a;fa(b,b.aoHeader);fa(b,b.aoFooter);b.aiDisplay.length||h(b.nTBody).find("td[colspan]").attr("colspan",V(b));xa(b)}});a!==k&&(this.iterator("column",function(c,e){r(c,null,"column-visibility",[c,e,a,b])}),(b===k||b)&&this.columns.adjust());return c});u("columns().indexes()","column().index()",
+function(a){return this.iterator("column",function(b,c){return"visible"===a?ba(b,c):c},1)});o("columns.adjust()",function(){return this.iterator("table",function(a){$(a)},1)});o("column.index()",function(a,b){if(0!==this.context.length){var c=this.context[0];if("fromVisible"===a||"toData"===a)return aa(c,b);if("fromData"===a||"toVisible"===a)return ba(c,b)}});o("column()",function(a,b){return cb(this.columns(a,b))});o("cells()",function(a,b,c){h.isPlainObject(a)&&(a.row===k?(c=a,a=null):(c=b,b=null));
+h.isPlainObject(b)&&(c=b,b=null);if(null===b||b===k)return this.iterator("table",function(b){var d=a,e=bb(c),f=b.aoData,g=Ba(b,e),j=Qb(ja(f,g,"anCells")),i=h([].concat.apply([],j)),l,m=b.aoColumns.length,n,o,u,s,r,v;return ab("cell",d,function(a){var c=typeof a==="function";if(a===null||a===k||c){n=[];o=0;for(u=g.length;o<u;o++){l=g[o];for(s=0;s<m;s++){r={row:l,column:s};if(c){v=f[l];a(r,B(b,l,s),v.anCells?v.anCells[s]:null)&&n.push(r)}else n.push(r)}}return n}if(h.isPlainObject(a))return a.column!==
+k&&a.row!==k&&h.inArray(a.row,g)!==-1?[a]:[];c=i.filter(a).map(function(a,b){return{row:b._DT_CellIndex.row,column:b._DT_CellIndex.column}}).toArray();if(c.length||!a.nodeName)return c;v=h(a).closest("*[data-dt-row]");return v.length?[{row:v.data("dt-row"),column:v.data("dt-column")}]:[]},b,e)});var d=this.columns(b),e=this.rows(a),f,g,j,i,m;this.iterator("table",function(a,b){f=[];g=0;for(j=e[b].length;g<j;g++){i=0;for(m=d[b].length;i<m;i++)f.push({row:e[b][g],column:d[b][i]})}},1);var l=this.cells(f,
+c);h.extend(l.selector,{cols:b,rows:a,opts:c});return l});u("cells().nodes()","cell().node()",function(){return this.iterator("cell",function(a,b,c){return(a=a.aoData[b])&&a.anCells?a.anCells[c]:k},1)});o("cells().data()",function(){return this.iterator("cell",function(a,b,c){return B(a,b,c)},1)});u("cells().cache()","cell().cache()",function(a){a="search"===a?"_aFilterData":"_aSortData";return this.iterator("cell",function(b,c,d){return b.aoData[c][a][d]},1)});u("cells().render()","cell().render()",
+function(a){return this.iterator("cell",function(b,c,d){return B(b,c,d,a)},1)});u("cells().indexes()","cell().index()",function(){return this.iterator("cell",function(a,b,c){return{row:b,column:c,columnVisible:ba(a,c)}},1)});u("cells().invalidate()","cell().invalidate()",function(a){return this.iterator("cell",function(b,c,d){da(b,c,a,d)})});o("cell()",function(a,b,c){return cb(this.cells(a,b,c))});o("cell().data()",function(a){var b=this.context,c=this[0];if(a===k)return b.length&&c.length?B(b[0],
+c[0].row,c[0].column):k;jb(b[0],c[0].row,c[0].column,a);da(b[0],c[0].row,"data",c[0].column);return this});o("order()",function(a,b){var c=this.context;if(a===k)return 0!==c.length?c[0].aaSorting:k;"number"===typeof a?a=[[a,b]]:a.length&&!h.isArray(a[0])&&(a=Array.prototype.slice.call(arguments));return this.iterator("table",function(b){b.aaSorting=a.slice()})});o("order.listener()",function(a,b,c){return this.iterator("table",function(d){Ma(d,a,b,c)})});o("order.fixed()",function(a){if(!a){var b=
+this.context,b=b.length?b[0].aaSortingFixed:k;return h.isArray(b)?{pre:b}:b}return this.iterator("table",function(b){b.aaSortingFixed=h.extend(!0,{},a)})});o(["columns().order()","column().order()"],function(a){var b=this;return this.iterator("table",function(c,d){var e=[];h.each(b[d],function(b,c){e.push([c,a])});c.aaSorting=e})});o("search()",function(a,b,c,d){var e=this.context;return a===k?0!==e.length?e[0].oPreviousSearch.sSearch:k:this.iterator("table",function(e){e.oFeatures.bFilter&&ga(e,
+h.extend({},e.oPreviousSearch,{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),1)})});u("columns().search()","column().search()",function(a,b,c,d){return this.iterator("column",function(e,f){var g=e.aoPreSearchCols;if(a===k)return g[f].sSearch;e.oFeatures.bFilter&&(h.extend(g[f],{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),ga(e,e.oPreviousSearch,1))})});o("state()",function(){return this.context.length?this.context[0].oSavedState:
+null});o("state.clear()",function(){return this.iterator("table",function(a){a.fnStateSaveCallback.call(a.oInstance,a,{})})});o("state.loaded()",function(){return this.context.length?this.context[0].oLoadedState:null});o("state.save()",function(){return this.iterator("table",function(a){xa(a)})});n.versionCheck=n.fnVersionCheck=function(a){for(var b=n.version.split("."),a=a.split("."),c,d,e=0,f=a.length;e<f;e++)if(c=parseInt(b[e],10)||0,d=parseInt(a[e],10)||0,c!==d)return c>d;return!0};n.isDataTable=
+n.fnIsDataTable=function(a){var b=h(a).get(0),c=!1;if(a instanceof n.Api)return!0;h.each(n.settings,function(a,e){var f=e.nScrollHead?h("table",e.nScrollHead)[0]:null,g=e.nScrollFoot?h("table",e.nScrollFoot)[0]:null;if(e.nTable===b||f===b||g===b)c=!0});return c};n.tables=n.fnTables=function(a){var b=!1;h.isPlainObject(a)&&(b=a.api,a=a.visible);var c=h.map(n.settings,function(b){if(!a||a&&h(b.nTable).is(":visible"))return b.nTable});return b?new s(c):c};n.camelToHungarian=J;o("$()",function(a,b){var c=
+this.rows(b).nodes(),c=h(c);return h([].concat(c.filter(a).toArray(),c.find(a).toArray()))});h.each(["on","one","off"],function(a,b){o(b+"()",function(){var a=Array.prototype.slice.call(arguments);a[0]=h.map(a[0].split(/\s/),function(a){return!a.match(/\.dt\b/)?a+".dt":a}).join(" ");var d=h(this.tables().nodes());d[b].apply(d,a);return this})});o("clear()",function(){return this.iterator("table",function(a){oa(a)})});o("settings()",function(){return new s(this.context,this.context)});o("init()",function(){var a=
+this.context;return a.length?a[0].oInit:null});o("data()",function(){return this.iterator("table",function(a){return D(a.aoData,"_aData")}).flatten()});o("destroy()",function(a){a=a||!1;return this.iterator("table",function(b){var c=b.nTableWrapper.parentNode,d=b.oClasses,e=b.nTable,f=b.nTBody,g=b.nTHead,j=b.nTFoot,i=h(e),f=h(f),k=h(b.nTableWrapper),l=h.map(b.aoData,function(a){return a.nTr}),o;b.bDestroying=!0;r(b,"aoDestroyCallback","destroy",[b]);a||(new s(b)).columns().visible(!0);k.off(".DT").find(":not(tbody *)").off(".DT");
+h(E).off(".DT-"+b.sInstance);e!=g.parentNode&&(i.children("thead").detach(),i.append(g));j&&e!=j.parentNode&&(i.children("tfoot").detach(),i.append(j));b.aaSorting=[];b.aaSortingFixed=[];wa(b);h(l).removeClass(b.asStripeClasses.join(" "));h("th, td",g).removeClass(d.sSortable+" "+d.sSortableAsc+" "+d.sSortableDesc+" "+d.sSortableNone);f.children().detach();f.append(l);g=a?"remove":"detach";i[g]();k[g]();!a&&c&&(c.insertBefore(e,b.nTableReinsertBefore),i.css("width",b.sDestroyWidth).removeClass(d.sTable),
+(o=b.asDestroyStripes.length)&&f.children().each(function(a){h(this).addClass(b.asDestroyStripes[a%o])}));c=h.inArray(b,n.settings);-1!==c&&n.settings.splice(c,1)})});h.each(["column","row","cell"],function(a,b){o(b+"s().every()",function(a){var d=this.selector.opts,e=this;return this.iterator(b,function(f,g,h,i,m){a.call(e[b](g,"cell"===b?h:d,"cell"===b?d:k),g,h,i,m)})})});o("i18n()",function(a,b,c){var d=this.context[0],a=S(a)(d.oLanguage);a===k&&(a=b);c!==k&&h.isPlainObject(a)&&(a=a[c]!==k?a[c]:
+a._);return a.replace("%d",c)});n.version="1.10.18";n.settings=[];n.models={};n.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};n.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null,idx:-1};n.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,
+sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};n.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,
+bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(a){return a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+
+a.sInstance+"_"+location.pathname))}catch(b){}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===a.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+a.sInstance+"_"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},
+oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:h.extend({},
+n.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",searchDelay:null,sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null,rowId:"DT_RowId"};Z(n.defaults);n.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};
+Z(n.defaults.column);n.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1,bBounding:!1,barWidth:0},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aIds:{},aoColumns:[],aoHeader:[],
+aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",
+iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:k,oAjaxData:k,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==y(this)?1*this._iRecordsTotal:
+this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==y(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var a=this._iDisplayLength,b=this._iDisplayStart,c=b+a,d=this.aiDisplay.length,e=this.oFeatures,f=e.bPaginate;return e.bServerSide?!1===f||-1===a?b+d:Math.min(b+a,this._iRecordsDisplay):!f||c>d||-1===a?d:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{},rowIdFn:null,rowId:null};n.ext=x={buttons:{},
+classes:{},build:"ju-1.12.1/jq-3.3.1/dt-1.10.18",errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:n.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:n.version};h.extend(x,{afnFiltering:x.search,aTypes:x.type.detect,ofnSearch:x.type.search,oSort:x.type.order,afnSortData:x.order,aoFeatures:x.feature,oApi:x.internal,oStdClasses:x.classes,oPagination:x.pager});
+h.extend(n.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",
+sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",
+sJUIHeader:"",sJUIFooter:""});var Kb=n.ext.pager;h.extend(Kb,{simple:function(){return["previous","next"]},full:function(){return["first","previous","next","last"]},numbers:function(a,b){return[ia(a,b)]},simple_numbers:function(a,b){return["previous",ia(a,b),"next"]},full_numbers:function(a,b){return["first","previous",ia(a,b),"next","last"]},first_last_numbers:function(a,b){return["first",ia(a,b),"last"]},_numbers:ia,numbers_length:7});h.extend(!0,n.ext.renderer,{pageButton:{_:function(a,b,c,d,e,
+f){var g=a.oClasses,j=a.oLanguage.oPaginate,i=a.oLanguage.oAria.paginate||{},m,l,n=0,o=function(b,d){var k,s,u,r,v=function(b){Ta(a,b.data.action,true)};k=0;for(s=d.length;k<s;k++){r=d[k];if(h.isArray(r)){u=h("<"+(r.DT_el||"div")+"/>").appendTo(b);o(u,r)}else{m=null;l="";switch(r){case "ellipsis":b.append('<span class="ellipsis">&#x2026;</span>');break;case "first":m=j.sFirst;l=r+(e>0?"":" "+g.sPageButtonDisabled);break;case "previous":m=j.sPrevious;l=r+(e>0?"":" "+g.sPageButtonDisabled);break;case "next":m=
+j.sNext;l=r+(e<f-1?"":" "+g.sPageButtonDisabled);break;case "last":m=j.sLast;l=r+(e<f-1?"":" "+g.sPageButtonDisabled);break;default:m=r+1;l=e===r?g.sPageButtonActive:""}if(m!==null){u=h("<a>",{"class":g.sPageButton+" "+l,"aria-controls":a.sTableId,"aria-label":i[r],"data-dt-idx":n,tabindex:a.iTabIndex,id:c===0&&typeof r==="string"?a.sTableId+"_"+r:null}).html(m).appendTo(b);Wa(u,{action:r},v);n++}}}},s;try{s=h(b).find(H.activeElement).data("dt-idx")}catch(u){}o(h(b).empty(),d);s!==k&&h(b).find("[data-dt-idx="+
+s+"]").focus()}}});h.extend(n.ext.type.detect,[function(a,b){var c=b.oLanguage.sDecimal;return $a(a,c)?"num"+c:null},function(a){if(a&&!(a instanceof Date)&&!Zb.test(a))return null;var b=Date.parse(a);return null!==b&&!isNaN(b)||M(a)?"date":null},function(a,b){var c=b.oLanguage.sDecimal;return $a(a,c,!0)?"num-fmt"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Pb(a,c)?"html-num"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Pb(a,c,!0)?"html-num-fmt"+c:null},function(a){return M(a)||
+"string"===typeof a&&-1!==a.indexOf("<")?"html":null}]);h.extend(n.ext.type.search,{html:function(a){return M(a)?a:"string"===typeof a?a.replace(Mb," ").replace(Aa,""):""},string:function(a){return M(a)?a:"string"===typeof a?a.replace(Mb," "):a}});var za=function(a,b,c,d){if(0!==a&&(!a||"-"===a))return-Infinity;b&&(a=Ob(a,b));a.replace&&(c&&(a=a.replace(c,"")),d&&(a=a.replace(d,"")));return 1*a};h.extend(x.type.order,{"date-pre":function(a){a=Date.parse(a);return isNaN(a)?-Infinity:a},"html-pre":function(a){return M(a)?
+"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return M(a)?"":"string"===typeof a?a.toLowerCase():!a.toString?"":a.toString()},"string-asc":function(a,b){return a<b?-1:a>b?1:0},"string-desc":function(a,b){return a<b?1:a>b?-1:0}});Da("");h.extend(!0,n.ext.renderer,{header:{_:function(a,b,c,d){h(a.nTable).on("order.dt.DT",function(e,f,g,h){if(a===f){e=c.idx;b.removeClass(c.sSortingClass+" "+d.sSortAsc+" "+d.sSortDesc).addClass(h[e]=="asc"?d.sSortAsc:h[e]=="desc"?d.sSortDesc:
+c.sSortingClass)}})},jqueryui:function(a,b,c,d){h("<div/>").addClass(d.sSortJUIWrapper).append(b.contents()).append(h("<span/>").addClass(d.sSortIcon+" "+c.sSortingClassJUI)).appendTo(b);h(a.nTable).on("order.dt.DT",function(e,f,g,h){if(a===f){e=c.idx;b.removeClass(d.sSortAsc+" "+d.sSortDesc).addClass(h[e]=="asc"?d.sSortAsc:h[e]=="desc"?d.sSortDesc:c.sSortingClass);b.find("span."+d.sSortIcon).removeClass(d.sSortJUIAsc+" "+d.sSortJUIDesc+" "+d.sSortJUI+" "+d.sSortJUIAscAllowed+" "+d.sSortJUIDescAllowed).addClass(h[e]==
+"asc"?d.sSortJUIAsc:h[e]=="desc"?d.sSortJUIDesc:c.sSortingClassJUI)}})}}});var Vb=function(a){return"string"===typeof a?a.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):a};n.render={number:function(a,b,c,d,e){return{display:function(f){if("number"!==typeof f&&"string"!==typeof f)return f;var g=0>f?"-":"",h=parseFloat(f);if(isNaN(h))return Vb(f);h=h.toFixed(c);f=Math.abs(h);h=parseInt(f,10);f=c?b+(f-h).toFixed(c).substring(2):"";return g+(d||"")+h.toString().replace(/\B(?=(\d{3})+(?!\d))/g,
+a)+f+(e||"")}}},text:function(){return{display:Vb}}};h.extend(n.ext.internal,{_fnExternApiFunc:Lb,_fnBuildAjax:sa,_fnAjaxUpdate:lb,_fnAjaxParameters:ub,_fnAjaxUpdateDraw:vb,_fnAjaxDataSrc:ta,_fnAddColumn:Ea,_fnColumnOptions:ka,_fnAdjustColumnSizing:$,_fnVisibleToColumnIndex:aa,_fnColumnIndexToVisible:ba,_fnVisbleColumns:V,_fnGetColumns:ma,_fnColumnTypes:Ga,_fnApplyColumnDefs:ib,_fnHungarianMap:Z,_fnCamelToHungarian:J,_fnLanguageCompat:Ca,_fnBrowserDetect:gb,_fnAddData:O,_fnAddTr:na,_fnNodeToDataIndex:function(a,
+b){return b._DT_RowIndex!==k?b._DT_RowIndex:null},_fnNodeToColumnIndex:function(a,b,c){return h.inArray(c,a.aoData[b].anCells)},_fnGetCellData:B,_fnSetCellData:jb,_fnSplitObjNotation:Ja,_fnGetObjectDataFn:S,_fnSetObjectDataFn:N,_fnGetDataMaster:Ka,_fnClearTable:oa,_fnDeleteIndex:pa,_fnInvalidate:da,_fnGetRowElements:Ia,_fnCreateTr:Ha,_fnBuildHead:kb,_fnDrawHead:fa,_fnDraw:P,_fnReDraw:T,_fnAddOptionsHtml:nb,_fnDetectHeader:ea,_fnGetUniqueThs:ra,_fnFeatureHtmlFilter:pb,_fnFilterComplete:ga,_fnFilterCustom:yb,
+_fnFilterColumn:xb,_fnFilter:wb,_fnFilterCreateSearch:Pa,_fnEscapeRegex:Qa,_fnFilterData:zb,_fnFeatureHtmlInfo:sb,_fnUpdateInfo:Cb,_fnInfoMacros:Db,_fnInitialise:ha,_fnInitComplete:ua,_fnLengthChange:Ra,_fnFeatureHtmlLength:ob,_fnFeatureHtmlPaginate:tb,_fnPageChange:Ta,_fnFeatureHtmlProcessing:qb,_fnProcessingDisplay:C,_fnFeatureHtmlTable:rb,_fnScrollDraw:la,_fnApplyToChildren:I,_fnCalculateColumnWidths:Fa,_fnThrottle:Oa,_fnConvertToWidth:Eb,_fnGetWidestNode:Fb,_fnGetMaxLenString:Gb,_fnStringToCss:v,
+_fnSortFlatten:X,_fnSort:mb,_fnSortAria:Ib,_fnSortListener:Va,_fnSortAttachListener:Ma,_fnSortingClasses:wa,_fnSortData:Hb,_fnSaveState:xa,_fnLoadState:Jb,_fnSettingsFromNode:ya,_fnLog:K,_fnMap:F,_fnBindAction:Wa,_fnCallbackReg:z,_fnCallbackFire:r,_fnLengthOverflow:Sa,_fnRenderer:Na,_fnDataSource:y,_fnRowAttributes:La,_fnExtend:Xa,_fnCalculateEnd:function(){}});h.fn.dataTable=n;n.$=h;h.fn.dataTableSettings=n.settings;h.fn.dataTableExt=n.ext;h.fn.DataTable=function(a){return h(this).dataTable(a).api()};
+h.each(n,function(a,b){h.fn.DataTable[a]=b});return h.fn.dataTable});
+
+
+/*!
+ DataTables jQuery UI integration
+ ©2011-2014 SpryMedia Ltd - datatables.net/license
+*/
+(function(a){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(b){return a(b,window,document)}):"object"===typeof exports?module.exports=function(b,d){b||(b=window);if(!d||!d.fn.dataTable)d=require("datatables.net")(b,d).$;return a(d,b,b.document)}:a(jQuery,window,document)})(function(a){var b=a.fn.dataTable;a.extend(!0,b.defaults,{dom:'<"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-tl ui-corner-tr"lfr>t<"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-bl ui-corner-br"ip>',
+renderer:"jqueryui"});a.extend(b.ext.classes,{sWrapper:"dataTables_wrapper dt-jqueryui",sPageButton:"fg-button ui-button ui-state-default",sPageButtonActive:"ui-state-disabled",sPageButtonDisabled:"ui-state-disabled",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sSortAsc:"ui-state-default sorting_asc",sSortDesc:"ui-state-default sorting_desc",sSortable:"ui-state-default sorting",sSortableAsc:"ui-state-default sorting_asc_disabled",sSortableDesc:"ui-state-default sorting_desc_disabled",
+sSortableNone:"ui-state-default sorting_disabled",sSortIcon:"DataTables_sort_icon",sScrollHead:"dataTables_scrollHead ui-state-default",sScrollFoot:"dataTables_scrollFoot ui-state-default",sHeaderTH:"ui-state-default",sFooterTH:"ui-state-default"});b.ext.renderer.header.jqueryui=function(b,h,e,c){var f="css_right ui-icon ui-icon-caret-2-n-s",g=-1!==a.inArray("asc",e.asSorting),i=-1!==a.inArray("desc",e.asSorting);!e.bSortable||!g&&!i?f="":g&&!i?f="css_right ui-icon ui-icon-caret-1-n":!g&&i&&(f="css_right ui-icon ui-icon-caret-1-s");
+a("<div/>").addClass("DataTables_sort_wrapper").append(h.contents()).append(a("<span/>").addClass(c.sSortIcon+" "+f)).appendTo(h);a(b.nTable).on("order.dt",function(a,g,i,j){b===g&&(a=e.idx,h.removeClass(c.sSortAsc+" "+c.sSortDesc).addClass("asc"==j[a]?c.sSortAsc:"desc"==j[a]?c.sSortDesc:e.sSortingClass),h.find("span."+c.sSortIcon).removeClass("css_right ui-icon ui-icon-triangle-1-n css_right ui-icon ui-icon-triangle-1-s css_right ui-icon ui-icon-caret-2-n-s css_right ui-icon ui-icon-caret-1-n css_right ui-icon ui-icon-caret-1-s").addClass("asc"==
+j[a]?"css_right ui-icon ui-icon-triangle-1-n":"desc"==j[a]?"css_right ui-icon ui-icon-triangle-1-s":f))})};b.TableTools&&a.extend(!0,b.TableTools.classes,{container:"DTTT_container ui-buttonset ui-buttonset-multi",buttons:{normal:"DTTT_button ui-button ui-state-default"},collection:{container:"DTTT_collection ui-buttonset ui-buttonset-multi"}});return b});
+
+
diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js
index c2335903d7..e5a0b87f7e 100644
--- a/pandora_console/include/javascript/functions_pandora_networkmap.js
+++ b/pandora_console/include/javascript/functions_pandora_networkmap.js
@@ -669,7 +669,7 @@ function update_link(row_index, id_link) {
           temp_link["arrow_start"] = "module";
           temp_link["id_module_start"] = interface_source;
           temp_link["status_start"] = data["status"];
-          temp_link["link_color"] = data["status"] == "1" ? "#FC4444" : "#999";
+          temp_link["link_color"] = data["status"] == "1" ? "#e63c52" : "#999";
         } else {
           temp_link["arrow_start"] = "";
           temp_link["id_agent_start"] = interface_source;
@@ -679,7 +679,7 @@ function update_link(row_index, id_link) {
           temp_link["arrow_end"] = "module";
           temp_link["id_module_end"] = interface_target;
           temp_link["status_end"] = data["status"];
-          temp_link["link_color"] = data["status"] == "1" ? "#FC4444" : "#999";
+          temp_link["link_color"] = data["status"] == "1" ? "#e63c52" : "#999";
         } else {
           temp_link["arrow_end"] = "";
           temp_link["id_agent_end"] = interface_target;
@@ -2329,7 +2329,7 @@ function add_interface_link_js() {
           temp_link["id_module_start"] = source_value;
           temp_link["status_start"] = data["status_start"];
           temp_link["link_color"] =
-            data["status_start"] == "1" ? "#FC4444" : "#999";
+            data["status_start"] == "1" ? "#e63c52" : "#999";
         } else {
           temp_link["arrow_start"] = "";
           temp_link["id_agent_start"] = source_value;
@@ -2340,7 +2340,7 @@ function add_interface_link_js() {
           temp_link["id_module_end"] = target_value;
           temp_link["status_end"] = data["status_end"];
           temp_link["link_color"] =
-            data["status_end"] == "1" ? "#FC4444" : "#999";
+            data["status_end"] == "1" ? "#e63c52" : "#999";
         } else {
           temp_link["arrow_end"] = "";
           temp_link["id_agent_end"] = target_value;
diff --git a/pandora_console/include/javascript/jquery.pandora.js b/pandora_console/include/javascript/jquery.pandora.js
index 9e0b3447af..ed75400386 100644
--- a/pandora_console/include/javascript/jquery.pandora.js
+++ b/pandora_console/include/javascript/jquery.pandora.js
@@ -1,386 +1,405 @@
 (function($) {
-	$.fn.check = function () {
-		return this.each (function () {
-			this.checked = true;
-		});};
+  $.fn.check = function() {
+    return this.each(function() {
+      this.checked = true;
+    });
+  };
 
-	$.fn.uncheck = function () {
-		return this.each (function () {
-			this.checked = false;
-		});};
+  $.fn.uncheck = function() {
+    return this.each(function() {
+      this.checked = false;
+    });
+  };
 
-	$.fn.enable = function () {
-		return $(this).removeAttr ("disabled");
-		};
+  $.fn.enable = function() {
+    return $(this).removeAttr("disabled");
+  };
 
-	$.fn.disable = function () {
-		return $(this).attr ("disabled", "disabled");
-		};
+  $.fn.disable = function() {
+    return $(this).attr("disabled", "disabled");
+  };
 
-	$.fn.pulsate = function () {
-		var i = 0;
-		for (i = 0; i <= 2; i++) {
-			$(this).fadeOut ("slow").fadeIn ("slow");
-		}
-	};
+  $.fn.pulsate = function() {
+    var i = 0;
+    for (i = 0; i <= 2; i++) {
+      $(this)
+        .fadeOut("slow")
+        .fadeIn("slow");
+    }
+  };
 
-	$.fn.showMessage = function (msg) {
-		return $(this).hide ().empty ()
-		// here, previously .text (msg)
-				.html (msg)
-				.slideDown ();
-		};
-}) (jQuery);
+  $.fn.showMessage = function(msg) {
+    return (
+      $(this)
+        .hide()
+        .empty()
+        // here, previously .text (msg)
+        .html(msg)
+        .slideDown()
+    );
+  };
+})(jQuery);
 
-$(document).ready (function () {
-	$("a#show_messages_dialog").click (function () {
-		jQuery.post ("ajax.php",
-			{
-				"page": "operation/messages/message_list"
-			},
-			function (data, status) {
-				$("#dialog_messages").hide ()
-					.empty ()
-					.append (data)
-					.dialog ({
-						title: $("a#show_messages_dialog").attr ("title"),
-						resizable: false,
-						modal: true,
-						overlay: {
-							opacity: 0.5,
-							background: "black"
-						},
-						width: 700,
-						height: 300
-					}).show ();
-				},
-			"html"
-		);
+$(document).ready(function() {
+  $("a#show_messages_dialog").click(function() {
+    jQuery.post(
+      "ajax.php",
+      {
+        page: "operation/messages/message_list"
+      },
+      function(data, status) {
+        $("#dialog_messages")
+          .hide()
+          .empty()
+          .append(data)
+          .dialog({
+            title: $("a#show_messages_dialog").attr("title"),
+            resizable: false,
+            modal: true,
+            overlay: {
+              opacity: 0.5,
+              background: "black"
+            },
+            width: 700,
+            height: 300
+          })
+          .show();
+      },
+      "html"
+    );
 
-		return false;
-	});
+    return false;
+  });
 
-	$("a.show_systemalert_dialog").click (function () {
-		$('body').append( "<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>" );
-		$("#opacidad").css('opacity', 0.5);
+  $("a.show_systemalert_dialog").click(function() {
+    $("body").append(
+      "<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>"
+    );
+    $("#opacidad").css("opacity", 0.5);
 
-		jQuery.post ("ajax.php",
-			{
-				"page": "operation/system_alert"},
-				function (data, status) {
-					$("#alert_messages").show();
-					$("#alert_messages").empty ().append (data);
-					$("#alert_messages").css('opacity', 1);
+    jQuery.post(
+      "ajax.php",
+      {
+        page: "operation/system_alert"
+      },
+      function(data, status) {
+        $("#alert_messages").show();
+        $("#alert_messages")
+          .empty()
+          .append(data);
+        $("#alert_messages").css("opacity", 1);
+      },
+      "html"
+    );
+  });
 
-			},
-			"html"
-		);
-	});
-	
-	$("a.modalpopup").click (function () {
-		var elem = $(this).attr("id");
-		$('body').append( "<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>" );
-		$("#opacidad").css('opacity', 0.5);
+  $("a.modalpopup").click(function() {
+    var elem = $(this).attr("id");
+    $("body").append(
+      "<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>"
+    );
+    $("#opacidad").css("opacity", 0.5);
 
-		jQuery.post ("ajax.php",
-			{
-				"page": "general/alert_enterprise",
-				"message": elem
-			},
-			function (data, status) {
-				$("#alert_messages").show();
-				$("#alert_messages").empty ().append (data);
-				$("#alert_messages").css('opacity', 1);
-			},
-			"html"
-		);
-		return false;
-	});
+    jQuery.post(
+      "ajax.php",
+      {
+        page: "general/alert_enterprise",
+        message: elem
+      },
+      function(data, status) {
+        $("#alert_messages").show();
+        $("#alert_messages")
+          .empty()
+          .append(data);
+        $("#alert_messages").css("opacity", 1);
+      },
+      "html"
+    );
+    return false;
+  });
 
-	// Creacion de ventana modal y botones
-	$(".publienterprise").click (function () {
-		var elem = $(this).attr("id");
-		$('body').append( "<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>" );
-		$("#opacidad").css('opacity', 0.5);
+  // Creacion de ventana modal y botones
+  $(".publienterprise").click(function() {
+    var elem = $(this).attr("id");
+    $("body").append(
+      "<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>"
+    );
+    $("#opacidad").css("opacity", 0.5);
 
-		jQuery.post ("ajax.php",
-			{
-				"page": "general/alert_enterprise",
-				"message": elem
-			},
-			function (data, status) {
-				$("#alert_messages").show();
-				$("#alert_messages").empty ().append (data);
-				$("#alert_messages").css('opacity', 1);
-			},
-			"html"
-		);
-		return false;
-	});
-	
-	
-	$(".publienterprisehide").click (function () {
-		var elem = $(this).attr("id");
-		$('body').append( "<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>" );
-		$("#opacidad").css('opacity', 0.5);
+    jQuery.post(
+      "ajax.php",
+      {
+        page: "general/alert_enterprise",
+        message: elem
+      },
+      function(data, status) {
+        $("#alert_messages").show();
+        $("#alert_messages")
+          .empty()
+          .append(data);
+        $("#alert_messages").css("opacity", 1);
+      },
+      "html"
+    );
+    return false;
+  });
 
-		jQuery.post ("ajax.php",
-			{
-				"page": "general/alert_enterprise",
-				"message": elem
-			},
-			function (data, status) {
-				$("#alert_messages").show();
-				$("#alert_messages").empty ().append (data);
-				$("#alert_messages").css('opacity', 1);
-			},
-			"html"
-		);
-		return false;
-	});
+  $(".publienterprisehide").click(function() {
+    var elem = $(this).attr("id");
+    $("body").append(
+      "<div id='opacidad' style='position:fixed;background:black;z-index:1'></div>"
+    );
+    $("#opacidad").css("opacity", 0.5);
 
+    jQuery.post(
+      "ajax.php",
+      {
+        page: "general/alert_enterprise",
+        message: elem
+      },
+      function(data, status) {
+        $("#alert_messages").show();
+        $("#alert_messages")
+          .empty()
+          .append(data);
+        $("#alert_messages").css("opacity", 1);
+      },
+      "html"
+    );
+    return false;
+  });
 
+  if ($("#license_error_msg_dialog").length) {
+    if (typeof process_login_ok == "undefined") process_login_ok = 0;
 
-	if ($('#license_error_msg_dialog').length) {
-		if (typeof(process_login_ok) == "undefined")
-			process_login_ok = 0;
+    if (typeof show_error_license == "undefined") show_error_license = 0;
 
-		if (typeof(show_error_license) == "undefined")
-			show_error_license = 0;
+    if (process_login_ok || show_error_license) {
+      $("#license_error_msg_dialog").dialog({
+        dialogClass: "no-close",
+        closeOnEscape: false,
+        resizable: false,
+        draggable: true,
+        modal: true,
+        height: 470,
+        width: 850,
+        overlay: {
+          opacity: 0.5,
+          background: "black"
+        },
+        open: function() {
+          var remaining = 30;
 
-		if (process_login_ok || show_error_license) {
+          // Timeout counter.
+          var count = function() {
+            if (remaining > 0) {
+              $("#license_error_remaining").text(remaining);
+              remaining -= 1;
+            } else {
+              $("#license_error_remaining").hide();
+              $("#ok_buttom").show();
+              clearInterval(count);
+            }
+          };
 
-			$( "#license_error_msg_dialog" ).dialog({
-				dialogClass: "no-close",
-				closeOnEscape: false,
-				resizable: false,
-				draggable: true,
-				modal: true,
-				height: 450,
-				width: 850,
-				overlay: {
-					opacity: 0.5,
-					background: "black"
-				},
-				open: function() {
-					var remaining = 30;
+          setInterval(count, 1000);
+        }
+      });
 
-					// Timeout counter.
-					var count = function() {
-						if (remaining > 0) {
-							$("#license_error_remaining").text(remaining);
-							remaining -= 1;
-						} else {
-							$("#license_error_remaining").hide();
-							$("#ok_buttom").show();
-							clearInterval(count);
-						}
-					}
+      $("#submit-hide-license-error-msg").click(function() {
+        $("#license_error_msg_dialog").dialog("close");
+      });
+    }
+  }
 
-					setInterval(count, 1000);
-				}
-			});
+  if ($("#msg_change_password").length) {
+    $("#msg_change_password").dialog({
+      resizable: false,
+      draggable: true,
+      modal: true,
+      height: 450,
+      width: 620,
+      overlay: {
+        opacity: 0.5,
+        background: "black"
+      }
+    });
+  }
 
-			$("#submit-hide-license-error-msg").click (function () {
-				$("#license_error_msg_dialog" ).dialog('close')
-			});
+  if ($("#login_blocked").length) {
+    $("#login_blocked").dialog({
+      resizable: true,
+      draggable: true,
+      modal: true,
+      height: 200,
+      width: 520,
+      overlay: {
+        opacity: 0.5,
+        background: "black"
+      }
+    });
+  }
 
-		}
-	}
+  if ($("#login_correct_pass").length) {
+    $("#login_correct_pass").dialog({
+      resizable: true,
+      draggable: true,
+      modal: true,
+      height: 200,
+      width: 520,
+      overlay: {
+        opacity: 0.5,
+        background: "black"
+      }
+    });
+  }
 
+  forced_title_callback();
 
-	if ($('#msg_change_password').length) {
+  $(document).on("scroll", function() {
+    if (
+      document.documentElement.scrollTop != 0 ||
+      document.body.scrollTop != 0
+    ) {
+      if ($("#head").css("position") == "fixed") {
+        if ($("#menu").css("position") == "fixed") {
+          $("#menu").css("top", "80px");
+        } else {
+          $("#menu").css("top", "60px");
+        }
+      } else {
+        if ($("#menu").css("position") == "fixed") {
+          $("#menu").css("top", "20px");
+        } else {
+          $("#menu").css("top", "80px");
+        }
+      }
+    } else {
+      if ($("#head").css("position") == "fixed") {
+        if ($("#menu").css("position") == "fixed") {
+          $("#menu").css("top", "80px");
+        } else {
+          $("#menu").css("top", "60px");
+        }
+      } else {
+        if ($("#menu").css("position") == "fixed") {
+          $("#menu").css("top", "80px");
+        } else {
+          $("#menu").css("top", "80px");
+        }
+      }
+    }
 
-		$( "#msg_change_password" ).dialog({
-			resizable: false,
-			draggable: true,
-			modal: true,
-			height: 350,
-			width: 620,
-			overlay: {
-				opacity: 0.5,
-				background: "black"
-			}
-		});
+    // if((document.documentElement.scrollTop != 0 || document.body.scrollTop != 0) && $('#menu').css('position') =='fixed'){
+    // 	if($('#head').css('position') =='fixed'){
+    // 		$('#menu').css('top','80px');
+    // 	}
+    // 	else{
+    // 		$('#menu').css('top','20px');
+    // 	}
+    // }
+    // else{
+    // 	if($('#head').css('position') =='fixed'){
+    // 		if(document.documentElement.scrollTop != 0 || document.body.scrollTop != 0){
+    // 			$('#menu').css('top','60px');
+    // 		}else{
+    // 			$('#menu').css('top','80px');
+    // 		}
+    //
+    // 	}
+    // 	else{
+    // 		$('#menu').css('top','60px');
+    // 	}
+    // }
+  });
 
-	}
-
-	if ($('#login_blocked').length) {
-
-		$( "#login_blocked" ).dialog({
-			resizable: true,
-			draggable: true,
-			modal: true,
-			height: 200,
-			width: 520,
-			overlay: {
-				opacity: 0.5,
-				background: "black"
-			}
-		});
-
-	}
-
-	if ($('#login_correct_pass').length) {
-
-		$( "#login_correct_pass" ).dialog({
-			resizable: true,
-			draggable: true,
-			modal: true,
-			height: 200,
-			width: 520,
-			overlay: {
-				opacity: 0.5,
-				background: "black"
-			}
-		});
-
-	}
-
-	forced_title_callback();
-	
-	
-	$(document).on("scroll", function(){
-		
-		if(document.documentElement.scrollTop != 0 || document.body.scrollTop != 0){
-			if($('#head').css('position') =='fixed'){
-				if($('#menu').css('position') =='fixed'){
-					$('#menu').css('top','80px');
-				} else {
-					$('#menu').css('top','60px');
-				}	
-			} else {
-				if($('#menu').css('position') =='fixed'){
-					$('#menu').css('top','20px');
-				} else {
-					$('#menu').css('top','80px');
-				}	
-			}
-		} else {
-			if($('#head').css('position') =='fixed'){
-				if($('#menu').css('position') =='fixed'){
-					$('#menu').css('top','80px');
-				} else {
-					$('#menu').css('top','60px');
-				}
-			} else {
-				if($('#menu').css('position') =='fixed'){
-					$('#menu').css('top','80px');
-				} else {
-					$('#menu').css('top','80px');
-				}	
-			}
-		}
-		
-		// if((document.documentElement.scrollTop != 0 || document.body.scrollTop != 0) && $('#menu').css('position') =='fixed'){
-		// 	if($('#head').css('position') =='fixed'){
-		// 		$('#menu').css('top','80px');
-		// 	}
-		// 	else{
-		// 		$('#menu').css('top','20px');
-		// 	}	
-		// }
-		// else{
-		// 	if($('#head').css('position') =='fixed'){
-		// 		if(document.documentElement.scrollTop != 0 || document.body.scrollTop != 0){
-		// 			$('#menu').css('top','60px');
-		// 		}else{
-		// 			$('#menu').css('top','80px');
-		// 		}
-		// 		
-		// 	}
-		// 	else{
-		// 		$('#menu').css('top','60px');
-		// 	}	
-		// }
-	});
-
-	$("#alert_messages").draggable();
-	$("#alert_messages").css({'left':+parseInt(screen.width/2)-parseInt($("#alert_messages").css('width'))/2+'px'});
-	
+  $("#alert_messages").draggable();
+  $("#alert_messages").css({
+    left:
+      +parseInt(screen.width / 2) -
+      parseInt($("#alert_messages").css("width")) / 2 +
+      "px"
+  });
 });
 
-
-
-
 function forced_title_callback() {
-	// Forced title code
-	$('body').on('mouseenter', '.forced_title', function() {
-		///////////////////////////////////////////
-		// Put the layer in the left-top corner to fill it
-		///////////////////////////////////////////
-		$('#forced_title_layer').css('left', 0);
-		$('#forced_title_layer').css('top', 0);
+  // Forced title code
+  $("body").on("mouseenter", ".forced_title", function() {
+    ///////////////////////////////////////////
+    // Put the layer in the left-top corner to fill it
+    ///////////////////////////////////////////
+    $("#forced_title_layer").css("left", 0);
+    $("#forced_title_layer").css("top", 0);
 
-		///////////////////////////////////////////
-		// Get info of the image
-		///////////////////////////////////////////
+    ///////////////////////////////////////////
+    // Get info of the image
+    ///////////////////////////////////////////
 
-		var img_top = $(this).offset().top;
-		var img_width = $(this).width();
-		var img_height = $(this).height();
-		var img_id = $(this).attr('id');
-		var img_left_mid = $(this).offset().left + (img_width / 2);
+    var img_top = $(this).offset().top;
+    var img_width = $(this).width();
+    var img_height = $(this).height();
+    var img_id = $(this).attr("id");
+    var img_left_mid = $(this).offset().left + img_width / 2;
 
-		///////////////////////////////////////////
-		// Put title in the layer
-		///////////////////////////////////////////
+    ///////////////////////////////////////////
+    // Put title in the layer
+    ///////////////////////////////////////////
 
-		// If the '.forced_title' element has 'use_title_for_force_title' = 1
-		// into their 'data' prop, the element title will be used for the
-		// content.
-		if ($(this).data("use_title_for_force_title")) {
-			var title = $(this).data("title");
-		}
-		else {
-			var title = $('#forced_title_'+img_id).html();
-		}
+    // If the '.forced_title' element has 'use_title_for_force_title' = 1
+    // into their 'data' prop, the element title will be used for the
+    // content.
+    if ($(this).data("use_title_for_force_title")) {
+      var title = $(this).data("title");
+    } else {
+      var title = $("#forced_title_" + img_id).html();
+    }
 
-		$('#forced_title_layer').html(title);
+    $("#forced_title_layer").html(title);
 
-		///////////////////////////////////////////
-		// Get info of the layer
-		///////////////////////////////////////////
+    ///////////////////////////////////////////
+    // Get info of the layer
+    ///////////////////////////////////////////
 
-		var layer_width = $('#forced_title_layer').width();
-		var layer_height = $('#forced_title_layer').height();
+    var layer_width = $("#forced_title_layer").width();
+    var layer_height = $("#forced_title_layer").height();
 
-		///////////////////////////////////////////
-		// Obtain the new position of the layer
-		///////////////////////////////////////////
+    ///////////////////////////////////////////
+    // Obtain the new position of the layer
+    ///////////////////////////////////////////
 
-		// Jquery doesnt know the padding of the layer
-		var layer_padding = 4;
+    // Jquery doesnt know the padding of the layer
+    var layer_padding = 4;
 
-		// Deduct padding of both sides
-		var layer_top = img_top - layer_height - (layer_padding * 2) - 5;
-		if (layer_top < 0) {
-			layer_top = img_top + img_height + (layer_padding * 2);
-		}
+    // Deduct padding of both sides
+    var layer_top = img_top - layer_height - layer_padding * 2 - 5;
+    if (layer_top < 0) {
+      layer_top = img_top + img_height + layer_padding * 2;
+    }
 
-		// Deduct padding of one side
-		var layer_left = img_left_mid - (layer_width / 2) - layer_padding;
-		if (layer_left < 0) {
-			layer_left = 0;
-		}
+    // Deduct padding of one side
+    var layer_left = img_left_mid - layer_width / 2 - layer_padding;
+    if (layer_left < 0) {
+      layer_left = 0;
+    }
 
-		var real_layer_width = layer_width + (layer_padding * 2) + 5;
-		var layer_right = layer_left + real_layer_width;
-		var screen_width = $(window).width();
-		if (screen_width < layer_right) {
-			layer_left = screen_width - real_layer_width;
-		}
+    var real_layer_width = layer_width + layer_padding * 2 + 5;
+    var layer_right = layer_left + real_layer_width;
+    var screen_width = $(window).width();
+    if (screen_width < layer_right) {
+      layer_left = screen_width - real_layer_width;
+    }
 
-		///////////////////////////////////////////
-		// Set the layer position and show
-		///////////////////////////////////////////
+    ///////////////////////////////////////////
+    // Set the layer position and show
+    ///////////////////////////////////////////
 
-		$('#forced_title_layer').css('left', layer_left);
-		$('#forced_title_layer').css('top', layer_top);
-		$('#forced_title_layer').show();
-	});
-	$('body').on('mouseout', '.forced_title', function () {
-		$('#forced_title_layer').hide().empty();
-	});
+    $("#forced_title_layer").css("left", layer_left);
+    $("#forced_title_layer").css("top", layer_top);
+    $("#forced_title_layer").show();
+  });
+  $("body").on("mouseout", ".forced_title", function() {
+    $("#forced_title_layer")
+      .hide()
+      .empty();
+  });
 }
-
diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js
index 351531a5e9..05009e7292 100644
--- a/pandora_console/include/javascript/pandora.js
+++ b/pandora_console/include/javascript/pandora.js
@@ -1599,7 +1599,7 @@ function paint_graph_status(
       .attr("y", height_x - 30)
       .attr("width", 10)
       .attr("height", 10)
-      .style("fill", "#fc4444");
+      .style("fill", "#e63c52");
 
     //styles for number and axes
     svg
@@ -1683,7 +1683,7 @@ function paint_graph_status(
         )
         .attr("width", 300)
         .attr("height", (max_c - min_c) * position)
-        .style("fill", "#fc4444");
+        .style("fill", "#e63c52");
     } else {
       svg
         .append("g")
@@ -1695,7 +1695,7 @@ function paint_graph_status(
         .attr("y", height_x + 200 - (min_c - range_min) * position)
         .attr("width", 300)
         .attr("height", (min_c - range_min) * position)
-        .style("fill", "#fc4444");
+        .style("fill", "#e63c52");
       svg
         .append("g")
         .append("rect")
@@ -1709,7 +1709,7 @@ function paint_graph_status(
           "height",
           (range_max - min_c) * position - (max_c - min_c) * position
         )
-        .style("fill", "#fc4444");
+        .style("fill", "#e63c52");
     }
   } else {
     d3.select("#svg_dinamic rect").remove();
@@ -1870,3 +1870,100 @@ function logo_preview(icon_name, icon_path, incoming_options) {
     // console.log(err);
   }
 }
+
+// Advanced Form control.
+/* global $ */
+/* exported load_modal */
+function load_modal(settings) {
+  var AJAX_RUNNING = 0;
+  var data = new FormData();
+  if (settings.extradata) {
+    settings.extradata.forEach(function(item) {
+      if (item.value != undefined) data.append(item.name, item.value);
+    });
+  }
+  data.append("page", settings.onshow.page);
+  data.append("method", settings.onshow.method);
+
+  var width = 630;
+  if (settings.onshow.width) {
+    width = settings.onshow.width;
+  }
+
+  $.ajax({
+    method: "post",
+    url: settings.url,
+    processData: false,
+    contentType: false,
+    data: data,
+    success: function(data) {
+      settings.target.html(data);
+      settings.target.dialog({
+        resizable: true,
+        draggable: true,
+        modal: true,
+        title: settings.modal.title,
+        width: width,
+        overlay: {
+          opacity: 0.5,
+          background: "black"
+        },
+        buttons: [
+          {
+            class:
+              "ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
+            text: settings.modal.cancel,
+            click: function() {
+              $(this).dialog("close");
+              settings.cleanup();
+            }
+          },
+          {
+            class:
+              "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
+            text: settings.modal.ok,
+            click: function() {
+              if (AJAX_RUNNING) return;
+              AJAX_RUNNING = 1;
+              var formdata = new FormData();
+              if (settings.extradata) {
+                settings.extradata.forEach(function(item) {
+                  if (item.value != undefined)
+                    formdata.append(item.name, item.value);
+                });
+              }
+              formdata.append("page", settings.onsubmit.page);
+              formdata.append("method", settings.onsubmit.method);
+
+              $("#" + settings.form + " :input").each(function() {
+                if (this.type == "file") {
+                  if ($(this).prop("files")[0]) {
+                    formdata.append(this.name, $(this).prop("files")[0]);
+                  }
+                } else {
+                  formdata.append(this.name, $(this).val());
+                }
+              });
+
+              $.ajax({
+                method: "post",
+                url: settings.url,
+                processData: false,
+                contentType: false,
+                data: formdata,
+                success: function(data) {
+                  settings.ajax_callback(data);
+                  AJAX_RUNNING = 0;
+                }
+              });
+            }
+          }
+        ],
+        closeOnEscape: false,
+        open: function() {
+          $(".ui-dialog-titlebar-close").hide();
+        }
+      });
+    }
+  });
+}
diff --git a/pandora_console/include/javascript/pandora_alerts.js b/pandora_console/include/javascript/pandora_alerts.js
index 1c72d13cf3..389aa15475 100644
--- a/pandora_console/include/javascript/pandora_alerts.js
+++ b/pandora_console/include/javascript/pandora_alerts.js
@@ -1,5 +1,4 @@
 var original_command = "";
-
 function parse_alert_command(command, classs) {
   if (classs == "recovery") {
     classs = "fields_recovery";
@@ -34,13 +33,13 @@ function parse_alert_command(command, classs) {
 }
 
 function render_command_preview(original_command) {
-  $("#textarea_command_preview").text(
+  $("#textarea_command_preview").html(
     parse_alert_command(original_command, "")
   );
 }
 
 function render_command_recovery_preview(original_command) {
-  $("#textarea_command_recovery_preview").text(
+  $("#textarea_command_recovery_preview").html(
     parse_alert_command(original_command, "recovery")
   );
 }
diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js
index 1f1ff42c3f..0fb6c1a6ef 100644
--- a/pandora_console/include/javascript/pandora_events.js
+++ b/pandora_console/include/javascript/pandora_events.js
@@ -1,18 +1,28 @@
+/*global jQuery,$,forced_title_callback,Base64, dt_events*/
+
 // Show the modal window of an event
-function show_event_dialog(event_id, group_rep, dialog_page, result) {
+var current_event;
+function show_event_dialog(event, dialog_page, result) {
   var ajax_file = $("#hidden-ajax_file").val();
 
   if (dialog_page == undefined) {
     dialog_page = "general";
   }
 
-  var similar_ids = $("#hidden-similar_ids_" + event_id).val();
-  var timestamp_first = $("#hidden-timestamp_first_" + event_id).val();
-  var timestamp_last = $("#hidden-timestamp_last_" + event_id).val();
-  var user_comment = $("#hidden-user_comment_" + event_id).val();
-  var event_rep = $("#hidden-event_rep_" + event_id).val();
-  var server_id = $("#hidden-server_id_" + event_id).val();
-  var childrens_ids = $("#hidden-childrens_ids").val();
+  current_event = event;
+
+  try {
+    event = JSON.parse(atob(event));
+  } catch (e) {
+    console.error(e);
+    return;
+  }
+
+  var inputs = $("#events_form :input");
+  var values = {};
+  inputs.each(function() {
+    values[this.name] = $(this).val();
+  });
 
   // Metaconsole mode flag
   var meta = $("#hidden-meta").val();
@@ -25,26 +35,19 @@ function show_event_dialog(event_id, group_rep, dialog_page, result) {
     {
       page: "include/ajax/events",
       get_extended_event: 1,
-      group_rep: group_rep,
-      event_rep: event_rep,
       dialog_page: dialog_page,
-      similar_ids: similar_ids,
-      timestamp_first: timestamp_first,
-      timestamp_last: timestamp_last,
-      user_comment: user_comment,
-      event_id: event_id,
-      server_id: server_id,
+      event: event,
       meta: meta,
-      childrens_ids: childrens_ids,
-      history: history
+      history: history,
+      filter: values
     },
-    function(data, status) {
+    function(data) {
       $("#event_details_window")
         .hide()
         .empty()
         .append(data)
         .dialog({
-          title: get_event_name(event_id, meta, history),
+          title: event.evento,
           resizable: true,
           draggable: true,
           modal: true,
@@ -56,8 +59,8 @@ function show_event_dialog(event_id, group_rep, dialog_page, result) {
             opacity: 0.5,
             background: "black"
           },
-          width: 725,
-          height: 530
+          width: 710,
+          height: 600
         })
         .show();
 
@@ -92,45 +95,6 @@ function show_event_dialog(event_id, group_rep, dialog_page, result) {
   return false;
 }
 
-function show_save_filter_dialog() {
-  $('input:radio[name="filter_mode"]')
-    .filter('[value="new"]')
-    .trigger("click");
-  $("#save_filter_layer")
-    .dialog({
-      title: $("#save_filter_text").html(),
-      resizable: true,
-      draggable: true,
-      modal: true,
-      overlay: {
-        opacity: 0.5,
-        background: "black"
-      },
-      width: 688,
-      height: 200
-    })
-    .show();
-  return false;
-}
-
-function show_load_filter_dialog() {
-  $("#load_filter_layer")
-    .dialog({
-      title: $("#load_filter_text").html(),
-      resizable: true,
-      draggable: true,
-      modal: true,
-      overlay: {
-        opacity: 0.5,
-        background: "black"
-      },
-      width: 520,
-      height: 300
-    })
-    .show();
-  return false;
-}
-
 // Check the response type and open it in a modal dialog or new window
 function execute_response(event_id, server_id) {
   var response_id = $("#select_custom_response option:selected").val();
@@ -160,8 +124,6 @@ function execute_response(event_id, server_id) {
 
 //Show the modal window of an event response
 function show_response_dialog(event_id, response_id, response) {
-  var ajax_file = $("#hidden-ajax_file").val();
-
   var params = [];
   params.push("page=include/ajax/events");
   params.push("dialogue_event_response=1");
@@ -173,7 +135,7 @@ function show_response_dialog(event_id, response_id, response) {
   jQuery.ajax({
     data: params.join("&"),
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     dataType: "html",
     success: function(data) {
       $("#event_response_window")
@@ -185,7 +147,7 @@ function show_response_dialog(event_id, response_id, response) {
           resizable: true,
           draggable: true,
           modal: false,
-          open: function(event, ui) {
+          open: function() {
             perform_response(response["target"], response_id);
           },
           width: response["modal_width"],
@@ -204,8 +166,6 @@ function show_massive_response_dialog(
   out_iterator,
   end
 ) {
-  var ajax_file = $("#hidden-ajax_file").val();
-
   var params = [];
   params.push("page=include/ajax/events");
   params.push("dialogue_event_response=1");
@@ -222,7 +182,7 @@ function show_massive_response_dialog(
     response_id: response_id,
     out_iterator: out_iterator,
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     dataType: "html",
     success: function(data) {
       if (out_iterator === 0) $("#event_response_window").empty();
@@ -235,11 +195,11 @@ function show_massive_response_dialog(
           resizable: true,
           draggable: true,
           modal: false,
-          open: function(event, ui) {
+          open: function() {
             $("#response_loading_dialog").hide();
             $("#button-submit_event_response").show();
           },
-          close: function(event, ui) {
+          close: function() {
             $(".chk_val").prop("checked", false);
             $("#event_response_command_window").dialog("close");
           },
@@ -259,8 +219,6 @@ function show_massive_response_dialog(
 
 // Get an event response from db
 function get_response(response_id) {
-  var ajax_file = $("#hidden-ajax_file").val();
-
   var response = "";
 
   var params = [];
@@ -271,9 +229,8 @@ function get_response(response_id) {
   jQuery.ajax({
     data: params.join("&"),
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     async: false,
-    timeout: 10000,
     dataType: "json",
     success: function(data) {
       response = data;
@@ -285,8 +242,6 @@ function get_response(response_id) {
 
 // Get an event response params from db
 function get_response_params(response_id) {
-  var ajax_file = $("#hidden-ajax_file").val();
-
   var response_params;
 
   var params = [];
@@ -297,9 +252,8 @@ function get_response_params(response_id) {
   jQuery.ajax({
     data: params.join("&"),
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     async: false,
-    timeout: 10000,
     dataType: "json",
     success: function(data) {
       response_params = data;
@@ -311,8 +265,6 @@ function get_response_params(response_id) {
 
 // Get an event response description from db
 function get_response_description(response_id) {
-  var ajax_file = $("#hidden-ajax_file").val();
-
   var response_description = "";
 
   var params = [];
@@ -323,9 +275,8 @@ function get_response_description(response_id) {
   jQuery.ajax({
     data: params.join("&"),
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     async: false,
-    timeout: 10000,
     dataType: "html",
     success: function(data) {
       response_description = data;
@@ -337,8 +288,6 @@ function get_response_description(response_id) {
 
 // Get an event response description from db
 function get_event_name(event_id, meta, history) {
-  var ajax_file = $("#hidden-ajax_file").val();
-
   var name = "";
 
   var params = [];
@@ -351,9 +300,8 @@ function get_event_name(event_id, meta, history) {
   jQuery.ajax({
     data: params.join("&"),
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     async: false,
-    timeout: 10000,
     dataType: "html",
     success: function(data) {
       name = data;
@@ -382,8 +330,6 @@ function get_response_target(
   server_id,
   response_command
 ) {
-  var ajax_file = $("#hidden-ajax_file").val();
-
   var target = "";
 
   // Replace the main macros
@@ -397,9 +343,8 @@ function get_response_target(
   jQuery.ajax({
     data: params.join("&"),
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     async: false,
-    timeout: 10000,
     dataType: "html",
     success: function(data) {
       target = data;
@@ -409,7 +354,7 @@ function get_response_target(
   // Replace the custom params macros.
   var response_params = get_response_params(response_id);
   if (response_params.length > 1 || response_params[0] != "") {
-    for (i = 0; i < response_params.length; i++) {
+    for (var i = 0; i < response_params.length; i++) {
       if (!response_command) {
         target = target.replace(
           "_" + response_params[i] + "_",
@@ -429,16 +374,10 @@ function get_response_target(
 
 // Perform a response and put the output into a div
 function perform_response(target, response_id) {
-  var ajax_file = $("#hidden-ajax_file").val();
-
   $("#re_exec_command").hide();
   $("#response_loading_command").show();
   $("#response_out").html("");
 
-  var finished = 0;
-  var time = Math.round(+new Date() / 1000);
-  var timeout = time + 10;
-
   var params = [];
   params.push("page=include/ajax/events");
   params.push("perform_event_response=1");
@@ -448,9 +387,8 @@ function perform_response(target, response_id) {
   jQuery.ajax({
     data: params.join("&"),
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     async: true,
-    timeout: 10000,
     dataType: "html",
     success: function(data) {
       var out = data.replace(/[\n|\r]/g, "<br>");
@@ -465,8 +403,6 @@ function perform_response(target, response_id) {
 
 // Perform a response and put the output into a div
 function perform_response_massive(target, response_id, out_iterator) {
-  var ajax_file = $("#hidden-ajax_file").val();
-
   $("#re_exec_command").hide();
   $("#response_loading_command_" + out_iterator).show();
   $("#response_out_" + out_iterator).html("");
@@ -480,9 +416,8 @@ function perform_response_massive(target, response_id, out_iterator) {
   jQuery.ajax({
     data: params.join("&"),
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     async: true,
-    timeout: 10000,
     dataType: "html",
     success: function(data) {
       var out = data.replace(/[\n|\r]/g, "<br>");
@@ -497,42 +432,44 @@ function perform_response_massive(target, response_id, out_iterator) {
 
 // Change the status of an event to new, in process or validated.
 function event_change_status(event_ids) {
-  var ajax_file = $("#hidden-ajax_file").val();
-
   var new_status = $("#estado").val();
   var event_id = $("#hidden-id_event").val();
   var meta = $("#hidden-meta").val();
   var history = $("#hidden-history").val();
 
-  var params = [];
-  params.push("page=include/ajax/events");
-  params.push("change_status=1");
-  params.push("event_ids=" + event_ids);
-  params.push("new_status=" + new_status);
-  params.push("meta=" + meta);
-  params.push("history=" + history);
-
   $("#button-status_button").attr("disabled", "disabled");
   $("#response_loading").show();
 
   jQuery.ajax({
-    data: params.join("&"),
+    data: {
+      page: "include/ajax/events",
+      change_status: 1,
+      event_ids: event_ids,
+      new_status: new_status,
+      meta: meta,
+      history: history
+    },
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     async: true,
-    timeout: 10000,
     dataType: "html",
     success: function(data) {
       $("#button-status_button").removeAttr("disabled");
       $("#response_loading").hide();
-      show_event_dialog(
-        event_id,
-        $("#hidden-group_rep").val(),
-        "responses",
-        data
-      );
+
+      if ($("#notification_status_success").length) {
+        $("#notification_status_success").hide();
+      }
+
+      if ($("#notification_status_error").length) {
+        $("#notification_status_error").hide();
+      }
+
       if (data == "status_ok") {
+        dt_events.draw(false);
+        $("#notification_status_success").show();
       } else {
+        $("#notification_status_error").show();
       }
     }
   });
@@ -541,41 +478,54 @@ function event_change_status(event_ids) {
 
 // Change te owner of an event to one user of empty
 function event_change_owner() {
-  var ajax_file = $("#hidden-ajax_file").val();
-
   var event_id = $("#hidden-id_event").val();
   var new_owner = $("#id_owner").val();
   var meta = $("#hidden-meta").val();
   var history = $("#hidden-history").val();
 
-  var params = [];
-  params.push("page=include/ajax/events");
-  params.push("change_owner=1");
-  params.push("event_id=" + event_id);
-  params.push("new_owner=" + new_owner);
-  params.push("meta=" + meta);
-  params.push("history=" + history);
-
   $("#button-owner_button").attr("disabled", "disabled");
   $("#response_loading").show();
 
   jQuery.ajax({
-    data: params.join("&"),
+    data: {
+      page: "include/ajax/events",
+      change_owner: 1,
+      event_id: event_id,
+      new_owner: new_owner,
+      meta: meta,
+      history: history
+    },
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     async: true,
-    timeout: 10000,
     dataType: "html",
     success: function(data) {
       $("#button-owner_button").removeAttr("disabled");
       $("#response_loading").hide();
 
-      show_event_dialog(
-        event_id,
-        $("#hidden-group_rep").val(),
-        "responses",
-        data
-      );
+      if ($("#notification_owner_success").length) {
+        $("#notification_owner_success").hide();
+      }
+
+      if ($("#notification_owner_error").length) {
+        $("#notification_owner_error").hide();
+      }
+
+      if (data == "owner_ok") {
+        dt_events.draw(false);
+        $("#notification_owner_success").show();
+        if (new_owner == -1) {
+          $("#extended_event_general_page table td.general_owner").html(
+            "<i>N/A</i>"
+          );
+        } else {
+          $("#extended_event_general_page table td.general_owner").text(
+            new_owner
+          );
+        }
+      } else {
+        $("#notification_owner_error").show();
+      }
     }
   });
 
@@ -584,20 +534,21 @@ function event_change_owner() {
 
 // Save a comment into an event
 function event_comment() {
-  var ajax_file = $("#hidden-ajax_file").val();
+  var event;
+  try {
+    event = JSON.parse(atob(current_event));
+  } catch (e) {
+    console.error(e);
+    return;
+  }
 
-  var event_id = $("#hidden-id_event").val();
+  var event_id = event.id_evento;
   var comment = $("#textarea_comment").val();
   var meta = $("#hidden-meta").val();
   var history = $("#hidden-history").val();
 
   if (comment == "") {
-    show_event_dialog(
-      event_id,
-      $("#hidden-group_rep").val(),
-      "comments",
-      "comment_error"
-    );
+    show_event_dialog(current_event, "comments", "comment_error");
     return false;
   }
 
@@ -615,20 +566,13 @@ function event_comment() {
   jQuery.ajax({
     data: params.join("&"),
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     async: true,
-    timeout: 10000,
     dataType: "html",
     success: function(data) {
       $("#button-comment_button").removeAttr("disabled");
-      $("#response_loading").show();
-
-      show_event_dialog(
-        event_id,
-        $("#hidden-group_rep").val(),
-        "comments",
-        data
-      );
+      $("#response_loading").hide();
+      $("#link_comments").click();
     }
   });
 
@@ -637,8 +581,7 @@ function event_comment() {
 
 //Show event list when fielter repetead is Group agents
 function show_events_group_agent(id_insert, id_agent, server_id) {
-  var ajax_file = $("#hidden-ajax_file").val();
-  parameter = [];
+  var parameter = [];
   parameter.push({ name: "id_agent", value: id_agent });
   parameter.push({ name: "server_id", value: server_id });
   parameter.push({ name: "event_type", value: $("#event_type").val() });
@@ -680,7 +623,7 @@ function show_events_group_agent(id_insert, id_agent, server_id) {
 
   jQuery.ajax({
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     data: parameter,
     dataType: "html",
     success: function(data) {
@@ -691,8 +634,6 @@ function show_events_group_agent(id_insert, id_agent, server_id) {
 }
 
 function show_event_response_command_dialog(id, response, total_checked) {
-  var ajax_file = $("#hidden-ajax_file").val();
-
   var params = [];
   params.push("page=include/ajax/events");
   params.push("get_table_response_command=1");
@@ -701,7 +642,7 @@ function show_event_response_command_dialog(id, response, total_checked) {
   jQuery.ajax({
     data: params.join("&"),
     type: "POST",
-    url: (action = ajax_file),
+    url: $("#hidden-ajax_file").val(),
     dataType: "html",
     success: function(data) {
       $("#event_response_command_window")
@@ -739,3 +680,232 @@ function show_event_response_command_dialog(id, response, total_checked) {
     }
   });
 }
+
+var processed = 0;
+function update_event(table, id_evento, type, event_rep, row) {
+  var inputs = $("#events_form :input");
+  var values = {};
+  var redraw = false;
+  inputs.each(function() {
+    values[this.name] = $(this).val();
+  });
+  var t1 = new Date();
+
+  // Update events matching current filters and id_evento selected.
+  $.ajax({
+    async: true,
+    type: "POST",
+    url: $("#hidden-ajax_file").val(),
+    data: {
+      page: "include/ajax/events",
+      validate_event: type.validate_event,
+      in_process_event: type.in_process_event,
+      delete_event: type.delete_event,
+      id_evento: id_evento,
+      event_rep: event_rep,
+      filter: values
+    },
+    success: function(d) {
+      processed += 1;
+      var t2 = new Date();
+      var diff_g = t2.getTime() - t1.getTime();
+      var diff_s = diff_g / 1000;
+      if (processed >= $(".chk_val:checked").length) {
+        // If operation takes less than 2 seconds, redraw.
+        if (diff_s < 2 || $(".chk_val:checked").length > 1) {
+          redraw = true;
+        }
+        if (redraw) {
+          table.draw(false);
+        } else {
+          $(row)
+            .closest("tr")
+            .remove();
+        }
+      }
+    },
+    error: function() {
+      processed += 1;
+    }
+  });
+}
+
+function validate_event(table, id_evento, event_rep, row) {
+  var button = document.getElementById("val-" + id_evento);
+  if (!button) {
+    // Button does not exist. Ignore.
+    processed += 1;
+    return;
+  }
+
+  button.children[0];
+  button.children[0].src = "images/spinner.gif";
+  return update_event(table, id_evento, { validate_event: 1 }, event_rep, row);
+}
+
+function in_process_event(table, id_evento, event_rep, row) {
+  var button = document.getElementById("proc-" + id_evento);
+  if (!button) {
+    // Button does not exist. Ignore.
+    processed += 1;
+    return;
+  }
+
+  button.children[0];
+  button.children[0].src = "images/spinner.gif";
+  return update_event(
+    table,
+    id_evento,
+    { in_process_event: 1 },
+    event_rep,
+    row
+  );
+}
+
+function delete_event(table, id_evento, event_rep, row) {
+  var button = document.getElementById("del-" + id_evento);
+  if (!button) {
+    // Button does not exist. Ignore.
+    processed += 1;
+    return;
+  }
+
+  button.children[0];
+  button.children[0].src = "images/spinner.gif";
+  return update_event(table, id_evento, { delete_event: 1 }, event_rep, row);
+}
+
+// Imported from old files.
+function execute_event_response(event_list_btn) {
+  processed = 0;
+  $("#max_custom_event_resp_msg").hide();
+  $("#max_custom_selected").hide();
+
+  var response_id = $("select[name=response_id]").val();
+
+  var total_checked = $(".chk_val:checked").length;
+
+  // Check select an event.
+  if (total_checked == 0) {
+    $("#max_custom_selected").show();
+    return;
+  }
+
+  if (!isNaN(response_id)) {
+    // It is a custom response
+    var response = get_response(response_id);
+
+    // If cannot get response abort it
+    if (response == null) {
+      return;
+    }
+
+    // Limit number of events to apply custom responses
+    // due performance reasons.
+    if (total_checked > $("#max_execution_event_response").val()) {
+      $("#max_custom_event_resp_msg").show();
+      return;
+    }
+
+    var response_command = [];
+    $(".response_command_input").each(function() {
+      response_command[$(this).attr("name")] = $(this).val();
+    });
+
+    if (event_list_btn) {
+      $("#button-submit_event_response").hide(function() {
+        $("#response_loading_dialog").show(function() {
+          var check_params = get_response_params(response_id);
+
+          if (check_params[0] !== "") {
+            show_event_response_command_dialog(
+              response_id,
+              response,
+              total_checked
+            );
+          } else {
+            check_massive_response_event(
+              response_id,
+              response,
+              total_checked,
+              response_command
+            );
+          }
+        });
+      });
+    } else {
+      $("#button-btn_str").hide(function() {
+        $("#execute_again_loading").show(function() {
+          check_massive_response_event(
+            response_id,
+            response,
+            total_checked,
+            response_command
+          );
+        });
+      });
+    }
+  } else {
+    // It is not a custom response
+    switch (response_id) {
+      case "in_progress_selected":
+        $(".chk_val:checked").each(function() {
+          // Parent: TD. GrandParent: TR.
+          in_process_event(
+            dt_events,
+            $(this).val(),
+            $(this).attr("event_rep"),
+            this.parentElement.parentElement
+          );
+        });
+        break;
+      case "validate_selected":
+        $(".chk_val:checked").each(function() {
+          validate_event(
+            dt_events,
+            $(this).val(),
+            $(this).attr("event_rep"),
+            this.parentElement.parentElement
+          );
+        });
+        break;
+      case "delete_selected":
+        $(".chk_val:checked").each(function() {
+          delete_event(
+            dt_events,
+            $(this).val(),
+            $(this).attr("event_rep"),
+            this.parentElement.parentElement
+          );
+        });
+        break;
+    }
+  }
+}
+
+function check_massive_response_event(
+  response_id,
+  response,
+  total_checked,
+  response_command
+) {
+  var counter = 0;
+  var end = 0;
+
+  $(".chk_val:checked").each(function() {
+    var event_id = $(this).val();
+    var server_id = $("#hidden-server_id_" + event_id).val();
+    response["target"] = get_response_target(
+      event_id,
+      response_id,
+      server_id,
+      response_command
+    );
+
+    if (total_checked - 1 === counter) end = 1;
+
+    show_massive_response_dialog(event_id, response_id, response, counter, end);
+
+    counter++;
+  });
+}
diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js
index 0487923b38..d04c3d2bd6 100644
--- a/pandora_console/include/javascript/pandora_modules.js
+++ b/pandora_console/include/javascript/pandora_modules.js
@@ -536,7 +536,7 @@ function configure_modules_form() {
 
           var obj = jQuery.parseJSON(data["macros"]);
           $.each(obj, function(k, macro) {
-            add_macro_field(macro, "simple-macro");
+            add_macro_field(macro, "simple-macro", "td", k);
           });
         }
 
@@ -791,7 +791,7 @@ function new_macro(prefix, callback) {
   }
 }
 
-function add_macro_field(macro, row_model_id) {
+function add_macro_field(macro, row_model_id, type_copy, k) {
   var macro_desc = macro["desc"];
   // Change the carriage returns by html returns <br> in help
   var macro_help = macro["help"].replace(/&#x0d;/g, "<br>");
@@ -799,7 +799,6 @@ function add_macro_field(macro, row_model_id) {
   var macro_value = $("<div />")
     .html(macro["value"])
     .text();
-  var macro_hide = macro["hide"];
 
   macro_value.type = "password";
 
@@ -809,6 +808,7 @@ function add_macro_field(macro, row_model_id) {
 
   // Change attributes to be unique and with identificable class
   $macro_field.attr("id", row_id);
+
   $macro_field.attr("class", "macro_field");
 
   // Get the number of fields already printed
@@ -828,6 +828,19 @@ function add_macro_field(macro, row_model_id) {
     );
   }
 
+  // Only for create module type plugin need rename
+  // td id "simple-macro_field" + k + "-1" is horrible.
+  if (k) {
+    $("#" + row_model_id + "_field" + k + "_ td:eq(0)").attr(
+      "id",
+      "simple-macro_field" + k + "-0"
+    );
+    $("#" + row_model_id + "_field" + k + "_ td:eq(1)").attr(
+      "id",
+      "simple-macro_field" + k + "-1"
+    );
+  }
+
   // Change the label
   if (macro_help == "") {
     $("#" + row_id)
@@ -850,16 +863,29 @@ function add_macro_field(macro, row_model_id) {
   }
 
   // Change the text box id and value
-  $("#" + row_id)
-    .children()
-    .eq(1)
-    .attr("id", "text-" + macro_macro);
-  $("#" + row_id)
-    .children()
-    .eq(1)
-    .attr("name", macro_macro);
+  if (type_copy == "td") {
+    $("#" + row_id)
+      .children()
+      .eq(1)
+      .children()
+      .attr("id", "text-" + macro_macro);
+    $("#" + row_id)
+      .children()
+      .eq(1)
+      .children()
+      .attr("name", macro_macro);
+  } else {
+    $("#" + row_id)
+      .children()
+      .eq(1)
+      .attr("id", "text-" + macro_macro);
+    $("#" + row_id)
+      .children()
+      .eq(1)
+      .attr("name", macro_macro);
+  }
 
-  macro_field_hide = false;
+  var macro_field_hide = false;
   if (typeof macro["hide"] == "string") {
     if (macro["hide"].length == 0) {
       macro_field_hide = false;
@@ -872,16 +898,33 @@ function add_macro_field(macro, row_model_id) {
     }
   }
 
-  if (macro_field_hide) {
-    $("#" + row_id)
-      .children()
-      .eq(1)
-      .attr("type", "password");
+  if (type_copy == "td") {
+    if (macro_field_hide) {
+      $("#" + row_id)
+        .children()
+        .eq(1)
+        .children()
+        .attr("type", "password");
+    } else {
+      $("#" + row_id)
+        .children()
+        .eq(1)
+        .children()
+        .val(macro_value);
+    }
+  } else {
+    if (macro_field_hide) {
+      $("#" + row_id)
+        .children()
+        .eq(1)
+        .attr("type", "password");
+    } else {
+      $("#" + row_id)
+        .children()
+        .eq(1)
+        .val(macro_value);
+    }
   }
-  $("#" + row_id)
-    .children()
-    .eq(1)
-    .val(macro_value);
 
   $("#" + row_id).show();
 }
@@ -908,7 +951,7 @@ function load_plugin_macros_fields(row_model_id) {
         $("#hidden-macros").val(data["base64"]);
         jQuery.each(data["array"], function(i, macro) {
           if (macro["desc"] != "") {
-            add_macro_field(macro, row_model_id);
+            add_macro_field(macro, row_model_id, "td");
           }
         });
         //Plugin text can be larger
@@ -1223,3 +1266,42 @@ function get_explanation_recon_script(id, id_rt, url) {
 
   taskManager.addTask(xhr);
 }
+
+// Filter modules in a select (bulk operations)
+function filterByText(selectbox, textbox, textNoData) {
+  return selectbox.each(function() {
+    var select = selectbox;
+    var options = [];
+    $(select)
+      .find("option")
+      .each(function() {
+        options.push({ value: $(this).val(), text: $(this).text() });
+      });
+    $(select).data("options", options);
+    $(textbox).bind("change keyup", function() {
+      var options = $(select)
+        .empty()
+        .scrollTop(0)
+        .data("options");
+      var search = $(this).val();
+      var regex = new RegExp(search, "gi");
+      $.each(options, function(i) {
+        var option = options[i];
+        if (option.text.match(regex) !== null) {
+          $(select).append(
+            $("<option>")
+              .text(option.text)
+              .val(option.value)
+          );
+        }
+      });
+      if ($(select)[0].length == 0) {
+        $(select).append(
+          $("<option>")
+            .text(textNoData)
+            .val(textNoData)
+        );
+      }
+    });
+  });
+}
diff --git a/pandora_console/include/javascript/pandora_snmp_browser.js b/pandora_console/include/javascript/pandora_snmp_browser.js
index ee75eac71f..dbe8121a64 100644
--- a/pandora_console/include/javascript/pandora_snmp_browser.js
+++ b/pandora_console/include/javascript/pandora_snmp_browser.js
@@ -417,3 +417,50 @@ function checkSNMPVersion() {
     $("#snmp3_browser_options").css("display", "none");
   }
 }
+
+// Show the SNMP browser window
+function snmpBrowserWindow() {
+  // Keep elements in the form and the SNMP browser synced
+  $("#text-target_ip").val($("#text-ip_target").val());
+  $("#text-community").val($("#text-snmp_community").val());
+  $("#snmp_browser_version").val($("#snmp_version").val());
+  $("#text-snmp3_browser_auth_user").val($("#text-snmp3_auth_user").val());
+  $("#snmp3_browser_security_level").val($("#snmp3_security_level").val());
+  $("#snmp3_browser_auth_method").val($("#snmp3_auth_method").val());
+  $("#password-snmp3_browser_auth_pass").val(
+    $("#password-snmp3_auth_pass").val()
+  );
+  $("#snmp3_browser_privacy_method").val($("#snmp3_privacy_method").val());
+  $("#password-snmp3_browser_privacy_pass").val(
+    $("#password-snmp3_privacy_pass").val()
+  );
+
+  checkSNMPVersion();
+
+  $("#snmp_browser_container")
+    .show()
+    .dialog({
+      title: "",
+      resizable: true,
+      draggable: true,
+      modal: true,
+      overlay: {
+        opacity: 0.5,
+        background: "black"
+      },
+      width: 920,
+      height: 500
+    });
+}
+
+// Set the form OID to the value selected in the SNMP browser
+function setOID() {
+  if ($("#snmp_browser_version").val() == "3") {
+    $("#text-snmp_oid").val($("#table1-0-1").text());
+  } else {
+    $("#text-snmp_oid").val($("#snmp_selected_oid").text());
+  }
+
+  // Close the SNMP browser
+  $(".ui-dialog-titlebar-close").trigger("click");
+}
diff --git a/pandora_console/include/javascript/pandora_visual_console.js b/pandora_console/include/javascript/pandora_visual_console.js
index b78270f3dc..6a726a1d8e 100755
--- a/pandora_console/include/javascript/pandora_visual_console.js
+++ b/pandora_console/include/javascript/pandora_visual_console.js
@@ -67,6 +67,13 @@ function createVisualConsole(
                     ? JSON.parse(data.items)
                     : data.items;
 
+                // Add the datetime when the item was received.
+                var receivedAt = new Date();
+                items.map(function(item) {
+                  item["receivedAt"] = receivedAt;
+                  return item;
+                });
+
                 var prevProps = visualConsole.props;
                 // Update the data structure.
                 visualConsole.props = props;
@@ -116,7 +123,7 @@ function createVisualConsole(
   try {
     visualConsole = new VisualConsole(container, props, items);
     // VC Item clicked.
-    visualConsole.onClick(function(e) {
+    visualConsole.onItemClick(function(e) {
       // Override the link to another VC if it isn't on remote console.
       if (
         e.data &&
@@ -132,6 +139,94 @@ function createVisualConsole(
         updateVisualConsole(e.data.linkedLayoutId, updateInterval);
       }
     });
+    // VC Item moved.
+    visualConsole.onItemMoved(function(e) {
+      var id = e.item.props.id;
+      var data = {
+        x: e.newPosition.x,
+        y: e.newPosition.y,
+        type: e.item.props.type
+      };
+      var taskId = "visual-console-item-move-" + id;
+
+      // Persist the new position.
+      asyncTaskManager
+        .add(taskId, function(done) {
+          var abortable = updateVisualConsoleItem(
+            baseUrl,
+            visualConsole.props.id,
+            id,
+            data,
+            function(error, data) {
+              // if (!error && !data) return;
+              if (error || !data) {
+                console.log(
+                  "[ERROR]",
+                  "[VISUAL-CONSOLE-CLIENT]",
+                  "[API]",
+                  error ? error.message : "Invalid response"
+                );
+
+                // Move the element to its initial position.
+                e.item.move(e.prevPosition.x, e.prevPosition.y);
+              }
+
+              done();
+            }
+          );
+
+          return {
+            cancel: function() {
+              abortable.abort();
+            }
+          };
+        })
+        .init();
+    });
+    // VC Item resized.
+    visualConsole.onItemResized(function(e) {
+      var id = e.item.props.id;
+      var data = {
+        width: e.newSize.width,
+        height: e.newSize.height,
+        type: e.item.props.type
+      };
+      var taskId = "visual-console-item-resize-" + id;
+
+      // Persist the new size.
+      asyncTaskManager
+        .add(taskId, function(done) {
+          var abortable = updateVisualConsoleItem(
+            baseUrl,
+            visualConsole.props.id,
+            id,
+            data,
+            function(error, data) {
+              // if (!error && !data) return;
+              if (error || !data) {
+                console.log(
+                  "[ERROR]",
+                  "[VISUAL-CONSOLE-CLIENT]",
+                  "[API]",
+                  error ? error.message : "Invalid response"
+                );
+
+                // Resize the element to its initial Size.
+                e.item.resize(e.prevSize.width, e.prevSize.height);
+              }
+
+              done();
+            }
+          );
+
+          return {
+            cancel: function() {
+              abortable.abort();
+            }
+          };
+        })
+        .init();
+    });
 
     if (updateInterval != null && updateInterval > 0) {
       // Start an interval to update the Visual Console.
@@ -259,6 +354,75 @@ function loadVisualConsoleData(baseUrl, vcId, callback) {
   };
 }
 
+/**
+ * Fetch a Visual Console's structure and its items.
+ * @param {string} baseUrl Base URL to build the API path.
+ * @param {number} vcId Identifier of the Visual Console.
+ * @param {number} vcItemId Identifier of the Visual Console's item.
+ * @param {Object} data Data we want to save.
+ * @param {function} callback Function to be executed on request success or fail.
+ * @return {Object} Cancellable. Object which include and .abort([statusText]) function.
+ */
+// eslint-disable-next-line no-unused-vars
+function updateVisualConsoleItem(baseUrl, vcId, vcItemId, data, callback) {
+  // var apiPath = baseUrl + "/include/rest-api";
+  var apiPath = baseUrl + "/ajax.php";
+  var jqXHR = null;
+
+  // Cancel the ajax requests.
+  var abort = function(textStatus) {
+    if (textStatus == null) textStatus = "abort";
+
+    // -- XMLHttpRequest.readyState --
+    // Value	State	  Description
+    // 0	    UNSENT	Client has been created. open() not called yet.
+    // 4	    DONE   	The operation is complete.
+
+    if (jqXHR.readyState !== 0 && jqXHR.readyState !== 4)
+      jqXHR.abort(textStatus);
+  };
+
+  // Failed request handler.
+  var handleFail = function(jqXHR, textStatus, errorThrown) {
+    abort();
+    // Manually aborted or not.
+    if (textStatus === "abort") {
+      callback();
+    } else {
+      var error = new Error(errorThrown);
+      error.request = jqXHR;
+      callback(error);
+    }
+  };
+
+  // Function which handle success case.
+  var handleSuccess = function(data) {
+    callback(null, data);
+  };
+
+  // Visual Console container request.
+  jqXHR = jQuery
+    // .get(apiPath + "/visual-consoles/" + vcId, null, "json")
+    .get(
+      apiPath,
+      {
+        page: "include/rest-api/index",
+        updateVisualConsoleItem: 1,
+        visualConsoleId: vcId,
+        visualConsoleItemId: vcItemId,
+        data: data
+      },
+      "json"
+    )
+    .done(handleSuccess)
+    .fail(handleFail);
+
+  // Abortable.
+  return {
+    abort: abort
+  };
+}
+
 // TODO: Delete the functions below when you can.
 /**************************************
  These functions require jQuery library
diff --git a/pandora_console/include/javascript/tree/TreeController.js b/pandora_console/include/javascript/tree/TreeController.js
index b544dbfd95..c51e50a361 100644
--- a/pandora_console/include/javascript/tree/TreeController.js
+++ b/pandora_console/include/javascript/tree/TreeController.js
@@ -624,7 +624,10 @@ var TreeController = {
                   'images/tree_service_map.png" /> '
               );
 
-              if (typeof element.serviceDetail != "undefined") {
+              if (
+                typeof element.serviceDetail != "undefined" &&
+                element.name != null
+              ) {
                 $serviceDetailImage
                   .click(function(e) {
                     e.preventDefault();
@@ -634,10 +637,11 @@ var TreeController = {
                   .css("cursor", "pointer");
 
                 $content.append($serviceDetailImage);
+                $content.append(" " + element.name);
+              } else {
+                $content.remove($node);
               }
 
-              $content.append(" " + element.name);
-
               break;
             case "modules":
               if (
diff --git a/pandora_console/include/javascript/update_manager.js b/pandora_console/include/javascript/update_manager.js
index bab4ef2aae..0cc385fb95 100644
--- a/pandora_console/include/javascript/update_manager.js
+++ b/pandora_console/include/javascript/update_manager.js
@@ -44,7 +44,7 @@ function form_upload(homeurl) {
         "<li>" +
           '<input type="text" id="input-progress" ' +
           'value="0" data-width="55" data-height="55" ' +
-          'data-fgColor="#80BA27" data-readOnly="1" ' +
+          'data-fgColor="#82b92e" data-readOnly="1" ' +
           'data-bgColor="#3E4043" />' +
           "<p></p><span></span>" +
           "</li>"
diff --git a/pandora_console/include/load_session.php b/pandora_console/include/load_session.php
index 22a7226a8f..80fb8643ef 100644
--- a/pandora_console/include/load_session.php
+++ b/pandora_console/include/load_session.php
@@ -1,32 +1,75 @@
 <?php
+/**
+ * Session manager.
+ *
+ * @category   Session handler.
+ * @package    Pandora FMS.
+ * @subpackage OpenSource.
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the  GNU Lesser General Public License
-// as published by the Free Software Foundation; version 2
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
+// Begin.
+
+
+/**
+ * Open session.
+ *
+ * @param string $save_path    Save path.
+ * @param string $session_name Session name.
+ *
+ * @return boolean
+ */
 function pandora_session_open($save_path, $session_name)
 {
     return true;
 }
 
 
+/**
+ * Close session.
+ *
+ * @return boolean
+ */
 function pandora_session_close()
 {
     return true;
 }
 
 
+/**
+ * Read a session.
+ *
+ * @param string $session_id Session ID.
+ *
+ * @return string Session data.
+ */
 function pandora_session_read($session_id)
 {
     $session_id = addslashes($session_id);
-    $session_data = db_get_value('data', 'tsessions_php', 'id_session', $session_id);
+    $session_data = db_get_value(
+        'data',
+        'tsessions_php',
+        'id_session',
+        $session_id
+    );
 
     if (!empty($session_data)) {
         return $session_data;
@@ -36,10 +79,25 @@ function pandora_session_read($session_id)
 }
 
 
+/**
+ * Write session data.
+ *
+ * @param string $session_id Session id.
+ * @param string $data       Data.
+ *
+ * @return boolean
+ */
 function pandora_session_write($session_id, $data)
 {
     $session_id = addslashes($session_id);
 
+    if (is_ajax()) {
+        // Avoid session upadte while processing ajax responses - notifications.
+        if (get_parameter('check_new_notifications', false)) {
+            return true;
+        }
+    }
+
     $values = [];
     $values['last_active'] = time();
 
@@ -47,40 +105,95 @@ function pandora_session_write($session_id, $data)
         $values['data'] = addslashes($data);
     }
 
-    $session_exists = (bool) db_get_value('COUNT(id_session)', 'tsessions_php', 'id_session', $session_id);
+    $session_exists = (bool) db_get_value(
+        'COUNT(id_session)',
+        'tsessions_php',
+        'id_session',
+        $session_id
+    );
 
     if (!$session_exists) {
         $values['id_session'] = $session_id;
         $retval_write = db_process_sql_insert('tsessions_php', $values);
     } else {
-        $retval_write = db_process_sql_update('tsessions_php', $values, ['id_session' => $session_id]);
+        $retval_write = db_process_sql_update(
+            'tsessions_php',
+            $values,
+            ['id_session' => $session_id]
+        );
     }
 
     return $retval_write !== false;
 }
 
 
+/**
+ * Destroy a session.
+ *
+ * @param string $session_id Session Id.
+ *
+ * @return boolean
+ */
 function pandora_session_destroy($session_id)
 {
     $session_id = addslashes($session_id);
 
-    $retval = (bool) db_process_sql_delete('tsessions_php', ['id_session' => $session_id]);
+    $retval = (bool) db_process_sql_delete(
+        'tsessions_php',
+        ['id_session' => $session_id]
+    );
 
     return $retval;
 }
 
 
+/**
+ * Session garbage collector.
+ *
+ * @param integer $max_lifetime Max lifetime.
+ *
+ * @return boolean.
+ */
 function pandora_session_gc($max_lifetime=300)
 {
     global $config;
 
     if (isset($config['session_timeout'])) {
-        $max_lifetime = $config['session_timeout'];
+        $session_timeout = $config['session_timeout'];
+    } else {
+        // if $config doesn`t work ...
+        $session_timeout = db_get_value(
+            'value',
+            'tconfig',
+            'token',
+            'session_timeout'
+        );
+    }
+
+    if (!empty($session_timeout)) {
+        if ($session_timeout == -1) {
+            // The session expires in 10 years
+            $session_timeout = 315576000;
+        } else {
+            $session_timeout *= 60;
+        }
+
+        $max_lifetime = $session_timeout;
     }
 
     $time_limit = (time() - $max_lifetime);
 
-    $retval = (bool) db_process_sql_delete('tsessions_php', ['last_active' => '<'.$time_limit]);
+    $retval = (bool) db_process_sql_delete(
+        'tsessions_php',
+        [
+            'last_active' => '<'.$time_limit,
+        ]
+    );
+
+    // Deleting cron and empty sessions.
+    $sql = "DELETE FROM tsessions_php WHERE 
+        data IS NULL OR id_session REGEXP '^cron-'";
+    db_process_sql($sql);
 
     return $retval;
 }
@@ -88,5 +201,12 @@ function pandora_session_gc($max_lifetime=300)
 
 // FIXME: SAML should work with pandora session handlers
 if (db_get_value('value', 'tconfig', 'token', 'auth') != 'saml') {
-    $result_handler = session_set_save_handler('pandora_session_open', 'pandora_session_close', 'pandora_session_read', 'pandora_session_write', 'pandora_session_destroy', 'pandora_session_gc');
+    $result_handler = session_set_save_handler(
+        'pandora_session_open',
+        'pandora_session_close',
+        'pandora_session_read',
+        'pandora_session_write',
+        'pandora_session_destroy',
+        'pandora_session_gc'
+    );
 }
diff --git a/pandora_console/include/rest-api/index.php b/pandora_console/include/rest-api/index.php
index 10f87488c7..1aa8bfb5a9 100644
--- a/pandora_console/include/rest-api/index.php
+++ b/pandora_console/include/rest-api/index.php
@@ -13,6 +13,7 @@ use Models\VisualConsole\Container as VisualConsole;
 $visualConsoleId = (int) get_parameter('visualConsoleId');
 $getVisualConsole = (bool) get_parameter('getVisualConsole');
 $getVisualConsoleItems = (bool) get_parameter('getVisualConsoleItems');
+$updateVisualConsoleItem = (bool) get_parameter('updateVisualConsoleItem');
 
 // Check groups can access user.
 $aclUserGroups = [];
@@ -44,6 +45,21 @@ if ($getVisualConsole === true) {
 } else if ($getVisualConsoleItems === true) {
     $vcItems = VisualConsole::getItemsFromDB($visualConsoleId, $aclUserGroups);
     echo '['.implode($vcItems, ',').']';
+} else if ($updateVisualConsoleItem === true) {
+    $visualConsoleId = (integer) get_parameter('visualConsoleId');
+    $visualConsoleItemId = (integer) get_parameter('visualConsoleItemId');
+    $data = get_parameter('data');
+
+    $class = VisualConsole::getItemClass($data['type']);
+
+    $item_data = [];
+    $item_data['id'] = $visualConsoleItemId;
+    $item_data['id_layout'] = $visualConsoleId;
+
+    $item = $class::fromDB($item_data);
+    $result = $item->save($data);
+
+    echo json_encode($result);
 }
 
 exit;
diff --git a/pandora_console/include/rest-api/models/Model.php b/pandora_console/include/rest-api/models/Model.php
index 78ef90468e..cebdb3d0d7 100644
--- a/pandora_console/include/rest-api/models/Model.php
+++ b/pandora_console/include/rest-api/models/Model.php
@@ -47,6 +47,30 @@ abstract class Model
     abstract protected function decode(array $data): array;
 
 
+    /**
+     * Return a valid representation of a record in database.
+     *
+     * @param array $data Input data.
+     *
+     * @return array Data structure representing a record in database.
+     *
+     * @abstract
+     */
+    abstract protected function encode(array $data): array;
+
+
+    /**
+     * Insert or update an item in the database
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return boolean The modeled element data structure stored into the DB.
+     *
+     * @abstract
+     */
+    abstract public function save(array $data=[]);
+
+
     /**
      * Constructor of the model. It won't be public. The instances
      * will be created through factories which start with from*.
@@ -62,6 +86,12 @@ abstract class Model
     }
 
 
+    public function setData(array $data)
+    {
+        $this->data = $data;
+    }
+
+
     /**
      * Instance the class with the unknown input data.
      *
@@ -69,7 +99,7 @@ abstract class Model
      *
      * @return self Instance of the model.
      */
-    public static function fromArray(array $data)
+    public static function fromArray(array $data): self
     {
         // The reserved word static refers to the invoked class at runtime.
         return new static($data);
diff --git a/pandora_console/include/rest-api/models/VisualConsole/Container.php b/pandora_console/include/rest-api/models/VisualConsole/Container.php
index ad1f34a2ff..9ad437ed5b 100644
--- a/pandora_console/include/rest-api/models/VisualConsole/Container.php
+++ b/pandora_console/include/rest-api/models/VisualConsole/Container.php
@@ -92,6 +92,37 @@ final class Container extends Model
     }
 
 
+    /**
+     * Return a valid representation of a record in database.
+     *
+     * @param array $data Input data.
+     *
+     * @return array Data structure representing a record in database.
+     *
+     * @overrides Model::encode.
+     */
+    protected function encode(array $data): array
+    {
+        $result = [];
+        return $result;
+    }
+
+
+    /**
+     * Insert or update an item in the database
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return boolean The modeled element data structure stored into the DB.
+     *
+     * @overrides Model::save.
+     */
+    public function save(array $data=[]): bool
+    {
+        return true;
+    }
+
+
     /**
      * Extract a group Id value.
      *
@@ -319,7 +350,7 @@ final class Container extends Model
         // Default filter.
         $filter = ['id_layout' => $layoutId];
         $fields = [
-            'id',
+            'DISTINCT(id) AS id',
             'type',
             'cache_expiration',
             'id_layout',
@@ -340,8 +371,9 @@ final class Container extends Model
             // Only true condition if type is GROUP_ITEM.
             $filter[] = '('.\db_format_array_where_clause_sql(
                 [
-                    'type'     => GROUP_ITEM,
-                    'id_group' => $groupsFilter,
+                    'id_layout' => $layoutId,
+                    'type'      => GROUP_ITEM,
+                    'id_group'  => $groupsFilter,
                 ]
             ).')';
         }
diff --git a/pandora_console/include/rest-api/models/VisualConsole/Item.php b/pandora_console/include/rest-api/models/VisualConsole/Item.php
index 617b48e517..3105233b31 100644
--- a/pandora_console/include/rest-api/models/VisualConsole/Item.php
+++ b/pandora_console/include/rest-api/models/VisualConsole/Item.php
@@ -240,7 +240,7 @@ class Item extends CachedModel
     private static function extractX(array $data): int
     {
         return static::parseIntOr(
-            static::issetInArray($data, ['x', 'pos_x']),
+            static::issetInArray($data, ['x', 'pos_x', 'posX', 'startX']),
             0
         );
     }
@@ -256,7 +256,7 @@ class Item extends CachedModel
     private static function extractY(array $data): int
     {
         return static::parseIntOr(
-            static::issetInArray($data, ['y', 'pos_y']),
+            static::issetInArray($data, ['y', 'pos_y', 'posY', 'startY']),
             0
         );
     }
@@ -272,7 +272,7 @@ class Item extends CachedModel
     private static function extractAclGroupId(array $data)
     {
         return static::parseIntOr(
-            static::issetInArray($data, ['id_group', 'aclGroupId']),
+            static::issetInArray($data, ['id_group', 'aclGroupId', 'idGroup']),
             null
         );
     }
@@ -288,7 +288,7 @@ class Item extends CachedModel
     private static function extractParentId(array $data)
     {
         return static::parseIntOr(
-            static::issetInArray($data, ['parentId', 'parent_item']),
+            static::issetInArray($data, ['parentId', 'parent_item', 'parentItem']),
             null
         );
     }
@@ -304,7 +304,7 @@ class Item extends CachedModel
     private static function extractIsOnTop(array $data): bool
     {
         return static::parseBool(
-            static::issetInArray($data, ['isOnTop', 'show_on_top'])
+            static::issetInArray($data, ['isOnTop', 'show_on_top', 'showOnTop'])
         );
     }
 
@@ -319,7 +319,7 @@ class Item extends CachedModel
     private static function extractIsLinkEnabled(array $data): bool
     {
         return static::parseBool(
-            static::issetInArray($data, ['isLinkEnabled', 'enable_link'])
+            static::issetInArray($data, ['isLinkEnabled', 'enable_link', 'enableLink'])
         );
     }
 
@@ -376,7 +376,23 @@ class Item extends CachedModel
     private static function extractAgentId(array $data)
     {
         return static::parseIntOr(
-            static::issetInArray($data, ['agentId', 'id_agent', 'id_agente']),
+            static::issetInArray($data, ['agentId', 'id_agent', 'id_agente', 'idAgent', 'idAgente']),
+            null
+        );
+    }
+
+
+    /**
+     * Extract a custom id graph value.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return integer Valid identifier of an agent.
+     */
+    private static function extractIdCustomGraph(array $data)
+    {
+        return static::parseIntOr(
+            static::issetInArray($data, ['id_custom_graph', 'idCustomGraph', 'customGraphId']),
             null
         );
     }
@@ -398,6 +414,9 @@ class Item extends CachedModel
                     'moduleId',
                     'id_agente_modulo',
                     'id_modulo',
+                    'idModulo',
+                    'idAgenteModulo',
+                    'idAgentModule',
                 ]
             ),
             null
@@ -1187,4 +1206,468 @@ class Item extends CachedModel
     }
 
 
+    /**
+     * Return a valid representation of a record in database.
+     *
+     * @param array $data Input data.
+     *
+     * @return array Data structure representing a record in database.
+     *
+     * @overrides Model::encode.
+     */
+    protected function encode(array $data): array
+    {
+        $result = [];
+
+        $id = static::getId($data);
+        if ($id) {
+            $result['id'] = $id;
+        }
+
+        $id_layout = static::getIdLayout($data);
+        if ($id_layout) {
+            $result['id_layout'] = $id_layout;
+        }
+
+        $pos_x = static::parseIntOr(
+            static::issetInArray($data, ['x', 'pos_x', 'posX']),
+            null
+        );
+        if ($pos_x !== null) {
+            $result['pos_x'] = $pos_x;
+        }
+
+        $pos_y = static::parseIntOr(
+            static::issetInArray($data, ['y', 'pos_y', 'posY']),
+            null
+        );
+        if ($pos_y !== null) {
+            $result['pos_y'] = $pos_y;
+        }
+
+        $height = static::getHeight($data);
+        if ($height !== null) {
+            $result['height'] = $height;
+        }
+
+        $width = static::getWidth($data);
+        if ($width !== null) {
+            $result['width'] = $width;
+        }
+
+        $label = static::extractLabel($data);
+        if ($label !== null) {
+            $result['label'] = $label;
+        }
+
+        $image = static::getImageSrc($data);
+        if ($image !== null) {
+            $result['image'] = $image;
+        }
+
+        $type = static::parseIntOr(
+            static::issetInArray($data, ['type']),
+            null
+        );
+        if ($type !== null) {
+            $result['type'] = $type;
+        }
+
+        $period = static::parseIntOr(
+            static::issetInArray($data, ['period', 'maxTime']),
+            null
+        );
+        if ($period !== null) {
+            $result['period'] = $period;
+        }
+
+        $id_agente_modulo = static::extractModuleId($data);
+        if ($id_agente_modulo !== null) {
+            $result['id_agente_modulo'] = $id_agente_modulo;
+        }
+
+        $id_agent = static::extractAgentId($data);
+        if ($id_agent !== null) {
+            $result['id_agent'] = $id_agent;
+        }
+
+        $id_layout_linked = static::parseIntOr(
+            static::issetInArray($data, ['linkedLayoutId', 'id_layout_linked', 'idLayoutLinked']),
+            null
+        );
+        if ($id_layout_linked !== null) {
+            $result['id_layout_linked'] = $id_layout_linked;
+        }
+
+        $parent_item = static::extractParentId($data);
+        if ($parent_item !== null) {
+            $result['parent_item'] = $parent_item;
+        }
+
+        $enable_link = static::issetInArray($data, ['isLinkEnabled', 'enable_link', 'enableLink']);
+        if ($enable_link !== null) {
+            $result['enable_link'] = static::parseBool($enable_link);
+        }
+
+        $id_metaconsole = static::extractMetaconsoleId($data);
+        if ($id_metaconsole !== null) {
+            $result['id_metaconsole'] = $id_metaconsole;
+        }
+
+        $id_group = static::extractAclGroupId($data);
+        if ($id_group !== null) {
+            $result['id_group'] = $id_group;
+        }
+
+        $id_custom_graph = static::extractIdCustomGraph($data);
+        if ($id_custom_graph !== null) {
+            $result['id_custom_graph'] = $id_custom_graph;
+        }
+
+        $border_width = static::getBorderWidth($data);
+        if ($border_width !== null) {
+            $result['border_width'] = $border_width;
+        }
+
+        $type_graph = static::getTypeGraph($data);
+        if ($type_graph !== null) {
+            $result['type_graph'] = $type_graph;
+        }
+
+        $label_position = static::notEmptyStringOr(
+            static::issetInArray($data, ['labelPosition', 'label_position']),
+            null
+        );
+        if ($label_position !== null) {
+            $result['label_position'] = $label_position;
+        }
+
+        $border_color = static::getBorderColor($data);
+        if ($border_color !== null) {
+            $result['border_color'] = $border_color;
+        }
+
+        $fill_color = static::getFillColor($data);
+        if ($fill_color !== null) {
+            $result['fill_color'] = $fill_color;
+        }
+
+        $show_statistics = static::issetInArray($data, ['showStatistics', 'show_statistics']);
+        if ($show_statistics !== null) {
+            $result['show_statistics'] = static::parseBool($show_statistics);
+        }
+
+        $linked_layout_node_id = static::parseIntOr(
+            static::issetInArray(
+                $data,
+                [
+                    'linkedLayoutAgentId',
+                    'linked_layout_node_id',
+                ]
+            ),
+            null
+        );
+        if ($linked_layout_node_id !== null) {
+            $result['linked_layout_node_id'] = $linked_layout_node_id;
+        }
+
+        $linked_layout_status_type = static::notEmptyStringOr(
+            static::issetInArray($data, ['linkedLayoutStatusType', 'linked_layout_status_type']),
+            null
+        );
+        if ($linked_layout_status_type !== null) {
+            $result['linked_layout_status_type'] = $linked_layout_status_type;
+        }
+
+        $id_layout_linked_weight = static::parseIntOr(
+            static::issetInArray($data, ['linkedLayoutStatusTypeWeight', 'id_layout_linked_weight']),
+            null
+        );
+        if ($id_layout_linked_weight !== null) {
+            $result['id_layout_linked_weight'] = $id_layout_linked_weight;
+        }
+
+        $linked_layout_status_as_service_warning = static::parseIntOr(
+            static::issetInArray(
+                $data,
+                [
+                    'linkedLayoutStatusTypeWarningThreshold',
+                    'linked_layout_status_as_service_warning',
+                ]
+            ),
+            null
+        );
+        if ($linked_layout_status_as_service_warning !== null) {
+            $result['linked_layout_status_as_service_warning'] = $linked_layout_status_as_service_warning;
+        }
+
+        $linked_layout_status_as_service_critical = static::parseIntOr(
+            static::issetInArray(
+                $data,
+                [
+                    'linkedLayoutStatusTypeCriticalThreshold',
+                    'linked_layout_status_as_service_critical',
+                ]
+            ),
+            null
+        );
+        if ($linked_layout_status_as_service_critical !== null) {
+            $result['linked_layout_status_as_service_critical'] = $linked_layout_status_as_service_critical;
+        }
+
+        $element_group = static::parseIntOr(
+            static::issetInArray($data, ['elementGroup', 'element_group']),
+            null
+        );
+        if ($element_group !== null) {
+            $result['element_group'] = $element_group;
+        }
+
+        $show_on_top = static::issetInArray($data, ['isOnTop', 'show_on_top', 'showOnTop']);
+        if ($show_on_top !== null) {
+            $result['show_on_top'] = static::parseBool($show_on_top);
+        }
+
+        $clock_animation = static::notEmptyStringOr(
+            static::issetInArray($data, ['clockType', 'clock_animation', 'clockAnimation']),
+            null
+        );
+        if ($clock_animation !== null) {
+            $result['clock_animation'] = $clock_animation;
+        }
+
+        $time_format = static::notEmptyStringOr(
+            static::issetInArray($data, ['clockFormat', 'time_format', 'timeFormat']),
+            null
+        );
+        if ($time_format !== null) {
+            $result['time_format'] = $time_format;
+        }
+
+        $timezone = static::notEmptyStringOr(
+            static::issetInArray($data, ['timezone', 'timeZone', 'time_zone', 'clockTimezone']),
+            null
+        );
+        if ($timezone !== null) {
+            $result['timezone'] = $timezone;
+        }
+
+        $show_last_value = static::parseIntOr(
+            static::issetInArray($data, ['show_last_value', 'showLastValue']),
+            null
+        );
+        if ($show_last_value !== null) {
+            $result['show_last_value'] = $show_last_value;
+        }
+
+        $cache_expiration = static::parseIntOr(
+            static::issetInArray($data, ['cache_expiration', 'cacheExpiration']),
+            null
+        );
+        if ($cache_expiration !== null) {
+            $result['cache_expiration'] = $cache_expiration;
+        }
+
+        return $result;
+    }
+
+
+    /**
+     * Extract item id.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return integer Item id. 0 by default.
+     */
+    private static function getId(array $data): int
+    {
+        return static::parseIntOr(
+            static::issetInArray($data, ['id', 'itemId']),
+            0
+        );
+    }
+
+
+    /**
+     * Extract layout id.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return integer Item id. 0 by default.
+     */
+    private static function getIdLayout(array $data): int
+    {
+        return static::parseIntOr(
+            static::issetInArray($data, ['id_layout', 'idLayout', 'layoutId']),
+            0
+        );
+    }
+
+
+    /**
+     * Extract item width.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return integer Item width. 0 by default.
+     */
+    private static function getWidth(array $data)
+    {
+        return static::parseIntOr(
+            static::issetInArray($data, ['width', 'endX']),
+            null
+        );
+    }
+
+
+    /**
+     * Extract item height.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return integer Item height. 0 by default.
+     */
+    private static function getHeight(array $data)
+    {
+        return static::parseIntOr(
+            static::issetInArray($data, ['height', 'endY']),
+            null
+        );
+    }
+
+
+    /**
+     * Extract a image src value.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return mixed String representing the image url (not empty) or null.
+     */
+    protected static function getImageSrc(array $data)
+    {
+        $imageSrc = static::notEmptyStringOr(
+            static::issetInArray($data, ['image', 'imageSrc', 'backgroundColor', 'backgroundType', 'valueType']),
+            null
+        );
+
+        return $imageSrc;
+    }
+
+
+    /**
+     * Extract a border width value.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return integer Valid border width.
+     */
+    private static function getBorderWidth(array $data)
+    {
+        return static::parseIntOr(
+            static::issetInArray($data, ['border_width', 'borderWidth']),
+            null
+        );
+    }
+
+
+    /**
+     * Extract a type graph value.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return string One of 'vertical' or 'horizontal'. 'vertical' by default.
+     */
+    private static function getTypeGraph(array $data)
+    {
+        return static::notEmptyStringOr(
+            static::issetInArray($data, ['typeGraph', 'type_graph', 'graphType']),
+            null
+        );
+    }
+
+
+    /**
+     * Extract a border color value.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return mixed String representing the border color (not empty) or null.
+     */
+    private static function getBorderColor(array $data)
+    {
+        return static::notEmptyStringOr(
+            static::issetInArray($data, ['borderColor', 'border_color', 'gridColor', 'color', 'legendBackgroundColor']),
+            null
+        );
+    }
+
+
+    /**
+     * Extract a fill color value.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return mixed String representing the fill color (not empty) or null.
+     */
+    private static function getFillColor(array $data)
+    {
+        return static::notEmptyStringOr(
+            static::issetInArray($data, ['fillColor', 'fill_color', 'labelColor']),
+            null
+        );
+    }
+
+
+    /**
+     * Insert or update an item in the database
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return boolean The modeled element data structure stored into the DB.
+     *
+     * @overrides Model::save.
+     */
+    public function save(array $data=[]): bool
+    {
+        if (empty($data)) {
+            return false;
+        }
+
+        $dataModelEncode = $this->encode($this->toArray());
+        $dataEncode = $this->encode($data);
+
+        $save = \array_merge($dataModelEncode, $dataEncode);
+
+        if (!empty($save)) {
+            if (empty($save['id'])) {
+                // Insert.
+                $result = \db_process_sql_insert('tlayout_data', $save);
+                if ($result) {
+                    $item = static::fromDB(['id' => $result]);
+                }
+            } else {
+                // Update.
+                $result = \db_process_sql_update('tlayout_data', $save, ['id' => $save['id']]);
+                // Invalidate the item's cache.
+                if ($result !== false && $result > 0) {
+                    db_process_sql_delete(
+                        'tvisual_console_elements_cache',
+                        [
+                            'vc_item_id' => (int) $save['id'],
+                        ]
+                    );
+
+                    $item = static::fromDB(['id' => $save['id']]);
+                    // Update the model.
+                    if (!empty($item)) {
+                        $this->setData($item->toArray());
+                    }
+                }
+            }
+        }
+
+        return (bool) $result;
+    }
+
+
 }
diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php
index e627003244..cbbe877f8d 100644
--- a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php
+++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php
@@ -355,7 +355,7 @@ final class Group extends Item
                 'color: #FFF;',
                 'font-size: 12px;',
                 'display: inline;',
-                'background-color: #FC4444;',
+                'background-color: #e63c52;',
                 'position: relative;',
                 'height: 80%;',
                 'width: 9.4%;',
@@ -389,7 +389,7 @@ final class Group extends Item
         $html .= '<td>';
 
         // Critical.
-        $html .= '<div style="'.$valueStyle.'background-color: #FC4444;">';
+        $html .= '<div style="'.$valueStyle.'background-color: #e63c52;">';
         $html .= \number_format($agentStats['critical'], 2).'%';
         $html .= '</div>';
         $html .= '<div style="'.$nameStyle.'">'.__('Critical').'</div>';
diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php
index fd6f64b4cb..4b177c30b2 100644
--- a/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php
+++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php
@@ -206,4 +206,203 @@ final class Line extends Model
     }
 
 
+    /**
+     * Return a valid representation of a record in database.
+     *
+     * @param array $data Input data.
+     *
+     * @return array Data structure representing a record in database.
+     *
+     * @overrides Model::encode.
+     */
+    protected function encode(array $data): array
+    {
+        $result = [];
+
+        $id = static::getId($data);
+        if ($id) {
+            $result['id'] = $id;
+        }
+
+        $id_layout = static::getIdLayout($data);
+        if ($id_layout) {
+            $result['id_layout'] = $id_layout;
+        }
+
+        $pos_x = static::parseIntOr(
+            static::issetInArray($data, ['x', 'pos_x', 'posX']),
+            null
+        );
+        if ($pos_x !== null) {
+            $result['pos_x'] = $pos_x;
+        }
+
+        $pos_y = static::parseIntOr(
+            static::issetInArray($data, ['y', 'pos_y', 'posY']),
+            null
+        );
+        if ($pos_y !== null) {
+            $result['pos_y'] = $pos_y;
+        }
+
+        $height = static::getHeight($data);
+        if ($height !== null) {
+            $result['height'] = $height;
+        }
+
+        $width = static::getWidth($data);
+        if ($width !== null) {
+            $result['width'] = $width;
+        }
+
+        $type = static::parseIntOr(
+            static::issetInArray($data, ['type']),
+            null
+        );
+        if ($type !== null) {
+            $result['type'] = $type;
+        }
+
+        $border_width = static::getBorderWidth($data);
+        if ($border_width !== null) {
+            $result['border_width'] = $border_width;
+        }
+
+        $border_color = static::extractBorderColor($data);
+        if ($border_color !== null) {
+            $result['border_color'] = $border_color;
+        }
+
+        $show_on_top = static::issetInArray($data, ['isOnTop', 'show_on_top', 'showOnTop']);
+        if ($show_on_top !== null) {
+            $result['show_on_top'] = static::parseBool($show_on_top);
+        }
+
+        return $result;
+    }
+
+
+    /**
+     * Extract item id.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return integer Item id. 0 by default.
+     */
+    private static function getId(array $data): int
+    {
+        return static::parseIntOr(
+            static::issetInArray($data, ['id', 'itemId']),
+            0
+        );
+    }
+
+
+    /**
+     * Extract layout id.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return integer Item id. 0 by default.
+     */
+    private static function getIdLayout(array $data): int
+    {
+        return static::parseIntOr(
+            static::issetInArray($data, ['id_layout', 'idLayout', 'layoutId']),
+            0
+        );
+    }
+
+
+    /**
+     * Extract item width.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return integer Item width. 0 by default.
+     */
+    private static function getWidth(array $data)
+    {
+        return static::parseIntOr(
+            static::issetInArray($data, ['width', 'endX']),
+            null
+        );
+    }
+
+
+    /**
+     * Extract item height.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return integer Item height. 0 by default.
+     */
+    private static function getHeight(array $data)
+    {
+        return static::parseIntOr(
+            static::issetInArray($data, ['height', 'endY']),
+            null
+        );
+    }
+
+
+    /**
+     * Extract a border width value.
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return integer Valid border width.
+     */
+    private static function getBorderWidth(array $data)
+    {
+        return static::parseIntOr(
+            static::issetInArray($data, ['border_width', 'borderWidth']),
+            null
+        );
+    }
+
+
+    /**
+     * Insert or update an item in the database
+     *
+     * @param array $data Unknown input data structure.
+     *
+     * @return boolean The modeled element data structure stored into the DB.
+     *
+     * @overrides Model::save.
+     */
+    public function save(array $data=[]): bool
+    {
+        $data_model = $this->encode($this->toArray());
+        $newData = $this->encode($data);
+
+        $save = \array_merge($data_model, $newData);
+
+        if (!empty($save)) {
+            if (empty($save['id'])) {
+                // Insert.
+                $result = \db_process_sql_insert('tlayout_data', $save);
+            } else {
+                // Update.
+                $result = \db_process_sql_update('tlayout_data', $save, ['id' => $save['id']]);
+            }
+        }
+
+        // Update the model.
+        if ($result) {
+            if (empty($save['id'])) {
+                $item = static::fromDB(['id' => $result]);
+            } else {
+                $item = static::fromDB(['id' => $save['id']]);
+            }
+
+            if (!empty($item)) {
+                $this->setData($item->toArray());
+            }
+        }
+
+        return (bool) $result;
+    }
+
+
 }
diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/ModuleGraph.php b/pandora_console/include/rest-api/models/VisualConsole/Items/ModuleGraph.php
index d89a01efff..a804e29b02 100644
--- a/pandora_console/include/rest-api/models/VisualConsole/Items/ModuleGraph.php
+++ b/pandora_console/include/rest-api/models/VisualConsole/Items/ModuleGraph.php
@@ -207,21 +207,18 @@ final class ModuleGraph extends Item
 
         // Custom graph.
         if (empty($customGraphId) === false) {
-            $customGraph = \db_get_row_filter(
-                'tgraph',
-                'id_graph',
-                $customGraphId
-            );
+            $customGraph = \db_get_row('tgraph', 'id_graph', $customGraphId);
 
             $params = [
                 'period'          => $period,
-                'width'           => $data['width'],
+                'width'           => (int) $data['width'],
                 'height'          => ($data['height'] - 30),
                 'title'           => '',
                 'unit_name'       => null,
                 'show_alerts'     => false,
                 'only_image'      => $imageOnly,
                 'vconsole'        => true,
+                'document_ready'  => false,
                 'backgroundColor' => $backgroundType,
             ];
 
@@ -248,7 +245,7 @@ final class ModuleGraph extends Item
                 'agent_module_id' => $moduleId,
                 'period'          => $period,
                 'show_events'     => false,
-                'width'           => $data['width'],
+                'width'           => (int) $data['width'],
                 'height'          => ($data['height'] - 30),
                 'title'           => \modules_get_agentmodule_name($moduleId),
                 'unit'            => \modules_get_unit($moduleId),
@@ -257,6 +254,7 @@ final class ModuleGraph extends Item
                 'backgroundColor' => $backgroundType,
                 'type_graph'      => $graphType,
                 'vconsole'        => true,
+                'document_ready'  => false,
             ];
 
             $data['html'] = \grafico_modulo_sparse($params);
diff --git a/pandora_console/include/styles/agent_manager.css b/pandora_console/include/styles/agent_manager.css
index fc648aefba..8b3e0db4f7 100644
--- a/pandora_console/include/styles/agent_manager.css
+++ b/pandora_console/include/styles/agent_manager.css
@@ -16,6 +16,7 @@
 .agent_options_update {
   width: 85%;
   margin-right: 20px;
+  min-width: 640px;
 }
 
 .agent_options_column_left,
@@ -43,6 +44,20 @@ a#qr_code_agent_view {
   margin-top: 5px;
 }
 
+.p-switch {
+  margin-right: 1em;
+}
+
+.sg_source,
+.sg_target {
+  width: 35%;
+}
+
+.sg_source select,
+.sg_target select {
+  width: 100%;
+}
+
 .first_row .agent_options_column_right select,
 .first_row .agent_options_column_right input,
 .first_row .agent_options_column_left select#grupo {
@@ -100,38 +115,44 @@ a#qr_code_agent_view {
 }
 
 .custom_fields_table .custom_field_row_opened td {
-  border-bottom-left-radius: 0px !important;
-  border-bottom-right-radius: 0px !important;
+  border-bottom-left-radius: 0px;
+  border-bottom-right-radius: 0px;
 }
 
-.secondary_groups_select {
+.agent_av_opt_right,
+.agent_av_opt_left,
+.secondary_groups_list {
+  flex: 1;
+}
+.secondary_groups_list {
   display: flex;
+  flex-direction: row;
   align-items: center;
   justify-content: center;
-  margin-bottom: 15px;
+  flex-wrap: wrap;
+  min-width: 640px;
+}
+.secondary_group_arrows {
+  display: flex;
+  flex-direction: column;
+  padding: 0 2em;
 }
 
-.secondary_groups_select .secondary_groups_select_arrows input {
-  display: grid;
-  margin: 0 auto;
+.no-border.flex {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+  justify-content: start;
+  align-items: start;
 }
 
-.secondary_groups_select .secondary_groups_list_left {
-  text-align: right;
-  width: 50%;
+.no-border.flex > div {
+  margin: 1em;
 }
 
-.secondary_groups_select .secondary_groups_list_right {
-  text-align: left;
-  width: 50%;
-}
-
-.secondary_groups_select .secondary_groups_select_arrows {
-  padding: 0 50px;
-}
-
-.secondary_groups_select_arrows a {
-  display: block;
+.agent_av_opt_left input,
+.agent_av_opt_left select {
+  width: 100%;
 }
 
 .agent_options_adv .agent_options_column_right .label_select select,
@@ -147,12 +168,16 @@ a#qr_code_agent_view {
 }
 
 .agent_description {
-  min-height: 4.8em !important;
+  min-height: 4.8em;
 }
 .agent_custom_id {
   padding-bottom: 0.7em;
   padding-top: 0.5em;
   display: inline-block;
-  border-radius: 5px !important;
+  border-radius: 5px;
   border: 1px solid #ccc;
 }
+
+#safe_mode_module {
+  margin-top: 0.6em;
+}
diff --git a/pandora_console/include/styles/agent_repository.css b/pandora_console/include/styles/agent_repository.css
new file mode 100644
index 0000000000..4f0794338d
--- /dev/null
+++ b/pandora_console/include/styles/agent_repository.css
@@ -0,0 +1,29 @@
+ul.wizard li > label:not(.p-switch) {
+  width: auto;
+}
+
+form.top-action-buttons ul.wizard {
+  display: flex;
+  flex-direction: row;
+}
+
+ul.wizard li {
+  margin-right: 1em;
+}
+
+form.modal ul.wizard li {
+  display: flex;
+  flex-direction: row;
+  width: 90%;
+  margin: 0.5em auto;
+  justify-items: center;
+}
+
+form.modal ul.wizard li * {
+  flex: 1;
+}
+
+ul.wizard li.flex-indep {
+  flex: 1;
+  margin: 0;
+}
diff --git a/pandora_console/include/styles/agent_view.css b/pandora_console/include/styles/agent_view.css
index fca8aaa4fc..60bed6ca29 100644
--- a/pandora_console/include/styles/agent_view.css
+++ b/pandora_console/include/styles/agent_view.css
@@ -1,13 +1,14 @@
 text.text-tooltip {
-  font-family: "lato-bolder", "Open Sans", sans-serif !important;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
+  font-weight: bold;
 }
 
 div#bullets_modules span {
-  font-family: "lato-bolder", "Open Sans", sans-serif !important;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
 }
 
 table#agent_interface_info .noresizevc.graph {
-  width: 500px !important;
+  width: 500px;
 }
 
 div.agent_details_agent_alias {
@@ -15,5 +16,66 @@ div.agent_details_agent_alias {
 }
 
 div.agent_details_agent_alias * {
-  font-family: "lato-bolder", "Open Sans", sans-serif !important;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
+}
+
+#module_list {
+  width: 100%;
+}
+
+#module_filter_agent_view tr td {
+  padding-bottom: 3em;
+}
+
+#div_all_events_24h {
+  border-bottom: 1px solid #ebebeb;
+  padding-bottom: 3em;
+}
+
+#rect1,
+#rect2 {
+  z-index: 10;
+  position: absolute;
+  height: 238px;
+  width: 0px;
+  background: #3d84a8;
+}
+
+.agent-animation {
+  height: 300px;
+  width: 600px;
+  background: #3d84a8;
+  border-radius: 3px;
+  position: relative;
+  padding: 32px;
+}
+.agent-animation:before {
+  content: "";
+  position: absolute;
+  left: 30px;
+  top: 30px;
+  height: 240px;
+  width: 2px;
+  background: #48466d;
+}
+.agent-animation:after {
+  content: "";
+  position: absolute;
+  left: 30px;
+  bottom: 30px;
+  height: 2px;
+  width: 540px;
+  background: #48466d;
+}
+.agent-animation svg {
+  position: absolute;
+  left: 32px;
+  top: 30px;
+  width: 540px !important;
+}
+.agent-animation svg .cls-1 {
+  fill: none;
+  stroke: #abedd8;
+  stroke-miterlimit: 10;
+  stroke-width: 2px;
 }
diff --git a/pandora_console/include/styles/common.css b/pandora_console/include/styles/common.css
index 09c7abb566..c09bc06b4e 100644
--- a/pandora_console/include/styles/common.css
+++ b/pandora_console/include/styles/common.css
@@ -1,7 +1,7 @@
 /* Debug styles */
 pre.debug,
 div.backtrace {
-  font-family: monospace !important;
+  font-family: monospace;
   text-align: left;
   padding: 10px;
   margin: 5px;
@@ -66,9 +66,9 @@ img.right {
   text-align: right;
 }
 .noshadow {
-  -moz-box-shadow: 0px !important;
-  -webkit-box-shadow: 0px !important;
-  box-shadow: 0px !important;
+  -moz-box-shadow: 0px;
+  -webkit-box-shadow: 0px;
+  box-shadow: 0px;
 }
 .center_align {
   text-align: center;
diff --git a/pandora_console/include/styles/credential_store.css b/pandora_console/include/styles/credential_store.css
new file mode 100644
index 0000000000..aa77985188
--- /dev/null
+++ b/pandora_console/include/styles/credential_store.css
@@ -0,0 +1,12 @@
+#info_key .flex-row,
+#new_key .flex-row {
+  margin: 1em auto;
+  max-width: 80%;
+}
+
+#info_key input,
+#info_key select,
+#new_key input,
+#new_key select {
+  width: 60%;
+}
diff --git a/pandora_console/include/styles/deployment_list.css b/pandora_console/include/styles/deployment_list.css
new file mode 100644
index 0000000000..e487207b05
--- /dev/null
+++ b/pandora_console/include/styles/deployment_list.css
@@ -0,0 +1,34 @@
+ul.wizard li > label:not(.p-switch) {
+  width: auto;
+}
+
+form.top-action-buttons ul.wizard {
+  display: flex;
+  flex-direction: row;
+}
+
+ul.wizard li {
+  margin-right: 1em;
+}
+
+form.modal ul.wizard li {
+  display: flex;
+  flex-direction: row;
+  width: 90%;
+  margin: 0.5em auto;
+  justify-items: center;
+}
+
+form.modal ul.wizard li * {
+  flex: 1;
+}
+
+ul.wizard li.flex-indep {
+  flex: 1;
+  margin: 0;
+}
+
+.datatable_filter.content li input[type="text"] {
+  width: 150px;
+  margin: 0 1em 0 0;
+}
diff --git a/pandora_console/include/styles/dialog.css b/pandora_console/include/styles/dialog.css
index ecb4ab61f9..7346e62fdb 100644
--- a/pandora_console/include/styles/dialog.css
+++ b/pandora_console/include/styles/dialog.css
@@ -1,38 +1,38 @@
 /* This file skins dialog */
 
 .ui-dialog {
-  background: none repeat scroll 0 0 #3f3f3f !important;
-  border: 1px solid #3f3f3f !important;
-  color: #333333 !important;
-  padding: 0.2em !important;
-  overflow: hidden !important;
+  background: none repeat scroll 0 0 #3f3f3f;
+  border: 1px solid #3f3f3f;
+  color: #333333;
+  padding: 0.2em;
+  overflow: hidden;
 
-  -moz-border-radius: 6px !important;
-  -webkit-border-radius: 6px !important;
-  border-radius: 6px !important;
+  -moz-border-radius: 6px;
+  -webkit-border-radius: 6px;
+  border-radius: 6px;
 
-  -moz-box-shadow: 0px 5px 5px #010e1b !important;
-  -webkit-box-shadow: 0px 5px 5px #010e1b !important;
-  box-shadow: 0px 5px 5px #010e1b !important;
+  -moz-box-shadow: 0px 5px 5px #010e1b;
+  -webkit-box-shadow: 0px 5px 5px #010e1b;
+  box-shadow: 0px 5px 5px #010e1b;
 }
 
 .ui-widget-header {
-  background: #3f3f3f !important;
+  background: #3f3f3f;
 }
 
 .ui-dialog .ui-dialog-titlebar {
   background-color: #ececec;
-  height: 24px !important;
-  padding: 0.3em 1em !important;
+  height: 24px;
+  padding: 0.3em 1em;
   position: relative;
-  margin: 0px auto 0 auto !important;
-  font-weight: bold !important;
-  border-bottom: none !important;
-  border-top: none !important;
-  border-left: none !important;
-  border-right: none !important;
-  color: #ffffff !important;
-  #padding: 0.1em 1em !important;
+  margin: 0px auto 0 auto;
+  font-weight: bold;
+  border-bottom: none;
+  border-top: none;
+  border-left: none;
+  border-right: none;
+  color: #ffffff;
+  #padding: 0.1em 1em;
 
   -moz-border-radius: 4px 4px 0 0;
   -webkit-border-radius: 4px 4px 0 0;
@@ -40,114 +40,114 @@
 }
 
 .ui-dialog .ui-dialog-title {
-  margin-left: 5px !important;
-  color: white !important;
-  font-weight: bold !important;
-  position: relative !important;
+  margin-left: 5px;
+  color: white;
+  font-weight: bold;
+  position: relative;
   top: 3px;
   font-size: 10pt;
-  left: 4px !important;
-  float: none !important;
+  left: 4px;
+  float: none;
 }
 
 .ui-dialog.ui-draggable .ui-dialog-titlebar {
-  cursor: move !important;
+  cursor: move;
 }
 
 .ui-dialog .ui-dialog-titlebar-close {
-  width: 23px !important;
-  height: 23px !important;
-  background: url(images/dialog-titlebar-close.png) no-repeat !important;
-  position: absolute !important;
+  width: 23px;
+  height: 23px;
+  background: url(images/dialog-titlebar-close.png) no-repeat;
+  position: absolute;
   top: 6px;
-  right: 3px !important;
-  cursor: pointer !important;
+  right: 3px;
+  cursor: pointer;
 }
 
 .ui-dialog .ui-dialog-titlebar-close span {
-  display: none !important;
+  display: none;
 }
 
 .ui-dialog .ui-dialog-titlebar-close-hover {
-  color: #000000 !important;
+  color: #000000;
 }
 
 .ui-dialog .ui-dialog-titlebar-close:hover span {
-  display: none !important;
+  display: none;
 }
 
 .ui-dialog .ui-dialog-titlebar-close:hover {
-  color: #000000 !important;
+  color: #000000;
 }
 
 .ui-dialog .ui-dialog-content {
-  margin: 12px !important;
-  #padding: 0.5em 1em !important;
-  overflow: auto !important;
+  margin: 12px;
+  #padding: 0.5em 1em;
+  overflow: auto;
 
-  -moz-border-left: 1px solid #a9a9a9 !important;
-  -moz-border-right: 1px solid #a9a9a9 !important;
-  -moz-border-bottom: 1px solid #a9a9a9 !important;
-  -moz-border-radius: 8px 8px 8px 8px !important;
+  -moz-border-left: 1px solid #a9a9a9;
+  -moz-border-right: 1px solid #a9a9a9;
+  -moz-border-bottom: 1px solid #a9a9a9;
+  -moz-border-radius: 8px 8px 8px 8px;
 
-  -webkit-border-left: 1px solid #a9a9a9 !important;
-  -webkit-border-right: 1px solid #a9a9a9 !important;
-  -webkit-border-bottom: 1px solid #a9a9a9 !important;
-  -webkit-border-radius: 8px 8px 8px 8px !important;
+  -webkit-border-left: 1px solid #a9a9a9;
+  -webkit-border-right: 1px solid #a9a9a9;
+  -webkit-border-bottom: 1px solid #a9a9a9;
+  -webkit-border-radius: 8px 8px 8px 8px;
 
-  border-left: 1px solid #a9a9a9 !important;
-  border-right: 1px solid #a9a9a9 !important;
-  border-bottom: 1px solid #a9a9a9 !important;
-  border-radius: 8px 8px 8px 8px !important;
+  border-left: 1px solid #a9a9a9;
+  border-right: 1px solid #a9a9a9;
+  border-bottom: 1px solid #a9a9a9;
+  border-radius: 8px 8px 8px 8px;
 
-  background: #ffffff !important;
-  position: relative !important;
+  background: #ffffff;
+  position: relative;
 }
 
 .ui-tabs .ui-tabs-nav {
-  background-color: white !important;
+  background-color: white;
 }
 
 .ui-tabs-panel {
-  background: #ececec !important;
-  -moz-border-radius: 8px !important;
-  -webkit-border-radius: 8px !important;
-  border-radius: 8px !important;
-  -moz-border-top-left-radius: 0px !important;
-  -webkit-border-top-left-radius: 0px !important;
-  border-top-left-radius: 0px !important;
+  background: #ececec;
+  -moz-border-radius: 8px;
+  -webkit-border-radius: 8px;
+  border-radius: 8px;
+  -moz-border-top-left-radius: 0px;
+  -webkit-border-top-left-radius: 0px;
+  border-top-left-radius: 0px;
   -moz-box-shadow: -1px 1px 6px #aaa;
   -webkit-box-shadow: -1px 1px 6px #aaa;
   box-shadow: 1px 1px 6px #aaa;
 }
 
 .ui-widget .ui-widget {
-  border: 0px !important;
+  border: 0px;
 }
 
 .ui-state-default:first-child {
-  margin-left: -3px !important;
+  margin-left: -3px;
 }
 
 .ui-state-default {
-  background: #fff !important;
-  border: 2px solid #ececec !important;
-  -moz-border-top-left-radius: 10px !important;
-  -webkit-top-left-border-radius: 10px !important;
-  border-top-left-radius: 10px !important;
-  -moz-border-top-right-radius: 10px !important;
-  -webkit-top-right-border-radius: 10px !important;
-  border-top-right-radius: 10px !important;
-  margin-left: 2px !important;
+  background: #fff;
+  border: 2px solid #ececec;
+  -moz-border-top-left-radius: 10px;
+  -webkit-top-left-border-radius: 10px;
+  border-top-left-radius: 10px;
+  -moz-border-top-right-radius: 10px;
+  -webkit-top-right-border-radius: 10px;
+  border-top-right-radius: 10px;
+  margin-left: 2px;
 }
 .ui-state-active {
-  background: #ececec !important;
+  background: #ececec;
 }
 
 .ui-dialog-content {
-  overflow: auto !important;
-  width: auto !important;
-  #height: auto !important;
+  overflow: auto;
+  width: auto;
+  #height: auto;
 }
 
 .ui-dialog .ui-dialog-buttonpane {
@@ -185,8 +185,8 @@
   font-weight: bold;
   outline: medium none;
   cursor: pointer;
-  margin: 0.5em 0.4em 0.5em 0 !important;
-  border-radius: 4px 4px 4px 4px !important;
+  margin: 0.5em 0.4em 0.5em 0;
+  border-radius: 4px 4px 4px 4px;
 }
 
 .ui-dialog .ui-button-dialog:hover {
@@ -199,5 +199,5 @@
 
 .ui-dialog-overlay {
   background: url("images/ui-bg_diagonals-thick_20_666666_40x40.png") repeat
-    scroll 50% 50% #666666 !important;
+    scroll 50% 50% #666666;
 }
diff --git a/pandora_console/include/styles/discovery-hint.css b/pandora_console/include/styles/discovery-hint.css
new file mode 100644
index 0000000000..8247b26c96
--- /dev/null
+++ b/pandora_console/include/styles/discovery-hint.css
@@ -0,0 +1,10 @@
+/*
+ * Discovery show help css
+ */
+li.discovery:not(:first-child) > a:hover {
+  color: #000;
+}
+
+li.discovery:not(:first-child) div.data_container:not(:hover) {
+  box-shadow: 2px 2px 10px #80ba27;
+}
diff --git a/pandora_console/include/styles/discovery.css b/pandora_console/include/styles/discovery.css
index 0209a43a8e..82b022050f 100644
--- a/pandora_console/include/styles/discovery.css
+++ b/pandora_console/include/styles/discovery.css
@@ -2,11 +2,14 @@
  * Discovery css global
  */
 
+ul.bigbuttonlist {
+  min-height: 200px;
+}
+
 li.discovery {
   display: inline-block;
   float: left;
   width: 250px;
-  height: 120px;
   margin: 15px;
   padding-bottom: 50px;
 }
@@ -28,7 +31,7 @@ li.discovery > a label {
 }
 
 div.data_container > label {
-  font-family: "lato-bolder", "Open Sans", sans-serif !important;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
   font-weight: lighter;
 }
 
@@ -117,7 +120,7 @@ div.arrow_box:before {
   min-height: 55px;
   width: 100%;
   padding-right: 0px;
-  margin-left: 0px !important;
+  margin-left: 0px;
   margin-bottom: 20px;
   height: 55px;
   box-sizing: border-box;
@@ -132,21 +135,21 @@ div.arrow_box:before {
 }
 
 .breadcrumbs_container {
-  padding-left: 10px;
   padding-top: 4px;
   text-indent: 0.25em;
+  padding-left: 2.5em;
 }
 
 .breadcrumb_link {
   color: #848484;
-  font-size: 10pt !important;
-  font-family: "lato-bolder", "Open Sans", sans-serif !important;
-  text-decoration: none !important;
+  font-size: 10pt;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
+  text-decoration: none;
 }
 
 span.breadcrumb_link {
   color: #d0d0d0;
-  font-size: 12pt !important;
+  font-size: 12pt;
 }
 
 .breadcrumb_link.selected {
@@ -168,6 +171,11 @@ form.discovery * {
   font-size: 10pt;
 }
 
+form.discovery .label_select b {
+  font-family: "lato", "Open Sans", sans-serif;
+  font-weight: bolder;
+}
+
 .edit_discovery_info {
   display: flex;
   align-items: flex-start;
@@ -188,7 +196,7 @@ form.discovery * {
 }
 
 label {
-  color: #343434 !important;
+  color: #343434;
   font-weight: bold;
 }
 
@@ -201,11 +209,11 @@ li > input[type="password"],
 .discovery_text_input > input[type="password"],
 .discovery_text_input > input[type="text"],
 #interval_manual > input[type="text"] {
-  background-color: transparent !important;
+  background-color: transparent;
   border: none;
-  border-radius: 0 !important;
+  border-radius: 0;
   border-bottom: 1px solid #ccc;
-  font-family: "lato-bolder", "Open Sans", sans-serif !important;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
   font-weight: lighter;
   padding: 0px 0px 2px 0px;
   box-sizing: border-box;
@@ -234,7 +242,7 @@ li > input[type="password"],
 }
 
 .discovery_textarea_input {
-  background-color: #fbfbfb !important;
+  background-color: #fbfbfb;
   padding-left: 10px;
   width: 100%;
   height: 100px;
@@ -257,3 +265,8 @@ a.tip {
 .discovery_interval_select_width {
   width: 90%;
 }
+
+a.ext_link {
+  margin-left: 1em;
+  font-size: 8pt;
+}
diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css
index 20b1f59d15..8b46a97ca6 100644
--- a/pandora_console/include/styles/events.css
+++ b/pandora_console/include/styles/events.css
@@ -12,9 +12,312 @@ div.criticity {
 }
 
 div.mini-criticity {
-  width: 5px;
-  height: 4em;
+  width: 10px;
+  height: 3em;
   padding: 0;
   margin: 0;
   display: inline-block;
 }
+
+div.mini-criticity.h100p {
+  height: 100%;
+}
+
+.flex-row.event {
+  align-items: center;
+}
+
+form.flex-row div.filter_input,
+form.flex-row ul {
+  width: 30%;
+  min-width: 300px;
+  display: flex;
+  flex-direction: row;
+  align-items: baseline;
+  flex-wrap: wrap;
+  align-content: center;
+  justify-content: space-between;
+  flex: 1;
+  margin: 0.5em 3em 0.5em 0;
+}
+
+div.filter_input_little {
+  flex: 1;
+  display: flex;
+  flex-direction: row;
+  align-items: baseline;
+  flex-wrap: nowrap;
+  margin: 0.5em 0 0.5em 1em;
+}
+
+form.flex-row div.filter_input.large {
+  flex: 1;
+  min-width: 470px;
+}
+
+div.filter_input > label,
+div.filter_input_little > label {
+  width: 10em;
+}
+
+form.flex-row > ul,
+form.flex-row > ul > li,
+form.flex-row > .box-shadow.white_table_graph {
+  width: 100%;
+}
+
+form.flex-row > .box-shadow.white_table_graph {
+  margin-top: 2em;
+}
+
+form.flex-row > ul input[type="submit"] {
+  float: right;
+}
+
+form.flex-row > div > label {
+  margin-right: 1em;
+}
+
+table.dataTable tbody th,
+table.dataTable tbody td {
+  padding: 8px 10px;
+}
+
+.info_table.events tr > th {
+  padding-left: 1em;
+  font-size: 8pt;
+  font-weight: 300;
+  border-bottom: 1px solid #878787;
+  cursor: pointer;
+}
+
+.info_table.events tr > td {
+  height: 2.5em;
+}
+
+.sorting_desc {
+  background: url(../../images/sort_down_green.png) no-repeat;
+  background-position-x: left;
+  background-position-y: center;
+}
+.sorting_asc {
+  background: url(../../images/sort_up_green.png) no-repeat;
+  background-position-x: left;
+  background-position-y: center;
+}
+
+.info_table.events > tbody > tr > td {
+  -moz-border-radius: 0px;
+  -webkit-border-radius: 0px;
+  border-radius: 0px;
+  border: none;
+  padding-left: 0px;
+  padding-right: 9px;
+  padding-top: 7px;
+  padding-bottom: 7px;
+  border-bottom: 2px solid #dedede;
+}
+
+.filter_input {
+  align-items: center;
+}
+
+.filter_input_little > select,
+.filter_input_little > input,
+.filter_input > select,
+.filter_input > input {
+  flex: 1;
+}
+
+fieldset {
+  margin: 0 auto;
+}
+
+.event.flex-row.h100p.nowrap div {
+  max-width: 98%;
+}
+.event.flex-row.h100p.nowrap .mini-criticity {
+  width: 10px;
+  min-width: 10px;
+  max-width: 10px;
+}
+
+.filter_summary {
+  margin-bottom: 3em;
+  height: 3em;
+}
+
+.filter_summary div.label {
+  background: #878787;
+  color: #fff;
+  font-weight: bolder;
+  border-radius: 5px;
+  padding: 0.5em;
+}
+.filter_summary div.content {
+  padding: 0.5em;
+}
+
+.filter_summary > div {
+  border: 1px solid #eee;
+  border-radius: 5px;
+}
+
+.filter_summary div {
+  float: left;
+  margin-right: 2em;
+  text-align: center;
+  background: #fff;
+}
+
+#events_processing {
+  background: #dedede;
+  font-size: 3em;
+  height: auto;
+  padding: 2em;
+  color: #777;
+  border: none;
+  margin-top: -2em;
+}
+
+/* Image open dialog in group events by agents*/
+#open_agent_groups {
+  cursor: pointer;
+}
+
+.table_modal_alternate {
+  border-spacing: 0px;
+  text-align: left;
+}
+
+/* Modal window - Show More */
+table.table_modal_alternate tr:nth-child(odd) td {
+  background-color: #ffffff;
+}
+
+table.table_modal_alternate tr:nth-child(even) td {
+  background-color: #f9f9f9;
+  border-top: 1px solid #e0e0e0;
+  border-bottom: 1px solid #e0e0e0;
+}
+
+table.table_modal_alternate tr td {
+  height: 33px;
+  max-height: 33px;
+  min-height: 33px;
+}
+
+table.table_modal_alternate tr td:first-child {
+  width: 35%;
+  font-weight: bold;
+  padding-left: 20px;
+}
+
+ul.events_tabs {
+  background: #ffffff;
+  border: 0px;
+  display: flex;
+  justify-content: space-between;
+  padding: 0px;
+}
+
+ul.events_tabs:before,
+ul.events_tabs:after {
+  content: none;
+}
+
+ul.events_tabs > li {
+  margin: 0;
+  width: 100%;
+  text-align: center;
+  float: none;
+  outline-width: 0;
+}
+
+ul.events_tabs > li.ui-state-default {
+  background: #fff;
+  border: none;
+  border-bottom: 2px solid #cacaca;
+}
+
+ul.events_tabs > li a {
+  text-align: center;
+  float: none;
+  padding: 8px;
+  display: block;
+}
+
+ul.events_tabs > li span {
+  position: relative;
+  top: -6px;
+  left: 5px;
+  margin-right: 10px;
+}
+
+ul.events_tabs > li.ui-tabs-active {
+  border: none;
+}
+
+ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header {
+  background: none;
+  margin: 0;
+  margin-bottom: -1px;
+  border: none;
+  border-bottom: 1px solid #a9a9a9;
+}
+
+ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header
+  li {
+  padding: 0.5em;
+}
+
+ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header
+  li
+  > a {
+  display: flex;
+  align-items: center;
+  flex-direction: row;
+}
+ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header
+  li
+  > a
+  > img {
+  margin-right: 0.3em;
+}
+
+li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab {
+  border-bottom: 1px solid #ccc;
+}
+li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab.ui-tabs-active.ui-state-active {
+  border-bottom: 1px solid #fff;
+}
+
+tr.group {
+  padding: 5px;
+  border: none;
+}
+tr.group * {
+  text-align: left;
+  color: #222;
+  text-indent: 3em;
+  background: #e2e2e2;
+}
+
+div.multi-response-buttons {
+  margin-top: 2em;
+  width: 100%;
+  text-align: right;
+}
+
+div.criticity {
+  width: 150px;
+  height: 2em;
+  color: #fff;
+  text-align: center;
+  border-radius: 5px;
+  font-size: 0.8em;
+  padding: 5px;
+  margin: 0;
+  display: table-cell;
+  vertical-align: middle;
+}
diff --git a/pandora_console/include/styles/firts_task.css b/pandora_console/include/styles/firts_task.css
index 1b26b2bfbe..be75dd632d 100755
--- a/pandora_console/include/styles/firts_task.css
+++ b/pandora_console/include/styles/firts_task.css
@@ -64,7 +64,7 @@ div.new_task_cluster > div {
 
 .button_task {
   margin-top: 10px;
-  background-color: #3f3f3f !important;
+  background-color: #3f3f3f;
   padding: 10px 10px 10px 10px;
   font-weight: bold;
   color: #82b92e;
@@ -78,3 +78,7 @@ div.new_task_cluster > div {
 #fuerte {
   font-size: 12px;
 }
+
+.flex-row-baseline * {
+  margin-right: 1em;
+}
diff --git a/pandora_console/include/styles/fixed-bottom-box.css b/pandora_console/include/styles/fixed-bottom-box.css
index b278e16cec..e97a334712 100644
--- a/pandora_console/include/styles/fixed-bottom-box.css
+++ b/pandora_console/include/styles/fixed-bottom-box.css
@@ -1,5 +1,5 @@
 div.fixed-bottom-box {
-  background: #e1e1e1;
+  background: #fff;
 
   border-radius: 10px 10px 0 0;
   -moz-border-radius: 10px 10px 0 0;
@@ -9,6 +9,20 @@ div.fixed-bottom-box {
   -khtml-border-radius: 10px 10px 0 0;
 }
 
+/* Overrides */
+.left_align {
+  border: 1px solid #e1e1e1;
+}
+.white_table_graph_header {
+  border-top-left-radius: 0px;
+  border-top-right-radius: 0px;
+  margin: -1px;
+}
+.white-box-content {
+  margin: -1px;
+}
+/* Overrides end */
+
 div.fixed-bottom-box > div.fixed-bottom-box-head {
   height: 30px;
   line-height: 30px;
diff --git a/pandora_console/include/styles/footer.css b/pandora_console/include/styles/footer.css
new file mode 100644
index 0000000000..84dff3e551
--- /dev/null
+++ b/pandora_console/include/styles/footer.css
@@ -0,0 +1,33 @@
+/*
+ * ---------------------------------------------------------------------
+ * - FOOTER 														-
+ * ---------------------------------------------------------------------
+ */
+a.footer,
+a.footer span {
+  font-size: 9px;
+  color: white;
+}
+
+div#foot {
+  padding-top: 10px;
+  padding-bottom: 10px;
+  text-align: center;
+  background: #343434;
+  clear: both;
+  width: auto;
+  height: 38px;
+  margin-top: auto;
+  box-sizing: border-box;
+}
+
+div#foot a,
+div#foot span {
+  font-family: "Open Sans", sans-serif;
+  font-size: 8pt;
+  color: #9ca4a6;
+}
+
+div#foot small span {
+  font-size: 0.8em;
+}
diff --git a/pandora_console/include/styles/ie.css b/pandora_console/include/styles/ie.css
index b8077309a8..01ded178be 100644
--- a/pandora_console/include/styles/ie.css
+++ b/pandora_console/include/styles/ie.css
@@ -20,7 +20,7 @@
   background: none;
 }
 .title .toggle {
-  background: transparent url(images/toggle.png) no-repeat scroll !important;
+  background: transparent url(images/toggle.png) no-repeat scroll;
 }
 
 .title a {
@@ -70,7 +70,7 @@ div#foot {
   box-shadow: 0px 0px 15px #000000;
 }
 div#foot a {
-  color: #333 !important;
+  color: #333;
 }
 
 div#foot a.white:after {
diff --git a/pandora_console/include/styles/install.css b/pandora_console/include/styles/install.css
index 51197b9da7..9ccf2a05bd 100644
--- a/pandora_console/include/styles/install.css
+++ b/pandora_console/include/styles/install.css
@@ -259,16 +259,16 @@ div.installation_step {
 }
 
 .popup-button-green span {
-  color: #fff !important;
+  color: #fff;
 }
 
 .popup-button-green:hover {
-  background-color: transparent !important;
+  background-color: transparent;
   border: 1px solid #82b92e;
-  color: #82b92e !important;
+  color: #82b92e;
 }
 
 .popup-button-green:hover span {
-  color: #82b92e !important;
+  color: #82b92e;
 }
 /* POPUP -END */
diff --git a/pandora_console/include/styles/jquery-ui.min.css b/pandora_console/include/styles/jquery-ui.min.css
new file mode 100644
index 0000000000..776e2595ad
--- /dev/null
+++ b/pandora_console/include/styles/jquery-ui.min.css
@@ -0,0 +1,7 @@
+/*! jQuery UI - v1.12.1 - 2016-09-14
+* http://jqueryui.com
+* Includes: core.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, dialog.css, draggable.css, resizable.css, progressbar.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
+* To view and modify this theme, visit http://jqueryui.com/themeroller/?bgShadowXPos=&bgOverlayXPos=&bgErrorXPos=&bgHighlightXPos=&bgContentXPos=&bgHeaderXPos=&bgActiveXPos=&bgHoverXPos=&bgDefaultXPos=&bgShadowYPos=&bgOverlayYPos=&bgErrorYPos=&bgHighlightYPos=&bgContentYPos=&bgHeaderYPos=&bgActiveYPos=&bgHoverYPos=&bgDefaultYPos=&bgShadowRepeat=&bgOverlayRepeat=&bgErrorRepeat=&bgHighlightRepeat=&bgContentRepeat=&bgHeaderRepeat=&bgActiveRepeat=&bgHoverRepeat=&bgDefaultRepeat=&iconsHover=url(%22images%2Fui-icons_555555_256x240.png%22)&iconsHighlight=url(%22images%2Fui-icons_777620_256x240.png%22)&iconsHeader=url(%22images%2Fui-icons_444444_256x240.png%22)&iconsError=url(%22images%2Fui-icons_cc0000_256x240.png%22)&iconsDefault=url(%22images%2Fui-icons_777777_256x240.png%22)&iconsContent=url(%22images%2Fui-icons_444444_256x240.png%22)&iconsActive=url(%22images%2Fui-icons_ffffff_256x240.png%22)&bgImgUrlShadow=&bgImgUrlOverlay=&bgImgUrlHover=&bgImgUrlHighlight=&bgImgUrlHeader=&bgImgUrlError=&bgImgUrlDefault=&bgImgUrlContent=&bgImgUrlActive=&opacityFilterShadow=Alpha(Opacity%3D30)&opacityFilterOverlay=Alpha(Opacity%3D30)&opacityShadowPerc=30&opacityOverlayPerc=30&iconColorHover=%23555555&iconColorHighlight=%23777620&iconColorHeader=%23444444&iconColorError=%23cc0000&iconColorDefault=%23777777&iconColorContent=%23444444&iconColorActive=%23ffffff&bgImgOpacityShadow=0&bgImgOpacityOverlay=0&bgImgOpacityError=95&bgImgOpacityHighlight=55&bgImgOpacityContent=75&bgImgOpacityHeader=75&bgImgOpacityActive=65&bgImgOpacityHover=75&bgImgOpacityDefault=75&bgTextureShadow=flat&bgTextureOverlay=flat&bgTextureError=flat&bgTextureHighlight=flat&bgTextureContent=flat&bgTextureHeader=flat&bgTextureActive=flat&bgTextureHover=flat&bgTextureDefault=flat&cornerRadius=3px&fwDefault=normal&ffDefault=Arial%2CHelvetica%2Csans-serif&fsDefault=1em&cornerRadiusShadow=8px&thicknessShadow=5px&offsetLeftShadow=0px&offsetTopShadow=0px&opacityShadow=.3&bgColorShadow=%23666666&opacityOverlay=.3&bgColorOverlay=%23aaaaaa&fcError=%235f3f3f&borderColorError=%23f1a899&bgColorError=%23fddfdf&fcHighlight=%23777620&borderColorHighlight=%23dad55e&bgColorHighlight=%23fffa90&fcContent=%23333333&borderColorContent=%23dddddd&bgColorContent=%23ffffff&fcHeader=%23333333&borderColorHeader=%23dddddd&bgColorHeader=%23e9e9e9&fcActive=%23ffffff&borderColorActive=%23003eff&bgColorActive=%23007fff&fcHover=%232b2b2b&borderColorHover=%23cccccc&bgColorHover=%23ededed&fcDefault=%23454545&borderColorDefault=%23c5c5c5&bgColorDefault=%23f6f6f6
+* Copyright jQuery Foundation and other contributors; Licensed MIT */
+
+.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;font-size:100%}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-button{padding:.4em 1em;display:inline-block;position:relative;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2em;box-sizing:border-box;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-button-icon-only{text-indent:0}.ui-button-icon-only .ui-icon{position:absolute;top:50%;left:50%;margin-top:-8px;margin-left:-8px}.ui-button.ui-icon-notext .ui-icon{padding:0;width:2.1em;height:2.1em;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-icon-notext .ui-icon{width:auto;height:auto;text-indent:0;white-space:normal;padding:.4em 1em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-controlgroup{vertical-align:middle;display:inline-block}.ui-controlgroup > .ui-controlgroup-item{float:left;margin-left:0;margin-right:0}.ui-controlgroup > .ui-controlgroup-item:focus,.ui-controlgroup > .ui-controlgroup-item.ui-visual-focus{z-index:9999}.ui-controlgroup-vertical > .ui-controlgroup-item{display:block;float:none;width:100%;margin-top:0;margin-bottom:0;text-align:left}.ui-controlgroup-vertical .ui-controlgroup-item{box-sizing:border-box}.ui-controlgroup .ui-controlgroup-label{padding:.4em 1em}.ui-controlgroup .ui-controlgroup-label span{font-size:80%}.ui-controlgroup-horizontal .ui-controlgroup-label + .ui-controlgroup-item{border-left:none}.ui-controlgroup-vertical .ui-controlgroup-label + .ui-controlgroup-item{border-top:none}.ui-controlgroup-horizontal .ui-controlgroup-label.ui-widget-content{border-right:none}.ui-controlgroup-vertical .ui-controlgroup-label.ui-widget-content{border-bottom:none}.ui-controlgroup-vertical .ui-spinner-input{width:75%;width:calc( 100% - 2.4em )}.ui-controlgroup-vertical .ui-spinner .ui-spinner-up{border-top-style:solid}.ui-checkboxradio-label .ui-icon-background{box-shadow:inset 1px 1px 1px #ccc;border-radius:.12em;border:none}.ui-checkboxradio-radio-label .ui-icon-background{width:16px;height:16px;border-radius:1em;overflow:visible;border:none}.ui-checkboxradio-radio-label.ui-checkboxradio-checked .ui-icon,.ui-checkboxradio-radio-label.ui-checkboxradio-checked:hover .ui-icon{background-image:none;width:8px;height:8px;border-width:4px;border-style:solid}.ui-checkboxradio-disabled{pointer-events:none}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker .ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat;left:.5em;top:.3em}.ui-dialog{position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-n{height:2px;top:0}.ui-dialog .ui-resizable-e{width:2px;right:0}.ui-dialog .ui-resizable-s{height:2px;bottom:0}.ui-dialog .ui-resizable-w{width:2px;left:0}.ui-dialog .ui-resizable-se,.ui-dialog .ui-resizable-sw,.ui-dialog .ui-resizable-ne,.ui-dialog .ui-resizable-nw{width:7px;height:7px}.ui-dialog .ui-resizable-se{right:0;bottom:0}.ui-dialog .ui-resizable-sw{left:0;bottom:0}.ui-dialog .ui-resizable-ne{right:0;top:0}.ui-dialog .ui-resizable-nw{left:0;top:0}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,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");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-text{display:block;margin-right:20px;overflow:hidden;text-overflow:ellipsis}.ui-selectmenu-button.ui-button{text-align:left;white-space:nowrap;width:14em}.ui-selectmenu-icon.ui-icon{float:right;margin-top:0}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:.222em 0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:2em}.ui-spinner-button{width:1.6em;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top-style:none;border-bottom-style:none;border-right-style:none}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget.ui-widget-content{border:1px solid #c5c5c5}.ui-widget-content{border:1px solid #ddd;background:#fff;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #ddd;background:#e9e9e9;color:#333;font-weight:bold}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default,.ui-button,html .ui-button.ui-state-disabled:hover,html .ui-button.ui-state-disabled:active{border:1px solid #c5c5c5;background:#f6f6f6;font-weight:normal;color:#454545}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited,a.ui-button,a:link.ui-button,a:visited.ui-button,.ui-button{color:#454545;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus,.ui-button:hover,.ui-button:focus{border:1px solid #ccc;background:#ededed;font-weight:normal;color:#2b2b2b}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,a.ui-button:hover,a.ui-button:focus{color:#2b2b2b;text-decoration:none}.ui-visual-focus{box-shadow:0 0 3px 1px rgb(94,158,214)}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active,a.ui-button:active,.ui-button:active,.ui-button.ui-state-active:hover{border:1px solid #003eff;background:#007fff;font-weight:normal;color:#fff}.ui-icon-background,.ui-state-active .ui-icon-background{border:#003eff;background-color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #dad55e;background:#fffa90;color:#777620}.ui-state-checked{border:1px solid #dad55e;background:#fffa90}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#777620}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #f1a899;background:#fddfdf;color:#5f3f3f}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#5f3f3f}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#5f3f3f}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon,.ui-button:hover .ui-icon,.ui-button:focus .ui-icon{background-image:url("images/ui-icons_555555_256x240.png")}.ui-state-active .ui-icon,.ui-button:active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon,.ui-button .ui-state-highlight.ui-icon{background-image:url("images/ui-icons_777620_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cc0000_256x240.png")}.ui-button .ui-icon{background-image:url("images/ui-icons_777777_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-caret-1-n{background-position:0 0}.ui-icon-caret-1-ne{background-position:-16px 0}.ui-icon-caret-1-e{background-position:-32px 0}.ui-icon-caret-1-se{background-position:-48px 0}.ui-icon-caret-1-s{background-position:-65px 0}.ui-icon-caret-1-sw{background-position:-80px 0}.ui-icon-caret-1-w{background-position:-96px 0}.ui-icon-caret-1-nw{background-position:-112px 0}.ui-icon-caret-2-n-s{background-position:-128px 0}.ui-icon-caret-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-65px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-65px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:1px -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:3px}.ui-widget-overlay{background:#aaa;opacity:.003;filter:Alpha(Opacity=.3)}.ui-widget-shadow{-webkit-box-shadow:0 0 5px #666;box-shadow:0 0 5px #666}
\ No newline at end of file
diff --git a/pandora_console/include/styles/js/buttons.dataTables.min.css b/pandora_console/include/styles/js/buttons.dataTables.min.css
new file mode 100644
index 0000000000..e734c060fc
--- /dev/null
+++ b/pandora_console/include/styles/js/buttons.dataTables.min.css
@@ -0,0 +1 @@
+@keyframes dtb-spinner{100%{transform:rotate(360deg)}}@-o-keyframes dtb-spinner{100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@-ms-keyframes dtb-spinner{100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes dtb-spinner{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes dtb-spinner{100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}div.dt-button-info{position:fixed;top:50%;left:50%;width:400px;margin-top:-100px;margin-left:-200px;background-color:white;border:2px solid #111;box-shadow:3px 3px 8px rgba(0,0,0,0.3);border-radius:3px;text-align:center;z-index:21}div.dt-button-info h2{padding:0.5em;margin:0;font-weight:normal;border-bottom:1px solid #ddd;background-color:#f3f3f3}div.dt-button-info>div{padding:1em}div.dt-button-collection-title{text-align:center;padding:0.3em 0 0.5em;font-size:0.9em}div.dt-button-collection-title:empty{display:none}button.dt-button,div.dt-button,a.dt-button{position:relative;display:inline-block;box-sizing:border-box;margin-right:0.333em;margin-bottom:0.333em;padding:0.5em 1em;border:1px solid #999;border-radius:2px;cursor:pointer;font-size:0.88em;line-height:1.6em;color:black;white-space:nowrap;overflow:hidden;background-color:#e9e9e9;background-image:-webkit-linear-gradient(top, #fff 0%, #e9e9e9 100%);background-image:-moz-linear-gradient(top, #fff 0%, #e9e9e9 100%);background-image:-ms-linear-gradient(top, #fff 0%, #e9e9e9 100%);background-image:-o-linear-gradient(top, #fff 0%, #e9e9e9 100%);background-image:linear-gradient(to bottom, #fff 0%, #e9e9e9 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='white', EndColorStr='#e9e9e9');-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-decoration:none;outline:none}button.dt-button.disabled,div.dt-button.disabled,a.dt-button.disabled{color:#999;border:1px solid #d0d0d0;cursor:default;background-color:#f9f9f9;background-image:-webkit-linear-gradient(top, #fff 0%, #f9f9f9 100%);background-image:-moz-linear-gradient(top, #fff 0%, #f9f9f9 100%);background-image:-ms-linear-gradient(top, #fff 0%, #f9f9f9 100%);background-image:-o-linear-gradient(top, #fff 0%, #f9f9f9 100%);background-image:linear-gradient(to bottom, #fff 0%, #f9f9f9 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#ffffff', EndColorStr='#f9f9f9')}button.dt-button:active:not(.disabled),button.dt-button.active:not(.disabled),div.dt-button:active:not(.disabled),div.dt-button.active:not(.disabled),a.dt-button:active:not(.disabled),a.dt-button.active:not(.disabled){background-color:#e2e2e2;background-image:-webkit-linear-gradient(top, #f3f3f3 0%, #e2e2e2 100%);background-image:-moz-linear-gradient(top, #f3f3f3 0%, #e2e2e2 100%);background-image:-ms-linear-gradient(top, #f3f3f3 0%, #e2e2e2 100%);background-image:-o-linear-gradient(top, #f3f3f3 0%, #e2e2e2 100%);background-image:linear-gradient(to bottom, #f3f3f3 0%, #e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#f3f3f3', EndColorStr='#e2e2e2');box-shadow:inset 1px 1px 3px #999999}button.dt-button:active:not(.disabled):hover:not(.disabled),button.dt-button.active:not(.disabled):hover:not(.disabled),div.dt-button:active:not(.disabled):hover:not(.disabled),div.dt-button.active:not(.disabled):hover:not(.disabled),a.dt-button:active:not(.disabled):hover:not(.disabled),a.dt-button.active:not(.disabled):hover:not(.disabled){box-shadow:inset 1px 1px 3px #999999;background-color:#cccccc;background-image:-webkit-linear-gradient(top, #eaeaea 0%, #ccc 100%);background-image:-moz-linear-gradient(top, #eaeaea 0%, #ccc 100%);background-image:-ms-linear-gradient(top, #eaeaea 0%, #ccc 100%);background-image:-o-linear-gradient(top, #eaeaea 0%, #ccc 100%);background-image:linear-gradient(to bottom, #eaeaea 0%, #ccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#eaeaea', EndColorStr='#cccccc')}button.dt-button:hover,div.dt-button:hover,a.dt-button:hover{text-decoration:none}button.dt-button:hover:not(.disabled),div.dt-button:hover:not(.disabled),a.dt-button:hover:not(.disabled){border:1px solid #666;background-color:#e0e0e0;background-image:-webkit-linear-gradient(top, #f9f9f9 0%, #e0e0e0 100%);background-image:-moz-linear-gradient(top, #f9f9f9 0%, #e0e0e0 100%);background-image:-ms-linear-gradient(top, #f9f9f9 0%, #e0e0e0 100%);background-image:-o-linear-gradient(top, #f9f9f9 0%, #e0e0e0 100%);background-image:linear-gradient(to bottom, #f9f9f9 0%, #e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#f9f9f9', EndColorStr='#e0e0e0')}button.dt-button:focus:not(.disabled),div.dt-button:focus:not(.disabled),a.dt-button:focus:not(.disabled){border:1px solid #426c9e;text-shadow:0 1px 0 #c4def1;outline:none;background-color:#79ace9;background-image:-webkit-linear-gradient(top, #bddef4 0%, #79ace9 100%);background-image:-moz-linear-gradient(top, #bddef4 0%, #79ace9 100%);background-image:-ms-linear-gradient(top, #bddef4 0%, #79ace9 100%);background-image:-o-linear-gradient(top, #bddef4 0%, #79ace9 100%);background-image:linear-gradient(to bottom, #bddef4 0%, #79ace9 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#bddef4', EndColorStr='#79ace9')}.dt-button embed{outline:none}div.dt-buttons{position:relative;float:left}div.dt-buttons.buttons-right{float:right}div.dt-button-collection{position:absolute;top:0;left:0;width:150px;margin-top:3px;padding:8px 8px 4px 8px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.4);background-color:white;overflow:hidden;z-index:2002;border-radius:5px;box-shadow:3px 3px 5px rgba(0,0,0,0.3);-webkit-column-gap:8px;-moz-column-gap:8px;-ms-column-gap:8px;-o-column-gap:8px;column-gap:8px}div.dt-button-collection button.dt-button,div.dt-button-collection div.dt-button,div.dt-button-collection a.dt-button{position:relative;left:0;right:0;width:100%;display:block;float:none;margin-bottom:4px;margin-right:0}div.dt-button-collection button.dt-button:active:not(.disabled),div.dt-button-collection button.dt-button.active:not(.disabled),div.dt-button-collection div.dt-button:active:not(.disabled),div.dt-button-collection div.dt-button.active:not(.disabled),div.dt-button-collection a.dt-button:active:not(.disabled),div.dt-button-collection a.dt-button.active:not(.disabled){background-color:#dadada;background-image:-webkit-linear-gradient(top, #f0f0f0 0%, #dadada 100%);background-image:-moz-linear-gradient(top, #f0f0f0 0%, #dadada 100%);background-image:-ms-linear-gradient(top, #f0f0f0 0%, #dadada 100%);background-image:-o-linear-gradient(top, #f0f0f0 0%, #dadada 100%);background-image:linear-gradient(to bottom, #f0f0f0 0%, #dadada 100%);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#f0f0f0', EndColorStr='#dadada');box-shadow:inset 1px 1px 3px #666}div.dt-button-collection.fixed{position:fixed;top:50%;left:50%;margin-left:-75px;border-radius:0}div.dt-button-collection.fixed.two-column{margin-left:-150px}div.dt-button-collection.fixed.three-column{margin-left:-225px}div.dt-button-collection.fixed.four-column{margin-left:-300px}div.dt-button-collection>*{-webkit-column-break-inside:avoid;break-inside:avoid}div.dt-button-collection.two-column{width:300px;padding-bottom:1px;-webkit-column-count:2;-moz-column-count:2;-ms-column-count:2;-o-column-count:2;column-count:2}div.dt-button-collection.three-column{width:450px;padding-bottom:1px;-webkit-column-count:3;-moz-column-count:3;-ms-column-count:3;-o-column-count:3;column-count:3}div.dt-button-collection.four-column{width:600px;padding-bottom:1px;-webkit-column-count:4;-moz-column-count:4;-ms-column-count:4;-o-column-count:4;column-count:4}div.dt-button-collection .dt-button{border-radius:0}div.dt-button-background{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.7);background:-ms-radial-gradient(center, ellipse farthest-corner, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);background:-moz-radial-gradient(center, ellipse farthest-corner, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);background:-o-radial-gradient(center, ellipse farthest-corner, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);background:-webkit-gradient(radial, center center, 0, center center, 497, color-stop(0, rgba(0,0,0,0.3)), color-stop(1, rgba(0,0,0,0.7)));background:-webkit-radial-gradient(center, ellipse farthest-corner, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);background:radial-gradient(ellipse farthest-corner at center, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);z-index:2001}@media screen and (max-width: 640px){div.dt-buttons{float:none !important;text-align:center}}button.dt-button.processing,div.dt-button.processing,a.dt-button.processing{color:rgba(0,0,0,0.2)}button.dt-button.processing:after,div.dt-button.processing:after,a.dt-button.processing:after{position:absolute;top:50%;left:50%;width:16px;height:16px;margin:-8px 0 0 -8px;box-sizing:border-box;display:block;content:' ';border:2px solid #282828;border-radius:50%;border-left-color:transparent;border-right-color:transparent;animation:dtb-spinner 1500ms infinite linear;-o-animation:dtb-spinner 1500ms infinite linear;-ms-animation:dtb-spinner 1500ms infinite linear;-webkit-animation:dtb-spinner 1500ms infinite linear;-moz-animation:dtb-spinner 1500ms infinite linear}
diff --git a/pandora_console/include/styles/js/cluetip.css b/pandora_console/include/styles/js/cluetip.css
index 233dbf3cbb..a1360b0afe 100644
--- a/pandora_console/include/styles/js/cluetip.css
+++ b/pandora_console/include/styles/js/cluetip.css
@@ -2,19 +2,23 @@
 #cluetip-close img {
   border: 0;
 }
+
 #cluetip-title {
   overflow: hidden;
 }
+
 #cluetip-title #cluetip-close {
   float: right;
   position: relative;
 }
+
 #cluetip-waitimage {
   width: 43px;
   height: 11px;
   position: absolute;
   background-image: url(../../../images/wait.gif);
 }
+
 .cluetip-arrows {
   display: none;
   position: absolute;
@@ -25,9 +29,11 @@
   background-repeat: no-repeat;
   background-position: 0 0;
 }
+
 #cluetip-extra {
   display: none;
 }
+
 /***************************************
  =cluetipClass: 'default' 
 -------------------------------------- */
@@ -36,11 +42,13 @@
   background-color: #fff;
   text-align: left;
 }
+
 .cluetip-default #cluetip-outer {
   position: relative;
   margin: 0;
   background-color: #fff;
 }
+
 .cluetip-default h3 {
   margin: 0 0 5px;
   padding: 8px 10px 4px;
@@ -49,6 +57,7 @@
   background-color: #b1b1b1;
   color: #fff;
 }
+
 .cluetip-default h3#cluetip-title {
   display: none;
   height: 0px;
@@ -56,41 +65,49 @@
   padding: 0;
   color: #fff;
 }
+
 .cluetip-default #cluetip-title a {
   color: #fff;
   font-size: 0.95em;
 }
+
 .cluetip-default #cluetip-inner {
   padding: 10px;
 }
+
 .cluetip-default div#cluetip-close {
   text-align: right;
   margin: 0 5px 5px;
   color: #900;
 }
+
 .cluetip-default ul {
   text-align: left;
 }
+
 /* default arrows */
 
 .clue-right-default .cluetip-arrows {
-  background-image: url(../../images/darrowleft.png);
+  background-image: url(../../../images/darrowleft.png);
 }
+
 .clue-left-default .cluetip-arrows {
-  background-image: url(../../images/darrowright.png);
+  background-image: url(../../../images/darrowright.png);
   left: 100%;
   margin-right: -11px;
 }
+
 .clue-top-default .cluetip-arrows {
-  background-image: url(../../images/darrowdown.png);
+  background-image: url(../../../images/darrowdown.png);
   top: 100%;
   left: 50%;
   margin-left: -11px;
   height: 11px;
   width: 22px;
 }
+
 .clue-bottom-default .cluetip-arrows {
-  background-image: url(../../images/darrowup.png);
+  background-image: url(../../../images/darrowup.png);
   top: -11px;
   left: 50%;
   margin-left: -11px;
diff --git a/pandora_console/include/styles/js/images/ui-bg_flat_0_aaaaaa_40x100.png b/pandora_console/include/styles/js/images/ui-bg_flat_0_aaaaaa_40x100.png
new file mode 100644
index 0000000000..a2e6bfc085
Binary files /dev/null and b/pandora_console/include/styles/js/images/ui-bg_flat_0_aaaaaa_40x100.png differ
diff --git a/pandora_console/include/styles/js/images/ui-icons_444444_256x240.png b/pandora_console/include/styles/js/images/ui-icons_444444_256x240.png
new file mode 100644
index 0000000000..df4e373785
Binary files /dev/null and b/pandora_console/include/styles/js/images/ui-icons_444444_256x240.png differ
diff --git a/pandora_console/include/styles/js/images/ui-icons_555555_256x240.png b/pandora_console/include/styles/js/images/ui-icons_555555_256x240.png
new file mode 100644
index 0000000000..bbb422fed1
Binary files /dev/null and b/pandora_console/include/styles/js/images/ui-icons_555555_256x240.png differ
diff --git a/pandora_console/include/styles/js/images/ui-icons_777620_256x240.png b/pandora_console/include/styles/js/images/ui-icons_777620_256x240.png
new file mode 100644
index 0000000000..ee49e9e501
Binary files /dev/null and b/pandora_console/include/styles/js/images/ui-icons_777620_256x240.png differ
diff --git a/pandora_console/include/styles/js/images/ui-icons_777777_256x240.png b/pandora_console/include/styles/js/images/ui-icons_777777_256x240.png
new file mode 100644
index 0000000000..b01ff3deeb
Binary files /dev/null and b/pandora_console/include/styles/js/images/ui-icons_777777_256x240.png differ
diff --git a/pandora_console/include/styles/js/images/ui-icons_cc0000_256x240.png b/pandora_console/include/styles/js/images/ui-icons_cc0000_256x240.png
new file mode 100644
index 0000000000..8920193948
Binary files /dev/null and b/pandora_console/include/styles/js/images/ui-icons_cc0000_256x240.png differ
diff --git a/pandora_console/include/styles/js/images/ui-icons_ffffff_256x240.png b/pandora_console/include/styles/js/images/ui-icons_ffffff_256x240.png
new file mode 100644
index 0000000000..1cba4313d3
Binary files /dev/null and b/pandora_console/include/styles/js/images/ui-icons_ffffff_256x240.png differ
diff --git a/pandora_console/include/styles/js/introjs.css b/pandora_console/include/styles/js/introjs.css
index 03db182404..8ca0f3fbf9 100644
--- a/pandora_console/include/styles/js/introjs.css
+++ b/pandora_console/include/styles/js/introjs.css
@@ -53,14 +53,14 @@
 }
 
 .introjs-fixParent {
-  z-index: auto !important;
-  opacity: 1 !important;
+  z-index: auto;
+  opacity: 1;
 }
 
 .introjs-showElement,
 tr.introjs-showElement > td,
 tr.introjs-showElement > th {
-  z-index: 9999999 !important;
+  z-index: 9999999;
 }
 
 .introjs-relativePosition,
@@ -89,7 +89,7 @@ tr.introjs-showElement > th {
   position: absolute;
   top: -16px;
   left: -16px;
-  z-index: 9999999999 !important;
+  z-index: 9999999999;
   padding: 2px;
   font-family: Arial, verdana, tahoma;
   font-size: 13px;
diff --git a/pandora_console/include/styles/js/jquery-ui_custom.css b/pandora_console/include/styles/js/jquery-ui_custom.css
index f5bd560d69..35fb445970 100644
--- a/pandora_console/include/styles/js/jquery-ui_custom.css
+++ b/pandora_console/include/styles/js/jquery-ui_custom.css
@@ -1,16 +1,30 @@
 @import url(calendar.css);
 
 /* --- JQUERY-UI --- */
+
+.ui-dialog .ui-corner-all .ui-widget {
+  border-radius: 0;
+  margin: 0;
+  padding: 0;
+  border: none;
+}
+
 .ui-dialog .ui-dialog-titlebar {
-  background-color: #82b92e !important;
+  background-color: #82b92e;
+  border-radius: 0;
+  margin: 0;
+  display: inherit;
+  text-align: center;
+  padding: 0.4em 33px 0.4em 12px;
+  height: 30px;
+  position: relative;
+  overflow: hidden;
+  text-overflow: ellipsis;
 }
 
 /*center ui dialog center*/
-.ui-dialog-titlebar .ui-icon-closethick {
-  margin-top: -5px !important;
-}
 .ui-button-text-only .ui-button-text {
-  font-family: nunito;
+  font-family: "lato", "Open Sans", sans-serif;
   font-size: 9pt;
   color: #82b92e;
 }
@@ -20,43 +34,33 @@
 }
 .ui-datepicker .ui-datepicker-title select,
 .ui-datepicker .ui-datepicker-title option {
-  color: #111 !important;
-}
-.ui-dialog .ui-dialog-titlebar {
-  display: inherit;
-  text-align: center;
-  padding: 0.4em 1em;
-  height: 30px;
-  position: relative;
+  color: #111;
 }
 .ui-dialog .ui-dialog-title {
-  font-family: Nunito, sans-serif;
-  margin: 0.1em 0 !important;
-  white-space: nowrap !important;
-  width: 100% !important;
-  overflow: hidden !important;
-  text-overflow: ellipsis !important;
-  font-size: 11pt;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
+  white-space: nowrap;
+  width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
   position: relative;
-  top: 5px;
-  float: none !important;
+  font-size: 12pt;
 }
 .ui-dialog .ui-dialog-titlebar-close {
-  position: absolute !important;
-  right: 1em !important;
-  width: 21px !important;
-  margin: 0px 0 0 0 !important;
-  padding: 1px !important;
-  height: 20px !important;
-  bottom: 30% !important;
-  top: 20% !important;
+  position: absolute;
+  right: 1em;
+  width: 21px;
+  margin: 0px 0 0 0;
+  padding: 1px;
+  height: 20px;
+  bottom: 30%;
+  top: 20%;
 }
 .ui-dialog .ui-dialog-content {
-  position: relative !important;
+  position: relative;
   border: 0;
-  padding: 0.5em 1em !important;
-  background: none !important;
-  overflow: auto !important;
+  padding: 0.5em 1em;
+  background: none;
+  overflow: auto;
   margin-bottom: 1em;
 }
 .ui-dialog .ui-dialog-buttonpane {
@@ -79,70 +83,69 @@
   width: 90px;
 }
 .ui-widget-header .ui-icon {
-  background-image: url(../images/ui-icons_444444_256x240.png) !important;
+  background-image: url(../images/ui-icons_444444_256x240.png);
 }
 .ui-icon,
 .ui-widget-content .ui-icon {
-  background-image: url(../images/ui-icons_444444_256x240.png) !important;
+  background-image: url(../images/ui-icons_444444_256x240.png);
 }
 .ui-widget-content {
-  background: #ffffff url(../images/ui-bg_flat_75_ffffff_40x100.png) 50% 50%
-    repeat-x;
+  background: #fff;
 }
 .ui-state-default,
 .ui-widget-content .ui-state-default,
 .ui-widget-header .ui-state-default {
   margin-top: 3px;
-  border: 1px solid #d3d3d3 !important;
-  border-bottom: 0 !important;
-  background: #e6e6e6 url(../images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50%
-    repeat-x !important;
-  font-weight: normal !important;
-  color: #555555 !important;
+  border: 1px solid #d3d3d3;
+  border-bottom: 0;
+  background: #e6e6e6;
+  font-weight: normal;
+  color: #555555;
 }
 .ui-corner-all,
 .ui-corner-top,
 .ui-corner-left,
 .ui-corner-tl {
-  border-top-left-radius: 0 !important;
+  border-top-left-radius: 0;
 }
 .ui-corner-all,
 .ui-corner-top,
 .ui-corner-right,
 .ui-corner-tr {
-  border-top-right-radius: 0 !important;
+  border-top-right-radius: 0;
 }
 .ui-corner-all,
 .ui-corner-bottom,
 .ui-corner-left,
 .ui-corner-bl {
-  border-bottom-left-radius: 0 !important;
+  border-bottom-left-radius: 0;
 }
 .ui-corner-all,
 .ui-corner-bottom,
 .ui-corner-right,
 .ui-corner-br {
-  border-bottom-right-radius: 0 !important;
+  border-bottom-right-radius: 0;
 }
 #ui-datepicker-div {
   border-color: #b1b1b1;
   background: #ffffff;
 }
 .ui-widget-header {
-  background: #b1b1b1 !important;
-  color: #ffffff !important;
+  background: #b1b1b1;
+  color: #ffffff;
 }
 .ui-datepicker-calendar th {
   background-color: #3f3f3f;
 }
 .ui-dialog .ui-widget-header {
   background-color: #82b92e;
+  margin: -1px -1px 0px -1px;
 }
 .ui_tpicker_hour,
 .ui_tpicker_minute,
 .ui_tpicker_second,
 .ui-slider-handle {
-  border: 1px solid #aaaaaa !important;
+  border: 1px solid #aaaaaa;
 }
 .ui-timepicker-div dd {
   margin: 0px 15px 0px 15px;
@@ -151,32 +154,38 @@
   color: white;
 }
 .ui-datepicker-buttonpane button {
-  border-color: #b1b1b1 !important;
+  border-color: #b1b1b1;
 }
 .ui-datepicker-buttonpane .ui-datepicker-current {
-  margin-left: 0.2em !important;
+  margin-left: 0.2em;
 }
 .ui-dialog .ui-widget-content {
-  border: 0px !important;
+  border: 0px;
 }
 .ui-dialog {
   box-shadow: 5px 5px 19px #4e4e4e;
-  border: 0px !important;
-  padding: 0 !important;
+  border: 0px;
+  padding: 0;
 }
 .ui-dialog-titlebar {
-  border: 0px !important;
-}
-.ui-dialog-titlebar .ui-icon-closethick,
-.ui-dialog-titlebar .ui-state-default,
-.ui-dialog-titlebar .ui-state-hover,
-.ui-dialog-titlebar button {
-  background: transparent;
   border: 0px;
 }
-.ui-dialog-titlebar .ui-icon-closethick {
-  background-image: url("../../../images/icono_cerrar.png") !important;
+
+.ui-state-hover .ui-icon,
+.ui-state-focus .ui-icon,
+.ui-button:hover .ui-icon,
+.ui-button:focus .ui-icon {
+  background: none;
 }
+.ui-dialog-titlebar.ui-icon-closethick:hover,
+.ui-dialog-titlebar .ui-icon-closethick {
+  background: none;
+}
+.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close,
+.ui-button.ui-corner-all.ui-widget.ui-button-icon-only.ui-dialog-titlebar-close:hover {
+  background: url("../../../images/icono_cerrar.png") no-repeat center center;
+}
+
 .ui-dialog-title {
   color: #ffffff;
   font-size: 9pt;
@@ -185,7 +194,7 @@
 .ui-widget select,
 .ui-widget textarea,
 .ui-widget button {
-  font-family: Verdana, Arial, sans-serif !important;
+  font-family: "lato", "Open Sans", sans-serif;
 }
 
 a.ui-button:active,
@@ -195,69 +204,67 @@ a.ui-button:active,
 .ui-state-focus .ui-widget-header,
 .ui-state-focus .ui-button:hover,
 .ui-button:focus {
-  background: transparent !important;
-  border: none !important;
+  background: transparent;
+  border: none;
 }
 
 .ui-state-hover,
 .ui-widget-content .ui-state-hover,
 .ui-widget-header .ui-state-hover {
-  border: 1px solid #999999 !important;
-  border-bottom: 0 !important;
-  background: #dadada url(../images/ui-bg_glass_75_dadada_1x400.png) 50% 50%
-    repeat-x !important;
+  border: 1px solid #999999;
+  border-bottom: 0;
+  background: #dadada;
 }
 
 .ui-state-active,
 .ui-widget-content .ui-state-active,
 .ui-widget-header .ui-state-active {
-  border: 1px solid #aaaaaa !important;
-  border-bottom: 0 !important;
-  background: #ffffff url(../images/ui-bg_glass_65_ffffff_1x400.png) 50% 50%
-    repeat-x !important;
-  font-weight: normal !important;
-  color: #212121 !important;
+  border: 1px solid #aaaaaa;
+  border-bottom: 0;
+  background: #ffffff;
+  font-weight: normal;
+  color: #212121;
 }
 .ui-state-active a,
 .ui-state-active a:link,
 .ui-state-active a:visited {
-  color: #212121 !important;
+  color: #212121;
 }
 
 ul.ui-front {
-  z-index: 1000000 !important;
-  padding-right: 0px !important;
+  z-index: 1000000;
+  padding-right: 0px;
 }
 
 ul.ui-front li {
-  padding: 3px !important;
+  padding: 3px;
 }
 
 ul.ui-front li:hover {
-  background-color: #e1e3e1 !important;
+  background-color: #e1e3e1;
 }
 
 ul.ui-front li a.ui-menu-item-wrapper {
-  background: transparent !important;
-  border: none !important;
+  background: transparent;
+  border: none;
 }
 
 ul.ui-front li a.ui-menu-item-wrapper span {
-  padding-left: 5px !important;
+  padding-left: 5px;
 }
 
 ul.ui-front li a.ui-menu-item-wrapper:hover {
-  text-decoration: none !important;
+  text-decoration: none;
 }
 
 input[type="submit"].ui-button-dialog {
-  margin: 0.5em 1em 0.5em 0 !important;
-  cursor: pointer !important;
-  background: white !important;
-  background-color: white !important;
-  color: #82b92e !important;
-  text-align: center !important;
-  border: 1px solid #82b92e !important;
-  height: 30px !important;
-  width: 90px !important;
+  margin: 0.5em 1em 0.5em 0;
+  cursor: pointer;
+  background: white;
+  background-color: white;
+  color: #82b92e;
+  text-align: center;
+  border: 1px solid #82b92e;
+  height: 30px;
+  width: 90px;
 }
diff --git a/pandora_console/include/styles/login.css b/pandora_console/include/styles/login.css
index bffcda19d5..8edd7d46c0 100644
--- a/pandora_console/include/styles/login.css
+++ b/pandora_console/include/styles/login.css
@@ -6,7 +6,7 @@
 h1#log_title {
   font-size: 18px;
   margin-bottom: 0px;
-  color: #fff !important;
+  color: #fff;
   width: 300px;
 }
 
@@ -27,7 +27,6 @@ div#error_buttons a {
   min-height: 100%;
   min-width: 1200px;
   width: 100%;
-  z-index: -9999;
   position: absolute;
   background: linear-gradient(74deg, #02020255 36%, transparent 36%),
     url("../../images/backgrounds/background_pandora_console_keys.jpg");
@@ -35,7 +34,7 @@ div#error_buttons a {
 }
 
 p.log_in {
-  color: #fff !important;
+  color: #fff;
   padding: 0px 10px;
   width: 300px;
 }
@@ -167,13 +166,13 @@ div.login_pass input {
 
 div.login_nick input,
 div.login_pass input {
-  border: 0px !important;
+  border: 0px;
   color: #343434;
   border-radius: 3px;
   width: 100%;
   height: 40px;
   font-size: 10pt;
-  padding: 0px 0px 0px 35px !important;
+  padding: 0px 0px 0px 35px;
   background-repeat: no-repeat;
   background-size: 27px;
   background-position: left center;
@@ -195,8 +194,8 @@ div.login_pass input:-webkit-autofill:hover,
 div.login_pass input:-webkit-autofill:focus,
 div.login_pass input:-webkit-autofill:active {
   transition: background-color 10000s ease-in-out 0s;
-  -webkit-box-shadow: 0 0 0px 0px transparent inset !important;
-  -webkit-text-fill-color: #343434 !important;
+  -webkit-box-shadow: 0 0 0px 0px transparent inset;
+  -webkit-text-fill-color: #343434;
   border: 0px;
   width: 89%;
 }
@@ -217,55 +216,55 @@ div.login_button_saml {
 
 div.login_button input {
   width: 100%;
-  background-color: #82b92e !important;
+  background-color: #82b92e;
   text-align: center;
   height: 40px;
   padding: 0px;
   font-size: 11pt;
-  color: #fff !important;
+  color: #fff;
   border: 1px solid #82b92e;
   border-radius: 3px;
 }
 
 div.login_button_saml input {
   border: 1px solid #fff;
-  background-color: #fff !important;
-  color: #000 !important;
+  background-color: #fff;
+  color: #000;
   background-image: url("../../images/saml_login.png");
   background-repeat: no-repeat;
   background-position: right 5% center;
 }
 
 div.login_button input:hover {
-  background-color: #fff !important;
-  color: #000 !important;
-  border: 1px solid #fff !important;
+  background-color: #fff;
+  color: #000;
+  border: 1px solid #fff;
 }
 
 div.login_button_saml input:hover {
   background-image: url("../../images/saml_login_hover.png");
-  background-color: transparent !important;
-  color: #fff !important;
-  border: 1px solid #fff !important;
+  background-color: transparent;
+  color: #fff;
+  border: 1px solid #fff;
 }
 
 #remove_button input {
-  background-image: url("../../images/user_login.png") !important;
+  background-image: url("../../images/user_login.png");
   background-repeat: no-repeat;
   background-position: right 5% center;
 }
 
 #remove_button input:hover {
-  background-image: url("../../images/user_login_hover.png") !important;
+  background-image: url("../../images/user_login_hover.png");
 }
 
 .login_back input {
-  background-image: url("../../images/back_login.png") !important;
-  background-position: left 5% center !important;
+  background-image: url("../../images/back_login.png");
+  background-position: left 5% center;
 }
 
 .login_back input:hover {
-  background-image: url("../../images/back_login_hover.png") !important;
+  background-image: url("../../images/back_login_hover.png");
 }
 
 div.login_data {
@@ -319,7 +318,7 @@ div.img_banner_login img {
 }
 
 .reset_password a {
-  color: #ddd !important;
+  color: #ddd;
   font-family: "Open Sans", sans-serif;
   font-size: 8.5pt;
 }
@@ -399,7 +398,7 @@ div.form_message_alert ul li {
 
 div.form_message_alert ul li input {
   border: none;
-  background-color: #dadada !important;
+  background-color: #dadada;
   border-radius: 0px;
   height: 17px;
   width: 145px;
@@ -407,6 +406,8 @@ div.form_message_alert ul li input {
 }
 
 div.form_message_alert ul li label {
+  display: inline-block;
+  width: 145px;
   font-size: 10pt;
   padding-right: 20px;
 }
diff --git a/pandora_console/include/styles/logon.css b/pandora_console/include/styles/logon.css
new file mode 100644
index 0000000000..d5da931f84
--- /dev/null
+++ b/pandora_console/include/styles/logon.css
@@ -0,0 +1,24 @@
+#welcome_panel {
+  display: flex;
+  flex-direction: row;
+}
+
+#overview {
+  width: 30em;
+  min-width: 30em;
+  margin-top: 15px;
+  align-self: start;
+}
+#right {
+  flex: 1;
+}
+
+#news {
+  flex: 1 1 auto;
+  margin: 15px;
+}
+
+#activity {
+  flex: 1 1 auto;
+  margin: 15px;
+}
diff --git a/pandora_console/include/styles/menu.css b/pandora_console/include/styles/menu.css
index 7846a3f9a6..983b1d9b05 100644
--- a/pandora_console/include/styles/menu.css
+++ b/pandora_console/include/styles/menu.css
@@ -18,7 +18,7 @@
 
 .operation li,
 .godmode li {
-  display: flex !important;
+  display: flex;
   justify-content: flex-start;
   align-items: center;
 }
@@ -58,7 +58,7 @@ li:hover ul {
   margin-left: 0px;
   width: 100%;
   color: #b9b9b9;
-  font-family: "Open Sans", sans-serif;
+  font-family: "lato", "Open Sans", sans-serif;
   font-size: 9.4pt;
 }
 
@@ -81,13 +81,13 @@ li:hover ul {
 }
 
 .sub_subMenu {
-  font-weight: normal !important;
+  font-weight: normal;
   background-color: #202020;
   padding-left: 1.5em;
 }
 
 .sub_subMenu.selected {
-  font-weight: 600 !important;
+  font-weight: 600;
 }
 
 .submenu2 li a {
@@ -109,29 +109,28 @@ li:hover ul {
 
 .menu li.submenu_not_selected a,
 .menu li.submenu2_not_selected a {
-  font-weight: normal !important;
+  font-weight: normal;
 }
 
 .submenu_selected {
-  margin-bottom: 0px !important;
-  box-shadow: inset 4px 0 #80ba27 !important;
+  margin-bottom: 0px;
+  box-shadow: inset 4px 0 #82b92e;
 }
 .selected.submenu_selected {
-  background-color: #202020 !important;
+  background-color: #202020;
 }
 
 li.submenu_selected.selected {
-  background-color: #202020 !important;
+  background-color: #202020;
   font-weight: 600;
 }
 
 li.sub_subMenu.selected {
-  background-color: #161616 !important;
+  background-color: #161616;
 }
 
 .menu .menu_icon,
 .menu li.links {
-  background-position: 4px 4px;
   background-repeat: no-repeat;
   cursor: pointer;
 }
@@ -143,73 +142,73 @@ li.sub_subMenu.selected {
 
 /* Icons specified here */
 #icon_oper-networkconsole {
-  background: url(../../images/op_network.menu_gray.png) no-repeat;
+  background-image: url(../../images/op_network.menu_gray.png);
 }
 #icon_oper-agents {
-  background: url(../../images/op_monitoring.menu_gray.png) no-repeat;
+  background-image: url(../../images/op_monitoring.menu_gray.png);
 }
 #icon_oper-events {
-  background: url(../../images/op_events.menu_gray.png) no-repeat;
+  background-image: url(../../images/op_events.menu_gray.png);
 }
 
 /* users */
 #icon_oper-users {
-  background: url(../../images/op_workspace.menu_gray.png) no-repeat;
+  background-image: url(../../images/op_workspace.menu_gray.png);
 }
 /* trap console */
 #icon_oper-snmpc,
 #icon_god-snmpc {
-  background: url(../../images/op_snmp.menu.png) no-repeat 50% 50%;
+  background-image: url(../../images/op_snmp.menu.png);
 }
 #icon_oper-reporting {
-  background: url(../../images/op_reporting.menu_gray.png) no-repeat;
+  background-image: url(../../images/op_reporting.menu_gray.png);
 }
 #icon_oper-gismaps {
-  background: url(../../images/op_gis.menu.png) no-repeat 50% 50%;
+  background-image: url(../../images/op_gis.menu.png);
 }
 #icon_oper-netflow {
-  background: url(../../images/op_netflow.menu.png) no-repeat 50% 50%;
+  background-image: url(../../images/op_netflow.menu.png);
 }
 #icon_oper-extensions {
-  background: url(../../images/extensions.menu_gray.png) no-repeat;
+  background-image: url(../../images/extensions.menu_gray.png);
 }
 
 /* Godmode images */
 #icon_god-discovery {
-  background: url(../../images/gm_discovery.menu.png) no-repeat;
+  background-image: url(../../images/gm_discovery.menu.png);
 }
 #icon_god-resources {
-  background: url(../../images/gm_resources.menu_gray.png) no-repeat;
+  background-image: url(../../images/gm_resources.menu_gray.png);
 }
 #icon_god-configuration {
-  background: url(../../images/gm_configuration.menu_gray.png) no-repeat;
+  background-image: url(../../images/gm_configuration.menu_gray.png);
 }
 #icon_god-alerts {
-  background: url(../../images/gm_alerts.menu_gray.png) no-repeat;
+  background-image: url(../../images/gm_alerts.menu_gray.png);
 }
 #icon_god-users {
-  background: url(../../images/gm_users.menu_gray.png) no-repeat;
+  background-image: url(../../images/gm_users.menu_gray.png);
 }
 #icon_god-reporting {
-  background: url(../../images/reporting_edit.menu.png) no-repeat 50% 50%;
+  background-image: url(../../images/reporting_edit.menu.png);
 }
 #icon_god-servers {
-  background: url(../../images/gm_servers.menu_gray.png) no-repeat;
+  background-image: url(../../images/gm_servers.menu_gray.png);
 }
 #icon_god-setup {
-  background: url(../../images/gm_setup.menu_gray.png) no-repeat;
+  background-image: url(../../images/gm_setup.menu_gray.png);
 }
 #icon_god-events {
-  background: url(../../images/gm_events.menu_gray.png) no-repeat;
+  background-image: url(../../images/gm_events.menu_gray.png);
 }
 #icon_god-extensions {
-  background: url(../../images/builder.menu_gray.png) no-repeat;
+  background-image: url(../../images/builder.menu_gray.png);
 }
 #icon_god-links {
-  background: url(../../images/links.menu_gray.png) no-repeat;
+  background-image: url(../../images/links.menu_gray.png);
 }
 #icon_god-um_messages {
-  background: url(../../images/um_messages.menu_gray.png) no-repeat;
+  background-image: url(../../images/um_messages.menu_gray.png);
 }
 
 #menu_container {
@@ -267,38 +266,42 @@ ul li {
  */
 
 .menu_icon:hover {
-  background-color: #282828 !important;
+  background-color: #282828;
 }
 .submenu_not_selected:hover {
-  background-color: #202020 !important;
+  background-color: #202020;
 }
 .submenu_selected:hover {
-  background-color: #202020 !important;
+  background-color: #202020;
 }
 .sub_subMenu:hover {
-  background-color: #161616 !important;
+  background-color: #161616;
 }
 
 .menu li.selected {
-  box-shadow: inset 4px 0 #80ba27;
+  box-shadow: inset 4px 0 #82b92e;
 }
 
 .operation {
-  background-color: #3d3d3d !important;
-  padding-top: 20px !important;
+  background-color: #3d3d3d;
+  padding-top: 20px;
 }
 
 .operation .selected,
 .godmode .selected {
-  background-color: #282828 !important;
+  background-color: #282828;
 }
 
 .operation .selected #title_menu,
 .godmode .selected #title_menu {
-  color: #fff !important;
+  color: #fff;
   font-weight: 600;
 }
 
+.menu > .operation {
+  padding-top: 2em;
+}
+
 .menu li,
 .menu li a,
 .menu li div {
@@ -312,84 +315,83 @@ ul li {
 }
 
 .godmode {
-  padding-bottom: 4px !important;
+  padding-bottom: 4px;
   background-color: #343434;
 }
 
 /* Menu icons active */
 .selected#icon_oper-networkconsole {
-  background: url(../../images/op_network.menu_white.png) no-repeat;
+  background-image: url(../../images/op_network.menu_white.png);
 }
 .selected#icon_oper-agents {
-  background: url(../../images/op_monitoring.menu_white.png) no-repeat;
+  background-image: url(../../images/op_monitoring.menu_white.png);
 }
 .selected#icon_oper-events {
-  background: url(../../images/op_events.menu_white.png) no-repeat;
+  background-image: url(../../images/op_events.menu_white.png);
 }
 .selected#icon_oper-users {
-  background: url(../../images/op_workspace.menu_white.png) no-repeat;
+  background-image: url(../../images/op_workspace.menu_white.png);
 }
 .selected#icon_oper-reporting {
-  background: url(../../images/op_reporting.menu_white.png) no-repeat;
+  background-image: url(../../images/op_reporting.menu_white.png);
 }
 .selected#icon_oper-extensions {
-  background: url(../../images/extensions.menu_white.png) no-repeat;
+  background-image: url(../../images/extensions.menu_white.png);
 }
 .selected#icon_god-discovery {
-  background: url(../../images/gm_discovery.menu_white.png) no-repeat;
+  background-image: url(../../images/gm_discovery.menu_white.png);
 }
 .selected#icon_god-resources {
-  background: url(../../images/gm_resources.menu_white.png) no-repeat;
+  background-image: url(../../images/gm_resources.menu_white.png);
 }
 .selected#icon_god-configuration {
-  background: url(../../images/gm_configuration.menu_white.png) no-repeat;
+  background-image: url(../../images/gm_configuration.menu_white.png);
 }
 .selected#icon_god-alerts {
-  background: url(../../images/gm_alerts.menu_white.png) no-repeat;
+  background-image: url(../../images/gm_alerts.menu_white.png);
 }
 .selected#icon_god-users {
-  background: url(../../images/gm_users.menu_white.png) no-repeat;
+  background-image: url(../../images/gm_users.menu_white.png);
 }
 .selected#icon_god-servers {
-  background: url(../../images/gm_servers.menu_white.png) no-repeat;
+  background-image: url(../../images/gm_servers.menu_white.png);
 }
 .selected#icon_god-setup {
-  background: url(../../images/gm_setup.menu_white.png) no-repeat;
+  background-image: url(../../images/gm_setup.menu_white.png);
 }
 .selected#icon_god-events {
-  background: url(../../images/gm_events.menu_white.png) no-repeat;
+  background-image: url(../../images/gm_events.menu_white.png);
 }
 .selected#icon_god-extensions {
-  background: url(../../images/builder.menu_white.png) no-repeat;
+  background-image: url(../../images/builder.menu_white.png);
 }
 .selected#icon_god-links {
-  background: url(../../images/links.menu_white.png) no-repeat;
+  background-image: url(../../images/links.menu_white.png);
 }
 .selected#icon_god-um_messages {
-  background: url(../../images/um_messages.menu_white.png) no-repeat;
+  background-image: url(../../images/um_messages.menu_white.png);
 }
 
 #menu_full {
-  width: 60px; /* This is overwritten by the classic menu (215px) */
+  height: 100%;
+  display: flex;
+  flex-direction: column;
   position: fixed;
   z-index: 1;
   top: 0;
   left: 0;
   background-color: #343434;
-  border-bottom: solid 3px #343434;
-  min-height: 943px;
 }
 
 .button_collapse {
+  margin-top: auto;
   height: 38px;
   background-color: #505050;
-  width: 60px; /* This is overwritten by the classic menu (215px) */
   text-align: center;
   color: #fff;
   cursor: pointer;
   background-repeat: no-repeat;
   background-position: center;
-  margin-top: 15px;
 }
 
 .logo_green {
@@ -403,21 +405,29 @@ ul li {
 .operation a,
 .godmode div,
 .godmode a {
-  font-family: "Open Sans", sans-serif;
+  font-family: "lato", "Open Sans", sans-serif;
 }
 
 .menu_full_classic,
 .button_classic {
-  width: 215px !important;
+  width: 215px;
 }
 
 .menu_full_collapsed,
 .button_collapsed {
-  width: 60px !important;
+  width: 60px;
+}
+
+.menu_full_classic .title_menu_classic {
+  display: flex;
+}
+
+.menu_full_collapsed .title_menu_collapsed {
+  display: none;
 }
 
 .button_classic {
-  width: 215px !important;
+  width: 215px;
   background-image: url(../../images/button_collapse_menu.png);
   background-repeat: no-repeat;
   background-position: center;
@@ -434,13 +444,13 @@ ul li {
   .menu li,
   .menu li a,
   .menu li div {
-    min-height: 28px !important;
+    min-height: 28px;
   }
 }
 
 @media screen and (max-height: 735px) {
   .operation {
-    padding-top: 10px !important;
+    padding-top: 10px;
   }
   .button_collapse {
     margin-top: 10px;
@@ -453,29 +463,29 @@ ul li {
  * ---------------------------------------------------------------------
  */
 .page_classic {
-  padding-left: 215px !important;
+  padding-left: 215px;
 }
 
 .page_collapsed {
-  padding-left: 60px !important;
+  padding-left: 60px;
 }
 
 .header_table_classic {
-  padding-left: 235px !important; /* 215 + 35 */
+  padding-left: 235px; /* 215 + 35 */
 }
 
 .header_table_collapsed {
-  padding-left: 80px !important; /* 60 + 35 */
+  padding-left: 80px; /* 60 + 35 */
 }
 
 .title_menu_classic {
-  display: flex !important;
+  display: flex;
 }
 
 .title_menu_collapsed {
-  display: none !important;
+  display: none;
 }
 
 .menu_icon_collapsed {
-  background-position: 50% 50% !important;
+  background-position: 50% 50%;
 }
diff --git a/pandora_console/include/styles/news.css b/pandora_console/include/styles/news.css
new file mode 100644
index 0000000000..0ed635bafd
--- /dev/null
+++ b/pandora_console/include/styles/news.css
@@ -0,0 +1,14 @@
+.green_title {
+  background-color: #82b92e;
+  font-weight: 600;
+  width: 100%;
+  text-align: center;
+  display: block;
+  padding: 1em;
+  font-size: 1.3em;
+  color: #fff;
+}
+
+.new.content {
+  padding: 0 4em 2em;
+}
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index b4fa370521..8c12d11d04 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -116,16 +116,23 @@
   src: url("../../fonts/Lato-Regular.ttf");
 }
 * {
-  font-family: verdana, sans-serif;
+  font-family: "lato-lighter", "Open Sans", sans-serif;
   letter-spacing: 0.03pt;
   font-size: 8pt;
+  box-sizing: border-box;
 }
 svg * {
   font-size: 11pt;
 }
+html {
+  height: 100%;
+}
 body {
   background-color: #fff;
   margin: 0 auto;
+  display: flex;
+  flex-direction: column;
+  min-height: 100%;
 }
 input,
 textarea {
@@ -142,7 +149,7 @@ input {
 }
 
 input[type="checkbox"] {
-  display: inline !important;
+  display: inline;
 }
 select {
   padding: 2px 3px 3px 3px;
@@ -210,13 +217,13 @@ th > label {
   padding-top: 7px;
 }
 input:disabled {
-  background-color: #ddd !important;
+  background-color: #ddd;
 }
 textarea:disabled {
-  background-color: #ddd !important;
+  background-color: #ddd;
 }
 select:disabled {
-  background-color: #ddd !important;
+  background-color: #ddd;
 }
 ul {
   list-style-type: none;
@@ -228,11 +235,12 @@ pre {
   font-family: courier, serif;
 }
 fieldset {
-  background-color: #f9faf9;
+  background-color: #fff;
   border: 1px solid #e2e2e2;
   padding: 0.5em;
   margin-bottom: 20px;
   position: relative;
+  border-radius: 5px;
 }
 fieldset legend {
   font-size: 1.1em;
@@ -247,7 +255,7 @@ td input[type="checkbox"] {
 }
 input[type="image"] {
   border: 0px;
-  background-color: transparent !important;
+  background-color: transparent;
 }
 table,
 img {
@@ -274,18 +282,18 @@ textarea:-webkit-autofill:hover textarea:-webkit-autofill:focus,
 select:-webkit-autofill,
 select:-webkit-autofill:hover,
 select:-webkit-autofill:focus {
-  -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
+  -webkit-box-shadow: 0 0 0px 1000px #ffffff inset;
 }
 
 /* All select type multiple */
 select[multiple] option:checked {
   background: #82b92e linear-gradient(0deg, #82b92e 0%, #82b92e 100%);
-  color: #fff !important;
+  color: #fff;
 }
 
 select option:checked {
   background-color: #82b92e;
-  color: #fff !important;
+  color: #fff;
 }
 
 select > option:hover {
@@ -429,30 +437,129 @@ select:-internal-list-box {
  * - GLOBAL STYLES                           									-
  * ---------------------------------------------------------------------
  */
+.truncate {
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
+.truncate:hover {
+  white-space: pre-wrap;
+}
+.w120px {
+  width: 120px;
+  max-width: 120px;
+}
+.mw120px {
+  min-width: 120px;
+}
+.mw250px {
+  min-width: 250px;
+}
+.w20px {
+  width: 20px;
+}
 .w10p {
-  max-width: 10%;
+  width: 10%;
 }
 
 .w20p {
-  max-width: 20%;
+  width: 20%;
 }
 
 .w30p {
-  max-width: 30%;
+  width: 30%;
 }
 
 .w40p {
-  max-width: 40%;
+  width: 40%;
 }
 
 .w50p {
-  max-width: 50%;
+  width: 50%;
 }
 
 .w100p {
-  max-width: 100%;
+  width: 100%;
 }
 
+.h10p {
+  height: 10%;
+}
+
+.h20p {
+  height: 20%;
+}
+
+.h30p {
+  height: 30%;
+}
+
+.h40p {
+  height: 40%;
+}
+
+.h50p {
+  height: 50%;
+}
+
+.h80p {
+  height: 80%;
+}
+
+.h100p {
+  height: 100%;
+}
+.no-text-imp {
+  font-size: 0 !important;
+}
+.flex-content-right {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: nowrap;
+  justify-content: flex-end;
+  align-content: flex-end;
+}
+.flex-column {
+  display: flex;
+  flex-direction: column;
+  flex-wrap: wrap;
+  justify-content: space-between;
+  align-content: center;
+}
+
+.flex-row {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+  justify-content: space-between;
+  align-content: center;
+}
+.flex-row-baseline {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+  align-items: baseline;
+}
+
+.nowrap {
+  flex-wrap: nowrap;
+}
+
+.padding-2 {
+  padding: 2em;
+}
+.padding-4 {
+  padding: 4em;
+}
+.padding-6 {
+  padding: 6em;
+}
+.margin-right-2 {
+  margin-right: 2em;
+}
+.no-border {
+  border: none;
+}
 .no-padding {
   padding: 0;
 }
@@ -469,10 +576,19 @@ select:-internal-list-box {
   vertical-align: top;
 }
 .no-td-borders td {
-  border: none !important;
+  border: none;
 }
 .no-td-padding td {
-  padding: 0 !important;
+  padding: 0;
+}
+.td-bg-white td {
+  background: #fff;
+}
+.float-left {
+  float: left;
+}
+.float-right {
+  float: right;
 }
 
 div#page {
@@ -480,10 +596,10 @@ div#page {
   background-image: none;
   clear: both;
   width: auto;
-  padding-top: 5px !important;
-  padding-left: 60px; /* This is overwritten by the classic menu (215px)*/
-  padding-right: 35px;
-  margin-left: 20px;
+  padding-top: 5px;
+  padding-right: 6em;
+  display: flex;
+  flex-direction: column;
 }
 
 body.pure {
@@ -500,12 +616,11 @@ div#container {
 }
 
 div#main {
-  width: auto;
+  width: 100%;
   margin: 0 auto;
+  margin-left: 3em;
   position: relative;
   min-height: 850px;
-  max-width: 100%;
-  min-width: 93%;
 }
 
 textarea.conf_editor {
@@ -563,11 +678,11 @@ p.center {
 }
 
 /* --- Botones --- */
+button.sub,
 input.sub {
   font-weight: normal;
   -moz-border-radius: 2px;
   -webkit-border-radius: 2px;
-  height: auto !important;
   border-radius: 2px;
   font-size: 1.2em;
   background-color: #fff;
@@ -577,13 +692,27 @@ input.sub {
   padding-bottom: 10px;
   padding-top: 10px;
   padding-left: 15px;
-  border-color: #888;
-  font-family: "lato", "Open Sans", sans-serif !important;
+  border: 1px solid #888;
+  font-family: "lato", "Open Sans", sans-serif;
+  cursor: pointer;
 }
 
+button.sub:hover,
+input.sub:hover {
+  border: 1px solid #333;
+}
+
+button.sub:active,
+input.sub:active {
+  border: 1px solid #000;
+  color: #333;
+  background-color: #e1e1e1;
+}
+
+button.sub[disabled],
 input.sub[disabled] {
-  color: #b4b4b4 !important;
-  background-color: #f3f3f3 !important;
+  color: #b4b4b4;
+  background-color: #f3f3f3;
   border-color: #b6b6b6;
   cursor: default;
 }
@@ -715,33 +844,6 @@ div#main_help div.databox p {
   text-align: justify;
 }
 
-/*
- * ---------------------------------------------------------------------
- * - FOOTER 														-
- * ---------------------------------------------------------------------
- */
-a.footer,
-a.footer span {
-  font-size: 9px;
-  color: white;
-}
-
-div#foot {
-  padding-top: 10px;
-  padding-bottom: 10px;
-  text-align: center;
-  background: #343434;
-  clear: both;
-  width: auto;
-}
-
-div#foot a,
-div#foot span {
-  font-family: "Open Sans", sans-serif;
-  font-size: 8pt;
-  color: #9ca4a6;
-}
-
 /*
  * ---------------------------------------------------------------------
  * - HEADER AND LEFT MENU STYLES 									-
@@ -789,9 +891,9 @@ div#head {
 }
 
 /*.databox_error {
-	width: 657px !important;
+	width: 657px;
 	height: 400px;
-	border: none !important;
+	border: none;
 	background-color: #fafafa;
 	background: url(../../images/splash_error.png) no-repeat;
 }
@@ -808,276 +910,6 @@ input.datos {
 	background-color: #050505;
 }*/
 
-/*
- * ---------------------------------------------------------------------
- * - VISUAL MAPS 													-
- * ---------------------------------------------------------------------
- */
-input.vs_button_ghost {
-  background-color: transparent !important;
-  border: 1px solid #82b92e;
-  color: #82b92e !important;
-  text-align: center;
-  padding: 4px 12px;
-  font-weight: bold;
-}
-
-input.next,
-input.upd,
-input.ok,
-input.wand,
-input.delete,
-input.cog,
-input.target,
-input.search,
-input.copy,
-input.add,
-input.graph,
-input.percentile,
-input.binary,
-input.camera,
-input.config,
-input.cancel,
-input.default,
-input.filter,
-input.pdf,
-input.spinn {
-  padding-right: 30px;
-  height: 23px;
-}
-
-input.next {
-  background-image: url(../../images/input_go.png) !important;
-}
-input.upd {
-  background-image: url(../../images/input_update.png) !important;
-}
-input.wand {
-  background-image: url(../../images/input_wand.png) !important;
-}
-input.wand:disabled {
-  background-image: url(../../images/input_wand.disabled.png) !important;
-}
-input.search {
-  background-image: url(../../images/input_zoom.png) !important;
-}
-input.search:disabled {
-  background-image: url(../../images/input_zoom.disabled.png) !important;
-}
-input.ok {
-  background-image: url(../../images/input_tick.png) !important;
-}
-input.ok:disabled {
-  background-image: url(../../images/input_tick.disabled.png) !important;
-}
-input.add {
-  background-image: url(../../images/input_add.png) !important;
-}
-input.add:disabled {
-  background-image: url(../../images/input_add.disabled.png) !important;
-}
-input.cancel {
-  background-image: url(../../images/input_cross.png) !important;
-}
-input.cancel:disabled {
-  background-image: url(../../images/input_cross.disabled.png) !important;
-}
-input.delete {
-  background-image: url(../../images/input_delete.png) !important;
-}
-input.delete:disabled {
-  background-image: url(../../images/input_delete.disabled.png) !important;
-}
-input.cog {
-  background-image: url(../../images/input_cog.png) !important;
-}
-input.cog:disabled {
-  background-image: url(../../images/input_cog.disabled.png) !important;
-}
-input.config {
-  background-image: url(../../images/input_config.png) !important;
-}
-input.config:disabled {
-  background-image: url(../../images/input_config.disabled.png) !important;
-}
-input.filter {
-  background-image: url(../../images/input_filter.png) !important;
-}
-input.filter:disabled {
-  background-image: url(../../images/input_filter.disabled.png) !important;
-}
-input.pdf {
-  background-image: url(../../images/input_pdf.png) !important;
-}
-input.pdf:disabled {
-  background-image: url(../../images/input_pdf.disabled.png) !important;
-}
-input.camera {
-  background-image: url(../../images/input_camera.png) !important;
-}
-input.spinn {
-  background-image: url(../../images/spinner_green.gif) !important;
-}
-
-#toolbox #auto_save {
-  padding-top: 5px;
-}
-
-#toolbox {
-  margin-top: 13px;
-}
-input.visual_editor_button_toolbox {
-  padding-right: 15px;
-  padding-top: 10px;
-  margin-top: 5px;
-}
-input.delete_min {
-  background: #fefefe url(../../images/cross.png) no-repeat center !important;
-}
-input.delete_min[disabled] {
-  background: #fefefe url(../../images/cross.disabled.png) no-repeat center !important;
-}
-input.graph_min {
-  background: #fefefe url(../../images/chart_curve.png) no-repeat center !important;
-}
-input.graph_min[disabled] {
-  background: #fefefe url(../../images/chart_curve.disabled.png) no-repeat
-    center !important;
-}
-input.bars_graph_min {
-  background: #fefefe url(../../images/icono-barras-arriba.png) no-repeat center !important;
-}
-input.bars_graph_min[disabled] {
-  background: #fefefe url(../../images/icono-barras-arriba.disabled.png)
-    no-repeat center !important;
-}
-input.percentile_min {
-  background: #fefefe url(../../images/chart_bar.png) no-repeat center !important;
-}
-input.percentile_min[disabled] {
-  background: #fefefe url(../../images/chart_bar.disabled.png) no-repeat center !important;
-}
-input.percentile_item_min {
-  background: #fefefe url(../../images/percentile_item.png) no-repeat center !important;
-}
-input.percentile_item_min[disabled] {
-  background: #fefefe url(../../images/percentile_item.disabled.png) no-repeat
-    center !important;
-}
-input.auto_sla_graph_min {
-  background: #fefefe url(../../images/auto_sla_graph.png) no-repeat center !important;
-}
-input.auto_sla_graph_min[disabled] {
-  background: #fefefe url(../../images/auto_sla_graph.disabled.png) no-repeat
-    center !important;
-}
-input.donut_graph_min {
-  background: #fefefe url(../../images/icono-quesito.png) no-repeat center !important;
-}
-input.donut_graph_min[disabled] {
-  background: #fefefe url(../../images/icono-quesito.disabled.png) no-repeat
-    center !important;
-}
-input.binary_min {
-  background: #fefefe url(../../images/binary.png) no-repeat center !important;
-}
-input.binary_min[disabled] {
-  background: #fefefe url(../../images/binary.disabled.png) no-repeat center !important;
-}
-input.camera_min {
-  background: #fefefe url(../../images/camera.png) no-repeat center !important;
-}
-input.camera_min[disabled] {
-  background: #fefefe url(../../images/camera.disabled.png) no-repeat center !important;
-}
-input.config_min {
-  background: #fefefe url(../../images/config.png) no-repeat center !important;
-}
-input.config_min[disabled] {
-  background: #fefefe url(../../images/config.disabled.png) no-repeat center !important;
-}
-input.label_min {
-  background: #fefefe url(../../images/tag_red.png) no-repeat center !important;
-}
-input.label_min[disabled] {
-  background: #fefefe url(../../images/tag_red.disabled.png) no-repeat center !important;
-}
-input.icon_min {
-  background: #fefefe url(../../images/photo.png) no-repeat center !important;
-}
-input.icon_min[disabled] {
-  background: #fefefe url(../../images/photo.disabled.png) no-repeat center !important;
-}
-input.clock_min {
-  background: #fefefe url(../../images/clock-tab.png) no-repeat center !important;
-}
-input.clock_min[disabled] {
-  background: #fefefe url(../../images/clock-tab.disabled.png) no-repeat center !important;
-}
-input.box_item {
-  background: #fefefe url(../../images/box_item.png) no-repeat center !important;
-}
-input.box_item[disabled] {
-  background: #fefefe url(../../images/box_item.disabled.png) no-repeat center !important;
-}
-input.line_item {
-  background: #fefefe url(../../images/line_item.png) no-repeat center !important;
-}
-input.line_item[disabled] {
-  background: #fefefe url(../../images/line_item.disabled.png) no-repeat center !important;
-}
-input.copy_item {
-  background: #fefefe url(../../images/copy_visualmap.png) no-repeat center !important;
-}
-input.copy_item[disabled] {
-  background: #fefefe url(../../images/copy_visualmap.disabled.png) no-repeat
-    center !important;
-}
-input.grid_min {
-  background: #fefefe url(../../images/grid.png) no-repeat center !important;
-}
-input.grid_min[disabled] {
-  background: #fefefe url(../../images/grid.disabled.png) no-repeat center !important;
-}
-input.save_min {
-  background: #fefefe url(../../images/file.png) no-repeat center !important;
-}
-input.save_min[disabled] {
-  background: #fefefe url(../../images/file.disabled.png) no-repeat center !important;
-}
-input.service_min {
-  background: #fefefe url(../../images/box.png) no-repeat center !important;
-}
-input.service_min[disabled] {
-  background: #fefefe url(../../images/box.disabled.png) no-repeat center !important;
-}
-
-input.group_item_min {
-  background: #fefefe url(../../images/group_green.png) no-repeat center !important;
-}
-input.group_item_min[disabled] {
-  background: #fefefe url(../../images/group_green.disabled.png) no-repeat
-    center !important;
-}
-input.color_cloud_min {
-  background: #fefefe url(../../images/color_cloud_item.png) no-repeat center !important;
-}
-input.color_cloud_min[disabled] {
-  background: #fefefe url(../../images/color_cloud_item.disabled.png) no-repeat
-    center !important;
-}
-
-div#cont {
-  position: fixed;
-  max-height: 320px;
-  overflow-y: auto;
-  overflow-x: hidden;
-}
-
-/*.termframe{
-	background-color: #80BA27 !important;
-}*/
-
 /*
  * ---------------------------------------------------------------------
  * - REPORTS 														-
@@ -1093,38 +925,6 @@ div#cont {
   border: #ccc outset 3px;
 }
 
-td.datos3,
-td.datos4 {
-  background-color: #fff;
-  color: #000 !important;
-  border-bottom: 2px solid #82b92e !important;
-  border-left: none !important;
-  border-right: none !important;
-  height: 30px;
-  font-size: 8.6pt;
-  font-weight: normal;
-}
-
-td.datos4 {
-  /*Add !important because in php the function html_print_table write style in cell and this is style head.*/
-  text-align: center !important;
-}
-
-td.datos3 *,
-td.datos4 * {
-  font-size: 8.6pt;
-  font-weight: normal;
-}
-
-/*td.datos_id {
-	color: #1a313a;
-}*/
-
-/* user list php */
-tr.disabled_row_user * {
-  color: grey;
-}
-
 /* global syles */
 .bg {
   /* op menu */
@@ -1203,7 +1003,7 @@ td.datos2f9 {
 }
 
 .warning * {
-  color: #fad403;
+  color: #f3b200;
 }
 
 .help {
@@ -1333,9 +1133,8 @@ div.title_line {
   justify-content: space-between;
   border-bottom: 2px solid #82b92e;
   min-height: 50px;
-  width: 100%;
+  width: calc(100% + 3em);
   padding-right: 0px;
-  margin-left: 0px !important;
   margin-bottom: 20px;
   height: 50px;
   box-sizing: border-box;
@@ -1343,6 +1142,7 @@ div.title_line {
   border-top-right-radius: 7px;
   border-top-left-radius: 7px;
   box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
+  margin-left: -3em;
 }
 
 /* Breadcrum */
@@ -1364,24 +1164,23 @@ div.title_line {
 }
 
 .breadcrumbs_container {
-  padding-left: 10px;
+  padding-left: 2.5em;
   padding-top: 4px;
   text-indent: 0.25em;
   color: #848484;
-  font-size: 10pt !important;
-  font-family: "lato-bolder", "Open Sans", sans-serif !important;
+  font-size: 10pt;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
 }
 
 .breadcrumb_active {
   color: #82b92e;
-  font-size: 10pt !important;
-  font-family: "lato-bolder", "Open Sans", sans-serif !important;
+  font-size: 10pt;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
 }
 /* End - Breadcrum */
 
 #menu_tab {
   margin-right: 10px;
-  min-width: 510px;
 }
 
 #menu_tab .mn,
@@ -1449,11 +1248,11 @@ ul.subsubmenu li a {
   float: right;
   z-index: 9999;
   display: none;
-  margin-top: 5px !important ;
-  left: 0px !important;
+  margin-top: 5px;
+  left: 0px;
 }
 .subsubmenu li {
-  margin-top: 0px !important ;
+  margin-top: 0px;
 }
 
 div#agent_wizard_subtabs {
@@ -1479,9 +1278,12 @@ div#agent_wizard_subtabs {
   margin-right: 20px;
 }
 
+#menu_tab_left span {
+  padding-left: 0.9em;
+}
+
 #menu_tab_left .mn,
-#menu_tab_left ul,
-#menu_tab_left .mn ul {
+#menu_tab_left ul {
   color: #343434;
   padding: 0px 0px 0px 0px;
   list-style: none;
@@ -1498,7 +1300,7 @@ div#agent_wizard_subtabs {
 }
 
 #menu_tab_left li.view {
-  margin-left: 0px !important;
+  margin-left: 0px;
   padding-left: 10px;
   padding-bottom: 4px;
   white-space: nowrap;
@@ -1512,7 +1314,7 @@ div#agent_wizard_subtabs {
 #menu_tab_left li a,
 #menu_tab_left li span {
   color: #343434;
-  font-family: "lato-bolder", "Open Sans", sans-serif !important;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
   font-size: 18pt;
   line-height: 18pt;
 }
@@ -1626,9 +1428,9 @@ span.rmess, span.nrmess {
 table.databox {
   background-color: #f9faf9;
   border-spacing: 0px;
-  -moz-box-shadow: 0px 0px 0px #ddd !important;
-  -webkit-box-shadow: 0px 0px 0px #ddd !important;
-  box-shadow: 0px 0px 0px #ddd !important;
+  -moz-box-shadow: 0px 0px 0px #ddd;
+  -webkit-box-shadow: 0px 0px 0px #ddd;
+  box-shadow: 0px 0px 0px #ddd;
 }
 
 .databox > tbody > tr > td {
@@ -1658,7 +1460,7 @@ table.databox {
 .databox > th > textarea,
 .databox > th > select,
 .databox > th > select > option {
-  color: #222 !important;
+  color: #222;
 }
 
 .databox.data > tbody > tr > td:first-child {
@@ -1724,9 +1526,9 @@ table.alternate tr:nth-child(even) td {
 
 table.rounded_cells td {
   padding: 4px 4px 4px 10px;
-  -moz-border-radius: 6px !important;
-  -webkit-border-radius: 6px !important;
-  border-radius: 6px !important;
+  -moz-border-radius: 6px;
+  -webkit-border-radius: 6px;
+  border-radius: 6px;
 }
 
 /*#head_l {
@@ -1776,6 +1578,151 @@ div#logo_text3 {
 .action-buttons {
   text-align: right;
 }
+
+button.next,
+button.upd,
+button.ok,
+button.wand,
+button.delete,
+button.cog,
+button.target,
+button.search,
+button.copy,
+button.add,
+button.graph,
+button.percentile,
+button.binary,
+button.camera,
+button.config,
+button.filter,
+button.cancel,
+button.default,
+button.deploy,
+input.deploy,
+input.next,
+input.upd,
+input.ok,
+input.wand,
+input.delete,
+input.cog,
+input.target,
+input.search,
+input.copy,
+input.add,
+input.graph,
+input.percentile,
+input.binary,
+input.camera,
+input.config,
+input.filter,
+input.cancel,
+input.default,
+input.filter,
+input.pdf,
+input.spinn {
+  padding-right: 30px;
+}
+
+button.next,
+input.next {
+  background-image: url(../../images/input_go.png);
+}
+button.upd,
+input.upd {
+  background-image: url(../../images/input_update.png);
+}
+button.wand,
+input.wand {
+  background-image: url(../../images/input_wand.png);
+}
+button.wand:disabled,
+input.wand:disabled {
+  background-image: url(../../images/input_wand.disabled.png);
+}
+button.search,
+input.search {
+  background-image: url(../../images/input_zoom.png);
+}
+button.search:disabled,
+input.search:disabled {
+  background-image: url(../../images/input_zoom.disabled.png);
+}
+button.ok,
+input.ok {
+  background-image: url(../../images/input_tick.png);
+}
+button.ok:disabled,
+input.ok:disabled {
+  background-image: url(../../images/input_tick.disabled.png);
+}
+button.add,
+input.add {
+  background-image: url(../../images/input_add.png);
+}
+button.add:disabled,
+input.add:disabled {
+  background-image: url(../../images/input_add.disabled.png);
+}
+button.cancel,
+input.cancel {
+  background-image: url(../../images/input_cross.png);
+}
+button.cancel:disabled,
+input.cancel:disabled {
+  background-image: url(../../images/input_cross.disabled.png);
+}
+button.delete,
+input.delete {
+  background-image: url(../../images/input_delete.png);
+}
+button.delete:disabled,
+input.delete:disabled {
+  background-image: url(../../images/input_delete.disabled.png);
+}
+button.cog,
+input.cog {
+  background-image: url(../../images/input_cog.png);
+}
+button.cog:disabled,
+input.cog:disabled {
+  background-image: url(../../images/input_cog.disabled.png);
+}
+button.config,
+input.config {
+  background-image: url(../../images/input_config.png);
+}
+button.config:disabled,
+input.config:disabled {
+  background-image: url(../../images/input_config.disabled.png);
+}
+button.filter,
+input.filter {
+  background-image: url(../../images/input_filter.png);
+}
+button.filter:disabled,
+input.filter:disabled {
+  background-image: url(../../images/input_filter.disabled.png);
+}
+button.pdf,
+input.pdf {
+  background-image: url(../../images/input_pdf.png);
+}
+button.pdf:disabled,
+input.pdf:disabled {
+  background-image: url(../../images/input_pdf.disabled.png);
+}
+button.camera,
+input.camera {
+  background-image: url(../../images/input_camera.png);
+}
+button.spinn,
+input.spinn {
+  background-image: url(../../images/spinner_green.gif);
+}
+button.deploy,
+input.deploy {
+  background-image: url(../../images/input_deploy.png);
+}
 /*#table-add-item select, #table-add-sla select {
 	width: 180px;
 }*/
@@ -1814,7 +1761,7 @@ div#main_pure {
 
 /* IE 7 Hack */
 #editor {
-  *margin-top: 10px !important;
+  *margin-top: 10px;
 }
 /* big_data is used in tactical and logon_ok */
 .big_data {
@@ -1834,7 +1781,7 @@ div#main_pure {
   text-align: center;
   font-weight: bold;
   padding: 8px;
-  margin: 0px 0px 0px 0px !important;
+  margin: 0px 0px 0px 0px;
   z-index: -1;
 }
 
@@ -1854,7 +1801,7 @@ span.actions {
   margin-left: 30px;
 }
 .actions {
-  min-width: 200px !important;
+  min-width: 200px;
 }
 select#template,
 select#action {
@@ -1995,7 +1942,7 @@ ol.steps li.current {
   background-color: #e9f3d2;
 }
 ol.steps li.visited {
-  color: #999 !important;
+  color: #999;
 }
 
 fieldset .databox {
@@ -2003,7 +1950,7 @@ fieldset .databox {
 }
 
 fieldset.databox {
-  padding: 14px !important;
+  padding: 14px;
 }
 
 fieldset legend span,
@@ -2116,10 +2063,6 @@ div#pandora_logo_header {
  * ---------------------------------------------------------------------
  */
 #header_table {
-  margin: 0px;
-  padding: 0px;
-  margin-top: 0px;
-  padding-left: 95px; /* This is overwritten by the classic menu */
   padding-right: 35px;
 }
 
@@ -2135,21 +2078,12 @@ div#pandora_logo_header {
 .header_title {
   font-weight: 600;
   font-size: 10.5pt;
-  font-family: "lato-bolder", "Open Sans", sans-serif !important;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
 }
 
 .header_subtitle {
   font-size: 10pt;
-  font-family: "lato-bolder", "Open Sans", sans-serif !important;
-}
-
-#header_table_inner a,
-#header_table_inner span {
-  font-family: "Open Sans", sans-serif;
-}
-
-#header_table_inner a:hover {
-  text-decoration: none;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
 }
 
 .header_left {
@@ -2206,7 +2140,7 @@ div#header_autorefresh_counter {
 }
 
 .autorefresh_disabled {
-  cursor: not-allowed !important;
+  cursor: not-allowed;
 }
 
 a.autorefresh_txt,
@@ -2243,8 +2177,8 @@ div.warn {
 .submenu_not_selected,
 .submenu_selected,
 .submenu2 {
-  border: 0px !important;
-  min-height: 35px !important;
+  border: 0px;
+  min-height: 35px;
 }
 
 div#steps_clean {
@@ -2276,8 +2210,8 @@ div#logo_text3 {
 	padding-top: 0px;
 }*/
 .pagination * {
-  margin-left: 0px !important;
-  margin-right: 0px !important;
+  margin-left: 0px;
+  margin-right: 0px;
   vertical-align: middle;
 }
 
@@ -2321,7 +2255,7 @@ td.cellUnknown {
 }
 
 td.cellNotInit {
-  background: #3ba0ff;
+  background: #4a83f3;
   color: #ffffff;
 }
 
@@ -2339,26 +2273,27 @@ td.cellBig {
 }
 
 .info_box {
-  background: #f9faf9;
-  margin-top: 10px !important;
-  margin-bottom: 10px !important;
+  background: #fff;
+  box-shadow: 0px 0px 15px -10px #888;
+  margin-top: 10px;
+  margin-bottom: 10px;
   padding: 0px 5px 5px 10px;
   border-color: #e2e2e2;
   border-style: solid;
   border-width: 1px;
-  width: 100% !important;
+  width: 100%;
   -moz-border-radius: 4px;
   -webkit-border-radius: 4px;
   border-radius: 4px;
 }
 
 .info_box .title * {
-  font-size: 10pt !important;
+  font-size: 10pt;
   font-weight: bolder;
 }
 
 .info_box .icon {
-  width: 30px !important;
+  width: 30px;
   text-align: center;
 }
 
@@ -2378,20 +2313,20 @@ tr.group_view_data,
 
 tr.group_view_crit,
 .group_view_crit {
-  background-color: #fc4444;
+  background-color: #e63c52;
   color: #fff;
 }
 
 tr.group_view_ok,
 .group_view_ok {
-  background-color: #80ba27;
+  background-color: #82b92e;
   color: #fff;
 }
 
 tr.group_view_not_init,
 .group_view_not_init {
   background-color: #5bb6e5;
-  color: #fff !important;
+  color: #fff;
 }
 
 tr.group_view_warn,
@@ -2399,25 +2334,25 @@ tr.group_view_warn,
 tr.group_view_warn.a,
 a.group_view_warn,
 tr.a.group_view_warn {
-  background-color: #fad403;
-  color: #fff !important;
+  background-color: #f3b200;
+  color: #fff;
 }
 
 a.group_view_warn {
-  color: #fad403 !important;
-  color: #fff !important;
+  color: #f3b200;
+  color: #fff;
 }
 
 tr.group_view_alrm,
 .group_view_alrm {
   background-color: #ffa631;
-  color: #fff !important;
+  color: #fff;
 }
 
 tr.group_view_unk,
 .group_view_unk {
   background-color: #b2b2b2;
-  color: #fff !important;
+  color: #fff;
 }
 
 /* classes for event priorities. Sits now in functions.php */
@@ -2426,7 +2361,7 @@ tr.group_view_unk,
 .datos_green a,
 .datos_greenf9 a,
 .datos_green * {
-  background-color: #80ba27;
+  background-color: #82b92e;
   color: #fff;
 }
 .datos_red,
@@ -2434,14 +2369,14 @@ tr.group_view_unk,
 .datos_red a,
 .datos_redf9 a,
 .datos_red * {
-  background-color: #fc4444;
-  color: #fff !important;
+  background-color: #e63c52;
+  color: #fff;
 }
 
 .datos_yellow,
 .datos_yellowf9,
 .datos_yellow * {
-  background-color: #fad403;
+  background-color: #f3b200;
   color: #111;
 }
 
@@ -2450,7 +2385,7 @@ a.datos_blue,
 .datos_blue,
 .datos_blue * {
   background-color: #4ca8e0;
-  color: #fff !important;
+  color: #fff;
 }
 
 .datos_grey,
@@ -2497,7 +2432,7 @@ input#text-id_parent.ac_input,
 input,
 textarea,
 select {
-  background-color: #ffffff !important;
+  background-color: #ffffff;
   border: 1px solid #cbcbcb;
   -moz-border-radius: 3px;
   -webkit-border-radius: 3px;
@@ -2529,7 +2464,7 @@ span#plugin_description {
 .visual_font_size_4pt > em > strong,
 .visual_font_size_4pt em span,
 .visual_font_size_4pt span em {
-  font-size: 4pt !important;
+  font-size: 4pt;
   line-height: 4pt;
 }
 .visual_font_size_6pt,
@@ -2541,7 +2476,7 @@ span#plugin_description {
 .visual_font_size_6pt > em > strong,
 .visual_font_size_6pt em span,
 .visual_font_size_6pt span em {
-  font-size: 6pt !important;
+  font-size: 6pt;
   line-height: 6pt;
 }
 .visual_font_size_8pt,
@@ -2553,7 +2488,7 @@ span#plugin_description {
 .visual_font_size_8pt > em > strong,
 .visual_font_size_8pt em span,
 .visual_font_size_8pt span em {
-  font-size: 8pt !important;
+  font-size: 8pt;
   line-height: 8pt;
 }
 .visual_font_size_10pt,
@@ -2565,7 +2500,7 @@ span#plugin_description {
 .visual_font_size_10pt > em > strong,
 .visual_font_size_10pt em span,
 .visual_font_size_10pt span em {
-  font-size: 10pt !important;
+  font-size: 10pt;
   line-height: 10pt;
 }
 .visual_font_size_12pt,
@@ -2577,7 +2512,7 @@ span#plugin_description {
 .visual_font_size_12pt > em > strong,
 .visual_font_size_12pt em span,
 .visual_font_size_12pt span em {
-  font-size: 12pt !important;
+  font-size: 12pt;
   line-height: 12pt;
 }
 .visual_font_size_14pt,
@@ -2589,7 +2524,7 @@ span#plugin_description {
 .visual_font_size_14pt > em > strong,
 .visual_font_size_14pt em span,
 .visual_font_size_14pt span em {
-  font-size: 14pt !important;
+  font-size: 14pt;
   line-height: 14pt;
 }
 .visual_font_size_18pt,
@@ -2601,7 +2536,7 @@ span#plugin_description {
 .visual_font_size_18pt > em > strong,
 .visual_font_size_18pt em span,
 .visual_font_size_18pt span em {
-  font-size: 18pt !important;
+  font-size: 18pt;
   line-height: 18pt;
 }
 
@@ -2614,7 +2549,7 @@ span#plugin_description {
 .visual_font_size_24pt > em > strong,
 .visual_font_size_24pt em span,
 .visual_font_size_24pt span em {
-  font-size: 24pt !important;
+  font-size: 24pt;
   line-height: 24pt;
 }
 .visual_font_size_28pt,
@@ -2626,7 +2561,7 @@ span#plugin_description {
 .visual_font_size_28pt > em > strong,
 .visual_font_size_28pt em span,
 .visual_font_size_28pt span em {
-  font-size: 28pt !important;
+  font-size: 28pt;
   line-height: 28pt;
 }
 .visual_font_size_36pt,
@@ -2638,7 +2573,7 @@ span#plugin_description {
 .visual_font_size_36pt > em > strong,
 .visual_font_size_36pt em span,
 .visual_font_size_36pt span em {
-  font-size: 36pt !important;
+  font-size: 36pt;
   line-height: 36pt;
 }
 .visual_font_size_48pt,
@@ -2650,7 +2585,7 @@ span#plugin_description {
 .visual_font_size_48pt > em > strong,
 .visual_font_size_48pt em span,
 .visual_font_size_48pt span em {
-  font-size: 48pt !important;
+  font-size: 48pt;
   line-height: 48pt;
 }
 .visual_font_size_60pt,
@@ -2662,7 +2597,7 @@ span#plugin_description {
 .visual_font_size_60pt > em > strong,
 .visual_font_size_60pt em span,
 .visual_font_size_60pt span em {
-  font-size: 60pt !important;
+  font-size: 60pt;
   line-height: 60pt;
 }
 .visual_font_size_72pt,
@@ -2674,7 +2609,7 @@ span#plugin_description {
 .visual_font_size_72pt > em > strong,
 .visual_font_size_72pt em span,
 .visual_font_size_72pt span em {
-  font-size: 72pt !important;
+  font-size: 72pt;
   line-height: 72pt;
 }
 
@@ -2687,7 +2622,7 @@ span#plugin_description {
 .visual_font_size_84pt > em > strong,
 .visual_font_size_84pt em span,
 .visual_font_size_84pt span em {
-  font-size: 84pt !important;
+  font-size: 84pt;
   line-height: 84pt;
 }
 
@@ -2700,7 +2635,7 @@ span#plugin_description {
 .visual_font_size_96pt > em > strong,
 .visual_font_size_96pt em span,
 .visual_font_size_96pt span em {
-  font-size: 96pt !important;
+  font-size: 96pt;
   line-height: 96pt;
 }
 
@@ -2713,7 +2648,7 @@ span#plugin_description {
 .visual_font_size_116pt > em > strong,
 .visual_font_size_116pt em span,
 .visual_font_size_116pt span em {
-  font-size: 116pt !important;
+  font-size: 116pt;
   line-height: 116pt;
 }
 
@@ -2726,7 +2661,7 @@ span#plugin_description {
 .visual_font_size_128pt > em > strong,
 .visual_font_size_128pt em span,
 .visual_font_size_128pt span em {
-  font-size: 128pt !important;
+  font-size: 128pt;
   line-height: 128pt;
 }
 
@@ -2739,7 +2674,7 @@ span#plugin_description {
 .visual_font_size_140pt > em > strong,
 .visual_font_size_140pt em span,
 .visual_font_size_140pt span em {
-  font-size: 140pt !important;
+  font-size: 140pt;
   line-height: 140pt;
 }
 
@@ -2752,7 +2687,7 @@ span#plugin_description {
 .visual_font_size_154pt > em > strong,
 .visual_font_size_154pt em span,
 .visual_font_size_154pt span em {
-  font-size: 154pt !important;
+  font-size: 154pt;
   line-height: 154pt;
 }
 
@@ -2765,7 +2700,7 @@ span#plugin_description {
 .visual_font_size_196pt > em > strong,
 .visual_font_size_196pt em span,
 .visual_font_size_196pt span em {
-  font-size: 196pt !important;
+  font-size: 196pt;
   line-height: 196pt;
 }
 
@@ -2778,7 +2713,7 @@ span#plugin_description {
 .resize_visual_font_size_8pt > em > strong,
 .visual_font_size_8pt em span,
 .visual_font_size_8pt span em {
-  font-size: 4pt !important;
+  font-size: 4pt;
   line-height: 4pt;
 }
 .resize_visual_font_size_14pt,
@@ -2790,7 +2725,7 @@ span#plugin_description {
 .resize_visual_font_size_14pt > em > strong,
 .visual_font_size_14pt em span,
 .visual_font_size_14pt span em {
-  font-size: 7pt !important;
+  font-size: 7pt;
   line-height: 7pt;
 }
 .resize_visual_font_size_24pt,
@@ -2802,7 +2737,7 @@ span#plugin_description {
 .resize_visual_font_size_24pt > em > strong,
 .visual_font_size_14pt em span,
 .visual_font_size_14pt span em {
-  font-size: 12pt !important;
+  font-size: 12pt;
   line-height: 12pt;
 }
 .resize_visual_font_size_36pt,
@@ -2814,7 +2749,7 @@ span#plugin_description {
 .resize_visual_font_size_36pt > em > strong,
 .visual_font_size_36pt em span,
 .visual_font_size_36pt span em {
-  font-size: 18pt !important;
+  font-size: 18pt;
   line-height: 18pt;
 }
 .resize_visual_font_size_72pt,
@@ -2826,7 +2761,7 @@ span#plugin_description {
 .resize_visual_font_size_72pt > em > strong,
 .visual_font_size_72pt em span,
 .visual_font_size_72pt span em {
-  font-size: 36pt !important;
+  font-size: 36pt;
   line-height: 36pt;
 }
 
@@ -2851,9 +2786,9 @@ span#plugin_description {
   width: 400px;
   height: 260px;
 
-  -moz-box-shadow: 0px 4px 4px #010e1b !important;
-  -webkit-box-shadow: 0px 4px 4px #010e1b !important;
-  box-shadow: 0px 4px 4px #010e1b !important;
+  -moz-box-shadow: 0px 4px 4px #010e1b;
+  -webkit-box-shadow: 0px 4px 4px #010e1b;
+  box-shadow: 0px 4px 4px #010e1b;
 
   filter: alpha(opacity=97);
   -moz-opacity: 0.97;
@@ -2935,7 +2870,7 @@ span#plugin_description {
  * ---------------------------------------------------------------------
  */
 a.tip {
-  display: inline !important;
+  display: inline;
   cursor: help;
 }
 
@@ -2960,10 +2895,10 @@ input.search_input {
   background-position: center right 10px;
   background-repeat: no-repeat;
   background-size: 17px;
-  background-color: #f2f6f7 !important;
+  background-color: #f2f6f7;
   padding: 0px;
   margin: 0;
-  width: 250px;
+  width: 300px;
   height: 30px;
   margin-left: 2px;
   padding-left: 15px;
@@ -2979,7 +2914,7 @@ input.search_input {
 }
 
 /*.vertical_fields td input, .vertical_fields td select {
-	margin-top: 8px !important;
+	margin-top: 8px;
 }*/
 
 a[id^="tgl_ctrl_"] > img,
@@ -3015,7 +2950,7 @@ div.forced_title_layer {
 
 div.legend > div {
   pointer-events: none; /* Allow to click the graphs below */
-  opacity: 0.65 !important;
+  opacity: 0.65;
 }
 
 /* Recover the padding of the legend elements under a databox parent */
@@ -3162,7 +3097,7 @@ div.nodata_container {
 
 .menu_graph,
 .timestamp_graph {
-  position: absolute !important;
+  position: absolute;
 }
 
 .menu_graph {
@@ -3183,13 +3118,13 @@ div.nodata_container {
 .legendColorBox * {
   font-size: 0px;
   padding: 0px 4px;
-  overflow: visible !important;
+  overflow: visible;
 }
 
 /* GIS CSS */
 
 .olLayerDiv {
-  z-index: 102 !important;
+  z-index: 102;
 }
 
 /* Alert view */
@@ -3205,7 +3140,7 @@ table.alert_escalation th img {
 }
 
 td.used_field {
-  background: #6eb432 !important;
+  background: #6eb432;
   color: #ffffff;
   font-weight: bold;
 }
@@ -3289,7 +3224,7 @@ table#policy_modules td * {
   width: 100%;
   margin-left: auto;
   margin-right: auto;
-  background-color: #fff !important;
+  background-color: #fff;
   padding: 10px;
   border: 1px solid #e2e2e2;
   margin-top: 5%;
@@ -3345,9 +3280,13 @@ div.div_groups_status {
   border-radius: 100px;
 }
 
+.databox.pies {
+  border: none;
+}
+
 .databox.pies fieldset.tactical_set {
-  width: 70% !important;
-  height: 285px;
+  width: 100%;
+  min-height: 285px;
 }
 
 .difference {
@@ -3365,12 +3304,12 @@ div.div_groups_status {
   letter-spacing: 0pt;
   font-size: 10pt;
   white-space: pre-wrap;
-  padding-top: 0 !important;
+  padding-top: 0;
   font-family: "Open Sans", sans-serif;
 }
 
 .no_hidden_menu {
-  background-position: 11% 50% !important;
+  background-position: 11% 50%;
 }
 
 #menu_tab li.nomn,
@@ -3407,10 +3346,16 @@ div.div_groups_status {
   margin-top: 10px;
   margin-left: 3px;
 }
+#menu_tab li.nomn.tab_operation img,
+#menu_tab li.nomn.tab_godmode img,
+#menu_tab li.nomn_high.tab_operation img,
+#menu_tab li.nomn_high.tab_godmode img {
+  margin: 10px auto;
+}
 
 #menu_tab li.tab_operation a,
 #menu_tab a.tab_operation {
-  background: none !important ;
+  background: none;
 }
 
 .agents_modules_table {
@@ -3421,67 +3366,12 @@ div.div_groups_status {
   border: 1px solid #e2e2e2;
 }
 
-.databox.filters,
-.databox.data {
-  margin-bottom: 20px;
-}
-
-.databox.filters > tbody > tr > td {
-  padding: 10px;
-  padding-left: 20px;
-}
-
-.databox.filters > tbody > tr > td > img,
-.databox.filters > tbody > tr > td > div > a > img,
-.databox.filters > tbody > tr > td > span > img,
-.databox.filters > tbody > tr > td > span > a > img,
-.databox.filters > tbody > tr > td > a > img {
-  vertical-align: middle;
-  margin-left: 5px;
-}
-.databox.data > tbody > tr > td > img,
-.databox.data > thead > tr > th > img,
-.databox.data > tbody > tr > td > div > a > img,
-.databox.data > tbody > tr > td > span > img,
-.databox.data > tbody > tr > td > span > a > img,
-.databox.data > tbody > tr > td > a > img,
-.databox.data > tbody > tr > td > form > a > img {
-  vertical-align: middle;
-}
-
-.databox.filters > tbody > tr > td > a > img {
-  vertical-align: middle;
-}
-
-.databox.data > tbody > tr > td > input[type="checkbox"] {
-  margin: 0px;
-}
-
-.databox_color > tbody > tr > td {
-  padding-left: 10px;
-}
-
-.databox.agente > tbody > tr > td > div > canvas {
-  width: 100% !important;
-  text-align: left !important;
-}
-.databox.agente > tbody > tr > td > div.graph {
-  width: 100% !important;
-  text-align: left !important;
-}
-
-.green_title {
-  background-color: #82b92e;
-  font-weight: normal;
-  text-align: center;
-}
-
 .dashboard {
   top: 23px;
 }
 
 .dashboard li a {
-  width: 158px !important;
+  width: 158px;
 }
 
 .text_subDashboard {
@@ -3568,8 +3458,8 @@ div.div_groups_status {
   width: 200px;
   height: 20px;
   position: relative;
-  background: transparent !important;
-  border: 0px !important;
+  background: transparent;
+  border: 0px;
 
   left: -92px;
   top: 93px;
@@ -3676,123 +3566,14 @@ div.div_groups_status {
 }
 */
 
-/*
- * ---------------------------------------------------------------------
- * - VISUAL MAPS 		  											-
- * ---------------------------------------------------------------------
- */
-div#vc-controls {
-  position: fixed;
-  top: 30px;
-  right: 20px;
-}
-
-div#vc-controls div.vc-title,
-div#vc-controls div.vc-refr {
-  margin-top: 6px;
-  margin-left: 3px;
-  margin-right: 3px;
-}
-div#vc-controls div.vc-refr > div {
-  display: inline;
-}
-div#vc-controls img.vc-qr {
-  margin-top: 6px;
-  margin-left: 8px;
-  margin-right: 8px;
-}
 div.simple_value > span.text > p,
 div.simple_value > span.text > p > span > strong,
 div.simple_value > span.text > p > strong,
 div.simple_value > a > span.text p {
-  font-family: monospace !important;
+  font-family: monospace;
   white-space: pre;
 }
 
-/*
- * ---------------------------------------------------------------------
- * - EVENTS 														-
- * ---------------------------------------------------------------------
- */
-/* Image open dialog in group events by agents*/
-#open_agent_groups {
-  cursor: pointer;
-}
-
-.table_modal_alternate {
-  border-spacing: 0px;
-  text-align: left;
-}
-
-/* Modal window - Show More */
-table.table_modal_alternate tr:nth-child(odd) td {
-  background-color: #ffffff;
-}
-
-table.table_modal_alternate tr:nth-child(even) td {
-  background-color: #f9f9f9;
-  border-top: 1px solid #e0e0e0;
-  border-bottom: 1px solid #e0e0e0;
-}
-
-table.table_modal_alternate tr td {
-  height: 33px;
-  max-height: 33px;
-  min-height: 33px;
-}
-
-table.table_modal_alternate tr td:first-child {
-  width: 35%;
-  font-weight: bold;
-  padding-left: 20px;
-}
-
-ul.events_tabs {
-  background: #ffffff !important;
-  border: 0px;
-  display: flex;
-  justify-content: space-between;
-  padding: 0px !important;
-}
-
-ul.events_tabs:before,
-ul.events_tabs:after {
-  content: none !important;
-}
-
-ul.events_tabs > li {
-  margin: 0 !important;
-  width: 100%;
-  text-align: center;
-  float: none !important;
-  outline-width: 0;
-}
-
-ul.events_tabs > li.ui-state-default {
-  background: #fff !important;
-  border: none !important;
-  border-bottom: 2px solid #cacaca !important;
-}
-
-ul.events_tabs > li a {
-  text-align: center;
-  float: none !important;
-  padding: 8px !important;
-  display: block;
-}
-
-ul.events_tabs > li span {
-  position: relative;
-  top: -6px;
-  left: 5px;
-  margin-right: 10px;
-}
-
-ul.events_tabs > li.ui-tabs-active {
-  border-bottom: 2px solid #82b92e !important;
-  border-top: 2px solid #82b92e !important;
-}
-
 /*
  * ---------------------------------------------------------------------
  * - modal window and edit user 									-
@@ -4090,7 +3871,7 @@ span.log_zone_line {
 }
 
 span.log_zone_line_error {
-  color: #fc4444;
+  color: #e63c52;
 }
 
 /* global */
@@ -4099,7 +3880,7 @@ span.log_zone_line_error {
 }
 
 .readonly {
-  background-color: #dedede !important;
+  background-color: #dedede;
 }
 
 .input_error {
@@ -4129,11 +3910,8 @@ span.log_zone_line_error {
 .rowOdd:hover {
   background-color: #eee;
 }
-.databox.data > tbody > tr:hover {
-  background-color: #eee;
-}
 .checkselected {
-  background-color: #eee !important;
+  background-color: #eee;
 }
 .tag-wrapper {
   padding: 0 10px 0 0;
@@ -4233,15 +4011,15 @@ div#footer_help {
  * ---------------------------------------------------------------------
  */
 .graph_conteiner_inside > .parent_graph {
-  width: 100% !important;
+  width: 100%;
 }
 
 .graph_conteiner_inside > .parent_graph > .menu_graph {
-  left: 90% !important;
+  left: 90%;
 }
 
 .graph_conteiner_inside > .parent_graph > .graph {
-  width: 90% !important;
+  width: 90%;
 }
 
 .graph_conteiner_inside > div > .nodata_container > .nodata_text {
@@ -4249,7 +4027,7 @@ div#footer_help {
 }
 
 .graph_conteiner_inside > div > .nodata_container {
-  background-size: 120px 80px !important;
+  background-size: 120px 80px;
 }
 
 /*
@@ -4475,8 +4253,8 @@ form ul.form_flex li ul li {
 /* library for graphs */
 .yAxis.y1Axis > .tickLabel {
   white-space: nowrap;
-  line-height: 1.05em !important;
-  width: auto !important;
+  line-height: 1.05em;
+  width: auto;
 }
 
 /* dialog */
@@ -4484,7 +4262,7 @@ form ul.form_flex li ul li {
   display: flex;
   width: 100%;
   margin-left: 10px;
-  float: none !important;
+  float: none;
 }
 
 .pandora_confirm_dialog .ui-dialog-buttonset button {
@@ -4514,11 +4292,11 @@ form ul.form_flex li ul li {
 }
 
 .dialog-grayed {
-  background: #373737 !important;
+  background: #373737;
 }
 
 .dialog-grayed .ui-dialog-buttonpane {
-  background: #373737 !important;
+  background: #373737;
 }
 
 /* GIS MAP */
@@ -4562,7 +4340,7 @@ tr:first-child > td > a.up_arrow {
 /* extensions -> module groups */
 .tooltip_counters h3 {
   font-size: 12pt;
-  padding-bottom: 10px !important;
+  padding-bottom: 10px;
   text-align: center;
 }
 
@@ -4581,9 +4359,9 @@ tr:first-child > td > a.up_arrow {
 
 .button-as-link {
   text-decoration: underline;
-  background: none !important;
+  background: none;
   border: none;
-  padding: 0 !important;
+  padding: 0;
 }
 
 /*
@@ -4626,7 +4404,7 @@ div#dialog_messages table th:last-child {
   cursor: pointer;
 }
 .notification-ball-new-messages {
-  background-color: #fc4444;
+  background-color: #e63c52;
 }
 
 #notification-wrapper {
@@ -4930,6 +4708,7 @@ input:checked + .p-slider:before {
   height: 27px;
   cursor: pointer;
   border-radius: 5px;
+  z-index: 10;
 }
 
 #top_btn:hover {
@@ -4970,7 +4749,7 @@ input:checked + .p-slider:before {
 }
 
 #edit_user_profiles table {
-  margin-bottom: 0 !important;
+  margin-bottom: 0;
 }
 
 .user_edit_first_row {
@@ -5008,9 +4787,9 @@ input:checked + .p-slider:before {
 }
 
 .edit_user_info_right input {
-  background-color: transparent !important;
+  background-color: transparent;
   border: none;
-  border-radius: 0 !important;
+  border-radius: 0;
   border-bottom: 1px solid #343434;
   padding: 10px 0px 2px 35px;
   box-sizing: border-box;
@@ -5051,9 +4830,9 @@ input:checked + .p-slider:before {
 }
 
 .edit_user_options #text-block_size {
-  background-color: transparent !important;
+  background-color: transparent;
   border: none;
-  border-radius: 0 !important;
+  border-radius: 0;
   border-bottom: 1px solid #343434;
   padding: 0px 0px 0px 10px;
 }
@@ -5072,12 +4851,12 @@ input:checked + .p-slider:before {
 }
 
 .edit_user_comments #textarea_comments {
-  background-color: #fbfbfb !important;
+  background-color: #fbfbfb;
   padding-left: 10px;
 }
 
 .edit_user_labels {
-  color: #343434 !important;
+  color: #343434;
   font-weight: bold;
   padding-right: 10px;
   margin: 0px 0px 5px 0px;
@@ -5085,6 +4864,7 @@ input:checked + .p-slider:before {
 
 .label_select,
 .label_select_simple {
+  font-family: "lato-bolder", "Open Sans", sans-serif;
   margin-bottom: 15px;
 }
 
@@ -5107,7 +4887,7 @@ input:checked + .p-slider:before {
 .user_edit_first_row .edit_user_info_left > div:last-child,
 .user_edit_first_row .edit_user_info_right > div:last-child,
 .user_edit_second_row .edit_user_options > div:last-child {
-  margin-bottom: 0px !important;
+  margin-bottom: 0px;
 }
 
 .user_avatar {
@@ -5166,137 +4946,16 @@ input:checked + .p-slider:before {
   color: #4d4d4d;
 }
 
-/* This is to use divs like tables */
-.table_div {
-  display: table;
-}
-.table_thead,
-.table_tbody {
-  display: table-row;
-}
-.table_th {
-  font-weight: bold;
-}
-.table_th,
-.table_td {
-  display: table-cell;
-  vertical-align: middle;
-  padding: 10px;
-}
-/* Tables with 3 columns */
-.table_three_columns .table_th,
-.table_three_columns .table_td {
-  width: 33%;
-}
-
-/*
- * ---------------------------------------------------------------------
- * - TABLES TO SHOW INFORMATION
- * ---------------------------------------------------------------------
- */
-
-table.info_table {
-  background-color: #fff;
-  margin-bottom: 10px;
-  border-spacing: 0;
-  border-collapse: collapse;
-  overflow: hidden;
-  border-radius: 5px;
-}
-
-table.info_table > tbody > tr:nth-child(even) {
-  background-color: #f5f5f5;
-}
-
-table.info_table tr:first-child > th {
-  background-color: #fff;
-  color: #000;
-  text-align: left;
-  vertical-align: middle;
-}
-
-table.info_table th {
-  font-size: 7.5pt;
-  letter-spacing: 0.3pt;
-  color: #000;
-  background-color: #fff;
-}
-
-table.info_table tr th {
-  border-bottom: 1px solid #e2e2e2;
-}
-
-/* Radius top */
-table.info_table > thead > tr:first-child > th:first-child {
-  border-top-left-radius: 4px;
-}
-table.info_table > thead > tr:first-child > th:last-child {
-  border-top-right-radius: 4px;
-}
-
-/* Radius bottom */
-table.info_table > tbody > tr:last-child > td:first-child {
-  border-top-left-radius: 4px;
-}
-table.info_table > tbody > tr:last-child > td:last-child {
-  border-top-right-radius: 4px;
-}
-
-table.info_table > thead > tr > th,
-table.info_table > tbody > tr > th,
-table.info_table > thead > tr > th a {
-  padding-left: 9px;
-  padding-right: 9px;
-  padding-top: 9px;
-  padding-bottom: 9px;
-  font-weight: normal;
-  color: #000;
-  font-size: 8.6pt;
-}
-
-table.info_table > tbody > tr {
-  border-bottom: 1px solid #e2e2e2;
-}
-
-table.info_table > tbody > tr > td {
-  -moz-border-radius: 0px;
-  -webkit-border-radius: 0px;
-  border-radius: 0px;
-  border: none;
-  padding-left: 9px;
-  padding-right: 9px;
-  padding-top: 7px;
-  padding-bottom: 7px;
-}
-
-table.info_table > tbody > tr > td > img,
-table.info_table > thead > tr > th > img,
-table.info_table > tbody > tr > td > div > a > img,
-table.info_table > tbody > tr > td > span > img,
-table.info_table > tbody > tr > td > span > a > img,
-table.info_table > tbody > tr > td > a > img,
-table.info_table > tbody > tr > td > form > a > img {
-  vertical-align: middle;
-}
-
-table.info_table > tbody > tr:hover {
-  background-color: #eee !important;
-}
-
-.info_table.profile_list > thead > tr > th > a.tip {
-  padding: 0px;
-}
-
 /* This class is for the icons of actions and operations in the tables. */
 .action_buttons a[href] img,
 .action_buttons input[type="image"],
 .action_button_img {
   border-radius: 4px;
-  border: 1px solid #dcdcdc !important;
+  border: 1px solid #dcdcdc;
   padding: 1px;
   box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
   max-width: 21px;
-  background-color: transparent !important; /*BORRAR*/
+  background-color: transparent; /*BORRAR*/
 }
 
 /* This class is for only one icon to be a button type. */
@@ -5321,7 +4980,7 @@ table.info_table > tbody > tr:hover {
 }
 
 .action_buttons input[type="image"]:hover {
-  background-color: #fff !important;
+  background-color: #fff;
 }
 
 /* Tables to upload files */
@@ -5360,7 +5019,7 @@ table.info_table > tbody > tr:hover {
 
 .file_table_buttons a:last-child img,
 #file_table_modal .upload_file {
-  margin-right: 0px !important;
+  margin-right: 0px;
 }
 
 #file_table_modal li a {
@@ -5406,7 +5065,7 @@ table.info_table > tbody > tr:hover {
 }
 
 .file_table_modal_active {
-  background-color: #fff !important;
+  background-color: #fff;
   border: 1px solid #e6e6e6;
   border-bottom: none;
 }
@@ -5453,7 +5112,7 @@ table.info_table.agent_info_table {
   margin-bottom: 20px;
 }
 table.agent_info_table tr {
-  background-color: #fff !important;
+  background-color: #fff;
 }
 
 table.agent_info_table > tbody > tr > td {
@@ -5493,20 +5152,20 @@ table.info_table.agent_info_table table.info_table {
 }
 
 .agent_info_table_opened {
-  background-color: #82b92e !important;
-  color: #fff !important;
-  border-color: #82b92e !important;
+  background-color: #82b92e;
+  color: #fff;
+  border-color: #82b92e;
 }
 
 .agent_info_table_closed {
-  background-color: #fff !important;
-  color: #000 !important;
+  background-color: #fff;
+  color: #000;
   border-radius: 4px;
 }
 
 /* Tag view */
 table.info_table.policy_table tr {
-  background-color: #fff !important;
+  background-color: #fff;
 }
 
 table.info_table.policy_sub_table thead > tr:first-child th {
@@ -5524,7 +5183,7 @@ table.info_table.policy_sub_table {
   vertical-align: middle;
 }
 .sort_arrow a {
-  padding: 0 0 0 5px !important;
+  padding: 0 0 0 5px;
 }
 .sort_arrow img {
   width: 0.8em;
@@ -5568,7 +5227,7 @@ table.info_table.policy_sub_table {
 .pagination .total_number > *:last-child {
   border-top-right-radius: 2px;
   border-bottom-right-radius: 2px;
-  border-right: 1px solid #cacaca !important;
+  border-right: 1px solid #cacaca;
 }
 
 .pagination .page_number_active {
@@ -5588,7 +5247,7 @@ table.info_table.policy_sub_table {
 }
 
 .pagination a {
-  margin: 0 !important;
+  margin: 0;
 }
 
 .pagination .pagination-arrows {
@@ -5628,7 +5287,7 @@ table.info_table.policy_sub_table {
 }
 
 .input_label {
-  color: #343434 !important;
+  color: #343434;
   font-weight: bold;
   padding-right: 10px;
   margin: 0px 0px 5px 0px;
@@ -5666,11 +5325,11 @@ table.info_table.policy_sub_table {
 
 /* Inputs type text shown as a black line */
 .agent_options input[type="text"] {
-  background-color: transparent !important;
+  background-color: transparent;
   border: none;
-  border-radius: 0 !important;
+  border-radius: 0;
   border-bottom: 1px solid #ccc;
-  font-family: "lato-bolder", "Open Sans", sans-serif !important;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
   font-size: 10pt;
   padding: 2px 5px;
   box-sizing: border-box;
@@ -5679,6 +5338,10 @@ table.info_table.policy_sub_table {
   margin-bottom: 4px;
 }
 
+.agent_options input[readonly] {
+  color: #848484;
+}
+
 /*
  * ---------------------------------------------------------------------
  * - CLASSES FOR THE NEW TOGGLES                     								-
@@ -5714,7 +5377,7 @@ table.info_table.policy_sub_table {
 }
 
 .switch_radio_button input {
-  position: absolute !important;
+  position: absolute;
   clip: rect(0, 0, 0, 0);
   height: 1px;
   width: 1px;
@@ -5822,19 +5485,19 @@ div#bullets_modules div {
   background: #ffa631;
 }
 .red_background {
-  background: #fc4444;
+  background: #e63c52;
 }
 .yellow_background {
-  background: #fad403;
+  background: #f3b200;
 }
 .grey_background {
   background: #b2b2b2;
 }
 .blue_background {
-  background: #3ba0ff;
+  background: #4a83f3;
 }
 .green_background {
-  background: #80ba27;
+  background: #82b92e;
 }
 
 /* First row in agent view */
@@ -5907,7 +5570,7 @@ div#bullets_modules div {
 
 /* Agent details in agent view */
 div#status_pie path {
-  stroke-width: 8px !important;
+  stroke-width: 8px;
 }
 div#status_pie {
   margin-bottom: 2em;
@@ -5923,7 +5586,7 @@ div#status_pie {
 
 .agent_details_content {
   display: flex;
-  align-items: center;
+  align-items: flex-start;
   padding: 20px;
   padding-bottom: 0;
 }
@@ -5988,6 +5651,13 @@ div#status_pie {
   border-top-left-radius: 4px;
   border-top-right-radius: 4px;
   font-weight: bold;
+  display: flex;
+  min-width: fit-content;
+}
+
+.white_table_graph_header b {
+  font-size: 10pt;
+  font-weight: 600;
 }
 
 .white_table_graph_header div#bullets_modules {
@@ -6002,20 +5672,29 @@ div#status_pie {
   padding-left: 10px;
 }
 
+.white-box-content.padded {
+  padding-top: 2em;
+  padding-bottom: 2em;
+}
+
 .white-box-content {
   width: 100%;
   height: 100%;
   background-color: #fff;
+  box-sizing: border-box;
+  border: 1px solid #e2e2e2;
   display: flex;
   align-items: center;
   flex-wrap: wrap;
+  padding: 1em;
+  min-width: fit-content;
 }
 
 .white_table_graph_content {
   border: 1px solid #e2e2e2;
   border-top: none;
   background-color: #fff;
-  padding: 20px;
+  padding: 5px;
   border-bottom-left-radius: 4px;
   border-bottom-right-radius: 4px;
   align-items: center;
@@ -6023,7 +5702,7 @@ div#status_pie {
 }
 
 .white_table_graph_content.no-padding-imp .info_box {
-  margin: 0 !important;
+  margin: 0;
 }
 
 .white_table_graph_content.min-height-100 {
@@ -6046,6 +5725,13 @@ div#status_pie {
   padding: 10px;
 }
 
+.white-box-content form {
+  width: 100%;
+  margin-bottom: 2em;
+  padding: 2em;
+  min-width: fit-content;
+}
+
 /* White tables */
 .white_table,
 .white_table tr:first-child > th {
@@ -6094,5 +5780,107 @@ div#status_pie {
 }
 
 .white_table_no_border {
-  border: none !important;
+  border: none;
+}
+
+/*
+ * ---------------------------------------------------------------------
+ * - SERVICES TABLE VIEW
+ * ---------------------------------------------------------------------
+ */
+#table_services {
+  display: grid;
+  grid-gap: 20px;
+  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
+  grid-template-rows: 1fr;
+  margin-bottom: 30px;
+}
+
+.table_services_item_link {
+  font-size: 16px;
+  display: grid;
+  min-height: 80px;
+  box-sizing: border-box;
+  padding: 10px 10px 10px 0;
+}
+
+.table_services_item {
+  display: grid;
+  align-items: center;
+  grid-template-columns: 50px auto;
+}
+
+/*
+ * ---------------------------------------------------------------------
+ * - IMAGES FOR STATUS. This replaces the images of /images/status_sets/default/ 
+ * - Don't delete this
+ * ---------------------------------------------------------------------
+ */
+.status_small_rectangles {
+  width: 20px;
+  height: 10px;
+  display: inline-block;
+}
+
+.status_rounded_rectangles {
+  width: 50px;
+  height: 2em;
+  display: inline-block;
+  border-radius: 5px;
+}
+
+.status_small_squares,
+.status_balls {
+  width: 12px;
+  height: 12px;
+  display: inline-block;
+}
+
+.status_balls {
+  border-radius: 50%;
+}
+
+.status_small_balls {
+  width: 8px;
+  height: 8px;
+  display: inline-block;
+  border-radius: 50%;
+}
+/*
+ * ---------------------------------------------------------------------
+ * - END - IMAGES FOR STATUS. Don't delete this
+ * ---------------------------------------------------------------------
+ */
+
+/* Table for show more info in events and config menu in modules graphs. (This class exists in events.css too) */
+.table_modal_alternate {
+  border-spacing: 0;
+  text-align: left;
+}
+
+table.table_modal_alternate tr:nth-child(odd) td {
+  background-color: #ffffff;
+}
+
+table.table_modal_alternate tr:nth-child(even) td {
+  background-color: #f9f9f9;
+  border-top: 1px solid #e0e0e0;
+  border-bottom: 1px solid #e0e0e0;
+}
+
+table.table_modal_alternate tr td {
+  height: 33px;
+  max-height: 33px;
+  min-height: 33px;
+}
+
+table.table_modal_alternate tr td:first-child {
+  width: 35%;
+  font-weight: bold;
+  padding-left: 20px;
+}
+/* END - Table for show more info in events and config menu in modules graphs */
+
+.fullwidth {
+  width: 100%;
 }
diff --git a/pandora_console/include/styles/pandoraPDF.css b/pandora_console/include/styles/pandoraPDF.css
index 37d527c30b..9a55b6a1e4 100644
--- a/pandora_console/include/styles/pandoraPDF.css
+++ b/pandora_console/include/styles/pandoraPDF.css
@@ -1,4 +1,6 @@
 /**
+ * Exclude css from visual styles
+ *
  * Extension to manage a list of gateways and the node address where they should
  * point to.
  *
@@ -25,6 +27,10 @@
  * GNU General Public License for more details.
  * ============================================================================
  */
+table {
+  text-align: center;
+}
+
 table.header_table {
   width: 100%;
 }
diff --git a/pandora_console/include/styles/pandora_black.css b/pandora_console/include/styles/pandora_black.css
index 169f078cea..6f0c74d16b 100644
--- a/pandora_console/include/styles/pandora_black.css
+++ b/pandora_console/include/styles/pandora_black.css
@@ -6,7 +6,7 @@ Description: The default Pandora FMS theme layout
 
 // Pandora FMS - http://pandorafms.com
 // ==========================================================
-// Copyright (c) 2004-2011 Artica Soluciones Tecnológicas S.L
+// Copyright (c) 2004-2019 Artica Soluciones Tecnológicas S.L
 
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License
@@ -21,4242 +21,382 @@ Description: The default Pandora FMS theme layout
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
 
-/* Tree view styles */
-@import url(tree.css);
-
-* {
-  font-family: verdana, sans-serif;
-  letter-spacing: 0.03pt;
-  font-size: 8pt;
-  color: #fff;
-}
-svg * {
-  font-size: 11pt;
-}
-body {
-  background-color: #5b5b5b;
-  margin: 0 auto;
-}
-
-div#page {
-  background: #5b5b5b;
-  background-image: none;
-}
-
-body.pure {
-  background-color: #5b5b5b;
-}
-input,
-textarea {
-  border: 1px solid #ddd;
-}
-
-textarea {
-  padding: 5px;
-  min-height: 100px;
-  width: 99%;
-}
-textarea.conf_editor {
-  padding: 5px;
-  width: 650px;
-  height: 350px;
-}
-textarea.conf_error {
-  background-image: url(../../images/err.png);
-  background-repeat: no-repeat;
-  background-position: top right;
-}
-input {
-  padding: 2px 3px 4px 3px;
-  vertical-align: middle;
-}
-
-input[type="checkbox"] {
-  display: inline !important;
-}
-
-select {
-  padding: 2px 3px 3px 3px;
-  vertical-align: middle;
-}
-input.button {
-  font-family: Arial, Sans-serif;
-  border: 4px solid #ccc;
-  background: #5b5b5b;
-  padding: 2px 3px;
-  margin: 10px 15px;
-}
-
-input[type="submit"],
-input[type="button"] {
-  cursor: pointer;
-}
-
-select {
-  border: 1px solid #ddd;
-}
-checkbox {
-  padding: 4px;
-  border: 1px solid #eee;
-}
-h1,
-h2,
-h3,
-h4 {
-  font-weight: bold;
-  font-size: 1em;
-  font-family: Arial, Sans-serif;
-  text-transform: uppercase;
-  color: #fff;
-  padding-bottom: 4px;
-  padding-top: 7px;
-}
-h1 {
-  font-size: 16px;
-}
-h2 {
-  font-size: 15px;
-}
-h3 {
-  font-size: 14px;
-}
-h4 {
-  margin-bottom: 10px;
-  font-size: 13px;
-  color: #fff;
-  text-transform: none;
-}
-a {
-  color: #fff;
-  text-decoration: none;
-}
-a:hover {
-  color: #fff;
-  text-decoration: underline;
-}
-a.white_bold {
-  color: #eee;
-  text-decoration: none;
-  font-weight: bold;
-}
-a.white {
-  color: #eee;
-  text-decoration: none;
-}
-p.center {
-  text-align: center;
-}
-h1#log_title {
-  font-size: 18px;
-  margin-bottom: 0px;
-  color: #fff !important;
-  width: 300px;
-}
-div#log_msg {
-  display: none;
-}
-div#error_buttons {
-  margin-top: 20px;
-}
-div#error_buttons a {
-  margin: 14px;
-}
-
-#noaccess {
-  position: relative;
-  margin-top: 25px;
-  left: 15px;
-  padding-top: 5px;
-  background-color: #5b5b5b;
-  border-top-left-radius: 2px;
-  border-top-right-radius: 2px;
-  border-bottom-left-radius: 2px;
-  border-bottom-right-radius: 2px;
-}
-
-#noaccess-title {
-  color: #fff;
-  font-weight: bold;
-  padding-top: 5px;
-  margin-left: 5px;
-  background: none repeat scroll 0% 0% #82b92e;
-  border-top-left-radius: 2px;
-  border-top-right-radius: 2px;
-  border-bottom-left-radius: 2px;
-  border-bottom-right-radius: 2px;
-  text-align: center;
-}
-
-#noaccess-text {
-  font-size: 12px;
-  text-align: justify;
-  padding-top: 25px;
-  padding-right: 50px;
-  float: right;
-}
-
-#noaccess-image {
-  position: relative;
-  left: 10px;
-  top: 10px;
-  float: left;
-}
-
-div#activity {
-  padding-top: 0px;
-  padding-bottom: 18px;
-}
-div#noa {
-  float: right;
-  padding-right: 50px;
-  margin-top: 25px;
-}
-div#db_f {
-  text-align: justify;
-  margin: auto;
-  padding: 0.5em;
-  width: 55em;
-  margin-top: 3em;
-}
-div#db_ftxt {
-  float: right;
-  padding-top: 10px;
-}
-div#container {
-  margin: 0 auto;
-  min-width: 960px;
-  text-align: left;
-  #border-left: solid 2px #000;
-  #border-right: solid 2px #000;
-  #border-top: solid 2px #000;
-  #margin-top: 5px;
-  height: 100%;
-  background: #5b5b5b;
-}
-div#page {
-  width: 960px;
-  clear: both;
-}
-div#main {
-  width: auto;
-  margin: 0px 2% 0px 0%;
-  float: right;
-  position: relative;
-  min-height: 850px;
-}
-div#main_help {
-  width: 100%;
-  padding-left: 0px;
-  padding-top: 0px;
-  background-color: #5b5b5b;
-  margin-top: 0px;
-  margin-left: 0px;
-  margin-right: 0px;
-  border-radius: 10px;
-}
-div#main_help div.databox,
-.license_databox {
-  background: F3F3F3;
-  -moz-border-radius: 8px;
-  -webkit-border-radius: 8px;
-  border-radius: 8px;
-  border: 0px;
-  padding-left: 25px;
-  padding-right: 25px;
-  margin-top: 10px;
-  -moz-box-shadow: -1px 1px 6px #aaa;
-  -webkit-box-shadow: -1px 1px 6px #aaa;
-  box-shadow: -1px 1px 6px #aaa;
-}
-
-div#main_help div.databox h1 {
-  padding-bottom: 0px;
-  margin-bottom: 0px;
-  font-weight: bold;
-  font-family: sans-serif, verdana;
-}
-
-div#main_help div.databox h3,
-div#main_help div.databox h2 {
-  color: #6eb432;
-  font-family: sans-serif, verdana;
-}
-
-div#main_help div.databox h3 {
-  font-size: 12px;
-}
-
-div#main_help a.footer,
-div#main_help span {
-  color: #999;
-}
-
-a.footer,
-a.footer span {
-  font-size: 9px;
-  color: white;
-}
-
-div#main_help div.databox hr {
-  width: 100%;
-  border: 0px;
-  height: 1px;
-  background-color: #222;
-  margin: 0px;
-}
-
-div#main_help div.databox p {
-  line-height: 15px;
-  text-align: justify;
-}
-
-div#menu_container {
-  -moz-border-top-right-radius: 6px;
-  -webkit-border-top-right-radius: 6px;
-  border-top-right-radius: 6px;
-  z-index: 1010;
-  width: 40px;
-  height: 100%;
-}
-
-div#menu {
-  width: 45px;
-  float: left;
-  z-index: 2000;
-  position: absolute;
-}
-
-div#head {
-  font-size: 8pt;
-  width: 100%;
-  height: 60px;
-  padding-top: 0px;
-  margin-bottom: 20px;
-  border-bottom-style: solid;
-  border-bottom-width: 3px;
-  border-color: #82b92e;
-  min-width: 882px;
-  background-color: #333;
-  color: white;
-  background-image: url("../../images/header_f2b.jpg");
-}
-
-.fixed_header {
-  z-index: 9999;
-  position: fixed;
-  left: 0;
-  top: 0;
-  width: 100%;
-}
-
-div#foot {
-  font-size: 6pt !important;
-  border-top: solid 2px #222;
-  padding-top: 8px;
-  padding-bottom: 5px;
-  text-align: center;
-  background: #333333;
-  height: 30px;
-  clear: both;
-  width: auto;
-}
-#ver {
-  margin-bottom: 25px;
-}
-
-/****************/
-/* LOGIN STYLES */
-/****************/
-
-@font-face {
-  font-family: "Nunito";
-  font-style: normal;
-  font-weight: 400;
-  src: local("Nunito-Regular"), url(../../fonts/nunito.woff) format("woff");
-}
-
-@font-face {
-  font-family: "roboto";
-  src: url("../../fonts/roboto.woff2") format("woff2");
-}
-
-@font-face {
-  font-family: "opensans";
-  src: url("../../fonts/opensans.woff2") format("woff2");
-}
-
-@font-face {
-  font-family: "lato";
-  src: url("../../fonts/lato.woff2") format("woff2");
-}
-
-@font-face {
-  font-family: "leaguegothic";
-  src: url("../../fonts/leaguegothic.woff") format("woff");
-}
-
-#login_body {
-  /* Set rules to fill background */
-  min-height: 100%;
-  min-width: 1024px;
-  width: 100%;
-  z-index: -9999;
-  position: absolute;
-}
-
-@media screen and (max-width: 1024px) {
-  /* Specific to this particular image */
-  #login_body {
-    left: 50%;
-    margin-left: -512px; /* 50% */
-  }
-}
-@media screen and (max-width: 1100px) {
-  /* Specific to this particular image */
-  #login_body {
-    background-image: url("../../images/backgrounds/fondo_madera_bn_1100.jpg");
-    background-repeat: repeat;
-    background-position: center center;
-  }
-}
-@media screen and (max-width: 1400px) {
-  /* Specific to this particular image */
-  #login_body {
-    background-image: url("../../images/backgrounds/fondo_madera_bn_1400.jpg");
-    background-repeat: repeat;
-    background-position: center center;
-  }
-}
-@media screen and (max-width: 2000px) {
-  /* Specific to this particular image */
-  #login_body {
-    background-image: url("../../images/backgrounds/fondo_madera_bn_2000.jpg");
-    background-repeat: repeat;
-    background-position: center center;
-  }
-}
-@media screen and (min-width: 2000px) {
-  /* Specific to this particular image */
-  #login_body {
-    background-image: url("../../images/backgrounds/fondo_madera_bn_2500.jpg");
-    background-repeat: repeat;
-    background-position: center center;
-  }
-}
-
-p.log_in {
-  color: #fff !important;
-  padding: 0px 10px;
-  width: 300px;
-}
-h1#log_f {
-  color: #c00;
-  border-bottom: 1px solid #c00;
-  padding-bottom: 3px;
-}
-div#login {
-  border-width: 2px 2px 2px 2px;
-  border-style: solid;
-  border-color: #000;
-  font-size: 12px !important;
-}
-div#login_in,
-#login_f {
-  /*margin: 0 auto 0 140px;
-	width: 400px;*/
-}
-
-.databox_login,
-.databox_logout {
-  border-radius: 5px;
-  height: 200px;
-}
-
-#login_inner {
-  width: 100%;
-  height: 100%;
-  border-radius: 5px;
-  /* Browser without multibackground support */
-  background-color: #373737 !important;
-}
-#login_outer {
-  border-radius: 11px;
-  background-color: #000;
-  width: 500px !important;
-  color: #fff !important;
-  margin: 0px auto;
-}
-
-.version_login {
-  transform: rotate(36deg);
-  /* Old browser support */
-  -ms-transform: rotate(36deg); /* IE */
-  -moz-transform: rotate(36deg); /* FF */
-  -o-transform: rotate(36deg); /* Opera */
-  -webkit-transform: rotate(36deg); /* Safari and Chrome */
-
-  float: right;
-  margin-top: 18px;
-  width: 80px;
-  height: 0px;
-  border-right: 13px solid transparent;
-  border-left: 25px solid transparent;
-  border-bottom: 18px solid #82b92e;
-  left: 16px;
-  position: relative;
-}
-
-#login_outer * {
-  font-family: Nunito, "Arial Rounded MT", Arial, Helvetica, sans-serif;
-  font-weight: bold;
-}
-.login_border {
-  border-right: 1px solid #fff;
-  text-align: center;
-}
-table#login_layout {
-  width: 100%;
-  height: 160px;
-  position: absolute;
-}
-
-div#error_login {
-  text-align: center;
-  margin-top: 5px;
-  margin-left: 5px;
-  width: 75%;
-  float: right;
-  text-align: left;
-  top: 100px;
-}
-
-div#error_login_icon {
-  #margin: 0 auto;
-  margin-top: 10px;
-  margin-right: 7px;
-  text-align: center;
-  #margin-left: 20px;
-  width: 20%;
-  float: right;
-}
-
-div#login_f {
-  margin-top: 10px;
-  margin-bottom: 25px;
-}
-
-a:focus,
-input:focus,
-button:focus {
-  utline-width: 0;
-  outline: 0;
-}
-
-/*DIV.login_links {
-	margin: 10px 0px 0px;
-	color: #FFF;
-	text-align: center;
-}
-
-DIV.login_links>a {
-	color: #FFF;
-}
-
-DIV.login_button{
-	text-align:right;
-	width: 100%;
-	margin-top: 15px;
-}
-
-DIV.login_button>input{
-	background-color: #373737 !important;
-	border: 0px none;
-	background-image: url("../../images/input_go.png") !important;
-	padding-right: 25px !important;
-}
-
-.login_page{
-	height: 200px;
-	padding-top: 10%;
-	text-align: center;
-	width: 100%;
-	position: absolute;
-}
-
-input.next_login {
-	padding-right: 12px !important;
-	padding-left: 12px !important;
-	height: 23px;
-	text-align: center;
-	font-weight: 600 !important;
-	letter-spacing: 0.5pt;
-	font-size: 12px !important;
-	border-radius: 3px !important;
-}
-
-DIV.login_nick, DIV.login_pass {
-	text-align:left;
-	padding-left: 15px;
-	margin-top: 10px;
-}
-
-DIV.login_nick>input, DIV.login_pass>input {
-	height: 20px;
-	border-radius:0px;
-	margin-left: 10px;
-}
-
-DIV.login_nick>input:focus,DIV.login_pass>input:focus {
-    outline-width: 0px;
-	border-color: #82b92e;
-	background-color: #82b92e;
-	font-size: 12px;
-	height: 20px;
-	box-shadow: 0px 0px 3px 3px #82b92e;
-}
-
-DIV.login_nick>img, DIV.login_pass>img {
-	vertical-align: middle;
-}
-
-DIV.login_links a {
-	letter-spacing: 0.8pt;
-}
-
-DIV.login_links a:first-child {
-	margin-right: 5px;
-}
-
-DIV.login_links a:last-child {
-	margin-left: 5px;
-}
-
-DIV.login_nick_text {
-	text-align: left;
-	margin-bottom: 3px;
-	width: 191px;
-	margin: 5px 0px;
-	font-size: 12px;
-	letter-spacing: 0.4pt;
-}
-
-DIV.login_pass_text {
-	text-align: left;
-	width: 191px;
-	margin: 13px 0px 5px 0px;
-	font-size: 12px;
-	letter-spacing: 0.4pt;
-}
-
-DIV.login_pass {
-}
-
-input.login {
-	border: 0px none;
-	margin: 0px 0px;
-	width: 135px;
-	height: 18px;
-	font-weight: 100 !important;
-
-	letter-spacing: 0.3pt;
-}
-
-input.login_user {
-	 
-	color: #373737 !important;
-	padding-left: 8px;
-	width: 179px;
-	color: #222;
-	height: 18px;
-}
-
-input.login_password {
-	
-	padding-left: 8px;
-	width: 179px;
-	color: #222;
-	height: 20px;
-}
-*/
-
-.databox_error {
-  width: 657px !important;
-  height: 400px;
-  border: none !important;
-  background-color: #fafafa;
-  background: url(../../images/splash_error.png) no-repeat;
-}
-
-#ver_num {
-  margin: 0px auto;
-  width: 100%;
-  position: absolute;
-  bottom: 10px;
-  color: #fff;
-  text-align: center;
-}
-
-input:-webkit-autofill {
-  #-webkit-box-shadow: 0 0 0px 1000px #ddd inset;
-}
-/***********************/
-/* END OF LOGIN STYLES */
-/***********************/
-
-th > label {
-  padding-top: 7px;
-}
-input.chk {
-  margin-right: 0px;
-  border: 0px none;
-  height: 14px;
-}
-input.datos {
-  background-color: #f5f5f5;
-}
-input.datos_readonly {
-  background-color: #050505;
-}
-
-input.sub {
-  font-weight: normal;
-
-  -moz-border-radius: 2px;
-  -webkit-border-radius: 2px;
-  border-radius: 2px;
-
-  font-size: 8pt;
-
-  background-color: #333 !important;
-  background-repeat: no-repeat !important;
-  background-position: 92% 3px !important;
-
-  color: white !important;
-  padding: 3px 3px 5px 12px;
-
-  border-color: #333;
-}
-
-input.sub[disabled] {
-  color: #b4b4b4 !important;
-  background-color: #f3f3f3 !important;
-  border-color: #b6b6b6;
-  cursor: default;
-}
-
-input.next,
-input.upd,
-input.ok,
-input.wand,
-input.delete,
-input.cog,
-input.target,
-input.search,
-input.copy,
-input.add,
-input.graph,
-input.percentile,
-input.binary,
-input.camera,
-input.config,
-input.cancel,
-input.default,
-input.filter,
-input.pdf {
-  padding-right: 30px;
-  height: 23px;
-}
-
-input.next {
-  background-image: url(../../images/input_go.png) !important;
-}
-input.upd {
-  background-image: url(../../images/input_update.png) !important;
-}
-input.wand {
-  background-image: url(../../images/input_wand.png) !important;
-}
-input.wand:disabled {
-  background-image: url(../../images/input_wand.disabled.png) !important;
-}
-input.search {
-  background-image: url(../../images/input_zoom.png) !important;
-}
-input.search:disabled {
-  background-image: url(../../images/input_zoom.disabled.png) !important;
-}
-input.ok {
-  background-image: url(../../images/input_tick.png) !important;
-}
-input.ok:disabled {
-  background-image: url(../../images/input_tick.disabled.png) !important;
-}
-input.add {
-  background-image: url(../../images/input_add.png) !important;
-}
-input.add:disabled {
-  background-image: url(../../images/input_add.disabled.png) !important;
-}
-input.cancel {
-  background-image: url(../../images/input_cross.png) !important;
-}
-input.cancel:disabled {
-  background-image: url(../../images/input_cross.disabled.png) !important;
-}
-input.delete {
-  background-image: url(../../images/input_delete.png) !important;
-}
-input.delete:disabled {
-  background-image: url(../../images/input_delete.disabled.png) !important;
-}
-input.cog {
-  background-image: url(../../images/input_cog.png) !important;
-}
-input.cog:disabled {
-  background-image: url(../../images/input_cog.disabled.png) !important;
-}
-input.config {
-  background-image: url(../../images/input_config.png) !important;
-}
-input.config:disabled {
-  background-image: url(../../images/input_config.disabled.png) !important;
-}
-input.filter {
-  background-image: url(../../images/input_filter.png) !important;
-}
-input.filter:disabled {
-  background-image: url(../../images/input_filter.disabled.png) !important;
-}
-input.pdf {
-  background-image: url(../../images/input_pdf.png) !important;
-}
-input.pdf:disabled {
-  background-image: url(../../images/input_pdf.disabled.png) !important;
-}
-input.camera {
-  background-image: url(../../images/input_camera.png) !important;
-}
-
-#toolbox #auto_save {
-  padding-top: 5px;
-}
-
-#toolbox {
-  margin-top: 13px;
-}
-input.visual_editor_button_toolbox {
-  padding-right: 15px;
-  padding-top: 10px;
-  margin-top: 5px;
-}
-input.delete_min {
-  background: #fefefe url(../../images/cross.png) no-repeat center !important;
-}
-input.delete_min[disabled] {
-  background: #fefefe url(../../images/cross.disabled.png) no-repeat center !important;
-}
-input.graph_min {
-  background: #fefefe url(../../images/chart_curve.png) no-repeat center !important;
-}
-input.graph_min[disabled] {
-  background: #fefefe url(../../images/chart_curve.disabled.png) no-repeat
-    center !important;
-}
-input.percentile_min {
-  background: #fefefe url(../../images/chart_bar.png) no-repeat center !important;
-}
-input.percentile_min[disabled] {
-  background: #fefefe url(../../images/chart_bar.disabled.png) no-repeat center !important;
-}
-input.percentile_item_min {
-  background: #fefefe url(../../images/percentile_item.png) no-repeat center !important;
-}
-input.percentile_item_min[disabled] {
-  background: #fefefe url(../../images/percentile_item.disabled.png) no-repeat
-    center !important;
-}
-input.binary_min {
-  background: #fefefe url(../../images/binary.png) no-repeat center !important;
-}
-input.binary_min[disabled] {
-  background: #fefefe url(../../images/binary.disabled.png) no-repeat center !important;
-}
-input.camera_min {
-  background: #fefefe url(../../images/camera.png) no-repeat center !important;
-}
-input.camera_min[disabled] {
-  background: #fefefe url(../../images/camera.disabled.png) no-repeat center !important;
-}
-input.config_min {
-  background: #fefefe url(../../images/config.png) no-repeat center !important;
-}
-input.config_min[disabled] {
-  background: #fefefe url(../../images/config.disabled.png) no-repeat center !important;
-}
-input.label_min {
-  background: #fefefe url(../../images/tag_red.png) no-repeat center !important;
-}
-input.label_min[disabled] {
-  background: #fefefe url(../../images/tag_red.disabled.png) no-repeat center !important;
-}
-input.icon_min {
-  background: #fefefe url(../../images/photo.png) no-repeat center !important;
-}
-input.icon_min[disabled] {
-  background: #fefefe url(../../images/photo.disabled.png) no-repeat center !important;
-}
-input.box_item {
-  background: #fefefe url(../../images/box_item.png) no-repeat center !important;
-}
-input.box_item[disabled] {
-  background: #fefefe url(../../images/box_item.disabled.png) no-repeat center !important;
-}
-input.line_item {
-  background: #fefefe url(../../images/line_item.png) no-repeat center !important;
-}
-input.line_item[disabled] {
-  background: #fefefe url(../../images/line_item.disabled.png) no-repeat center !important;
-}
-input.copy_item {
-  background: #fefefe url(../../images/copy_visualmap.png) no-repeat center !important;
-}
-input.copy_item[disabled] {
-  background: #fefefe url(../../images/copy_visualmap.disabled.png) no-repeat
-    center !important;
-}
-input.grid_min {
-  background: #fefefe url(../../images/grid.png) no-repeat center !important;
-}
-input.grid_min[disabled] {
-  background: #fefefe url(../../images/grid.disabled.png) no-repeat center !important;
-}
-input.save_min {
-  background: #fefefe url(../../images/file.png) no-repeat center !important;
-}
-input.save_min[disabled] {
-  background: #fefefe url(../../images/file.disabled.png) no-repeat center !important;
-}
-input.service_min {
-  background: #fefefe url(../../images/box.png) no-repeat center !important;
-}
-input.service_min[disabled] {
-  background: #fefefe url(../../images/box.disabled.png) no-repeat center !important;
-}
-
-input.group_item_min {
-  background: #fefefe url(../../images/group_green.png) no-repeat center !important;
-}
-input.group_item_min[disabled] {
-  background: #fefefe url(../../images/group_green.disabled.png) no-repeat
-    center !important;
-}
-
-div#cont {
-  position: fixed;
-  max-height: 320px;
-  overflow-y: auto;
-  overflow-x: hidden;
-}
-
-.termframe {
-  background-color: #82b92e !important;
-}
-
-table,
-img {
-  border: 0px;
-}
-
-tr:first-child > th {
-  background-color: #373737;
-}
-
-th {
-  color: #fff;
-  background-color: #666;
-  font-size: 7.5pt;
-  letter-spacing: 0.3pt;
-}
-tr.datos,
-tr.datost,
-tr.datosb,
-tr.datos_id,
-tr.datosf9 {
-  #background-color: #eaeaea;
-}
-
-tr.datos2,
-tr.datos2t,
-tr.datos2b,
-tr.datos2_id,
-tr.datos2f9 {
-  #background-color: #f2f2f2;
-}
-
-tr.datos:hover,
-tr.datost:hover,
-tr.datosb:hover,
-tr.datos_id:hover,
-tr.datosf9:hover,
-tr.datos2:hover,
-tr.datos2t:hover,
-tr.datos2b:hover,
-tr.datos2_id:hover,
-tr.datos2f9:hover {
-  #background-color: #efefef;
-}
-
-/* Checkbox styles */
-td input[type="checkbox"] {
-  /* Double-sized Checkboxes */
-  -ms-transform: scale(1.3); /* IE */
-  -moz-transform: scale(1.3); /* FF */
-  -o-transform: scale(1.3); /* Opera */
-  -webkit-transform: scale(1.3); /* Safari and Chrome */
-  padding: 10px;
-  margin-top: 2px;
-  display: table-cell;
-}
-
-td.datos3,
-td.datos3 * {
-  background-color: #666;
-  color: white !important;
-}
-
-td.datos4,
-td.datos4 * {
-  /*Add !important because in php the function html_print_table write style in cell and this is style head.*/
-  text-align: center !important;
-  background-color: #666;
-  color: white !important;
-}
-
-td.datos_id {
-  color: #1a313a;
-}
-
-tr.disabled_row_user * {
-  color: grey;
-}
-
-.bg {
-  /* op menu */
-  background: #82b92e;
-}
-
-.bg2 {
-  /* main page */
-  background-color: #0a160c;
-}
-.bg3 {
-  /* godmode */
-  background: #666666;
-}
-.bg4 {
-  /* links */
-  background-color: #989898;
-}
-.bg,
-.bg2,
-.bg3,
-.bg4 {
-  position: relative;
-  width: 100%;
-}
-.bg {
-  height: 20px;
-}
-.bg2,
-.bg3,
-.bg4 {
-  height: 18px;
-}
-.f10,
-#ip {
-  font-size: 7pt;
-  text-align: center;
-}
-.f9,
-.f9i,
-.f9b,
-.datos_greyf9,
-.datos_bluef9,
-.datos_greenf9,
-.datos_redf9,
-.datos_yellowf9,
-td.f9,
-td.f9i,
-td.datosf9,
-td.datos2f9 {
-  font-size: 6.5pt;
-}
-.f9i,
-.redi {
-  font-style: italic;
-}
-.tit {
-  padding: 6px 0px;
-  height: 14px;
-}
-.tit,
-.titb {
-  font-weight: bold;
-  color: #fff;
-  text-align: center;
-}
-
-.suc * {
-  color: #5a8629;
-}
-
-.info * {
-  color: #006f9d;
-}
-
-.error * {
-  color: #f85858;
-}
-
-.warning * {
-  color: #fad403;
-}
-
-.help {
-  background: url(../../images/help.png) no-repeat;
-}
-.red,
-.redb,
-.redi,
-.error {
-  color: #c00;
-}
-
-.sep {
-  margin-left: 30px;
-  border-bottom: 1px solid #708090;
-  width: 100%;
-}
-.orange {
-  color: #fd7304;
-}
-.green {
-  color: #5a8629;
-}
-.yellow {
-  color: #f3c500;
-}
-.greenb {
-  color: #00aa00;
-}
-.grey {
-  color: #808080;
-  font-weight: bold;
-}
-.blue {
-  color: #5ab7e5;
-  font-weight: bold;
-}
-.redb,
-.greenb,
-td.datos_id,
-td.datos2_id,
-f9b {
-  font-weight: bold;
-}
-.p10 {
-  padding-top: 1px;
-  padding-bottom: 0px;
-}
-.p21 {
-  padding-top: 2px;
-  padding-bottom: 1px;
-}
-.w120 {
-  width: 120px;
-}
-.w130,
-#table-agent-configuration select {
-  width: 130px;
-}
-.w135 {
-  width: 135px;
-}
-.w155,
-#table_layout_data select {
-  width: 155px;
-}
-.top,
-.top_red,
-.bgt,
-td.datost,
-td.datos2t {
-  vertical-align: top;
-}
-.top_red {
-  background: #ff0000;
-}
-.bot,
-.titb,
-td.datosb {
-  vertical-align: bottom;
-}
-.msg {
-  margin-top: 15px;
-  text-align: justify;
-}
-ul.mn {
-  list-style: none;
-  padding: 0px 0px 0px 0px;
-  margin: 0px 0px 0px 0px;
-  line-height: 15px;
-}
-.gr {
-  font-size: 10pt;
-  font-weight: bold;
-}
-a.mn,
-.gr {
-  font-family: Arial, Verdana, sans-serif, Helvetica;
-}
-div.nf {
-  background: url(../../images/info.png) no-repeat scroll 0 50% transparent;
-  margin-left: 7px;
-  padding: 8px 1px 6px 25px;
-}
-div.title_line {
-  background-color: #4e682c;
-  height: 5px;
-  width: 762px;
-}
-
-.alpha50 {
-  filter: alpha(opacity=50);
-  -moz-opacity: 0.5;
-  opacity: 0.5;
-  -khtml-opacity: 0.5;
-}
-
+/* General styles */
+body,
+div#page,
 #menu_tab_frame,
-#menu_tab_frame_view {
-  display: block !important;
-  border-bottom: 1px solid #82b92e;
-  /*	float:left; */
-  margin-left: 0px !important;
-  max-height: 31px;
-  min-height: 31px;
-  padding-right: 28px;
-  width: 100%;
-}
-
-#menu_tab {
-  margin: 0px 0px 0px 0px !important;
-}
-
-#menu_tab .mn,
-#menu_tab ul,
-#menu_tab .mn ul {
-  padding: 0px;
-  list-style: none;
-  margin: 0px 0px 0px 0px;
-}
-#menu_tab .mn li {
-  float: right;
-  position: relative;
-  margin: 0px 0px 0px 0px;
-}
-/*
-#menu_tab li a, #menu_tab a {
-	padding: 2px 0px;
-	font-weight: bold;
-	line-height: 18px;
-	margin-left: 3px;
-	margin-right: 0px;
-
-	-moz-border-top-right-radius: 5px;
-	-webkit-border-top-right-radius: 5px;
-	border-top-right-radius: 5px;
-
-	-moz-border-top-left-radius: 5px;
-	-webkit-border-top-left-radius: 5px;
-	border-top-left-radius: 5px;
-}
-
-#menu_tab li>form {
-	padding-left: 7px;
-	padding-top: 4px;
-}
-*/
-
-#menu_tab li.separator_view {
-  padding: 4px;
-}
-
-#menu_tab li.separator {
-  padding: 4px;
-}
-
-#menu_tab li.nomn_high a {
-  /*background: #82b92e;*/
-  color: #fff;
-}
-#menu_tab .mn li a {
-  display: block;
-  text-decoration: none;
-  padding: 0px;
-  margin: 0px;
-  height: 21px;
-  width: 21px;
-}
-#menu_tab li.nomn:hover a,
-#menu_tab li:hover ul a:hover {
-  /*background: #82b92e;*/
-  color: #fff;
-}
-#menu_tab li:hover a {
-  /*background: #b2b08a url("../../images/arrow.png") no-repeat right 3px;*/
-}
-
-#menu_tab li.nomn {
-  min-width: 30px;
-  height: 28px;
-}
-#menu_tab li.nomn_high {
-  min-width: 30px;
-  height: 28px;
-}
-/* TAB TITLE */
-#menu_tab_left {
-  margin-left: 0px !important;
-}
-
-#menu_tab_left .mn,
-#menu_tab_left ul,
-#menu_tab_left .mn ul {
-  background-color: #000;
-  color: #fff;
-  font-weight: bold;
-  padding: 0px 0px 0px 0px;
-  list-style: none;
-  margin: 0px 0px 0px 0px;
-}
-#menu_tab_left .mn li {
-  float: left;
-  position: relative;
-  height: 26px;
-  max-height: 26px;
-}
-#menu_tab_left li a,
-#menu_tab_left li span {
-  /*	text-transform: uppercase; */
-  padding: 0px 0px 0px 0px;
-  color: #fff;
-  font-size: 8.5pt;
-  font-weight: bold;
-  line-height: 20px;
-}
-#menu_tab_left .mn li a {
-  display: block;
-  text-decoration: none;
-}
-#menu_tab_left li.view a {
-  padding: 2px 10px 2px 10px;
-  color: #fff;
-  font-weight: bold;
-  line-height: 18px;
-  display: none;
-}
-
-#menu_tab_left li.view {
-  background: #82b92e;
-  max-width: 40%;
-  min-width: 20%;
-  padding: 5px 5px 0px;
-  text-align: center;
-  -moz-border-top-right-radius: 3px;
-  -webkit-border-top-right-radius: 3px;
-  border-top-right-radius: 3px;
-
-  -moz-border-top-left-radius: 3px;
-  -webkit-border-top-left-radius: 3px;
-  border-top-left-radius: 3px;
-  margin-left: 0px !important;
-  overflow-y: hidden;
-}
-
-#menu_tab_left li.view img.bottom {
-  width: 24px;
-  height: 24px;
-}
-
-#menu_tab_frame *,
-#menu_tab_frame_view * {
-  #margin: 0px 0px 0px 0px !important;
-}
-
-span.users {
-  background: url(../../images/group.png) no-repeat;
-}
-span.agents {
-  background: url(../../images/bricks.png) no-repeat;
-}
-span.data {
-  background: url(../../images/data.png) no-repeat;
-}
-span.alerts {
-  background: url(../../images/bell.png) no-repeat;
-}
-span.time {
-  background: url(../../images/hourglass.png) no-repeat;
-}
-span.net {
-  background: url(../../images/network.png) no-repeat;
-}
-span.master {
-  background: url(../../images/master.png) no-repeat;
-}
-span.wmi {
-  background: url(../../images/wmi.png) no-repeat;
-}
-span.prediction {
-  background: url(../../images/chart_bar.png) no-repeat;
-}
-span.plugin {
-  background: url(../../images/plugin.png) no-repeat;
-}
-span.export {
-  background: url(../../images/database_refresh.png) no-repeat;
-}
-span.snmp {
-  background: url(../../images/snmp.png) no-repeat;
-}
-span.binary {
-  background: url(../../images/binary.png) no-repeat;
-}
-span.recon {
-  background: url(../../images/recon.png) no-repeat;
-}
-span.rmess {
-  background: url(../../images/email_open.png) no-repeat;
-}
-span.nrmess {
-  background: url(../../images/email.png) no-repeat;
-}
-span.recon_server {
-  background: url(../../images/recon.png) no-repeat;
-}
-span.wmi_server {
-  background: url(../../images/wmi.png) no-repeat;
-}
-span.export_server {
-  background: url(../../images/server_export.png) no-repeat;
-}
-span.inventory_server {
-  background: url(../../images/page_white_text.png) no-repeat;
-}
-span.web_server {
-  background: url(../../images/world.png) no-repeat;
-}
-/* This kind of span do not have any sense, should be replaced on PHP code
-by a real img in code. They are not useful because insert too much margin around
-(for example, not valid to use in the table of server view */
-span.users,
-span.agents,
-span.data,
-span.alerts,
-span.time,
-span.net,
-span.master,
-span.snmp,
-span.binary,
-span.recon,
-span.wmi,
-span.prediction,
-span.plugin,
-span.plugin,
-span.export,
-span.recon_server,
-span.wmi_server,
-span.export_server,
-span.inventory_server,
-span.web_server {
-  margin-left: 4px;
-  margin-top: 10px;
-  padding: 4px 8px 12px 30px;
-  display: block;
-}
-span.rmess,
-span.nrmess {
-  margin-left: 14px;
-  padding: 1px 0px 10px 30px;
-  display: block;
-}
-/* New styles for data box */
-.databox,
-.databox_color,
-.databox_frame {
-  margin-bottom: 5px;
-  margin-top: 0px;
-  margin-left: 0px;
-  border: 1px solid #e2e2e2;
-  -moz-border-radius: 4px;
-  -webkit-border-radius: 4px;
-  border-radius: 4px;
-}
-.databox_color {
-  padding-top: 5px;
-}
-
-table.databox {
-  background-color: #5b5b5b;
-  border-spacing: 0px;
-  -moz-box-shadow: 0px 0px 0px #ddd !important;
-  -webkit-box-shadow: 0px 0px 0px #ddd !important;
-  box-shadow: 0px 0px 0px #ddd !important;
-}
-
-.databox td {
-  -moz-border-radius: 0px;
-  -webkit-border-radius: 0px;
-  border-radius: 0px;
-  border: 0px none #e2e2e2;
-}
-
-.databox th {
-  padding: 9px 7px;
-  font-weight: normal;
-  color: #fff;
-}
-.databox td {
-  #border-bottom: 1px solid #e2e2e2;
-}
-
-.databox th * {
-  color: #fff;
-}
-
-.databox th input,
-.databox th textarea,
-.databox th select,
-.databox th select option {
-  color: #222 !important;
-}
-
-.tabletitle {
-  color: #333;
-}
-
-.tactical_set legend {
-  text-align: left;
-  color: #fff;
-}
-
-.tactical_set {
-  background: #5b5b5b;
-  border: 1px solid #e2e2e2;
-  margin-left: auto;
-  margin-right: auto;
-  width: auto;
-}
-
-/* For use in Netflow */
-
-table.databox_grid {
-  margin: 25px;
-}
-
-table.databox_grid th {
-  font-size: 12px;
-}
-
-table.databox_grid td {
-  padding: 6px;
-  margin: 4px;
-  border-bottom: 1px solid #acacac;
-  border-right: 1px solid #acacac;
-}
-
-table.alternate tr:nth-child(odd) td {
-  background-color: #5b5b5b;
-}
-table.alternate tr:nth-child(even) td {
-  background-color: #e4e5e4;
-}
-
-table.rounded_cells td {
-  padding: 4px 4px 4px 10px;
-  -moz-border-radius: 6px !important;
-  -webkit-border-radius: 6px !important;
-  border-radius: 6px !important;
-}
-
-.databox_color {
-  background-color: #fafafa;
-}
-#head_l {
-  float: left;
-  margin: 0;
-  padding: 0;
-}
-#head_r {
-  float: right;
-  text-align: right;
-  margin-right: 10px;
-  padding-top: 0px;
-}
-#head_m {
-  position: absolute;
-  padding-top: 6px;
-  padding-left: 12em;
-}
-span#logo_text1 {
-  font: bolder 3em Arial, Sans-serif;
-  letter-spacing: -2px;
-  color: #eee;
-}
-span#logo_text2 {
-  font: 3em Arial, Sans-serif;
-  letter-spacing: -2px;
-  color: #aaa;
-}
-
-div#logo_text3 {
-  text-align: right;
-  font: 2em Arial, Sans-serif;
-  letter-spacing: 6px;
-  color: #aaa;
-  font-weight: bold;
-  margin-top: 0px;
-  margin-left: 4px;
-  padding-top: 0px;
-}
-
-.bb0 {
-  border-bottom: 0px;
-}
-.bt0 {
-  border-top: 0px;
-}
-.action-buttons {
-  text-align: right;
-}
-#table-add-item select,
-#table-add-sla select {
-  width: 180px;
-}
-
-/* end of classes for event priorities */
-div#main_pure {
-  background-color: #fefefe;
-  text-align: left;
-  margin-bottom: 25px;
-  margin-top: 30px;
-  margin-left: 10px;
-  margin-right: 10px;
-  height: 1000px;
-  width: 98%;
-  position: static;
-}
-#table-agent-configuration radio {
-  margin-right: 40px;
-}
-.ui-draggable {
-  cursor: move;
-}
-#layout_trash_drop {
-  float: right;
-  width: 300px;
-  height: 180px;
-  background: #fff url("../../images/trash.png") no-repeat bottom left;
-}
-#layout_trash_drop div {
-  display: block;
-}
-#layout_editor_drop {
-  float: left;
-  width: 300px;
-}
-.agent_reporting {
-  margin: 5px;
-  padding: 5px;
-}
-.report_table,
-.agent_reporting {
-  border: #ccc outset 3px;
-}
-.img_help {
-  cursor: help;
-}
-#loading {
-  position: fixed;
-  width: 200px;
-  margin-left: 30%;
-  text-align: center;
-  top: 50%;
-  background-color: #999999;
-  padding: 20px;
-}
-/* IE 7 Hack */
-#editor {
-  *margin-top: 10px !important;
-}
-/* big_data is used in tactical and logon_ok */
-.big_data {
-  text-decoration: none;
-  font: bold 2em Arial, Sans-serif;
-}
-
-.med_data {
-  text-decoration: none;
-  font: bold 1.5em Arial, Sans-serif;
-}
-
-.notify {
-  background-color: #f7ffa5;
-  text-align: center;
-  font-weight: bold;
-  padding: 8px;
-  margin: 0px 0px 0px 0px !important;
-  z-index: -1;
-}
-
-.notify a {
-  color: #003a3a;
-  text-decoration: underline;
-}
-
-.listing {
-  border-collapse: collapse;
-}
-.listing td {
-  border-bottom: 1px solid #cccccc;
-  border-top: 1px solid #cccccc;
-}
-ul {
-  list-style-type: none;
-  padding-left: 0;
-  margin-left: 0;
-}
-span.actions {
-  margin-left: 30px;
-}
-.actions {
-  min-width: 200px !important;
-}
-code,
-pre {
-  font-family: courier, serif;
-}
-select#template,
-select#action {
-  width: 250px;
-}
-#label-checkbox-matches_value,
-#label-checkbox-copy_modules,
-#label-checkbox-copy_alerts {
-  display: inline;
-  font-weight: normal;
-}
-input[type="image"] {
-  border: 0px;
-  background-color: transparent !important;
-}
-table#simple select#id_module_type,
-table#alert_search select#id_agent,
-table#alert_search select#id_group,
-table#network_component select#type {
-  width: 200px;
-}
-table#simple select#select_snmp_oid,
-table#simple select#id_plugin,
-table#network_component select#id_plugin {
-  width: 270px;
-}
-table#simple select#prediction_id_group,
-table#simple select#prediction_id_agent,
-table#simple select#prediction_module {
-  width: 50%;
-  display: block;
-}
-table#simple input#text-plugin_parameter,
-table#simple input#text-snmp_oid,
-table#source_table select,
-table#destiny_table select,
-table#target_table select,
-table#filter_compound_table select,
-table#filter_compound_table #text-search,
-table#delete_table select {
-  width: 100%;
-}
-table#simple select#network_component_group,
-table#simple select#network_component {
-  width: 90%;
-}
-table#simple span#component_group,
-table#simple span#component {
-  width: 45%;
-  font-style: italic;
-}
-table#simple label {
-  display: inline;
-  font-weight: normal;
-  font-style: italic;
-}
-.clickable {
-  cursor: pointer;
-}
-table#agent_list tr,
-table.alert_list tr {
-  vertical-align: top;
-}
-.toggle {
-  border-collapse: collapse;
-}
-.toggle td {
-  border-left: 1px solid #d3d3d3;
-}
-
-ul.actions_list {
-  list-style-image: url(../../images/arrow.png);
-  list-style-position: inside;
-  margin-top: 0;
-}
-div.loading {
-  background-color: #fff1a8;
-  margin-left: auto;
-  margin-right: auto;
-  padding: 5px;
-  text-align: center;
-  font-style: italic;
-  width: 95%;
-}
-div.loading img {
-  float: right;
-}
-/* Tablesorter jQuery pager */
-div.pager {
-  margin-left: 10px;
-  margin-top: 5px;
-}
-div.pager img {
-  position: relative;
-  top: 4px;
-  padding-left: 5px;
-}
-div.pager input {
-  padding-left: 5px;
-}
-.pagedisplay {
-  border: 0;
-  width: 35px;
-}
-/* Steps style */
-ol.steps {
-  margin-bottom: 15px;
-  padding: 0;
-  list-style-type: none;
-  list-style-position: outside;
-}
-ol.steps li {
-  float: left;
-  background-color: #efefef;
-  padding: 5px;
-  margin-left: 5px;
-  width: 150px;
-}
-ol.steps li a {
-  color: #111;
-}
-ol.steps li.visited a {
-  color: #999;
-}
-ol.steps li span {
-  font-weight: normal;
-  display: block;
-}
-ol.steps li span {
-  color: #777;
-}
-ol.steps li.visited span {
-  color: #999;
-}
-ol.steps li.current {
-  border-left: 5px solid #778866;
-  margin-left: 0;
-  font-weight: bold;
-  background-color: #e9f3d2;
-}
-ol.steps li.visited {
-  color: #999 !important;
-}
-
-fieldset {
-  background-color: #5b5b5b;
-  border: 1px solid #e2e2e2;
-  padding: 0.5em;
-  margin-bottom: 20px;
-  position: relative;
-}
-fieldset legend {
-  font-size: 1.1em;
-  font-weight: bold;
-  #color: #3f4e2f;
-  line-height: 20px;
-  color: #3f3f3f;
-  #top: -2em;
-}
-
-fieldset .databox {
-  border: 0px solid;
-}
-
-fieldset.databox {
-  padding: 14px !important;
-}
-
-fieldset legend span,
-span#latest_value {
-  font-style: italic;
-}
-span#latest_value span#value {
-  font-style: normal;
-}
-form#filter_form {
-  margin-bottom: 15px;
-}
-ul.action_list {
-  margin: 0;
-  list-style: none inside circle;
-}
-ul.action_list li div {
-  margin-left: 15px;
-}
-span.action_name {
-  float: none;
-}
-div.actions_container {
-  overflow: auto;
-  width: 100%;
-  max-height: 200px;
-}
-div.actions_container label {
-  display: inline;
-  font-weight: normal;
-  font-style: italic;
-}
-a.add_action {
-  clear: both;
-  display: block;
-}
-
-/* timeEntry styles */
-.timeEntry_control {
-  vertical-align: middle;
-  margin-left: 2px;
-}
-div#steps_clean {
-  clear: both;
-}
-div#event_control {
-  clear: right;
-}
-
-/* Autocomplete styles */
-.ac_results {
-  padding: 0px;
-  border: 1px solid black;
-  background-color: white;
-  overflow: hidden;
-  z-index: 99999;
-}
-
-.ac_results ul {
-  width: 100%;
-  list-style-position: outside;
-  list-style: none;
-  padding: 0;
-  margin: 0;
-  text-align: left;
-}
-
-.ac_results li {
-  margin: 0px;
-  padding: 2px 5px;
-  cursor: default;
-  display: block;
-  /*
-	if width will be 100% horizontal scrollbar will apear
-	when scroll mode will be used
-	*/
-  /*width: 100%;*/
-  font: menu;
-  font-size: 12px;
-  /*
-	it is very important, if line-height not setted or setted
-	in relative units scroll will be broken in firefox
-	*/
-  line-height: 16px;
-}
-
-.ac_loading {
-  background: white url("../images/loading.gif") right center no-repeat;
-}
-
-.ac_over {
-  background-color: #efefef;
-}
-span.ac_extra_field,
-span.ac_extra_field strong {
-  font-style: italic;
-  font-size: 9px;
-}
-
-div#pandora_logo_header {
-  /*	Put here your company logo (139x60 pixels) like this: */
-  /*	background: url(../../images/MiniLogoArtica.jpg); */
-  background: url(../../images/pandora_logo_head.png);
-  background-position: 0% 0%;
-  width: 139px;
-  height: 60px;
-  float: left;
-}
-
-#header_table img {
-  margin-top: 0px;
-}
-
-.autorefresh_disabled {
-  cursor: not-allowed !important;
-}
-
-a.autorefresh {
-  padding-right: 8px;
-}
-
-#refrcounter {
-  color: white;
-}
-
-#combo_refr select {
-  margin-right: 8px;
-}
-
-.disabled_module {
-  color: #aaa;
-}
-div.warn {
-  background: url(../../images/info.png) no-repeat;
-  margin-top: 7px;
-  padding: 2px 1px 6px 25px;
-}
-
-.submenu_not_selected {
-  transition-property: background-color;
-  transition-duration: 0.5s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color;
-  -webkit-transition-duration: 0.5s;
-  -webkit-transition-timing-function: ease-out;
-  -moz-transition-property: background-color;
-  -moz-transition-duration: 0.5s;
-  -moz-transition-timing-function: ease-out;
-  -o-transition-property: background-color;
-  -o-transition-duration: 0.5s;
-  -o-transition-timing-function: ease-out;
-  font-weight: normal !important;
-}
-
-/* Submenus havent borders */
-.submenu_not_selected,
-.submenu_selected,
-.submenu2 {
-  border: 0px !important;
-  min-height: 35px !important;
-}
-
-/* Pandora width style theme */
-
-div#container {
-  width: 100%;
-}
-div#page {
-  width: auto;
-}
-div#main {
-  max-width: 93%;
-  min-width: 93%;
-}
-
-ol.steps {
-  margin-bottom: 70px;
-}
-div#steps_clean {
-  display: none;
-}
-
-#menu_tab_frame,
-#menu_tab_frame_view {
-  width: 100%;
-  padding-right: 0px;
-  margin-left: 0px !important;
-  margin-bottom: 20px;
-  height: 31px;
-}
-div#events_list {
-  float: left;
-  width: 100%;
-}
-span#logo_text1 {
-  font: bolder 3em Arial, Sans-serif;
-  letter-spacing: -2px;
-  color: #eee;
-}
-span#logo_text2 {
-  font: 3em Arial, Sans-serif;
-  letter-spacing: -2px;
-  color: #aaa;
-}
-div#logo_text3 {
-  text-align: right;
-  font: 2em Arial, Sans-serif;
-  letter-spacing: 6px;
-  color: #aaa;
-  font-weight: bold;
-  margin-top: 0px;
-  margin-left: 4px;
-  padding-top: 0px;
-}
-.pagination {
-  margin-top: 15px;
-  margin-bottom: 5px;
-}
-.pagination * {
-  margin-left: 0px !important;
-  margin-right: 0px !important;
-  vertical-align: middle;
-}
-
-/*CALENDAR TOOLTIP STYLE*/
-
-/* Calendar background */
-table.scw {
-  background-color: #82b92e;
-  border: 0 !important;
-  border-radius: 4px;
-}
-
-/* Week number heading */
-td.scwWeekNumberHead {
-  color: #111;
-}
-
-td.scwWeek {
-  color: #111 !important;
-}
-
-Today selector td.scwFoot {
-  background-color: #daedae;
-  color: #111;
-}
-
-td.scwFootDisabled {
-  background-color: #000;
-  color: #ffffff;
-}
-
-tfoot.scwFoot {
-  color: #111;
-}
-
-.scwFoot :hover {
-  color: #3f3f3f !important;
-}
-
-table.scwCells {
-  background-color: #5b5b5b !important;
-  color: #3c3c3c !important;
-}
-
-table.scwCells:hover {
-  background-color: #5b5b5b !important;
-}
-
-td.scwCellsExMonth {
-  background-color: #eee !important;
-  color: #3c3c3c !important;
-}
-
-td.scwCellsWeekend {
-  background-color: #3c3c3c !important;
-  color: #fff !important;
-  border: 0 !important;
-}
-
-td.scwInputDate {
-  background-color: #777 !important;
-  color: #ffffff !important;
-  border: 0 !important;
-}
-
-td.scwFoot {
-  background-color: #5b5b5b !important;
-  color: #3c3c3c !important;
-  border: 0 !important;
-}
-
-/* Cells divs to set individual styles with the table objects */
-div.cellBold {
-  width: 100%;
-  height: 100%;
-  font-weight: bold;
-}
-
-div.cellRight {
-  width: 100%;
-  height: 100%;
-  text-align: right;
-}
-
-div.cellCenter {
-  width: 100%;
-  height: 100%;
-  text-align: center;
-}
-
-div.cellWhite {
-  width: 100%;
-  height: 100%;
-  background: #5b5b5b;
-  color: #111;
-}
-
-div.cellNormal {
-  width: 100%;
-  height: 100%;
-  background: #6eb432;
-  color: #fff;
-}
-
-div.cellCritical {
-  width: 100%;
-  height: 100%;
-  background: #f85858;
-  color: #fff;
-}
-
-div.cellWarning {
-  width: 100%;
-  height: 100%;
-  background: #ffea59;
-  color: #111;
-}
-
-div.cellUnknown {
-  width: 100%;
-  height: 100%;
-  background: #aaaaaa;
-  color: #ffffff;
-}
-
-div.cellNotInit {
-  width: 100%;
-  height: 100%;
-  background: #3ba0ff;
-  color: #ffffff;
-}
-
-div.cellAlert {
-  width: 100%;
-  height: 100%;
-  background: #ff8800;
-  color: #111;
-}
-
-div.cellBorder1 {
-  width: 100%;
-  height: 100%;
-  border: 1px solid #666;
-}
-
-div.cellBig {
-  width: 100%;
-  height: 100%;
-  font-size: 18px;
-}
-
-.info_box {
-  background: #5b5b5b;
-  margin-top: 10px !important;
-  margin-bottom: 10px !important;
-  padding: 0px 5px 5px 10px;
-  border-color: #e2e2e2;
-  border-style: solid;
-  border-width: 1px;
-  width: 100% !important;
-  -moz-border-radius: 4px;
-  -webkit-border-radius: 4px;
-  border-radius: 4px;
-}
-
-.info_box .title * {
-  font-size: 10pt !important;
-  font-weight: bolder;
-}
-
-.info_box .icon {
-  width: 30px !important;
-  text-align: center;
-}
-
-/* Standard styles for status colos (groups, events, backgrounds...) */
-
-.opacity_cell {
-  filter: alpha(opacity=80);
-  -moz-opacity: 0.8;
-  opacity: 0.8;
-  -khtml-opacity: 0.8;
-}
-
-tr.group_view_data,
-.group_view_data {
-  color: #3f3f3f;
-}
-
-tr.group_view_crit,
-.group_view_crit {
-  background-color: #fc4444;
-  color: #fff;
-}
-
-tr.group_view_norm,
-.group_view_norm,
-tr.group_view_normal,
-.group_view_normal {
-  #background-color: #5b5b5b;
-}
-tr.group_view_ok,
-.group_view_ok {
-  background-color: #82b92e;
-  color: #fff;
-}
-
-tr.group_view_not_init,
-.group_view_not_init,
-tr.group_view_not_init,
-.group_view_not_init {
-  background-color: #5bb6e5;
-  color: #fff !important;
-}
-
-tr.group_view_warn,
-.group_view_warn,
-tr.group_view_warn.a,
-a.group_view_warn,
-tr.a.group_view_warn {
-  background-color: #fad403;
-  color: #3f3f3f !important;
-}
-
-a.group_view_warn {
-  color: #fad403 !important;
-}
-
-tr.group_view_alrm,
-.group_view_alrm {
-  background-color: #ffa631;
-  color: #fff;
-}
-
-tr.group_view_unk,
-.group_view_unk {
-  background-color: #b2b2b2;
-  color: #fff;
-}
-
-/* classes for event priorities. Sits now in functions.php */
-.datos_green,
-.datos_greenf9,
-.datos_green a,
-.datos_greenf9 a,
-.datos_green * {
-  background-color: #82b92e;
-  color: #fff;
-}
-.datos_red,
-.datos_redf9,
-.datos_red a,
-.datos_redf9 a,
-.datos_red * {
-  background-color: #fc4444;
-  color: #fff !important;
-}
-
-.datos_yellow,
-.datos_yellowf9,
-.datos_yellow * {
-  background-color: #fad403;
-  color: #111;
-}
-
-a.datos_blue,
-.datos_bluef9,
-.datos_blue,
-.datos_blue * {
-  background-color: #4ca8e0;
-  color: #fff !important;
-}
-
-.datos_grey,
-.datos_greyf9,
-.datos_grey * {
-  background-color: #999999;
-  color: #fff;
-}
-
-.datos_pink,
-.datos_pinkf9,
-.datos_pink * {
-  background-color: #fdc4ca;
-  color: #111;
-}
-
-.datos_brown,
-.datos_brownf9,
-.datos_brown * {
-  background-color: #a67c52;
-  color: #fff;
-}
-
-.datos_orange,
-.datos_orangef9,
-.datos_orange * {
-  background-color: #f7931e;
-  color: #111;
-}
-
-td.datos_greyf9,
-td.datos_bluef9,
-td.datos_greenf9,
-td.datos_redf9,
-td.datos_yellowf9,
-td.datos_pinkf9,
-td.datos_brownf9,
-td.datos_orangef9 {
-  padding: 5px 5px 5px 5px;
-}
-
-.menu li.selected {
-  font-weight: bold;
-}
-
-ul.operation li a:hover {
-  #font-weight: bold;
-}
-
-.menu_icon {
-  transition-property: background-color;
-  transition-duration: 0.5s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color;
-  -webkit-transition-duration: 0.5s;
-  -webkit-transition-timing-function: ease-out;
-  -moz-transition-property: background-color;
-  -moz-transition-duration: 0.5s;
-  -moz-transition-timing-function: ease-out;
-  -o-transition-property: background-color;
-  -o-transition-duration: 0.5s;
-  -o-transition-timing-function: ease-out;
-}
-
-.menu_icon:hover {
-  transition-property: background-color;
-  transition-duration: 0.5s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color;
-  -webkit-transition-duration: 0.5s;
-  -webkit-transition-timing-function: ease-out;
-  -moz-transition-property: background-color;
-  -moz-transition-duration: 0.5s;
-  -moz-transition-timing-function: ease-out;
-  -o-transition-property: background-color;
-  -o-transition-duration: 0.5s;
-  -o-transition-timing-function: ease-out;
-  background-color: #b1b1b1 !important;
-}
-.submenu_not_selected:hover {
-  transition-property: background-color;
-  transition-duration: 0.5s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color;
-  -webkit-transition-duration: 0.5s;
-  -webkit-transition-timing-function: ease-out;
-  -moz-transition-property: background-color;
-  -moz-transition-duration: 0.5s;
-  -moz-transition-timing-function: ease-out;
-  -o-transition-property: background-color;
-  -o-transition-duration: 0.5s;
-  -o-transition-timing-function: ease-out;
-  background-color: #b1b1b1 !important;
-}
-
-.submenu_selected:hover {
-  background-color: #b1b1b1 !important;
-}
-
-.sub_subMenu {
-  transition-property: background-color;
-  transition-duration: 0.5s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color;
-  -webkit-transition-duration: 0.5s;
-  -webkit-transition-timing-function: ease-out;
-  -moz-transition-property: background-color;
-  -moz-transition-duration: 0.5s;
-  -moz-transition-timing-function: ease-out;
-  -o-transition-property: background-color;
-  -o-transition-duration: 0.5s;
-}
-.sub_subMenu:hover {
-  transition-property: background-color;
-  transition-duration: 0.5s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color;
-  -webkit-transition-duration: 0.5s;
-  -webkit-transition-timing-function: ease-out;
-  -moz-transition-property: background-color;
-  -moz-transition-duration: 0.5s;
-  -moz-transition-timing-function: ease-out;
-  -o-transition-property: background-color;
-  -o-transition-duration: 0.5s;
-  background-color: #b1b1b1 !important;
-}
-
-.submenu_text {
-  color: #fff;
-}
-
-.menu li.selected {
-  box-shadow: inset 4px 0 #b1b1b1;
-}
-
-li.links a:hover {
-  #font-weight: bold;
-}
-
-.is_submenu2 li {
-  background-color: #ff0000;
-}
-
-.is_submenu2 {
-  background-color: #222222 !important;
-}
-
-.operation {
-  background-color: #333 !important;
-}
-
-.operation .selected {
-  background-color: #b1b1b1 !important;
-}
-
-.menu li,
-.menu .li.not_selected {
-  border-radius: 0px 0px 0px 0px;
-  display: block;
-  min-height: 35px;
-  border-bottom: 0px none #424242;
-  vertical-align: middle;
-}
-
-#menu_tab li.separator {
-  /* Empty */
-}
-
-.operation {
-  border-top-right-radius: 5px;
-  border-right-style: solid;
-  border-right-width: 0px;
-}
-
+#menu_tab_frame_view,
+#menu_tab_frame_view_bc,
+input.search_input,
+.filters input,
 input#text-id_parent.ac_input,
 input,
 textarea,
-select {
-  background-color: #5b5b5b !important;
-  border: 1px solid #cbcbcb;
-  -moz-border-radius: 3px;
-  -webkit-border-radius: 3px;
-  border-radius: 3px;
-}
-
-span#plugin_description {
-  font-size: 9px;
-}
-
-/*FOR TINYMCE*/
-#tinymce {
-  text-align: left;
-}
-.visual_font_size_4pt,
-.visual_font_size_4pt > em,
-.visual_font_size_4pt > strong,
-.visual_font_size_4pt > strong > span,
-.visual_font_size_4pt > span,
-.visual_font_size_4pt > strong > em,
-.visual_font_size_4pt > em > strong,
-.visual_font_size_4pt em span,
-.visual_font_size_4pt span em {
-  font-size: 4pt !important;
-  line-height: 4pt;
-}
-.visual_font_size_6pt,
-.visual_font_size_6pt > em,
-.visual_font_size_6pt > strong,
-.visual_font_size_6pt > strong > span,
-.visual_font_size_6pt > span,
-.visual_font_size_6pt > strong > em,
-.visual_font_size_6pt > em > strong,
-.visual_font_size_6pt em span,
-.visual_font_size_6pt span em {
-  font-size: 6pt !important;
-  line-height: 6pt;
-}
-.visual_font_size_8pt,
-.visual_font_size_8pt > em,
-.visual_font_size_8pt > strong,
-.visual_font_size_8pt > strong > span,
-.visual_font_size_8pt > span,
-.visual_font_size_8pt > strong > em,
-.visual_font_size_8pt > em > strong,
-.visual_font_size_8pt em span,
-.visual_font_size_8pt span em {
-  font-size: 8pt !important;
-  line-height: 8pt;
-}
-.visual_font_size_10pt,
-.visual_font_size_10pt > em,
-.visual_font_size_10pt > strong,
-.visual_font_size_10pt > strong > em,
-.visual_font_size_10pt > em > strong,
-.visual_font_size_10pt em span,
-.visual_font_size_10pt span em {
-  font-size: 10pt !important;
-  line-height: 10pt;
-}
-.visual_font_size_12pt,
-.visual_font_size_12pt > em,
-.visual_font_size_12pt > strong,
-.visual_font_size_12pt > strong > em,
-.visual_font_size_12pt > em > strong,
-.visual_font_size_12pt em span,
-.visual_font_size_12pt span em {
-  font-size: 12pt !important;
-  line-height: 12pt;
-}
-.visual_font_size_14pt,
-.visual_font_size_14pt > em,
-.visual_font_size_14pt > strong,
-.visual_font_size_14pt > strong > span,
-.visual_font_size_14pt > span,
-.visual_font_size_14pt > strong > em,
-.visual_font_size_14pt > em > strong,
-.visual_font_size_14pt em span,
-.visual_font_size_14pt span em {
-  font-size: 14pt !important;
-  line-height: 14pt;
-}
-.visual_font_size_18pt,
-.visual_font_size_18pt > em,
-.visual_font_size_18pt > strong,
-.visual_font_size_18pt > strong > span,
-.visual_font_size_18pt > span,
-.visual_font_size_18pt > strong > em,
-.visual_font_size_18pt > em > strong,
-.visual_font_size_18pt em span,
-.visual_font_size_18pt span em {
-  font-size: 18pt !important;
-  line-height: 18pt;
-}
-.visual_font_size_24pt,
-.visual_font_size_24pt > em,
-.visual_font_size_24pt > strong,
-.visual_font_size_24pt > strong > span,
-.visual_font_size_24pt > span,
-.visual_font_size_24pt > strong > em,
-.visual_font_size_24pt > em > strong,
-.visual_font_size_24pt em span,
-.visual_font_size_24pt span em {
-  font-size: 24pt !important;
-  line-height: 24pt;
-}
-.visual_font_size_28pt,
-.visual_font_size_28pt > em,
-.visual_font_size_28pt > strong,
-.visual_font_size_28pt > strong > span,
-.visual_font_size_28pt > span,
-.visual_font_size_28pt > strong > em,
-.visual_font_size_28pt > em > strong,
-.visual_font_size_28pt em span,
-.visual_font_size_28pt span em {
-  font-size: 28pt !important;
-  line-height: 28pt;
-}
-.visual_font_size_36pt,
-.visual_font_size_36pt > em,
-.visual_font_size_36pt > strong,
-.visual_font_size_36pt > strong > span,
-.visual_font_size_36pt > span,
-.visual_font_size_36pt > strong > em,
-.visual_font_size_36pt > em > strong,
-.visual_font_size_36pt em span,
-.visual_font_size_36pt span em {
-  font-size: 36pt !important;
-  line-height: 36pt;
-}
-.visual_font_size_48pt,
-.visual_font_size_48pt > em,
-.visual_font_size_48pt > strong,
-.visual_font_size_48pt > strong > span,
-.visual_font_size_48pt > span,
-.visual_font_size_48pt > strong > em,
-.visual_font_size_48pt > em > strong,
-.visual_font_size_48pt em span,
-.visual_font_size_48pt span em {
-  font-size: 48pt !important;
-  line-height: 48pt;
-}
-.visual_font_size_60pt,
-.visual_font_size_60pt > em,
-.visual_font_size_60pt > strong,
-.visual_font_size_60pt > strong > span,
-.visual_font_size_60pt > span,
-.visual_font_size_60pt > strong > em,
-.visual_font_size_60pt > em > strong,
-.visual_font_size_60pt em span,
-.visual_font_size_60pt span em {
-  font-size: 60pt !important;
-  line-height: 60pt;
-}
-.visual_font_size_72pt,
-.visual_font_size_72pt > em,
-.visual_font_size_72pt > strong,
-.visual_font_size_72pt > strong > span,
-.visual_font_size_72pt > span,
-.visual_font_size_72pt > strong > em,
-.visual_font_size_72pt > em > strong,
-.visual_font_size_72pt em span,
-.visual_font_size_72pt span em {
-  font-size: 72pt !important;
-  line-height: 72pt;
-}
-.visual_font_size_84pt,
-.visual_font_size_84pt > em,
-.visual_font_size_84pt > strong,
-.visual_font_size_84pt > strong > span,
-.visual_font_size_84pt > span,
-.visual_font_size_84pt > strong > em,
-.visual_font_size_84pt > em > strong,
-.visual_font_size_84pt em span,
-.visual_font_size_84pt span em {
-  font-size: 84pt !important;
-  line-height: 84pt;
-}
-
-.visual_font_size_96pt,
-.visual_font_size_96pt > em,
-.visual_font_size_96pt > strong,
-.visual_font_size_96pt > strong > span,
-.visual_font_size_96pt > span,
-.visual_font_size_96pt > strong > em,
-.visual_font_size_96pt > em > strong,
-.visual_font_size_96pt em span,
-.visual_font_size_96pt span em {
-  font-size: 96pt !important;
-  line-height: 96pt;
-}
-
-.visual_font_size_116pt,
-.visual_font_size_116pt > em,
-.visual_font_size_116pt > strong,
-.visual_font_size_116pt > strong > span,
-.visual_font_size_116pt > span,
-.visual_font_size_116pt > strong > em,
-.visual_font_size_116pt > em > strong,
-.visual_font_size_116pt em span,
-.visual_font_size_116pt span em {
-  font-size: 116pt !important;
-  line-height: 116pt;
-}
-
-.visual_font_size_128pt,
-.visual_font_size_128pt > em,
-.visual_font_size_128pt > strong,
-.visual_font_size_128pt > strong > span,
-.visual_font_size_128pt > span,
-.visual_font_size_128pt > strong > em,
-.visual_font_size_128pt > em > strong,
-.visual_font_size_128pt em span,
-.visual_font_size_128pt span em {
-  font-size: 128pt !important;
-  line-height: 128pt;
-}
-
-.visual_font_size_140pt,
-.visual_font_size_140pt > em,
-.visual_font_size_140pt > strong,
-.visual_font_size_140pt > strong > span,
-.visual_font_size_140pt > span,
-.visual_font_size_140pt > strong > em,
-.visual_font_size_140pt > em > strong,
-.visual_font_size_140pt em span,
-.visual_font_size_140pt span em {
-  font-size: 140pt !important;
-  line-height: 140pt;
-}
-
-.visual_font_size_154pt,
-.visual_font_size_154pt > em,
-.visual_font_size_154pt > strong,
-.visual_font_size_154pt > strong > span,
-.visual_font_size_154pt > span,
-.visual_font_size_154pt > strong > em,
-.visual_font_size_154pt > em > strong,
-.visual_font_size_154pt em span,
-.visual_font_size_154pt span em {
-  font-size: 154pt !important;
-  line-height: 154pt;
-}
-
-.visual_font_size_196pt,
-.visual_font_size_196pt > em,
-.visual_font_size_196pt > strong,
-.visual_font_size_196pt > strong > span,
-.visual_font_size_196pt > span,
-.visual_font_size_196pt > strong > em,
-.visual_font_size_196pt > em > strong,
-.visual_font_size_196pt em span,
-.visual_font_size_196pt span em {
-  font-size: 196pt !important;
-  line-height: 196pt;
-}
-
-.resize_visual_font_size_8pt,
-.resize_visual_font_size_8pt > em,
-.resize_visual_font_size_8pt > strong,
-.resize_visual_font_size_8pt > strong > span,
-.resize_visual_font_size_8pt > span,
-.resize_visual_font_size_8pt > strong > em,
-.resize_visual_font_size_8pt > em > strong,
-.visual_font_size_8pt em span,
-.visual_font_size_8pt span em {
-  font-size: 4pt !important;
-  line-height: 4pt;
-}
-.resize_visual_font_size_14pt,
-.resize_visual_font_size_14pt > em,
-.resize_visual_font_size_14pt > strong,
-.resize_visual_font_size_14pt > strong > span,
-.resize_visual_font_size_14pt > span,
-.resize_visual_font_size_14pt > strong > em,
-.resize_visual_font_size_14pt > em > strong,
-.visual_font_size_14pt em span,
-.visual_font_size_14pt span em {
-  font-size: 7pt !important;
-  line-height: 7pt;
-}
-.resize_visual_font_size_24pt,
-.resize_visual_font_size_24pt > em,
-.resize_visual_font_size_24pt > strong,
-.resize_visual_font_size_24pt > strong > span,
-.resize_visual_font_size_24pt > span,
-.resize_visual_font_size_24pt > strong > em,
-.resize_visual_font_size_24pt > em > strong,
-.visual_font_size_14pt em span,
-.visual_font_size_14pt span em {
-  font-size: 12pt !important;
-  line-height: 12pt;
-}
-.resize_visual_font_size_36pt,
-.resize_visual_font_size_36pt > em,
-.resize_visual_font_size_36pt > strong,
-.resize_visual_font_size_36pt > strong > span,
-.resize_visual_font_size_36pt > span,
-.resize_visual_font_size_36pt > strong > em,
-.resize_visual_font_size_36pt > em > strong,
-.visual_font_size_36pt em span,
-.visual_font_size_36pt span em {
-  font-size: 18pt !important;
-  line-height: 18pt;
-}
-.resize_visual_font_size_72pt,
-.resize_visual_font_size_72pt > em,
-.resize_visual_font_size_72pt > strong,
-.resize_visual_font_size_72pt > strong > span,
-.resize_visual_font_size_72pt > span,
-.resize_visual_font_size_72pt > strong > em,
-.resize_visual_font_size_72pt > em > strong,
-.visual_font_size_72pt em span,
-.visual_font_size_72pt span em {
-  font-size: 36pt !important;
-  line-height: 36pt;
-}
-
-/*SIDEBAR*/
-.menu_sidebar {
-  color: #111;
-  background: #3f3f3f;
-
-  margin-left: 10px;
-  padding-left: 0px;
-  padding-right: 0px;
-  padding-top: 10px;
-  text-align: left;
-  font-family: arial, sans-serif, verdana;
-  font-size: 10px;
-  border: 1px solid #000;
-  position: absolute;
-  margin: 0;
-  width: 400px;
-  height: 260px;
-
-  -moz-box-shadow: 0px 4px 4px #010e1b !important;
-  -webkit-box-shadow: 0px 4px 4px #010e1b !important;
-  box-shadow: 0px 4px 4px #010e1b !important;
-
-  filter: alpha(opacity=97);
-  -moz-opacity: 0.97;
-  opacity: 0.97;
-}
-
-.menu_sidebar_radius_left {
-  -moz-border-top-left-radius: 8px;
-  -webkit-border-top-left-radius: 8px;
-  border-top-left-radius: 8px;
-
-  -moz-border-bottom-left-radius: 8px;
-  -webkit-border-bottom-left-radius: 8px;
-  border-bottom-left-radius: 8px;
-
-  border-right: 0px solid #000;
-}
-
-.menu_sidebar_radius_right {
-  -moz-border-top-right-radius: 8px;
-  -webkit-border-top-right-radius: 8px;
-  border-top-right-radius: 8px;
-  -moz-border-bottom-right-radius: 8px;
-  -webkit-border-bottom-right-radius: 8px;
-  border-bottom-right-radius: 8px;
-}
-
-.menu_sidebar_outer {
-  margin-left: 3px;
-  background: #ececec;
-  width: 100%;
-  text-align: center;
-  -moz-border-radius: 6px;
-  -webkit-border-radius: 6px;
-  border-radius: 6px;
-  padding: 8px;
-}
-
-/*Groupsview*/
-
-.groupsview {
-  border-spacing: 0px 4px;
-}
-
-.groupsview tr {
-  background-color: #666;
-}
-
-.groupsview th {
-  font-size: 12px;
-  padding: 5px;
-}
-
-.groupsview td.first,
-.groupsview th.first {
-  -moz-border-top-left-radius: 10px;
-  -webkit-border-top-left-radius: 10px;
-  border-top-left-radius: 10px;
-
-  -moz-border-bottom-left-radius: 10px;
-  -webkit-border-bottom-left-radius: 10px;
-  border-bottom-left-radius: 10px;
-}
-
-.groupsview td.last,
-.groupsview th.last {
-  -moz-border-top-right-radius: 10px;
-  -webkit-border-top-right-radius: 10px;
-  border-top-right-radius: 10px;
-  -moz-border-bottom-right-radius: 10px;
-  -webkit-border-bottom-right-radius: 10px;
-  border-bottom-right-radius: 10px;
-}
-
-a.tip {
-  display: inline !important;
-  cursor: help;
-}
-
-a.tip > img {
-  margin-left: 2px;
-  margin-right: 2px;
-}
-
-input.search_input {
-  background: white url("../../images/input_zoom.png") no-repeat right;
-  padding: 0px;
-  padding-left: 5px;
-  margin: 0;
-  width: 80%;
-  height: 19px;
-  margin-bottom: 5px;
-  margin-left: 2px;
-  padding-right: 25px;
-  color: #999;
-}
-
-.vertical_fields td input,
-.vertical_fields td select {
-  margin-top: 8px !important;
-}
-
-a[id^="tgl_ctrl_"] > img,
-a[id^="tgl_ctrl_"] > b > img {
-  vertical-align: middle;
-}
-
-.noshadow {
-  -moz-box-shadow: 0px !important;
-  -webkit-box-shadow: 0px !important;
-  box-shadow: 0px !important;
-}
-
-/* Images forced title */
-
-div.forced_title_layer {
-  display: block;
-  text-decoration: none;
-  position: absolute;
-  z-index: 100000;
-  border: 1px solid #708090;
-  background-color: #666;
+select,
+.edit_user_comments #textarea_comments,
+.discovery_textarea_input {
+  background-color: #111;
   color: #fff;
-  padding: 4px 5px;
-  font-weight: bold;
-  font-size: small;
-  font-size: 11px;
-  /* IE 8 */
-  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=9)";
-  /* Netscape */
-  -moz-opacity: 0.9;
-  opacity: 0.9;
-  -moz-border-radius: 3px;
-  -webkit-border-radius: 3px;
-  border-radius: 3px;
-}
-
-/* Graphs styles */
-
-div.legend > div {
-  pointer-events: none; /* Allow to click the graphs below */
-  opacity: 0.65 !important;
-}
-
-div.nodata_text {
-  padding: 5px 12px 0px 68px;
-  font-weight: bold;
-  color: #c1c1c1;
-  text-transform: uppercase;
-  display: table-cell;
-  vertical-align: middle;
-  text-align: left;
-}
-
-div.nodata_container {
-  width: 150px;
-  height: 100px;
-  background-repeat: no-repeat;
-  background-position: center;
-  margin: auto auto;
-  display: table;
-}
-
-#snmp_data {
-  width: 40%;
-  position: absolute;
-  top: 0;
-  right: 20px;
-
-  #background-color: #5b5b5b;
-  #padding: 10px;
-}
-
-#rmf_data {
-  width: 40%;
-  height: 80%;
-  position: absolute;
-  top: 0;
-  right: 20px;
-  overflow: auto;
-
-  #background-color: #5b5b5b;
-  #padding: 10px;
-}
-
-/* Subtab styles */
-
-ul.subsubmenu {
-  border-bottom-right-radius: 5px;
-  border-bottom-left-radius: 5px;
-  -moz-border-bottom-right-radius: 5px;
-  -moz-border-bottom-left-radius: 5px;
-  -webkit-border-bottom-right-radius: 5px;
-  -webkit-border-bottom-left-radius: 5px;
-
-  background: #ececec !important;
-}
-
-ul.subsubmenu li {
-  background-color: #ececec;
-  font-weight: bold;
-  text-decoration: none;
-  font-size: 14px;
-  border-color: #e2e2e2;
-  border-style: solid;
-  border-width: 1px;
-}
-
-ul.subsubmenu li a {
-  padding: 0px 10px 5px;
-}
-
-div#agent_wizard_subtabs {
-  position: absolute;
-  margin-left: 0px;
-  display: none;
-  padding-bottom: 3px;
-  z-index: 1000;
-}
-
-.agent_wizard_tab:hover {
-  cursor: default;
-}
-
-#container_servicemap_legend {
-  position: absolute;
-  width: 200px;
-  background: #5b5b5b;
-  margin-top: 10px;
-  right: 2px;
-  border: 1px solid #e2e2e2;
-  border-radius: 5px;
-  padding: 10px;
-  opacity: 0.9;
-}
-
-#container_servicemap_legend table {
-  text-align: left;
-}
-
-.legend_square {
-  width: 20px;
-  padding-left: 20px;
-  padding-right: 10px;
-}
-
-.legend_square_simple {
-  padding-left: 0px;
-  padding-right: 10px;
-  padding-bottom: 3px;
-}
-.legend_square div,
-.legend_square_simple div {
-  width: 20px;
-  height: 20px;
-  border-radius: 3px;
-}
-
-.legend_basic {
-  background: #f4f4f4;
-  margin-top: 10px;
-  border-radius: 5px;
-  padding: 10px;
-}
-
-.agents_modules_table th {
-  background: #3f3f3f;
-}
-
-.agents_modules_table th * {
-  color: #ffffff;
-}
-
-/*
- * LOAD_ENTERPRISE.PHP
- */
-#code_license_dialog {
-  padding: 50px;
-  padding-top: 10px;
-}
-#code_license_dialog #logo {
-  margin-bottom: 20px;
-  text-align: center;
-}
-#code_license_dialog,
-#code_license_dialog * {
-  font-size: 14px;
-}
-#code_license_dialog ul {
-  padding-left: 30px;
-  list-style-image: url("../../images/input_tick.png");
-}
-#code_license_dialog li {
-  margin-bottom: 12px;
-}
-
-#code_license_dialog #code {
-  font-weight: bolder;
-  font-size: 20px;
-  border: 1px solid #dddddd;
-  padding: 5px;
-  text-align: center;
-  -moz-border-radius: 8px;
-  -webkit-border-radius: 8px;
-  border-radius: 8px;
-}
-
-#code_license_dialog a {
-  text-decoration: underline;
-}
-
-/* GRAPHS CSS */
-
-.parent_graph {
-  position: relative;
-}
-
-.menu_graph,
-.timestamp_graph {
-  position: absolute !important;
-}
-
-.menu_graph {
-  -moz-border-top-right-radius: 6px;
-  -webkit-border-top-right-radius: 6px;
-  border-top-right-radius: 6px;
-  -moz-border-top-left-radius: 6px;
-  -webkit-border-top-left-radius: 6px;
-  border-top-left-radius: 6px;
-}
-
-.legend_graph {
-  margin: 0px;
-  padding: 0px;
-  text-align: left;
-}
-
-.legendColorBox * {
-  font-size: 0px;
-  padding: 0px 4px;
-  overflow: visible !important;
-}
-
-/* GIS CSS */
-
-.olLayerDiv {
-  z-index: 102 !important;
-}
-
-/* Alert view */
-
-table.alert_days th,
-table.alert_time th {
-  height: 30px;
-  vertical-align: middle;
-}
-
-table.alert_escalation th img {
-  width: 18px;
-}
-
-td.used_field {
-  #border: solid #6eb432;
-  background: #6eb432 !important;
-  color: #ffffff;
-  font-weight: bold;
-}
-
-td.overrided_field {
-  color: #666;
-}
-
-td.unused_field {
-  color: #888;
-}
-
-td.empty_field {
-  background: url("../../images/long_arrow.png") no-repeat 100% center;
-}
-
-#table_macros textarea {
-  width: 96%;
-}
-
-/* Policies styles */
-
-table#policy_modules td * {
-  display: inline;
-}
-
-.context_help_title {
-  font-weight: bolder;
-  text-align: left;
-}
-.context_help_body {
-  text-align: left;
-}
-
-#left_column_logon_ok {
-  width: 750px;
-  float: left;
-}
-
-#news_board {
-  min-width: 530px;
-}
-
-#right_column_logon_ok {
-  width: 350px;
-  float: right;
-  margin-right: 20px;
-}
-
-#clippy_head_title {
-  font-weight: bold;
-  background: #82b92e;
-  color: #ffffff;
-  margin-top: -15px;
-  margin-left: -15px;
-  margin-right: -15px;
-  padding: 5px;
-  margin-bottom: 10px;
-  border-top-left-radius: 2px;
-  border-top-right-radius: 2px;
-}
-
-.clippy_body {
-  color: black;
-}
-
-#dialog-double_auth-container {
-  width: 100%;
-  text-align: center;
-  vertical-align: middle;
-}
-
-.center_align {
-  text-align: center;
-}
-
-.left_align {
-  text-align: left;
-}
-
-.status_tactical {
-  width: 100%;
-  margin-left: auto;
-  margin-right: auto;
-  background-color: #5b5b5b !important;
-  padding: 10px;
-  border: 1px solid #e2e2e2;
-  margin-top: 5%;
-  text-align: left;
-}
-
-.status_tactical img {
-  border: 3px solid #000;
-  border-radius: 100px;
-}
-
-#sumary {
-  color: #fff;
-  margin: 15px;
-  padding: 10px 30px;
-  font-size: 20px;
-  font-weight: bold;
-  height: 66px;
-  width: 191px;
-  border-radius: 2px;
-}
-
-.databox.data td {
-  border-bottom: 1px solid #e2e2e2;
-}
-
-.databox .search {
-  margin-top: 0px;
-}
-
-.databox.data td.progress_bar img {
-  border: 3px solid #000;
-  border-radius: 100px;
-}
-
-.databox td {
-  padding-left: 9px;
-  padding-right: 9px;
-  padding-top: 7px;
-  padding-bottom: 7px;
-}
-.databox.pies fieldset.tactical_set {
-  width: 70% !important;
-  height: 285px;
-}
-
-.difference {
-  border-left-width: 2px;
-  border-left-style: solid;
-  border-right-width: 2px;
-  border-right-style: solid;
-  border-color: #e2e2e2;
-}
-
-#title_menu {
-  color: #fff;
-  float: right;
-  width: 70%;
-  letter-spacing: 0pt;
-  font-size: 8pt;
-  white-space: pre-wrap;
-}
-
-.no_hidden_menu {
-  background-position: 11% 50% !important;
-}
-
-#menu_tab li.nomn,
-#menu_tab li.nomn_high {
-  background-color: #ececec;
-  padding-right: 3px;
-  padding-left: 3px;
-  font-weight: bold;
-  text-decoration: none;
-  font-size: 14px;
-  border-color: #e2e2e2;
-  border-style: solid;
-  border-width: 1px;
-  margin-top: -10px;
 }
 
+div#head,
 #menu_tab li.nomn_high,
-#menu_tab li.nomn_high span {
+#menu_tab li.nomn_high span,
+.info_box,
+.white_table_graph_header,
+.white-box-content,
+fieldset,
+.databox.filters,
+table.databox,
+.legend_basic,
+.databox_color,
+.white_box {
+  background-color: #222 !important;
   color: #fff;
-  background-color: #5b5b5b;
 }
 
+input[readonly] {
+  background-color: #444 !important;
+  color: #a2a2a2 !important;
+}
+
+.box-shadow {
+  box-shadow: none;
+}
+
+select:disabled,
+textarea:disabled {
+  background-color: #666;
+}
+
+.status_tactical,
+.tactical_set,
+.td-bg-white td,
+#top_btn:hover {
+  background-color: transparent;
+}
+
+.agent_details_col,
+.white_table,
+.white_table tr:first-child > th,
+.white_table_graph_content {
+  background-color: #222;
+  color: #fff;
+}
+
+.notify,
+.notify h3 {
+  color: #000;
+}
+
+.sort_arrow img {
+  filter: brightness(2.5) contrast(3.5);
+}
+
+table.widget_list tr.datos,
+table.widget_list tr.datos2,
+table.widget_list td.datos,
+table.widget_list td.datos2 {
+  background-color: inherit;
+}
+
+/* messages */
+.container {
+  background-color: #222;
+}
+
+.p-slider {
+  background-color: #888;
+}
+
+.fileupload_form {
+  background-color: #222 !important;
+}
+
+#drop_file {
+  background-color: #444 !important;
+  color: #fff !important;
+}
+
+ol.steps li.current {
+  border-left: 5px solid #82b92e;
+  background-color: #545454;
+}
+
+ol.steps li {
+  background-color: #999;
+}
+
+ol.steps li.visited,
+ol.steps li.visited span,
+ol.steps li.visited a {
+  color: #eaeaea;
+}
+
+/* White text */
+a,
+#menu_tab_left li a,
+#menu_tab_left li span,
+fieldset legend,
+.tactical_set legend,
+#user-notifications-wrappe,
+#user_form *,
+h1,
+h2,
+h3,
+h4,
+.info_table > tbody > tr > th,
+.info_table > thead > tr > th,
+.info_table > thead > tr > th a,
+.info_table > thead > tr > th > span,
+form.discovery label,
+.edit_user_labels,
+.input_label,
+.pagination,
+tr.group_view_data,
+.group_view_data,
+ol.steps li span,
+ol.steps li a {
+  color: #fff;
+}
+
+/* Tabs icons change color */
 #menu_tab li.nomn img,
 #menu_tab li img {
-  margin-top: 3px;
-  margin-left: 3px;
+  filter: invert(100%);
 }
 
-#menu_tab li.tab_operation a,
-#menu_tab a.tab_operation {
-  background: none !important ;
-}
-
-.subsubmenu {
-  position: absolute;
-  float: right;
-  z-index: 9999;
-  display: none;
-  margin-top: 6px !important ;
-  left: 0px !important;
-}
-.subsubmenu li {
-  margin-top: 0px !important ;
-}
-
-.agents_modules_table {
-  border: 1px solid #e2e2e2;
-  border-spacing: 0px;
-}
-.agents_modules_table td {
-  border: 1px solid #e2e2e2;
-}
-.agents_modules_table th {
-  border: 1px solid #e2e2e2;
-}
-
-.databox.filters,
-.databox.data,
-.databox.profile_list {
-  margin-bottom: 20px;
-}
-
-.databox.filters td {
-  padding: 10px;
-  padding-left: 20px;
-}
-.databox.profile_list td {
-  padding: 4px 1px;
-  padding-left: 5px;
-  border-bottom: 1px solid #e2e2e2;
-}
-.databox.profile_list a.tip > img {
-  margin: 0px;
-}
-
-.databox.filters td > img,
-.databox.filters td > div > a > img,
-.databox.filters td > span > img,
-.databox.filters td > span > a > img,
-.databox.filters td > a > img {
-  vertical-align: middle;
-  margin-left: 5px;
-}
-.databox.data td > img,
-.databox.data th > img,
-.databox.data td > div > a > img,
-.databox.data td > span > img,
-.databox.data td > span > a > img,
-.databox.data td > a > img,
-.databox.data td > form > a > img {
-  vertical-align: middle;
-}
-
-.databox.filters td > a > img {
-  vertical-align: middle;
-}
-
-.databox.data td > input[type="checkbox"] {
-  margin: 0px;
-}
-
-.databox_color td {
-  padding-left: 10px;
-}
-
-.databox.agente td > div > canvas {
-  width: 100% !important;
-  text-align: left !important;
-}
-.databox.agente td > div.graph {
-  width: 100% !important;
-  text-align: left !important;
+/* menu.css */
+.operation {
+  background-color: #252525;
 }
 
 .godmode,
-.menu_icon ul li {
+#menu_full {
+  background-color: #1a1a1a;
+}
+
+.button_collapse {
+  background-color: #444;
+}
+
+.operation .selected,
+.godmode .selected,
+.menu_icon:hover {
+  background-color: #080808;
+}
+
+.sub_subMenu {
+  background-color: #343434;
+}
+
+/* footer */
+div#foot {
+  background: #222;
+}
+
+/* Overwrite inline styles */
+.textodialogo td {
+  color: #fff !important;
+}
+
+/* snmp */
+#snmp_browser {
+  background-color: #222 !important;
+}
+
+/* events.css */
+table.table_modal_alternate tr:nth-child(odd) td {
   background-color: #222;
 }
-.operation .menu_icon ul li {
-  background-color: #333;
+
+table.table_modal_alternate tr:nth-child(even) td {
+  background-color: #111;
 }
 
-.godmode {
-  border-top: 4px solid !important;
-  padding-bottom: 4px !important;
-  border-bottom-right-radius: 5px;
-  border-right-style: solid;
-  border-right-width: 0px;
+/* tables.css */
+.info_table {
+  background-color: #222;
 }
 
-.green_title {
-  background-color: #82b92e;
-  font-weight: normal;
-  text-align: center;
+.info_table > tbody > tr:nth-child(even) {
+  background-color: #111;
 }
 
-.dashboard {
-  top: 23px;
-}
-
-.dashboard li a {
-  width: 158px !important;
-}
-
-.text_subDashboard {
-  float: left;
-  margin-top: 5%;
-  margin-left: 3%;
-}
-
-/* The items with the class 'spinner' will rotate */
-/* Not supported on IE9 and below */
-.spinner {
-  -webkit-animation: spinner 2s infinite linear;
-  animation: spinner 2s infinite linear;
-}
-
-@-webkit-keyframes spinner {
-  0% {
-    -ms-transform: rotate(0deg); /* IE */
-    -moz-transform: rotate(0deg); /* FF */
-    -o-transform: rotate(0deg); /* Opera */
-    -webkit-transform: rotate(0deg); /* Safari and Chrome */
-    transform: rotate(0deg);
-  }
-  100% {
-    -ms-transform: rotate(359deg); /* IE */
-    -moz-transform: rotate(359deg); /* FF */
-    -o-transform: rotate(359deg); /* Opera */
-    -webkit-transform: rotate(359deg); /* Safari and Chrome */
-    transform: rotate(359deg);
-  }
-}
-
-@keyframes spinner {
-  0% {
-    -ms-transform: rotate(0deg); /* IE */
-    -moz-transform: rotate(0deg); /* FF */
-    -o-transform: rotate(0deg); /* Opera */
-    -webkit-transform: rotate(0deg); /* Safari and Chrome */
-    transform: rotate(0deg);
-  }
-  100% {
-    -ms-transform: rotate(359deg); /* IE */
-    -moz-transform: rotate(359deg); /* FF */
-    -o-transform: rotate(359deg); /* Opera */
-    -webkit-transform: rotate(359deg); /* Safari and Chrome */
-    transform: rotate(359deg);
-  }
-}
-
-#alert_messages {
-  -moz-border-bottom-right-radius: 5px;
-  -webkit-border-bottom-left-radius: 5px;
-  border-bottom-right-radius: 5px;
-  border-bottom-left-radius: 5px;
-  z-index: 3;
-  position: fixed;
-  width: 750px;
-  max-width: 750px;
-  min-width: 750px;
-  top: 20%;
-  background: white;
-}
-.modalheader {
-  text-align: center;
-  width: 100%;
-  height: 37px;
-  left: 0px;
-  background-color: #82b92e;
-}
-.modalheadertext {
-  color: white;
-  position: relative;
-  font-family: Nunito;
-  font-size: 13pt;
-  top: 8px;
-}
-.modalclosex {
-  cursor: pointer;
-  display: inline;
-  float: right;
-  margin-right: 10px;
-  margin-top: 10px;
-}
-.modalcontent {
-  color: black;
-  background: white;
-}
-.modalcontentimg {
-  float: left;
-  margin-left: 30px;
-  margin-top: 30px;
-  margin-bottom: 30px;
-}
-.modalcontenttext {
-  float: left;
-  text-align: justify;
-  color: #666;
-  font-size: 9.5pt;
-  line-height: 13pt;
-  margin-top: 30px;
-  width: 430px;
-  margin-left: 30px;
-}
-
-.modalcontenttext > p {
-  color: black;
-}
-.modalcontenttext > p > a {
-  color: black;
-}
-
-.modalokbutton {
-  transition-property: background-color, color;
-  transition-duration: 1s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color, color;
-  -webkit-transition-duration: 1s;
-  -o-transition-property: background-color, color;
-  -o-transition-duration: 1s;
-  cursor: pointer;
-  text-align: center;
-  margin-right: 45px;
-  float: right;
-  -moz-border-radius: 3px;
-  -webkit-border-radius: 3px;
-  margin-bottom: 30px;
-  border-radius: 3px;
-  width: 90px;
-  height: 30px;
-  background-color: white;
-  border: 1px solid #82b92e;
-}
-.modalokbuttontext {
-  transition-property: background-color, color;
-  transition-duration: 1s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color, color;
-  -webkit-transition-duration: 1s;
-  -o-transition-property: background-color, color;
-  -o-transition-duration: 1s;
-  color: #82b92e;
-  font-family: Nunito;
-  font-size: 10pt;
-  position: relative;
-  top: 6px;
-}
-
-.modalokbutton:hover {
-  transition-property: background-color, color;
-  transition-duration: 1s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color, color;
-  -webkit-transition-duration: 1s;
-  -o-transition-property: background-color, color;
-  -o-transition-duration: 1s;
-  background-color: #82b92e;
-}
-
-.modalokbutton:hover .modalokbuttontext {
-  transition-property: background-color, color;
-  transition-duration: 1s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color, color;
-  -webkit-transition-duration: 1s;
-  -o-transition-property: background-color, color;
-  -o-transition-duration: 1s;
-  color: white;
-}
-.modalgobutton {
-  transition-property: background-color, color;
-  transition-duration: 1s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color, color;
-  -webkit-transition-duration: 1s;
-  -o-transition-property: background-color, color;
-  -o-transition-duration: 1s;
-  cursor: pointer;
-  text-align: center;
-  margin-right: 15px;
-  margin-bottom: 30px;
-  float: right;
-  -moz-border-radius: 3px;
-  -webkit-border-radius: 3px;
-  border-radius: 3px;
-  width: 240px;
-  height: 30px;
-  background-color: white;
-  border: 1px solid #82b92e;
-}
-.modalgobuttontext {
-  transition-property: background-color, color;
-  transition-duration: 1s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color, color;
-  -webkit-transition-duration: 1s;
-  -o-transition-property: background-color, color;
-  -o-transition-duration: 1s;
-  color: #82b92e;
-  font-family: Nunito;
-  font-size: 10pt;
-  position: relative;
-  top: 6px;
-}
-
-.modalgobutton:hover {
-  transition-property: background-color, color;
-  transition-duration: 1s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color, color;
-  -webkit-transition-duration: 1s;
-  -o-transition-property: background-color, color;
-  -o-transition-duration: 1s;
-  background-color: #82b92e;
-}
-
-.modalgobutton:hover .modalgobuttontext {
-  transition-property: background-color, color;
-  transition-duration: 1s;
-  transition-timing-function: ease-out;
-  -webkit-transition-property: background-color, color;
-  -webkit-transition-duration: 1s;
-  -o-transition-property: background-color, color;
-  -o-transition-duration: 1s;
-  color: white;
-}
-
-#opacidad {
-  opacity: 0.5;
-  z-index: 1;
-  width: 100%;
-  height: 100%;
-  position: absolute;
-  left: 0px;
-  top: 0px;
-}
-
-.textodialogo {
-  margin-left: 0px;
-  color: black;
-  font-size: 9pt;
-}
-
-.cargatextodialogo {
-  max-width: 58.5%;
-  width: 58.5%;
-  min-width: 58.5%;
-  float: left;
-  margin-left: 0px;
-  font-size: 18pt;
-  padding: 20px;
-  text-align: center;
-}
-
-.cargatextodialogo b {
-  color: black;
-}
-.cargatextodialogo p {
-  color: black;
-}
-
-.cargatextodialogo b {
-  color: black;
-}
-.cargatextodialogo a {
-  color: black;
-}
-
-.cargatextodialogo > div {
-  color: black;
-}
-
-.cargatextodialogo p,
-.cargatextodialogo b,
-.cargatextodialogo a {
-  font-size: 18pt;
-}
-
-#toolbox > input {
-  border-width: 0px 1px 0px 0px;
-  border-color: lightgray;
-}
-
-#toolbox > input.service_min {
-  border-width: 0px 0px 0px 0px;
-}
-
-#toolbox > input.grid_min {
-  border-width: 0px 0px 0px 0px;
-}
-#tinymce {
-  padding-top: 20px;
+.info_table tr:first-child > th,
+.info_table th {
+  background-color: #222;
+  color: #fff;
 }
 
+.info_table > tbody > tr:hover,
+.databox.data > tbody > tr:hover,
+.checkselected,
 .rowPair:hover,
 .rowOdd:hover {
-  background-color: #6e6e6e;
-}
-.databox.data > tbody > tr:hover {
-  background-color: #6e6e6e;
-}
-.checkselected {
-  background-color: #eee;
+  background-color: #555 !important;
 }
 
-#login_help_dialog * {
-  color: #222222;
+.info_table .datos3,
+.datos3,
+.info_table .datos4,
+.datos4 {
+  background-color: #444;
+  color: #fff;
 }
 
-.introjs-tooltip * {
-  color: #222222;
+.action_buttons a[href] img,
+.action_buttons input[type="image"],
+.action_button_img {
+  filter: brightness(2.5) contrast(50%);
 }
 
-.dd_widget_content * {
-  color: #222222;
+/* firts_task.css */
+.new_task,
+div.new_task_cluster,
+div.new_task_cluster > div {
+  background-color: #222;
 }
 
-#dialog_add_new_widget * {
-  color: #222222;
+/* events.css */
+.filter_summary div {
+  background: transparent;
 }
 
-.widget_configuration_form table tbody tr td:first-child {
-  color: #222222;
+/* webchat */
+#chat_box,
+#userlist_box {
+  background: #222 !important;
 }
 
-.widget_configuration_form .container * {
-  color: #222222;
-}
-.widget_configuration_form b {
-  color: #222222;
+#chat_box > div span {
+  color: #fff !important;
 }
 
-form[action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list"]
-  * {
-  color: #222222;
+/* tree.css */
+.node-content:hover {
+  background-color: #222;
 }
 
-form[action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list"]
-  input {
-  color: white;
-}
-
-form[action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list"]
-  select {
-  color: white;
-}
-.notify {
-  color: black;
-}
-.notify * {
-  color: black;
-}
-#login_logout * {
-  color: #222222;
-}
-
-/*modal windows login*/
-div.content_alert {
-  width: 98%;
-  margin-top: 20px;
-}
-
-div.icon_message_alert {
-  float: left;
-  width: 25%;
-  text-align: center;
-}
-
-div.icon_message_alert img {
-  width: 85px;
-}
-
-div.content_message_alert {
-  width: 75%;
-  float: right;
-}
-
-div.content_message_alert * {
-  color: black;
-}
-
-div.text_message_alert {
-  width: 100%;
-  margin-top: 10px;
-}
-
-div.text_message_alert h1 {
-  margin: 0px;
-}
-
-div.text_message_alert p {
-  margin: 0px;
-  font-size: 10.3pt;
-  line-height: 14pt;
-}
-
-div.button_message_alert {
-  width: 100%;
-}
-
-div.button_message_alert input {
-  float: right;
-  width: 87px;
-  height: 33px;
-  color: #82b92e;
-  border: 1px solid #82b92e;
-  font-weight: bold;
-  margin-right: 20px;
-  margin-top: 20px;
-  font-size: 10pt;
-}
-
-div.form_message_alert {
-  width: 90%;
-  clear: both;
-  padding-top: 20px;
-  padding-left: 40px;
-}
-
-div.form_message_alert ul li {
-  display: inline-block;
-  padding: 10px;
-}
-
-div.form_message_alert ul li input {
-  border: none;
-  background-color: #dadada !important;
-  border-radius: 0px;
-  height: 17px;
-  width: 145px;
-  padding-left: 5px;
-}
-
-div.form_message_alert ul li label {
-  font-size: 10pt;
-  padding-right: 20px;
-}
-
-div.form_message_alert h4 {
-  margin: 0px;
-  margin-bottom: 10px;
-}
-
-div.button_message_alert_form input {
-  float: right;
-  width: 87px;
-  height: 33px;
-  color: #82b92e;
-  border: 1px solid #82b92e;
-  font-weight: bold;
-  font-size: 10pt;
-  margin-right: 25px;
-}
-
-.ui-dialog .ui-dialog-titlebar {
-  background-color: #82b92e !important;
-}
-
-/*
-	styles header login
-*/
-div#header_login {
-  width: 100%;
-  height: 65px;
-  background-color: rgba(255, 255, 255, 0.06);
-}
-
-div#icon_custom_pandora {
-  float: left;
-  margin-top: 5px;
-  margin-left: 4%;
-}
-
-div#list_icon_docs_support {
-  float: right;
-  margin-top: 8px;
-  margin-right: 4%;
-}
-
-div#list_icon_docs_support ul {
-  margin-top: 5px;
-}
-
-div#list_icon_docs_support ul li {
-  display: inline-block;
-  color: white;
-  vertical-align: middle;
-  margin-right: 5px;
-  font-size: 10pt;
-}
-
-li#li_margin_left {
-  margin-left: 30px;
-}
-
-/*
-	styles login form
-*/
-
-div.container_login {
-  margin-top: 10%;
-  margin-left: 5%;
-  margin-right: 5%;
-}
-
-div.login_page {
-  width: 35%;
-  min-height: 600px;
-  float: left;
-}
-
-div.login_page form {
-  border-right: 1px solid #868686;
-  padding-top: 30px;
-  padding-bottom: 50px;
-  min-width: 400px;
-  max-height: 600px;
-}
-
-div.login_logo_icon {
-  margin-bottom: 40px;
-  text-align: center;
-}
-
-div.login_logo_icon img {
-  margin: 0 auto;
-  width: 150px;
-}
-div.login_double_auth_code,
-div.login_nick,
-div.login_pass {
-  margin: 0 auto;
-  width: 70%;
-  height: 40px;
-  background-color: rgba(255, 255, 255, 0.2) !important;
-  margin-bottom: 25px;
-  min-width: 260px;
-}
-
-div.login_nick img,
-div.login_pass img {
-  vertical-align: middle;
-  margin: 3px;
+ul.tree-group
+  li.tree-node
+  div.node-content
+  img:not(.module-status):not(.agent-status):not(.agent-alerts-fired) {
+  filter: brightness(2);
 }
 
+/* login.css */
 div.login_nick input,
 div.login_pass input {
-  background-color: rgba(255, 255, 255, 0) !important;
-  border: 0px !important;
-  color: white !important;
-  border-radius: 0px;
-  width: 89%;
-  height: 40px;
-  font-size: 9pt;
-  padding: 0px !important;
+  background-color: #fff !important;
 }
 
-div.login_nick input:focus,
-div.login_pass input:focus {
-  outline: none;
+/* user edit */
+.edit_user_info_right input {
+  border-bottom: 1px solid #5f5f5f;
 }
 
-div.login_nick input:-webkit-autofill,
-div.login_nick input:-webkit-autofill:hover,
-div.login_nick input:-webkit-autofill:focus,
-div.login_nick input:-webkit-autofill:active,
-div.login_pass input:-webkit-autofill,
-div.login_pass input:-webkit-autofill:hover,
-div.login_pass input:-webkit-autofill:focus,
-div.login_pass input:-webkit-autofill:active {
-  transition: background-color 10000s ease-in-out 0s;
-  -webkit-box-shadow: 0 0 0px 0px transparent inset !important;
-  -webkit-text-fill-color: white !important;
+#user-notifications-wrapper {
+  color: #fff;
+}
+
+/* datatables */
+table.dataTable tbody tr {
+  background-color: #222;
+}
+
+table.dataTable span {
+  color: #fff;
+}
+
+/* diagnostic info */
+table#diagnostic_info {
+  background-color: #111 !important;
+}
+
+table#diagnostic_info th {
+  background-color: #444 !important;
+}
+
+table#diagnostic_info tbody td div {
+  background-color: #222 !important;
+}
+
+/* agent view */
+.buttons_agent_view {
+  filter: brightness(2.5);
+}
+
+/* jquery custom */
+.ui-dialog,
+.ui-widget-content {
+  background-color: #111;
+}
+.ui-widget-content,
+.ui-widget-content a {
+  color: #fff;
+}
+
+.ui-state-default,
+.ui-widget-content .ui-state-default,
+.ui-widget-header .ui-state-default {
+  background-color: #222;
+  color: #fff;
+}
+
+.ui-state-active,
+.ui-widget-content .ui-state-active,
+.ui-widget-header .ui-state-active {
+  background-color: #111;
+  color: #fff;
+}
+
+.ui-state-default a,
+.ui-state-default a:link,
+.ui-state-default a:visited,
+a.ui-button,
+a:link.ui-button,
+a:visited.ui-button,
+.ui-button {
+  color: #fff;
+}
+
+ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header
+  img {
+  filter: brightness(2);
+}
+
+/* notifications */
+#notification-wrapper::before {
+  border-bottom-color: #111;
+}
+
+#notification-wrapper {
+  background: #111;
+}
+
+.notification-item {
+  background: #222;
+}
+
+.notification-subtitle {
+  color: #fff;
+}
+
+/* update_manager.css */
+div#box_online * {
+  color: #000;
+}
+
+/* discovery.css */
+#text_wizard {
+  color: #555;
+}
+
+div#code_license_dialog div#code,
+div#form_activate_licence #code {
+  margin-top: 20px;
+  margin-bottom: 20px;
   border: 0px;
-  width: 89%;
-}
-
-div.login_nick input::-webkit-input-placeholder,
-div.login_pass input::-webkit-input-placeholder {
-  color: white;
-}
-
-div.login_pass img,
-div.login_nick img {
-  width: 30px;
-}
-
-div.login_pass div,
-div.login_nick div {
-  float: left;
-  width: 11%;
-}
-
-div.login_button {
-  margin: 0 auto;
-  width: 70%;
-  height: 40px;
-  background-color: rgb(25, 25, 25);
-  border: 1px solid white;
-  min-width: 260px;
-}
-
-div.login_button input {
-  width: 100%;
-  background-color: rgb(25, 25, 25) !important;
-  text-align: center;
-  border: 0px;
-  border-radius: 0px;
-  height: 40px;
-  padding: 0px;
-  font-size: 9pt;
-  color: white;
-}
-
-div.login_data {
-  width: 65%;
-  min-height: 600px;
-  float: left;
-}
-
-div.text_banner_login {
-  width: 100%;
-  margin-bottom: 60px;
-  color: white;
-  text-align: center;
-}
-
-div.text_banner_login span {
-  width: 100%;
-}
-
-span.span1 {
-  font-size: 3vw;
-  font-family: "lato-thin";
-  color: white;
-}
-
-span.span2 {
-  font-size: 3vw;
-  font-family: "lato-bolder";
-  color: white;
-}
-
-div.img_banner_login {
-  width: 100%;
-  text-align: center;
-}
-
-div.img_banner_login img {
-  max-width: 70%;
-  min-width: 70%;
-  max-height: 50%;
-  min-height: 50%;
-}
-
-@media all and (max-width: 1200px) {
-  span.span1 {
-    font-size: 30pt;
-  }
-  span.span2 {
-    font-size: 30pt;
-  }
-}
-
-.new_task p,
-.new_task h3,
-.new_task h2,
-.new_task a,
-.new_task strong {
-  color: #222222;
-}
-.item p {
-  color: #222222;
-}
-
-.item span {
-  color: #222222;
-}
-
-.widget_config_advice,
-.widget_config_advice * {
-  color: black;
+  background-color: #222;
 }
diff --git a/pandora_console/include/styles/pandora_forms.css b/pandora_console/include/styles/pandora_forms.css
index e104a22fca..845f0a954a 100644
--- a/pandora_console/include/styles/pandora_forms.css
+++ b/pandora_console/include/styles/pandora_forms.css
@@ -71,7 +71,7 @@ td.scwWeekNumberHead {
 }
 
 td.scwWeek {
-  color: #000 !important;
+  color: #000;
 }
 
 /* Today selector */
@@ -90,5 +90,5 @@ tfoot.scwFoot {
 }
 
 .scwFoot :hover {
-  color: #ffa500 !important;
+  color: #ffa500;
 }
diff --git a/pandora_console/include/styles/pandora_green_old.css b/pandora_console/include/styles/pandora_green_old.css
index c27229aeb2..4b5c875f83 100644
--- a/pandora_console/include/styles/pandora_green_old.css
+++ b/pandora_console/include/styles/pandora_green_old.css
@@ -6,7 +6,7 @@ Description: The default Pandora FMS theme layout
 
 // Pandora FMS - http://pandorafms.com
 // ==========================================================
-// Copyright (c) 2004-2011 Artica Soluciones Tecnológicas S.L
+// Copyright (c) 2004-2019 Artica Soluciones Tecnológicas S.L
 
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License
@@ -21,3771 +21,165 @@ Description: The default Pandora FMS theme layout
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
 
-/* Tree view styles */
-@import url(tree.css);
-
-* {
-  font-family: verdana, sans-serif;
-  letter-spacing: 0.03pt;
-  font-size: 8pt;
-  color: #3f3f3f;
-}
-svg * {
-  font-size: 11pt;
-}
-body {
-  background-color: #fff;
-  margin: 0 auto;
-}
-
-div#page {
-  background: #fff;
-  background-image: none;
-}
-
-body.pure {
+/* menu.css */
+.operation,
+#menu_full,
+.godmode,
+.operation .menu_icon ul.submenu > li,
+.godmode .menu_icon ul.submenu > li,
+.sub_subMenu {
   background-color: #fff;
 }
-input,
-textarea {
-  border: 1px solid #ddd;
-}
 
-textarea {
-  padding: 5px;
-  min-height: 100px;
-  width: 99%;
-}
-textarea.conf_editor {
-  padding: 5px;
-  width: 650px;
-  height: 350px;
-}
-textarea.conf_error {
-  background-image: url(../../images/err.png);
-  background-repeat: no-repeat;
-  background-position: top right;
-}
-input {
-  padding: 2px 3px 4px 3px;
-  vertical-align: middle;
-}
-
-input[type="checkbox"] {
-  display: inline !important;
-}
-
-select {
-  padding: 2px 3px 3px 3px;
-  vertical-align: middle;
-}
-input.button {
-  font-family: Arial, Sans-serif;
-  border: 4px solid #ccc;
-  background: #fff;
-  padding: 2px 3px;
-  margin: 10px 15px;
-}
-
-input[type="submit"],
-input[type="button"] {
-  cursor: pointer;
-}
-
-select {
-  border: 1px solid #ddd;
-}
-checkbox {
-  padding: 4px;
-  border: 1px solid #eee;
-}
-h1,
-h2,
-h3,
-h4 {
-  font-weight: bold;
-  font-size: 1em;
-  font-family: Arial, Sans-serif;
-  text-transform: uppercase;
-  color: #3f3f3f;
-  padding-bottom: 4px;
-  padding-top: 7px;
-}
-h1 {
-  font-size: 16px;
-}
-h2 {
-  font-size: 15px;
-}
-h3 {
-  font-size: 14px;
-}
-h4 {
-  margin-bottom: 10px;
-  font-size: 13px;
-  color: #3f3f3f;
-  text-transform: none;
-}
-a {
-  color: #3f3f3f;
-  text-decoration: none;
-}
-a:hover {
-  color: #373737;
-  text-decoration: underline;
-}
-a.white_bold {
-  color: #eee;
-  text-decoration: none;
-  font-weight: bold;
-}
-a.white {
-  color: #eee;
-  text-decoration: none;
-}
-p.center {
-  text-align: center;
-}
-h1#log_title {
-  font-size: 18px;
-  margin-bottom: 0px;
-  color: #fff !important;
-  width: 300px;
-}
-div#log_msg {
-  display: none;
-}
-div#error_buttons {
-  margin-top: 20px;
-}
-div#error_buttons a {
-  margin: 14px;
-}
-
-#noaccess {
-  position: relative;
-  margin-top: 25px;
-  left: 15px;
-  padding-top: 5px;
-  background-color: #ffffff;
-  border-top-left-radius: 2px;
-  border-top-right-radius: 2px;
-  border-bottom-left-radius: 2px;
-  border-bottom-right-radius: 2px;
-}
-
-#noaccess-title {
+.operation .selected,
+.operation .menu_icon:hover,
+.godmode .selected,
+.godmode .menu_icon:hover,
+.godmode .submenu_not_selected:hover,
+.godmode .submenu_selected:hover,
+.operation .sub_subMenu:hover,
+.operation .menu_icon ul.submenu > li:hover,
+.godmode .menu_icon ul.submenu > li:hover {
+  background-color: #343434 !important;
   color: #fff;
-  font-weight: bold;
-  padding-top: 5px;
-  margin-left: 5px;
-  background: none repeat scroll 0% 0% #80ab51;
-  border-top-left-radius: 2px;
-  border-top-right-radius: 2px;
-  border-bottom-left-radius: 2px;
-  border-bottom-right-radius: 2px;
-  text-align: center;
-}
-
-#noaccess-text {
-  font-size: 12px;
-  text-align: justify;
-  padding-top: 25px;
-  padding-right: 50px;
-  float: right;
-}
-
-#noaccess-image {
-  position: relative;
-  left: 10px;
-  top: 10px;
-  float: left;
-}
-
-div#activity {
-  padding-top: 0px;
-  padding-bottom: 18px;
-}
-div#noa {
-  float: right;
-  padding-right: 50px;
-  margin-top: 25px;
-}
-div#db_f {
-  text-align: justify;
-  margin: auto;
-  padding: 0.5em;
-  width: 55em;
-  margin-top: 3em;
-}
-div#db_ftxt {
-  float: right;
-  padding-top: 10px;
-}
-div#container {
-  margin: 0 auto;
-  min-width: 960px;
-  text-align: left;
-  #border-left: solid 2px #000;
-  #border-right: solid 2px #000;
-  #border-top: solid 2px #000;
-  #margin-top: 5px;
-  height: 100%;
-  background: #fff;
-}
-div#page {
-  width: 960px;
-  clear: both;
-}
-div#main {
-  width: auto;
-  margin: 0px 2% 0px 0%;
-  float: right;
-  position: relative;
-  min-height: 850px;
-}
-div#main_help {
-  width: 100%;
-  padding-left: 0px;
-  padding-top: 0px;
-  background-color: #ffffff;
-  margin-top: 0px;
-  margin-left: 0px;
-  margin-right: 0px;
-  border-radius: 10px;
-}
-div#main_help div.databox,
-.license_databox {
-  background: F3F3F3;
-  -moz-border-radius: 8px;
-  -webkit-border-radius: 8px;
-  border-radius: 8px;
-  border: 0px;
-  padding-left: 25px;
-  padding-right: 25px;
-  margin-top: 10px;
-  -moz-box-shadow: -1px 1px 6px #aaa;
-  -webkit-box-shadow: -1px 1px 6px #aaa;
-  box-shadow: -1px 1px 6px #aaa;
-}
-
-div#main_help div.databox h1 {
-  padding-bottom: 0px;
-  margin-bottom: 0px;
-  font-weight: bold;
-  font-family: sans-serif, verdana;
-}
-
-div#main_help div.databox h3,
-div#main_help div.databox h2 {
-  color: #6eb432;
-  font-family: sans-serif, verdana;
-}
-
-div#main_help div.databox h3 {
-  font-size: 12px;
-}
-
-div#main_help a.footer,
-div#main_help span {
-  color: #999;
-}
-
-a.footer,
-a.footer span {
-  font-size: 9px;
-  color: white;
-}
-
-div#main_help div.databox hr {
-  width: 100%;
-  border: 0px;
-  height: 1px;
-  background-color: #222;
-  margin: 0px;
-}
-
-div#main_help div.databox p {
-  line-height: 15px;
-  text-align: justify;
-}
-
-div#menu_container {
-  -moz-border-top-right-radius: 6px;
-  -webkit-border-top-right-radius: 6px;
-  border-top-right-radius: 6px;
-  z-index: 1010;
-  width: 40px;
-  height: 100%;
-}
-
-div#menu {
-  width: 45px;
-  float: left;
-  z-index: 2000;
-  position: absolute;
-}
-
-div#head {
-  font-size: 8pt;
-  width: 100%;
-  height: 60px;
-  padding-top: 0px;
-  margin-bottom: 20px;
-  border-bottom-style: solid;
-  border-bottom-width: 3px;
-  border-color: #80ab51;
-  min-width: 882px;
-  background-color: #333;
-  color: white;
-  background-image: url("../../images/header.jpg");
-}
-
-.fixed_header {
-  z-index: 9999;
-  position: fixed;
-  left: 0;
-  top: 0;
-  width: 100%;
-}
-
-div#foot {
-  font-size: 6pt !important;
-  border-top: solid 2px #222;
-  padding-top: 8px;
-  padding-bottom: 5px;
-  text-align: center;
-  background: #333333;
-  height: 30px;
-  clear: both;
-  width: auto;
-}
-#ver {
-  margin-bottom: 25px;
-}
-
-/****************/
-/* LOGIN STYLES */
-/****************/
-
-@font-face {
-  font-family: "Nunito";
-  font-style: normal;
-  font-weight: 400;
-  src: local("Nunito-Regular"), url(../../fonts/nunito.woff) format("woff");
-}
-
-@font-face {
-  font-family: "roboto";
-  src: url("../../fonts/roboto.woff2") format("woff2");
-}
-
-@font-face {
-  font-family: "opensans";
-  src: url("../../fonts/opensans.woff2") format("woff2");
-}
-
-@font-face {
-  font-family: "lato";
-  src: url("../../fonts/lato.woff2") format("woff2");
-}
-
-@font-face {
-  font-family: "leaguegothic";
-  src: url("../../fonts/leaguegothic.woff") format("woff");
-}
-
-#login_body {
-  /* Set rules to fill background */
-  min-height: 100%;
-  min-width: 1024px;
-  width: 100%;
-  z-index: -9999;
-  position: absolute;
-}
-
-@media screen and (max-width: 1024px) {
-  /* Specific to this particular image */
-  #login_body {
-    left: 50%;
-    margin-left: -512px; /* 50% */
-  }
-}
-@media screen and (max-width: 1100px) {
-  /* Specific to this particular image */
-  #login_body {
-    background-image: url("../../images/backgrounds/fondo_madera_bn_1100.jpg");
-    background-repeat: repeat;
-    background-position: center center;
-  }
-}
-@media screen and (max-width: 1400px) {
-  /* Specific to this particular image */
-  #login_body {
-    background-image: url("../../images/backgrounds/fondo_madera_bn_1400.jpg");
-    background-repeat: repeat;
-    background-position: center center;
-  }
-}
-@media screen and (max-width: 2000px) {
-  /* Specific to this particular image */
-  #login_body {
-    background-image: url("../../images/backgrounds/fondo_madera_bn_2000.jpg");
-    background-repeat: repeat;
-    background-position: center center;
-  }
-}
-@media screen and (min-width: 2000px) {
-  /* Specific to this particular image */
-  #login_body {
-    background-image: url("../../images/backgrounds/fondo_madera_bn_2500.jpg");
-    background-repeat: repeat;
-    background-position: center center;
-  }
-}
-
-p.log_in {
-  color: #fff !important;
-  padding: 0px 10px;
-  width: 300px;
-}
-h1#log_f {
-  color: #c00;
-  border-bottom: 1px solid #c00;
-  padding-bottom: 3px;
-}
-div#login {
-  border-width: 2px 2px 2px 2px;
-  border-style: solid;
-  border-color: #000;
-  font-size: 12px !important;
-}
-div#login_in,
-#login_f {
-  /*margin: 0 auto 0 140px;
-	width: 400px;*/
-}
-
-.databox_login,
-.databox_logout {
-  border-radius: 5px;
-  height: 200px;
-}
-
-#login_inner {
-  width: 100%;
-  height: 100%;
-  border-radius: 5px;
-  /* Browser without multibackground support */
-  background-color: #373737 !important;
-}
-#login_outer {
-  border-radius: 11px;
-  background-color: #000;
-  width: 500px !important;
-  color: #fff !important;
-  margin: 0px auto;
-}
-
-.version_login {
-  transform: rotate(36deg);
-  /* Old browser support */
-  -ms-transform: rotate(36deg); /* IE */
-  -moz-transform: rotate(36deg); /* FF */
-  -o-transform: rotate(36deg); /* Opera */
-  -webkit-transform: rotate(36deg); /* Safari and Chrome */
-
-  float: right;
-  margin-top: 18px;
-  width: 80px;
-  height: 0px;
-  border-right: 13px solid transparent;
-  border-left: 25px solid transparent;
-  border-bottom: 18px solid #80ab51;
-  left: 16px;
-  position: relative;
-}
-
-#login_outer * {
-  font-family: Nunito, "Arial Rounded MT", Arial, Helvetica, sans-serif;
-  font-weight: bold;
-}
-.login_border {
-  border-right: 1px solid #fff;
-  text-align: center;
-}
-table#login_layout {
-  width: 100%;
-  height: 160px;
-  position: absolute;
-}
-
-div#error_login {
-  text-align: center;
-  margin-top: 5px;
-  margin-left: 5px;
-  width: 75%;
-  float: right;
-  text-align: left;
-  top: 100px;
-}
-
-div#error_login_icon {
-  #margin: 0 auto;
-  margin-top: 10px;
-  margin-right: 7px;
-  text-align: center;
-  #margin-left: 20px;
-  width: 20%;
-  float: right;
-}
-
-div#login_f {
-  margin-top: 10px;
-  margin-bottom: 25px;
-}
-
-a:focus,
-input:focus,
-button:focus {
-  utline-width: 0;
-  outline: 0;
-}
-
-div.login_links {
-  margin: 10px 0px 0px;
-  color: #fff;
-  text-align: center;
-}
-
-div.login_links > a {
-  color: #fff;
-}
-
-div.login_button {
-  text-align: right;
-  width: 100%;
-  margin-top: 15px;
-}
-
-div.login_button > input {
-  background-color: #373737 !important;
-  border: 0px none;
-  background-image: url("../../images/input_go.png") !important;
-  padding-right: 25px !important;
-}
-
-.login_page {
-  height: 200px;
-  padding-top: 10%;
-  text-align: center;
-  width: 100%;
-  position: absolute;
-}
-
-input.next_login {
-  padding-right: 12px !important;
-  padding-left: 12px !important;
-  height: 23px;
-  text-align: center;
-  font-weight: 600 !important;
-  letter-spacing: 0.5pt;
-  font-size: 12px !important;
-  border-radius: 3px !important;
-}
-
-div.login_nick,
-div.login_pass {
-  text-align: left;
-  padding-left: 15px;
-  margin-top: 10px;
-}
-
-div.login_nick > input,
-div.login_pass > input {
-  height: 20px;
-  border-radius: 0px;
-  margin-left: 10px;
-}
-
-div.login_nick > input:focus,
-div.login_pass > input:focus {
-  outline-width: 0px;
-  border-color: #80ab51;
-  background-color: #80ab51;
-  font-size: 12px;
-  height: 20px;
-  box-shadow: 0px 0px 3px 3px #80ab51;
-}
-
-div.login_nick > img,
-div.login_pass > img {
-  vertical-align: middle;
-}
-
-div.login_links a {
-  letter-spacing: 0.8pt;
-}
-
-div.login_links a:first-child {
-  margin-right: 5px;
-}
-
-div.login_links a:last-child {
-  margin-left: 5px;
-}
-
-div.login_nick_text {
-  text-align: left;
-  margin-bottom: 3px;
-  width: 191px;
-  margin: 5px 0px;
-  font-size: 12px;
-  letter-spacing: 0.4pt;
-}
-
-div.login_pass_text {
-  text-align: left;
-  width: 191px;
-  margin: 13px 0px 5px 0px;
-  font-size: 12px;
-  letter-spacing: 0.4pt;
-}
-
-div.login_pass {
-}
-
-input.login {
-  border: 0px none;
-  margin: 0px 0px;
-  width: 135px;
-  height: 18px;
-  font-weight: 100 !important;
-
-  letter-spacing: 0.3pt;
-}
-
-input.login_user {
-  /* Browser without multibackground support */
-  color: #373737 !important;
-  padding-left: 8px;
-  width: 179px;
-  color: #222;
-  height: 18px;
-}
-
-input.login_password {
-  /* Browser without multibackground support */
-  padding-left: 8px;
-  width: 179px;
-  color: #222;
-  height: 20px;
-}
-.databox_error {
-  width: 657px !important;
-  height: 400px;
-  border: none !important;
-  background-color: #fafafa;
-  background: url(../../images/splash_error.png) no-repeat;
-}
-
-#ver_num {
-  margin: 0px auto;
-  width: 100%;
-  position: absolute;
-  bottom: 10px;
-  color: #fff;
-  text-align: center;
-}
-
-input:-webkit-autofill {
-  #-webkit-box-shadow: 0 0 0px 1000px #ddd inset;
-}
-/***********************/
-/* END OF LOGIN STYLES */
-/***********************/
-
-th > label {
-  padding-top: 7px;
-}
-input.chk {
-  margin-right: 0px;
-  border: 0px none;
-  height: 14px;
-}
-input.datos {
-  background-color: #f5f5f5;
-}
-input.datos_readonly {
-  background-color: #050505;
-}
-
-input.sub {
-  font-weight: normal;
-
-  -moz-border-radius: 2px;
-  -webkit-border-radius: 2px;
-  border-radius: 2px;
-
-  font-size: 8pt;
-
-  background-color: #333 !important;
-  background-repeat: no-repeat !important;
-  background-position: 92% 3px !important;
-
-  color: white !important;
-  padding: 3px 3px 5px 12px;
-
-  border-color: #333;
-}
-
-input.sub[disabled] {
-  color: #b4b4b4 !important;
-  background-color: #f3f3f3 !important;
-  border-color: #b6b6b6;
-  cursor: default;
-}
-
-input.next,
-input.upd,
-input.ok,
-input.wand,
-input.delete,
-input.cog,
-input.target,
-input.search,
-input.copy,
-input.add,
-input.graph,
-input.percentile,
-input.binary,
-input.camera,
-input.config,
-input.cancel,
-input.default,
-input.filter,
-input.pdf {
-  padding-right: 30px;
-  height: 23px;
-}
-
-input.next {
-  background-image: url(../../images/input_go.png) !important;
-}
-input.upd {
-  background-image: url(../../images/input_update.png) !important;
-}
-input.wand {
-  background-image: url(../../images/input_wand.png) !important;
-}
-input.wand:disabled {
-  background-image: url(../../images/input_wand.disabled.png) !important;
-}
-input.search {
-  background-image: url(../../images/input_zoom.png) !important;
-}
-input.search:disabled {
-  background-image: url(../../images/input_zoom.disabled.png) !important;
-}
-input.ok {
-  background-image: url(../../images/input_tick.png) !important;
-}
-input.ok:disabled {
-  background-image: url(../../images/input_tick.disabled.png) !important;
-}
-input.add {
-  background-image: url(../../images/input_add.png) !important;
-}
-input.add:disabled {
-  background-image: url(../../images/input_add.disabled.png) !important;
-}
-input.cancel {
-  background-image: url(../../images/input_cross.png) !important;
-}
-input.cancel:disabled {
-  background-image: url(../../images/input_cross.disabled.png) !important;
-}
-input.delete {
-  background-image: url(../../images/input_delete.png) !important;
-}
-input.delete:disabled {
-  background-image: url(../../images/input_delete.disabled.png) !important;
-}
-input.cog {
-  background-image: url(../../images/input_cog.png) !important;
-}
-input.cog:disabled {
-  background-image: url(../../images/input_cog.disabled.png) !important;
-}
-input.config {
-  background-image: url(../../images/input_config.png) !important;
-}
-input.config:disabled {
-  background-image: url(../../images/input_config.disabled.png) !important;
-}
-input.filter {
-  background-image: url(../../images/input_filter.png) !important;
-}
-input.filter:disabled {
-  background-image: url(../../images/input_filter.disabled.png) !important;
-}
-input.pdf {
-  background-image: url(../../images/input_pdf.png) !important;
-}
-input.pdf:disabled {
-  background-image: url(../../images/input_pdf.disabled.png) !important;
-}
-input.camera {
-  background-image: url(../../images/input_camera.png) !important;
-}
-
-#toolbox #auto_save {
-  padding-top: 5px;
-}
-
-#toolbox {
-  margin-top: 13px;
-}
-input.visual_editor_button_toolbox {
-  padding-right: 15px;
-  padding-top: 10px;
-  margin-top: 5px;
-}
-input.delete_min {
-  background: #fefefe url(../../images/cross.png) no-repeat center !important;
-}
-input.delete_min[disabled] {
-  background: #fefefe url(../../images/cross.disabled.png) no-repeat center !important;
-}
-input.graph_min {
-  background: #fefefe url(../../images/chart_curve.png) no-repeat center !important;
-}
-input.graph_min[disabled] {
-  background: #fefefe url(../../images/chart_curve.disabled.png) no-repeat
-    center !important;
-}
-input.percentile_min {
-  background: #fefefe url(../../images/chart_bar.png) no-repeat center !important;
-}
-input.percentile_min[disabled] {
-  background: #fefefe url(../../images/chart_bar.disabled.png) no-repeat center !important;
-}
-input.percentile_item_min {
-  background: #fefefe url(../../images/percentile_item.png) no-repeat center !important;
-}
-input.percentile_item_min[disabled] {
-  background: #fefefe url(../../images/percentile_item.disabled.png) no-repeat
-    center !important;
-}
-input.binary_min {
-  background: #fefefe url(../../images/binary.png) no-repeat center !important;
-}
-input.binary_min[disabled] {
-  background: #fefefe url(../../images/binary.disabled.png) no-repeat center !important;
-}
-input.camera_min {
-  background: #fefefe url(../../images/camera.png) no-repeat center !important;
-}
-input.camera_min[disabled] {
-  background: #fefefe url(../../images/camera.disabled.png) no-repeat center !important;
-}
-input.config_min {
-  background: #fefefe url(../../images/config.png) no-repeat center !important;
-}
-input.config_min[disabled] {
-  background: #fefefe url(../../images/config.disabled.png) no-repeat center !important;
-}
-input.label_min {
-  background: #fefefe url(../../images/tag_red.png) no-repeat center !important;
-}
-input.label_min[disabled] {
-  background: #fefefe url(../../images/tag_red.disabled.png) no-repeat center !important;
-}
-input.icon_min {
-  background: #fefefe url(../../images/photo.png) no-repeat center !important;
-}
-input.icon_min[disabled] {
-  background: #fefefe url(../../images/photo.disabled.png) no-repeat center !important;
-}
-input.box_item {
-  background: #fefefe url(../../images/box_item.png) no-repeat center !important;
-}
-input.box_item[disabled] {
-  background: #fefefe url(../../images/box_item.disabled.png) no-repeat center !important;
-}
-input.line_item {
-  background: #fefefe url(../../images/line_item.png) no-repeat center !important;
-}
-input.line_item[disabled] {
-  background: #fefefe url(../../images/line_item.disabled.png) no-repeat center !important;
-}
-input.copy_item {
-  background: #fefefe url(../../images/copy_visualmap.png) no-repeat center !important;
-}
-input.copy_item[disabled] {
-  background: #fefefe url(../../images/copy_visualmap.disabled.png) no-repeat
-    center !important;
-}
-input.grid_min {
-  background: #fefefe url(../../images/grid.png) no-repeat center !important;
-}
-input.grid_min[disabled] {
-  background: #fefefe url(../../images/grid.disabled.png) no-repeat center !important;
-}
-input.save_min {
-  background: #fefefe url(../../images/file.png) no-repeat center !important;
-}
-input.save_min[disabled] {
-  background: #fefefe url(../../images/file.disabled.png) no-repeat center !important;
-}
-input.service_min {
-  background: #fefefe url(../../images/box.png) no-repeat center !important;
-}
-input.service_min[disabled] {
-  background: #fefefe url(../../images/box.disabled.png) no-repeat center !important;
-}
-
-input.group_item_min {
-  background: #fefefe url(../../images/group_green.png) no-repeat center !important;
-}
-input.group_item_min[disabled] {
-  background: #fefefe url(../../images/group_green.disabled.png) no-repeat
-    center !important;
-}
-
-div#cont {
-  position: fixed;
-  max-height: 320px;
-  overflow-y: auto;
-  overflow-x: hidden;
-}
-
-.termframe {
-  background-color: #80ba27 !important;
-}
-
-table,
-img {
-  border: 0px;
-}
-
-tr:first-child > th {
-  background-color: #373737;
-}
-
-th {
-  color: #fff;
-  background-color: #666;
-  font-size: 7.5pt;
-  letter-spacing: 0.3pt;
-}
-tr.datos,
-tr.datost,
-tr.datosb,
-tr.datos_id,
-tr.datosf9 {
-  #background-color: #eaeaea;
-}
-
-tr.datos2,
-tr.datos2t,
-tr.datos2b,
-tr.datos2_id,
-tr.datos2f9 {
-  #background-color: #f2f2f2;
-}
-
-tr.datos:hover,
-tr.datost:hover,
-tr.datosb:hover,
-tr.datos_id:hover,
-tr.datosf9:hover,
-tr.datos2:hover,
-tr.datos2t:hover,
-tr.datos2b:hover,
-tr.datos2_id:hover,
-tr.datos2f9:hover {
-  #background-color: #efefef;
-}
-
-/* Checkbox styles */
-td input[type="checkbox"] {
-  /* Double-sized Checkboxes */
-  -ms-transform: scale(1.3); /* IE */
-  -moz-transform: scale(1.3); /* FF */
-  -o-transform: scale(1.3); /* Opera */
-  -webkit-transform: scale(1.3); /* Safari and Chrome */
-  padding: 10px;
-  margin-top: 2px;
-  display: table-cell;
-}
-
-td.datos3,
-td.datos3 * {
-  background-color: #666;
-  color: white !important;
-}
-
-td.datos4,
-td.datos4 * {
-  /*Add !important because in php the function html_print_table write style in cell and this is style head.*/
-  text-align: center !important;
-  background-color: #666;
-  color: white !important;
-}
-
-td.datos_id {
-  color: #1a313a;
-}
-
-tr.disabled_row_user * {
-  color: grey;
-}
-
-.bg {
-  /* op menu */
-  background: #80ab51;
-}
-
-.bg2 {
-  /* main page */
-  background-color: #0a160c;
-}
-.bg3 {
-  /* godmode */
-  background: #666666;
-}
-.bg4 {
-  /* links */
-  background-color: #989898;
-}
-.bg,
-.bg2,
-.bg3,
-.bg4 {
-  position: relative;
-  width: 100%;
-}
-.bg {
-  height: 20px;
-}
-.bg2,
-.bg3,
-.bg4 {
-  height: 18px;
-}
-.f10,
-#ip {
-  font-size: 7pt;
-  text-align: center;
-}
-.f9,
-.f9i,
-.f9b,
-.datos_greyf9,
-.datos_bluef9,
-.datos_greenf9,
-.datos_redf9,
-.datos_yellowf9,
-td.f9,
-td.f9i,
-td.datosf9,
-td.datos2f9 {
-  font-size: 6.5pt;
-}
-.f9i,
-.redi {
-  font-style: italic;
-}
-.tit {
-  padding: 6px 0px;
-  height: 14px;
-}
-.tit,
-.titb {
-  font-weight: bold;
-  color: #fff;
-  text-align: center;
-}
-
-.suc * {
-  color: #5a8629;
-}
-
-.info * {
-  color: #006f9d;
-}
-
-.error * {
-  color: #f85858;
-}
-
-.warning * {
-  color: #fad403;
-}
-
-.help {
-  background: url(../../images/help.png) no-repeat;
-}
-.red,
-.redb,
-.redi,
-.error {
-  color: #c00;
-}
-
-.sep {
-  margin-left: 30px;
-  border-bottom: 1px solid #708090;
-  width: 100%;
-}
-.orange {
-  color: #fd7304;
-}
-.green {
-  color: #5a8629;
-}
-.yellow {
-  color: #f3c500;
-}
-.greenb {
-  color: #00aa00;
-}
-.grey {
-  color: #808080;
-  font-weight: bold;
-}
-.blue {
-  color: #5ab7e5;
-  font-weight: bold;
-}
-.redb,
-.greenb,
-td.datos_id,
-td.datos2_id,
-f9b {
-  font-weight: bold;
-}
-.p10 {
-  padding-top: 1px;
-  padding-bottom: 0px;
-}
-.p21 {
-  padding-top: 2px;
-  padding-bottom: 1px;
-}
-.w120 {
-  width: 120px;
-}
-.w130,
-#table-agent-configuration select {
-  width: 130px;
-}
-.w135 {
-  width: 135px;
-}
-.w155,
-#table_layout_data select {
-  width: 155px;
-}
-.top,
-.top_red,
-.bgt,
-td.datost,
-td.datos2t {
-  vertical-align: top;
-}
-.top_red {
-  background: #ff0000;
-}
-.bot,
-.titb,
-td.datosb {
-  vertical-align: bottom;
-}
-.msg {
-  margin-top: 15px;
-  text-align: justify;
-}
-ul.mn {
-  list-style: none;
-  padding: 0px 0px 0px 0px;
-  margin: 0px 0px 0px 0px;
-  line-height: 15px;
-}
-.gr {
-  font-size: 10pt;
-  font-weight: bold;
-}
-a.mn,
-.gr {
-  font-family: Arial, Verdana, sans-serif, Helvetica;
-}
-div.nf {
-  background: url(../../images/info.png) no-repeat scroll 0 50% transparent;
-  margin-left: 7px;
-  padding: 8px 1px 6px 25px;
-}
-div.title_line {
-  background-color: #4e682c;
-  height: 5px;
-  width: 762px;
-}
-
-.alpha50 {
-  filter: alpha(opacity=50);
-  -moz-opacity: 0.5;
-  opacity: 0.5;
-  -khtml-opacity: 0.5;
-}
-
-#menu_tab_frame,
-#menu_tab_frame_view {
-  display: block !important;
-  border-bottom: 1px solid #80ba27;
-  /*	float:left; */
-  margin-left: 0px !important;
-  max-height: 42px;
-  min-height: 42px;
-  padding-right: 28px;
-  width: 100%;
-}
-
-#menu_tab {
-  margin: 0px 0px 0px 0px !important;
-  position: absolute;
-  right: 0px;
-  top: 10px;
-}
-
-#menu_tab .mn,
-#menu_tab ul,
-#menu_tab .mn ul {
-  padding: 0px;
-  list-style: none;
-  margin: 0px 0px 0px 0px;
-}
-#menu_tab .mn li {
-  float: right;
-  position: relative;
-  margin: 0px 0px 0px 0px;
-}
-/*
-#menu_tab li a, #menu_tab a {
-	padding: 2px 0px;
-	font-weight: bold;
-	line-height: 18px;
-	margin-left: 3px;
-	margin-right: 0px;
-
-	-moz-border-top-right-radius: 5px;
-	-webkit-border-top-right-radius: 5px;
-	border-top-right-radius: 5px;
-
-	-moz-border-top-left-radius: 5px;
-	-webkit-border-top-left-radius: 5px;
-	border-top-left-radius: 5px;
-}
-
-#menu_tab li>form {
-	padding-left: 7px;
-	padding-top: 4px;
-}
-*/
-
-#menu_tab li.separator_view {
-  padding: 4px;
-}
-
-#menu_tab li.separator {
-  padding: 4px;
-}
-
-#menu_tab li.nomn_high a {
-  /*background: #80ab51;*/
-  color: #fff;
-}
-#menu_tab .mn li a {
-  display: block;
-  text-decoration: none;
-  padding: 0px;
-  margin: 0px;
-  height: 21px;
-  width: 21px;
-}
-#menu_tab li.nomn:hover a,
-#menu_tab li:hover ul a:hover {
-  /*background: #80ab51;*/
-  color: #fff;
-}
-#menu_tab li:hover a {
-  /*background: #b2b08a url("../../images/arrow.png") no-repeat right 3px;*/
-}
-
-#menu_tab li.nomn {
-  min-width: 30px;
-  height: 28px;
-}
-#menu_tab li.nomn_high {
-  min-width: 30px;
-  height: 28px;
-}
-/* TAB TITLE */
-#menu_tab_left {
-  margin-left: 0px !important;
-}
-
-#menu_tab_left .mn,
-#menu_tab_left ul,
-#menu_tab_left .mn ul {
-  background-color: #000;
-  color: #fff;
-  font-weight: bold;
-  padding: 0px 0px 0px 0px;
-  list-style: none;
-  margin: 0px 0px 0px 0px;
-}
-#menu_tab_left .mn li {
-  float: left;
-  position: relative;
-  height: 26px;
-  max-height: 26px;
-}
-#menu_tab_left li a,
-#menu_tab_left li span {
-  /*	text-transform: uppercase; */
-  padding: 0px 0px 0px 0px;
-  color: #fff;
-  font-size: 8.5pt;
-  font-weight: bold;
-  line-height: 20px;
-}
-#menu_tab_left .mn li a {
-  display: block;
-  text-decoration: none;
-}
-#menu_tab_left li.view a {
-  padding: 2px 10px 2px 10px;
-  color: #fff;
-  font-weight: bold;
-  line-height: 18px;
-  display: none;
-}
-
-#menu_tab_left li.view {
-  background: #80ab51;
-  max-width: 100%;
-  min-width: 100%;
-  padding: 5px 5px 0px;
-  text-align: left;
-  -moz-border-top-right-radius: 3px;
-  -webkit-border-top-right-radius: 3px;
-  border-top-right-radius: 3px;
-
-  -moz-border-top-left-radius: 3px;
-  -webkit-border-top-left-radius: 3px;
-  border-top-left-radius: 3px;
-  margin-left: 0px !important;
-  overflow-y: hidden;
-}
-
-#menu_tab_left li.view img.bottom {
-  width: 24px;
-  height: 24px;
-}
-
-#menu_tab_frame *,
-#menu_tab_frame_view * {
-  #margin: 0px 0px 0px 0px !important;
-}
-
-span.users {
-  background: url(../../images/group.png) no-repeat;
-}
-span.agents {
-  background: url(../../images/bricks.png) no-repeat;
-}
-span.data {
-  background: url(../../images/data.png) no-repeat;
-}
-span.alerts {
-  background: url(../../images/bell.png) no-repeat;
-}
-span.time {
-  background: url(../../images/hourglass.png) no-repeat;
-}
-span.net {
-  background: url(../../images/network.png) no-repeat;
-}
-span.master {
-  background: url(../../images/master.png) no-repeat;
-}
-span.wmi {
-  background: url(../../images/wmi.png) no-repeat;
-}
-span.prediction {
-  background: url(../../images/chart_bar.png) no-repeat;
-}
-span.plugin {
-  background: url(../../images/plugin.png) no-repeat;
-}
-span.export {
-  background: url(../../images/database_refresh.png) no-repeat;
-}
-span.snmp {
-  background: url(../../images/snmp.png) no-repeat;
-}
-span.binary {
-  background: url(../../images/binary.png) no-repeat;
-}
-span.recon {
-  background: url(../../images/recon.png) no-repeat;
-}
-span.rmess {
-  background: url(../../images/email_open.png) no-repeat;
-}
-span.nrmess {
-  background: url(../../images/email.png) no-repeat;
-}
-span.recon_server {
-  background: url(../../images/recon.png) no-repeat;
-}
-span.wmi_server {
-  background: url(../../images/wmi.png) no-repeat;
-}
-span.export_server {
-  background: url(../../images/server_export.png) no-repeat;
-}
-span.inventory_server {
-  background: url(../../images/page_white_text.png) no-repeat;
-}
-span.web_server {
-  background: url(../../images/world.png) no-repeat;
-}
-/* This kind of span do not have any sense, should be replaced on PHP code
-by a real img in code. They are not useful because insert too much margin around
-(for example, not valid to use in the table of server view */
-span.users,
-span.agents,
-span.data,
-span.alerts,
-span.time,
-span.net,
-span.master,
-span.snmp,
-span.binary,
-span.recon,
-span.wmi,
-span.prediction,
-span.plugin,
-span.plugin,
-span.export,
-span.recon_server,
-span.wmi_server,
-span.export_server,
-span.inventory_server,
-span.web_server {
-  margin-left: 4px;
-  margin-top: 10px;
-  padding: 4px 8px 12px 30px;
-  display: block;
-}
-span.rmess,
-span.nrmess {
-  margin-left: 14px;
-  padding: 1px 0px 10px 30px;
-  display: block;
-}
-/* New styles for data box */
-.databox,
-.databox_color,
-.databox_frame {
-  margin-bottom: 5px;
-  margin-top: 0px;
-  margin-left: 0px;
-  border: 1px solid #e2e2e2;
-  -moz-border-radius: 4px;
-  -webkit-border-radius: 4px;
-  border-radius: 4px;
-}
-.databox_color {
-  padding-top: 5px;
-}
-
-table.databox {
-  background-color: #f9faf9;
-  border-spacing: 0px;
-  -moz-box-shadow: 0px 0px 0px #ddd !important;
-  -webkit-box-shadow: 0px 0px 0px #ddd !important;
-  box-shadow: 0px 0px 0px #ddd !important;
-}
-
-.databox td {
-  -moz-border-radius: 0px;
-  -webkit-border-radius: 0px;
-  border-radius: 0px;
-  border: 0px none #e2e2e2;
-}
-
-.databox th {
-  padding: 9px 7px;
-  font-weight: normal;
-  color: #fff;
-}
-.databox td {
-  #border-bottom: 1px solid #e2e2e2;
-}
-
-.databox th * {
-  color: #fff;
-}
-
-.databox th input,
-.databox th textarea,
-.databox th select,
-.databox th select option {
-  color: #222 !important;
-}
-
-.tabletitle {
-  color: #333;
-}
-
-.tactical_set legend {
-  text-align: left;
-  color: #3f3f3f;
-}
-
-.tactical_set {
-  background: #fff;
-  border: 1px solid #e2e2e2;
-  margin-left: auto;
-  margin-right: auto;
-  width: auto;
-}
-
-/* For use in Netflow */
-
-table.databox_grid {
-  margin: 25px;
-}
-
-table.databox_grid th {
-  font-size: 12px;
-}
-
-table.databox_grid td {
-  padding: 6px;
-  margin: 4px;
-  border-bottom: 1px solid #acacac;
-  border-right: 1px solid #acacac;
-}
-
-table.alternate tr:nth-child(odd) td {
-  background-color: #ffffff;
-}
-table.alternate tr:nth-child(even) td {
-  background-color: #e4e5e4;
-}
-
-table.rounded_cells td {
-  padding: 4px 4px 4px 10px;
-  -moz-border-radius: 6px !important;
-  -webkit-border-radius: 6px !important;
-  border-radius: 6px !important;
-}
-
-.databox_color {
-  background-color: #fafafa;
-}
-#head_l {
-  float: left;
-  margin: 0;
-  padding: 0;
-}
-#head_r {
-  float: right;
-  text-align: right;
-  margin-right: 10px;
-  padding-top: 0px;
-}
-#head_m {
-  position: absolute;
-  padding-top: 6px;
-  padding-left: 12em;
-}
-span#logo_text1 {
-  font: bolder 3em Arial, Sans-serif;
-  letter-spacing: -2px;
-  color: #eee;
-}
-span#logo_text2 {
-  font: 3em Arial, Sans-serif;
-  letter-spacing: -2px;
-  color: #aaa;
-}
-
-div#logo_text3 {
-  text-align: right;
-  font: 2em Arial, Sans-serif;
-  letter-spacing: 6px;
-  color: #aaa;
-  font-weight: bold;
-  margin-top: 0px;
-  margin-left: 4px;
-  padding-top: 0px;
-}
-
-.bb0 {
-  border-bottom: 0px;
-}
-.bt0 {
-  border-top: 0px;
-}
-.action-buttons {
-  text-align: right;
-}
-#table-add-item select,
-#table-add-sla select {
-  width: 180px;
-}
-
-/* end of classes for event priorities */
-div#main_pure {
-  background-color: #fefefe;
-  text-align: left;
-  margin-bottom: 25px;
-  margin-top: 30px;
-  margin-left: 10px;
-  margin-right: 10px;
-  height: 1000px;
-  width: 98%;
-  position: static;
-}
-#table-agent-configuration radio {
-  margin-right: 40px;
-}
-.ui-draggable {
-  cursor: move;
-}
-#layout_trash_drop {
-  float: right;
-  width: 300px;
-  height: 180px;
-  background: #fff url("../../images/trash.png") no-repeat bottom left;
-}
-#layout_trash_drop div {
-  display: block;
-}
-#layout_editor_drop {
-  float: left;
-  width: 300px;
-}
-.agent_reporting {
-  margin: 5px;
-  padding: 5px;
-}
-.report_table,
-.agent_reporting {
-  border: #ccc outset 3px;
-}
-.img_help {
-  cursor: help;
-}
-#loading {
-  position: fixed;
-  width: 200px;
-  margin-left: 30%;
-  text-align: center;
-  top: 50%;
-  background-color: #999999;
-  padding: 20px;
-}
-/* IE 7 Hack */
-#editor {
-  *margin-top: 10px !important;
-}
-/* big_data is used in tactical and logon_ok */
-.big_data {
-  text-decoration: none;
-  font: bold 2em Arial, Sans-serif;
-}
-
-.med_data {
-  text-decoration: none;
-  font: bold 1.5em Arial, Sans-serif;
-}
-
-.notify {
-  background-color: #f7ffa5;
-  text-align: center;
-  font-weight: bold;
-  padding: 8px;
-  margin: 0px 0px 0px 0px !important;
-  z-index: -1;
-}
-
-.notify a {
-  color: #003a3a;
-  text-decoration: underline;
-}
-
-.listing {
-  border-collapse: collapse;
-}
-.listing td {
-  border-bottom: 1px solid #cccccc;
-  border-top: 1px solid #cccccc;
-}
-ul {
-  list-style-type: none;
-  padding-left: 0;
-  margin-left: 0;
-}
-span.actions {
-  margin-left: 30px;
-}
-.actions {
-  min-width: 200px !important;
-}
-code,
-pre {
-  font-family: courier, serif;
-}
-select#template,
-select#action {
-  width: 250px;
-}
-#label-checkbox-matches_value,
-#label-checkbox-copy_modules,
-#label-checkbox-copy_alerts {
-  display: inline;
-  font-weight: normal;
-}
-input[type="image"] {
-  border: 0px;
-  background-color: transparent !important;
-}
-table#simple select#id_module_type,
-table#alert_search select#id_agent,
-table#alert_search select#id_group,
-table#network_component select#type {
-  width: 200px;
-}
-table#simple select#select_snmp_oid,
-table#simple select#id_plugin,
-table#network_component select#id_plugin {
-  width: 270px;
-}
-table#simple select#prediction_id_group,
-table#simple select#prediction_id_agent,
-table#simple select#prediction_module {
-  width: 50%;
-  display: block;
-}
-table#simple input#text-plugin_parameter,
-table#simple input#text-snmp_oid,
-table#source_table select,
-table#destiny_table select,
-table#target_table select,
-table#filter_compound_table select,
-table#filter_compound_table #text-search,
-table#delete_table select {
-  width: 100%;
-}
-table#simple select#network_component_group,
-table#simple select#network_component {
-  width: 90%;
-}
-table#simple span#component_group,
-table#simple span#component {
-  width: 45%;
-  font-style: italic;
-}
-table#simple label {
-  display: inline;
-  font-weight: normal;
-  font-style: italic;
-}
-.clickable {
-  cursor: pointer;
-}
-table#agent_list tr,
-table.alert_list tr {
-  vertical-align: top;
-}
-.toggle {
-  border-collapse: collapse;
-}
-.toggle td {
-  border-left: 1px solid #d3d3d3;
-}
-
-ul.actions_list {
-  list-style-image: url(../../images/arrow.png);
-  list-style-position: inside;
-  margin-top: 0;
-}
-div.loading {
-  background-color: #fff1a8;
-  margin-left: auto;
-  margin-right: auto;
-  padding: 5px;
-  text-align: center;
-  font-style: italic;
-  width: 95%;
-}
-div.loading img {
-  float: right;
-}
-/* Tablesorter jQuery pager */
-div.pager {
-  margin-left: 10px;
-  margin-top: 5px;
-}
-div.pager img {
-  position: relative;
-  top: 4px;
-  padding-left: 5px;
-}
-div.pager input {
-  padding-left: 5px;
-}
-.pagedisplay {
-  border: 0;
-  width: 35px;
-}
-/* Steps style */
-ol.steps {
-  margin-bottom: 15px;
-  padding: 0;
-  list-style-type: none;
-  list-style-position: outside;
-}
-ol.steps li {
-  float: left;
-  background-color: #efefef;
-  padding: 5px;
-  margin-left: 5px;
-  width: 150px;
-}
-ol.steps li a {
-  color: #111;
-}
-ol.steps li.visited a {
-  color: #999;
-}
-ol.steps li span {
-  font-weight: normal;
-  display: block;
-}
-ol.steps li span {
-  color: #777;
-}
-ol.steps li.visited span {
-  color: #999;
-}
-ol.steps li.current {
-  border-left: 5px solid #778866;
-  margin-left: 0;
-  font-weight: bold;
-  background-color: #e9f3d2;
-}
-ol.steps li.visited {
-  color: #999 !important;
-}
-
-fieldset {
-  background-color: #f9faf9;
-  border: 1px solid #e2e2e2;
-  padding: 0.5em;
-  margin-bottom: 20px;
-  position: relative;
-}
-fieldset legend {
-  font-size: 1.1em;
-  font-weight: bold;
-  #color: #3f4e2f;
-  line-height: 20px;
-  color: #3f3f3f;
-  #top: -2em;
-}
-
-fieldset .databox {
-  border: 0px solid;
-}
-
-fieldset.databox {
-  padding: 14px !important;
-}
-
-fieldset legend span,
-span#latest_value {
-  font-style: italic;
-}
-span#latest_value span#value {
-  font-style: normal;
-}
-form#filter_form {
-  margin-bottom: 15px;
-}
-ul.action_list {
-  margin: 0;
-  list-style: none inside circle;
-}
-ul.action_list li div {
-  margin-left: 15px;
-}
-span.action_name {
-  float: none;
-}
-div.actions_container {
-  overflow: auto;
-  width: 100%;
-  max-height: 200px;
-}
-div.actions_container label {
-  display: inline;
-  font-weight: normal;
-  font-style: italic;
-}
-a.add_action {
-  clear: both;
-  display: block;
-}
-
-/* timeEntry styles */
-.timeEntry_control {
-  vertical-align: middle;
-  margin-left: 2px;
-}
-div#steps_clean {
-  clear: both;
-}
-div#event_control {
-  clear: right;
-}
-
-/* Autocomplete styles */
-.ac_results {
-  padding: 0px;
-  border: 1px solid black;
-  background-color: white;
-  overflow: hidden;
-  z-index: 99999;
-}
-
-.ac_results ul {
-  width: 100%;
-  list-style-position: outside;
-  list-style: none;
-  padding: 0;
-  margin: 0;
-  text-align: left;
-}
-
-.ac_results li {
-  margin: 0px;
-  padding: 2px 5px;
-  cursor: default;
-  display: block;
-  /*
-	if width will be 100% horizontal scrollbar will apear
-	when scroll mode will be used
-	*/
-  /*width: 100%;*/
-  font: menu;
-  font-size: 12px;
-  /*
-	it is very important, if line-height not setted or setted
-	in relative units scroll will be broken in firefox
-	*/
-  line-height: 16px;
-}
-
-.ac_loading {
-  background: white url("../images/loading.gif") right center no-repeat;
-}
-
-.ac_over {
-  background-color: #efefef;
-}
-span.ac_extra_field,
-span.ac_extra_field strong {
-  font-style: italic;
-  font-size: 9px;
-}
-
-div#pandora_logo_header {
-  /*	Put here your company logo (139x60 pixels) like this: */
-  /*	background: url(../../images/MiniLogoArtica.jpg); */
-  background: url(../../images/pandora_logo_head.png);
-  background-position: 0% 0%;
-  width: 139px;
-  height: 60px;
-  float: left;
-}
-
-#header_table img {
-  margin-top: 0px;
-}
-
-.autorefresh_disabled {
-  cursor: not-allowed !important;
-}
-
-a.autorefresh {
-  padding-right: 8px;
-}
-
-#refrcounter {
-  color: white;
-}
-
-#combo_refr select {
-  margin-right: 8px;
-}
-
-.disabled_module {
-  color: #aaa;
-}
-div.warn {
-  background: url(../../images/info.png) no-repeat;
-  margin-top: 7px;
-  padding: 2px 1px 6px 25px;
-}
-
-.submenu_not_selected {
-  font-weight: normal !important;
-}
-
-/* Submenus havent borders */
-.submenu_not_selected,
-.submenu_selected,
-.submenu2 {
-  border: 0px !important;
-  min-height: 35px !important;
-}
-
-/* Pandora width style theme */
-
-div#container {
-  width: 100%;
-}
-div#page {
-  width: auto;
-}
-div#main {
-  max-width: 93%;
-  min-width: 93%;
-}
-
-ol.steps {
-  margin-bottom: 70px;
-}
-div#steps_clean {
-  display: none;
-}
-
-#menu_tab_frame,
-#menu_tab_frame_view {
-  width: 100%;
-  padding-right: 0px;
-  margin-left: 0px !important;
-  margin-bottom: 20px;
-  height: 31px;
-}
-div#events_list {
-  float: left;
-  width: 100%;
-}
-span#logo_text1 {
-  font: bolder 3em Arial, Sans-serif;
-  letter-spacing: -2px;
-  color: #eee;
-}
-span#logo_text2 {
-  font: 3em Arial, Sans-serif;
-  letter-spacing: -2px;
-  color: #aaa;
-}
-div#logo_text3 {
-  text-align: right;
-  font: 2em Arial, Sans-serif;
-  letter-spacing: 6px;
-  color: #aaa;
-  font-weight: bold;
-  margin-top: 0px;
-  margin-left: 4px;
-  padding-top: 0px;
-}
-.pagination {
-  margin-top: 15px;
-  margin-bottom: 5px;
-}
-.pagination * {
-  margin-left: 0px !important;
-  margin-right: 0px !important;
-  vertical-align: middle;
-}
-
-/*CALENDAR TOOLTIP STYLE*/
-
-/* Calendar background */
-table.scw {
-  background-color: #80ab51;
-  border: 0 !important;
-  border-radius: 4px;
-}
-
-/* Week number heading */
-td.scwWeekNumberHead {
-  color: #111;
-}
-
-td.scwWeek {
-  color: #111 !important;
-}
-
-Today selector td.scwFoot {
-  background-color: #daedae;
-  color: #111;
-}
-
-td.scwFootDisabled {
-  background-color: #000;
-  color: #ffffff;
-}
-
-tfoot.scwFoot {
-  color: #111;
-}
-
-.scwFoot :hover {
-  color: #3f3f3f !important;
-}
-
-table.scwCells {
-  background-color: #fff !important;
-  color: #3c3c3c !important;
-}
-
-table.scwCells:hover {
-  background-color: #fff !important;
-}
-
-td.scwCellsExMonth {
-  background-color: #eee !important;
-  color: #3c3c3c !important;
-}
-
-td.scwCellsWeekend {
-  background-color: #3c3c3c !important;
-  color: #fff !important;
-  border: 0 !important;
-}
-
-td.scwInputDate {
-  background-color: #777 !important;
-  color: #ffffff !important;
-  border: 0 !important;
-}
-
-td.scwFoot {
-  background-color: #fff !important;
-  color: #3c3c3c !important;
-  border: 0 !important;
-}
-
-/* Cells divs to set individual styles with the table objects */
-div.cellBold {
-  width: 100%;
-  height: 100%;
-  font-weight: bold;
-}
-
-div.cellRight {
-  width: 100%;
-  height: 100%;
-  text-align: right;
-}
-
-div.cellCenter {
-  width: 100%;
-  height: 100%;
-  text-align: center;
-}
-
-div.cellWhite {
-  width: 100%;
-  height: 100%;
-  background: #fff;
-  color: #111;
-}
-
-div.cellNormal {
-  width: 100%;
-  height: 100%;
-  background: #6eb432;
-  color: #fff;
-}
-
-div.cellCritical {
-  width: 100%;
-  height: 100%;
-  background: #f85858;
-  color: #fff;
-}
-
-div.cellWarning {
-  width: 100%;
-  height: 100%;
-  background: #ffea59;
-  color: #111;
-}
-
-div.cellUnknown {
-  width: 100%;
-  height: 100%;
-  background: #aaaaaa;
-  color: #ffffff;
-}
-
-div.cellNotInit {
-  width: 100%;
-  height: 100%;
-  background: #3ba0ff;
-  color: #ffffff;
-}
-
-div.cellAlert {
-  width: 100%;
-  height: 100%;
-  background: #ff8800;
-  color: #111;
-}
-
-div.cellBorder1 {
-  width: 100%;
-  height: 100%;
-  border: 1px solid #666;
-}
-
-div.cellBig {
-  width: 100%;
-  height: 100%;
-  font-size: 18px;
-}
-
-.info_box {
-  background: #f9faf9;
-  margin-top: 10px !important;
-  margin-bottom: 10px !important;
-  padding: 0px 5px 5px 10px;
-  border-color: #e2e2e2;
-  border-style: solid;
-  border-width: 1px;
-  width: 100% !important;
-  -moz-border-radius: 4px;
-  -webkit-border-radius: 4px;
-  border-radius: 4px;
-}
-
-.info_box .title * {
-  font-size: 10pt !important;
-  font-weight: bolder;
-}
-
-.info_box .icon {
-  width: 30px !important;
-  text-align: center;
-}
-
-/* Standard styles for status colos (groups, events, backgrounds...) */
-
-.opacity_cell {
-  filter: alpha(opacity=80);
-  -moz-opacity: 0.8;
-  opacity: 0.8;
-  -khtml-opacity: 0.8;
-}
-
-tr.group_view_data,
-.group_view_data {
-  color: #3f3f3f;
-}
-
-tr.group_view_crit,
-.group_view_crit {
-  background-color: #fc4444;
-  color: #fff;
-}
-
-tr.group_view_norm,
-.group_view_norm,
-tr.group_view_normal,
-.group_view_normal {
-  #background-color: #ffffff;
-}
-tr.group_view_ok,
-.group_view_ok {
-  background-color: #80ba27;
-  color: #fff;
-}
-
-tr.group_view_not_init,
-.group_view_not_init,
-tr.group_view_not_init,
-.group_view_not_init {
-  background-color: #5bb6e5;
-  color: #fff !important;
-}
-
-tr.group_view_warn,
-.group_view_warn,
-tr.group_view_warn.a,
-a.group_view_warn,
-tr.a.group_view_warn {
-  background-color: #fad403;
-  color: #3f3f3f !important;
-}
-
-a.group_view_warn {
-  color: #fad403 !important;
-}
-
-tr.group_view_alrm,
-.group_view_alrm {
-  background-color: #ffa631;
-  color: #fff;
-}
-
-tr.group_view_unk,
-.group_view_unk {
-  background-color: #b2b2b2;
-  color: #fff;
-}
-
-/* classes for event priorities. Sits now in functions.php */
-.datos_green,
-.datos_greenf9,
-.datos_green a,
-.datos_greenf9 a,
-.datos_green * {
-  background-color: #80ba27;
-  color: #fff;
-}
-.datos_red,
-.datos_redf9,
-.datos_red a,
-.datos_redf9 a,
-.datos_red * {
-  background-color: #fc4444;
-  color: #fff !important;
-}
-
-.datos_yellow,
-.datos_yellowf9,
-.datos_yellow * {
-  background-color: #fad403;
-  color: #111;
-}
-
-a.datos_blue,
-.datos_bluef9,
-.datos_blue,
-.datos_blue * {
-  background-color: #4ca8e0;
-  color: #fff !important;
-}
-
-.datos_grey,
-.datos_greyf9,
-.datos_grey * {
-  background-color: #999999;
-  color: #fff;
-}
-
-.datos_pink,
-.datos_pinkf9,
-.datos_pink * {
-  background-color: #fdc4ca;
-  color: #111;
-}
-
-.datos_brown,
-.datos_brownf9,
-.datos_brown * {
-  background-color: #a67c52;
-  color: #fff;
-}
-
-.datos_orange,
-.datos_orangef9,
-.datos_orange * {
-  background-color: #f7931e;
-  color: #111;
-}
-
-td.datos_greyf9,
-td.datos_bluef9,
-td.datos_greenf9,
-td.datos_redf9,
-td.datos_yellowf9,
-td.datos_pinkf9,
-td.datos_brownf9,
-td.datos_orangef9 {
-  padding: 5px 5px 5px 5px;
-}
-
-.menu li.selected {
-  font-weight: bold;
-}
-
-ul.operation li a:hover {
-  #font-weight: bold;
-}
-
-.submenu_text {
-  color: #fff;
-}
-
-.submenu_not_selected {
-  color: #fff !important;
-}
-
-.operation .menu_icon:hover {
-  background-color: #d9fb86 !important;
-}
-.operation .submenu_text:hover {
-  color: #585858 !important;
-}
-.operation .submenu_not_selected:hover {
-  background-color: #d9fb86 !important;
-  color: #585858 !important;
-}
-.operation .submenu_selected:hover {
-  background-color: #d9fb86 !important;
-  color: #585858 !important;
-}
-.operation .sub_subMenu:hover {
-  background-color: #d9fb86 !important;
-  color: #585858 !important;
-}
-.operation .selected .submenu_not_selected * {
-  color: #fff !important;
-}
-
-.operation .selected .submenu_not_selected *:hover {
-  color: #585858 !important;
-}
-.operation {
-  background-color: #80ab51 !important;
-}
-.operation .selected {
-  background-color: #d9fb86 !important;
-}
-.operation li.selected {
-  box-shadow: inset 4px 0 #80ab51;
-}
-.operation .selected .submenu_text_middle {
-  color: #585858;
-}
-.operation .submenu_selected .selected .submenu_text {
-  color: #585858;
-}
-.operation .submenu_selected .selected {
-  color: #585858;
-}
-
-.godmode .menu_icon:hover {
-  background-color: #a77853 !important;
-}
-.godmode .submenu_text:hover {
-  color: #3f3f3f !important;
-}
-.godmode .submenu_not_selected:hover {
-  background-color: #a77853 !important;
-  color: #2f2f2f !important;
-}
-.godmode .submenu_selected:hover {
-  background-color: #a77853 !important;
-  color: #2f2f2f !important;
-}
-.godmode .sub_subMenu:hover {
-  background-color: #a77853 !important;
-  color: #2f2f2f !important;
-}
-.godmode .selected .submenu_not_selected * {
-  color: #fff !important;
-}
-
-.godmode .selected .submenu_not_selected *:hover {
-  color: #2f2f2f !important;
-}
-.godmode {
-  background-color: #e79b5d !important;
-}
-.godmode .selected {
-  background-color: #a77853 !important;
-}
-.godmode li.selected {
-  box-shadow: inset 4px 0 #e79b5d;
-}
-.godmode .selected .submenu_text_middle {
-  color: #2f2f2f;
-}
-.godmode .submenu_selected .selected .submenu_text {
-  color: #2f2f2f;
-}
-.godmode .submenu_selected .selected {
-  color: #2f2f2f;
-}
-
-li.links a:hover {
-  #font-weight: bold;
-}
-
-.is_submenu2 li {
-  background-color: #ff0000;
-}
-
-.is_submenu2 {
-  background-color: #222222 !important;
-}
-
-.menu li,
-.menu .li.not_selected {
-  border-radius: 0px 0px 0px 0px;
-  display: block;
-  min-height: 35px;
-  border-bottom: 0px none #424242;
-  vertical-align: middle;
-}
-
-#menu_tab li.separator {
-  /* Empty */
-}
-
-.operation {
-  border-top-right-radius: 5px;
-  border-right-style: solid;
-  border-right-width: 0px;
-}
-
-input#text-id_parent.ac_input,
-input,
-textarea,
-select {
-  background-color: #ffffff !important;
-  border: 1px solid #cbcbcb;
-  -moz-border-radius: 3px;
-  -webkit-border-radius: 3px;
-  border-radius: 3px;
-}
-
-span#plugin_description {
-  font-size: 9px;
-}
-
-/*FOR TINYMCE*/
-#tinymce {
-  text-align: left;
-}
-
-.visual_font_size_4pt,
-.visual_font_size_4pt > em,
-.visual_font_size_4pt > strong,
-.visual_font_size_4pt > strong > span,
-.visual_font_size_4pt > span,
-.visual_font_size_4pt > strong > em,
-.visual_font_size_4pt > em > strong,
-.visual_font_size_4pt em span,
-.visual_font_size_4pt span em {
-  font-size: 4pt !important;
-  line-height: 4pt;
-}
-
-.visual_font_size_6pt,
-.visual_font_size_6pt > em,
-.visual_font_size_6pt > strong,
-.visual_font_size_6pt > strong > span,
-.visual_font_size_6pt > span,
-.visual_font_size_6pt > strong > em,
-.visual_font_size_6pt > em > strong,
-.visual_font_size_6pt em span,
-.visual_font_size_6pt span em {
-  font-size: 6pt !important;
-  line-height: 6pt;
-}
-
-.visual_font_size_8pt,
-.visual_font_size_8pt > em,
-.visual_font_size_8pt > strong,
-.visual_font_size_8pt > strong > span,
-.visual_font_size_8pt > span,
-.visual_font_size_8pt > strong > em,
-.visual_font_size_8pt > em > strong,
-.visual_font_size_8pt em span,
-.visual_font_size_8pt span em {
-  font-size: 8pt !important;
-  line-height: 8pt;
-}
-
-.visual_font_size_10pt,
-.visual_font_size_10pt > em,
-.visual_font_size_10pt > strong,
-.visual_font_size_10pt > strong > em,
-.visual_font_size_10pt > em > strong,
-.visual_font_size_10pt em span,
-.visual_font_size_10pt span em {
-  font-size: 10pt !important;
-  line-height: 10pt;
-}
-
-.visual_font_size_12pt,
-.visual_font_size_12pt > em,
-.visual_font_size_12pt > strong,
-.visual_font_size_12pt > strong > em,
-.visual_font_size_12pt > em > strong,
-.visual_font_size_12pt em span,
-.visual_font_size_12pt span em {
-  font-size: 12pt !important;
-  line-height: 12pt;
-}
-
-.visual_font_size_14pt,
-.visual_font_size_14pt > em,
-.visual_font_size_14pt > strong,
-.visual_font_size_14pt > strong > span,
-.visual_font_size_14pt > span,
-.visual_font_size_14pt > strong > em,
-.visual_font_size_14pt > em > strong,
-.visual_font_size_14pt em span,
-.visual_font_size_14pt span em {
-  font-size: 14pt !important;
-  line-height: 14pt;
-}
-
-.visual_font_size_18pt,
-.visual_font_size_18pt > em,
-.visual_font_size_18pt > strong,
-.visual_font_size_18pt > strong > span,
-.visual_font_size_18pt > span,
-.visual_font_size_18pt > strong > em,
-.visual_font_size_18pt > em > strong,
-.visual_font_size_18pt em span,
-.visual_font_size_18pt span em {
-  font-size: 18pt !important;
-  line-height: 18pt;
-}
-
-.visual_font_size_24pt,
-.visual_font_size_24pt > em,
-.visual_font_size_24pt > strong,
-.visual_font_size_24pt > strong > span,
-.visual_font_size_24pt > span,
-.visual_font_size_24pt > strong > em,
-.visual_font_size_24pt > em > strong,
-.visual_font_size_24pt em span,
-.visual_font_size_24pt span em {
-  font-size: 24pt !important;
-  line-height: 24pt;
-}
-
-.visual_font_size_28pt,
-.visual_font_size_28pt > em,
-.visual_font_size_28pt > strong,
-.visual_font_size_28pt > strong > span,
-.visual_font_size_28pt > span,
-.visual_font_size_28pt > strong > em,
-.visual_font_size_28pt > em > strong,
-.visual_font_size_28pt em span,
-.visual_font_size_28pt span em {
-  font-size: 28pt !important;
-  line-height: 28pt;
-}
-
-.visual_font_size_36pt,
-.visual_font_size_36pt > em,
-.visual_font_size_36pt > strong,
-.visual_font_size_36pt > strong > span,
-.visual_font_size_36pt > span,
-.visual_font_size_36pt > strong > em,
-.visual_font_size_36pt > em > strong,
-.visual_font_size_36pt em span,
-.visual_font_size_36pt span em {
-  font-size: 36pt !important;
-  line-height: 36pt;
-}
-
-.visual_font_size_48pt,
-.visual_font_size_48pt > em,
-.visual_font_size_48pt > strong,
-.visual_font_size_48pt > strong > span,
-.visual_font_size_48pt > span,
-.visual_font_size_48pt > strong > em,
-.visual_font_size_48pt > em > strong,
-.visual_font_size_48pt em span,
-.visual_font_size_48pt span em {
-  font-size: 48pt !important;
-  line-height: 48pt;
-}
-
-.visual_font_size_60pt,
-.visual_font_size_60pt > em,
-.visual_font_size_60pt > strong,
-.visual_font_size_60pt > strong > span,
-.visual_font_size_60pt > span,
-.visual_font_size_60pt > strong > em,
-.visual_font_size_60pt > em > strong,
-.visual_font_size_60pt em span,
-.visual_font_size_60pt span em {
-  font-size: 60pt !important;
-  line-height: 60pt;
-}
-
-.visual_font_size_72pt,
-.visual_font_size_72pt > em,
-.visual_font_size_72pt > strong,
-.visual_font_size_72pt > strong > span,
-.visual_font_size_72pt > span,
-.visual_font_size_72pt > strong > em,
-.visual_font_size_72pt > em > strong,
-.visual_font_size_72pt em span,
-.visual_font_size_72pt span em {
-  font-size: 72pt !important;
-  line-height: 72pt;
-}
-
-.visual_font_size_84pt,
-.visual_font_size_84pt > em,
-.visual_font_size_84pt > strong,
-.visual_font_size_84pt > strong > span,
-.visual_font_size_84pt > span,
-.visual_font_size_84pt > strong > em,
-.visual_font_size_84pt > em > strong,
-.visual_font_size_84pt em span,
-.visual_font_size_84pt span em {
-  font-size: 84pt !important;
-  line-height: 84pt;
-}
-
-.visual_font_size_96pt,
-.visual_font_size_96pt > em,
-.visual_font_size_96pt > strong,
-.visual_font_size_96pt > strong > span,
-.visual_font_size_96pt > span,
-.visual_font_size_96pt > strong > em,
-.visual_font_size_96pt > em > strong,
-.visual_font_size_96pt em span,
-.visual_font_size_96pt span em {
-  font-size: 96pt !important;
-  line-height: 96pt;
-}
-
-.visual_font_size_116pt,
-.visual_font_size_116pt > em,
-.visual_font_size_116pt > strong,
-.visual_font_size_116pt > strong > span,
-.visual_font_size_116pt > span,
-.visual_font_size_116pt > strong > em,
-.visual_font_size_116pt > em > strong,
-.visual_font_size_116pt em span,
-.visual_font_size_116pt span em {
-  font-size: 116pt !important;
-  line-height: 116pt;
-}
-
-.visual_font_size_128pt,
-.visual_font_size_128pt > em,
-.visual_font_size_128pt > strong,
-.visual_font_size_128pt > strong > span,
-.visual_font_size_128pt > span,
-.visual_font_size_128pt > strong > em,
-.visual_font_size_128pt > em > strong,
-.visual_font_size_128pt em span,
-.visual_font_size_128pt span em {
-  font-size: 128pt !important;
-  line-height: 128pt;
-}
-
-.visual_font_size_140pt,
-.visual_font_size_140pt > em,
-.visual_font_size_140pt > strong,
-.visual_font_size_140pt > strong > span,
-.visual_font_size_140pt > span,
-.visual_font_size_140pt > strong > em,
-.visual_font_size_140pt > em > strong,
-.visual_font_size_140pt em span,
-.visual_font_size_140pt span em {
-  font-size: 140pt !important;
-  line-height: 140pt;
-}
-
-.visual_font_size_154pt,
-.visual_font_size_154pt > em,
-.visual_font_size_154pt > strong,
-.visual_font_size_154pt > strong > span,
-.visual_font_size_154pt > span,
-.visual_font_size_154pt > strong > em,
-.visual_font_size_154pt > em > strong,
-.visual_font_size_154pt em span,
-.visual_font_size_154pt span em {
-  font-size: 154pt !important;
-  line-height: 154pt;
-}
-
-.visual_font_size_196pt,
-.visual_font_size_196pt > em,
-.visual_font_size_196pt > strong,
-.visual_font_size_196pt > strong > span,
-.visual_font_size_196pt > span,
-.visual_font_size_196pt > strong > em,
-.visual_font_size_196pt > em > strong,
-.visual_font_size_196pt em span,
-.visual_font_size_196pt span em {
-  font-size: 196pt !important;
-  line-height: 196pt;
-}
-
-.resize_visual_font_size_8pt,
-.resize_visual_font_size_8pt > em,
-.resize_visual_font_size_8pt > strong,
-.resize_visual_font_size_8pt > strong > span,
-.resize_visual_font_size_8pt > span,
-.resize_visual_font_size_8pt > strong > em,
-.resize_visual_font_size_8pt > em > strong,
-.visual_font_size_8pt em span,
-.visual_font_size_8pt span em {
-  font-size: 4pt !important;
-  line-height: 4pt;
-}
-.resize_visual_font_size_14pt,
-.resize_visual_font_size_14pt > em,
-.resize_visual_font_size_14pt > strong,
-.resize_visual_font_size_14pt > strong > span,
-.resize_visual_font_size_14pt > span,
-.resize_visual_font_size_14pt > strong > em,
-.resize_visual_font_size_14pt > em > strong,
-.visual_font_size_14pt em span,
-.visual_font_size_14pt span em {
-  font-size: 7pt !important;
-  line-height: 7pt;
-}
-.resize_visual_font_size_24pt,
-.resize_visual_font_size_24pt > em,
-.resize_visual_font_size_24pt > strong,
-.resize_visual_font_size_24pt > strong > span,
-.resize_visual_font_size_24pt > span,
-.resize_visual_font_size_24pt > strong > em,
-.resize_visual_font_size_24pt > em > strong,
-.visual_font_size_14pt em span,
-.visual_font_size_14pt span em {
-  font-size: 12pt !important;
-  line-height: 12pt;
-}
-.resize_visual_font_size_36pt,
-.resize_visual_font_size_36pt > em,
-.resize_visual_font_size_36pt > strong,
-.resize_visual_font_size_36pt > strong > span,
-.resize_visual_font_size_36pt > span,
-.resize_visual_font_size_36pt > strong > em,
-.resize_visual_font_size_36pt > em > strong,
-.visual_font_size_36pt em span,
-.visual_font_size_36pt span em {
-  font-size: 18pt !important;
-  line-height: 18pt;
-}
-.resize_visual_font_size_72pt,
-.resize_visual_font_size_72pt > em,
-.resize_visual_font_size_72pt > strong,
-.resize_visual_font_size_72pt > strong > span,
-.resize_visual_font_size_72pt > span,
-.resize_visual_font_size_72pt > strong > em,
-.resize_visual_font_size_72pt > em > strong,
-.visual_font_size_72pt em span,
-.visual_font_size_72pt span em {
-  font-size: 36pt !important;
-  line-height: 36pt;
-}
-/*SIDEBAR*/
-.menu_sidebar {
-  color: #111;
-  background: #3f3f3f;
-
-  margin-left: 10px;
-  padding-left: 0px;
-  padding-right: 0px;
-  padding-top: 10px;
-  text-align: left;
-  font-family: arial, sans-serif, verdana;
-  font-size: 10px;
-  border: 1px solid #000;
-  position: absolute;
-  margin: 0;
-  width: 400px;
-  height: 260px;
-
-  -moz-box-shadow: 0px 4px 4px #010e1b !important;
-  -webkit-box-shadow: 0px 4px 4px #010e1b !important;
-  box-shadow: 0px 4px 4px #010e1b !important;
-
-  filter: alpha(opacity=97);
-  -moz-opacity: 0.97;
-  opacity: 0.97;
-}
-
-.menu_sidebar_radius_left {
-  -moz-border-top-left-radius: 8px;
-  -webkit-border-top-left-radius: 8px;
-  border-top-left-radius: 8px;
-
-  -moz-border-bottom-left-radius: 8px;
-  -webkit-border-bottom-left-radius: 8px;
-  border-bottom-left-radius: 8px;
-
-  border-right: 0px solid #000;
-}
-
-.menu_sidebar_radius_right {
-  -moz-border-top-right-radius: 8px;
-  -webkit-border-top-right-radius: 8px;
-  border-top-right-radius: 8px;
-  -moz-border-bottom-right-radius: 8px;
-  -webkit-border-bottom-right-radius: 8px;
-  border-bottom-right-radius: 8px;
-}
-
-.menu_sidebar_outer {
-  margin-left: 3px;
-  background: #ececec;
-  width: 100%;
-  text-align: center;
-  -moz-border-radius: 6px;
-  -webkit-border-radius: 6px;
-  border-radius: 6px;
-  padding: 8px;
-}
-
-/*Groupsview*/
-
-.groupsview {
-  border-spacing: 0px 4px;
-}
-
-.groupsview tr {
-  background-color: #666;
-}
-
-.groupsview th {
-  font-size: 12px;
-  padding: 5px;
-}
-
-.groupsview td.first,
-.groupsview th.first {
-  -moz-border-top-left-radius: 10px;
-  -webkit-border-top-left-radius: 10px;
-  border-top-left-radius: 10px;
-
-  -moz-border-bottom-left-radius: 10px;
-  -webkit-border-bottom-left-radius: 10px;
-  border-bottom-left-radius: 10px;
-}
-
-.groupsview td.last,
-.groupsview th.last {
-  -moz-border-top-right-radius: 10px;
-  -webkit-border-top-right-radius: 10px;
-  border-top-right-radius: 10px;
-  -moz-border-bottom-right-radius: 10px;
-  -webkit-border-bottom-right-radius: 10px;
-  border-bottom-right-radius: 10px;
-}
-
-a.tip {
-  display: inline !important;
-  cursor: help;
-}
-
-a.tip > img {
-  margin-left: 2px;
-  margin-right: 2px;
-}
-
-input.search_input {
-  background: white url("../../images/input_zoom.png") no-repeat right;
-  padding: 0px;
-  padding-left: 5px;
-  margin: 0;
-  width: 80%;
-  height: 19px;
-  margin-bottom: 5px;
-  margin-left: 2px;
-  padding-right: 25px;
-  color: #999;
-}
-
-.vertical_fields td input,
-.vertical_fields td select {
-  margin-top: 8px !important;
-}
-
-a[id^="tgl_ctrl_"] > img,
-a[id^="tgl_ctrl_"] > b > img {
-  vertical-align: middle;
-}
-
-.noshadow {
-  -moz-box-shadow: 0px !important;
-  -webkit-box-shadow: 0px !important;
-  box-shadow: 0px !important;
-}
-
-/* Images forced title */
-
-div.forced_title_layer {
-  display: block;
-  text-decoration: none;
-  position: absolute;
-  z-index: 100000;
-  border: 1px solid #708090;
-  background-color: #666;
-  color: #fff;
-  padding: 4px 5px;
-  font-weight: bold;
-  font-size: small;
-  font-size: 11px;
-  /* IE 8 */
-  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=9)";
-  /* Netscape */
-  -moz-opacity: 0.9;
-  opacity: 0.9;
-  -moz-border-radius: 3px;
-  -webkit-border-radius: 3px;
-  border-radius: 3px;
-}
-
-/* Graphs styles */
-
-div.legend > div {
-  pointer-events: none; /* Allow to click the graphs below */
-  opacity: 0.65 !important;
-}
-
-div.nodata_text {
-  padding: 5px 12px 0px 68px;
-  font-weight: bold;
-  color: #c1c1c1;
-  text-transform: uppercase;
-  display: table-cell;
-  vertical-align: middle;
-  text-align: left;
-}
-
-div.nodata_container {
-  width: 150px;
-  height: 100px;
-  background-repeat: no-repeat;
-  background-position: center;
-  margin: auto auto;
-  display: table;
-}
-
-#snmp_data {
-  width: 40%;
-  position: absolute;
-  top: 0;
-  right: 20px;
-
-  #background-color: #fff;
-  #padding: 10px;
-}
-
-#rmf_data {
-  width: 40%;
-  height: 80%;
-  position: absolute;
-  top: 0;
-  right: 20px;
-  overflow: auto;
-
-  #background-color: #fff;
-  #padding: 10px;
-}
-
-/* Subtab styles */
-
-ul.subsubmenu {
-  border-bottom-right-radius: 5px;
-  border-bottom-left-radius: 5px;
-  -moz-border-bottom-right-radius: 5px;
-  -moz-border-bottom-left-radius: 5px;
-  -webkit-border-bottom-right-radius: 5px;
-  -webkit-border-bottom-left-radius: 5px;
-
-  background: #ececec !important;
 }
 
 ul.subsubmenu li {
-  background-color: #ececec;
-  font-weight: bold;
-  text-decoration: none;
-  font-size: 14px;
-  border-color: #e2e2e2;
-  border-style: solid;
-  border-width: 1px;
+  background-color: #82b92e;
 }
 
-ul.subsubmenu li a {
-  padding: 0px 10px 5px;
+.godmode {
+  border-top: 1px solid #ddd;
 }
 
-div#agent_wizard_subtabs {
-  position: absolute;
-  margin-left: 0px;
-  display: none;
-  padding-bottom: 3px;
-  z-index: 1000;
+.menu li ul {
+  border: 1px solid #eee;
 }
 
-.agent_wizard_tab:hover {
-  cursor: default;
-}
-
-#container_servicemap_legend {
-  position: absolute;
-  width: 200px;
-  background: #fff;
-  margin-top: 10px;
-  right: 2px;
-  border: 1px solid #e2e2e2;
-  border-radius: 5px;
-  padding: 10px;
-  opacity: 0.9;
-}
-
-#container_servicemap_legend table {
-  text-align: left;
-}
-
-.legend_square {
-  width: 20px;
-  padding-left: 20px;
-  padding-right: 10px;
-}
-
-.legend_square_simple {
-  padding-left: 0px;
-  padding-right: 10px;
-  padding-bottom: 3px;
-}
-.legend_square div,
-.legend_square_simple div {
-  width: 20px;
-  height: 20px;
-  border-radius: 3px;
-}
-
-.legend_basic {
-  background: #f4f4f4;
-  margin-top: 10px;
-  border-radius: 5px;
-  padding: 10px;
-}
-
-.agents_modules_table th {
-  background: #3f3f3f;
-}
-
-.agents_modules_table th * {
-  color: #ffffff;
-}
-
-/*
- * LOAD_ENTERPRISE.PHP
- */
-#code_license_dialog {
-  padding: 50px;
-  padding-top: 10px;
-}
-#code_license_dialog #logo {
-  margin-bottom: 20px;
-  text-align: center;
-}
-#code_license_dialog,
-#code_license_dialog * {
-  font-size: 14px;
-}
-#code_license_dialog ul {
-  padding-left: 30px;
-  list-style-image: url("../../images/input_tick.png");
-}
-#code_license_dialog li {
-  margin-bottom: 12px;
-}
-
-#code_license_dialog #code {
-  font-weight: bolder;
-  font-size: 20px;
-  border: 1px solid #dddddd;
-  padding: 5px;
-  text-align: center;
-  -moz-border-radius: 8px;
-  -webkit-border-radius: 8px;
-  border-radius: 8px;
-}
-
-#code_license_dialog a {
-  text-decoration: underline;
-}
-
-/* GRAPHS CSS */
-
-.parent_graph {
-  position: relative;
-}
-
-.menu_graph,
-.timestamp_graph {
-  position: absolute !important;
-}
-
-.menu_graph {
-  -moz-border-top-right-radius: 6px;
-  -webkit-border-top-right-radius: 6px;
-  border-top-right-radius: 6px;
-  -moz-border-top-left-radius: 6px;
-  -webkit-border-top-left-radius: 6px;
-  border-top-left-radius: 6px;
-}
-
-.legend_graph {
-  margin: 0px;
-  padding: 0px;
-  text-align: left;
-}
-
-.legendColorBox * {
-  font-size: 0px;
-  padding: 0px 4px;
-  overflow: visible !important;
-}
-
-/* GIS CSS */
-
-.olLayerDiv {
-  z-index: 102 !important;
-}
-
-/* Alert view */
-
-table.alert_days th,
-table.alert_time th {
-  height: 30px;
-  vertical-align: middle;
-}
-
-table.alert_escalation th img {
-  width: 18px;
-}
-
-td.used_field {
-  #border: solid #6eb432;
-  background: #6eb432 !important;
-  color: #ffffff;
-  font-weight: bold;
-}
-
-td.overrided_field {
+#title_menu,
+.submenu_text {
   color: #666;
 }
-
-td.unused_field {
-  color: #888;
+#title_menu:hover,
+.submenu_text:hover {
+  color: #b9b9b9;
 }
 
-td.empty_field {
-  background: url("../../images/long_arrow.png") no-repeat 100% center;
+.button_collapse,
+div#foot {
+  background-color: #82b92e;
 }
 
-#table_macros textarea {
-  width: 96%;
-}
-
-/* Policies styles */
-
-table#policy_modules td * {
-  display: inline;
-}
-
-.context_help_title {
-  font-weight: bolder;
-  text-align: left;
-}
-.context_help_body {
-  text-align: left;
-}
-
-#left_column_logon_ok {
-  width: 750px;
-  float: left;
-}
-
-#news_board {
-  min-width: 530px;
-}
-
-#right_column_logon_ok {
-  width: 350px;
-  float: right;
-  margin-right: 20px;
-}
-
-#clippy_head_title {
-  font-weight: bold;
-  background: #80ab51;
-  color: #ffffff;
-  margin-top: -15px;
-  margin-left: -15px;
-  margin-right: -15px;
-  padding: 5px;
-  margin-bottom: 10px;
-  border-top-left-radius: 2px;
-  border-top-right-radius: 2px;
-}
-
-#dialog-double_auth-container {
-  width: 100%;
-  text-align: center;
-  vertical-align: middle;
-}
-
-.center_align {
-  text-align: center;
-}
-
-.left_align {
-  text-align: left;
-}
-
-.status_tactical {
-  width: 100%;
-  margin-left: auto;
-  margin-right: auto;
-  background-color: #fff !important;
-  padding: 10px;
-  border: 1px solid #e2e2e2;
-  margin-top: 5%;
-  text-align: left;
-}
-
-.status_tactical img {
-  border: 3px solid #000;
-  border-radius: 100px;
-}
-
-#sumary {
+/* footer */
+div#foot a,
+div#foot span {
   color: #fff;
-  margin: 15px;
-  padding: 10px 30px;
-  font-size: 20px;
-  font-weight: bold;
-  height: 66px;
-  width: 191px;
-  border-radius: 2px;
 }
 
-.databox.data td {
-  border-bottom: 1px solid #e2e2e2;
-}
-
-.databox .search {
-  margin-top: 0px;
-}
-
-.databox.data td.progress_bar img {
-  border: 3px solid #000;
-  border-radius: 100px;
-}
-
-.databox td {
-  padding-left: 9px;
-  padding-right: 9px;
-  padding-top: 7px;
-  padding-bottom: 7px;
-}
-.databox.pies fieldset.tactical_set {
-  width: 70% !important;
-  height: 285px;
-}
-
-.difference {
-  border-left-width: 2px;
-  border-left-style: solid;
-  border-right-width: 2px;
-  border-right-style: solid;
-  border-color: #e2e2e2;
-}
-
-#title_menu {
-  color: #fff;
-  float: right;
-  width: 70%;
-  letter-spacing: 0pt;
-  font-size: 8pt;
-  white-space: pre-wrap;
-}
-
-.no_hidden_menu {
-  background-position: 11% 50% !important;
-}
-
-#menu_tab li.nomn,
-#menu_tab li.nomn_high {
-  background-color: #ececec;
-  padding-right: 3px;
-  padding-left: 3px;
-  font-weight: bold;
-  text-decoration: none;
-  font-size: 14px;
-  border-color: #e2e2e2;
-  border-style: solid;
-  border-width: 1px;
-  margin-top: -10px;
+/* Tabs */
+#menu_tab_frame,
+#menu_tab_frame_view,
+#menu_tab_frame_view_bc {
+  background-color: #82b92e;
 }
 
 #menu_tab li.nomn_high,
 #menu_tab li.nomn_high span {
+  box-shadow: inset 0px 4px #fff;
+  background-color: transparent;
+}
+#menu_tab li:hover {
+  box-shadow: inset 0px 4px #fff;
+  background-color: #ffffff38;
+}
+
+#menu_tab_left li a,
+#menu_tab_left li span {
   color: #fff;
-  background-color: #fff;
 }
 
 #menu_tab li.nomn img,
 #menu_tab li img {
-  margin-top: 3px;
-  margin-left: 3px;
+  filter: brightness(4.5);
 }
 
-#menu_tab li.tab_operation a,
-#menu_tab a.tab_operation {
-  background: none !important ;
+/* General styles */
+body,
+div#page {
+  background: #ecfad6;
 }
 
-.subsubmenu {
-  position: absolute;
-  float: right;
-  z-index: 9999;
-  display: none;
-  margin-top: 6px !important ;
-  left: 0px !important;
-}
-.subsubmenu li {
-  margin-top: 0px !important ;
+#top_btn {
+  background-color: #343434;
 }
 
-.agents_modules_table {
-  border: 1px solid #e2e2e2;
-  border-spacing: 0px;
-}
-.agents_modules_table td {
-  border: 1px solid #e2e2e2;
-}
-.agents_modules_table th {
-  border: 1px solid #e2e2e2;
+#top_btn:hover {
+  background-color: transparent;
 }
 
-.databox.filters,
-.databox.data,
-.databox.profile_list {
-  margin-bottom: 20px;
+.breadcrumb_link.selected,
+.breadcrumb_active {
+  color: #ecfad6;
 }
 
-.databox.filters td {
-  padding: 10px;
-  padding-left: 20px;
-}
-.databox.profile_list td {
-  padding: 4px 1px;
-  padding-left: 5px;
-  border-bottom: 1px solid #e2e2e2;
-}
-.databox.profile_list a.tip > img {
-  margin: 0px;
+.sort_arrow img {
+  filter: brightness(2.5) contrast(3.5);
 }
 
-.databox.filters td > img,
-.databox.filters td > div > a > img,
-.databox.filters td > span > img,
-.databox.filters td > span > a > img,
-.databox.filters td > a > img {
-  vertical-align: middle;
-  margin-left: 5px;
-}
-.databox.data td > img,
-.databox.data th > img,
-.databox.data td > div > a > img,
-.databox.data td > span > img,
-.databox.data td > span > a > img,
-.databox.data td > a > img,
-.databox.data td > form > a > img {
-  vertical-align: middle;
+table.widget_list tr.datos,
+table.widget_list tr.datos2,
+table.widget_list td.datos,
+table.widget_list td.datos2 {
+  background-color: #ecfad6;
 }
 
-.databox.filters td > a > img {
-  vertical-align: middle;
+/* tables.css */
+.info_table tr:first-child > th {
+  background-color: #343434;
+  color: #fff;
 }
 
-.databox.data td > input[type="checkbox"] {
-  margin: 0px;
+.info_table > tbody > tr > th,
+.info_table > thead > tr > th,
+.info_table > thead > tr > th a,
+.info_table > thead > tr > th > span {
+  color: #fff;
 }
 
-.databox_color td {
-  padding-left: 10px;
+/* agent view*/
+.agent_details_header,
+.white_table tr:first-child > th,
+.white_table_graph_header {
+  background-color: #343434;
+  color: #fff;
+  border-top-left-radius: 5px;
+  border-top-right-radius: 5px;
 }
 
-.databox.agente td > div > canvas {
-  width: 100% !important;
-  text-align: left !important;
-}
-.databox.agente td > div.graph {
-  width: 100% !important;
-  text-align: left !important;
+.white_table thead tr:first-child > th {
+  border-radius: 0;
 }
 
-.godmode,
-.menu_icon ul li {
-  background-color: #222;
-}
-.operation .menu_icon ul li {
-  background-color: #333;
+.white_table thead tr:first-child > th:first-child {
+  border-top-left-radius: 4px;
 }
 
-.godmode {
-  border-top: 4px solid !important;
-  padding-bottom: 4px !important;
-  border-bottom-right-radius: 5px;
-  border-right-style: solid;
-  border-right-width: 0px;
+.white_table thead tr:first-child > th:last-child {
+  border-top-right-radius: 4px;
 }
 
-.green_title {
-  background-color: #80ab51;
-  font-weight: normal;
-  text-align: center;
+.buttons_agent_view a img {
+  background-color: #fff;
 }
 
-.dashboard {
-  top: 23px;
+.breadcrumbs_container,
+.breadcrumb_link,
+div.agent_details_agent_alias * {
+  color: #fff;
 }
 
-.dashboard li a {
-  width: 158px !important;
-}
-
-.text_subDashboard {
-  float: left;
-  margin-top: 5%;
-  margin-left: 3%;
-}
-
-/* The items with the class 'spinner' will rotate */
-/* Not supported on IE9 and below */
-.spinner {
-  -webkit-animation: spinner 2s infinite linear;
-  animation: spinner 2s infinite linear;
-}
-
-@-webkit-keyframes spinner {
-  0% {
-    -ms-transform: rotate(0deg); /* IE */
-    -moz-transform: rotate(0deg); /* FF */
-    -o-transform: rotate(0deg); /* Opera */
-    -webkit-transform: rotate(0deg); /* Safari and Chrome */
-    transform: rotate(0deg);
-  }
-  100% {
-    -ms-transform: rotate(359deg); /* IE */
-    -moz-transform: rotate(359deg); /* FF */
-    -o-transform: rotate(359deg); /* Opera */
-    -webkit-transform: rotate(359deg); /* Safari and Chrome */
-    transform: rotate(359deg);
-  }
-}
-
-@keyframes spinner {
-  0% {
-    -ms-transform: rotate(0deg); /* IE */
-    -moz-transform: rotate(0deg); /* FF */
-    -o-transform: rotate(0deg); /* Opera */
-    -webkit-transform: rotate(0deg); /* Safari and Chrome */
-    transform: rotate(0deg);
-  }
-  100% {
-    -ms-transform: rotate(359deg); /* IE */
-    -moz-transform: rotate(359deg); /* FF */
-    -o-transform: rotate(359deg); /* Opera */
-    -webkit-transform: rotate(359deg); /* Safari and Chrome */
-    transform: rotate(359deg);
-  }
-}
-
-#alert_messages {
-  -moz-border-bottom-right-radius: 5px;
-  -webkit-border-bottom-left-radius: 5px;
-  border-bottom-right-radius: 5px;
-  border-bottom-left-radius: 5px;
-  z-index: 3;
-  position: fixed;
-  width: 750px;
-  max-width: 750px;
-  min-width: 750px;
-  top: 20%;
-  background: white;
-}
-.modalheader {
-  text-align: center;
-  width: 100%;
-  height: 37px;
-  left: 0px;
-  background-color: #82b92e;
-}
-.modalheadertext {
-  color: white;
-  position: relative;
-  font-family: Nunito;
-  font-size: 13pt;
-  top: 8px;
-}
-.modalclosex {
-  cursor: pointer;
-  display: inline;
-  float: right;
-  margin-right: 10px;
-  margin-top: 10px;
-}
-.modalcontent {
-  color: black;
-  background: white;
-}
-.modalcontentimg {
-  float: left;
-  margin-left: 30px;
-  margin-top: 30px;
-  margin-bottom: 30px;
-}
-.modalcontenttext {
-  float: left;
-  text-align: justify;
-  color: black;
-  font-size: 9.5pt;
-  line-height: 13pt;
-  margin-top: 30px;
-  width: 430px;
-  margin-left: 30px;
-}
-.modalokbutton {
-  cursor: pointer;
-  text-align: center;
-  margin-right: 45px;
-  float: right;
-  -moz-border-radius: 3px;
-  -webkit-border-radius: 3px;
-  margin-bottom: 30px;
-  border-radius: 3px;
-  width: 90px;
-  height: 30px;
-  background-color: white;
-  border: 1px solid #82b92e;
-}
-.modalokbuttontext {
-  color: #82b92e;
-  font-family: Nunito;
-  font-size: 10pt;
-  position: relative;
-  top: 6px;
-}
-.modalgobutton {
-  cursor: pointer;
-  text-align: center;
-  margin-right: 15px;
-  margin-bottom: 30px;
-  float: right;
-  -moz-border-radius: 3px;
-  -webkit-border-radius: 3px;
-  border-radius: 3px;
-  width: 240px;
-  height: 30px;
-  background-color: white;
-  border: 1px solid #82b92e;
-}
-.modalgobuttontext {
-  color: #82b92e;
-  font-family: Nunito;
-  font-size: 10pt;
-  position: relative;
-  top: 6px;
-}
-
-#opacidad {
-  opacity: 0.5;
-  z-index: 1;
-  width: 100%;
-  height: 100%;
-  position: absolute;
-  left: 0px;
-  top: 0px;
-}
-
-.textodialogo {
-  margin-left: 0px;
-  color: #333;
-  padding: 20px;
-  font-size: 9pt;
-}
-
-.cargatextodialogo {
-  max-width: 58.5%;
-  width: 58.5%;
-  min-width: 58.5%;
-  float: left;
-  margin-left: 0px;
-  font-size: 18pt;
-  padding: 20px;
-  text-align: center;
-}
-
-.cargatextodialogo p,
-.cargatextodialogo b,
-.cargatextodialogo a {
-  font-size: 18pt;
-}
-
-#toolbox > input {
-  border-width: 0px 1px 0px 0px;
-  border-color: lightgray;
-}
-
-#toolbox > input.service_min {
-  border-width: 0px 0px 0px 0px;
-}
-
-#toolbox > input.grid_min {
-  border-width: 0px 0px 0px 0px;
-}
-
-#tinymce {
-  padding-top: 20px;
-}
-
-.rowPair:hover,
-.rowOdd:hover {
-  background-color: #eee;
-}
-.databox.data > tbody > tr:hover {
-  background-color: #eee;
-}
-.checkselected {
-  background-color: #eee;
+/* jquery custom */
+.ui-dialog,
+.ui-widget-content {
+  background-color: #ecfad6;
 }
diff --git a/pandora_console/include/styles/pandora_minimal.css b/pandora_console/include/styles/pandora_minimal.css
index 8c9649888d..d9d6bbdc60 100644
--- a/pandora_console/include/styles/pandora_minimal.css
+++ b/pandora_console/include/styles/pandora_minimal.css
@@ -129,7 +129,7 @@ td.scwWeekNumberHead {
 }
 
 td.scwWeek {
-  color: #000 !important;
+  color: #000;
 }
 
 /* Today selector */
@@ -148,7 +148,7 @@ tfoot.scwFoot {
 }
 
 .scwFoot :hover {
-  color: #ffa500 !important;
+  color: #ffa500;
 }
 
 input.next {
@@ -164,18 +164,18 @@ input.next {
   margin: 10px auto;
   padding: 5px;
   border: 1px solid #a8a8a8;
-  width: 85% !important;
-  -moz-box-shadow: 0px 2px 2px #010e1b !important;
-  -webkit-box-shadow: 0px 2px 2px #010e1b !important;
-  box-shadow: 0px 2px 2px #010e1b !important;
+  width: 85%;
+  -moz-box-shadow: 0px 2px 2px #010e1b;
+  -webkit-box-shadow: 0px 2px 2px #010e1b;
+  box-shadow: 0px 2px 2px #010e1b;
 }
 
 .info_box .title * {
-  font-size: 10pt !important;
+  font-size: 10pt;
   font-weight: bolder;
 }
 
 .info_box .icon {
-  width: 30px !important;
+  width: 30px;
   text-align: center;
 }
diff --git a/pandora_console/include/styles/progress.css b/pandora_console/include/styles/progress.css
index 84c3224f27..f263e87fcf 100644
--- a/pandora_console/include/styles/progress.css
+++ b/pandora_console/include/styles/progress.css
@@ -1,20 +1,23 @@
-span.progress_text {
-  position: absolute;
-  font-family: "lato-bolder", "Open Sans", sans-serif;
-  font-size: 2em;
-  margin-left: -0.5em;
-}
-
-div.progress_main {
-  display: inline-block;
-  text-align: center;
+.progress_main {
   height: 2.5em;
-  border: 1px solid #80ba27;
+  border: 1px solid #82b92e;
+  position: relative;
+  width: 100%;
+  display: inline-block;
+}
+.progress_main:before {
+  content: attr(data-label);
+  position: absolute;
+  text-align: center;
+  left: 0;
+  right: 0;
+  margin-top: 0.2em;
+  font-family: "lato-bolder", "Open Sans", sans-serif;
 }
 
-div.progress {
+.progress {
   width: 0%;
-  background: #80ba27;
+  background: #82b92e;
   height: 100%;
   float: left;
 }
diff --git a/pandora_console/include/styles/register.css b/pandora_console/include/styles/register.css
index d2589a3f01..ef0fdc6e1b 100644
--- a/pandora_console/include/styles/register.css
+++ b/pandora_console/include/styles/register.css
@@ -1,42 +1,44 @@
 input[type="submit"].submit-cancel,
+button.submit-cancel.ui-button.ui-corner-all.ui-widget,
 button.submit-cancel {
-  color: #fb4444 !important;
-  border: 1px solid #fb4444 !important;
-  background: #fff !important;
+  color: #fb4444;
+  border: 1px solid #fb4444;
+  background: #fff;
   padding: 5px;
   font-size: 1.3em;
-  margin: 0.5em 1em 0.5em 0 !important;
-  cursor: pointer !important;
-  text-align: center !important;
-  height: 30px !important;
-  width: 90px !important;
+  margin: 0.5em 1em 0.5em 0;
+  cursor: pointer;
+  text-align: center;
+  height: 30px;
+  width: 90px;
 }
 
 input[type="submit"].submit-cancel:hover,
+button.submit-cancel.ui-button.ui-corner-all.ui-widget:hover,
 button.submit-cancel:hover {
-  color: #fff !important;
-  background: #fb4444 !important;
+  color: #fff;
+  background: #fb4444;
 }
 
 input[type="submit"].submit-next,
-button.submit-next,
+button.submit-next.ui-button.ui-corner-all.ui-widget,
 input[type="button"].submit-next {
-  color: #82b92e !important;
-  border: 1px solid #82b92e !important;
-  background: #fff !important;
+  color: #82b92e;
+  border: 1px solid #82b92e;
+  background: #fff;
   padding: 5px;
   font-size: 1.3em;
-  margin: 0.5em 1em 0.5em 0 !important;
-  cursor: pointer !important;
-  text-align: center !important;
-  height: 30px !important;
+  margin: 0.5em 1em 0.5em 0;
+  cursor: pointer;
+  text-align: center;
+  height: 30px;
 }
 
 input[type="submit"].submit-next:hover,
-button.submit-next:hover,
+button.submit-next.ui-button.ui-corner-all.ui-widget:hover,
 input[type="button"].submit-next:hover {
-  color: #fff !important;
-  background: #82b92e !important;
+  color: #fff;
+  background: #82b92e;
 }
 
 div.submit_buttons_container {
diff --git a/pandora_console/include/styles/tables.css b/pandora_console/include/styles/tables.css
new file mode 100644
index 0000000000..23f6253421
--- /dev/null
+++ b/pandora_console/include/styles/tables.css
@@ -0,0 +1,354 @@
+/*
+ * ---------------------------------------------------------------------
+ * - TABLES
+ * ---------------------------------------------------------------------
+ */
+/* This is to use divs like tables */
+.table_div {
+  display: table;
+}
+.table_thead,
+.table_tbody {
+  display: table-row;
+}
+.table_th {
+  font-weight: bold;
+}
+.table_th,
+.table_td {
+  display: table-cell;
+  vertical-align: middle;
+  padding: 10px;
+}
+/* Tables with 3 columns */
+.table_three_columns .table_th,
+.table_three_columns .table_td {
+  width: 33%;
+}
+
+.white-box-content > form > .databox.filters {
+  border: none;
+}
+
+.databox.filters {
+  background: #fff;
+  padding: 1em 0;
+}
+
+.databox.filters,
+.databox.data {
+  margin-bottom: 20px;
+}
+
+.databox.filters > tbody > tr > td {
+  padding: 10px;
+  padding-left: 20px;
+}
+
+.databox.filters > tbody > tr > td > img,
+.databox.filters > tbody > tr > td > div > a > img,
+.databox.filters > tbody > tr > td > span > img,
+.databox.filters > tbody > tr > td > span > a > img,
+.databox.filters > tbody > tr > td > a > img {
+  vertical-align: middle;
+  margin-left: 5px;
+}
+.databox.filters > tbody > tr > td > a > img {
+  vertical-align: middle;
+}
+
+.databox.data > tbody > tr > td > img,
+.databox.data > thead > tr > th > img,
+.databox.data > tbody > tr > td > div > a > img,
+.databox.data > tbody > tr > td > span > img,
+.databox.data > tbody > tr > td > span > a > img,
+.databox.data > tbody > tr > td > a > img,
+.databox.data > tbody > tr > td > form > a > img {
+  vertical-align: middle;
+}
+
+.databox.data > tbody > tr:hover {
+  background-color: #eee;
+}
+
+.databox.data > tbody > tr > td > input[type="checkbox"] {
+  margin: 0px;
+}
+
+.databox_color > tbody > tr > td {
+  padding-left: 10px;
+}
+
+.databox.agente > tbody > tr > td > div > canvas {
+  width: 100%;
+  text-align: left;
+}
+.databox.agente > tbody > tr > td > div.graph {
+  width: 100%;
+  text-align: left;
+}
+
+.info_table {
+  background-color: #fff;
+  margin-bottom: 10px;
+  border-spacing: 0;
+  border-collapse: collapse;
+  overflow: hidden;
+  border-radius: 5px;
+}
+
+.info_table > tbody > tr:nth-child(even) {
+  background-color: #f5f5f5;
+}
+
+.info_table tr > td:first-child,
+.info_table tr > th:first-child {
+  padding-left: 5px;
+}
+.info_table tr > td:last-child,
+.info_table tr > th:last-child {
+  padding-right: 5px;
+}
+
+.info_table tr:first-child > th {
+  background-color: #fff;
+  color: #000;
+  text-align: left;
+  vertical-align: middle;
+}
+
+.info_table th {
+  font-size: 7.5pt;
+  letter-spacing: 0.3pt;
+  color: #000;
+  background-color: #fff;
+  cursor: pointer;
+}
+
+.info_table tr th {
+  border-bottom: 1px solid #e2e2e2;
+}
+
+.info_table > thead > tr {
+  height: 3em;
+  vertical-align: top;
+}
+
+/* Radius top */
+.info_table > thead > tr:first-child > th:first-child {
+  border-top-left-radius: 4px;
+}
+.info_table > thead > tr:first-child > th:last-child {
+  border-top-right-radius: 4px;
+}
+
+/* Radius bottom */
+.info_table > tbody > tr:last-child > td:first-child {
+  border-top-left-radius: 4px;
+}
+.info_table > tbody > tr:last-child > td:last-child {
+  border-top-right-radius: 4px;
+}
+
+.info_table > tbody > tr > th,
+.info_table > thead > tr > th,
+.info_table > thead > tr > th a,
+.info_table > thead > tr > th > span {
+  padding: 0.1em;
+  font-weight: normal;
+  color: #000;
+  margin-left: 0.5em;
+}
+
+.info_table > tbody > tr {
+  border-bottom: 1px solid #e2e2e2;
+}
+
+.info_table > tbody > tr > td {
+  -moz-border-radius: 0px;
+  -webkit-border-radius: 0px;
+  border-radius: 0px;
+  border: none;
+  padding-left: 0px;
+  padding-right: 9px;
+  padding-top: 7px;
+  padding-bottom: 7px;
+}
+
+.info_table.no-td-padding td {
+  padding-left: 0;
+  padding-right: 0;
+}
+
+.info_table > tbody > tr > td > img,
+.info_table > thead > tr > th > img,
+.info_table > tbody > tr > td > div > a > img,
+.info_table > tbody > tr > td > span > img,
+.info_table > tbody > tr > td > span > a > img,
+.info_table > tbody > tr > td > a > img,
+.info_table > tbody > tr > td > form > a > img {
+  vertical-align: middle;
+}
+
+.info_table > tbody > tr:hover {
+  /* This !important is necessary to overwrite the white background of tables with less than 5 rows. */
+  background-color: #eee !important;
+}
+
+.info_.profile_list > thead > tr > th > a.tip {
+  padding: 0px;
+}
+
+.info_table .datos3,
+.datos3,
+.info_table .datos4,
+.datos4 {
+  background-color: #fff;
+  color: #000;
+  border-bottom: 2px solid #82b92e;
+  border-left: none;
+  border-right: none;
+  height: 30px;
+  font-size: 8.6pt;
+  font-weight: normal;
+}
+
+.databox.datos2 {
+  background: #f5f5f5;
+}
+
+.databox.datos {
+  background: #fff;
+}
+
+.filters input {
+  background: #fbfbfb;
+}
+
+.datos4 {
+  /*Add because in php the function html_print_table write style in cell and this is style head.*/
+  text-align: center;
+}
+
+.datos3 *,
+.datos4 *,
+.info_table .datos3 *,
+.info_table .datos4 * {
+  font-size: 8.6pt;
+  font-weight: 600;
+  padding: 1.3em 0;
+}
+
+/*td.datos_id {
+	color: #1a313a;
+}*/
+
+/* user list php */
+tr.disabled_row_user * {
+  color: grey;
+}
+
+/* Disable datatables border */
+table.dataTable.info_table.no-footer {
+  border-bottom: none;
+}
+
+/* Datatables pagination */
+.dataTables_paginate.paging_simple_numbers {
+  margin: 2em 0;
+}
+
+a.pandora_pagination {
+  padding: 5px;
+  color: #000;
+  border: 1px solid #cacaca;
+  border-left: none;
+  min-width: 12px;
+  text-decoration: none;
+  cursor: pointer;
+}
+.dataTables_paginate > span > span.ellipsis + a.pandora_pagination:last-child,
+.dataTables_paginate a.pandora_pagination.previous {
+  border-left: 1px solid #cacaca;
+}
+
+a.pandora_pagination.disabled {
+  color: #cacaca;
+}
+a.pandora_pagination:hover {
+  text-decoration: none;
+  background-color: #e2e2e2;
+}
+
+a.pandora_pagination.current,
+a.pandora_pagination.current:hover {
+  color: #fff;
+  background-color: #82b92e;
+}
+
+/* CSV button datatables */
+.dt-button.buttons-csv.buttons-html5 {
+  background-image: url(../../images/csv_mc.png);
+  background-position: center center;
+  background-color: #fff;
+  background-repeat: no-repeat;
+  color: #000;
+  border: none;
+  font-family: "lato", "Open Sans", sans-serif;
+  cursor: pointer;
+  display: inline;
+  padding: 7pt;
+  margin-left: 10px;
+}
+.dt-button.buttons-csv.buttons-html5 span {
+  font-size: 0;
+}
+
+.dt-buttons {
+  margin-top: 3pt;
+}
+
+.dt-button.buttons-csv.buttons-html5:active,
+.dt-button.buttons-csv.buttons-html5:hover {
+  border: none;
+}
+
+.dt-button.buttons-csv.buttons-html5[disabled] {
+  color: #b4b4b4;
+  background-color: #f3f3f3;
+  border-color: #b6b6b6;
+  cursor: default;
+}
+
+/* Default datatable filter style */
+.datatable_filter.content {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+  align-items: center;
+  justify-content: space-between;
+}
+.datatable_filter.content label {
+  margin-right: 1em;
+}
+.datatable_filter.content li {
+  flex: 1 1 auto;
+  margin: 1em auto;
+}
+.sorting_desc {
+  background: url(../../images/sort_down_green.png) no-repeat;
+  background-position-x: left;
+  background-position-y: center;
+  cursor: pointer;
+}
+.sorting_asc {
+  background: url(../../images/sort_up_green.png) no-repeat;
+  background-position-x: left;
+  background-position-y: center;
+  cursor: pointer;
+}
+
+.info_table tr th.sorting_asc,
+.info_table tr th.sorting_desc {
+  padding-left: 15px;
+}
diff --git a/pandora_console/include/styles/tree.css b/pandora_console/include/styles/tree.css
index e86edfe90b..42649bd048 100644
--- a/pandora_console/include/styles/tree.css
+++ b/pandora_console/include/styles/tree.css
@@ -4,7 +4,7 @@
 }
 
 .tree-group {
-  margin-left: 16px;
+  margin-left: 19px;
   padding-top: 1px;
 }
 
@@ -22,7 +22,8 @@
   background: 0 0;
 }
 .node-content {
-  height: 16px;
+  height: 26px;
+  font-size: 1.2em;
 }
 
 .node-content > img {
@@ -128,7 +129,7 @@
 
 .tree-node > .node-content > .tree-node-counters > .tree-node-counter {
   font-weight: bold;
-  font-size: 7pt;
+  font-size: 1.2em;
   cursor: default;
 }
 
@@ -137,3 +138,7 @@ div#tree-controller-recipient {
   width: 98%;
   margin-top: 10px;
 }
+
+.tree-node > .node-content > div + div:not(.tree-node-counters) {
+  margin-left: 3px;
+}
diff --git a/pandora_console/include/styles/visual_maps.css b/pandora_console/include/styles/visual_maps.css
new file mode 100644
index 0000000000..ee2e6dc49b
--- /dev/null
+++ b/pandora_console/include/styles/visual_maps.css
@@ -0,0 +1,203 @@
+/*
+ * ---------------------------------------------------------------------
+ * - VISUAL MAPS 													-
+ * ---------------------------------------------------------------------
+ */
+
+div#vc-controls {
+  position: fixed;
+  top: 30px;
+  right: 20px;
+}
+
+div#vc-controls div.vc-title,
+div#vc-controls div.vc-refr {
+  margin-top: 15px;
+  margin-left: 3px;
+  margin-right: 3px;
+}
+div#vc-controls div.vc-refr > div {
+  display: inline;
+}
+div#vc-controls img.vc-qr {
+  margin-top: 12px;
+  margin-left: 8px;
+  margin-right: 8px;
+}
+
+.visual-console-edit-controls {
+  display: flex;
+  justify-content: flex-end;
+}
+
+.visual-console-edit-controls > span {
+  margin: 4px;
+}
+
+input.vs_button_ghost {
+  background-color: transparent;
+  border: 1px solid #82b92e;
+  color: #82b92e;
+  text-align: center;
+  padding: 4px 12px;
+  font-weight: bold;
+}
+
+#toolbox #auto_save {
+  padding-top: 5px;
+}
+
+#toolbox {
+  margin-top: 13px;
+}
+input.visual_editor_button_toolbox {
+  padding-right: 15px;
+  padding-top: 10px;
+  margin-top: 5px;
+}
+input.delete_min {
+  background: #fefefe url(../../images/cross.png) no-repeat center;
+}
+input.delete_min[disabled] {
+  background: #fefefe url(../../images/cross.disabled.png) no-repeat center;
+}
+input.graph_min {
+  background: #fefefe url(../../images/chart_curve.png) no-repeat center;
+}
+input.graph_min[disabled] {
+  background: #fefefe url(../../images/chart_curve.disabled.png) no-repeat
+    center;
+}
+input.bars_graph_min {
+  background: #fefefe url(../../images/icono-barras-arriba.png) no-repeat center;
+}
+input.bars_graph_min[disabled] {
+  background: #fefefe url(../../images/icono-barras-arriba.disabled.png)
+    no-repeat center;
+}
+input.percentile_min {
+  background: #fefefe url(../../images/chart_bar.png) no-repeat center;
+}
+input.percentile_min[disabled] {
+  background: #fefefe url(../../images/chart_bar.disabled.png) no-repeat center;
+}
+input.percentile_item_min {
+  background: #fefefe url(../../images/percentile_item.png) no-repeat center;
+}
+input.percentile_item_min[disabled] {
+  background: #fefefe url(../../images/percentile_item.disabled.png) no-repeat
+    center;
+}
+input.auto_sla_graph_min {
+  background: #fefefe url(../../images/auto_sla_graph.png) no-repeat center;
+}
+input.auto_sla_graph_min[disabled] {
+  background: #fefefe url(../../images/auto_sla_graph.disabled.png) no-repeat
+    center;
+}
+input.donut_graph_min {
+  background: #fefefe url(../../images/icono-quesito.png) no-repeat center;
+}
+input.donut_graph_min[disabled] {
+  background: #fefefe url(../../images/icono-quesito.disabled.png) no-repeat
+    center;
+}
+input.binary_min {
+  background: #fefefe url(../../images/binary.png) no-repeat center;
+}
+input.binary_min[disabled] {
+  background: #fefefe url(../../images/binary.disabled.png) no-repeat center;
+}
+input.camera_min {
+  background: #fefefe url(../../images/camera.png) no-repeat center;
+}
+input.camera_min[disabled] {
+  background: #fefefe url(../../images/camera.disabled.png) no-repeat center;
+}
+input.config_min {
+  background: #fefefe url(../../images/config.png) no-repeat center;
+}
+input.config_min[disabled] {
+  background: #fefefe url(../../images/config.disabled.png) no-repeat center;
+}
+input.label_min {
+  background: #fefefe url(../../images/tag_red.png) no-repeat center;
+}
+input.label_min[disabled] {
+  background: #fefefe url(../../images/tag_red.disabled.png) no-repeat center;
+}
+input.icon_min {
+  background: #fefefe url(../../images/photo.png) no-repeat center;
+}
+input.icon_min[disabled] {
+  background: #fefefe url(../../images/photo.disabled.png) no-repeat center;
+}
+input.clock_min {
+  background: #fefefe url(../../images/clock-tab.png) no-repeat center;
+}
+input.clock_min[disabled] {
+  background: #fefefe url(../../images/clock-tab.disabled.png) no-repeat center;
+}
+input.box_item {
+  background: #fefefe url(../../images/box_item.png) no-repeat center;
+}
+input.box_item[disabled] {
+  background: #fefefe url(../../images/box_item.disabled.png) no-repeat center;
+}
+input.line_item {
+  background: #fefefe url(../../images/line_item.png) no-repeat center;
+}
+input.line_item[disabled] {
+  background: #fefefe url(../../images/line_item.disabled.png) no-repeat center;
+}
+input.copy_item {
+  background: #fefefe url(../../images/copy_visualmap.png) no-repeat center;
+}
+input.copy_item[disabled] {
+  background: #fefefe url(../../images/copy_visualmap.disabled.png) no-repeat
+    center;
+}
+input.grid_min {
+  background: #fefefe url(../../images/grid.png) no-repeat center;
+}
+input.grid_min[disabled] {
+  background: #fefefe url(../../images/grid.disabled.png) no-repeat center;
+}
+input.save_min {
+  background: #fefefe url(../../images/file.png) no-repeat center;
+}
+input.save_min[disabled] {
+  background: #fefefe url(../../images/file.disabled.png) no-repeat center;
+}
+input.service_min {
+  background: #fefefe url(../../images/box.png) no-repeat center;
+}
+input.service_min[disabled] {
+  background: #fefefe url(../../images/box.disabled.png) no-repeat center;
+}
+
+input.group_item_min {
+  background: #fefefe url(../../images/group_green.png) no-repeat center;
+}
+input.group_item_min[disabled] {
+  background: #fefefe url(../../images/group_green.disabled.png) no-repeat
+    center;
+}
+input.color_cloud_min {
+  background: #fefefe url(../../images/color_cloud_item.png) no-repeat center;
+}
+input.color_cloud_min[disabled] {
+  background: #fefefe url(../../images/color_cloud_item.disabled.png) no-repeat
+    center;
+}
+
+div#cont {
+  position: fixed;
+  max-height: 320px;
+  overflow-y: auto;
+  overflow-x: hidden;
+}
+
+/*.termframe{
+	background-color: #82b92e;
+}*/
diff --git a/pandora_console/include/visual-console-client/vc.main.css b/pandora_console/include/visual-console-client/vc.main.css
index 20f5a1da7c..16ecacd33c 100644
--- a/pandora_console/include/visual-console-client/vc.main.css
+++ b/pandora_console/include/visual-console-client/vc.main.css
@@ -25,6 +25,28 @@
           user-select: text;
 }
 
+.visual-console-item.is-editing {
+  border: 2px dashed #b2b2b2;
+  -webkit-transform: translateX(-2px) translateY(-2px);
+          transform: translateX(-2px) translateY(-2px);
+  cursor: move;
+  -webkit-user-select: none;
+     -moz-user-select: none;
+      -ms-user-select: none;
+          user-select: none;
+}
+
+.visual-console-item.is-editing > .resize-draggable {
+  float: right;
+  position: absolute;
+  right: 0;
+  bottom: 0;
+  width: 15px;
+  height: 15px;
+  background: url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJDYXBhXzEiIAoJeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAKCXhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE1cHgiIGhlaWdodD0iMTVweCIgdmlld0JveD0iMCAwIDE1IDE1IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAxNSAxNSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+Cgk8bGluZSBmaWxsPSJub25lIiBzdHJva2U9IiNCMkIyQjIiIHN0cm9rZS13aWR0aD0iMS41IiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHgxPSIwLjU2MiIgeTE9IjM2LjMxNyIgeDI9IjE0LjIzMSIgeTI9IjIyLjY0OCIvPgoJPGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjQjJCMkIyIiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iNC45NzEiIHkxPSIzNi41OTUiIHgyPSIxNC40MDkiIHkyPSIyNy4xNTUiLz4KCTxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0IyQjJCMiIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjEwLjAxNyIgeTE9IjM2LjQzMyIgeDI9IjE0LjIzMSIgeTI9IjMyLjIxOCIvPgoJPGcgaWQ9ImpHRWVLbl8xXyI+CgoJCTxpbWFnZSBvdmVyZmxvdz0idmlzaWJsZSIgd2lkdGg9IjQ2IiBoZWlnaHQ9IjM3IiBpZD0iakdFZUtuIiB4bGluazpocmVmPSJkYXRhOmltYWdlL2pwZWc7YmFzZTY0LC85ai80QUFRU2taSlJnQUJBZ0VBU0FCSUFBRC83QUFSUkhWamEza0FBUUFFQUFBQUhnQUEvKzRBSVVGa2IySmxBR1RBQUFBQUFRTUEKRUFNQ0F3WUFBQUdSQUFBQnN3QUFBZ0wvMndDRUFCQUxDd3NNQ3hBTURCQVhEdzBQRnhzVUVCQVVHeDhYRnhjWEZ4OGVGeG9hR2hvWApIaDRqSlNjbEl4NHZMek16THk5QVFFQkFRRUJBUUVCQVFFQkFRRUFCRVE4UEVSTVJGUklTRlJRUkZCRVVHaFFXRmhRYUpob2FIQm9hCkpqQWpIaDRlSGlNd0t5NG5KeWN1S3pVMU1EQTFOVUJBUDBCQVFFQkFRRUJBUUVCQVFQL0NBQkVJQUNZQUx3TUJJZ0FDRVFFREVRSC8KeEFCNUFBRUJBUUVCQUFBQUFBQUFBQUFBQUFBQUFRUUNCZ0VCQUFBQUFBQUFBQUFBQUFBQUFBQUFBQkFBQVFRREFBQUFBQUFBQUFBQQpBQUFBQVFBeEFnTVFNQklSQUFFQkJnVUZBUUFBQUFBQUFBQUFBQUVDQUJFaFFXRURFQ0J4a1JJd01ZRXlFd1FTQVFBQUFBQUFBQUFBCkFBQUFBQUFBQURELzJnQU1Bd0VBQWhFREVRQUFBUGZBUzV6VFpUa0dQclVMWlFBQUQvL2FBQWdCQWdBQkJRRFQvOW9BQ0FFREFBRUYKQU5QLzJnQUlBUUVBQVFVQXpKZzJTUUJDMmQwdzJiWlN2Vk5jNW9NdUF1UXVBdVJwLzlvQUNBRUNBZ1kvQUIvLzJnQUlBUU1DQmo4QQpILy9hQUFnQkFRRUdQd0RFNlpYbUFZcXR3c0pCSEk5MUdsTXFudlQrZTM3UUwxa1MwYjdYQndBRHJWb1FDUlhHZTVhZTVhZTVhZms5CkgvL1oiIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgLTQ2Ljg3NSAtOS44OTA2KSI+CgkJPC9pbWFnZT4KCTwvZz4KCTxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0IyQjJCMiIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjEzLjQ4MyIgeTE9IjAuNjQ0IiB4Mj0iMC44MjgiIHkyPSIxMy4zMDEiLz4KCTxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0IyQjJCMiIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjEzLjczNCIgeTE9IjUuMTQxIiB4Mj0iNS4zMjUiIHkyPSIxMy41NDkiLz4KCTxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0IyQjJCMiIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgeDE9IjE0LjIzMSIgeTE9IjkuMzg4IiB4Mj0iOS44MDYiIHkyPSIxMy44MTMiLz4KPC9zdmc+Cg==);
+  cursor: se-resize;
+}
+
 @font-face {
   font-family: Alarm Clock;
   src: url(alarm-clock.ttf);
diff --git a/pandora_console/include/visual-console-client/vc.main.css.map b/pandora_console/include/visual-console-client/vc.main.css.map
index 2b723c93b4..d52e239f93 100644
--- a/pandora_console/include/visual-console-client/vc.main.css.map
+++ b/pandora_console/include/visual-console-client/vc.main.css.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///main.css","webpack:///styles.css"],"names":[],"mappings":"AAAA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,4BAA4B;EAC5B,0BAA0B;EAC1B,2BAA2B;AAC7B;;AAEA;EACE,kBAAkB;EAClB,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,2BAAuB;EAAvB,8BAAuB;MAAvB,2BAAuB;UAAvB,uBAAuB;EACvB,qBAAqB;EACrB,yBAAmB;MAAnB,sBAAmB;UAAnB,mBAAmB;EACnB,yBAAiB;KAAjB,sBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;AACnB;;ACfA;EACE,wBAAwB;EACxB,0BAA2B;AAC7B;;AAEA,kBAAkB;;AAElB;EACE,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,4BAAsB;EAAtB,6BAAsB;MAAtB,0BAAsB;UAAtB,sBAAsB;EACtB,wBAAuB;MAAvB,qBAAuB;UAAvB,uBAAuB;EACvB,qBAAqB;EACrB,0BAAqB;MAArB,qBAAqB;EACrB,yBAAmB;MAAnB,sBAAmB;UAAnB,mBAAmB;AACrB;;AAEA;EACE,6DAA6D;EAC7D,eAAe;;EAEf,0BAA0B;EAC1B,mCAAmC;EACnC,kCAAkC;EAClC,kCAAkC;EAClC,wCAAwC;AAC1C;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,eAAe;AACjB;;AAEA,iBAAiB;;AAEjB;EACE,kBAAkB;AACpB;;AAEA;EACE,qDAA6C;UAA7C,6CAA6C;AAC/C;;AAEA;EACE,sDAA8C;UAA9C,8CAA8C;AAChD;;AAEA;EACE,oDAA4C;UAA5C,4CAA4C;AAC9C","file":"vc.main.css","sourcesContent":["#visual-console-container {\n  margin: 0px auto;\n  position: relative;\n  background-repeat: no-repeat;\n  background-size: 100% 100%;\n  background-position: center;\n}\n\n.visual-console-item {\n  position: absolute;\n  display: flex;\n  flex-direction: initial;\n  justify-items: center;\n  align-items: center;\n  user-select: text;\n}\n","@font-face {\n  font-family: Alarm Clock;\n  src: url(./alarm-clock.ttf);\n}\n\n/* Digital clock */\n\n.visual-console-item .digital-clock {\n  display: flex;\n  flex-direction: column;\n  justify-content: center;\n  justify-items: center;\n  align-content: center;\n  align-items: center;\n}\n\n.visual-console-item .digital-clock > span {\n  font-family: \"Alarm Clock\", \"Courier New\", Courier, monospace;\n  font-size: 50px;\n\n  /* To improve legibility */\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n  text-rendering: optimizeLegibility;\n  text-shadow: rgba(0, 0, 0, 0.01) 0 0 1px;\n}\n\n.visual-console-item .digital-clock > span.date {\n  font-size: 25px;\n}\n\n.visual-console-item .digital-clock > span.timezone {\n  font-size: 25px;\n}\n\n/* Analog clock */\n\n.visual-console-item .analogic-clock {\n  text-align: center;\n}\n\n.visual-console-item .analogic-clock .hour-hand {\n  animation: rotate-hour 43200s infinite linear;\n}\n\n.visual-console-item .analogic-clock .minute-hand {\n  animation: rotate-minute 3600s infinite linear;\n}\n\n.visual-console-item .analogic-clock .second-hand {\n  animation: rotate-second 60s infinite linear;\n}\n"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///main.css","webpack:///styles.css"],"names":[],"mappings":"AAAA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,4BAA4B;EAC5B,0BAA0B;EAC1B,2BAA2B;AAC7B;;AAEA;EACE,kBAAkB;EAClB,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,2BAAuB;EAAvB,8BAAuB;MAAvB,2BAAuB;UAAvB,uBAAuB;EACvB,qBAAqB;EACrB,yBAAmB;MAAnB,sBAAmB;UAAnB,mBAAmB;EACnB,yBAAiB;KAAjB,sBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;AACnB;;AAEA;EACE,0BAA0B;EAC1B,oDAA4C;UAA5C,4CAA4C;EAC5C,YAAY;EACZ,yBAAiB;KAAjB,sBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;AACnB;;AAEA;EACE,YAAY;EACZ,kBAAkB;EAClB,QAAQ;EACR,SAAS;EACT,WAAW;EACX,YAAY;EACZ,yCAAoC;EACpC,iBAAiB;AACnB;;ACjCA;EACE,wBAAwB;EACxB,0BAA2B;AAC7B;;AAEA,kBAAkB;;AAElB;EACE,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,4BAAsB;EAAtB,6BAAsB;MAAtB,0BAAsB;UAAtB,sBAAsB;EACtB,wBAAuB;MAAvB,qBAAuB;UAAvB,uBAAuB;EACvB,qBAAqB;EACrB,0BAAqB;MAArB,qBAAqB;EACrB,yBAAmB;MAAnB,sBAAmB;UAAnB,mBAAmB;AACrB;;AAEA;EACE,6DAA6D;EAC7D,eAAe;;EAEf,0BAA0B;EAC1B,mCAAmC;EACnC,kCAAkC;EAClC,kCAAkC;EAClC,wCAAwC;AAC1C;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,eAAe;AACjB;;AAEA,iBAAiB;;AAEjB;EACE,kBAAkB;AACpB;;AAEA;EACE,qDAA6C;UAA7C,6CAA6C;AAC/C;;AAEA;EACE,sDAA8C;UAA9C,8CAA8C;AAChD;;AAEA;EACE,oDAA4C;UAA5C,4CAA4C;AAC9C","file":"vc.main.css","sourcesContent":["#visual-console-container {\n  margin: 0px auto;\n  position: relative;\n  background-repeat: no-repeat;\n  background-size: 100% 100%;\n  background-position: center;\n}\n\n.visual-console-item {\n  position: absolute;\n  display: flex;\n  flex-direction: initial;\n  justify-items: center;\n  align-items: center;\n  user-select: text;\n}\n\n.visual-console-item.is-editing {\n  border: 2px dashed #b2b2b2;\n  transform: translateX(-2px) translateY(-2px);\n  cursor: move;\n  user-select: none;\n}\n\n.visual-console-item.is-editing > .resize-draggable {\n  float: right;\n  position: absolute;\n  right: 0;\n  bottom: 0;\n  width: 15px;\n  height: 15px;\n  background: url(./resize-handle.svg);\n  cursor: se-resize;\n}\n","@font-face {\n  font-family: Alarm Clock;\n  src: url(./alarm-clock.ttf);\n}\n\n/* Digital clock */\n\n.visual-console-item .digital-clock {\n  display: flex;\n  flex-direction: column;\n  justify-content: center;\n  justify-items: center;\n  align-content: center;\n  align-items: center;\n}\n\n.visual-console-item .digital-clock > span {\n  font-family: \"Alarm Clock\", \"Courier New\", Courier, monospace;\n  font-size: 50px;\n\n  /* To improve legibility */\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n  text-rendering: optimizeLegibility;\n  text-shadow: rgba(0, 0, 0, 0.01) 0 0 1px;\n}\n\n.visual-console-item .digital-clock > span.date {\n  font-size: 25px;\n}\n\n.visual-console-item .digital-clock > span.timezone {\n  font-size: 25px;\n}\n\n/* Analog clock */\n\n.visual-console-item .analogic-clock {\n  text-align: center;\n}\n\n.visual-console-item .analogic-clock .hour-hand {\n  animation: rotate-hour 43200s infinite linear;\n}\n\n.visual-console-item .analogic-clock .minute-hand {\n  animation: rotate-minute 3600s infinite linear;\n}\n\n.visual-console-item .analogic-clock .second-hand {\n  animation: rotate-second 60s infinite linear;\n}\n"],"sourceRoot":""}
\ No newline at end of file
diff --git a/pandora_console/include/visual-console-client/vc.main.min.js b/pandora_console/include/visual-console-client/vc.main.min.js
index 9f2f23a09a..aa7de676c0 100644
--- a/pandora_console/include/visual-console-client/vc.main.min.js
+++ b/pandora_console/include/visual-console-client/vc.main.min.js
@@ -1,2 +1,2 @@
-!function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(t,e,n){"use strict";n.d(e,"i",function(){return r}),n.d(e,"h",function(){return s}),n.d(e,"n",function(){return o}),n.d(e,"f",function(){return a}),n.d(e,"g",function(){return c}),n.d(e,"j",function(){return u}),n.d(e,"m",function(){return h}),n.d(e,"e",function(){return p}),n.d(e,"d",function(){return _}),n.d(e,"k",function(){return f}),n.d(e,"a",function(){return d}),n.d(e,"b",function(){return y}),n.d(e,"c",function(){return m}),n.d(e,"l",function(){return b});var i=function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function r(t,e){return"number"==typeof t?t:"string"==typeof t&&t.length>0&&!isNaN(parseInt(t))?parseInt(t):e}function s(t,e){return"number"==typeof t?t:"string"==typeof t&&t.length>0&&!isNaN(parseFloat(t))?parseFloat(t):e}function o(t){return null==t||0===t.length}function a(t,e){return"string"==typeof t&&t.length>0?t:e}function c(t){return"boolean"==typeof t?t:"number"==typeof t?t>0:"string"==typeof t&&("1"===t||"true"===t)}function l(t,e,n){void 0===n&&(n=" "),"number"==typeof t&&(t=""+t),"number"==typeof n&&(n=""+n);var i=e-t.length;if(0===i)return t;if(i<0)return t.substr(Math.abs(i));if(i===n.length)return""+n+t;if(i<n.length)return""+n.substring(0,i)+t;for(var r=Math.floor(i/n.length),s=i-n.length*r,o="",a=0;a<r;a++)o+=n;return 0===s?""+o+t:""+o+n.substring(0,s)+t}function u(t){return{x:r(t.x,0),y:r(t.y,0)}}function h(t){if(null==t.width||isNaN(parseInt(t.width))||null==t.height||isNaN(parseInt(t.height)))throw new TypeError("invalid size.");return{width:parseInt(t.width),height:parseInt(t.height)}}function p(t){return i({moduleId:r(t.moduleId,null),moduleName:a(t.moduleName,null),moduleDescription:a(t.moduleDescription,null)},function(t){var e={agentId:r(t.agent,null),agentName:a(t.agentName,null),agentAlias:a(t.agentAlias,null),agentDescription:a(t.agentDescription,null),agentAddress:a(t.agentAddress,null)};return null!=t.metaconsoleId?i({metaconsoleId:t.metaconsoleId},e):e}(t))}function _(t){var e=t.metaconsoleId,n=t.linkedLayoutId,s=t.linkedLayoutAgentId,o={linkedLayoutStatusType:"default"};switch(t.linkedLayoutStatusType){case"weight":var a=r(t.linkedLayoutStatusTypeWeight,null);if(null==a)throw new TypeError("invalid status calculation properties.");t.linkedLayoutStatusTypeWeight&&(o={linkedLayoutStatusType:"weight",linkedLayoutStatusTypeWeight:a});break;case"service":var c=r(t.linkedLayoutStatusTypeWarningThreshold,null),l=r(t.linkedLayoutStatusTypeCriticalThreshold,null);if(null==c||null==l)throw new TypeError("invalid status calculation properties.");o={linkedLayoutStatusType:"service",linkedLayoutStatusTypeWarningThreshold:c,linkedLayoutStatusTypeCriticalThreshold:l}}var u=i({linkedLayoutId:r(n,null),linkedLayoutAgentId:r(s,null)},o);return null!=e?i({metaconsoleId:e},u):u}function f(t,e){var n=t+": "+e+";";return["-webkit-"+n,"-moz-"+n,"-ms-"+n,"-o-"+n,""+n]}function d(t){return decodeURIComponent(escape(window.atob(t)))}function y(t,e){if(void 0===e&&(e=null),e&&Intl&&Intl.DateTimeFormat){return Intl.DateTimeFormat(e,{day:"2-digit",month:"2-digit",year:"numeric"}).format(t)}return l(t.getDate(),2,0)+"/"+l(t.getMonth()+1,2,0)+"/"+l(t.getFullYear(),4,0)}function m(t){return l(t.getHours(),2,0)+":"+l(t.getMinutes(),2,0)+":"+l(t.getSeconds(),2,0)}function b(t,e){return t.reduce(function(t,e){var n=e.macro,i=e.value;return t.replace(n,i)},e)}},function(t,e,n){"use strict";n.d(e,"b",function(){return a});var i=n(0),r=n(2),s=function(){return(s=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},o=function(t){switch(t){case"up":case"right":case"down":case"left":return t;default:return"down"}};function a(t){if(null==t.id||isNaN(parseInt(t.id)))throw new TypeError("invalid id.");if(null==t.type||isNaN(parseInt(t.type)))throw new TypeError("invalid type.");return s({id:parseInt(t.id),type:parseInt(t.type),label:Object(i.f)(t.label,null),labelPosition:o(t.labelPosition),isLinkEnabled:Object(i.g)(t.isLinkEnabled),link:Object(i.f)(t.link,null),isOnTop:Object(i.g)(t.isOnTop),parentId:Object(i.i)(t.parentId,null),aclGroupId:Object(i.i)(t.aclGroupId,null)},Object(i.m)(t),Object(i.j)(t))}var c=function(){function t(t){this.clickEventManager=new r.a,this.removeEventManager=new r.a,this.disposables=[],this.itemProps=t,this.elementRef=this.createContainerDomElement(),this.labelElementRef=this.createLabelDomElement(),this.childElementRef=this.createDomElement(),this.elementRef.append(this.childElementRef,this.labelElementRef),this.resizeElement(t.width,t.height),this.changeLabelPosition(t.labelPosition)}return t.prototype.createContainerDomElement=function(){var t,e=this;return this.props.isLinkEnabled?(t=document.createElement("a"),this.props.link&&(t.href=this.props.link)):t=document.createElement("div"),t.className="visual-console-item",t.style.zIndex=this.props.isOnTop?"2":"1",t.style.left=this.props.x+"px",t.style.top=this.props.y+"px",t.onclick=function(t){return e.clickEventManager.emit({data:e.props,nativeEvent:t})},t},t.prototype.createLabelDomElement=function(){var t=document.createElement("div");t.className="visual-console-item-label";var e=this.getLabelWithMacrosReplaced();if(e.length>0){var n=document.createElement("table"),i=document.createElement("tr"),r=document.createElement("tr"),s=document.createElement("tr"),o=document.createElement("td");switch(o.innerHTML=e,i.append(o),n.append(r,i,s),n.style.textAlign="center",this.props.labelPosition){case"up":case"down":this.props.width>0&&(n.style.width=this.props.width+"px",n.style.height=null);break;case"left":case"right":this.props.height>0&&(n.style.width=null,n.style.height=this.props.height+"px")}t.append(n)}return t},t.prototype.getLabelWithMacrosReplaced=function(){var t=this.props;return Object(i.l)([{macro:"_date_",value:Object(i.b)(new Date)},{macro:"_time_",value:Object(i.c)(new Date)},{macro:"_agent_",value:null!=t.agentAlias?t.agentAlias:""},{macro:"_agentdescription_",value:null!=t.agentDescription?t.agentDescription:""},{macro:"_address_",value:null!=t.agentAddress?t.agentAddress:""},{macro:"_module_",value:null!=t.moduleName?t.moduleName:""},{macro:"_moduledescription_",value:null!=t.moduleDescription?t.moduleDescription:""}],this.props.label||"")},t.prototype.updateDomElement=function(t){t.innerHTML=this.createDomElement().innerHTML},Object.defineProperty(t.prototype,"props",{get:function(){return s({},this.itemProps)},set:function(t){var e=this.props;this.itemProps=t,this.shouldBeUpdated(e,t)&&this.render(e)},enumerable:!0,configurable:!0}),t.prototype.shouldBeUpdated=function(t,e){return t!==e},t.prototype.render=function(t){void 0===t&&(t=null),this.updateDomElement(this.childElementRef),t&&!this.positionChanged(t,this.props)||this.moveElement(this.props.x,this.props.y),t&&!this.sizeChanged(t,this.props)||this.resizeElement(this.props.width,this.props.height);var e=this.labelElementRef.innerHTML,n=this.createLabelDomElement().innerHTML;if(e!==n&&(this.labelElementRef.innerHTML=n),t&&t.labelPosition===this.props.labelPosition||this.changeLabelPosition(this.props.labelPosition),t&&(t.isLinkEnabled!==this.props.isLinkEnabled||this.props.isLinkEnabled&&t.link!==this.props.link)){var i=this.createContainerDomElement();i.innerHTML=this.elementRef.innerHTML;for(var r=this.elementRef.attributes,s=0;s<r.length;s++)"id"!==r[s].nodeName&&i.setAttributeNode(r[s]);null!==this.elementRef.parentNode&&this.elementRef.parentNode.replaceChild(i,this.elementRef),this.elementRef=i}},t.prototype.remove=function(){this.removeEventManager.emit({data:this.props}),this.disposables.forEach(function(t){try{t.dispose()}catch(t){}}),this.elementRef.remove()},t.prototype.positionChanged=function(t,e){return t.x!==e.x||t.y!==e.y},t.prototype.changeLabelPosition=function(t){switch(t){case"up":this.elementRef.style.flexDirection="column-reverse";break;case"left":this.elementRef.style.flexDirection="row-reverse";break;case"right":this.elementRef.style.flexDirection="row";break;case"down":default:this.elementRef.style.flexDirection="column"}var e=this.labelElementRef.getElementsByTagName("table"),n=e.length>0?e.item(0):null;if(n)switch(this.props.labelPosition){case"up":case"down":this.props.width>0&&(n.style.width=this.props.width+"px",n.style.height=null);break;case"left":case"right":this.props.height>0&&(n.style.width=null,n.style.height=this.props.height+"px")}},t.prototype.moveElement=function(t,e){this.elementRef.style.left=t+"px",this.elementRef.style.top=e+"px"},t.prototype.move=function(t,e){this.moveElement(t,e),this.itemProps=s({},this.props,{x:t,y:e})},t.prototype.sizeChanged=function(t,e){return t.width!==e.width||t.height!==e.height},t.prototype.resizeElement=function(t,e){this.childElementRef.style.width=t>0?t+"px":null,this.childElementRef.style.height=e>0?e+"px":null},t.prototype.resize=function(t,e){this.resizeElement(t,e),this.itemProps=s({},this.props,{width:t,height:e})},t.prototype.onClick=function(t){var e=this.clickEventManager.on(t);return this.disposables.push(e),e},t.prototype.onRemove=function(t){var e=this.removeEventManager.on(t);return this.disposables.push(e),e},t}();e.a=c},function(t,e,n){"use strict";var i=function(){return function(){var t=this;this.listeners=[],this.listenersOncer=[],this.on=function(e){return t.listeners.push(e),{dispose:function(){return t.off(e)}}},this.once=function(e){t.listenersOncer.push(e)},this.off=function(e){var n=t.listeners.indexOf(e);n>-1&&t.listeners.splice(n,1)},this.emit=function(e){t.listeners.forEach(function(t){return t(e)}),t.listenersOncer.forEach(function(t){return t(e)}),t.listenersOncer=[]},this.pipe=function(e){return t.on(function(t){return e.emit(t)})}}}();e.a=i},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"b",function(){return eventsHistoryPropsDecoder});var _lib__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_Item__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1),__extends=(extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),extendStatics,__assign=function(){return(__assign=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function eventsHistoryPropsDecoder(t){if(Object(_lib__WEBPACK_IMPORTED_MODULE_0__.n)(t.html)&&Object(_lib__WEBPACK_IMPORTED_MODULE_0__.n)(t.encodedHtml))throw new TypeError("missing html content.");return __assign({},Object(_Item__WEBPACK_IMPORTED_MODULE_1__.b)(t),{type:14,maxTime:Object(_lib__WEBPACK_IMPORTED_MODULE_0__.i)(t.maxTime,null),html:Object(_lib__WEBPACK_IMPORTED_MODULE_0__.n)(t.html)?Object(_lib__WEBPACK_IMPORTED_MODULE_0__.a)(t.encodedHtml):t.html},Object(_lib__WEBPACK_IMPORTED_MODULE_0__.e)(t))}var EventsHistory=function(_super){function EventsHistory(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(EventsHistory,_super),EventsHistory.prototype.createDomElement=function(){var element=document.createElement("div");element.className="events-history",element.innerHTML=this.props.html;for(var scripts=element.getElementsByTagName("script"),_loop_1=function(i){0===scripts[i].src.length&&setTimeout(function(){try{eval(scripts[i].innerHTML.trim())}catch(t){}},0)},i=0;i<scripts.length;i++)_loop_1(i);return element},EventsHistory.prototype.updateDomElement=function(element){element.innerHTML=this.props.html;var aux=document.createElement("div");aux.innerHTML=this.props.html;for(var scripts=aux.getElementsByTagName("script"),i=0;i<scripts.length;i++)0===scripts[i].src.length&&eval(scripts[i].innerHTML.trim())},EventsHistory}(_Item__WEBPACK_IMPORTED_MODULE_1__.a);__webpack_exports__.a=EventsHistory},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"b",function(){return donutGraphPropsDecoder});var _lib__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_Item__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1),__extends=(extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),extendStatics,__assign=function(){return(__assign=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function donutGraphPropsDecoder(t){if(Object(_lib__WEBPACK_IMPORTED_MODULE_0__.n)(t.html)&&Object(_lib__WEBPACK_IMPORTED_MODULE_0__.n)(t.encodedHtml))throw new TypeError("missing html content.");return __assign({},Object(_Item__WEBPACK_IMPORTED_MODULE_1__.b)(t),{type:17,html:Object(_lib__WEBPACK_IMPORTED_MODULE_0__.n)(t.html)?Object(_lib__WEBPACK_IMPORTED_MODULE_0__.a)(t.encodedHtml):t.html},Object(_lib__WEBPACK_IMPORTED_MODULE_0__.e)(t),Object(_lib__WEBPACK_IMPORTED_MODULE_0__.d)(t))}var DonutGraph=function(_super){function DonutGraph(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(DonutGraph,_super),DonutGraph.prototype.createDomElement=function(){var element=document.createElement("div");element.className="donut-graph",element.innerHTML=this.props.html;for(var scripts=element.getElementsByTagName("script"),_loop_1=function(i){setTimeout(function(){0===scripts[i].src.length&&eval(scripts[i].innerHTML.trim())},0)},i=0;i<scripts.length;i++)_loop_1(i);return element},DonutGraph.prototype.updateDomElement=function(element){element.innerHTML=this.props.html;var aux=document.createElement("div");aux.innerHTML=this.props.html;for(var scripts=aux.getElementsByTagName("script"),i=0;i<scripts.length;i++)0===scripts[i].src.length&&eval(scripts[i].innerHTML.trim())},DonutGraph}(_Item__WEBPACK_IMPORTED_MODULE_1__.a);__webpack_exports__.a=DonutGraph},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",function(){return barsGraphPropsDecoder});var _lib__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_Item__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1),__extends=(extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),extendStatics,__assign=function(){return(__assign=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function barsGraphPropsDecoder(t){if(Object(_lib__WEBPACK_IMPORTED_MODULE_0__.n)(t.html)&&Object(_lib__WEBPACK_IMPORTED_MODULE_0__.n)(t.encodedHtml))throw new TypeError("missing html content.");return __assign({},Object(_Item__WEBPACK_IMPORTED_MODULE_1__.b)(t),{type:18,html:Object(_lib__WEBPACK_IMPORTED_MODULE_0__.n)(t.html)?Object(_lib__WEBPACK_IMPORTED_MODULE_0__.a)(t.encodedHtml):t.html},Object(_lib__WEBPACK_IMPORTED_MODULE_0__.e)(t))}var BarsGraph=function(_super){function BarsGraph(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(BarsGraph,_super),BarsGraph.prototype.createDomElement=function(){var element=document.createElement("div");element.className="bars-graph",element.innerHTML=this.props.html;for(var scripts=element.getElementsByTagName("script"),_loop_1=function(i){setTimeout(function(){0===scripts[i].src.length&&eval(scripts[i].innerHTML.trim())},0)},i=0;i<scripts.length;i++)_loop_1(i);return element},BarsGraph.prototype.updateDomElement=function(element){element.innerHTML=this.props.html;var aux=document.createElement("div");aux.innerHTML=this.props.html;for(var scripts=aux.getElementsByTagName("script"),i=0;i<scripts.length;i++)0===scripts[i].src.length&&eval(scripts[i].innerHTML.trim())},BarsGraph}(_Item__WEBPACK_IMPORTED_MODULE_1__.a);__webpack_exports__.b=BarsGraph},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"b",function(){return moduleGraphPropsDecoder});var _lib__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_Item__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1),__extends=(extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),extendStatics,__assign=function(){return(__assign=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function moduleGraphPropsDecoder(t){if(Object(_lib__WEBPACK_IMPORTED_MODULE_0__.n)(t.html)&&Object(_lib__WEBPACK_IMPORTED_MODULE_0__.n)(t.encodedHtml))throw new TypeError("missing html content.");return __assign({},Object(_Item__WEBPACK_IMPORTED_MODULE_1__.b)(t),{type:1,html:Object(_lib__WEBPACK_IMPORTED_MODULE_0__.n)(t.html)?Object(_lib__WEBPACK_IMPORTED_MODULE_0__.a)(t.encodedHtml):t.html},Object(_lib__WEBPACK_IMPORTED_MODULE_0__.e)(t),Object(_lib__WEBPACK_IMPORTED_MODULE_0__.d)(t))}var ModuleGraph=function(_super){function ModuleGraph(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(ModuleGraph,_super),ModuleGraph.prototype.resizeElement=function(t){_super.prototype.resizeElement.call(this,t,0)},ModuleGraph.prototype.createDomElement=function(){var element=document.createElement("div");element.className="module-graph",element.innerHTML=this.props.html;for(var legendP=element.getElementsByTagName("p"),i=0;i<legendP.length;i++)legendP[i].style.margin="0px";for(var overviewGraphs=element.getElementsByClassName("overview_graph"),i=0;i<overviewGraphs.length;i++)overviewGraphs[i].remove();for(var scripts=element.getElementsByTagName("script"),_loop_1=function(i){0===scripts[i].src.length&&setTimeout(function(){try{eval(scripts[i].innerHTML.trim())}catch(t){}},0)},i=0;i<scripts.length;i++)_loop_1(i);return element},ModuleGraph.prototype.updateDomElement=function(element){element.innerHTML=this.props.html;for(var legendP=element.getElementsByTagName("p"),i=0;i<legendP.length;i++)legendP[i].style.margin="0px";for(var overviewGraphs=element.getElementsByClassName("overview_graph"),i=0;i<overviewGraphs.length;i++)overviewGraphs[i].remove();var aux=document.createElement("div");aux.innerHTML=this.props.html;for(var scripts=aux.getElementsByTagName("script"),i=0;i<scripts.length;i++)0===scripts[i].src.length&&eval(scripts[i].innerHTML.trim())},ModuleGraph}(_Item__WEBPACK_IMPORTED_MODULE_1__.a);__webpack_exports__.a=ModuleGraph},function(t,e,n){},function(t,e,n){},function(t,e,n){"use strict";n.r(e);n(7);var i,r=n(0),s=n(1),o=(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=function(){return(a=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},c=function(t){switch(t){case"default":case"enabled":case"disabled":return t;default:return"default"}};function l(t){if("string"!=typeof t.imageSrc||0===t.imageSrc.length)throw new TypeError("invalid image src.");return a({},Object(s.b)(t),{type:0,imageSrc:t.imageSrc,showLastValueTooltip:c(t.showLastValueTooltip),statusImageSrc:Object(r.f)(t.statusImageSrc,null),lastValue:Object(r.f)(t.lastValue,null)},Object(r.e)(t),Object(r.d)(t))}var u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.createDomElement=function(){var t=this.props.statusImageSrc||this.props.imageSrc,e=document.createElement("div");return e.className="static-graph",e.style.background="url("+t+") no-repeat",e.style.backgroundSize="contain",e.style.backgroundPosition="center",null!==this.props.lastValue&&"disabled"!==this.props.showLastValueTooltip&&(e.className="static-graph image forced_title",e.setAttribute("data-use_title_for_force_title","1"),e.setAttribute("data-title",this.props.lastValue)),e},e}(s.a),h=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),p=function(){return(p=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function _(t){if("string"!=typeof t.imageSrc||0===t.imageSrc.length)throw new TypeError("invalid image src.");return p({},Object(s.b)(t),{type:5,imageSrc:t.imageSrc},Object(r.d)(t))}var f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return h(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");return t.className="icon",t.style.background="url("+this.props.imageSrc+") no-repeat",t.style.backgroundSize="contain",t.style.backgroundPosition="center",t},e}(s.a),d=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),y=function(){return(y=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function m(t){if("string"!=typeof t.color||0===t.color.length)throw new TypeError("invalid color.");return y({},Object(s.b)(t),{type:20,color:t.color},Object(r.e)(t),Object(r.d)(t))}var b="http://www.w3.org/2000/svg",v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return d(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");return t.className="color-cloud",t.append(this.createSvgElement()),t},e.prototype.createSvgElement=function(){var t="grad_"+this.props.id,e=document.createElementNS(b,"svg");e.setAttribute("viewBox","0 0 100 100");var n=document.createElementNS(b,"defs"),i=document.createElementNS(b,"radialGradient");i.setAttribute("id",t),i.setAttribute("cx","50%"),i.setAttribute("cy","50%"),i.setAttribute("r","50%"),i.setAttribute("fx","50%"),i.setAttribute("fy","50%");var r=document.createElementNS(b,"stop");r.setAttribute("offset","0%"),r.setAttribute("style","stop-color:"+this.props.color+";stop-opacity:0.9");var s=document.createElementNS(b,"stop");s.setAttribute("offset","100%"),s.setAttribute("style","stop-color:"+this.props.color+";stop-opacity:0");var o=document.createElementNS(b,"circle");return o.setAttribute("fill","url(#"+t+")"),o.setAttribute("cx","50%"),o.setAttribute("cy","50%"),o.setAttribute("r","50%"),i.append(r,s),n.append(i),e.append(n,o),e},e}(s.a),g=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),x=function(){return(x=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function E(t){if(("string"!=typeof t.imageSrc||0===t.imageSrc.length)&&null===t.encodedHtml)throw new TypeError("invalid image src.");if(null===Object(r.i)(t.groupId,null))throw new TypeError("invalid group Id.");var e=Object(r.g)(t.showStatistics),n=e?function(t){return Object(r.n)(t.html)?Object(r.n)(t.encodedHtml)?null:Object(r.a)(t.encodedHtml):t.html}(t):null;return x({},Object(s.b)(t),{type:11,groupId:parseInt(t.groupId),imageSrc:Object(r.f)(t.imageSrc,null),statusImageSrc:Object(r.f)(t.statusImageSrc,null),showStatistics:e,html:n},Object(r.d)(t))}var O=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return g(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");return t.className="group",this.props.showStatistics||null===this.props.statusImageSrc?this.props.showStatistics&&null!=this.props.html&&(t.innerHTML=this.props.html):(t.style.background="url("+this.props.statusImageSrc+") no-repeat",t.style.backgroundSize="contain",t.style.backgroundPosition="center"),t},e}(s.a),w=(n(8),function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}()),T=function(){return(T=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},A=function(t){switch(t){case"analogic":case"digital":return t;default:return"analogic"}},k=function(t){switch(t){case"datetime":case"time":return t;default:return"datetime"}};function P(t){if("string"!=typeof t.clockTimezone||0===t.clockTimezone.length)throw new TypeError("invalid timezone.");return T({},Object(s.b)(t),{type:19,clockType:A(t.clockType),clockFormat:k(t.clockFormat),clockTimezone:t.clockTimezone,clockTimezoneOffset:Object(r.i)(t.clockTimezoneOffset,0),showClockTimezone:Object(r.g)(t.showClockTimezone),color:Object(r.f)(t.color,null)},Object(r.d)(t))}var M=function(t){function e(n){var i=t.call(this,n)||this;return i.intervalRef=null,i.startTick(function(){i.childElementRef.innerHTML=i.createClock().innerHTML},"analogic"===i.props.clockType?2e4:e.TICK_INTERVAL),i}return w(e,t),e.prototype.stopTick=function(){null!==this.intervalRef&&(window.clearInterval(this.intervalRef),this.intervalRef=null)},e.prototype.startTick=function(t,n){void 0===n&&(n=e.TICK_INTERVAL),this.stopTick(),this.intervalRef=window.setInterval(t,n)},e.prototype.createDomElement=function(){return this.createClock()},e.prototype.remove=function(){this.stopTick(),t.prototype.remove.call(this)},e.prototype.resizeElement=function(e,n){var i=this.getElementSize(e,n),r=i.width,s=i.height;t.prototype.resizeElement.call(this,r,s),"digital"===this.props.clockType&&(this.childElementRef.innerHTML=this.createClock().innerHTML)},e.prototype.createClock=function(){switch(this.props.clockType){case"analogic":return this.createAnalogicClock();case"digital":return this.createDigitalClock();default:throw new Error("invalid clock type.")}},e.prototype.createAnalogicClock=function(){var t="http://www.w3.org/2000/svg",e="#FFFFF0",n="#242124",i="#242124",s="#242124",o="#525252",a="#DC143C",c=this.getElementSize(),l=c.width,u=c.height,h=10*l/100,p=document.createElement("div");p.className="analogic-clock",p.style.width=l+"px",p.style.height=u+"px";var _=document.createElementNS(t,"svg");_.setAttribute("viewBox","0 0 100 100");var f=document.createElementNS(t,"g");f.setAttribute("class","clockface");var d=document.createElementNS(t,"circle");d.setAttribute("cx","50"),d.setAttribute("cy","50"),d.setAttribute("r","48"),d.setAttribute("fill",e),d.setAttribute("stroke",n),d.setAttribute("stroke-width","2"),d.setAttribute("stroke-linecap","round"),f.append(d);var y=this.getHumanTimezone();if(y.length>0){var m=document.createElementNS(t,"text");m.setAttribute("text-anchor","middle"),m.setAttribute("font-size","8"),m.setAttribute("transform","translate(30 50) rotate(90)"),m.setAttribute("fill",i),m.textContent=y,f.append(m)}var b=document.createElementNS(t,"g");b.setAttribute("class","marks");var v=document.createElementNS(t,"g");v.setAttribute("class","mark"),v.setAttribute("transform","translate(50 50)");var g=document.createElementNS(t,"line");g.setAttribute("x1","36"),g.setAttribute("y1","0"),g.setAttribute("x2","46"),g.setAttribute("y2","0"),g.setAttribute("stroke",i),g.setAttribute("stroke-width","5");var x=document.createElementNS(t,"line");x.setAttribute("x1","36"),x.setAttribute("y1","0"),x.setAttribute("x2","46"),x.setAttribute("y2","0"),x.setAttribute("stroke",e),x.setAttribute("stroke-width","1"),v.append(g,x),b.append(v);for(var E=1;E<60;E++){var O=document.createElementNS(t,"line");O.setAttribute("y1","0"),O.setAttribute("y2","0"),O.setAttribute("stroke",i),O.setAttribute("transform","translate(50 50) rotate("+6*E+")"),E%5==0?(O.setAttribute("x1","38"),O.setAttribute("x2","46"),O.setAttribute("stroke-width",E%15==0?"2":"1")):(O.setAttribute("x1","42"),O.setAttribute("x2","46"),O.setAttribute("stroke-width","0.5")),b.append(O)}var w=document.createElementNS(t,"g");w.setAttribute("class","hour-hand"),w.setAttribute("transform","translate(50 50)");var T=document.createElementNS(t,"line");T.setAttribute("class","hour-hand-a"),T.setAttribute("x1","0"),T.setAttribute("y1","0"),T.setAttribute("x2","30"),T.setAttribute("y2","0"),T.setAttribute("stroke",o),T.setAttribute("stroke-width","4"),T.setAttribute("stroke-linecap","round");var A=document.createElementNS(t,"line");A.setAttribute("class","hour-hand-b"),A.setAttribute("x1","0"),A.setAttribute("y1","0"),A.setAttribute("x2","29.9"),A.setAttribute("y2","0"),A.setAttribute("stroke",s),A.setAttribute("stroke-width","3.1"),A.setAttribute("stroke-linecap","round"),w.append(T,A);var k=document.createElementNS(t,"g");k.setAttribute("class","minute-hand"),k.setAttribute("transform","translate(50 50)");var P=document.createElementNS(t,"line");P.setAttribute("class","minute-hand-a"),P.setAttribute("x1","0"),P.setAttribute("y1","0"),P.setAttribute("x2","40"),P.setAttribute("y2","0"),P.setAttribute("stroke",o),P.setAttribute("stroke-width","2"),P.setAttribute("stroke-linecap","round");var M=document.createElementNS(t,"line");M.setAttribute("class","minute-hand-b"),M.setAttribute("x1","0"),M.setAttribute("y1","0"),M.setAttribute("x2","39.9"),M.setAttribute("y2","0"),M.setAttribute("stroke",s),M.setAttribute("stroke-width","1.5"),M.setAttribute("stroke-linecap","round");var j=document.createElementNS(t,"circle");j.setAttribute("r","3"),j.setAttribute("fill",s),k.append(P,M,j);var S=document.createElementNS(t,"g");S.setAttribute("class","second-hand"),S.setAttribute("transform","translate(50 50)");var I=document.createElementNS(t,"line");I.setAttribute("x1","0"),I.setAttribute("y1","0"),I.setAttribute("x2","46"),I.setAttribute("y2","0"),I.setAttribute("stroke",a),I.setAttribute("stroke-width","1"),I.setAttribute("stroke-linecap","round");var N=document.createElementNS(t,"circle");N.setAttribute("r","2"),N.setAttribute("fill",a),S.append(I,N);var D=document.createElementNS(t,"circle");D.setAttribute("cx","50"),D.setAttribute("cy","50"),D.setAttribute("r","0.3"),D.setAttribute("fill",s);var L=this.getOriginDate(),R=L.getSeconds(),C=L.getMinutes(),B=6*R,z=6*C+R/60*6,W=30*L.getHours()+C/60*30;if(w.setAttribute("transform","translate(50 50) rotate("+W+")"),k.setAttribute("transform","translate(50 50) rotate("+z+")"),S.setAttribute("transform","translate(50 50) rotate("+B+")"),_.append(f,b,w,k,S,D),_.setAttribute("transform","rotate(-90)"),p.innerHTML="\n      <style>\n        @keyframes rotate-hour {\n          from {\n            "+Object(r.k)("transform","translate(50px, 50px) rotate("+W+"deg)").join("\n")+"\n          }\n          to {\n            "+Object(r.k)("transform","translate(50px, 50px) rotate("+(W+360)+"deg)").join("\n")+"\n          }\n        }\n        @keyframes rotate-minute {\n          from {\n            "+Object(r.k)("transform","translate(50px, 50px) rotate("+z+"deg)").join("\n")+"\n          }\n          to {\n            "+Object(r.k)("transform","translate(50px, 50px) rotate("+(z+360)+"deg)").join("\n")+"\n          }\n        }\n        @keyframes rotate-second {\n          from {\n            "+Object(r.k)("transform","translate(50px, 50px) rotate("+B+"deg)").join("\n")+"\n          }\n          to {\n            "+Object(r.k)("transform","translate(50px, 50px) rotate("+(B+360)+"deg)").join("\n")+"\n          }\n        }\n      </style>\n    ",p.append(_),"datetime"===this.props.clockFormat){var H=document.createElement("span");H.className="date",H.textContent=Object(r.b)(L,"default"),H.style.fontSize=h+"px",this.props.color&&(H.style.color=this.props.color),p.append(H)}return p},e.prototype.createDigitalClock=function(){var t=document.createElement("div");t.className="digital-clock";var e=this.getElementSize().width,n=6/this.props.clockTimezone.length,i=20*e/100,s=10*e/100,o=Math.min(20*n*e/100,e/100*10),a=this.getOriginDate();if("datetime"===this.props.clockFormat){var c=document.createElement("span");c.className="date",c.textContent=Object(r.b)(a,"default"),c.style.fontSize=s+"px",this.props.color&&(c.style.color=this.props.color),t.append(c)}var l=document.createElement("span");l.className="time",l.textContent=Object(r.c)(a),l.style.fontSize=i+"px",this.props.color&&(l.style.color=this.props.color),t.append(l);var u=this.getHumanTimezone();if(u.length>0){var h=document.createElement("span");h.className="timezone",h.textContent=u,h.style.fontSize=o+"px",this.props.color&&(h.style.color=this.props.color),t.append(h)}return t},e.prototype.getOriginDate=function(t){void 0===t&&(t=null);var e=t||new Date,n=1e3*this.props.clockTimezoneOffset,i=60*e.getTimezoneOffset()*1e3,r=e.getTime()+n+i;return new Date(r)},e.prototype.getHumanTimezone=function(t){void 0===t&&(t=this.props.clockTimezone);var e=t.split("/")[1];return(void 0===e?"":e).replace("_"," ")},e.prototype.getElementSize=function(t,e){switch(void 0===t&&(t=this.props.width),void 0===e&&(e=this.props.height),this.props.clockType){case"analogic":var n=100;return t>0&&e>0?n=Math.min(t,e):t>0?n=t:e>0&&(n=e),{width:n,height:n};case"digital":return t>0&&e>0?e=t/2<e?t/2:e:t>0?e=t/2:e>0?t=2*e:(t=100,e=50),{width:t,height:e};default:throw new Error("invalid clock type.")}},e.TICK_INTERVAL=1e3,e}(s.a),j=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),S=function(){return(S=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function I(t){return S({},Object(s.b)(t),{type:12,label:null,isLinkEnabled:!1,parentId:null,aclGroupId:null,borderWidth:Object(r.i)(t.borderWidth,0),borderColor:Object(r.f)(t.borderColor,null),fillColor:Object(r.f)(t.fillColor,null)})}var N=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return j(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");if(t.className="box",t.style.boxSizing="border-box",this.props.fillColor&&(t.style.backgroundColor=this.props.fillColor),this.props.borderWidth>0){t.style.borderStyle="solid";var e=Math.min(this.props.width,this.props.height)/2,n=Math.min(this.props.borderWidth,e);t.style.borderWidth=n+"px",this.props.borderColor&&(t.style.borderColor=this.props.borderColor)}return t},e}(s.a),D=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),L=function(){return(L=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function R(t){var e=L({},Object(s.b)(L({},t,{width:1,height:1})),{type:13,label:null,isLinkEnabled:!1,parentId:null,aclGroupId:null,x:0,y:0,width:0,height:0,startPosition:{x:Object(r.i)(t.startX,0),y:Object(r.i)(t.startY,0)},endPosition:{x:Object(r.i)(t.endX,0),y:Object(r.i)(t.endY,0)},lineWidth:Object(r.i)(t.lineWidth||t.borderWidth,1),color:Object(r.f)(t.borderColor||t.color,null)});return L({},e,C.extractBoxSizeAndPosition(e))}var C=function(t){function e(n){return t.call(this,L({},n,e.extractBoxSizeAndPosition(n)))||this}return D(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");t.className="line";var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");n.setAttribute("width",(this.props.width+this.props.lineWidth).toString()),n.setAttribute("height",(this.props.height+this.props.lineWidth).toString());var i=document.createElementNS(e,"line");return i.setAttribute("x1",""+(this.props.startPosition.x-this.props.x+this.props.lineWidth/2)),i.setAttribute("y1",""+(this.props.startPosition.y-this.props.y+this.props.lineWidth/2)),i.setAttribute("x2",""+(this.props.endPosition.x-this.props.x+this.props.lineWidth/2)),i.setAttribute("y2",""+(this.props.endPosition.y-this.props.y+this.props.lineWidth/2)),i.setAttribute("stroke",this.props.color||"black"),i.setAttribute("stroke-width",this.props.lineWidth.toString()),n.append(i),t.append(n),t},e.extractBoxSizeAndPosition=function(t){return{width:Math.abs(t.startPosition.x-t.endPosition.x),height:Math.abs(t.startPosition.y-t.endPosition.y),x:Math.min(t.startPosition.x,t.endPosition.x),y:Math.min(t.startPosition.y,t.endPosition.y)}},e}(s.a),B=C,z=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),W=function(){return(W=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function H(t){return W({},Object(s.b)(t),{type:4},Object(r.d)(t))}var U=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return z(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");return t.className="label",t.innerHTML=this.getLabelWithMacrosReplaced(),t},e.prototype.createLabelDomElement=function(){var t=document.createElement("div");return t.className="visual-console-item-label",t},e}(s.a),K=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),G=function(){return(G=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},q=function(t){switch(t){case"string":case"image":return t;default:return"string"}},V=function(t){switch(t){case"none":case"avg":case"max":case"min":return t;default:return"none"}};function F(t){if("string"!=typeof t.value||0===t.value.length)throw new TypeError("invalid value");var e=V(t.processValue);return G({},Object(s.b)(t),{type:2,valueType:q(t.valueType),value:t.value},"none"===e?{processValue:e}:{processValue:e,period:Object(r.i)(t.period,0)},Object(r.e)(t),Object(r.d)(t))}var Y=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return K(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");if(t.className="simple-value","image"===this.props.valueType){var e=document.createElement("img");e.src=this.props.value,t.append(e)}else{var n=this.props.value,i=this.getLabelWithMacrosReplaced();i.length>0&&(n=Object(r.l)([{macro:/\(?_VALUE_\)?/i,value:n}],i)),t.innerHTML=n}return t},e.prototype.createLabelDomElement=function(){var t=document.createElement("div");return t.className="visual-console-item-label",t},e}(s.a),X=n(3),Z=Math.PI,Q=2*Z,J=Q-1e-6;function $(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function tt(){return new $}$.prototype=tt.prototype={constructor:$,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,r,s){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+s)},arcTo:function(t,e,n,i,r){t=+t,e=+e,n=+n,i=+i,r=+r;var s=this._x1,o=this._y1,a=n-t,c=i-e,l=s-t,u=o-e,h=l*l+u*u;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(h>1e-6)if(Math.abs(u*a-c*l)>1e-6&&r){var p=n-s,_=i-o,f=a*a+c*c,d=p*p+_*_,y=Math.sqrt(f),m=Math.sqrt(h),b=r*Math.tan((Z-Math.acos((f+h-d)/(2*y*m)))/2),v=b/m,g=b/y;Math.abs(v-1)>1e-6&&(this._+="L"+(t+v*l)+","+(e+v*u)),this._+="A"+r+","+r+",0,0,"+ +(u*p>l*_)+","+(this._x1=t+g*a)+","+(this._y1=e+g*c)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,i,r,s){t=+t,e=+e;var o=(n=+n)*Math.cos(i),a=n*Math.sin(i),c=t+o,l=e+a,u=1^s,h=s?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+c+","+l:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+c+","+l),n&&(h<0&&(h=h%Q+Q),h>J?this._+="A"+n+","+n+",0,1,"+u+","+(t-o)+","+(e-a)+"A"+n+","+n+",0,1,"+u+","+(this._x1=c)+","+(this._y1=l):h>1e-6&&(this._+="A"+n+","+n+",0,"+ +(h>=Z)+","+u+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};var et=tt,nt=function(t){return function(){return t}},it=Math.abs,rt=Math.atan2,st=Math.cos,ot=Math.max,at=Math.min,ct=Math.sin,lt=Math.sqrt,ut=1e-12,ht=Math.PI,pt=ht/2,_t=2*ht;function ft(t){return t>=1?pt:t<=-1?-pt:Math.asin(t)}function dt(t){return t.innerRadius}function yt(t){return t.outerRadius}function mt(t){return t.startAngle}function bt(t){return t.endAngle}function vt(t){return t&&t.padAngle}function gt(t,e,n,i,r,s,o){var a=t-n,c=e-i,l=(o?s:-s)/lt(a*a+c*c),u=l*c,h=-l*a,p=t+u,_=e+h,f=n+u,d=i+h,y=(p+f)/2,m=(_+d)/2,b=f-p,v=d-_,g=b*b+v*v,x=r-s,E=p*d-f*_,O=(v<0?-1:1)*lt(ot(0,x*x*g-E*E)),w=(E*v-b*O)/g,T=(-E*b-v*O)/g,A=(E*v+b*O)/g,k=(-E*b+v*O)/g,P=w-y,M=T-m,j=A-y,S=k-m;return P*P+M*M>j*j+S*S&&(w=A,T=k),{cx:w,cy:T,x01:-u,y01:-h,x11:w*(r/x-1),y11:T*(r/x-1)}}var xt=function(){var t=dt,e=yt,n=nt(0),i=null,r=mt,s=bt,o=vt,a=null;function c(){var c,l,u,h=+t.apply(this,arguments),p=+e.apply(this,arguments),_=r.apply(this,arguments)-pt,f=s.apply(this,arguments)-pt,d=it(f-_),y=f>_;if(a||(a=c=et()),p<h&&(l=p,p=h,h=l),p>ut)if(d>_t-ut)a.moveTo(p*st(_),p*ct(_)),a.arc(0,0,p,_,f,!y),h>ut&&(a.moveTo(h*st(f),h*ct(f)),a.arc(0,0,h,f,_,y));else{var m,b,v=_,g=f,x=_,E=f,O=d,w=d,T=o.apply(this,arguments)/2,A=T>ut&&(i?+i.apply(this,arguments):lt(h*h+p*p)),k=at(it(p-h)/2,+n.apply(this,arguments)),P=k,M=k;if(A>ut){var j=ft(A/h*ct(T)),S=ft(A/p*ct(T));(O-=2*j)>ut?(x+=j*=y?1:-1,E-=j):(O=0,x=E=(_+f)/2),(w-=2*S)>ut?(v+=S*=y?1:-1,g-=S):(w=0,v=g=(_+f)/2)}var I=p*st(v),N=p*ct(v),D=h*st(E),L=h*ct(E);if(k>ut){var R,C=p*st(g),B=p*ct(g),z=h*st(x),W=h*ct(x);if(d<ht&&(R=function(t,e,n,i,r,s,o,a){var c=n-t,l=i-e,u=o-r,h=a-s,p=h*c-u*l;if(!(p*p<ut))return[t+(p=(u*(e-s)-h*(t-r))/p)*c,e+p*l]}(I,N,z,W,C,B,D,L))){var H=I-R[0],U=N-R[1],K=C-R[0],G=B-R[1],q=1/ct(((u=(H*K+U*G)/(lt(H*H+U*U)*lt(K*K+G*G)))>1?0:u<-1?ht:Math.acos(u))/2),V=lt(R[0]*R[0]+R[1]*R[1]);P=at(k,(h-V)/(q-1)),M=at(k,(p-V)/(q+1))}}w>ut?M>ut?(m=gt(z,W,I,N,p,M,y),b=gt(C,B,D,L,p,M,y),a.moveTo(m.cx+m.x01,m.cy+m.y01),M<k?a.arc(m.cx,m.cy,M,rt(m.y01,m.x01),rt(b.y01,b.x01),!y):(a.arc(m.cx,m.cy,M,rt(m.y01,m.x01),rt(m.y11,m.x11),!y),a.arc(0,0,p,rt(m.cy+m.y11,m.cx+m.x11),rt(b.cy+b.y11,b.cx+b.x11),!y),a.arc(b.cx,b.cy,M,rt(b.y11,b.x11),rt(b.y01,b.x01),!y))):(a.moveTo(I,N),a.arc(0,0,p,v,g,!y)):a.moveTo(I,N),h>ut&&O>ut?P>ut?(m=gt(D,L,C,B,h,-P,y),b=gt(I,N,z,W,h,-P,y),a.lineTo(m.cx+m.x01,m.cy+m.y01),P<k?a.arc(m.cx,m.cy,P,rt(m.y01,m.x01),rt(b.y01,b.x01),!y):(a.arc(m.cx,m.cy,P,rt(m.y01,m.x01),rt(m.y11,m.x11),!y),a.arc(0,0,h,rt(m.cy+m.y11,m.cx+m.x11),rt(b.cy+b.y11,b.cx+b.x11),y),a.arc(b.cx,b.cy,P,rt(b.y11,b.x11),rt(b.y01,b.x01),!y))):a.arc(0,0,h,E,x,y):a.lineTo(D,L)}else a.moveTo(0,0);if(a.closePath(),c)return a=null,c+""||null}return c.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,i=(+r.apply(this,arguments)+ +s.apply(this,arguments))/2-ht/2;return[st(i)*n,ct(i)*n]},c.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:nt(+e),c):t},c.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:nt(+t),c):e},c.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:nt(+t),c):n},c.padRadius=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:nt(+t),c):i},c.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:nt(+t),c):r},c.endAngle=function(t){return arguments.length?(s="function"==typeof t?t:nt(+t),c):s},c.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:nt(+t),c):o},c.context=function(t){return arguments.length?(a=null==t?null:t,c):a},c};function Et(t){this._context=t}Et.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var Ot=function(t){return new Et(t)};Tt(Ot);function wt(t){this._curve=t}function Tt(t){function e(e){return new wt(t(e))}return e._curve=t,e}wt.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};Array.prototype.slice;Math.sqrt(1/3);var At=Math.sin(ht/10)/Math.sin(7*ht/10),kt=(Math.sin(_t/10),Math.cos(_t/10),Math.sqrt(3),Math.sqrt(3),Math.sqrt(12),function(){});function Pt(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Mt(t){this._context=t}Mt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Pt(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Pt(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function jt(t){this._context=t}jt.prototype={areaStart:kt,areaEnd:kt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Pt(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function St(t){this._context=t}St.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,i=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,i):this._context.moveTo(n,i);break;case 3:this._point=4;default:Pt(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function It(t,e){this._basis=new Mt(t),this._beta=e}It.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var i,r=t[0],s=e[0],o=t[n]-r,a=e[n]-s,c=-1;++c<=n;)i=c/n,this._basis.point(this._beta*t[c]+(1-this._beta)*(r+i*o),this._beta*e[c]+(1-this._beta)*(s+i*a));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};(function t(e){function n(t){return 1===e?new Mt(t):new It(t,e)}return n.beta=function(e){return t(+e)},n})(.85);function Nt(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Dt(t,e){this._context=t,this._k=(1-e)/6}Dt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Nt(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Nt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function n(t){return new Dt(t,e)}return n.tension=function(e){return t(+e)},n})(0);function Lt(t,e){this._context=t,this._k=(1-e)/6}Lt.prototype={areaStart:kt,areaEnd:kt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Nt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function n(t){return new Lt(t,e)}return n.tension=function(e){return t(+e)},n})(0);function Rt(t,e){this._context=t,this._k=(1-e)/6}Rt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Nt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function n(t){return new Rt(t,e)}return n.tension=function(e){return t(+e)},n})(0);function Ct(t,e,n){var i=t._x1,r=t._y1,s=t._x2,o=t._y2;if(t._l01_a>ut){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);i=(i*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,r=(r*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>ut){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);s=(s*l+t._x1*t._l23_2a-e*t._l12_2a)/u,o=(o*l+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(i,r,s,o,t._x2,t._y2)}function Bt(t,e){this._context=t,this._alpha=e}Bt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Ct(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function n(t){return e?new Bt(t,e):new Dt(t,0)}return n.alpha=function(e){return t(+e)},n})(.5);function zt(t,e){this._context=t,this._alpha=e}zt.prototype={areaStart:kt,areaEnd:kt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Ct(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function n(t){return e?new zt(t,e):new Lt(t,0)}return n.alpha=function(e){return t(+e)},n})(.5);function Wt(t,e){this._context=t,this._alpha=e}Wt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Ct(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function n(t){return e?new Wt(t,e):new Rt(t,0)}return n.alpha=function(e){return t(+e)},n})(.5);function Ht(t){this._context=t}Ht.prototype={areaStart:kt,areaEnd:kt,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Ut(t){return t<0?-1:1}function Kt(t,e,n){var i=t._x1-t._x0,r=e-t._x1,s=(t._y1-t._y0)/(i||r<0&&-0),o=(n-t._y1)/(r||i<0&&-0),a=(s*r+o*i)/(i+r);return(Ut(s)+Ut(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function Gt(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function qt(t,e,n){var i=t._x0,r=t._y0,s=t._x1,o=t._y1,a=(s-i)/3;t._context.bezierCurveTo(i+a,r+a*e,s-a,o-a*n,s,o)}function Vt(t){this._context=t}function Ft(t){this._context=new Yt(t)}function Yt(t){this._context=t}function Xt(t){this._context=t}function Zt(t){var e,n,i=t.length-1,r=new Array(i),s=new Array(i),o=new Array(i);for(r[0]=0,s[0]=2,o[0]=t[0]+2*t[1],e=1;e<i-1;++e)r[e]=1,s[e]=4,o[e]=4*t[e]+2*t[e+1];for(r[i-1]=2,s[i-1]=7,o[i-1]=8*t[i-1]+t[i],e=1;e<i;++e)n=r[e]/s[e-1],s[e]-=n,o[e]-=n*o[e-1];for(r[i-1]=o[i-1]/s[i-1],e=i-2;e>=0;--e)r[e]=(o[e]-r[e+1])/s[e];for(s[i-1]=(t[i]+r[i-1])/2,e=0;e<i-1;++e)s[e]=2*t[e+1]-r[e+1];return[r,s]}Vt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:qt(this,this._t0,Gt(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,qt(this,Gt(this,n=Kt(this,t,e)),n);break;default:qt(this,this._t0,n=Kt(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(Ft.prototype=Object.create(Vt.prototype)).point=function(t,e){Vt.prototype.point.call(this,e,t)},Yt.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,i,r,s){this._context.bezierCurveTo(e,t,i,n,s,r)}},Xt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var i=Zt(t),r=Zt(e),s=0,o=1;o<n;++s,++o)this._context.bezierCurveTo(i[0][s],r[0][s],i[1][s],r[1][s],t[o],e[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function Qt(t,e){this._context=t,this._t=e}Qt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var Jt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),$t=function(){return($t=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function te(t){switch(t){case"progress-bar":case"bubble":case"circular-progress-bar":case"circular-progress-bar-alt":return t;default:case 3:return"progress-bar";case 9:return"bubble";case 15:return"circular-progress-bar";case 16:return"circular-progress-bar-alt"}}function ee(t){switch(t){case"percent":case"value":return t;default:return"percent"}}function ne(t){return $t({},Object(s.b)(t),{type:3,percentileType:te(t.percentileType||t.type),valueType:ee(t.valueType),minValue:Object(r.i)(t.minValue,null),maxValue:Object(r.i)(t.maxValue,null),color:Object(r.f)(t.color,null),labelColor:Object(r.f)(t.labelColor,null),value:Object(r.h)(t.value,null),unit:Object(r.f)(t.unit,null)},Object(r.e)(t),Object(r.d)(t))}var ie="http://www.w3.org/2000/svg",re=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Jt(e,t),e.prototype.createDomElement=function(){var t,e={background:"#000000",progress:this.props.color||"#F0F0F0",text:this.props.labelColor||"#444444"},n=this.getProgress(),i=document.createElement("div"),r=document.createElementNS(ie,"svg");switch(null!=this.props.value&&(t=Intl?Intl.NumberFormat("en-EN").format(this.props.value):this.props.value),this.props.percentileType){case"progress-bar":var s=document.createElementNS(ie,"rect");s.setAttribute("fill",e.background),s.setAttribute("fill-opacity","0.5"),s.setAttribute("width","100"),s.setAttribute("height","20"),s.setAttribute("rx","5"),s.setAttribute("ry","5");var o=document.createElementNS(ie,"rect");o.setAttribute("fill",e.progress),o.setAttribute("fill-opacity","1"),o.setAttribute("width",""+n),o.setAttribute("height","20"),o.setAttribute("rx","5"),o.setAttribute("ry","5"),(h=document.createElementNS(ie,"text")).setAttribute("text-anchor","middle"),h.setAttribute("alignment-baseline","middle"),h.setAttribute("font-size","12"),h.setAttribute("font-family","arial"),h.setAttribute("font-weight","bold"),h.setAttribute("transform","translate(50 11)"),h.setAttribute("fill",e.text),"value"===this.props.valueType?(h.style.fontSize="6pt",h.textContent=this.props.unit?t+" "+this.props.unit:""+t):h.textContent=n+"%",r.setAttribute("viewBox","0 0 100 20"),r.append(s,o,h);break;case"bubble":case"circular-progress-bar":case"circular-progress-bar-alt":if(r.setAttribute("viewBox","0 0 100 100"),"bubble"===this.props.percentileType){(a=document.createElementNS(ie,"circle")).setAttribute("transform","translate(50 50)"),a.setAttribute("fill",e.background),a.setAttribute("fill-opacity","0.5"),a.setAttribute("r","50"),(c=document.createElementNS(ie,"circle")).setAttribute("transform","translate(50 50)"),c.setAttribute("fill",e.progress),c.setAttribute("fill-opacity","1"),c.setAttribute("r",""+n/2),r.append(a,c)}else{var a,c,l={innerRadius:"circular-progress-bar"===this.props.percentileType?30:0,outerRadius:50,startAngle:0,endAngle:2*Math.PI},u=xt();(a=document.createElementNS(ie,"path")).setAttribute("transform","translate(50 50)"),a.setAttribute("fill",e.background),a.setAttribute("fill-opacity","0.5"),a.setAttribute("d",""+u(l)),(c=document.createElementNS(ie,"path")).setAttribute("transform","translate(50 50)"),c.setAttribute("fill",e.progress),c.setAttribute("fill-opacity","1"),c.setAttribute("d",""+u($t({},l,{endAngle:l.endAngle*(n/100)}))),r.append(a,c)}var h;if((h=document.createElementNS(ie,"text")).setAttribute("text-anchor","middle"),h.setAttribute("alignment-baseline","middle"),h.setAttribute("font-size","16"),h.setAttribute("font-family","arial"),h.setAttribute("font-weight","bold"),h.setAttribute("fill",e.text),"value"===this.props.valueType&&null!=this.props.value)if(this.props.unit&&this.props.unit.length>0){var p=document.createElementNS(ie,"tspan");p.setAttribute("x","0"),p.setAttribute("dy","1em"),p.textContent=""+t,p.style.fontSize="8pt";var _=document.createElementNS(ie,"tspan");_.setAttribute("x","0"),_.setAttribute("dy","1em"),_.textContent=""+this.props.unit,_.style.fontSize="8pt",h.append(p,_),h.setAttribute("transform","translate(50 33)")}else h.textContent=""+t,h.style.fontSize="8pt",h.setAttribute("transform","translate(50 50)");else h.textContent=n+"%",h.setAttribute("transform","translate(50 50)");r.append(h)}return i.append(r),i},e.prototype.getProgress=function(){var t=this.props.minValue||0,e=this.props.maxValue||100,n=null==this.props.value?0:this.props.value;return n<=t?0:n>=e?100:Math.trunc((n-t)/(e-t)*100)},e}(s.a),se=n(2),oe=n(4),ae=n(5),ce=n(6),le=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),ue=function(){return(ue=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function he(t){if(null!==t.imageSrc){if("string"!=typeof t.statusImageSrc||0===t.imageSrc.statusImageSrc)throw new TypeError("invalid status image src.")}else if(Object(r.n)(t.encodedTitle))throw new TypeError("missing encode tittle content.");if(null===Object(r.i)(t.serviceId,null))throw new TypeError("invalid service id.");return ue({},Object(s.b)(t),{type:10,serviceId:t.serviceId,imageSrc:Object(r.f)(t.imageSrc,null),statusImageSrc:Object(r.f)(t.statusImageSrc,null),encodedTitle:Object(r.f)(t.encodedTitle,null)})}var pe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return le(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");return t.className="service",null!==this.props.statusImageSrc?(t.style.background="url("+this.props.statusImageSrc+") no-repeat",t.style.backgroundSize="contain",t.style.backgroundPosition="center"):null!==this.props.encodedTitle&&(t.innerHTML=Object(r.a)(this.props.encodedTitle)),t},e}(s.a),_e=function(){return(_e=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function fe(t){var e=Object(r.i)(t.type,null);if(null==e)throw new TypeError("missing item type.");switch(e){case 0:return new u(l(t));case 1:return new ce.a(Object(ce.b)(t));case 2:case 6:case 7:case 8:return new Y(F(t));case 3:case 9:case 15:case 16:return new re(ne(t));case 4:return new U(H(t));case 5:return new f(_(t));case 10:return new pe(he(t));case 11:return new O(E(t));case 12:return new N(I(t));case 13:return new B(R(t));case 14:return new X.a(Object(X.b)(t));case 17:return new oe.a(Object(oe.b)(t));case 18:return new ae.b(Object(ae.a)(t));case 19:return new M(P(t));case 20:return new v(m(t));default:throw new TypeError("item not found")}}var de=function(){function t(t,e,n){var i=this;this.elementsById={},this.elementIds=[],this.relations={},this.clickEventManager=new se.a,this.disposables=[],this.handleElementClick=function(t){i.clickEventManager.emit(t)},this.handleElementRemove=function(t){i.elementIds=i.elementIds.filter(function(e){return e!==t.data.id}),delete i.elementsById[t.data.id],i.clearRelations(t.data.id)},this.containerRef=t,this._props=function(t){var e=t.id,n=t.name,i=t.groupId,s=t.backgroundURL,o=t.backgroundColor,a=t.isFavorite,c=t.relationLineWidth;if(null==e||isNaN(parseInt(e)))throw new TypeError("invalid Id.");if("string"!=typeof n||0===n.length)throw new TypeError("invalid name.");if(null==i||isNaN(parseInt(i)))throw new TypeError("invalid group Id.");return _e({id:parseInt(e),name:n,groupId:parseInt(i),backgroundURL:Object(r.f)(s,null),backgroundColor:Object(r.f)(o,null),isFavorite:Object(r.g)(a),relationLineWidth:Object(r.i)(c,0)},Object(r.m)(t))}(e),this.render(),(n=n.sort(function(t,e){return null==t.isOnTop||null==e.isOnTop||null==t.id||null==e.id?0:t.isOnTop&&!e.isOnTop?1:!t.isOnTop&&e.isOnTop?-1:t.id>e.id?1:-1})).forEach(function(t){try{var e=fe(t);i.elementsById[e.props.id]=e,i.elementIds.push(e.props.id),e.onClick(i.handleElementClick),e.onRemove(i.handleElementRemove),i.containerRef.append(e.elementRef)}catch(t){console.log("Error creating a new element:",t.message)}}),this.buildRelations()}return Object.defineProperty(t.prototype,"elements",{get:function(){var t=this;return this.elementIds.map(function(e){return t.elementsById[e]}).filter(function(t){return null!=t})},enumerable:!0,configurable:!0}),t.prototype.updateElements=function(t){var e=this,n=t.map(function(t){return t.id||null}).filter(function(t){return null!=t});this.elementIds.filter(function(t){return n.indexOf(t)<0}).forEach(function(t){null!=e.elementsById[t]&&(e.elementsById[t].remove(),delete e.elementsById[t])}),this.elementIds=n,t.forEach(function(t){if(t.id)if(null==e.elementsById[t.id])try{var n=fe(t);e.elementsById[n.props.id]=n,n.onClick(e.handleElementClick),n.onRemove(e.handleElementRemove),e.containerRef.append(n.elementRef)}catch(t){console.log("Error creating a new element:",t.message)}else try{e.elementsById[t.id].props=function(t){var e=Object(r.i)(t.type,null);if(null==e)throw new TypeError("missing item type.");switch(e){case 0:return l(t);case 1:return Object(ce.b)(t);case 2:case 6:case 7:case 8:return F(t);case 3:case 9:case 15:case 16:return ne(t);case 4:return H(t);case 5:return _(t);case 10:return he(t);case 11:return E(t);case 12:return I(t);case 13:return R(t);case 14:return Object(X.b)(t);case 17:return Object(oe.b)(t);case 18:return Object(ae.a)(t);case 19:return P(t);case 20:return m(t);default:throw new TypeError("decoder not found")}}(t)}catch(t){console.log("Error updating an element:",t.message)}}),this.buildRelations()},Object.defineProperty(t.prototype,"props",{get:function(){return _e({},this._props)},set:function(t){var e=this.props;this._props=t,this.render(e)},enumerable:!0,configurable:!0}),t.prototype.render=function(t){void 0===t&&(t=null),t?(t.backgroundURL!==this.props.backgroundURL&&(this.containerRef.style.backgroundImage=null!==this.props.backgroundURL?"url("+this.props.backgroundURL+")":null),t.backgroundColor!==this.props.backgroundColor&&(this.containerRef.style.backgroundColor=this.props.backgroundColor),this.sizeChanged(t,this.props)&&this.resizeElement(this.props.width,this.props.height)):(this.containerRef.style.backgroundImage=null!==this.props.backgroundURL?"url("+this.props.backgroundURL+")":null,this.containerRef.style.backgroundColor=this.props.backgroundColor,this.resizeElement(this.props.width,this.props.height))},t.prototype.sizeChanged=function(t,e){return t.width!==e.width||t.height!==e.height},t.prototype.resizeElement=function(t,e){this.containerRef.style.width=t+"px",this.containerRef.style.height=e+"px"},t.prototype.resize=function(t,e){this.props=_e({},this.props,{width:t,height:e})},t.prototype.remove=function(){this.disposables.forEach(function(t){return t.dispose()}),this.elements.forEach(function(t){return t.remove()}),this.elementsById={},this.elementIds=[],this.clearRelations(),this.containerRef.innerHTML=""},t.prototype.buildRelations=function(){var t=this;this.clearRelations(),this.elements.forEach(function(e){if(null!==e.props.parentId){var n=t.elementsById[e.props.parentId],i=t.elementsById[e.props.id];n&&i&&t.addRelationLine(n,i)}})},t.prototype.clearRelations=function(t){if(null!=t)for(var e in this.relations){var n=e.split("|"),i=Number.parseInt(n[0]),r=Number.parseInt(n[1]);t!==i&&t!==r||(this.relations[e].remove(),delete this.relations[e])}else for(var e in this.relations)this.relations[e].remove(),delete this.relations[e]},t.prototype.getRelationLine=function(t,e){var n=t+"|"+e;return this.relations[n]||null},t.prototype.addRelationLine=function(t,e){var n=t.props.id+"|"+e.props.id;null!=this.relations[n]&&this.relations[n].remove();var i=t.props.x+t.elementRef.clientWidth/2,r=t.props.y+(t.elementRef.clientHeight-t.labelElementRef.clientHeight)/2,s=e.props.x+e.elementRef.clientWidth/2,o=e.props.y+(e.elementRef.clientHeight-e.labelElementRef.clientHeight)/2,a=new B(R({id:0,type:13,startX:i,startY:r,endX:s,endY:o,width:0,height:0,lineWidth:this.props.relationLineWidth,color:"#CCCCCC"}));return this.relations[n]=a,a.elementRef.style.zIndex="0",this.containerRef.append(a.elementRef),a},t.prototype.onClick=function(t){var e=this.clickEventManager.on(t);return this.disposables.push(e),e},t}(),ye=function(){function t(t){this.cancellable={cancel:function(){}},this._status="waiting",this.statusChangeEventManager=new se.a,this.disposables=[],this.taskInitiator=t}return Object.defineProperty(t.prototype,"status",{get:function(){return this._status},set:function(t){this._status=t,this.statusChangeEventManager.emit(t)},enumerable:!0,configurable:!0}),t.prototype.init=function(){var t=this;this.cancellable=this.taskInitiator(function(){t.status="finished"}),this.status="started"},t.prototype.cancel=function(){this.cancellable.cancel(),this.status="cancelled"},t.prototype.onStatusChange=function(t){var e=this.statusChangeEventManager.on(t);return this.disposables.push(e),e},t}();var me=function(){function t(){this.tasks={}}return t.prototype.add=function(t,e,n){void 0===n&&(n=0),this.tasks[t]&&"started"===this.tasks[t].status&&this.tasks[t].cancel();var i=n>0?function(t,e){return new ye(function(){var n=null;return t.onStatusChange(function(i){"finished"===i&&(n=window.setTimeout(function(){t.init()},e))}),t.init(),{cancel:function(){n&&clearTimeout(n),t.cancel()}}})}(new ye(e),n):new ye(e);return this.tasks[t]=i,this.tasks[t]},t.prototype.init=function(t){!this.tasks[t]||"waiting"!==this.tasks[t].status&&"cancelled"!==this.tasks[t].status&&"finished"!==this.tasks[t].status||this.tasks[t].init()},t.prototype.cancel=function(t){this.tasks[t]&&"started"===this.tasks[t].status&&this.tasks[t].cancel()},t}();window.VisualConsole=de,window.AsyncTaskManager=me}]);
+!function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(t,e,n){"use strict";n.d(e,"m",function(){return r}),n.d(e,"l",function(){return s}),n.d(e,"r",function(){return o}),n.d(e,"j",function(){return a}),n.d(e,"k",function(){return c}),n.d(e,"n",function(){return u}),n.d(e,"q",function(){return h}),n.d(e,"i",function(){return p}),n.d(e,"h",function(){return _}),n.d(e,"g",function(){return f}),n.d(e,"o",function(){return d}),n.d(e,"d",function(){return m}),n.d(e,"e",function(){return y}),n.d(e,"f",function(){return b}),n.d(e,"p",function(){return v}),n.d(e,"c",function(){return x}),n.d(e,"a",function(){return w}),n.d(e,"b",function(){return O});var i=function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function r(t,e){return"number"==typeof t?t:"string"==typeof t&&t.length>0&&!isNaN(parseInt(t))?parseInt(t):e}function s(t,e){return"number"==typeof t?t:"string"==typeof t&&t.length>0&&!isNaN(parseFloat(t))?parseFloat(t):e}function o(t){return null==t||0===t.length}function a(t,e){return"string"==typeof t&&t.length>0?t:e}function c(t){return"boolean"==typeof t?t:"number"==typeof t?t>0:"string"==typeof t&&("1"===t||"true"===t)}function l(t,e,n){void 0===n&&(n=" "),"number"==typeof t&&(t=""+t),"number"==typeof n&&(n=""+n);var i=e-t.length;if(0===i)return t;if(i<0)return t.substr(Math.abs(i));if(i===n.length)return""+n+t;if(i<n.length)return""+n.substring(0,i)+t;for(var r=Math.floor(i/n.length),s=i-n.length*r,o="",a=0;a<r;a++)o+=n;return 0===s?""+o+t:""+o+n.substring(0,s)+t}function u(t){return{x:r(t.x,0),y:r(t.y,0)}}function h(t){if(null==t.width||isNaN(parseInt(t.width))||null==t.height||isNaN(parseInt(t.height)))throw new TypeError("invalid size.");return{width:parseInt(t.width),height:parseInt(t.height)}}function p(t){return i({moduleId:r(t.moduleId,null),moduleName:a(t.moduleName,null),moduleDescription:a(t.moduleDescription,null)},function(t){var e={agentId:r(t.agent,null),agentName:a(t.agentName,null),agentAlias:a(t.agentAlias,null),agentDescription:a(t.agentDescription,null),agentAddress:a(t.agentAddress,null)};return null!=t.metaconsoleId?i({metaconsoleId:t.metaconsoleId},e):e}(t))}function _(t){var e=t.metaconsoleId,n=t.linkedLayoutId,s=t.linkedLayoutAgentId,o={linkedLayoutStatusType:"default"};switch(t.linkedLayoutStatusType){case"weight":var a=r(t.linkedLayoutStatusTypeWeight,null);if(null==a)throw new TypeError("invalid status calculation properties.");t.linkedLayoutStatusTypeWeight&&(o={linkedLayoutStatusType:"weight",linkedLayoutStatusTypeWeight:a});break;case"service":var c=r(t.linkedLayoutStatusTypeWarningThreshold,null),l=r(t.linkedLayoutStatusTypeCriticalThreshold,null);if(null==c||null==l)throw new TypeError("invalid status calculation properties.");o={linkedLayoutStatusType:"service",linkedLayoutStatusTypeWarningThreshold:c,linkedLayoutStatusTypeCriticalThreshold:l}}var u=i({linkedLayoutId:r(n,null),linkedLayoutAgentId:r(s,null)},o);return null!=e?i({metaconsoleId:e},u):u}function f(t){var e,n,i=(e=t.receivedAt,n=null,e instanceof Date?e:"number"==typeof e?new Date(1e3*e):"string"!=typeof e||Number.isNaN(new Date(e).getTime())?n:new Date(e));if(null===i)throw new TypeError("invalid meta structure");var r=null;return t.error instanceof Error?r=t.error:"string"==typeof t.error&&(r=new Error(t.error)),{receivedAt:i,error:r,editMode:c(t.editMode),isFromCache:c(t.isFromCache),isFetching:!1,isUpdating:!1}}function d(t,e){var n=t+": "+e+";";return["-webkit-"+n,"-moz-"+n,"-ms-"+n,"-o-"+n,""+n]}function m(t){return decodeURIComponent(escape(window.atob(t)))}function y(t,e){if(void 0===e&&(e=null),e&&Intl&&Intl.DateTimeFormat){return Intl.DateTimeFormat(e,{day:"2-digit",month:"2-digit",year:"numeric"}).format(t)}return l(t.getDate(),2,0)+"/"+l(t.getMonth()+1,2,0)+"/"+l(t.getFullYear(),4,0)}function b(t){return l(t.getHours(),2,0)+":"+l(t.getMinutes(),2,0)+":"+l(t.getSeconds(),2,0)}function v(t,e){return t.reduce(function(t,e){var n=e.macro,i=e.value;return t.replace(n,i)},e)}function g(t,e){var n=0;return function(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];var s=Date.now();if(!(s-n<t))return n=s,e.apply(void 0,i)}}function x(t,e){var n=null;return function(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];null!==n&&window.clearTimeout(n),n=window.setTimeout(function(){e.apply(void 0,i),n=null},t)}}function E(t){for(var e=0,n=0;t&&!Number.isNaN(t.offsetLeft)&&!Number.isNaN(t.offsetTop);)e+=t.offsetLeft-t.scrollLeft,n+=t.offsetTop-t.scrollTop,t=t.offsetParent;return{top:n,left:e}}function w(t,e){var n=t.parentElement,i=t.draggable,r=0,s=0,o=0,a=0,c=0,l=0,u=n.getBoundingClientRect(),h=E(n),p=h.top,_=p+u.height,f=h.left,d=f+u.width,m=t.getBoundingClientRect(),y=window.getComputedStyle(t).borderWidth||"0",b=2*Number.parseInt(y),v=x(32,function(t,n){return e(t,n)}),w=g(16,function(t,n){return e(t,n)}),O=function(t){var e=0,n=0,i=t.pageX,h=t.pageY,y=i-o,g=h-a,x=u.width-m.width+b,E=u.height-m.height+b,O=i<f||0===r&&y>0&&i<f+c,T=i>d||y+r+m.width-b>u.width||r===x&&y<0&&i>f+x+c,A=h<p||0===s&&g>0&&h<p+l,k=h>_||g+s+m.height-b>u.height||s===E&&g<0&&h>p+E+l;(e=O?0:T?x:y+r)<0&&(e=0),(n=A?0:k?E:g+s)<0&&(n=0),o=i,a=h,e===r&&n===s||(w(e,n),v(e,n),r=e,s=n)},T=function(){r=0,s=0,o=0,a=0,document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",T),t.draggable=i,document.body.style.userSelect="auto"},A=function(e){e.stopPropagation(),t.draggable=!1,r=t.offsetLeft,s=t.offsetTop,o=e.pageX,a=e.pageY,c=e.offsetX,l=e.offsetY,u=n.getBoundingClientRect(),h=E(n),p=h.top,_=p+u.height,f=h.left,d=f+u.width,m=t.getBoundingClientRect(),y=window.getComputedStyle(t).borderWidth||"0",b=2*Number.parseInt(y),document.addEventListener("mousemove",O),document.addEventListener("mouseup",T),document.body.style.userSelect="none"};return t.addEventListener("mousedown",A),function(){t.removeEventListener("mousedown",A),T()}}function O(t,e){var n=document.createElement("div");n.className="resize-draggable",t.appendChild(n);var i=t.parentElement,r=t.draggable,s=0,o=0,a=0,c=0,l=0,u=i.getBoundingClientRect(),h=E(i),p=h.top,_=p+u.height,f=h.left,d=f+u.width,m=E(t),y=m.top,b=m.left,v=window.getComputedStyle(t).borderWidth||"0",w=Number.parseInt(v),O=x(32,function(t,n){return e(t,n)}),T=g(16,function(t,n){return e(t,n)}),A=function(t){var e=s+(t.pageX-a),n=o+(t.pageY-c);e===s&&n===o||e<s&&t.pageX>b+(s-l)||(e<15?e=15:e+b-w/2>=d&&(e=d-b),n<15?n=15:n+y-w/2>=_&&(n=_-y),T(e,n),O(e,n),s=e,o=n,a=t.pageX,c=t.pageY)},k=function(){s=0,o=0,a=0,c=0,l=0,0,document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",k),t.draggable=r,document.body.style.userSelect="auto"};return n.addEventListener("mousedown",function(e){e.stopPropagation(),t.draggable=!1;var n=t.getBoundingClientRect(),r=n.width,v=n.height;s=r,o=v,a=e.pageX,c=e.pageY,l=e.offsetX,e.offsetY,u=i.getBoundingClientRect(),h=E(i),p=h.top,_=p+u.height,f=h.left,d=f+u.width,m=E(t),y=m.top,b=m.left,document.addEventListener("mousemove",A),document.addEventListener("mouseup",k),document.body.style.userSelect="none"}),function(){n.remove(),k()}}},function(t,e,n){"use strict";n.d(e,"b",function(){return a});var i=n(0),r=n(2),s=function(){return(s=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},o=function(t){switch(t){case"up":case"right":case"down":case"left":return t;default:return"down"}};function a(t){if(null==t.id||isNaN(parseInt(t.id)))throw new TypeError("invalid id.");if(null==t.type||isNaN(parseInt(t.type)))throw new TypeError("invalid type.");return s({id:parseInt(t.id),type:parseInt(t.type),label:Object(i.j)(t.label,null),labelPosition:o(t.labelPosition),isLinkEnabled:Object(i.k)(t.isLinkEnabled),link:Object(i.j)(t.link,null),isOnTop:Object(i.k)(t.isOnTop),parentId:Object(i.m)(t.parentId,null),aclGroupId:Object(i.m)(t.aclGroupId,null)},Object(i.q)(t),Object(i.n)(t))}var c=function(){function t(t,e){var n=this;this.clickEventManager=new r.a,this.movedEventManager=new r.a,this.resizedEventManager=new r.a,this.removeEventManager=new r.a,this.disposables=[],this.debouncedMovementSave=Object(i.c)(500,function(t,e){var i={x:n.props.x,y:n.props.y},r={x:t,y:e};n.positionChanged(i,r)&&(n.move(t,e),n.movedEventManager.emit({item:n,prevPosition:i,newPosition:r}))}),this.removeMovement=null,this.debouncedResizementSave=Object(i.c)(500,function(t,e){var i={width:n.props.width,height:n.props.height},r={width:t,height:e};n.sizeChanged(i,r)&&(n.resize(t,e),n.resizedEventManager.emit({item:n,prevSize:i,newSize:r}))}),this.removeResizement=null,this.itemProps=t,this._metadata=e,this.elementRef=this.createContainerDomElement(),this.labelElementRef=this.createLabelDomElement(),this.childElementRef=this.createDomElement(),this.elementRef.append(this.childElementRef,this.labelElementRef),this.resizeElement(t.width,t.height),this.changeLabelPosition(t.labelPosition)}return t.prototype.initMovementListener=function(t){var e=this;this.removeMovement=Object(i.a)(t,function(t,n){e.moveElement(t,n),e.debouncedMovementSave(t,n)})},t.prototype.stopMovementListener=function(){this.removeMovement&&(this.removeMovement(),this.removeMovement=null)},t.prototype.initResizementListener=function(t){var e=this;this.removeResizement=Object(i.b)(t,function(t,n){if(e.props.label&&e.props.label.length>0){var i=e.labelElementRef.getBoundingClientRect(),r=i.width,s=i.height;switch(e.props.labelPosition){case"up":case"down":n-=s;break;case"left":case"right":t-=r}}e.resizeElement(t,n),e.debouncedResizementSave(t,n)})},t.prototype.stopResizementListener=function(){this.removeResizement&&(this.removeResizement(),this.removeResizement=null)},t.prototype.createContainerDomElement=function(){var t,e=this;return this.props.isLinkEnabled?(t=document.createElement("a"),this.props.link&&(t.href=this.props.link)):t=document.createElement("div"),t.className="visual-console-item",t.style.zIndex=this.props.isOnTop?"2":"1",t.style.left=this.props.x+"px",t.style.top=this.props.y+"px",t.addEventListener("click",function(t){e.meta.editMode?(t.preventDefault(),t.stopPropagation()):e.clickEventManager.emit({data:e.props,nativeEvent:t})}),this.meta.editMode&&(t.classList.add("is-editing"),this.initMovementListener(t),this.initResizementListener(t)),this.meta.isFetching&&t.classList.add("is-fetching"),this.meta.isUpdating&&t.classList.add("is-updating"),t},t.prototype.createLabelDomElement=function(){var t=document.createElement("div");t.className="visual-console-item-label";var e=this.getLabelWithMacrosReplaced();if(e.length>0){var n=document.createElement("table"),i=document.createElement("tr"),r=document.createElement("tr"),s=document.createElement("tr"),o=document.createElement("td");switch(o.innerHTML=e,i.append(o),n.append(r,i,s),n.style.textAlign="center",this.props.labelPosition){case"up":case"down":this.props.width>0&&(n.style.width=this.props.width+"px",n.style.height=null);break;case"left":case"right":this.props.height>0&&(n.style.width=null,n.style.height=this.props.height+"px")}t.append(n)}return t},t.prototype.getLabelWithMacrosReplaced=function(){var t=this.props;return Object(i.p)([{macro:"_date_",value:Object(i.e)(new Date)},{macro:"_time_",value:Object(i.f)(new Date)},{macro:"_agent_",value:null!=t.agentAlias?t.agentAlias:""},{macro:"_agentdescription_",value:null!=t.agentDescription?t.agentDescription:""},{macro:"_address_",value:null!=t.agentAddress?t.agentAddress:""},{macro:"_module_",value:null!=t.moduleName?t.moduleName:""},{macro:"_moduledescription_",value:null!=t.moduleDescription?t.moduleDescription:""}],this.props.label||"")},t.prototype.updateDomElement=function(t){t.innerHTML=this.createDomElement().innerHTML},Object.defineProperty(t.prototype,"props",{get:function(){return s({},this.itemProps)},set:function(t){var e=this.props;this.itemProps=t,this.shouldBeUpdated(e,t)&&this.render(e,this._metadata)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"meta",{get:function(){return s({},this._metadata)},set:function(t){this.setMeta(t)},enumerable:!0,configurable:!0}),t.prototype.setMeta=function(t){var e=this._metadata;this._metadata=t,this.render(this.itemProps,e)},t.prototype.shouldBeUpdated=function(t,e){return t!==e},t.prototype.render=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.updateDomElement(this.childElementRef),t&&!this.positionChanged(t,this.props)||this.moveElement(this.props.x,this.props.y),t&&!this.sizeChanged(t,this.props)||this.resizeElement(this.props.width,this.props.height);var n=this.labelElementRef.innerHTML,i=this.createLabelDomElement().innerHTML;if(n!==i&&(this.labelElementRef.innerHTML=i),t&&t.labelPosition===this.props.labelPosition||this.changeLabelPosition(this.props.labelPosition),t&&(t.isLinkEnabled!==this.props.isLinkEnabled||this.props.isLinkEnabled&&t.link!==this.props.link)){var r=this.createContainerDomElement();r.innerHTML=this.elementRef.innerHTML;for(var s=this.elementRef.attributes,o=0;o<s.length;o++)"id"!==s[o].nodeName&&r.setAttributeNode(s[o]);null!==this.elementRef.parentNode&&this.elementRef.parentNode.replaceChild(r,this.elementRef),this.elementRef=r}e&&e.editMode===this.meta.editMode||(this.meta.editMode?(this.elementRef.classList.add("is-editing"),this.initMovementListener(this.elementRef),this.initResizementListener(this.elementRef)):(this.elementRef.classList.remove("is-editing"),this.stopMovementListener(),this.stopResizementListener())),e&&e.isFetching===this.meta.isFetching||(this.meta.isFetching?this.elementRef.classList.add("is-fetching"):this.elementRef.classList.remove("is-fetching")),e&&e.isUpdating===this.meta.isUpdating||(this.meta.isUpdating?this.elementRef.classList.add("is-updating"):this.elementRef.classList.remove("is-updating"))},t.prototype.remove=function(){this.removeEventManager.emit({data:this.props}),this.disposables.forEach(function(t){try{t.dispose()}catch(t){}}),this.elementRef.remove()},t.prototype.positionChanged=function(t,e){return t.x!==e.x||t.y!==e.y},t.prototype.changeLabelPosition=function(t){switch(t){case"up":this.elementRef.style.flexDirection="column-reverse";break;case"left":this.elementRef.style.flexDirection="row-reverse";break;case"right":this.elementRef.style.flexDirection="row";break;case"down":default:this.elementRef.style.flexDirection="column"}var e=this.labelElementRef.getElementsByTagName("table"),n=e.length>0?e.item(0):null;if(n)switch(this.props.labelPosition){case"up":case"down":this.props.width>0&&(n.style.width=this.props.width+"px",n.style.height=null);break;case"left":case"right":this.props.height>0&&(n.style.width=null,n.style.height=this.props.height+"px")}},t.prototype.moveElement=function(t,e){this.elementRef.style.left=t+"px",this.elementRef.style.top=e+"px"},t.prototype.move=function(t,e){this.moveElement(t,e),this.itemProps=s({},this.props,{x:t,y:e})},t.prototype.sizeChanged=function(t,e){return t.width!==e.width||t.height!==e.height},t.prototype.resizeElement=function(t,e){if(this.childElementRef.style.width=t>0?t+"px":null,this.childElementRef.style.height=e>0?e+"px":null,this.props.label&&this.props.label.length>0){var n=this.labelElementRef.getElementsByTagName("table"),i=n.length>0?n.item(0):null;if(i)switch(this.props.labelPosition){case"up":case"down":i.style.width=t>0?t+"px":null;break;case"left":case"right":i.style.height=e>0?e+"px":null}}},t.prototype.resize=function(t,e){this.resizeElement(t,e),this.itemProps=s({},this.props,{width:t,height:e})},t.prototype.onClick=function(t){var e=this.clickEventManager.on(t);return this.disposables.push(e),e},t.prototype.onMoved=function(t){var e=this.movedEventManager.on(t);return this.disposables.push(e),e},t.prototype.onResized=function(t){var e=this.resizedEventManager.on(t);return this.disposables.push(e),e},t.prototype.onRemove=function(t){var e=this.removeEventManager.on(t);return this.disposables.push(e),e},t}();e.a=c},function(t,e,n){"use strict";var i=function(){return function(){var t=this;this.listeners=[],this.listenersOncer=[],this.on=function(e){return t.listeners.push(e),{dispose:function(){return t.off(e)}}},this.once=function(e){t.listenersOncer.push(e)},this.off=function(e){var n=t.listeners.indexOf(e);n>-1&&t.listeners.splice(n,1)},this.emit=function(e){t.listeners.forEach(function(t){return t(e)}),t.listenersOncer.forEach(function(t){return t(e)}),t.listenersOncer=[]},this.pipe=function(e){return t.on(function(t){return e.emit(t)})}}}();e.a=i},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"b",function(){return eventsHistoryPropsDecoder});var _lib__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_Item__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1),__extends=(extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),extendStatics,__assign=function(){return(__assign=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function eventsHistoryPropsDecoder(t){if(Object(_lib__WEBPACK_IMPORTED_MODULE_0__.r)(t.html)&&Object(_lib__WEBPACK_IMPORTED_MODULE_0__.r)(t.encodedHtml))throw new TypeError("missing html content.");return __assign({},Object(_Item__WEBPACK_IMPORTED_MODULE_1__.b)(t),{type:14,maxTime:Object(_lib__WEBPACK_IMPORTED_MODULE_0__.m)(t.maxTime,null),html:Object(_lib__WEBPACK_IMPORTED_MODULE_0__.r)(t.html)?Object(_lib__WEBPACK_IMPORTED_MODULE_0__.d)(t.encodedHtml):t.html},Object(_lib__WEBPACK_IMPORTED_MODULE_0__.i)(t))}var EventsHistory=function(_super){function EventsHistory(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(EventsHistory,_super),EventsHistory.prototype.createDomElement=function(){var element=document.createElement("div");element.className="events-history",element.innerHTML=this.props.html;for(var scripts=element.getElementsByTagName("script"),_loop_1=function(i){0===scripts[i].src.length&&setTimeout(function(){try{eval(scripts[i].innerHTML.trim())}catch(t){}},0)},i=0;i<scripts.length;i++)_loop_1(i);return element},EventsHistory.prototype.updateDomElement=function(element){element.innerHTML=this.props.html;var aux=document.createElement("div");aux.innerHTML=this.props.html;for(var scripts=aux.getElementsByTagName("script"),i=0;i<scripts.length;i++)0===scripts[i].src.length&&eval(scripts[i].innerHTML.trim())},EventsHistory}(_Item__WEBPACK_IMPORTED_MODULE_1__.a);__webpack_exports__.a=EventsHistory},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"b",function(){return donutGraphPropsDecoder});var _lib__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_Item__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1),__extends=(extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),extendStatics,__assign=function(){return(__assign=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function donutGraphPropsDecoder(t){if(Object(_lib__WEBPACK_IMPORTED_MODULE_0__.r)(t.html)&&Object(_lib__WEBPACK_IMPORTED_MODULE_0__.r)(t.encodedHtml))throw new TypeError("missing html content.");return __assign({},Object(_Item__WEBPACK_IMPORTED_MODULE_1__.b)(t),{type:17,html:Object(_lib__WEBPACK_IMPORTED_MODULE_0__.r)(t.html)?Object(_lib__WEBPACK_IMPORTED_MODULE_0__.d)(t.encodedHtml):t.html},Object(_lib__WEBPACK_IMPORTED_MODULE_0__.i)(t),Object(_lib__WEBPACK_IMPORTED_MODULE_0__.h)(t))}var DonutGraph=function(_super){function DonutGraph(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(DonutGraph,_super),DonutGraph.prototype.createDomElement=function(){var element=document.createElement("div");element.className="donut-graph",element.innerHTML=this.props.html;for(var scripts=element.getElementsByTagName("script"),_loop_1=function(i){setTimeout(function(){0===scripts[i].src.length&&eval(scripts[i].innerHTML.trim())},0)},i=0;i<scripts.length;i++)_loop_1(i);return element},DonutGraph.prototype.updateDomElement=function(element){element.innerHTML=this.props.html;var aux=document.createElement("div");aux.innerHTML=this.props.html;for(var scripts=aux.getElementsByTagName("script"),i=0;i<scripts.length;i++)0===scripts[i].src.length&&eval(scripts[i].innerHTML.trim())},DonutGraph}(_Item__WEBPACK_IMPORTED_MODULE_1__.a);__webpack_exports__.a=DonutGraph},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",function(){return barsGraphPropsDecoder});var _lib__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_Item__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1),__extends=(extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),extendStatics,__assign=function(){return(__assign=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function barsGraphPropsDecoder(t){if(Object(_lib__WEBPACK_IMPORTED_MODULE_0__.r)(t.html)&&Object(_lib__WEBPACK_IMPORTED_MODULE_0__.r)(t.encodedHtml))throw new TypeError("missing html content.");return __assign({},Object(_Item__WEBPACK_IMPORTED_MODULE_1__.b)(t),{type:18,html:Object(_lib__WEBPACK_IMPORTED_MODULE_0__.r)(t.html)?Object(_lib__WEBPACK_IMPORTED_MODULE_0__.d)(t.encodedHtml):t.html},Object(_lib__WEBPACK_IMPORTED_MODULE_0__.i)(t))}var BarsGraph=function(_super){function BarsGraph(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(BarsGraph,_super),BarsGraph.prototype.createDomElement=function(){var element=document.createElement("div");element.className="bars-graph",element.innerHTML=this.props.html;for(var scripts=element.getElementsByTagName("script"),_loop_1=function(i){setTimeout(function(){0===scripts[i].src.length&&eval(scripts[i].innerHTML.trim())},0)},i=0;i<scripts.length;i++)_loop_1(i);return element},BarsGraph.prototype.updateDomElement=function(element){element.innerHTML=this.props.html;var aux=document.createElement("div");aux.innerHTML=this.props.html;for(var scripts=aux.getElementsByTagName("script"),i=0;i<scripts.length;i++)0===scripts[i].src.length&&eval(scripts[i].innerHTML.trim())},BarsGraph}(_Item__WEBPACK_IMPORTED_MODULE_1__.a);__webpack_exports__.b=BarsGraph},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"b",function(){return moduleGraphPropsDecoder});var _lib__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_Item__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1),__extends=(extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),extendStatics,__assign=function(){return(__assign=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function moduleGraphPropsDecoder(t){if(Object(_lib__WEBPACK_IMPORTED_MODULE_0__.r)(t.html)&&Object(_lib__WEBPACK_IMPORTED_MODULE_0__.r)(t.encodedHtml))throw new TypeError("missing html content.");return __assign({},Object(_Item__WEBPACK_IMPORTED_MODULE_1__.b)(t),{type:1,html:Object(_lib__WEBPACK_IMPORTED_MODULE_0__.r)(t.html)?Object(_lib__WEBPACK_IMPORTED_MODULE_0__.d)(t.encodedHtml):t.html},Object(_lib__WEBPACK_IMPORTED_MODULE_0__.i)(t),Object(_lib__WEBPACK_IMPORTED_MODULE_0__.h)(t))}var ModuleGraph=function(_super){function ModuleGraph(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(ModuleGraph,_super),ModuleGraph.prototype.resizeElement=function(t){_super.prototype.resizeElement.call(this,t,0)},ModuleGraph.prototype.initResizementListener=function(){},ModuleGraph.prototype.createDomElement=function(){var element=document.createElement("div");element.className="module-graph",element.innerHTML=this.props.html;for(var legendP=element.getElementsByTagName("p"),i=0;i<legendP.length;i++)legendP[i].style.margin="0px";for(var overviewGraphs=element.getElementsByClassName("overview_graph"),i=0;i<overviewGraphs.length;i++)overviewGraphs[i].remove();for(var scripts=element.getElementsByTagName("script"),_loop_1=function(i){0===scripts[i].src.length&&setTimeout(function(){try{eval(scripts[i].innerHTML.trim())}catch(t){}},0)},i=0;i<scripts.length;i++)_loop_1(i);return element},ModuleGraph.prototype.updateDomElement=function(element){element.innerHTML=this.props.html;for(var legendP=element.getElementsByTagName("p"),i=0;i<legendP.length;i++)legendP[i].style.margin="0px";for(var overviewGraphs=element.getElementsByClassName("overview_graph"),i=0;i<overviewGraphs.length;i++)overviewGraphs[i].remove();for(var scripts=element.getElementsByTagName("script"),i=0;i<scripts.length;i++)0===scripts[i].src.length&&eval(scripts[i].innerHTML.trim())},ModuleGraph}(_Item__WEBPACK_IMPORTED_MODULE_1__.a);__webpack_exports__.a=ModuleGraph},function(t,e,n){},function(t,e,n){},function(t,e,n){"use strict";n.r(e);n(7);var i,r=n(0),s=n(1),o=(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=function(){return(a=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},c=function(t){switch(t){case"default":case"enabled":case"disabled":return t;default:return"default"}};function l(t){if("string"!=typeof t.imageSrc||0===t.imageSrc.length)throw new TypeError("invalid image src.");return a({},Object(s.b)(t),{type:0,imageSrc:t.imageSrc,showLastValueTooltip:c(t.showLastValueTooltip),statusImageSrc:Object(r.j)(t.statusImageSrc,null),lastValue:Object(r.j)(t.lastValue,null)},Object(r.i)(t),Object(r.h)(t))}var u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.createDomElement=function(){var t=this.props.statusImageSrc||this.props.imageSrc,e=document.createElement("div");return e.className="static-graph",e.style.background="url("+t+") no-repeat",e.style.backgroundSize="contain",e.style.backgroundPosition="center",null!==this.props.lastValue&&"disabled"!==this.props.showLastValueTooltip&&(e.className="static-graph image forced_title",e.setAttribute("data-use_title_for_force_title","1"),e.setAttribute("data-title",this.props.lastValue)),e},e}(s.a),h=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),p=function(){return(p=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function _(t){if("string"!=typeof t.imageSrc||0===t.imageSrc.length)throw new TypeError("invalid image src.");return p({},Object(s.b)(t),{type:5,imageSrc:t.imageSrc},Object(r.h)(t))}var f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return h(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");return t.className="icon",t.style.background="url("+this.props.imageSrc+") no-repeat",t.style.backgroundSize="contain",t.style.backgroundPosition="center",t},e}(s.a),d=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),m=function(){return(m=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function y(t){if("string"!=typeof t.color||0===t.color.length)throw new TypeError("invalid color.");return m({},Object(s.b)(t),{type:20,color:t.color},Object(r.i)(t),Object(r.h)(t))}var b="http://www.w3.org/2000/svg",v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return d(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");return t.className="color-cloud",t.append(this.createSvgElement()),t},e.prototype.resizeElement=function(e){t.prototype.resizeElement.call(this,e,e)},e.prototype.createSvgElement=function(){var t="grad_"+this.props.id,e=document.createElementNS(b,"svg");e.setAttribute("viewBox","0 0 100 100");var n=document.createElementNS(b,"defs"),i=document.createElementNS(b,"radialGradient");i.setAttribute("id",t),i.setAttribute("cx","50%"),i.setAttribute("cy","50%"),i.setAttribute("r","50%"),i.setAttribute("fx","50%"),i.setAttribute("fy","50%");var r=document.createElementNS(b,"stop");r.setAttribute("offset","0%"),r.setAttribute("style","stop-color:"+this.props.color+";stop-opacity:0.9");var s=document.createElementNS(b,"stop");s.setAttribute("offset","100%"),s.setAttribute("style","stop-color:"+this.props.color+";stop-opacity:0");var o=document.createElementNS(b,"circle");return o.setAttribute("fill","url(#"+t+")"),o.setAttribute("cx","50%"),o.setAttribute("cy","50%"),o.setAttribute("r","50%"),i.append(r,s),n.append(i),e.append(n,o),e},e}(s.a),g=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),x=function(){return(x=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function E(t){if(("string"!=typeof t.imageSrc||0===t.imageSrc.length)&&null===t.encodedHtml)throw new TypeError("invalid image src.");if(null===Object(r.m)(t.groupId,null))throw new TypeError("invalid group Id.");var e=Object(r.k)(t.showStatistics),n=e?function(t){return Object(r.r)(t.html)?Object(r.r)(t.encodedHtml)?null:Object(r.d)(t.encodedHtml):t.html}(t):null;return x({},Object(s.b)(t),{type:11,groupId:parseInt(t.groupId),imageSrc:Object(r.j)(t.imageSrc,null),statusImageSrc:Object(r.j)(t.statusImageSrc,null),showStatistics:e,html:n},Object(r.h)(t))}var w=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return g(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");return t.className="group",this.props.showStatistics||null===this.props.statusImageSrc?this.props.showStatistics&&null!=this.props.html&&(t.innerHTML=this.props.html):(t.style.background="url("+this.props.statusImageSrc+") no-repeat",t.style.backgroundSize="contain",t.style.backgroundPosition="center"),t},e}(s.a),O=(n(8),function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}()),T=function(){return(T=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},A=function(t){switch(t){case"analogic":case"digital":return t;default:return"analogic"}},k=function(t){switch(t){case"datetime":case"time":return t;default:return"datetime"}};function M(t){if("string"!=typeof t.clockTimezone||0===t.clockTimezone.length)throw new TypeError("invalid timezone.");return T({},Object(s.b)(t),{type:19,clockType:A(t.clockType),clockFormat:k(t.clockFormat),clockTimezone:t.clockTimezone,clockTimezoneOffset:Object(r.m)(t.clockTimezoneOffset,0),showClockTimezone:Object(r.k)(t.showClockTimezone),color:Object(r.j)(t.color,null)},Object(r.h)(t))}var j=function(t){function e(n,i){var r=t.call(this,n,i)||this;return r.intervalRef=null,r.startTick(function(){r.childElementRef.innerHTML=r.createClock().innerHTML},"analogic"===r.props.clockType?2e4:e.TICK_INTERVAL),r}return O(e,t),e.prototype.stopTick=function(){null!==this.intervalRef&&(window.clearInterval(this.intervalRef),this.intervalRef=null)},e.prototype.startTick=function(t,n){void 0===n&&(n=e.TICK_INTERVAL),this.stopTick(),this.intervalRef=window.setInterval(t,n)},e.prototype.createDomElement=function(){return this.createClock()},e.prototype.remove=function(){this.stopTick(),t.prototype.remove.call(this)},e.prototype.resizeElement=function(e,n){var i=this.getElementSize(e,n),r=i.width,s=i.height;t.prototype.resizeElement.call(this,r,s),"digital"===this.props.clockType&&(this.childElementRef.innerHTML=this.createClock().innerHTML)},e.prototype.createClock=function(){switch(this.props.clockType){case"analogic":return this.createAnalogicClock();case"digital":return this.createDigitalClock();default:throw new Error("invalid clock type.")}},e.prototype.createAnalogicClock=function(){var t="http://www.w3.org/2000/svg",e="#FFFFF0",n="#242124",i="#242124",s="#242124",o="#525252",a="#DC143C",c=this.getElementSize(),l=c.width,u=c.height,h=10*l/100,p=document.createElement("div");p.className="analogic-clock",p.style.width=l+"px",p.style.height=u+"px";var _=document.createElementNS(t,"svg");_.setAttribute("viewBox","0 0 100 100");var f=document.createElementNS(t,"g");f.setAttribute("class","clockface");var d=document.createElementNS(t,"circle");d.setAttribute("cx","50"),d.setAttribute("cy","50"),d.setAttribute("r","48"),d.setAttribute("fill",e),d.setAttribute("stroke",n),d.setAttribute("stroke-width","2"),d.setAttribute("stroke-linecap","round"),f.append(d);var m=this.getHumanTimezone();if(m.length>0){var y=document.createElementNS(t,"text");y.setAttribute("text-anchor","middle"),y.setAttribute("font-size","8"),y.setAttribute("transform","translate(30 50) rotate(90)"),y.setAttribute("fill",i),y.textContent=m,f.append(y)}var b=document.createElementNS(t,"g");b.setAttribute("class","marks");var v=document.createElementNS(t,"g");v.setAttribute("class","mark"),v.setAttribute("transform","translate(50 50)");var g=document.createElementNS(t,"line");g.setAttribute("x1","36"),g.setAttribute("y1","0"),g.setAttribute("x2","46"),g.setAttribute("y2","0"),g.setAttribute("stroke",i),g.setAttribute("stroke-width","5");var x=document.createElementNS(t,"line");x.setAttribute("x1","36"),x.setAttribute("y1","0"),x.setAttribute("x2","46"),x.setAttribute("y2","0"),x.setAttribute("stroke",e),x.setAttribute("stroke-width","1"),v.append(g,x),b.append(v);for(var E=1;E<60;E++){var w=document.createElementNS(t,"line");w.setAttribute("y1","0"),w.setAttribute("y2","0"),w.setAttribute("stroke",i),w.setAttribute("transform","translate(50 50) rotate("+6*E+")"),E%5==0?(w.setAttribute("x1","38"),w.setAttribute("x2","46"),w.setAttribute("stroke-width",E%15==0?"2":"1")):(w.setAttribute("x1","42"),w.setAttribute("x2","46"),w.setAttribute("stroke-width","0.5")),b.append(w)}var O=document.createElementNS(t,"g");O.setAttribute("class","hour-hand"),O.setAttribute("transform","translate(50 50)");var T=document.createElementNS(t,"line");T.setAttribute("class","hour-hand-a"),T.setAttribute("x1","0"),T.setAttribute("y1","0"),T.setAttribute("x2","30"),T.setAttribute("y2","0"),T.setAttribute("stroke",o),T.setAttribute("stroke-width","4"),T.setAttribute("stroke-linecap","round");var A=document.createElementNS(t,"line");A.setAttribute("class","hour-hand-b"),A.setAttribute("x1","0"),A.setAttribute("y1","0"),A.setAttribute("x2","29.9"),A.setAttribute("y2","0"),A.setAttribute("stroke",s),A.setAttribute("stroke-width","3.1"),A.setAttribute("stroke-linecap","round"),O.append(T,A);var k=document.createElementNS(t,"g");k.setAttribute("class","minute-hand"),k.setAttribute("transform","translate(50 50)");var M=document.createElementNS(t,"line");M.setAttribute("class","minute-hand-a"),M.setAttribute("x1","0"),M.setAttribute("y1","0"),M.setAttribute("x2","40"),M.setAttribute("y2","0"),M.setAttribute("stroke",o),M.setAttribute("stroke-width","2"),M.setAttribute("stroke-linecap","round");var j=document.createElementNS(t,"line");j.setAttribute("class","minute-hand-b"),j.setAttribute("x1","0"),j.setAttribute("y1","0"),j.setAttribute("x2","39.9"),j.setAttribute("y2","0"),j.setAttribute("stroke",s),j.setAttribute("stroke-width","1.5"),j.setAttribute("stroke-linecap","round");var P=document.createElementNS(t,"circle");P.setAttribute("r","3"),P.setAttribute("fill",s),k.append(M,j,P);var S=document.createElementNS(t,"g");S.setAttribute("class","second-hand"),S.setAttribute("transform","translate(50 50)");var L=document.createElementNS(t,"line");L.setAttribute("x1","0"),L.setAttribute("y1","0"),L.setAttribute("x2","46"),L.setAttribute("y2","0"),L.setAttribute("stroke",a),L.setAttribute("stroke-width","1"),L.setAttribute("stroke-linecap","round");var R=document.createElementNS(t,"circle");R.setAttribute("r","2"),R.setAttribute("fill",a),S.append(L,R);var N=document.createElementNS(t,"circle");N.setAttribute("cx","50"),N.setAttribute("cy","50"),N.setAttribute("r","0.3"),N.setAttribute("fill",s);var I=this.getOriginDate(),D=I.getSeconds(),C=I.getMinutes(),z=6*D,B=6*C+D/60*6,W=30*I.getHours()+C/60*30;if(O.setAttribute("transform","translate(50 50) rotate("+W+")"),k.setAttribute("transform","translate(50 50) rotate("+B+")"),S.setAttribute("transform","translate(50 50) rotate("+z+")"),_.append(f,b,O,k,S,N),_.setAttribute("transform","rotate(-90)"),p.innerHTML="\n      <style>\n        @keyframes rotate-hour {\n          from {\n            "+Object(r.o)("transform","translate(50px, 50px) rotate("+W+"deg)").join("\n")+"\n          }\n          to {\n            "+Object(r.o)("transform","translate(50px, 50px) rotate("+(W+360)+"deg)").join("\n")+"\n          }\n        }\n        @keyframes rotate-minute {\n          from {\n            "+Object(r.o)("transform","translate(50px, 50px) rotate("+B+"deg)").join("\n")+"\n          }\n          to {\n            "+Object(r.o)("transform","translate(50px, 50px) rotate("+(B+360)+"deg)").join("\n")+"\n          }\n        }\n        @keyframes rotate-second {\n          from {\n            "+Object(r.o)("transform","translate(50px, 50px) rotate("+z+"deg)").join("\n")+"\n          }\n          to {\n            "+Object(r.o)("transform","translate(50px, 50px) rotate("+(z+360)+"deg)").join("\n")+"\n          }\n        }\n      </style>\n    ",p.append(_),"datetime"===this.props.clockFormat){var H=document.createElement("span");H.className="date",H.textContent=Object(r.e)(I,"default"),H.style.fontSize=h+"px",this.props.color&&(H.style.color=this.props.color),p.append(H)}return p},e.prototype.createDigitalClock=function(){var t=document.createElement("div");t.className="digital-clock";var e=this.getElementSize().width,n=6/this.props.clockTimezone.length,i=20*e/100,s=10*e/100,o=Math.min(20*n*e/100,e/100*10),a=this.getOriginDate();if("datetime"===this.props.clockFormat){var c=document.createElement("span");c.className="date",c.textContent=Object(r.e)(a,"default"),c.style.fontSize=s+"px",this.props.color&&(c.style.color=this.props.color),t.append(c)}var l=document.createElement("span");l.className="time",l.textContent=Object(r.f)(a),l.style.fontSize=i+"px",this.props.color&&(l.style.color=this.props.color),t.append(l);var u=this.getHumanTimezone();if(u.length>0){var h=document.createElement("span");h.className="timezone",h.textContent=u,h.style.fontSize=o+"px",this.props.color&&(h.style.color=this.props.color),t.append(h)}return t},e.prototype.getOriginDate=function(t){void 0===t&&(t=null);var e=t||new Date,n=1e3*this.props.clockTimezoneOffset,i=60*e.getTimezoneOffset()*1e3,r=e.getTime()+n+i;return new Date(r)},e.prototype.getHumanTimezone=function(t){void 0===t&&(t=this.props.clockTimezone);var e=t.split("/")[1];return(void 0===e?"":e).replace("_"," ")},e.prototype.getElementSize=function(t,e){switch(void 0===t&&(t=this.props.width),void 0===e&&(e=this.props.height),this.props.clockType){case"analogic":var n=100;return t>0&&e>0?n=Math.min(t,e):t>0?n=t:e>0&&(n=e),{width:n,height:n};case"digital":return t>0&&e>0?e=t/2<e?t/2:e:t>0?e=t/2:e>0?t=2*e:(t=100,e=50),{width:t,height:e};default:throw new Error("invalid clock type.")}},e.TICK_INTERVAL=1e3,e}(s.a),P=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),S=function(){return(S=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function L(t){return S({},Object(s.b)(t),{type:12,label:null,isLinkEnabled:!1,parentId:null,aclGroupId:null,borderWidth:Object(r.m)(t.borderWidth,0),borderColor:Object(r.j)(t.borderColor,null),fillColor:Object(r.j)(t.fillColor,null)})}var R=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return P(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");if(t.className="box",t.style.boxSizing="border-box",this.props.fillColor&&(t.style.backgroundColor=this.props.fillColor),this.props.borderWidth>0){t.style.borderStyle="solid";var e=Math.min(this.props.width,this.props.height)/2,n=Math.min(this.props.borderWidth,e);t.style.borderWidth=n+"px",this.props.borderColor&&(t.style.borderColor=this.props.borderColor)}return t},e}(s.a),N=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),I=function(){return(I=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function D(t){var e=I({},Object(s.b)(I({},t,{width:1,height:1})),{type:13,label:null,isLinkEnabled:!1,parentId:null,aclGroupId:null,x:0,y:0,width:0,height:0,startPosition:{x:Object(r.m)(t.startX,0),y:Object(r.m)(t.startY,0)},endPosition:{x:Object(r.m)(t.endX,0),y:Object(r.m)(t.endY,0)},lineWidth:Object(r.m)(t.lineWidth||t.borderWidth,1),color:Object(r.j)(t.borderColor||t.color,null)});return I({},e,C.extractBoxSizeAndPosition(e))}var C=function(t){function e(n,i){return t.call(this,I({},n,e.extractBoxSizeAndPosition(n)),I({},i,{editMode:!1}))||this}return N(e,t),e.prototype.setMeta=function(e){t.prototype.setMeta.call(this,I({},e,{editMode:!1}))},e.prototype.createDomElement=function(){var t=document.createElement("div");t.className="line";var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");n.setAttribute("width",(this.props.width+this.props.lineWidth).toString()),n.setAttribute("height",(this.props.height+this.props.lineWidth).toString());var i=document.createElementNS(e,"line");return i.setAttribute("x1",""+(this.props.startPosition.x-this.props.x+this.props.lineWidth/2)),i.setAttribute("y1",""+(this.props.startPosition.y-this.props.y+this.props.lineWidth/2)),i.setAttribute("x2",""+(this.props.endPosition.x-this.props.x+this.props.lineWidth/2)),i.setAttribute("y2",""+(this.props.endPosition.y-this.props.y+this.props.lineWidth/2)),i.setAttribute("stroke",this.props.color||"black"),i.setAttribute("stroke-width",this.props.lineWidth.toString()),n.append(i),t.append(n),t},e.extractBoxSizeAndPosition=function(t){return{width:Math.abs(t.startPosition.x-t.endPosition.x),height:Math.abs(t.startPosition.y-t.endPosition.y),x:Math.min(t.startPosition.x,t.endPosition.x),y:Math.min(t.startPosition.y,t.endPosition.y)}},e}(s.a),z=C,B=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),W=function(){return(W=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function H(t){return W({},Object(s.b)(t),{type:4},Object(r.h)(t))}var U=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return B(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");return t.className="label",t.innerHTML=this.getLabelWithMacrosReplaced(),t},e.prototype.createLabelDomElement=function(){var t=document.createElement("div");return t.className="visual-console-item-label",t},e}(s.a),K=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),G=function(){return(G=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},q=function(t){switch(t){case"string":case"image":return t;default:return"string"}},F=function(t){switch(t){case"none":case"avg":case"max":case"min":return t;default:return"none"}};function V(t){if("string"!=typeof t.value||0===t.value.length)throw new TypeError("invalid value");var e=F(t.processValue);return G({},Object(s.b)(t),{type:2,valueType:q(t.valueType),value:t.value},"none"===e?{processValue:e}:{processValue:e,period:Object(r.m)(t.period,0)},Object(r.i)(t),Object(r.h)(t))}var X=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return K(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");if(t.className="simple-value","image"===this.props.valueType){var e=document.createElement("img");e.src=this.props.value,t.append(e)}else{var n=this.props.value,i=this.getLabelWithMacrosReplaced();i.length>0&&(n=Object(r.p)([{macro:/\(?_VALUE_\)?/i,value:n}],i)),t.innerHTML=n}return t},e.prototype.createLabelDomElement=function(){var t=document.createElement("div");return t.className="visual-console-item-label",t},e}(s.a),Y=n(3),Z=Math.PI,Q=2*Z,J=Q-1e-6;function $(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function tt(){return new $}$.prototype=tt.prototype={constructor:$,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,r,s){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+s)},arcTo:function(t,e,n,i,r){t=+t,e=+e,n=+n,i=+i,r=+r;var s=this._x1,o=this._y1,a=n-t,c=i-e,l=s-t,u=o-e,h=l*l+u*u;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(h>1e-6)if(Math.abs(u*a-c*l)>1e-6&&r){var p=n-s,_=i-o,f=a*a+c*c,d=p*p+_*_,m=Math.sqrt(f),y=Math.sqrt(h),b=r*Math.tan((Z-Math.acos((f+h-d)/(2*m*y)))/2),v=b/y,g=b/m;Math.abs(v-1)>1e-6&&(this._+="L"+(t+v*l)+","+(e+v*u)),this._+="A"+r+","+r+",0,0,"+ +(u*p>l*_)+","+(this._x1=t+g*a)+","+(this._y1=e+g*c)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,i,r,s){t=+t,e=+e;var o=(n=+n)*Math.cos(i),a=n*Math.sin(i),c=t+o,l=e+a,u=1^s,h=s?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+c+","+l:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+c+","+l),n&&(h<0&&(h=h%Q+Q),h>J?this._+="A"+n+","+n+",0,1,"+u+","+(t-o)+","+(e-a)+"A"+n+","+n+",0,1,"+u+","+(this._x1=c)+","+(this._y1=l):h>1e-6&&(this._+="A"+n+","+n+",0,"+ +(h>=Z)+","+u+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};var et=tt,nt=function(t){return function(){return t}},it=Math.abs,rt=Math.atan2,st=Math.cos,ot=Math.max,at=Math.min,ct=Math.sin,lt=Math.sqrt,ut=1e-12,ht=Math.PI,pt=ht/2,_t=2*ht;function ft(t){return t>=1?pt:t<=-1?-pt:Math.asin(t)}function dt(t){return t.innerRadius}function mt(t){return t.outerRadius}function yt(t){return t.startAngle}function bt(t){return t.endAngle}function vt(t){return t&&t.padAngle}function gt(t,e,n,i,r,s,o){var a=t-n,c=e-i,l=(o?s:-s)/lt(a*a+c*c),u=l*c,h=-l*a,p=t+u,_=e+h,f=n+u,d=i+h,m=(p+f)/2,y=(_+d)/2,b=f-p,v=d-_,g=b*b+v*v,x=r-s,E=p*d-f*_,w=(v<0?-1:1)*lt(ot(0,x*x*g-E*E)),O=(E*v-b*w)/g,T=(-E*b-v*w)/g,A=(E*v+b*w)/g,k=(-E*b+v*w)/g,M=O-m,j=T-y,P=A-m,S=k-y;return M*M+j*j>P*P+S*S&&(O=A,T=k),{cx:O,cy:T,x01:-u,y01:-h,x11:O*(r/x-1),y11:T*(r/x-1)}}var xt=function(){var t=dt,e=mt,n=nt(0),i=null,r=yt,s=bt,o=vt,a=null;function c(){var c,l,u,h=+t.apply(this,arguments),p=+e.apply(this,arguments),_=r.apply(this,arguments)-pt,f=s.apply(this,arguments)-pt,d=it(f-_),m=f>_;if(a||(a=c=et()),p<h&&(l=p,p=h,h=l),p>ut)if(d>_t-ut)a.moveTo(p*st(_),p*ct(_)),a.arc(0,0,p,_,f,!m),h>ut&&(a.moveTo(h*st(f),h*ct(f)),a.arc(0,0,h,f,_,m));else{var y,b,v=_,g=f,x=_,E=f,w=d,O=d,T=o.apply(this,arguments)/2,A=T>ut&&(i?+i.apply(this,arguments):lt(h*h+p*p)),k=at(it(p-h)/2,+n.apply(this,arguments)),M=k,j=k;if(A>ut){var P=ft(A/h*ct(T)),S=ft(A/p*ct(T));(w-=2*P)>ut?(x+=P*=m?1:-1,E-=P):(w=0,x=E=(_+f)/2),(O-=2*S)>ut?(v+=S*=m?1:-1,g-=S):(O=0,v=g=(_+f)/2)}var L=p*st(v),R=p*ct(v),N=h*st(E),I=h*ct(E);if(k>ut){var D,C=p*st(g),z=p*ct(g),B=h*st(x),W=h*ct(x);if(d<ht&&(D=function(t,e,n,i,r,s,o,a){var c=n-t,l=i-e,u=o-r,h=a-s,p=h*c-u*l;if(!(p*p<ut))return[t+(p=(u*(e-s)-h*(t-r))/p)*c,e+p*l]}(L,R,B,W,C,z,N,I))){var H=L-D[0],U=R-D[1],K=C-D[0],G=z-D[1],q=1/ct(((u=(H*K+U*G)/(lt(H*H+U*U)*lt(K*K+G*G)))>1?0:u<-1?ht:Math.acos(u))/2),F=lt(D[0]*D[0]+D[1]*D[1]);M=at(k,(h-F)/(q-1)),j=at(k,(p-F)/(q+1))}}O>ut?j>ut?(y=gt(B,W,L,R,p,j,m),b=gt(C,z,N,I,p,j,m),a.moveTo(y.cx+y.x01,y.cy+y.y01),j<k?a.arc(y.cx,y.cy,j,rt(y.y01,y.x01),rt(b.y01,b.x01),!m):(a.arc(y.cx,y.cy,j,rt(y.y01,y.x01),rt(y.y11,y.x11),!m),a.arc(0,0,p,rt(y.cy+y.y11,y.cx+y.x11),rt(b.cy+b.y11,b.cx+b.x11),!m),a.arc(b.cx,b.cy,j,rt(b.y11,b.x11),rt(b.y01,b.x01),!m))):(a.moveTo(L,R),a.arc(0,0,p,v,g,!m)):a.moveTo(L,R),h>ut&&w>ut?M>ut?(y=gt(N,I,C,z,h,-M,m),b=gt(L,R,B,W,h,-M,m),a.lineTo(y.cx+y.x01,y.cy+y.y01),M<k?a.arc(y.cx,y.cy,M,rt(y.y01,y.x01),rt(b.y01,b.x01),!m):(a.arc(y.cx,y.cy,M,rt(y.y01,y.x01),rt(y.y11,y.x11),!m),a.arc(0,0,h,rt(y.cy+y.y11,y.cx+y.x11),rt(b.cy+b.y11,b.cx+b.x11),m),a.arc(b.cx,b.cy,M,rt(b.y11,b.x11),rt(b.y01,b.x01),!m))):a.arc(0,0,h,E,x,m):a.lineTo(N,I)}else a.moveTo(0,0);if(a.closePath(),c)return a=null,c+""||null}return c.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,i=(+r.apply(this,arguments)+ +s.apply(this,arguments))/2-ht/2;return[st(i)*n,ct(i)*n]},c.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:nt(+e),c):t},c.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:nt(+t),c):e},c.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:nt(+t),c):n},c.padRadius=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:nt(+t),c):i},c.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:nt(+t),c):r},c.endAngle=function(t){return arguments.length?(s="function"==typeof t?t:nt(+t),c):s},c.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:nt(+t),c):o},c.context=function(t){return arguments.length?(a=null==t?null:t,c):a},c};function Et(t){this._context=t}Et.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var wt=function(t){return new Et(t)};Tt(wt);function Ot(t){this._curve=t}function Tt(t){function e(e){return new Ot(t(e))}return e._curve=t,e}Ot.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};Array.prototype.slice;Math.sqrt(1/3);var At=Math.sin(ht/10)/Math.sin(7*ht/10),kt=(Math.sin(_t/10),Math.cos(_t/10),Math.sqrt(3),Math.sqrt(3),Math.sqrt(12),function(){});function Mt(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function jt(t){this._context=t}jt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Mt(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Mt(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Pt(t){this._context=t}Pt.prototype={areaStart:kt,areaEnd:kt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Mt(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function St(t){this._context=t}St.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,i=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,i):this._context.moveTo(n,i);break;case 3:this._point=4;default:Mt(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Lt(t,e){this._basis=new jt(t),this._beta=e}Lt.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var i,r=t[0],s=e[0],o=t[n]-r,a=e[n]-s,c=-1;++c<=n;)i=c/n,this._basis.point(this._beta*t[c]+(1-this._beta)*(r+i*o),this._beta*e[c]+(1-this._beta)*(s+i*a));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};(function t(e){function n(t){return 1===e?new jt(t):new Lt(t,e)}return n.beta=function(e){return t(+e)},n})(.85);function Rt(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Nt(t,e){this._context=t,this._k=(1-e)/6}Nt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Rt(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Rt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function n(t){return new Nt(t,e)}return n.tension=function(e){return t(+e)},n})(0);function It(t,e){this._context=t,this._k=(1-e)/6}It.prototype={areaStart:kt,areaEnd:kt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Rt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function n(t){return new It(t,e)}return n.tension=function(e){return t(+e)},n})(0);function Dt(t,e){this._context=t,this._k=(1-e)/6}Dt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Rt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function n(t){return new Dt(t,e)}return n.tension=function(e){return t(+e)},n})(0);function Ct(t,e,n){var i=t._x1,r=t._y1,s=t._x2,o=t._y2;if(t._l01_a>ut){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);i=(i*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,r=(r*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>ut){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);s=(s*l+t._x1*t._l23_2a-e*t._l12_2a)/u,o=(o*l+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(i,r,s,o,t._x2,t._y2)}function zt(t,e){this._context=t,this._alpha=e}zt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Ct(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function n(t){return e?new zt(t,e):new Nt(t,0)}return n.alpha=function(e){return t(+e)},n})(.5);function Bt(t,e){this._context=t,this._alpha=e}Bt.prototype={areaStart:kt,areaEnd:kt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Ct(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function n(t){return e?new Bt(t,e):new It(t,0)}return n.alpha=function(e){return t(+e)},n})(.5);function Wt(t,e){this._context=t,this._alpha=e}Wt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,i=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+i*i,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Ct(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function n(t){return e?new Wt(t,e):new Dt(t,0)}return n.alpha=function(e){return t(+e)},n})(.5);function Ht(t){this._context=t}Ht.prototype={areaStart:kt,areaEnd:kt,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Ut(t){return t<0?-1:1}function Kt(t,e,n){var i=t._x1-t._x0,r=e-t._x1,s=(t._y1-t._y0)/(i||r<0&&-0),o=(n-t._y1)/(r||i<0&&-0),a=(s*r+o*i)/(i+r);return(Ut(s)+Ut(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function Gt(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function qt(t,e,n){var i=t._x0,r=t._y0,s=t._x1,o=t._y1,a=(s-i)/3;t._context.bezierCurveTo(i+a,r+a*e,s-a,o-a*n,s,o)}function Ft(t){this._context=t}function Vt(t){this._context=new Xt(t)}function Xt(t){this._context=t}function Yt(t){this._context=t}function Zt(t){var e,n,i=t.length-1,r=new Array(i),s=new Array(i),o=new Array(i);for(r[0]=0,s[0]=2,o[0]=t[0]+2*t[1],e=1;e<i-1;++e)r[e]=1,s[e]=4,o[e]=4*t[e]+2*t[e+1];for(r[i-1]=2,s[i-1]=7,o[i-1]=8*t[i-1]+t[i],e=1;e<i;++e)n=r[e]/s[e-1],s[e]-=n,o[e]-=n*o[e-1];for(r[i-1]=o[i-1]/s[i-1],e=i-2;e>=0;--e)r[e]=(o[e]-r[e+1])/s[e];for(s[i-1]=(t[i]+r[i-1])/2,e=0;e<i-1;++e)s[e]=2*t[e+1]-r[e+1];return[r,s]}Ft.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:qt(this,this._t0,Gt(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,qt(this,Gt(this,n=Kt(this,t,e)),n);break;default:qt(this,this._t0,n=Kt(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(Vt.prototype=Object.create(Ft.prototype)).point=function(t,e){Ft.prototype.point.call(this,e,t)},Xt.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,i,r,s){this._context.bezierCurveTo(e,t,i,n,s,r)}},Yt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var i=Zt(t),r=Zt(e),s=0,o=1;o<n;++s,++o)this._context.bezierCurveTo(i[0][s],r[0][s],i[1][s],r[1][s],t[o],e[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function Qt(t,e){this._context=t,this._t=e}Qt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var Jt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),$t=function(){return($t=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function te(t){switch(t){case"progress-bar":case"bubble":case"circular-progress-bar":case"circular-progress-bar-alt":return t;default:case 3:return"progress-bar";case 9:return"bubble";case 15:return"circular-progress-bar";case 16:return"circular-progress-bar-alt"}}function ee(t){switch(t){case"percent":case"value":return t;default:return"percent"}}function ne(t){return $t({},Object(s.b)(t),{type:3,percentileType:te(t.percentileType||t.type),valueType:ee(t.valueType),minValue:Object(r.m)(t.minValue,null),maxValue:Object(r.m)(t.maxValue,null),color:Object(r.j)(t.color,null),labelColor:Object(r.j)(t.labelColor,null),value:Object(r.l)(t.value,null),unit:Object(r.j)(t.unit,null)},Object(r.i)(t),Object(r.h)(t))}var ie="http://www.w3.org/2000/svg",re=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Jt(e,t),e.prototype.createDomElement=function(){var t,e={background:"#000000",progress:this.props.color||"#F0F0F0",text:this.props.labelColor||"#444444"},n=this.getProgress(),i=document.createElement("div"),r=document.createElementNS(ie,"svg");switch(null!=this.props.value&&(t=Intl?Intl.NumberFormat("en-EN").format(this.props.value):this.props.value),this.props.percentileType){case"progress-bar":var s=document.createElementNS(ie,"rect");s.setAttribute("fill",e.background),s.setAttribute("fill-opacity","0.5"),s.setAttribute("width","100"),s.setAttribute("height","20"),s.setAttribute("rx","5"),s.setAttribute("ry","5");var o=document.createElementNS(ie,"rect");o.setAttribute("fill",e.progress),o.setAttribute("fill-opacity","1"),o.setAttribute("width",""+n),o.setAttribute("height","20"),o.setAttribute("rx","5"),o.setAttribute("ry","5"),(h=document.createElementNS(ie,"text")).setAttribute("text-anchor","middle"),h.setAttribute("alignment-baseline","middle"),h.setAttribute("font-size","12"),h.setAttribute("font-family","arial"),h.setAttribute("font-weight","bold"),h.setAttribute("transform","translate(50 11)"),h.setAttribute("fill",e.text),"value"===this.props.valueType?(h.style.fontSize="6pt",h.textContent=this.props.unit?t+" "+this.props.unit:""+t):h.textContent=n+"%",r.setAttribute("viewBox","0 0 100 20"),r.append(s,o,h);break;case"bubble":case"circular-progress-bar":case"circular-progress-bar-alt":if(r.setAttribute("viewBox","0 0 100 100"),"bubble"===this.props.percentileType){(a=document.createElementNS(ie,"circle")).setAttribute("transform","translate(50 50)"),a.setAttribute("fill",e.background),a.setAttribute("fill-opacity","0.5"),a.setAttribute("r","50"),(c=document.createElementNS(ie,"circle")).setAttribute("transform","translate(50 50)"),c.setAttribute("fill",e.progress),c.setAttribute("fill-opacity","1"),c.setAttribute("r",""+n/2),r.append(a,c)}else{var a,c,l={innerRadius:"circular-progress-bar"===this.props.percentileType?30:0,outerRadius:50,startAngle:0,endAngle:2*Math.PI},u=xt();(a=document.createElementNS(ie,"path")).setAttribute("transform","translate(50 50)"),a.setAttribute("fill",e.background),a.setAttribute("fill-opacity","0.5"),a.setAttribute("d",""+u(l)),(c=document.createElementNS(ie,"path")).setAttribute("transform","translate(50 50)"),c.setAttribute("fill",e.progress),c.setAttribute("fill-opacity","1"),c.setAttribute("d",""+u($t({},l,{endAngle:l.endAngle*(n/100)}))),r.append(a,c)}var h;if((h=document.createElementNS(ie,"text")).setAttribute("text-anchor","middle"),h.setAttribute("alignment-baseline","middle"),h.setAttribute("font-size","16"),h.setAttribute("font-family","arial"),h.setAttribute("font-weight","bold"),h.setAttribute("fill",e.text),"value"===this.props.valueType&&null!=this.props.value)if(this.props.unit&&this.props.unit.length>0){var p=document.createElementNS(ie,"tspan");p.setAttribute("x","0"),p.setAttribute("dy","1em"),p.textContent=""+t,p.style.fontSize="8pt";var _=document.createElementNS(ie,"tspan");_.setAttribute("x","0"),_.setAttribute("dy","1em"),_.textContent=""+this.props.unit,_.style.fontSize="8pt",h.append(p,_),h.setAttribute("transform","translate(50 33)")}else h.textContent=""+t,h.style.fontSize="8pt",h.setAttribute("transform","translate(50 50)");else h.textContent=n+"%",h.setAttribute("transform","translate(50 50)");r.append(h)}return i.append(r),i},e.prototype.getProgress=function(){var t=this.props.minValue||0,e=this.props.maxValue||100,n=null==this.props.value?0:this.props.value;return n<=t?0:n>=e?100:Math.trunc((n-t)/(e-t)*100)},e}(s.a),se=n(2),oe=n(4),ae=n(5),ce=n(6),le=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),ue=function(){return(ue=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function he(t){if(null!==t.imageSrc){if("string"!=typeof t.statusImageSrc||0===t.imageSrc.statusImageSrc)throw new TypeError("invalid status image src.")}else if(Object(r.r)(t.encodedTitle))throw new TypeError("missing encode tittle content.");if(null===Object(r.m)(t.serviceId,null))throw new TypeError("invalid service id.");return ue({},Object(s.b)(t),{type:10,serviceId:t.serviceId,imageSrc:Object(r.j)(t.imageSrc,null),statusImageSrc:Object(r.j)(t.statusImageSrc,null),encodedTitle:Object(r.j)(t.encodedTitle,null)})}var pe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return le(e,t),e.prototype.createDomElement=function(){var t=document.createElement("div");return t.className="service",null!==this.props.statusImageSrc?(t.style.background="url("+this.props.statusImageSrc+") no-repeat",t.style.backgroundSize="contain",t.style.backgroundPosition="center"):null!==this.props.encodedTitle&&(t.innerHTML=Object(r.d)(this.props.encodedTitle)),t},e}(s.a),_e=function(){return(_e=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function fe(t){var e=Object(r.m)(t.type,null);if(null==e)throw new TypeError("missing item type.");var n=Object(r.g)(t);switch(e){case 0:return new u(l(t),n);case 1:return new ce.a(Object(ce.b)(t),n);case 2:case 6:case 7:case 8:return new X(V(t),n);case 3:case 9:case 15:case 16:return new re(ne(t),n);case 4:return new U(H(t),n);case 5:return new f(_(t),n);case 10:return new pe(he(t),n);case 11:return new w(E(t),n);case 12:return new R(L(t),n);case 13:return new z(D(t),n);case 14:return new Y.a(Object(Y.b)(t),n);case 17:return new oe.a(Object(oe.b)(t),n);case 18:return new ae.b(Object(ae.a)(t),n);case 19:return new j(M(t),n);case 20:return new v(y(t),n);default:throw new TypeError("item not found")}}var de=function(){function t(t,e,n){var i=this;this.elementsById={},this.elementIds=[],this.relations={},this.clickEventManager=new se.a,this.movedEventManager=new se.a,this.resizedEventManager=new se.a,this.disposables=[],this.handleElementClick=function(t){i.clickEventManager.emit(t)},this.handleElementMovement=function(t){i.movedEventManager.emit(t)},this.handleElementResizement=function(t){i.resizedEventManager.emit(t)},this.handleElementRemove=function(t){i.elementIds=i.elementIds.filter(function(e){return e!==t.data.id}),delete i.elementsById[t.data.id],i.clearRelations(t.data.id)},this.containerRef=t,this._props=function(t){var e=t.id,n=t.name,i=t.groupId,s=t.backgroundURL,o=t.backgroundColor,a=t.isFavorite,c=t.relationLineWidth;if(null==e||isNaN(parseInt(e)))throw new TypeError("invalid Id.");if("string"!=typeof n||0===n.length)throw new TypeError("invalid name.");if(null==i||isNaN(parseInt(i)))throw new TypeError("invalid group Id.");return _e({id:parseInt(e),name:n,groupId:parseInt(i),backgroundURL:Object(r.j)(s,null),backgroundColor:Object(r.j)(o,null),isFavorite:Object(r.k)(a),relationLineWidth:Object(r.m)(c,0)},Object(r.q)(t))}(e),this.render(),(n=n.sort(function(t,e){return null==t.isOnTop||null==e.isOnTop||null==t.id||null==e.id?0:t.isOnTop&&!e.isOnTop?1:!t.isOnTop&&e.isOnTop?-1:t.id>e.id?1:-1})).forEach(function(t){try{var e=fe(t);i.elementsById[e.props.id]=e,i.elementIds.push(e.props.id),e.onClick(i.handleElementClick),e.onMoved(i.handleElementMovement),e.onResized(i.handleElementResizement),e.onRemove(i.handleElementRemove),i.containerRef.append(e.elementRef)}catch(t){console.log("Error creating a new element:",t.message)}}),this.buildRelations()}return Object.defineProperty(t.prototype,"elements",{get:function(){var t=this;return this.elementIds.map(function(e){return t.elementsById[e]}).filter(function(t){return null!=t})},enumerable:!0,configurable:!0}),t.prototype.updateElements=function(t){var e=this,n=t.map(function(t){return t.id||null}).filter(function(t){return null!=t});this.elementIds.filter(function(t){return n.indexOf(t)<0}).forEach(function(t){null!=e.elementsById[t]&&(e.elementsById[t].remove(),delete e.elementsById[t])}),this.elementIds=n,t.forEach(function(t){if(t.id)if(null==e.elementsById[t.id])try{var n=fe(t);e.elementsById[n.props.id]=n,n.onClick(e.handleElementClick),n.onRemove(e.handleElementRemove),e.containerRef.append(n.elementRef)}catch(t){console.log("Error creating a new element:",t.message)}else try{e.elementsById[t.id].props=function(t){var e=Object(r.m)(t.type,null);if(null==e)throw new TypeError("missing item type.");switch(e){case 0:return l(t);case 1:return Object(ce.b)(t);case 2:case 6:case 7:case 8:return V(t);case 3:case 9:case 15:case 16:return ne(t);case 4:return H(t);case 5:return _(t);case 10:return he(t);case 11:return E(t);case 12:return L(t);case 13:return D(t);case 14:return Object(Y.b)(t);case 17:return Object(oe.b)(t);case 18:return Object(ae.a)(t);case 19:return M(t);case 20:return y(t);default:throw new TypeError("decoder not found")}}(t)}catch(t){console.log("Error updating an element:",t.message)}}),this.buildRelations()},Object.defineProperty(t.prototype,"props",{get:function(){return _e({},this._props)},set:function(t){var e=this.props;this._props=t,this.render(e)},enumerable:!0,configurable:!0}),t.prototype.render=function(t){void 0===t&&(t=null),t?(t.backgroundURL!==this.props.backgroundURL&&(this.containerRef.style.backgroundImage=null!==this.props.backgroundURL?"url("+this.props.backgroundURL+")":null),t.backgroundColor!==this.props.backgroundColor&&(this.containerRef.style.backgroundColor=this.props.backgroundColor),this.sizeChanged(t,this.props)&&this.resizeElement(this.props.width,this.props.height)):(this.containerRef.style.backgroundImage=null!==this.props.backgroundURL?"url("+this.props.backgroundURL+")":null,this.containerRef.style.backgroundColor=this.props.backgroundColor,this.resizeElement(this.props.width,this.props.height))},t.prototype.sizeChanged=function(t,e){return t.width!==e.width||t.height!==e.height},t.prototype.resizeElement=function(t,e){this.containerRef.style.width=t+"px",this.containerRef.style.height=e+"px"},t.prototype.resize=function(t,e){this.props=_e({},this.props,{width:t,height:e})},t.prototype.remove=function(){this.disposables.forEach(function(t){return t.dispose()}),this.elements.forEach(function(t){return t.remove()}),this.elementsById={},this.elementIds=[],this.clearRelations(),this.containerRef.innerHTML=""},t.prototype.buildRelations=function(){var t=this;this.clearRelations(),this.elements.forEach(function(e){if(null!==e.props.parentId){var n=t.elementsById[e.props.parentId],i=t.elementsById[e.props.id];n&&i&&t.addRelationLine(n,i)}})},t.prototype.clearRelations=function(t){if(null!=t)for(var e in this.relations){var n=e.split("|"),i=Number.parseInt(n[0]),r=Number.parseInt(n[1]);t!==i&&t!==r||(this.relations[e].remove(),delete this.relations[e])}else for(var e in this.relations)this.relations[e].remove(),delete this.relations[e]},t.prototype.getRelationLine=function(t,e){var n=t+"|"+e;return this.relations[n]||null},t.prototype.addRelationLine=function(t,e){var n=t.props.id+"|"+e.props.id;null!=this.relations[n]&&this.relations[n].remove();var i=t.props.x+t.elementRef.clientWidth/2,s=t.props.y+(t.elementRef.clientHeight-t.labelElementRef.clientHeight)/2,o=e.props.x+e.elementRef.clientWidth/2,a=e.props.y+(e.elementRef.clientHeight-e.labelElementRef.clientHeight)/2,c=new z(D({id:0,type:13,startX:i,startY:s,endX:o,endY:a,width:0,height:0,lineWidth:this.props.relationLineWidth,color:"#CCCCCC"}),Object(r.g)({receivedAt:new Date}));return this.relations[n]=c,c.elementRef.style.zIndex="0",this.containerRef.append(c.elementRef),c},t.prototype.onItemClick=function(t){var e=this.clickEventManager.on(t);return this.disposables.push(e),e},t.prototype.onItemMoved=function(t){var e=this.movedEventManager.on(t);return this.disposables.push(e),e},t.prototype.onItemResized=function(t){var e=this.resizedEventManager.on(t);return this.disposables.push(e),e},t.prototype.enableEditMode=function(){this.elements.forEach(function(t){t.meta=_e({},t.meta,{editMode:!0})}),this.containerRef.classList.add("is-editing")},t.prototype.disableEditMode=function(){this.elements.forEach(function(t){t.meta=_e({},t.meta,{editMode:!1})}),this.containerRef.classList.remove("is-editing")},t}(),me=function(){function t(t){this.cancellable={cancel:function(){}},this._status="waiting",this.statusChangeEventManager=new se.a,this.disposables=[],this.taskInitiator=t}return Object.defineProperty(t.prototype,"status",{get:function(){return this._status},set:function(t){this._status=t,this.statusChangeEventManager.emit(t)},enumerable:!0,configurable:!0}),t.prototype.init=function(){var t=this;this.cancellable=this.taskInitiator(function(){t.status="finished"}),this.status="started"},t.prototype.cancel=function(){this.cancellable.cancel(),this.status="cancelled"},t.prototype.onStatusChange=function(t){var e=this.statusChangeEventManager.on(t);return this.disposables.push(e),e},t}();var ye=function(){function t(){this.tasks={}}return t.prototype.add=function(t,e,n){void 0===n&&(n=0),this.tasks[t]&&"started"===this.tasks[t].status&&this.tasks[t].cancel();var i=n>0?function(t,e){return new me(function(){var n=null;return t.onStatusChange(function(i){"finished"===i&&(n=window.setTimeout(function(){t.init()},e))}),t.init(),{cancel:function(){n&&clearTimeout(n),t.cancel()}}})}(new me(e),n):new me(e);return this.tasks[t]=i,this.tasks[t]},t.prototype.init=function(t){!this.tasks[t]||"waiting"!==this.tasks[t].status&&"cancelled"!==this.tasks[t].status&&"finished"!==this.tasks[t].status||this.tasks[t].init()},t.prototype.cancel=function(t){this.tasks[t]&&"started"===this.tasks[t].status&&this.tasks[t].cancel()},t}();window.VisualConsole=de,window.AsyncTaskManager=ye}]);
 //# sourceMappingURL=vc.main.min.js.map
\ No newline at end of file
diff --git a/pandora_console/include/visual-console-client/vc.main.min.js.map b/pandora_console/include/visual-console-client/vc.main.min.js.map
index 518b003c07..b39960805d 100644
--- a/pandora_console/include/visual-console-client/vc.main.min.js.map
+++ b/pandora_console/include/visual-console-client/vc.main.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/lib/index.ts","webpack:///./src/Item.ts","webpack:///./src/TypedEvent.ts","webpack:///./src/items/EventsHistory.ts","webpack:///./src/items/DonutGraph.ts","webpack:///./src/items/BarsGraph.ts","webpack:///./src/items/ModuleGraph.ts","webpack:///./src/items/StaticGraph.ts","webpack:///./src/items/Icon.ts","webpack:///./src/items/ColorCloud.ts","webpack:///./src/items/Group.ts","webpack:///./src/items/Clock/index.ts","webpack:///./src/items/Box.ts","webpack:///./src/items/Line.ts","webpack:///./src/items/Label.ts","webpack:///./src/items/SimpleValue.ts","webpack:///./node_modules/d3-path/src/path.js","webpack:///./node_modules/d3-shape/src/constant.js","webpack:///./node_modules/d3-shape/src/math.js","webpack:///./node_modules/d3-shape/src/arc.js","webpack:///./node_modules/d3-shape/src/curve/linear.js","webpack:///./node_modules/d3-shape/src/curve/radial.js","webpack:///./node_modules/d3-shape/src/array.js","webpack:///./node_modules/d3-shape/src/symbol/diamond.js","webpack:///./node_modules/d3-shape/src/symbol/circle.js","webpack:///./node_modules/d3-shape/src/symbol/star.js","webpack:///./node_modules/d3-shape/src/noop.js","webpack:///./node_modules/d3-shape/src/symbol/triangle.js","webpack:///./node_modules/d3-shape/src/symbol/wye.js","webpack:///./node_modules/d3-shape/src/curve/basis.js","webpack:///./node_modules/d3-shape/src/curve/basisClosed.js","webpack:///./node_modules/d3-shape/src/curve/basisOpen.js","webpack:///./node_modules/d3-shape/src/curve/bundle.js","webpack:///./node_modules/d3-shape/src/curve/cardinal.js","webpack:///./node_modules/d3-shape/src/curve/cardinalClosed.js","webpack:///./node_modules/d3-shape/src/curve/cardinalOpen.js","webpack:///./node_modules/d3-shape/src/curve/catmullRom.js","webpack:///./node_modules/d3-shape/src/curve/catmullRomClosed.js","webpack:///./node_modules/d3-shape/src/curve/catmullRomOpen.js","webpack:///./node_modules/d3-shape/src/curve/linearClosed.js","webpack:///./node_modules/d3-shape/src/curve/monotone.js","webpack:///./node_modules/d3-shape/src/curve/natural.js","webpack:///./node_modules/d3-shape/src/curve/step.js","webpack:///./node_modules/d3-shape/src/order/descending.js","webpack:///./src/items/Percentile.ts","webpack:///./src/items/Service.ts","webpack:///./src/VisualConsole.ts","webpack:///./src/lib/AsyncTaskManager.ts","webpack:///./src/index.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","parseIntOr","defaultValue","length","isNaN","parseInt","parseFloatOr","parseFloat","stringIsEmpty","notEmptyStringOr","parseBoolean","leftPad","pad","diffLength","substr","Math","abs","substring","repeatTimes","floor","restLength","newPad","positionPropsDecoder","data","x","y","sizePropsDecoder","width","height","TypeError","modulePropsDecoder","__assign","moduleName","moduleDescription","agentProps","agentId","agent","agentName","agentAlias","agentDescription","agentAddress","metaconsoleId","agentPropsDecoder","linkedVCPropsDecoder","id","linkedLayoutId","linkedLayoutAgentId","linkedLayoutStatusProps","linkedLayoutStatusType","weight","linkedLayoutStatusTypeWeight","warningThreshold","linkedLayoutStatusTypeWarningThreshold","criticalThreshold","linkedLayoutStatusTypeCriticalThreshold","linkedLayoutBaseProps","prefixedCssRules","ruleName","ruleValue","rule","decodeBase64","input","decodeURIComponent","escape","window","atob","humanDate","date","locale","Intl","DateTimeFormat","day","month","year","format","getDate","getMonth","getFullYear","humanTime","getHours","getMinutes","getSeconds","replaceMacros","macros","text","reduce","acc","_a","macro","replace","parseLabelPosition","labelPosition","itemBasePropsDecoder","type","label","_lib__WEBPACK_IMPORTED_MODULE_0__","isLinkEnabled","link","isOnTop","parentId","aclGroupId","VisualConsoleItem","props","this","clickEventManager","_TypedEvent__WEBPACK_IMPORTED_MODULE_1__","removeEventManager","disposables","itemProps","elementRef","createContainerDomElement","labelElementRef","createLabelDomElement","childElementRef","createDomElement","append","resizeElement","changeLabelPosition","box","_this","document","createElement","href","className","style","zIndex","left","top","onclick","e","emit","nativeEvent","element","getLabelWithMacrosReplaced","table","row","emptyRow1","emptyRow2","cell","innerHTML","textAlign","Date","updateDomElement","newProps","prevProps","shouldBeUpdated","render","positionChanged","moveElement","sizeChanged","oldLabelHtml","newLabelHtml","container","attrs","attributes","nodeName","setAttributeNode","parentNode","replaceChild","remove","forEach","disposable","dispose","ignored","prevPosition","newPosition","position","flexDirection","tables","getElementsByTagName","item","move","prevSize","newSize","resize","onClick","listener","on","push","onRemove","__webpack_exports__","TypedEvent","listeners","listenersOncer","off","once","callbackIndex","indexOf","splice","event","pipe","te","eventsHistoryPropsDecoder","html","encodedHtml","_Item__WEBPACK_IMPORTED_MODULE_1__","maxTime","EventsHistory","_super","__extends","scripts","src","setTimeout","eval","trim","aux","donutGraphPropsDecoder","DonutGraph","barsGraphPropsDecoder","BarsGraph","moduleGraphPropsDecoder","ModuleGraph","legendP","margin","overviewGraphs","getElementsByClassName","parseShowLastValueTooltip","showLastValueTooltip","staticGraphPropsDecoder","imageSrc","Item","statusImageSrc","lib","lastValue","StaticGraph","imgSrc","background","backgroundSize","backgroundPosition","setAttribute","iconPropsDecoder","Icon_assign","Icon","Icon_extends","colorCloudPropsDecoder","color","ColorCloud_assign","ColorCloud_svgNS","ColorCloud","ColorCloud_extends","createSvgElement","gradientId","svg","createElementNS","defs","radialGradient","stop0","stop100","circle","groupPropsDecoder","groupId","showStatistics","extractHtml","Group_assign","Group","Group_extends","parseClockType","clockType","parseClockFormat","clockFormat","clockPropsDecoder","clockTimezone","Clock_assign","clockTimezoneOffset","showClockTimezone","items_Clock","Clock","intervalRef","startTick","createClock","TICK_INTERVAL","Clock_extends","stopTick","clearInterval","handler","interval","setInterval","getElementSize","newWidth","newHeight","createAnalogicClock","createDigitalClock","Error","svgNS","colors","dateFontSize","baseTimeFontSize","div","clockFace","clockFaceBackground","city","getHumanTimezone","timezoneComplication","textContent","marksGroup","mainMarkGroup","mark1a","mark1b","mark","hourHand","hourHandA","hourHandB","minuteHand","minuteHandA","minuteHandB","minuteHandPin","secondHand","secondHandBar","secondHandPin","pin","getOriginDate","seconds","minutes","secAngle","minuteAngle","hourAngle","join","dateElem","fontSize","tzFontSizeMultiplier","timeFontSize","tzFontSize","min","timeElem","tzElem","initialDate","targetTZOffset","localTZOffset","getTimezoneOffset","utimestamp","getTime","timezone","_b","split","diameter","boxPropsDecoder","Box_assign","borderWidth","borderColor","fillColor","Box","Box_extends","boxSizing","backgroundColor","borderStyle","maxBorderWidth","linePropsDecoder","Line_assign","startPosition","startX","startY","endPosition","endX","endY","lineWidth","Line","extractBoxSizeAndPosition","Line_extends","toString","line","labelPropsDecoder","Label_assign","Label","Label_extends","parseValueType","valueType","parseProcessValue","processValue","simpleValuePropsDecoder","SimpleValue_assign","period","SimpleValue","SimpleValue_extends","img","pi","PI","tau","tauEpsilon","Path","_x0","_y0","_x1","_y1","_","path","constructor","moveTo","closePath","lineTo","quadraticCurveTo","x1","y1","bezierCurveTo","x2","y2","arcTo","x0","y0","x21","y21","x01","y01","l01_2","x20","y20","l21_2","l20_2","l21","sqrt","l01","tan","acos","t01","t21","arc","a0","a1","ccw","dx","cos","dy","sin","cw","da","rect","w","h","src_path","constant","atan2","max","math_epsilon","math_pi","halfPi","math_tau","asin","arcInnerRadius","innerRadius","arcOuterRadius","outerRadius","arcStartAngle","startAngle","arcEndAngle","endAngle","arcPadAngle","padAngle","cornerTangents","r1","rc","lo","ox","oy","x11","y11","x10","y10","x00","y00","d2","D","cx0","cy0","cx1","cy1","dx0","dy0","dx1","dy1","cx","cy","src_arc","cornerRadius","padRadius","context","buffer","r0","apply","arguments","t0","t1","a01","a11","a00","a10","da0","da1","ap","rp","rc0","rc1","p0","p1","oc","x3","y3","x32","y32","intersect","ax","ay","bx","by","kc","lc","centroid","a","Linear","_context","areaStart","_line","areaEnd","NaN","lineStart","_point","lineEnd","point","linear","curveRadial","Radial","curve","_curve","radial","Array","slice","kr","noop","that","Basis","BasisClosed","_x2","_x3","_x4","_y2","_y3","_y4","BasisOpen","Bundle","beta","_basis","_beta","_x","_y","j","custom","bundle","cardinal_point","_k","Cardinal","tension","cardinal","CardinalClosed","_x5","_y5","CardinalOpen","catmullRom_point","_l01_a","_l01_2a","_l12_a","_l12_2a","_l23_a","b","_l23_2a","CatmullRom","alpha","_alpha","x23","y23","pow","catmullRom","CatmullRomClosed","CatmullRomOpen","LinearClosed","sign","slope3","h0","h1","s0","s1","slope2","monotone_point","MonotoneX","MonotoneY","ReflectContext","Natural","controlPoints","_t0","px","py","i0","i1","Step","_t","extractPercentileType","extractValueType","percentilePropsDecoder","Percentile_assign","percentileType","minValue","maxValue","labelColor","unit","Percentile_svgNS","Percentile","Percentile_extends","formatValue","progress","getProgress","NumberFormat","backgroundRect","progressRect","backgroundCircle","progressCircle","arcProps","trunc","servicePropsDecoder","encodedTitle","serviceId","Service_assign","Service","Service_extends","itemInstanceFrom","items_StaticGraph","items_SimpleValue","items_Percentile","items_Label","items_Icon","items_Service","items_Group","items_Box","items_Line","items_ColorCloud","VisualConsole","items","elementsById","elementIds","relations","handleElementClick","handleElementRemove","filter","clearRelations","containerRef","_props","backgroundURL","isFavorite","relationLineWidth","VisualConsole_assign","visualConsolePropsDecoder","sort","itemInstance","error","console","log","message","buildRelations","map","updateElements","itemIds","decodeProps","backgroundImage","elements","parent_1","child","addRelationLine","itemId","ids","Number","childId","getRelationLine","identifier","parent","clientWidth","clientHeight","AsyncTaskManager_AsyncTask","AsyncTask","taskInitiator","cancellable","cancel","_status","statusChangeEventManager","status","init","onStatusChange","AsyncTaskManager","tasks","add","asyncTask","task","ref","clearTimeout","asyncPeriodic","src_VisualConsole","lib_AsyncTaskManager"],"mappings":"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","file":"vc.main.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 9);\n","import {\n  UnknownObject,\n  Position,\n  Size,\n  WithAgentProps,\n  WithModuleProps,\n  LinkedVisualConsoleProps,\n  LinkedVisualConsolePropsStatus\n} from \"../types\";\n\n/**\n * Return a number or a default value from a raw value.\n * @param value Raw value from which we will try to extract a valid number.\n * @param defaultValue Default value to use if we cannot extract a valid number.\n * @return A valid number or the default value.\n */\nexport function parseIntOr<T>(value: unknown, defaultValue: T): number | T {\n  if (typeof value === \"number\") return value;\n  if (typeof value === \"string\" && value.length > 0 && !isNaN(parseInt(value)))\n    return parseInt(value);\n  else return defaultValue;\n}\n\n/**\n * Return a number or a default value from a raw value.\n * @param value Raw value from which we will try to extract a valid number.\n * @param defaultValue Default value to use if we cannot extract a valid number.\n * @return A valid number or the default value.\n */\nexport function parseFloatOr<T>(value: unknown, defaultValue: T): number | T {\n  if (typeof value === \"number\") return value;\n  if (\n    typeof value === \"string\" &&\n    value.length > 0 &&\n    !isNaN(parseFloat(value))\n  )\n    return parseFloat(value);\n  else return defaultValue;\n}\n\n/**\n * Check if a string exists and it's not empty.\n * @param value Value to check.\n * @return The check result.\n */\nexport function stringIsEmpty(value?: string | null): boolean {\n  return value == null || value.length === 0;\n}\n\n/**\n * Return a not empty string or a default value from a raw value.\n * @param value Raw value from which we will try to extract a non empty string.\n * @param defaultValue Default value to use if we cannot extract a non empty string.\n * @return A non empty string or the default value.\n */\nexport function notEmptyStringOr<T>(\n  value: unknown,\n  defaultValue: T\n): string | T {\n  return typeof value === \"string\" && value.length > 0 ? value : defaultValue;\n}\n\n/**\n * Return a boolean from a raw value.\n * @param value Raw value from which we will try to extract the boolean.\n * @return A valid boolean value. false by default.\n */\nexport function parseBoolean(value: unknown): boolean {\n  if (typeof value === \"boolean\") return value;\n  else if (typeof value === \"number\") return value > 0;\n  else if (typeof value === \"string\") return value === \"1\" || value === \"true\";\n  else return false;\n}\n\n/**\n * Pad the current string with another string (multiple times, if needed)\n * until the resulting string reaches the given length.\n * The padding is applied from the start (left) of the current string.\n * @param value Text that needs to be padded.\n * @param length Length of the returned text.\n * @param pad Text to add.\n * @return Padded text.\n */\nexport function leftPad(\n  value: string | number,\n  length: number,\n  pad: string | number = \" \"\n): string {\n  if (typeof value === \"number\") value = `${value}`;\n  if (typeof pad === \"number\") pad = `${pad}`;\n\n  const diffLength = length - value.length;\n  if (diffLength === 0) return value;\n  if (diffLength < 0) return value.substr(Math.abs(diffLength));\n\n  if (diffLength === pad.length) return `${pad}${value}`;\n  if (diffLength < pad.length) return `${pad.substring(0, diffLength)}${value}`;\n\n  const repeatTimes = Math.floor(diffLength / pad.length);\n  const restLength = diffLength - pad.length * repeatTimes;\n\n  let newPad = \"\";\n  for (let i = 0; i < repeatTimes; i++) newPad += pad;\n\n  if (restLength === 0) return `${newPad}${value}`;\n  return `${newPad}${pad.substring(0, restLength)}${value}`;\n}\n\n/* Decoders */\n\n/**\n * Build a valid typed object from a raw object.\n * @param data Raw object.\n * @return An object representing the position.\n */\nexport function positionPropsDecoder(data: UnknownObject): Position {\n  return {\n    x: parseIntOr(data.x, 0),\n    y: parseIntOr(data.y, 0)\n  };\n}\n\n/**\n * Build a valid typed object from a raw object.\n * @param data Raw object.\n * @return An object representing the size.\n * @throws Will throw a TypeError if the width and height are not valid numbers.\n */\nexport function sizePropsDecoder(data: UnknownObject): Size | never {\n  if (\n    data.width == null ||\n    isNaN(parseInt(data.width)) ||\n    data.height == null ||\n    isNaN(parseInt(data.height))\n  ) {\n    throw new TypeError(\"invalid size.\");\n  }\n\n  return {\n    width: parseInt(data.width),\n    height: parseInt(data.height)\n  };\n}\n\n/**\n * Build a valid typed object from a raw object.\n * @param data Raw object.\n * @return An object representing the agent properties.\n */\nexport function agentPropsDecoder(data: UnknownObject): WithAgentProps {\n  const agentProps: WithAgentProps = {\n    agentId: parseIntOr(data.agent, null),\n    agentName: notEmptyStringOr(data.agentName, null),\n    agentAlias: notEmptyStringOr(data.agentAlias, null),\n    agentDescription: notEmptyStringOr(data.agentDescription, null),\n    agentAddress: notEmptyStringOr(data.agentAddress, null)\n  };\n\n  return data.metaconsoleId != null\n    ? {\n        metaconsoleId: data.metaconsoleId,\n        ...agentProps // Object spread: http://es6-features.org/#SpreadOperator\n      }\n    : agentProps;\n}\n\n/**\n * Build a valid typed object from a raw object.\n * @param data Raw object.\n * @return An object representing the module and agent properties.\n */\nexport function modulePropsDecoder(data: UnknownObject): WithModuleProps {\n  return {\n    moduleId: parseIntOr(data.moduleId, null),\n    moduleName: notEmptyStringOr(data.moduleName, null),\n    moduleDescription: notEmptyStringOr(data.moduleDescription, null),\n    ...agentPropsDecoder(data) // Object spread: http://es6-features.org/#SpreadOperator\n  };\n}\n\n/**\n * Build a valid typed object from a raw object.\n * @param data Raw object.\n * @return An object representing the linked visual console properties.\n * @throws Will throw a TypeError if the status calculation properties are invalid.\n */\nexport function linkedVCPropsDecoder(\n  data: UnknownObject\n): LinkedVisualConsoleProps | never {\n  // Object destructuring: http://es6-features.org/#ObjectMatchingShorthandNotation\n  const {\n    metaconsoleId,\n    linkedLayoutId: id,\n    linkedLayoutAgentId: agentId\n  } = data;\n\n  let linkedLayoutStatusProps: LinkedVisualConsolePropsStatus = {\n    linkedLayoutStatusType: \"default\"\n  };\n  switch (data.linkedLayoutStatusType) {\n    case \"weight\": {\n      const weight = parseIntOr(data.linkedLayoutStatusTypeWeight, null);\n      if (weight == null)\n        throw new TypeError(\"invalid status calculation properties.\");\n\n      if (data.linkedLayoutStatusTypeWeight)\n        linkedLayoutStatusProps = {\n          linkedLayoutStatusType: \"weight\",\n          linkedLayoutStatusTypeWeight: weight\n        };\n      break;\n    }\n    case \"service\": {\n      const warningThreshold = parseIntOr(\n        data.linkedLayoutStatusTypeWarningThreshold,\n        null\n      );\n      const criticalThreshold = parseIntOr(\n        data.linkedLayoutStatusTypeCriticalThreshold,\n        null\n      );\n      if (warningThreshold == null || criticalThreshold == null) {\n        throw new TypeError(\"invalid status calculation properties.\");\n      }\n\n      linkedLayoutStatusProps = {\n        linkedLayoutStatusType: \"service\",\n        linkedLayoutStatusTypeWarningThreshold: warningThreshold,\n        linkedLayoutStatusTypeCriticalThreshold: criticalThreshold\n      };\n      break;\n    }\n  }\n\n  const linkedLayoutBaseProps = {\n    linkedLayoutId: parseIntOr(id, null),\n    linkedLayoutAgentId: parseIntOr(agentId, null),\n    ...linkedLayoutStatusProps // Object spread: http://es6-features.org/#SpreadOperator\n  };\n\n  return metaconsoleId != null\n    ? {\n        metaconsoleId,\n        ...linkedLayoutBaseProps // Object spread: http://es6-features.org/#SpreadOperator\n      }\n    : linkedLayoutBaseProps;\n}\n\n/**\n * To get a CSS rule with the most used prefixes.\n * @param ruleName Name of the CSS rule.\n * @param ruleValue Value of the CSS rule.\n * @return An array of rules with the prefixes applied.\n */\nexport function prefixedCssRules(\n  ruleName: string,\n  ruleValue: string\n): string[] {\n  const rule = `${ruleName}: ${ruleValue};`;\n  return [\n    `-webkit-${rule}`,\n    `-moz-${rule}`,\n    `-ms-${rule}`,\n    `-o-${rule}`,\n    `${rule}`\n  ];\n}\n\n/**\n * Decode a base64 string.\n * @param input Data encoded using base64.\n * @return Decoded data.\n */\nexport function decodeBase64(input: string): string {\n  return decodeURIComponent(escape(window.atob(input)));\n}\n\n/**\n * Generate a date representation with the format 'd/m/Y'.\n * @param initialDate Date to be used instead of a generated one.\n * @param locale Locale to use if localization is required and available.\n * @example 24/02/2020.\n * @return Date representation.\n */\nexport function humanDate(date: Date, locale: string | null = null): string {\n  if (locale && Intl && Intl.DateTimeFormat) {\n    // Format using the user locale.\n    const options: Intl.DateTimeFormatOptions = {\n      day: \"2-digit\",\n      month: \"2-digit\",\n      year: \"numeric\"\n    };\n    return Intl.DateTimeFormat(locale, options).format(date);\n  } else {\n    // Use getDate, getDay returns the week day.\n    const day = leftPad(date.getDate(), 2, 0);\n    // The getMonth function returns the month starting by 0.\n    const month = leftPad(date.getMonth() + 1, 2, 0);\n    const year = leftPad(date.getFullYear(), 4, 0);\n\n    // Format: 'd/m/Y'.\n    return `${day}/${month}/${year}`;\n  }\n}\n\n/**\n * Generate a time representation with the format 'hh:mm:ss'.\n * @param initialDate Date to be used instead of a generated one.\n * @example 01:34:09.\n * @return Time representation.\n */\nexport function humanTime(date: Date): string {\n  const hours = leftPad(date.getHours(), 2, 0);\n  const minutes = leftPad(date.getMinutes(), 2, 0);\n  const seconds = leftPad(date.getSeconds(), 2, 0);\n\n  return `${hours}:${minutes}:${seconds}`;\n}\n\ninterface Macro {\n  macro: string | RegExp;\n  value: string;\n}\n/**\n * Replace the macros of a text.\n * @param macros List of macros and their replacements.\n * @param text Text in which we need to replace the macros.\n */\nexport function replaceMacros(macros: Macro[], text: string): string {\n  return macros.reduce(\n    (acc, { macro, value }) => acc.replace(macro, value),\n    text\n  );\n}\n","import { Position, Size, UnknownObject, WithModuleProps } from \"./types\";\nimport {\n  sizePropsDecoder,\n  positionPropsDecoder,\n  parseIntOr,\n  parseBoolean,\n  notEmptyStringOr,\n  replaceMacros,\n  humanDate,\n  humanTime\n} from \"./lib\";\nimport TypedEvent, { Listener, Disposable } from \"./TypedEvent\";\n\n// Enum: https://www.typescriptlang.org/docs/handbook/enums.html.\nexport const enum ItemType {\n  STATIC_GRAPH = 0,\n  MODULE_GRAPH = 1,\n  SIMPLE_VALUE = 2,\n  PERCENTILE_BAR = 3,\n  LABEL = 4,\n  ICON = 5,\n  SIMPLE_VALUE_MAX = 6,\n  SIMPLE_VALUE_MIN = 7,\n  SIMPLE_VALUE_AVG = 8,\n  PERCENTILE_BUBBLE = 9,\n  SERVICE = 10,\n  GROUP_ITEM = 11,\n  BOX_ITEM = 12,\n  LINE_ITEM = 13,\n  AUTO_SLA_GRAPH = 14,\n  CIRCULAR_PROGRESS_BAR = 15,\n  CIRCULAR_INTERIOR_PROGRESS_BAR = 16,\n  DONUT_GRAPH = 17,\n  BARS_GRAPH = 18,\n  CLOCK = 19,\n  COLOR_CLOUD = 20\n}\n\n// Base item properties. This interface should be extended by the item implementations.\nexport interface ItemProps extends Position, Size {\n  readonly id: number;\n  readonly type: ItemType;\n  label: string | null;\n  labelPosition: \"up\" | \"right\" | \"down\" | \"left\";\n  isLinkEnabled: boolean;\n  link: string | null;\n  isOnTop: boolean;\n  parentId: number | null;\n  aclGroupId: number | null;\n}\n\n// FIXME: Fix type compatibility.\nexport interface ItemClickEvent<Props extends ItemProps> {\n  // data: Props;\n  data: UnknownObject;\n  nativeEvent: Event;\n}\n\n// FIXME: Fix type compatibility.\nexport interface ItemRemoveEvent<Props extends ItemProps> {\n  // data: Props;\n  data: UnknownObject;\n}\n\n/**\n * Extract a valid enum value from a raw label positi9on value.\n * @param labelPosition Raw value.\n */\nconst parseLabelPosition = (\n  labelPosition: unknown\n): ItemProps[\"labelPosition\"] => {\n  switch (labelPosition) {\n    case \"up\":\n    case \"right\":\n    case \"down\":\n    case \"left\":\n      return labelPosition;\n    default:\n      return \"down\";\n  }\n};\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the item props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function itemBasePropsDecoder(data: UnknownObject): ItemProps | never {\n  if (data.id == null || isNaN(parseInt(data.id))) {\n    throw new TypeError(\"invalid id.\");\n  }\n  if (data.type == null || isNaN(parseInt(data.type))) {\n    throw new TypeError(\"invalid type.\");\n  }\n\n  return {\n    id: parseInt(data.id),\n    type: parseInt(data.type),\n    label: notEmptyStringOr(data.label, null),\n    labelPosition: parseLabelPosition(data.labelPosition),\n    isLinkEnabled: parseBoolean(data.isLinkEnabled),\n    link: notEmptyStringOr(data.link, null),\n    isOnTop: parseBoolean(data.isOnTop),\n    parentId: parseIntOr(data.parentId, null),\n    aclGroupId: parseIntOr(data.aclGroupId, null),\n    ...sizePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...positionPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\n/**\n * Base class of the visual console items. Should be extended to use its capabilities.\n */\nabstract class VisualConsoleItem<Props extends ItemProps> {\n  // Properties of the item.\n  private itemProps: Props;\n  // Reference to the DOM element which will contain the item.\n  public elementRef: HTMLElement;\n  public readonly labelElementRef: HTMLElement;\n  // Reference to the DOM element which will contain the view of the item which extends this class.\n  protected readonly childElementRef: HTMLElement;\n  // Event manager for click events.\n  private readonly clickEventManager = new TypedEvent<ItemClickEvent<Props>>();\n  // Event manager for remove events.\n  private readonly removeEventManager = new TypedEvent<\n    ItemRemoveEvent<Props>\n  >();\n  // List of references to clean the event listeners.\n  private readonly disposables: Disposable[] = [];\n\n  /**\n   * To create a new element which will be inside the item box.\n   * @return Item.\n   */\n  protected abstract createDomElement(): HTMLElement;\n\n  public constructor(props: Props) {\n    this.itemProps = props;\n\n    /*\n     * Get a HTMLElement which represents the container box\n     * of the Visual Console item. This element will manage\n     * all the common things like click events, show a border\n     * when hovered, etc.\n     */\n    this.elementRef = this.createContainerDomElement();\n    this.labelElementRef = this.createLabelDomElement();\n\n    /*\n     * Get a HTMLElement which represents the custom view\n     * of the Visual Console item. This element will be\n     * different depending on the item implementation.\n     */\n    this.childElementRef = this.createDomElement();\n\n    // Insert the elements into the container.\n    this.elementRef.append(this.childElementRef, this.labelElementRef);\n\n    // Resize element.\n    this.resizeElement(props.width, props.height);\n    // Set label position.\n    this.changeLabelPosition(props.labelPosition);\n  }\n\n  /**\n   * To create a new box for the visual console item.\n   * @return Item box.\n   */\n  private createContainerDomElement(): HTMLElement {\n    let box;\n    if (this.props.isLinkEnabled) {\n      box = document.createElement(\"a\");\n      box as HTMLAnchorElement;\n      if (this.props.link) box.href = this.props.link;\n    } else {\n      box = document.createElement(\"div\");\n      box as HTMLDivElement;\n    }\n\n    box.className = \"visual-console-item\";\n    box.style.zIndex = this.props.isOnTop ? \"2\" : \"1\";\n    box.style.left = `${this.props.x}px`;\n    box.style.top = `${this.props.y}px`;\n    box.onclick = e =>\n      this.clickEventManager.emit({ data: this.props, nativeEvent: e });\n\n    return box;\n  }\n\n  /**\n   * To create a new label for the visual console item.\n   * @return Item label.\n   */\n  protected createLabelDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"visual-console-item-label\";\n    // Add the label if it exists.\n    const label = this.getLabelWithMacrosReplaced();\n    if (label.length > 0) {\n      // Ugly table we need to use to replicate the legacy style.\n      const table = document.createElement(\"table\");\n      const row = document.createElement(\"tr\");\n      const emptyRow1 = document.createElement(\"tr\");\n      const emptyRow2 = document.createElement(\"tr\");\n      const cell = document.createElement(\"td\");\n\n      cell.innerHTML = label;\n      row.append(cell);\n      table.append(emptyRow1, row, emptyRow2);\n      table.style.textAlign = \"center\";\n\n      // Change the table size depending on its position.\n      switch (this.props.labelPosition) {\n        case \"up\":\n        case \"down\":\n          if (this.props.width > 0) {\n            table.style.width = `${this.props.width}px`;\n            table.style.height = null;\n          }\n          break;\n        case \"left\":\n        case \"right\":\n          if (this.props.height > 0) {\n            table.style.width = null;\n            table.style.height = `${this.props.height}px`;\n          }\n          break;\n      }\n\n      // element.innerHTML = this.props.label;\n      element.append(table);\n    }\n\n    return element;\n  }\n\n  /**\n   * Return the label stored into the props with some macros replaced.\n   */\n  protected getLabelWithMacrosReplaced(): string {\n    // We assert that the props may have some needed properties.\n    const props = this.props as Partial<WithModuleProps>;\n\n    return replaceMacros(\n      [\n        {\n          macro: \"_date_\",\n          value: humanDate(new Date())\n        },\n        {\n          macro: \"_time_\",\n          value: humanTime(new Date())\n        },\n        {\n          macro: \"_agent_\",\n          value: props.agentAlias != null ? props.agentAlias : \"\"\n        },\n        {\n          macro: \"_agentdescription_\",\n          value: props.agentDescription != null ? props.agentDescription : \"\"\n        },\n        {\n          macro: \"_address_\",\n          value: props.agentAddress != null ? props.agentAddress : \"\"\n        },\n        {\n          macro: \"_module_\",\n          value: props.moduleName != null ? props.moduleName : \"\"\n        },\n        {\n          macro: \"_moduledescription_\",\n          value: props.moduleDescription != null ? props.moduleDescription : \"\"\n        }\n      ],\n      this.props.label || \"\"\n    );\n  }\n\n  /**\n   * To update the content element.\n   * @return Item.\n   */\n  protected updateDomElement(element: HTMLElement): void {\n    element.innerHTML = this.createDomElement().innerHTML;\n  }\n\n  /**\n   * Public accessor of the `props` property.\n   * @return Properties.\n   */\n  public get props(): Props {\n    return { ...this.itemProps }; // Return a copy.\n  }\n\n  /**\n   * Public setter of the `props` property.\n   * If the new props are different enough than the\n   * stored props, a render would be fired.\n   * @param newProps\n   */\n  public set props(newProps: Props) {\n    const prevProps = this.props;\n    // Update the internal props.\n    this.itemProps = newProps;\n\n    // From this point, things which rely on this.props can access to the changes.\n\n    // Check if we should re-render.\n    if (this.shouldBeUpdated(prevProps, newProps)) this.render(prevProps);\n  }\n\n  /**\n   * To compare the previous and the new props and returns a boolean value\n   * in case the difference is meaningfull enough to perform DOM changes.\n   *\n   * Here, the only comparision is done by reference.\n   *\n   * Override this function to perform a different comparision depending on the item needs.\n   *\n   * @param prevProps\n   * @param newProps\n   * @return Whether the difference is meaningful enough to perform DOM changes or not.\n   */\n  protected shouldBeUpdated(prevProps: Props, newProps: Props): boolean {\n    return prevProps !== newProps;\n  }\n\n  /**\n   * To recreate or update the HTMLElement which represents the item into the DOM.\n   * @param prevProps If exists it will be used to only perform DOM updates instead of a full replace.\n   */\n  public render(prevProps: Props | null = null): void {\n    this.updateDomElement(this.childElementRef);\n\n    // Move box.\n    if (!prevProps || this.positionChanged(prevProps, this.props)) {\n      this.moveElement(this.props.x, this.props.y);\n    }\n    // Resize box.\n    if (!prevProps || this.sizeChanged(prevProps, this.props)) {\n      this.resizeElement(this.props.width, this.props.height);\n    }\n    // Change label.\n    const oldLabelHtml = this.labelElementRef.innerHTML;\n    const newLabelHtml = this.createLabelDomElement().innerHTML;\n    if (oldLabelHtml !== newLabelHtml) {\n      this.labelElementRef.innerHTML = newLabelHtml;\n    }\n    // Change label position.\n    if (!prevProps || prevProps.labelPosition !== this.props.labelPosition) {\n      this.changeLabelPosition(this.props.labelPosition);\n    }\n    // Change link.\n    if (\n      prevProps &&\n      (prevProps.isLinkEnabled !== this.props.isLinkEnabled ||\n        (this.props.isLinkEnabled && prevProps.link !== this.props.link))\n    ) {\n      const container = this.createContainerDomElement();\n      // Add the children of the old element.\n      container.innerHTML = this.elementRef.innerHTML;\n      // Copy the attributes.\n      const attrs = this.elementRef.attributes;\n      for (let i = 0; i < attrs.length; i++) {\n        if (attrs[i].nodeName !== \"id\") {\n          container.setAttributeNode(attrs[i]);\n        }\n      }\n      // Replace the reference.\n      if (this.elementRef.parentNode !== null) {\n        this.elementRef.parentNode.replaceChild(container, this.elementRef);\n      }\n\n      // Changed the reference to the main element. It's ugly, but needed.\n      this.elementRef = container;\n    }\n  }\n\n  /**\n   * To remove the event listeners and the elements from the DOM.\n   */\n  public remove(): void {\n    // Call the remove event.\n    this.removeEventManager.emit({ data: this.props });\n    // Event listeners.\n    this.disposables.forEach(disposable => {\n      try {\n        disposable.dispose();\n      } catch (ignored) {} // eslint-disable-line no-empty\n    });\n    // VisualConsoleItem DOM element.\n    this.elementRef.remove();\n  }\n\n  /**\n   * Compare the previous and the new position and return\n   * a boolean value in case the position changed.\n   * @param prevPosition\n   * @param newPosition\n   * @return Whether the position changed or not.\n   */\n  protected positionChanged(\n    prevPosition: Position,\n    newPosition: Position\n  ): boolean {\n    return prevPosition.x !== newPosition.x || prevPosition.y !== newPosition.y;\n  }\n\n  /**\n   * Move the label around the item content.\n   * @param position Label position.\n   */\n  protected changeLabelPosition(position: Props[\"labelPosition\"]): void {\n    switch (position) {\n      case \"up\":\n        this.elementRef.style.flexDirection = \"column-reverse\";\n        break;\n      case \"left\":\n        this.elementRef.style.flexDirection = \"row-reverse\";\n        break;\n      case \"right\":\n        this.elementRef.style.flexDirection = \"row\";\n        break;\n      case \"down\":\n      default:\n        this.elementRef.style.flexDirection = \"column\";\n        break;\n    }\n\n    // Ugly table to show the label as its legacy counterpart.\n    const tables = this.labelElementRef.getElementsByTagName(\"table\");\n    const table = tables.length > 0 ? tables.item(0) : null;\n    // Change the table size depending on its position.\n    if (table) {\n      switch (this.props.labelPosition) {\n        case \"up\":\n        case \"down\":\n          if (this.props.width > 0) {\n            table.style.width = `${this.props.width}px`;\n            table.style.height = null;\n          }\n          break;\n        case \"left\":\n        case \"right\":\n          if (this.props.height > 0) {\n            table.style.width = null;\n            table.style.height = `${this.props.height}px`;\n          }\n          break;\n      }\n    }\n  }\n\n  /**\n   * Move the DOM container.\n   * @param x Horizontal axis position.\n   * @param y Vertical axis position.\n   */\n  protected moveElement(x: number, y: number): void {\n    this.elementRef.style.left = `${x}px`;\n    this.elementRef.style.top = `${y}px`;\n  }\n\n  /**\n   * Update the position into the properties and move the DOM container.\n   * @param x Horizontal axis position.\n   * @param y Vertical axis position.\n   */\n  public move(x: number, y: number): void {\n    this.moveElement(x, y);\n    this.itemProps = {\n      ...this.props, // Object spread: http://es6-features.org/#SpreadOperator\n      x,\n      y\n    };\n  }\n\n  /**\n   * Compare the previous and the new size and return\n   * a boolean value in case the size changed.\n   * @param prevSize\n   * @param newSize\n   * @return Whether the size changed or not.\n   */\n  protected sizeChanged(prevSize: Size, newSize: Size): boolean {\n    return (\n      prevSize.width !== newSize.width || prevSize.height !== newSize.height\n    );\n  }\n\n  /**\n   * Resize the DOM content container.\n   * @param width\n   * @param height\n   */\n  protected resizeElement(width: number, height: number): void {\n    // The most valuable size is the content size.\n    this.childElementRef.style.width = width > 0 ? `${width}px` : null;\n    this.childElementRef.style.height = height > 0 ? `${height}px` : null;\n  }\n\n  /**\n   * Update the size into the properties and resize the DOM container.\n   * @param width\n   * @param height\n   */\n  public resize(width: number, height: number): void {\n    this.resizeElement(width, height);\n    this.itemProps = {\n      ...this.props, // Object spread: http://es6-features.org/#SpreadOperator\n      width,\n      height\n    };\n  }\n\n  /**\n   * To add an event handler to the click of the linked visual console elements.\n   * @param listener Function which is going to be executed when a linked console is clicked.\n   */\n  public onClick(listener: Listener<ItemClickEvent<Props>>): Disposable {\n    /*\n     * The '.on' function returns a function which will clean the event\n     * listener when executed. We store all the 'dispose' functions to\n     * call them when the item should be cleared.\n     */\n    const disposable = this.clickEventManager.on(listener);\n    this.disposables.push(disposable);\n\n    return disposable;\n  }\n\n  /**\n   * To add an event handler to the removal of the item.\n   * @param listener Function which is going to be executed when a item is removed.\n   */\n  public onRemove(listener: Listener<ItemRemoveEvent<Props>>): Disposable {\n    /*\n     * The '.on' function returns a function which will clean the event\n     * listener when executed. We store all the 'dispose' functions to\n     * call them when the item should be cleared.\n     */\n    const disposable = this.removeEventManager.on(listener);\n    this.disposables.push(disposable);\n\n    return disposable;\n  }\n}\n\nexport default VisualConsoleItem;\n","export interface Listener<T> {\n  (event: T): void;\n}\n\nexport interface Disposable {\n  dispose: () => void;\n}\n\n/** passes through events as they happen. You will not get events from before you start listening */\nexport default class TypedEvent<T> {\n  private listeners: Listener<T>[] = [];\n  private listenersOncer: Listener<T>[] = [];\n\n  public on = (listener: Listener<T>): Disposable => {\n    this.listeners.push(listener);\n    return {\n      dispose: () => this.off(listener)\n    };\n  };\n\n  public once = (listener: Listener<T>): void => {\n    this.listenersOncer.push(listener);\n  };\n\n  public off = (listener: Listener<T>): void => {\n    const callbackIndex = this.listeners.indexOf(listener);\n    if (callbackIndex > -1) this.listeners.splice(callbackIndex, 1);\n  };\n\n  public emit = (event: T): void => {\n    /** Update any general listeners */\n    this.listeners.forEach(listener => listener(event));\n\n    /** Clear the `once` queue */\n    this.listenersOncer.forEach(listener => listener(event));\n    this.listenersOncer = [];\n  };\n\n  public pipe = (te: TypedEvent<T>): Disposable => this.on(e => te.emit(e));\n}\n","import { UnknownObject, WithModuleProps } from \"../types\";\nimport {\n  modulePropsDecoder,\n  parseIntOr,\n  decodeBase64,\n  stringIsEmpty\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type EventsHistoryProps = {\n  type: ItemType.AUTO_SLA_GRAPH;\n  maxTime: number | null;\n  html: string;\n} & ItemProps &\n  WithModuleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the events history props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function eventsHistoryPropsDecoder(\n  data: UnknownObject\n): EventsHistoryProps | never {\n  if (stringIsEmpty(data.html) && stringIsEmpty(data.encodedHtml)) {\n    throw new TypeError(\"missing html content.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.AUTO_SLA_GRAPH,\n    maxTime: parseIntOr(data.maxTime, null),\n    html: !stringIsEmpty(data.html)\n      ? data.html\n      : decodeBase64(data.encodedHtml),\n    ...modulePropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class EventsHistory extends Item<EventsHistoryProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"events-history\";\n    element.innerHTML = this.props.html;\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const scripts = element.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      if (scripts[i].src.length === 0) {\n        setTimeout(() => {\n          try {\n            eval(scripts[i].innerHTML.trim());\n          } catch (ignored) {} // eslint-disable-line no-empty\n        }, 0);\n      }\n    }\n\n    return element;\n  }\n\n  protected updateDomElement(element: HTMLElement): void {\n    element.innerHTML = this.props.html;\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const aux = document.createElement(\"div\");\n    aux.innerHTML = this.props.html;\n    const scripts = aux.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      if (scripts[i].src.length === 0) {\n        eval(scripts[i].innerHTML.trim());\n      }\n    }\n  }\n}\n","import {\n  LinkedVisualConsoleProps,\n  UnknownObject,\n  WithModuleProps\n} from \"../types\";\nimport {\n  linkedVCPropsDecoder,\n  modulePropsDecoder,\n  decodeBase64,\n  stringIsEmpty\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type DonutGraphProps = {\n  type: ItemType.DONUT_GRAPH;\n  html: string;\n} & ItemProps &\n  WithModuleProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the donut graph props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function donutGraphPropsDecoder(\n  data: UnknownObject\n): DonutGraphProps | never {\n  if (stringIsEmpty(data.html) && stringIsEmpty(data.encodedHtml)) {\n    throw new TypeError(\"missing html content.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.DONUT_GRAPH,\n    html: !stringIsEmpty(data.html)\n      ? data.html\n      : decodeBase64(data.encodedHtml),\n    ...modulePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class DonutGraph extends Item<DonutGraphProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"donut-graph\";\n    element.innerHTML = this.props.html;\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const scripts = element.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      setTimeout(() => {\n        if (scripts[i].src.length === 0) eval(scripts[i].innerHTML.trim());\n      }, 0);\n    }\n\n    return element;\n  }\n\n  protected updateDomElement(element: HTMLElement): void {\n    element.innerHTML = this.props.html;\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const aux = document.createElement(\"div\");\n    aux.innerHTML = this.props.html;\n    const scripts = aux.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      if (scripts[i].src.length === 0) {\n        eval(scripts[i].innerHTML.trim());\n      }\n    }\n  }\n}\n","import { UnknownObject, WithModuleProps } from \"../types\";\nimport { modulePropsDecoder, decodeBase64, stringIsEmpty } from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type BarsGraphProps = {\n  type: ItemType.BARS_GRAPH;\n  html: string;\n} & ItemProps &\n  WithModuleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the bars graph props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function barsGraphPropsDecoder(\n  data: UnknownObject\n): BarsGraphProps | never {\n  if (stringIsEmpty(data.html) && stringIsEmpty(data.encodedHtml)) {\n    throw new TypeError(\"missing html content.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.BARS_GRAPH,\n    html: !stringIsEmpty(data.html)\n      ? data.html\n      : decodeBase64(data.encodedHtml),\n    ...modulePropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class BarsGraph extends Item<BarsGraphProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"bars-graph\";\n    element.innerHTML = this.props.html;\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const scripts = element.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      setTimeout(() => {\n        if (scripts[i].src.length === 0) eval(scripts[i].innerHTML.trim());\n      }, 0);\n    }\n\n    return element;\n  }\n\n  protected updateDomElement(element: HTMLElement): void {\n    element.innerHTML = this.props.html;\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const aux = document.createElement(\"div\");\n    aux.innerHTML = this.props.html;\n    const scripts = aux.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      if (scripts[i].src.length === 0) {\n        eval(scripts[i].innerHTML.trim());\n      }\n    }\n  }\n}\n","import {\n  LinkedVisualConsoleProps,\n  UnknownObject,\n  WithModuleProps\n} from \"../types\";\nimport {\n  linkedVCPropsDecoder,\n  modulePropsDecoder,\n  decodeBase64,\n  stringIsEmpty\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type ModuleGraphProps = {\n  type: ItemType.MODULE_GRAPH;\n  html: string;\n} & ItemProps &\n  WithModuleProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the module graph props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function moduleGraphPropsDecoder(\n  data: UnknownObject\n): ModuleGraphProps | never {\n  if (stringIsEmpty(data.html) && stringIsEmpty(data.encodedHtml)) {\n    throw new TypeError(\"missing html content.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.MODULE_GRAPH,\n    html: !stringIsEmpty(data.html)\n      ? data.html\n      : decodeBase64(data.encodedHtml),\n    ...modulePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class ModuleGraph extends Item<ModuleGraphProps> {\n  /**\n   * @override Item.resizeElement.\n   * Resize the DOM content container.\n   * We need to override the resize function cause this item's height\n   * is larger than the configured and the graph is over the label.\n   * @param width\n   * @param height\n   */\n  protected resizeElement(width: number): void {\n    super.resizeElement(width, 0);\n  }\n\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"module-graph\";\n    element.innerHTML = this.props.html;\n\n    // Remove the overview graph.\n    const legendP = element.getElementsByTagName(\"p\");\n    for (let i = 0; i < legendP.length; i++) {\n      legendP[i].style.margin = \"0px\";\n    }\n\n    // Remove the overview graph.\n    const overviewGraphs = element.getElementsByClassName(\"overview_graph\");\n    for (let i = 0; i < overviewGraphs.length; i++) {\n      overviewGraphs[i].remove();\n    }\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const scripts = element.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      if (scripts[i].src.length === 0) {\n        setTimeout(() => {\n          try {\n            eval(scripts[i].innerHTML.trim());\n          } catch (ignored) {} // eslint-disable-line no-empty\n        }, 0);\n      }\n    }\n\n    return element;\n  }\n\n  protected updateDomElement(element: HTMLElement): void {\n    element.innerHTML = this.props.html;\n\n    // Remove the overview graph.\n    const legendP = element.getElementsByTagName(\"p\");\n    for (let i = 0; i < legendP.length; i++) {\n      legendP[i].style.margin = \"0px\";\n    }\n\n    // Remove the overview graph.\n    const overviewGraphs = element.getElementsByClassName(\"overview_graph\");\n    for (let i = 0; i < overviewGraphs.length; i++) {\n      overviewGraphs[i].remove();\n    }\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const aux = document.createElement(\"div\");\n    aux.innerHTML = this.props.html;\n    const scripts = aux.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      if (scripts[i].src.length === 0) {\n        eval(scripts[i].innerHTML.trim());\n      }\n    }\n  }\n}\n","import {\n  WithModuleProps,\n  LinkedVisualConsoleProps,\n  UnknownObject\n} from \"../types\";\n\nimport {\n  modulePropsDecoder,\n  linkedVCPropsDecoder,\n  notEmptyStringOr\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type StaticGraphProps = {\n  type: ItemType.STATIC_GRAPH;\n  imageSrc: string; // URL?\n  showLastValueTooltip: \"default\" | \"enabled\" | \"disabled\";\n  statusImageSrc: string | null; // URL?\n  lastValue: string | null;\n} & ItemProps &\n  (WithModuleProps | LinkedVisualConsoleProps);\n\n/**\n * Extract a valid enum value from a raw unknown value.\n * @param showLastValueTooltip Raw value.\n */\nconst parseShowLastValueTooltip = (\n  showLastValueTooltip: unknown\n): StaticGraphProps[\"showLastValueTooltip\"] => {\n  switch (showLastValueTooltip) {\n    case \"default\":\n    case \"enabled\":\n    case \"disabled\":\n      return showLastValueTooltip;\n    default:\n      return \"default\";\n  }\n};\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the static graph props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function staticGraphPropsDecoder(\n  data: UnknownObject\n): StaticGraphProps | never {\n  if (typeof data.imageSrc !== \"string\" || data.imageSrc.length === 0) {\n    throw new TypeError(\"invalid image src.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.STATIC_GRAPH,\n    imageSrc: data.imageSrc,\n    showLastValueTooltip: parseShowLastValueTooltip(data.showLastValueTooltip),\n    statusImageSrc: notEmptyStringOr(data.statusImageSrc, null),\n    lastValue: notEmptyStringOr(data.lastValue, null),\n    ...modulePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class StaticGraph extends Item<StaticGraphProps> {\n  protected createDomElement(): HTMLElement {\n    const imgSrc = this.props.statusImageSrc || this.props.imageSrc;\n    const element = document.createElement(\"div\");\n    element.className = \"static-graph\";\n    element.style.background = `url(${imgSrc}) no-repeat`;\n    element.style.backgroundSize = \"contain\";\n    element.style.backgroundPosition = \"center\";\n\n    // Show last value in a tooltip.\n    if (\n      this.props.lastValue !== null &&\n      this.props.showLastValueTooltip !== \"disabled\"\n    ) {\n      element.className = \"static-graph image forced_title\";\n      element.setAttribute(\"data-use_title_for_force_title\", \"1\");\n      element.setAttribute(\"data-title\", this.props.lastValue);\n    }\n\n    return element;\n  }\n}\n","import { LinkedVisualConsoleProps, UnknownObject } from \"../types\";\nimport { linkedVCPropsDecoder } from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type IconProps = {\n  type: ItemType.ICON;\n  imageSrc: string; // URL?\n} & ItemProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the icon props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function iconPropsDecoder(data: UnknownObject): IconProps | never {\n  if (typeof data.imageSrc !== \"string\" || data.imageSrc.length === 0) {\n    throw new TypeError(\"invalid image src.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.ICON,\n    imageSrc: data.imageSrc,\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class Icon extends Item<IconProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"icon\";\n    element.style.background = `url(${this.props.imageSrc}) no-repeat`;\n    element.style.backgroundSize = \"contain\";\n    element.style.backgroundPosition = \"center\";\n\n    return element;\n  }\n}\n","import {\n  WithModuleProps,\n  LinkedVisualConsoleProps,\n  UnknownObject\n} from \"../types\";\nimport { modulePropsDecoder, linkedVCPropsDecoder } from \"../lib\";\nimport Item, { itemBasePropsDecoder, ItemType, ItemProps } from \"../Item\";\n\nexport type ColorCloudProps = {\n  type: ItemType.COLOR_CLOUD;\n  color: string;\n  // TODO: Add the rest of the color cloud values?\n} & ItemProps &\n  WithModuleProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the static graph props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function colorCloudPropsDecoder(\n  data: UnknownObject\n): ColorCloudProps | never {\n  // TODO: Validate the color.\n  if (typeof data.color !== \"string\" || data.color.length === 0) {\n    throw new TypeError(\"invalid color.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.COLOR_CLOUD,\n    color: data.color,\n    ...modulePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nconst svgNS = \"http://www.w3.org/2000/svg\";\n\nexport default class ColorCloud extends Item<ColorCloudProps> {\n  protected createDomElement(): HTMLElement {\n    const container: HTMLDivElement = document.createElement(\"div\");\n    container.className = \"color-cloud\";\n\n    // Add the SVG.\n    container.append(this.createSvgElement());\n\n    return container;\n  }\n\n  public createSvgElement(): SVGSVGElement {\n    const gradientId = `grad_${this.props.id}`;\n    // SVG container.\n    const svg = document.createElementNS(svgNS, \"svg\");\n    // Auto resize SVG using the view box magic: https://css-tricks.com/scale-svg/\n    svg.setAttribute(\"viewBox\", \"0 0 100 100\");\n\n    // Defs.\n    const defs = document.createElementNS(svgNS, \"defs\");\n    // Radial gradient.\n    const radialGradient = document.createElementNS(svgNS, \"radialGradient\");\n    radialGradient.setAttribute(\"id\", gradientId);\n    radialGradient.setAttribute(\"cx\", \"50%\");\n    radialGradient.setAttribute(\"cy\", \"50%\");\n    radialGradient.setAttribute(\"r\", \"50%\");\n    radialGradient.setAttribute(\"fx\", \"50%\");\n    radialGradient.setAttribute(\"fy\", \"50%\");\n    // Stops.\n    const stop0 = document.createElementNS(svgNS, \"stop\");\n    stop0.setAttribute(\"offset\", \"0%\");\n    stop0.setAttribute(\n      \"style\",\n      `stop-color:${this.props.color};stop-opacity:0.9`\n    );\n    const stop100 = document.createElementNS(svgNS, \"stop\");\n    stop100.setAttribute(\"offset\", \"100%\");\n    stop100.setAttribute(\n      \"style\",\n      `stop-color:${this.props.color};stop-opacity:0`\n    );\n    // Circle.\n    const circle = document.createElementNS(svgNS, \"circle\");\n    circle.setAttribute(\"fill\", `url(#${gradientId})`);\n    circle.setAttribute(\"cx\", \"50%\");\n    circle.setAttribute(\"cy\", \"50%\");\n    circle.setAttribute(\"r\", \"50%\");\n\n    // Append elements.\n    radialGradient.append(stop0, stop100);\n    defs.append(radialGradient);\n    svg.append(defs, circle);\n\n    return svg;\n  }\n}\n","import { LinkedVisualConsoleProps, UnknownObject } from \"../types\";\nimport {\n  linkedVCPropsDecoder,\n  parseIntOr,\n  notEmptyStringOr,\n  stringIsEmpty,\n  decodeBase64,\n  parseBoolean\n} from \"../lib\";\nimport Item, { ItemProps, itemBasePropsDecoder, ItemType } from \"../Item\";\n\nexport type GroupProps = {\n  type: ItemType.GROUP_ITEM;\n  groupId: number;\n  imageSrc: string | null; // URL?\n  statusImageSrc: string | null;\n  showStatistics: boolean;\n  html?: string | null;\n} & ItemProps &\n  LinkedVisualConsoleProps;\n\nfunction extractHtml(data: UnknownObject): string | null {\n  if (!stringIsEmpty(data.html)) return data.html;\n  if (!stringIsEmpty(data.encodedHtml)) return decodeBase64(data.encodedHtml);\n  return null;\n}\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the group props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function groupPropsDecoder(data: UnknownObject): GroupProps | never {\n  if (\n    (typeof data.imageSrc !== \"string\" || data.imageSrc.length === 0) &&\n    data.encodedHtml === null\n  ) {\n    throw new TypeError(\"invalid image src.\");\n  }\n  if (parseIntOr(data.groupId, null) === null) {\n    throw new TypeError(\"invalid group Id.\");\n  }\n\n  const showStatistics = parseBoolean(data.showStatistics);\n  const html = showStatistics ? extractHtml(data) : null;\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.GROUP_ITEM,\n    groupId: parseInt(data.groupId),\n    imageSrc: notEmptyStringOr(data.imageSrc, null),\n    statusImageSrc: notEmptyStringOr(data.statusImageSrc, null),\n    showStatistics,\n    html,\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class Group extends Item<GroupProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"group\";\n\n    if (!this.props.showStatistics && this.props.statusImageSrc !== null) {\n      // Icon with status.\n      element.style.background = `url(${this.props.statusImageSrc}) no-repeat`;\n      element.style.backgroundSize = \"contain\";\n      element.style.backgroundPosition = \"center\";\n    } else if (this.props.showStatistics && this.props.html != null) {\n      // Stats table.\n      element.innerHTML = this.props.html;\n    }\n\n    return element;\n  }\n}\n","import \"./styles.css\";\n\nimport { LinkedVisualConsoleProps, UnknownObject, Size } from \"../../types\";\nimport {\n  linkedVCPropsDecoder,\n  parseIntOr,\n  parseBoolean,\n  prefixedCssRules,\n  notEmptyStringOr,\n  humanDate,\n  humanTime\n} from \"../../lib\";\nimport Item, { ItemProps, itemBasePropsDecoder, ItemType } from \"../../Item\";\n\nexport type ClockProps = {\n  type: ItemType.CLOCK;\n  clockType: \"analogic\" | \"digital\";\n  clockFormat: \"datetime\" | \"time\";\n  clockTimezone: string;\n  clockTimezoneOffset: number; // Offset of the timezone to UTC in seconds.\n  showClockTimezone: boolean;\n  color?: string | null;\n} & ItemProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Extract a valid enum value from a raw unknown value.\n * @param clockType Raw value.\n */\nconst parseClockType = (clockType: unknown): ClockProps[\"clockType\"] => {\n  switch (clockType) {\n    case \"analogic\":\n    case \"digital\":\n      return clockType;\n    default:\n      return \"analogic\";\n  }\n};\n\n/**\n * Extract a valid enum value from a raw unknown value.\n * @param clockFormat Raw value.\n */\nconst parseClockFormat = (clockFormat: unknown): ClockProps[\"clockFormat\"] => {\n  switch (clockFormat) {\n    case \"datetime\":\n    case \"time\":\n      return clockFormat;\n    default:\n      return \"datetime\";\n  }\n};\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the clock props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function clockPropsDecoder(data: UnknownObject): ClockProps | never {\n  if (\n    typeof data.clockTimezone !== \"string\" ||\n    data.clockTimezone.length === 0\n  ) {\n    throw new TypeError(\"invalid timezone.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.CLOCK,\n    clockType: parseClockType(data.clockType),\n    clockFormat: parseClockFormat(data.clockFormat),\n    clockTimezone: data.clockTimezone,\n    clockTimezoneOffset: parseIntOr(data.clockTimezoneOffset, 0),\n    showClockTimezone: parseBoolean(data.showClockTimezone),\n    color: notEmptyStringOr(data.color, null),\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class Clock extends Item<ClockProps> {\n  public static readonly TICK_INTERVAL = 1000; // In ms.\n  private intervalRef: number | null = null;\n\n  public constructor(props: ClockProps) {\n    // Call the superclass constructor.\n    super(props);\n\n    /* The item is already loaded and inserted into the DOM.\n     * The class properties are now initialized.\n     * Now you can modify the item, add event handlers, timers, etc.\n     */\n\n    /* The use of the arrow function is important here. startTick will\n     * use the function passed as an argument to call the global setInterval\n     * function. The interval, timeout or event functions, among other, are\n     * called into another execution loop and using a different context.\n     * The arrow functions, unlike the classic functions, doesn't create\n     * their own context (this), so their context at execution time will be\n     * use the current context at the declaration time.\n     * http://es6-features.org/#Lexicalthis\n     */\n    this.startTick(\n      () => {\n        // Replace the old element with the updated date.\n        this.childElementRef.innerHTML = this.createClock().innerHTML;\n      },\n      /* The analogic clock doesn't need to tick,\n       * but it will be refreshed every 20 seconds\n       * to avoid a desync caused by page freezes.\n       */\n      this.props.clockType === \"analogic\" ? 20000 : Clock.TICK_INTERVAL\n    );\n  }\n\n  /**\n   * Wrap a window.clearInterval call.\n   */\n  private stopTick(): void {\n    if (this.intervalRef !== null) {\n      window.clearInterval(this.intervalRef);\n      this.intervalRef = null;\n    }\n  }\n\n  /**\n   * Wrap a window.setInterval call.\n   * @param handler Function to be called every time the interval\n   * timer is reached.\n   * @param interval Number in milliseconds for the interval timer.\n   */\n  private startTick(\n    handler: TimerHandler,\n    interval: number = Clock.TICK_INTERVAL\n  ): void {\n    this.stopTick();\n    this.intervalRef = window.setInterval(handler, interval);\n  }\n\n  /**\n   * Create a element which contains the DOM representation of the item.\n   * @return DOM Element.\n   * @override\n   */\n  protected createDomElement(): HTMLElement | never {\n    return this.createClock();\n  }\n\n  /**\n   * To remove the event listeners and the elements from the DOM.\n   * @override\n   */\n  public remove(): void {\n    // Clear the interval.\n    this.stopTick();\n    // Call to the parent clean function.\n    super.remove();\n  }\n\n  /**\n   * @override Item.resizeElement\n   * Resize the DOM content container.\n   * @param width\n   * @param height\n   */\n  protected resizeElement(width: number, height: number): void {\n    const { width: newWidth, height: newHeight } = this.getElementSize(\n      width,\n      height\n    ); // Destructuring assigment: http://es6-features.org/#ObjectMatchingShorthandNotation\n    super.resizeElement(newWidth, newHeight);\n    // Re-render the item to force it calculate a new font size.\n    if (this.props.clockType === \"digital\") {\n      // Replace the old element with the updated date.\n      this.childElementRef.innerHTML = this.createClock().innerHTML;\n    }\n  }\n\n  /**\n   * Create a element which contains a representation of a clock.\n   * It choose between the clock types.\n   * @return DOM Element.\n   * @throws Error.\n   */\n  private createClock(): HTMLElement | never {\n    switch (this.props.clockType) {\n      case \"analogic\":\n        return this.createAnalogicClock();\n      case \"digital\":\n        return this.createDigitalClock();\n      default:\n        throw new Error(\"invalid clock type.\");\n    }\n  }\n\n  /**\n   * Create a element which contains a representation of an analogic clock.\n   * @return DOM Element.\n   */\n  private createAnalogicClock(): HTMLElement {\n    const svgNS = \"http://www.w3.org/2000/svg\";\n    const colors = {\n      watchFace: \"#FFFFF0\",\n      watchFaceBorder: \"#242124\",\n      mark: \"#242124\",\n      handDark: \"#242124\",\n      handLight: \"#525252\",\n      secondHand: \"#DC143C\"\n    };\n\n    const { width, height } = this.getElementSize(); // Destructuring assigment: http://es6-features.org/#ObjectMatchingShorthandNotation\n\n    // Calculate font size to adapt the font to the item size.\n    const baseTimeFontSize = 20; // Per 100px of width.\n    const dateFontSizeMultiplier = 0.5;\n    const dateFontSize =\n      (baseTimeFontSize * dateFontSizeMultiplier * width) / 100;\n\n    const div = document.createElement(\"div\");\n    div.className = \"analogic-clock\";\n    div.style.width = `${width}px`;\n    div.style.height = `${height}px`;\n\n    // SVG container.\n    const svg = document.createElementNS(svgNS, \"svg\");\n    // Auto resize SVG using the view box magic: https://css-tricks.com/scale-svg/\n    svg.setAttribute(\"viewBox\", \"0 0 100 100\");\n\n    // Clock face.\n    const clockFace = document.createElementNS(svgNS, \"g\");\n    clockFace.setAttribute(\"class\", \"clockface\");\n    const clockFaceBackground = document.createElementNS(svgNS, \"circle\");\n    clockFaceBackground.setAttribute(\"cx\", \"50\");\n    clockFaceBackground.setAttribute(\"cy\", \"50\");\n    clockFaceBackground.setAttribute(\"r\", \"48\");\n    clockFaceBackground.setAttribute(\"fill\", colors.watchFace);\n    clockFaceBackground.setAttribute(\"stroke\", colors.watchFaceBorder);\n    clockFaceBackground.setAttribute(\"stroke-width\", \"2\");\n    clockFaceBackground.setAttribute(\"stroke-linecap\", \"round\");\n    // Insert the clockface background into the clockface group.\n    clockFace.append(clockFaceBackground);\n\n    // Timezone complication.\n    const city = this.getHumanTimezone();\n    if (city.length > 0) {\n      const timezoneComplication = document.createElementNS(svgNS, \"text\");\n      timezoneComplication.setAttribute(\"text-anchor\", \"middle\");\n      timezoneComplication.setAttribute(\"font-size\", \"8\");\n      timezoneComplication.setAttribute(\n        \"transform\",\n        \"translate(30 50) rotate(90)\" // Rotate to counter the clock rotation.\n      );\n      timezoneComplication.setAttribute(\"fill\", colors.mark);\n      timezoneComplication.textContent = city;\n      clockFace.append(timezoneComplication);\n    }\n\n    // Marks group.\n    const marksGroup = document.createElementNS(svgNS, \"g\");\n    marksGroup.setAttribute(\"class\", \"marks\");\n    // Build the 12 hours mark.\n    const mainMarkGroup = document.createElementNS(svgNS, \"g\");\n    mainMarkGroup.setAttribute(\"class\", \"mark\");\n    mainMarkGroup.setAttribute(\"transform\", \"translate(50 50)\");\n    const mark1a = document.createElementNS(svgNS, \"line\");\n    mark1a.setAttribute(\"x1\", \"36\");\n    mark1a.setAttribute(\"y1\", \"0\");\n    mark1a.setAttribute(\"x2\", \"46\");\n    mark1a.setAttribute(\"y2\", \"0\");\n    mark1a.setAttribute(\"stroke\", colors.mark);\n    mark1a.setAttribute(\"stroke-width\", \"5\");\n    const mark1b = document.createElementNS(svgNS, \"line\");\n    mark1b.setAttribute(\"x1\", \"36\");\n    mark1b.setAttribute(\"y1\", \"0\");\n    mark1b.setAttribute(\"x2\", \"46\");\n    mark1b.setAttribute(\"y2\", \"0\");\n    mark1b.setAttribute(\"stroke\", colors.watchFace);\n    mark1b.setAttribute(\"stroke-width\", \"1\");\n    // Insert the 12 mark lines into their group.\n    mainMarkGroup.append(mark1a, mark1b);\n    // Insert the main mark into the marks group.\n    marksGroup.append(mainMarkGroup);\n    // Build the rest of the marks.\n    for (let i = 1; i < 60; i++) {\n      const mark = document.createElementNS(svgNS, \"line\");\n      mark.setAttribute(\"y1\", \"0\");\n      mark.setAttribute(\"y2\", \"0\");\n      mark.setAttribute(\"stroke\", colors.mark);\n      mark.setAttribute(\"transform\", `translate(50 50) rotate(${i * 6})`);\n\n      if (i % 5 === 0) {\n        mark.setAttribute(\"x1\", \"38\");\n        mark.setAttribute(\"x2\", \"46\");\n        mark.setAttribute(\"stroke-width\", i % 15 === 0 ? \"2\" : \"1\");\n      } else {\n        mark.setAttribute(\"x1\", \"42\");\n        mark.setAttribute(\"x2\", \"46\");\n        mark.setAttribute(\"stroke-width\", \"0.5\");\n      }\n\n      // Insert the mark into the marks group.\n      marksGroup.append(mark);\n    }\n\n    /* Clock hands */\n\n    // Hour hand.\n    const hourHand = document.createElementNS(svgNS, \"g\");\n    hourHand.setAttribute(\"class\", \"hour-hand\");\n    hourHand.setAttribute(\"transform\", \"translate(50 50)\");\n    // This will go back and will act like a border.\n    const hourHandA = document.createElementNS(svgNS, \"line\");\n    hourHandA.setAttribute(\"class\", \"hour-hand-a\");\n    hourHandA.setAttribute(\"x1\", \"0\");\n    hourHandA.setAttribute(\"y1\", \"0\");\n    hourHandA.setAttribute(\"x2\", \"30\");\n    hourHandA.setAttribute(\"y2\", \"0\");\n    hourHandA.setAttribute(\"stroke\", colors.handLight);\n    hourHandA.setAttribute(\"stroke-width\", \"4\");\n    hourHandA.setAttribute(\"stroke-linecap\", \"round\");\n    // This will go in front of the previous line.\n    const hourHandB = document.createElementNS(svgNS, \"line\");\n    hourHandB.setAttribute(\"class\", \"hour-hand-b\");\n    hourHandB.setAttribute(\"x1\", \"0\");\n    hourHandB.setAttribute(\"y1\", \"0\");\n    hourHandB.setAttribute(\"x2\", \"29.9\");\n    hourHandB.setAttribute(\"y2\", \"0\");\n    hourHandB.setAttribute(\"stroke\", colors.handDark);\n    hourHandB.setAttribute(\"stroke-width\", \"3.1\");\n    hourHandB.setAttribute(\"stroke-linecap\", \"round\");\n    // Append the elements to finish the hour hand.\n    hourHand.append(hourHandA, hourHandB);\n\n    // Minute hand.\n    const minuteHand = document.createElementNS(svgNS, \"g\");\n    minuteHand.setAttribute(\"class\", \"minute-hand\");\n    minuteHand.setAttribute(\"transform\", \"translate(50 50)\");\n    // This will go back and will act like a border.\n    const minuteHandA = document.createElementNS(svgNS, \"line\");\n    minuteHandA.setAttribute(\"class\", \"minute-hand-a\");\n    minuteHandA.setAttribute(\"x1\", \"0\");\n    minuteHandA.setAttribute(\"y1\", \"0\");\n    minuteHandA.setAttribute(\"x2\", \"40\");\n    minuteHandA.setAttribute(\"y2\", \"0\");\n    minuteHandA.setAttribute(\"stroke\", colors.handLight);\n    minuteHandA.setAttribute(\"stroke-width\", \"2\");\n    minuteHandA.setAttribute(\"stroke-linecap\", \"round\");\n    // This will go in front of the previous line.\n    const minuteHandB = document.createElementNS(svgNS, \"line\");\n    minuteHandB.setAttribute(\"class\", \"minute-hand-b\");\n    minuteHandB.setAttribute(\"x1\", \"0\");\n    minuteHandB.setAttribute(\"y1\", \"0\");\n    minuteHandB.setAttribute(\"x2\", \"39.9\");\n    minuteHandB.setAttribute(\"y2\", \"0\");\n    minuteHandB.setAttribute(\"stroke\", colors.handDark);\n    minuteHandB.setAttribute(\"stroke-width\", \"1.5\");\n    minuteHandB.setAttribute(\"stroke-linecap\", \"round\");\n    const minuteHandPin = document.createElementNS(svgNS, \"circle\");\n    minuteHandPin.setAttribute(\"r\", \"3\");\n    minuteHandPin.setAttribute(\"fill\", colors.handDark);\n    // Append the elements to finish the minute hand.\n    minuteHand.append(minuteHandA, minuteHandB, minuteHandPin);\n\n    // Second hand.\n    const secondHand = document.createElementNS(svgNS, \"g\");\n    secondHand.setAttribute(\"class\", \"second-hand\");\n    secondHand.setAttribute(\"transform\", \"translate(50 50)\");\n    const secondHandBar = document.createElementNS(svgNS, \"line\");\n    secondHandBar.setAttribute(\"x1\", \"0\");\n    secondHandBar.setAttribute(\"y1\", \"0\");\n    secondHandBar.setAttribute(\"x2\", \"46\");\n    secondHandBar.setAttribute(\"y2\", \"0\");\n    secondHandBar.setAttribute(\"stroke\", colors.secondHand);\n    secondHandBar.setAttribute(\"stroke-width\", \"1\");\n    secondHandBar.setAttribute(\"stroke-linecap\", \"round\");\n    const secondHandPin = document.createElementNS(svgNS, \"circle\");\n    secondHandPin.setAttribute(\"r\", \"2\");\n    secondHandPin.setAttribute(\"fill\", colors.secondHand);\n    // Append the elements to finish the second hand.\n    secondHand.append(secondHandBar, secondHandPin);\n\n    // Pin.\n    const pin = document.createElementNS(svgNS, \"circle\");\n    pin.setAttribute(\"cx\", \"50\");\n    pin.setAttribute(\"cy\", \"50\");\n    pin.setAttribute(\"r\", \"0.3\");\n    pin.setAttribute(\"fill\", colors.handDark);\n\n    // Get the hand angles.\n    const date = this.getOriginDate();\n    const seconds = date.getSeconds();\n    const minutes = date.getMinutes();\n    const hours = date.getHours();\n    const secAngle = (360 / 60) * seconds;\n    const minuteAngle = (360 / 60) * minutes + (360 / 60) * (seconds / 60);\n    const hourAngle = (360 / 12) * hours + (360 / 12) * (minutes / 60);\n    // Set the clock time by moving the hands.\n    hourHand.setAttribute(\"transform\", `translate(50 50) rotate(${hourAngle})`);\n    minuteHand.setAttribute(\n      \"transform\",\n      `translate(50 50) rotate(${minuteAngle})`\n    );\n    secondHand.setAttribute(\n      \"transform\",\n      `translate(50 50) rotate(${secAngle})`\n    );\n\n    // Build the clock\n    svg.append(clockFace, marksGroup, hourHand, minuteHand, secondHand, pin);\n    // Rotate the clock to its normal position.\n    svg.setAttribute(\"transform\", \"rotate(-90)\");\n\n    /* Add the animation declaration to the container.\n     * Since the animation keyframes need to know the\n     * start angle, this angle is dynamic (current time),\n     * and we can't edit keyframes through javascript\n     * safely and with backwards compatibility, we need\n     * to inject it.\n     */\n    div.innerHTML = `\n      <style>\n        @keyframes rotate-hour {\n          from {\n            ${prefixedCssRules(\n              \"transform\",\n              `translate(50px, 50px) rotate(${hourAngle}deg)`\n            ).join(\"\\n\")}\n          }\n          to {\n            ${prefixedCssRules(\n              \"transform\",\n              `translate(50px, 50px) rotate(${hourAngle + 360}deg)`\n            ).join(\"\\n\")}\n          }\n        }\n        @keyframes rotate-minute {\n          from {\n            ${prefixedCssRules(\n              \"transform\",\n              `translate(50px, 50px) rotate(${minuteAngle}deg)`\n            ).join(\"\\n\")}\n          }\n          to {\n            ${prefixedCssRules(\n              \"transform\",\n              `translate(50px, 50px) rotate(${minuteAngle + 360}deg)`\n            ).join(\"\\n\")}\n          }\n        }\n        @keyframes rotate-second {\n          from {\n            ${prefixedCssRules(\n              \"transform\",\n              `translate(50px, 50px) rotate(${secAngle}deg)`\n            ).join(\"\\n\")}\n          }\n          to {\n            ${prefixedCssRules(\n              \"transform\",\n              `translate(50px, 50px) rotate(${secAngle + 360}deg)`\n            ).join(\"\\n\")}\n          }\n        }\n      </style>\n    `;\n    // Add the clock to the container\n    div.append(svg);\n\n    // Date.\n    if (this.props.clockFormat === \"datetime\") {\n      const dateElem: HTMLSpanElement = document.createElement(\"span\");\n      dateElem.className = \"date\";\n      dateElem.textContent = humanDate(date, \"default\");\n      dateElem.style.fontSize = `${dateFontSize}px`;\n      if (this.props.color) dateElem.style.color = this.props.color;\n      div.append(dateElem);\n    }\n\n    return div;\n  }\n\n  /**\n   * Create a element which contains a representation of a digital clock.\n   * @return DOM Element.\n   */\n  private createDigitalClock(): HTMLElement {\n    const element: HTMLDivElement = document.createElement(\"div\");\n    element.className = \"digital-clock\";\n\n    const { width } = this.getElementSize(); // Destructuring assigment: http://es6-features.org/#ObjectMatchingShorthandNotation\n\n    // Calculate font size to adapt the font to the item size.\n    const baseTimeFontSize = 20; // Per 100px of width.\n    const dateFontSizeMultiplier = 0.5;\n    const tzFontSizeMultiplier = 6 / this.props.clockTimezone.length;\n    const timeFontSize = (baseTimeFontSize * width) / 100;\n    const dateFontSize =\n      (baseTimeFontSize * dateFontSizeMultiplier * width) / 100;\n    const tzFontSize = Math.min(\n      (baseTimeFontSize * tzFontSizeMultiplier * width) / 100,\n      (width / 100) * 10\n    );\n\n    // Date calculated using the original timezone.\n    const date = this.getOriginDate();\n\n    // Date.\n    if (this.props.clockFormat === \"datetime\") {\n      const dateElem: HTMLSpanElement = document.createElement(\"span\");\n      dateElem.className = \"date\";\n      dateElem.textContent = humanDate(date, \"default\");\n      dateElem.style.fontSize = `${dateFontSize}px`;\n      if (this.props.color) dateElem.style.color = this.props.color;\n      element.append(dateElem);\n    }\n\n    // Time.\n    const timeElem: HTMLSpanElement = document.createElement(\"span\");\n    timeElem.className = \"time\";\n    timeElem.textContent = humanTime(date);\n    timeElem.style.fontSize = `${timeFontSize}px`;\n    if (this.props.color) timeElem.style.color = this.props.color;\n    element.append(timeElem);\n\n    // City name.\n    const city = this.getHumanTimezone();\n    if (city.length > 0) {\n      const tzElem: HTMLSpanElement = document.createElement(\"span\");\n      tzElem.className = \"timezone\";\n      tzElem.textContent = city;\n      tzElem.style.fontSize = `${tzFontSize}px`;\n      if (this.props.color) tzElem.style.color = this.props.color;\n      element.append(tzElem);\n    }\n\n    return element;\n  }\n\n  /**\n   * Generate the current date using the timezone offset stored into the properties.\n   * @return The current date.\n   */\n  private getOriginDate(initialDate: Date | null = null): Date {\n    const d = initialDate ? initialDate : new Date();\n    const targetTZOffset = this.props.clockTimezoneOffset * 1000; // In ms.\n    const localTZOffset = d.getTimezoneOffset() * 60 * 1000; // In ms.\n    const utimestamp = d.getTime() + targetTZOffset + localTZOffset;\n\n    return new Date(utimestamp);\n  }\n\n  /**\n   * Extract a human readable city name from the timezone text.\n   * @param timezone Timezone text.\n   */\n  public getHumanTimezone(timezone: string = this.props.clockTimezone): string {\n    const [, city = \"\"] = timezone.split(\"/\");\n    return city.replace(\"_\", \" \");\n  }\n\n  /**\n   * Generate a element size using the current size and the default values.\n   * @return The size.\n   */\n  private getElementSize(\n    width: number = this.props.width,\n    height: number = this.props.height\n  ): Size {\n    switch (this.props.clockType) {\n      case \"analogic\": {\n        let diameter = 100; // Default value.\n\n        if (width > 0 && height > 0) {\n          diameter = Math.min(width, height);\n        } else if (width > 0) {\n          diameter = width;\n        } else if (height > 0) {\n          diameter = height;\n        }\n\n        return {\n          width: diameter,\n          height: diameter\n        };\n      }\n      case \"digital\": {\n        if (width > 0 && height > 0) {\n          // The proportion of the clock should be (width = height / 2) aproximately.\n          height = width / 2 < height ? width / 2 : height;\n        } else if (width > 0) {\n          height = width / 2;\n        } else if (height > 0) {\n          // The proportion of the clock should be (height * 2 = width) aproximately.\n          width = height * 2;\n        } else {\n          width = 100; // Default value.\n          height = 50; // Default value.\n        }\n\n        return {\n          width,\n          height\n        };\n      }\n      default:\n        throw new Error(\"invalid clock type.\");\n    }\n  }\n}\n","import { UnknownObject } from \"../types\";\nimport { parseIntOr, notEmptyStringOr } from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\ninterface BoxProps extends ItemProps {\n  // Overrided properties.\n  readonly type: ItemType.BOX_ITEM;\n  label: null;\n  isLinkEnabled: false;\n  parentId: null;\n  aclGroupId: null;\n  // Custom properties.\n  borderWidth: number;\n  borderColor: string | null;\n  fillColor: string | null;\n}\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the item props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function boxPropsDecoder(data: UnknownObject): BoxProps | never {\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.BOX_ITEM,\n    label: null,\n    isLinkEnabled: false,\n    parentId: null,\n    aclGroupId: null,\n    // Custom properties.\n    borderWidth: parseIntOr(data.borderWidth, 0),\n    borderColor: notEmptyStringOr(data.borderColor, null),\n    fillColor: notEmptyStringOr(data.fillColor, null)\n  };\n}\n\nexport default class Box extends Item<BoxProps> {\n  protected createDomElement(): HTMLElement {\n    const box: HTMLDivElement = document.createElement(\"div\");\n    box.className = \"box\";\n    // To prevent this item to expand beyond its parent.\n    box.style.boxSizing = \"border-box\";\n\n    if (this.props.fillColor) {\n      box.style.backgroundColor = this.props.fillColor;\n    }\n\n    // Border.\n    if (this.props.borderWidth > 0) {\n      box.style.borderStyle = \"solid\";\n      // Control the max width to prevent this item to expand beyond its parent.\n      const maxBorderWidth = Math.min(this.props.width, this.props.height) / 2;\n      const borderWidth = Math.min(this.props.borderWidth, maxBorderWidth);\n      box.style.borderWidth = `${borderWidth}px`;\n\n      if (this.props.borderColor) {\n        box.style.borderColor = this.props.borderColor;\n      }\n    }\n\n    return box;\n  }\n}\n","import { UnknownObject, Position, Size } from \"../types\";\nimport { parseIntOr, notEmptyStringOr } from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\ninterface LineProps extends ItemProps {\n  // Overrided properties.\n  readonly type: ItemType.LINE_ITEM;\n  label: null;\n  isLinkEnabled: false;\n  parentId: null;\n  aclGroupId: null;\n  // Custom properties.\n  startPosition: Position;\n  endPosition: Position;\n  lineWidth: number;\n  color: string | null;\n}\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the item props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function linePropsDecoder(data: UnknownObject): LineProps | never {\n  const props: LineProps = {\n    ...itemBasePropsDecoder({ ...data, width: 1, height: 1 }), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.LINE_ITEM,\n    label: null,\n    isLinkEnabled: false,\n    parentId: null,\n    aclGroupId: null,\n    // Initialize Position & Size.\n    x: 0,\n    y: 0,\n    width: 0,\n    height: 0,\n    // Custom properties.\n    startPosition: {\n      x: parseIntOr(data.startX, 0),\n      y: parseIntOr(data.startY, 0)\n    },\n    endPosition: {\n      x: parseIntOr(data.endX, 0),\n      y: parseIntOr(data.endY, 0)\n    },\n    lineWidth: parseIntOr(data.lineWidth || data.borderWidth, 1),\n    color: notEmptyStringOr(data.borderColor || data.color, null)\n  };\n\n  /*\n   * We need to enhance the props with the extracted size and position\n   * of the box cause there are missing at the props update. A better\n   * solution would be overriding the props setter to do it there, but\n   * the language doesn't allow it while targetting ES5.\n   * TODO: We need to figure out a more consistent solution.\n   */\n\n  return {\n    ...props,\n    // Enhance the props extracting the box size and position.\n    // eslint-disable-next-line @typescript-eslint/no-use-before-define\n    ...Line.extractBoxSizeAndPosition(props)\n  };\n}\n\nexport default class Line extends Item<LineProps> {\n  /**\n   * @override\n   */\n  public constructor(props: LineProps) {\n    /*\n     * We need to override the constructor cause we need to obtain\n     * the\n     * box size and position from the start and finish points\n     * of the line.\n     */\n    super({\n      ...props,\n      ...Line.extractBoxSizeAndPosition(props)\n    });\n  }\n\n  /**\n   * @override\n   * To create the item's DOM representation.\n   * @return Item.\n   */\n  protected createDomElement(): HTMLElement {\n    const element: HTMLDivElement = document.createElement(\"div\");\n    element.className = \"line\";\n\n    const svgNS = \"http://www.w3.org/2000/svg\";\n    // SVG container.\n    const svg = document.createElementNS(svgNS, \"svg\");\n    // Set SVG size.\n    svg.setAttribute(\n      \"width\",\n      (this.props.width + this.props.lineWidth).toString()\n    );\n    svg.setAttribute(\n      \"height\",\n      (this.props.height + this.props.lineWidth).toString()\n    );\n    const line = document.createElementNS(svgNS, \"line\");\n    line.setAttribute(\n      \"x1\",\n      `${this.props.startPosition.x - this.props.x + this.props.lineWidth / 2}`\n    );\n    line.setAttribute(\n      \"y1\",\n      `${this.props.startPosition.y - this.props.y + this.props.lineWidth / 2}`\n    );\n    line.setAttribute(\n      \"x2\",\n      `${this.props.endPosition.x - this.props.x + this.props.lineWidth / 2}`\n    );\n    line.setAttribute(\n      \"y2\",\n      `${this.props.endPosition.y - this.props.y + this.props.lineWidth / 2}`\n    );\n    line.setAttribute(\"stroke\", this.props.color || \"black\");\n    line.setAttribute(\"stroke-width\", this.props.lineWidth.toString());\n\n    svg.append(line);\n    element.append(svg);\n\n    return element;\n  }\n\n  /**\n   * Extract the size and position of the box from\n   * the start and the finish of the line.\n   * @param props Item properties.\n   */\n  public static extractBoxSizeAndPosition(props: LineProps): Size & Position {\n    return {\n      width: Math.abs(props.startPosition.x - props.endPosition.x),\n      height: Math.abs(props.startPosition.y - props.endPosition.y),\n      x: Math.min(props.startPosition.x, props.endPosition.x),\n      y: Math.min(props.startPosition.y, props.endPosition.y)\n    };\n  }\n}\n","import { LinkedVisualConsoleProps, UnknownObject } from \"../types\";\nimport { linkedVCPropsDecoder } from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type LabelProps = {\n  type: ItemType.LABEL;\n} & ItemProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the label props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function labelPropsDecoder(data: UnknownObject): LabelProps | never {\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.LABEL,\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class Label extends Item<LabelProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"label\";\n    element.innerHTML = this.getLabelWithMacrosReplaced();\n\n    return element;\n  }\n\n  /**\n   * @override Item.createLabelDomElement\n   * Create a new label for the visual console item.\n   * @return Item label.\n   */\n  public createLabelDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"visual-console-item-label\";\n    // Always return an empty label.\n    return element;\n  }\n}\n","import {\n  LinkedVisualConsoleProps,\n  UnknownObject,\n  WithModuleProps\n} from \"../types\";\nimport {\n  linkedVCPropsDecoder,\n  parseIntOr,\n  modulePropsDecoder,\n  replaceMacros\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type SimpleValueProps = {\n  type: ItemType.SIMPLE_VALUE;\n  valueType: \"string\" | \"image\";\n  value: string;\n} & (\n  | {\n      processValue: \"none\";\n    }\n  | {\n      processValue: \"avg\" | \"max\" | \"min\";\n      period: number;\n    }) &\n  ItemProps &\n  WithModuleProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Extract a valid enum value from a raw value type.\n * @param valueType Raw value.\n */\nconst parseValueType = (valueType: unknown): SimpleValueProps[\"valueType\"] => {\n  switch (valueType) {\n    case \"string\":\n    case \"image\":\n      return valueType;\n    default:\n      return \"string\";\n  }\n};\n\n/**\n * Extract a valid enum value from a raw process value.\n * @param processValue Raw value.\n */\nconst parseProcessValue = (\n  processValue: unknown\n): SimpleValueProps[\"processValue\"] => {\n  switch (processValue) {\n    case \"none\":\n    case \"avg\":\n    case \"max\":\n    case \"min\":\n      return processValue;\n    default:\n      return \"none\";\n  }\n};\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the simple value props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function simpleValuePropsDecoder(\n  data: UnknownObject\n): SimpleValueProps | never {\n  if (typeof data.value !== \"string\" || data.value.length === 0) {\n    throw new TypeError(\"invalid value\");\n  }\n\n  const processValue = parseProcessValue(data.processValue);\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.SIMPLE_VALUE,\n    valueType: parseValueType(data.valueType),\n    value: data.value,\n    ...(processValue === \"none\"\n      ? { processValue }\n      : { processValue, period: parseIntOr(data.period, 0) }), // Object spread. It will merge the properties of the two objects.\n    ...modulePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class SimpleValue extends Item<SimpleValueProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"simple-value\";\n\n    if (this.props.valueType === \"image\") {\n      const img = document.createElement(\"img\");\n      img.src = this.props.value;\n      element.append(img);\n    } else {\n      // Add the value to the label and show it.\n      let text = this.props.value;\n      let label = this.getLabelWithMacrosReplaced();\n      if (label.length > 0) {\n        text = replaceMacros([{ macro: /\\(?_VALUE_\\)?/i, value: text }], label);\n      }\n\n      element.innerHTML = text;\n    }\n\n    return element;\n  }\n\n  /**\n   * @override Item.createLabelDomElement\n   * Create a new label for the visual console item.\n   * @return Item label.\n   */\n  protected createLabelDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"visual-console-item-label\";\n    // Always return an empty label.\n    return element;\n  }\n}\n","var pi = Math.PI,\n    tau = 2 * pi,\n    epsilon = 1e-6,\n    tauEpsilon = tau - epsilon;\n\nfunction Path() {\n  this._x0 = this._y0 = // start of current subpath\n  this._x1 = this._y1 = null; // end of current subpath\n  this._ = \"\";\n}\n\nfunction path() {\n  return new Path;\n}\n\nPath.prototype = path.prototype = {\n  constructor: Path,\n  moveTo: function(x, y) {\n    this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y);\n  },\n  closePath: function() {\n    if (this._x1 !== null) {\n      this._x1 = this._x0, this._y1 = this._y0;\n      this._ += \"Z\";\n    }\n  },\n  lineTo: function(x, y) {\n    this._ += \"L\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n  },\n  quadraticCurveTo: function(x1, y1, x, y) {\n    this._ += \"Q\" + (+x1) + \",\" + (+y1) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n  },\n  bezierCurveTo: function(x1, y1, x2, y2, x, y) {\n    this._ += \"C\" + (+x1) + \",\" + (+y1) + \",\" + (+x2) + \",\" + (+y2) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n  },\n  arcTo: function(x1, y1, x2, y2, r) {\n    x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n    var x0 = this._x1,\n        y0 = this._y1,\n        x21 = x2 - x1,\n        y21 = y2 - y1,\n        x01 = x0 - x1,\n        y01 = y0 - y1,\n        l01_2 = x01 * x01 + y01 * y01;\n\n    // Is the radius negative? Error.\n    if (r < 0) throw new Error(\"negative radius: \" + r);\n\n    // Is this path empty? Move to (x1,y1).\n    if (this._x1 === null) {\n      this._ += \"M\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n    }\n\n    // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n    else if (!(l01_2 > epsilon));\n\n    // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n    // Equivalently, is (x1,y1) coincident with (x2,y2)?\n    // Or, is the radius zero? Line to (x1,y1).\n    else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n      this._ += \"L\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n    }\n\n    // Otherwise, draw an arc!\n    else {\n      var x20 = x2 - x0,\n          y20 = y2 - y0,\n          l21_2 = x21 * x21 + y21 * y21,\n          l20_2 = x20 * x20 + y20 * y20,\n          l21 = Math.sqrt(l21_2),\n          l01 = Math.sqrt(l01_2),\n          l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n          t01 = l / l01,\n          t21 = l / l21;\n\n      // If the start tangent is not coincident with (x0,y0), line to.\n      if (Math.abs(t01 - 1) > epsilon) {\n        this._ += \"L\" + (x1 + t01 * x01) + \",\" + (y1 + t01 * y01);\n      }\n\n      this._ += \"A\" + r + \",\" + r + \",0,0,\" + (+(y01 * x20 > x01 * y20)) + \",\" + (this._x1 = x1 + t21 * x21) + \",\" + (this._y1 = y1 + t21 * y21);\n    }\n  },\n  arc: function(x, y, r, a0, a1, ccw) {\n    x = +x, y = +y, r = +r;\n    var dx = r * Math.cos(a0),\n        dy = r * Math.sin(a0),\n        x0 = x + dx,\n        y0 = y + dy,\n        cw = 1 ^ ccw,\n        da = ccw ? a0 - a1 : a1 - a0;\n\n    // Is the radius negative? Error.\n    if (r < 0) throw new Error(\"negative radius: \" + r);\n\n    // Is this path empty? Move to (x0,y0).\n    if (this._x1 === null) {\n      this._ += \"M\" + x0 + \",\" + y0;\n    }\n\n    // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n    else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n      this._ += \"L\" + x0 + \",\" + y0;\n    }\n\n    // Is this arc empty? We’re done.\n    if (!r) return;\n\n    // Does the angle go the wrong way? Flip the direction.\n    if (da < 0) da = da % tau + tau;\n\n    // Is this a complete circle? Draw two arcs to complete the circle.\n    if (da > tauEpsilon) {\n      this._ += \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (x - dx) + \",\" + (y - dy) + \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (this._x1 = x0) + \",\" + (this._y1 = y0);\n    }\n\n    // Is this arc non-empty? Draw an arc!\n    else if (da > epsilon) {\n      this._ += \"A\" + r + \",\" + r + \",0,\" + (+(da >= pi)) + \",\" + cw + \",\" + (this._x1 = x + r * Math.cos(a1)) + \",\" + (this._y1 = y + r * Math.sin(a1));\n    }\n  },\n  rect: function(x, y, w, h) {\n    this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y) + \"h\" + (+w) + \"v\" + (+h) + \"h\" + (-w) + \"Z\";\n  },\n  toString: function() {\n    return this._;\n  }\n};\n\nexport default path;\n","export default function(x) {\n  return function constant() {\n    return x;\n  };\n}\n","export var abs = Math.abs;\nexport var atan2 = Math.atan2;\nexport var cos = Math.cos;\nexport var max = Math.max;\nexport var min = Math.min;\nexport var sin = Math.sin;\nexport var sqrt = Math.sqrt;\n\nexport var epsilon = 1e-12;\nexport var pi = Math.PI;\nexport var halfPi = pi / 2;\nexport var tau = 2 * pi;\n\nexport function acos(x) {\n  return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n  return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","import {path} from \"d3-path\";\nimport constant from \"./constant\";\nimport {abs, acos, asin, atan2, cos, epsilon, halfPi, max, min, pi, sin, sqrt, tau} from \"./math\";\n\nfunction arcInnerRadius(d) {\n  return d.innerRadius;\n}\n\nfunction arcOuterRadius(d) {\n  return d.outerRadius;\n}\n\nfunction arcStartAngle(d) {\n  return d.startAngle;\n}\n\nfunction arcEndAngle(d) {\n  return d.endAngle;\n}\n\nfunction arcPadAngle(d) {\n  return d && d.padAngle; // Note: optional!\n}\n\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n  var x10 = x1 - x0, y10 = y1 - y0,\n      x32 = x3 - x2, y32 = y3 - y2,\n      t = y32 * x10 - x32 * y10;\n  if (t * t < epsilon) return;\n  t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;\n  return [x0 + t * x10, y0 + t * y10];\n}\n\n// Compute perpendicular offset line of length rc.\n// http://mathworld.wolfram.com/Circle-LineIntersection.html\nfunction cornerTangents(x0, y0, x1, y1, r1, rc, cw) {\n  var x01 = x0 - x1,\n      y01 = y0 - y1,\n      lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),\n      ox = lo * y01,\n      oy = -lo * x01,\n      x11 = x0 + ox,\n      y11 = y0 + oy,\n      x10 = x1 + ox,\n      y10 = y1 + oy,\n      x00 = (x11 + x10) / 2,\n      y00 = (y11 + y10) / 2,\n      dx = x10 - x11,\n      dy = y10 - y11,\n      d2 = dx * dx + dy * dy,\n      r = r1 - rc,\n      D = x11 * y10 - x10 * y11,\n      d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),\n      cx0 = (D * dy - dx * d) / d2,\n      cy0 = (-D * dx - dy * d) / d2,\n      cx1 = (D * dy + dx * d) / d2,\n      cy1 = (-D * dx + dy * d) / d2,\n      dx0 = cx0 - x00,\n      dy0 = cy0 - y00,\n      dx1 = cx1 - x00,\n      dy1 = cy1 - y00;\n\n  // Pick the closer of the two intersection points.\n  // TODO Is there a faster way to determine which intersection to use?\n  if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n\n  return {\n    cx: cx0,\n    cy: cy0,\n    x01: -ox,\n    y01: -oy,\n    x11: cx0 * (r1 / r - 1),\n    y11: cy0 * (r1 / r - 1)\n  };\n}\n\nexport default function() {\n  var innerRadius = arcInnerRadius,\n      outerRadius = arcOuterRadius,\n      cornerRadius = constant(0),\n      padRadius = null,\n      startAngle = arcStartAngle,\n      endAngle = arcEndAngle,\n      padAngle = arcPadAngle,\n      context = null;\n\n  function arc() {\n    var buffer,\n        r,\n        r0 = +innerRadius.apply(this, arguments),\n        r1 = +outerRadius.apply(this, arguments),\n        a0 = startAngle.apply(this, arguments) - halfPi,\n        a1 = endAngle.apply(this, arguments) - halfPi,\n        da = abs(a1 - a0),\n        cw = a1 > a0;\n\n    if (!context) context = buffer = path();\n\n    // Ensure that the outer radius is always larger than the inner radius.\n    if (r1 < r0) r = r1, r1 = r0, r0 = r;\n\n    // Is it a point?\n    if (!(r1 > epsilon)) context.moveTo(0, 0);\n\n    // Or is it a circle or annulus?\n    else if (da > tau - epsilon) {\n      context.moveTo(r1 * cos(a0), r1 * sin(a0));\n      context.arc(0, 0, r1, a0, a1, !cw);\n      if (r0 > epsilon) {\n        context.moveTo(r0 * cos(a1), r0 * sin(a1));\n        context.arc(0, 0, r0, a1, a0, cw);\n      }\n    }\n\n    // Or is it a circular or annular sector?\n    else {\n      var a01 = a0,\n          a11 = a1,\n          a00 = a0,\n          a10 = a1,\n          da0 = da,\n          da1 = da,\n          ap = padAngle.apply(this, arguments) / 2,\n          rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),\n          rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),\n          rc0 = rc,\n          rc1 = rc,\n          t0,\n          t1;\n\n      // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.\n      if (rp > epsilon) {\n        var p0 = asin(rp / r0 * sin(ap)),\n            p1 = asin(rp / r1 * sin(ap));\n        if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;\n        else da0 = 0, a00 = a10 = (a0 + a1) / 2;\n        if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;\n        else da1 = 0, a01 = a11 = (a0 + a1) / 2;\n      }\n\n      var x01 = r1 * cos(a01),\n          y01 = r1 * sin(a01),\n          x10 = r0 * cos(a10),\n          y10 = r0 * sin(a10);\n\n      // Apply rounded corners?\n      if (rc > epsilon) {\n        var x11 = r1 * cos(a11),\n            y11 = r1 * sin(a11),\n            x00 = r0 * cos(a00),\n            y00 = r0 * sin(a00),\n            oc;\n\n        // Restrict the corner radius according to the sector angle.\n        if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {\n          var ax = x01 - oc[0],\n              ay = y01 - oc[1],\n              bx = x11 - oc[0],\n              by = y11 - oc[1],\n              kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),\n              lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n          rc0 = min(rc, (r0 - lc) / (kc - 1));\n          rc1 = min(rc, (r1 - lc) / (kc + 1));\n        }\n      }\n\n      // Is the sector collapsed to a line?\n      if (!(da1 > epsilon)) context.moveTo(x01, y01);\n\n      // Does the sector’s outer ring have rounded corners?\n      else if (rc1 > epsilon) {\n        t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);\n        t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);\n\n        context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n        // Have the corners merged?\n        if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n        // Otherwise, draw the two corners and the ring.\n        else {\n          context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n          context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);\n          context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n        }\n      }\n\n      // Or is the outer ring just a circular arc?\n      else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);\n\n      // Is there no inner ring, and it’s a circular sector?\n      // Or perhaps it’s an annular sector collapsed due to padding?\n      if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);\n\n      // Does the sector’s inner ring (or point) have rounded corners?\n      else if (rc0 > epsilon) {\n        t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);\n        t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);\n\n        context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n        // Have the corners merged?\n        if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n        // Otherwise, draw the two corners and the ring.\n        else {\n          context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n          context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);\n          context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n        }\n      }\n\n      // Or is the inner ring just a circular arc?\n      else context.arc(0, 0, r0, a10, a00, cw);\n    }\n\n    context.closePath();\n\n    if (buffer) return context = null, buffer + \"\" || null;\n  }\n\n  arc.centroid = function() {\n    var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,\n        a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;\n    return [cos(a) * r, sin(a) * r];\n  };\n\n  arc.innerRadius = function(_) {\n    return arguments.length ? (innerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : innerRadius;\n  };\n\n  arc.outerRadius = function(_) {\n    return arguments.length ? (outerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : outerRadius;\n  };\n\n  arc.cornerRadius = function(_) {\n    return arguments.length ? (cornerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : cornerRadius;\n  };\n\n  arc.padRadius = function(_) {\n    return arguments.length ? (padRadius = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), arc) : padRadius;\n  };\n\n  arc.startAngle = function(_) {\n    return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : startAngle;\n  };\n\n  arc.endAngle = function(_) {\n    return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : endAngle;\n  };\n\n  arc.padAngle = function(_) {\n    return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : padAngle;\n  };\n\n  arc.context = function(_) {\n    return arguments.length ? ((context = _ == null ? null : _), arc) : context;\n  };\n\n  return arc;\n}\n","function Linear(context) {\n  this._context = context;\n}\n\nLinear.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n      case 1: this._point = 2; // proceed\n      default: this._context.lineTo(x, y); break;\n    }\n  }\n};\n\nexport default function(context) {\n  return new Linear(context);\n}\n","import curveLinear from \"./linear\";\n\nexport var curveRadialLinear = curveRadial(curveLinear);\n\nfunction Radial(curve) {\n  this._curve = curve;\n}\n\nRadial.prototype = {\n  areaStart: function() {\n    this._curve.areaStart();\n  },\n  areaEnd: function() {\n    this._curve.areaEnd();\n  },\n  lineStart: function() {\n    this._curve.lineStart();\n  },\n  lineEnd: function() {\n    this._curve.lineEnd();\n  },\n  point: function(a, r) {\n    this._curve.point(r * Math.sin(a), r * -Math.cos(a));\n  }\n};\n\nexport default function curveRadial(curve) {\n\n  function radial(context) {\n    return new Radial(curve(context));\n  }\n\n  radial._curve = curve;\n\n  return radial;\n}\n","export var slice = Array.prototype.slice;\n","var tan30 = Math.sqrt(1 / 3),\n    tan30_2 = tan30 * 2;\n\nexport default {\n  draw: function(context, size) {\n    var y = Math.sqrt(size / tan30_2),\n        x = y * tan30;\n    context.moveTo(0, -y);\n    context.lineTo(x, 0);\n    context.lineTo(0, y);\n    context.lineTo(-x, 0);\n    context.closePath();\n  }\n};\n","import {pi, tau} from \"../math\";\n\nexport default {\n  draw: function(context, size) {\n    var r = Math.sqrt(size / pi);\n    context.moveTo(r, 0);\n    context.arc(0, 0, r, 0, tau);\n  }\n};\n","import {pi, tau} from \"../math\";\n\nvar ka = 0.89081309152928522810,\n    kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10),\n    kx = Math.sin(tau / 10) * kr,\n    ky = -Math.cos(tau / 10) * kr;\n\nexport default {\n  draw: function(context, size) {\n    var r = Math.sqrt(size * ka),\n        x = kx * r,\n        y = ky * r;\n    context.moveTo(0, -r);\n    context.lineTo(x, y);\n    for (var i = 1; i < 5; ++i) {\n      var a = tau * i / 5,\n          c = Math.cos(a),\n          s = Math.sin(a);\n      context.lineTo(s * r, -c * r);\n      context.lineTo(c * x - s * y, s * x + c * y);\n    }\n    context.closePath();\n  }\n};\n","export default function() {}\n","var sqrt3 = Math.sqrt(3);\n\nexport default {\n  draw: function(context, size) {\n    var y = -Math.sqrt(size / (sqrt3 * 3));\n    context.moveTo(0, y * 2);\n    context.lineTo(-sqrt3 * y, -y);\n    context.lineTo(sqrt3 * y, -y);\n    context.closePath();\n  }\n};\n","var c = -0.5,\n    s = Math.sqrt(3) / 2,\n    k = 1 / Math.sqrt(12),\n    a = (k / 2 + 1) * 3;\n\nexport default {\n  draw: function(context, size) {\n    var r = Math.sqrt(size / a),\n        x0 = r / 2,\n        y0 = r * k,\n        x1 = x0,\n        y1 = r * k + r,\n        x2 = -x1,\n        y2 = y1;\n    context.moveTo(x0, y0);\n    context.lineTo(x1, y1);\n    context.lineTo(x2, y2);\n    context.lineTo(c * x0 - s * y0, s * x0 + c * y0);\n    context.lineTo(c * x1 - s * y1, s * x1 + c * y1);\n    context.lineTo(c * x2 - s * y2, s * x2 + c * y2);\n    context.lineTo(c * x0 + s * y0, c * y0 - s * x0);\n    context.lineTo(c * x1 + s * y1, c * y1 - s * x1);\n    context.lineTo(c * x2 + s * y2, c * y2 - s * x2);\n    context.closePath();\n  }\n};\n","export function point(that, x, y) {\n  that._context.bezierCurveTo(\n    (2 * that._x0 + that._x1) / 3,\n    (2 * that._y0 + that._y1) / 3,\n    (that._x0 + 2 * that._x1) / 3,\n    (that._y0 + 2 * that._y1) / 3,\n    (that._x0 + 4 * that._x1 + x) / 6,\n    (that._y0 + 4 * that._y1 + y) / 6\n  );\n}\n\nexport function Basis(context) {\n  this._context = context;\n}\n\nBasis.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 =\n    this._y0 = this._y1 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 3: point(this, this._x1, this._y1); // proceed\n      case 2: this._context.lineTo(this._x1, this._y1); break;\n    }\n    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n      case 1: this._point = 2; break;\n      case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed\n      default: point(this, x, y); break;\n    }\n    this._x0 = this._x1, this._x1 = x;\n    this._y0 = this._y1, this._y1 = y;\n  }\n};\n\nexport default function(context) {\n  return new Basis(context);\n}\n","import noop from \"../noop\";\nimport {point} from \"./basis\";\n\nfunction BasisClosed(context) {\n  this._context = context;\n}\n\nBasisClosed.prototype = {\n  areaStart: noop,\n  areaEnd: noop,\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =\n    this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 1: {\n        this._context.moveTo(this._x2, this._y2);\n        this._context.closePath();\n        break;\n      }\n      case 2: {\n        this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);\n        this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);\n        this._context.closePath();\n        break;\n      }\n      case 3: {\n        this.point(this._x2, this._y2);\n        this.point(this._x3, this._y3);\n        this.point(this._x4, this._y4);\n        break;\n      }\n    }\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; this._x2 = x, this._y2 = y; break;\n      case 1: this._point = 2; this._x3 = x, this._y3 = y; break;\n      case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;\n      default: point(this, x, y); break;\n    }\n    this._x0 = this._x1, this._x1 = x;\n    this._y0 = this._y1, this._y1 = y;\n  }\n};\n\nexport default function(context) {\n  return new BasisClosed(context);\n}\n","import {point} from \"./basis\";\n\nfunction BasisOpen(context) {\n  this._context = context;\n}\n\nBasisOpen.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 =\n    this._y0 = this._y1 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; break;\n      case 1: this._point = 2; break;\n      case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;\n      case 3: this._point = 4; // proceed\n      default: point(this, x, y); break;\n    }\n    this._x0 = this._x1, this._x1 = x;\n    this._y0 = this._y1, this._y1 = y;\n  }\n};\n\nexport default function(context) {\n  return new BasisOpen(context);\n}\n","import {Basis} from \"./basis\";\n\nfunction Bundle(context, beta) {\n  this._basis = new Basis(context);\n  this._beta = beta;\n}\n\nBundle.prototype = {\n  lineStart: function() {\n    this._x = [];\n    this._y = [];\n    this._basis.lineStart();\n  },\n  lineEnd: function() {\n    var x = this._x,\n        y = this._y,\n        j = x.length - 1;\n\n    if (j > 0) {\n      var x0 = x[0],\n          y0 = y[0],\n          dx = x[j] - x0,\n          dy = y[j] - y0,\n          i = -1,\n          t;\n\n      while (++i <= j) {\n        t = i / j;\n        this._basis.point(\n          this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),\n          this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)\n        );\n      }\n    }\n\n    this._x = this._y = null;\n    this._basis.lineEnd();\n  },\n  point: function(x, y) {\n    this._x.push(+x);\n    this._y.push(+y);\n  }\n};\n\nexport default (function custom(beta) {\n\n  function bundle(context) {\n    return beta === 1 ? new Basis(context) : new Bundle(context, beta);\n  }\n\n  bundle.beta = function(beta) {\n    return custom(+beta);\n  };\n\n  return bundle;\n})(0.85);\n","export function point(that, x, y) {\n  that._context.bezierCurveTo(\n    that._x1 + that._k * (that._x2 - that._x0),\n    that._y1 + that._k * (that._y2 - that._y0),\n    that._x2 + that._k * (that._x1 - x),\n    that._y2 + that._k * (that._y1 - y),\n    that._x2,\n    that._y2\n  );\n}\n\nexport function Cardinal(context, tension) {\n  this._context = context;\n  this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 =\n    this._y0 = this._y1 = this._y2 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 2: this._context.lineTo(this._x2, this._y2); break;\n      case 3: point(this, this._x1, this._y1); break;\n    }\n    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n      case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n      case 2: this._point = 3; // proceed\n      default: point(this, x, y); break;\n    }\n    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n  }\n};\n\nexport default (function custom(tension) {\n\n  function cardinal(context) {\n    return new Cardinal(context, tension);\n  }\n\n  cardinal.tension = function(tension) {\n    return custom(+tension);\n  };\n\n  return cardinal;\n})(0);\n","import noop from \"../noop\";\nimport {point} from \"./cardinal\";\n\nexport function CardinalClosed(context, tension) {\n  this._context = context;\n  this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n  areaStart: noop,\n  areaEnd: noop,\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n    this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 1: {\n        this._context.moveTo(this._x3, this._y3);\n        this._context.closePath();\n        break;\n      }\n      case 2: {\n        this._context.lineTo(this._x3, this._y3);\n        this._context.closePath();\n        break;\n      }\n      case 3: {\n        this.point(this._x3, this._y3);\n        this.point(this._x4, this._y4);\n        this.point(this._x5, this._y5);\n        break;\n      }\n    }\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n      case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n      case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n      default: point(this, x, y); break;\n    }\n    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n  }\n};\n\nexport default (function custom(tension) {\n\n  function cardinal(context) {\n    return new CardinalClosed(context, tension);\n  }\n\n  cardinal.tension = function(tension) {\n    return custom(+tension);\n  };\n\n  return cardinal;\n})(0);\n","import {point} from \"./cardinal\";\n\nexport function CardinalOpen(context, tension) {\n  this._context = context;\n  this._k = (1 - tension) / 6;\n}\n\nCardinalOpen.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 =\n    this._y0 = this._y1 = this._y2 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; break;\n      case 1: this._point = 2; break;\n      case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n      case 3: this._point = 4; // proceed\n      default: point(this, x, y); break;\n    }\n    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n  }\n};\n\nexport default (function custom(tension) {\n\n  function cardinal(context) {\n    return new CardinalOpen(context, tension);\n  }\n\n  cardinal.tension = function(tension) {\n    return custom(+tension);\n  };\n\n  return cardinal;\n})(0);\n","import {epsilon} from \"../math\";\nimport {Cardinal} from \"./cardinal\";\n\nexport function point(that, x, y) {\n  var x1 = that._x1,\n      y1 = that._y1,\n      x2 = that._x2,\n      y2 = that._y2;\n\n  if (that._l01_a > epsilon) {\n    var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,\n        n = 3 * that._l01_a * (that._l01_a + that._l12_a);\n    x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;\n    y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;\n  }\n\n  if (that._l23_a > epsilon) {\n    var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,\n        m = 3 * that._l23_a * (that._l23_a + that._l12_a);\n    x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;\n    y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;\n  }\n\n  that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);\n}\n\nfunction CatmullRom(context, alpha) {\n  this._context = context;\n  this._alpha = alpha;\n}\n\nCatmullRom.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 =\n    this._y0 = this._y1 = this._y2 = NaN;\n    this._l01_a = this._l12_a = this._l23_a =\n    this._l01_2a = this._l12_2a = this._l23_2a =\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 2: this._context.lineTo(this._x2, this._y2); break;\n      case 3: this.point(this._x2, this._y2); break;\n    }\n    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n\n    if (this._point) {\n      var x23 = this._x2 - x,\n          y23 = this._y2 - y;\n      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n    }\n\n    switch (this._point) {\n      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n      case 1: this._point = 2; break;\n      case 2: this._point = 3; // proceed\n      default: point(this, x, y); break;\n    }\n\n    this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n    this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n  }\n};\n\nexport default (function custom(alpha) {\n\n  function catmullRom(context) {\n    return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);\n  }\n\n  catmullRom.alpha = function(alpha) {\n    return custom(+alpha);\n  };\n\n  return catmullRom;\n})(0.5);\n","import {CardinalClosed} from \"./cardinalClosed\";\nimport noop from \"../noop\";\nimport {point} from \"./catmullRom\";\n\nfunction CatmullRomClosed(context, alpha) {\n  this._context = context;\n  this._alpha = alpha;\n}\n\nCatmullRomClosed.prototype = {\n  areaStart: noop,\n  areaEnd: noop,\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n    this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n    this._l01_a = this._l12_a = this._l23_a =\n    this._l01_2a = this._l12_2a = this._l23_2a =\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 1: {\n        this._context.moveTo(this._x3, this._y3);\n        this._context.closePath();\n        break;\n      }\n      case 2: {\n        this._context.lineTo(this._x3, this._y3);\n        this._context.closePath();\n        break;\n      }\n      case 3: {\n        this.point(this._x3, this._y3);\n        this.point(this._x4, this._y4);\n        this.point(this._x5, this._y5);\n        break;\n      }\n    }\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n\n    if (this._point) {\n      var x23 = this._x2 - x,\n          y23 = this._y2 - y;\n      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n    }\n\n    switch (this._point) {\n      case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n      case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n      case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n      default: point(this, x, y); break;\n    }\n\n    this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n    this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n  }\n};\n\nexport default (function custom(alpha) {\n\n  function catmullRom(context) {\n    return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);\n  }\n\n  catmullRom.alpha = function(alpha) {\n    return custom(+alpha);\n  };\n\n  return catmullRom;\n})(0.5);\n","import {CardinalOpen} from \"./cardinalOpen\";\nimport {point} from \"./catmullRom\";\n\nfunction CatmullRomOpen(context, alpha) {\n  this._context = context;\n  this._alpha = alpha;\n}\n\nCatmullRomOpen.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 =\n    this._y0 = this._y1 = this._y2 = NaN;\n    this._l01_a = this._l12_a = this._l23_a =\n    this._l01_2a = this._l12_2a = this._l23_2a =\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n\n    if (this._point) {\n      var x23 = this._x2 - x,\n          y23 = this._y2 - y;\n      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n    }\n\n    switch (this._point) {\n      case 0: this._point = 1; break;\n      case 1: this._point = 2; break;\n      case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n      case 3: this._point = 4; // proceed\n      default: point(this, x, y); break;\n    }\n\n    this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n    this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n  }\n};\n\nexport default (function custom(alpha) {\n\n  function catmullRom(context) {\n    return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);\n  }\n\n  catmullRom.alpha = function(alpha) {\n    return custom(+alpha);\n  };\n\n  return catmullRom;\n})(0.5);\n","import noop from \"../noop\";\n\nfunction LinearClosed(context) {\n  this._context = context;\n}\n\nLinearClosed.prototype = {\n  areaStart: noop,\n  areaEnd: noop,\n  lineStart: function() {\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (this._point) this._context.closePath();\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    if (this._point) this._context.lineTo(x, y);\n    else this._point = 1, this._context.moveTo(x, y);\n  }\n};\n\nexport default function(context) {\n  return new LinearClosed(context);\n}\n","function sign(x) {\n  return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n  var h0 = that._x1 - that._x0,\n      h1 = x2 - that._x1,\n      s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n      s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n      p = (s0 * h1 + s1 * h0) / (h0 + h1);\n  return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n  var h = that._x1 - that._x0;\n  return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(that, t0, t1) {\n  var x0 = that._x0,\n      y0 = that._y0,\n      x1 = that._x1,\n      y1 = that._y1,\n      dx = (x1 - x0) / 3;\n  that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n  this._context = context;\n}\n\nMonotoneX.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 =\n    this._y0 = this._y1 =\n    this._t0 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 2: this._context.lineTo(this._x1, this._y1); break;\n      case 3: point(this, this._t0, slope2(this, this._t0)); break;\n    }\n    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    var t1 = NaN;\n\n    x = +x, y = +y;\n    if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n    switch (this._point) {\n      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n      case 1: this._point = 2; break;\n      case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n      default: point(this, this._t0, t1 = slope3(this, x, y)); break;\n    }\n\n    this._x0 = this._x1, this._x1 = x;\n    this._y0 = this._y1, this._y1 = y;\n    this._t0 = t1;\n  }\n}\n\nfunction MonotoneY(context) {\n  this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n  MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n  this._context = context;\n}\n\nReflectContext.prototype = {\n  moveTo: function(x, y) { this._context.moveTo(y, x); },\n  closePath: function() { this._context.closePath(); },\n  lineTo: function(x, y) { this._context.lineTo(y, x); },\n  bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nexport function monotoneX(context) {\n  return new MonotoneX(context);\n}\n\nexport function monotoneY(context) {\n  return new MonotoneY(context);\n}\n","function Natural(context) {\n  this._context = context;\n}\n\nNatural.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x = [];\n    this._y = [];\n  },\n  lineEnd: function() {\n    var x = this._x,\n        y = this._y,\n        n = x.length;\n\n    if (n) {\n      this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);\n      if (n === 2) {\n        this._context.lineTo(x[1], y[1]);\n      } else {\n        var px = controlPoints(x),\n            py = controlPoints(y);\n        for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {\n          this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);\n        }\n      }\n    }\n\n    if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();\n    this._line = 1 - this._line;\n    this._x = this._y = null;\n  },\n  point: function(x, y) {\n    this._x.push(+x);\n    this._y.push(+y);\n  }\n};\n\n// See https://www.particleincell.com/2012/bezier-splines/ for derivation.\nfunction controlPoints(x) {\n  var i,\n      n = x.length - 1,\n      m,\n      a = new Array(n),\n      b = new Array(n),\n      r = new Array(n);\n  a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];\n  for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];\n  a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];\n  for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];\n  a[n - 1] = r[n - 1] / b[n - 1];\n  for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];\n  b[n - 1] = (x[n] + a[n - 1]) / 2;\n  for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];\n  return [a, b];\n}\n\nexport default function(context) {\n  return new Natural(context);\n}\n","function Step(context, t) {\n  this._context = context;\n  this._t = t;\n}\n\nStep.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x = this._y = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);\n    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n    if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n      case 1: this._point = 2; // proceed\n      default: {\n        if (this._t <= 0) {\n          this._context.lineTo(this._x, y);\n          this._context.lineTo(x, y);\n        } else {\n          var x1 = this._x * (1 - this._t) + x * this._t;\n          this._context.lineTo(x1, this._y);\n          this._context.lineTo(x1, y);\n        }\n        break;\n      }\n    }\n    this._x = x, this._y = y;\n  }\n};\n\nexport default function(context) {\n  return new Step(context, 0.5);\n}\n\nexport function stepBefore(context) {\n  return new Step(context, 0);\n}\n\nexport function stepAfter(context) {\n  return new Step(context, 1);\n}\n","import ascending from \"./ascending\";\n\nexport default function(series) {\n  return ascending(series).reverse();\n}\n","import { arc as arcFactory } from \"d3-shape\";\n\nimport {\n  LinkedVisualConsoleProps,\n  UnknownObject,\n  WithModuleProps\n} from \"../types\";\nimport {\n  linkedVCPropsDecoder,\n  modulePropsDecoder,\n  notEmptyStringOr,\n  parseIntOr,\n  parseFloatOr\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type PercentileProps = {\n  type: ItemType.PERCENTILE_BAR;\n  percentileType:\n    | \"progress-bar\"\n    | \"bubble\"\n    | \"circular-progress-bar\"\n    | \"circular-progress-bar-alt\";\n  valueType: \"percent\" | \"value\";\n  minValue: number | null;\n  maxValue: number | null;\n  color: string | null;\n  labelColor: string | null;\n  value: number | null;\n  unit: string | null;\n} & ItemProps &\n  WithModuleProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Extract a valid enum value from a raw type value.\n * @param type Raw value.\n */\nfunction extractPercentileType(\n  type: unknown\n): PercentileProps[\"percentileType\"] {\n  switch (type) {\n    case \"progress-bar\":\n    case \"bubble\":\n    case \"circular-progress-bar\":\n    case \"circular-progress-bar-alt\":\n      return type;\n    default:\n    case ItemType.PERCENTILE_BAR:\n      return \"progress-bar\";\n    case ItemType.PERCENTILE_BUBBLE:\n      return \"bubble\";\n    case ItemType.CIRCULAR_PROGRESS_BAR:\n      return \"circular-progress-bar\";\n    case ItemType.CIRCULAR_INTERIOR_PROGRESS_BAR:\n      return \"circular-progress-bar-alt\";\n  }\n}\n\n/**\n * Extract a valid enum value from a raw value type value.\n * @param type Raw value.\n */\nfunction extractValueType(valueType: unknown): PercentileProps[\"valueType\"] {\n  switch (valueType) {\n    case \"percent\":\n    case \"value\":\n      return valueType;\n    default:\n      return \"percent\";\n  }\n}\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the percentile props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function percentilePropsDecoder(\n  data: UnknownObject\n): PercentileProps | never {\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.PERCENTILE_BAR,\n    percentileType: extractPercentileType(data.percentileType || data.type),\n    valueType: extractValueType(data.valueType),\n    minValue: parseIntOr(data.minValue, null),\n    maxValue: parseIntOr(data.maxValue, null),\n    color: notEmptyStringOr(data.color, null),\n    labelColor: notEmptyStringOr(data.labelColor, null),\n    value: parseFloatOr(data.value, null),\n    unit: notEmptyStringOr(data.unit, null),\n    ...modulePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nconst svgNS = \"http://www.w3.org/2000/svg\";\n\nexport default class Percentile extends Item<PercentileProps> {\n  protected createDomElement(): HTMLElement {\n    const colors = {\n      background: \"#000000\",\n      progress: this.props.color || \"#F0F0F0\",\n      text: this.props.labelColor || \"#444444\"\n    };\n    // Progress.\n    const progress = this.getProgress();\n    // Main element.\n    const element = document.createElement(\"div\");\n    // SVG container.\n    const svg = document.createElementNS(svgNS, \"svg\");\n\n    var formatValue;\n    if (this.props.value != null) {\n      if (Intl) {\n        formatValue = Intl.NumberFormat(\"en-EN\").format(this.props.value);\n      } else {\n        formatValue = this.props.value;\n      }\n    }\n\n    switch (this.props.percentileType) {\n      case \"progress-bar\":\n        {\n          const backgroundRect = document.createElementNS(svgNS, \"rect\");\n          backgroundRect.setAttribute(\"fill\", colors.background);\n          backgroundRect.setAttribute(\"fill-opacity\", \"0.5\");\n          backgroundRect.setAttribute(\"width\", \"100\");\n          backgroundRect.setAttribute(\"height\", \"20\");\n          backgroundRect.setAttribute(\"rx\", \"5\");\n          backgroundRect.setAttribute(\"ry\", \"5\");\n          const progressRect = document.createElementNS(svgNS, \"rect\");\n          progressRect.setAttribute(\"fill\", colors.progress);\n          progressRect.setAttribute(\"fill-opacity\", \"1\");\n          progressRect.setAttribute(\"width\", `${progress}`);\n          progressRect.setAttribute(\"height\", \"20\");\n          progressRect.setAttribute(\"rx\", \"5\");\n          progressRect.setAttribute(\"ry\", \"5\");\n          const text = document.createElementNS(svgNS, \"text\");\n          text.setAttribute(\"text-anchor\", \"middle\");\n          text.setAttribute(\"alignment-baseline\", \"middle\");\n          text.setAttribute(\"font-size\", \"12\");\n          text.setAttribute(\"font-family\", \"arial\");\n          text.setAttribute(\"font-weight\", \"bold\");\n          text.setAttribute(\"transform\", \"translate(50 11)\");\n          text.setAttribute(\"fill\", colors.text);\n\n          if (this.props.valueType === \"value\") {\n            text.style.fontSize = \"6pt\";\n\n            text.textContent = this.props.unit\n              ? `${formatValue} ${this.props.unit}`\n              : `${formatValue}`;\n          } else {\n            text.textContent = `${progress}%`;\n          }\n\n          // Auto resize SVG using the view box magic: https://css-tricks.com/scale-svg/\n          svg.setAttribute(\"viewBox\", \"0 0 100 20\");\n          svg.append(backgroundRect, progressRect, text);\n        }\n        break;\n      case \"bubble\":\n      case \"circular-progress-bar\":\n      case \"circular-progress-bar-alt\":\n        {\n          // Auto resize SVG using the view box magic: https://css-tricks.com/scale-svg/\n          svg.setAttribute(\"viewBox\", \"0 0 100 100\");\n\n          if (this.props.percentileType === \"bubble\") {\n            // Create and append the circles.\n            const backgroundCircle = document.createElementNS(svgNS, \"circle\");\n            backgroundCircle.setAttribute(\"transform\", \"translate(50 50)\");\n            backgroundCircle.setAttribute(\"fill\", colors.background);\n            backgroundCircle.setAttribute(\"fill-opacity\", \"0.5\");\n            backgroundCircle.setAttribute(\"r\", \"50\");\n            const progressCircle = document.createElementNS(svgNS, \"circle\");\n            progressCircle.setAttribute(\"transform\", \"translate(50 50)\");\n            progressCircle.setAttribute(\"fill\", colors.progress);\n            progressCircle.setAttribute(\"fill-opacity\", \"1\");\n            progressCircle.setAttribute(\"r\", `${progress / 2}`);\n\n            svg.append(backgroundCircle, progressCircle);\n          } else {\n            // Create and append the circles.\n            const arcProps = {\n              innerRadius:\n                this.props.percentileType === \"circular-progress-bar\" ? 30 : 0,\n              outerRadius: 50,\n              startAngle: 0,\n              endAngle: Math.PI * 2\n            };\n            const arc = arcFactory();\n\n            const backgroundCircle = document.createElementNS(svgNS, \"path\");\n            backgroundCircle.setAttribute(\"transform\", \"translate(50 50)\");\n            backgroundCircle.setAttribute(\"fill\", colors.background);\n            backgroundCircle.setAttribute(\"fill-opacity\", \"0.5\");\n            backgroundCircle.setAttribute(\"d\", `${arc(arcProps)}`);\n            const progressCircle = document.createElementNS(svgNS, \"path\");\n            progressCircle.setAttribute(\"transform\", \"translate(50 50)\");\n            progressCircle.setAttribute(\"fill\", colors.progress);\n            progressCircle.setAttribute(\"fill-opacity\", \"1\");\n            progressCircle.setAttribute(\n              \"d\",\n              `${arc({\n                ...arcProps,\n                endAngle: arcProps.endAngle * (progress / 100)\n              })}`\n            );\n\n            svg.append(backgroundCircle, progressCircle);\n          }\n\n          // Create and append the text.\n          const text = document.createElementNS(svgNS, \"text\");\n          text.setAttribute(\"text-anchor\", \"middle\");\n          text.setAttribute(\"alignment-baseline\", \"middle\");\n          text.setAttribute(\"font-size\", \"16\");\n          text.setAttribute(\"font-family\", \"arial\");\n          text.setAttribute(\"font-weight\", \"bold\");\n          text.setAttribute(\"fill\", colors.text);\n\n          if (this.props.valueType === \"value\" && this.props.value != null) {\n            // Show value and unit in 1 (no unit) or 2 lines.\n            if (this.props.unit && this.props.unit.length > 0) {\n              const value = document.createElementNS(svgNS, \"tspan\");\n              value.setAttribute(\"x\", \"0\");\n              value.setAttribute(\"dy\", \"1em\");\n              value.textContent = `${formatValue}`;\n              value.style.fontSize = \"8pt\";\n              const unit = document.createElementNS(svgNS, \"tspan\");\n              unit.setAttribute(\"x\", \"0\");\n              unit.setAttribute(\"dy\", \"1em\");\n              unit.textContent = `${this.props.unit}`;\n              unit.style.fontSize = \"8pt\";\n              text.append(value, unit);\n              text.setAttribute(\"transform\", \"translate(50 33)\");\n            } else {\n              text.textContent = `${formatValue}`;\n              text.style.fontSize = \"8pt\";\n              text.setAttribute(\"transform\", \"translate(50 50)\");\n            }\n          } else {\n            // Percentage.\n            text.textContent = `${progress}%`;\n            text.setAttribute(\"transform\", \"translate(50 50)\");\n          }\n\n          svg.append(text);\n        }\n        break;\n    }\n\n    element.append(svg);\n\n    return element;\n  }\n\n  private getProgress(): number {\n    const minValue = this.props.minValue || 0;\n    const maxValue = this.props.maxValue || 100;\n    const value = this.props.value == null ? 0 : this.props.value;\n\n    if (value <= minValue) return 0;\n    else if (value >= maxValue) return 100;\n    else return Math.trunc(((value - minValue) / (maxValue - minValue)) * 100);\n  }\n}\n","import { UnknownObject } from \"../types\";\nimport {\n  stringIsEmpty,\n  notEmptyStringOr,\n  decodeBase64,\n  parseIntOr\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type ServiceProps = {\n  type: ItemType.SERVICE;\n  serviceId: number;\n  imageSrc: string | null;\n  statusImageSrc: string | null;\n  encodedTitle: string | null;\n} & ItemProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the service props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function servicePropsDecoder(data: UnknownObject): ServiceProps | never {\n  if (data.imageSrc !== null) {\n    if (\n      typeof data.statusImageSrc !== \"string\" ||\n      data.imageSrc.statusImageSrc === 0\n    ) {\n      throw new TypeError(\"invalid status image src.\");\n    }\n  } else {\n    if (stringIsEmpty(data.encodedTitle)) {\n      throw new TypeError(\"missing encode tittle content.\");\n    }\n  }\n\n  if (parseIntOr(data.serviceId, null) === null) {\n    throw new TypeError(\"invalid service id.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.SERVICE,\n    serviceId: data.serviceId,\n    imageSrc: notEmptyStringOr(data.imageSrc, null),\n    statusImageSrc: notEmptyStringOr(data.statusImageSrc, null),\n    encodedTitle: notEmptyStringOr(data.encodedTitle, null)\n  };\n}\n\nexport default class Service extends Item<ServiceProps> {\n  public createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"service\";\n\n    if (this.props.statusImageSrc !== null) {\n      element.style.background = `url(${this.props.statusImageSrc}) no-repeat`;\n      element.style.backgroundSize = \"contain\";\n      element.style.backgroundPosition = \"center\";\n    } else if (this.props.encodedTitle !== null) {\n      element.innerHTML = decodeBase64(this.props.encodedTitle);\n    }\n\n    return element;\n  }\n}\n","import { UnknownObject, Size } from \"./types\";\nimport {\n  parseBoolean,\n  sizePropsDecoder,\n  parseIntOr,\n  notEmptyStringOr\n} from \"./lib\";\nimport Item, {\n  ItemType,\n  ItemProps,\n  ItemClickEvent,\n  ItemRemoveEvent\n} from \"./Item\";\nimport StaticGraph, { staticGraphPropsDecoder } from \"./items/StaticGraph\";\nimport Icon, { iconPropsDecoder } from \"./items/Icon\";\nimport ColorCloud, { colorCloudPropsDecoder } from \"./items/ColorCloud\";\nimport Group, { groupPropsDecoder } from \"./items/Group\";\nimport Clock, { clockPropsDecoder } from \"./items/Clock\";\nimport Box, { boxPropsDecoder } from \"./items/Box\";\nimport Line, { linePropsDecoder } from \"./items/Line\";\nimport Label, { labelPropsDecoder } from \"./items/Label\";\nimport SimpleValue, { simpleValuePropsDecoder } from \"./items/SimpleValue\";\nimport EventsHistory, {\n  eventsHistoryPropsDecoder\n} from \"./items/EventsHistory\";\nimport Percentile, { percentilePropsDecoder } from \"./items/Percentile\";\nimport TypedEvent, { Disposable, Listener } from \"./TypedEvent\";\nimport DonutGraph, { donutGraphPropsDecoder } from \"./items/DonutGraph\";\nimport BarsGraph, { barsGraphPropsDecoder } from \"./items/BarsGraph\";\nimport ModuleGraph, { moduleGraphPropsDecoder } from \"./items/ModuleGraph\";\nimport Service, { servicePropsDecoder } from \"./items/Service\";\n\n// TODO: Document.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nfunction itemInstanceFrom(data: UnknownObject) {\n  const type = parseIntOr(data.type, null);\n  if (type == null) throw new TypeError(\"missing item type.\");\n\n  switch (type as ItemType) {\n    case ItemType.STATIC_GRAPH:\n      return new StaticGraph(staticGraphPropsDecoder(data));\n    case ItemType.MODULE_GRAPH:\n      return new ModuleGraph(moduleGraphPropsDecoder(data));\n    case ItemType.SIMPLE_VALUE:\n    case ItemType.SIMPLE_VALUE_MAX:\n    case ItemType.SIMPLE_VALUE_MIN:\n    case ItemType.SIMPLE_VALUE_AVG:\n      return new SimpleValue(simpleValuePropsDecoder(data));\n    case ItemType.PERCENTILE_BAR:\n    case ItemType.PERCENTILE_BUBBLE:\n    case ItemType.CIRCULAR_PROGRESS_BAR:\n    case ItemType.CIRCULAR_INTERIOR_PROGRESS_BAR:\n      return new Percentile(percentilePropsDecoder(data));\n    case ItemType.LABEL:\n      return new Label(labelPropsDecoder(data));\n    case ItemType.ICON:\n      return new Icon(iconPropsDecoder(data));\n    case ItemType.SERVICE:\n      return new Service(servicePropsDecoder(data));\n    case ItemType.GROUP_ITEM:\n      return new Group(groupPropsDecoder(data));\n    case ItemType.BOX_ITEM:\n      return new Box(boxPropsDecoder(data));\n    case ItemType.LINE_ITEM:\n      return new Line(linePropsDecoder(data));\n    case ItemType.AUTO_SLA_GRAPH:\n      return new EventsHistory(eventsHistoryPropsDecoder(data));\n    case ItemType.DONUT_GRAPH:\n      return new DonutGraph(donutGraphPropsDecoder(data));\n    case ItemType.BARS_GRAPH:\n      return new BarsGraph(barsGraphPropsDecoder(data));\n    case ItemType.CLOCK:\n      return new Clock(clockPropsDecoder(data));\n    case ItemType.COLOR_CLOUD:\n      return new ColorCloud(colorCloudPropsDecoder(data));\n    default:\n      throw new TypeError(\"item not found\");\n  }\n}\n\n// TODO: Document.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nfunction decodeProps(data: UnknownObject) {\n  const type = parseIntOr(data.type, null);\n  if (type == null) throw new TypeError(\"missing item type.\");\n\n  switch (type as ItemType) {\n    case ItemType.STATIC_GRAPH:\n      return staticGraphPropsDecoder(data);\n    case ItemType.MODULE_GRAPH:\n      return moduleGraphPropsDecoder(data);\n    case ItemType.SIMPLE_VALUE:\n    case ItemType.SIMPLE_VALUE_MAX:\n    case ItemType.SIMPLE_VALUE_MIN:\n    case ItemType.SIMPLE_VALUE_AVG:\n      return simpleValuePropsDecoder(data);\n    case ItemType.PERCENTILE_BAR:\n    case ItemType.PERCENTILE_BUBBLE:\n    case ItemType.CIRCULAR_PROGRESS_BAR:\n    case ItemType.CIRCULAR_INTERIOR_PROGRESS_BAR:\n      return percentilePropsDecoder(data);\n    case ItemType.LABEL:\n      return labelPropsDecoder(data);\n    case ItemType.ICON:\n      return iconPropsDecoder(data);\n    case ItemType.SERVICE:\n      return servicePropsDecoder(data);\n    case ItemType.GROUP_ITEM:\n      return groupPropsDecoder(data);\n    case ItemType.BOX_ITEM:\n      return boxPropsDecoder(data);\n    case ItemType.LINE_ITEM:\n      return linePropsDecoder(data);\n    case ItemType.AUTO_SLA_GRAPH:\n      return eventsHistoryPropsDecoder(data);\n    case ItemType.DONUT_GRAPH:\n      return donutGraphPropsDecoder(data);\n    case ItemType.BARS_GRAPH:\n      return barsGraphPropsDecoder(data);\n    case ItemType.CLOCK:\n      return clockPropsDecoder(data);\n    case ItemType.COLOR_CLOUD:\n      return colorCloudPropsDecoder(data);\n    default:\n      throw new TypeError(\"decoder not found\");\n  }\n}\n\n// Base properties.\nexport interface VisualConsoleProps extends Size {\n  readonly id: number;\n  name: string;\n  groupId: number;\n  backgroundURL: string | null; // URL?\n  backgroundColor: string | null;\n  isFavorite: boolean;\n  relationLineWidth: number;\n}\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the Visual Console props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function visualConsolePropsDecoder(\n  data: UnknownObject\n): VisualConsoleProps | never {\n  // Object destructuring: http://es6-features.org/#ObjectMatchingShorthandNotation\n  const {\n    id,\n    name,\n    groupId,\n    backgroundURL,\n    backgroundColor,\n    isFavorite,\n    relationLineWidth\n  } = data;\n\n  if (id == null || isNaN(parseInt(id))) {\n    throw new TypeError(\"invalid Id.\");\n  }\n  if (typeof name !== \"string\" || name.length === 0) {\n    throw new TypeError(\"invalid name.\");\n  }\n  if (groupId == null || isNaN(parseInt(groupId))) {\n    throw new TypeError(\"invalid group Id.\");\n  }\n\n  return {\n    id: parseInt(id),\n    name,\n    groupId: parseInt(groupId),\n    backgroundURL: notEmptyStringOr(backgroundURL, null),\n    backgroundColor: notEmptyStringOr(backgroundColor, null),\n    isFavorite: parseBoolean(isFavorite),\n    relationLineWidth: parseIntOr(relationLineWidth, 0),\n    ...sizePropsDecoder(data)\n  };\n}\n\nexport default class VisualConsole {\n  // Reference to the DOM element which will contain the items.\n  private readonly containerRef: HTMLElement;\n  // Properties.\n  private _props: VisualConsoleProps;\n  // Visual Console Item instances by their Id.\n  private elementsById: {\n    [key: number]: Item<ItemProps>;\n  } = {};\n  // Visual Console Item Ids.\n  private elementIds: ItemProps[\"id\"][] = [];\n  // Dictionary which store the created lines.\n  private relations: {\n    [key: string]: Line;\n  } = {};\n  // Event manager for click events.\n  private readonly clickEventManager = new TypedEvent<\n    ItemClickEvent<ItemProps>\n  >();\n  // List of references to clean the event listeners.\n  private readonly disposables: Disposable[] = [];\n\n  /**\n   * React to a click on an element.\n   * @param e Event object.\n   */\n  private handleElementClick: (e: ItemClickEvent<ItemProps>) => void = e => {\n    this.clickEventManager.emit(e);\n    // console.log(`Clicked element #${e.data.id}`, e);\n  };\n\n  /**\n   * Clear some element references.\n   * @param e Event object.\n   */\n  private handleElementRemove: (e: ItemRemoveEvent<ItemProps>) => void = e => {\n    // Remove the element from the list and its relations.\n    this.elementIds = this.elementIds.filter(id => id !== e.data.id);\n    delete this.elementsById[e.data.id];\n    this.clearRelations(e.data.id);\n  };\n\n  public constructor(\n    container: HTMLElement,\n    props: UnknownObject,\n    items: UnknownObject[]\n  ) {\n    this.containerRef = container;\n    this._props = visualConsolePropsDecoder(props);\n\n    // Force the first render.\n    this.render();\n\n    // Sort by isOnTop, id ASC\n    items = items.sort(function(a, b) {\n      if (\n        a.isOnTop == null ||\n        b.isOnTop == null ||\n        a.id == null ||\n        b.id == null\n      ) {\n        return 0;\n      }\n\n      if (a.isOnTop && !b.isOnTop) return 1;\n      else if (!a.isOnTop && b.isOnTop) return -1;\n      else if (a.id > b.id) return 1;\n      else return -1;\n    });\n\n    // Initialize the items.\n    items.forEach(item => {\n      try {\n        const itemInstance = itemInstanceFrom(item);\n        // Add the item to the list.\n        this.elementsById[itemInstance.props.id] = itemInstance;\n        this.elementIds.push(itemInstance.props.id);\n        // Item event handlers.\n        itemInstance.onClick(this.handleElementClick);\n        itemInstance.onRemove(this.handleElementRemove);\n        // Add the item to the DOM.\n        this.containerRef.append(itemInstance.elementRef);\n      } catch (error) {\n        console.log(\"Error creating a new element:\", error.message);\n      }\n    });\n\n    // Create lines.\n    this.buildRelations();\n  }\n\n  /**\n   * Public accessor of the `elements` property.\n   * @return Properties.\n   */\n  public get elements(): Item<ItemProps>[] {\n    // Ensure the type cause Typescript doesn't know the filter removes null items.\n    return this.elementIds\n      .map(id => this.elementsById[id])\n      .filter(_ => _ != null) as Item<ItemProps>[];\n  }\n\n  /**\n   * Public setter of the `elements` property.\n   * @param items.\n   */\n  public updateElements(items: UnknownObject[]): void {\n    const itemIds = items.map(item => item.id || null).filter(id => id != null);\n    itemIds as number[]; // Tell the type system to rely on us.\n    // Get the elements we should delete.\n    const deletedIds: number[] = this.elementIds.filter(\n      id => itemIds.indexOf(id) < 0\n    );\n    // Delete the elements.\n    deletedIds.forEach(id => {\n      if (this.elementsById[id] != null) {\n        this.elementsById[id].remove();\n        delete this.elementsById[id];\n      }\n    });\n    // Replace the element ids.\n    this.elementIds = itemIds;\n\n    // Initialize the items.\n    items.forEach(item => {\n      if (item.id) {\n        if (this.elementsById[item.id] == null) {\n          // New item.\n          try {\n            const itemInstance = itemInstanceFrom(item);\n            // Add the item to the list.\n            this.elementsById[itemInstance.props.id] = itemInstance;\n            // Item event handlers.\n            itemInstance.onClick(this.handleElementClick);\n            itemInstance.onRemove(this.handleElementRemove);\n            // Add the item to the DOM.\n            this.containerRef.append(itemInstance.elementRef);\n          } catch (error) {\n            console.log(\"Error creating a new element:\", error.message);\n          }\n        } else {\n          // Update item.\n          try {\n            this.elementsById[item.id].props = decodeProps(item);\n          } catch (error) {\n            console.log(\"Error updating an element:\", error.message);\n          }\n        }\n      }\n    });\n\n    // Re-build relations.\n    this.buildRelations();\n  }\n\n  /**\n   * Public accessor of the `props` property.\n   * @return Properties.\n   */\n  public get props(): VisualConsoleProps {\n    return { ...this._props }; // Return a copy.\n  }\n\n  /**\n   * Public setter of the `props` property.\n   * If the new props are different enough than the\n   * stored props, a render would be fired.\n   * @param newProps\n   */\n  public set props(newProps: VisualConsoleProps) {\n    const prevProps = this.props;\n    // Update the internal props.\n    this._props = newProps;\n\n    // From this point, things which rely on this.props can access to the changes.\n\n    // Re-render.\n    this.render(prevProps);\n  }\n\n  /**\n   * Recreate or update the HTMLElement which represents the Visual Console into the DOM.\n   * @param prevProps If exists it will be used to only DOM updates instead of a full replace.\n   */\n  public render(prevProps: VisualConsoleProps | null = null): void {\n    if (prevProps) {\n      if (prevProps.backgroundURL !== this.props.backgroundURL) {\n        this.containerRef.style.backgroundImage =\n          this.props.backgroundURL !== null\n            ? `url(${this.props.backgroundURL})`\n            : null;\n      }\n      if (prevProps.backgroundColor !== this.props.backgroundColor) {\n        this.containerRef.style.backgroundColor = this.props.backgroundColor;\n      }\n      if (this.sizeChanged(prevProps, this.props)) {\n        this.resizeElement(this.props.width, this.props.height);\n      }\n    } else {\n      this.containerRef.style.backgroundImage =\n        this.props.backgroundURL !== null\n          ? `url(${this.props.backgroundURL})`\n          : null;\n\n      this.containerRef.style.backgroundColor = this.props.backgroundColor;\n      this.resizeElement(this.props.width, this.props.height);\n    }\n  }\n\n  /**\n   * Compare the previous and the new size and return\n   * a boolean value in case the size changed.\n   * @param prevSize\n   * @param newSize\n   * @return Whether the size changed or not.\n   */\n  public sizeChanged(prevSize: Size, newSize: Size): boolean {\n    return (\n      prevSize.width !== newSize.width || prevSize.height !== newSize.height\n    );\n  }\n\n  /**\n   * Resize the DOM container.\n   * @param width\n   * @param height\n   */\n  public resizeElement(width: number, height: number): void {\n    this.containerRef.style.width = `${width}px`;\n    this.containerRef.style.height = `${height}px`;\n  }\n\n  /**\n   * Update the size into the properties and resize the DOM container.\n   * @param width\n   * @param height\n   */\n  public resize(width: number, height: number): void {\n    this.props = {\n      ...this.props, // Object spread: http://es6-features.org/#SpreadOperator\n      width,\n      height\n    };\n  }\n\n  /**\n   * To remove the event listeners and the elements from the DOM.\n   */\n  public remove(): void {\n    this.disposables.forEach(d => d.dispose()); // Arrow function.\n    this.elements.forEach(e => e.remove()); // Arrow function.\n    this.elementsById = {};\n    this.elementIds = [];\n    // Clear relations.\n    this.clearRelations();\n    // Clean container.\n    this.containerRef.innerHTML = \"\";\n  }\n\n  /**\n   * Create line elements which connect the elements with their parents.\n   */\n  private buildRelations(): void {\n    // Clear relations.\n    this.clearRelations();\n    // Add relations.\n    this.elements.forEach(item => {\n      if (item.props.parentId !== null) {\n        const parent = this.elementsById[item.props.parentId];\n        const child = this.elementsById[item.props.id];\n        if (parent && child) this.addRelationLine(parent, child);\n      }\n    });\n  }\n\n  /**\n   * @param itemId Optional identifier of a parent or child item.\n   * Remove the line elements which connect the elements with their parents.\n   */\n  private clearRelations(itemId?: number): void {\n    if (itemId != null) {\n      for (let key in this.relations) {\n        const ids = key.split(\"|\");\n        const parentId = Number.parseInt(ids[0]);\n        const childId = Number.parseInt(ids[1]);\n\n        if (itemId === parentId || itemId === childId) {\n          this.relations[key].remove();\n          delete this.relations[key];\n        }\n      }\n    } else {\n      for (let key in this.relations) {\n        this.relations[key].remove();\n        delete this.relations[key];\n      }\n    }\n  }\n\n  /**\n   * Retrieve the line element which represent the relation between items.\n   * @param parentId Identifier of the parent item.\n   * @param childId Itentifier of the child item.\n   * @return The line element or nothing.\n   */\n  private getRelationLine(parentId: number, childId: number): Line | null {\n    const identifier = `${parentId}|${childId}`;\n    return this.relations[identifier] || null;\n  }\n\n  /**\n   * Add a new line item to represent a relation between the items.\n   * @param parent Parent item.\n   * @param child Child item.\n   * @return Whether the line was added or not.\n   */\n  private addRelationLine(\n    parent: Item<ItemProps>,\n    child: Item<ItemProps>\n  ): Line {\n    const identifier = `${parent.props.id}|${child.props.id}`;\n    if (this.relations[identifier] != null) {\n      this.relations[identifier].remove();\n    }\n\n    // Get the items center.\n    const startX = parent.props.x + parent.elementRef.clientWidth / 2;\n    const startY =\n      parent.props.y +\n      (parent.elementRef.clientHeight - parent.labelElementRef.clientHeight) /\n        2;\n    const endX = child.props.x + child.elementRef.clientWidth / 2;\n    const endY =\n      child.props.y +\n      (child.elementRef.clientHeight - child.labelElementRef.clientHeight) / 2;\n\n    const line = new Line(\n      linePropsDecoder({\n        id: 0,\n        type: ItemType.LINE_ITEM,\n        startX,\n        startY,\n        endX,\n        endY,\n        width: 0,\n        height: 0,\n        lineWidth: this.props.relationLineWidth,\n        color: \"#CCCCCC\"\n      })\n    );\n    // Save a reference to the line item.\n    this.relations[identifier] = line;\n\n    // Add the line to the DOM.\n    line.elementRef.style.zIndex = \"0\";\n    this.containerRef.append(line.elementRef);\n\n    return line;\n  }\n\n  /**\n   * Add an event handler to the click of the linked visual console elements.\n   * @param listener Function which is going to be executed when a linked console is clicked.\n   */\n  public onClick(listener: Listener<ItemClickEvent<ItemProps>>): Disposable {\n    /*\n     * The '.on' function returns a function which will clean the event\n     * listener when executed. We store all the 'dispose' functions to\n     * call them when the item should be cleared.\n     */\n    const disposable = this.clickEventManager.on(listener);\n    this.disposables.push(disposable);\n\n    return disposable;\n  }\n}\n","import TypedEvent, { Disposable, Listener } from \"../TypedEvent\";\n\ninterface Cancellable {\n  cancel(): void;\n}\n\ntype AsyncTaskStatus = \"waiting\" | \"started\" | \"cancelled\" | \"finished\";\ntype AsyncTaskInitiator = (done: () => void) => Cancellable;\n\n/**\n * Defines an async task which can be started and cancelled.\n * It's possible to observe the status changes of the task.\n */\nclass AsyncTask {\n  private readonly taskInitiator: AsyncTaskInitiator;\n  private cancellable: Cancellable = { cancel: () => {} };\n  private _status: AsyncTaskStatus = \"waiting\";\n\n  // Event manager for status change events.\n  private readonly statusChangeEventManager = new TypedEvent<AsyncTaskStatus>();\n  // List of references to clean the event listeners.\n  private readonly disposables: Disposable[] = [];\n\n  public constructor(taskInitiator: AsyncTaskInitiator) {\n    this.taskInitiator = taskInitiator;\n  }\n\n  /**\n   * Public setter of the `status` property.\n   * @param status.\n   */\n  public set status(status: AsyncTaskStatus) {\n    this._status = status;\n    this.statusChangeEventManager.emit(status);\n  }\n\n  /**\n   * Public accessor of the `status` property.\n   * @return status.\n   */\n  public get status() {\n    return this._status;\n  }\n\n  /**\n   * Start the async task.\n   */\n  public init(): void {\n    this.cancellable = this.taskInitiator(() => {\n      this.status = \"finished\";\n    });\n    this.status = \"started\";\n  }\n\n  /**\n   * Cancel the async task.\n   */\n  public cancel(): void {\n    this.cancellable.cancel();\n    this.status = \"cancelled\";\n  }\n\n  /**\n   * Add an event handler to the status change.\n   * @param listener Function which is going to be executed when the status changes.\n   */\n  public onStatusChange(listener: Listener<AsyncTaskStatus>): Disposable {\n    /*\n     * The '.on' function returns a function which will clean the event\n     * listener when executed. We store all the 'dispose' functions to\n     * call them when the item should be cleared.\n     */\n    const disposable = this.statusChangeEventManager.on(listener);\n    this.disposables.push(disposable);\n\n    return disposable;\n  }\n}\n\n/**\n * Wrap an async task into another which will execute that task indefinitely\n * every time the tash finnish and the chosen period ends.\n * Will last until cancellation.\n *\n * @param task Async task to execute.\n * @param period Time in milliseconds to wait until the next async esecution.\n *\n * @return A new async task.\n */\nfunction asyncPeriodic(task: AsyncTask, period: number): AsyncTask {\n  return new AsyncTask(() => {\n    let ref: number | null = null;\n\n    task.onStatusChange(status => {\n      if (status === \"finished\") {\n        ref = window.setTimeout(() => {\n          task.init();\n        }, period);\n      }\n    });\n\n    task.init();\n\n    return {\n      cancel: () => {\n        if (ref) clearTimeout(ref);\n        task.cancel();\n      }\n    };\n  });\n}\n\n/**\n * Manages a list of async tasks.\n */\nexport default class AsyncTaskManager {\n  private tasks: { [identifier: string]: AsyncTask } = {};\n\n  /**\n   * Adds an async task to the manager.\n   *\n   * @param identifier Unique identifier.\n   * @param taskInitiator Function to initialize the async task.\n   * Should return a structure to cancel the task.\n   * @param period Optional period to repeat the task indefinitely.\n   */\n  public add(\n    identifier: string,\n    taskInitiator: AsyncTaskInitiator,\n    period: number = 0\n  ): AsyncTask {\n    if (this.tasks[identifier] && this.tasks[identifier].status === \"started\") {\n      this.tasks[identifier].cancel();\n    }\n\n    const asyncTask =\n      period > 0\n        ? asyncPeriodic(new AsyncTask(taskInitiator), period)\n        : new AsyncTask(taskInitiator);\n\n    this.tasks[identifier] = asyncTask;\n\n    return this.tasks[identifier];\n  }\n\n  /**\n   * Starts an async task.\n   *\n   * @param identifier Unique identifier.\n   */\n  public init(identifier: string) {\n    if (\n      this.tasks[identifier] &&\n      (this.tasks[identifier].status === \"waiting\" ||\n        this.tasks[identifier].status === \"cancelled\" ||\n        this.tasks[identifier].status === \"finished\")\n    ) {\n      this.tasks[identifier].init();\n    }\n  }\n\n  /**\n   * Cancel a running async task.\n   *\n   * @param identifier Unique identifier.\n   */\n  public cancel(identifier: string) {\n    if (this.tasks[identifier] && this.tasks[identifier].status === \"started\") {\n      this.tasks[identifier].cancel();\n    }\n  }\n}\n","/*\n * Useful resources.\n * http://es6-features.org/\n * http://exploringjs.com/es6\n * https://www.typescriptlang.org/\n */\n\nimport \"./main.css\"; // CSS import.\nimport VisualConsole from \"./VisualConsole\";\nimport AsyncTaskManager from \"./lib/AsyncTaskManager\";\n\n// Export the VisualConsole class to the global object.\n// eslint-disable-next-line\n(window as any).VisualConsole = VisualConsole;\n\n// Export the AsyncTaskManager class to the global object.\n// eslint-disable-next-line\n(window as any).AsyncTaskManager = AsyncTaskManager;\n"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/lib/index.ts","webpack:///./src/Item.ts","webpack:///./src/lib/TypedEvent.ts","webpack:///./src/items/EventsHistory.ts","webpack:///./src/items/DonutGraph.ts","webpack:///./src/items/BarsGraph.ts","webpack:///./src/items/ModuleGraph.ts","webpack:///./src/items/StaticGraph.ts","webpack:///./src/items/Icon.ts","webpack:///./src/items/ColorCloud.ts","webpack:///./src/items/Group.ts","webpack:///./src/items/Clock/index.ts","webpack:///./src/items/Box.ts","webpack:///./src/items/Line.ts","webpack:///./src/items/Label.ts","webpack:///./src/items/SimpleValue.ts","webpack:///./node_modules/d3-path/src/path.js","webpack:///./node_modules/d3-shape/src/constant.js","webpack:///./node_modules/d3-shape/src/math.js","webpack:///./node_modules/d3-shape/src/arc.js","webpack:///./node_modules/d3-shape/src/curve/linear.js","webpack:///./node_modules/d3-shape/src/curve/radial.js","webpack:///./node_modules/d3-shape/src/array.js","webpack:///./node_modules/d3-shape/src/symbol/diamond.js","webpack:///./node_modules/d3-shape/src/symbol/circle.js","webpack:///./node_modules/d3-shape/src/symbol/star.js","webpack:///./node_modules/d3-shape/src/noop.js","webpack:///./node_modules/d3-shape/src/symbol/triangle.js","webpack:///./node_modules/d3-shape/src/symbol/wye.js","webpack:///./node_modules/d3-shape/src/curve/basis.js","webpack:///./node_modules/d3-shape/src/curve/basisClosed.js","webpack:///./node_modules/d3-shape/src/curve/basisOpen.js","webpack:///./node_modules/d3-shape/src/curve/bundle.js","webpack:///./node_modules/d3-shape/src/curve/cardinal.js","webpack:///./node_modules/d3-shape/src/curve/cardinalClosed.js","webpack:///./node_modules/d3-shape/src/curve/cardinalOpen.js","webpack:///./node_modules/d3-shape/src/curve/catmullRom.js","webpack:///./node_modules/d3-shape/src/curve/catmullRomClosed.js","webpack:///./node_modules/d3-shape/src/curve/catmullRomOpen.js","webpack:///./node_modules/d3-shape/src/curve/linearClosed.js","webpack:///./node_modules/d3-shape/src/curve/monotone.js","webpack:///./node_modules/d3-shape/src/curve/natural.js","webpack:///./node_modules/d3-shape/src/curve/step.js","webpack:///./node_modules/d3-shape/src/order/descending.js","webpack:///./src/items/Percentile.ts","webpack:///./src/items/Service.ts","webpack:///./src/VisualConsole.ts","webpack:///./src/lib/AsyncTaskManager.ts","webpack:///./src/index.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","parseIntOr","defaultValue","length","isNaN","parseInt","parseFloatOr","parseFloat","stringIsEmpty","notEmptyStringOr","parseBoolean","leftPad","pad","diffLength","substr","Math","abs","substring","repeatTimes","floor","restLength","newPad","positionPropsDecoder","data","x","y","sizePropsDecoder","width","height","TypeError","modulePropsDecoder","__assign","moduleName","moduleDescription","agentProps","agentId","agent","agentName","agentAlias","agentDescription","agentAddress","metaconsoleId","agentPropsDecoder","linkedVCPropsDecoder","id","linkedLayoutId","linkedLayoutAgentId","linkedLayoutStatusProps","linkedLayoutStatusType","weight","linkedLayoutStatusTypeWeight","warningThreshold","linkedLayoutStatusTypeWarningThreshold","criticalThreshold","linkedLayoutStatusTypeCriticalThreshold","linkedLayoutBaseProps","itemMetaDecoder","receivedAt","Date","Number","getTime","error","Error","editMode","isFromCache","isFetching","isUpdating","prefixedCssRules","ruleName","ruleValue","rule","decodeBase64","input","decodeURIComponent","escape","window","atob","humanDate","date","locale","Intl","DateTimeFormat","day","month","year","format","getDate","getMonth","getFullYear","humanTime","getHours","getMinutes","getSeconds","replaceMacros","macros","text","reduce","acc","_a","macro","replace","throttle","delay","fn","last","args","_i","arguments","now","apply","debounce","timerRef","clearTimeout","setTimeout","getOffset","el","offsetLeft","offsetTop","scrollLeft","scrollTop","offsetParent","top","left","addMovementListener","element","onMoved","container","parentElement","isDraggable","draggable","lastX","lastY","lastMouseX","lastMouseY","mouseElementOffsetX","mouseElementOffsetY","containerBounds","getBoundingClientRect","containerOffset","containerTop","containerBottom","containerLeft","containerRight","elementBounds","borderWidth","getComputedStyle","borderFix","debouncedMovement","throttledMovement","handleMove","e","mouseX","pageX","mouseY","pageY","mouseDeltaX","mouseDeltaY","maxX","maxY","outOfBoundsLeft","outOfBoundsRight","outOfBoundsTop","outOfBoundsBottom","handleEnd","document","removeEventListener","body","style","userSelect","handleStart","stopPropagation","offsetX","offsetY","addEventListener","addResizementListener","onResized","resizeDraggable","createElement","className","appendChild","lastWidth","lastHeight","elementOffset","elementTop","elementLeft","debouncedResizement","throttledResizement","handleResize","remove","parseLabelPosition","labelPosition","itemBasePropsDecoder","type","label","_lib__WEBPACK_IMPORTED_MODULE_0__","isLinkEnabled","link","isOnTop","parentId","aclGroupId","VisualConsoleItem","props","metadata","_this","this","clickEventManager","_lib_TypedEvent__WEBPACK_IMPORTED_MODULE_1__","movedEventManager","resizedEventManager","removeEventManager","disposables","debouncedMovementSave","prevPosition","newPosition","positionChanged","move","emit","item","removeMovement","debouncedResizementSave","prevSize","newSize","sizeChanged","resize","removeResizement","itemProps","_metadata","elementRef","createContainerDomElement","labelElementRef","createLabelDomElement","childElementRef","createDomElement","append","resizeElement","changeLabelPosition","initMovementListener","moveElement","stopMovementListener","initResizementListener","labelWidth","labelHeight","stopResizementListener","box","href","zIndex","meta","preventDefault","nativeEvent","classList","add","getLabelWithMacrosReplaced","table","row","emptyRow1","emptyRow2","cell","innerHTML","textAlign","updateDomElement","newProps","prevProps","shouldBeUpdated","render","newMetadata","setMeta","prevMetadata","prevMeta","oldLabelHtml","newLabelHtml","attrs","attributes","nodeName","setAttributeNode","parentNode","replaceChild","forEach","disposable","dispose","ignored","position","flexDirection","tables","getElementsByTagName","onClick","listener","on","push","onRemove","__webpack_exports__","TypedEvent","listeners","listenersOncer","off","once","callbackIndex","indexOf","splice","event","pipe","te","eventsHistoryPropsDecoder","html","encodedHtml","_Item__WEBPACK_IMPORTED_MODULE_1__","maxTime","EventsHistory","_super","__extends","scripts","src","eval","trim","aux","donutGraphPropsDecoder","DonutGraph","barsGraphPropsDecoder","BarsGraph","moduleGraphPropsDecoder","ModuleGraph","legendP","margin","overviewGraphs","getElementsByClassName","parseShowLastValueTooltip","showLastValueTooltip","staticGraphPropsDecoder","imageSrc","Item","statusImageSrc","lib","lastValue","StaticGraph","imgSrc","background","backgroundSize","backgroundPosition","setAttribute","iconPropsDecoder","Icon_assign","Icon","Icon_extends","colorCloudPropsDecoder","color","ColorCloud_assign","ColorCloud_svgNS","ColorCloud","ColorCloud_extends","createSvgElement","gradientId","svg","createElementNS","defs","radialGradient","stop0","stop100","circle","groupPropsDecoder","groupId","showStatistics","extractHtml","Group_assign","Group","Group_extends","parseClockType","clockType","parseClockFormat","clockFormat","clockPropsDecoder","clockTimezone","Clock_assign","clockTimezoneOffset","showClockTimezone","items_Clock","Clock","intervalRef","startTick","createClock","TICK_INTERVAL","Clock_extends","stopTick","clearInterval","handler","interval","setInterval","getElementSize","newWidth","newHeight","createAnalogicClock","createDigitalClock","svgNS","colors","dateFontSize","baseTimeFontSize","div","clockFace","clockFaceBackground","city","getHumanTimezone","timezoneComplication","textContent","marksGroup","mainMarkGroup","mark1a","mark1b","mark","hourHand","hourHandA","hourHandB","minuteHand","minuteHandA","minuteHandB","minuteHandPin","secondHand","secondHandBar","secondHandPin","pin","getOriginDate","seconds","minutes","secAngle","minuteAngle","hourAngle","join","dateElem","fontSize","tzFontSizeMultiplier","timeFontSize","tzFontSize","min","timeElem","tzElem","initialDate","targetTZOffset","localTZOffset","getTimezoneOffset","utimestamp","timezone","_b","split","diameter","boxPropsDecoder","Box_assign","borderColor","fillColor","Box","Box_extends","boxSizing","backgroundColor","borderStyle","maxBorderWidth","linePropsDecoder","Line_assign","startPosition","startX","startY","endPosition","endX","endY","lineWidth","Line","extractBoxSizeAndPosition","Line_extends","toString","line","labelPropsDecoder","Label_assign","Label","Label_extends","parseValueType","valueType","parseProcessValue","processValue","simpleValuePropsDecoder","SimpleValue_assign","period","SimpleValue","SimpleValue_extends","img","pi","PI","tau","tauEpsilon","Path","_x0","_y0","_x1","_y1","_","path","constructor","moveTo","closePath","lineTo","quadraticCurveTo","x1","y1","bezierCurveTo","x2","y2","arcTo","x0","y0","x21","y21","x01","y01","l01_2","x20","y20","l21_2","l20_2","l21","sqrt","l01","tan","acos","t01","t21","arc","a0","a1","ccw","dx","cos","dy","sin","cw","da","rect","w","h","src_path","constant","atan2","max","math_epsilon","math_pi","halfPi","math_tau","asin","arcInnerRadius","innerRadius","arcOuterRadius","outerRadius","arcStartAngle","startAngle","arcEndAngle","endAngle","arcPadAngle","padAngle","cornerTangents","r1","rc","lo","ox","oy","x11","y11","x10","y10","x00","y00","d2","D","cx0","cy0","cx1","cy1","dx0","dy0","dx1","dy1","cx","cy","src_arc","cornerRadius","padRadius","context","buffer","r0","t0","t1","a01","a11","a00","a10","da0","da1","ap","rp","rc0","rc1","p0","p1","oc","x3","y3","x32","y32","intersect","ax","ay","bx","by","kc","lc","centroid","a","Linear","_context","areaStart","_line","areaEnd","NaN","lineStart","_point","lineEnd","point","linear","curveRadial","Radial","curve","_curve","radial","Array","slice","kr","noop","that","Basis","BasisClosed","_x2","_x3","_x4","_y2","_y3","_y4","BasisOpen","Bundle","beta","_basis","_beta","_x","_y","j","custom","bundle","cardinal_point","_k","Cardinal","tension","cardinal","CardinalClosed","_x5","_y5","CardinalOpen","catmullRom_point","_l01_a","_l01_2a","_l12_a","_l12_2a","_l23_a","b","_l23_2a","CatmullRom","alpha","_alpha","x23","y23","pow","catmullRom","CatmullRomClosed","CatmullRomOpen","LinearClosed","sign","slope3","h0","h1","s0","s1","slope2","monotone_point","MonotoneX","MonotoneY","ReflectContext","Natural","controlPoints","_t0","px","py","i0","i1","Step","_t","extractPercentileType","extractValueType","percentilePropsDecoder","Percentile_assign","percentileType","minValue","maxValue","labelColor","unit","Percentile_svgNS","Percentile","Percentile_extends","formatValue","progress","getProgress","NumberFormat","backgroundRect","progressRect","backgroundCircle","progressCircle","arcProps","trunc","servicePropsDecoder","encodedTitle","serviceId","Service_assign","Service","Service_extends","itemInstanceFrom","items_StaticGraph","items_SimpleValue","items_Percentile","items_Label","items_Icon","items_Service","items_Group","items_Box","items_Line","items_ColorCloud","VisualConsole","items","elementsById","elementIds","relations","handleElementClick","handleElementMovement","handleElementResizement","handleElementRemove","filter","clearRelations","containerRef","_props","backgroundURL","isFavorite","relationLineWidth","VisualConsole_assign","visualConsolePropsDecoder","sort","itemInstance","console","log","message","buildRelations","map","updateElements","itemIds","decodeProps","backgroundImage","elements","parent_1","child","addRelationLine","itemId","ids","childId","getRelationLine","identifier","parent","clientWidth","clientHeight","onItemClick","onItemMoved","onItemResized","enableEditMode","disableEditMode","AsyncTaskManager_AsyncTask","AsyncTask","taskInitiator","cancellable","cancel","_status","statusChangeEventManager","status","init","onStatusChange","AsyncTaskManager","tasks","asyncTask","task","ref","asyncPeriodic","src_VisualConsole","lib_AsyncTaskManager"],"mappings":"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","file":"vc.main.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 9);\n","import {\n  AnyObject,\n  Position,\n  Size,\n  WithAgentProps,\n  WithModuleProps,\n  LinkedVisualConsoleProps,\n  LinkedVisualConsolePropsStatus,\n  UnknownObject,\n  ItemMeta\n} from \"./types\";\n\n/**\n * Return a number or a default value from a raw value.\n * @param value Raw value from which we will try to extract a valid number.\n * @param defaultValue Default value to use if we cannot extract a valid number.\n * @return A valid number or the default value.\n */\nexport function parseIntOr<T>(value: unknown, defaultValue: T): number | T {\n  if (typeof value === \"number\") return value;\n  if (typeof value === \"string\" && value.length > 0 && !isNaN(parseInt(value)))\n    return parseInt(value);\n  else return defaultValue;\n}\n\n/**\n * Return a number or a default value from a raw value.\n * @param value Raw value from which we will try to extract a valid number.\n * @param defaultValue Default value to use if we cannot extract a valid number.\n * @return A valid number or the default value.\n */\nexport function parseFloatOr<T>(value: unknown, defaultValue: T): number | T {\n  if (typeof value === \"number\") return value;\n  if (\n    typeof value === \"string\" &&\n    value.length > 0 &&\n    !isNaN(parseFloat(value))\n  )\n    return parseFloat(value);\n  else return defaultValue;\n}\n\n/**\n * Check if a string exists and it's not empty.\n * @param value Value to check.\n * @return The check result.\n */\nexport function stringIsEmpty(value?: string | null): boolean {\n  return value == null || value.length === 0;\n}\n\n/**\n * Return a not empty string or a default value from a raw value.\n * @param value Raw value from which we will try to extract a non empty string.\n * @param defaultValue Default value to use if we cannot extract a non empty string.\n * @return A non empty string or the default value.\n */\nexport function notEmptyStringOr<T>(\n  value: unknown,\n  defaultValue: T\n): string | T {\n  return typeof value === \"string\" && value.length > 0 ? value : defaultValue;\n}\n\n/**\n * Return a boolean from a raw value.\n * @param value Raw value from which we will try to extract the boolean.\n * @return A valid boolean value. false by default.\n */\nexport function parseBoolean(value: unknown): boolean {\n  if (typeof value === \"boolean\") return value;\n  else if (typeof value === \"number\") return value > 0;\n  else if (typeof value === \"string\") return value === \"1\" || value === \"true\";\n  else return false;\n}\n\n/**\n * Return a valid date or a default value from a raw value.\n * @param value Raw value from which we will try to extract a valid date.\n * @param defaultValue Default value to use if we cannot extract a valid date.\n * @return A valid date or the default value.\n */\nexport function parseDateOr<T>(value: unknown, defaultValue: T): Date | T {\n  if (value instanceof Date) return value;\n  else if (typeof value === \"number\") return new Date(value * 1000);\n  else if (\n    typeof value === \"string\" &&\n    !Number.isNaN(new Date(value).getTime())\n  )\n    return new Date(value);\n  else return defaultValue;\n}\n\n/**\n * Pad the current string with another string (multiple times, if needed)\n * until the resulting string reaches the given length.\n * The padding is applied from the start (left) of the current string.\n * @param value Text that needs to be padded.\n * @param length Length of the returned text.\n * @param pad Text to add.\n * @return Padded text.\n */\nexport function leftPad(\n  value: string | number,\n  length: number,\n  pad: string | number = \" \"\n): string {\n  if (typeof value === \"number\") value = `${value}`;\n  if (typeof pad === \"number\") pad = `${pad}`;\n\n  const diffLength = length - value.length;\n  if (diffLength === 0) return value;\n  if (diffLength < 0) return value.substr(Math.abs(diffLength));\n\n  if (diffLength === pad.length) return `${pad}${value}`;\n  if (diffLength < pad.length) return `${pad.substring(0, diffLength)}${value}`;\n\n  const repeatTimes = Math.floor(diffLength / pad.length);\n  const restLength = diffLength - pad.length * repeatTimes;\n\n  let newPad = \"\";\n  for (let i = 0; i < repeatTimes; i++) newPad += pad;\n\n  if (restLength === 0) return `${newPad}${value}`;\n  return `${newPad}${pad.substring(0, restLength)}${value}`;\n}\n\n/* Decoders */\n\n/**\n * Build a valid typed object from a raw object.\n * @param data Raw object.\n * @return An object representing the position.\n */\nexport function positionPropsDecoder(data: AnyObject): Position {\n  return {\n    x: parseIntOr(data.x, 0),\n    y: parseIntOr(data.y, 0)\n  };\n}\n\n/**\n * Build a valid typed object from a raw object.\n * @param data Raw object.\n * @return An object representing the size.\n * @throws Will throw a TypeError if the width and height are not valid numbers.\n */\nexport function sizePropsDecoder(data: AnyObject): Size | never {\n  if (\n    data.width == null ||\n    isNaN(parseInt(data.width)) ||\n    data.height == null ||\n    isNaN(parseInt(data.height))\n  ) {\n    throw new TypeError(\"invalid size.\");\n  }\n\n  return {\n    width: parseInt(data.width),\n    height: parseInt(data.height)\n  };\n}\n\n/**\n * Build a valid typed object from a raw object.\n * @param data Raw object.\n * @return An object representing the agent properties.\n */\nexport function agentPropsDecoder(data: AnyObject): WithAgentProps {\n  const agentProps: WithAgentProps = {\n    agentId: parseIntOr(data.agent, null),\n    agentName: notEmptyStringOr(data.agentName, null),\n    agentAlias: notEmptyStringOr(data.agentAlias, null),\n    agentDescription: notEmptyStringOr(data.agentDescription, null),\n    agentAddress: notEmptyStringOr(data.agentAddress, null)\n  };\n\n  return data.metaconsoleId != null\n    ? {\n        metaconsoleId: data.metaconsoleId,\n        ...agentProps // Object spread: http://es6-features.org/#SpreadOperator\n      }\n    : agentProps;\n}\n\n/**\n * Build a valid typed object from a raw object.\n * @param data Raw object.\n * @return An object representing the module and agent properties.\n */\nexport function modulePropsDecoder(data: AnyObject): WithModuleProps {\n  return {\n    moduleId: parseIntOr(data.moduleId, null),\n    moduleName: notEmptyStringOr(data.moduleName, null),\n    moduleDescription: notEmptyStringOr(data.moduleDescription, null),\n    ...agentPropsDecoder(data) // Object spread: http://es6-features.org/#SpreadOperator\n  };\n}\n\n/**\n * Build a valid typed object from a raw object.\n * @param data Raw object.\n * @return An object representing the linked visual console properties.\n * @throws Will throw a TypeError if the status calculation properties are invalid.\n */\nexport function linkedVCPropsDecoder(\n  data: AnyObject\n): LinkedVisualConsoleProps | never {\n  // Object destructuring: http://es6-features.org/#ObjectMatchingShorthandNotation\n  const {\n    metaconsoleId,\n    linkedLayoutId: id,\n    linkedLayoutAgentId: agentId\n  } = data;\n\n  let linkedLayoutStatusProps: LinkedVisualConsolePropsStatus = {\n    linkedLayoutStatusType: \"default\"\n  };\n  switch (data.linkedLayoutStatusType) {\n    case \"weight\": {\n      const weight = parseIntOr(data.linkedLayoutStatusTypeWeight, null);\n      if (weight == null)\n        throw new TypeError(\"invalid status calculation properties.\");\n\n      if (data.linkedLayoutStatusTypeWeight)\n        linkedLayoutStatusProps = {\n          linkedLayoutStatusType: \"weight\",\n          linkedLayoutStatusTypeWeight: weight\n        };\n      break;\n    }\n    case \"service\": {\n      const warningThreshold = parseIntOr(\n        data.linkedLayoutStatusTypeWarningThreshold,\n        null\n      );\n      const criticalThreshold = parseIntOr(\n        data.linkedLayoutStatusTypeCriticalThreshold,\n        null\n      );\n      if (warningThreshold == null || criticalThreshold == null) {\n        throw new TypeError(\"invalid status calculation properties.\");\n      }\n\n      linkedLayoutStatusProps = {\n        linkedLayoutStatusType: \"service\",\n        linkedLayoutStatusTypeWarningThreshold: warningThreshold,\n        linkedLayoutStatusTypeCriticalThreshold: criticalThreshold\n      };\n      break;\n    }\n  }\n\n  const linkedLayoutBaseProps = {\n    linkedLayoutId: parseIntOr(id, null),\n    linkedLayoutAgentId: parseIntOr(agentId, null),\n    ...linkedLayoutStatusProps // Object spread: http://es6-features.org/#SpreadOperator\n  };\n\n  return metaconsoleId != null\n    ? {\n        metaconsoleId,\n        ...linkedLayoutBaseProps // Object spread: http://es6-features.org/#SpreadOperator\n      }\n    : linkedLayoutBaseProps;\n}\n\n/**\n * Build a valid typed object from a raw object.\n * @param data Raw object.\n * @return An object representing the item's meta properties.\n */\nexport function itemMetaDecoder(data: UnknownObject): ItemMeta | never {\n  const receivedAt = parseDateOr(data.receivedAt, null);\n  if (receivedAt === null) throw new TypeError(\"invalid meta structure\");\n\n  let error = null;\n  if (data.error instanceof Error) error = data.error;\n  else if (typeof data.error === \"string\") error = new Error(data.error);\n\n  return {\n    receivedAt,\n    error,\n    editMode: parseBoolean(data.editMode),\n    isFromCache: parseBoolean(data.isFromCache),\n    isFetching: false,\n    isUpdating: false\n  };\n}\n\n/**\n * To get a CSS rule with the most used prefixes.\n * @param ruleName Name of the CSS rule.\n * @param ruleValue Value of the CSS rule.\n * @return An array of rules with the prefixes applied.\n */\nexport function prefixedCssRules(\n  ruleName: string,\n  ruleValue: string\n): string[] {\n  const rule = `${ruleName}: ${ruleValue};`;\n  return [\n    `-webkit-${rule}`,\n    `-moz-${rule}`,\n    `-ms-${rule}`,\n    `-o-${rule}`,\n    `${rule}`\n  ];\n}\n\n/**\n * Decode a base64 string.\n * @param input Data encoded using base64.\n * @return Decoded data.\n */\nexport function decodeBase64(input: string): string {\n  return decodeURIComponent(escape(window.atob(input)));\n}\n\n/**\n * Generate a date representation with the format 'd/m/Y'.\n * @param initialDate Date to be used instead of a generated one.\n * @param locale Locale to use if localization is required and available.\n * @example 24/02/2020.\n * @return Date representation.\n */\nexport function humanDate(date: Date, locale: string | null = null): string {\n  if (locale && Intl && Intl.DateTimeFormat) {\n    // Format using the user locale.\n    const options: Intl.DateTimeFormatOptions = {\n      day: \"2-digit\",\n      month: \"2-digit\",\n      year: \"numeric\"\n    };\n    return Intl.DateTimeFormat(locale, options).format(date);\n  } else {\n    // Use getDate, getDay returns the week day.\n    const day = leftPad(date.getDate(), 2, 0);\n    // The getMonth function returns the month starting by 0.\n    const month = leftPad(date.getMonth() + 1, 2, 0);\n    const year = leftPad(date.getFullYear(), 4, 0);\n\n    // Format: 'd/m/Y'.\n    return `${day}/${month}/${year}`;\n  }\n}\n\n/**\n * Generate a time representation with the format 'hh:mm:ss'.\n * @param initialDate Date to be used instead of a generated one.\n * @example 01:34:09.\n * @return Time representation.\n */\nexport function humanTime(date: Date): string {\n  const hours = leftPad(date.getHours(), 2, 0);\n  const minutes = leftPad(date.getMinutes(), 2, 0);\n  const seconds = leftPad(date.getSeconds(), 2, 0);\n\n  return `${hours}:${minutes}:${seconds}`;\n}\n\ninterface Macro {\n  macro: string | RegExp;\n  value: string;\n}\n/**\n * Replace the macros of a text.\n * @param macros List of macros and their replacements.\n * @param text Text in which we need to replace the macros.\n */\nexport function replaceMacros(macros: Macro[], text: string): string {\n  return macros.reduce(\n    (acc, { macro, value }) => acc.replace(macro, value),\n    text\n  );\n}\n\n/**\n * Create a function which will limit the rate of execution of\n * the selected function to one time for the selected interval.\n * @param delay Interval.\n * @param fn Function to be executed at a limited rate.\n */\nexport function throttle<T, R>(delay: number, fn: (...args: T[]) => R) {\n  let last = 0;\n  return (...args: T[]) => {\n    const now = Date.now();\n    if (now - last < delay) return;\n    last = now;\n    return fn(...args);\n  };\n}\n\n/**\n * Create a function which will call the selected function only\n * after the interval time has passed after its last execution.\n * @param delay Interval.\n * @param fn Function to be executed after the last call.\n */\nexport function debounce<T>(delay: number, fn: (...args: T[]) => void) {\n  let timerRef: number | null = null;\n  return (...args: T[]) => {\n    if (timerRef !== null) window.clearTimeout(timerRef);\n    timerRef = window.setTimeout(() => {\n      fn(...args);\n      timerRef = null;\n    }, delay);\n  };\n}\n\n/**\n * Retrieve the offset of an element relative to the page.\n * @param el Node used to calculate the offset.\n */\nfunction getOffset(el: HTMLElement | null) {\n  let x = 0;\n  let y = 0;\n  while (el && !Number.isNaN(el.offsetLeft) && !Number.isNaN(el.offsetTop)) {\n    x += el.offsetLeft - el.scrollLeft;\n    y += el.offsetTop - el.scrollTop;\n    el = el.offsetParent as HTMLElement | null;\n  }\n  return { top: y, left: x };\n}\n\n/**\n * Add the grab & move functionality to a certain element inside it's container.\n *\n * @param element Element to move.\n * @param onMoved Function to execute when the element moves.\n *\n * @return A function which will clean the event handlers when executed.\n */\nexport function addMovementListener(\n  element: HTMLElement,\n  onMoved: (x: Position[\"x\"], y: Position[\"y\"]) => void\n): Function {\n  const container = element.parentElement as HTMLElement;\n  // Store the initial draggable state.\n  const isDraggable = element.draggable;\n  // Init the coordinates.\n  let lastX: Position[\"x\"] = 0;\n  let lastY: Position[\"y\"] = 0;\n  let lastMouseX: Position[\"x\"] = 0;\n  let lastMouseY: Position[\"y\"] = 0;\n  let mouseElementOffsetX: Position[\"x\"] = 0;\n  let mouseElementOffsetY: Position[\"y\"] = 0;\n  // Bounds.\n  let containerBounds = container.getBoundingClientRect();\n  let containerOffset = getOffset(container);\n  let containerTop = containerOffset.top;\n  let containerBottom = containerTop + containerBounds.height;\n  let containerLeft = containerOffset.left;\n  let containerRight = containerLeft + containerBounds.width;\n  let elementBounds = element.getBoundingClientRect();\n  let borderWidth = window.getComputedStyle(element).borderWidth || \"0\";\n  let borderFix = Number.parseInt(borderWidth) * 2;\n\n  // Will run onMoved 32ms after its last execution.\n  const debouncedMovement = debounce(32, (x: Position[\"x\"], y: Position[\"y\"]) =>\n    onMoved(x, y)\n  );\n  // Will run onMoved one time max every 16ms.\n  const throttledMovement = throttle(16, (x: Position[\"x\"], y: Position[\"y\"]) =>\n    onMoved(x, y)\n  );\n\n  const handleMove = (e: MouseEvent) => {\n    // Calculate the new element coordinates.\n    let x = 0;\n    let y = 0;\n\n    const mouseX = e.pageX;\n    const mouseY = e.pageY;\n    const mouseDeltaX = mouseX - lastMouseX;\n    const mouseDeltaY = mouseY - lastMouseY;\n\n    const minX = 0;\n    const maxX = containerBounds.width - elementBounds.width + borderFix;\n    const minY = 0;\n    const maxY = containerBounds.height - elementBounds.height + borderFix;\n\n    const outOfBoundsLeft =\n      mouseX < containerLeft ||\n      (lastX === 0 &&\n        mouseDeltaX > 0 &&\n        mouseX < containerLeft + mouseElementOffsetX);\n    const outOfBoundsRight =\n      mouseX > containerRight ||\n      mouseDeltaX + lastX + elementBounds.width - borderFix >\n        containerBounds.width ||\n      (lastX === maxX &&\n        mouseDeltaX < 0 &&\n        mouseX > containerLeft + maxX + mouseElementOffsetX);\n    const outOfBoundsTop =\n      mouseY < containerTop ||\n      (lastY === 0 &&\n        mouseDeltaY > 0 &&\n        mouseY < containerTop + mouseElementOffsetY);\n    const outOfBoundsBottom =\n      mouseY > containerBottom ||\n      mouseDeltaY + lastY + elementBounds.height - borderFix >\n        containerBounds.height ||\n      (lastY === maxY &&\n        mouseDeltaY < 0 &&\n        mouseY > containerTop + maxY + mouseElementOffsetY);\n\n    if (outOfBoundsLeft) x = minX;\n    else if (outOfBoundsRight) x = maxX;\n    else x = mouseDeltaX + lastX;\n\n    if (outOfBoundsTop) y = minY;\n    else if (outOfBoundsBottom) y = maxY;\n    else y = mouseDeltaY + lastY;\n\n    if (x < 0) x = minX;\n    if (y < 0) y = minY;\n\n    // Store the last mouse coordinates.\n    lastMouseX = mouseX;\n    lastMouseY = mouseY;\n\n    if (x === lastX && y === lastY) return;\n\n    // Run the movement events.\n    throttledMovement(x, y);\n    debouncedMovement(x, y);\n\n    // Store the coordinates of the element.\n    lastX = x;\n    lastY = y;\n  };\n  const handleEnd = () => {\n    // Reset the positions.\n    lastX = 0;\n    lastY = 0;\n    lastMouseX = 0;\n    lastMouseY = 0;\n    // Remove the move event.\n    document.removeEventListener(\"mousemove\", handleMove);\n    // Clean itself.\n    document.removeEventListener(\"mouseup\", handleEnd);\n    // Reset the draggable property to its initial state.\n    element.draggable = isDraggable;\n    // Reset the body selection property to a default state.\n    document.body.style.userSelect = \"auto\";\n  };\n  const handleStart = (e: MouseEvent) => {\n    e.stopPropagation();\n\n    // Disable the drag temporarily.\n    element.draggable = false;\n\n    // Store the difference between the cursor and\n    // the initial coordinates of the element.\n    lastX = element.offsetLeft;\n    lastY = element.offsetTop;\n    // Store the mouse position.\n    lastMouseX = e.pageX;\n    lastMouseY = e.pageY;\n    // Store the relative position between the mouse and the element.\n    mouseElementOffsetX = e.offsetX;\n    mouseElementOffsetY = e.offsetY;\n\n    // Initialize the bounds.\n    containerBounds = container.getBoundingClientRect();\n    containerOffset = getOffset(container);\n    containerTop = containerOffset.top;\n    containerBottom = containerTop + containerBounds.height;\n    containerLeft = containerOffset.left;\n    containerRight = containerLeft + containerBounds.width;\n    elementBounds = element.getBoundingClientRect();\n    borderWidth = window.getComputedStyle(element).borderWidth || \"0\";\n    borderFix = Number.parseInt(borderWidth) * 2;\n\n    // Listen to the mouse movement.\n    document.addEventListener(\"mousemove\", handleMove);\n    // Listen to the moment when the mouse click is not pressed anymore.\n    document.addEventListener(\"mouseup\", handleEnd);\n    // Limit the mouse selection of the body.\n    document.body.style.userSelect = \"none\";\n  };\n\n  // Event to listen the init of the movement.\n  element.addEventListener(\"mousedown\", handleStart);\n\n  // Returns a function to clean the event listeners.\n  return () => {\n    element.removeEventListener(\"mousedown\", handleStart);\n    handleEnd();\n  };\n}\n\n/**\n * Add the grab & resize functionality to a certain element.\n *\n * @param element Element to move.\n * @param onResized Function to execute when the element is resized.\n *\n * @return A function which will clean the event handlers when executed.\n */\nexport function addResizementListener(\n  element: HTMLElement,\n  onResized: (x: Position[\"x\"], y: Position[\"y\"]) => void\n): Function {\n  const minWidth = 15;\n  const minHeight = 15;\n\n  const resizeDraggable = document.createElement(\"div\");\n  resizeDraggable.className = \"resize-draggable\";\n  element.appendChild(resizeDraggable);\n\n  // Container of the resizable element.\n  const container = element.parentElement as HTMLElement;\n  // Store the initial draggable state.\n  const isDraggable = element.draggable;\n  // Init the coordinates.\n  let lastWidth: Size[\"width\"] = 0;\n  let lastHeight: Size[\"height\"] = 0;\n  let lastMouseX: Position[\"x\"] = 0;\n  let lastMouseY: Position[\"y\"] = 0;\n  let mouseElementOffsetX: Position[\"x\"] = 0;\n  let mouseElementOffsetY: Position[\"y\"] = 0;\n  // Init the bounds.\n  let containerBounds = container.getBoundingClientRect();\n  let containerOffset = getOffset(container);\n  let containerTop = containerOffset.top;\n  let containerBottom = containerTop + containerBounds.height;\n  let containerLeft = containerOffset.left;\n  let containerRight = containerLeft + containerBounds.width;\n  let elementOffset = getOffset(element);\n  let elementTop = elementOffset.top;\n  let elementLeft = elementOffset.left;\n  let borderWidth = window.getComputedStyle(element).borderWidth || \"0\";\n  let borderFix = Number.parseInt(borderWidth);\n\n  // Will run onResized 32ms after its last execution.\n  const debouncedResizement = debounce(\n    32,\n    (width: Size[\"width\"], height: Size[\"height\"]) => onResized(width, height)\n  );\n  // Will run onResized one time max every 16ms.\n  const throttledResizement = throttle(\n    16,\n    (width: Size[\"width\"], height: Size[\"height\"]) => onResized(width, height)\n  );\n\n  const handleResize = (e: MouseEvent) => {\n    // Calculate the new element coordinates.\n    let width = lastWidth + (e.pageX - lastMouseX);\n    let height = lastHeight + (e.pageY - lastMouseY);\n\n    if (width === lastWidth && height === lastHeight) return;\n\n    if (\n      width < lastWidth &&\n      e.pageX > elementLeft + (lastWidth - mouseElementOffsetX)\n    )\n      return;\n\n    if (width < minWidth) {\n      // Minimum value.\n      width = minWidth;\n    } else if (width + elementLeft - borderFix / 2 >= containerRight) {\n      // Limit the size to the container.\n      width = containerRight - elementLeft;\n    }\n    if (height < minHeight) {\n      // Minimum value.\n      height = minHeight;\n    } else if (height + elementTop - borderFix / 2 >= containerBottom) {\n      // Limit the size to the container.\n      height = containerBottom - elementTop;\n    }\n\n    // Run the movement events.\n    throttledResizement(width, height);\n    debouncedResizement(width, height);\n\n    // Store the coordinates of the element.\n    lastWidth = width;\n    lastHeight = height;\n    // Store the last mouse coordinates.\n    lastMouseX = e.pageX;\n    lastMouseY = e.pageY;\n  };\n  const handleEnd = () => {\n    // Reset the positions.\n    lastWidth = 0;\n    lastHeight = 0;\n    lastMouseX = 0;\n    lastMouseY = 0;\n    mouseElementOffsetX = 0;\n    mouseElementOffsetY = 0;\n    // Remove the move event.\n    document.removeEventListener(\"mousemove\", handleResize);\n    // Clean itself.\n    document.removeEventListener(\"mouseup\", handleEnd);\n    // Reset the draggable property to its initial state.\n    element.draggable = isDraggable;\n    // Reset the body selection property to a default state.\n    document.body.style.userSelect = \"auto\";\n  };\n  const handleStart = (e: MouseEvent) => {\n    e.stopPropagation();\n\n    // Disable the drag temporarily.\n    element.draggable = false;\n\n    // Store the difference between the cursor and\n    // the initial coordinates of the element.\n    const { width, height } = element.getBoundingClientRect();\n    lastWidth = width;\n    lastHeight = height;\n    // Store the mouse position.\n    lastMouseX = e.pageX;\n    lastMouseY = e.pageY;\n    // Store the relative position between the mouse and the element.\n    mouseElementOffsetX = e.offsetX;\n    mouseElementOffsetY = e.offsetY;\n\n    // Initialize the bounds.\n    containerBounds = container.getBoundingClientRect();\n    containerOffset = getOffset(container);\n    containerTop = containerOffset.top;\n    containerBottom = containerTop + containerBounds.height;\n    containerLeft = containerOffset.left;\n    containerRight = containerLeft + containerBounds.width;\n    elementOffset = getOffset(element);\n    elementTop = elementOffset.top;\n    elementLeft = elementOffset.left;\n\n    // Listen to the mouse movement.\n    document.addEventListener(\"mousemove\", handleResize);\n    // Listen to the moment when the mouse click is not pressed anymore.\n    document.addEventListener(\"mouseup\", handleEnd);\n    // Limit the mouse selection of the body.\n    document.body.style.userSelect = \"none\";\n  };\n\n  // Event to listen the init of the movement.\n  resizeDraggable.addEventListener(\"mousedown\", handleStart);\n\n  // Returns a function to clean the event listeners.\n  return () => {\n    resizeDraggable.remove();\n    handleEnd();\n  };\n}\n","import {\n  Position,\n  Size,\n  AnyObject,\n  WithModuleProps,\n  ItemMeta\n} from \"./lib/types\";\nimport {\n  sizePropsDecoder,\n  positionPropsDecoder,\n  parseIntOr,\n  parseBoolean,\n  notEmptyStringOr,\n  replaceMacros,\n  humanDate,\n  humanTime,\n  addMovementListener,\n  debounce,\n  addResizementListener\n} from \"./lib\";\nimport TypedEvent, { Listener, Disposable } from \"./lib/TypedEvent\";\n\n// Enum: https://www.typescriptlang.org/docs/handbook/enums.html.\nexport const enum ItemType {\n  STATIC_GRAPH = 0,\n  MODULE_GRAPH = 1,\n  SIMPLE_VALUE = 2,\n  PERCENTILE_BAR = 3,\n  LABEL = 4,\n  ICON = 5,\n  SIMPLE_VALUE_MAX = 6,\n  SIMPLE_VALUE_MIN = 7,\n  SIMPLE_VALUE_AVG = 8,\n  PERCENTILE_BUBBLE = 9,\n  SERVICE = 10,\n  GROUP_ITEM = 11,\n  BOX_ITEM = 12,\n  LINE_ITEM = 13,\n  AUTO_SLA_GRAPH = 14,\n  CIRCULAR_PROGRESS_BAR = 15,\n  CIRCULAR_INTERIOR_PROGRESS_BAR = 16,\n  DONUT_GRAPH = 17,\n  BARS_GRAPH = 18,\n  CLOCK = 19,\n  COLOR_CLOUD = 20\n}\n\n// Base item properties. This interface should be extended by the item implementations.\nexport interface ItemProps extends Position, Size {\n  readonly id: number;\n  readonly type: ItemType;\n  label: string | null;\n  labelPosition: \"up\" | \"right\" | \"down\" | \"left\";\n  isLinkEnabled: boolean;\n  link: string | null;\n  isOnTop: boolean;\n  parentId: number | null;\n  aclGroupId: number | null;\n}\n\n// FIXME: Fix type compatibility.\nexport interface ItemClickEvent<Props extends ItemProps> {\n  // data: Props;\n  data: AnyObject;\n  nativeEvent: Event;\n}\n\n// FIXME: Fix type compatibility.\nexport interface ItemRemoveEvent<Props extends ItemProps> {\n  // data: Props;\n  data: AnyObject;\n}\n\nexport interface ItemMovedEvent {\n  item: VisualConsoleItem<ItemProps>;\n  prevPosition: Position;\n  newPosition: Position;\n}\n\nexport interface ItemResizedEvent {\n  item: VisualConsoleItem<ItemProps>;\n  prevSize: Size;\n  newSize: Size;\n}\n\n/**\n * Extract a valid enum value from a raw label positi9on value.\n * @param labelPosition Raw value.\n */\nconst parseLabelPosition = (\n  labelPosition: unknown\n): ItemProps[\"labelPosition\"] => {\n  switch (labelPosition) {\n    case \"up\":\n    case \"right\":\n    case \"down\":\n    case \"left\":\n      return labelPosition;\n    default:\n      return \"down\";\n  }\n};\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the item props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function itemBasePropsDecoder(data: AnyObject): ItemProps | never {\n  if (data.id == null || isNaN(parseInt(data.id))) {\n    throw new TypeError(\"invalid id.\");\n  }\n  if (data.type == null || isNaN(parseInt(data.type))) {\n    throw new TypeError(\"invalid type.\");\n  }\n\n  return {\n    id: parseInt(data.id),\n    type: parseInt(data.type),\n    label: notEmptyStringOr(data.label, null),\n    labelPosition: parseLabelPosition(data.labelPosition),\n    isLinkEnabled: parseBoolean(data.isLinkEnabled),\n    link: notEmptyStringOr(data.link, null),\n    isOnTop: parseBoolean(data.isOnTop),\n    parentId: parseIntOr(data.parentId, null),\n    aclGroupId: parseIntOr(data.aclGroupId, null),\n    ...sizePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...positionPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\n/**\n * Base class of the visual console items. Should be extended to use its capabilities.\n */\nabstract class VisualConsoleItem<Props extends ItemProps> {\n  // Properties of the item.\n  private itemProps: Props;\n  // Metadata of the item.\n  private _metadata: ItemMeta;\n  // Reference to the DOM element which will contain the item.\n  public elementRef: HTMLElement;\n  public readonly labelElementRef: HTMLElement;\n  // Reference to the DOM element which will contain the view of the item which extends this class.\n  protected readonly childElementRef: HTMLElement;\n  // Event manager for click events.\n  private readonly clickEventManager = new TypedEvent<ItemClickEvent<Props>>();\n  // Event manager for moved events.\n  private readonly movedEventManager = new TypedEvent<ItemMovedEvent>();\n  // Event manager for resized events.\n  private readonly resizedEventManager = new TypedEvent<ItemResizedEvent>();\n  // Event manager for remove events.\n  private readonly removeEventManager = new TypedEvent<\n    ItemRemoveEvent<Props>\n  >();\n  // List of references to clean the event listeners.\n  private readonly disposables: Disposable[] = [];\n\n  // This function will only run the 2nd arg function after the time\n  // of the first arg have passed after its last execution.\n  private debouncedMovementSave = debounce(\n    500, // ms.\n    (x: Position[\"x\"], y: Position[\"y\"]) => {\n      const prevPosition = {\n        x: this.props.x,\n        y: this.props.y\n      };\n      const newPosition = {\n        x: x,\n        y: y\n      };\n\n      if (!this.positionChanged(prevPosition, newPosition)) return;\n\n      // Save the new position to the props.\n      this.move(x, y);\n      // Emit the movement event.\n      this.movedEventManager.emit({\n        item: this,\n        prevPosition: prevPosition,\n        newPosition: newPosition\n      });\n    }\n  );\n  // This property will store the function\n  // to clean the movement listener.\n  private removeMovement: Function | null = null;\n\n  /**\n   * Start the movement funtionality.\n   * @param element Element to move inside its container.\n   */\n  private initMovementListener(element: HTMLElement): void {\n    this.removeMovement = addMovementListener(\n      element,\n      (x: Position[\"x\"], y: Position[\"y\"]) => {\n        // Move the DOM element.\n        this.moveElement(x, y);\n        // Run the save function.\n        this.debouncedMovementSave(x, y);\n      }\n    );\n  }\n  /**\n   * Stop the movement fun\n   */\n  private stopMovementListener(): void {\n    if (this.removeMovement) {\n      this.removeMovement();\n      this.removeMovement = null;\n    }\n  }\n\n  // This function will only run the 2nd arg function after the time\n  // of the first arg have passed after its last execution.\n  private debouncedResizementSave = debounce(\n    500, // ms.\n    (width: Size[\"width\"], height: Size[\"height\"]) => {\n      const prevSize = {\n        width: this.props.width,\n        height: this.props.height\n      };\n      const newSize = {\n        width: width,\n        height: height\n      };\n\n      if (!this.sizeChanged(prevSize, newSize)) return;\n\n      // Save the new position to the props.\n      this.resize(width, height);\n      // Emit the resizement event.\n      this.resizedEventManager.emit({\n        item: this,\n        prevSize: prevSize,\n        newSize: newSize\n      });\n    }\n  );\n  // This property will store the function\n  // to clean the resizement listener.\n  private removeResizement: Function | null = null;\n\n  /**\n   * Start the resizement funtionality.\n   * @param element Element to move inside its container.\n   */\n  protected initResizementListener(element: HTMLElement): void {\n    this.removeResizement = addResizementListener(\n      element,\n      (width: Size[\"width\"], height: Size[\"height\"]) => {\n        // The label it's outside the item's size, so we need\n        // to get rid of its size to get the real size of the\n        // item's content.\n        if (this.props.label && this.props.label.length > 0) {\n          const {\n            width: labelWidth,\n            height: labelHeight\n          } = this.labelElementRef.getBoundingClientRect();\n\n          switch (this.props.labelPosition) {\n            case \"up\":\n            case \"down\":\n              height -= labelHeight;\n              break;\n            case \"left\":\n            case \"right\":\n              width -= labelWidth;\n              break;\n          }\n        }\n\n        // Move the DOM element.\n        this.resizeElement(width, height);\n        // Run the save function.\n        this.debouncedResizementSave(width, height);\n      }\n    );\n  }\n  /**\n   * Stop the resizement functionality.\n   */\n  private stopResizementListener(): void {\n    if (this.removeResizement) {\n      this.removeResizement();\n      this.removeResizement = null;\n    }\n  }\n\n  /**\n   * To create a new element which will be inside the item box.\n   * @return Item.\n   */\n  protected abstract createDomElement(): HTMLElement;\n\n  public constructor(props: Props, metadata: ItemMeta) {\n    this.itemProps = props;\n    this._metadata = metadata;\n\n    /*\n     * Get a HTMLElement which represents the container box\n     * of the Visual Console item. This element will manage\n     * all the common things like click events, show a border\n     * when hovered, etc.\n     */\n    this.elementRef = this.createContainerDomElement();\n    this.labelElementRef = this.createLabelDomElement();\n\n    /*\n     * Get a HTMLElement which represents the custom view\n     * of the Visual Console item. This element will be\n     * different depending on the item implementation.\n     */\n    this.childElementRef = this.createDomElement();\n\n    // Insert the elements into the container.\n    this.elementRef.append(this.childElementRef, this.labelElementRef);\n\n    // Resize element.\n    this.resizeElement(props.width, props.height);\n    // Set label position.\n    this.changeLabelPosition(props.labelPosition);\n  }\n\n  /**\n   * To create a new box for the visual console item.\n   * @return Item box.\n   */\n  private createContainerDomElement(): HTMLElement {\n    let box;\n    if (this.props.isLinkEnabled) {\n      box = document.createElement(\"a\") as HTMLAnchorElement;\n      if (this.props.link) box.href = this.props.link;\n    } else {\n      box = document.createElement(\"div\") as HTMLDivElement;\n    }\n\n    box.className = \"visual-console-item\";\n    box.style.zIndex = this.props.isOnTop ? \"2\" : \"1\";\n    box.style.left = `${this.props.x}px`;\n    box.style.top = `${this.props.y}px`;\n    // Init the click listener.\n    box.addEventListener(\"click\", e => {\n      if (this.meta.editMode) {\n        e.preventDefault();\n        e.stopPropagation();\n      } else {\n        this.clickEventManager.emit({ data: this.props, nativeEvent: e });\n      }\n    });\n\n    // Metadata state.\n    if (this.meta.editMode) {\n      box.classList.add(\"is-editing\");\n      // Init the movement listener.\n      this.initMovementListener(box);\n      // Init the resizement listener.\n      this.initResizementListener(box);\n    }\n    if (this.meta.isFetching) {\n      box.classList.add(\"is-fetching\");\n    }\n    if (this.meta.isUpdating) {\n      box.classList.add(\"is-updating\");\n    }\n\n    return box;\n  }\n\n  /**\n   * To create a new label for the visual console item.\n   * @return Item label.\n   */\n  protected createLabelDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"visual-console-item-label\";\n    // Add the label if it exists.\n    const label = this.getLabelWithMacrosReplaced();\n    if (label.length > 0) {\n      // Ugly table we need to use to replicate the legacy style.\n      const table = document.createElement(\"table\");\n      const row = document.createElement(\"tr\");\n      const emptyRow1 = document.createElement(\"tr\");\n      const emptyRow2 = document.createElement(\"tr\");\n      const cell = document.createElement(\"td\");\n\n      cell.innerHTML = label;\n      row.append(cell);\n      table.append(emptyRow1, row, emptyRow2);\n      table.style.textAlign = \"center\";\n\n      // Change the table size depending on its position.\n      switch (this.props.labelPosition) {\n        case \"up\":\n        case \"down\":\n          if (this.props.width > 0) {\n            table.style.width = `${this.props.width}px`;\n            table.style.height = null;\n          }\n          break;\n        case \"left\":\n        case \"right\":\n          if (this.props.height > 0) {\n            table.style.width = null;\n            table.style.height = `${this.props.height}px`;\n          }\n          break;\n      }\n\n      // element.innerHTML = this.props.label;\n      element.append(table);\n    }\n\n    return element;\n  }\n\n  /**\n   * Return the label stored into the props with some macros replaced.\n   */\n  protected getLabelWithMacrosReplaced(): string {\n    // We assert that the props may have some needed properties.\n    const props = this.props as Partial<WithModuleProps>;\n\n    return replaceMacros(\n      [\n        {\n          macro: \"_date_\",\n          value: humanDate(new Date())\n        },\n        {\n          macro: \"_time_\",\n          value: humanTime(new Date())\n        },\n        {\n          macro: \"_agent_\",\n          value: props.agentAlias != null ? props.agentAlias : \"\"\n        },\n        {\n          macro: \"_agentdescription_\",\n          value: props.agentDescription != null ? props.agentDescription : \"\"\n        },\n        {\n          macro: \"_address_\",\n          value: props.agentAddress != null ? props.agentAddress : \"\"\n        },\n        {\n          macro: \"_module_\",\n          value: props.moduleName != null ? props.moduleName : \"\"\n        },\n        {\n          macro: \"_moduledescription_\",\n          value: props.moduleDescription != null ? props.moduleDescription : \"\"\n        }\n      ],\n      this.props.label || \"\"\n    );\n  }\n\n  /**\n   * To update the content element.\n   * @return Item.\n   */\n  protected updateDomElement(element: HTMLElement): void {\n    element.innerHTML = this.createDomElement().innerHTML;\n  }\n\n  /**\n   * Public accessor of the `props` property.\n   * @return Properties.\n   */\n  public get props(): Props {\n    return { ...this.itemProps }; // Return a copy.\n  }\n\n  /**\n   * Public setter of the `props` property.\n   * If the new props are different enough than the\n   * stored props, a render would be fired.\n   * @param newProps\n   */\n  public set props(newProps: Props) {\n    const prevProps = this.props;\n    // Update the internal props.\n    this.itemProps = newProps;\n\n    // From this point, things which rely on this.props can access to the changes.\n\n    // Check if we should re-render.\n    if (this.shouldBeUpdated(prevProps, newProps))\n      this.render(prevProps, this._metadata);\n  }\n\n  /**\n   * Public accessor of the `meta` property.\n   * @return Properties.\n   */\n  public get meta(): ItemMeta {\n    return { ...this._metadata }; // Return a copy.\n  }\n\n  /**\n   * Public setter of the `meta` property.\n   * If the new meta are different enough than the\n   * stored meta, a render would be fired.\n   * @param newProps\n   */\n  public set meta(newMetadata: ItemMeta) {\n    this.setMeta(newMetadata);\n  }\n\n  /**\n   * Clasic and protected version of the setter of the `meta` property.\n   * Useful to override it from children classes.\n   * @param newProps\n   */\n  protected setMeta(newMetadata: ItemMeta) {\n    const prevMetadata = this._metadata;\n    // Update the internal meta.\n    this._metadata = newMetadata;\n\n    // From this point, things which rely on this.props can access to the changes.\n\n    // Check if we should re-render.\n    // if (this.shouldBeUpdated(prevMetadata, newMetadata))\n    this.render(this.itemProps, prevMetadata);\n  }\n\n  /**\n   * To compare the previous and the new props and returns a boolean value\n   * in case the difference is meaningfull enough to perform DOM changes.\n   *\n   * Here, the only comparision is done by reference.\n   *\n   * Override this function to perform a different comparision depending on the item needs.\n   *\n   * @param prevProps\n   * @param newProps\n   * @return Whether the difference is meaningful enough to perform DOM changes or not.\n   */\n  protected shouldBeUpdated(prevProps: Props, newProps: Props): boolean {\n    return prevProps !== newProps;\n  }\n\n  /**\n   * To recreate or update the HTMLElement which represents the item into the DOM.\n   * @param prevProps If exists it will be used to only perform DOM updates instead of a full replace.\n   */\n  public render(\n    prevProps: Props | null = null,\n    prevMeta: ItemMeta | null = null\n  ): void {\n    this.updateDomElement(this.childElementRef);\n\n    // Move box.\n    if (!prevProps || this.positionChanged(prevProps, this.props)) {\n      this.moveElement(this.props.x, this.props.y);\n    }\n    // Resize box.\n    if (!prevProps || this.sizeChanged(prevProps, this.props)) {\n      this.resizeElement(this.props.width, this.props.height);\n    }\n    // Change label.\n    const oldLabelHtml = this.labelElementRef.innerHTML;\n    const newLabelHtml = this.createLabelDomElement().innerHTML;\n    if (oldLabelHtml !== newLabelHtml) {\n      this.labelElementRef.innerHTML = newLabelHtml;\n    }\n    // Change label position.\n    if (!prevProps || prevProps.labelPosition !== this.props.labelPosition) {\n      this.changeLabelPosition(this.props.labelPosition);\n    }\n    // Change link.\n    if (\n      prevProps &&\n      (prevProps.isLinkEnabled !== this.props.isLinkEnabled ||\n        (this.props.isLinkEnabled && prevProps.link !== this.props.link))\n    ) {\n      const container = this.createContainerDomElement();\n      // Add the children of the old element.\n      container.innerHTML = this.elementRef.innerHTML;\n      // Copy the attributes.\n      const attrs = this.elementRef.attributes;\n      for (let i = 0; i < attrs.length; i++) {\n        if (attrs[i].nodeName !== \"id\") {\n          container.setAttributeNode(attrs[i]);\n        }\n      }\n      // Replace the reference.\n      if (this.elementRef.parentNode !== null) {\n        this.elementRef.parentNode.replaceChild(container, this.elementRef);\n      }\n\n      // Changed the reference to the main element. It's ugly, but needed.\n      this.elementRef = container;\n    }\n\n    // Change metadata related things.\n    if (!prevMeta || prevMeta.editMode !== this.meta.editMode) {\n      if (this.meta.editMode) {\n        this.elementRef.classList.add(\"is-editing\");\n        this.initMovementListener(this.elementRef);\n        this.initResizementListener(this.elementRef);\n      } else {\n        this.elementRef.classList.remove(\"is-editing\");\n        this.stopMovementListener();\n        this.stopResizementListener();\n      }\n    }\n    if (!prevMeta || prevMeta.isFetching !== this.meta.isFetching) {\n      if (this.meta.isFetching) {\n        this.elementRef.classList.add(\"is-fetching\");\n      } else {\n        this.elementRef.classList.remove(\"is-fetching\");\n      }\n    }\n    if (!prevMeta || prevMeta.isUpdating !== this.meta.isUpdating) {\n      if (this.meta.isUpdating) {\n        this.elementRef.classList.add(\"is-updating\");\n      } else {\n        this.elementRef.classList.remove(\"is-updating\");\n      }\n    }\n  }\n\n  /**\n   * To remove the event listeners and the elements from the DOM.\n   */\n  public remove(): void {\n    // Call the remove event.\n    this.removeEventManager.emit({ data: this.props });\n    // Event listeners.\n    this.disposables.forEach(disposable => {\n      try {\n        disposable.dispose();\n      } catch (ignored) {} // eslint-disable-line no-empty\n    });\n    // VisualConsoleItem DOM element.\n    this.elementRef.remove();\n  }\n\n  /**\n   * Compare the previous and the new position and return\n   * a boolean value in case the position changed.\n   * @param prevPosition\n   * @param newPosition\n   * @return Whether the position changed or not.\n   */\n  protected positionChanged(\n    prevPosition: Position,\n    newPosition: Position\n  ): boolean {\n    return prevPosition.x !== newPosition.x || prevPosition.y !== newPosition.y;\n  }\n\n  /**\n   * Move the label around the item content.\n   * @param position Label position.\n   */\n  protected changeLabelPosition(position: Props[\"labelPosition\"]): void {\n    switch (position) {\n      case \"up\":\n        this.elementRef.style.flexDirection = \"column-reverse\";\n        break;\n      case \"left\":\n        this.elementRef.style.flexDirection = \"row-reverse\";\n        break;\n      case \"right\":\n        this.elementRef.style.flexDirection = \"row\";\n        break;\n      case \"down\":\n      default:\n        this.elementRef.style.flexDirection = \"column\";\n        break;\n    }\n\n    // Ugly table to show the label as its legacy counterpart.\n    const tables = this.labelElementRef.getElementsByTagName(\"table\");\n    const table = tables.length > 0 ? tables.item(0) : null;\n    // Change the table size depending on its position.\n    if (table) {\n      switch (this.props.labelPosition) {\n        case \"up\":\n        case \"down\":\n          if (this.props.width > 0) {\n            table.style.width = `${this.props.width}px`;\n            table.style.height = null;\n          }\n          break;\n        case \"left\":\n        case \"right\":\n          if (this.props.height > 0) {\n            table.style.width = null;\n            table.style.height = `${this.props.height}px`;\n          }\n          break;\n      }\n    }\n  }\n\n  /**\n   * Move the DOM container.\n   * @param x Horizontal axis position.\n   * @param y Vertical axis position.\n   */\n  protected moveElement(x: number, y: number): void {\n    this.elementRef.style.left = `${x}px`;\n    this.elementRef.style.top = `${y}px`;\n  }\n\n  /**\n   * Update the position into the properties and move the DOM container.\n   * @param x Horizontal axis position.\n   * @param y Vertical axis position.\n   */\n  public move(x: number, y: number): void {\n    this.moveElement(x, y);\n    this.itemProps = {\n      ...this.props, // Object spread: http://es6-features.org/#SpreadOperator\n      x,\n      y\n    };\n  }\n\n  /**\n   * Compare the previous and the new size and return\n   * a boolean value in case the size changed.\n   * @param prevSize\n   * @param newSize\n   * @return Whether the size changed or not.\n   */\n  protected sizeChanged(prevSize: Size, newSize: Size): boolean {\n    return (\n      prevSize.width !== newSize.width || prevSize.height !== newSize.height\n    );\n  }\n\n  /**\n   * Resize the DOM content container.\n   * @param width\n   * @param height\n   */\n  protected resizeElement(width: number, height: number): void {\n    // The most valuable size is the content size.\n    this.childElementRef.style.width = width > 0 ? `${width}px` : null;\n    this.childElementRef.style.height = height > 0 ? `${height}px` : null;\n\n    if (this.props.label && this.props.label.length > 0) {\n      // Ugly table to show the label as its legacy counterpart.\n      const tables = this.labelElementRef.getElementsByTagName(\"table\");\n      const table = tables.length > 0 ? tables.item(0) : null;\n\n      if (table) {\n        switch (this.props.labelPosition) {\n          case \"up\":\n          case \"down\":\n            table.style.width = width > 0 ? `${width}px` : null;\n            break;\n          case \"left\":\n          case \"right\":\n            table.style.height = height > 0 ? `${height}px` : null;\n            break;\n        }\n      }\n    }\n  }\n\n  /**\n   * Update the size into the properties and resize the DOM container.\n   * @param width\n   * @param height\n   */\n  public resize(width: number, height: number): void {\n    this.resizeElement(width, height);\n    this.itemProps = {\n      ...this.props, // Object spread: http://es6-features.org/#SpreadOperator\n      width,\n      height\n    };\n  }\n\n  /**\n   * To add an event handler to the click of the linked visual console elements.\n   * @param listener Function which is going to be executed when a linked console is clicked.\n   */\n  public onClick(listener: Listener<ItemClickEvent<Props>>): Disposable {\n    /*\n     * The '.on' function returns a function which will clean the event\n     * listener when executed. We store all the 'dispose' functions to\n     * call them when the item should be cleared.\n     */\n    const disposable = this.clickEventManager.on(listener);\n    this.disposables.push(disposable);\n\n    return disposable;\n  }\n\n  /**\n   * To add an event handler to the movement of visual console elements.\n   * @param listener Function which is going to be executed when a linked console is moved.\n   */\n  public onMoved(listener: Listener<ItemMovedEvent>): Disposable {\n    /*\n     * The '.on' function returns a function which will clean the event\n     * listener when executed. We store all the 'dispose' functions to\n     * call them when the item should be cleared.\n     */\n    const disposable = this.movedEventManager.on(listener);\n    this.disposables.push(disposable);\n\n    return disposable;\n  }\n\n  /**\n   * To add an event handler to the resizement of visual console elements.\n   * @param listener Function which is going to be executed when a linked console is moved.\n   */\n  public onResized(listener: Listener<ItemResizedEvent>): Disposable {\n    /*\n     * The '.on' function returns a function which will clean the event\n     * listener when executed. We store all the 'dispose' functions to\n     * call them when the item should be cleared.\n     */\n    const disposable = this.resizedEventManager.on(listener);\n    this.disposables.push(disposable);\n\n    return disposable;\n  }\n\n  /**\n   * To add an event handler to the removal of the item.\n   * @param listener Function which is going to be executed when a item is removed.\n   */\n  public onRemove(listener: Listener<ItemRemoveEvent<Props>>): Disposable {\n    /*\n     * The '.on' function returns a function which will clean the event\n     * listener when executed. We store all the 'dispose' functions to\n     * call them when the item should be cleared.\n     */\n    const disposable = this.removeEventManager.on(listener);\n    this.disposables.push(disposable);\n\n    return disposable;\n  }\n}\n\nexport default VisualConsoleItem;\n","export interface Listener<T> {\n  (event: T): void;\n}\n\nexport interface Disposable {\n  dispose: () => void;\n}\n\n/** passes through events as they happen. You will not get events from before you start listening */\nexport default class TypedEvent<T> {\n  private listeners: Listener<T>[] = [];\n  private listenersOncer: Listener<T>[] = [];\n\n  public on = (listener: Listener<T>): Disposable => {\n    this.listeners.push(listener);\n    return {\n      dispose: () => this.off(listener)\n    };\n  };\n\n  public once = (listener: Listener<T>): void => {\n    this.listenersOncer.push(listener);\n  };\n\n  public off = (listener: Listener<T>): void => {\n    const callbackIndex = this.listeners.indexOf(listener);\n    if (callbackIndex > -1) this.listeners.splice(callbackIndex, 1);\n  };\n\n  public emit = (event: T): void => {\n    /** Update any general listeners */\n    this.listeners.forEach(listener => listener(event));\n\n    /** Clear the `once` queue */\n    this.listenersOncer.forEach(listener => listener(event));\n    this.listenersOncer = [];\n  };\n\n  public pipe = (te: TypedEvent<T>): Disposable => this.on(e => te.emit(e));\n}\n","import { AnyObject, WithModuleProps } from \"../lib/types\";\nimport {\n  modulePropsDecoder,\n  parseIntOr,\n  decodeBase64,\n  stringIsEmpty\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type EventsHistoryProps = {\n  type: ItemType.AUTO_SLA_GRAPH;\n  maxTime: number | null;\n  html: string;\n} & ItemProps &\n  WithModuleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the events history props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function eventsHistoryPropsDecoder(\n  data: AnyObject\n): EventsHistoryProps | never {\n  if (stringIsEmpty(data.html) && stringIsEmpty(data.encodedHtml)) {\n    throw new TypeError(\"missing html content.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.AUTO_SLA_GRAPH,\n    maxTime: parseIntOr(data.maxTime, null),\n    html: !stringIsEmpty(data.html)\n      ? data.html\n      : decodeBase64(data.encodedHtml),\n    ...modulePropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class EventsHistory extends Item<EventsHistoryProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"events-history\";\n    element.innerHTML = this.props.html;\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const scripts = element.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      if (scripts[i].src.length === 0) {\n        setTimeout(() => {\n          try {\n            eval(scripts[i].innerHTML.trim());\n          } catch (ignored) {} // eslint-disable-line no-empty\n        }, 0);\n      }\n    }\n\n    return element;\n  }\n\n  protected updateDomElement(element: HTMLElement): void {\n    element.innerHTML = this.props.html;\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const aux = document.createElement(\"div\");\n    aux.innerHTML = this.props.html;\n    const scripts = aux.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      if (scripts[i].src.length === 0) {\n        eval(scripts[i].innerHTML.trim());\n      }\n    }\n  }\n}\n","import {\n  LinkedVisualConsoleProps,\n  AnyObject,\n  WithModuleProps\n} from \"../lib/types\";\nimport {\n  linkedVCPropsDecoder,\n  modulePropsDecoder,\n  decodeBase64,\n  stringIsEmpty\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type DonutGraphProps = {\n  type: ItemType.DONUT_GRAPH;\n  html: string;\n} & ItemProps &\n  WithModuleProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the donut graph props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function donutGraphPropsDecoder(\n  data: AnyObject\n): DonutGraphProps | never {\n  if (stringIsEmpty(data.html) && stringIsEmpty(data.encodedHtml)) {\n    throw new TypeError(\"missing html content.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.DONUT_GRAPH,\n    html: !stringIsEmpty(data.html)\n      ? data.html\n      : decodeBase64(data.encodedHtml),\n    ...modulePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class DonutGraph extends Item<DonutGraphProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"donut-graph\";\n    element.innerHTML = this.props.html;\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const scripts = element.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      setTimeout(() => {\n        if (scripts[i].src.length === 0) eval(scripts[i].innerHTML.trim());\n      }, 0);\n    }\n\n    return element;\n  }\n\n  protected updateDomElement(element: HTMLElement): void {\n    element.innerHTML = this.props.html;\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const aux = document.createElement(\"div\");\n    aux.innerHTML = this.props.html;\n    const scripts = aux.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      if (scripts[i].src.length === 0) {\n        eval(scripts[i].innerHTML.trim());\n      }\n    }\n  }\n}\n","import { AnyObject, WithModuleProps } from \"../lib/types\";\nimport { modulePropsDecoder, decodeBase64, stringIsEmpty } from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type BarsGraphProps = {\n  type: ItemType.BARS_GRAPH;\n  html: string;\n} & ItemProps &\n  WithModuleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the bars graph props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function barsGraphPropsDecoder(data: AnyObject): BarsGraphProps | never {\n  if (stringIsEmpty(data.html) && stringIsEmpty(data.encodedHtml)) {\n    throw new TypeError(\"missing html content.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.BARS_GRAPH,\n    html: !stringIsEmpty(data.html)\n      ? data.html\n      : decodeBase64(data.encodedHtml),\n    ...modulePropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class BarsGraph extends Item<BarsGraphProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"bars-graph\";\n    element.innerHTML = this.props.html;\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const scripts = element.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      setTimeout(() => {\n        if (scripts[i].src.length === 0) eval(scripts[i].innerHTML.trim());\n      }, 0);\n    }\n\n    return element;\n  }\n\n  protected updateDomElement(element: HTMLElement): void {\n    element.innerHTML = this.props.html;\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const aux = document.createElement(\"div\");\n    aux.innerHTML = this.props.html;\n    const scripts = aux.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      if (scripts[i].src.length === 0) {\n        eval(scripts[i].innerHTML.trim());\n      }\n    }\n  }\n}\n","import {\n  LinkedVisualConsoleProps,\n  AnyObject,\n  WithModuleProps\n} from \"../lib/types\";\nimport {\n  linkedVCPropsDecoder,\n  modulePropsDecoder,\n  decodeBase64,\n  stringIsEmpty\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type ModuleGraphProps = {\n  type: ItemType.MODULE_GRAPH;\n  html: string;\n} & ItemProps &\n  WithModuleProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the module graph props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function moduleGraphPropsDecoder(\n  data: AnyObject\n): ModuleGraphProps | never {\n  if (stringIsEmpty(data.html) && stringIsEmpty(data.encodedHtml)) {\n    throw new TypeError(\"missing html content.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.MODULE_GRAPH,\n    html: !stringIsEmpty(data.html)\n      ? data.html\n      : decodeBase64(data.encodedHtml),\n    ...modulePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class ModuleGraph extends Item<ModuleGraphProps> {\n  /**\n   * @override Item.resizeElement.\n   * Resize the DOM content container.\n   * We need to override the resize function cause this item's height\n   * is larger than the configured and the graph is over the label.\n   * @param width\n   * @param height\n   */\n  protected resizeElement(width: number): void {\n    super.resizeElement(width, 0);\n  }\n\n  /**\n   * @override Item.initResizementListener. To disable the functionality.\n   * Start the resizement funtionality.\n   * @param element Element to move inside its container.\n   */\n  protected initResizementListener(): void {\n    // No-Op. Disable the resizement functionality for this item.\n  }\n\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"module-graph\";\n    element.innerHTML = this.props.html;\n\n    // Remove the overview graph.\n    const legendP = element.getElementsByTagName(\"p\");\n    for (let i = 0; i < legendP.length; i++) {\n      legendP[i].style.margin = \"0px\";\n    }\n\n    // Remove the overview graph.\n    const overviewGraphs = element.getElementsByClassName(\"overview_graph\");\n    for (let i = 0; i < overviewGraphs.length; i++) {\n      overviewGraphs[i].remove();\n    }\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const scripts = element.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      if (scripts[i].src.length === 0) {\n        setTimeout(() => {\n          try {\n            eval(scripts[i].innerHTML.trim());\n          } catch (ignored) {} // eslint-disable-line no-empty\n        }, 0);\n      }\n    }\n\n    return element;\n  }\n\n  protected updateDomElement(element: HTMLElement): void {\n    element.innerHTML = this.props.html;\n\n    // Remove the overview graph.\n    const legendP = element.getElementsByTagName(\"p\");\n    for (let i = 0; i < legendP.length; i++) {\n      legendP[i].style.margin = \"0px\";\n    }\n\n    // Remove the overview graph.\n    const overviewGraphs = element.getElementsByClassName(\"overview_graph\");\n    for (let i = 0; i < overviewGraphs.length; i++) {\n      overviewGraphs[i].remove();\n    }\n\n    // Hack to execute the JS after the HTML is added to the DOM.\n    const scripts = element.getElementsByTagName(\"script\");\n    for (let i = 0; i < scripts.length; i++) {\n      if (scripts[i].src.length === 0) {\n        eval(scripts[i].innerHTML.trim());\n      }\n    }\n  }\n}\n","import {\n  WithModuleProps,\n  LinkedVisualConsoleProps,\n  AnyObject\n} from \"../lib/types\";\n\nimport {\n  modulePropsDecoder,\n  linkedVCPropsDecoder,\n  notEmptyStringOr\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type StaticGraphProps = {\n  type: ItemType.STATIC_GRAPH;\n  imageSrc: string; // URL?\n  showLastValueTooltip: \"default\" | \"enabled\" | \"disabled\";\n  statusImageSrc: string | null; // URL?\n  lastValue: string | null;\n} & ItemProps &\n  (WithModuleProps | LinkedVisualConsoleProps);\n\n/**\n * Extract a valid enum value from a raw unknown value.\n * @param showLastValueTooltip Raw value.\n */\nconst parseShowLastValueTooltip = (\n  showLastValueTooltip: unknown\n): StaticGraphProps[\"showLastValueTooltip\"] => {\n  switch (showLastValueTooltip) {\n    case \"default\":\n    case \"enabled\":\n    case \"disabled\":\n      return showLastValueTooltip;\n    default:\n      return \"default\";\n  }\n};\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the static graph props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function staticGraphPropsDecoder(\n  data: AnyObject\n): StaticGraphProps | never {\n  if (typeof data.imageSrc !== \"string\" || data.imageSrc.length === 0) {\n    throw new TypeError(\"invalid image src.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.STATIC_GRAPH,\n    imageSrc: data.imageSrc,\n    showLastValueTooltip: parseShowLastValueTooltip(data.showLastValueTooltip),\n    statusImageSrc: notEmptyStringOr(data.statusImageSrc, null),\n    lastValue: notEmptyStringOr(data.lastValue, null),\n    ...modulePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class StaticGraph extends Item<StaticGraphProps> {\n  protected createDomElement(): HTMLElement {\n    const imgSrc = this.props.statusImageSrc || this.props.imageSrc;\n    const element = document.createElement(\"div\");\n    element.className = \"static-graph\";\n    element.style.background = `url(${imgSrc}) no-repeat`;\n    element.style.backgroundSize = \"contain\";\n    element.style.backgroundPosition = \"center\";\n\n    // Show last value in a tooltip.\n    if (\n      this.props.lastValue !== null &&\n      this.props.showLastValueTooltip !== \"disabled\"\n    ) {\n      element.className = \"static-graph image forced_title\";\n      element.setAttribute(\"data-use_title_for_force_title\", \"1\");\n      element.setAttribute(\"data-title\", this.props.lastValue);\n    }\n\n    return element;\n  }\n}\n","import { LinkedVisualConsoleProps, AnyObject } from \"../lib/types\";\nimport { linkedVCPropsDecoder } from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type IconProps = {\n  type: ItemType.ICON;\n  imageSrc: string; // URL?\n} & ItemProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the icon props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function iconPropsDecoder(data: AnyObject): IconProps | never {\n  if (typeof data.imageSrc !== \"string\" || data.imageSrc.length === 0) {\n    throw new TypeError(\"invalid image src.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.ICON,\n    imageSrc: data.imageSrc,\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class Icon extends Item<IconProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"icon\";\n    element.style.background = `url(${this.props.imageSrc}) no-repeat`;\n    element.style.backgroundSize = \"contain\";\n    element.style.backgroundPosition = \"center\";\n\n    return element;\n  }\n}\n","import {\n  WithModuleProps,\n  LinkedVisualConsoleProps,\n  AnyObject\n} from \"../lib/types\";\nimport { modulePropsDecoder, linkedVCPropsDecoder } from \"../lib\";\nimport Item, { itemBasePropsDecoder, ItemType, ItemProps } from \"../Item\";\n\nexport type ColorCloudProps = {\n  type: ItemType.COLOR_CLOUD;\n  color: string;\n  // TODO: Add the rest of the color cloud values?\n} & ItemProps &\n  WithModuleProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the static graph props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function colorCloudPropsDecoder(\n  data: AnyObject\n): ColorCloudProps | never {\n  // TODO: Validate the color.\n  if (typeof data.color !== \"string\" || data.color.length === 0) {\n    throw new TypeError(\"invalid color.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.COLOR_CLOUD,\n    color: data.color,\n    ...modulePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nconst svgNS = \"http://www.w3.org/2000/svg\";\n\nexport default class ColorCloud extends Item<ColorCloudProps> {\n  protected createDomElement(): HTMLElement {\n    const container: HTMLDivElement = document.createElement(\"div\");\n    container.className = \"color-cloud\";\n\n    // Add the SVG.\n    container.append(this.createSvgElement());\n\n    return container;\n  }\n\n  protected resizeElement(width: number): void {\n    super.resizeElement(width, width);\n  }\n\n  public createSvgElement(): SVGSVGElement {\n    const gradientId = `grad_${this.props.id}`;\n    // SVG container.\n    const svg = document.createElementNS(svgNS, \"svg\");\n    // Auto resize SVG using the view box magic: https://css-tricks.com/scale-svg/\n    svg.setAttribute(\"viewBox\", \"0 0 100 100\");\n\n    // Defs.\n    const defs = document.createElementNS(svgNS, \"defs\");\n    // Radial gradient.\n    const radialGradient = document.createElementNS(svgNS, \"radialGradient\");\n    radialGradient.setAttribute(\"id\", gradientId);\n    radialGradient.setAttribute(\"cx\", \"50%\");\n    radialGradient.setAttribute(\"cy\", \"50%\");\n    radialGradient.setAttribute(\"r\", \"50%\");\n    radialGradient.setAttribute(\"fx\", \"50%\");\n    radialGradient.setAttribute(\"fy\", \"50%\");\n    // Stops.\n    const stop0 = document.createElementNS(svgNS, \"stop\");\n    stop0.setAttribute(\"offset\", \"0%\");\n    stop0.setAttribute(\n      \"style\",\n      `stop-color:${this.props.color};stop-opacity:0.9`\n    );\n    const stop100 = document.createElementNS(svgNS, \"stop\");\n    stop100.setAttribute(\"offset\", \"100%\");\n    stop100.setAttribute(\n      \"style\",\n      `stop-color:${this.props.color};stop-opacity:0`\n    );\n    // Circle.\n    const circle = document.createElementNS(svgNS, \"circle\");\n    circle.setAttribute(\"fill\", `url(#${gradientId})`);\n    circle.setAttribute(\"cx\", \"50%\");\n    circle.setAttribute(\"cy\", \"50%\");\n    circle.setAttribute(\"r\", \"50%\");\n\n    // Append elements.\n    radialGradient.append(stop0, stop100);\n    defs.append(radialGradient);\n    svg.append(defs, circle);\n\n    return svg;\n  }\n}\n","import { LinkedVisualConsoleProps, AnyObject } from \"../lib/types\";\nimport {\n  linkedVCPropsDecoder,\n  parseIntOr,\n  notEmptyStringOr,\n  stringIsEmpty,\n  decodeBase64,\n  parseBoolean\n} from \"../lib\";\nimport Item, { ItemProps, itemBasePropsDecoder, ItemType } from \"../Item\";\n\nexport type GroupProps = {\n  type: ItemType.GROUP_ITEM;\n  groupId: number;\n  imageSrc: string | null; // URL?\n  statusImageSrc: string | null;\n  showStatistics: boolean;\n  html?: string | null;\n} & ItemProps &\n  LinkedVisualConsoleProps;\n\nfunction extractHtml(data: AnyObject): string | null {\n  if (!stringIsEmpty(data.html)) return data.html;\n  if (!stringIsEmpty(data.encodedHtml)) return decodeBase64(data.encodedHtml);\n  return null;\n}\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the group props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function groupPropsDecoder(data: AnyObject): GroupProps | never {\n  if (\n    (typeof data.imageSrc !== \"string\" || data.imageSrc.length === 0) &&\n    data.encodedHtml === null\n  ) {\n    throw new TypeError(\"invalid image src.\");\n  }\n  if (parseIntOr(data.groupId, null) === null) {\n    throw new TypeError(\"invalid group Id.\");\n  }\n\n  const showStatistics = parseBoolean(data.showStatistics);\n  const html = showStatistics ? extractHtml(data) : null;\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.GROUP_ITEM,\n    groupId: parseInt(data.groupId),\n    imageSrc: notEmptyStringOr(data.imageSrc, null),\n    statusImageSrc: notEmptyStringOr(data.statusImageSrc, null),\n    showStatistics,\n    html,\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class Group extends Item<GroupProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"group\";\n\n    if (!this.props.showStatistics && this.props.statusImageSrc !== null) {\n      // Icon with status.\n      element.style.background = `url(${this.props.statusImageSrc}) no-repeat`;\n      element.style.backgroundSize = \"contain\";\n      element.style.backgroundPosition = \"center\";\n    } else if (this.props.showStatistics && this.props.html != null) {\n      // Stats table.\n      element.innerHTML = this.props.html;\n    }\n\n    return element;\n  }\n}\n","import \"./styles.css\";\n\nimport {\n  LinkedVisualConsoleProps,\n  AnyObject,\n  Size,\n  ItemMeta\n} from \"../../lib/types\";\nimport {\n  linkedVCPropsDecoder,\n  parseIntOr,\n  parseBoolean,\n  prefixedCssRules,\n  notEmptyStringOr,\n  humanDate,\n  humanTime\n} from \"../../lib\";\nimport Item, { ItemProps, itemBasePropsDecoder, ItemType } from \"../../Item\";\n\nexport type ClockProps = {\n  type: ItemType.CLOCK;\n  clockType: \"analogic\" | \"digital\";\n  clockFormat: \"datetime\" | \"time\";\n  clockTimezone: string;\n  clockTimezoneOffset: number; // Offset of the timezone to UTC in seconds.\n  showClockTimezone: boolean;\n  color?: string | null;\n} & ItemProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Extract a valid enum value from a raw unknown value.\n * @param clockType Raw value.\n */\nconst parseClockType = (clockType: unknown): ClockProps[\"clockType\"] => {\n  switch (clockType) {\n    case \"analogic\":\n    case \"digital\":\n      return clockType;\n    default:\n      return \"analogic\";\n  }\n};\n\n/**\n * Extract a valid enum value from a raw unknown value.\n * @param clockFormat Raw value.\n */\nconst parseClockFormat = (clockFormat: unknown): ClockProps[\"clockFormat\"] => {\n  switch (clockFormat) {\n    case \"datetime\":\n    case \"time\":\n      return clockFormat;\n    default:\n      return \"datetime\";\n  }\n};\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the clock props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function clockPropsDecoder(data: AnyObject): ClockProps | never {\n  if (\n    typeof data.clockTimezone !== \"string\" ||\n    data.clockTimezone.length === 0\n  ) {\n    throw new TypeError(\"invalid timezone.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.CLOCK,\n    clockType: parseClockType(data.clockType),\n    clockFormat: parseClockFormat(data.clockFormat),\n    clockTimezone: data.clockTimezone,\n    clockTimezoneOffset: parseIntOr(data.clockTimezoneOffset, 0),\n    showClockTimezone: parseBoolean(data.showClockTimezone),\n    color: notEmptyStringOr(data.color, null),\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class Clock extends Item<ClockProps> {\n  public static readonly TICK_INTERVAL = 1000; // In ms.\n  private intervalRef: number | null = null;\n\n  public constructor(props: ClockProps, meta: ItemMeta) {\n    // Call the superclass constructor.\n    super(props, meta);\n\n    /* The item is already loaded and inserted into the DOM.\n     * The class properties are now initialized.\n     * Now you can modify the item, add event handlers, timers, etc.\n     */\n\n    /* The use of the arrow function is important here. startTick will\n     * use the function passed as an argument to call the global setInterval\n     * function. The interval, timeout or event functions, among other, are\n     * called into another execution loop and using a different context.\n     * The arrow functions, unlike the classic functions, doesn't create\n     * their own context (this), so their context at execution time will be\n     * use the current context at the declaration time.\n     * http://es6-features.org/#Lexicalthis\n     */\n    this.startTick(\n      () => {\n        // Replace the old element with the updated date.\n        this.childElementRef.innerHTML = this.createClock().innerHTML;\n      },\n      /* The analogic clock doesn't need to tick,\n       * but it will be refreshed every 20 seconds\n       * to avoid a desync caused by page freezes.\n       */\n      this.props.clockType === \"analogic\" ? 20000 : Clock.TICK_INTERVAL\n    );\n  }\n\n  /**\n   * Wrap a window.clearInterval call.\n   */\n  private stopTick(): void {\n    if (this.intervalRef !== null) {\n      window.clearInterval(this.intervalRef);\n      this.intervalRef = null;\n    }\n  }\n\n  /**\n   * Wrap a window.setInterval call.\n   * @param handler Function to be called every time the interval\n   * timer is reached.\n   * @param interval Number in milliseconds for the interval timer.\n   */\n  private startTick(\n    handler: TimerHandler,\n    interval: number = Clock.TICK_INTERVAL\n  ): void {\n    this.stopTick();\n    this.intervalRef = window.setInterval(handler, interval);\n  }\n\n  /**\n   * Create a element which contains the DOM representation of the item.\n   * @return DOM Element.\n   * @override\n   */\n  protected createDomElement(): HTMLElement | never {\n    return this.createClock();\n  }\n\n  /**\n   * To remove the event listeners and the elements from the DOM.\n   * @override\n   */\n  public remove(): void {\n    // Clear the interval.\n    this.stopTick();\n    // Call to the parent clean function.\n    super.remove();\n  }\n\n  /**\n   * @override Item.resizeElement\n   * Resize the DOM content container.\n   * @param width\n   * @param height\n   */\n  protected resizeElement(width: number, height: number): void {\n    const { width: newWidth, height: newHeight } = this.getElementSize(\n      width,\n      height\n    ); // Destructuring assigment: http://es6-features.org/#ObjectMatchingShorthandNotation\n    super.resizeElement(newWidth, newHeight);\n    // Re-render the item to force it calculate a new font size.\n    if (this.props.clockType === \"digital\") {\n      // Replace the old element with the updated date.\n      this.childElementRef.innerHTML = this.createClock().innerHTML;\n    }\n  }\n\n  /**\n   * Create a element which contains a representation of a clock.\n   * It choose between the clock types.\n   * @return DOM Element.\n   * @throws Error.\n   */\n  private createClock(): HTMLElement | never {\n    switch (this.props.clockType) {\n      case \"analogic\":\n        return this.createAnalogicClock();\n      case \"digital\":\n        return this.createDigitalClock();\n      default:\n        throw new Error(\"invalid clock type.\");\n    }\n  }\n\n  /**\n   * Create a element which contains a representation of an analogic clock.\n   * @return DOM Element.\n   */\n  private createAnalogicClock(): HTMLElement {\n    const svgNS = \"http://www.w3.org/2000/svg\";\n    const colors = {\n      watchFace: \"#FFFFF0\",\n      watchFaceBorder: \"#242124\",\n      mark: \"#242124\",\n      handDark: \"#242124\",\n      handLight: \"#525252\",\n      secondHand: \"#DC143C\"\n    };\n\n    const { width, height } = this.getElementSize(); // Destructuring assigment: http://es6-features.org/#ObjectMatchingShorthandNotation\n\n    // Calculate font size to adapt the font to the item size.\n    const baseTimeFontSize = 20; // Per 100px of width.\n    const dateFontSizeMultiplier = 0.5;\n    const dateFontSize =\n      (baseTimeFontSize * dateFontSizeMultiplier * width) / 100;\n\n    const div = document.createElement(\"div\");\n    div.className = \"analogic-clock\";\n    div.style.width = `${width}px`;\n    div.style.height = `${height}px`;\n\n    // SVG container.\n    const svg = document.createElementNS(svgNS, \"svg\");\n    // Auto resize SVG using the view box magic: https://css-tricks.com/scale-svg/\n    svg.setAttribute(\"viewBox\", \"0 0 100 100\");\n\n    // Clock face.\n    const clockFace = document.createElementNS(svgNS, \"g\");\n    clockFace.setAttribute(\"class\", \"clockface\");\n    const clockFaceBackground = document.createElementNS(svgNS, \"circle\");\n    clockFaceBackground.setAttribute(\"cx\", \"50\");\n    clockFaceBackground.setAttribute(\"cy\", \"50\");\n    clockFaceBackground.setAttribute(\"r\", \"48\");\n    clockFaceBackground.setAttribute(\"fill\", colors.watchFace);\n    clockFaceBackground.setAttribute(\"stroke\", colors.watchFaceBorder);\n    clockFaceBackground.setAttribute(\"stroke-width\", \"2\");\n    clockFaceBackground.setAttribute(\"stroke-linecap\", \"round\");\n    // Insert the clockface background into the clockface group.\n    clockFace.append(clockFaceBackground);\n\n    // Timezone complication.\n    const city = this.getHumanTimezone();\n    if (city.length > 0) {\n      const timezoneComplication = document.createElementNS(svgNS, \"text\");\n      timezoneComplication.setAttribute(\"text-anchor\", \"middle\");\n      timezoneComplication.setAttribute(\"font-size\", \"8\");\n      timezoneComplication.setAttribute(\n        \"transform\",\n        \"translate(30 50) rotate(90)\" // Rotate to counter the clock rotation.\n      );\n      timezoneComplication.setAttribute(\"fill\", colors.mark);\n      timezoneComplication.textContent = city;\n      clockFace.append(timezoneComplication);\n    }\n\n    // Marks group.\n    const marksGroup = document.createElementNS(svgNS, \"g\");\n    marksGroup.setAttribute(\"class\", \"marks\");\n    // Build the 12 hours mark.\n    const mainMarkGroup = document.createElementNS(svgNS, \"g\");\n    mainMarkGroup.setAttribute(\"class\", \"mark\");\n    mainMarkGroup.setAttribute(\"transform\", \"translate(50 50)\");\n    const mark1a = document.createElementNS(svgNS, \"line\");\n    mark1a.setAttribute(\"x1\", \"36\");\n    mark1a.setAttribute(\"y1\", \"0\");\n    mark1a.setAttribute(\"x2\", \"46\");\n    mark1a.setAttribute(\"y2\", \"0\");\n    mark1a.setAttribute(\"stroke\", colors.mark);\n    mark1a.setAttribute(\"stroke-width\", \"5\");\n    const mark1b = document.createElementNS(svgNS, \"line\");\n    mark1b.setAttribute(\"x1\", \"36\");\n    mark1b.setAttribute(\"y1\", \"0\");\n    mark1b.setAttribute(\"x2\", \"46\");\n    mark1b.setAttribute(\"y2\", \"0\");\n    mark1b.setAttribute(\"stroke\", colors.watchFace);\n    mark1b.setAttribute(\"stroke-width\", \"1\");\n    // Insert the 12 mark lines into their group.\n    mainMarkGroup.append(mark1a, mark1b);\n    // Insert the main mark into the marks group.\n    marksGroup.append(mainMarkGroup);\n    // Build the rest of the marks.\n    for (let i = 1; i < 60; i++) {\n      const mark = document.createElementNS(svgNS, \"line\");\n      mark.setAttribute(\"y1\", \"0\");\n      mark.setAttribute(\"y2\", \"0\");\n      mark.setAttribute(\"stroke\", colors.mark);\n      mark.setAttribute(\"transform\", `translate(50 50) rotate(${i * 6})`);\n\n      if (i % 5 === 0) {\n        mark.setAttribute(\"x1\", \"38\");\n        mark.setAttribute(\"x2\", \"46\");\n        mark.setAttribute(\"stroke-width\", i % 15 === 0 ? \"2\" : \"1\");\n      } else {\n        mark.setAttribute(\"x1\", \"42\");\n        mark.setAttribute(\"x2\", \"46\");\n        mark.setAttribute(\"stroke-width\", \"0.5\");\n      }\n\n      // Insert the mark into the marks group.\n      marksGroup.append(mark);\n    }\n\n    /* Clock hands */\n\n    // Hour hand.\n    const hourHand = document.createElementNS(svgNS, \"g\");\n    hourHand.setAttribute(\"class\", \"hour-hand\");\n    hourHand.setAttribute(\"transform\", \"translate(50 50)\");\n    // This will go back and will act like a border.\n    const hourHandA = document.createElementNS(svgNS, \"line\");\n    hourHandA.setAttribute(\"class\", \"hour-hand-a\");\n    hourHandA.setAttribute(\"x1\", \"0\");\n    hourHandA.setAttribute(\"y1\", \"0\");\n    hourHandA.setAttribute(\"x2\", \"30\");\n    hourHandA.setAttribute(\"y2\", \"0\");\n    hourHandA.setAttribute(\"stroke\", colors.handLight);\n    hourHandA.setAttribute(\"stroke-width\", \"4\");\n    hourHandA.setAttribute(\"stroke-linecap\", \"round\");\n    // This will go in front of the previous line.\n    const hourHandB = document.createElementNS(svgNS, \"line\");\n    hourHandB.setAttribute(\"class\", \"hour-hand-b\");\n    hourHandB.setAttribute(\"x1\", \"0\");\n    hourHandB.setAttribute(\"y1\", \"0\");\n    hourHandB.setAttribute(\"x2\", \"29.9\");\n    hourHandB.setAttribute(\"y2\", \"0\");\n    hourHandB.setAttribute(\"stroke\", colors.handDark);\n    hourHandB.setAttribute(\"stroke-width\", \"3.1\");\n    hourHandB.setAttribute(\"stroke-linecap\", \"round\");\n    // Append the elements to finish the hour hand.\n    hourHand.append(hourHandA, hourHandB);\n\n    // Minute hand.\n    const minuteHand = document.createElementNS(svgNS, \"g\");\n    minuteHand.setAttribute(\"class\", \"minute-hand\");\n    minuteHand.setAttribute(\"transform\", \"translate(50 50)\");\n    // This will go back and will act like a border.\n    const minuteHandA = document.createElementNS(svgNS, \"line\");\n    minuteHandA.setAttribute(\"class\", \"minute-hand-a\");\n    minuteHandA.setAttribute(\"x1\", \"0\");\n    minuteHandA.setAttribute(\"y1\", \"0\");\n    minuteHandA.setAttribute(\"x2\", \"40\");\n    minuteHandA.setAttribute(\"y2\", \"0\");\n    minuteHandA.setAttribute(\"stroke\", colors.handLight);\n    minuteHandA.setAttribute(\"stroke-width\", \"2\");\n    minuteHandA.setAttribute(\"stroke-linecap\", \"round\");\n    // This will go in front of the previous line.\n    const minuteHandB = document.createElementNS(svgNS, \"line\");\n    minuteHandB.setAttribute(\"class\", \"minute-hand-b\");\n    minuteHandB.setAttribute(\"x1\", \"0\");\n    minuteHandB.setAttribute(\"y1\", \"0\");\n    minuteHandB.setAttribute(\"x2\", \"39.9\");\n    minuteHandB.setAttribute(\"y2\", \"0\");\n    minuteHandB.setAttribute(\"stroke\", colors.handDark);\n    minuteHandB.setAttribute(\"stroke-width\", \"1.5\");\n    minuteHandB.setAttribute(\"stroke-linecap\", \"round\");\n    const minuteHandPin = document.createElementNS(svgNS, \"circle\");\n    minuteHandPin.setAttribute(\"r\", \"3\");\n    minuteHandPin.setAttribute(\"fill\", colors.handDark);\n    // Append the elements to finish the minute hand.\n    minuteHand.append(minuteHandA, minuteHandB, minuteHandPin);\n\n    // Second hand.\n    const secondHand = document.createElementNS(svgNS, \"g\");\n    secondHand.setAttribute(\"class\", \"second-hand\");\n    secondHand.setAttribute(\"transform\", \"translate(50 50)\");\n    const secondHandBar = document.createElementNS(svgNS, \"line\");\n    secondHandBar.setAttribute(\"x1\", \"0\");\n    secondHandBar.setAttribute(\"y1\", \"0\");\n    secondHandBar.setAttribute(\"x2\", \"46\");\n    secondHandBar.setAttribute(\"y2\", \"0\");\n    secondHandBar.setAttribute(\"stroke\", colors.secondHand);\n    secondHandBar.setAttribute(\"stroke-width\", \"1\");\n    secondHandBar.setAttribute(\"stroke-linecap\", \"round\");\n    const secondHandPin = document.createElementNS(svgNS, \"circle\");\n    secondHandPin.setAttribute(\"r\", \"2\");\n    secondHandPin.setAttribute(\"fill\", colors.secondHand);\n    // Append the elements to finish the second hand.\n    secondHand.append(secondHandBar, secondHandPin);\n\n    // Pin.\n    const pin = document.createElementNS(svgNS, \"circle\");\n    pin.setAttribute(\"cx\", \"50\");\n    pin.setAttribute(\"cy\", \"50\");\n    pin.setAttribute(\"r\", \"0.3\");\n    pin.setAttribute(\"fill\", colors.handDark);\n\n    // Get the hand angles.\n    const date = this.getOriginDate();\n    const seconds = date.getSeconds();\n    const minutes = date.getMinutes();\n    const hours = date.getHours();\n    const secAngle = (360 / 60) * seconds;\n    const minuteAngle = (360 / 60) * minutes + (360 / 60) * (seconds / 60);\n    const hourAngle = (360 / 12) * hours + (360 / 12) * (minutes / 60);\n    // Set the clock time by moving the hands.\n    hourHand.setAttribute(\"transform\", `translate(50 50) rotate(${hourAngle})`);\n    minuteHand.setAttribute(\n      \"transform\",\n      `translate(50 50) rotate(${minuteAngle})`\n    );\n    secondHand.setAttribute(\n      \"transform\",\n      `translate(50 50) rotate(${secAngle})`\n    );\n\n    // Build the clock\n    svg.append(clockFace, marksGroup, hourHand, minuteHand, secondHand, pin);\n    // Rotate the clock to its normal position.\n    svg.setAttribute(\"transform\", \"rotate(-90)\");\n\n    /* Add the animation declaration to the container.\n     * Since the animation keyframes need to know the\n     * start angle, this angle is dynamic (current time),\n     * and we can't edit keyframes through javascript\n     * safely and with backwards compatibility, we need\n     * to inject it.\n     */\n    div.innerHTML = `\n      <style>\n        @keyframes rotate-hour {\n          from {\n            ${prefixedCssRules(\n              \"transform\",\n              `translate(50px, 50px) rotate(${hourAngle}deg)`\n            ).join(\"\\n\")}\n          }\n          to {\n            ${prefixedCssRules(\n              \"transform\",\n              `translate(50px, 50px) rotate(${hourAngle + 360}deg)`\n            ).join(\"\\n\")}\n          }\n        }\n        @keyframes rotate-minute {\n          from {\n            ${prefixedCssRules(\n              \"transform\",\n              `translate(50px, 50px) rotate(${minuteAngle}deg)`\n            ).join(\"\\n\")}\n          }\n          to {\n            ${prefixedCssRules(\n              \"transform\",\n              `translate(50px, 50px) rotate(${minuteAngle + 360}deg)`\n            ).join(\"\\n\")}\n          }\n        }\n        @keyframes rotate-second {\n          from {\n            ${prefixedCssRules(\n              \"transform\",\n              `translate(50px, 50px) rotate(${secAngle}deg)`\n            ).join(\"\\n\")}\n          }\n          to {\n            ${prefixedCssRules(\n              \"transform\",\n              `translate(50px, 50px) rotate(${secAngle + 360}deg)`\n            ).join(\"\\n\")}\n          }\n        }\n      </style>\n    `;\n    // Add the clock to the container\n    div.append(svg);\n\n    // Date.\n    if (this.props.clockFormat === \"datetime\") {\n      const dateElem: HTMLSpanElement = document.createElement(\"span\");\n      dateElem.className = \"date\";\n      dateElem.textContent = humanDate(date, \"default\");\n      dateElem.style.fontSize = `${dateFontSize}px`;\n      if (this.props.color) dateElem.style.color = this.props.color;\n      div.append(dateElem);\n    }\n\n    return div;\n  }\n\n  /**\n   * Create a element which contains a representation of a digital clock.\n   * @return DOM Element.\n   */\n  private createDigitalClock(): HTMLElement {\n    const element: HTMLDivElement = document.createElement(\"div\");\n    element.className = \"digital-clock\";\n\n    const { width } = this.getElementSize(); // Destructuring assigment: http://es6-features.org/#ObjectMatchingShorthandNotation\n\n    // Calculate font size to adapt the font to the item size.\n    const baseTimeFontSize = 20; // Per 100px of width.\n    const dateFontSizeMultiplier = 0.5;\n    const tzFontSizeMultiplier = 6 / this.props.clockTimezone.length;\n    const timeFontSize = (baseTimeFontSize * width) / 100;\n    const dateFontSize =\n      (baseTimeFontSize * dateFontSizeMultiplier * width) / 100;\n    const tzFontSize = Math.min(\n      (baseTimeFontSize * tzFontSizeMultiplier * width) / 100,\n      (width / 100) * 10\n    );\n\n    // Date calculated using the original timezone.\n    const date = this.getOriginDate();\n\n    // Date.\n    if (this.props.clockFormat === \"datetime\") {\n      const dateElem: HTMLSpanElement = document.createElement(\"span\");\n      dateElem.className = \"date\";\n      dateElem.textContent = humanDate(date, \"default\");\n      dateElem.style.fontSize = `${dateFontSize}px`;\n      if (this.props.color) dateElem.style.color = this.props.color;\n      element.append(dateElem);\n    }\n\n    // Time.\n    const timeElem: HTMLSpanElement = document.createElement(\"span\");\n    timeElem.className = \"time\";\n    timeElem.textContent = humanTime(date);\n    timeElem.style.fontSize = `${timeFontSize}px`;\n    if (this.props.color) timeElem.style.color = this.props.color;\n    element.append(timeElem);\n\n    // City name.\n    const city = this.getHumanTimezone();\n    if (city.length > 0) {\n      const tzElem: HTMLSpanElement = document.createElement(\"span\");\n      tzElem.className = \"timezone\";\n      tzElem.textContent = city;\n      tzElem.style.fontSize = `${tzFontSize}px`;\n      if (this.props.color) tzElem.style.color = this.props.color;\n      element.append(tzElem);\n    }\n\n    return element;\n  }\n\n  /**\n   * Generate the current date using the timezone offset stored into the properties.\n   * @return The current date.\n   */\n  private getOriginDate(initialDate: Date | null = null): Date {\n    const d = initialDate ? initialDate : new Date();\n    const targetTZOffset = this.props.clockTimezoneOffset * 1000; // In ms.\n    const localTZOffset = d.getTimezoneOffset() * 60 * 1000; // In ms.\n    const utimestamp = d.getTime() + targetTZOffset + localTZOffset;\n\n    return new Date(utimestamp);\n  }\n\n  /**\n   * Extract a human readable city name from the timezone text.\n   * @param timezone Timezone text.\n   */\n  public getHumanTimezone(timezone: string = this.props.clockTimezone): string {\n    const [, city = \"\"] = timezone.split(\"/\");\n    return city.replace(\"_\", \" \");\n  }\n\n  /**\n   * Generate a element size using the current size and the default values.\n   * @return The size.\n   */\n  private getElementSize(\n    width: number = this.props.width,\n    height: number = this.props.height\n  ): Size {\n    switch (this.props.clockType) {\n      case \"analogic\": {\n        let diameter = 100; // Default value.\n\n        if (width > 0 && height > 0) {\n          diameter = Math.min(width, height);\n        } else if (width > 0) {\n          diameter = width;\n        } else if (height > 0) {\n          diameter = height;\n        }\n\n        return {\n          width: diameter,\n          height: diameter\n        };\n      }\n      case \"digital\": {\n        if (width > 0 && height > 0) {\n          // The proportion of the clock should be (width = height / 2) aproximately.\n          height = width / 2 < height ? width / 2 : height;\n        } else if (width > 0) {\n          height = width / 2;\n        } else if (height > 0) {\n          // The proportion of the clock should be (height * 2 = width) aproximately.\n          width = height * 2;\n        } else {\n          width = 100; // Default value.\n          height = 50; // Default value.\n        }\n\n        return {\n          width,\n          height\n        };\n      }\n      default:\n        throw new Error(\"invalid clock type.\");\n    }\n  }\n}\n","import { AnyObject } from \"../lib/types\";\nimport { parseIntOr, notEmptyStringOr } from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\ninterface BoxProps extends ItemProps {\n  // Overrided properties.\n  readonly type: ItemType.BOX_ITEM;\n  label: null;\n  isLinkEnabled: false;\n  parentId: null;\n  aclGroupId: null;\n  // Custom properties.\n  borderWidth: number;\n  borderColor: string | null;\n  fillColor: string | null;\n}\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the item props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function boxPropsDecoder(data: AnyObject): BoxProps | never {\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.BOX_ITEM,\n    label: null,\n    isLinkEnabled: false,\n    parentId: null,\n    aclGroupId: null,\n    // Custom properties.\n    borderWidth: parseIntOr(data.borderWidth, 0),\n    borderColor: notEmptyStringOr(data.borderColor, null),\n    fillColor: notEmptyStringOr(data.fillColor, null)\n  };\n}\n\nexport default class Box extends Item<BoxProps> {\n  protected createDomElement(): HTMLElement {\n    const box: HTMLDivElement = document.createElement(\"div\");\n    box.className = \"box\";\n    // To prevent this item to expand beyond its parent.\n    box.style.boxSizing = \"border-box\";\n\n    if (this.props.fillColor) {\n      box.style.backgroundColor = this.props.fillColor;\n    }\n\n    // Border.\n    if (this.props.borderWidth > 0) {\n      box.style.borderStyle = \"solid\";\n      // Control the max width to prevent this item to expand beyond its parent.\n      const maxBorderWidth = Math.min(this.props.width, this.props.height) / 2;\n      const borderWidth = Math.min(this.props.borderWidth, maxBorderWidth);\n      box.style.borderWidth = `${borderWidth}px`;\n\n      if (this.props.borderColor) {\n        box.style.borderColor = this.props.borderColor;\n      }\n    }\n\n    return box;\n  }\n}\n","import { AnyObject, Position, Size, ItemMeta } from \"../lib/types\";\nimport { parseIntOr, notEmptyStringOr } from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\ninterface LineProps extends ItemProps {\n  // Overrided properties.\n  readonly type: ItemType.LINE_ITEM;\n  label: null;\n  isLinkEnabled: false;\n  parentId: null;\n  aclGroupId: null;\n  // Custom properties.\n  startPosition: Position;\n  endPosition: Position;\n  lineWidth: number;\n  color: string | null;\n}\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the item props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function linePropsDecoder(data: AnyObject): LineProps | never {\n  const props: LineProps = {\n    ...itemBasePropsDecoder({ ...data, width: 1, height: 1 }), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.LINE_ITEM,\n    label: null,\n    isLinkEnabled: false,\n    parentId: null,\n    aclGroupId: null,\n    // Initialize Position & Size.\n    x: 0,\n    y: 0,\n    width: 0,\n    height: 0,\n    // Custom properties.\n    startPosition: {\n      x: parseIntOr(data.startX, 0),\n      y: parseIntOr(data.startY, 0)\n    },\n    endPosition: {\n      x: parseIntOr(data.endX, 0),\n      y: parseIntOr(data.endY, 0)\n    },\n    lineWidth: parseIntOr(data.lineWidth || data.borderWidth, 1),\n    color: notEmptyStringOr(data.borderColor || data.color, null)\n  };\n\n  /*\n   * We need to enhance the props with the extracted size and position\n   * of the box cause there are missing at the props update. A better\n   * solution would be overriding the props setter to do it there, but\n   * the language doesn't allow it while targetting ES5.\n   * TODO: We need to figure out a more consistent solution.\n   */\n\n  return {\n    ...props,\n    // Enhance the props extracting the box size and position.\n    // eslint-disable-next-line @typescript-eslint/no-use-before-define\n    ...Line.extractBoxSizeAndPosition(props)\n  };\n}\n\nexport default class Line extends Item<LineProps> {\n  /**\n   * @override\n   */\n  public constructor(props: LineProps, meta: ItemMeta) {\n    /*\n     * We need to override the constructor cause we need to obtain\n     * the\n     * box size and position from the start and finish points\n     * of the line.\n     */\n    super(\n      {\n        ...props,\n        ...Line.extractBoxSizeAndPosition(props)\n      },\n      {\n        ...meta,\n        editMode: false\n      }\n    );\n  }\n\n  /**\n   * Clasic and protected version of the setter of the `meta` property.\n   * Useful to override it from children classes.\n   * @param newProps\n   * @override Item.setMeta\n   */\n  public setMeta(newMetadata: ItemMeta) {\n    super.setMeta({\n      ...newMetadata,\n      editMode: false\n    });\n  }\n\n  /**\n   * @override\n   * To create the item's DOM representation.\n   * @return Item.\n   */\n  protected createDomElement(): HTMLElement {\n    const element: HTMLDivElement = document.createElement(\"div\");\n    element.className = \"line\";\n\n    const svgNS = \"http://www.w3.org/2000/svg\";\n    // SVG container.\n    const svg = document.createElementNS(svgNS, \"svg\");\n    // Set SVG size.\n    svg.setAttribute(\n      \"width\",\n      (this.props.width + this.props.lineWidth).toString()\n    );\n    svg.setAttribute(\n      \"height\",\n      (this.props.height + this.props.lineWidth).toString()\n    );\n    const line = document.createElementNS(svgNS, \"line\");\n    line.setAttribute(\n      \"x1\",\n      `${this.props.startPosition.x - this.props.x + this.props.lineWidth / 2}`\n    );\n    line.setAttribute(\n      \"y1\",\n      `${this.props.startPosition.y - this.props.y + this.props.lineWidth / 2}`\n    );\n    line.setAttribute(\n      \"x2\",\n      `${this.props.endPosition.x - this.props.x + this.props.lineWidth / 2}`\n    );\n    line.setAttribute(\n      \"y2\",\n      `${this.props.endPosition.y - this.props.y + this.props.lineWidth / 2}`\n    );\n    line.setAttribute(\"stroke\", this.props.color || \"black\");\n    line.setAttribute(\"stroke-width\", this.props.lineWidth.toString());\n\n    svg.append(line);\n    element.append(svg);\n\n    return element;\n  }\n\n  /**\n   * Extract the size and position of the box from\n   * the start and the finish of the line.\n   * @param props Item properties.\n   */\n  public static extractBoxSizeAndPosition(props: LineProps): Size & Position {\n    return {\n      width: Math.abs(props.startPosition.x - props.endPosition.x),\n      height: Math.abs(props.startPosition.y - props.endPosition.y),\n      x: Math.min(props.startPosition.x, props.endPosition.x),\n      y: Math.min(props.startPosition.y, props.endPosition.y)\n    };\n  }\n}\n","import { LinkedVisualConsoleProps, AnyObject } from \"../lib/types\";\nimport { linkedVCPropsDecoder } from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type LabelProps = {\n  type: ItemType.LABEL;\n} & ItemProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the label props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function labelPropsDecoder(data: AnyObject): LabelProps | never {\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.LABEL,\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class Label extends Item<LabelProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"label\";\n    element.innerHTML = this.getLabelWithMacrosReplaced();\n\n    return element;\n  }\n\n  /**\n   * @override Item.createLabelDomElement\n   * Create a new label for the visual console item.\n   * @return Item label.\n   */\n  public createLabelDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"visual-console-item-label\";\n    // Always return an empty label.\n    return element;\n  }\n}\n","import {\n  LinkedVisualConsoleProps,\n  AnyObject,\n  WithModuleProps\n} from \"../lib/types\";\nimport {\n  linkedVCPropsDecoder,\n  parseIntOr,\n  modulePropsDecoder,\n  replaceMacros\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type SimpleValueProps = {\n  type: ItemType.SIMPLE_VALUE;\n  valueType: \"string\" | \"image\";\n  value: string;\n} & (\n  | {\n      processValue: \"none\";\n    }\n  | {\n      processValue: \"avg\" | \"max\" | \"min\";\n      period: number;\n    }) &\n  ItemProps &\n  WithModuleProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Extract a valid enum value from a raw value type.\n * @param valueType Raw value.\n */\nconst parseValueType = (valueType: unknown): SimpleValueProps[\"valueType\"] => {\n  switch (valueType) {\n    case \"string\":\n    case \"image\":\n      return valueType;\n    default:\n      return \"string\";\n  }\n};\n\n/**\n * Extract a valid enum value from a raw process value.\n * @param processValue Raw value.\n */\nconst parseProcessValue = (\n  processValue: unknown\n): SimpleValueProps[\"processValue\"] => {\n  switch (processValue) {\n    case \"none\":\n    case \"avg\":\n    case \"max\":\n    case \"min\":\n      return processValue;\n    default:\n      return \"none\";\n  }\n};\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the simple value props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function simpleValuePropsDecoder(\n  data: AnyObject\n): SimpleValueProps | never {\n  if (typeof data.value !== \"string\" || data.value.length === 0) {\n    throw new TypeError(\"invalid value\");\n  }\n\n  const processValue = parseProcessValue(data.processValue);\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.SIMPLE_VALUE,\n    valueType: parseValueType(data.valueType),\n    value: data.value,\n    ...(processValue === \"none\"\n      ? { processValue }\n      : { processValue, period: parseIntOr(data.period, 0) }), // Object spread. It will merge the properties of the two objects.\n    ...modulePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nexport default class SimpleValue extends Item<SimpleValueProps> {\n  protected createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"simple-value\";\n\n    if (this.props.valueType === \"image\") {\n      const img = document.createElement(\"img\");\n      img.src = this.props.value;\n      element.append(img);\n    } else {\n      // Add the value to the label and show it.\n      let text = this.props.value;\n      let label = this.getLabelWithMacrosReplaced();\n      if (label.length > 0) {\n        text = replaceMacros([{ macro: /\\(?_VALUE_\\)?/i, value: text }], label);\n      }\n\n      element.innerHTML = text;\n    }\n\n    return element;\n  }\n\n  /**\n   * @override Item.createLabelDomElement\n   * Create a new label for the visual console item.\n   * @return Item label.\n   */\n  protected createLabelDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"visual-console-item-label\";\n    // Always return an empty label.\n    return element;\n  }\n}\n","var pi = Math.PI,\n    tau = 2 * pi,\n    epsilon = 1e-6,\n    tauEpsilon = tau - epsilon;\n\nfunction Path() {\n  this._x0 = this._y0 = // start of current subpath\n  this._x1 = this._y1 = null; // end of current subpath\n  this._ = \"\";\n}\n\nfunction path() {\n  return new Path;\n}\n\nPath.prototype = path.prototype = {\n  constructor: Path,\n  moveTo: function(x, y) {\n    this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y);\n  },\n  closePath: function() {\n    if (this._x1 !== null) {\n      this._x1 = this._x0, this._y1 = this._y0;\n      this._ += \"Z\";\n    }\n  },\n  lineTo: function(x, y) {\n    this._ += \"L\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n  },\n  quadraticCurveTo: function(x1, y1, x, y) {\n    this._ += \"Q\" + (+x1) + \",\" + (+y1) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n  },\n  bezierCurveTo: function(x1, y1, x2, y2, x, y) {\n    this._ += \"C\" + (+x1) + \",\" + (+y1) + \",\" + (+x2) + \",\" + (+y2) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n  },\n  arcTo: function(x1, y1, x2, y2, r) {\n    x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n    var x0 = this._x1,\n        y0 = this._y1,\n        x21 = x2 - x1,\n        y21 = y2 - y1,\n        x01 = x0 - x1,\n        y01 = y0 - y1,\n        l01_2 = x01 * x01 + y01 * y01;\n\n    // Is the radius negative? Error.\n    if (r < 0) throw new Error(\"negative radius: \" + r);\n\n    // Is this path empty? Move to (x1,y1).\n    if (this._x1 === null) {\n      this._ += \"M\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n    }\n\n    // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n    else if (!(l01_2 > epsilon));\n\n    // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n    // Equivalently, is (x1,y1) coincident with (x2,y2)?\n    // Or, is the radius zero? Line to (x1,y1).\n    else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n      this._ += \"L\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n    }\n\n    // Otherwise, draw an arc!\n    else {\n      var x20 = x2 - x0,\n          y20 = y2 - y0,\n          l21_2 = x21 * x21 + y21 * y21,\n          l20_2 = x20 * x20 + y20 * y20,\n          l21 = Math.sqrt(l21_2),\n          l01 = Math.sqrt(l01_2),\n          l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n          t01 = l / l01,\n          t21 = l / l21;\n\n      // If the start tangent is not coincident with (x0,y0), line to.\n      if (Math.abs(t01 - 1) > epsilon) {\n        this._ += \"L\" + (x1 + t01 * x01) + \",\" + (y1 + t01 * y01);\n      }\n\n      this._ += \"A\" + r + \",\" + r + \",0,0,\" + (+(y01 * x20 > x01 * y20)) + \",\" + (this._x1 = x1 + t21 * x21) + \",\" + (this._y1 = y1 + t21 * y21);\n    }\n  },\n  arc: function(x, y, r, a0, a1, ccw) {\n    x = +x, y = +y, r = +r;\n    var dx = r * Math.cos(a0),\n        dy = r * Math.sin(a0),\n        x0 = x + dx,\n        y0 = y + dy,\n        cw = 1 ^ ccw,\n        da = ccw ? a0 - a1 : a1 - a0;\n\n    // Is the radius negative? Error.\n    if (r < 0) throw new Error(\"negative radius: \" + r);\n\n    // Is this path empty? Move to (x0,y0).\n    if (this._x1 === null) {\n      this._ += \"M\" + x0 + \",\" + y0;\n    }\n\n    // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n    else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n      this._ += \"L\" + x0 + \",\" + y0;\n    }\n\n    // Is this arc empty? We’re done.\n    if (!r) return;\n\n    // Does the angle go the wrong way? Flip the direction.\n    if (da < 0) da = da % tau + tau;\n\n    // Is this a complete circle? Draw two arcs to complete the circle.\n    if (da > tauEpsilon) {\n      this._ += \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (x - dx) + \",\" + (y - dy) + \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (this._x1 = x0) + \",\" + (this._y1 = y0);\n    }\n\n    // Is this arc non-empty? Draw an arc!\n    else if (da > epsilon) {\n      this._ += \"A\" + r + \",\" + r + \",0,\" + (+(da >= pi)) + \",\" + cw + \",\" + (this._x1 = x + r * Math.cos(a1)) + \",\" + (this._y1 = y + r * Math.sin(a1));\n    }\n  },\n  rect: function(x, y, w, h) {\n    this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y) + \"h\" + (+w) + \"v\" + (+h) + \"h\" + (-w) + \"Z\";\n  },\n  toString: function() {\n    return this._;\n  }\n};\n\nexport default path;\n","export default function(x) {\n  return function constant() {\n    return x;\n  };\n}\n","export var abs = Math.abs;\nexport var atan2 = Math.atan2;\nexport var cos = Math.cos;\nexport var max = Math.max;\nexport var min = Math.min;\nexport var sin = Math.sin;\nexport var sqrt = Math.sqrt;\n\nexport var epsilon = 1e-12;\nexport var pi = Math.PI;\nexport var halfPi = pi / 2;\nexport var tau = 2 * pi;\n\nexport function acos(x) {\n  return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n  return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","import {path} from \"d3-path\";\nimport constant from \"./constant\";\nimport {abs, acos, asin, atan2, cos, epsilon, halfPi, max, min, pi, sin, sqrt, tau} from \"./math\";\n\nfunction arcInnerRadius(d) {\n  return d.innerRadius;\n}\n\nfunction arcOuterRadius(d) {\n  return d.outerRadius;\n}\n\nfunction arcStartAngle(d) {\n  return d.startAngle;\n}\n\nfunction arcEndAngle(d) {\n  return d.endAngle;\n}\n\nfunction arcPadAngle(d) {\n  return d && d.padAngle; // Note: optional!\n}\n\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n  var x10 = x1 - x0, y10 = y1 - y0,\n      x32 = x3 - x2, y32 = y3 - y2,\n      t = y32 * x10 - x32 * y10;\n  if (t * t < epsilon) return;\n  t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;\n  return [x0 + t * x10, y0 + t * y10];\n}\n\n// Compute perpendicular offset line of length rc.\n// http://mathworld.wolfram.com/Circle-LineIntersection.html\nfunction cornerTangents(x0, y0, x1, y1, r1, rc, cw) {\n  var x01 = x0 - x1,\n      y01 = y0 - y1,\n      lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),\n      ox = lo * y01,\n      oy = -lo * x01,\n      x11 = x0 + ox,\n      y11 = y0 + oy,\n      x10 = x1 + ox,\n      y10 = y1 + oy,\n      x00 = (x11 + x10) / 2,\n      y00 = (y11 + y10) / 2,\n      dx = x10 - x11,\n      dy = y10 - y11,\n      d2 = dx * dx + dy * dy,\n      r = r1 - rc,\n      D = x11 * y10 - x10 * y11,\n      d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),\n      cx0 = (D * dy - dx * d) / d2,\n      cy0 = (-D * dx - dy * d) / d2,\n      cx1 = (D * dy + dx * d) / d2,\n      cy1 = (-D * dx + dy * d) / d2,\n      dx0 = cx0 - x00,\n      dy0 = cy0 - y00,\n      dx1 = cx1 - x00,\n      dy1 = cy1 - y00;\n\n  // Pick the closer of the two intersection points.\n  // TODO Is there a faster way to determine which intersection to use?\n  if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n\n  return {\n    cx: cx0,\n    cy: cy0,\n    x01: -ox,\n    y01: -oy,\n    x11: cx0 * (r1 / r - 1),\n    y11: cy0 * (r1 / r - 1)\n  };\n}\n\nexport default function() {\n  var innerRadius = arcInnerRadius,\n      outerRadius = arcOuterRadius,\n      cornerRadius = constant(0),\n      padRadius = null,\n      startAngle = arcStartAngle,\n      endAngle = arcEndAngle,\n      padAngle = arcPadAngle,\n      context = null;\n\n  function arc() {\n    var buffer,\n        r,\n        r0 = +innerRadius.apply(this, arguments),\n        r1 = +outerRadius.apply(this, arguments),\n        a0 = startAngle.apply(this, arguments) - halfPi,\n        a1 = endAngle.apply(this, arguments) - halfPi,\n        da = abs(a1 - a0),\n        cw = a1 > a0;\n\n    if (!context) context = buffer = path();\n\n    // Ensure that the outer radius is always larger than the inner radius.\n    if (r1 < r0) r = r1, r1 = r0, r0 = r;\n\n    // Is it a point?\n    if (!(r1 > epsilon)) context.moveTo(0, 0);\n\n    // Or is it a circle or annulus?\n    else if (da > tau - epsilon) {\n      context.moveTo(r1 * cos(a0), r1 * sin(a0));\n      context.arc(0, 0, r1, a0, a1, !cw);\n      if (r0 > epsilon) {\n        context.moveTo(r0 * cos(a1), r0 * sin(a1));\n        context.arc(0, 0, r0, a1, a0, cw);\n      }\n    }\n\n    // Or is it a circular or annular sector?\n    else {\n      var a01 = a0,\n          a11 = a1,\n          a00 = a0,\n          a10 = a1,\n          da0 = da,\n          da1 = da,\n          ap = padAngle.apply(this, arguments) / 2,\n          rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),\n          rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),\n          rc0 = rc,\n          rc1 = rc,\n          t0,\n          t1;\n\n      // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.\n      if (rp > epsilon) {\n        var p0 = asin(rp / r0 * sin(ap)),\n            p1 = asin(rp / r1 * sin(ap));\n        if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;\n        else da0 = 0, a00 = a10 = (a0 + a1) / 2;\n        if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;\n        else da1 = 0, a01 = a11 = (a0 + a1) / 2;\n      }\n\n      var x01 = r1 * cos(a01),\n          y01 = r1 * sin(a01),\n          x10 = r0 * cos(a10),\n          y10 = r0 * sin(a10);\n\n      // Apply rounded corners?\n      if (rc > epsilon) {\n        var x11 = r1 * cos(a11),\n            y11 = r1 * sin(a11),\n            x00 = r0 * cos(a00),\n            y00 = r0 * sin(a00),\n            oc;\n\n        // Restrict the corner radius according to the sector angle.\n        if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {\n          var ax = x01 - oc[0],\n              ay = y01 - oc[1],\n              bx = x11 - oc[0],\n              by = y11 - oc[1],\n              kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),\n              lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n          rc0 = min(rc, (r0 - lc) / (kc - 1));\n          rc1 = min(rc, (r1 - lc) / (kc + 1));\n        }\n      }\n\n      // Is the sector collapsed to a line?\n      if (!(da1 > epsilon)) context.moveTo(x01, y01);\n\n      // Does the sector’s outer ring have rounded corners?\n      else if (rc1 > epsilon) {\n        t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);\n        t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);\n\n        context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n        // Have the corners merged?\n        if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n        // Otherwise, draw the two corners and the ring.\n        else {\n          context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n          context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);\n          context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n        }\n      }\n\n      // Or is the outer ring just a circular arc?\n      else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);\n\n      // Is there no inner ring, and it’s a circular sector?\n      // Or perhaps it’s an annular sector collapsed due to padding?\n      if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);\n\n      // Does the sector’s inner ring (or point) have rounded corners?\n      else if (rc0 > epsilon) {\n        t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);\n        t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);\n\n        context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n        // Have the corners merged?\n        if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n        // Otherwise, draw the two corners and the ring.\n        else {\n          context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n          context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);\n          context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n        }\n      }\n\n      // Or is the inner ring just a circular arc?\n      else context.arc(0, 0, r0, a10, a00, cw);\n    }\n\n    context.closePath();\n\n    if (buffer) return context = null, buffer + \"\" || null;\n  }\n\n  arc.centroid = function() {\n    var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,\n        a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;\n    return [cos(a) * r, sin(a) * r];\n  };\n\n  arc.innerRadius = function(_) {\n    return arguments.length ? (innerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : innerRadius;\n  };\n\n  arc.outerRadius = function(_) {\n    return arguments.length ? (outerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : outerRadius;\n  };\n\n  arc.cornerRadius = function(_) {\n    return arguments.length ? (cornerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : cornerRadius;\n  };\n\n  arc.padRadius = function(_) {\n    return arguments.length ? (padRadius = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), arc) : padRadius;\n  };\n\n  arc.startAngle = function(_) {\n    return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : startAngle;\n  };\n\n  arc.endAngle = function(_) {\n    return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : endAngle;\n  };\n\n  arc.padAngle = function(_) {\n    return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : padAngle;\n  };\n\n  arc.context = function(_) {\n    return arguments.length ? ((context = _ == null ? null : _), arc) : context;\n  };\n\n  return arc;\n}\n","function Linear(context) {\n  this._context = context;\n}\n\nLinear.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n      case 1: this._point = 2; // proceed\n      default: this._context.lineTo(x, y); break;\n    }\n  }\n};\n\nexport default function(context) {\n  return new Linear(context);\n}\n","import curveLinear from \"./linear\";\n\nexport var curveRadialLinear = curveRadial(curveLinear);\n\nfunction Radial(curve) {\n  this._curve = curve;\n}\n\nRadial.prototype = {\n  areaStart: function() {\n    this._curve.areaStart();\n  },\n  areaEnd: function() {\n    this._curve.areaEnd();\n  },\n  lineStart: function() {\n    this._curve.lineStart();\n  },\n  lineEnd: function() {\n    this._curve.lineEnd();\n  },\n  point: function(a, r) {\n    this._curve.point(r * Math.sin(a), r * -Math.cos(a));\n  }\n};\n\nexport default function curveRadial(curve) {\n\n  function radial(context) {\n    return new Radial(curve(context));\n  }\n\n  radial._curve = curve;\n\n  return radial;\n}\n","export var slice = Array.prototype.slice;\n","var tan30 = Math.sqrt(1 / 3),\n    tan30_2 = tan30 * 2;\n\nexport default {\n  draw: function(context, size) {\n    var y = Math.sqrt(size / tan30_2),\n        x = y * tan30;\n    context.moveTo(0, -y);\n    context.lineTo(x, 0);\n    context.lineTo(0, y);\n    context.lineTo(-x, 0);\n    context.closePath();\n  }\n};\n","import {pi, tau} from \"../math\";\n\nexport default {\n  draw: function(context, size) {\n    var r = Math.sqrt(size / pi);\n    context.moveTo(r, 0);\n    context.arc(0, 0, r, 0, tau);\n  }\n};\n","import {pi, tau} from \"../math\";\n\nvar ka = 0.89081309152928522810,\n    kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10),\n    kx = Math.sin(tau / 10) * kr,\n    ky = -Math.cos(tau / 10) * kr;\n\nexport default {\n  draw: function(context, size) {\n    var r = Math.sqrt(size * ka),\n        x = kx * r,\n        y = ky * r;\n    context.moveTo(0, -r);\n    context.lineTo(x, y);\n    for (var i = 1; i < 5; ++i) {\n      var a = tau * i / 5,\n          c = Math.cos(a),\n          s = Math.sin(a);\n      context.lineTo(s * r, -c * r);\n      context.lineTo(c * x - s * y, s * x + c * y);\n    }\n    context.closePath();\n  }\n};\n","export default function() {}\n","var sqrt3 = Math.sqrt(3);\n\nexport default {\n  draw: function(context, size) {\n    var y = -Math.sqrt(size / (sqrt3 * 3));\n    context.moveTo(0, y * 2);\n    context.lineTo(-sqrt3 * y, -y);\n    context.lineTo(sqrt3 * y, -y);\n    context.closePath();\n  }\n};\n","var c = -0.5,\n    s = Math.sqrt(3) / 2,\n    k = 1 / Math.sqrt(12),\n    a = (k / 2 + 1) * 3;\n\nexport default {\n  draw: function(context, size) {\n    var r = Math.sqrt(size / a),\n        x0 = r / 2,\n        y0 = r * k,\n        x1 = x0,\n        y1 = r * k + r,\n        x2 = -x1,\n        y2 = y1;\n    context.moveTo(x0, y0);\n    context.lineTo(x1, y1);\n    context.lineTo(x2, y2);\n    context.lineTo(c * x0 - s * y0, s * x0 + c * y0);\n    context.lineTo(c * x1 - s * y1, s * x1 + c * y1);\n    context.lineTo(c * x2 - s * y2, s * x2 + c * y2);\n    context.lineTo(c * x0 + s * y0, c * y0 - s * x0);\n    context.lineTo(c * x1 + s * y1, c * y1 - s * x1);\n    context.lineTo(c * x2 + s * y2, c * y2 - s * x2);\n    context.closePath();\n  }\n};\n","export function point(that, x, y) {\n  that._context.bezierCurveTo(\n    (2 * that._x0 + that._x1) / 3,\n    (2 * that._y0 + that._y1) / 3,\n    (that._x0 + 2 * that._x1) / 3,\n    (that._y0 + 2 * that._y1) / 3,\n    (that._x0 + 4 * that._x1 + x) / 6,\n    (that._y0 + 4 * that._y1 + y) / 6\n  );\n}\n\nexport function Basis(context) {\n  this._context = context;\n}\n\nBasis.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 =\n    this._y0 = this._y1 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 3: point(this, this._x1, this._y1); // proceed\n      case 2: this._context.lineTo(this._x1, this._y1); break;\n    }\n    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n      case 1: this._point = 2; break;\n      case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed\n      default: point(this, x, y); break;\n    }\n    this._x0 = this._x1, this._x1 = x;\n    this._y0 = this._y1, this._y1 = y;\n  }\n};\n\nexport default function(context) {\n  return new Basis(context);\n}\n","import noop from \"../noop\";\nimport {point} from \"./basis\";\n\nfunction BasisClosed(context) {\n  this._context = context;\n}\n\nBasisClosed.prototype = {\n  areaStart: noop,\n  areaEnd: noop,\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =\n    this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 1: {\n        this._context.moveTo(this._x2, this._y2);\n        this._context.closePath();\n        break;\n      }\n      case 2: {\n        this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);\n        this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);\n        this._context.closePath();\n        break;\n      }\n      case 3: {\n        this.point(this._x2, this._y2);\n        this.point(this._x3, this._y3);\n        this.point(this._x4, this._y4);\n        break;\n      }\n    }\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; this._x2 = x, this._y2 = y; break;\n      case 1: this._point = 2; this._x3 = x, this._y3 = y; break;\n      case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;\n      default: point(this, x, y); break;\n    }\n    this._x0 = this._x1, this._x1 = x;\n    this._y0 = this._y1, this._y1 = y;\n  }\n};\n\nexport default function(context) {\n  return new BasisClosed(context);\n}\n","import {point} from \"./basis\";\n\nfunction BasisOpen(context) {\n  this._context = context;\n}\n\nBasisOpen.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 =\n    this._y0 = this._y1 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; break;\n      case 1: this._point = 2; break;\n      case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;\n      case 3: this._point = 4; // proceed\n      default: point(this, x, y); break;\n    }\n    this._x0 = this._x1, this._x1 = x;\n    this._y0 = this._y1, this._y1 = y;\n  }\n};\n\nexport default function(context) {\n  return new BasisOpen(context);\n}\n","import {Basis} from \"./basis\";\n\nfunction Bundle(context, beta) {\n  this._basis = new Basis(context);\n  this._beta = beta;\n}\n\nBundle.prototype = {\n  lineStart: function() {\n    this._x = [];\n    this._y = [];\n    this._basis.lineStart();\n  },\n  lineEnd: function() {\n    var x = this._x,\n        y = this._y,\n        j = x.length - 1;\n\n    if (j > 0) {\n      var x0 = x[0],\n          y0 = y[0],\n          dx = x[j] - x0,\n          dy = y[j] - y0,\n          i = -1,\n          t;\n\n      while (++i <= j) {\n        t = i / j;\n        this._basis.point(\n          this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),\n          this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)\n        );\n      }\n    }\n\n    this._x = this._y = null;\n    this._basis.lineEnd();\n  },\n  point: function(x, y) {\n    this._x.push(+x);\n    this._y.push(+y);\n  }\n};\n\nexport default (function custom(beta) {\n\n  function bundle(context) {\n    return beta === 1 ? new Basis(context) : new Bundle(context, beta);\n  }\n\n  bundle.beta = function(beta) {\n    return custom(+beta);\n  };\n\n  return bundle;\n})(0.85);\n","export function point(that, x, y) {\n  that._context.bezierCurveTo(\n    that._x1 + that._k * (that._x2 - that._x0),\n    that._y1 + that._k * (that._y2 - that._y0),\n    that._x2 + that._k * (that._x1 - x),\n    that._y2 + that._k * (that._y1 - y),\n    that._x2,\n    that._y2\n  );\n}\n\nexport function Cardinal(context, tension) {\n  this._context = context;\n  this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 =\n    this._y0 = this._y1 = this._y2 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 2: this._context.lineTo(this._x2, this._y2); break;\n      case 3: point(this, this._x1, this._y1); break;\n    }\n    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n      case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n      case 2: this._point = 3; // proceed\n      default: point(this, x, y); break;\n    }\n    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n  }\n};\n\nexport default (function custom(tension) {\n\n  function cardinal(context) {\n    return new Cardinal(context, tension);\n  }\n\n  cardinal.tension = function(tension) {\n    return custom(+tension);\n  };\n\n  return cardinal;\n})(0);\n","import noop from \"../noop\";\nimport {point} from \"./cardinal\";\n\nexport function CardinalClosed(context, tension) {\n  this._context = context;\n  this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n  areaStart: noop,\n  areaEnd: noop,\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n    this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 1: {\n        this._context.moveTo(this._x3, this._y3);\n        this._context.closePath();\n        break;\n      }\n      case 2: {\n        this._context.lineTo(this._x3, this._y3);\n        this._context.closePath();\n        break;\n      }\n      case 3: {\n        this.point(this._x3, this._y3);\n        this.point(this._x4, this._y4);\n        this.point(this._x5, this._y5);\n        break;\n      }\n    }\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n      case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n      case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n      default: point(this, x, y); break;\n    }\n    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n  }\n};\n\nexport default (function custom(tension) {\n\n  function cardinal(context) {\n    return new CardinalClosed(context, tension);\n  }\n\n  cardinal.tension = function(tension) {\n    return custom(+tension);\n  };\n\n  return cardinal;\n})(0);\n","import {point} from \"./cardinal\";\n\nexport function CardinalOpen(context, tension) {\n  this._context = context;\n  this._k = (1 - tension) / 6;\n}\n\nCardinalOpen.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 =\n    this._y0 = this._y1 = this._y2 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; break;\n      case 1: this._point = 2; break;\n      case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n      case 3: this._point = 4; // proceed\n      default: point(this, x, y); break;\n    }\n    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n  }\n};\n\nexport default (function custom(tension) {\n\n  function cardinal(context) {\n    return new CardinalOpen(context, tension);\n  }\n\n  cardinal.tension = function(tension) {\n    return custom(+tension);\n  };\n\n  return cardinal;\n})(0);\n","import {epsilon} from \"../math\";\nimport {Cardinal} from \"./cardinal\";\n\nexport function point(that, x, y) {\n  var x1 = that._x1,\n      y1 = that._y1,\n      x2 = that._x2,\n      y2 = that._y2;\n\n  if (that._l01_a > epsilon) {\n    var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,\n        n = 3 * that._l01_a * (that._l01_a + that._l12_a);\n    x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;\n    y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;\n  }\n\n  if (that._l23_a > epsilon) {\n    var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,\n        m = 3 * that._l23_a * (that._l23_a + that._l12_a);\n    x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;\n    y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;\n  }\n\n  that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);\n}\n\nfunction CatmullRom(context, alpha) {\n  this._context = context;\n  this._alpha = alpha;\n}\n\nCatmullRom.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 =\n    this._y0 = this._y1 = this._y2 = NaN;\n    this._l01_a = this._l12_a = this._l23_a =\n    this._l01_2a = this._l12_2a = this._l23_2a =\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 2: this._context.lineTo(this._x2, this._y2); break;\n      case 3: this.point(this._x2, this._y2); break;\n    }\n    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n\n    if (this._point) {\n      var x23 = this._x2 - x,\n          y23 = this._y2 - y;\n      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n    }\n\n    switch (this._point) {\n      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n      case 1: this._point = 2; break;\n      case 2: this._point = 3; // proceed\n      default: point(this, x, y); break;\n    }\n\n    this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n    this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n  }\n};\n\nexport default (function custom(alpha) {\n\n  function catmullRom(context) {\n    return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);\n  }\n\n  catmullRom.alpha = function(alpha) {\n    return custom(+alpha);\n  };\n\n  return catmullRom;\n})(0.5);\n","import {CardinalClosed} from \"./cardinalClosed\";\nimport noop from \"../noop\";\nimport {point} from \"./catmullRom\";\n\nfunction CatmullRomClosed(context, alpha) {\n  this._context = context;\n  this._alpha = alpha;\n}\n\nCatmullRomClosed.prototype = {\n  areaStart: noop,\n  areaEnd: noop,\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n    this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n    this._l01_a = this._l12_a = this._l23_a =\n    this._l01_2a = this._l12_2a = this._l23_2a =\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 1: {\n        this._context.moveTo(this._x3, this._y3);\n        this._context.closePath();\n        break;\n      }\n      case 2: {\n        this._context.lineTo(this._x3, this._y3);\n        this._context.closePath();\n        break;\n      }\n      case 3: {\n        this.point(this._x3, this._y3);\n        this.point(this._x4, this._y4);\n        this.point(this._x5, this._y5);\n        break;\n      }\n    }\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n\n    if (this._point) {\n      var x23 = this._x2 - x,\n          y23 = this._y2 - y;\n      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n    }\n\n    switch (this._point) {\n      case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n      case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n      case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n      default: point(this, x, y); break;\n    }\n\n    this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n    this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n  }\n};\n\nexport default (function custom(alpha) {\n\n  function catmullRom(context) {\n    return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);\n  }\n\n  catmullRom.alpha = function(alpha) {\n    return custom(+alpha);\n  };\n\n  return catmullRom;\n})(0.5);\n","import {CardinalOpen} from \"./cardinalOpen\";\nimport {point} from \"./catmullRom\";\n\nfunction CatmullRomOpen(context, alpha) {\n  this._context = context;\n  this._alpha = alpha;\n}\n\nCatmullRomOpen.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 = this._x2 =\n    this._y0 = this._y1 = this._y2 = NaN;\n    this._l01_a = this._l12_a = this._l23_a =\n    this._l01_2a = this._l12_2a = this._l23_2a =\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n\n    if (this._point) {\n      var x23 = this._x2 - x,\n          y23 = this._y2 - y;\n      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));\n    }\n\n    switch (this._point) {\n      case 0: this._point = 1; break;\n      case 1: this._point = 2; break;\n      case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;\n      case 3: this._point = 4; // proceed\n      default: point(this, x, y); break;\n    }\n\n    this._l01_a = this._l12_a, this._l12_a = this._l23_a;\n    this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;\n    this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n    this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n  }\n};\n\nexport default (function custom(alpha) {\n\n  function catmullRom(context) {\n    return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);\n  }\n\n  catmullRom.alpha = function(alpha) {\n    return custom(+alpha);\n  };\n\n  return catmullRom;\n})(0.5);\n","import noop from \"../noop\";\n\nfunction LinearClosed(context) {\n  this._context = context;\n}\n\nLinearClosed.prototype = {\n  areaStart: noop,\n  areaEnd: noop,\n  lineStart: function() {\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (this._point) this._context.closePath();\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    if (this._point) this._context.lineTo(x, y);\n    else this._point = 1, this._context.moveTo(x, y);\n  }\n};\n\nexport default function(context) {\n  return new LinearClosed(context);\n}\n","function sign(x) {\n  return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n  var h0 = that._x1 - that._x0,\n      h1 = x2 - that._x1,\n      s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n      s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n      p = (s0 * h1 + s1 * h0) / (h0 + h1);\n  return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n  var h = that._x1 - that._x0;\n  return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(that, t0, t1) {\n  var x0 = that._x0,\n      y0 = that._y0,\n      x1 = that._x1,\n      y1 = that._y1,\n      dx = (x1 - x0) / 3;\n  that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n  this._context = context;\n}\n\nMonotoneX.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x0 = this._x1 =\n    this._y0 = this._y1 =\n    this._t0 = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    switch (this._point) {\n      case 2: this._context.lineTo(this._x1, this._y1); break;\n      case 3: point(this, this._t0, slope2(this, this._t0)); break;\n    }\n    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n    this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    var t1 = NaN;\n\n    x = +x, y = +y;\n    if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n    switch (this._point) {\n      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n      case 1: this._point = 2; break;\n      case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n      default: point(this, this._t0, t1 = slope3(this, x, y)); break;\n    }\n\n    this._x0 = this._x1, this._x1 = x;\n    this._y0 = this._y1, this._y1 = y;\n    this._t0 = t1;\n  }\n}\n\nfunction MonotoneY(context) {\n  this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n  MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n  this._context = context;\n}\n\nReflectContext.prototype = {\n  moveTo: function(x, y) { this._context.moveTo(y, x); },\n  closePath: function() { this._context.closePath(); },\n  lineTo: function(x, y) { this._context.lineTo(y, x); },\n  bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nexport function monotoneX(context) {\n  return new MonotoneX(context);\n}\n\nexport function monotoneY(context) {\n  return new MonotoneY(context);\n}\n","function Natural(context) {\n  this._context = context;\n}\n\nNatural.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x = [];\n    this._y = [];\n  },\n  lineEnd: function() {\n    var x = this._x,\n        y = this._y,\n        n = x.length;\n\n    if (n) {\n      this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);\n      if (n === 2) {\n        this._context.lineTo(x[1], y[1]);\n      } else {\n        var px = controlPoints(x),\n            py = controlPoints(y);\n        for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {\n          this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);\n        }\n      }\n    }\n\n    if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();\n    this._line = 1 - this._line;\n    this._x = this._y = null;\n  },\n  point: function(x, y) {\n    this._x.push(+x);\n    this._y.push(+y);\n  }\n};\n\n// See https://www.particleincell.com/2012/bezier-splines/ for derivation.\nfunction controlPoints(x) {\n  var i,\n      n = x.length - 1,\n      m,\n      a = new Array(n),\n      b = new Array(n),\n      r = new Array(n);\n  a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];\n  for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];\n  a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];\n  for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];\n  a[n - 1] = r[n - 1] / b[n - 1];\n  for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];\n  b[n - 1] = (x[n] + a[n - 1]) / 2;\n  for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];\n  return [a, b];\n}\n\nexport default function(context) {\n  return new Natural(context);\n}\n","function Step(context, t) {\n  this._context = context;\n  this._t = t;\n}\n\nStep.prototype = {\n  areaStart: function() {\n    this._line = 0;\n  },\n  areaEnd: function() {\n    this._line = NaN;\n  },\n  lineStart: function() {\n    this._x = this._y = NaN;\n    this._point = 0;\n  },\n  lineEnd: function() {\n    if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);\n    if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n    if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;\n  },\n  point: function(x, y) {\n    x = +x, y = +y;\n    switch (this._point) {\n      case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n      case 1: this._point = 2; // proceed\n      default: {\n        if (this._t <= 0) {\n          this._context.lineTo(this._x, y);\n          this._context.lineTo(x, y);\n        } else {\n          var x1 = this._x * (1 - this._t) + x * this._t;\n          this._context.lineTo(x1, this._y);\n          this._context.lineTo(x1, y);\n        }\n        break;\n      }\n    }\n    this._x = x, this._y = y;\n  }\n};\n\nexport default function(context) {\n  return new Step(context, 0.5);\n}\n\nexport function stepBefore(context) {\n  return new Step(context, 0);\n}\n\nexport function stepAfter(context) {\n  return new Step(context, 1);\n}\n","import ascending from \"./ascending\";\n\nexport default function(series) {\n  return ascending(series).reverse();\n}\n","import { arc as arcFactory } from \"d3-shape\";\n\nimport {\n  LinkedVisualConsoleProps,\n  AnyObject,\n  WithModuleProps\n} from \"../lib/types\";\nimport {\n  linkedVCPropsDecoder,\n  modulePropsDecoder,\n  notEmptyStringOr,\n  parseIntOr,\n  parseFloatOr\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type PercentileProps = {\n  type: ItemType.PERCENTILE_BAR;\n  percentileType:\n    | \"progress-bar\"\n    | \"bubble\"\n    | \"circular-progress-bar\"\n    | \"circular-progress-bar-alt\";\n  valueType: \"percent\" | \"value\";\n  minValue: number | null;\n  maxValue: number | null;\n  color: string | null;\n  labelColor: string | null;\n  value: number | null;\n  unit: string | null;\n} & ItemProps &\n  WithModuleProps &\n  LinkedVisualConsoleProps;\n\n/**\n * Extract a valid enum value from a raw type value.\n * @param type Raw value.\n */\nfunction extractPercentileType(\n  type: unknown\n): PercentileProps[\"percentileType\"] {\n  switch (type) {\n    case \"progress-bar\":\n    case \"bubble\":\n    case \"circular-progress-bar\":\n    case \"circular-progress-bar-alt\":\n      return type;\n    default:\n    case ItemType.PERCENTILE_BAR:\n      return \"progress-bar\";\n    case ItemType.PERCENTILE_BUBBLE:\n      return \"bubble\";\n    case ItemType.CIRCULAR_PROGRESS_BAR:\n      return \"circular-progress-bar\";\n    case ItemType.CIRCULAR_INTERIOR_PROGRESS_BAR:\n      return \"circular-progress-bar-alt\";\n  }\n}\n\n/**\n * Extract a valid enum value from a raw value type value.\n * @param type Raw value.\n */\nfunction extractValueType(valueType: unknown): PercentileProps[\"valueType\"] {\n  switch (valueType) {\n    case \"percent\":\n    case \"value\":\n      return valueType;\n    default:\n      return \"percent\";\n  }\n}\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the percentile props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function percentilePropsDecoder(\n  data: AnyObject\n): PercentileProps | never {\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.PERCENTILE_BAR,\n    percentileType: extractPercentileType(data.percentileType || data.type),\n    valueType: extractValueType(data.valueType),\n    minValue: parseIntOr(data.minValue, null),\n    maxValue: parseIntOr(data.maxValue, null),\n    color: notEmptyStringOr(data.color, null),\n    labelColor: notEmptyStringOr(data.labelColor, null),\n    value: parseFloatOr(data.value, null),\n    unit: notEmptyStringOr(data.unit, null),\n    ...modulePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    ...linkedVCPropsDecoder(data) // Object spread. It will merge the properties of the two objects.\n  };\n}\n\nconst svgNS = \"http://www.w3.org/2000/svg\";\n\nexport default class Percentile extends Item<PercentileProps> {\n  protected createDomElement(): HTMLElement {\n    const colors = {\n      background: \"#000000\",\n      progress: this.props.color || \"#F0F0F0\",\n      text: this.props.labelColor || \"#444444\"\n    };\n    // Progress.\n    const progress = this.getProgress();\n    // Main element.\n    const element = document.createElement(\"div\");\n    // SVG container.\n    const svg = document.createElementNS(svgNS, \"svg\");\n\n    var formatValue;\n    if (this.props.value != null) {\n      if (Intl) {\n        formatValue = Intl.NumberFormat(\"en-EN\").format(this.props.value);\n      } else {\n        formatValue = this.props.value;\n      }\n    }\n\n    switch (this.props.percentileType) {\n      case \"progress-bar\":\n        {\n          const backgroundRect = document.createElementNS(svgNS, \"rect\");\n          backgroundRect.setAttribute(\"fill\", colors.background);\n          backgroundRect.setAttribute(\"fill-opacity\", \"0.5\");\n          backgroundRect.setAttribute(\"width\", \"100\");\n          backgroundRect.setAttribute(\"height\", \"20\");\n          backgroundRect.setAttribute(\"rx\", \"5\");\n          backgroundRect.setAttribute(\"ry\", \"5\");\n          const progressRect = document.createElementNS(svgNS, \"rect\");\n          progressRect.setAttribute(\"fill\", colors.progress);\n          progressRect.setAttribute(\"fill-opacity\", \"1\");\n          progressRect.setAttribute(\"width\", `${progress}`);\n          progressRect.setAttribute(\"height\", \"20\");\n          progressRect.setAttribute(\"rx\", \"5\");\n          progressRect.setAttribute(\"ry\", \"5\");\n          const text = document.createElementNS(svgNS, \"text\");\n          text.setAttribute(\"text-anchor\", \"middle\");\n          text.setAttribute(\"alignment-baseline\", \"middle\");\n          text.setAttribute(\"font-size\", \"12\");\n          text.setAttribute(\"font-family\", \"arial\");\n          text.setAttribute(\"font-weight\", \"bold\");\n          text.setAttribute(\"transform\", \"translate(50 11)\");\n          text.setAttribute(\"fill\", colors.text);\n\n          if (this.props.valueType === \"value\") {\n            text.style.fontSize = \"6pt\";\n\n            text.textContent = this.props.unit\n              ? `${formatValue} ${this.props.unit}`\n              : `${formatValue}`;\n          } else {\n            text.textContent = `${progress}%`;\n          }\n\n          // Auto resize SVG using the view box magic: https://css-tricks.com/scale-svg/\n          svg.setAttribute(\"viewBox\", \"0 0 100 20\");\n          svg.append(backgroundRect, progressRect, text);\n        }\n        break;\n      case \"bubble\":\n      case \"circular-progress-bar\":\n      case \"circular-progress-bar-alt\":\n        {\n          // Auto resize SVG using the view box magic: https://css-tricks.com/scale-svg/\n          svg.setAttribute(\"viewBox\", \"0 0 100 100\");\n\n          if (this.props.percentileType === \"bubble\") {\n            // Create and append the circles.\n            const backgroundCircle = document.createElementNS(svgNS, \"circle\");\n            backgroundCircle.setAttribute(\"transform\", \"translate(50 50)\");\n            backgroundCircle.setAttribute(\"fill\", colors.background);\n            backgroundCircle.setAttribute(\"fill-opacity\", \"0.5\");\n            backgroundCircle.setAttribute(\"r\", \"50\");\n            const progressCircle = document.createElementNS(svgNS, \"circle\");\n            progressCircle.setAttribute(\"transform\", \"translate(50 50)\");\n            progressCircle.setAttribute(\"fill\", colors.progress);\n            progressCircle.setAttribute(\"fill-opacity\", \"1\");\n            progressCircle.setAttribute(\"r\", `${progress / 2}`);\n\n            svg.append(backgroundCircle, progressCircle);\n          } else {\n            // Create and append the circles.\n            const arcProps = {\n              innerRadius:\n                this.props.percentileType === \"circular-progress-bar\" ? 30 : 0,\n              outerRadius: 50,\n              startAngle: 0,\n              endAngle: Math.PI * 2\n            };\n            const arc = arcFactory();\n\n            const backgroundCircle = document.createElementNS(svgNS, \"path\");\n            backgroundCircle.setAttribute(\"transform\", \"translate(50 50)\");\n            backgroundCircle.setAttribute(\"fill\", colors.background);\n            backgroundCircle.setAttribute(\"fill-opacity\", \"0.5\");\n            backgroundCircle.setAttribute(\"d\", `${arc(arcProps)}`);\n            const progressCircle = document.createElementNS(svgNS, \"path\");\n            progressCircle.setAttribute(\"transform\", \"translate(50 50)\");\n            progressCircle.setAttribute(\"fill\", colors.progress);\n            progressCircle.setAttribute(\"fill-opacity\", \"1\");\n            progressCircle.setAttribute(\n              \"d\",\n              `${arc({\n                ...arcProps,\n                endAngle: arcProps.endAngle * (progress / 100)\n              })}`\n            );\n\n            svg.append(backgroundCircle, progressCircle);\n          }\n\n          // Create and append the text.\n          const text = document.createElementNS(svgNS, \"text\");\n          text.setAttribute(\"text-anchor\", \"middle\");\n          text.setAttribute(\"alignment-baseline\", \"middle\");\n          text.setAttribute(\"font-size\", \"16\");\n          text.setAttribute(\"font-family\", \"arial\");\n          text.setAttribute(\"font-weight\", \"bold\");\n          text.setAttribute(\"fill\", colors.text);\n\n          if (this.props.valueType === \"value\" && this.props.value != null) {\n            // Show value and unit in 1 (no unit) or 2 lines.\n            if (this.props.unit && this.props.unit.length > 0) {\n              const value = document.createElementNS(svgNS, \"tspan\");\n              value.setAttribute(\"x\", \"0\");\n              value.setAttribute(\"dy\", \"1em\");\n              value.textContent = `${formatValue}`;\n              value.style.fontSize = \"8pt\";\n              const unit = document.createElementNS(svgNS, \"tspan\");\n              unit.setAttribute(\"x\", \"0\");\n              unit.setAttribute(\"dy\", \"1em\");\n              unit.textContent = `${this.props.unit}`;\n              unit.style.fontSize = \"8pt\";\n              text.append(value, unit);\n              text.setAttribute(\"transform\", \"translate(50 33)\");\n            } else {\n              text.textContent = `${formatValue}`;\n              text.style.fontSize = \"8pt\";\n              text.setAttribute(\"transform\", \"translate(50 50)\");\n            }\n          } else {\n            // Percentage.\n            text.textContent = `${progress}%`;\n            text.setAttribute(\"transform\", \"translate(50 50)\");\n          }\n\n          svg.append(text);\n        }\n        break;\n    }\n\n    element.append(svg);\n\n    return element;\n  }\n\n  private getProgress(): number {\n    const minValue = this.props.minValue || 0;\n    const maxValue = this.props.maxValue || 100;\n    const value = this.props.value == null ? 0 : this.props.value;\n\n    if (value <= minValue) return 0;\n    else if (value >= maxValue) return 100;\n    else return Math.trunc(((value - minValue) / (maxValue - minValue)) * 100);\n  }\n}\n","import { AnyObject } from \"../lib/types\";\nimport {\n  stringIsEmpty,\n  notEmptyStringOr,\n  decodeBase64,\n  parseIntOr\n} from \"../lib\";\nimport Item, { ItemType, ItemProps, itemBasePropsDecoder } from \"../Item\";\n\nexport type ServiceProps = {\n  type: ItemType.SERVICE;\n  serviceId: number;\n  imageSrc: string | null;\n  statusImageSrc: string | null;\n  encodedTitle: string | null;\n} & ItemProps;\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the service props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function servicePropsDecoder(data: AnyObject): ServiceProps | never {\n  if (data.imageSrc !== null) {\n    if (\n      typeof data.statusImageSrc !== \"string\" ||\n      data.imageSrc.statusImageSrc === 0\n    ) {\n      throw new TypeError(\"invalid status image src.\");\n    }\n  } else {\n    if (stringIsEmpty(data.encodedTitle)) {\n      throw new TypeError(\"missing encode tittle content.\");\n    }\n  }\n\n  if (parseIntOr(data.serviceId, null) === null) {\n    throw new TypeError(\"invalid service id.\");\n  }\n\n  return {\n    ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.\n    type: ItemType.SERVICE,\n    serviceId: data.serviceId,\n    imageSrc: notEmptyStringOr(data.imageSrc, null),\n    statusImageSrc: notEmptyStringOr(data.statusImageSrc, null),\n    encodedTitle: notEmptyStringOr(data.encodedTitle, null)\n  };\n}\n\nexport default class Service extends Item<ServiceProps> {\n  public createDomElement(): HTMLElement {\n    const element = document.createElement(\"div\");\n    element.className = \"service\";\n\n    if (this.props.statusImageSrc !== null) {\n      element.style.background = `url(${this.props.statusImageSrc}) no-repeat`;\n      element.style.backgroundSize = \"contain\";\n      element.style.backgroundPosition = \"center\";\n    } else if (this.props.encodedTitle !== null) {\n      element.innerHTML = decodeBase64(this.props.encodedTitle);\n    }\n\n    return element;\n  }\n}\n","import { AnyObject, Size } from \"./lib/types\";\nimport {\n  parseBoolean,\n  sizePropsDecoder,\n  parseIntOr,\n  notEmptyStringOr,\n  itemMetaDecoder\n} from \"./lib\";\nimport Item, {\n  ItemType,\n  ItemProps,\n  ItemClickEvent,\n  ItemRemoveEvent,\n  ItemMovedEvent,\n  ItemResizedEvent\n} from \"./Item\";\nimport StaticGraph, { staticGraphPropsDecoder } from \"./items/StaticGraph\";\nimport Icon, { iconPropsDecoder } from \"./items/Icon\";\nimport ColorCloud, { colorCloudPropsDecoder } from \"./items/ColorCloud\";\nimport Group, { groupPropsDecoder } from \"./items/Group\";\nimport Clock, { clockPropsDecoder } from \"./items/Clock\";\nimport Box, { boxPropsDecoder } from \"./items/Box\";\nimport Line, { linePropsDecoder } from \"./items/Line\";\nimport Label, { labelPropsDecoder } from \"./items/Label\";\nimport SimpleValue, { simpleValuePropsDecoder } from \"./items/SimpleValue\";\nimport EventsHistory, {\n  eventsHistoryPropsDecoder\n} from \"./items/EventsHistory\";\nimport Percentile, { percentilePropsDecoder } from \"./items/Percentile\";\nimport TypedEvent, { Disposable, Listener } from \"./lib/TypedEvent\";\nimport DonutGraph, { donutGraphPropsDecoder } from \"./items/DonutGraph\";\nimport BarsGraph, { barsGraphPropsDecoder } from \"./items/BarsGraph\";\nimport ModuleGraph, { moduleGraphPropsDecoder } from \"./items/ModuleGraph\";\nimport Service, { servicePropsDecoder } from \"./items/Service\";\n\n// TODO: Document.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nfunction itemInstanceFrom(data: AnyObject) {\n  const type = parseIntOr(data.type, null);\n  if (type == null) throw new TypeError(\"missing item type.\");\n\n  const meta = itemMetaDecoder(data);\n\n  switch (type as ItemType) {\n    case ItemType.STATIC_GRAPH:\n      return new StaticGraph(staticGraphPropsDecoder(data), meta);\n    case ItemType.MODULE_GRAPH:\n      return new ModuleGraph(moduleGraphPropsDecoder(data), meta);\n    case ItemType.SIMPLE_VALUE:\n    case ItemType.SIMPLE_VALUE_MAX:\n    case ItemType.SIMPLE_VALUE_MIN:\n    case ItemType.SIMPLE_VALUE_AVG:\n      return new SimpleValue(simpleValuePropsDecoder(data), meta);\n    case ItemType.PERCENTILE_BAR:\n    case ItemType.PERCENTILE_BUBBLE:\n    case ItemType.CIRCULAR_PROGRESS_BAR:\n    case ItemType.CIRCULAR_INTERIOR_PROGRESS_BAR:\n      return new Percentile(percentilePropsDecoder(data), meta);\n    case ItemType.LABEL:\n      return new Label(labelPropsDecoder(data), meta);\n    case ItemType.ICON:\n      return new Icon(iconPropsDecoder(data), meta);\n    case ItemType.SERVICE:\n      return new Service(servicePropsDecoder(data), meta);\n    case ItemType.GROUP_ITEM:\n      return new Group(groupPropsDecoder(data), meta);\n    case ItemType.BOX_ITEM:\n      return new Box(boxPropsDecoder(data), meta);\n    case ItemType.LINE_ITEM:\n      return new Line(linePropsDecoder(data), meta);\n    case ItemType.AUTO_SLA_GRAPH:\n      return new EventsHistory(eventsHistoryPropsDecoder(data), meta);\n    case ItemType.DONUT_GRAPH:\n      return new DonutGraph(donutGraphPropsDecoder(data), meta);\n    case ItemType.BARS_GRAPH:\n      return new BarsGraph(barsGraphPropsDecoder(data), meta);\n    case ItemType.CLOCK:\n      return new Clock(clockPropsDecoder(data), meta);\n    case ItemType.COLOR_CLOUD:\n      return new ColorCloud(colorCloudPropsDecoder(data), meta);\n    default:\n      throw new TypeError(\"item not found\");\n  }\n}\n\n// TODO: Document.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nfunction decodeProps(data: AnyObject) {\n  const type = parseIntOr(data.type, null);\n  if (type == null) throw new TypeError(\"missing item type.\");\n\n  switch (type as ItemType) {\n    case ItemType.STATIC_GRAPH:\n      return staticGraphPropsDecoder(data);\n    case ItemType.MODULE_GRAPH:\n      return moduleGraphPropsDecoder(data);\n    case ItemType.SIMPLE_VALUE:\n    case ItemType.SIMPLE_VALUE_MAX:\n    case ItemType.SIMPLE_VALUE_MIN:\n    case ItemType.SIMPLE_VALUE_AVG:\n      return simpleValuePropsDecoder(data);\n    case ItemType.PERCENTILE_BAR:\n    case ItemType.PERCENTILE_BUBBLE:\n    case ItemType.CIRCULAR_PROGRESS_BAR:\n    case ItemType.CIRCULAR_INTERIOR_PROGRESS_BAR:\n      return percentilePropsDecoder(data);\n    case ItemType.LABEL:\n      return labelPropsDecoder(data);\n    case ItemType.ICON:\n      return iconPropsDecoder(data);\n    case ItemType.SERVICE:\n      return servicePropsDecoder(data);\n    case ItemType.GROUP_ITEM:\n      return groupPropsDecoder(data);\n    case ItemType.BOX_ITEM:\n      return boxPropsDecoder(data);\n    case ItemType.LINE_ITEM:\n      return linePropsDecoder(data);\n    case ItemType.AUTO_SLA_GRAPH:\n      return eventsHistoryPropsDecoder(data);\n    case ItemType.DONUT_GRAPH:\n      return donutGraphPropsDecoder(data);\n    case ItemType.BARS_GRAPH:\n      return barsGraphPropsDecoder(data);\n    case ItemType.CLOCK:\n      return clockPropsDecoder(data);\n    case ItemType.COLOR_CLOUD:\n      return colorCloudPropsDecoder(data);\n    default:\n      throw new TypeError(\"decoder not found\");\n  }\n}\n\n// Base properties.\nexport interface VisualConsoleProps extends Size {\n  readonly id: number;\n  name: string;\n  groupId: number;\n  backgroundURL: string | null; // URL?\n  backgroundColor: string | null;\n  isFavorite: boolean;\n  relationLineWidth: number;\n}\n\n/**\n * Build a valid typed object from a raw object.\n * This will allow us to ensure the type safety.\n *\n * @param data Raw object.\n * @return An object representing the Visual Console props.\n * @throws Will throw a TypeError if some property\n * is missing from the raw object or have an invalid type.\n */\nexport function visualConsolePropsDecoder(\n  data: AnyObject\n): VisualConsoleProps | never {\n  // Object destructuring: http://es6-features.org/#ObjectMatchingShorthandNotation\n  const {\n    id,\n    name,\n    groupId,\n    backgroundURL,\n    backgroundColor,\n    isFavorite,\n    relationLineWidth\n  } = data;\n\n  if (id == null || isNaN(parseInt(id))) {\n    throw new TypeError(\"invalid Id.\");\n  }\n  if (typeof name !== \"string\" || name.length === 0) {\n    throw new TypeError(\"invalid name.\");\n  }\n  if (groupId == null || isNaN(parseInt(groupId))) {\n    throw new TypeError(\"invalid group Id.\");\n  }\n\n  return {\n    id: parseInt(id),\n    name,\n    groupId: parseInt(groupId),\n    backgroundURL: notEmptyStringOr(backgroundURL, null),\n    backgroundColor: notEmptyStringOr(backgroundColor, null),\n    isFavorite: parseBoolean(isFavorite),\n    relationLineWidth: parseIntOr(relationLineWidth, 0),\n    ...sizePropsDecoder(data)\n  };\n}\n\nexport default class VisualConsole {\n  // Reference to the DOM element which will contain the items.\n  private readonly containerRef: HTMLElement;\n  // Properties.\n  private _props: VisualConsoleProps;\n  // Visual Console Item instances by their Id.\n  private elementsById: {\n    [key: number]: Item<ItemProps>;\n  } = {};\n  // Visual Console Item Ids.\n  private elementIds: ItemProps[\"id\"][] = [];\n  // Dictionary which store the created lines.\n  private relations: {\n    [key: string]: Line;\n  } = {};\n  // Event manager for click events.\n  private readonly clickEventManager = new TypedEvent<\n    ItemClickEvent<ItemProps>\n  >();\n  // Event manager for move events.\n  private readonly movedEventManager = new TypedEvent<ItemMovedEvent>();\n  // Event manager for resize events.\n  private readonly resizedEventManager = new TypedEvent<ItemResizedEvent>();\n  // List of references to clean the event listeners.\n  private readonly disposables: Disposable[] = [];\n\n  /**\n   * React to a click on an element.\n   * @param e Event object.\n   */\n  private handleElementClick: (e: ItemClickEvent<ItemProps>) => void = e => {\n    this.clickEventManager.emit(e);\n    // console.log(`Clicked element #${e.data.id}`, e);\n  };\n\n  /**\n   * React to a movement on an element.\n   * @param e Event object.\n   */\n  private handleElementMovement: (e: ItemMovedEvent) => void = e => {\n    this.movedEventManager.emit(e);\n    // console.log(`Moved element #${e.item.props.id}`, e);\n  };\n\n  /**\n   * React to a resizement on an element.\n   * @param e Event object.\n   */\n  private handleElementResizement: (e: ItemResizedEvent) => void = e => {\n    this.resizedEventManager.emit(e);\n    // console.log(`Resized element #${e.item.props.id}`, e);\n  };\n\n  /**\n   * Clear some element references.\n   * @param e Event object.\n   */\n  private handleElementRemove: (e: ItemRemoveEvent<ItemProps>) => void = e => {\n    // Remove the element from the list and its relations.\n    this.elementIds = this.elementIds.filter(id => id !== e.data.id);\n    delete this.elementsById[e.data.id];\n    this.clearRelations(e.data.id);\n  };\n\n  public constructor(\n    container: HTMLElement,\n    props: AnyObject,\n    items: AnyObject[]\n  ) {\n    this.containerRef = container;\n    this._props = visualConsolePropsDecoder(props);\n\n    // Force the first render.\n    this.render();\n\n    // Sort by isOnTop, id ASC\n    items = items.sort(function(a, b) {\n      if (\n        a.isOnTop == null ||\n        b.isOnTop == null ||\n        a.id == null ||\n        b.id == null\n      ) {\n        return 0;\n      }\n\n      if (a.isOnTop && !b.isOnTop) return 1;\n      else if (!a.isOnTop && b.isOnTop) return -1;\n      else if (a.id > b.id) return 1;\n      else return -1;\n    });\n\n    // Initialize the items.\n    items.forEach(item => {\n      try {\n        const itemInstance = itemInstanceFrom(item);\n        // Add the item to the list.\n        this.elementsById[itemInstance.props.id] = itemInstance;\n        this.elementIds.push(itemInstance.props.id);\n        // Item event handlers.\n        itemInstance.onClick(this.handleElementClick);\n        itemInstance.onMoved(this.handleElementMovement);\n        itemInstance.onResized(this.handleElementResizement);\n        itemInstance.onRemove(this.handleElementRemove);\n        // Add the item to the DOM.\n        this.containerRef.append(itemInstance.elementRef);\n      } catch (error) {\n        console.log(\"Error creating a new element:\", error.message);\n      }\n    });\n\n    // Create lines.\n    this.buildRelations();\n  }\n\n  /**\n   * Public accessor of the `elements` property.\n   * @return Properties.\n   */\n  public get elements(): Item<ItemProps>[] {\n    // Ensure the type cause Typescript doesn't know the filter removes null items.\n    return this.elementIds\n      .map(id => this.elementsById[id])\n      .filter(_ => _ != null) as Item<ItemProps>[];\n  }\n\n  /**\n   * Public setter of the `elements` property.\n   * @param items.\n   */\n  public updateElements(items: AnyObject[]): void {\n    // Ensure the type cause Typescript doesn't know the filter removes null items.\n    const itemIds = items\n      .map(item => item.id || null)\n      .filter(id => id != null) as number[];\n    // Get the elements we should delete.\n    const deletedIds = this.elementIds.filter(id => itemIds.indexOf(id) < 0);\n    // Delete the elements.\n    deletedIds.forEach(id => {\n      if (this.elementsById[id] != null) {\n        this.elementsById[id].remove();\n        delete this.elementsById[id];\n      }\n    });\n    // Replace the element ids.\n    this.elementIds = itemIds;\n\n    // Initialize the items.\n    items.forEach(item => {\n      if (item.id) {\n        if (this.elementsById[item.id] == null) {\n          // New item.\n          try {\n            const itemInstance = itemInstanceFrom(item);\n            // Add the item to the list.\n            this.elementsById[itemInstance.props.id] = itemInstance;\n            // Item event handlers.\n            itemInstance.onClick(this.handleElementClick);\n            itemInstance.onRemove(this.handleElementRemove);\n            // Add the item to the DOM.\n            this.containerRef.append(itemInstance.elementRef);\n          } catch (error) {\n            console.log(\"Error creating a new element:\", error.message);\n          }\n        } else {\n          // Update item.\n          try {\n            this.elementsById[item.id].props = decodeProps(item);\n          } catch (error) {\n            console.log(\"Error updating an element:\", error.message);\n          }\n        }\n      }\n    });\n\n    // Re-build relations.\n    this.buildRelations();\n  }\n\n  /**\n   * Public accessor of the `props` property.\n   * @return Properties.\n   */\n  public get props(): VisualConsoleProps {\n    return { ...this._props }; // Return a copy.\n  }\n\n  /**\n   * Public setter of the `props` property.\n   * If the new props are different enough than the\n   * stored props, a render would be fired.\n   * @param newProps\n   */\n  public set props(newProps: VisualConsoleProps) {\n    const prevProps = this.props;\n    // Update the internal props.\n    this._props = newProps;\n\n    // From this point, things which rely on this.props can access to the changes.\n\n    // Re-render.\n    this.render(prevProps);\n  }\n\n  /**\n   * Recreate or update the HTMLElement which represents the Visual Console into the DOM.\n   * @param prevProps If exists it will be used to only DOM updates instead of a full replace.\n   */\n  public render(prevProps: VisualConsoleProps | null = null): void {\n    if (prevProps) {\n      if (prevProps.backgroundURL !== this.props.backgroundURL) {\n        this.containerRef.style.backgroundImage =\n          this.props.backgroundURL !== null\n            ? `url(${this.props.backgroundURL})`\n            : null;\n      }\n      if (prevProps.backgroundColor !== this.props.backgroundColor) {\n        this.containerRef.style.backgroundColor = this.props.backgroundColor;\n      }\n      if (this.sizeChanged(prevProps, this.props)) {\n        this.resizeElement(this.props.width, this.props.height);\n      }\n    } else {\n      this.containerRef.style.backgroundImage =\n        this.props.backgroundURL !== null\n          ? `url(${this.props.backgroundURL})`\n          : null;\n\n      this.containerRef.style.backgroundColor = this.props.backgroundColor;\n      this.resizeElement(this.props.width, this.props.height);\n    }\n  }\n\n  /**\n   * Compare the previous and the new size and return\n   * a boolean value in case the size changed.\n   * @param prevSize\n   * @param newSize\n   * @return Whether the size changed or not.\n   */\n  public sizeChanged(prevSize: Size, newSize: Size): boolean {\n    return (\n      prevSize.width !== newSize.width || prevSize.height !== newSize.height\n    );\n  }\n\n  /**\n   * Resize the DOM container.\n   * @param width\n   * @param height\n   */\n  public resizeElement(width: number, height: number): void {\n    this.containerRef.style.width = `${width}px`;\n    this.containerRef.style.height = `${height}px`;\n  }\n\n  /**\n   * Update the size into the properties and resize the DOM container.\n   * @param width\n   * @param height\n   */\n  public resize(width: number, height: number): void {\n    this.props = {\n      ...this.props, // Object spread: http://es6-features.org/#SpreadOperator\n      width,\n      height\n    };\n  }\n\n  /**\n   * To remove the event listeners and the elements from the DOM.\n   */\n  public remove(): void {\n    this.disposables.forEach(d => d.dispose()); // Arrow function.\n    this.elements.forEach(e => e.remove()); // Arrow function.\n    this.elementsById = {};\n    this.elementIds = [];\n    // Clear relations.\n    this.clearRelations();\n    // Clean container.\n    this.containerRef.innerHTML = \"\";\n  }\n\n  /**\n   * Create line elements which connect the elements with their parents.\n   */\n  private buildRelations(): void {\n    // Clear relations.\n    this.clearRelations();\n    // Add relations.\n    this.elements.forEach(item => {\n      if (item.props.parentId !== null) {\n        const parent = this.elementsById[item.props.parentId];\n        const child = this.elementsById[item.props.id];\n        if (parent && child) this.addRelationLine(parent, child);\n      }\n    });\n  }\n\n  /**\n   * @param itemId Optional identifier of a parent or child item.\n   * Remove the line elements which connect the elements with their parents.\n   */\n  private clearRelations(itemId?: number): void {\n    if (itemId != null) {\n      for (let key in this.relations) {\n        const ids = key.split(\"|\");\n        const parentId = Number.parseInt(ids[0]);\n        const childId = Number.parseInt(ids[1]);\n\n        if (itemId === parentId || itemId === childId) {\n          this.relations[key].remove();\n          delete this.relations[key];\n        }\n      }\n    } else {\n      for (let key in this.relations) {\n        this.relations[key].remove();\n        delete this.relations[key];\n      }\n    }\n  }\n\n  /**\n   * Retrieve the line element which represent the relation between items.\n   * @param parentId Identifier of the parent item.\n   * @param childId Itentifier of the child item.\n   * @return The line element or nothing.\n   */\n  private getRelationLine(parentId: number, childId: number): Line | null {\n    const identifier = `${parentId}|${childId}`;\n    return this.relations[identifier] || null;\n  }\n\n  /**\n   * Add a new line item to represent a relation between the items.\n   * @param parent Parent item.\n   * @param child Child item.\n   * @return Whether the line was added or not.\n   */\n  private addRelationLine(\n    parent: Item<ItemProps>,\n    child: Item<ItemProps>\n  ): Line {\n    const identifier = `${parent.props.id}|${child.props.id}`;\n    if (this.relations[identifier] != null) {\n      this.relations[identifier].remove();\n    }\n\n    // Get the items center.\n    const startX = parent.props.x + parent.elementRef.clientWidth / 2;\n    const startY =\n      parent.props.y +\n      (parent.elementRef.clientHeight - parent.labelElementRef.clientHeight) /\n        2;\n    const endX = child.props.x + child.elementRef.clientWidth / 2;\n    const endY =\n      child.props.y +\n      (child.elementRef.clientHeight - child.labelElementRef.clientHeight) / 2;\n\n    const line = new Line(\n      linePropsDecoder({\n        id: 0,\n        type: ItemType.LINE_ITEM,\n        startX,\n        startY,\n        endX,\n        endY,\n        width: 0,\n        height: 0,\n        lineWidth: this.props.relationLineWidth,\n        color: \"#CCCCCC\"\n      }),\n      itemMetaDecoder({\n        receivedAt: new Date()\n      })\n    );\n    // Save a reference to the line item.\n    this.relations[identifier] = line;\n\n    // Add the line to the DOM.\n    line.elementRef.style.zIndex = \"0\";\n    this.containerRef.append(line.elementRef);\n\n    return line;\n  }\n\n  /**\n   * Add an event handler to the click of the linked visual console elements.\n   * @param listener Function which is going to be executed when a linked console is clicked.\n   */\n  public onItemClick(\n    listener: Listener<ItemClickEvent<ItemProps>>\n  ): Disposable {\n    /*\n     * The '.on' function returns a function which will clean the event\n     * listener when executed. We store all the 'dispose' functions to\n     * call them when the item should be cleared.\n     */\n    const disposable = this.clickEventManager.on(listener);\n    this.disposables.push(disposable);\n\n    return disposable;\n  }\n\n  /**\n   * Add an event handler to the movement of the visual console elements.\n   * @param listener Function which is going to be executed when a linked console is moved.\n   */\n  public onItemMoved(listener: Listener<ItemMovedEvent>): Disposable {\n    /*\n     * The '.on' function returns a function which will clean the event\n     * listener when executed. We store all the 'dispose' functions to\n     * call them when the item should be cleared.\n     */\n    const disposable = this.movedEventManager.on(listener);\n    this.disposables.push(disposable);\n\n    return disposable;\n  }\n\n  /**\n   * Add an event handler to the resizement of the visual console elements.\n   * @param listener Function which is going to be executed when a linked console is moved.\n   */\n  public onItemResized(listener: Listener<ItemResizedEvent>): Disposable {\n    /*\n     * The '.on' function returns a function which will clean the event\n     * listener when executed. We store all the 'dispose' functions to\n     * call them when the item should be cleared.\n     */\n    const disposable = this.resizedEventManager.on(listener);\n    this.disposables.push(disposable);\n\n    return disposable;\n  }\n\n  /**\n   * Enable the edition mode.\n   */\n  public enableEditMode(): void {\n    this.elements.forEach(item => {\n      item.meta = { ...item.meta, editMode: true };\n    });\n    this.containerRef.classList.add(\"is-editing\");\n  }\n\n  /**\n   * Disable the edition mode.\n   */\n  public disableEditMode(): void {\n    this.elements.forEach(item => {\n      item.meta = { ...item.meta, editMode: false };\n    });\n    this.containerRef.classList.remove(\"is-editing\");\n  }\n}\n","import TypedEvent, { Disposable, Listener } from \"./TypedEvent\";\n\ninterface Cancellable {\n  cancel(): void;\n}\n\ntype AsyncTaskStatus = \"waiting\" | \"started\" | \"cancelled\" | \"finished\";\ntype AsyncTaskInitiator = (done: () => void) => Cancellable;\n\n/**\n * Defines an async task which can be started and cancelled.\n * It's possible to observe the status changes of the task.\n */\nclass AsyncTask {\n  private readonly taskInitiator: AsyncTaskInitiator;\n  private cancellable: Cancellable = { cancel: () => {} };\n  private _status: AsyncTaskStatus = \"waiting\";\n\n  // Event manager for status change events.\n  private readonly statusChangeEventManager = new TypedEvent<AsyncTaskStatus>();\n  // List of references to clean the event listeners.\n  private readonly disposables: Disposable[] = [];\n\n  public constructor(taskInitiator: AsyncTaskInitiator) {\n    this.taskInitiator = taskInitiator;\n  }\n\n  /**\n   * Public setter of the `status` property.\n   * @param status.\n   */\n  public set status(status: AsyncTaskStatus) {\n    this._status = status;\n    this.statusChangeEventManager.emit(status);\n  }\n\n  /**\n   * Public accessor of the `status` property.\n   * @return status.\n   */\n  public get status() {\n    return this._status;\n  }\n\n  /**\n   * Start the async task.\n   */\n  public init(): void {\n    this.cancellable = this.taskInitiator(() => {\n      this.status = \"finished\";\n    });\n    this.status = \"started\";\n  }\n\n  /**\n   * Cancel the async task.\n   */\n  public cancel(): void {\n    this.cancellable.cancel();\n    this.status = \"cancelled\";\n  }\n\n  /**\n   * Add an event handler to the status change.\n   * @param listener Function which is going to be executed when the status changes.\n   */\n  public onStatusChange(listener: Listener<AsyncTaskStatus>): Disposable {\n    /*\n     * The '.on' function returns a function which will clean the event\n     * listener when executed. We store all the 'dispose' functions to\n     * call them when the item should be cleared.\n     */\n    const disposable = this.statusChangeEventManager.on(listener);\n    this.disposables.push(disposable);\n\n    return disposable;\n  }\n}\n\n/**\n * Wrap an async task into another which will execute that task indefinitely\n * every time the tash finnish and the chosen period ends.\n * Will last until cancellation.\n *\n * @param task Async task to execute.\n * @param period Time in milliseconds to wait until the next async esecution.\n *\n * @return A new async task.\n */\nfunction asyncPeriodic(task: AsyncTask, period: number): AsyncTask {\n  return new AsyncTask(() => {\n    let ref: number | null = null;\n\n    task.onStatusChange(status => {\n      if (status === \"finished\") {\n        ref = window.setTimeout(() => {\n          task.init();\n        }, period);\n      }\n    });\n\n    task.init();\n\n    return {\n      cancel: () => {\n        if (ref) clearTimeout(ref);\n        task.cancel();\n      }\n    };\n  });\n}\n\n/**\n * Manages a list of async tasks.\n */\nexport default class AsyncTaskManager {\n  private tasks: { [identifier: string]: AsyncTask } = {};\n\n  /**\n   * Adds an async task to the manager.\n   *\n   * @param identifier Unique identifier.\n   * @param taskInitiator Function to initialize the async task.\n   * Should return a structure to cancel the task.\n   * @param period Optional period to repeat the task indefinitely.\n   */\n  public add(\n    identifier: string,\n    taskInitiator: AsyncTaskInitiator,\n    period: number = 0\n  ): AsyncTask {\n    if (this.tasks[identifier] && this.tasks[identifier].status === \"started\") {\n      this.tasks[identifier].cancel();\n    }\n\n    const asyncTask =\n      period > 0\n        ? asyncPeriodic(new AsyncTask(taskInitiator), period)\n        : new AsyncTask(taskInitiator);\n\n    this.tasks[identifier] = asyncTask;\n\n    return this.tasks[identifier];\n  }\n\n  /**\n   * Starts an async task.\n   *\n   * @param identifier Unique identifier.\n   */\n  public init(identifier: string) {\n    if (\n      this.tasks[identifier] &&\n      (this.tasks[identifier].status === \"waiting\" ||\n        this.tasks[identifier].status === \"cancelled\" ||\n        this.tasks[identifier].status === \"finished\")\n    ) {\n      this.tasks[identifier].init();\n    }\n  }\n\n  /**\n   * Cancel a running async task.\n   *\n   * @param identifier Unique identifier.\n   */\n  public cancel(identifier: string) {\n    if (this.tasks[identifier] && this.tasks[identifier].status === \"started\") {\n      this.tasks[identifier].cancel();\n    }\n  }\n}\n","/*\n * Useful resources.\n * http://es6-features.org/\n * http://exploringjs.com/es6\n * https://www.typescriptlang.org/\n */\n\nimport \"./main.css\"; // CSS import.\nimport VisualConsole from \"./VisualConsole\";\nimport AsyncTaskManager from \"./lib/AsyncTaskManager\";\n\n// Export the VisualConsole class to the global object.\n// eslint-disable-next-line\n(window as any).VisualConsole = VisualConsole;\n\n// Export the AsyncTaskManager class to the global object.\n// eslint-disable-next-line\n(window as any).AsyncTaskManager = AsyncTaskManager;\n"],"sourceRoot":""}
\ No newline at end of file
diff --git a/pandora_console/index.php b/pandora_console/index.php
index 06793c1a87..74621dded1 100755
--- a/pandora_console/index.php
+++ b/pandora_console/index.php
@@ -1,17 +1,32 @@
 <?php
+/**
+ * Index.
+ *
+ * @category   Main entrypoint.
+ * @package    Pandora FMS
+ * @subpackage Opensource.
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2012 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation; version 2
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-// Enable profiler for testing
+// Begin.
 if (!defined('__PAN_XHPROF__')) {
     define('__PAN_XHPROF__', 0);
 }
@@ -24,17 +39,18 @@ if (__PAN_XHPROF__ === 1) {
     }
 }
 
-// Set character encoding to UTF-8 - fixes a lot of multibyte character headaches
+// Set character encoding to UTF-8
+// fixes a lot of multibyte character issues.
 if (function_exists('mb_internal_encoding')) {
     mb_internal_encoding('UTF-8');
 }
 
 // Set to 1 to do not check for installer or config file (for development!).
-// Activate gives more error information, not useful for production sites
+// Activate gives more error information, not useful for production sites.
 $develop_bypass = 0;
 
 if ($develop_bypass != 1) {
-    // If no config file, automatically try to install
+    // If no config file, automatically try to install.
     if (! file_exists('include/config.php')) {
         if (! file_exists('install.php')) {
             $url = explode('/', $_SERVER['REQUEST_URI']);
@@ -74,14 +90,14 @@ if ($develop_bypass != 1) {
         }
     }
 
-    // Check for installer presence
+    // Check installer presence.
     if (file_exists('install.php')) {
         $login_screen = 'error_install';
         include 'general/error_screen.php';
         exit;
     }
 
-    // Check perms for config.php
+    // Check perms for config.php.
     if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
         if ((substr(sprintf('%o', fileperms('include/config.php')), -4) != '0600')
             && (substr(sprintf('%o', fileperms('include/config.php')), -4) != '0660')
@@ -110,15 +126,18 @@ if ($develop_bypass != 1) {
     }
 }
 
-if ((! file_exists('include/config.php')) || (! is_readable('include/config.php'))) {
+if ((! file_exists('include/config.php'))
+    || (! is_readable('include/config.php'))
+) {
     $login_screen = 'error_noconfig';
     include 'general/error_screen.php';
     exit;
 }
 
-//
-// PLEASE DO NOT CHANGE ORDER //////
-//
+/*
+ * DO NOT CHANGE ORDER OF FOLLOWING REQUIRES.
+ */
+
 require_once 'include/config.php';
 require_once 'include/functions_config.php';
 
@@ -128,11 +147,11 @@ if (isset($config['error'])) {
     exit;
 }
 
-// If metaconsole activated, redirect to it
-if ($config['metaconsole'] == 1 && $config['enterprise_installed'] == 1) {
-    header('Location: '.$config['homeurl'].'enterprise/meta');
+// If metaconsole activated, redirect to it.
+if (is_metaconsole()) {
+    header('Location: '.ui_get_full_url('index.php'));
+    // Always exit after sending location headers.
     exit;
-    // Always exit after sending location headers
 }
 
 if (file_exists(ENTERPRISE_DIR.'/include/functions_login.php')) {
@@ -141,12 +160,12 @@ if (file_exists(ENTERPRISE_DIR.'/include/functions_login.php')) {
 
 if (!empty($config['https']) && empty($_SERVER['HTTPS'])) {
     $query = '';
-    if (sizeof($_REQUEST)) {
-        // Some (old) browsers don't like the ?&key=var
+    if (count($_REQUEST)) {
+        // Some (old) browsers don't like the ?&key=var.
         $query .= '?1=1';
     }
 
-    // We don't clean these variables up as they're only being passed along
+    // We don't clean these variables up as they're only being passed along.
     foreach ($_GET as $key => $value) {
         if ($key == 1) {
             continue;
@@ -162,12 +181,12 @@ if (!empty($config['https']) && empty($_SERVER['HTTPS'])) {
     $url = ui_get_full_url($query);
 
     // Prevent HTTP response splitting attacks
-    // http://en.wikipedia.org/wiki/HTTP_response_splitting
+    // http://en.wikipedia.org/wiki/HTTP_response_splitting.
     $url = str_replace("\n", '', $url);
 
     header('Location: '.$url);
+    // Always exit after sending location headers.
     exit;
-    // Always exit after sending location headers
 }
 
 // Pure mode (without menu, header and footer).
@@ -188,20 +207,21 @@ echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www
 echo '<html xmlns="http://www.w3.org/1999/xhtml">'."\n";
 echo '<head>'."\n";
 
-// This starts the page head. In the call back function, things from $page['head'] array will be processed into the head
+// This starts the page head. In the callback function,
+// $page['head'] array content will be processed into the head.
 ob_start('ui_process_page_head');
 
-// Enterprise main
+// Enterprise main.
 enterprise_include('index.php');
 
 echo '<script type="text/javascript">';
     echo 'var dispositivo = navigator.userAgent.toLowerCase();';
     echo 'if( dispositivo.search(/iphone|ipod|ipad|android/) > -1 ){';
-        echo 'document.location = "'.$config['homeurl'].'mobile";  }';
+        echo 'document.location = "'.ui_get_full_url('/mobile').'";  }';
 echo '</script>';
 
 // This tag is included in the buffer passed to ui_process_page_head so
-// technically it can be stripped
+// technically it can be stripped.
 echo '</head>'."\n";
 
 require_once 'include/functions_themes.php';
@@ -212,13 +232,13 @@ $config['remote_addr'] = $_SERVER['REMOTE_ADDR'];
 $sec2 = get_parameter_get('sec2');
 $sec2 = safe_url_extraclean($sec2);
 $page = $sec2;
-// Reference variable for old time sake
+// Reference variable for old time sake.
 $sec = get_parameter_get('sec');
 $sec = safe_url_extraclean($sec);
 
 $process_login = false;
 
-// Update user password
+// Update user password.
 $change_pass = get_parameter_post('renew_password', 0);
 
 if ($change_pass == 1) {
@@ -235,14 +255,14 @@ $searchPage = false;
 $search = get_parameter_get('head_search_keywords');
 if (strlen($search) > 0) {
     $config['search_keywords'] = io_safe_input(trim(io_safe_output(get_parameter('keywords'))));
-    // If not search category providad, we'll use an agent search
+    // If not search category providad, we'll use an agent search.
     $config['search_category'] = get_parameter('search_category', 'all');
     if (($config['search_keywords'] != 'Enter keywords to search') && (strlen($config['search_keywords']) > 0)) {
         $searchPage = true;
     }
 }
 
-// Login process
+// Login process.
 if (! isset($config['id_user'])) {
     // Clear error messages.
     unset($_COOKIE['errormsg']);
@@ -250,50 +270,53 @@ if (! isset($config['id_user'])) {
 
     if (isset($_GET['login'])) {
         include_once 'include/functions_db.php';
-        // Include it to use escape_string_sql function
+        // Include it to use escape_string_sql function.
         $config['auth_error'] = '';
-        // Set this to the error message from the authorization mechanism
+        // Set this to the error message from the authorization mechanism.
         $nick = get_parameter_post('nick');
-        // This is the variable with the login
+        // This is the variable with the login.
         $pass = get_parameter_post('pass');
-        // This is the variable with the password
+        // This is the variable with the password.
         $nick = db_escape_string_sql($nick);
         $pass = db_escape_string_sql($pass);
 
-        // Since now, only the $pass variable are needed
+        // Since now, only the $pass variable are needed.
         unset($_GET['pass'], $_POST['pass'], $_REQUEST['pass']);
 
-        // If the auth_code exists, we assume the user has come through the double auth page
+        // If the auth_code exists, we assume the user has come from
+        // double authorization page.
         if (isset($_POST['auth_code'])) {
             $double_auth_success = false;
 
-            // The double authentication is activated and the user has surpassed the first step (the login).
+            // The double authentication is activated and the user has
+            // surpassed the first step (the login).
             // Now the authentication code provided will be checked.
             if (isset($_SESSION['prepared_login_da'])) {
                 if (isset($_SESSION['prepared_login_da']['id_user'])
                     && isset($_SESSION['prepared_login_da']['timestamp'])
                 ) {
-                    // The user has a maximum of 5 minutes to introduce the double auth code
+                    // The user has a maximum of 5 minutes to introduce
+                    // the double auth code.
                     $dauth_period = SECONDS_2MINUTES;
                     $now = time();
                     $dauth_time = $_SESSION['prepared_login_da']['timestamp'];
 
                     if (($now - $dauth_period) < $dauth_time) {
-                        // Nick
+                        // Nick.
                         $nick = $_SESSION['prepared_login_da']['id_user'];
-                        // Code
+                        // Code.
                         $code = (string) get_parameter_post('auth_code');
 
                         if (!empty($code)) {
                             $result = validate_double_auth_code($nick, $code);
 
                             if ($result === true) {
-                                // Double auth success
+                                // Double auth success.
                                 $double_auth_success = true;
                             } else {
-                                // Screen
+                                // Screen.
                                 $login_screen = 'double_auth';
-                                // Error message
+                                // Error message.
                                 $config['auth_error'] = __('Invalid code');
 
                                 if (!isset($_SESSION['prepared_login_da']['attempts'])) {
@@ -303,9 +326,9 @@ if (! isset($config['id_user'])) {
                                 $_SESSION['prepared_login_da']['attempts']++;
                             }
                         } else {
-                            // Screen
+                            // Screen.
                             $login_screen = 'double_auth';
-                            // Error message
+                            // Error message.
                             $config['auth_error'] = __("The code shouldn't be empty");
 
                             if (!isset($_SESSION['prepared_login_da']['attempts'])) {
@@ -315,27 +338,27 @@ if (! isset($config['id_user'])) {
                             $_SESSION['prepared_login_da']['attempts']++;
                         }
                     } else {
-                        // Expired login
+                        // Expired login.
                         unset($_SESSION['prepared_login_da']);
 
-                        // Error message
+                        // Error message.
                         $config['auth_error'] = __('Expired login');
                     }
                 } else {
-                    // If the code doesn't exist, remove the prepared login
+                    // If the code doesn't exist, remove the prepared login.
                     unset($_SESSION['prepared_login_da']);
 
-                    // Error message
+                    // Error message.
                     $config['auth_error'] = __('Login error');
                 }
-            }
-            // If $_SESSION['prepared_login_da'] doesn't exist, the user have to do the login again
-            else {
-                // Error message
+            } else {
+                // If $_SESSION['prepared_login_da'] doesn't exist, the user
+                // must login again.
+                // Error message.
                 $config['auth_error'] = __('Login error');
             }
 
-            // Remove the authenticator code
+            // Remove the authenticator code.
             unset($_POST['auth_code'], $code);
 
             if (!$double_auth_success) {
@@ -347,6 +370,8 @@ if (! isset($config['id_user'])) {
                     $_SERVER['REMOTE_ADDR']
                 );
                 while (@ob_end_flush()) {
+                    // Dumping...
+                    continue;
                 }
 
                 exit('</html>');
@@ -355,18 +380,28 @@ if (! isset($config['id_user'])) {
 
         $login_button_saml = get_parameter('login_button_saml', false);
         if (isset($double_auth_success) && $double_auth_success) {
-            // This values are true cause there are checked before complete the 2nd auth step
+            // This values are true cause there are checked before complete
+            // the 2nd auth step.
             $nick_in_db = $_SESSION['prepared_login_da']['id_user'];
             $expired_pass = false;
         } else if (($config['auth'] == 'saml') && ($login_button_saml)) {
-            include_once ENTERPRISE_DIR.'/include/auth/saml.php';
+            $saml_configured = include_once $config['homedir'].'/'.ENTERPRISE_DIR.'/include/auth/saml.php';
+
+            if (!$saml_configured) {
+                include_once 'general/noaccesssaml.php';
+            }
 
             $saml_user_id = saml_process_user_login();
 
+            if (!$saml_user_id) {
+                include_once 'general/noaccesssaml.php';
+            }
+
+
             $nick_in_db = $saml_user_id;
             if (!$nick_in_db) {
                 include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
-                $as = new SimpleSAML_Auth_Simple('PandoraFMS');
+                $as = new SimpleSAML_Auth_Simple($config['saml_source']);
                 $as->logout();
             }
         } else {
@@ -391,28 +426,34 @@ if (! isset($config['id_user'])) {
                     include_once 'general/login_page.php';
                     db_pandora_audit('Password expired', 'Password expired: '.$nick, $nick);
                     while (@ob_end_flush()) {
+                        // Dumping...
+                        continue;
                     }
 
                     exit('</html>');
                 }
 
-                // Checks if password has expired
+                // Checks if password has expired.
                 $check_status = check_pass_status($nick, $pass);
 
                 switch ($check_status) {
                     case PASSSWORD_POLICIES_FIRST_CHANGE:
-                        // first change
+                        // First change.
                     case PASSSWORD_POLICIES_EXPIRED:
-                        // pass expired
+                        // Pass expired.
                         $expired_pass = true;
                         login_change_password($nick, '', $check_status);
                     break;
+
+                    default:
+                        // Ignore.
+                    break;
                 }
             }
         }
 
         if (($nick_in_db !== false) && $expired_pass) {
-            // login ok and password has expired
+            // Login ok and password has expired.
             include_once 'general/login_page.php';
             db_pandora_audit(
                 'Password expired',
@@ -420,30 +461,38 @@ if (! isset($config['id_user'])) {
                 $nick
             );
             while (@ob_end_flush()) {
+                // Dumping...
+                continue;
             }
 
             exit('</html>');
         } else if (($nick_in_db !== false) && (!$expired_pass)) {
-            // login ok and password has not expired
-            // Double auth check
-            if ((!isset($double_auth_success) || !$double_auth_success) && is_double_auth_enabled($nick_in_db)) {
-                // Store this values in the session to know if the user login was correct
+            // Login ok and password has not expired.
+            // Double auth check.
+            if ((!isset($double_auth_success)
+                || !$double_auth_success)
+                && is_double_auth_enabled($nick_in_db)
+            ) {
+                // Store this values in the session to know if the user login
+                // was correct.
                 $_SESSION['prepared_login_da'] = [
                     'id_user'   => $nick_in_db,
                     'timestamp' => time(),
                     'attempts'  => 0,
                 ];
 
-                // Load the page to introduce the double auth code
+                // Load the page to introduce the double auth code.
                 $login_screen = 'double_auth';
                 include_once 'general/login_page.php';
                 while (@ob_end_flush()) {
+                    // Dumping...
+                    continue;
                 }
 
                 exit('</html>');
             }
 
-            // login ok and password has not expired
+            // Login ok and password has not expired.
             $process_login = true;
 
             if (is_user_admin($nick)) {
@@ -455,7 +504,7 @@ if (! isset($config['id_user'])) {
             if (!isset($_GET['sec2']) && !isset($_GET['sec'])) {
                 // Avoid the show homepage when the user go to
                 // a specific section of pandora
-                // for example when timeout the sesion
+                // for example when timeout the sesion.
                 unset($_GET['sec2']);
                 $_GET['sec'] = 'general/logon_ok';
                 $home_page = '';
@@ -486,6 +535,7 @@ if (! isset($config['id_user'])) {
                             break;
 
                             case 'Default':
+                            default:
                                 $_GET['sec'] = 'general/logon_ok';
                             break;
 
@@ -521,11 +571,14 @@ if (! isset($config['id_user'])) {
             $_SESSION['id_usuario'] = $nick_in_db;
             $config['id_user'] = $nick_in_db;
 
-            // Check if connection goes through F5 balancer. If it does, then don't call config_prepare_session() or user will be back to login all the time
+            // Check if connection goes through F5 balancer. If it does, then
+            // don't call config_prepare_session() or user will be back to login
+            // all the time.
             $prepare_session = true;
             foreach ($_COOKIE as $key => $value) {
                 if (preg_match('/BIGipServer*/', $key)) {
                     $prepare_session = false;
+                    break;
                 }
             }
 
@@ -534,9 +587,13 @@ if (! isset($config['id_user'])) {
             }
 
             if (is_user_admin($config['id_user'])) {
-                // PHP configuration values
-                $PHPupload_max_filesize = config_return_in_bytes(ini_get('upload_max_filesize'));
-                $PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
+                // PHP configuration values.
+                $PHPupload_max_filesize = config_return_in_bytes(
+                    ini_get('upload_max_filesize')
+                );
+                $PHPmemory_limit = config_return_in_bytes(
+                    ini_get('memory_limit')
+                );
                 $PHPmax_execution_time = ini_get('max_execution_time');
 
                 if ($PHPmax_execution_time !== '0') {
@@ -571,43 +628,60 @@ if (! isset($config['id_user'])) {
 
             $l10n = null;
             if (file_exists('./include/languages/'.$user_language.'.mo')) {
-                $l10n = new gettext_reader(new CachedFileReader('./include/languages/'.$user_language.'.mo'));
+                $cacheFileReader = new CachedFileReader(
+                    './include/languages/'.$user_language.'.mo'
+                );
+                $l10n = new gettext_reader($cacheFileReader);
                 $l10n->load_tables();
             }
         } else {
-            // login wrong
+            // Login wrong.
             $blocked = false;
 
-            if ((!is_user_admin($nick) || $config['enable_pass_policy_admin']) && file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
+            if ((!is_user_admin($nick) || $config['enable_pass_policy_admin'])
+                && file_exists(ENTERPRISE_DIR.'/load_enterprise.php')
+            ) {
                 $blocked = login_check_blocked($nick);
             }
 
             if (!$blocked) {
                 if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
+                    // Checks failed attempts.
                     login_check_failed($nick);
-                    // Checks failed attempts
                 }
 
                 $login_failed = true;
                 include_once 'general/login_page.php';
-                db_pandora_audit('Logon Failed', 'Invalid login: '.$nick, $nick);
+                db_pandora_audit(
+                    'Logon Failed',
+                    'Invalid login: '.$nick,
+                    $nick
+                );
                 while (@ob_end_flush()) {
+                    // Dumping...
+                    continue;
                 }
 
                 exit('</html>');
             } else {
                 include_once 'general/login_page.php';
-                db_pandora_audit('Logon Failed', 'Invalid login: '.$nick, $nick);
+                db_pandora_audit(
+                    'Logon Failed',
+                    'Invalid login: '.$nick,
+                    $nick
+                );
                 while (@ob_end_flush()) {
+                    // Dumping...
+                    continue;
                 }
 
                 exit('</html>');
             }
         }
 
-        // Form the url
+        // Form the url.
         $query_params_redirect = $_GET;
-        // Visual console do not want sec2
+        // Visual console do not want sec2.
         if ($home_page == 'Visual console') {
             unset($query_params_redirect['sec2']);
         }
@@ -621,15 +695,19 @@ if (! isset($config['id_user'])) {
             $redirect_url .= '&'.safe_url_extraclean($key).'='.safe_url_extraclean($value);
         }
 
-        header('Location: '.$config['homeurl'].'index.php'.$redirect_url);
+        header('Location: '.ui_get_full_url('index.php'.$redirect_url));
         exit;
         // Always exit after sending location headers.
     } else if (isset($_GET['loginhash'])) {
-        // Hash login process
+        // Hash login process.
         $loginhash_data = get_parameter('loginhash_data', '');
         $loginhash_user = str_rot13(get_parameter('loginhash_user', ''));
 
-        if ($config['loginhash_pwd'] != '' && $loginhash_data == md5($loginhash_user.io_output_password($config['loginhash_pwd']))) {
+        if ($config['loginhash_pwd'] != ''
+            && $loginhash_data == md5(
+                $loginhash_user.io_output_password($config['loginhash_pwd'])
+            )
+        ) {
             db_logon($loginhash_user, $_SERVER['REMOTE_ADDR']);
             $_SESSION['id_usuario'] = $loginhash_user;
             $config['id_user'] = $loginhash_user;
@@ -637,6 +715,8 @@ if (! isset($config['id_user'])) {
             include_once 'general/login_page.php';
             db_pandora_audit('Logon Failed (loginhash', '', 'system');
             while (@ob_end_flush()) {
+                // Dumping...
+                    continue;
             }
 
             exit('</html>');
@@ -758,7 +838,7 @@ if (! isset($config['id_user'])) {
                         $body .= '<p />';
                         $body .= __('Please click the link below to reset your password');
                         $body .= '<p />';
-                        $body .= '<a href="'.$config['homeurl'].'index.php?reset_hash='.$cod_hash.'">'.__('Reset your password').'</a>';
+                        $body .= '<a href="'.ui_get_full_url('index.php?reset_hash='.$cod_hash).'">'.__('Reset your password').'</a>';
                         $body .= '<p />';
                         $body .= get_product_name();
                         $body .= '<p />';
@@ -781,6 +861,8 @@ if (! isset($config['id_user'])) {
         }
 
         while (@ob_end_flush()) {
+            // Dumping...
+            continue;
         }
 
         exit('</html>');
@@ -790,11 +872,20 @@ if (! isset($config['id_user'])) {
         $loginhash_data = get_parameter('loginhash_data', '');
         $loginhash_user = str_rot13(get_parameter('loginhash_user', ''));
         $iduser = $_SESSION['id_usuario'];
-        // logoff_db ($iduser, $_SERVER["REMOTE_ADDR"]); check why is not available
+
+        /*
+         * Check why is not available.
+         * logoff_db ($iduser, $_SERVER["REMOTE_ADDR"]);
+         */
+
         unset($_SESSION['id_usuario']);
         unset($iduser);
 
-        if ($config['loginhash_pwd'] != '' && $loginhash_data == md5($loginhash_user.io_output_password($config['loginhash_pwd']))) {
+        if ($config['loginhash_pwd'] != ''
+            && $loginhash_data == md5(
+                $loginhash_user.io_output_password($config['loginhash_pwd'])
+            )
+        ) {
             db_logon($loginhash_user, $_SERVER['REMOTE_ADDR']);
             $_SESSION['id_usuario'] = $loginhash_user;
             $config['id_user'] = $loginhash_user;
@@ -802,6 +893,8 @@ if (! isset($config['id_user'])) {
             include_once 'general/login_page.php';
             db_pandora_audit('Logon Failed (loginhash', '', 'system');
             while (@ob_end_flush()) {
+                // Dumping...
+                continue;
             }
 
             exit('</html>');
@@ -814,7 +907,7 @@ if (! isset($config['id_user'])) {
         '*'
     );
     if ($user_in_db == false) {
-        // logout
+        // Logout.
         $_REQUEST = [];
         $_GET = [];
         $_POST = [];
@@ -825,6 +918,8 @@ if (! isset($config['id_user'])) {
         unset($iduser);
         include_once 'general/login_page.php';
         while (@ob_end_flush()) {
+            // Dumping...
+            continue;
         }
 
         exit('</html>');
@@ -832,7 +927,7 @@ if (! isset($config['id_user'])) {
         if (((bool) $user_in_db['is_admin'] === false)
             && ((bool) $user_in_db['not_login'] === true)
         ) {
-            // logout
+            // Logout.
             $_REQUEST = [];
             $_GET = [];
             $_POST = [];
@@ -843,6 +938,8 @@ if (! isset($config['id_user'])) {
             unset($iduser);
             include_once 'general/login_page.php';
             while (@ob_end_flush()) {
+                // Dumping...
+                continue;
             }
 
             exit('</html>');
@@ -850,12 +947,12 @@ if (! isset($config['id_user'])) {
     }
 }
 
-// Enterprise support
+// Enterprise support.
 if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
     include_once ENTERPRISE_DIR.'/load_enterprise.php';
 }
 
-// Log off
+// Log off.
 if (isset($_GET['bye'])) {
     include 'general/logoff.php';
     $iduser = $_SESSION['id_usuario'];
@@ -873,6 +970,8 @@ if (isset($_GET['bye'])) {
     }
 
     while (@ob_end_flush()) {
+        // Dumping...
+        continue;
     }
 
     exit('</html>');
@@ -880,10 +979,11 @@ if (isset($_GET['bye'])) {
 
 clear_pandora_error_for_header();
 
-// ----------------------------------------------------------------------
-// EXTENSIONS
-// ----------------------------------------------------------------------
 /*
+ * ----------------------------------------------------------------------
+ *  EXTENSIONS
+ * ----------------------------------------------------------------------
+ *
  * Load the basic configurations of extension and add extensions into menu.
  * Load here, because if not, some extensions not load well, I don't why.
  */
@@ -892,7 +992,7 @@ $config['logged'] = false;
 extensions_load_extensions($process_login);
 
 if ($process_login) {
-     // Call all extensions login function
+    // Call all extensions login function.
     extensions_call_login_function();
 
     unset($_SESSION['new_update']);
@@ -983,7 +1083,7 @@ if (get_parameter('login', 0) !== 0) {
     }
 }
 
-// Header
+// Header.
 if ($config['pure'] == 0) {
     echo '<div id="container"><div id="head">';
     include 'general/header.php';
@@ -999,24 +1099,27 @@ if ($config['pure'] == 0) {
     echo '<button onclick="topFunction()" id="top_btn" title="Go to top"></button>';
 } else {
     echo '<div id="main_pure">';
-    // Require menu only to build structure to use it in ACLs
+    // Require menu only to build structure to use it in ACLs.
     include 'operation/menu.php';
     include 'godmode/menu.php';
 }
 
-// http://es2.php.net/manual/en/ref.session.php#64525
-// Session locking concurrency speedup!
+/*
+ * Session locking concurrency speedup!
+ * http://es2.php.net/manual/en/ref.session.php#64525
+ */
+
 session_write_close();
 
 
-// Main block of content
+// Main block of content.
 if ($config['pure'] == 0) {
     echo '<div id="main">';
 }
 
 
 
-// Page loader / selector
+// Page loader / selector.
 if ($searchPage) {
     include 'operation/search_results.php';
 } else {
@@ -1040,7 +1143,7 @@ if ($searchPage) {
 
         $page .= '.php';
 
-        // Enterprise ACL check
+        // Enterprise ACL check.
         if (enterprise_hook(
             'enterprise_acl',
             [
@@ -1070,7 +1173,7 @@ if ($searchPage) {
             }
         }
     } else {
-        // home screen chosen by the user
+        // Home screen chosen by the user.
         $home_page = '';
         if (isset($config['id_user'])) {
             $user_info = users_get_user_by_id($config['id_user']);
@@ -1101,6 +1204,7 @@ if ($searchPage) {
                 break;
 
                 case 'Default':
+                default:
                     $_GET['sec2'] = 'general/logon_ok';
                 break;
 
@@ -1139,12 +1243,11 @@ if ($searchPage) {
 
             if (isset($_GET['sec2'])) {
                 $file = $_GET['sec2'].'.php';
-                // Translate some secs
+                // Translate some secs.
                 $main_sec = get_sec($_GET['sec']);
-                $_GET['sec'] = $main_sec == false ? $_GET['sec'] : $main_sec;
+                $_GET['sec'] = ($main_sec == false) ? $_GET['sec'] : $main_sec;
                 if (!file_exists($file)
-                    || (                        $_GET['sec2'] != 'general/logon_ok'
-                    && enterprise_hook(
+                    || ($_GET['sec2'] != 'general/logon_ok' && enterprise_hook(
                         'enterprise_acl',
                         [
                             $config['id_user'],
@@ -1153,7 +1256,7 @@ if ($searchPage) {
                             true,
                             isset($_GET['sec3']) ? $_GET['sec3'] : '',
                         ]
-                    ) == false                    )
+                    ) == false)
                 ) {
                     unset($_GET['sec2']);
                     include 'general/noaccess.php';
@@ -1172,13 +1275,13 @@ if ($searchPage) {
 if ($config['pure'] == 0) {
     echo '<div style="clear:both"></div>';
     echo '</div>';
-    // main
+    // Main.
     echo '<div style="clear:both">&nbsp;</div>';
     echo '</div>';
-    // page (id = page)
+    // Page (id = page).
 } else {
     echo '</div>';
-    // main_pure
+    // Main pure.
 }
 
 echo '<div id="wiz_container">';
@@ -1189,27 +1292,30 @@ echo '</div>';
 
 if ($config['pure'] == 0) {
     echo '</div>';
-    // container div
+    // Container div.
+    echo '</div>';
     echo '<div style="clear:both"></div>';
+
     echo '<div id="foot">';
     include 'general/footer.php';
-    echo '</div>';
 }
 
-// Clippy function
+// Clippy function.
 require_once 'include/functions_clippy.php';
 clippy_start($sec2);
 
 while (@ob_end_flush()) {
+    // Dumping...
+    continue;
 }
 
 db_print_database_debug();
 echo '</html>';
 
 $run_time = format_numeric((microtime(true) - $config['start_time']), 3);
-echo "\n<!-- Page generated in $run_time seconds -->\n";
+echo "\n<!-- Page generated in ".$run_time." seconds -->\n";
 
-// Values from PHP to be recovered from JAVASCRIPT
+// Values from PHP to be recovered from JAVASCRIPT.
 require 'include/php_to_js_values.php';
 
 
@@ -1217,12 +1323,16 @@ require 'include/php_to_js_values.php';
 
 <script type="text/javascript" language="javascript">
 
-    // When there are less than 5 rows, all rows must be white
-    if($('table.info_table tr').length < 5){
-        $('table.info_table tbody > tr').css('background-color', '#fff');
+       // When there are less than 5 rows, all rows must be white
+       var theme = "<?php echo $config['style']; ?>";
+        if(theme === 'pandora'){
+        if($('table.info_table tr').length < 5){
+            $('table.info_table tbody > tr').css('background-color', '#fff');
+        }
     }
 
-    // When the user scrolls down 400px from the top of the document, show the button.
+    // When the user scrolls down 400px from the top of the document, show the
+    // button.
     window.onscroll = function() {scrollFunction()};
 
     function scrollFunction() {
@@ -1235,18 +1345,24 @@ require 'include/php_to_js_values.php';
 
     // When the user clicks on the button, scroll to the top of the document.
     function topFunction() {
-        //document.body.scrollTop = 0; // For Safari.
-        //document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera.
+
+        /*
+         * Safari.
+         * document.body.scrollTop = 0;
+         * For Chrome, Firefox, IE and Opera.
+         * document.documentElement.scrollTop = 0; 
+         */
+
         $("HTML, BODY").animate({ scrollTop: 0 }, 500);
     }
 
-    //Initial load of page
+    // Initial load of page.
     $(document).ready(adjustFooter);
     
-    //Every resize of window
+    // Every resize of window.
     $(window).resize(adjustFooter);
     
-    //Every show/hide call may need footer re-layout
+    // Every show/hide call may need footer re-layout.
     (function() {
         var oShow = jQuery.fn.show;
         var oHide = jQuery.fn.hide;
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 9f646c86b8..c04064aaa2 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -128,8 +128,8 @@
         </div>
         <div style='height: 10px'>
             <?php
-            $version = '7.0NG.735';
-            $build = '190605';
+            $version = '7.0NG.738';
+            $build = '190906';
             $banner = "v$version Build $build";
 
             error_reporting(0);
diff --git a/pandora_console/mobile/operation/module_graph.php b/pandora_console/mobile/operation/module_graph.php
index 3a6668b0bc..2d057fb8fb 100644
--- a/pandora_console/mobile/operation/module_graph.php
+++ b/pandora_console/mobile/operation/module_graph.php
@@ -47,6 +47,8 @@ class ModuleGraph
 
     private $module = null;
 
+    private $server_id = '';
+
 
     function __construct()
     {
@@ -68,6 +70,8 @@ class ModuleGraph
 
         $this->id = (int) $system->getRequest('id', 0);
         $this->id_agent = (int) $system->getRequest('id_agent', 0);
+        $this->server_id = $system->getRequest('server_id', '');
+
         $this->module = modules_get_agentmodule($this->id);
         $this->graph_type = return_graphtype($this->module['id_tipo_modulo']);
 
@@ -124,6 +128,16 @@ class ModuleGraph
             switch ($parameter2) {
                 case 'get_graph':
                     $this->getFilters();
+                    if ($system->getConfig('metaconsole')) {
+                        $server_data = metaconsole_get_connection_by_id(
+                            $this->server_id
+                        );
+                        // Establishes connection.
+                        if (metaconsole_load_external_db($server_data) !== NOERR) {
+                            return false;
+                        }
+                    }
+
                     $correct = 0;
                     $graph = '';
                     $correct = 1;
@@ -197,6 +211,10 @@ class ModuleGraph
                         break;
                     }
 
+                    if ($system->getConfig('metaconsole')) {
+                        metaconsole_restore_db();
+                    }
+
                     $graph = ob_get_clean().$graph;
 
                     echo json_encode(['correct' => $correct, 'graph' => $graph]);
@@ -252,7 +270,7 @@ class ModuleGraph
                             - $(".ui-collapsible").height()
                             - 55;
                     var width = $(document).width() - 25;
-                    ajax_get_graph($("#id_module").val(), heigth, width);
+                    ajax_get_graph($("#id_module").val(), heigth, width, $("#server_id").val());
                 }
 
                 load_graph();
@@ -264,7 +282,7 @@ class ModuleGraph
                 });
             });
 
-            function ajax_get_graph(id, heigth_graph, width_graph) {
+            function ajax_get_graph(id, heigth_graph, width_graph, server_id) {
                 postvars = {};
                 postvars["action"] = "ajax";
                 postvars["parameter1"] = "module_graph";
@@ -284,6 +302,8 @@ class ModuleGraph
 
                 postvars["id"] = id;
 
+                postvars["server_id"] = server_id;
+
                 $.ajax ({
                     type: "POST",
                     url: "index.php",
@@ -360,9 +380,18 @@ class ModuleGraph
                     ]
                 )
             );
+            $ui->contentAddHtml(
+                $ui->getInput(
+                    [
+                        'id'    => 'server_id',
+                        'value' => $this->server_id,
+                        'type'  => 'hidden',
+                    ]
+                )
+            );
             $title = sprintf(__('Options for %s : %s'), $agent_alias, $this->module['nombre']);
             $ui->contentBeginCollapsible($title);
-                $ui->beginForm('index.php?page=module_graph&id='.$this->id);
+                $ui->beginForm('index.php?page=module_graph&id='.$this->id.'&server_id='.$this->server_id);
                     $options = [
                         'name'    => 'draw_alerts',
                         'value'   => 1,
diff --git a/pandora_console/mobile/operation/modules.php b/pandora_console/mobile/operation/modules.php
index 8b9bd18804..5b32c358ad 100644
--- a/pandora_console/mobile/operation/modules.php
+++ b/pandora_console/mobile/operation/modules.php
@@ -485,6 +485,8 @@ class Modules
                 $temp_modules = db_get_all_rows_sql($sql_select.$sql.$sql_limit);
 
                 foreach ($temp_modules as $result_element_key => $result_element_value) {
+                    $result_element_value['server_id'] = $server['id'];
+                    $result_element_value['server_name'] = $server['server_name'];
                     array_push($modules_db, $result_element_value);
                 }
 
@@ -684,7 +686,19 @@ class Modules
 
                     $row[7] = ui_get_snapshot_image($link, $is_snapshot).'&nbsp;&nbsp;';
                 } else {
-                    $row[7] = $row[__('Data')] = '<span style="white-space: nowrap;">'.'<span style="display: none;" class="show_collapside">'.$row[__('Status')].'&nbsp;&nbsp;</span>'.'<a data-ajax="false" class="ui-link" '.'href="index.php?page=module_graph&id='.$module['id_agente_modulo'].'&id_agent='.$this->id_agent.'">'.$output.'</a>'.'</span>';
+                    if ($system->getConfig('metaconsole')) {
+                        $row[__('Data')] = '<span style="white-space: nowrap;">';
+                        $row[__('Data')] .= '<span style="display: none;" class="show_collapside">';
+                        $row[__('Data')] .= $row[__('Status')].'&nbsp;&nbsp;</span>';
+                        $row[__('Data')] .= '<a data-ajax="false" class="ui-link" ';
+                        $row[__('Data')] .= 'href="index.php?page=module_graph&id='.$module['id_agente_modulo'];
+                        $row[__('Data')] .= '&server_id='.$module['server_id'];
+                        $row[__('Data')] .= '&id_agent='.$this->id_agent.'">';
+                        $row[__('Data')] .= $output.'</a></span>';
+                        $row[7] = $row[__('Data')];
+                    } else {
+                        $row[7] = $row[__('Data')] = '<span style="white-space: nowrap;">'.'<span style="display: none;" class="show_collapside">'.$row[__('Status')].'&nbsp;&nbsp;</span>'.'<a data-ajax="false" class="ui-link" '.'href="index.php?page=module_graph&id='.$module['id_agente_modulo'].'&id_agent='.$this->id_agent.'">'.$output.'</a>'.'</span>';
+                    }
                 }
 
                 if (!$ajax) {
diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php
index e231266667..ee9bbeb065 100755
--- a/pandora_console/operation/agentes/alerts_status.php
+++ b/pandora_console/operation/agentes/alerts_status.php
@@ -229,6 +229,9 @@ $selectModuleUp = false;
 $selectModuleDown = false;
 $selectTemplateUp = false;
 $selectTemplateDown = false;
+$selectLastFiredUp = false;
+$selectLastFiredDown = false;
+
 switch ($sortField) {
     case 'agent':
         switch ($sort) {
@@ -290,6 +293,26 @@ switch ($sortField) {
         }
     break;
 
+    case 'last_fired':
+        switch ($sort) {
+            case 'up':
+                $selectLastFiredUp = $selected;
+                $order = [
+                    'field' => 'last_fired',
+                    'order' => 'ASC',
+                ];
+            break;
+
+            case 'down':
+                $selectLastFiredDown = $selected;
+                $order = [
+                    'field' => 'last_fired',
+                    'order' => 'DESC',
+                ];
+            break;
+        }
+    break;
+
     default:
         if ($print_agent) {
             $selectDisabledUp = '';
@@ -300,6 +323,8 @@ switch ($sortField) {
             $selectModuleDown = false;
             $selectTemplateUp = false;
             $selectTemplateDown = false;
+            $selectLastFiredUp = false;
+            $selectLastFiredDown = false;
             $order = [
                 'field' => 'agent_module_name',
                 'order' => 'ASC',
@@ -313,6 +338,8 @@ switch ($sortField) {
             $selectModuleDown = false;
             $selectTemplateUp = false;
             $selectTemplateDown = false;
+            $selectLastFiredUp = false;
+            $selectLastFiredDown = false;
             $order = [
                 'field' => 'agent_module_name',
                 'order' => 'ASC',
@@ -449,6 +476,8 @@ $url_up_module = $url.'&sort_field=module&sort=up';
 $url_down_module = $url.'&sort_field=module&sort=down';
 $url_up_template = $url.'&sort_field=template&sort=up';
 $url_down_template = $url.'&sort_field=template&sort=down';
+$url_up_lastfired = $url.'&sort_field=last_fired&sort=up';
+$url_down_lastfired = $url.'&sort_field=last_fired&sort=down';
 
 $table = new stdClass();
 $table->width = '100%';
@@ -494,6 +523,7 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
             $table->head[3] .= ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
             $table->head[4] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
             $table->head[5] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
+            $table->head[7] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
         }
     } else {
         if (!is_metaconsole()) {
@@ -528,6 +558,7 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
         if (!is_metaconsole()) {
             $table->head[3] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
             $table->head[4] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
+            $table->head[6] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
         }
     }
 } else {
@@ -562,6 +593,7 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
             $table->head[3] .= ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
             $table->head[4] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
             $table->head[5] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
+            $table->head[6] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
         }
     } else {
         if (!is_metaconsole()) {
@@ -592,6 +624,7 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
         if (!is_metaconsole()) {
             $table->head[2] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
             $table->head[3] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
+            $table->head[5] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
         }
     }
 }
@@ -614,7 +647,7 @@ foreach ($alerts['alerts_simple'] as $alert) {
 if (!empty($table->data)) {
     $class = '';
     if ($agent_view_page === true) {
-        $class = 'white_table_graph_content w100p no-padding-imp';
+        $class = 'w100p no-padding-imp';
     }
 
     echo '<form class="'.$class.'" method="post" action="'.$url.'">';
diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php
index bb9dc7cef7..df2c36a1cd 100644
--- a/pandora_console/operation/agentes/estado_agente.php
+++ b/pandora_console/operation/agentes/estado_agente.php
@@ -624,6 +624,13 @@ if (empty($agents)) {
     $agents = [];
 }
 
+$agent_font_size = 'font-size:  7px';
+$description_font_size = 'font-size: 6.5px';
+if ($config['language'] == 'ja' || $config['language'] == 'zh_CN' || $own_info['language'] == 'ja' || $own_info['language'] == 'zh_CN') {
+    $agent_font_size = 'font-size: 15px';
+    $description_font_size = 'font-size: 11px';
+}
+
 // Urls to sort the table.
 $url_up_agente = 'index.php?sec=view&amp;sec2=operation/agentes/estado_agente&amp;refr='.$refr.'&amp;offset='.$offset.'&amp;group_id='.$group_id.'&amp;recursion='.$recursion.'&amp;search='.$search.'&amp;status='.$status.'&amp;sort_field=name&amp;sort=up';
 $url_down_agente = 'index.php?sec=view&amp;sec2=operation/agentes/estado_agente&amp;refr='.$refr.'&amp;offset='.$offset.'&amp;group_id='.$group_id.'&amp;recursion='.$recursion.'&amp;search='.$search.'&amp;status='.$status.'&amp;sort_field=name&amp;sort=down';
@@ -739,7 +746,7 @@ foreach ($agents as $agent) {
     $data[0] = '<div class="left_'.$agent['id_agente'].'">';
     $data[0] .= '<span>';
 
-    $data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'"> <span style="font-size: 7pt;font-weight:bold" title ="'.$agent['nombre'].'">'.$agent['alias'].'</span></a>';
+    $data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'"> <span style="'.$agent_font_size.';font-weight:bold" title ="'.$agent['nombre'].'">'.$agent['alias'].'</span></a>';
     $data[0] .= '</span>';
 
     if ($agent['quiet']) {
@@ -772,7 +779,7 @@ foreach ($agents as $agent) {
 
     $data[0] .= '</div></div>';
 
-    $data[1] = ui_print_truncate_text($agent['description'], 'description', false, true, true, '[&hellip;]', 'font-size: 6.5pt');
+    $data[1] = ui_print_truncate_text($agent['description'], 'description', false, true, true, '[&hellip;]', $description_font_size);
 
     $data[10] = '';
 
diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php
index 360a7fd332..24aa44e098 100755
--- a/pandora_console/operation/agentes/estado_generalagente.php
+++ b/pandora_console/operation/agentes/estado_generalagente.php
@@ -82,6 +82,9 @@ if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AR')
     return;
 }
 
+$alive_animation = agents_get_status_animation(
+    agents_get_interval_status($agent, false)
+);
 
 /*
  * START: TABLE AGENT BUILD.
@@ -252,7 +255,7 @@ $table_agent = '
             </div>
         </div>
         <div class="agent_details_info">
-            '.$table_agent_os.$table_agent_ip.$table_agent_version.$table_agent_description.$remote_cfg.'
+            '.$alive_animation.$table_agent_os.$table_agent_ip.$table_agent_version.$table_agent_description.$remote_cfg.'
         </div>
     </div>';
 
@@ -314,7 +317,16 @@ $data[1] = ui_progress(
     1.8,
     '#BBB',
     true,
-    ($agent['intervalo'] * (100 - $progress) / 100).' s'
+    floor(($agent['intervalo'] * (100 - $progress) / 100)).' s',
+    [
+        'page'     => 'operation/agentes/ver_agente',
+        'interval' => (100 / $agent['intervalo']),
+        'data'     => [
+            'id_agente'       => $id_agente,
+            'refresh_contact' => 1,
+        ],
+
+    ]
 );
 
 if ($progress > 100) {
@@ -449,26 +461,25 @@ if ($fields === false) {
 
 $custom_fields = [];
 foreach ($fields as $field) {
-    $data = [];
-    $data[0] = '<b>'.$field['name'].ui_print_help_tip(__('Custom field'), true).'</b>';
-        $custom_value = db_get_all_rows_sql(
-            'select tagent_custom_data.description,tagent_custom_fields.is_password_type from tagent_custom_fields 
-			INNER JOIN tagent_custom_data ON tagent_custom_fields.id_field = tagent_custom_data.id_field where tagent_custom_fields.id_field = '.$field['id_field'].' and tagent_custom_data.id_agent = '.$id_agente
-        );
+    $custom_value = db_get_all_rows_sql(
+        'select tagent_custom_data.description,tagent_custom_fields.is_password_type from tagent_custom_fields 
+        INNER JOIN tagent_custom_data ON tagent_custom_fields.id_field = tagent_custom_data.id_field where tagent_custom_fields.id_field = '.$field['id_field'].' and tagent_custom_data.id_agent = '.$id_agente
+    );
 
-    if ($custom_value[0]['description'] === false || $custom_value[0]['description'] == '') {
-        $custom_value[0]['description'] = '<i>-'.__('empty').'-</i>';
-    } else {
+    if ($custom_value[0]['description'] !== false && $custom_value[0]['description'] != '') {
+        $data = [];
+
+        $data[0] = '<b>'.$field['name'].ui_print_help_tip(__('Custom field'), true).'</b>';
         $custom_value[0]['description'] = ui_bbcode_to_html($custom_value[0]['description']);
-    }
 
-    if ($custom_value[0]['is_password_type']) {
-            $data[1] = '&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;';
-    } else {
-        $data[1] = $custom_value[0]['description'];
-    }
+        if ($custom_value[0]['is_password_type']) {
+                $data[1] = '&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;';
+        } else {
+            $data[1] = $custom_value[0]['description'];
+        }
 
-    $custom_fields[] = $data;
+        $custom_fields[] = $data;
+    }
 }
 
 $custom_fields_count = count($custom_fields);
@@ -505,12 +516,12 @@ $access_agent = db_get_value_sql(
 );
 
 if ($config['agentaccess'] && $access_agent > 0) {
-    $table_access_rate = '<div class="box-shadow white_table_graph" id="table_access_rate">
+    $table_access_rate = '<div class="white_table_graph" id="table_access_rate">
                             <div class="white_table_graph_header">'.html_print_image(
         'images/arrow_down_green.png',
         true
     ).'<span>'.__('Agent access rate (24h)').'</span></div>
-    <div class="white_table_graph_content min-height-100">
+    <div class="white_table_graph_content h80p">
 '.graphic_agentaccess(
         $id_agente,
         '95%',
@@ -739,6 +750,7 @@ if (!empty($network_interfaces)) {
 ?>
     <script type="text/javascript">
         $(document).ready (function () {
+
             $("#agent_data_main").find("thead").click (function () {
                 close_table('#agent_data_main');
             })
@@ -785,12 +797,12 @@ if (!empty($network_interfaces)) {
 <?php
 // EVENTS.
 if ($config['agentaccess'] && $access_agent > 0) {
-    $extra_class = 'min-height-100';
+    $extra_class = 'h80p';
 } else {
     $extra_class = '';
 }
 
-$table_events = '<div class="box-shadow white_table_graph" id="table_events">
+$table_events = '<div class="white_table_graph" id="table_events">
             <div class="white_table_graph_header">'.html_print_image(
     'images/arrow_down_green.png',
     true
diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php
index 7536d294ae..d50ed3a0fb 100755
--- a/pandora_console/operation/agentes/estado_monitores.php
+++ b/pandora_console/operation/agentes/estado_monitores.php
@@ -496,7 +496,8 @@ function print_form_filter_monitors(
     $form_text = '';
     $table = new stdClass();
     $table->class = 'info_table';
-    $table->styleTable = 'border: 1px solid #ebebeb;border-radius: 0;padding: 0;margin: 0;margin-top: -1px;';
+    $table->id = 'module_filter_agent_view';
+    $table->styleTable = 'border-radius: 0;padding: 0;margin: 0;';
     $table->width = '100%';
     $table->style[0] = 'font-weight: bold;';
     $table->style[2] = 'font-weight: bold;';
diff --git a/pandora_console/operation/agentes/exportdata.php b/pandora_console/operation/agentes/exportdata.php
index 6fbefa93dd..5743084f6a 100644
--- a/pandora_console/operation/agentes/exportdata.php
+++ b/pandora_console/operation/agentes/exportdata.php
@@ -243,9 +243,10 @@ if (empty($export_btn) || $show_form) {
         false
     );
 
-    // Agent selector
+    // Agent selector.
     $table->data[1][0] = '<b>'.__('Source agent').'</b>';
 
+    $filter = [];
     if ($group > 0) {
         $filter['id_grupo'] = (array) $group;
     } else {
diff --git a/pandora_console/operation/agentes/graphs.php b/pandora_console/operation/agentes/graphs.php
index 628c25d3ba..308481d8e0 100644
--- a/pandora_console/operation/agentes/graphs.php
+++ b/pandora_console/operation/agentes/graphs.php
@@ -244,18 +244,22 @@ $htmlForm = '<form method="post" action="index.php?sec=estado&sec2=operation/age
 $htmlForm .= html_print_table($table, true);
 $htmlForm .= html_print_input_hidden('filter', 1, true);
 $htmlForm .= '<div class="action-buttons" style="width: '.$table->width.'">';
-$htmlForm .= html_print_button(
-    __('Save as custom graph'),
-    'save_custom_graph',
-    false,
-    '',
-    'class="sub add" style=""',
-    true
-).'&nbsp;&nbsp;'.html_print_submit_button(__('Filter'), 'filter_button', false, 'class="sub upd" style=""', true);
+if (check_acl($config['id_user'], 0, 'RW') || check_acl($config['id_user'], 0, 'RM')) {
+    $htmlForm .= html_print_button(
+        __('Save as custom graph'),
+        'save_custom_graph',
+        false,
+        '',
+        'class="sub add" style=""',
+        true
+    );
+}
+
+$htmlForm .= '&nbsp;&nbsp;'.html_print_submit_button(__('Filter'), 'filter_button', false, 'class="sub upd" style=""', true);
 $htmlForm .= '</div>';
 $htmlForm .= '</form>';
 
-ui_toggle($htmlForm, __('Filter graphs'), __('Toggle filter(s)'), false);
+ui_toggle($htmlForm, __('Filter graphs'), __('Toggle filter(s)'), '', false);
 
 $utime = get_system_time();
 $current = date('Y-m-d', $utime);
diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php
index 080e7ffbaf..c8d6b562a8 100644
--- a/pandora_console/operation/agentes/group_view.php
+++ b/pandora_console/operation/agentes/group_view.php
@@ -156,16 +156,16 @@ echo '<table cellpadding="0" cellspacing="0" border="0" width="100%" class="data
     echo '</tr>';
     echo "<tr height=70px'>";
         echo "<td align='center'>";
-            echo "<span id='sumary' style='background-color:#FC4444;'>".$total_agent_critical.'%</span>';
-            echo "<span id='sumary' style='background-color:#FAD403;'>".$total_agent_warning.'%</span>';
-            echo "<span id='sumary' style='background-color:#80BA27;'>".$total_agent_ok.'%</span>';
+            echo "<span id='sumary' style='background-color:#e63c52;'>".$total_agent_critical.'%</span>';
+            echo "<span id='sumary' style='background-color:#f3b200;'>".$total_agent_warning.'%</span>';
+            echo "<span id='sumary' style='background-color:#82b92e;'>".$total_agent_ok.'%</span>';
             echo "<span id='sumary' style='background-color:#B2B2B2;'>".$total_agent_unknown.'%</span>';
             echo "<span id='sumary' style='background-color:#5bb6e5;'>".$total_not_init.'%</span>';
         echo '</td>';
         echo "<td align='center'>";
-            echo "<span id='sumary' style='background-color:#FC4444;'>".$total_critical.'%</span>';
-            echo "<span id='sumary' style='background-color:#FAD403;'>".$total_warning.'%</span>';
-            echo "<span id='sumary' style='background-color:#80BA27;'>".$total_ok.'%</span>';
+            echo "<span id='sumary' style='background-color:#e63c52;'>".$total_critical.'%</span>';
+            echo "<span id='sumary' style='background-color:#f3b200;'>".$total_warning.'%</span>';
+            echo "<span id='sumary' style='background-color:#82b92e;'>".$total_ok.'%</span>';
             echo "<span id='sumary' style='background-color:#B2B2B2;'>".$total_unknown.'%</span>';
             echo "<span id='sumary' style='background-color:#5bb6e5;'>".$total_monitor_not_init.'%</span>';
         echo '</td>';
diff --git a/pandora_console/operation/agentes/interface_traffic_graph_win.php b/pandora_console/operation/agentes/interface_traffic_graph_win.php
index c02cbbcb31..08070a459d 100644
--- a/pandora_console/operation/agentes/interface_traffic_graph_win.php
+++ b/pandora_console/operation/agentes/interface_traffic_graph_win.php
@@ -263,7 +263,7 @@ if ($date > $now) {
         echo '<div class="module_graph_menu_dropdown">
                 <div id="module_graph_menu_header" class="module_graph_menu_header">
                     '.html_print_image('images/arrow_down_green.png', true, ['class' => 'module_graph_menu_arrow', 'float' => 'left'], false, false, true).'
-                    <span>'.__('Graph configuration menu').ui_print_help_icon('graphs', true, $config['homeurl'], 'images/help_g.png', true).'</span>
+                    <span>'.__('Graph configuration menu').'</span>
                     '.html_print_image('images/config.png', true, ['float' => 'right'], false, false, true).'
                 </div>
                 <div class="module_graph_menu_content module_graph_menu_content_closed" style="display:none;">'.$form_table.'</div>
diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php
index 4ed526a404..7f698d8653 100644
--- a/pandora_console/operation/agentes/pandora_networkmap.editor.php
+++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php
@@ -383,14 +383,14 @@ if ($not_found) {
 
     html_print_table($table);
 
-    echo "<div style='width: ".$table->width."; text-align: right;'>";
+    echo "<div style='width: ".$table->width."; text-align: right; margin-top:20px;'>";
     if ($new_networkmap) {
         html_print_input_hidden('save_networkmap', 1);
         html_print_submit_button(
             __('Save networkmap'),
             'crt',
             false,
-            'class="sub"'
+            'class="sub next"'
         );
     }
 
@@ -401,7 +401,7 @@ if ($not_found) {
             __('Update networkmap'),
             'crt',
             false,
-            'class="sub"'
+            'class="sub upd"'
         );
     }
 
diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php
index 35eb712146..2aa1404e30 100644
--- a/pandora_console/operation/agentes/pandora_networkmap.php
+++ b/pandora_console/operation/agentes/pandora_networkmap.php
@@ -795,7 +795,7 @@ switch ($tab) {
             echo "<div style='width: ".$table->width."; margin-top: 5px;'>";
             echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
             html_print_input_hidden('new_networkmap', 1);
-            html_print_submit_button(__('Create networkmap'), 'crt', false, 'class="sub next" style="float: right;"');
+            html_print_submit_button(__('Create network map'), 'crt', false, 'class="sub next" style="float: right;"');
             echo '</form>';
             echo '</div>';
 
@@ -803,7 +803,7 @@ switch ($tab) {
                 echo "<div style='width: ".$table->width."; margin-top: 5px;'>";
                 echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
                 html_print_input_hidden('new_empty_networkmap', 1);
-                html_print_submit_button(__('Create empty networkmap'), 'crt', false, 'class="sub next" style="float: right; margin-right:20px;"');
+                html_print_submit_button(__('Create empty network map'), 'crt', false, 'class="sub next" style="float: right; margin-right:20px;"');
                 echo '</form>';
                 echo '</div>';
             }
diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php
index 70af429f6d..18f2fea040 100644
--- a/pandora_console/operation/agentes/stat_win.php
+++ b/pandora_console/operation/agentes/stat_win.php
@@ -72,6 +72,7 @@ $alias    = db_get_value('alias', 'tagente', 'id_agente', $id_agent);
         <title><?php echo __('%s Graph', get_product_name()).' ('.$alias.' - '.$label; ?>)</title>
         <link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" />
         <link rel="stylesheet" href="../../include/styles/js/jquery-ui.min.css" type="text/css" />
+        <link rel="stylesheet" href="../../include/styles/js/jquery-ui_custom.css" type="text/css" />
         <script type='text/javascript' src='../../include/javascript/pandora.js'></script>
         <script type='text/javascript' src='../../include/javascript/jquery-3.3.1.min.js'></script>
         <script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
@@ -402,7 +403,7 @@ $alias    = db_get_value('alias', 'tagente', 'id_agente', $id_agent);
         echo '<div class="module_graph_menu_dropdown">
                 <div id="module_graph_menu_header" class="module_graph_menu_header">
                     '.html_print_image('images/arrow_down_green.png', true, ['class' => 'module_graph_menu_arrow', 'float' => 'left'], false, false, true).'
-                    <span>'.__('Graph configuration menu').ui_print_help_icon('graphs', true, $config['homeurl'], 'images/help_g.png', true).'</span>
+                    <span>'.__('Graph configuration menu').'</span>
                     '.html_print_image('images/config.png', true, ['float' => 'right'], false, false, true).'
                 </div>
                 <div class="module_graph_menu_content module_graph_menu_content_closed" style="display:none;">'.$form_table.'</div>
diff --git a/pandora_console/operation/agentes/status_events.php b/pandora_console/operation/agentes/status_events.php
index 5e6e060f82..df30d75dda 100755
--- a/pandora_console/operation/agentes/status_events.php
+++ b/pandora_console/operation/agentes/status_events.php
@@ -25,6 +25,7 @@ ui_toggle(
     "<div style='width: 100%;' id='event_list'>".html_print_image('images/spinner.gif', true).'</div>',
     __('Latest events for this agent'),
     __('Latest events for this agent'),
+    '',
     false,
     false,
     '',
diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php
index 447baa3556..0f7257663a 100644
--- a/pandora_console/operation/agentes/status_monitor.php
+++ b/pandora_console/operation/agentes/status_monitor.php
@@ -421,7 +421,7 @@ if (!is_metaconsole()) {
 
 $table->data[0][5] = html_print_select($rows_select, 'modulegroup', $modulegroup, '', __('All'), -1, true, false, true, '', false, 'width: 120px;');
 
-$table->rowspan[0][6] = 2;
+$table->rowspan[0][6] = 3;
 $table->data[0][6] = html_print_submit_button(
     __('Show'),
     'uptbutton',
@@ -705,13 +705,14 @@ if (is_metaconsole()) {
         html_print_table($table_custom_fields, true),
         __('Advanced Options'),
         '',
+        '',
         true,
         true
     );
 
     $filters .= html_print_table($table, true);
     $filters .= '</form>';
-    ui_toggle($filters, __('Show Options'), '', false);
+    ui_toggle($filters, __('Show Options'), '', '', false);
 } else {
     $table->colspan[3][0] = 7;
     $table->cellstyle[3][0] = 'padding-left: 10px;';
@@ -722,8 +723,12 @@ if (is_metaconsole()) {
         ),
         __('Agent custom fields'),
         '',
+        '',
         true,
-        true
+        true,
+        '',
+        'white-box-content',
+        'white_table_graph'
     );
 
     $filters .= html_print_table($table, true);
@@ -1389,6 +1394,34 @@ if (!empty($result)) {
                         true
                     );
                 }
+            } else if ($row['estado'] == 3) {
+                if (is_numeric($row['datos'])) {
+                    $data[6] = ui_print_status_image(
+                        STATUS_MODULE_UNKNOWN,
+                        __('UNKNOWN').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])),
+                        true
+                    );
+                } else {
+                    $data[6] = ui_print_status_image(
+                        STATUS_MODULE_UNKNOWN,
+                        __('UNKNOWN').': '.$row['datos'],
+                        true
+                    );
+                }
+            } else if ($row['estado'] == 4) {
+                if (is_numeric($row['datos'])) {
+                    $data[6] = ui_print_status_image(
+                        STATUS_MODULE_NO_DATA,
+                        __('NO DATA').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'])),
+                        true
+                    );
+                } else {
+                    $data[6] = ui_print_status_image(
+                        STATUS_MODULE_NO_DATA,
+                        __('NO DATA').': '.$row['datos'],
+                        true
+                    );
+                }
             } else {
                 $last_status = modules_get_agentmodule_last_status(
                     $row['id_agente_modulo']
diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php
index 10e4ff5736..1a54e84afc 100755
--- a/pandora_console/operation/agentes/tactical.php
+++ b/pandora_console/operation/agentes/tactical.php
@@ -116,13 +116,13 @@ if (!empty($all_data)) {
 }
 
 echo '<table border=0 style="width:100%;"><tr>';
-echo '<td style="vertical-align: top; min-width: 180px; width:25%; padding-right: 20px; vertical-align: top; padding-top: 0px;" id="leftcolumn">';
+echo '<td style="vertical-align: top; min-width: 30em; width:25%; padding-right: 20px; vertical-align: top; padding-top: 0px;" id="leftcolumn">';
 // ---------------------------------------------------------------------
 // The status horizontal bars (Global health, Monitor sanity...
 // ---------------------------------------------------------------------
 $table = new stdClass();
 $table->width = '100%';
-$table->class = 'info_table no-td-borders';
+$table->class = 'info_table no-td-borders td-bg-white';
 $table->cellpadding = 2;
 $table->cellspacing = 2;
 $table->border = 0;
@@ -130,7 +130,6 @@ $table->head = [];
 $table->data = [];
 $table->style = [];
 
-$table->head[0] = '<b><span>'.__('Report of State').'</span></b>';
 $stats = reporting_get_stats_indicators($data, 120, 10, false);
 $status = '<table class="status_tactical">';
 foreach ($stats as $stat) {
@@ -166,7 +165,13 @@ if ($is_admin) {
     $table->rowclass[] = '';
 }
 
-html_print_table($table);
+ui_toggle(
+    html_print_table($table, true),
+    __('Report of State'),
+    '',
+    '',
+    false
+);
 
 echo '</td>';
 // Left column
@@ -190,7 +195,8 @@ if (check_acl($config['id_user'], 0, 'ER')) {
     ui_toggle(
         $events,
         __('Latest events'),
-        false,
+        '',
+        '',
         false
     );
 }
@@ -210,7 +216,15 @@ $out = '<table cellpadding=0 cellspacing=0 class="databox pies"  style="margin-t
     $out .= '<fieldset class="databox tactical_set" id="graphic_event_group">
 			<legend>'.__('Event graph by agent').'</legend>'.html_print_image('images/spinner.gif', true, ['id' => 'spinner_graphic_event_group']).'</fieldset>';
     $out .= '</td></tr></table>';
-echo $out;
+
+
+ui_toggle(
+    $out,
+    __('Event graphs'),
+    '',
+    '',
+    false
+);
 
 echo '</td>';
 echo '</tr></table>';
diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php
index 9bed24a3db..7444dda595 100644
--- a/pandora_console/operation/agentes/ver_agente.php
+++ b/pandora_console/operation/agentes/ver_agente.php
@@ -62,6 +62,37 @@ if (is_ajax()) {
     $agent_alias = get_parameter('alias', '');
     $agents_inserted = get_parameter('agents_inserted', []);
     $id_group = (int) get_parameter('id_group');
+
+    $refresh_contact = get_parameter('refresh_contact', 0);
+
+    if ($refresh_contact) {
+        $id_agente = get_parameter('id_agente', 0);
+        if ($id_agente > 0) {
+            $last_contact = db_get_value_sql(
+                sprintf(
+                    'SELECT format(intervalo,2) - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto))) as "val"
+                     FROM `tagente`
+                     WHERE id_agente = %d ',
+                    $id_agente
+                )
+            );
+
+            $progress = agents_get_next_contact($id_agente);
+            if ($progress < 0 || $progress > 100) {
+                $progress = 100;
+            }
+
+            echo json_encode(
+                [
+                    'progress'     => $progress,
+                    'last_contact' => $last_contact,
+                ]
+            );
+        }
+
+        return;
+    }
+
     if ($get_agents_group_json) {
         $id_group = (int) get_parameter('id_group');
         $recursion = (bool) get_parameter('recursion');
@@ -1528,8 +1559,11 @@ switch ($tab) {
         include 'estado_monitores.php';
         echo "<a name='alerts'></a>";
         include 'alerts_status.php';
-        echo "<a name='events'></a>";
-        include 'status_events.php';
+        // Check permissions to read events
+        if (check_acl($config['id_user'], 0, 'ER')) {
+            echo "<a name='events'></a>";
+            include 'status_events.php';
+        }
     break;
 
     case 'data_view':
diff --git a/pandora_console/operation/events/event_statistics.php b/pandora_console/operation/events/event_statistics.php
index 437ec0f47c..00dd1f4bc6 100644
--- a/pandora_console/operation/events/event_statistics.php
+++ b/pandora_console/operation/events/event_statistics.php
@@ -1,30 +1,48 @@
 <?php
+/**
+ * Event statistics.
+ *
+ * @category   Statistics view.
+ * @package    Pandora FMS
+ * @subpackage Events.
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation for version 2.
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// Load global vars
+// Begin.
 global $config;
 
 require_once $config['homedir'].'/include/functions_graph.php';
 
 check_login();
 
-if (! check_acl($config['id_user'], 0, 'ER') && ! check_acl($config['id_user'], 0, 'EW') && ! check_acl($config['id_user'], 0, 'EM')) {
+if (! check_acl($config['id_user'], 0, 'ER')
+    && ! check_acl($config['id_user'], 0, 'EW')
+    && ! check_acl($config['id_user'], 0, 'EM')
+) {
     db_pandora_audit('ACL Violation', 'Trying to access event viewer');
     include 'general/noaccess.php';
     return;
 }
 
-// header
+// Header.
 ui_print_page_header(__('Statistics'), 'images/op_events.png', false, false);
 echo '<table width=95%>';
 
@@ -44,7 +62,7 @@ echo '<table width=95%>';
         echo '</td>';
 
         echo "<td valign='top'>";
-            echo grafico_eventos_usuario(320, 296);
+            echo grafico_eventos_usuario(320, 280);
         echo '</td>';
     echo '</tr>';
 
@@ -65,7 +83,7 @@ if (!users_is_admin()) {
 
     echo '<tr>';
         echo "<td valign='top'>";
-            echo grafico_eventos_grupo(300, 200, $where);
+            echo grafico_eventos_grupo(300, 250, $where);
         echo '</td>';
 
         echo "<td valign='top'>";
@@ -83,7 +101,7 @@ if (!users_is_admin()) {
     ];
 }
 
-            echo graph_events_validated(320, 296, $extra_filter);
+            echo graph_events_validated(320, 250, $extra_filter);
         echo '</td>';
     echo '</tr>';
 
diff --git a/pandora_console/operation/events/events.build_query.php b/pandora_console/operation/events/events.build_query.php
index f915a5093b..7da35b6977 100755
--- a/pandora_console/operation/events/events.build_query.php
+++ b/pandora_console/operation/events/events.build_query.php
@@ -142,41 +142,43 @@ switch ($status) {
     break;
 }
 
-
-$events_wi_cdata = db_get_all_rows_sql('SELECT id_evento,custom_data from tevento WHERE custom_data != ""');
-$count_events = 0;
-$events_wi_cdata_id = 'OR id_evento IN (';
-if ($events_wi_cdata === false) {
-    $events_wi_cdata = [];
-}
-
-foreach ($events_wi_cdata as $key => $value) {
-    $needle = base64_decode($value['custom_data']);
-    if (($needle != '') && ($search != '')) {
-        if (strpos(strtolower($needle), strtolower($search)) != false) {
-            $events_wi_cdata_id .= $value['id_evento'];
-            $count_events++;
-        }
-    }
-
-    if ($value !== end($events_wi_cdata) && $count_events > 0) {
-        $events_wi_cdata_id .= ',';
-        $events_wi_cdata_id = str_replace(',,', ',', $events_wi_cdata_id);
-    }
-}
-
-$events_wi_cdata_id .= ')';
-
-$events_wi_cdata_id = str_replace(',)', ')', $events_wi_cdata_id);
-
-if ($count_events == 0) {
-    $events_wi_cdata_id = '';
-}
-
+/*
+ * Never use things like this.
+ *
+ * $events_wi_cdata = db_get_all_rows_sql('SELECT id_evento,custom_data from tevento WHERE custom_data != ""');
+ * $count_events = 0;
+ * $events_wi_cdata_id = 'OR id_evento IN (';
+ * if ($events_wi_cdata === false) {
+ *     $events_wi_cdata = [];
+ * }
+ *
+ * foreach ($events_wi_cdata as $key => $value) {
+ *     $needle = base64_decode($value['custom_data']);
+ *     if (($needle != '') && ($search != '')) {
+ *         if (strpos(strtolower($needle), strtolower($search)) != false) {
+ *             $events_wi_cdata_id .= $value['id_evento'];
+ *             $count_events++;
+ *         }
+ *     }
+ *
+ *     if ($value !== end($events_wi_cdata) && $count_events > 0) {
+ *         $events_wi_cdata_id .= ',';
+ *         $events_wi_cdata_id = str_replace(',,', ',', $events_wi_cdata_id);
+ *     }
+ * }
+ *
+ * $events_wi_cdata_id .= ')';
+ *
+ * $events_wi_cdata_id = str_replace(',)', ')', $events_wi_cdata_id);
+ *
+ * if ($count_events == 0) {
+ *     $events_wi_cdata_id = '';
+ * }
+ */
 
 if ($search != '') {
     $filter_resume['free_search'] = $search;
-    $sql_post .= " AND (evento LIKE '%".$search."%' OR id_evento LIKE '%$search%' ".$events_wi_cdata_id.')';
+    $sql_post .= " AND (evento LIKE '%".$search."%' OR id_evento LIKE '%$search%' )";
 }
 
 if ($event_type != '') {
diff --git a/pandora_console/operation/events/events.build_table.php b/pandora_console/operation/events/events.build_table.php
index 3e112f3fb8..a07ec2a703 100644
--- a/pandora_console/operation/events/events.build_table.php
+++ b/pandora_console/operation/events/events.build_table.php
@@ -29,7 +29,7 @@ $table->id = 'eventtable';
 $table->cellpadding = 4;
 $table->cellspacing = 4;
 if (!isset($table->class)) {
-    $table->class = 'databox data';
+    $table->class = 'info_table';
 }
 
 $table->head = [];
@@ -91,11 +91,11 @@ if ($group_rep == 2) {
         if ($res['event_type'] == 'alert_fired') {
             $table->rowstyle[$key] = 'background: #FFA631;';
         } else if ($res['event_type'] == 'going_up_critical' || $res['event_type'] == 'going_down_critical') {
-            $table->rowstyle[$key] = 'background: #FC4444;';
+            $table->rowstyle[$key] = 'background: #e63c52;';
         } else if ($res['event_type'] == 'going_up_warning' || $res['event_type'] == 'going_down_warning') {
-            $table->rowstyle[$key] = 'background: #FAD403;';
+            $table->rowstyle[$key] = 'background: #f3b200;';
         } else if ($res['event_type'] == 'going_up_normal' || $res['event_type'] == 'going_down_normal') {
-            $table->rowstyle[$key] = 'background: #80BA27;';
+            $table->rowstyle[$key] = 'background: #82b92e;';
         } else if ($res['event_type'] == 'going_unknown') {
             $table->rowstyle[$key] = 'background: #B2B2B2;';
         }
@@ -990,12 +990,12 @@ if ($group_rep == 2) {
                 html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"');
                 echo "<span id='response_loading_dialog' style='display:none'>".html_print_image('images/spinner.gif', true).'</span>';
                 echo '</form>';
-                echo '<span id="max_custom_event_resp_msg" style="display:none; color:#FC4444; line-height: 200%;">';
+                echo '<span id="max_custom_event_resp_msg" style="display:none; color:#e63c52; line-height: 200%;">';
                 echo __(
                     'A maximum of %s event custom responses can be selected',
                     $config['max_execution_event_response']
                 ).'</span>';
-                echo '<span id="max_custom_selected" style="display:none; color:#FC4444; line-height: 200%;">';
+                echo '<span id="max_custom_selected" style="display:none; color:#e63c52; line-height: 200%;">';
                 echo __(
                     'Please, select an event'
                 ).'</span>';
diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php
index 09f952108c..786743b8d0 100644
--- a/pandora_console/operation/events/events.php
+++ b/pandora_console/operation/events/events.php
@@ -1,7 +1,6 @@
 <?php
 /**
- * Extension to manage a list of gateways and the node address where they should
- * point to.
+ * Event list.
  *
  * @category   Events
  * @package    Pandora FMS
@@ -41,451 +40,645 @@ require_once $config['homedir'].'/include/functions_users.php';
 require_once $config['homedir'].'/include/functions_graph.php';
 require_once $config['homedir'].'/include/functions_ui.php';
 
+
+// Check access.
 check_login();
 
-if (! check_acl($config['id_user'], 0, 'ER')
-    && ! check_acl($config['id_user'], 0, 'EW')
-    && ! check_acl($config['id_user'], 0, 'EM')
+$event_a = check_acl($config['id_user'], 0, 'ER');
+$event_w = check_acl($config['id_user'], 0, 'EW');
+$event_m = check_acl($config['id_user'], 0, 'EM');
+
+if (! $event_a
+    && ! $event_w
+    && ! $event_m
 ) {
     db_pandora_audit(
         'ACL Violation',
         'Trying to access event viewer'
     );
+    if (is_ajax()) {
+        return ['error' => 'noaccess'];
+    }
+
     include 'general/noaccess.php';
     return;
 }
 
-// Set metaconsole mode.
-$meta = false;
-if (enterprise_installed() && defined('METACONSOLE')) {
-    $meta = true;
-}
 
-// Get the history mode.
-$history = (bool) get_parameter('history', 0);
+$access = ($event_a == true) ? 'ER' : (($event_w == true) ? 'EW' : (($event_m == true) ? 'EM' : 'ER'));
+
 
 $readonly = false;
-if (!$meta) {
-    if (isset($config['event_replication'])
-        && $config['event_replication'] == 1
-    ) {
-        if ((bool) $config['show_events_in_local']) {
-            $readonly = true;
-        }
-    }
+if (!is_metaconsole()
+    && isset($config['event_replication'])
+    && $config['event_replication'] == 1
+    && $config['show_events_in_local'] == 1
+) {
+    $readonly = true;
 }
 
+// Load specific stylesheet.
+ui_require_css_file('events');
+ui_require_css_file('tables');
+if (is_metaconsole()) {
+    ui_require_css_file('tables_meta', ENTERPRISE_DIR.'/include/styles/');
+}
 
+// Load extra javascript.
+ui_require_javascript_file('pandora_events');
+
+// Get requests.
+$default_filter = [
+    'status'        => EVENT_NO_VALIDATED,
+    'event_view_hr' => $config['event_view_hr'],
+    'group_rep'     => 1,
+    'tag_with'      => [],
+    'tag_without'   => [],
+    'history'       => false,
+];
+
+$fb64 = get_parameter('fb64', null);
+if (isset($fb64)) {
+    $filter = json_decode(base64_decode($fb64), true);
+} else {
+    $filter = get_parameter(
+        'filter',
+        $default_filter
+    );
+}
+
+$id_group = get_parameter(
+    'filter[id_group]',
+    $filter['id_group']
+);
+$event_type = get_parameter(
+    'filter[event_type]',
+    $filter['event_type']
+);
+$severity = get_parameter(
+    'filter[severity]',
+    $filter['severity']
+);
+$status = get_parameter(
+    'filter[status]',
+    $filter['status']
+);
+$search = get_parameter(
+    'filter[search]',
+    $filter['search']
+);
+$text_agent = get_parameter(
+    'filter[text_agent]',
+    $filter['text_agent']
+);
+$id_agent = get_parameter(
+    'filter[id_agent]',
+    $filter['id_agent']
+);
+$id_agent_module = get_parameter(
+    'filter[id_agent_module]',
+    $filter['id_agent_module']
+);
+$pagination = get_parameter(
+    'filter[pagination]',
+    $filter['pagination']
+);
+$event_view_hr = get_parameter(
+    'filter[event_view_hr]',
+    $filter['event_view_hr']
+);
+$id_user_ack = get_parameter(
+    'filter[id_user_ack]',
+    $filter['id_user_ack']
+);
+$group_rep = get_parameter(
+    'filter[group_rep]',
+    $filter['group_rep']
+);
+$tag_with = get_parameter(
+    'filter[tag_with]',
+    $filter['tag_with']
+);
+$tag_without = get_parameter(
+    'filter[tag_without]',
+    $filter['tag_without']
+);
+$filter_only_alert = get_parameter(
+    'filter[filter_only_alert]',
+    $filter['filter_only_alert']
+);
+$id_group_filter = get_parameter(
+    'filter[id_group_filter]',
+    $filter['id_group_filter']
+);
+$date_from = get_parameter(
+    'filter[date_from]',
+    $filter['date_from']
+);
+$date_to = get_parameter(
+    'filter[date_to]',
+    $filter['date_to']
+);
+$source = get_parameter(
+    'filter[source]',
+    $filter['source']
+);
+$id_extra = get_parameter(
+    'filter[id_extra]',
+    $filter['id_extra']
+);
+$user_comment = get_parameter(
+    'filter[user_comment]',
+    $filter['user_comment']
+);
+$history = get_parameter(
+    'history',
+    $filter['history']
+);
+$section = get_parameter('section', false);
+
+// Ajax responses.
 if (is_ajax()) {
-    $get_event_tooltip = (bool) get_parameter('get_event_tooltip');
-    $validate_event = (bool) get_parameter('validate_event');
-    $delete_event = (bool) get_parameter('delete_event');
-    $get_events_fired = (bool) get_parameter('get_events_fired');
-    $standby_alert = (bool) get_parameter('standby_alert');
-    $meta = get_parameter('meta', 0);
-    $history = get_parameter('history', 0);
+    $get_events = get_parameter('get_events', 0);
+    // Datatables offset, limit.
+    $start = get_parameter('start', 0);
+    $length = get_parameter('length', $config['block_size']);
 
-    if ($get_event_tooltip) {
-        $id = (int) get_parameter('id');
-        $event = events_get_event($id);
-        if ($event === false) {
-            return;
-        }
+    if ($get_events) {
+        try {
+            ob_start();
+            $order = get_datatable_order(true);
 
-        echo '<h3>'.__('Event').'</h3>';
-        echo '<strong>'.__('Type').': </strong><br />';
+            if (is_array($order) && $order['field'] == 'mini_severity') {
+                $order['field'] = 'te.criticity';
+            }
 
-        events_print_type_img($event['event_type']);
-        echo ' ';
-        if ($event['event_type'] == 'system') {
-            echo __('System');
-        } else if ($event['id_agente'] > 0) {
-            // Agent name.
-            echo agents_get_alias($event['id_agente']);
-        } else {
-            echo '';
-        }
+            $fields = [
+                'te.id_evento',
+                'te.id_agente',
+                'te.id_usuario',
+                'te.id_grupo',
+                'te.estado',
+                'te.timestamp',
+                'te.evento',
+                'te.utimestamp',
+                'te.event_type',
+                'te.id_alert_am',
+                'te.criticity',
+                'te.user_comment',
+                'te.tags',
+                'te.source',
+                'te.id_extra',
+                'te.critical_instructions',
+                'te.warning_instructions',
+                'te.unknown_instructions',
+                'te.owner_user',
+                'if(te.ack_utimestamp > 0, from_unixtime(te.ack_utimestamp),"") as ack_utimestamp',
+                'te.custom_data',
+                'te.data',
+                'te.module_status',
+                'ta.alias as agent_name',
+                'tg.nombre as group_name',
+            ];
+            if (!is_metaconsole()) {
+                $fields[] = 'am.nombre as module_name';
+                $fields[] = 'am.id_agente_modulo as id_agentmodule';
+                $fields[] = 'ta.server_name as server_name';
+            } else {
+                $fields[] = 'ts.server_name as server_name';
+                $fields[] = 'te.id_agentmodule';
+                $fields[] = 'te.server_id';
+            }
 
-        echo '<br />';
-        echo '<strong>'.__('Timestamp').': </strong><br />';
-        ui_print_timestamp($event['utimestamp']);
+            $events = events_get_all(
+                // Fields.
+                $fields,
+                // Filter.
+                $filter,
+                // Offset.
+                $start,
+                // Limit.
+                $length,
+                // Order.
+                $order['direction'],
+                // Sort field.
+                $order['field'],
+                // History.
+                $history
+            );
+            $count = events_get_all(
+                'count',
+                $filter
+            );
 
-        echo '<br />';
-        echo '<strong>'.__('Description').': </strong><br />';
-        echo $event['evento'];
+            if ($count !== false) {
+                $count = $count['0']['nitems'];
+            }
 
-        return;
-    }
+            if ($events) {
+                $data = array_reduce(
+                    $events,
+                    function ($carry, $item) {
+                        $tmp = (object) $item;
+                        $tmp->hint = '';
+                        $tmp->meta = false;
+                        if (strlen($tmp->evento) >= 255) {
+                            $tmp->hint = io_safe_output(chunk_split(substr($tmp->evento, 0, 600), 80, '<br>').'(...)');
+                            $tmp->meta = is_metaconsole();
+                            $tmp->evento = io_safe_output(substr($tmp->evento, 0, 253).'(...)');
+                            if (strpos($tmp->evento, ' ') === false) {
+                                $tmp->evento = substr($tmp->evento, 0, 80).'(...)';
+                            }
+                        } else {
+                            $tmp->evento = io_safe_output($tmp->evento);
+                        }
 
-    if ($validate_event) {
-        $id = (int) get_parameter('id');
-        $similars = (bool) get_parameter('similars');
-        $comment = (string) get_parameter('comment');
-        $new_status = get_parameter('new_status');
+                        if ($tmp->module_name) {
+                            $tmp->module_name = io_safe_output($tmp->module_name);
+                        }
 
-        // Set off the standby mode when close an event.
-        if ($new_status == 1) {
-            $event = events_get_event($id);
-            alerts_agent_module_standby($event['id_alert_am'], 0);
-        }
+                        $tmp->agent_name = io_safe_output($tmp->agent_name);
+                        $tmp->ack_utimestamp = ui_print_timestamp(
+                            $tmp->ack_utimestamp,
+                            true
+                        );
+                        $tmp->timestamp = ui_print_timestamp(
+                            $tmp->timestamp,
+                            true
+                        );
 
-        $return = events_change_status($id, $new_status, $meta);
-        if ($return) {
-            echo 'ok';
-        } else {
-            echo 'error';
-        }
+                        $tmp->data = format_numeric($tmp->data, 1);
 
-        return;
-    }
+                        $tmp->b64 = base64_encode(json_encode($tmp));
 
-    if ($delete_event) {
-        $id = (array) get_parameter('id');
-        $similars = (bool) get_parameter('similars');
+                        $carry[] = $tmp;
+                        return $carry;
+                    }
+                );
+            }
 
-        $return = events_delete_event($id, $similars, $meta, $history);
-
-        if ($return) {
-            echo 'ok';
-        } else {
-            echo 'error';
-        }
-
-        return;
-    }
-
-    if ($get_events_fired) {
-        $id = get_parameter('id_row');
-        $idGroup = get_parameter('id_group');
-        $agents = get_parameter('agents', null);
-
-        $query = ' AND id_evento > '.$id;
-
-        $type = [];
-        $alert = get_parameter('alert_fired');
-        if ($alert == 'true') {
-            $resultAlert = alerts_get_event_status_group(
-                $idGroup,
+            // RecordsTotal && recordsfiltered resultados totales.
+            echo json_encode(
                 [
-                    'alert_fired',
-                    'alert_ceased',
-                ],
-                $query,
-                $agents
-            );
-        }
-
-        $critical = get_parameter('critical');
-        if ($critical == 'true') {
-            $resultCritical = alerts_get_event_status_group(
-                $idGroup,
-                'going_up_critical',
-                $query,
-                $agents
-            );
-        }
-
-        $warning = get_parameter('warning');
-        if ($warning == 'true') {
-            $resultWarning = alerts_get_event_status_group(
-                $idGroup,
-                'going_up_warning',
-                $query,
-                $agents
-            );
-        }
-
-        $unknown = get_parameter('unknown');
-        if ($unknown == 'true') {
-            $resultUnknown = alerts_get_event_status_group(
-                $idGroup,
-                'going_unknown',
-                $query,
-                $agents
-            );
-        }
-
-        if ($resultAlert) {
-            $return = [
-                'fired' => $resultAlert,
-                'sound' => $config['sound_alert'],
-            ];
-            $event = events_get_event($resultAlert);
-
-            $module_name = modules_get_agentmodule_name($event['id_agentmodule']);
-            $agent_name = agents_get_alias($event['id_agente']);
-
-            $return['message'] = io_safe_output($agent_name).' - '.__('Alert fired in module ').io_safe_output($module_name).' - '.$event['timestamp'];
-        } else if ($resultCritical) {
-            $return = [
-                'fired' => $resultCritical,
-                'sound' => $config['sound_critical'],
-            ];
-            $event = events_get_event($resultCritical);
-
-            $module_name = modules_get_agentmodule_name($event['id_agentmodule']);
-            $agent_name = agents_get_alias($event['id_agente']);
-
-            $return['message'] = io_safe_output($agent_name).' - '.__('Module ').io_safe_output($module_name).__(' is going to critical').' - '.$event['timestamp'];
-        } else if ($resultWarning) {
-            $return = [
-                'fired' => $resultWarning,
-                'sound' => $config['sound_warning'],
-            ];
-            $event = events_get_event($resultWarning);
-
-            $module_name = modules_get_agentmodule_name($event['id_agentmodule']);
-            $agent_name = agents_get_alias($event['id_agente']);
-
-            $return['message'] = io_safe_output($agent_name).' - '.__('Module ').io_safe_output($module_name).__(' is going to warning').' - '.$event['timestamp'];
-        } else if ($resultUnknown) {
-            $return = [
-                'fired' => $resultUnknown,
-                'sound' => $config['sound_alert'],
-            ];
-            $event = events_get_event($resultUnknown);
-
-            $module_name = modules_get_agentmodule_name($event['id_agentmodule']);
-            $agent_name = agents_get_alias($event['id_agente']);
-
-            $return['message'] = io_safe_output($agent_name).' - '.__('Module ').io_safe_output($module_name).__(' is going to unknown').' - '.$event['timestamp'];
-        } else {
-            $return = ['fired' => 0];
-        }
-
-        echo io_json_mb_encode($return);
-    }
-
-    return;
-}
-
-enterprise_hook('open_meta_frame');
-
-if (!$meta) {
-    if (isset($config['event_replication'])
-        && $config['event_replication'] == 1
-    ) {
-        if ($config['show_events_in_local'] == 0) {
-            db_pandora_audit(
-                'ACL Violation',
-                'Trying to access event viewer. View disabled due event replication.'
-            );
-            ui_print_info_message(
-                [
-                    'message'  => __(
-                        'Event viewer is disabled due event replication. For more information, please contact with the administrator'
-                    ),
-                    'no_close' => true,
+                    'data'            => $data,
+                    'recordsTotal'    => $count,
+                    'recordsFiltered' => $count,
                 ]
             );
-            return;
+            $response = ob_get_clean();
+        } catch (Exception $e) {
+            echo json_encode(
+                ['error' => $e->getMessage()]
+            );
+        }
+
+        // If not valid it will throw an exception.
+        json_decode($response);
+        if (json_last_error() == JSON_ERROR_NONE) {
+            // If valid dump.
+            echo $response;
         } else {
-            $readonly = true;
+            echo json_encode(
+                ['error' => $response]
+            );
         }
     }
+
+    // AJAX section ends.
+    exit;
 }
 
-$id_filter = db_get_value(
-    'id_filter',
-    'tusuario',
-    'id_user',
-    $config['id_user']
+/*
+ * Load user default form.
+ */
+
+$user_filter = db_get_row_sql(
+    sprintf(
+        'SELECT f.id_filter, f.id_name
+         FROM tevent_filter f
+         INNER JOIN tusuario u
+             ON u.default_event_filter=f.id_filter
+         WHERE u.id_user = "%s" ',
+        $config['id_user']
+    )
 );
+if ($user_filter !== false) {
+    $filter = events_get_event_filter($user_filter['id_filter']);
+    if ($filter !== false) {
+        $id_group = $filter['id_group'];
+        $event_type = $filter['event_type'];
+        $severity = $filter['severity'];
+        $status = $filter['status'];
+        $search = $filter['search'];
+        $text_agent = $filter['text_agent'];
+        $id_agent = $filter['id_agent'];
+        $id_agent_module = $filter['id_agent_module'];
+        $pagination = $filter['pagination'];
+        $event_view_hr = $filter['event_view_hr'];
+        $id_user_ack = $filter['id_user_ack'];
+        $group_rep = $filter['group_rep'];
+        $tag_with = json_decode(io_safe_output($filter['tag_with']));
+        $tag_without = json_decode(io_safe_output($filter['tag_without']));
 
-// If user has event filter retrieve filter values.
-if (!empty($id_filter)) {
-    $apply_filter = true;
+        $tag_with_base64 = base64_encode(json_encode($tag_with));
+        $tag_without_base64 = base64_encode(json_encode($tag_without));
 
-    $event_filter = events_get_event_filter($id_filter);
-
-    $event_filter['search'] = io_safe_output($event_filter['search']);
-    $event_filter['id_name'] = io_safe_output($event_filter['id_name']);
-    $event_filter['tag_with'] = base64_encode(
-        io_safe_output($event_filter['tag_with'])
-    );
-    $event_filter['tag_without'] = base64_encode(
-        io_safe_output($event_filter['tag_without'])
-    );
-}
-
-$is_filtered = get_parameter('is_filtered', false);
-$offset = (int) get_parameter('offset', 0);
-
-if ($event_filter['id_group'] == '') {
-    $event_filter['id_group'] = 0;
-}
-
-$id_group = (int) get_parameter('id_group', 0);
-
-// 0 all
-// **********************************************************************
-// TODO
-// This code is disabled for to enabled in Pandora 5.1
-// but it needs a field in tevent_filter.
-//
-// $recursion = (bool)get_parameter('recursion', false); //Flag show in child groups
-// **********************************************************************
-$recursion = (bool) get_parameter('recursion', true);
-// Flag show in child groups.
-if (empty($event_filter['event_type'])) {
-    $event_filter['event_type'] = '';
-}
-
-$event_type = ($apply_filter === true && $is_filtered === false) ? $event_filter['event_type'] : get_parameter('event_type', '');
-
-// 0 all.
-$severity = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['severity'] : (int) get_parameter('severity', -1);
-// -1 all.
-if ($event_filter['status'] == -1) {
-    $event_filter['status'] = 3;
-}
-
-$status = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['status'] : (int) get_parameter('status', 3);
-// -1 all, 0 only new, 1 only validated,
-// 2 only in process, 3 only not validated.
-$id_agent = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['id_agent'] : (int) get_parameter('id_agent', 0);
-$pagination = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['pagination'] : (int) get_parameter('pagination', $config['block_size']);
-
-if (empty($event_filter['event_view_hr'])) {
-    $event_filter['event_view_hr'] = ($history) ? 0 : $config['event_view_hr'];
-}
-
-$event_view_hr = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['event_view_hr'] : (int) get_parameter(
-    'event_view_hr',
-    ($history) ? 0 : $config['event_view_hr']
-);
-
-
-$id_user_ack = ($apply_filter === true && $is_filtered === false) ? $event_filter['id_user_ack'] : get_parameter('id_user_ack', 0);
-$group_rep = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['group_rep'] : (int) get_parameter('group_rep', 1);
-$delete = (bool) get_parameter('delete');
-$validate = (bool) get_parameter('validate', 0);
-$section = (string) get_parameter('section', 'list');
-$filter_only_alert = ($apply_filter === true && $is_filtered === false) ? (int) $event_filter['filter_only_alert'] : (int) get_parameter('filter_only_alert', -1);
-$filter_id = (int) get_parameter('filter_id', 0);
-
-if (empty($event_filter['id_name'])) {
-    $event_filter['id_name'] = '';
-}
-
-$id_name = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['id_name'] : (string) get_parameter('id_name', '');
-$open_filter = (int) get_parameter('open_filter', 0);
-$date_from = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['date_from'] : (string) get_parameter('date_from', '');
-$date_to = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['date_to'] : (string) get_parameter('date_to', '');
-$time_from = (string) get_parameter('time_from', '');
-$time_to = (string) get_parameter('time_to', '');
-$server_id = (int) get_parameter('server_id', 0);
-$text_agent = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['text_agent'] : (string) get_parameter('text_agent');
-$refr = (int) get_parameter('refresh');
-$id_extra = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['id_extra'] : (string) get_parameter('id_extra');
-$user_comment = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['user_comment'] : (string) get_parameter('user_comment');
-$source = ($apply_filter === true && $is_filtered === false) ? (string) $event_filter['source'] : (string) get_parameter('source');
-
-if ($id_agent != 0) {
-    $text_agent = agents_get_alias($id_agent);
-    if ($text_agent == false) {
-        $text_agent = '';
-        $id_agent = 0;
+        $filter_only_alert = $filter['filter_only_alert'];
+        $id_group_filter = $filter['id_group_filter'];
+        $date_from = $filter['date_from'];
+        $date_to = $filter['date_to'];
+        $source = $filter['source'];
+        $id_extra = $filter['id_extra'];
+        $user_comment = $filter['user_comment'];
     }
+}
+
+// TAGS.
+// Get the tags where the user have permissions in Events reading tasks.
+$tags = tags_get_user_tags($config['id_user'], $access);
+
+$tags_select_with = [];
+$tags_select_without = [];
+$tag_with_temp = [];
+$tag_without_temp = [];
+foreach ($tags as $id_tag => $tag) {
+    if ((array_search($id_tag, $tag_with) === false)
+        || (array_search($id_tag, $tag_with) === null)
+    ) {
+        $tags_select_with[$id_tag] = ui_print_truncate_text($tag, 50, true);
+    } else {
+        $tag_with_temp[$id_tag] = ui_print_truncate_text($tag, 50, true);
+    }
+
+    if ((array_search($id_tag, $tag_without) === false)
+        || (array_search($id_tag, $tag_without) === null)
+    ) {
+        $tags_select_without[$id_tag] = ui_print_truncate_text($tag, 50, true);
+    } else {
+        $tag_without_temp[$id_tag] = ui_print_truncate_text($tag, 50, true);
+    }
+}
+
+$add_with_tag_disabled = empty($tags_select_with);
+$remove_with_tag_disabled = empty($tag_with_temp);
+$add_without_tag_disabled = empty($tags_select_without);
+$remove_without_tag_disabled = empty($tag_without_temp);
+
+$tabletags_with = html_get_predefined_table('transparent', 2);
+$tabletags_with->id = 'filter_events_tags_with';
+$tabletags_with->width = '100%';
+$tabletags_with->cellspacing = 4;
+$tabletags_with->cellpadding = 4;
+$tabletags_with->class = 'noshadow';
+$tabletags_with->styleTable = 'border: 0px;';
+if (is_metaconsole()) {
+    $tabletags_with->class = 'nobady';
+    $tabletags_with->cellspacing = 0;
+    $tabletags_with->cellpadding = 0;
+}
+
+
+$data = [];
+
+$data[0] = html_print_select(
+    $tags_select_with,
+    'select_with',
+    '',
+    '',
+    '',
+    0,
+    true,
+    true,
+    true,
+    '',
+    false,
+    'width: 200px;'
+);
+
+$data[1] = html_print_image(
+    'images/darrowright.png',
+    true,
+    [
+        'id'    => 'button-add_with',
+        'style' => 'cursor: pointer;',
+        'title' => __('Add'),
+    ]
+);
+
+$data[1] .= html_print_input_hidden(
+    'tag_with',
+    $tag_with_base64,
+    true
+);
+
+$data[1] .= '<br><br>'.html_print_image(
+    'images/darrowleft.png',
+    true,
+    [
+        'id'    => 'button-remove_with',
+        'style' => 'cursor: pointer;',
+        'title' => __('Remove'),
+    ]
+);
+
+$data[2] = html_print_select(
+    $tag_with_temp,
+    'tag_with_temp',
+    [],
+    '',
+    '',
+    0,
+    true,
+    true,
+    true,
+    '',
+    false,
+    'width: 200px;'
+);
+
+$tabletags_with->data[] = $data;
+$tabletags_with->rowclass[] = '';
+
+
+$tabletags_without = html_get_predefined_table('transparent', 2);
+$tabletags_without->id = 'filter_events_tags_without';
+$tabletags_without->width = '100%';
+$tabletags_without->cellspacing = 4;
+$tabletags_without->cellpadding = 4;
+$tabletags_without->class = 'noshadow';
+if (is_metaconsole()) {
+    $tabletags_without->class = 'nobady';
+    $tabletags_without->cellspacing = 0;
+    $tabletags_without->cellpadding = 0;
+}
+
+$tabletags_without->styleTable = 'border: 0px;';
+
+$data = [];
+$data[0] = html_print_select(
+    $tags_select_without,
+    'select_without',
+    '',
+    '',
+    '',
+    0,
+    true,
+    true,
+    true,
+    '',
+    false,
+    'width: 200px;'
+);
+$data[1] = html_print_image(
+    'images/darrowright.png',
+    true,
+    [
+        'id'    => 'button-add_without',
+        'style' => 'cursor: pointer;',
+        'title' => __('Add'),
+    ]
+);
+$data[1] .= html_print_input_hidden(
+    'tag_without',
+    $tag_without_base64,
+    true
+);
+$data[1] .= '<br><br>'.html_print_image(
+    'images/darrowleft.png',
+    true,
+    [
+        'id'    => 'button-remove_without',
+        'style' => 'cursor: pointer;',
+        'title' => __('Remove'),
+    ]
+);
+$data[2] = html_print_select(
+    $tag_without_temp,
+    'tag_without_temp',
+    [],
+    '',
+    '',
+    0,
+    true,
+    true,
+    true,
+    '',
+    false,
+    'width: 200px;'
+);
+$tabletags_without->data[] = $data;
+$tabletags_without->rowclass[] = '';
+
+if (io_safe_output($tag_with) == '["0"]') {
+    $tag_with = '[]';
+}
+
+if (io_safe_output($tag_without) == '["0"]') {
+    $tag_without = '[]';
+}
+
+/*
+ * END OF TAGS.
+ */
+
+// View.
+$pure = get_parameter('pure', 0);
+$url = ui_get_full_url('index.php?sec=eventos&sec2=operation/events/events');
+
+// Concatenate parameters.
+$url .= '';
+
+if ($pure) {
+    // Fullscreen.
+    // Floating menu - Start.
+    echo '<div id="vc-controls" style="z-index: 999">';
+
+    echo '<div id="menu_tab">';
+    echo '<ul class="mn">';
+
+    // Quit fullscreen.
+    echo '<li class="nomn">';
+    echo '<a target="_top" href="'.$url.'&amp;pure=0">';
+    echo html_print_image(
+        'images/normal_screen.png',
+        true,
+        ['title' => __('Back to normal mode')]
+    );
+    echo '</a>';
+    echo '</li>';
+
+    // Countdown.
+    echo '<li class="nomn">';
+    echo '<div class="events-refr">';
+    echo '<div class="events-countdown"><span id="refrcounter"></span></div>';
+    echo '<div id="events-refr-form">';
+    echo __('Refresh').':';
+    echo html_print_select(
+        get_refresh_time_array(),
+        'refresh',
+        $refr,
+        '',
+        '',
+        0,
+        true,
+        false,
+        false
+    );
+    echo '</div>';
+    echo '</div>';
+    echo '</li>';
+
+    // Console name.
+    echo '<li class="nomn">';
+    echo '<div class="vc-title">'.__('Event viewer').'</div>';
+    echo '</li>';
+
+    echo '</ul>';
+    echo '</div>';
+
+    echo '</div>';
+    // Floating menu - End.
+    ui_require_jquery_file('countdown');
 } else {
-    if (!$meta) {
-        $text_agent = '';
+    if (is_metaconsole()) {
+        // Load metaconsole frame.
+        enterprise_hook('open_meta_frame');
     }
-}
 
-$text_module = (string) get_parameter('module_search', '');
-$id_agent_module = ($apply_filter === true && $is_filtered === false) ? $event_filter['id_agent_module'] : get_parameter(
-    'module_search_hidden',
-    get_parameter('id_agent_module', 0)
-);
-if ($id_agent_module != 0) {
-    $text_module = db_get_value(
-        'nombre',
-        'tagente_modulo',
-        'id_agente_modulo',
-        $id_agent_module
-    );
-    if ($text_module == false) {
-        $text_module = '';
-    }
-} else {
-    $text_module = '';
-}
-
-
-
-$tag_with_json = ($apply_filter === true && $is_filtered === false) ? base64_decode($event_filter['tag_with']) : base64_decode(get_parameter('tag_with', ''));
-$tag_with_json_clean = io_safe_output($tag_with_json);
-$tag_with_base64 = base64_encode($tag_with_json_clean);
-$tag_with = json_decode($tag_with_json_clean, true);
-if (empty($tag_with)) {
-    $tag_with = [];
-}
-
-$tag_with = array_diff($tag_with, [0 => 0]);
-
-$tag_without_json = ($apply_filter === true && $is_filtered === false) ? base64_decode($event_filter['tag_without']) : base64_decode(get_parameter('tag_without', ''));
-$tag_without_json_clean = io_safe_output($tag_without_json);
-$tag_without_base64 = base64_encode($tag_without_json_clean);
-$tag_without = json_decode($tag_without_json_clean, true);
-if (empty($tag_without)) {
-    $tag_without = [];
-}
-
-$tag_without = array_diff($tag_without, [0 => 0]);
-
-$search = get_parameter('search');
-
-users_get_groups($config['id_user'], 'ER');
-
-$ids = (array) get_parameter('eventid', -1);
-
-$params = 'search='.io_safe_input($search).'&amp;event_type='.$event_type.'&amp;severity='.$severity.'&amp;status='.$status.'&amp;id_group='.$id_group.'&amp;recursion='.$recursion.'&amp;refresh='.(int) get_parameter('refresh', 0).'&amp;id_agent='.$id_agent.'&amp;id_agent_module='.$id_agent_module.'&amp;pagination='.$pagination.'&amp;group_rep='.$group_rep.'&amp;event_view_hr='.$event_view_hr.'&amp;id_user_ack='.$id_user_ack.'&amp;tag_with='.$tag_with_base64.'&amp;tag_without='.$tag_without_base64.'&amp;filter_only_alert'.$filter_only_alert.'&amp;offset='.$offset.'&amp;toogle_filter=no'.'&amp;filter_id='.$filter_id.'&amp;id_name='.$id_name.'&amp;history='.(int) $history.'&amp;section='.$section.'&amp;open_filter='.$open_filter.'&amp;date_from='.$date_from.'&amp;date_to='.$date_to.'&amp;time_from='.$time_from.'&amp;time_to='.$time_to;
-
-if ($meta) {
-    $params .= '&amp;text_agent='.$text_agent;
-    $params .= '&amp;server_id='.$server_id;
-}
-
-$url = 'index.php?sec=eventos&amp;sec2=operation/events/events&amp;'.$params;
-
-
-
-// Header.
-if ($config['pure'] == 0 || $meta) {
+    // Header.
     $pss = get_user_info($config['id_user']);
     $hashup = md5($config['id_user'].$pss['password']);
 
     // Fullscreen.
     $fullscreen['active'] = false;
-    $fullscreen['text'] = '<a href="'.$url.'&amp;pure=1">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).'</a>';
+    $fullscreen['text'] = '<a class="events_link" href="'.$url.'&amp;pure=1&">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).'</a>';
 
     // Event list.
     $list['active'] = false;
-    $list['text'] = '<a href="index.php?sec=eventos&sec2=operation/events/events&amp;pure='.$config['pure'].'">'.html_print_image('images/events_list.png', true, ['title' => __('Event list')]).'</a>';
+    $list['text'] = '<a class="events_link" href="index.php?sec=eventos&sec2=operation/events/events&amp;pure='.$config['pure'].'&">'.html_print_image('images/events_list.png', true, ['title' => __('Event list')]).'</a>';
 
     // History event list.
     $history_list['active'] = false;
-    $history_list['text'] = '<a href="index.php?sec=eventos&sec2=operation/events/events&amp;pure='.$config['pure'].'&amp;section=history&amp;history=1">'.html_print_image('images/books.png', true, ['title' => __('History event list')]).'</a>';
+    $history_list['text'] = '<a class="events_link" href="index.php?sec=eventos&sec2=operation/events/events&amp;pure='.$config['pure'].'&amp;section=history&amp;history=1&">'.html_print_image('images/books.png', true, ['title' => __('History event list')]).'</a>';
 
     // RSS.
     $rss['active'] = false;
-    $rss['text'] = '<a href="operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&'.$params.'">'.html_print_image('images/rss.png', true, ['title' => __('RSS Events')]).'</a>';
+    $rss['text'] = '<a class="events_link" href="operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&">'.html_print_image('images/rss.png', true, ['title' => __('RSS Events')]).'</a>';
 
     // Marquee.
     $marquee['active'] = false;
-    $marquee['text'] = '<a href="operation/events/events_marquee.php">'.html_print_image('images/heart.png', true, ['title' => __('Marquee display')]).'</a>';
+    $marquee['text'] = '<a class="events_link" href="operation/events/events_marquee.php?">'.html_print_image('images/heart.png', true, ['title' => __('Marquee display')]).'</a>';
 
     // CSV.
     $csv['active'] = false;
-    $csv['text'] = '<a href="operation/events/export_csv.php?'.$params.'">'.html_print_image('images/csv_mc.png', true, ['title' => __('Export to CSV file')]).'</a>';
+    $csv['text'] = '<a class="events_link" href="operation/events/export_csv.php?'.$filter_b64.'">'.html_print_image('images/csv_mc.png', true, ['title' => __('Export to CSV file')]).'</a>';
 
     // Sound events.
     $sound_event['active'] = false;
     $sound_event['text'] = '<a href="javascript: openSoundEventWindow();">'.html_print_image('images/sound.png', true, ['title' => __('Sound events')]).'</a>';
 
     // If the user has administrator permission display manage tab.
-    if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, 'EM')) {
+    if ($event_w || $event_m) {
         // Manage events.
         $manage_events['active'] = false;
         $manage_events['text'] = '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=filter&amp;pure='.$config['pure'].'">'.html_print_image('images/setup.png', true, ['title' => __('Manage events')]).'</a>';
@@ -514,7 +707,7 @@ if ($config['pure'] == 0 || $meta) {
         ];
     }
 
-    // If the history event is not ebabled, dont show the history tab.
+    // If the history event is not enabled, dont show the history tab.
     if (!isset($config['metaconsole_events_history']) || $config['metaconsole_events_history'] != 1) {
         unset($onheader['history']);
     }
@@ -569,57 +762,6 @@ if ($config['pure'] == 0 || $meta) {
         }
     </script>
     <?php
-} else {
-    // Fullscreen.
-    // Floating menu - Start.
-    echo '<div id="vc-controls" style="z-index: 999">';
-
-    echo '<div id="menu_tab">';
-    echo '<ul class="mn">';
-
-    // Quit fullscreen.
-    echo '<li class="nomn">';
-    echo '<a target="_top" href="'.$url.'&amp;pure=0">';
-    echo html_print_image(
-        'images/normal_screen.png',
-        true,
-        ['title' => __('Back to normal mode')]
-    );
-    echo '</a>';
-    echo '</li>';
-
-    // Countdown.
-    echo '<li class="nomn">';
-    echo '<div class="vc-refr">';
-    echo '<div class="vc-countdown"></div>';
-    echo '<div id="vc-refr-form">';
-    echo __('Refresh').':';
-    echo html_print_select(
-        get_refresh_time_array(),
-        'refresh',
-        $refr,
-        '',
-        '',
-        0,
-        true,
-        false,
-        false
-    );
-    echo '</div>';
-    echo '</div>';
-    echo '</li>';
-
-    // Console name.
-    echo '<li class="nomn">';
-    echo '<div class="vc-title">'.__('Event viewer').'</div>';
-    echo '</li>';
-
-    echo '</ul>';
-    echo '</div>';
-
-    echo '</div>';
-    // Floating menu - End.
-    ui_require_jquery_file('countdown');
 }
 
 // Error div for ajax messages.
@@ -627,570 +769,1598 @@ echo "<div id='show_message_error'>";
 echo '</div>';
 
 
-if (($section == 'validate') && ($ids[0] == -1)) {
-    $section = 'list';
-    ui_print_error_message(__('No events selected'));
-}
-
-// Process validation (pass array or single value).
-if ($validate) {
-    $ids = get_parameter('eventid', -1);
-    $comment = get_parameter('comment', '');
-    $new_status = get_parameter('select_validate', 1);
-    $ids = explode(',', $ids);
-    $standby_alert = (bool) get_parameter('standby-alert');
-
-    // Avoid to re-set inprocess events.
-    if ($new_status == 2) {
-        foreach ($ids as $key => $id) {
-            $event = events_get_event($id);
-            if ($event['estado'] == 2) {
-                unset($ids[$key]);
-            }
-        }
-    }
-
-    if (isset($ids[0]) && $ids[0] != -1) {
-        $return = events_change_status($ids, $new_status, $meta);
-
-        if ($new_status == 1) {
-            ui_print_result_message(
-                $return,
-                __('Successfully validated'),
-                __('Could not be validated')
+// Controls.
+if (is_metaconsole() !== true) {
+    if (isset($config['event_replication'])
+        && $config['event_replication'] == 1
+    ) {
+        if ($config['show_events_in_local'] == 0) {
+            db_pandora_audit(
+                'ACL Violation',
+                'Trying to access event viewer. View disabled due event replication.'
             );
-        } else if ($new_status == 2) {
-            ui_print_result_message(
-                $return,
-                __('Successfully set in process'),
-                __('Could not be set in process')
+            ui_print_info_message(
+                [
+                    'message'  => __(
+                        'Event viewer is disabled due event replication. For more information, please contact with the administrator'
+                    ),
+                    'no_close' => true,
+                ]
             );
+            return;
+        } else {
+            $readonly = true;
         }
     }
 }
 
-// Process deletion (pass array or single value).
-if ($delete) {
-    $ids = (array) get_parameter('validate_ids', -1);
+/*
+ * Load filter form.
+ */
 
-    // Discard deleting in progress events.
-    $in_process_status = db_get_all_rows_sql(
-        '
-		SELECT id_evento
-		FROM tevento
-		WHERE estado=2'
+// Group.
+$user_groups_array = users_get_groups_for_select(
+    $config['id_user'],
+    $access,
+    true,
+    true,
+    false
+);
+$data = html_print_select(
+    $user_groups_array,
+    'id_group_filter',
+    $id_group_filter,
+    '',
+    '',
+    0,
+    true,
+    false,
+    false,
+    'w130'
+);
+$in = '<div class="filter_input"><label>'.__('Group').'</label>';
+$in .= $data.'</div>';
+$inputs[] = $in;
+
+// Event type.
+$types = get_event_types();
+$types['not_normal'] = __('Not normal');
+$data = html_print_select(
+    $types,
+    'event_type',
+    $event_type,
+    '',
+    __('All'),
+    '',
+    true
+);
+$in = '<div class="filter_input"><label>'.__('Event type').'</label>';
+$in .= $data.'</div>';
+$inputs[] = $in;
+
+// Criticity - severity.
+$severity_select .= html_print_select(
+    get_priorities(),
+    'severity',
+    $severity,
+    '',
+    __('All'),
+    '-1',
+    true,
+    false,
+    false
+);
+$in = '<div class="filter_input"><label>'.__('Severity').'</label>';
+$in .= $severity_select.'</div>';
+$inputs[] = $in;
+
+// Event status.
+$data = html_print_select(
+    events_get_all_status(),
+    'status',
+    $status,
+    '',
+    '',
+    '',
+    true
+);
+$in = '<div class="filter_input"><label>'.__('Event status').'</label>';
+$in .= $data.'</div>';
+$inputs[] = $in;
+
+// Max hours old.
+$data = html_print_input_text(
+    'event_view_hr',
+    $event_view_hr,
+    '',
+    5,
+    255,
+    true
+);
+$in = '<div class="filter_input"><label>'.__('Max. hours old').'</label>';
+$in .= $data.'</div>';
+$inputs[] = $in;
+
+// Duplicates group { events | agents }.
+$data = html_print_select(
+    [
+        0 => __('All events'),
+        1 => __('Group events'),
+        2 => __('Group agents'),
+    ],
+    'group_rep',
+    $group_rep,
+    '',
+    '',
+    0,
+    true
+);
+$in = '<div class="filter_input"><label>'.__('Repeated').'</label>';
+$in .= $data.'</div>';
+$inputs[] = $in;
+
+// Free search.
+$data = html_print_input_text('search', $search, '', '', 255, true);
+$in = '<div class="filter_input"><label>'.__('Free search').'</label>';
+$in .= $data.'</div>';
+$inputs[] = $in;
+
+$buttons = [];
+
+$buttons[] = [
+    'id'      => 'load-filter',
+    'class'   => 'float-left margin-right-2 sub config',
+    'text'    => __('Load filter'),
+    'onclick' => '',
+];
+
+if ($event_w || $event_m) {
+    $buttons[] = [
+        'id'      => 'save-filter',
+        'class'   => 'float-left margin-right-2 sub wand',
+        'text'    => __('Save filter'),
+        'onclick' => '',
+    ];
+}
+
+/*
+ * Advanced filter.
+ */
+
+$adv_inputs = [];
+
+
+// Source.
+$data = html_print_input_text('source', $source, '', '', 255, true);
+$in = '<div class="filter_input"><label>'.__('Source').'</label>';
+$in .= $data.'</div>';
+$adv_inputs[] = $in;
+
+
+// Extra ID.
+$data = html_print_input_text('id_extra', $id_extra, '', 11, 255, true);
+$in = '<div class="filter_input"><label>'.__('Extra ID').'</label>';
+$in .= $data.'</div>';
+$adv_inputs[] = $in;
+
+// Comment.
+$data = html_print_input_text(
+    'user_comment',
+    $user_comment,
+    '',
+    '',
+    255,
+    true
+);
+$in = '<div class="filter_input"><label>'.__('Comment').'</label>';
+$in .= $data.'</div>';
+$adv_inputs[] = $in;
+
+// Agent search.
+$params = [];
+$params['show_helptip'] = true;
+$params['input_name'] = 'text_agent';
+$params['value'] = $text_agent;
+$params['return'] = true;
+
+if ($meta) {
+    $params['javascript_page'] = 'enterprise/meta/include/ajax/events.ajax';
+}
+
+$params['print_hidden_input_idagent'] = true;
+$params['hidden_input_idagent_name'] = 'id_agent';
+$params['hidden_input_idagent_value'] = $id_agent;
+$params['size'] = '';
+
+$data = ui_print_agent_autocomplete_input($params);
+$in = '<div class="filter_input"><label>'.__('Agent search').'</label>';
+$in .= $data.'</div>';
+$adv_inputs[] = $in;
+
+// Mixed. Metaconsole => server, Console => module.
+if (is_metaconsole()) {
+    $title = __('Server');
+    $data = html_print_select_from_sql(
+        'SELECT id, server_name FROM tmetaconsole_setup',
+        'server_id',
+        $server_id,
+        '',
+        __('All'),
+        '0',
+        true
+    );
+} else {
+    $title = __('Module search');
+    $data = html_print_autocomplete_modules(
+        'module_search',
+        $text_module,
+        false,
+        true,
+        '',
+        [],
+        true,
+        $id_agent_module,
+        ''
+    );
+}
+
+$in = '<div class="filter_input"><label>'.$title.'</label>';
+$in .= $data.'</div>';
+$adv_inputs[] = $in;
+
+// User ack.
+$user_users = users_get_user_users(
+    $config['id_user'],
+    $access,
+    users_can_manage_group_all()
+);
+
+$data = html_print_select(
+    $user_users,
+    'id_user_ack',
+    $id_user_ack,
+    '',
+    __('Any'),
+    0,
+    true
+);
+$in = '<div class="filter_input"><label>'.__('User ack.').'</label>';
+$in .= $data.'</div>';
+$adv_inputs[] = $in;
+
+// Only alert events.
+$data = html_print_select(
+    [
+        '0' => __('Filter alert events'),
+        '1' => __('Only alert events'),
+    ],
+    'filter_only_alert',
+    $filter_only_alert,
+    '',
+    __('All'),
+    -1,
+    true
+);
+$in = '<div class="filter_input"><label>'.__('Alert events').'</label>';
+$in .= $data.'</div>';
+$adv_inputs[] = $in;
+
+// Gap.
+$adv_inputs[] = '<div class="filter_input"></div>';
+
+// Date from.
+$data = html_print_input_text(
+    'date_from',
+    $date_from,
+    '',
+    false,
+    10,
+    true,
+    // Disabled.
+    false,
+    // Required.
+    false,
+    // Function.
+    '',
+    // Class.
+    '',
+    // OnChange.
+    '',
+    // Autocomplete.
+    'off'
+);
+$in = '<div class="filter_input">';
+$in .= '<div class="filter_input_little"><label>'.__('Date from').'</label>';
+$in .= $data.'</div>';
+
+// Time from.
+$data = html_print_input_text(
+    'time_from',
+    $time_from,
+    '',
+    false,
+    10,
+    true,
+    // Disabled.
+    false,
+    // Required.
+    false,
+    // Function.
+    '',
+    // Class.
+    '',
+    // OnChange.
+    '',
+    // Autocomplete.
+    'off'
+);
+$in .= '<div class="filter_input_little"><label>'.__('Time from').'</label>';
+$in .= $data.'</div>';
+$in .= '</div>';
+$adv_inputs[] = $in;
+
+// Date to.
+$data = html_print_input_text(
+    'date_to',
+    $date_to,
+    '',
+    false,
+    10,
+    true,
+    // Disabled.
+    false,
+    // Required.
+    false,
+    // Function.
+    '',
+    // Class.
+    '',
+    // OnChange.
+    '',
+    // Autocomplete.
+    'off'
+);
+$in = '<div class="filter_input">';
+$in .= '<div class="filter_input_little"><label>'.__('Date to').'</label>';
+$in .= $data.'</div>';
+
+// Time to.
+$data = html_print_input_text(
+    'time_to',
+    $time_to,
+    '',
+    false,
+    10,
+    true,
+    // Disabled.
+    false,
+    // Required.
+    false,
+    // Function.
+    '',
+    // Class.
+    '',
+    // OnChange.
+    '',
+    // Autocomplete.
+    'off'
+);
+$in .= '<div class="filter_input_little"><label>'.__('Time to').'</label>';
+$in .= $data.'</div>';
+$in .= '</div>';
+$adv_inputs[] = $in;
+
+
+// Tags.
+if (is_metaconsole()) {
+    $data = '<fieldset><legend style="padding:0px;">'.__('Events with following tags').'</legend>'.html_print_table($tabletags_with, true).'</fieldset>';
+    $data .= '<fieldset><legend style="padding:0px;">'.__('Events without following tags').'</legend>'.html_print_table($tabletags_without, true).'</fieldset>';
+} else {
+    $data = '<fieldset><legend>'.__('Events with following tags').'</legend>'.html_print_table($tabletags_with, true).'</fieldset>';
+    $data .= '<fieldset><legend>'.__('Events without following tags').'</legend>'.html_print_table($tabletags_without, true).'</fieldset>';
+}
+
+$in = '<div class="filter_input large">';
+$in .= $data.'</div>';
+$adv_inputs[] = $in;
+
+// Load view.
+$adv_filter = join('', $adv_inputs);
+$filter = join('', $inputs);
+$filter .= ui_toggle(
+    $adv_filter,
+    __('Advanced options'),
+    '',
+    '',
+    true,
+    true,
+    'white_box white_box_opened',
+    'no-border flex-row'
+);
+
+try {
+    $checkbox_all = html_print_checkbox(
+        'all_validate_box',
+        1,
+        false,
+        true
     );
 
-    foreach ($in_process_status as $val) {
-        if (($key = array_search($val['id_evento'], $ids)) !== false) {
-            unset($ids[$key]);
+    $default_fields = [
+        [
+            'text'  => 'evento',
+            'class' => 'mw120px',
+        ],
+        [
+            'text'  => 'mini_severity',
+            'class' => 'no-padding',
+        ],
+        'id_evento',
+            // 'id_agente',
+            // 'id_usuario',
+            // 'id_grupo',
+            // 'estado',
+        'agent_name',
+        'timestamp',
+            // 'utimestamp',
+            // 'event_type',
+            // 'id_agentmodule',
+            // 'id_alert_am',
+        'event_type',
+            // 'user_comment',
+            // 'tags',
+            // 'source',
+            // 'id_extra',
+            // 'critical_instructions',
+            // 'warning_instructions',
+            // 'unknown_instructions',
+            // 'owner_user',
+            // 'ack_utimestamp',
+            // 'custom_data',
+            // 'data',
+            // 'module_status',
+            // 'similar_ids',
+            // 'event_rep',
+            // 'timestamp_rep',
+            // 'timestamp_rep_min',
+            // 'module_name',
+        [
+            'text'  => 'options',
+            'class' => 'action_buttons w120px',
+        ],[
+            'text'  => 'm',
+            'extra' => $checkbox_all,
+            'class' => 'mw120px',
+        ],
+    ];
+    $fields = explode(',', $config['event_fields']);
+
+    // Always check something is shown.
+    if (empty($fields)) {
+        $fields = $default_fields;
+    }
+
+    if (in_array('mini_severity', $fields) > 0) {
+        $fields[array_search('mini_severity', $fields)] = [
+            'text'  => 'mini_severity',
+            'class' => 'no-padding-imp',
+        ];
+    }
+
+    $evento_id = array_search('evento', $fields);
+    if ($evento_id !== false) {
+        $fields[$evento_id] = [
+            'text'  => 'evento',
+            'class' => 'mw250px',
+        ];
+    }
+
+    // Always add options column.
+    $fields = array_merge(
+        $fields,
+        [
+            [
+                'text'  => 'options',
+                'class' => 'action_buttons mw120px',
+            ],[
+                'text'  => 'm',
+                'extra' => $checkbox_all,
+                'class' => 'w20px no-text-imp',
+            ],
+        ]
+    );
+
+    // Get column names.
+    $column_names = events_get_column_names($fields, true);
+
+    foreach ($column_names as $key => $column) {
+        if (is_array($column) && $column['text'] == 'S') {
+            $column_names[$key]['style'] = 'padding-left: 1em !important;';
         }
     }
 
-    if ($ids[0] != -1) {
-        $return = events_delete_event($ids, ($group_rep == 1), $meta);
-        ui_print_result_message(
-            $return,
-            __('Successfully deleted'),
-            __('Could not be deleted')
-        );
+    // Open current filter quick reference.
+    $active_filters_div = '<div class="filter_summary">';
+
+    // Current filter.
+    $active_filters_div .= '<div>';
+    $active_filters_div .= '<div class="label box-shadow">'.__('Current filter').'</div>';
+    $active_filters_div .= '<div id="current_filter" class="content">';
+    if ($user_filter !== false) {
+        $active_filters_div .= io_safe_output($user_filter['id_name']);
+    } else {
+        $active_filters_div .= __('Not set.');
     }
 
-    include_once $config['homedir'].'/operation/events/events_list.php';
-} else {
-    switch ($section) {
-        case 'list':
-        case 'history':
-            include_once $config['homedir'].'/operation/events/events_list.php';
+    $active_filters_div .= '</div>';
+    $active_filters_div .= '</div>';
+
+    // Event status.
+    $active_filters_div .= '<div>';
+    $active_filters_div .= '<div class="label box-shadow">'.__('Event status').'</div>';
+    $active_filters_div .= '<div id="summary_status" class="content">';
+    switch ($status) {
+        case EVENT_ALL:
+        default:
+            $active_filters_div .= __('Any status.');
         break;
+
+        case EVENT_NEW:
+            $active_filters_div .= __('New events.');
+        break;
+
+        case EVENT_VALIDATE:
+            $active_filters_div .= __('Validated.');
+        break;
+
+        case EVENT_PROCESS:
+            $active_filters_div .= __('In proccess.');
+        break;
+
+        case EVENT_NO_VALIDATED:
+            $active_filters_div .= __('Not validated.');
+        break;
+    }
+
+    $active_filters_div .= '</div>';
+    $active_filters_div .= '</div>';
+
+    // Max. hours old.
+    $active_filters_div .= '<div>';
+    $active_filters_div .= '<div class="label box-shadow">'.__('Max. hours old').'</div>';
+    $active_filters_div .= '<div id="summary_hours" class="content">';
+    if ($event_view_hr == 0) {
+        $active_filters_div .= __('Any time.');
+    } else if ($event_view_hr == 1) {
+        $active_filters_div .= __('Last hour.');
+    } else if ($event_view_hr > 1) {
+        $active_filters_div .= __('Last %d hours.', $event_view_hr);
+    }
+
+    $active_filters_div .= '</div>';
+    $active_filters_div .= '</div>';
+
+    // Duplicates.
+    $active_filters_div .= '<div>';
+    $active_filters_div .= '<div class="label box-shadow">'.__('Duplicated').'</div>';
+    $active_filters_div .= '<div id="summary_duplicates" class="content">';
+    if ($group_rep == 0) {
+        $active_filters_div .= __('All events.');
+    } else if ($group_rep == 1) {
+        $active_filters_div .= __('Group events');
+    } else if ($group_rep == 2) {
+        $active_filters_div .= __('Group agents.');
+    }
+
+    $active_filters_div .= '</div>';
+    $active_filters_div .= '</div>';
+
+    // Close.
+    $active_filters_div .= '</div>';
+
+    $table_id = 'events';
+    $form_id = 'events_form';
+
+    // Print datatable.
+    ui_print_datatable(
+        [
+            'id'                  => $table_id,
+            'class'               => 'info_table events',
+            'style'               => 'width: 100%;',
+            'ajax_url'            => 'operation/events/events',
+            'ajax_data'           => [
+                'get_events' => 1,
+                'history'    => (int) $history,
+            ],
+            'form'                => [
+                'id'            => $form_id,
+                'class'         => 'flex-row',
+                'html'          => $filter,
+                'inputs'        => [],
+                'extra_buttons' => $buttons,
+            ],
+            'extra_html'          => $active_filters_div,
+            'pagination_options'  => [
+                [
+                    $config['block_size'],
+                    10,
+                    25,
+                    100,
+                    200,
+                    500,
+                    1000,
+                    -1,
+                ],
+                [
+                    $config['block_size'],
+                    10,
+                    25,
+                    100,
+                    200,
+                    500,
+                    1000,
+                    'All',
+                ],
+            ],
+            'order'               => [
+                'field'     => 'timestamp',
+                'direction' => 'desc',
+            ],
+            'column_names'        => $column_names,
+            'columns'             => $fields,
+            'no_sortable_columns' => [
+                -1,
+                -2,
+            ],
+            'ajax_postprocess'    => 'process_datatables_item(item)',
+            'drawCallback'        => 'process_datatables_callback(this, settings)',
+        ]
+    );
+} catch (Exception $e) {
+    ui_print_error_message($e->getMessage());
+}
+
+// Event responses.
+$sql_event_resp = "SELECT id, name FROM tevent_response WHERE type LIKE 'command'";
+$event_responses = db_get_all_rows_sql($sql_event_resp);
+
+if ($config['event_replication'] != 1) {
+    if ($event_w && !$readonly) {
+        $array_events_actions['in_progress_selected'] = __('In progress selected');
+        $array_events_actions['validate_selected'] = __('Validate selected');
+    }
+
+    if ($event_m == 1 && !$readonly) {
+        $array_events_actions['delete_selected'] = __('Delete selected');
     }
 }
 
+foreach ($event_responses as $val) {
+    $array_events_actions[$val['id']] = $val['name'];
+}
+
+
+echo '<div class="multi-response-buttons">';
+echo '<form method="post" id="form_event_response">';
+echo '<input type="hidden" id="max_execution_event_response" value="'.$config['max_execution_event_response'].'" />';
+html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false);
+echo '&nbsp&nbsp';
+html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"');
+echo "<span id='response_loading_dialog' style='display:none'>".html_print_image('images/spinner.gif', true).'</span>';
+echo '</form>';
+echo '<span id="max_custom_event_resp_msg" style="display:none; color:#e63c52; line-height: 200%;">';
+echo __(
+    'A maximum of %s event custom responses can be selected',
+    $config['max_execution_event_response']
+).'</span>';
+echo '<span id="max_custom_selected" style="display:none; color:#e63c52; line-height: 200%;">';
+echo __(
+    'Please, select an event'
+).'</span>';
+echo '</div>';
+
+
+// Close viewer.
+enterprise_hook('close_meta_frame');
+
+// Datepicker requirements.
+ui_require_css_file('datepicker');
+ui_include_time_picker();
+ui_require_jquery_file(
+    'ui.datepicker-'.get_user_language(),
+    'include/javascript/i18n/'
+);
+
+// End. Load required JS.
+html_print_input_hidden('meta', (int) is_metaconsole());
+html_print_input_hidden('history', (int) $history);
+html_print_input_hidden('filterid', $is_filter);
+html_print_input_hidden(
+    'ajax_file',
+    ui_get_full_url('ajax.php', false, false, false)
+);
+
+// AJAX call options responses.
 echo "<div id='event_details_window'></div>";
 echo "<div id='event_response_window'></div>";
 echo "<div id='event_response_command_window' title='".__('Parameters')."'></div>";
 
-ui_require_jquery_file('bgiframe');
-ui_require_javascript_file('pandora_events');
-enterprise_hook('close_meta_frame');
-ui_require_javascript_file('wz_jsgraphics');
-ui_require_javascript_file('pandora_visual_console');
+// Load filter div for dialog.
+echo '<div id="load-modal-filter" style="display: none"></div>';
+echo '<div id="save-modal-filter" style="display: none"></div>';
+
+if ($_GET['refr'] || $do_refresh === true) {
+    $autorefresh_draw = true;
+}
 
-$ignored_params['refresh'] = '';
 ?>
-<script language="javascript" type="text/javascript">
-/* <![CDATA[ */
+<script type="text/javascript">
+var loading = 0;
+var select_with_tag_empty = <?php echo (int) $remove_with_tag_disabled; ?>;
+var select_without_tag_empty = <?php echo (int) $remove_without_tag_disabled; ?>;
+var origin_select_with_tag_empty = <?php echo (int) $add_with_tag_disabled; ?>;
+var origin_select_without_tag_empty = <?php echo (int) $add_without_tag_disabled; ?>;
 
-$(document).ready( function() {
+var val_none = 0;
+var text_none = "<?php echo __('None'); ?>";
+var group_agents_id = false;
+var test;
+/* Datatables auxiliary functions starts */
+function process_datatables_callback(table, settings) {
+    var api = table.api();
+    var rows = api.rows( {page:'current'} ).nodes();
+    var last=null;
+    var last_count=0;
+    var events_per_group = [];
+    var j=0;
+
+    // Only while grouping by agents.
+    if($('#group_rep').val() == '2') {
+        test = api;
+        target = -1;
+        for (var i =0 ; i < api.columns()['0'].length; i++) {
+            var label = $(api.table().column(i).header()).text();
+            if(label == '<?php echo __('Agent ID'); ?>') {
+                // Agent id.
+                target = i;
+            }
+            if(label == '<?php echo __('Agent name'); ?>') {
+                // Agent id.
+                target = i;
+                break;
+            }
+        }
+
+        // Cannot group without agent_id or agent_name.
+        if (target < 0) {
+            return;
+        }
+
+        api.column(target, {page:'current'} )
+        .data()
+        .each( function ( group, i ) {
+            $(rows).eq( i ).show();
+            if ( last !== group ) {
+                $(rows).eq( i ).before(
+                    '<tr class="group"><td colspan="100%">'
+                    +'<?php echo __('Agent').' '; ?>'
+                    +group+' <?php echo __('has at least').' '; ?>'
+                    +'<span style="cursor: pointer" id="s'+j+'">'+'</span>'
+                    +'<?php echo ' '.__('events'); ?>'
+                    +'</td></tr>'
+                );
+                events_per_group.push(i - last_count);
+                last_count = i;
+                last = group;
+                j += 1;
+            }
+        });
+        events_per_group.push(rows.length - last_count);
     
-    var refr = <?php echo (int) $refr; ?>;
-    var pure = <?php echo (int) $config['pure']; ?>;
-    var href = "<?php echo ui_get_url_refresh($ignored_params); ?>";
-    if (pure) {
-        var startCountDown = function (duration, cb) {
-            $('div.vc-countdown').countdown('destroy');
-            if (!duration) return;
-            var t = new Date();
-            t.setTime(t.getTime() + duration * 1000);
-            $('div.vc-countdown').countdown({
-                until: t,
-                format: 'MS',
-                layout: '(%M%nn%M:%S%nn%S <?php echo __('Until refresh'); ?>) ',
-                alwaysExpire: true,
+        for( j=0; j<events_per_group.length; j++ ) {
+            $('#s'+j).text(events_per_group[j+1]);
+        }
+
+        /* Grouped by agent toggle view. */
+        $("tr.group td span").on('click', function(e){
+            var id = this.id.substring(1)*1;
+            var from = events_per_group[id];
+            var to = events_per_group[id+1] + from;
+            for (var i = from; i < to; i++) {
+                $(rows).eq(i).toggle();
+            }
+
+        })
+    }
+
+    var autorefresh_draw = '<?php echo $autorefresh_draw; ?>';
+    if (autorefresh_draw == true){
+        $("#refrcounter").countdown('change', {
+            until: countdown_repeat()
+        });
+
+        function countdown_repeat() {
+            var until_time = new Date();
+            until_time.setTime (until_time.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
+            return until_time;
+        }
+
+    }
+
+}
+
+function process_datatables_item(item) {
+
+    // Grouped events.
+    if(item.max_id_evento) {
+        item.id_evento = item.max_id_evento
+    }
+
+    /* Event severity prepared */
+    var color = "<?php echo COL_UNKNOWN; ?>";
+    var text = "<?php echo __('UNKNOWN'); ?>";
+    switch (item.criticity) {
+        case "<?php echo EVENT_CRIT_CRITICAL; ?>":
+            text = "<?php echo __('CRITICAL'); ?>";
+            color = "<?php echo COL_CRITICAL; ?>";
+        break;
+
+        case "<?php echo EVENT_CRIT_MAINTENANCE; ?>":
+            text = "<?php echo __('MAINTENANCE'); ?>";
+            color = "<?php echo COL_MAINTENANCE; ?>";
+        break;
+
+        case "<?php echo EVENT_CRIT_INFORMATIONAL; ?>":
+            text = "<?php echo __('INFORMATIONAL'); ?>";
+            color = "<?php echo COL_INFORMATIONAL; ?>";
+        break;
+
+        case "<?php echo EVENT_CRIT_MAJOR; ?>":
+            text = "<?php echo __('MAJOR'); ?>";
+            color = "<?php echo COL_MAJOR; ?>";
+        break;
+
+        case "<?php echo EVENT_CRIT_MINOR; ?>":
+            text = "<?php echo __('MINOR'); ?>";
+            color = "<?php echo COL_MINOR; ?>";
+        break;
+
+        case "<?php echo EVENT_CRIT_NORMAL; ?>":
+            text = "<?php echo __('NORMAL'); ?>";
+            color = "<?php echo COL_NORMAL; ?>";
+        break;
+
+        case "<?php echo EVENT_CRIT_WARNING; ?>":
+            text = "<?php echo __('WARNING'); ?>";
+            color = "<?php echo COL_WARNING; ?>";
+        break;
+    }
+    output = '<div data-title="';
+    output += text;
+    output += '" data-use_title_for_force_title="1" ';
+    output += 'class="forced_title mini-criticity h100p" ';
+    output += 'style="background: ' + color + '">';
+    output += '</div>';
+
+    // Add event severity to end of text.
+    evn = '<a href="javascript:" onclick="show_event_dialog(\'';
+    evn += item.b64+'\','+$("#group_rep").val()+');">';
+    // Grouped events.
+    if(item.event_rep && item.event_rep > 1) {
+        evn += '('+item.event_rep+') ';
+    }
+    evn += item.evento+'</a>';
+    if(item.hint !== ''){
+        let ruta = item.meta == true ? '../../images/tip_help.png' : 'images/tip_help.png';
+        evn += '&nbsp;<img src="'+ruta+'" data-title="'+item.hint+'" data-use_title_for_force_title="1" class="forced_title" alt="'+item.hint+'">';
+    }
+
+    item.mini_severity = '<div class="event flex-row h100p nowrap">';
+    item.mini_severity += output;
+    item.mini_severity += '</div>';
+
+    criticity = '<div class="criticity" style="background: ';
+    criticity += color + '">' + text + "</div>";
+
+    // Grouped events.
+    if(item.max_timestamp) {
+        item.timestamp = item.max_timestamp;
+    }
+
+    /* Event type prepared. */
+    switch (item.event_type) {
+        case "<?php echo EVENTS_ALERT_FIRED; ?>":
+        case "<?php echo EVENTS_ALERT_RECOVERED; ?>":
+        case "<?php echo EVENTS_ALERT_CEASED; ?>":
+        case "<?php echo EVENTS_ALERT_MANUAL_VALIDATION; ?>":
+            text = "<?php echo __('ALERT'); ?>";
+            color = "<?php echo COL_ALERTFIRED; ?>";
+        break;
+
+        case "<?php echo EVENTS_RECON_HOST_DETECTED; ?>":
+        case "<?php echo EVENTS_SYSTEM; ?>":
+        case "<?php echo EVENTS_ERROR; ?>":
+        case "<?php echo EVENTS_NEW_AGENT; ?>":
+        case "<?php echo EVENTS_CONFIGURATION_CHANGE; ?>":
+            text = "<?php echo __('SYSTEM'); ?>";
+            color = "<?php echo COL_MAINTENANCE; ?>";
+        break;
+
+        case "<?php echo EVENTS_GOING_UP_WARNING; ?>":
+        case "<?php echo EVENTS_GOING_DOWN_WARNING; ?>":
+            text = "<?php echo __('WARNING'); ?>";
+            color = "<?php echo COL_WARNING; ?>";
+        break;
+
+        case "<?php echo EVENTS_GOING_DOWN_NORMAL; ?>":
+        case "<?php echo EVENTS_GOING_UP_NORMAL; ?>":
+            text = "<?php echo __('NORMAL'); ?>";
+            color = "<?php echo COL_NORMAL; ?>";
+        break;
+
+        case "<?php echo EVENTS_GOING_DOWN_CRITICAL; ?>":
+        case "<?php echo EVENTS_GOING_UP_CRITICAL; ?>":
+            text = "<?php echo __('CRITICAL'); ?>";
+            color = "<?php echo COL_CRITICAL; ?>";
+        break;
+
+        case "<?php echo EVENTS_UNKNOWN; ?>":
+        case "<?php echo EVENTS_GOING_UNKNOWN; ?>":
+        default:
+            text = "<?php echo __('UNKNOWN'); ?>";
+            color = "<?php echo COL_UNKNOWN; ?>";
+        break;
+    }
+
+    event_type = '<div class="criticity" style="background: ';
+    event_type += color + '">' + text + "</div>";
+
+    /* Module status */
+    /* Event severity prepared */
+    var color = "<?php echo COL_UNKNOWN; ?>";
+    var text = "<?php echo __('UNKNOWN'); ?>";
+    switch (item.module_status) {
+        case "<?php echo AGENT_MODULE_STATUS_NORMAL; ?>":
+            text = "<?php echo __('NORMAL'); ?>";
+            color = "<?php echo COL_NORMAL; ?>";
+        break;
+
+        case "<?php echo AGENT_MODULE_STATUS_CRITICAL_BAD; ?>":
+            text = "<?php echo __('CRITICAL'); ?>";
+            color = "<?php echo COL_CRITICAL; ?>";
+        break;
+
+        case "<?php echo AGENT_MODULE_STATUS_NO_DATA; ?>":
+            text = "<?php echo __('NOT INIT'); ?>";
+            color = "<?php echo COL_NOTINIT; ?>";
+        break;
+
+        case "<?php echo AGENT_MODULE_STATUS_CRITICAL_ALERT; ?>":
+        case "<?php echo AGENT_MODULE_STATUS_NORMAL_ALERT; ?>":
+        case "<?php echo AGENT_MODULE_STATUS_WARNING_ALERT; ?>":
+            text = "<?php echo __('ALERT'); ?>";
+            color = "<?php echo COL_ALERTFIRED; ?>";
+        break;
+
+        case "<?php echo AGENT_MODULE_STATUS_WARNING; ?>":
+            text = "<?php echo __('WARNING'); ?>";
+            color = "<?php echo COL_WARNING; ?>";
+        break;
+    }
+
+    module_status = '<div class="criticity" style="background: ';
+    module_status += color + '">' + text + "</div>";
+
+    /* Options */
+    // Show more.
+    item.options = '<a href="javascript:" onclick="show_event_dialog(\'';
+    item.options += item.b64+'\','+$("#group_rep").val();
+    item.options += ')" ><?php echo html_print_image('images/eye.png', true, ['title' => __('Show more')]); ?></a>';
+
+    <?php
+    if (!$readonly) {
+        ?>
+
+    if (item.user_can_write == '1') {
+        if (item.estado != '1') {
+            // Validate.
+            item.options += '<a href="javascript:" onclick="validate_event(dt_<?php echo $table_id; ?>,';
+            if (item.max_id_evento) {
+                item.options += item.max_id_evento+', '+ item.event_rep +', this)" id="val-'+item.max_id_evento+'">';
+                item.options += '<?php echo html_print_image('images/tick.png', true, ['title' => __('Validate events')]); ?></a>';
+            } else {
+                item.options += item.id_evento+', 0, this)" id="val-'+item.id_evento+'">';
+                item.options += '<?php echo html_print_image('images/tick.png', true, ['title' => __('Validate event')]); ?></a>';
+            }
+        }
+
+        if (item.estado != '2') {
+            // In process.
+            item.options += '<a href="javascript:" onclick="in_process_event(dt_<?php echo $table_id; ?>,';
+            if (item.max_id_evento) {
+                item.options += item.max_id_evento+', '+ item.event_rep +', this)" id="proc-'+item.max_id_evento+'">';
+            } else {
+                item.options += item.id_evento+', 0, this)" id="proc-'+item.id_evento+'">';
+            }
+            item.options += '<?php echo html_print_image('images/hourglass.png', true, ['title' => __('Change to in progress status')]); ?></a>';
+        }
+    }
+
+    if (item.user_can_manage == '1') {
+        // Delete.
+        item.options += '<a href="javascript:" onclick="delete_event(dt_<?php echo $table_id; ?>,';
+        if (item.max_id_evento) {
+            item.options += item.max_id_evento+', '+ item.event_rep +', this)" id="del-'+item.max_id_evento+'">';
+            item.options += '<?php echo html_print_image('images/cross.png', true, ['title' => __('Delete events')]); ?></a>';
+        } else {
+            item.options += item.id_evento+', 0, this)" id="del-'+item.id_evento+'">';
+            item.options += '<?php echo html_print_image('images/cross.png', true, ['title' => __('Delete event')]); ?></a>';
+        }
+    }
+        <?php
+    }
+    ?>
+
+    // Multi select.
+    item.m = '<input name="checkbox-multi[]" type="checkbox" value="';
+    item.m += item.id_evento+'" id="checkbox-multi-'+item.id_evento+'" ';
+    if (item.max_id_evento) {
+        item.m += ' event_rep="' + item.event_rep +'" ';
+    } else {
+        item.m += ' event_rep="0" ';
+    }
+    item.m += 'class="candeleted chk_val">';
+
+    /* Status */
+    img = '<?php echo html_print_image('images/star.png', true, ['title' => __('Unknown'), 'class' => 'forced-title']); ?>';
+    switch (item.estado) {
+        case "<?php echo EVENT_STATUS_NEW; ?>":
+            img = '<?php echo html_print_image('images/star.png', true, ['title' => __('New event'), 'class' => 'forced-title']); ?>';
+        break;
+
+        case "<?php echo EVENT_STATUS_VALIDATED; ?>":
+            img = '<?php echo html_print_image('images/tick.png', true, [ 'title' => __('Event validated'), 'class' => 'forced-title']); ?>';
+        break;
+
+        case "<?php echo EVENT_STATUS_INPROCESS; ?>":
+            img = '<?php echo html_print_image('images/hourglass.png', true, [ 'title' => __('Event in process'), 'class' => 'forced-title']); ?>';
+        break;
+    }
+
+    /* Update column content now to avoid json poisoning. */
+
+    /* Agent name link */
+    if (item.id_agente > 0) {
+        item.agent_name = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>' +item.id_agente+'">' + item.agent_name + '</a>';
+    } else {
+        item.agent_name = '';
+    }
+
+    /* Agent ID link */
+    if (item.id_agente > 0) {
+        <?php
+        if (in_array('agent_name', $fields)) {
+            ?>
+            item.id_agente = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>'+item.id_agente+'">' + item.id_agente + '</a>';
+            <?php
+        } else {
+            ?>
+            item.id_agente = '<a href="<?php echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='); ?>'+item.id_agente+'">' + item.agent_name + '</a>';
+            <?php
+        }
+        ?>
+    } else {
+        item.id_agente = '';
+    }
+
+    item.estado = '<div>';
+    item.estado += img;
+    item.estado += '</div>';
+
+    item.criticity = criticity;
+    item.event_type = event_type;
+    item.module_status = module_status;
+
+    /* Event ID dash */
+    item.id_evento = "#"+item.id_evento;
+
+    /* Owner */
+    if (item.owner_user == "0") {
+        item.owner_user = '<?php echo __('System'); ?>';
+    }
+
+    // Add event severity format to itself.
+    item.evento = evn;
+
+    /* Group name */
+    if (item.id_grupo == "0") {
+        item.id_grupo = "<?php echo __('All'); ?>";
+    } else {
+        item.id_grupo = item.group_name;
+    }
+
+    /* Module name */
+    item.id_agentmodule = item.module_name;
+}
+
+/* Datatables auxiliary functions ends */
+
+/* Tag management starts */
+function click_button_remove_tag(what_button) {
+    if (what_button == "with") {
+        id_select_origin = "#select_with";
+        id_select_destiny = "#tag_with_temp";
+        id_button_remove = "#button-remove_with";
+        id_button_add = "#button-add_with";
+        
+        select_origin_empty = origin_select_with_tag_empty;
+    }
+    else { //without
+        id_select_origin = "#select_without";
+        id_select_destiny = "#tag_without_temp";
+        id_button_remove = "#button-remove_without";
+        id_button_add = "#button-add_without";
+        
+        select_origin_empty = origin_select_without_tag_empty;
+    }
+    
+    if ($(id_select_destiny + " option:selected").length == 0) {
+        return; //Do nothing
+    }
+    
+    if (select_origin_empty) {
+        $(id_select_origin + " option").remove();
+        
+        if (what_button == "with") {
+            origin_select_with_tag_empty = false;
+        }
+        else { //without
+            origin_select_without_tag_empty = false;
+        }
+        
+        $(id_button_add).removeAttr('disabled');
+    }
+    
+    //Foreach because maybe the user select several items in
+    //the select.
+    jQuery.each($(id_select_destiny + " option:selected"), function(key, element) {
+        val = $(element).val();
+        text = $(element).text();
+        
+        $(id_select_origin).append($("<option value='" + val + "'>" + text + "</option>"));
+    });
+    
+    $(id_select_destiny + " option:selected").remove();
+    
+    if ($(id_select_destiny + " option").length == 0) {
+        $(id_select_destiny).append($("<option value='" + val_none + "'>" + text_none + "</option>"));
+        $(id_button_remove).attr('disabled', 'true');
+        
+        if (what_button == 'with') {
+            select_with_tag_empty = true;
+        }
+        else { //without
+            select_without_tag_empty = true;
+        }
+    }
+    
+    replace_hidden_tags(what_button);
+}
+
+function click_button_add_tag(what_button) {
+    if (what_button == 'with') {
+        id_select_origin = "#select_with";
+        id_select_destiny = "#tag_with_temp";
+        id_button_remove = "#button-remove_with";
+        id_button_add = "#button-add_with";
+    }
+    else { //without
+        id_select_origin = "#select_without";
+        id_select_destiny = "#tag_without_temp";
+        id_button_remove = "#button-remove_without";
+        id_button_add = "#button-add_without";
+    }
+    
+    $(id_select_origin + " option:selected").each(function() {
+        if (what_button == 'with') {
+            select_destiny_empty = select_with_tag_empty;
+        }
+        else { //without
+            select_destiny_empty = select_without_tag_empty;
+        }
+        
+        
+        without_val = $(this).val();
+        if(without_val == null) {
+            next;
+        }
+        without_text = $(this).text();
+                
+        if (select_destiny_empty) {
+            $(id_select_destiny).empty();
+            
+            if (what_button == 'with') {
+                select_with_tag_empty = false;
+            }
+            else { //without
+                select_without_tag_empty = false;
+            }
+        }
+        
+        $(id_select_destiny).append($("<option value='" + without_val + "'>" + without_text + "</option>"));
+        $(id_select_origin + " option:selected").remove();
+        $(id_button_remove).removeAttr('disabled');
+        
+        if ($(id_select_origin + " option").length == 0) {
+            $(id_select_origin).append($("<option value='" + val_none + "'>" + text_none + "</option>"));
+            $(id_button_add).attr('disabled', 'true');
+            
+            if (what_button == 'with') {
+                origin_select_with_tag_empty = true;
+            }
+            else { //without
+                origin_select_without_tag_empty = true;
+            }
+        }
+            
+        replace_hidden_tags(what_button);
+    });
+    
+}
+
+function replace_hidden_tags(what_button) {
+    if (what_button == 'with') {
+        id_select_destiny = "#tag_with_temp";
+        id_hidden = "#hidden-tag_with";
+    }
+    else { //without
+        id_select_destiny = "#tag_without_temp";
+        id_hidden = "#hidden-tag_without";
+    }
+    
+    value_store = [];
+    
+    jQuery.each($(id_select_destiny + " option"), function(key, element) {
+        val = $(element).val();
+        
+        value_store.push(val);
+    });
+    
+    $(id_hidden).val(Base64.encode(JSON.stringify(value_store)));
+}
+
+function clear_tags_inputs() {
+    $("#hidden-tag_with").val(Base64.encode(JSON.stringify([])));
+    $("#hidden-tag_without").val(Base64.encode(JSON.stringify([])));
+    reorder_tags_inputs();
+}
+
+function reorder_tags_inputs() {
+    $('#select_with option[value="' + val_none + '"]').remove();
+    jQuery.each($("#tag_with_temp option"), function(key, element) {
+        val = $(element).val();
+        text = $(element).text();
+        
+        if (val == val_none)
+            return;
+        
+        $("#select_with").append($("<option value='" + val + "'>" + text + "</option>"));
+    });
+    $("#tag_with_temp option").remove();
+    
+    
+    $('#select_without option[value="' + val_none + '"]').remove();
+    jQuery.each($("#tag_without_temp option"), function(key, element) {
+        val = $(element).val();
+        text = $(element).text();
+        
+        if (val == val_none)
+            return;
+        
+        $("#select_without").append($("<option value='" + val + "'>" + text + "</option>"));
+    });
+    $("#tag_without_temp option").remove();
+    
+    
+    tags_base64 = $("#hidden-tag_with").val();
+    if (tags_base64.length > 0) {
+        tags = jQuery.parseJSON(Base64.decode(tags_base64));
+    } else {
+        tags = [];
+    }
+    jQuery.each(tags, function(key, element) {
+        if ($("#select_with option[value='" + element + "']").length == 1) {
+            text = $("#select_with option[value='" + element + "']").text();
+            val = $("#select_with option[value='" + element + "']").val();
+            $("#tag_with_temp").append($("<option value='" + val + "'>" + text + "</option>"));
+            $("#select_with option[value='" + element + "']").remove();
+        }
+    });
+    if ($("#select_with option").length == 0) {
+        origin_select_with_tag_empty = true;
+        $("#button-add_with").attr('disabled', 'true');
+        $("#select_with").append($("<option value='" + val_none + "'>" + text_none + "</option>"));
+    }
+    else {
+        origin_select_with_tag_empty = false;
+        $("#button-add_with").removeAttr('disabled');
+    }
+    if ($("#tag_with_temp option").length == 0) {
+        select_with_tag_empty = true;
+        $("#button-remove_with").attr('disabled', 'true');
+        $("#tag_with_temp").append($("<option value='" + val_none + "'>" + text_none + "</option>"));
+    }
+    else {
+        select_with_tag_empty = false;
+        $("#button-remove_with").removeAttr('disabled');
+    }
+    
+    tags_base64 = $("#hidden-tag_without").val();
+    if (tags_base64.length > 0) {
+        tags = jQuery.parseJSON(Base64.decode(tags_base64));
+    } else {
+        tags = [];
+    }
+    jQuery.each(tags, function(key, element) {
+        if ($("#select_without option[value='" + element + "']").length == 1) {
+            text = $("#select_without option[value='" + element + "']").text();
+            val = $("#select_without option[value='" + element + "']").val();
+            $("#tag_without_temp").append($("<option value='" + val + "'>" + text + "</option>"));
+            $("#select_without option[value='" + element + "']").remove();
+        }
+    });
+    if ($("#select_without option").length == 0) {
+        origin_select_without_tag_empty = true;
+        $("#button-add_without").attr('disabled', 'true');
+        $("#select_without").append($("<option value='" + val_none + "'>" + text_none + "</option>"));
+    }
+    else {
+        origin_select_without_tag_empty = false;
+        $("#button-add_without").removeAttr('disabled');
+    }
+    if ($("#tag_without_temp option").length == 0) {
+        select_without_tag_empty = true;
+        $("#button-remove_without").attr('disabled', 'true');
+        $("#tag_without_temp").append($("<option value='" + val_none + "'>" + text_none + "</option>"));
+    }
+    else {
+        select_without_tag_empty = false;
+        $("#button-remove_without").removeAttr('disabled');
+    }
+}
+/* Tag management ends */
+$(document).ready( function() {
+
+    let refresco = <?php echo get_parameter('refr', 0); ?>;
+    $('#refresh option[value='+refresco+']').attr('selected', 'selected');
+
+    /* Filter to a href */
+    $('.events_link').on('click', function(e) {
+        e.preventDefault();
+
+        inputs = $("#<?php echo $form_id; ?> :input");
+        values = {};
+        inputs.each(function() {
+            values[this.name] = $(this).val();
+        })
+
+        values['history'] = "<?php echo (int) $history; ?>";
+
+        var url = e.currentTarget.href;
+        url += 'fb64=' + btoa(JSON.stringify(values));
+        url += '&refr=' + '<?php echo $config['refr']; ?>';
+        document.location = url;
+
+    });
+
+    /* Multi select handler */
+    $('#checkbox-all_validate_box').on('change', function() {
+        if($('#checkbox-all_validate_box').is(":checked")) {
+            $('.chk_val').check();
+        } else {
+            $('.chk_val').uncheck();
+        }
+    });
+
+
+
+    /* Update summary */
+    $("#status").on("change",function(){
+        $('#summary_status').html($("#status option:selected").text());
+    });
+
+    $("#text-event_view_hr").on("keyup",function(){
+        hours = $('#text-event_view_hr').val();
+        if (hours == '' || hours == 0 ) {
+            $('#summary_hours').html('<?php echo __('Any'); ?>');
+        } else if (hours == 1) {
+            $('#summary_hours').html('<?php echo __('Last hour.'); ?>');
+        } else {
+            $('#summary_hours').html(hours + '<?php echo ' '.__('hours.'); ?>');
+        }
+    });
+
+    $('#group_rep').on("change", function(){
+        $('#summary_duplicates').html($("#group_rep option:selected").text());
+    });
+
+    /* Summary updates end. */
+
+    /* Filter management */
+    $('#load-filter').click(function (){
+        if($('#load-filter-select').length) {
+            $('#load-filter-select').dialog();
+        } else {
+            if (loading == 0) {
+                loading = 1
+                $.ajax({
+                    method: 'POST',
+                    url: '<?php echo ui_get_full_url('ajax.php'); ?>',
+                    data: {
+                        page: 'include/ajax/events',
+                        load_filter_modal: 1,
+                        current_filter: $('#latest_filter_id').val()
+                    },
+                    success: function (data){
+                        $('#load-modal-filter')
+                        .empty()
+                        .html(data);
+                        loading = 0;
+                    }
+                });
+            }
+        }
+    });
+
+    $('#save-filter').click(function (){
+        if($('#save-filter-select').length) {
+            $('#save-filter-select').dialog();
+        } else {
+            if (loading == 0) {
+                loading = 1
+                $.ajax({
+                    method: 'POST',
+                    url: '<?php echo ui_get_full_url('ajax.php'); ?>',
+                    data: {
+                        page: 'include/ajax/events',
+                        save_filter_modal: 1,
+                        current_filter: $('#latest_filter_id').val()
+                    },
+                    success: function (data){
+                        $('#save-modal-filter')
+                        .empty()
+                        .html(data);
+                        loading = 0;
+                    }
+                });
+            }
+        }
+    });
+
+    /* Filter management ends */
+
+    /* Tag management */
+    id_select_destiny = "#tag_with_temp";
+    id_hidden = "#hidden-tag_with";
+
+    value_store = [];
+    
+    jQuery.each($(id_select_destiny + " option"), function(key, element) {
+        val = $(element).val();
+        
+        value_store.push(val);
+    });
+    
+    $(id_hidden).val(Base64.encode(JSON.stringify(value_store)));
+    
+    id_select_destiny2 = "#tag_without_temp";
+    id_hidden2 = "#hidden-tag_without";
+    
+    value_store2 = [];
+    
+    jQuery.each($(id_select_destiny2 + " option"), function(key, element) {
+        val = $(element).val();
+        
+        value_store2.push(val);
+    });
+    
+    $(id_hidden2).val(Base64.encode(JSON.stringify(value_store2)));
+
+    $("#text-date_from, #text-date_to").datepicker(
+        {dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
+    
+    $("#button-add_with").click(function() {
+        click_button_add_tag("with");
+        });
+    
+    $("#button-add_without").click(function() {
+        click_button_add_tag("without");
+        });
+    
+    $("#button-remove_with").click(function() {
+        click_button_remove_tag("with");
+    });
+    
+    $("#button-remove_without").click(function() {
+        click_button_remove_tag("without");
+    });
+    
+
+    //Autorefresh in fullscreen
+    var pure = '<?php echo $pure; ?>';
+    if(pure == 1){
+        var refresh_interval = parseInt('<?php echo ($config['refr'] * 1000); ?>');
+        var until_time='';
+
+        // If autorefresh is disabled, don't show the countdown   
+        var refresh_time = '<?php echo $_GET['refr']; ?>'; 
+        if(refresh_time == '' || refresh_time == 0){
+            $('#refrcounter').toggle();
+        }
+
+        function events_refresh() {
+            until_time = new Date();
+            until_time.setTime (until_time.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
+
+            $("#refrcounter").countdown ({
+                until: until_time,
+                layout: '(%M%nn%M:%S%nn%S <?php echo __('Until next'); ?>)',
+                labels: ['', '', '', '', '', '', ''],
                 onExpiry: function () {
-                    $('div.vc-countdown').countdown('destroy');
-                    //cb();
-                    
-                    url = js_html_entity_decode( href ) + duration;
-                    $(document).attr ("location", url);
-                    
+                    dt_events.draw(false);
                 }
             });
         }
-        
-        startCountDown(refr, false);
-        //~ // Auto hide controls
-        var controls = document.getElementById('vc-controls');
-        autoHideElement(controls, 1000);
-        
-        $('select#refresh').change(function (event) {
-            refr = Number.parseInt(event.target.value, 10);
-            startCountDown(refr, false);
+        // Start the countdown when page is loaded (first time).
+        events_refresh();
+        // Repeat countdown according to refresh_interval.
+        setInterval(events_refresh, refresh_interval);
+
+
+        $("select#refresh").change (function () {
+            var href = window.location.href;
+
+            inputs = $("#events_form :input");
+            values = {};
+            inputs.each(function() {
+                values[this.name] = $(this).val();
+            })
+
+            var newValue = btoa(JSON.stringify(values));           
+            var fb64 = '<?php echo $fb64; ?>';  
+            // Check if the filters have changed.
+            if(fb64 !== newValue){
+                href = href.replace(fb64, newValue);
+            } 
+                
+            href = href.replace('refr='+refresh_time, 'refr='+this.value);
+
+            $(document).attr("location", href);
         });
     }
-    else {
-        $('#refresh').change(function () {
-            $('#hidden-vc_refr').val(
-                $('#refresh option:selected').val()
-            );
-        });
-    }
-    
-    $("input[name=all_validate_box]").change (function() {
-        if ($(this).is(":checked")) {
-            $("input[name='validate_ids[]']").check();
-        }
-        else {
-            $("input[name='validate_ids[]']").uncheck();
-        }
-        
-        $("input[name='validate_ids[]']").trigger('change');
-    });
-    
-    // If some of the checkbox checked cahnnot be deleted disable the delete button
-    $("input[name='validate_ids[]']").change (function() {
-        var canDeleted = 1;
-        $("input[name='validate_ids[]']").each(function() {
-            if ($(this).attr('checked') == 'checked') {
-                var classs = $(this).attr('class');
-                classs = classs.split(' ');
-                if (classs[0] != 'candeleted') {
-                    canDeleted = 0;
-                }
-            }
-        });
-        
-        if (canDeleted == 0) {
-            $('#button-delete_button').attr('disabled','disabled');
-        }
-        else {
-            $('#button-delete_button').removeAttr('disabled');
-        }
-    });
-    
-    $('#select_validate').change (function() {
-        $option = $('#select_validate').val();
-    });
-    
-    $("#tgl_event_control").click (function () {
-        $("#event_control").toggle ();
-        // Trick to don't collapse filter if autorefresh button has been pushed
-        if ($("#hidden-toogle_filter").val() == 'true') {
-            $("#hidden-toogle_filter").val('false');
-        }
-        else {
-            $("#hidden-toogle_filter").val('true');
-        }
-        return false;
-    });
-    
-    $("a.validate_event").click (function () {
-        $tr = $(this).parents ("tr");
-        
-        id = this.id.split ("-").pop ();
-        
-        var comment = $('#textarea_comment_'+id).val();
-        var select_validate = $('#select_validate_'+id).val(); // 1 validate, 2 in process, 3 add comment
-        var similars = $('#group_rep').val();
-        
-        if (!select_validate) {
-            select_validate = 1;
-        }
-        
-        jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
-            {
-                "page" : "operation/events/events",
-                "validate_event" : 1,
-                "id" : id,
-                "comment" : comment,
-                "new_status" : select_validate,
-                "similars" : similars
-            },
-            function (data, status) {
-                if (data == "ok") {
-                    
-                    // Refresh interface elements, don't reload (awfull)
-                    // Validate
-                    if (select_validate == 1) {
-                        $("#status_img_"+id)
-                            .attr ("src", "images/spinner.gif");
-                        // Change status description
-                        $("#status_row_"+id)
-                            .html(<?php echo "'".__('Event validated')."'"; ?>);
-                        
-                        // Get event comment
-                        jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
-                            {
-                                "page" : "operation/events/events",
-                                "get_comment" : 1,
-                                "id" : id
-                            },
-                            function (data, status) {
-                                $("#comment_row_"+id).html(data);
-                            }
-                        );
-                        
-                        // Get event comment in header
-                        jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
-                            {
-                                "page" : "operation/events/events",
-                                "get_comment_header" : 1,
-                                "id" : id
-                            },
-                            function (data, status) {
-                                $("#comment_header_"+id).html(data);
-                            }
-                        );
-                        
-                        // Change state image
-                        $("#validate-"+id).css("display", "none");
-                        $("#status_img_"+id).attr ("src", "images/tick.png");
-                        $("#status_img_"+id).attr ("title", <?php echo "'".__('Event validated')."'"; ?>);
-                        $("#status_img_"+id).attr ("alt", <?php echo "'".__('Event validated')."'"; ?>);
-                        
-                        // Remove row due to new state
-                        if (($("#status").val() == 2)
-                            || ($("#status").val() == 0)
-                            || ($("#status").val() == 3)) {
-                            
-                            $.each($tr, function(index, value) {
-                                row = value;
-                                
-                                if ($(row).attr('id') != '') {
-                                    
-                                    row_id_name = $(row).attr('id').split('-').shift();
-                                    row_id_number = $(row).attr('id').split('-').pop() - 1;
-                                    row_id_number_next = parseInt($(row).attr('id').split('-').pop()) + 1;
-                                    previous_row_id = $(row).attr('id');
-                                    current_row_id = row_id_name + "-" + row_id_number;
-                                    selected_row_id = row_id_name + "-" + row_id_number + "-0";
-                                    next_row_id = row_id_name + '-' + row_id_number_next;
-                                    
-                                    $("#"+previous_row_id).css('display', 'none');
-                                    $("#"+current_row_id).css('display', 'none');
-                                    $("#"+selected_row_id).css('display', 'none');
-                                    $("#"+next_row_id).css('display', 'none');
-                                }
-                            });
-                        }
-                        
-                    } // In process
-                    else if (select_validate == 2) {
-                        $("#status_img_"+id).attr ("src", "images/spinner.gif");
-                        // Change status description
-                        $("#status_row_"+id).html(<?php echo "'".__('Event in process')."'"; ?>);
-                        
-                        // Get event comment
-                        jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
-                            {
-                                "page" : "operation/events/events",
-                                "get_comment" : 1,
-                                "id" : id
-                            },
-                            function (data, status) {
-                                $("#comment_row_"+id).html(data);
-                            }
-                        );
-                        
-                        // Get event comment in header
-                        jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
-                            {
-                                "page" : "operation/events/events",
-                                "get_comment_header" : 1,
-                                "id" : id
-                            },
-                            function (data, status) {
-                                $("#comment_header_"+id).html(data);
-                            }
-                        );
-                        
-                        // Remove delete link (if event is not grouped and there is more than one event)
-                        if ($("#group_rep").val() == 1) {
-                            if (parseInt($("#count_event_group_"+id).text()) <= 1) {
-                                $("#delete-"+id).replaceWith('<img alt=" <?php echo addslashes(__('Is not allowed delete events in process')); ?>" title="<?php echo addslashes(__('Is not allowed delete events in process')); ?>"  src="images/cross.disabled.png">');
-                            }
-                        }
-                        else { // Remove delete link (if event is not grouped)
-                            $("#delete-"+id).replaceWith('<img alt="<?php echo addslashes(__('Is not allowed delete events in process')); ?> " title="<?php echo addslashes(__('Is not allowed delete events in process')); ?>"  src="images/cross.disabled.png">');
-                        }
-                        
-                        // Change state image
-                        $("#status_img_"+id).attr ("src", "images/hourglass.png");
-                        $("#status_img_"+id).attr ("title", <?php echo "'".__('Event in process')."'"; ?>);
-                        $("#status_img_"+id).attr ("alt", <?php echo "'".__('Event in process')."'"; ?>);
-                        
-                        // Remove row due to new state
-                        if (($("#status").val() == 0) || ($("#status").val() == 1)) {
-                            
-                            $.each($tr, function(index, value) {
-                                row = value;
-                                
-                                if ($(row).attr('id') != '') {
-                                    
-                                    row_id_name = $(row).attr('id').split('-').shift();
-                                    row_id_number = $(row).attr('id').split('-').pop() - 1;
-                                    row_id_number_next = parseInt($(row).attr('id').split('-').pop()) + 1;
-                                    previous_row_id = $(row).attr('id');
-                                    current_row_id = row_id_name + "-" + row_id_number;
-                                    selected_row_id = row_id_name + "-" + row_id_number + "-0";
-                                    next_row_id = row_id_name + '-' + row_id_number_next;
-                                    
-                                    $("#"+previous_row_id).css('display', 'none');
-                                    $("#"+current_row_id).css('display', 'none');
-                                    $("#"+selected_row_id).css('display', 'none');
-                                    $("#"+next_row_id).css('display', 'none');
-                                }
-                            });
-                            
-                        }
-                    } // Add comment
-                    else if (select_validate == 3) {
-                        // Get event comment
-                        jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
-                            {"page" : "operation/events/events",
-                            "get_comment" : 1,
-                            "id" : id
-                            },
-                            function (data, status) {
-                                $("#comment_row_"+id).html(data);
-                            });
-                            
-                        // Get event comment in header
-                        jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
-                            {"page" : "operation/events/events",
-                            "get_comment_header" : 1,
-                            "id" : id
-                            },
-                            function (data, status) {
-                                $("#comment_header_"+id).html(data);
-                            });
-                    }
-                    
-                    //location.reload();
-                }
-                else {
-                    $("#result")
-                        .showMessage ("<?php echo __('Could not be validated'); ?>")
-                        .addClass ("error");
-                }
-            },
-            "html"
-        );
-    });
 
-    $("td").on('click', 'a.delete_event', function () {
-        var click_element = this;
-        display_confirm_dialog(
-            "<?php echo __('Are you sure?'); ?>",
-            "<?php echo __('Confirm'); ?>",
-            "<?php echo __('Cancel'); ?>",
-            function () {
-                meta = $('#hidden-meta').val();
-                history_var = $('#hidden-history').val();
-
-                $tr = $(click_element).parents ("tr");
-                id = click_element.id.split ("-").pop ();
-
-                $("#delete_cross_"+id).attr ("src", "images/spinner.gif");
-
-                jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
-                    {"page" : "operation/events/events",
-                    "delete_event" : 1,
-                    "id" : id,
-                    "similars" : <?php echo ($group_rep) ? 1 : 0; ?>,
-                    "meta" : meta,
-                    "history" : history_var
-                    },
-                    function (data, status) {
-                        if (data == "ok") {
-                            $tr.remove ();
-                            $('#show_message_error').html('<h3 class="suc"> <?php echo __('Successfully delete'); ?> </h3>');
-                        }
-                        else
-                            $('#show_message_error').html('<h3 class="error"> <?php echo __('Error deleting event'); ?> </h3>');
-                    },
-                    "html"
-                );
-                return false;
-            }
-        );
-    });
-
-    function toggleDiv (divid) {
-        if (document.getElementById(divid).style.display == 'none') {
-            document.getElementById(divid).style.display = 'block';
-        }
-        else {
-            document.getElementById(divid).style.display = 'none';
-        }
-    }
 });
 
-function toggleCommentForm(id_event) {
-    display = $('.event_form_' + id_event).css('display');
+
+
+function datetime_picker_callback() {
+    $("#text-time_from, #text-time_to").timepicker({
+        showSecond: true,
+        timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
+        timeOnlyTitle: '<?php echo __('Choose time'); ?>',
+        timeText: '<?php echo __('Time'); ?>',
+        hourText: '<?php echo __('Hour'); ?>',
+        minuteText: '<?php echo __('Minute'); ?>',
+        secondText: '<?php echo __('Second'); ?>',
+        currentText: '<?php echo __('Now'); ?>',
+        closeText: '<?php echo __('Close'); ?>'});
+        
+    $("#text-date_from, #text-date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
     
-    $('#select_validate_' + id_event).change (function() {
-        $option = $('#select_validate_' + id_event).val();
-    });
-    
-    if (display != 'none') {
-        $('.event_form_' + id_event).css('display', 'none');
-        // Hide All showed rows
-        $('.event_form').css('display', 'none');
-        $(".select_validate").find('option:first').prop('selected', true).parent('select');
-    }
-    else {
-        $('.event_form_' + id_event).css('display', '');
-    }
-}
+    $.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
+};
 
-function validate_event_advanced(id, new_status) {
-    $tr = $('#validate-'+id).parents ("tr");
-    
-    var grouped = $('#group_rep').val();
-
-    // Get images url
-    var hourglass_image = "<?php echo ui_get_full_url('images/hourglass.png', false, false, false); ?>";
-    var cross_disabled_image = "<?php echo ui_get_full_url('images/cross.disabled.png', false, false, false); ?>";
-    var cross_image = "<?php echo ui_get_full_url('images/cross.png', false, false, false); ?>";
-    
-    var similar_ids;
-    similar_ids = $('#hidden-similar_ids_'+id).val();
-    meta = $('#hidden-meta').val();
-    var history_var = $('#hidden-history').val();
-    
-    $("#status_img_"+id).attr ("src", "images/spinner.gif");
-    
-    jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
-        {"page" : "include/ajax/events",
-        "change_status" : 1,
-        "event_ids" : similar_ids,
-        "new_status" : new_status,
-        "meta" : meta,
-        "history" : history_var
-        },
-        function (data, status) {
-            if (data == "status_ok") {
-                // Refresh interface elements, don't reload (awful)
-                // Validate
-                if (new_status == 1) {
-                    // Change status description
-                    $("#status_row_"+id).html(<?php echo "'".__('Event validated')."'"; ?>);
-                    
-                    // Change delete icon
-                    $("#delete-"+id).remove();
-                    $("#validate-"+id).parent().append('<a class="delete_event" href="javascript:" id="delete-' + id + '"></a>');
-                    $("#delete-"+id).append("<img src='" + cross_image + "' />");
-                    $("#delete-"+id + " img").attr ("id", "delete_cross_" + id);
-                    $("#delete-"+id + " img").attr ("data-title", <?php echo "'".__('Delete event')."'"; ?>);
-                    $("#delete-"+id + " img").attr ("alt", <?php echo "'".__('Delete event')."'"; ?>);
-                    $("#delete-"+id + " img").attr ("data-use_title_for_force_title", 1);
-                    $("#delete-"+id + " img").attr ("class", "forced_title");
-
-                    // Change other buttons actions
-                    $("#validate-"+id).css("display", "none");
-                    $("#in-progress-"+id).css("display", "none");
-                    $("#status_img_"+id).attr ("src", "images/tick.png");
-                    $("#status_img_"+id).attr ("data-title", <?php echo "'".__('Event in process')."'"; ?>);
-                    $("#status_img_"+id).attr ("alt", <?php echo "'".__('Event in process')."'"; ?>);
-                    $("#status_img_"+id).attr ("data-use_title_for_force_title", 1);
-                    $("#status_img_"+id).attr ("class", "forced_title");
-                } // In process
-                else if (new_status == 2) {
-                    // Change status description
-                    $("#status_row_"+id).html(<?php echo "'".__('Event in process')."'"; ?>);
-                    
-                    // Change state image
-                    $("#status_img_"+id).attr ("src", hourglass_image);
-                    $("#status_img_"+id).attr ("data-title", <?php echo "'".__('Event in process')."'"; ?>);
-                    $("#status_img_"+id).attr ("alt", <?php echo "'".__('Event in process')."'"; ?>);
-                    $("#status_img_"+id).attr ("data-use_title_for_force_title", 1);
-                    $("#status_img_"+id).attr ("class", "forced_title");
-
-                    // Change the actions buttons
-                    $("#delete-"+id).remove();
-                    $("#in-progress-"+id).remove();
-                    // Format the new disabled delete icon.
-                    $("#validate-"+id).parent().append("<img id='delete-" + id + "' src='" + cross_disabled_image + "' />");
-                    $("#delete-"+id).attr ("data-title",  "<?php echo addslashes(__('Is not allowed delete events in process')); ?>");
-                    $("#delete-"+id).attr ("alt"," <?php echo addslashes(__('Is not allowed delete events in process')); ?>");
-                    $("#delete-"+id).attr ("data-use_title_for_force_title", 1);
-                    $("#delete-"+id).attr ("class", "forced_title"); 
-
-                    // Remove row due to new state
-                    if (($("#status").val() == 0)
-                        || ($("#status").val() == 1)) {
-                        
-                        $.each($tr, function(index, value) {
-                            row = value;
-                            
-                            if ($(row).attr('id') != '') {
-                                
-                                row_id_name = $(row).attr('id').split('-').shift();
-                                row_id_number = $(row).attr('id').split('-').pop() - 1;
-                                row_id_number_next = parseInt($(row).attr('id').split('-').pop()) + 1;
-                                previous_row_id = $(row).attr('id');
-                                current_row_id = row_id_name + "-" + row_id_number;
-                                selected_row_id = row_id_name + "-" + row_id_number + "-0";
-                                next_row_id = row_id_name + '-' + row_id_number_next;
-                                
-                                $("#"+previous_row_id).css('display', 'none');
-                            }
-                        });
-                        
-                    }
-                }
-            }
-            else {
-                $("#result")
-                    .showMessage ("<?php echo __('Could not be validated'); ?>")
-                    .addClass ("error");
-            }
-        },
-        "html"
-    );
-}
+datetime_picker_callback();
 
 
-// Autoload event giving the id as POST/GET parameter
-<?php
-$load_event = get_parameter('load_event', 0);
-
-if ($load_event) {
-    ?>
-    show_event_dialog(<?php echo $load_event; ?>, 1);
-    <?php
-}
-?>
-/* ]]> */
-</script>
\ No newline at end of file
+</script>
diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php
index 8333ca5b0d..298310a845 100644
--- a/pandora_console/operation/events/events_list.php
+++ b/pandora_console/operation/events/events_list.php
@@ -992,6 +992,7 @@ $data[0] = ui_toggle(
     html_print_table($table_advanced, true),
     __('Advanced options'),
     '',
+    '',
     true,
     true
 );
diff --git a/pandora_console/operation/events/events_marquee.php b/pandora_console/operation/events/events_marquee.php
index 4834207172..b3332e56bf 100644
--- a/pandora_console/operation/events/events_marquee.php
+++ b/pandora_console/operation/events/events_marquee.php
@@ -17,7 +17,7 @@ error_reporting(1);
 $MAX_MARQUEE_EVENTS = 10;
 $MARQUEE_INTERVAL = 90;
 $MARQUEE_FONT_SIZE = '32px';
-$MARQUEE_SPEED = 12;
+$MARQUEE_SPEED = 9;
 
 $output = '';
 
diff --git a/pandora_console/operation/events/events_rss.php b/pandora_console/operation/events/events_rss.php
index 2a38643a9c..95ce7cd07b 100644
--- a/pandora_console/operation/events/events_rss.php
+++ b/pandora_console/operation/events/events_rss.php
@@ -1,18 +1,37 @@
 <?php
+/**
+ * Event RSS exporter.
+ *
+ * @category   Event RSS export
+ * @package    Pandora FMS
+ * @subpackage Community
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
+
+// Load global vars.
+global $config;
+
+// Don't display other errors, messes up XML.
+ini_set('display_errors', E_ALL);
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation for version 2.
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-ini_set('display_errors', 0);
-// Don't display other errors, messes up XML
 require_once '../../include/config.php';
 require_once '../../include/functions.php';
 require_once '../../include/functions_db.php';
@@ -22,65 +41,115 @@ require_once '../../include/functions_users.php';
 require_once '../../include/functions_tags.php';
 require_once '../../include/functions_groups.php';
 
-$ipOrigin = $_SERVER['REMOTE_ADDR'];
 
-// Uncoment this to activate ACL on RSS Events
-if (!isInACL($ipOrigin)) {
-    rss_error_handler(
-        null,
-        null,
-        null,
-        null,
-        __('Your IP is not into the IP list with API access.')
-    );
-
-    exit;
+/**
+ * Generates an xml entry.
+ *
+ * @param string $key   Key.
+ * @param string $value Value.
+ *
+ * @return string XML entry.
+ */
+function xml_entry($key, $value)
+{
+    $output = '<'.xml_entities($key).'>';
+    $output .= '<![CDATA['.io_safe_output($value).']]>';
+    $output .= '</'.xml_entities($key).'>';
+    return $output."\n";
 }
 
-// Check user credentials
-$user = get_parameter('user');
-$hashup = get_parameter('hashup');
 
-$pss = get_user_info($user);
-$hashup2 = md5($user.$pss['password']);
+/**
+ * Escape entities for XML.
+ *
+ * @param string $str String.
+ *
+ * @return string Escaped string.
+ */
+function xml_entities($str)
+{
+    if (!is_string($str)) {
+        return '';
+    }
 
-if ($hashup != $hashup2) {
-    rss_error_handler(
-        null,
-        null,
-        null,
-        null,
-        __('The URL of your feed has bad hash.')
-    );
+    if (preg_match_all('/(&[^;]+;)/', $str, $matches) != 0) {
+        $matches = $matches[0];
 
-    exit;
+        foreach ($matches as $entity) {
+            $char = html_entity_decode($entity, (ENT_COMPAT | ENT_HTML401), 'UTF-8');
+
+            $html_entity_numeric = '&#'.uniord($char).';';
+
+            $str = str_replace($entity, $html_entity_numeric, $str);
+        }
+    }
+
+    return $str;
 }
 
-header('Content-Type: application/xml; charset=UTF-8');
-// Send header before starting to output
+
+/**
+ * Undocumented function.
+ *
+ * @param string $u U.
+ *
+ * @return integer Ord.
+ */
+function uniord($u)
+{
+    $k = mb_convert_encoding($u, 'UCS-2LE', 'UTF-8');
+    $k1 = ord(substr($k, 0, 1));
+    $k2 = ord(substr($k, 1, 1));
+
+    return ($k2 * 256 + $k1);
+}
+
+
+/**
+ * Generate RSS header.
+ *
+ * @param integer $lastbuild Date, last build.
+ *
+ * @return string RSS header.
+ */
+function rss_header($lastbuild=0)
+{
+    $selfurl = ui_get_full_url('?'.$_SERVER['QUERY_STRING'], false, true);
+
+    // ' <?php ' -- Fixes highlighters thinking that the closing tag is PHP
+    $rss_feed = '<?xml version="1.0" encoding="utf-8" ?>'."\n";
+    $rss_feed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'."\n";
+    $rss_feed .= '<channel>'."\n";
+    $rss_feed .= '<title>'.io_safe_output(get_product_name()).' Events Feed</title>'."\n";
+    $rss_feed .= '<description>Latest events on '.get_product_name().'</description>'."\n";
+    $rss_feed .= '<lastBuildDate>'.date(DATE_RFC822, $lastbuild).'</lastBuildDate>'."\n";
+    // Last build date is the last event - that way readers won't mark it as having new posts.
+    $rss_feed .= '<link>'.$url.'</link>'."\n";
+    // Link back to the main Pandora page.
+    $rss_feed .= '<atom:link href="'.xml_entities(io_safe_input($selfurl)).'" rel="self" type="application/rss+xml" />'."\n";
+
+    return $rss_feed;
+}
+
+
+/**
+ * RSS error handler.
+ *
+ * @param string $errno                   Errno.
+ * @param string $errstr                  Errstr.
+ * @param string $errfile                 Errfile.
+ * @param string $errline                 Errline.
+ * @param string $error_human_description Error_human_description.
+ *
+ * @return void
+ */
 function rss_error_handler($errno, $errstr, $errfile, $errline, $error_human_description=null)
 {
     $url = ui_get_full_url(false);
     $selfurl = ui_get_full_url('?'.$_SERVER['QUERY_STRING'], false, true);
 
-    $rss_feed = '<?xml version="1.0" encoding="utf-8" ?>';
-    // ' Fixes certain highlighters freaking out on the PHP closing tag
-    $rss_feed .= "\n";
-    $rss_feed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">';
-    $rss_feed .= "\n";
-    $rss_feed .= '<channel>';
-    $rss_feed .= "\n";
-    $rss_feed .= '<title>'.get_product_name().' RSS Feed</title>';
-    $rss_feed .= "\n";
-    $rss_feed .= '<description>Latest events on '.get_product_name().'</description>';
-    $rss_feed .= "\n";
-    $rss_feed .= '<lastBuildDate>'.date(DATE_RFC822, 0).'</lastBuildDate>';
-    $rss_feed .= "\n";
-    $rss_feed .= '<link>'.$url.'</link>';
-    // Link back to the main Pandora page
-    $rss_feed .= "\n";
-    $rss_feed .= '<atom:link href="'.xml_entities(io_safe_input($selfurl)).'" rel="self" type="application/rss+xml" />';
-    // Alternative for Atom feeds. It's the same.
+    // ' Fixes certain highlighters freaking out on the PHP closing tag.
+    $rss_feed = rss_header(0);
     $rss_feed .= "\n";
     $rss_feed .= '<item>';
     $rss_feed .= "\n";
@@ -104,169 +173,206 @@ function rss_error_handler($errno, $errstr, $errfile, $errline, $error_human_des
     $rss_feed .= "\n";
     $rss_feed .= '</rss>';
 
-    exit($rss_feed);
-    // Exit by displaying the feed
+    echo $rss_feed;
 }
 
 
+// Errors output as RSS.
 set_error_handler('rss_error_handler', E_ERROR);
-// Errors output as RSS
-$id_group = get_parameter('id_group', 0);
-// group
-$event_type = get_parameter('event_type', '');
-// 0 all
-$severity = (int) get_parameter('severity', -1);
-// -1 all
-$status = (int) get_parameter('status', 0);
-// -1 all, 0 only red, 1 only green
-$id_agent = (int) get_parameter('id_agent', -1);
 
-$id_event = (int) get_parameter('id_event', -1);
-// This will allow to select only 1 event (eg. RSS)
-$event_view_hr = (int) get_parameter('event_view_hr', 0);
-$id_user_ack = get_parameter('id_user_ack', 0);
-$search = io_safe_output(preg_replace('/&([A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/', '&', rawurldecode(get_parameter('search'))));
-$text_agent = (string) get_parameter('text_agent', __('All'));
+// Send header before starting to output.
+header('Content-Type: application/xml; charset=UTF-8');
 
-$tag_with_json = base64_decode(get_parameter('tag_with', ''));
-$tag_with_json_clean = io_safe_output($tag_with_json);
-$tag_with_base64 = base64_encode($tag_with_json_clean);
-$tag_with = json_decode($tag_with_json_clean, true);
-if (empty($tag_with)) {
-    $tag_with = [];
+$ipOrigin = $_SERVER['REMOTE_ADDR'];
+
+// Uncoment this to activate ACL on RSS Events.
+if (!isInACL($ipOrigin)) {
+    rss_error_handler(
+        null,
+        null,
+        null,
+        null,
+        __('Your IP is not into the IP list with API access.')
+    );
+
+    exit;
 }
 
-$tag_with = array_diff($tag_with, [0 => 0]);
+// Check user credentials.
+$user = get_parameter('user');
+$hashup = get_parameter('hashup');
 
-$tag_without_json = base64_decode(get_parameter('tag_without', ''));
-$tag_without_json_clean = io_safe_output($tag_without_json);
-$tag_without_base64 = base64_encode($tag_without_json_clean);
-$tag_without = json_decode($tag_without_json_clean, true);
-if (empty($tag_without)) {
-    $tag_without = [];
+$pss = get_user_info($user);
+$hashup2 = md5($user.$pss['password']);
+
+if ($hashup != $hashup2) {
+    rss_error_handler(
+        null,
+        null,
+        null,
+        null,
+        __('The URL of your feed has bad hash.')
+    );
+
+    exit;
 }
 
-$tag_without = array_diff($tag_without, [0 => 0]);
-
-$filter_only_alert = (int) get_parameter('filter_only_alert', -1);
-
-//
-// Build the condition of the events query
-$sql_post = '';
-$meta = false;
-
-$id_user = $user;
-
-require 'events.build_query.php';
-
-// Now $sql_post have all the where condition
-//
-$sql = 'SELECT *
-	FROM tevento te LEFT JOIN tagent_secondary_group tasg
-		ON te.id_grupo = tasg.id_group
-	WHERE 1=1 '.$sql_post.'
-	ORDER BY utimestamp DESC';
-
-$result = db_get_all_rows_sql($sql);
-
-$url = ui_get_full_url(false);
-$selfurl = ui_get_full_url('?'.$_SERVER['QUERY_STRING'], false, true);
-
-if (empty($result)) {
-    $lastbuild = 0;
-    // Last build in 1970
-} else {
-    $lastbuild = (int) $result[0]['utimestamp'];
+$reset_session = false;
+if (empty($config['id_user'])) {
+    $config['id_user'] = $user;
+    $reset_session = true;
 }
 
-$rss_feed = '<?xml version="1.0" encoding="utf-8" ?>'."\n";
-// ' <?php ' -- Fixes highlighters thinking that the closing tag is PHP
-$rss_feed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'."\n";
-$rss_feed .= '<channel>'."\n";
-$rss_feed .= '<title>'.get_product_name().' RSS Feed</title>'."\n";
-$rss_feed .= '<description>Latest events on '.get_product_name().'</description>'."\n";
-$rss_feed .= '<lastBuildDate>'.date(DATE_RFC822, $lastbuild).'</lastBuildDate>'."\n";
-// Last build date is the last event - that way readers won't mark it as having new posts
-$rss_feed .= '<link>'.$url.'</link>'."\n";
-// Link back to the main Pandora page
-$rss_feed .= '<atom:link href="'.xml_entities(io_safe_input($selfurl)).'" rel="self" type="application/rss+xml" />'."\n";
-;
-// Alternative for Atom feeds. It's the same.
-if (empty($result)) {
-    $result = [];
-    $rss_feed .= '<item><guid>'.xml_entities(io_safe_input($url.'/index.php?sec=eventos&sec2=operation/events/events')).'</guid><title>No results</title>';
-    $rss_feed .= '<description>There are no results. Click on the link to see all Pending events</description>';
-    $rss_feed .= '<link>'.xml_entities(io_safe_input($url.'/index.php?sec=eventos&sec2=operation/events/events')).'</link></item>'."\n";
-}
+$column_names = [
+    'id_evento',
+    'evento',
+    'timestamp',
+    'estado',
+    'event_type',
+    'utimestamp',
+    'id_agente',
+    'agent_name',
+    'id_usuario',
+    'id_grupo',
+    'id_agentmodule',
+    'id_alert_am',
+    'criticity',
+    'user_comment',
+    'tags',
+    'source',
+    'id_extra',
+    'critical_instructions',
+    'warning_instructions',
+    'unknown_instructions',
+    'owner_user',
+    'ack_utimestamp',
+    'custom_data',
+    'data',
+    'module_status',
+];
 
-foreach ($result as $row) {
-    if (!check_acl($user, $row['id_grupo'], 'ER')) {
-        continue;
+$fields = [
+    'te.id_evento',
+    'te.evento',
+    'te.timestamp',
+    'te.estado',
+    'te.event_type',
+    'te.utimestamp',
+    'te.id_agente',
+    'ta.alias as agent_name',
+    'te.id_usuario',
+    'te.id_grupo',
+    'te.id_agentmodule',
+    'am.nombre as module_name',
+    'te.id_alert_am',
+    'te.criticity',
+    'te.user_comment',
+    'te.tags',
+    'te.source',
+    'te.id_extra',
+    'te.critical_instructions',
+    'te.warning_instructions',
+    'te.unknown_instructions',
+    'te.owner_user',
+    'te.ack_utimestamp',
+    'te.custom_data',
+    'te.data',
+    'te.module_status',
+    'tg.nombre as group_name',
+];
+
+
+try {
+    $fb64 = get_parameter('fb64', null);
+    $plain_filter = base64_decode($fb64);
+    $filter = json_decode($plain_filter, true);
+    if (json_last_error() != JSON_ERROR_NONE) {
+        throw new Exception('Invalid filter. ['.$plain_filter.']');
     }
 
-    if ($row['event_type'] == 'system') {
-        $agent_name = __('System');
-    } else if ($row['id_agente'] > 0) {
-        // Agent name
-        $agent_name = agents_get_alias($row['id_agente']);
-    } else {
-        $agent_name = __('Alert').__('SNMP');
+    // Dump events.
+    $limit = get_parameter('limit', 20);
+    $offset = get_parameter('offset', 0);
+    $events = events_get_all(
+        $fields,
+        $filter,
+        $offset,
+        $limit,
+        'desc',
+        'timestamp',
+        $filter['history']
+    );
+
+    $last_timestamp = 0;
+    if (is_array($events)) {
+        $last_timestamp = $events[0]['utimestamp'];
     }
 
-    // This is mandatory
-    $rss_feed .= '<item><guid>';
-    $rss_feed .= xml_entities(io_safe_input($url.'/index.php?sec=eventos&sec2=operation/events/events&id_event='.$row['id_evento']));
-    $rss_feed .= '</guid><title>';
-    $rss_feed .= xml_entities($agent_name);
-    $rss_feed .= '</title><description>';
-    $rss_feed .= xml_entities($row['evento']);
-    if ($row['estado'] == 1) {
-        $rss_feed .= xml_entities(io_safe_input('<br /><br />'.'Validated by '.$row['id_usuario']));
-    }
+    // Dump headers.
+    $rss = rss_header($last_timestamp);
+    $url = ui_get_full_url(false);
 
-    $rss_feed .= '</description><link>';
-    $rss_feed .= xml_entities(io_safe_input($url.'/index.php?sec=eventos&sec2=operation/events/events&id_event='.$row['id_evento']));
-    $rss_feed .= '</link>';
+    if (is_array($events)) {
+        foreach ($events as $row) {
+            $rss .= '<item>';
+            $rss .= xml_entry('title', $row['evento']);
+            if (!empty($row['id_agente'])) {
+                $rss .= xml_entry('link', $url.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$row['id_agente']);
+            }
 
-    // The rest is optional
-    $rss_feed .= '<pubDate>'.date(DATE_RFC822, $row['utimestamp']).'</pubDate>';
+            $rss .= xml_entry('comments', $row['']);
+            $rss .= xml_entry('pubDate', $row['timestamp']);
+            $rss .= xml_entry('category', $row['source']);
+            foreach ($column_names as $val) {
+                $key = $val;
+                if ($val == 'id_grupo') {
+                    $key = 'group_name';
+                } else if ($val == 'id_agentmodule') {
+                    $key = 'module_name';
+                }
 
-    // This is mandatory again
-    $rss_feed .= '</item>'."\n";
-}
+                switch ($key) {
+                    case 'module_status':
+                        $value = events_translate_module_status(
+                            $row[$key]
+                        );
+                    break;
 
-$rss_feed .= "</channel>\n</rss>\n";
+                    case 'event_type':
+                        $value = events_translate_event_type(
+                            $row[$key]
+                        );
+                    break;
 
-echo $rss_feed;
+                    case 'criticity':
+                        $value = events_translate_event_criticity(
+                            $row[$key]
+                        );
+                    break;
 
+                    default:
+                        $value = $row[$key];
+                    break;
+                }
 
-function xml_entities($str)
-{
-    if (!is_string($str)) {
-        return '';
-    }
+                $rss .= xml_entry($key, $value);
+            }
 
-    if (preg_match_all('/(&[^;]+;)/', $str, $matches) != 0) {
-        $matches = $matches[0];
-
-        foreach ($matches as $entity) {
-            $char = html_entity_decode($entity, (ENT_COMPAT | ENT_HTML401), 'UTF-8');
-
-            $html_entity_numeric = '&#'.uniord($char).';';
-
-            $str = str_replace($entity, $html_entity_numeric, $str);
+            $rss .= '</item>';
         }
+    } else {
+        $rss .= '<item><guid>'.xml_entities(io_safe_input($url.'/index.php?sec=eventos&sec2=operation/events/events')).'</guid><title>No results</title>';
+        $rss .= '<description>There are no results. Click on the link to see all Pending events</description>';
+        $rss .= '<link>'.xml_entities(io_safe_input($url.'/index.php?sec=eventos&sec2=operation/events/events')).'</link></item>'."\n";
     }
 
-    return $str;
+    $rss .= "</channel>\n</rss>\n";
+
+    echo $rss;
+} catch (Exception $e) {
+    echo rss_error_handler(200, 'Controlled error', '', '', $e->getMessage());
 }
 
-
-function uniord($u)
-{
-    $k = mb_convert_encoding($u, 'UCS-2LE', 'UTF-8');
-    $k1 = ord(substr($k, 0, 1));
-    $k2 = ord(substr($k, 1, 1));
-
-    return ($k2 * 256 + $k1);
+if ($reset_session) {
+    unset($config['id_user']);
 }
diff --git a/pandora_console/operation/events/export_csv.php b/pandora_console/operation/events/export_csv.php
index dbc20abb6a..0c16a16f9d 100644
--- a/pandora_console/operation/events/export_csv.php
+++ b/pandora_console/operation/events/export_csv.php
@@ -1,18 +1,34 @@
 <?php
+/**
+ * Event CSV exporter.
+ *
+ * @category   Event CSV export
+ * @package    Pandora FMS
+ * @subpackage Community
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
+
+// Load global vars.
+global $config;
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation for version 2.
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// Don't start a session before this import.
-// The session is configured and started inside the config process.
 require_once '../../include/config.php';
 require_once '../../include/auth/mysql.php';
 require_once '../../include/functions.php';
@@ -23,134 +39,165 @@ require_once '../../include/functions_groups.php';
 
 $config['id_user'] = $_SESSION['id_usuario'];
 
-if (! check_acl($config['id_user'], 0, 'ER') && ! check_acl($config['id_user'], 0, 'EW') && ! check_acl($config['id_user'], 0, 'EM')) {
+if (! check_acl($config['id_user'], 0, 'ER')
+    && ! check_acl($config['id_user'], 0, 'EW')
+    && ! check_acl($config['id_user'], 0, 'EM')
+) {
     exit;
 }
 
-global $config;
-
-// loading l10n tables, because of being invoked not through index.php.
+// Loading l10n tables, because of being invoked not through index.php.
 $l10n = null;
 if (file_exists($config['homedir'].'/include/languages/'.$user_language.'.mo')) {
-    $l10n = new gettext_reader(new CachedFileReader($config['homedir'].'/include/languages/'.$user_language.'.mo'));
+    $cfr = new CachedFileReader(
+        $config['homedir'].'/include/languages/'.$user_language.'.mo'
+    );
+    $l10n = new gettext_reader($cfr);
     $l10n->load_tables();
 }
 
-$offset = (int) get_parameter('offset');
-$id_group = (int) get_parameter('id_group');
-// group
-$event_type = (string) get_parameter('event_type', 'all');
-// 0 all
-$severity = (int) get_parameter('severity', -1);
-// -1 all
-$status = (int) get_parameter('status', -1);
-// -1 all, 0 only red, 1 only green
-$id_agent = (int) get_parameter('id_agent', -1);
+$column_names = [
+    'id_evento',
+    'evento',
+    'timestamp',
+    'estado',
+    'event_type',
+    'utimestamp',
+    'id_agente',
+    'agent_name',
+    'id_usuario',
+    'id_grupo',
+    'id_agentmodule',
+    'id_alert_am',
+    'criticity',
+    'user_comment',
+    'tags',
+    'source',
+    'id_extra',
+    'critical_instructions',
+    'warning_instructions',
+    'unknown_instructions',
+    'owner_user',
+    'ack_utimestamp',
+    'custom_data',
+    'data',
+    'module_status',
+];
 
-$id_event = (int) get_parameter('id_event', -1);
-$event_view_hr = (int) get_parameter('event_view_hr', $config['event_view_hr']);
-$id_user_ack = get_parameter('id_user_ack', 0);
-$search = io_safe_output(preg_replace('/&([A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/', '&', rawurldecode(get_parameter('search'))));
-$text_agent = (string) get_parameter('text_agent', __('All'));
-
-$tag_with_json = base64_decode(get_parameter('tag_with', ''));
-$tag_with_json_clean = io_safe_output($tag_with_json);
-$tag_with_base64 = base64_encode($tag_with_json_clean);
-$tag_with = json_decode($tag_with_json_clean, true);
-if (empty($tag_with)) {
-    $tag_with = [];
-}
-
-$tag_with = array_diff($tag_with, [0 => 0]);
-
-$tag_without_json = base64_decode(get_parameter('tag_without', ''));
-$tag_without_json_clean = io_safe_output($tag_without_json);
-$tag_without_base64 = base64_encode($tag_without_json_clean);
-$tag_without = json_decode($tag_without_json_clean, true);
-if (empty($tag_without)) {
-    $tag_without = [];
-}
-
-$tag_without = array_diff($tag_without, [0 => 0]);
-
-$filter_only_alert = (int) get_parameter('filter_only_alert', -1);
-
-//
-// Build the condition of the events query
-$sql_post = '';
-$meta = false;
-
-$id_user = $config['id_user'];
-
-require 'events.build_query.php';
-
-// Now $sql_post have all the where condition
-//
-switch ($config['dbtype']) {
-    case 'mysql':
-    case 'postgresql':
-    case 'oracle':
-        $sql = 'SELECT *
-			FROM tevento te
-			LEFT JOIN tagent_secondary_group tasg
-				ON te.id_grupo = tasg.id_group
-			WHERE 1=1 '.$sql_post.'
-			ORDER BY utimestamp DESC';
-    break;
-}
+$fields = [
+    'te.id_evento',
+    'te.evento',
+    'te.timestamp',
+    'te.estado',
+    'te.event_type',
+    'te.utimestamp',
+    'te.id_agente',
+    'ta.alias as agent_name',
+    'te.id_usuario',
+    'te.id_grupo',
+    'te.id_agentmodule',
+    'am.nombre as module_name',
+    'te.id_alert_am',
+    'te.criticity',
+    'te.user_comment',
+    'te.tags',
+    'te.source',
+    'te.id_extra',
+    'te.critical_instructions',
+    'te.warning_instructions',
+    'te.unknown_instructions',
+    'te.owner_user',
+    'te.ack_utimestamp',
+    'te.custom_data',
+    'te.data',
+    'te.module_status',
+    'tg.nombre as group_name',
+];
 
 $now = date('Y-m-d');
 
-// Show contentype header
+// Download header.
 header('Content-type: text/txt');
 header('Content-Disposition: attachment; filename="pandora_export_event'.$now.'.csv"');
 
-echo 'timestamp';
-echo $config['csv_divider'];
-echo 'agent';
-echo $config['csv_divider'];
-echo 'group';
-echo $config['csv_divider'];
-echo 'event';
-echo $config['csv_divider'];
-echo 'status';
-echo $config['csv_divider'];
-echo 'user';
-echo $config['csv_divider'];
-echo 'event_type';
-echo $config['csv_divider'];
-echo 'severity';
-echo $config['csv_divider'];
-echo 'id';
-echo chr(13);
-
-$new = true;
-while ($event = db_get_all_row_by_steps_sql($new, $result, $sql)) {
-    $new = false;
-    $alias = db_get_value('alias', 'tagente', 'id_agente', $event['id_agente']);
-    if ((!check_acl($config['id_user'], $event['id_grupo'], 'ER')
-        && !check_acl($config['id_user'], $event['id_grupo'], 'EW') && !check_acl($config['id_user'], $event['id_grupo'], 'EM') )
-        || (!check_acl($config['id_user'], 0, 'PM') && $event['event_type'] == 'system')
-    ) {
-        continue;
+try {
+    $fb64 = get_parameter('fb64', null);
+    $plain_filter = base64_decode($fb64);
+    $filter = json_decode($plain_filter, true);
+    if (json_last_error() != JSON_ERROR_NONE) {
+        throw new Exception('Invalid filter. ['.$plain_filter.']');
+    }
+
+    $names = events_get_column_names($column_names);
+
+    // Dump headers.
+    foreach ($names as $n) {
+        echo io_safe_output($n).$config['csv_divider'];
     }
 
-    echo date($config['date_format'], $event['utimestamp']);
-    echo $config['csv_divider'];
-    echo io_safe_output($alias);
-    echo $config['csv_divider'];
-    echo io_safe_output(groups_get_name($event['id_grupo']));
-    echo $config['csv_divider'];
-    echo io_safe_output($event['evento']);
-    echo $config['csv_divider'];
-    echo io_safe_output($event['estado']);
-    echo $config['csv_divider'];
-    echo io_safe_output($event['id_usuario']);
-    echo $config['csv_divider'];
-    echo io_safe_output($event['event_type']);
-    echo $config['csv_divider'];
-    echo $event['criticity'];
-    echo $config['csv_divider'];
-    echo $event['id_evento'];
     echo chr(13);
+
+    // Dump events.
+    $events_per_step = 1000;
+    $step = 0;
+    while (1) {
+        $events = events_get_all(
+            $fields,
+            $filter,
+            (($step++) * $events_per_step),
+            $events_per_step,
+            'desc',
+            'timestamp',
+            $filter['history']
+        );
+
+        if ($events === false) {
+            break;
+        }
+
+        foreach ($events as $row) {
+            foreach ($column_names as $val) {
+                $key = $val;
+                if ($val == 'id_grupo') {
+                    $key = 'group_name';
+                } else if ($val == 'id_agentmodule') {
+                    $key = 'module_name';
+                }
+
+                switch ($key) {
+                    case 'module_status':
+                        echo events_translate_module_status(
+                            $row[$key]
+                        );
+                    break;
+
+                    case 'event_type':
+                        echo events_translate_event_type(
+                            $row[$key]
+                        );
+                    break;
+
+                    case 'criticity':
+                        echo events_translate_event_criticity(
+                            $row[$key]
+                        );
+                    break;
+
+                    default:
+                        echo io_safe_output($row[$key]);
+                    break;
+                }
+
+                echo $config['csv_divider'];
+            }
+
+            echo chr(13);
+        }
+    }
+} catch (Exception $e) {
+    echo 'ERROR'.chr(13);
+    echo $e->getMessage();
+    exit;
 }
+
+exit;
diff --git a/pandora_console/operation/events/sound_events.php b/pandora_console/operation/events/sound_events.php
index 1bd1dcc444..6d337abc28 100644
--- a/pandora_console/operation/events/sound_events.php
+++ b/pandora_console/operation/events/sound_events.php
@@ -59,7 +59,7 @@ echo '</head>';
 echo "<body style='background-color: #494949; max-width: 550px; max-height: 400px; margin-top:40px;'>";
 echo "<h1 class='modalheaderh1'>".__('Sound console').'</h1>';
 
-$table = null;
+$table = new StdClass;
 $table->width = '100%';
 $table->styleTable = 'padding-left:16px; padding-right:16px; padding-top:16px;';
 $table->class = ' ';
@@ -82,7 +82,7 @@ $table->data[1][3] = html_print_textarea('events_fired', 200, 20, '', 'readonly=
 
 html_print_table($table);
 
-$table = null;
+$table = new StdClass;
 $table->width = '100%';
 $table->rowstyle[0] = 'text-align:center;';
 $table->styleTable = 'padding-top:16px;padding-bottom:16px;';
@@ -196,15 +196,15 @@ function forgetPreviousEvents() {
     var agents = $("#id_agents").val();
 
     jQuery.post ("../../ajax.php",
-        {"page" : "operation/events/events",
+        {"page" : "include/ajax/events",
             "get_events_fired": 1,
             "id_group": group,
-            "agents[]" : agents,
             "alert_fired": alert_fired,
             "critical": critical,
             "warning": warning,
             "unknown": unknown,
-            "id_row": id_row
+            "id_row": id_row,
+            "agents[]" : agents
         },
         function (data) {
             firedId = parseInt(data['fired']);
@@ -219,18 +219,17 @@ function forgetPreviousEvents() {
 
 function check_event() {
     var agents = $("#id_agents").val();
-    
     if (running) {
         jQuery.post ("../../ajax.php",
-            {"page" : "operation/events/events",
+            {"page" : "include/ajax/events",
                 "get_events_fired": 1,
                 "id_group": group,
-                "agents[]" : agents,
                 "alert_fired": alert_fired,
                 "critical": critical,
                 "warning": warning,
                 "unknown": unknown,
-                "id_row": id_row
+                "id_row": id_row,
+                "agents[]" : agents,
             },
             function (data) {
                 firedId = parseInt(data['fired']);
@@ -247,7 +246,6 @@ function check_event() {
                     $('audio').remove();
                     $('body').append("<audio src='../../" + data['sound'] + "' autoplay='true' hidden='true' loop='true'>");
                 }
-                
             },
             "json"
         );
diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php
index f52d830d14..936cb6a814 100644
--- a/pandora_console/operation/menu.php
+++ b/pandora_console/operation/menu.php
@@ -66,7 +66,7 @@ if (check_acl($config['id_user'], 0, 'AR')) {
     enterprise_hook('inventory_menu');
 
     if ($config['activate_netflow'] || $config['activate_nta']) {
-        $sub['network'] = [
+        $sub['network_traffic'] = [
             'text'    => __('Network'),
             'id'      => 'Network',
             'type'    => 'direct',
@@ -117,7 +117,7 @@ if (check_acl($config['id_user'], 0, 'AR')) {
             );
         }
 
-        $sub['network']['sub2'] = $netflow_sub;
+        $sub['network_traffic']['sub2'] = $netflow_sub;
     }
 
     if ($config['log_collector'] == 1) {
@@ -373,10 +373,36 @@ if (check_acl($config['id_user'], 0, 'ER')
         $pss = get_user_info($config['id_user']);
         $hashup = md5($config['id_user'].$pss['password']);
 
+        $user_filter = db_get_row_sql(
+            sprintf(
+                'SELECT f.id_filter, f.id_name
+                FROM tevent_filter f
+                INNER JOIN tusuario u
+                    ON u.default_event_filter=f.id_filter
+                WHERE u.id_user = "%s" ',
+                $config['id_user']
+            )
+        );
+        if ($user_filter !== false) {
+            $filter = events_get_event_filter($user_filter['id_filter']);
+        } else {
+            // Default.
+            $filter = [
+                'status'        => EVENT_NO_VALIDATED,
+                'event_view_hr' => $config['event_view_hr'],
+                'group_rep'     => 1,
+                'tag_with'      => [],
+                'tag_without'   => [],
+                'history'       => false,
+            ];
+        }
+
+        $fb64 = base64_encode(json_encode($filter));
+
         // RSS.
-        $sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure=']['text'] = __('RSS');
-        $sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure=']['id'] = 'RSS';
-        $sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&search=&event_type=&severity=-1&status=3&id_group=0&refr=0&id_agent=0&pagination=20&group_rep=1&event_view_hr=8&id_user_ack=0&tag_with=&tag_without=&filter_only_alert-1&offset=0&toogle_filter=no&filter_id=0&id_name=&id_group=0&history=0&section=list&open_filter=0&pure=']['type'] = 'direct';
+        $sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&fb64='.$fb64]['text'] = __('RSS');
+        $sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&fb64='.$fb64]['id'] = 'RSS';
+        $sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&fb64='.$fb64]['type'] = 'direct';
 
         // Marquee.
         $sub['operation/events/events_marquee.php']['text'] = __('Marquee');
diff --git a/pandora_console/operation/network/network_report.php b/pandora_console/operation/network/network_report.php
index c9f3edf408..d590e224fb 100644
--- a/pandora_console/operation/network/network_report.php
+++ b/pandora_console/operation/network/network_report.php
@@ -62,7 +62,7 @@ $style_period = ($is_period) ? '' : 'display: none;';
 
 // Build the table.
 $table = new stdClass();
-$table->class = 'databox';
+$table->class = 'databox filters';
 $table->styleTable = 'width: 100%';
 $table->data['0']['0'] = __('Data to show').'&nbsp;&nbsp;';
 $table->data['0']['0'] .= html_print_select(
diff --git a/pandora_console/operation/network/network_usage_map.php b/pandora_console/operation/network/network_usage_map.php
index 046cc1fcc4..764cd4eae3 100644
--- a/pandora_console/operation/network/network_usage_map.php
+++ b/pandora_console/operation/network/network_usage_map.php
@@ -67,7 +67,7 @@ $style_period = ($is_period) ? '' : 'display: none;';
 
 // Build the table.
 $table = new stdClass();
-$table->class = 'databox';
+$table->class = 'databox filters';
 $table->styleTable = 'width: 100%';
 
 $table->data['0']['0'] = '<div style="display: flex;">';
diff --git a/pandora_console/operation/reporting/custom_reporting.php b/pandora_console/operation/reporting/custom_reporting.php
index a5267a21bd..68ff8c80c0 100644
--- a/pandora_console/operation/reporting/custom_reporting.php
+++ b/pandora_console/operation/reporting/custom_reporting.php
@@ -36,7 +36,7 @@ $table->head[1] = __('Description');
 $table->head[2] = __('HTML');
 $table->head[3] = __('XML');
 
-enterprise_hook('load_custom_reporting_1');
+enterprise_hook('load_custom_reporting_1', [$table]);
 
 $table->align = [];
 $table->align[2] = 'center';
diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php
index 5e9dda1e57..e8431ddeb2 100755
--- a/pandora_console/operation/reporting/reporting_viewer.php
+++ b/pandora_console/operation/reporting/reporting_viewer.php
@@ -169,12 +169,12 @@ $table->rowspan[0][0] = 2;
 // Set initial conditions for these controls, later will be modified by javascript
 if (!$enable_init_date) {
     $table->style[1] = 'display: none';
-    $table->style[2] = 'display: ""';
+    $table->style[2] = 'display: flex;align-items: baseline;';
     $display_to = 'none';
     $display_item = '';
 } else {
-    $table->style[1] = 'display: ""';
-    $table->style[2] = 'display: ""';
+    $table->style[1] = 'display: "block"';
+    $table->style[2] = 'display: flex;align-items: baseline;';
     $display_to = '';
     $display_item = 'none';
 }
@@ -210,11 +210,11 @@ if ($html_enterprise !== ENTERPRISE_NOT_HOOK) {
 
 $table->data[0][1] .= '</div>';
 
-$table->data[1][1] = '<div style="float:left;padding-top:3px;">'.__('From').': </div>';
+$table->data[1][1] = '<div>'.__('From').': </div>';
 $table->data[1][1] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' ';
 $table->data[1][1] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' ';
-$table->data[1][2] = '<div style="float:left;padding-top:3px;display:'.$display_item.'" id="string_items">'.__('Items period before').':</div>';
-$table->data[1][2] .= '<div style="float:left;padding-top:3px;display:'.$display_to.'" id="string_to">'.__('to').':</div>';
+$table->data[1][2] = '<div style="display:'.$display_item.'" id="string_items">'.__('Items period before').':</div>';
+$table->data[1][2] .= '<div style="display:'.$display_to.'" id="string_to">'.__('to').':</div>';
 $table->data[1][2] .= html_print_input_text('date', $date, '', 12, 10, true).' ';
 $table->data[1][2] .= html_print_input_text('time', $time, '', 10, 7, true).' ';
 $table->data[1][2] .= html_print_submit_button(__('Update'), 'date_submit', false, 'class="sub next"', true);
diff --git a/pandora_console/operation/search_graphs.getdata.php b/pandora_console/operation/search_graphs.getdata.php
index aefd6e2073..4235ea40c6 100644
--- a/pandora_console/operation/search_graphs.getdata.php
+++ b/pandora_console/operation/search_graphs.getdata.php
@@ -26,6 +26,7 @@ if ($searchGraphs) {
     $usergraphs_id = array_keys($usergraphs);
 
     if (empty($usergraphs_id)) {
+        $totalGraphs = 0;
         return;
     }
 
@@ -37,13 +38,16 @@ if ($searchGraphs) {
         'id_graph',
         'name',
         'description',
+
     ];
 
     $totalGraphs = (int) db_get_value_filter('COUNT(id_graph) AS count', 'tgraph', $filter);
 
-    if (! $only_count && $totalGraphs > 0) {
+    if ($totalGraphs > 0) {
         $filter['limit'] = $config['block_size'];
         $filter['offset'] = (int) get_parameter('offset');
         $graphs = db_get_all_rows_filter('tgraph', $filter, $columns);
+    } else {
+        $totalGraphs = 0;
     }
 }
diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php
index ffc9d93f74..718fd45be5 100644
--- a/pandora_console/operation/search_main.php
+++ b/pandora_console/operation/search_main.php
@@ -20,9 +20,10 @@ $searchGraphs = check_acl($config['id_user'], 0, 'RR');
 $searchMaps = check_acl($config['id_user'], 0, 'RR');
 $searchReports = check_acl($config['id_user'], 0, 'RR');
 $searchUsers = check_acl($config['id_user'], 0, 'UM');
+$searchPolicies = check_acl($config['id_user'], 0, 'AW');
 $searchHelps = true;
 
-echo '<br><div style="margin:auto; width:90%; padding: 10px; background: #fff">';
+echo '<br><div style="margin:auto; width:90%; padding: 10px;">';
 
 $anyfound = false;
 
@@ -44,8 +45,12 @@ $table->style[9] = 'font-weight: bold; text-align: center;';
 $table->style[10] = 'font-weight: bold; text-align: center;';
 $table->style[11] = 'font-weight: bold; text-align: center;';
 $table->style[13] = 'font-weight: bold; text-align: center;';
+$table->style[14] = 'font-weight: bold; text-align: center;';
 $table->style[15] = 'font-weight: bold; text-align: center;';
 
+
+
+
 $table->data[0][0] = html_print_image('images/agent.png', true, ['title' => __('Agents found')]);
 $table->data[0][1] = "<a href='index.php?search_category=agents&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalAgents).'</a>';
 $table->data[0][2] = html_print_image('images/module.png', true, ['title' => __('Modules found')]);
@@ -64,8 +69,10 @@ $table->data[0][10] = html_print_image('images/reporting.png', true, ['title' =>
 $table->data[0][11] = "<a href='index.php?search_category=reports&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalReports).'</a>';
 $table->data[0][12] = html_print_image('images/visual_console_green.png', true, ['title' => __('Maps found')]);
 $table->data[0][13] = "<a href='index.php?search_category=maps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalMaps).'</a>';
-$table->data[0][14] = html_print_image('images/help.png', true, ['title' => __('Helps found')]);
-$table->data[0][15] = "<a href='index.php?search_category=helps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalHelps).'</a>';
+if (enterprise_installed()) {
+    $table->data[0][14] = html_print_image('images/policies.png', true, ['title' => __('Policies')]);
+    $table->data[0][15] = "<a href='index.php?search_category=policies&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalPolicies).'</a>';
+}
 
 html_print_table($table);
 
@@ -79,4 +86,5 @@ if ($searchAgents && $totalAgents > 0) {
     ).'</a>';
 }
 
+
 echo '</div>';
diff --git a/pandora_console/operation/search_policies.getdata.php b/pandora_console/operation/search_policies.getdata.php
new file mode 100644
index 0000000000..5186f1f0a9
--- /dev/null
+++ b/pandora_console/operation/search_policies.getdata.php
@@ -0,0 +1,200 @@
+<?php
+
+// Pandora FMS - http://pandorafms.com
+// ==================================================
+// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
+// Please see http://pandorafms.org for full contribution list
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+global $config;
+
+enterprise_include_once('include/functions_policies.php');
+
+
+$searchpolicies = check_acl($config['id_user'], 0, 'AW');
+
+$selectpolicieIDUp = '';
+$selectpolicieIDDown = '';
+$selectNameUp = '';
+$selectNameDown = '';
+$selectDescriptionUp = '';
+$selectDescriptionDown = '';
+$selectId_groupUp = '';
+$selectId_groupDown = '';
+$selectStatusUp = '';
+$selectStatusDown = '';
+
+switch ($sortField) {
+    case 'id':
+        switch ($sort) {
+            case 'up':
+                $selectpolicieIDUp = $selected;
+                $order = [
+                    'field' => 'id',
+                    'order' => 'ASC',
+                ];
+            break;
+
+            case 'down':
+                $selectpolicieIDDown = $selected;
+                $order = [
+                    'field' => 'id',
+                    'order' => 'DESC',
+                ];
+            break;
+        }
+    break;
+
+    case 'name':
+        switch ($sort) {
+            case 'up':
+                $selectNameUp = $selected;
+                $order = [
+                    'field' => 'name',
+                    'order' => 'ASC',
+                ];
+            break;
+
+            case 'down':
+                $selectNameDown = $selected;
+                $order = [
+                    'field' => 'name',
+                    'order' => 'DESC',
+                ];
+            break;
+        }
+    break;
+
+    case 'description':
+        switch ($sort) {
+            case 'up':
+                $selectId_groupUp = $selected;
+                $order = [
+                    'field' => 'description',
+                    'order' => 'ASC',
+                ];
+            break;
+
+            case 'down':
+                $selectDescriptionDown = $selected;
+                $order = [
+                    'field' => 'description',
+                    'order' => 'DESC',
+                ];
+            break;
+        }
+    break;
+
+    case 'last_contact':
+        switch ($sort) {
+            case 'up':
+                $selectId_groupUp = $selected;
+                $order = [
+                    'field' => 'last_connect',
+                    'order' => 'ASC',
+                ];
+            break;
+
+            case 'down':
+                $selectId_groupDown = $selected;
+                $order = [
+                    'field' => 'last_connect',
+                    'order' => 'DESC',
+                ];
+            break;
+        }
+    break;
+
+    case 'id_group':
+        switch ($sort) {
+            case 'up':
+                $selectId_groupUp = $selected;
+                $order = [
+                    'field' => 'last_connect',
+                    'order' => 'ASC',
+                ];
+            break;
+
+            case 'down':
+                $selectId_groupDown = $selected;
+                $order = [
+                    'field' => 'last_connect',
+                    'order' => 'DESC',
+                ];
+            break;
+        }
+    break;
+
+    case 'status':
+        switch ($sort) {
+            case 'up':
+                $selectStatusUp = $selected;
+                $order = [
+                    'field' => 'is_admin',
+                    'order' => 'ASC',
+                ];
+            break;
+
+            case 'down':
+                $selectStatusDown = $selected;
+                $order = [
+                    'field' => 'is_admin',
+                    'order' => 'DESC',
+                ];
+            break;
+        }
+    break;
+
+    default:
+        $selectpolicieIDUp = $selected;
+        $selectpolicieIDDown = '';
+        $selectNameUp = '';
+        $selectNameDown = '';
+        $selectDescriptionUp = '';
+        $selectDescriptionDown = '';
+        $selectId_groupUp = '';
+        $selectId_groupDown = '';
+        $selectStatusUp = '';
+        $selectStatusDown = '';
+
+        $order = [
+            'field' => 'id',
+            'order' => 'ASC',
+        ];
+    break;
+}
+
+if ($searchpolicies == 0) {
+    /*
+        We take the user groups to get policies that meet the requirements of the search
+        and which the user have permission on this groups
+    */
+    $user_groups = users_get_groups($config['id_user'], 'AR', false);
+    $id_user_groups = array_keys($user_groups);
+    $id_user_groups_str = implode(',', $id_user_groups);
+
+            $sql = "SELECT id, name, description, id_group, status
+					FROM tpolicies 
+					WHERE name LIKE '$stringSearchSQL'
+                    AND id_group IN ($id_user_groups_str)";
+}
+
+
+        $sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0);
+
+    $policies = db_process_sql($sql);
+
+if ($policies !== false) {
+    $totalPolicies = count($policies);
+
+    if ($only_count) {
+        unset($policies);
+    }
+} else {
+    $totalPolicies = 0;
+}
diff --git a/pandora_console/operation/search_policies.php b/pandora_console/operation/search_policies.php
new file mode 100644
index 0000000000..26b3f7737d
--- /dev/null
+++ b/pandora_console/operation/search_policies.php
@@ -0,0 +1,90 @@
+<?php
+
+// Pandora FMS - http://pandorafms.com
+// ==================================================
+// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
+// Please see http://pandorafms.org for full contribution list
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+global $config;
+
+enterprise_include_once('include/functions_policies.php');
+require_once $config['homedir'].'/enterprise/include/functions_groups.php';
+
+$searchpolicies = check_acl($config['id_user'], 0, 'AW');
+
+if (!$policies || !$searchpolicies) {
+    echo "<br><div class='nf'>".__('Zero results found')."</div>\n";
+} else {
+    $table->cellpadding = 4;
+    $table->cellspacing = 4;
+    $table->width = '98%';
+    $table->class = 'databox';
+
+    $table->align = [];
+    $table->align[4] = 'center';
+
+    $table->head = [];
+    // $table->head[0] = __('ID').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=id_policie&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectpolicieIDUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=id_policie&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectpolicieIDDown]).'</a>';
+    $table->head[0] = __('Name').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).'</a>';
+    $table->head[1] = __('Description').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=description&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectDescriptionUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=description&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectDescriptionDown]).'</a>';
+    $table->head[2] = __('Id_group').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectId_groupUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectId_groupDown]).'</a>';
+    $table->head[3] = __('Status').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=status&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectStatusUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=status&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectstatusDown]).'</a>';
+
+    $table->data = [];
+
+    foreach ($policies as $policie) {
+        $policieIDCell = "<a href='?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=".$policies['id']."'>".$policies['id'].'</a>';
+
+        switch ($policie['status']) {
+            case POLICY_UPDATED:
+                $status = html_print_image(
+                    'images/policies_ok.png',
+                    true,
+                    ['title' => __('Policy updated')]
+                );
+            break;
+
+            case POLICY_PENDING_DATABASE:
+                $status = html_print_image(
+                    'images/policies_error_db.png',
+                    true,
+                    ['title' => __('Pending update policy only database')]
+                );
+            break;
+
+            case POLICY_PENDING_ALL:
+                $status = html_print_image(
+                    'images/policies_error.png',
+                    true,
+                    ['title' => __('Pending update policy')]
+                );
+            break;
+        }
+
+        $url = $config['homeurl'].'/index.php?'.'sec=gmodules&'.'sec2=enterprise/godmode/policies/policies&id='.$policie['id'].'';
+
+        array_push(
+            $table->data,
+            [
+                // $policie['id'],
+                '<a href= '.$url.'>'.$policie['name'].'',
+                $policie['description'],
+                ui_print_group_icon($policie['id_group'], true),
+                $status,
+
+            ]
+        );
+    }
+
+    $totalPolicies = count($policies);
+    echo '<br />';
+    html_print_table($table);
+    unset($table);
+    ui_pagination($totalPolicies);
+}
diff --git a/pandora_console/operation/search_reports.php b/pandora_console/operation/search_reports.php
index 668f6f717b..a3b95357a3 100755
--- a/pandora_console/operation/search_reports.php
+++ b/pandora_console/operation/search_reports.php
@@ -35,7 +35,7 @@ if ($reports === false || !$searchReports) {
     $table->head[1] = __('Description');
     $table->head[2] = __('HTML');
     $table->head[3] = __('XML');
-    enterprise_hook('load_custom_reporting_1');
+    enterprise_hook('load_custom_reporting_1', [$table]);
 
     $table->align = [];
     $table->align[2] = 'center';
diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php
index d59e6908cb..803a92cdd1 100644
--- a/pandora_console/operation/search_results.php
+++ b/pandora_console/operation/search_results.php
@@ -18,7 +18,7 @@ require_once $config['homedir'].'/include/functions_reporting.php';
 enterprise_include('operation/reporting/custom_reporting.php');
 
 $searchAgents = $searchAlerts = $searchModules = check_acl($config['id_user'], 0, 'AR');
-$searchUsers = check_acl($config['id_user'], 0, 'UM');
+$searchUsers = $searchPolicies = check_acl($config['id_user'], 0, 'AW');
 $searchMaps = $searchReports = $searchGraphs = check_acl($config['id_user'], 0, 'IR');
 $searchMain = true;
 $searchHelps = true;
@@ -43,6 +43,7 @@ if ($config['search_category'] == 'all') {
 // INI SECURITY ACL
 if ((!$searchAgents && !$searchUsers && !$searchMaps)
     || (!$searchUsers && $searchTab == 'users')
+    || (!$searchPolicies && $searchTab == 'policies')
     || (!$searchAgents && ($searchTab == 'agents' || $searchTab == 'alerts'))
     || (!$searchGraphs && ($searchTab == 'graphs' || $searchTab == 'maps' || $searchTab == 'reports'))
 ) {
@@ -161,29 +162,29 @@ if ($searchModules) {
     $modules_tab = '';
 }
 
-if ($searchHelps) {
-    $helps_tab = [
-        'text'   => "<a href='index.php?search_category=helps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".html_print_image(
-            'images/help_w.png',
+if ($searchPolicies) {
+    $policies_tab = [
+        'text'   => "<a href='index.php?search_category=policies&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".html_print_image(
+            'images/policies.png',
             true,
-            ['title' => __('Helps')]
+            ['title' => __('Policies')]
         ).'</a>',
-        'active' => $searchTab == 'helps',
+        'active' => $searchTab == 'policies',
     ];
 } else {
-    $helps_tab = '';
+    $policies_tab = '';
 }
 
 $onheader = [
-    'main'    => $main_tab,
-    'agents'  => $agents_tab,
-    'modules' => $modules_tab,
-    'alerts'  => $alerts_tab,
-    'users'   => $users_tab,
-    'graphs'  => $graphs_tab,
-    'reports' => $reports_tab,
-    'maps'    => $maps_tab,
-    'helps'   => $helps_tab,
+    'main'     => $main_tab,
+    'agents'   => $agents_tab,
+    'modules'  => $modules_tab,
+    'alerts'   => $alerts_tab,
+    'users'    => $users_tab,
+    'graphs'   => $graphs_tab,
+    'reports'  => $reports_tab,
+    'maps'     => $maps_tab,
+    'policies' => $policies_tab,
 ];
 
 ui_print_page_header(
@@ -212,6 +213,7 @@ switch ($searchTab) {
         include_once 'search_maps.getdata.php';
         include_once 'search_modules.getdata.php';
         include_once 'search_helps.getdata.php';
+        include_once 'search_policies.getdata.php';
 
         include_once 'search_main.php';
     break;
@@ -251,8 +253,9 @@ switch ($searchTab) {
         include_once 'search_modules.php';
     break;
 
-    case 'helps':
-        include_once 'search_helps.getdata.php';
-        include_once 'search_helps.php';
+    case 'policies':
+        include_once 'search_policies.getdata.php';
+        include_once 'search_policies.php';
+
     break;
 }
diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php
index cb72a91ecd..677a7a625a 100755
--- a/pandora_console/operation/snmpconsole/snmp_view.php
+++ b/pandora_console/operation/snmpconsole/snmp_view.php
@@ -1,17 +1,31 @@
 <?php
+/**
+ * SNMP Console.
+ *
+ * @category   SNMP
+ * @package    Pandora FMS
+ * @subpackage Community
+ * @version    1.0.0
+ * @license    See below
+ *
+ *    ______                 ___                    _______ _______ ________
+ *   |   __ \.-----.--.--.--|  |.-----.----.-----. |    ___|   |   |     __|
+ *  |    __/|  _  |     |  _  ||  _  |   _|  _  | |    ___|       |__     |
+ * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
+ *
+ * ============================================================================
+ * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
+ * Please see http://pandorafms.org for full contribution list
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation for version 2.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ============================================================================
+ */
 
-// Pandora FMS - http://pandorafms.com
-// ==================================================
-// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
-// Please see http://pandorafms.org for full contribution list
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation for version 2.
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// Load global vars
 global $config;
 enterprise_include('operation/snmpconsole/snmp_view.php');
 enterprise_include('include/functions_snmp.php');
@@ -31,7 +45,7 @@ if (!$agent_a && !$agent_w) {
     exit;
 }
 
-// Read parameters
+// Read parameters.
 $filter_severity = (int) get_parameter('filter_severity', -1);
 $filter_fired = (int) get_parameter('filter_fired', -1);
 $filter_status = (int) get_parameter('filter_status', 0);
@@ -61,7 +75,7 @@ foreach ($user_groups as $id => $name) {
     $i++;
 }
 
-$url = 'index.php?sec=estado&'.'sec2=operation/snmpconsole/snmp_view&'.'filter_severity='.$filter_severity.'&'.'filter_fired='.$filter_fired.'&'.'free_search_string='.$free_search_string.'&'.'pagination='.$pagination.'&'.'offset='.$offset.'&'.'trap_type='.$trap_type.'&'.'group_by='.$group_by.'&'.'date_from_trap='.$date_from_trap.'&'.'date_to_trap='.$date_to_trap.'&'.'time_from_trap='.$time_from_trap.'&'.'time_to_trap='.$time_to_trap;
+$url = 'index.php?sec=estado&sec2=operation/snmpconsole/snmp_view&filter_severity='.$filter_severity.'&filter_fired='.$filter_fired.'&free_search_string='.$free_search_string.'&pagination='.$pagination.'&offset='.$offset.'&trap_type='.$trap_type.'&group_by='.$group_by.'&date_from_trap='.$date_from_trap.'&date_to_trap='.$date_to_trap.'&time_from_trap='.$time_from_trap.'&time_to_trap='.$time_to_trap;
 
 $statistics['text'] = '<a href="index.php?sec=estado&sec2=operation/snmpconsole/snmp_statistics&pure='.$config['pure'].'&refr='.$refr.'">'.html_print_image('images/op_reporting.png', true, ['title' => __('Statistics')]).'</a>';
 $list['text'] = '<a href="'.$url.'&pure='.$config['pure'].'&refresh='.$refr.'">'.html_print_image('images/op_snmp.png', true, ['title' => __('List')]).'</a>';
@@ -70,7 +84,7 @@ $list['active'] = true;
 if ($config['pure']) {
     $fullscreen['text'] = '<a target="_top" href="'.$url.'&pure=0&refresh='.$refr.'">'.html_print_image('images/normal_screen.png', true, ['title' => __('Normal screen')]).'</a>';
 } else {
-    // Fullscreen
+    // Fullscreen.
     $fullscreen['text'] = '<a target="_top" href="'.$url.'&pure=1&refresh='.$refr.'">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).'</a>';
 }
 
@@ -131,7 +145,7 @@ if (isset($_GET['check'])) {
     }
 }
 
-// Mass-process DELETE
+// Mass-process DELETE.
 if (isset($_POST['deletebt'])) {
     $trap_ids = get_parameter_post('snmptrapid', []);
     if (is_array($trap_ids) && check_acl($config['id_user'], 0, 'IW')) {
@@ -161,7 +175,7 @@ if (isset($_POST['deletebt'])) {
     }
 }
 
-// Mass-process UPDATE
+// Mass-process UPDATE.
 if (isset($_POST['updatebt'])) {
     $trap_ids = get_parameter_post('snmptrapid', []);
     if (is_array($trap_ids) && check_acl($config['id_user'], 0, 'IW')) {
@@ -178,14 +192,14 @@ if (isset($_POST['updatebt'])) {
     }
 }
 
-// All traps
+// All traps.
 $all_traps = db_get_all_rows_sql('SELECT DISTINCT source FROM ttrap');
 
 if (empty($all_traps)) {
     $all_traps = [];
 }
 
-// Set filters
+// Set filters.
 $agents = [];
 $oids = [];
 $severities = get_priorities();
@@ -206,7 +220,7 @@ foreach ($all_traps as $trap) {
 
 $prea = array_keys($user_groups);
 $ids = join(',', $prea);
-// Cuantos usuarios hay operadores con un grupo que exista y no lo tenga ningun usuario
+// Cuantos usuarios hay operadores con un grupo que exista y no lo tenga ningun usuario.
 $user_in_group_wo_agents = db_get_value_sql('select count(DISTINCT(id_usuario)) from tusuario_perfil where id_usuario ="'.$config['id_user'].'" and id_perfil = 1 and id_grupo in (select id_grupo from tgrupo where id_grupo in ('.$ids.') and id_grupo not in (select id_grupo from tagente))');
 
 switch ($config['dbtype']) {
@@ -244,6 +258,10 @@ switch ($config['dbtype']) {
             }
         }
     break;
+
+    default:
+        // Default.
+    break;
 }
 
 if (empty($address_by_user_groups)) {
@@ -293,6 +311,10 @@ switch ($config['dbtype']) {
 					) OR source='' OR source NOT IN (SELECT direccion FROM tagente WHERE direccion IS NOT NULL)) %s
 			ORDER BY timestamp DESC";
     break;
+
+    default:
+         // Default.
+    break;
 }
 
 switch ($config['dbtype']) {
@@ -335,6 +357,10 @@ switch ($config['dbtype']) {
 					) OR source='' OR source NOT IN (SELECT direccion FROM tagente WHERE direccion IS NOT NULL))
 				%s";
     break;
+
+    default:
+         // Default.
+    break;
 }
 
 // $whereSubquery = 'WHERE 1=1';
@@ -372,6 +398,10 @@ if ($free_search_string != '') {
 				text LIKE \'%'.$free_search_string.'%\' OR
 				description LIKE \'%'.$free_search_string.'%\')';
         break;
+
+        default:
+             // Default.
+        break;
     }
 }
 
@@ -422,7 +452,7 @@ if ($trap_type == 5) {
     $whereSubquery .= ' AND type = '.$trap_type;
 }
 
-// Disable this feature (time will decide if temporarily) in Oracle cause the group by is very confictive
+// Disable this feature (time will decide if temporarily) in Oracle cause the group by is very confictive.
 if ($group_by && $config['dbtype'] != 'oracle') {
     $where_without_group = $whereSubquery;
     $whereSubquery .= ' GROUP BY source,oid';
@@ -444,6 +474,10 @@ switch ($config['dbtype']) {
         $sql = sprintf($sql, $whereSubquery);
         $sql = oracle_recode_query($sql, $set);
     break;
+
+    default:
+        // Default.
+    break;
 }
 
 $sql_all = sprintf($sql_all, $whereSubquery);
@@ -458,7 +492,7 @@ $table->size = [];
 $table->size[0] = '120px';
 $table->data = [];
 
-// Alert status select
+// Alert status select.
 $table->data[1][0] = '<strong>'.__('Alert').'</strong>';
 $table->data[1][1] = html_print_select(
     $alerted,
@@ -470,7 +504,7 @@ $table->data[1][1] = html_print_select(
     true
 );
 
-// Block size for pagination select
+// Block size for pagination select.
 $table->data[2][0] = '<strong>'.__('Block size for pagination').'</strong>';
 $paginations[25] = 25;
 $paginations[50] = 50;
@@ -487,7 +521,7 @@ $table->data[2][1] = html_print_select(
     true
 );
 
-// Severity select
+// Severity select.
 $table->data[1][2] = '<strong>'.__('Severity').'</strong>';
 $table->data[1][3] = html_print_select(
     $severities,
@@ -499,7 +533,7 @@ $table->data[1][3] = html_print_select(
     true
 );
 
-// Status
+// Status.
 $table->data[3][0] = '<strong>'.__('Status').'</strong>';
 
 $status_array[-1] = __('All');
@@ -515,7 +549,7 @@ $table->data[3][1] = html_print_select(
     true
 );
 
-// Free search (search by all alphanumeric fields)
+// Free search (search by all alphanumeric fields).
 $table->data[2][3] = '<strong>'.__('Free search').'</strong>'.ui_print_help_tip(
     __(
         'Search by any alphanumeric field in the trap.
@@ -542,7 +576,7 @@ $table->data[5][1] = html_print_input_text('time_from_trap', $time_from_trap, fa
 $table->data[5][2] = '<strong>'.__('To (Time)').'</strong>';
 $table->data[5][3] = html_print_input_text('time_to_trap', $time_to_trap, false, 15, 10, true);
 
-// Type filter (ColdStart, WarmStart, LinkDown, LinkUp, authenticationFailure, Other)
+// Type filter (ColdStart, WarmStart, LinkDown, LinkUp, authenticationFailure, Other).
 $table->data[6][1] = '<strong>'.__('Trap type').'</strong>'.ui_print_help_tip(__('Search by trap type'), true);
 $trap_types = [
     -1 => __('None'),
@@ -565,14 +599,14 @@ $table->data[6][2] = html_print_select(
     false
 );
 
-// Disable this feature (time will decide if temporarily) in Oracle cause the group by is very confictive
+// Disable this feature (time will decide if temporarily) in Oracle cause the group by is very confictive.
 if ($config['dbtype'] != 'oracle') {
     $table->data[3][3] = '<strong>'.__('Group by Enterprise String/IP').'</strong>';
     $table->data[3][4] = __('Yes').'&nbsp;'.html_print_radio_button('group_by', 1, '', $group_by, true).'&nbsp;&nbsp;';
     $table->data[3][4] .= __('No').'&nbsp;'.html_print_radio_button('group_by', 0, '', $group_by, true);
 }
 
-$filter = '<form method="POST" action="index.php?'.'sec=snmpconsole&'.'sec2=operation/snmpconsole/snmp_view&'.'refresh='.((int) get_parameter('refresh', 0)).'&'.'pure='.$config['pure'].'">';
+$filter = '<form method="POST" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&refresh='.((int) get_parameter('refresh', 0)).'&pure='.$config['pure'].'">';
 $filter .= html_print_table($table, true);
 $filter .= '<div style="width: '.$table->width.'; text-align: right;">';
 $filter .= html_print_submit_button(__('Update'), 'search', false, 'class="sub upd"', true);
@@ -595,9 +629,9 @@ $filter_resume['trap_type'] = $trap_types[$trap_type];
 $traps = db_get_all_rows_sql($sql);
 $trapcount = (int) db_get_value_sql($sql_count);
 
-// No traps
+// No traps.
 if (empty($traps)) {
-    // Header
+    // Header.
     ui_print_page_header(
         __('SNMP Console'),
         'images/op_snmp.png',
@@ -638,24 +672,24 @@ if (empty($traps)) {
 
         echo '<div id="menu_tab">';
         echo '<ul class="mn">';
-        // Normal view button
+        // Normal view button.
         echo '<li class="nomn">';
-        $normal_url = 'index.php?'.'sec=snmpconsole&'.'sec2=operation/snmpconsole/snmp_view&'.'filter_severity='.$filter_severity.'&'.'filter_fired='.$filter_fired.'&'.'filter_status='.$filter_status.'&'.'refresh='.((int) get_parameter('refresh', 0)).'&'.'pure=0&'.'trap_type='.$trap_type.'&'.'group_by='.$group_by.'&'.'free_search_string='.$free_search_string.'&'.'date_from_trap='.$date_from_trap.'&'.'date_to_trap='.$date_to_trap.'&'.'time_from_trap='.$time_from_trap.'&'.'time_to_trap='.$time_to_trap;
+        $normal_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_severity='.$filter_severity.'&filter_fired='.$filter_fired.'&filter_status='.$filter_status.'&refresh='.((int) get_parameter('refresh', 0)).'&pure=0&trap_type='.$trap_type.'&group_by='.$group_by.'&free_search_string='.$free_search_string.'&date_from_trap='.$date_from_trap.'&date_to_trap='.$date_to_trap.'&time_from_trap='.$time_from_trap.'&time_to_trap='.$time_to_trap;
 
-        $urlPagination = $normal_url.'&'.'pagination='.$pagination.'&'.'offset='.$offset;
+        $urlPagination = $normal_url.'&pagination='.$pagination.'&offset='.$offset;
 
         echo '<a href="'.$urlPagination.'">';
         echo html_print_image('images/normal_screen.png', true, ['title' => __('Exit fullscreen')]);
         echo '</a>';
         echo '</li>';
 
-        // Auto refresh control
+        // Auto refresh control.
         echo '<li class="nomn">';
         echo '<div class="dashboard-refr" style="margin-top: 6px;">';
         echo '<div class="dashboard-countdown" style="display: inline;"></div>';
-        $normal_url = 'index.php?'.'sec=snmpconsole&'.'sec2=operation/snmpconsole/snmp_view&'.'filter_severity='.$filter_severity.'&'.'filter_fired='.$filter_fired.'&'.'filter_status='.$filter_status.'&'.'refresh='.((int) get_parameter('refresh', 0)).'&'.'pure=1&'.'trap_type='.$trap_type.'&'.'group_by='.$group_by.'&'.'free_search_string='.$free_search_string.'&'.'date_from_trap='.$date_from_trap.'&'.'date_to_trap='.$date_to_trap.'&'.'time_from_trap='.$time_from_trap.'&'.'time_to_trap='.$time_to_trap;
+        $normal_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_severity='.$filter_severity.'&filter_fired='.$filter_fired.'&filter_status='.$filter_status.'&refresh='.((int) get_parameter('refresh', 0)).'&pure=1&trap_type='.$trap_type.'&group_by='.$group_by.'&free_search_string='.$free_search_string.'&date_from_trap='.$date_from_trap.'&date_to_trap='.$date_to_trap.'&time_from_trap='.$time_from_trap.'&time_to_trap='.$time_to_trap;
 
-        $urlPagination = $normal_url.'&'.'pagination='.$pagination.'&'.'offset='.$offset;
+        $urlPagination = $normal_url.'&pagination='.$pagination.'&offset='.$offset;
 
 
         echo '<form id="refr-form" method="get" action="'.$urlPagination.'" style="display: inline;">';
@@ -669,7 +703,7 @@ if (empty($traps)) {
         html_print_input_hidden('pure', 1);
         html_print_input_hidden('refresh', ($refr > 0 ? $refr : $default_refr));
 
-        // Dashboard name
+        // Dashboard name.
         echo '<li class="nomn">';
         echo '<div class="dashboard-title">'.__('SNMP Traps').'</div>';
         echo '</li>';
@@ -688,7 +722,7 @@ if (empty($traps)) {
         ui_require_javascript_file('wz_jsgraphics');
         ui_require_javascript_file('pandora_visual_console');
     } else {
-        // Header
+        // Header.
         ui_print_page_header(
             __('SNMP Console'),
             'images/op_snmp.png',
@@ -710,18 +744,19 @@ unset($table);
 print_snmp_tags_active_filters($filter_resume);
 
 if (($config['dbtype'] == 'oracle') && ($traps !== false)) {
-    for ($i = 0; $i < count($traps); $i++) {
+    $traps_size = count($traps);
+    for ($i = 0; $i < $traps_size; $i++) {
         unset($traps[$i]['rnum']);
     }
 }
 
-$url_snmp = 'index.php?'.'sec=snmpconsole&'.'sec2=operation/snmpconsole/snmp_view&'.'filter_severity='.$filter_severity.'&'.'filter_fired='.$filter_fired.'&'.'filter_status='.$filter_status.'&'.'refresh='.((int) get_parameter('refresh', 0)).'&'.'pure='.$config['pure'].'&'.'trap_type='.$trap_type.'&'.'group_by='.$group_by.'&'.'free_search_string='.$free_search_string.'&'.'date_from_trap='.$date_from_trap.'&'.'date_to_trap='.$date_to_trap.'&'.'time_from_trap='.$time_from_trap.'&'.'time_to_trap='.$time_to_trap;
+$url_snmp = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_severity='.$filter_severity.'&filter_fired='.$filter_fired.'&filter_status='.$filter_status.'&refresh='.((int) get_parameter('refresh', 0)).'&pure='.$config['pure'].'&trap_type='.$trap_type.'&group_by='.$group_by.'&free_search_string='.$free_search_string.'&date_from_trap='.$date_from_trap.'&date_to_trap='.$date_to_trap.'&time_from_trap='.$time_from_trap.'&time_to_trap='.$time_to_trap;
 
-$urlPagination = $url_snmp.'&'.'pagination='.$pagination.'&'.'offset='.$offset;
+$urlPagination = $url_snmp.'&pagination='.$pagination.'&offset='.$offset;
 
 ui_pagination($trapcount, $urlPagination, $offset, $pagination);
 
-echo '<form name="eventtable" method="POST" action="'.$url_snmp.'">';
+echo '<form name="eventtable" method="POST" action="'.$urlPagination.'">';
 
 $table->cellpadding = 0;
 $table->cellspacing = 0;
@@ -778,7 +813,7 @@ $table->headstyle[7] = 'text-align: center';
 $table->head[8] = __('Action');
 $table->align[8] = 'center';
 $table->size[8] = '10%';
-$table->headstyle[8] = 'text-align: center';
+$table->headstyle[8] = 'min-width: 125px;text-align: center';
 
 $table->head[9] = html_print_checkbox_extended(
     'allbox',
@@ -795,7 +830,7 @@ $table->headstyle[9] = 'text-align: center';
 
 $table->style[8] = 'background: #F3F3F3; color: #111 !important;';
 
-// Skip offset records
+// Skip offset records.
 $idx = 0;
 if ($traps !== false) {
     foreach ($traps as $trap) {
@@ -809,7 +844,7 @@ if ($traps !== false) {
             $severity = $trap['alerted'] == 1 ? $trap['priority'] : 1;
         }
 
-        // Status
+        // Status.
         if ($trap['status'] == 0) {
             $data[0] = html_print_image(
                 'images/pixel_red.png',
@@ -832,7 +867,7 @@ if ($traps !== false) {
             );
         }
 
-        // Agent matching source address
+        // Agent matching source address.
         $table->cellclass[$idx][1] = get_priority_class($severity);
         $agent = agents_get_agent_with_ip($trap['source']);
         if ($agent === false) {
@@ -851,7 +886,7 @@ if ($traps !== false) {
             '</strong></a>';
         }
 
-        // OID
+        // OID.
         $table->cellclass[$idx][2] = get_priority_class($severity);
         if (! empty($trap['text'])) {
             $enterprise_string = $trap['text'];
@@ -863,7 +898,7 @@ if ($traps !== false) {
 
         $data[2] = '<a href="javascript: toggleVisibleExtendedInfo('.$trap['id_trap'].');">'.$enterprise_string.'</a>';
 
-        // Count
+        // Count.
         if ($group_by) {
             $sql = "SELECT * FROM ttrap WHERE 1=1 
 					$where_without_group
@@ -875,7 +910,7 @@ if ($traps !== false) {
             $data[3] = '<strong>'.$count_group_traps.'</strong></a>';
         }
 
-        // Value
+        // Value.
         $table->cellclass[$idx][4] = get_priority_class($severity);
         if (empty($trap['value'])) {
             $data[4] = __('N/A');
@@ -883,7 +918,7 @@ if ($traps !== false) {
             $data[4] = ui_print_truncate_text($trap['value'], GENERIC_SIZE_TEXT, false);
         }
 
-        // User
+        // User.
         $table->cellclass[$idx][5] = get_priority_class($severity);
         if (!empty($trap['status'])) {
             $data[5] = '<a href="index.php?sec=workspace&sec2=operation/users/user_edit&ver='.$trap['id_usuario'].'">'.substr($trap['id_usuario'], 0, 8).'</a>';
@@ -894,35 +929,35 @@ if ($traps !== false) {
             $data[5] = '--';
         }
 
-        // Timestamp
+        // Timestamp.
         $table->cellclass[$idx][6] = get_priority_class($severity);
         $data[6] = '<span title="'.$trap['timestamp'].'">';
         $data[6] .= ui_print_timestamp($trap['timestamp'], true);
         $data[6] .= '</span>';
 
-        // Use alert severity if fired
+        // Use alert severity if fired.
         if (!empty($trap['alerted'])) {
             $data[7] = html_print_image('images/pixel_yellow.png', true, ['width' => '20', 'height' => '20', 'border' => '0', 'title' => __('Alert fired')]);
         } else {
             $data[7] = html_print_image('images/pixel_gray.png', true, ['width' => '20', 'height' => '20', 'border' => '0', 'title' => __('Alert not fired')]);
         }
 
-        // Actions
+        // Actions.
         $data[8] = '';
 
         if (empty($trap['status']) && check_acl($config['id_user'], 0, 'IW')) {
-            $data[8] .= '<a href="'.$url_snmp.'&check='.$trap['id_trap'].'">'.html_print_image('images/ok.png', true, ['border' => '0', 'title' => __('Validate')]).'</a> ';
+            $data[8] .= '<a href="'.$urlPagination.'&check='.$trap['id_trap'].'">'.html_print_image('images/ok.png', true, ['border' => '0', 'title' => __('Validate')]).'</a> ';
         }
 
         if ($trap['source'] == '') {
             $is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
             if ($is_admin) {
-                $data[8] .= '<a href="'.$url_snmp.'&delete='.$trap['id_trap'].'&offset='.$offset.'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete')]).'</a> ';
+                $data[8] .= '<a href="'.$urlPagination.'&delete='.$trap['id_trap'].'&offset='.$offset.'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete')]).'</a> ';
             }
         } else {
             $agent_trap_group = db_get_value('id_grupo', 'tagente', 'nombre', $trap['source']);
             if ((check_acl($config['id_user'], $agent_trap_group, 'AW'))) {
-                $data[8] .= '<a href="'.$url_snmp.'&delete='.$trap['id_trap'].'&offset='.$offset.'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete')]).'</a> ';
+                $data[8] .= '<a href="'.$urlPagination.'&delete='.$trap['id_trap'].'&offset='.$offset.'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete')]).'</a> ';
             }
         }
 
@@ -934,18 +969,18 @@ if ($traps !== false) {
 
         array_push($table->data, $data);
 
-        // Hiden file for description
+        // Hiden file for description.
         $string = '<table style="border:solid 1px #D3D3D3;" width="90%" class="toggle">
 			<tr>
 				<td align="left" valign="top" width="15%">'.'<b>'.__('Variable bindings:').'</b></td>
 				<td align="left" >';
 
         if ($group_by) {
-            $new_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&'.'filter_severity='.$filter_severity.'&'.'filter_fired='.$filter_fired.'&'.'filter_status='.$filter_status.'&'.'refresh='.((int) get_parameter('refresh', 0)).'&'.'pure='.$config['pure'].'&'.'group_by=0&'.'free_search_string='.$free_search_string.'&'.'date_from_trap='.$date_from_trap.'&'.'date_to_trap='.$date_to_trap.'&'.'time_from_trap='.$time_from_trap.'&'.'time_to_trap='.$time_to_trap;
+            $new_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_severity='.$filter_severity.'&filter_fired='.$filter_fired.'&filter_status='.$filter_status.'&refresh='.((int) get_parameter('refresh', 0)).'&pure='.$config['pure'].'&group_by=0&free_search_string='.$free_search_string.'&date_from_trap='.$date_from_trap.'&date_to_trap='.$date_to_trap.'&time_from_trap='.$time_from_trap.'&time_to_trap='.$time_to_trap;
 
             $string .= '<a href='.$new_url.'>'.__('See more details').'</a>';
         } else {
-            // Print binding vars separately
+            // Print binding vars separately.
             $binding_vars = explode("\t", $trap['oid_custom']);
             foreach ($binding_vars as $var) {
                 $string .= $var.'<br/>';
@@ -1007,7 +1042,7 @@ if ($traps !== false) {
                 break;
             }
 
-            $string .= '<tr><td align="left" valign="top">'.'<b>'.__('Trap type:').'</b>'.'</td>'.'<td align="left">'.$desc_trap_type.'</td></tr>';
+            $string .= '<tr><td align="left" valign="top"><b>'.__('Trap type:').'</b></td><td align="left">'.$desc_trap_type.'</td></tr>';
         }
 
         if ($group_by) {
@@ -1060,7 +1095,7 @@ if ($traps !== false) {
     }
 }
 
-// No matching traps
+// No matching traps.
 if ($idx == 0) {
     echo '<div class="nf">'.__('No matching traps found').'</div>';
 } else {
diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php
index 9e267c5c2d..b8b42ad945 100644
--- a/pandora_console/operation/users/user_edit.php
+++ b/pandora_console/operation/users/user_edit.php
@@ -426,24 +426,25 @@ if (check_acl($config['id_user'], 0, 'ER')) {
     ).'</div>';
 }
 
+if (!$config['disabled_newsletter']) {
+    $newsletter = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Newsletter Subscribed').': </p>';
+    if ($user_info['middlename'] > 0) {
+        $newsletter .= '<span>'.__('Already subscribed to %s newsletter', get_product_name()).'</span>';
+    } else {
+        $newsletter .= '<span><a href="javascript: force_run_newsletter();">'.__('Subscribe to our newsletter').'</a></span></div>';
+        $newsletter_reminder = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Newsletter Reminder').': </p>';
+        $newsletter_reminder .= html_print_switch(
+            [
+                'name'     => 'newsletter_reminder',
+                'value'    => $newsletter_reminder_value,
+                'disabled' => false,
+            ]
+        );
+    }
 
-$newsletter = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Newsletter Subscribed').': </p>';
-if ($user_info['middlename'] > 0) {
-    $newsletter .= '<span>'.__('Already subscribed to %s newsletter', get_product_name()).'</span>';
-} else {
-    $newsletter .= '<span><a href="javascript: force_run_newsletter();">'.__('Subscribe to our newsletter').'</a></span></div>';
-    $newsletter_reminder = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Newsletter Reminder').': </p>';
-    $newsletter_reminder .= html_print_switch(
-        [
-            'name'     => 'newsletter_reminder',
-            'value'    => $newsletter_reminder_value,
-            'disabled' => false,
-        ]
-    );
+    $newsletter_reminder .= '</div>';
 }
 
-$newsletter_reminder .= '</div>';
-
 
 
 $autorefresh_list_out = [];
diff --git a/pandora_console/operation/users/webchat.php b/pandora_console/operation/users/webchat.php
index db97864863..de59c5d3e8 100644
--- a/pandora_console/operation/users/webchat.php
+++ b/pandora_console/operation/users/webchat.php
@@ -79,10 +79,10 @@ $table->class = 'databox filters';
 $table->style[0][1] = 'text-align: right; vertical-align: top;';
 
 $table->data[0][0] = '<div id="chat_box" style="width: 95%;
-	height: 300px; background: #ffffff; border: 1px inset black;
+	height: 300px; background: #ffffff; border: 1px solid #cbcbcb; border-radius: 5px;
 	overflow: auto; padding: 10px;"></div>';
 $table->data[0][1] = '<h4>'.__('Users Online').'</h4>'.'<div id="userlist_box" style="width: 90% !important; height: 200px !important;
-		height: 300px; background: #ffffff; border: 1px inset black;
+		height: 300px; background: #ffffff; border: 1px solid #cbcbcb; border-radius: 5px;
 		overflow: auto; padding-right: 10px;"></div>';
 $table->data[1][0] = '<b>'.__('Message').'</b> &nbsp;&nbsp;'.html_print_input_text(
     'message_box',
@@ -115,16 +115,16 @@ echo "<div style='width:100%'>".html_print_button(
             //Enter key.
             if (e.keyCode == 13) {
                 send_message();
+                check_users();
             }
         });
         
         init_webchat();
     });
-    
-    $(window).unload(function () {
+    $(window).on("beforeunload",function () {
         exit_webchat();
     });
-    
+
     function init_webchat() {
         send_login_message();
         long_polling_check_messages();
diff --git a/pandora_console/operation/visual_console/legacy_public_view.php b/pandora_console/operation/visual_console/legacy_public_view.php
index 18d8e2ca55..7bea2a22c9 100644
--- a/pandora_console/operation/visual_console/legacy_public_view.php
+++ b/pandora_console/operation/visual_console/legacy_public_view.php
@@ -40,6 +40,9 @@ ob_start('ui_process_page_head');
 // Enterprise main
 enterprise_include('index.php');
 
+$url_css = ui_get_full_url('include/styles/visual_maps.css', false, false, false);
+echo '<link rel="stylesheet" href="'.$url_css.'" type="text/css" />';
+
 require_once 'include/functions_visual_map.php';
 
 $hash = get_parameter('hash');
@@ -96,31 +99,40 @@ if ($layout) {
     echo '<div id="vc-container"></div>';
 }
 
-// Floating menu - Start
+// Floating menu - Start.
 echo '<div id="vc-controls" style="z-index:300;">';
 
 echo '<div id="menu_tab">';
-echo '<ul class="mn">';
+echo '<ul class="mn white-box-content box-shadow flex-row">';
 
-// QR code
+// QR code.
 echo '<li class="nomn">';
 echo '<a href="javascript: show_dialog_qrcode();">';
 echo '<img class="vc-qr" src="../../images/qrcode_icon_2.jpg"/>';
 echo '</a>';
 echo '</li>';
 
-// Countdown
+// Countdown.
 echo '<li class="nomn">';
 echo '<div class="vc-refr">';
-echo '<div class="vc-countdown"></div>';
 echo '<div id="vc-refr-form">';
 echo __('Refresh').':';
-echo html_print_select(get_refresh_time_array(), 'refr', $refr, '', '', 0, true, false, false);
+echo html_print_select(
+    get_refresh_time_array(),
+    'vc-refr',
+    $refr,
+    '',
+    '',
+    0,
+    true,
+    false,
+    false
+);
 echo '</div>';
 echo '</div>';
 echo '</li>';
 
-// Console name
+// Console name.
 echo '<li class="nomn">';
 echo '<div class="vc-title">'.$layout_name.'</div>';
 echo '</li>';
@@ -129,15 +141,15 @@ echo '</ul>';
 echo '</div>';
 
 echo '</div>';
-// Floating menu - End
-// QR code dialog
+
+// QR code dialog.
 echo '<div style="display: none;" id="qrcode_container" title="'.__('QR code of the page').'">';
 echo '<div id="qrcode_container_image"></div>';
 echo '</div>';
 
-ui_require_jquery_file('countdown');
-ui_require_javascript_file('wz_jsgraphics');
-ui_require_javascript_file('pandora_visual_console');
+ui_require_jquery_file('countdown', 'include/javascript/', true);
+ui_require_javascript_file('wz_jsgraphics', 'include/javascript/', true);
+ui_require_javascript_file('pandora_visual_console', 'include/javascript/', true);
 $ignored_params['refr'] = '';
 ?>
 
diff --git a/pandora_console/operation/visual_console/legacy_view.php b/pandora_console/operation/visual_console/legacy_view.php
index f5eec24096..62ed4fbd18 100644
--- a/pandora_console/operation/visual_console/legacy_view.php
+++ b/pandora_console/operation/visual_console/legacy_view.php
@@ -15,6 +15,7 @@ global $config;
 
 // Login check
 require_once $config['homedir'].'/include/functions_visual_map.php';
+ui_require_css_file('visual_maps');
 
 check_login();
 
diff --git a/pandora_console/operation/visual_console/public_view.php b/pandora_console/operation/visual_console/public_view.php
index 90fe29a545..e31d6f9ed5 100644
--- a/pandora_console/operation/visual_console/public_view.php
+++ b/pandora_console/operation/visual_console/public_view.php
@@ -42,6 +42,9 @@ ob_start('ui_process_page_head');
 // Enterprise main.
 enterprise_include('index.php');
 
+$url_css = ui_get_full_url('include/styles/visual_maps.css', false, false, false);
+echo '<link rel="stylesheet" href="'.$url_css.'" type="text/css" />';
+
 require_once 'include/functions_visual_map.php';
 
 $hash = (string) get_parameter('hash');
@@ -83,7 +86,7 @@ echo '<div id="visual-console-container"></div>';
 echo '<div id="vc-controls" style="z-index:300;">';
 
 echo '<div id="menu_tab">';
-echo '<ul class="mn">';
+echo '<ul class="mn white-box-content box-shadow flex-row">';
 
 // QR code.
 echo '<li class="nomn">';
@@ -134,7 +137,7 @@ if (!users_can_manage_group_all('AR')) {
 }
 
 $ignored_params['refr'] = '';
-ui_require_javascript_file('pandora_visual_console');
+ui_require_javascript_file('pandora_visual_console', 'include/javascript/', true);
 include_javascript_d3();
 visual_map_load_client_resources();
 
@@ -157,6 +160,10 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
     var props = <?php echo (string) $visualConsole; ?>;
     var items = <?php echo '['.implode($visualConsoleItems, ',').']'; ?>;
     var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>";
+
+    var controls = document.getElementById('vc-controls');
+    autoHideElement(controls, 1000);
+
     var handleUpdate = function (prevProps, newProps) {
         if (!newProps) return;
 
@@ -198,6 +205,14 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
             }
         }
     }
+
+    // Add the datetime when the item was received.
+    var receivedAt = new Date();
+    items.map(function(item) {
+        item["receivedAt"] = receivedAt;
+        return item;
+    });
+
     var visualConsoleManager = createVisualConsole(
         container,
         props,
diff --git a/pandora_console/operation/visual_console/view.php b/pandora_console/operation/visual_console/view.php
index 9c79ba7742..d99c5fe29b 100644
--- a/pandora_console/operation/visual_console/view.php
+++ b/pandora_console/operation/visual_console/view.php
@@ -19,6 +19,8 @@ check_login();
 require_once $config['homedir'].'/vendor/autoload.php';
 require_once $config['homedir'].'/include/functions_visual_map.php';
 
+ui_require_css_file('visual_maps');
+
 // Query parameters.
 $visualConsoleId = (int) get_parameter(!is_metaconsole() ? 'id' : 'id_visualmap');
 // To hide the menus.
@@ -155,6 +157,16 @@ if (!is_metaconsole()) {
     html_print_input_hidden('metaconsole', 1);
 }
 
+if ($pure === false) {
+    echo '<div class="visual-console-edit-controls">';
+    echo '<span>'.__('Move and resize mode').'</span>';
+    echo '<span>';
+    echo html_print_checkbox_switch('edit-mode', 1, false, true);
+    echo '</span>';
+    echo '</div>';
+    echo '<br />';
+}
+
 echo '<div id="visual-console-container"></div>';
 
 if ($pure === true) {
@@ -162,7 +174,7 @@ if ($pure === true) {
     echo '<div id="vc-controls" style="z-index: 999">';
 
     echo '<div id="menu_tab">';
-    echo '<ul class="mn">';
+    echo '<ul class="mn white-box-content box-shadow flex-row">';
 
     // Quit fullscreen.
     echo '<li class="nomn">';
@@ -306,6 +318,14 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
             }
         }
     }
+
+    // Add the datetime when the item was received.
+    var receivedAt = new Date();
+    items.map(function(item) {
+        item["receivedAt"] = receivedAt;
+        return item;
+    });
+
     var visualConsoleManager = createVisualConsole(
         container,
         props,
@@ -315,6 +335,17 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
         handleUpdate
     );
 
+    // Enable/disable the edition mode.
+    $('input[name=edit-mode]').change(function(event) {
+        if ($(this).prop('checked')) {
+            visualConsoleManager.visualConsole.enableEditMode();
+            visualConsoleManager.changeUpdateInterval(0);
+        } else {
+            visualConsoleManager.visualConsole.disableEditMode();
+            visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>); // To ms.
+        }
+    });
+
     // Update the data fetch interval.
     $('select#vc-refr').change(function(event) {
         var refr = Number.parseInt(event.target.value);
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index e074cfbfe6..3d42434718 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -2,8 +2,8 @@
 # Pandora FMS Console
 #
 %define name        pandorafms_console
-%define version     7.0NG.735
-%define release     190605
+%define version     7.0NG.738
+%define release     190906
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec
index 797993f37b..ad7d448cbf 100644
--- a/pandora_console/pandora_console.rhel7.spec
+++ b/pandora_console/pandora_console.rhel7.spec
@@ -2,8 +2,8 @@
 # Pandora FMS Console
 #
 %define name        pandorafms_console
-%define version     7.0NG.735
-%define release     190605
+%define version     7.0NG.738
+%define release     190906
 
 # User and Group under which Apache is running
 %define httpd_name  httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index 018cfe4433..1865074deb 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -2,8 +2,8 @@
 # Pandora FMS Console
 #
 %define name        pandorafms_console
-%define version     7.0NG.735
-%define release     190605
+%define version     7.0NG.738
+%define release     190906
 %define httpd_name      httpd
 # User and Group under which Apache is running
 %define httpd_name  apache2
diff --git a/pandora_console/pandora_console_install b/pandora_console/pandora_console_install
index 1e813790ee..bda06177d6 100644
--- a/pandora_console/pandora_console_install
+++ b/pandora_console/pandora_console_install
@@ -9,7 +9,7 @@
 # This code is licensed under GPL 2.0 license.
 # **********************************************************************
 
-PI_VERSION="7.0NG.735"
+PI_VERSION="7.0NG.738"
 FORCE=0
 DESTDIR=""
 LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index b30295bba6..d1de66ab07 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -693,6 +693,20 @@ CREATE TABLE IF NOT EXISTS `tgrupo` (
  	KEY `parent_index` (`parent`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+-- ---------------------------------------------------------------------
+-- Table `tcredential_store`
+-- ---------------------------------------------------------------------
+CREATE TABLE IF NOT EXISTS `tcredential_store` (
+	`identifier` varchar(100) NOT NULL,
+	`id_group` mediumint(4) unsigned NOT NULL DEFAULT 0,
+	`product` enum('CUSTOM', 'AWS', 'AZURE', 'GOOGLE') default 'CUSTOM',
+	`username` text,
+	`password` text,
+	`extra_1` text,
+	`extra_2` text,
+	PRIMARY KEY (`identifier`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
 -- ---------------------------------------------------------------------
 -- Table `tincidencia`
 -- ---------------------------------------------------------------------
@@ -806,6 +820,7 @@ CREATE TABLE IF NOT EXISTS `tmodule_relationship` (
 	`module_a` int(10) unsigned NOT NULL,
 	`module_b` int(10) unsigned NOT NULL,
 	`disable_update` tinyint(1) unsigned NOT NULL default '0',
+	`type` ENUM('direct', 'failover') DEFAULT 'direct',
 	PRIMARY KEY (`id`),
 	FOREIGN KEY (`module_a`) REFERENCES tagente_modulo(`id_agente_modulo`)
 		ON DELETE CASCADE,
@@ -1387,8 +1402,8 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
 	`type` varchar(30) default 'simple_graph',
 	`period` int(11) NOT NULL default 0,
 	`order` int (11) NOT NULL default 0,
-	`name` varchar(150) NULL,
-	`description` mediumtext, 
+	`name` varchar(300) NULL,
+	`description` mediumtext,
 	`id_agent` int(10) unsigned NOT NULL default 0,
 	`text` TEXT,
 	`external_source` Text,
@@ -1438,6 +1453,8 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
 	`agent_max_value` TINYINT(1) DEFAULT '1',
 	`agent_min_value` TINYINT(1) DEFAULT '1',
 	`current_month` TINYINT(1) DEFAULT '1',
+	`failover_mode` tinyint(1) DEFAULT '1',
+	`failover_type` tinyint(1) DEFAULT '1',
 	PRIMARY KEY(`id_rc`),
 	FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
 		ON UPDATE CASCADE ON DELETE CASCADE
@@ -1450,6 +1467,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_sla_combined` (
 	`id` INTEGER UNSIGNED NOT NULL auto_increment,
 	`id_report_content` INTEGER UNSIGNED NOT NULL,
 	`id_agent_module` int(10) unsigned NOT NULL,
+	`id_agent_module_failover` int(10) unsigned NOT NULL,
 	`sla_max` double(18,2) NOT NULL default 0,
 	`sla_min` double(18,2) NOT NULL default 0,
 	`sla_limit` double(18,2) NOT NULL default 0,
@@ -2978,6 +2996,8 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
 	`agent_max_value` TINYINT(1) DEFAULT '1',
 	`agent_min_value` TINYINT(1) DEFAULT '1',
 	`current_month` TINYINT(1) DEFAULT '1',
+	`failover_mode` tinyint(1) DEFAULT '1',
+	`failover_type` tinyint(1) DEFAULT '1',
 	PRIMARY KEY(`id_rc`)
 ) ENGINE = InnoDB DEFAULT CHARSET=utf8;
 
@@ -3219,6 +3239,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
 	PRIMARY KEY  (`id_agente`),
 	KEY `nombre` (`nombre`(255)),
 	KEY `direccion` (`direccion`),
+	KEY `id_tagente_idx` (`id_tagente`),
 	KEY `disabled` (`disabled`),
 	KEY `id_grupo` (`id_grupo`),
 	FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -3590,3 +3611,44 @@ CREATE TABLE IF NOT EXISTS `tvisual_console_elements_cache` (
         ON DELETE CASCADE
         ON UPDATE CASCADE
 ) engine=InnoDB DEFAULT CHARSET=utf8;
+
+-- ---------------------------------------------------------------------
+-- Table `tagent_repository`
+-- ---------------------------------------------------------------------
+CREATE TABLE `tagent_repository` (
+  `id` SERIAL,
+  `id_os` INT(10) UNSIGNED DEFAULT 0,
+  `arch` ENUM('x64', 'x86') DEFAULT 'x64',
+  `version` VARCHAR(10) DEFAULT '',
+  `path` text,
+  `uploaded_by` VARCHAR(100) DEFAULT '',
+  `uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
+  `last_err` text,
+  PRIMARY KEY (`id`),
+  FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
+    ON UPDATE CASCADE ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------------------------------------------------
+-- Table `tdeployment_hosts`
+-- ----------------------------------------------------------------------
+CREATE TABLE `tdeployment_hosts` (
+  `id` SERIAL,
+  `id_cs` VARCHAR(100),
+  `ip` VARCHAR(100) NOT NULL UNIQUE,
+  `id_os` INT(10) UNSIGNED DEFAULT 0,
+  `os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
+  `arch` ENUM('x64', 'x86') DEFAULT 'x64',
+  `current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
+  `target_agent_version_id` BIGINT UNSIGNED,
+  `deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
+  `server_ip` varchar(100) default NULL COMMENT "Where to point target agent",
+  `last_err` text,
+  PRIMARY KEY (`id`),
+  FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
+    ON UPDATE CASCADE ON DELETE SET NULL,
+  FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
+    ON UPDATE CASCADE ON DELETE CASCADE,
+  FOREIGN KEY (`target_agent_version_id`) REFERENCES  `tagent_repository`(`id`)
+    ON UPDATE CASCADE ON DELETE SET NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql
index 073c9496e2..a02f88fe5f 100644
--- a/pandora_console/pandoradb_data.sql
+++ b/pandora_console/pandoradb_data.sql
@@ -22,7 +22,6 @@ INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal
 INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (8,'Jabber&#x20;Alert','echo&#x20;_field3_&#x20;|&#x20;sendxmpp&#x20;-r&#x20;_field1_&#x20;--chatroom&#x20;_field2_','Send&#x20;jabber&#x20;alert&#x20;to&#x20;chat&#x20;room&#x20;in&#x20;a&#x20;predefined&#x20;server&#x20;&#40;configure&#x20;first&#x20;.sendxmpprc&#x20;file&#41;.&#x20;Uses&#x20;field3&#x20;as&#x20;text&#x20;message,&#x20;field1&#x20;as&#x20;useralias&#x20;for&#x20;source&#x20;message,&#x20;and&#x20;field2&#x20;for&#x20;chatroom&#x20;name',0,'[\"User&#x20;alias\",\"Chatroom&#x20;name\",\"Message\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
 INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (9,'SMS','sendsms&#x20;_field1_&#x20;_field2_','Send&#x20;SMS&#x20;using&#x20;the&#x20;standard&#x20;SMS&#x20;device,&#x20;using&#x20;smstools.&#x20;&#x20;Uses&#x20;field2&#x20;as&#x20;text&#x20;message,&#x20;field1&#x20;as&#x20;destination&#x20;phone&#x20;&#40;include&#x20;international&#x20;prefix!&#41;',0,'[\"Destination&#x20;number\",\"Message\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
 INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (10,'Validate&#x20;Event','Internal&#x20;type','This&#x20;alert&#x20;validate&#x20;the&#x20;events&#x20;matched&#x20;with&#x20;a&#x20;module&#x20;given&#x20;the&#x20;agent&#x20;name&#x20;&#40;_field1_&#41;&#x20;and&#x20;module&#x20;name&#x20;&#40;_field2_&#41;',1,'[\"Agent&#x20;name\",\"Module&#x20;name\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
-INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (11,'Integria&#x20;IMS&#x20;Ticket','Internal&#x20;type','This&#x20;alert&#x20;create&#x20;a&#x20;ticket&#x20;into&#x20;your&#x20;Integria&#x20;IMS.',1,'[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Integria&#x20;IMS&#x20;user&#x20;pass\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Email&#x20;copy\",\"Ticket&#x20;owner\",\"Ticket&#x20;description\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\",\"\",\"\"]');
 INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (12,'Remote&#x20;agent&#x20;control','/usr/share/pandora_server/util/udp_client.pl&#x20;_address_&#x20;41122&#x20;&quot;_field1_&quot;','This&#x20;command&#x20;is&#x20;used&#x20;to&#x20;send&#x20;commands&#x20;to&#x20;the&#x20;agents&#x20;with&#x20;the&#x20;UDP&#x20;server&#x20;enabled.&#x20;The&#x20;UDP&#x20;server&#x20;is&#x20;used&#x20;to&#x20;order&#x20;agents&#x20;&#40;Windows&#x20;and&#x20;UNIX&#41;&#x20;to&#x20;&quot;refresh&quot;&#x20;the&#x20;agent&#x20;execution:&#x20;that&#x20;means,&#x20;to&#x20;force&#x20;the&#x20;agent&#x20;to&#x20;execute&#x20;and&#x20;send&#x20;data',0,'[\"Command\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
 INSERT INTO `talert_commands` (`id`, `name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (13,'Generate&#x20;Notification','Internal&#x20;type','This&#x20;command&#x20;allows&#x20;you&#x20;to&#x20;send&#x20;an&#x20;internal&#x20;notification&#x20;to&#x20;any&#x20;user&#x20;or&#x20;group.',1,'[\"Destination&#x20;user\",\"Destination&#x20;group\",\"Title\",\"Message\",\"Link\",\"Criticity\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
 --
@@ -80,15 +79,11 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
 ('sound_alert', 'include/sounds/air_shock_alarm.wav'),
 ('sound_critical', 'include/sounds/Star_Trek_emergency_simulation.wav'),
 ('sound_warning', 'include/sounds/negativebeep.wav'),
-('integria_enabled', '0'),
-('integria_api_password', ''),
-('integria_inventory', '0'),
-('integria_url', ''),
 ('netflow_interval', '3600'),
 ('netflow_daemon', '/usr/bin/nfcapd'),
 ('netflow_nfdump', '/usr/bin/nfdump'),
 ('netflow_max_resolution', '50'),
-('event_fields', 'evento,id_agente,estado,timestamp'),
+('event_fields', 'mini_severity,evento,id_agente,estado,timestamp'),
 ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'),
 ('list_ACL_IPs_for_API', '127.0.0.1'),
 ('enable_pass_policy', 0),
@@ -114,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
 ('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
 ('custom_report_front_header', ''),
 ('custom_report_front_footer', ''),
-('MR', 28),
+('MR', 31),
 ('identification_reminder', 1),
 ('identification_reminder_timestamp', 0),
-('current_package_enterprise', '735'),
+('current_package_enterprise', '738'),
 ('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.0009765625":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}'),
 ('custom_docs_logo', 'default_docs.png'),
 ('custom_support_logo', 'default_support.png'),
@@ -270,7 +265,6 @@ INSERT INTO `ttipo_modulo` VALUES
 (21,'async_proc', 7, 'Asyncronous proc data', 'mod_async_proc.png'), 
 (22,'async_data', 6, 'Asyncronous numeric data', 'mod_async_data.png'), 
 (23,'async_string', 8, 'Asyncronous string data', 'mod_async_string.png'),
-(24,'log4x',0,'Log4x','mod_log4x.png'),
 (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png'),
 (30,'web_data',9,'Remote HTTP module to check latency','mod_web_data.png'),
 (31,'web_proc',9,'Remote HTTP module to check server response','mod_web_proc.png'),
@@ -1115,8 +1109,6 @@ INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field
 (2,'Restart&#x20;agent',12,'REFRESH AGENT *','','','','','','','','','',0,0,'','','','','','','','','','');
 INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES
 (3,'Monitoring&#x20;Event',3,'_agent_&#x20;_module_&#x20;generated&#x20;an&#x20;event&#x20;alert&#x20;&#40;_data_&#41;','alert_fired','pandora','','4','','','','','',0,0,'RECOVERED:&#x20;_agent_&#x20;_module_&#x20;generated&#x20;event&#x20;alert&#x20;&#40;_data_&#41;','alert_ceased','pandora','','4','','','','','');
-INSERT INTO `talert_actions` (`id`, `name`, `id_alert_command`, `field1`, `field2`, `field3`, `field4`, `field5`, `field6`, `field7`, `field8`, `field9`, `field10`, `id_group`, `action_threshold`, `field1_recovery`, `field2_recovery`, `field3_recovery`, `field4_recovery`, `field5_recovery`, `field6_recovery`, `field7_recovery`, `field8_recovery`, `field9_recovery`, `field10_recovery`) VALUES
-(4,'Create&#x20;a&#x20;ticket&#x20;in&#x20;Integria&#x20;IMS',11,'http://localhost/integria/include/api.php','1234','admin','integria','_agent_:&#x20;_alert_name_','1','3','copy@dom.com','admin','_alert_description_',0,0,'','','','','','','','','','');
 
 -- alert templates (default)
 
@@ -1318,4 +1310,115 @@ INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `als
   ((SELECT `id` FROM `tnotification_source` WHERE `description`="Official&#x20;communication"), "admin", 1, 0);
 
 UPDATE `tnotification_source` SET `enabled`=1 WHERE `description` = 'System&#x20;status' OR `description` = 'Official&#x20;communication';
-  
+
+
+-- 
+-- Dumping data for table `tlayout`
+-- 
+INSERT INTO `tlayout`
+VALUES
+    (1, 'Demo&#x20;visual console', 0, 'fondo.jpg', 1080, 1920, 'white', 0);
+
+-- 
+-- Dumping data for table `tlayout_data`
+-- 
+INSERT INTO `tlayout_data`
+VALUES
+  (1,1,998,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(2,1,998,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(3,1,1016,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(4,1,1016,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(5,1,1034,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(6,1,1034,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(7,1,1052,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(8,1,1052,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(9,1,1070,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(10,1,1070,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(11,1,1088,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(12,1,1088,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(13,1,1106,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(14,1,1106,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(15,1,1124,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(16,1,1124,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(17,1,1142,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(18,1,1142,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(19,1,1160,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(20,1,1160,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(21,1,1178,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(22,1,1178,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(23,1,1196,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(24,1,1196,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(25,1,1214,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(26,1,1214,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(27,1,1232,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(28,1,1232,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(29,1,1250,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(30,1,1250,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(31,1,1268,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(32,1,1268,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(33,1,1286,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(34,1,1286,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(35,1,1286,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(36,1,1304,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(37,1,1304,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(38,1,1322,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(39,1,1322,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(40,1,1340,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(41,1,1507,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(42,1,1536,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(43,1,1568,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(44,1,1599,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(45,1,1627,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(46,1,1656,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(47,1,1685,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(48,1,1714,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(49,1,1743,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(50,1,1772,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(51,1,1449,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(52,1,1800,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(53,1,1413,243,205,426,'','rack_frame',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(54,1,962,381,73,408,'','rack_firewall',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(55,1,962,454,73,408,'','rack_pdu',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(56,1,530,732,74,413,'','rack_server',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(57,1,962,233,74,413,'','rack_server',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(58,1,962,307,74,413,'','rack_server',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(59,1,530,658,74,413,'','rack_server',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(60,1,530,350,74,413,'','rack_server',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(61,1,530,204,73,408,'','rack_psa',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(62,1,530,277,73,408,'','rack_pdu',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(63,1,530,585,73,408,'','rack_firewall',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(64,1,530,424,161,411,'','rack_double_server',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(65,1,1426,448,74,413,'','rack_server',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(66,1,1495,540,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(67,1,1423,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(68,1,1463,540,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(69,1,1433,540,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(70,1,74,733,73,408,'','rack_pdu',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(71,1,1098,701,80,18,'','rack_hard_disk',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(72,1,1148,701,80,18,'','rack_hard_disk',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(73,1,1340,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(74,1,1358,783,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(75,1,1358,699,80,18,'','rack_hard_disk_2',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(76,1,1143,783,80,18,'','rack_hard_disk',0,3600,9,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(77,1,962,682,205,426,'','rack_frame',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(78,1,1522,540,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(79,1,1419,521,205,426,'','rack_frame',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(80,1,74,278,74,413,'','rack_server',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(81,1,74,572,161,411,'','rack_double_server',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(82,1,1418,729,74,413,'','rack_server',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(83,1,962,527,73,408,'','rack_switch',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(84,1,74,352,73,408,'','rack_router',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(85,1,962,600,74,413,'','rack_server',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(86,1,530,806,73,408,'','rack_firewall',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(87,1,74,425,74,413,'','rack_server',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(88,1,74,499,73,408,'','rack_switch',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(89,1,74,806,73,408,'','rack_psa',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(90,1,74,204,74,413,'','rack_server',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(91,1,1424,806,73,408,'','rack_firewall',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
+	(92,1,1486,907,0,0,'&lt;p&#x20;style=&quot;text-align:&#x20;center;&#x20;overflow:&#x20;hidden;&quot;&gt;&lt;span&#x20;class=&quot;visual_font_size_28pt&quot;&#x20;style=&quot;color:&#x20;#ffffff;&#x20;font-family:&#x20;opensans;&quot;&gt;&lt;strong&gt;&lt;span&#x20;class=&quot;visual_font_size_28pt&quot;&#x20;style=&quot;color:&#x20;#ffffff;&#x20;font-family:&#x20;opensans;&quot;&gt;Office&#x20;8&#x20;-&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span&#x20;class=&quot;visual_font_size_28pt&quot;&#x20;style=&quot;color:&#x20;#ffffff;&#x20;font-family:&#x20;opensans;&quot;&gt;Rack&#x20;2&lt;/span&gt;&lt;/p&gt;','white',4,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,0),
+	(93,1,1048,889,58,281,'&lt;p&#x20;style=&quot;text-align:&#x20;center;&#x20;overflow:&#x20;hidden;&quot;&gt;&lt;span&#x20;class=&quot;visual_font_size_28pt&quot;&#x20;style=&quot;color:&#x20;#ffffff;&#x20;font-family:&#x20;opensans;&quot;&gt;&lt;strong&gt;&lt;span&#x20;class=&quot;visual_font_size_28pt&quot;&#x20;style=&quot;color:&#x20;#ffffff;&#x20;font-family:&#x20;opensans;&quot;&gt;Office&#x20;8&#x20;-&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span&#x20;class=&quot;visual_font_size_28pt&quot;&#x20;style=&quot;color:&#x20;#ffffff;&#x20;font-family:&#x20;opensans;&quot;&gt;Rack&#x20;1&lt;/span&gt;&lt;/p&gt;','white',4,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,0),
+	(94,1,580,904,0,0,'&lt;p&#x20;style=&quot;text-align:&#x20;center;&#x20;overflow:&#x20;hidden;&quot;&gt;&lt;span&#x20;class=&quot;visual_font_size_28pt&quot;&#x20;style=&quot;color:&#x20;#ffffff;&#x20;font-family:&#x20;opensans;&quot;&gt;&lt;strong&gt;&lt;span&#x20;class=&quot;visual_font_size_28pt&quot;&#x20;style=&quot;color:&#x20;#ffffff;&#x20;font-family:&#x20;opensans;&quot;&gt;Office&#x20;7&#x20;-&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span&#x20;class=&quot;visual_font_size_28pt&quot;&#x20;style=&quot;color:&#x20;#ffffff;&#x20;font-family:&#x20;opensans;&quot;&gt;Rack&#x20;2&lt;/span&gt;&lt;/p&gt;','white',4,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,0),
+	(95,1,132,907,0,0,'&lt;p&#x20;style=&quot;text-align:&#x20;center;&#x20;overflow:&#x20;hidden;&quot;&gt;&lt;span&#x20;class=&quot;visual_font_size_28pt&quot;&#x20;style=&quot;color:&#x20;#ffffff;&#x20;font-family:&#x20;opensans;&quot;&gt;&lt;strong&gt;&lt;span&#x20;class=&quot;visual_font_size_28pt&quot;&#x20;style=&quot;color:&#x20;#ffffff;&#x20;font-family:&#x20;opensans;&quot;&gt;Office&#x20;7&#x20;-&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span&#x20;class=&quot;visual_font_size_28pt&quot;&#x20;style=&quot;color:&#x20;#ffffff;&#x20;font-family:&#x20;opensans;&quot;&gt;Rack&#x20;1&lt;/span&gt;&lt;/p&gt;','white',4,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,0),
+	(96,1,733,20,0,0,'&lt;p&#x20;style=&quot;overflow:&#x20;hidden;&quot;&gt;&lt;span&#x20;class=&quot;visual_font_size_48pt&quot;&gt;&lt;strong&gt;&lt;span&#x20;style=&quot;color:&#x20;#ffffff;&#x20;font-family:&#x20;opensans;&quot;&gt;OFFICE&#x20;RACKS&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;','white',4,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,0),
+	(97,1,1479,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60)
+;
\ No newline at end of file
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index 733679686f..8cafd9c319 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
 package: pandorafms-server
-Version: 7.0NG.735-190605
+Version: 7.0NG.738-190906
 Architecture: all
 Priority: optional
 Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index 86c564b311..37caeae281 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-pandora_version="7.0NG.735-190605"
+pandora_version="7.0NG.738-190906"
 
 package_cpan=0
 package_pandora=1
diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new
index 88868034ce..33d34082c0 100644
--- a/pandora_server/conf/pandora_server.conf.new
+++ b/pandora_server/conf/pandora_server.conf.new
@@ -1,7 +1,7 @@
 #############################################################################
 # Pandora FMS Server Parameters
 # Pandora FMS, the Flexible Monitoring System.
-# Version 7.0NG.735
+# Version 7.0NG.738
 # Licensed under GPL license v2,
 # (c) 2003-2017 Artica Soluciones Tecnologicas
 # http://www.pandorafms.com
@@ -304,6 +304,11 @@ fsnmp /usr/bin/pandorafsnmp
 
 autocreate_group 10
 
+# If set to 1, new agents will be added to the group specified by autocreate_group (the group specified by the agent will be used as fallback).
+# If set to 0, new agents will be added to the group specified by the agent (the group specified by autocreate_group will be used as fallback).
+
+autocreate_group_force 1
+
 # Set to 1 if want to autocreate agents with Pandora FMS Data Server, 
 # set to 0 to disable (for security purposes, for example).
 
@@ -424,6 +429,10 @@ eventserver 0
 
 event_window 3600
 
+# If set to 1, an alert will not be fired if the last event it generated is in 'in-process' status.
+
+event_inhibit_alerts 0
+
 # Enable (1) or disable (0) Pandora FMS Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY).
 # You need nmap 5.20 or higher in order to use this !
 
@@ -601,6 +610,9 @@ syslog_threads 2
 # Maximum number of lines queued by the Syslog Server's producer on each run (PANDORA FMS ENTERPRISE ONLY).
 syslog_max 65535
 
+# Sync Server
+#syncserver
+
 # Port tentacle server
 #sync_port 41121
 
@@ -619,7 +631,7 @@ syslog_max 65535
 # Sync timeout
 #sync_timeout 10
 
-# Address 
+# Address
 # sync_address
 
 # Target LogStash server, to allow Dataserver and SyslogServer store log information in ElasticSearch
diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows
index c78fbc86c7..a602f7abc4 100644
--- a/pandora_server/conf/pandora_server.conf.windows
+++ b/pandora_server/conf/pandora_server.conf.windows
@@ -261,6 +261,11 @@ dataserver_threads 2
 
 autocreate_group 10
 
+# If set to 1, new agents will be added to the group specified by autocreate_group (the group specified by the agent will be used as fallback).
+# If set to 0, new agents will be added to the group specified by the agent (the group specified by autocreate_group will be used as fallback).
+
+autocreate_group_force 1
+
 # Set to 1 if want to autocreate agents with Pandora FMS Data Server, 
 # set to 0 to disable
 
@@ -374,6 +379,10 @@ eventserver 0
 
 event_window 3600
 
+# If set to 1, an alert will not be fired if the last event it generated is in 'in-process' status.
+
+event_inhibit_alerts 0
+
 # Enable (1) or disable (0) Pandora FMS Enterprise ICMP Server (PANDORA FMS ENTERPRISE ONLY).
 # You need nmap 5.20 or higher in order to use this !
 
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index 7fb076135b..0bd92497dc 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -44,8 +44,8 @@ our @EXPORT = qw(
 	);
 
 # version: Defines actual version of Pandora Server for this module only
-my $pandora_version = "7.0NG.735";
-my $pandora_build = "190605";
+my $pandora_version = "7.0NG.738";
+my $pandora_build = "190906";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 # Setup hash
@@ -333,6 +333,7 @@ sub pandora_load_config {
 	$pa_config->{"snmpget"} = "/usr/bin/snmpget";
 	
 	$pa_config->{'autocreate_group'} = -1;
+	$pa_config->{'autocreate_group_force'} = 1;
 	$pa_config->{'autocreate'} = 1;
 
 	# max log size (bytes)
@@ -494,6 +495,8 @@ sub pandora_load_config {
 
 	$pa_config->{"fsnmp"} = "/usr/bin/pandorafsnmp"; # 7.0 732
 
+	$pa_config->{"event_inhibit_alerts"} = 0; # 7.0 737
+
 	# Check for UID0
 	if ($pa_config->{"quiet"} != 0){
 		if ($> == 0){
@@ -811,6 +814,9 @@ sub pandora_load_config {
 		elsif ($parametro =~ m/^autocreate_group\s+([0-9*]*)/i) {
 			$pa_config->{'autocreate_group'}= clean_blank($1); 
 		}
+		elsif ($parametro =~ m/^autocreate_group_force\s+([0-1])/i) {
+			$pa_config->{'autocreate_group_force'}= clean_blank($1); 
+		}
 		elsif ($parametro =~ m/^discovery_threads\s+([0-9]*)/i) {
 			$pa_config->{'discovery_threads'}= clean_blank($1);
 		}
@@ -917,6 +923,9 @@ sub pandora_load_config {
 		elsif ($parametro =~ m/^event_file\s+(.*)/i) {
 			$pa_config->{'event_file'}= clean_blank($1);
 		}
+		elsif ($parametro =~ m/^event_inhibit_alerts\s+([0-1])/i) {
+			$pa_config->{'event_inhibit_alerts'}= clean_blank($1);
+		}
 		elsif ($parametro =~ m/^text_going_down_normal\s+(.*)/i) {
 			$pa_config->{'text_going_down_normal'} = safe_input ($1);
 		}
diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm
index 0dbc8f963a..e1556d74b6 100644
--- a/pandora_server/lib/PandoraFMS/Core.pm
+++ b/pandora_server/lib/PandoraFMS/Core.pm
@@ -130,7 +130,17 @@ use Text::ParseWords;
 # due a bug processing some XML with blank spaces.
 # See http://www.perlmonks.org/?node_id=706838
 
-$XML::Simple::PREFERRED_PARSER='XML::Parser';
+eval {
+	local $SIG{__DIE__};
+	eval "use XML::SAX::ExpatXS;1" or die "XML::SAX::ExpatXS not available";
+};
+if (!$@) {
+	# Force best option available.
+	$XML::Simple::PREFERRED_PARSER='XML::SAX::ExpatXS';
+} else {
+	# Use classic parser.
+	$XML::Simple::PREFERRED_PARSER='XML::Parser';
+}
 
 # Default lib dir for RPM and DEB packages
 use lib '/usr/lib/perl5';
@@ -184,7 +194,9 @@ our @EXPORT = qw(
 	pandora_execute_action
 	pandora_exec_forced_alerts
 	pandora_generate_alerts
+	pandora_get_agent_group
 	pandora_get_config_value
+	pandora_get_credential
 	pandora_get_module_tags
 	pandora_get_module_url_tags
 	pandora_get_module_phone_tags
@@ -724,6 +736,15 @@ sub pandora_execute_alert ($$$$$$$$$;$) {
 	my ($pa_config, $data, $agent, $module,
 		$alert, $alert_mode, $dbh, $timestamp, $forced_alert, $extra_macros) = @_;
 	
+	# 'in-process' events can inhibit alers too.
+	if ($pa_config->{'event_inhibit_alerts'} == 1 && $alert_mode != RECOVERED_ALERT) {
+		my $status = get_db_value($dbh, 'SELECT estado FROM tevento WHERE id_alert_am = ? ORDER BY utimestamp DESC LIMIT 1', $alert->{'id_template_module'});
+		if (defined($status) && $status == 2) {
+			logger ($pa_config, "Alert '" . safe_output($alert->{'name'}) . "' inhibited by in-process events.", 10);
+			return;
+		}
+	}
+	
 	# Alerts in stand-by are not executed
 	if ($alert->{'standby'} == 1) {
 		if (defined ($module)) {
@@ -1184,13 +1205,13 @@ sub pandora_execute_action ($$$$$$$$$;$) {
 
 
 		# Address
-		$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
+		$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert);
 		# Subject
-		$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module);
+		$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module, $alert);
 		# Message
-		$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module);
+		$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert);
 		# Content
-		$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module);
+		$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module, $alert);
 
 		if($field4 eq ""){
 			$field4 = "text/html";
@@ -1595,6 +1616,31 @@ sub pandora_process_module ($$$$$$$$$;$) {
 	my $ff_start_utimestamp = $agent_status->{'ff_start_utimestamp'};
 	my $mark_for_update = 0;
 	
+	# tagente_estado.last_try defaults to NULL, should default to '1970-01-01 00:00:00'
+	$agent_status->{'last_try'} = '1970-01-01 00:00:00' unless defined ($agent_status->{'last_try'});
+	$agent_status->{'datos'} = "" unless defined($agent_status->{'datos'});
+	
+	# Do we have to save module data?
+	if ($agent_status->{'last_try'} !~ /(\d+)\-(\d+)\-(\d+) +(\d+):(\d+):(\d+)/) {
+		logger($pa_config, "Invalid last try timestamp '" . $agent_status->{'last_try'} . "' for agent '" . $agent->{'nombre'} . "' not found while processing module '" . $module->{'nombre'} . "'.", 3);
+		pandora_update_module_on_error ($pa_config, $module, $dbh);
+		return;
+	}
+	my $last_try = ($1 == 0) ? 0 : timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900);
+	my $save = ($module->{'history_data'} == 1 && ($agent_status->{'datos'} ne $processed_data || $last_try < ($utimestamp - 86400))) ? 1 : 0;
+	
+	# Received stale data. Save module data if needed and return.
+	if ($pa_config->{'dataserver_lifo'} == 1 && $utimestamp <= $agent_status->{'utimestamp'}) {
+		logger($pa_config, "Received stale data from agent " . (defined ($agent) ? "'" . $agent->{'nombre'} . "'" : 'ID ' . $module->{'id_agente'}) . ".", 10);
+		
+		# Save module data. Async and log4x modules are not compressed.
+		if ($module_type =~ m/(async)|(log4x)/ || $save == 1) {
+			save_module_data ($data_object, $module, $module_type, $utimestamp, $dbh);
+		}
+
+		return;
+	}
+
 	# Get new status
 	my $new_status = get_module_status ($processed_data, $module, $module_type);
 	
@@ -1743,23 +1789,6 @@ sub pandora_process_module ($$$$$$$$$;$) {
 		$mark_for_update = 1;
 	}
 		
-	# tagente_estado.last_try defaults to NULL, should default to '1970-01-01 00:00:00'
-	$agent_status->{'last_try'} = '1970-01-01 00:00:00' unless defined ($agent_status->{'last_try'});
-	
-	# Do we have to save module data?
-	if ($agent_status->{'last_try'} !~ /(\d+)\-(\d+)\-(\d+) +(\d+):(\d+):(\d+)/) {
-		logger($pa_config, "Invalid last try timestamp '" . $agent_status->{'last_try'} . "' for agent '" . $agent->{'nombre'} . "' not found while processing module '" . $module->{'nombre'} . "'.", 3);
-		pandora_update_module_on_error ($pa_config, $module, $dbh);
-		return;
-	}
-	
-	my $last_try = ($1 == 0) ? 0 : timelocal($6, $5, $4, $3, $2 - 1, $1 - 1900);
-
-	if (!defined($agent_status->{'datos'})){
-		$agent_status->{'datos'} = "";
-	}
-
-	my $save = ($module->{'history_data'} == 1 && ($agent_status->{'datos'} ne $processed_data || $last_try < ($utimestamp - 86400))) ? 1 : 0;
 	
 	# Never update tagente_estado when processing out-of-order data.
 	if ($utimestamp >= $last_try) {
@@ -3122,6 +3151,19 @@ sub pandora_get_config_value ($$) {
 	return (defined ($config_value) ? $config_value : "");
 }
 
+
+##########################################################################
+## Get credential from credential store
+##########################################################################
+sub pandora_get_credential ($$) {
+	my ($dbh, $identifier) = @_;
+
+	my $key = get_db_single_row($dbh, 'SELECT * FROM tcredential_store WHERE identifier = ?', $identifier);
+
+	return $key;
+}
+
+
 ##########################################################################
 =head2 C<< pandora_create_module_tags (I<$pa_config>, I<$dbh>, I<$id_agent_module>, I<$serialized_tags>) >>
 
@@ -3168,9 +3210,9 @@ sub pandora_create_agent ($$$$$$$$$$;$$$$$$$$$$) {
 	logger ($pa_config, "Server '$server_name' creating agent '$agent_name' address '$address'.", 10);
 	
 	if (!defined($group_id)) {
-		$group_id = $pa_config->{'autocreate_group'};
-		if (! defined (get_group_name ($dbh, $group_id))) {
-			logger($pa_config, "Group id $group_id does not exist (check autocreate_group config token)", 3);
+		$group_id = pandora_get_agent_group($pa_config, $dbh, $agent_name);
+		if ($group_id <= 0) {
+			logger($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': No valid group found.", 3);
 			return;
 		}
 	}
@@ -3352,7 +3394,7 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$$$) {
 	# Validate events with the same event id
 	if (defined ($id_extra) && $id_extra ne '') {
 		logger($pa_config, "Updating events with extended id '$id_extra'.", 10);
-		db_do ($dbh, 'UPDATE ' . $event_table . ' SET estado = 1, ack_utimestamp = ? WHERE estado = 0 AND id_extra=?', $utimestamp, $id_extra);
+		db_do ($dbh, 'UPDATE ' . $event_table . ' SET estado = 1, ack_utimestamp = ? WHERE estado IN (0,2) AND id_extra=?', $utimestamp, $id_extra);
 	}
 	
 	# Create the event
@@ -3420,6 +3462,47 @@ sub pandora_extended_event($$$$) {
 	);
 }
 
+##########################################################################
+# Returns a valid group ID to place an agent on success, -1 on error.
+##########################################################################
+sub pandora_get_agent_group {
+	my ($pa_config, $dbh, $agent_name, $agent_group, $agent_group_password) = @_;
+
+	my $group_id;
+	my @groups = $pa_config->{'autocreate_group_force'} == 1 ? ($pa_config->{'autocreate_group'}, $agent_group) : ($agent_group, $pa_config->{'autocreate_group'});
+	foreach my $group (@groups) {
+		next unless defined($group);
+
+		# Does the group exist?
+		if ($group eq $pa_config->{'autocreate_group'}) {
+			next if ($group <= 0);
+			$group_id = $group;
+			if (!defined(get_group_name ($dbh, $group_id))) {
+				logger($pa_config, "Group ID " . $group_id . " does not exist.", 10);
+				next;
+			}
+		} else {
+			next if ($group eq '');
+			$group_id = get_group_id ($dbh, $group);
+			if ($group_id <= 0) {
+				logger($pa_config, "Group " . $group . " does not exist.", 10);
+				next;
+			}
+		}
+
+		# Check the group password.
+		my $rc = enterprise_hook('check_group_password', [$dbh, $group_id, $agent_group_password]);
+		if (defined($rc) && $rc != 1) {
+			logger($pa_config, "Agent " . safe_output($agent_name) . " did not send a valid password for group ID $group_id.", 10);
+			next;
+		}
+
+		return $group_id;
+	}
+
+	return -1;
+}
+
 ##########################################################################
 =head2 C<< pandora_update_module_on_error (I<$pa_config>, I<$id_agent_module>, I<$dbh>) >> 
 
@@ -3860,23 +3943,23 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
 ##########################################################################
 # Search string for macros and substitutes them with their values.
 ##########################################################################
-sub subst_alert_macros ($$;$$$$) {
-	my ($string, $macros, $pa_config, $dbh, $agent, $module) = @_;
+sub subst_alert_macros ($$;$$$$$) {
+	my ($string, $macros, $pa_config, $dbh, $agent, $module, $alert) = @_;
 
 	my $macro_regexp = join('|', keys %{$macros});
 
 	my $subst_func;
-	if ($string =~ m/^(?:(")(?:.*)"|(')(?:.*)')$/) {
+	if (defined($string) && $string =~ m/^(?:(")(?:.*)"|(')(?:.*)')$/) {
 		my $quote = $1 ? $1 : $2;
 		$subst_func = sub {
-			my $macro = on_demand_macro($pa_config, $dbh, shift, $macros, $agent, $module);
+			my $macro = on_demand_macro($pa_config, $dbh, shift, $macros, $agent, $module,$alert);
 			$macro =~ s/'/'\\''/g; # close, escape, open
 			return decode_entities($quote . "'" . $macro . "'" . $quote); # close, quote, open
 		};
 	}
 	else {
 		$subst_func = sub {
-			my $macro = on_demand_macro($pa_config, $dbh, shift, $macros, $agent, $module);
+			my $macro = on_demand_macro($pa_config, $dbh, shift, $macros, $agent, $module, $alert);
 			return decode_entities($macro);
 		};
 	}
@@ -3910,8 +3993,8 @@ sub subst_column_macros ($$;$$$$) {
 ##########################################################################
 # Load macros that access the database on demand.
 ##########################################################################
-sub on_demand_macro($$$$$$) {
-	my ($pa_config, $dbh, $macro, $macros, $agent, $module) = @_;
+sub on_demand_macro($$$$$$;$) {
+	my ($pa_config, $dbh, $macro, $macros, $agent, $module,$alert) = @_;
 
 	# Static macro.
 	return $macros->{$macro} if (defined($macros->{$macro}));
@@ -3927,7 +4010,7 @@ sub on_demand_macro($$$$$$) {
 	} elsif ($macro eq '_moduletags_') {
 		return (defined ($module)) ? pandora_get_module_url_tags ($pa_config, $dbh, $module->{'id_agente_modulo'}) : '';
 	} elsif ($macro eq '_policy_') {
-		return (defined ($module)) ? enterprise_hook('get_policy_name', [$dbh, $module->{'id_policy_module'}]) : '';
+		return (defined ($alert)) ? enterprise_hook('get_policy_name_policy_alerts_id', [$dbh, $alert->{'id_policy_alerts'}]) : '';
 	} elsif ($macro eq '_email_tag_') {
 		return (defined ($module)) ? pandora_get_module_email_tags ($pa_config, $dbh, $module->{'id_agente_modulo'}) : '';
 	} elsif ($macro eq '_phone_tag_') {
@@ -4810,7 +4893,7 @@ sub pandora_process_event_replication ($) {
 			}
 			
 			# Get server id on metaconsole
-			my $metaconsole_server_id = enterprise_hook('get_metaconsole_setup_server_id', [$dbh_metaconsole, safe_input($pa_config->{'servername'})]);
+			my $metaconsole_server_id = enterprise_hook('get_metaconsole_setup_server_id', [$dbh]);
 		
 			# If the server name is not found in metaconsole setup: abort
 			if($metaconsole_server_id == -1) {
@@ -4859,32 +4942,36 @@ sub pandora_process_policy_queue ($) {
 	logger($pa_config, "Starting policy queue patrol process.", 1);
 
 	while($THRRUN == 1) {
+		eval {{
+			local $SIG{__DIE__};
 
-		# If we are not the master server sleep and check again.
-		if (pandora_is_master($pa_config) == 0) {
-			sleep ($pa_config->{'server_threshold'});
-			next;
-		}
+			# If we are not the master server sleep and check again.
+			if (pandora_is_master($pa_config) == 0) {
+				sleep ($pa_config->{'server_threshold'});
+				next;
+			}
+
+			my $operation = enterprise_hook('get_first_policy_queue', [$dbh]);
+			next unless (defined ($operation) && $operation ne '');
+
+			if($operation->{'operation'} eq 'apply' || $operation->{'operation'} eq 'apply_db') {
+				enterprise_hook('pandora_apply_policy', [$dbh, $pa_config, $operation->{'id_policy'}, $operation->{'id_agent'}, $operation->{'id'}, $operation->{'operation'}]);
+			}
+			elsif($operation->{'operation'} eq 'delete') {
+				if($operation->{'id_agent'} == 0) {
+					enterprise_hook('pandora_purge_policy_agents', [$dbh, $pa_config, $operation->{'id_policy'}]);
+				}
+				else {
+					enterprise_hook('pandora_delete_agent_from_policy', [$dbh, $pa_config, $operation->{'id_policy'}, $operation->{'id_agent'}]);
+				}
+			}
+
+			enterprise_hook('pandora_finish_queue_operation', [$dbh, $operation->{'id'}]);
+		}};
 
 		# Check the queue each 5 seconds
-		sleep (5);
+		sleep(5);
 		
-		my $operation = enterprise_hook('get_first_policy_queue', [$dbh]);
-		next unless (defined ($operation) && $operation ne '');
-
-		if($operation->{'operation'} eq 'apply' || $operation->{'operation'} eq 'apply_db') {
-			enterprise_hook('pandora_apply_policy', [$dbh, $pa_config, $operation->{'id_policy'}, $operation->{'id_agent'}, $operation->{'id'}, $operation->{'operation'}]);
-		}
-		elsif($operation->{'operation'} eq 'delete') {
-			if($operation->{'id_agent'} == 0) {
-				enterprise_hook('pandora_purge_policy_agents', [$dbh, $pa_config, $operation->{'id_policy'}]);
-			}
-			else {
-				enterprise_hook('pandora_delete_agent_from_policy', [$dbh, $pa_config, $operation->{'id_policy'}, $operation->{'id_agent'}]);
-			}
-		}
-		
-		enterprise_hook('pandora_finish_queue_operation', [$dbh, $operation->{'id'}]);
 	}
 
 	db_disconnect($dbh);
diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm
index 8e08a7d482..b7beb919a3 100644
--- a/pandora_server/lib/PandoraFMS/DataServer.pm
+++ b/pandora_server/lib/PandoraFMS/DataServer.pm
@@ -58,6 +58,7 @@ my %Agents :shared;
 my $Sem :shared;
 my $TaskSem :shared;
 my $AgentSem :shared;
+my $XMLinSem :shared;
 
 ########################################################################################
 # Data Server class constructor.
@@ -74,6 +75,7 @@ sub new ($$;$) {
 	$Sem = Thread::Semaphore->new;
 	$TaskSem = Thread::Semaphore->new (0);
 	$AgentSem = Thread::Semaphore->new (1);
+	$XMLinSem = Thread::Semaphore->new (1);
 	
 	# Call the constructor of the parent class
 	my $self = $class->SUPER::new($config, DATASERVER, \&PandoraFMS::DataServer::data_producer, \&PandoraFMS::DataServer::data_consumer, $dbh);
@@ -83,6 +85,13 @@ sub new ($$;$) {
 		push(@XML::Parser::Expat::Encoding_Path, $config->{'enc_dir'});
 	}
 
+	if ($config->{'autocreate_group'} > 0 && !defined(get_group_name ($dbh, $config->{'autocreate_group'}))) {
+		my $msg = "Group id " . $config->{'autocreate_group'} . " does not exist (check autocreate_group config token).";
+		logger($config, $msg, 3);
+		print_message($config, $msg, 1);
+		pandora_event ($config, $msg, 0, 0, 0, 0, 0, 'error', 0, $dbh);
+	}
+
 	bless $self, $class;
 	return $self;
 }
@@ -149,14 +158,8 @@ sub data_producer ($) {
 		next if ($file !~ /^(.*)[\._]\d+\.data$/);
 		my $agent_name = $1;
 
-		$AgentSem->down ();
-		if (defined ($Agents{$agent_name})) {
-			$AgentSem->up ();
-			next;
-		}
-		$Agents{$agent_name} = 1;
-		$AgentSem->up ();
-
+		next if (agent_lock($pa_config, $agent_name) == 0);
+			
 		push (@tasks, $file);
 	}
 
@@ -174,6 +177,7 @@ sub data_consumer ($$) {
 	my $agent_name = $1;		
 	my $file_name = $pa_config->{'incomingdir'};
 	my $xml_err;
+	my $error;
 	
 	# Fix path
 	$file_name .= "/" unless (substr ($file_name, -1, 1) eq '/');	
@@ -181,9 +185,7 @@ sub data_consumer ($$) {
 
 	# Double check that the file exists
 	if (! -f $file_name) {
-		$AgentSem->down ();
-		delete ($Agents{$agent_name});
-		$AgentSem->up ();
+		agent_unlock($pa_config, $agent_name);
 		return;
 	}
 
@@ -192,18 +194,37 @@ sub data_consumer ($$) {
 
 	for (0..1) {
 		eval {
+			local $SIG{__DIE__};
 			threads->yield;
+			# XML::SAX::ExpatXS is not thread safe.
+			if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
+				$XMLinSem->down();
+			}
 
 			$xml_data = XMLin ($file_name, forcearray => 'module');
+
+			if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
+				$XMLinSem->up();
+			}
 		};
 	
 		# Invalid XML
-		if ($@ || ref($xml_data) ne 'HASH') {
+		if ($@) {
+			$error = 1;
+			if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
+				$XMLinSem->up();
+			}
+		}
+
+		if ($error || ref($xml_data) ne 'HASH') {
+			
 			if ($@) {
 				$xml_err = $@;
 			} else {
 				$xml_err = "Invalid XML format.";
 			}
+
+			logger($pa_config, "Failed to parse $file_name $xml_err", 3);
 			sleep (2);
 			next;
 		}
@@ -213,9 +234,7 @@ sub data_consumer ($$) {
 
 		# Double check that the file exists
 		if (! -f $file_name) {
-			$AgentSem->down ();
-			delete ($Agents{$agent_name});
-			$AgentSem->up ();
+			agent_unlock($pa_config, $agent_name);
 			return;
 		}
 
@@ -231,17 +250,13 @@ sub data_consumer ($$) {
 		} else {
 			process_xml_data ($self->getConfig (), $file_name, $xml_data, $self->getServerID (), $self->getDBH ());
 		}
-		$AgentSem->down ();
-		delete ($Agents{$agent_name});
-		$AgentSem->up ();
+		agent_unlock($pa_config, $agent_name);
 		return;	
 	}
 
 	rename($file_name, $file_name . '_BADXML');
 	pandora_event ($pa_config, "Unable to process XML data file '$file_name': $xml_err", 0, 0, 0, 0, 0, 'error', 0, $dbh);
-	$AgentSem->down ();
-	delete ($Agents{$agent_name});
-	$AgentSem->up ();
+	agent_unlock($pa_config, $agent_name);
 }
 
 ###############################################################################
@@ -341,33 +356,10 @@ sub process_xml_data ($$$$$) {
 		
 		# Get OS, group and description
 		my $os = pandora_get_os ($dbh, $data->{'os_name'});
-		$group_id = $pa_config->{'autocreate_group'};
-		if (! defined (get_group_name ($dbh, $group_id))) {
-			if (defined ($data->{'group_id'}) && $data->{'group_id'} ne '') {
-				$group_id = $data->{'group_id'};
-				if (! defined (get_group_name ($dbh, $group_id))) {
-					pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group ID '" . $group_id . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
-					logger($pa_config, "Group ID " . $group_id . " does not exist.", 3);
-					return;
-				}
-			} elsif (defined ($data->{'group'}) && $data->{'group'} ne '') {
-				$group_id = get_group_id ($dbh, $data->{'group'});
-				if (! defined (get_group_name ($dbh, $group_id))) {
-					pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': group '" . safe_output($data->{'group'}) . "' does not exist.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
-					logger($pa_config, "Group " . $data->{'group'} . " does not exist.", 3);
-					return;
-				}
-			} else {
-					pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': autocreate_group $group_id does not exist. Edit the server configuration file and change it.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
-					logger($pa_config, "Group id $group_id does not exist (check autocreate_group config token).", 3);
-					return;
-			}
-		}
-
-		# Check the group password.
-		my $rc = enterprise_hook('check_group_password', [$dbh, $group_id, $data->{'group_password'}]);
-		if (defined($rc) && $rc != 1) {
-			logger($pa_config, "Agent $agent_name did not send a valid password for group id $group_id.", 10);
+		$group_id = pandora_get_agent_group($pa_config, $dbh, $agent_name, $data->{'group'}, $data->{'group_password'});
+		if ($group_id <= 0) {
+			pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': No valid group found.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
+			logger($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': No valid group found.", 3);
 			return;
 		}
 
@@ -1059,5 +1051,37 @@ sub process_xml_matrix_network {
 	return;
 }
 
+##########################################################################
+# Get a lock on the given agent. Return 1 on success, 0 otherwise.
+##########################################################################
+sub agent_lock {
+	my ($pa_config, $agent_name) = @_;
+
+	return 1 if ($pa_config->{'dataserver_lifo'} == 1);
+
+	$AgentSem->down ();
+	if (defined ($Agents{$agent_name})) {
+		$AgentSem->up ();
+		return 0;
+	}
+	$Agents{$agent_name} = 1;
+	$AgentSem->up ();
+
+	return 1;
+}
+
+##########################################################################
+# Remove the lock on the given agent.
+##########################################################################
+sub agent_unlock {
+	my ($pa_config, $agent_name) = @_;
+
+	return if ($pa_config->{'dataserver_lifo'} == 1);
+
+	$AgentSem->down ();
+	delete ($Agents{$agent_name});
+	$AgentSem->up ();
+}
+
 1;
 __END__
diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm
index e15511de44..6f7eab4c68 100644
--- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm
+++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm
@@ -56,15 +56,7 @@ my $TaskSem :shared;
 use constant {
     OS_OTHER => 10,
     OS_ROUTER => 17,
-    OS_SWITCH => 18,
-    DISCOVERY_HOSTDEVICES => 0,
-    DISCOVERY_HOSTDEVICES_CUSTOM => 1,
-    DISCOVERY_CLOUD_AWS => 2,
-    DISCOVERY_APP_VMWARE => 3,
-    DISCOVERY_APP_MYSQL => 4,
-    DISCOVERY_APP_ORACLE => 5,
-    DISCOVERY_CLOUD_AWS_EC2 => 6,
-    DISCOVERY_CLOUD_AWS_RDS => 7
+    OS_SWITCH => 18
 };
 
 ########################################################################################
@@ -73,7 +65,8 @@ use constant {
 sub new ($$$$$$) {
     my ($class, $config, $dbh) = @_;
     
-    return undef unless $config->{'reconserver'} == 1 || $config->{'discoveryserver'} == 1;
+    return undef unless (defined($config->{'reconserver'}) && $config->{'reconserver'} == 1)
+     || (defined($config->{'discoveryserver'}) && $config->{'discoveryserver'} == 1);
     
     if (! -e $config->{'nmap'}) {
         logger ($config, ' [E] ' . $config->{'nmap'} . " needed by " . $config->{'rb_product_name'} . " Discovery Server not found.", 1);
@@ -113,10 +106,6 @@ sub run ($) {
     print_message ($pa_config, " [*] Starting " . $pa_config->{'rb_product_name'} . " Discovery Server.", 1);
     my $threads = $pa_config->{'recon_threads'};
 
-    # Prepare some environmental variables.
-    $ENV{'AWS_ACCESS_KEY_ID'} = pandora_get_config_value($dbh, 'aws_access_key_id');
-    $ENV{'AWS_SECRET_ACCESS_KEY'} = pandora_get_config_value($dbh, 'aws_secret_access_key');
-
     # Use hightest value
     if ($pa_config->{'discovery_threads'}  > $pa_config->{'recon_threads'}) {
         $threads = $pa_config->{'discovery_threads'};
@@ -141,12 +130,21 @@ sub data_producer ($) {
     # Manual tasks are "forced" like the other, setting the utimestamp to 1
     # By default, after create a tasks it takes the utimestamp to 0
     # Status -1 means "done".
-    
-    my @rows = get_db_rows ($dbh, 'SELECT * FROM trecon_task 
-        WHERE id_recon_server = ?
-        AND disabled = 0
-        AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1)
-            OR (status = -1 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()))', $server_id);
+    my @rows;
+    if (pandora_is_master($pa_config) == 0) {
+        @rows = get_db_rows ($dbh, 'SELECT * FROM trecon_task 
+            WHERE id_recon_server = ?
+            AND disabled = 0
+            AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1)
+                OR (status = -1 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()))', $server_id);
+    } else {
+        @rows = get_db_rows ($dbh, 'SELECT * FROM trecon_task 
+            WHERE (id_recon_server = ? OR id_recon_server = ANY(SELECT id_server FROM tserver WHERE status = 0 AND server_type = ?))
+            AND disabled = 0
+            AND ((utimestamp = 0 AND interval_sweep != 0 OR status = 1)
+                OR (status = -1 AND interval_sweep > 0 AND (utimestamp + interval_sweep) < UNIX_TIMESTAMP()))', $server_id, DISCOVERYSERVER);
+    }
+
     foreach my $row (@rows) {
         
         # Update task status
@@ -191,45 +189,11 @@ sub data_consumer ($$) {
         my $main_event = pandora_event($pa_config, "[Discovery] Execution summary",$task->{'id_group'}, 0, 0, 0, 0, 'system', 0, $dbh);
 
         my %cnf_extra;
-        if ($task->{'type'} == DISCOVERY_CLOUD_AWS_EC2
-        || $task->{'type'} == DISCOVERY_CLOUD_AWS_RDS) {
-            $cnf_extra{'aws_access_key_id'} = pandora_get_config_value($dbh, 'aws_access_key_id');
-            $cnf_extra{'aws_secret_access_key'} = pandora_get_config_value($dbh, 'aws_secret_access_key');
-            $cnf_extra{'cloud_util_path'} = pandora_get_config_value($dbh, 'cloud_util_path');
-
-            if (!defined($ENV{'AWS_ACCESS_KEY_ID'}) || !defined($ENV{'AWS_SECRET_ACCESS_KEY'})
-            || $cnf_extra{'aws_secret_access_key'} ne $ENV{'AWS_ACCESS_KEY_ID'}
-            || $cnf_extra{'cloud_util_path'} ne $ENV{'AWS_SECRET_ACCESS_KEY'}) {
-                # Environmental data is out of date. Create a tmp file to manage
-                # credentials. Perl limitation. We cannot update ENV here.
-                $cnf_extra{'creds_file'} = $pa_config->{'temporal'} . '/tmp_discovery.' . md5($task->{'id_rt'} . $task->{'name'} . time());
-                eval {
-                    open(my $__file_cfg, '> '. $cnf_extra{'creds_file'}) or die($!);
-                    print $__file_cfg $cnf_extra{'aws_access_key_id'} . "\n";
-                    print $__file_cfg $cnf_extra{'aws_secret_access_key'} . "\n";
-                    close($__file_cfg);
-                    set_file_permissions(
-                        $pa_config,
-                        $cnf_extra{'creds_file'},
-                        "0600"
-                    );
-                };
-                if ($@) {
-                    logger(
-                        $pa_config,
-                        'Cannot instantiate configuration file for task: ' . safe_output($task->{'name'}),
-                        5
-                    );
-                    # A server restart will override ENV definition (see run)
-                    logger(
-                        $pa_config,
-                        'Cannot execute Discovery task: ' . safe_output($task->{'name'}) . '. Please restart the server.',
-                        1
-                    );
-                    # Skip this task.
-                    return;
-                }
-            }
+        
+        my $r = enterprise_hook('discovery_generate_extra_cnf',[$pa_config, $dbh, $task, \%cnf_extra]);
+        if (defined($r) && $r eq 'ERR') {
+            # Could not generate extra cnf, skip this task.
+            return;
         }
 
         my $recon = new PandoraFMS::Recon::Base(
@@ -264,6 +228,7 @@ sub data_consumer ($$) {
             server_id => $server_id,
             %{$pa_config},
             task_data => $task,
+            public_url => PandoraFMS::Config::pandora_get_tconfig_token($dbh, 'public_url', ''),
             %cnf_extra
         );
 
@@ -274,6 +239,12 @@ sub data_consumer ($$) {
         && -f $cnf_extra{'creds_file'}) {
 			unlink($cnf_extra{'creds_file'});
 		}
+
+
+        # Clean one shot tasks
+        if ($task->{'type'} eq DISCOVERY_DEPLOY_AGENTS) {
+            db_delete_limit($dbh, ' trecon_task ', ' id_rt = ? ', 1, $task->{'id_rt'});   
+        }
     };
     if ($@) {
         logger(
@@ -384,9 +355,10 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
 
     # Use xprobe2 if available
     if (-e $self->{pa_config}->{xprobe2}) {
-            my $output = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL | grep 'Running OS' | head -1`;
-            return OS_OTHER if ($? != 0);
+        my $output = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL | grep 'Running OS' | head -1`;
+        if ($? == 0) {
             return pandora_get_os($self->{'dbh'}, $output);
+        }
     }
     
     # Use nmap by default
@@ -481,7 +453,7 @@ sub PandoraFMS::Recon::Base::connect_agents($$$$$) {
     }
 
     # Connect the modules if they are not already connected.
-    my $connection_id = get_db_value($self->{'dbh'}, 'SELECT id FROM tmodule_relationship WHERE (module_a = ? AND module_b = ?) OR (module_b = ? AND module_a = ?)', $module_id_1, $module_id_2, $module_id_1, $module_id_2);
+    my $connection_id = get_db_value($self->{'dbh'}, 'SELECT id FROM tmodule_relationship WHERE (module_a = ? AND module_b = ? AND `type` = "direct") OR (module_b = ? AND module_a = ? AND `type` = "direct")', $module_id_1, $module_id_2, $module_id_1, $module_id_2);
     if (! defined($connection_id)) {
         db_do($self->{'dbh'}, 'INSERT INTO tmodule_relationship (`module_a`, `module_b`, `id_rt`) VALUES(?, ?, ?)', $module_id_1, $module_id_2, $self->{'task_id'});
     }
diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm
index e070654e82..cdb7da8680 100644
--- a/pandora_server/lib/PandoraFMS/PluginTools.pm
+++ b/pandora_server/lib/PandoraFMS/PluginTools.pm
@@ -31,8 +31,8 @@ use base 'Exporter';
 our @ISA = qw(Exporter);
 
 # version: Defines actual version of Pandora Server for this module only
-my $pandora_version = "7.0NG.735";
-my $pandora_build = "190605";
+my $pandora_version = "7.0NG.738";
+my $pandora_build = "190906";
 our $VERSION = $pandora_version." ".$pandora_build;
 
 our %EXPORT_TAGS = ( 'all' => [ qw() ] );
diff --git a/pandora_server/lib/PandoraFMS/Recon/Base.pm b/pandora_server/lib/PandoraFMS/Recon/Base.pm
index 23532d843b..223c36f248 100644
--- a/pandora_server/lib/PandoraFMS/Recon/Base.pm
+++ b/pandora_server/lib/PandoraFMS/Recon/Base.pm
@@ -31,7 +31,9 @@ use constant {
 	DISCOVERY_APP_MYSQL => 4,
 	DISCOVERY_APP_ORACLE => 5,
 	DISCOVERY_CLOUD_AWS_EC2 => 6,
-	DISCOVERY_CLOUD_AWS_RDS => 7
+	DISCOVERY_CLOUD_AWS_RDS => 7,
+	DISCOVERY_CLOUD_AZURE_COMPUTE => 8,
+	DISCOVERY_DEPLOY_AGENTS => 9,
 };
 
 # /dev/null
@@ -1632,6 +1634,41 @@ sub app_scan($) {
 
 }
 
+
+##########################################################################
+# Perform a deployment scan.
+##########################################################################
+sub deploy_scan($) {
+	my $self = shift;
+	my ($progress, $step);
+
+	my $type = '';
+
+	# Initialize deployer object.
+	my $deployer = PandoraFMS::Recon::Util::enterprise_new(
+		'PandoraFMS::Recon::Deployer',
+		[
+			task_data => $self->{'task_data'},
+			parent => $self
+		]
+
+	);
+
+	if (!$deployer) {
+		# Failed to initialize, check Cloud credentials or anything.
+		call('message', 'Unable to initialize PandoraFMS::Recon::Deployer', 3);
+	} else {
+		# Let deployer object manage scan.
+		$deployer->scan();
+	}
+
+	# Update progress.
+	# Done!
+	$self->{'step'} = '';
+	$self->call('update_progress', -1);
+}
+
+
 ##########################################################################
 # Perform a network scan.
 ##########################################################################
@@ -1653,6 +1690,10 @@ sub scan($) {
 			# Cloud scan.
 			return $self->cloud_scan();
 		}
+
+		if($self->{'task_data'}->{'type'} == DISCOVERY_DEPLOY_AGENTS) {
+			return $self->deploy_scan();
+		}
 	}
 
 	# Find devices.
diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm
index 02bb9f05ea..36050e4275 100755
--- a/pandora_server/lib/PandoraFMS/Tools.pm
+++ b/pandora_server/lib/PandoraFMS/Tools.pm
@@ -29,6 +29,7 @@ use Sys::Syslog;
 use Scalar::Util qw(looks_like_number);
 use LWP::UserAgent;
 use threads;
+use threads::shared;
 
 # New in 3.2. Used to sendmail internally, without external scripts
 # use Module::Loaded;
@@ -71,6 +72,16 @@ our @EXPORT = qw(
 	MIGRATIONSERVER
 	METACONSOLE_LICENSE
 	OFFLINE_LICENSE
+	DISCOVERY_HOSTDEVICES
+	DISCOVERY_HOSTDEVICES_CUSTOM
+	DISCOVERY_CLOUD_AWS
+	DISCOVERY_APP_VMWARE
+	DISCOVERY_APP_MYSQL
+	DISCOVERY_APP_ORACLE
+	DISCOVERY_CLOUD_AWS_EC2
+	DISCOVERY_CLOUD_AWS_RDS
+	DISCOVERY_CLOUD_AZURE_COMPUTE
+	DISCOVERY_DEPLOY_AGENTS
 	$DEVNULL
 	$OS
 	$OS_VERSION
@@ -171,6 +182,18 @@ use constant OFFLINE_LICENSE => 0x02;
 use constant RECOVERED_ALERT => 0;
 use constant FIRED_ALERT => 1;
 
+# Discovery task types
+use constant DISCOVERY_HOSTDEVICES => 0;
+use constant DISCOVERY_HOSTDEVICES_CUSTOM => 1;
+use constant DISCOVERY_CLOUD_AWS => 2;
+use constant DISCOVERY_APP_VMWARE => 3;
+use constant DISCOVERY_APP_MYSQL => 4;
+use constant DISCOVERY_APP_ORACLE => 5;
+use constant DISCOVERY_CLOUD_AWS_EC2 => 6;
+use constant DISCOVERY_CLOUD_AWS_RDS => 7;
+use constant DISCOVERY_CLOUD_AZURE_COMPUTE => 8;
+use constant DISCOVERY_DEPLOY_AGENTS => 9;
+
 # Set OS, OS version and /dev/null
 our $OS = $^O;
 our $OS_VERSION = "unknown";
@@ -1864,7 +1887,7 @@ sub stop_server_threads {
 	$THRRUN = 0;
 
 	foreach my $thr (@ServerThreads) {
-			$thr->detach();
+			$thr->join();
 	}
 
 	@ServerThreads = ();
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index 73deb40880..c8d7c85652 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -2,8 +2,8 @@
 # Pandora FMS Server 
 #
 %define name        pandorafms_server
-%define version     7.0NG.735
-%define release     190605
+%define version     7.0NG.738
+%define release     190906
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index f0a73adbad..f368d394bf 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -2,8 +2,8 @@
 # Pandora FMS Server 
 #
 %define name        pandorafms_server
-%define version     7.0NG.735
-%define release     190605
+%define version     7.0NG.738
+%define release     190906
 
 Summary:            Pandora FMS Server
 Name:               %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index a892f488c9..ab51df1d95 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -8,8 +8,8 @@
 # This code is licensed under GPL 2.0 license.
 # **********************************************************************
 
-PI_VERSION="7.0NG.735"
-PI_BUILD="190605"
+PI_VERSION="7.0NG.738"
+PI_BUILD="190906"
 
 MODE=$1
 if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index 465b86dbb0..daa4f0d901 100644
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -34,7 +34,7 @@ use PandoraFMS::Config;
 use PandoraFMS::DB;
 
 # version: define current version
-my $version = "7.0NG.735 PS190605";
+my $version = "7.0NG.738 PS190906";
 
 # Pandora server configuration
 my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
old mode 100644
new mode 100755
index d992deb676..0536aa058b
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -36,7 +36,7 @@ use Encode::Locale;
 Encode::Locale::decode_argv;
 
 # version: define current version
-my $version = "7.0NG.735 PS190605";
+my $version = "7.0NG.738 PS190906";
 
 # save program name for logging
 my $progname = basename($0);
@@ -284,19 +284,94 @@ sub api_call($$$;$$$$) {
 	return $content;
 }
 
+
+###############################################################################
+# Update token conf file agent
+###############################################################################
+sub update_conf_txt ($$$$) {
+	my ($conf, $agent_name, $token, $value) = @_;
+
+	# Read the conf of each agent.
+	my $conf_file_txt = enterprise_hook(
+		'read_agent_conf_file',
+		[
+			$conf,
+			$agent_name
+		]
+	);
+
+	# Check if there is agent conf.
+	if(!$conf_file_txt){
+		return 0;
+	}
+
+	my $updated = 0;
+	my $txt_content = "";
+
+	my @lines = split /\n/, $conf_file_txt;
+
+	foreach my $line (@lines) {
+		if ($line =~ /^\s*$token\s/ || $line =~ /^#$token\s/ || $line =~ /^#\s$token\s/) {
+			$txt_content .= $token.' '.$value."\n";
+			$updated = 1;
+		} else {
+			$txt_content .= $line."\n";
+		}
+	}
+
+	if ($updated == 0) {
+		$txt_content .= "\n$token $value\n";
+	}
+
+	# Write the conf.
+	my $result = enterprise_hook(
+		'write_agent_conf_file',
+		[
+			$conf,
+			$agent_name,
+			$txt_content
+		]
+	);
+
+	return $result;
+}
+
+
 ###############################################################################
 # Disable a entire group
 ###############################################################################
 sub pandora_disable_group ($$$) {
     my ($conf, $dbh, $group) = @_;
 
+	my @agents_bd = [];
+	my $result = 0;
+
 	if ($group == 0){
+		# Extract all the names of the pandora agents if it is for all = 0.
+		@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente');
+
+		# Update bbdd.
 		db_do ($dbh, "UPDATE tagente SET disabled = 1");
 	}
 	else {
+		# Extract all the names of the pandora agents if it is for group.
+		@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente WHERE id_grupo = ?', $group);
+
+		# Update bbdd.
 		db_do ($dbh, "UPDATE tagente SET disabled = 1 WHERE id_grupo = $group");
 	}
-    exit;
+
+	foreach my $name_agent (@agents_bd) {
+		# Check the standby field I put it to 0.
+		my $new_conf = update_conf_txt(
+			$conf,
+			$name_agent->{'nombre'},
+			'standby',
+			'1'
+		);
+	}
+
+    return $result;
 }
 
 ###############################################################################
@@ -305,13 +380,35 @@ sub pandora_disable_group ($$$) {
 sub pandora_enable_group ($$$) {
     my ($conf, $dbh, $group) = @_;
 
+	my @agents_bd = [];
+	my $result = 0;
+
 	if ($group == 0){
-			db_do ($dbh, "UPDATE tagente SET disabled = 0");
+		# Extract all the names of the pandora agents if it is for all = 0.
+		@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente');
+
+		# Update bbdd.
+		$result = db_do ($dbh, "UPDATE tagente SET disabled = 0");
 	}
 	else {
-			db_do ($dbh, "UPDATE tagente SET disabled = 0 WHERE id_grupo = $group");
+		# Extract all the names of the pandora agents if it is for group.
+		@agents_bd = get_db_rows ($dbh, 'SELECT nombre FROM tagente WHERE id_grupo = ?', $group);
+
+		# Update bbdd.
+		$result = db_do ($dbh, "UPDATE tagente SET disabled = 0 WHERE id_grupo = $group");
 	}
-    exit;
+
+	foreach my $name_agent (@agents_bd) {
+		# Check the standby field I put it to 0.
+		my $new_conf = update_conf_txt(
+			$conf,
+			$name_agent->{'nombre'},
+			'standby',
+			'0'
+		);
+	}
+
+    return $result;
 }
 
 ##############################################################################
@@ -3801,9 +3898,8 @@ sub cli_get_agent_group() {
 				else {
 					my $id_group = get_agent_group ($dbh_metaconsole, $id_agent);
 					my $group_name = get_group_name ($dbh_metaconsole, $id_group);
-					my $metaconsole_name = enterprise_hook('get_metaconsole_setup_server_name',[$dbh, $server]);
 					$agent_name = safe_output($agent_name);
-					print "[INFO] Server: $metaconsole_name Agent: $agent_name Name Group: $group_name\n\n";
+					print "[INFO] Agent: $agent_name Name Group: $group_name\n\n";
 				}
 			}
 		}
@@ -3843,7 +3939,6 @@ sub cli_get_agent_group_id() {
 			foreach my $server (@servers_id) {
 				my $dbh_metaconsole = enterprise_hook('get_node_dbh',[$conf, $server, $dbh]);
 				
-				my $metaconsole_name = enterprise_hook('get_metaconsole_setup_server_name',[$dbh, $server]);
 				my $id_agent = get_agent_id($dbh_metaconsole,$agent_name);
 				
 				if ($id_agent == -1) {
@@ -3852,7 +3947,7 @@ sub cli_get_agent_group_id() {
 				else {
 					my $id_group = get_agent_group ($dbh_metaconsole, $id_agent);
 					$agent_name = safe_output($agent_name);
-					print "Server: $metaconsole_name Agent: $agent_name ID Group: $id_group\n\n";
+					print "Agent: $agent_name ID Group: $id_group\n\n";
 				}
 			}
 		}
diff --git a/pandora_server/util/pandora_smpp.pl b/pandora_server/util/pandora_smpp.pl
new file mode 100755
index 0000000000..af85d496f5
--- /dev/null
+++ b/pandora_server/util/pandora_smpp.pl
@@ -0,0 +1,152 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Net::SMPP;
+
+use lib '/usr/lib/perl5';
+use PandoraFMS::PluginTools qw(read_configuration);
+
+my $HELP =<<EO_H;
+
+
+#######################
+Pandora FMS SMPP client
+#######################
+
+Usage:
+
+$0 -server <smsc_server:port> -user <user_id> -password <user_password> -source <source_number> -destination <destination_numbers> -message <short_message> [OPTIONS]
+
+- <destination_numbers>            Comma separated list of destination numbers (+123456789,+234567891,...)
+
+OPTIONS:
+
+-service_type <value>              Default: ''
+-source_addr_ton <value>           Default: 0x00
+-source_addr_npi <value>           Default: 0x00
+-dest_addr_ton <value>             Default: 0x00
+-dest_addr_npi <value>             Default: 0x00
+-esm_class <value>                 Default: 0x00
+-protocol_id <value>               Default: 0x00
+-priority_flag <value>             Default: 0x00
+-schedule_delivery_time <value>    Default: ''
+-validity_period <value>           Default: ''
+-registered_delivery <value>       Default: 0x00
+-replace_if_present_flag <value>   Default: 0x00
+-data_coding <value>               Default: 0x00
+-sm_default_msg_id <value>         Default: 0x00
+-system_type <value>               Default: ''
+-interface_version <value>         Default: 0x34
+-addr_ton <value>                  Default: 0x00
+-addr_npi <value>                  Default: 0x00
+-address_range <value>             Default: ''
+
+Example:
+
+$0 -server 192.168.1.50:2775 -user myuser -password mypassword -source +123456789 -destination +234567891 -message "Content of SMS message"
+
+EO_H
+
+my $config;
+$config = read_configuration($config);
+
+if (!$config->{'server'}){
+        print "Parameter -server is mandatory.";
+        print $HELP;
+        exit;
+}
+if (!$config->{'user'}){
+        print "Parameter -user is mandatory.";
+        print $HELP;
+        exit;
+}
+if (!$config->{'password'}){
+        print "Parameter -password is mandatory.";
+        print $HELP;
+        exit;
+}
+if (!$config->{'source'}){
+        print "Parameter -source is mandatory.";
+        print $HELP;
+        exit;
+}
+if (!$config->{'destination'}){
+        print "Parameter -destination is mandatory.";
+        print $HELP;
+        exit;
+}
+if (!$config->{'message'}){
+        print "Parameter -message is mandatory.";
+        print $HELP;
+        exit;
+}
+
+my ($smsc_server, $smsc_port) = split /:/, $config->{'server'};
+
+my @destination_numbers = $config->{'destination'};
+
+if (!$smsc_port){
+	$smsc_port = 2775;
+}
+
+$config->{'service_type'}              = ''     if (!$config->{'service_type'});
+$config->{'source_addr_ton'}           = '0x00' if (!$config->{'source_addr_ton'});
+$config->{'source_addr_npi'}           = '0x00' if (!$config->{'source_addr_npi'});
+$config->{'dest_addr_ton'}             = '0x00' if (!$config->{'dest_addr_ton'});
+$config->{'dest_addr_npi'}             = '0x00' if (!$config->{'dest_addr_npi'});
+$config->{'esm_class'}                 = '0x00' if (!$config->{'esm_class'});
+$config->{'protocol_id'}               = '0x00' if (!$config->{'protocol_id'});
+$config->{'priority_flag'}             = '0x00' if (!$config->{'priority_flag'});
+$config->{'schedule_delivery_time'}    = ''     if (!$config->{'schedule_delivery_time'});
+$config->{'validity_period'}           = ''     if (!$config->{'validity_period'});
+$config->{'registered_delivery'}       = '0x00' if (!$config->{'registered_delivery'});
+$config->{'replace_if_present_flag'}   = '0x00' if (!$config->{'replace_if_present_flag'});
+$config->{'data_coding'}               = '0x00' if (!$config->{'data_coding'});
+$config->{'sm_default_msg_id'}         = '0x00' if (!$config->{'sm_default_msg_id'});
+$config->{'system_type'}               = ''     if (!$config->{'system_type'});
+$config->{'interface_version'}         = '0x34' if (!$config->{'interface_version'});
+$config->{'addr_ton'}                  = '0x00' if (!$config->{'addr_ton'});
+$config->{'addr_npi'}                  = '0x00' if (!$config->{'addr_npi'});
+$config->{'address_range'}             = ''     if (!$config->{'address_range'});
+
+my $smpp = Net::SMPP->new_transmitter(
+        $smsc_server,
+        port              => $smsc_port,
+        system_id         => $config->{'user'},
+        password          => $config->{'password'},
+        system_type       => $config->{'system_type'},
+        interface_version => $config->{'interface_version'},
+        addr_ton          => $config->{'addr_ton'},
+        addr_npi          => $config->{'addr_npi'},
+        address_range     => $config->{'address_range'}
+) or die "Unable to connect to [$smsc_server] on port [$smsc_port] with user [" . $config->{'user'} . "]\n";
+
+foreach my $destination_number (@destination_numbers){
+        my $resp_pdu = $smpp->submit_sm(
+                source_addr             => $config->{'source'},
+                destination_addr        => $destination_number,
+                short_message           => $config->{'message'},
+                service_type            => $config->{'service_type'},
+                source_addr_ton         => $config->{'source_addr_ton'},
+                source_addr_npi         => $config->{'source_addr_npi'},
+                dest_addr_ton           => $config->{'dest_addr_ton'},
+                dest_addr_npi           => $config->{'dest_addr_npi'},
+                esm_class               => $config->{'esm_class'},
+                protocol_id             => $config->{'protocol_id'},
+                priority_flag           => $config->{'priority_flag'},
+                schedule_delivery_time  => $config->{'schedule_delivery_time'},
+                validity_period         => $config->{'validity_period'},
+                registered_delivery     => $config->{'registered_delivery'},
+                replace_if_present_flag => $config->{'replace_if_present_flag'},
+                data_coding             => $config->{'data_coding'},
+                sm_default_msg_id       => $config->{'sm_default_msg_id'}
+        );
+
+        if ($resp_pdu->{message_id}){
+                print "SUCCESS: Message sent to [$destination_number]\n";
+        }else{
+                print "ERROR: Unable to send message to [$destination_number] - Response error: " . $resp_pdu->explain_status() . "\n";
+        }
+}
\ No newline at end of file
diff --git a/pandora_server/util/plugin/dns_plugin.sh b/pandora_server/util/plugin/dns_plugin.sh
index 6ec4de874e..cbbebc1ff5 100755
--- a/pandora_server/util/plugin/dns_plugin.sh
+++ b/pandora_server/util/plugin/dns_plugin.sh
@@ -68,27 +68,16 @@ then
         help
 fi
 
-TMPFILE=/tmp/dns_$DNS_CHECK.tmp
 
-dig  @$DNS_CHECK $DOMAIN_CHECK > $TMPFILE
-RETURN_IP=`cat $TMPFILE | grep "^$DOMAIN_CHECK" | awk '{print $5}'`
-RETURN_TIMEOUT=`cat $TMPFILE | grep "Query time" | grep -o "[0-9]*"`
-
- rm $TMPFILE 2> /dev/null
-
-if [ $TIMEOUT_CHECK == 1 ]
-then
-    echo $RETURN_TIMEOUT
-    exit 0
-fi
-
-if [ "$RETURN_IP" != "$IP_CHECK" ]
-then
-    echo 0
-    exit 1
-else
-    echo 1
-    exit 0
-fi
+results=`dig @$DNS_CHECK +nocmd $DOMAIN_CHECK +multiline +noall +answer A`
+targets=`echo "$results"| awk '{print $5}'`
 
+for x in $targets; do
+        if [ "$x" == "$IP_CHECK" ]; then
+                echo 1
+                exit 0
+        fi
+done
 
+echo 0
+exit 0
diff --git a/pandora_server/util/recon_scripts/snmp-recon.pl b/pandora_server/util/recon_scripts/snmp-recon.pl
index 6bf2d6b709..c7009fd75a 100755
--- a/pandora_server/util/recon_scripts/snmp-recon.pl
+++ b/pandora_server/util/recon_scripts/snmp-recon.pl
@@ -1005,7 +1005,7 @@ sub connect_pandora_agents($$$$) {
 	}
 
 	# Connect the modules if they are not already connected.
-	my $connection_id = get_db_value($DBH, 'SELECT id FROM tmodule_relationship WHERE (module_a = ? AND module_b = ?) OR (module_b = ? AND module_a = ?)', $module_id_1, $module_id_2, $module_id_1, $module_id_2);
+	my $connection_id = get_db_value($DBH, 'SELECT id FROM tmodule_relationship WHERE (module_a = ? AND module_b = ? AND `type` = "direct") OR (module_b = ? AND module_a = ? AND `type` = "direct")', $module_id_1, $module_id_2, $module_id_1, $module_id_2);
 	if (! defined($connection_id)) {
 		db_do($DBH, 'INSERT INTO tmodule_relationship (`module_a`, `module_b`, `id_rt`) VALUES(?, ?, ?)', $module_id_1, $module_id_2, $TASK_ID);
 	}
diff --git a/visual_console_client/src/Item.ts b/visual_console_client/src/Item.ts
index 7ad0f779d6..0b23c8c26a 100644
--- a/visual_console_client/src/Item.ts
+++ b/visual_console_client/src/Item.ts
@@ -1,4 +1,10 @@
-import { Position, Size, UnknownObject, WithModuleProps } from "./types";
+import {
+  Position,
+  Size,
+  AnyObject,
+  WithModuleProps,
+  ItemMeta
+} from "./lib/types";
 import {
   sizePropsDecoder,
   positionPropsDecoder,
@@ -7,9 +13,12 @@ import {
   notEmptyStringOr,
   replaceMacros,
   humanDate,
-  humanTime
+  humanTime,
+  addMovementListener,
+  debounce,
+  addResizementListener
 } from "./lib";
-import TypedEvent, { Listener, Disposable } from "./TypedEvent";
+import TypedEvent, { Listener, Disposable } from "./lib/TypedEvent";
 
 // Enum: https://www.typescriptlang.org/docs/handbook/enums.html.
 export const enum ItemType {
@@ -52,14 +61,26 @@ export interface ItemProps extends Position, Size {
 // FIXME: Fix type compatibility.
 export interface ItemClickEvent<Props extends ItemProps> {
   // data: Props;
-  data: UnknownObject;
+  data: AnyObject;
   nativeEvent: Event;
 }
 
 // FIXME: Fix type compatibility.
 export interface ItemRemoveEvent<Props extends ItemProps> {
   // data: Props;
-  data: UnknownObject;
+  data: AnyObject;
+}
+
+export interface ItemMovedEvent {
+  item: VisualConsoleItem<ItemProps>;
+  prevPosition: Position;
+  newPosition: Position;
+}
+
+export interface ItemResizedEvent {
+  item: VisualConsoleItem<ItemProps>;
+  prevSize: Size;
+  newSize: Size;
 }
 
 /**
@@ -89,7 +110,7 @@ const parseLabelPosition = (
  * @throws Will throw a TypeError if some property
  * is missing from the raw object or have an invalid type.
  */
-export function itemBasePropsDecoder(data: UnknownObject): ItemProps | never {
+export function itemBasePropsDecoder(data: AnyObject): ItemProps | never {
   if (data.id == null || isNaN(parseInt(data.id))) {
     throw new TypeError("invalid id.");
   }
@@ -118,6 +139,8 @@ export function itemBasePropsDecoder(data: UnknownObject): ItemProps | never {
 abstract class VisualConsoleItem<Props extends ItemProps> {
   // Properties of the item.
   private itemProps: Props;
+  // Metadata of the item.
+  private _metadata: ItemMeta;
   // Reference to the DOM element which will contain the item.
   public elementRef: HTMLElement;
   public readonly labelElementRef: HTMLElement;
@@ -125,6 +148,10 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
   protected readonly childElementRef: HTMLElement;
   // Event manager for click events.
   private readonly clickEventManager = new TypedEvent<ItemClickEvent<Props>>();
+  // Event manager for moved events.
+  private readonly movedEventManager = new TypedEvent<ItemMovedEvent>();
+  // Event manager for resized events.
+  private readonly resizedEventManager = new TypedEvent<ItemResizedEvent>();
   // Event manager for remove events.
   private readonly removeEventManager = new TypedEvent<
     ItemRemoveEvent<Props>
@@ -132,14 +159,146 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
   // List of references to clean the event listeners.
   private readonly disposables: Disposable[] = [];
 
+  // This function will only run the 2nd arg function after the time
+  // of the first arg have passed after its last execution.
+  private debouncedMovementSave = debounce(
+    500, // ms.
+    (x: Position["x"], y: Position["y"]) => {
+      const prevPosition = {
+        x: this.props.x,
+        y: this.props.y
+      };
+      const newPosition = {
+        x: x,
+        y: y
+      };
+
+      if (!this.positionChanged(prevPosition, newPosition)) return;
+
+      // Save the new position to the props.
+      this.move(x, y);
+      // Emit the movement event.
+      this.movedEventManager.emit({
+        item: this,
+        prevPosition: prevPosition,
+        newPosition: newPosition
+      });
+    }
+  );
+  // This property will store the function
+  // to clean the movement listener.
+  private removeMovement: Function | null = null;
+
+  /**
+   * Start the movement funtionality.
+   * @param element Element to move inside its container.
+   */
+  private initMovementListener(element: HTMLElement): void {
+    this.removeMovement = addMovementListener(
+      element,
+      (x: Position["x"], y: Position["y"]) => {
+        // Move the DOM element.
+        this.moveElement(x, y);
+        // Run the save function.
+        this.debouncedMovementSave(x, y);
+      }
+    );
+  }
+  /**
+   * Stop the movement fun
+   */
+  private stopMovementListener(): void {
+    if (this.removeMovement) {
+      this.removeMovement();
+      this.removeMovement = null;
+    }
+  }
+
+  // This function will only run the 2nd arg function after the time
+  // of the first arg have passed after its last execution.
+  private debouncedResizementSave = debounce(
+    500, // ms.
+    (width: Size["width"], height: Size["height"]) => {
+      const prevSize = {
+        width: this.props.width,
+        height: this.props.height
+      };
+      const newSize = {
+        width: width,
+        height: height
+      };
+
+      if (!this.sizeChanged(prevSize, newSize)) return;
+
+      // Save the new position to the props.
+      this.resize(width, height);
+      // Emit the resizement event.
+      this.resizedEventManager.emit({
+        item: this,
+        prevSize: prevSize,
+        newSize: newSize
+      });
+    }
+  );
+  // This property will store the function
+  // to clean the resizement listener.
+  private removeResizement: Function | null = null;
+
+  /**
+   * Start the resizement funtionality.
+   * @param element Element to move inside its container.
+   */
+  protected initResizementListener(element: HTMLElement): void {
+    this.removeResizement = addResizementListener(
+      element,
+      (width: Size["width"], height: Size["height"]) => {
+        // The label it's outside the item's size, so we need
+        // to get rid of its size to get the real size of the
+        // item's content.
+        if (this.props.label && this.props.label.length > 0) {
+          const {
+            width: labelWidth,
+            height: labelHeight
+          } = this.labelElementRef.getBoundingClientRect();
+
+          switch (this.props.labelPosition) {
+            case "up":
+            case "down":
+              height -= labelHeight;
+              break;
+            case "left":
+            case "right":
+              width -= labelWidth;
+              break;
+          }
+        }
+
+        // Move the DOM element.
+        this.resizeElement(width, height);
+        // Run the save function.
+        this.debouncedResizementSave(width, height);
+      }
+    );
+  }
+  /**
+   * Stop the resizement functionality.
+   */
+  private stopResizementListener(): void {
+    if (this.removeResizement) {
+      this.removeResizement();
+      this.removeResizement = null;
+    }
+  }
+
   /**
    * To create a new element which will be inside the item box.
    * @return Item.
    */
   protected abstract createDomElement(): HTMLElement;
 
-  public constructor(props: Props) {
+  public constructor(props: Props, metadata: ItemMeta) {
     this.itemProps = props;
+    this._metadata = metadata;
 
     /*
      * Get a HTMLElement which represents the container box
@@ -173,20 +332,40 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
   private createContainerDomElement(): HTMLElement {
     let box;
     if (this.props.isLinkEnabled) {
-      box = document.createElement("a");
-      box as HTMLAnchorElement;
+      box = document.createElement("a") as HTMLAnchorElement;
       if (this.props.link) box.href = this.props.link;
     } else {
-      box = document.createElement("div");
-      box as HTMLDivElement;
+      box = document.createElement("div") as HTMLDivElement;
     }
 
     box.className = "visual-console-item";
     box.style.zIndex = this.props.isOnTop ? "2" : "1";
     box.style.left = `${this.props.x}px`;
     box.style.top = `${this.props.y}px`;
-    box.onclick = e =>
-      this.clickEventManager.emit({ data: this.props, nativeEvent: e });
+    // Init the click listener.
+    box.addEventListener("click", e => {
+      if (this.meta.editMode) {
+        e.preventDefault();
+        e.stopPropagation();
+      } else {
+        this.clickEventManager.emit({ data: this.props, nativeEvent: e });
+      }
+    });
+
+    // Metadata state.
+    if (this.meta.editMode) {
+      box.classList.add("is-editing");
+      // Init the movement listener.
+      this.initMovementListener(box);
+      // Init the resizement listener.
+      this.initResizementListener(box);
+    }
+    if (this.meta.isFetching) {
+      box.classList.add("is-fetching");
+    }
+    if (this.meta.isUpdating) {
+      box.classList.add("is-updating");
+    }
 
     return box;
   }
@@ -310,7 +489,43 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
     // From this point, things which rely on this.props can access to the changes.
 
     // Check if we should re-render.
-    if (this.shouldBeUpdated(prevProps, newProps)) this.render(prevProps);
+    if (this.shouldBeUpdated(prevProps, newProps))
+      this.render(prevProps, this._metadata);
+  }
+
+  /**
+   * Public accessor of the `meta` property.
+   * @return Properties.
+   */
+  public get meta(): ItemMeta {
+    return { ...this._metadata }; // Return a copy.
+  }
+
+  /**
+   * Public setter of the `meta` property.
+   * If the new meta are different enough than the
+   * stored meta, a render would be fired.
+   * @param newProps
+   */
+  public set meta(newMetadata: ItemMeta) {
+    this.setMeta(newMetadata);
+  }
+
+  /**
+   * Clasic and protected version of the setter of the `meta` property.
+   * Useful to override it from children classes.
+   * @param newProps
+   */
+  protected setMeta(newMetadata: ItemMeta) {
+    const prevMetadata = this._metadata;
+    // Update the internal meta.
+    this._metadata = newMetadata;
+
+    // From this point, things which rely on this.props can access to the changes.
+
+    // Check if we should re-render.
+    // if (this.shouldBeUpdated(prevMetadata, newMetadata))
+    this.render(this.itemProps, prevMetadata);
   }
 
   /**
@@ -333,7 +548,10 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
    * To recreate or update the HTMLElement which represents the item into the DOM.
    * @param prevProps If exists it will be used to only perform DOM updates instead of a full replace.
    */
-  public render(prevProps: Props | null = null): void {
+  public render(
+    prevProps: Props | null = null,
+    prevMeta: ItemMeta | null = null
+  ): void {
     this.updateDomElement(this.childElementRef);
 
     // Move box.
@@ -378,6 +596,33 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
       // Changed the reference to the main element. It's ugly, but needed.
       this.elementRef = container;
     }
+
+    // Change metadata related things.
+    if (!prevMeta || prevMeta.editMode !== this.meta.editMode) {
+      if (this.meta.editMode) {
+        this.elementRef.classList.add("is-editing");
+        this.initMovementListener(this.elementRef);
+        this.initResizementListener(this.elementRef);
+      } else {
+        this.elementRef.classList.remove("is-editing");
+        this.stopMovementListener();
+        this.stopResizementListener();
+      }
+    }
+    if (!prevMeta || prevMeta.isFetching !== this.meta.isFetching) {
+      if (this.meta.isFetching) {
+        this.elementRef.classList.add("is-fetching");
+      } else {
+        this.elementRef.classList.remove("is-fetching");
+      }
+    }
+    if (!prevMeta || prevMeta.isUpdating !== this.meta.isUpdating) {
+      if (this.meta.isUpdating) {
+        this.elementRef.classList.add("is-updating");
+      } else {
+        this.elementRef.classList.remove("is-updating");
+      }
+    }
   }
 
   /**
@@ -501,6 +746,25 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
     // The most valuable size is the content size.
     this.childElementRef.style.width = width > 0 ? `${width}px` : null;
     this.childElementRef.style.height = height > 0 ? `${height}px` : null;
+
+    if (this.props.label && this.props.label.length > 0) {
+      // Ugly table to show the label as its legacy counterpart.
+      const tables = this.labelElementRef.getElementsByTagName("table");
+      const table = tables.length > 0 ? tables.item(0) : null;
+
+      if (table) {
+        switch (this.props.labelPosition) {
+          case "up":
+          case "down":
+            table.style.width = width > 0 ? `${width}px` : null;
+            break;
+          case "left":
+          case "right":
+            table.style.height = height > 0 ? `${height}px` : null;
+            break;
+        }
+      }
+    }
   }
 
   /**
@@ -533,6 +797,38 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
     return disposable;
   }
 
+  /**
+   * To add an event handler to the movement of visual console elements.
+   * @param listener Function which is going to be executed when a linked console is moved.
+   */
+  public onMoved(listener: Listener<ItemMovedEvent>): Disposable {
+    /*
+     * The '.on' function returns a function which will clean the event
+     * listener when executed. We store all the 'dispose' functions to
+     * call them when the item should be cleared.
+     */
+    const disposable = this.movedEventManager.on(listener);
+    this.disposables.push(disposable);
+
+    return disposable;
+  }
+
+  /**
+   * To add an event handler to the resizement of visual console elements.
+   * @param listener Function which is going to be executed when a linked console is moved.
+   */
+  public onResized(listener: Listener<ItemResizedEvent>): Disposable {
+    /*
+     * The '.on' function returns a function which will clean the event
+     * listener when executed. We store all the 'dispose' functions to
+     * call them when the item should be cleared.
+     */
+    const disposable = this.resizedEventManager.on(listener);
+    this.disposables.push(disposable);
+
+    return disposable;
+  }
+
   /**
    * To add an event handler to the removal of the item.
    * @param listener Function which is going to be executed when a item is removed.
diff --git a/visual_console_client/src/VisualConsole.ts b/visual_console_client/src/VisualConsole.ts
index 7b45ccc2f1..2dbdcd3a09 100644
--- a/visual_console_client/src/VisualConsole.ts
+++ b/visual_console_client/src/VisualConsole.ts
@@ -1,15 +1,18 @@
-import { UnknownObject, Size } from "./types";
+import { AnyObject, Size } from "./lib/types";
 import {
   parseBoolean,
   sizePropsDecoder,
   parseIntOr,
-  notEmptyStringOr
+  notEmptyStringOr,
+  itemMetaDecoder
 } from "./lib";
 import Item, {
   ItemType,
   ItemProps,
   ItemClickEvent,
-  ItemRemoveEvent
+  ItemRemoveEvent,
+  ItemMovedEvent,
+  ItemResizedEvent
 } from "./Item";
 import StaticGraph, { staticGraphPropsDecoder } from "./items/StaticGraph";
 import Icon, { iconPropsDecoder } from "./items/Icon";
@@ -24,7 +27,7 @@ import EventsHistory, {
   eventsHistoryPropsDecoder
 } from "./items/EventsHistory";
 import Percentile, { percentilePropsDecoder } from "./items/Percentile";
-import TypedEvent, { Disposable, Listener } from "./TypedEvent";
+import TypedEvent, { Disposable, Listener } from "./lib/TypedEvent";
 import DonutGraph, { donutGraphPropsDecoder } from "./items/DonutGraph";
 import BarsGraph, { barsGraphPropsDecoder } from "./items/BarsGraph";
 import ModuleGraph, { moduleGraphPropsDecoder } from "./items/ModuleGraph";
@@ -32,47 +35,49 @@ import Service, { servicePropsDecoder } from "./items/Service";
 
 // TODO: Document.
 // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
-function itemInstanceFrom(data: UnknownObject) {
+function itemInstanceFrom(data: AnyObject) {
   const type = parseIntOr(data.type, null);
   if (type == null) throw new TypeError("missing item type.");
 
+  const meta = itemMetaDecoder(data);
+
   switch (type as ItemType) {
     case ItemType.STATIC_GRAPH:
-      return new StaticGraph(staticGraphPropsDecoder(data));
+      return new StaticGraph(staticGraphPropsDecoder(data), meta);
     case ItemType.MODULE_GRAPH:
-      return new ModuleGraph(moduleGraphPropsDecoder(data));
+      return new ModuleGraph(moduleGraphPropsDecoder(data), meta);
     case ItemType.SIMPLE_VALUE:
     case ItemType.SIMPLE_VALUE_MAX:
     case ItemType.SIMPLE_VALUE_MIN:
     case ItemType.SIMPLE_VALUE_AVG:
-      return new SimpleValue(simpleValuePropsDecoder(data));
+      return new SimpleValue(simpleValuePropsDecoder(data), meta);
     case ItemType.PERCENTILE_BAR:
     case ItemType.PERCENTILE_BUBBLE:
     case ItemType.CIRCULAR_PROGRESS_BAR:
     case ItemType.CIRCULAR_INTERIOR_PROGRESS_BAR:
-      return new Percentile(percentilePropsDecoder(data));
+      return new Percentile(percentilePropsDecoder(data), meta);
     case ItemType.LABEL:
-      return new Label(labelPropsDecoder(data));
+      return new Label(labelPropsDecoder(data), meta);
     case ItemType.ICON:
-      return new Icon(iconPropsDecoder(data));
+      return new Icon(iconPropsDecoder(data), meta);
     case ItemType.SERVICE:
-      return new Service(servicePropsDecoder(data));
+      return new Service(servicePropsDecoder(data), meta);
     case ItemType.GROUP_ITEM:
-      return new Group(groupPropsDecoder(data));
+      return new Group(groupPropsDecoder(data), meta);
     case ItemType.BOX_ITEM:
-      return new Box(boxPropsDecoder(data));
+      return new Box(boxPropsDecoder(data), meta);
     case ItemType.LINE_ITEM:
-      return new Line(linePropsDecoder(data));
+      return new Line(linePropsDecoder(data), meta);
     case ItemType.AUTO_SLA_GRAPH:
-      return new EventsHistory(eventsHistoryPropsDecoder(data));
+      return new EventsHistory(eventsHistoryPropsDecoder(data), meta);
     case ItemType.DONUT_GRAPH:
-      return new DonutGraph(donutGraphPropsDecoder(data));
+      return new DonutGraph(donutGraphPropsDecoder(data), meta);
     case ItemType.BARS_GRAPH:
-      return new BarsGraph(barsGraphPropsDecoder(data));
+      return new BarsGraph(barsGraphPropsDecoder(data), meta);
     case ItemType.CLOCK:
-      return new Clock(clockPropsDecoder(data));
+      return new Clock(clockPropsDecoder(data), meta);
     case ItemType.COLOR_CLOUD:
-      return new ColorCloud(colorCloudPropsDecoder(data));
+      return new ColorCloud(colorCloudPropsDecoder(data), meta);
     default:
       throw new TypeError("item not found");
   }
@@ -80,7 +85,7 @@ function itemInstanceFrom(data: UnknownObject) {
 
 // TODO: Document.
 // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
-function decodeProps(data: UnknownObject) {
+function decodeProps(data: AnyObject) {
   const type = parseIntOr(data.type, null);
   if (type == null) throw new TypeError("missing item type.");
 
@@ -147,7 +152,7 @@ export interface VisualConsoleProps extends Size {
  * is missing from the raw object or have an invalid type.
  */
 export function visualConsolePropsDecoder(
-  data: UnknownObject
+  data: AnyObject
 ): VisualConsoleProps | never {
   // Object destructuring: http://es6-features.org/#ObjectMatchingShorthandNotation
   const {
@@ -201,6 +206,10 @@ export default class VisualConsole {
   private readonly clickEventManager = new TypedEvent<
     ItemClickEvent<ItemProps>
   >();
+  // Event manager for move events.
+  private readonly movedEventManager = new TypedEvent<ItemMovedEvent>();
+  // Event manager for resize events.
+  private readonly resizedEventManager = new TypedEvent<ItemResizedEvent>();
   // List of references to clean the event listeners.
   private readonly disposables: Disposable[] = [];
 
@@ -213,6 +222,24 @@ export default class VisualConsole {
     // console.log(`Clicked element #${e.data.id}`, e);
   };
 
+  /**
+   * React to a movement on an element.
+   * @param e Event object.
+   */
+  private handleElementMovement: (e: ItemMovedEvent) => void = e => {
+    this.movedEventManager.emit(e);
+    // console.log(`Moved element #${e.item.props.id}`, e);
+  };
+
+  /**
+   * React to a resizement on an element.
+   * @param e Event object.
+   */
+  private handleElementResizement: (e: ItemResizedEvent) => void = e => {
+    this.resizedEventManager.emit(e);
+    // console.log(`Resized element #${e.item.props.id}`, e);
+  };
+
   /**
    * Clear some element references.
    * @param e Event object.
@@ -226,8 +253,8 @@ export default class VisualConsole {
 
   public constructor(
     container: HTMLElement,
-    props: UnknownObject,
-    items: UnknownObject[]
+    props: AnyObject,
+    items: AnyObject[]
   ) {
     this.containerRef = container;
     this._props = visualConsolePropsDecoder(props);
@@ -261,6 +288,8 @@ export default class VisualConsole {
         this.elementIds.push(itemInstance.props.id);
         // Item event handlers.
         itemInstance.onClick(this.handleElementClick);
+        itemInstance.onMoved(this.handleElementMovement);
+        itemInstance.onResized(this.handleElementResizement);
         itemInstance.onRemove(this.handleElementRemove);
         // Add the item to the DOM.
         this.containerRef.append(itemInstance.elementRef);
@@ -288,13 +317,13 @@ export default class VisualConsole {
    * Public setter of the `elements` property.
    * @param items.
    */
-  public updateElements(items: UnknownObject[]): void {
-    const itemIds = items.map(item => item.id || null).filter(id => id != null);
-    itemIds as number[]; // Tell the type system to rely on us.
+  public updateElements(items: AnyObject[]): void {
+    // Ensure the type cause Typescript doesn't know the filter removes null items.
+    const itemIds = items
+      .map(item => item.id || null)
+      .filter(id => id != null) as number[];
     // Get the elements we should delete.
-    const deletedIds: number[] = this.elementIds.filter(
-      id => itemIds.indexOf(id) < 0
-    );
+    const deletedIds = this.elementIds.filter(id => itemIds.indexOf(id) < 0);
     // Delete the elements.
     deletedIds.forEach(id => {
       if (this.elementsById[id] != null) {
@@ -530,6 +559,9 @@ export default class VisualConsole {
         height: 0,
         lineWidth: this.props.relationLineWidth,
         color: "#CCCCCC"
+      }),
+      itemMetaDecoder({
+        receivedAt: new Date()
       })
     );
     // Save a reference to the line item.
@@ -546,7 +578,9 @@ export default class VisualConsole {
    * Add an event handler to the click of the linked visual console elements.
    * @param listener Function which is going to be executed when a linked console is clicked.
    */
-  public onClick(listener: Listener<ItemClickEvent<ItemProps>>): Disposable {
+  public onItemClick(
+    listener: Listener<ItemClickEvent<ItemProps>>
+  ): Disposable {
     /*
      * The '.on' function returns a function which will clean the event
      * listener when executed. We store all the 'dispose' functions to
@@ -557,4 +591,56 @@ export default class VisualConsole {
 
     return disposable;
   }
+
+  /**
+   * Add an event handler to the movement of the visual console elements.
+   * @param listener Function which is going to be executed when a linked console is moved.
+   */
+  public onItemMoved(listener: Listener<ItemMovedEvent>): Disposable {
+    /*
+     * The '.on' function returns a function which will clean the event
+     * listener when executed. We store all the 'dispose' functions to
+     * call them when the item should be cleared.
+     */
+    const disposable = this.movedEventManager.on(listener);
+    this.disposables.push(disposable);
+
+    return disposable;
+  }
+
+  /**
+   * Add an event handler to the resizement of the visual console elements.
+   * @param listener Function which is going to be executed when a linked console is moved.
+   */
+  public onItemResized(listener: Listener<ItemResizedEvent>): Disposable {
+    /*
+     * The '.on' function returns a function which will clean the event
+     * listener when executed. We store all the 'dispose' functions to
+     * call them when the item should be cleared.
+     */
+    const disposable = this.resizedEventManager.on(listener);
+    this.disposables.push(disposable);
+
+    return disposable;
+  }
+
+  /**
+   * Enable the edition mode.
+   */
+  public enableEditMode(): void {
+    this.elements.forEach(item => {
+      item.meta = { ...item.meta, editMode: true };
+    });
+    this.containerRef.classList.add("is-editing");
+  }
+
+  /**
+   * Disable the edition mode.
+   */
+  public disableEditMode(): void {
+    this.elements.forEach(item => {
+      item.meta = { ...item.meta, editMode: false };
+    });
+    this.containerRef.classList.remove("is-editing");
+  }
 }
diff --git a/visual_console_client/src/items/BarsGraph.ts b/visual_console_client/src/items/BarsGraph.ts
index d1a6fe97a5..7fcde89177 100644
--- a/visual_console_client/src/items/BarsGraph.ts
+++ b/visual_console_client/src/items/BarsGraph.ts
@@ -1,4 +1,4 @@
-import { UnknownObject, WithModuleProps } from "../types";
+import { AnyObject, WithModuleProps } from "../lib/types";
 import { modulePropsDecoder, decodeBase64, stringIsEmpty } from "../lib";
 import Item, { ItemType, ItemProps, itemBasePropsDecoder } from "../Item";
 
@@ -17,9 +17,7 @@ export type BarsGraphProps = {
  * @throws Will throw a TypeError if some property
  * is missing from the raw object or have an invalid type.
  */
-export function barsGraphPropsDecoder(
-  data: UnknownObject
-): BarsGraphProps | never {
+export function barsGraphPropsDecoder(data: AnyObject): BarsGraphProps | never {
   if (stringIsEmpty(data.html) && stringIsEmpty(data.encodedHtml)) {
     throw new TypeError("missing html content.");
   }
diff --git a/visual_console_client/src/items/Box.ts b/visual_console_client/src/items/Box.ts
index ca3078c0a6..042621c5a6 100644
--- a/visual_console_client/src/items/Box.ts
+++ b/visual_console_client/src/items/Box.ts
@@ -1,4 +1,4 @@
-import { UnknownObject } from "../types";
+import { AnyObject } from "../lib/types";
 import { parseIntOr, notEmptyStringOr } from "../lib";
 import Item, { ItemType, ItemProps, itemBasePropsDecoder } from "../Item";
 
@@ -24,7 +24,7 @@ interface BoxProps extends ItemProps {
  * @throws Will throw a TypeError if some property
  * is missing from the raw object or have an invalid type.
  */
-export function boxPropsDecoder(data: UnknownObject): BoxProps | never {
+export function boxPropsDecoder(data: AnyObject): BoxProps | never {
   return {
     ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.
     type: ItemType.BOX_ITEM,
diff --git a/visual_console_client/src/items/Clock/index.ts b/visual_console_client/src/items/Clock/index.ts
index 52e0e65775..e775c00102 100644
--- a/visual_console_client/src/items/Clock/index.ts
+++ b/visual_console_client/src/items/Clock/index.ts
@@ -1,6 +1,11 @@
 import "./styles.css";
 
-import { LinkedVisualConsoleProps, UnknownObject, Size } from "../../types";
+import {
+  LinkedVisualConsoleProps,
+  AnyObject,
+  Size,
+  ItemMeta
+} from "../../lib/types";
 import {
   linkedVCPropsDecoder,
   parseIntOr,
@@ -60,7 +65,7 @@ const parseClockFormat = (clockFormat: unknown): ClockProps["clockFormat"] => {
  * @throws Will throw a TypeError if some property
  * is missing from the raw object or have an invalid type.
  */
-export function clockPropsDecoder(data: UnknownObject): ClockProps | never {
+export function clockPropsDecoder(data: AnyObject): ClockProps | never {
   if (
     typeof data.clockTimezone !== "string" ||
     data.clockTimezone.length === 0
@@ -85,9 +90,9 @@ export default class Clock extends Item<ClockProps> {
   public static readonly TICK_INTERVAL = 1000; // In ms.
   private intervalRef: number | null = null;
 
-  public constructor(props: ClockProps) {
+  public constructor(props: ClockProps, meta: ItemMeta) {
     // Call the superclass constructor.
-    super(props);
+    super(props, meta);
 
     /* The item is already loaded and inserted into the DOM.
      * The class properties are now initialized.
diff --git a/visual_console_client/src/items/Clock/spec.ts b/visual_console_client/src/items/Clock/spec.ts
index 7380f98468..acd4233ed1 100644
--- a/visual_console_client/src/items/Clock/spec.ts
+++ b/visual_console_client/src/items/Clock/spec.ts
@@ -1,4 +1,5 @@
 import Clock, { clockPropsDecoder } from ".";
+import { itemMetaDecoder } from "../../lib";
 
 const genericRawProps = {
   id: 1,
@@ -46,6 +47,9 @@ describe("Clock item", () => {
       ...sizeRawProps,
       ...linkedModuleProps,
       ...digitalClockProps
+    }),
+    itemMetaDecoder({
+      receivedAt: new Date(1)
     })
   );
 
diff --git a/visual_console_client/src/items/ColorCloud.spec.ts b/visual_console_client/src/items/ColorCloud.spec.ts
index 103850b04b..fb873b8894 100644
--- a/visual_console_client/src/items/ColorCloud.spec.ts
+++ b/visual_console_client/src/items/ColorCloud.spec.ts
@@ -1,4 +1,5 @@
 import ColorCloud, { colorCloudPropsDecoder } from "./ColorCloud";
+import { itemMetaDecoder } from "../lib";
 
 const genericRawProps = {
   id: 1,
@@ -41,6 +42,9 @@ describe("Color cloud item", () => {
       ...sizeRawProps,
       ...linkedModuleProps,
       ...colorCloudProps
+    }),
+    itemMetaDecoder({
+      receivedAt: new Date(1)
     })
   );
 
diff --git a/visual_console_client/src/items/ColorCloud.ts b/visual_console_client/src/items/ColorCloud.ts
index 0b5dfe9948..fa900601fa 100644
--- a/visual_console_client/src/items/ColorCloud.ts
+++ b/visual_console_client/src/items/ColorCloud.ts
@@ -1,8 +1,8 @@
 import {
   WithModuleProps,
   LinkedVisualConsoleProps,
-  UnknownObject
-} from "../types";
+  AnyObject
+} from "../lib/types";
 import { modulePropsDecoder, linkedVCPropsDecoder } from "../lib";
 import Item, { itemBasePropsDecoder, ItemType, ItemProps } from "../Item";
 
@@ -24,7 +24,7 @@ export type ColorCloudProps = {
  * is missing from the raw object or have an invalid type.
  */
 export function colorCloudPropsDecoder(
-  data: UnknownObject
+  data: AnyObject
 ): ColorCloudProps | never {
   // TODO: Validate the color.
   if (typeof data.color !== "string" || data.color.length === 0) {
@@ -53,6 +53,10 @@ export default class ColorCloud extends Item<ColorCloudProps> {
     return container;
   }
 
+  protected resizeElement(width: number): void {
+    super.resizeElement(width, width);
+  }
+
   public createSvgElement(): SVGSVGElement {
     const gradientId = `grad_${this.props.id}`;
     // SVG container.
diff --git a/visual_console_client/src/items/DonutGraph.ts b/visual_console_client/src/items/DonutGraph.ts
index d60f268567..c6436583c4 100644
--- a/visual_console_client/src/items/DonutGraph.ts
+++ b/visual_console_client/src/items/DonutGraph.ts
@@ -1,8 +1,8 @@
 import {
   LinkedVisualConsoleProps,
-  UnknownObject,
+  AnyObject,
   WithModuleProps
-} from "../types";
+} from "../lib/types";
 import {
   linkedVCPropsDecoder,
   modulePropsDecoder,
@@ -28,7 +28,7 @@ export type DonutGraphProps = {
  * is missing from the raw object or have an invalid type.
  */
 export function donutGraphPropsDecoder(
-  data: UnknownObject
+  data: AnyObject
 ): DonutGraphProps | never {
   if (stringIsEmpty(data.html) && stringIsEmpty(data.encodedHtml)) {
     throw new TypeError("missing html content.");
diff --git a/visual_console_client/src/items/EventsHistory.ts b/visual_console_client/src/items/EventsHistory.ts
index 7e9db0ae9b..1d460e5b5b 100644
--- a/visual_console_client/src/items/EventsHistory.ts
+++ b/visual_console_client/src/items/EventsHistory.ts
@@ -1,4 +1,4 @@
-import { UnknownObject, WithModuleProps } from "../types";
+import { AnyObject, WithModuleProps } from "../lib/types";
 import {
   modulePropsDecoder,
   parseIntOr,
@@ -24,7 +24,7 @@ export type EventsHistoryProps = {
  * is missing from the raw object or have an invalid type.
  */
 export function eventsHistoryPropsDecoder(
-  data: UnknownObject
+  data: AnyObject
 ): EventsHistoryProps | never {
   if (stringIsEmpty(data.html) && stringIsEmpty(data.encodedHtml)) {
     throw new TypeError("missing html content.");
diff --git a/visual_console_client/src/items/Group.spec.ts b/visual_console_client/src/items/Group.spec.ts
index e00a5cf327..c117a95b42 100644
--- a/visual_console_client/src/items/Group.spec.ts
+++ b/visual_console_client/src/items/Group.spec.ts
@@ -1,4 +1,5 @@
 import Group, { groupPropsDecoder } from "./Group";
+import { itemMetaDecoder } from "../lib";
 
 const genericRawProps = {
   id: 1,
@@ -33,6 +34,9 @@ describe("Group item", () => {
       ...positionRawProps,
       ...sizeRawProps,
       ...groupRawProps
+    }),
+    itemMetaDecoder({
+      receivedAt: new Date(1)
     })
   );
 
diff --git a/visual_console_client/src/items/Group.ts b/visual_console_client/src/items/Group.ts
index fa97f69a62..98552a0f1b 100644
--- a/visual_console_client/src/items/Group.ts
+++ b/visual_console_client/src/items/Group.ts
@@ -1,4 +1,4 @@
-import { LinkedVisualConsoleProps, UnknownObject } from "../types";
+import { LinkedVisualConsoleProps, AnyObject } from "../lib/types";
 import {
   linkedVCPropsDecoder,
   parseIntOr,
@@ -19,7 +19,7 @@ export type GroupProps = {
 } & ItemProps &
   LinkedVisualConsoleProps;
 
-function extractHtml(data: UnknownObject): string | null {
+function extractHtml(data: AnyObject): string | null {
   if (!stringIsEmpty(data.html)) return data.html;
   if (!stringIsEmpty(data.encodedHtml)) return decodeBase64(data.encodedHtml);
   return null;
@@ -34,7 +34,7 @@ function extractHtml(data: UnknownObject): string | null {
  * @throws Will throw a TypeError if some property
  * is missing from the raw object or have an invalid type.
  */
-export function groupPropsDecoder(data: UnknownObject): GroupProps | never {
+export function groupPropsDecoder(data: AnyObject): GroupProps | never {
   if (
     (typeof data.imageSrc !== "string" || data.imageSrc.length === 0) &&
     data.encodedHtml === null
diff --git a/visual_console_client/src/items/Icon.ts b/visual_console_client/src/items/Icon.ts
index 12c1b035c7..d6e4a21fc6 100644
--- a/visual_console_client/src/items/Icon.ts
+++ b/visual_console_client/src/items/Icon.ts
@@ -1,4 +1,4 @@
-import { LinkedVisualConsoleProps, UnknownObject } from "../types";
+import { LinkedVisualConsoleProps, AnyObject } from "../lib/types";
 import { linkedVCPropsDecoder } from "../lib";
 import Item, { ItemType, ItemProps, itemBasePropsDecoder } from "../Item";
 
@@ -17,7 +17,7 @@ export type IconProps = {
  * @throws Will throw a TypeError if some property
  * is missing from the raw object or have an invalid type.
  */
-export function iconPropsDecoder(data: UnknownObject): IconProps | never {
+export function iconPropsDecoder(data: AnyObject): IconProps | never {
   if (typeof data.imageSrc !== "string" || data.imageSrc.length === 0) {
     throw new TypeError("invalid image src.");
   }
diff --git a/visual_console_client/src/items/Label.ts b/visual_console_client/src/items/Label.ts
index c8de572c15..4f6a382a08 100644
--- a/visual_console_client/src/items/Label.ts
+++ b/visual_console_client/src/items/Label.ts
@@ -1,4 +1,4 @@
-import { LinkedVisualConsoleProps, UnknownObject } from "../types";
+import { LinkedVisualConsoleProps, AnyObject } from "../lib/types";
 import { linkedVCPropsDecoder } from "../lib";
 import Item, { ItemType, ItemProps, itemBasePropsDecoder } from "../Item";
 
@@ -16,7 +16,7 @@ export type LabelProps = {
  * @throws Will throw a TypeError if some property
  * is missing from the raw object or have an invalid type.
  */
-export function labelPropsDecoder(data: UnknownObject): LabelProps | never {
+export function labelPropsDecoder(data: AnyObject): LabelProps | never {
   return {
     ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.
     type: ItemType.LABEL,
diff --git a/visual_console_client/src/items/Line.ts b/visual_console_client/src/items/Line.ts
index 20532e44ea..035c6fa279 100644
--- a/visual_console_client/src/items/Line.ts
+++ b/visual_console_client/src/items/Line.ts
@@ -1,4 +1,4 @@
-import { UnknownObject, Position, Size } from "../types";
+import { AnyObject, Position, Size, ItemMeta } from "../lib/types";
 import { parseIntOr, notEmptyStringOr } from "../lib";
 import Item, { ItemType, ItemProps, itemBasePropsDecoder } from "../Item";
 
@@ -25,7 +25,7 @@ interface LineProps extends ItemProps {
  * @throws Will throw a TypeError if some property
  * is missing from the raw object or have an invalid type.
  */
-export function linePropsDecoder(data: UnknownObject): LineProps | never {
+export function linePropsDecoder(data: AnyObject): LineProps | never {
   const props: LineProps = {
     ...itemBasePropsDecoder({ ...data, width: 1, height: 1 }), // Object spread. It will merge the properties of the two objects.
     type: ItemType.LINE_ITEM,
@@ -71,16 +71,35 @@ export default class Line extends Item<LineProps> {
   /**
    * @override
    */
-  public constructor(props: LineProps) {
+  public constructor(props: LineProps, meta: ItemMeta) {
     /*
      * We need to override the constructor cause we need to obtain
      * the
      * box size and position from the start and finish points
      * of the line.
      */
-    super({
-      ...props,
-      ...Line.extractBoxSizeAndPosition(props)
+    super(
+      {
+        ...props,
+        ...Line.extractBoxSizeAndPosition(props)
+      },
+      {
+        ...meta,
+        editMode: false
+      }
+    );
+  }
+
+  /**
+   * Clasic and protected version of the setter of the `meta` property.
+   * Useful to override it from children classes.
+   * @param newProps
+   * @override Item.setMeta
+   */
+  public setMeta(newMetadata: ItemMeta) {
+    super.setMeta({
+      ...newMetadata,
+      editMode: false
     });
   }
 
diff --git a/visual_console_client/src/items/ModuleGraph.ts b/visual_console_client/src/items/ModuleGraph.ts
index 3440496d19..1aa9b623fa 100644
--- a/visual_console_client/src/items/ModuleGraph.ts
+++ b/visual_console_client/src/items/ModuleGraph.ts
@@ -1,8 +1,8 @@
 import {
   LinkedVisualConsoleProps,
-  UnknownObject,
+  AnyObject,
   WithModuleProps
-} from "../types";
+} from "../lib/types";
 import {
   linkedVCPropsDecoder,
   modulePropsDecoder,
@@ -28,7 +28,7 @@ export type ModuleGraphProps = {
  * is missing from the raw object or have an invalid type.
  */
 export function moduleGraphPropsDecoder(
-  data: UnknownObject
+  data: AnyObject
 ): ModuleGraphProps | never {
   if (stringIsEmpty(data.html) && stringIsEmpty(data.encodedHtml)) {
     throw new TypeError("missing html content.");
@@ -58,6 +58,15 @@ export default class ModuleGraph extends Item<ModuleGraphProps> {
     super.resizeElement(width, 0);
   }
 
+  /**
+   * @override Item.initResizementListener. To disable the functionality.
+   * Start the resizement funtionality.
+   * @param element Element to move inside its container.
+   */
+  protected initResizementListener(): void {
+    // No-Op. Disable the resizement functionality for this item.
+  }
+
   protected createDomElement(): HTMLElement {
     const element = document.createElement("div");
     element.className = "module-graph";
@@ -106,9 +115,7 @@ export default class ModuleGraph extends Item<ModuleGraphProps> {
     }
 
     // Hack to execute the JS after the HTML is added to the DOM.
-    const aux = document.createElement("div");
-    aux.innerHTML = this.props.html;
-    const scripts = aux.getElementsByTagName("script");
+    const scripts = element.getElementsByTagName("script");
     for (let i = 0; i < scripts.length; i++) {
       if (scripts[i].src.length === 0) {
         eval(scripts[i].innerHTML.trim());
diff --git a/visual_console_client/src/items/Percentile.ts b/visual_console_client/src/items/Percentile.ts
index 4c93b86b1f..0706f55ed9 100644
--- a/visual_console_client/src/items/Percentile.ts
+++ b/visual_console_client/src/items/Percentile.ts
@@ -2,9 +2,9 @@ import { arc as arcFactory } from "d3-shape";
 
 import {
   LinkedVisualConsoleProps,
-  UnknownObject,
+  AnyObject,
   WithModuleProps
-} from "../types";
+} from "../lib/types";
 import {
   linkedVCPropsDecoder,
   modulePropsDecoder,
@@ -81,7 +81,7 @@ function extractValueType(valueType: unknown): PercentileProps["valueType"] {
  * is missing from the raw object or have an invalid type.
  */
 export function percentilePropsDecoder(
-  data: UnknownObject
+  data: AnyObject
 ): PercentileProps | never {
   return {
     ...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.
diff --git a/visual_console_client/src/items/Service.ts b/visual_console_client/src/items/Service.ts
index 9440503e80..09a8c26824 100644
--- a/visual_console_client/src/items/Service.ts
+++ b/visual_console_client/src/items/Service.ts
@@ -1,4 +1,4 @@
-import { UnknownObject } from "../types";
+import { AnyObject } from "../lib/types";
 import {
   stringIsEmpty,
   notEmptyStringOr,
@@ -24,7 +24,7 @@ export type ServiceProps = {
  * @throws Will throw a TypeError if some property
  * is missing from the raw object or have an invalid type.
  */
-export function servicePropsDecoder(data: UnknownObject): ServiceProps | never {
+export function servicePropsDecoder(data: AnyObject): ServiceProps | never {
   if (data.imageSrc !== null) {
     if (
       typeof data.statusImageSrc !== "string" ||
diff --git a/visual_console_client/src/items/SimpleValue.ts b/visual_console_client/src/items/SimpleValue.ts
index 7cc5e139af..10b8e4097a 100644
--- a/visual_console_client/src/items/SimpleValue.ts
+++ b/visual_console_client/src/items/SimpleValue.ts
@@ -1,8 +1,8 @@
 import {
   LinkedVisualConsoleProps,
-  UnknownObject,
+  AnyObject,
   WithModuleProps
-} from "../types";
+} from "../lib/types";
 import {
   linkedVCPropsDecoder,
   parseIntOr,
@@ -69,7 +69,7 @@ const parseProcessValue = (
  * is missing from the raw object or have an invalid type.
  */
 export function simpleValuePropsDecoder(
-  data: UnknownObject
+  data: AnyObject
 ): SimpleValueProps | never {
   if (typeof data.value !== "string" || data.value.length === 0) {
     throw new TypeError("invalid value");
diff --git a/visual_console_client/src/items/StaticGraph.ts b/visual_console_client/src/items/StaticGraph.ts
index 899d54ec70..39267e33f9 100644
--- a/visual_console_client/src/items/StaticGraph.ts
+++ b/visual_console_client/src/items/StaticGraph.ts
@@ -1,8 +1,8 @@
 import {
   WithModuleProps,
   LinkedVisualConsoleProps,
-  UnknownObject
-} from "../types";
+  AnyObject
+} from "../lib/types";
 
 import {
   modulePropsDecoder,
@@ -47,7 +47,7 @@ const parseShowLastValueTooltip = (
  * is missing from the raw object or have an invalid type.
  */
 export function staticGraphPropsDecoder(
-  data: UnknownObject
+  data: AnyObject
 ): StaticGraphProps | never {
   if (typeof data.imageSrc !== "string" || data.imageSrc.length === 0) {
     throw new TypeError("invalid image src.");
diff --git a/visual_console_client/src/lib/AsyncTaskManager.ts b/visual_console_client/src/lib/AsyncTaskManager.ts
index 5ad261194b..ef187f45ad 100644
--- a/visual_console_client/src/lib/AsyncTaskManager.ts
+++ b/visual_console_client/src/lib/AsyncTaskManager.ts
@@ -1,4 +1,4 @@
-import TypedEvent, { Disposable, Listener } from "../TypedEvent";
+import TypedEvent, { Disposable, Listener } from "./TypedEvent";
 
 interface Cancellable {
   cancel(): void;
diff --git a/visual_console_client/src/TypedEvent.ts b/visual_console_client/src/lib/TypedEvent.ts
similarity index 100%
rename from visual_console_client/src/TypedEvent.ts
rename to visual_console_client/src/lib/TypedEvent.ts
diff --git a/visual_console_client/src/lib/index.ts b/visual_console_client/src/lib/index.ts
index 1a04ca74af..1b85dd8003 100644
--- a/visual_console_client/src/lib/index.ts
+++ b/visual_console_client/src/lib/index.ts
@@ -1,12 +1,14 @@
 import {
-  UnknownObject,
+  AnyObject,
   Position,
   Size,
   WithAgentProps,
   WithModuleProps,
   LinkedVisualConsoleProps,
-  LinkedVisualConsolePropsStatus
-} from "../types";
+  LinkedVisualConsolePropsStatus,
+  UnknownObject,
+  ItemMeta
+} from "./types";
 
 /**
  * Return a number or a default value from a raw value.
@@ -72,6 +74,23 @@ export function parseBoolean(value: unknown): boolean {
   else return false;
 }
 
+/**
+ * Return a valid date or a default value from a raw value.
+ * @param value Raw value from which we will try to extract a valid date.
+ * @param defaultValue Default value to use if we cannot extract a valid date.
+ * @return A valid date or the default value.
+ */
+export function parseDateOr<T>(value: unknown, defaultValue: T): Date | T {
+  if (value instanceof Date) return value;
+  else if (typeof value === "number") return new Date(value * 1000);
+  else if (
+    typeof value === "string" &&
+    !Number.isNaN(new Date(value).getTime())
+  )
+    return new Date(value);
+  else return defaultValue;
+}
+
 /**
  * Pad the current string with another string (multiple times, if needed)
  * until the resulting string reaches the given length.
@@ -113,7 +132,7 @@ export function leftPad(
  * @param data Raw object.
  * @return An object representing the position.
  */
-export function positionPropsDecoder(data: UnknownObject): Position {
+export function positionPropsDecoder(data: AnyObject): Position {
   return {
     x: parseIntOr(data.x, 0),
     y: parseIntOr(data.y, 0)
@@ -126,7 +145,7 @@ export function positionPropsDecoder(data: UnknownObject): Position {
  * @return An object representing the size.
  * @throws Will throw a TypeError if the width and height are not valid numbers.
  */
-export function sizePropsDecoder(data: UnknownObject): Size | never {
+export function sizePropsDecoder(data: AnyObject): Size | never {
   if (
     data.width == null ||
     isNaN(parseInt(data.width)) ||
@@ -147,7 +166,7 @@ export function sizePropsDecoder(data: UnknownObject): Size | never {
  * @param data Raw object.
  * @return An object representing the agent properties.
  */
-export function agentPropsDecoder(data: UnknownObject): WithAgentProps {
+export function agentPropsDecoder(data: AnyObject): WithAgentProps {
   const agentProps: WithAgentProps = {
     agentId: parseIntOr(data.agent, null),
     agentName: notEmptyStringOr(data.agentName, null),
@@ -169,7 +188,7 @@ export function agentPropsDecoder(data: UnknownObject): WithAgentProps {
  * @param data Raw object.
  * @return An object representing the module and agent properties.
  */
-export function modulePropsDecoder(data: UnknownObject): WithModuleProps {
+export function modulePropsDecoder(data: AnyObject): WithModuleProps {
   return {
     moduleId: parseIntOr(data.moduleId, null),
     moduleName: notEmptyStringOr(data.moduleName, null),
@@ -185,7 +204,7 @@ export function modulePropsDecoder(data: UnknownObject): WithModuleProps {
  * @throws Will throw a TypeError if the status calculation properties are invalid.
  */
 export function linkedVCPropsDecoder(
-  data: UnknownObject
+  data: AnyObject
 ): LinkedVisualConsoleProps | never {
   // Object destructuring: http://es6-features.org/#ObjectMatchingShorthandNotation
   const {
@@ -246,6 +265,29 @@ export function linkedVCPropsDecoder(
     : linkedLayoutBaseProps;
 }
 
+/**
+ * Build a valid typed object from a raw object.
+ * @param data Raw object.
+ * @return An object representing the item's meta properties.
+ */
+export function itemMetaDecoder(data: UnknownObject): ItemMeta | never {
+  const receivedAt = parseDateOr(data.receivedAt, null);
+  if (receivedAt === null) throw new TypeError("invalid meta structure");
+
+  let error = null;
+  if (data.error instanceof Error) error = data.error;
+  else if (typeof data.error === "string") error = new Error(data.error);
+
+  return {
+    receivedAt,
+    error,
+    editMode: parseBoolean(data.editMode),
+    isFromCache: parseBoolean(data.isFromCache),
+    isFetching: false,
+    isUpdating: false
+  };
+}
+
 /**
  * To get a CSS rule with the most used prefixes.
  * @param ruleName Name of the CSS rule.
@@ -332,3 +374,376 @@ export function replaceMacros(macros: Macro[], text: string): string {
     text
   );
 }
+
+/**
+ * Create a function which will limit the rate of execution of
+ * the selected function to one time for the selected interval.
+ * @param delay Interval.
+ * @param fn Function to be executed at a limited rate.
+ */
+export function throttle<T, R>(delay: number, fn: (...args: T[]) => R) {
+  let last = 0;
+  return (...args: T[]) => {
+    const now = Date.now();
+    if (now - last < delay) return;
+    last = now;
+    return fn(...args);
+  };
+}
+
+/**
+ * Create a function which will call the selected function only
+ * after the interval time has passed after its last execution.
+ * @param delay Interval.
+ * @param fn Function to be executed after the last call.
+ */
+export function debounce<T>(delay: number, fn: (...args: T[]) => void) {
+  let timerRef: number | null = null;
+  return (...args: T[]) => {
+    if (timerRef !== null) window.clearTimeout(timerRef);
+    timerRef = window.setTimeout(() => {
+      fn(...args);
+      timerRef = null;
+    }, delay);
+  };
+}
+
+/**
+ * Retrieve the offset of an element relative to the page.
+ * @param el Node used to calculate the offset.
+ */
+function getOffset(el: HTMLElement | null) {
+  let x = 0;
+  let y = 0;
+  while (el && !Number.isNaN(el.offsetLeft) && !Number.isNaN(el.offsetTop)) {
+    x += el.offsetLeft - el.scrollLeft;
+    y += el.offsetTop - el.scrollTop;
+    el = el.offsetParent as HTMLElement | null;
+  }
+  return { top: y, left: x };
+}
+
+/**
+ * Add the grab & move functionality to a certain element inside it's container.
+ *
+ * @param element Element to move.
+ * @param onMoved Function to execute when the element moves.
+ *
+ * @return A function which will clean the event handlers when executed.
+ */
+export function addMovementListener(
+  element: HTMLElement,
+  onMoved: (x: Position["x"], y: Position["y"]) => void
+): Function {
+  const container = element.parentElement as HTMLElement;
+  // Store the initial draggable state.
+  const isDraggable = element.draggable;
+  // Init the coordinates.
+  let lastX: Position["x"] = 0;
+  let lastY: Position["y"] = 0;
+  let lastMouseX: Position["x"] = 0;
+  let lastMouseY: Position["y"] = 0;
+  let mouseElementOffsetX: Position["x"] = 0;
+  let mouseElementOffsetY: Position["y"] = 0;
+  // Bounds.
+  let containerBounds = container.getBoundingClientRect();
+  let containerOffset = getOffset(container);
+  let containerTop = containerOffset.top;
+  let containerBottom = containerTop + containerBounds.height;
+  let containerLeft = containerOffset.left;
+  let containerRight = containerLeft + containerBounds.width;
+  let elementBounds = element.getBoundingClientRect();
+  let borderWidth = window.getComputedStyle(element).borderWidth || "0";
+  let borderFix = Number.parseInt(borderWidth) * 2;
+
+  // Will run onMoved 32ms after its last execution.
+  const debouncedMovement = debounce(32, (x: Position["x"], y: Position["y"]) =>
+    onMoved(x, y)
+  );
+  // Will run onMoved one time max every 16ms.
+  const throttledMovement = throttle(16, (x: Position["x"], y: Position["y"]) =>
+    onMoved(x, y)
+  );
+
+  const handleMove = (e: MouseEvent) => {
+    // Calculate the new element coordinates.
+    let x = 0;
+    let y = 0;
+
+    const mouseX = e.pageX;
+    const mouseY = e.pageY;
+    const mouseDeltaX = mouseX - lastMouseX;
+    const mouseDeltaY = mouseY - lastMouseY;
+
+    const minX = 0;
+    const maxX = containerBounds.width - elementBounds.width + borderFix;
+    const minY = 0;
+    const maxY = containerBounds.height - elementBounds.height + borderFix;
+
+    const outOfBoundsLeft =
+      mouseX < containerLeft ||
+      (lastX === 0 &&
+        mouseDeltaX > 0 &&
+        mouseX < containerLeft + mouseElementOffsetX);
+    const outOfBoundsRight =
+      mouseX > containerRight ||
+      mouseDeltaX + lastX + elementBounds.width - borderFix >
+        containerBounds.width ||
+      (lastX === maxX &&
+        mouseDeltaX < 0 &&
+        mouseX > containerLeft + maxX + mouseElementOffsetX);
+    const outOfBoundsTop =
+      mouseY < containerTop ||
+      (lastY === 0 &&
+        mouseDeltaY > 0 &&
+        mouseY < containerTop + mouseElementOffsetY);
+    const outOfBoundsBottom =
+      mouseY > containerBottom ||
+      mouseDeltaY + lastY + elementBounds.height - borderFix >
+        containerBounds.height ||
+      (lastY === maxY &&
+        mouseDeltaY < 0 &&
+        mouseY > containerTop + maxY + mouseElementOffsetY);
+
+    if (outOfBoundsLeft) x = minX;
+    else if (outOfBoundsRight) x = maxX;
+    else x = mouseDeltaX + lastX;
+
+    if (outOfBoundsTop) y = minY;
+    else if (outOfBoundsBottom) y = maxY;
+    else y = mouseDeltaY + lastY;
+
+    if (x < 0) x = minX;
+    if (y < 0) y = minY;
+
+    // Store the last mouse coordinates.
+    lastMouseX = mouseX;
+    lastMouseY = mouseY;
+
+    if (x === lastX && y === lastY) return;
+
+    // Run the movement events.
+    throttledMovement(x, y);
+    debouncedMovement(x, y);
+
+    // Store the coordinates of the element.
+    lastX = x;
+    lastY = y;
+  };
+  const handleEnd = () => {
+    // Reset the positions.
+    lastX = 0;
+    lastY = 0;
+    lastMouseX = 0;
+    lastMouseY = 0;
+    // Remove the move event.
+    document.removeEventListener("mousemove", handleMove);
+    // Clean itself.
+    document.removeEventListener("mouseup", handleEnd);
+    // Reset the draggable property to its initial state.
+    element.draggable = isDraggable;
+    // Reset the body selection property to a default state.
+    document.body.style.userSelect = "auto";
+  };
+  const handleStart = (e: MouseEvent) => {
+    e.stopPropagation();
+
+    // Disable the drag temporarily.
+    element.draggable = false;
+
+    // Store the difference between the cursor and
+    // the initial coordinates of the element.
+    lastX = element.offsetLeft;
+    lastY = element.offsetTop;
+    // Store the mouse position.
+    lastMouseX = e.pageX;
+    lastMouseY = e.pageY;
+    // Store the relative position between the mouse and the element.
+    mouseElementOffsetX = e.offsetX;
+    mouseElementOffsetY = e.offsetY;
+
+    // Initialize the bounds.
+    containerBounds = container.getBoundingClientRect();
+    containerOffset = getOffset(container);
+    containerTop = containerOffset.top;
+    containerBottom = containerTop + containerBounds.height;
+    containerLeft = containerOffset.left;
+    containerRight = containerLeft + containerBounds.width;
+    elementBounds = element.getBoundingClientRect();
+    borderWidth = window.getComputedStyle(element).borderWidth || "0";
+    borderFix = Number.parseInt(borderWidth) * 2;
+
+    // Listen to the mouse movement.
+    document.addEventListener("mousemove", handleMove);
+    // Listen to the moment when the mouse click is not pressed anymore.
+    document.addEventListener("mouseup", handleEnd);
+    // Limit the mouse selection of the body.
+    document.body.style.userSelect = "none";
+  };
+
+  // Event to listen the init of the movement.
+  element.addEventListener("mousedown", handleStart);
+
+  // Returns a function to clean the event listeners.
+  return () => {
+    element.removeEventListener("mousedown", handleStart);
+    handleEnd();
+  };
+}
+
+/**
+ * Add the grab & resize functionality to a certain element.
+ *
+ * @param element Element to move.
+ * @param onResized Function to execute when the element is resized.
+ *
+ * @return A function which will clean the event handlers when executed.
+ */
+export function addResizementListener(
+  element: HTMLElement,
+  onResized: (x: Position["x"], y: Position["y"]) => void
+): Function {
+  const minWidth = 15;
+  const minHeight = 15;
+
+  const resizeDraggable = document.createElement("div");
+  resizeDraggable.className = "resize-draggable";
+  element.appendChild(resizeDraggable);
+
+  // Container of the resizable element.
+  const container = element.parentElement as HTMLElement;
+  // Store the initial draggable state.
+  const isDraggable = element.draggable;
+  // Init the coordinates.
+  let lastWidth: Size["width"] = 0;
+  let lastHeight: Size["height"] = 0;
+  let lastMouseX: Position["x"] = 0;
+  let lastMouseY: Position["y"] = 0;
+  let mouseElementOffsetX: Position["x"] = 0;
+  let mouseElementOffsetY: Position["y"] = 0;
+  // Init the bounds.
+  let containerBounds = container.getBoundingClientRect();
+  let containerOffset = getOffset(container);
+  let containerTop = containerOffset.top;
+  let containerBottom = containerTop + containerBounds.height;
+  let containerLeft = containerOffset.left;
+  let containerRight = containerLeft + containerBounds.width;
+  let elementOffset = getOffset(element);
+  let elementTop = elementOffset.top;
+  let elementLeft = elementOffset.left;
+  let borderWidth = window.getComputedStyle(element).borderWidth || "0";
+  let borderFix = Number.parseInt(borderWidth);
+
+  // Will run onResized 32ms after its last execution.
+  const debouncedResizement = debounce(
+    32,
+    (width: Size["width"], height: Size["height"]) => onResized(width, height)
+  );
+  // Will run onResized one time max every 16ms.
+  const throttledResizement = throttle(
+    16,
+    (width: Size["width"], height: Size["height"]) => onResized(width, height)
+  );
+
+  const handleResize = (e: MouseEvent) => {
+    // Calculate the new element coordinates.
+    let width = lastWidth + (e.pageX - lastMouseX);
+    let height = lastHeight + (e.pageY - lastMouseY);
+
+    if (width === lastWidth && height === lastHeight) return;
+
+    if (
+      width < lastWidth &&
+      e.pageX > elementLeft + (lastWidth - mouseElementOffsetX)
+    )
+      return;
+
+    if (width < minWidth) {
+      // Minimum value.
+      width = minWidth;
+    } else if (width + elementLeft - borderFix / 2 >= containerRight) {
+      // Limit the size to the container.
+      width = containerRight - elementLeft;
+    }
+    if (height < minHeight) {
+      // Minimum value.
+      height = minHeight;
+    } else if (height + elementTop - borderFix / 2 >= containerBottom) {
+      // Limit the size to the container.
+      height = containerBottom - elementTop;
+    }
+
+    // Run the movement events.
+    throttledResizement(width, height);
+    debouncedResizement(width, height);
+
+    // Store the coordinates of the element.
+    lastWidth = width;
+    lastHeight = height;
+    // Store the last mouse coordinates.
+    lastMouseX = e.pageX;
+    lastMouseY = e.pageY;
+  };
+  const handleEnd = () => {
+    // Reset the positions.
+    lastWidth = 0;
+    lastHeight = 0;
+    lastMouseX = 0;
+    lastMouseY = 0;
+    mouseElementOffsetX = 0;
+    mouseElementOffsetY = 0;
+    // Remove the move event.
+    document.removeEventListener("mousemove", handleResize);
+    // Clean itself.
+    document.removeEventListener("mouseup", handleEnd);
+    // Reset the draggable property to its initial state.
+    element.draggable = isDraggable;
+    // Reset the body selection property to a default state.
+    document.body.style.userSelect = "auto";
+  };
+  const handleStart = (e: MouseEvent) => {
+    e.stopPropagation();
+
+    // Disable the drag temporarily.
+    element.draggable = false;
+
+    // Store the difference between the cursor and
+    // the initial coordinates of the element.
+    const { width, height } = element.getBoundingClientRect();
+    lastWidth = width;
+    lastHeight = height;
+    // Store the mouse position.
+    lastMouseX = e.pageX;
+    lastMouseY = e.pageY;
+    // Store the relative position between the mouse and the element.
+    mouseElementOffsetX = e.offsetX;
+    mouseElementOffsetY = e.offsetY;
+
+    // Initialize the bounds.
+    containerBounds = container.getBoundingClientRect();
+    containerOffset = getOffset(container);
+    containerTop = containerOffset.top;
+    containerBottom = containerTop + containerBounds.height;
+    containerLeft = containerOffset.left;
+    containerRight = containerLeft + containerBounds.width;
+    elementOffset = getOffset(element);
+    elementTop = elementOffset.top;
+    elementLeft = elementOffset.left;
+
+    // Listen to the mouse movement.
+    document.addEventListener("mousemove", handleResize);
+    // Listen to the moment when the mouse click is not pressed anymore.
+    document.addEventListener("mouseup", handleEnd);
+    // Limit the mouse selection of the body.
+    document.body.style.userSelect = "none";
+  };
+
+  // Event to listen the init of the movement.
+  resizeDraggable.addEventListener("mousedown", handleStart);
+
+  // Returns a function to clean the event listeners.
+  return () => {
+    resizeDraggable.remove();
+    handleEnd();
+  };
+}
diff --git a/visual_console_client/src/lib/spec.ts b/visual_console_client/src/lib/spec.ts
index ca86e2f499..ae8ffb02cc 100644
--- a/visual_console_client/src/lib/spec.ts
+++ b/visual_console_client/src/lib/spec.ts
@@ -7,7 +7,8 @@ import {
   decodeBase64,
   humanDate,
   humanTime,
-  replaceMacros
+  replaceMacros,
+  itemMetaDecoder
 } from ".";
 
 describe("function parseIntOr", () => {
@@ -72,14 +73,14 @@ describe("function prefixedCssRules", () => {
 
 describe("function decodeBase64", () => {
   it("should decode the base64 without errors", () => {
-    expect(decodeBase64("SGkgSSdtIGRlY29kZWQ=")).toEqual("Hi I'm decoded");
-    expect(decodeBase64("Rk9PQkFSQkFa")).toEqual("FOOBARBAZ");
-    expect(decodeBase64("eyJpZCI6MSwibmFtZSI6ImZvbyJ9")).toEqual(
+    expect(decodeBase64("SGkgSSdtIGRlY29kZWQ=")).toBe("Hi I'm decoded");
+    expect(decodeBase64("Rk9PQkFSQkFa")).toBe("FOOBARBAZ");
+    expect(decodeBase64("eyJpZCI6MSwibmFtZSI6ImZvbyJ9")).toBe(
       '{"id":1,"name":"foo"}'
     );
     expect(
       decodeBase64("PGRpdj5Cb3ggPHA+UGFyYWdyYXBoPC9wPjxociAvPjwvZGl2Pg==")
-    ).toEqual("<div>Box <p>Paragraph</p><hr /></div>");
+    ).toBe("<div>Box <p>Paragraph</p><hr /></div>");
   });
 });
 
@@ -118,3 +119,46 @@ describe("replaceMacros function", () => {
     expect(replaceMacros(macros, text)).toBe("Lorem foo Ipsum baz");
   });
 });
+
+describe("itemMetaDecoder function", () => {
+  it("should extract a default meta object", () => {
+    expect(
+      itemMetaDecoder({
+        receivedAt: 1
+      })
+    ).toEqual({
+      receivedAt: new Date(1000),
+      error: null,
+      isFromCache: false,
+      isFetching: false,
+      isUpdating: false,
+      editMode: false
+    });
+  });
+
+  it("should extract a valid meta object", () => {
+    expect(
+      itemMetaDecoder({
+        receivedAt: new Date(1000),
+        error: new Error("foo"),
+        editMode: 1
+      })
+    ).toEqual({
+      receivedAt: new Date(1000),
+      error: new Error("foo"),
+      isFromCache: false,
+      isFetching: false,
+      isUpdating: false,
+      editMode: true
+    });
+  });
+
+  it("should fail when a invalid structure is used", () => {
+    expect(() => itemMetaDecoder({})).toThrowError(TypeError);
+    expect(() =>
+      itemMetaDecoder({
+        receivedAt: "foo"
+      })
+    ).toThrowError(TypeError);
+  });
+});
diff --git a/visual_console_client/src/types.ts b/visual_console_client/src/lib/types.ts
similarity index 83%
rename from visual_console_client/src/types.ts
rename to visual_console_client/src/lib/types.ts
index 79dee56e74..97f6cb622d 100644
--- a/visual_console_client/src/types.ts
+++ b/visual_console_client/src/lib/types.ts
@@ -1,7 +1,11 @@
-export interface UnknownObject {
+export interface AnyObject {
   [key: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any
 }
 
+export interface UnknownObject {
+  [key: string]: unknown;
+}
+
 export interface Position {
   x: number;
   y: number;
@@ -45,3 +49,12 @@ export type LinkedVisualConsoleProps = {
   linkedLayoutId: number | null;
   linkedLayoutAgentId: number | null;
 } & LinkedVisualConsolePropsStatus;
+
+export interface ItemMeta {
+  receivedAt: Date;
+  error: Error | null;
+  isFromCache: boolean;
+  isFetching: boolean;
+  isUpdating: boolean;
+  editMode: boolean;
+}
diff --git a/visual_console_client/src/main.css b/visual_console_client/src/main.css
index 427c8895af..c69a486c8f 100644
--- a/visual_console_client/src/main.css
+++ b/visual_console_client/src/main.css
@@ -14,3 +14,21 @@
   align-items: center;
   user-select: text;
 }
+
+.visual-console-item.is-editing {
+  border: 2px dashed #b2b2b2;
+  transform: translateX(-2px) translateY(-2px);
+  cursor: move;
+  user-select: none;
+}
+
+.visual-console-item.is-editing > .resize-draggable {
+  float: right;
+  position: absolute;
+  right: 0;
+  bottom: 0;
+  width: 15px;
+  height: 15px;
+  background: url(./resize-handle.svg);
+  cursor: se-resize;
+}
diff --git a/visual_console_client/src/resize-handle.svg b/visual_console_client/src/resize-handle.svg
new file mode 100644
index 0000000000..b851b85377
--- /dev/null
+++ b/visual_console_client/src/resize-handle.svg
@@ -0,0 +1,24 @@
+<svg version="1.1" id="Capa_1" 
+	xmlns="http://www.w3.org/2000/svg" 
+	xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="15px" height="15px" viewBox="0 0 15 15" enable-background="new 0 0 15 15" xml:space="preserve">
+	<line fill="none" stroke="#B2B2B2" stroke-width="1.5" stroke-miterlimit="10" x1="0.562" y1="36.317" x2="14.231" y2="22.648"/>
+	<line fill="none" stroke="#B2B2B2" stroke-width="1.5" stroke-miterlimit="10" x1="4.971" y1="36.595" x2="14.409" y2="27.155"/>
+	<line fill="none" stroke="#B2B2B2" stroke-width="1.5" stroke-miterlimit="10" x1="10.017" y1="36.433" x2="14.231" y2="32.218"/>
+	<g id="jGEeKn_1_">
+
+		<image overflow="visible" width="46" height="37" id="jGEeKn" xlink:href="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEASABIAAD/7AARRHVja3kAAQAEAAAAHgAA/+4AIUFkb2JlAGTAAAAAAQMA
+EAMCAwYAAAGRAAABswAAAgL/2wCEABALCwsMCxAMDBAXDw0PFxsUEBAUGx8XFxcXFx8eFxoaGhoX
+Hh4jJSclIx4vLzMzLy9AQEBAQEBAQEBAQEBAQEABEQ8PERMRFRISFRQRFBEUGhQWFhQaJhoaHBoa
+JjAjHh4eHiMwKy4nJycuKzU1MDA1NUBAP0BAQEBAQEBAQEBAQP/CABEIACYALwMBIgACEQEDEQH/
+xAB5AAEBAQEBAAAAAAAAAAAAAAAAAQQCBgEBAAAAAAAAAAAAAAAAAAAAABAAAQQDAAAAAAAAAAAA
+AAAAAQAxAgMQMBIRAAEBBgUFAQAAAAAAAAAAAAECABEhQWEDECBxkRIwMYEyEwQSAQAAAAAAAAAA
+AAAAAAAAADD/2gAMAwEAAhEDEQAAAPfAS5zTZTkGPrULZQAAD//aAAgBAgABBQDT/9oACAEDAAEF
+ANP/2gAIAQEAAQUAzJg2SQBC2d0w2bZSvVNc5oMuAuQuAuRp/9oACAECAgY/AB//2gAIAQMCBj8A
+H//aAAgBAQEGPwDE6ZXmAYqtwsJBHI91GlMqnvT+e37QL1kS0b7XBwADrVoQCRXGe5ae5ae5afk9
+H//Z" transform="matrix(1 0 0 1 -46.875 -9.8906)">
+		</image>
+	</g>
+	<line fill="none" stroke="#B2B2B2" stroke-width="1.5" stroke-miterlimit="10" x1="13.483" y1="0.644" x2="0.828" y2="13.301"/>
+	<line fill="none" stroke="#B2B2B2" stroke-width="1.5" stroke-miterlimit="10" x1="13.734" y1="5.141" x2="5.325" y2="13.549"/>
+	<line fill="none" stroke="#B2B2B2" stroke-width="1.5" stroke-miterlimit="10" x1="14.231" y1="9.388" x2="9.806" y2="13.813"/>
+</svg>